import{d as y,e as s,aB as _,c as b,a as r,k as h,V as z,n as B,u as p,aC as D,m as P,r as T,o as g,aD as x,s as C,B as V,_ as k}from"./index-DT-14rcZ.js";const S={class:"sc-table"},w={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(m,{expose:f,emit:v}){const e=m,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 T({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 f({load_Data:l,loadTableData:()=>{l()}}),e.autoLoad&&l(),(a,t)=>(g(),b("div",S,[r("div",w,[r("div",E,[B(p(C),D({data:n.value},a.tableProps,{"empty-text":u.value}),{default:P(()=>[x(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(V),{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)])]))}}),j=k(U,[["__scopeId","data-v-22d5f260"]]);export{j as D};
