import{n as D}from"./notData-926f7286-1782729249161v=1.0.0.js";import{a as N,r as R}from"./index-b309bf9f-1782729249161v=1.0.0.js";import{E as T}from"./eleVendor-5008d1ec-1782729249161v=1.0.0.js";import{l as O,c as V,r as j,af as x,R as o,al as A,O as C}from"./vendor-1e24e3ad-1782729249161v=1.0.0.js";const G=(m,i,l,n=!0)=>{N();const a=O({tableData:[],pageable:{page:1,size:10,count:0},totalParam:{},searchParam:{},baseParam:{},loading:!1}),c=V({get:()=>({page:a.pageable.page,size:a.pageable.size}),set:e=>{}}),r=async e=>{try{a.loading=!0;let t=Object.assign({},a.baseParam,a.searchParam,n?c.value:{});t=R(t),l&&typeof l=="function"&&(t=l(t)),typeof e=="function"&&(t=e(t)),a.totalParam=t;let E=await m({...t}),{data:s,code:g,msg:h}=E;g!==0&&g!==200&&(T.warning(h),a.loading=!1),i&&(s=i(s)),a.tableData=n?Array.isArray(s)?s:s.listData||s.list:s;let{page:p,size:u,total:w}=s;return p=Number(p),u=Number(u),n&&f({count:w||s.count}),a.loading=!1,s}catch(t){a.loading=!1}finally{a.loading=!1}},f=e=>{Object.assign(a.pageable,e)},b=async(e,t)=>{a.pageable.page=1,typeof e=="function"?await r(e):await r(),t&&typeof t=="function"&&t(a.totalParam)},d=async e=>{a.pageable.page=1,a.searchParam={},await r(),e&&typeof e=="function"&&e(a.totalParam)},y=e=>{a.pageable.page=1,a.pageable.size=e,r()},P=e=>{a.pageable.page=e,r()},v=()=>o("div",{class:"table-empty"},[o(A("slot"),{name:"empty"},{default:()=>[o("img",{src:D,alt:"notData"},null),o("div",null,[C("\u6682\u65E0\u6570\u636E")])]})]),z=j(null);return{...x(a),proTableRef:z,handleSizeChange:y,handleCurrentChange:P,getTableList:r,search:b,reset:d,renderEmpty:v,pageParam:c}};export{G as u};
