import{d as y,r as s,au as _,c as b,a as r,j as h,k as z,e as D,u as p,av as P,w as T,n as x,o as g,aw as k,D as w,J as B,_ as C}from"./index-rw6aq_SD.js";const S={class:"sc-table"},V={class:"pagination-wrap"},E={class:"table-main"},U=y({__name:"Data_Table",props:{modelValue:{default:{}},query:{default:{}},loadUrl:{},autoLoad:{type:Boolean,default:!0},method:{default:"post"},tableProps:{default:{}},hasPagination:{type:Boolean,default:!0}},emits:["changeTotal"],setup(f,{expose:m,emit:v}){const e=f,i=v,o=s({page:1,pageSize:10});_(()=>{Object.keys(e==null?void 0:e.modelValue).length&&(o.value=e==null?void 0:e.modelValue)});const c=s(0),n=s([]),u=s("暂无数据"),l=async()=>{var t;u.value="正在等待后台返回数据，请稍后",i("changeTotal",null),n.value=[];const a=await x({url:e.loadUrl,data:{...o.value,...e.query},method:e.method});console.log(a.data),n.value=a.data,c.value=a.total??10,i("changeTotal",a.total??((t=a==null?void 0:a.data)==null?void 0:t.length)),u.value="暂无数据"};return m({load_Data:l,loadTableData:()=>{l()}}),e.autoLoad&&l(),(a,t)=>(g(),b("div",S,[r("div",V,[r("div",E,[D(p(w),P({data:n.value},a.tableProps,{"empty-text":u.value}),{default:T(()=>[k(a.$slots,"default",{},void 0,!0)]),_:3},16,["data","empty-text"])]),t[2]||(t[2]=r("br",null,null,-1)),a.hasPagination?(g(),h(p(B),{key:0,style:{"justify-content":"end"},"page-sizes":[10,20,30,40],layout:"prev, pager, next, sizes","current-page":o.value.page,"onUpdate:currentPage":t[0]||(t[0]=d=>o.value.page=d),"current-pageModifiers":{sync:!0},"page-size":o.value.pageSize,"onUpdate:pageSize":t[1]||(t[1]=d=>o.value.pageSize=d),"page-sizeModifiers":{sync:!0},total:c.value,onSizeChange:l,onCurrentChange:l},null,8,["current-page","page-size","total"])):z("",!0)])]))}}),N=C(U,[["__scopeId","data-v-22d5f260"]]);export{N as D};
