1 |
- import{d as ne,as as c,r as _,b as me,a,e as j,w as $,k as ge,Z as fe,f as m,Y as he,m as J,N as ye,X as W,_ as oe,P as re,cT as we,b4 as be,o as P,c as G,aY as xe,R as ve,A,aO as K,C as D,D as M,E as N,a3 as z,aH as _e,F as Pe,Q as Se,J as ke,x as Ae,bk as le,bl as se,n as ze,__tla as Le}from"./index-286756b9.js";import{g as B,_ as Te,__tla as Oe}from"./Form-75bb2af4.js";import{E as Ce,__tla as Fe}from"./index-fb47c94c.js";import{u as Re,__tla as je}from"./useForm-2c8a5436.js";import{d as $e}from"./download-20922b56.js";let ie,ce,de,De=Promise.all([(()=>{try{return Le}catch{}})(),(()=>{try{return Oe}catch{}})(),(()=>{try{return Fe}catch{}})(),(()=>{try{return je}catch{}})()]).then(async()=>{let V,ee,y;ce=oe(ne({name:"Table",props:{pageSize:c.number.def(10),currentPage:c.number.def(1),selection:c.bool.def(!1),showOverflowTooltip:c.bool.def(!0),columns:{type:Array,default:()=>[]},expand:c.bool.def(!1),pagination:{type:Object,default:()=>{}},reserveSelection:c.bool.def(!1),loading:c.bool.def(!1),reserveIndex:c.bool.def(!1),align:c.string.validate(e=>["left","center","right"].includes(e)).def("center"),headerAlign:c.string.validate(e=>["left","center","right"].includes(e)).def("center"),data:{type:Array,default:()=>[]}},emits:["update:pageSize","update:currentPage","register"],setup(e,{attrs:o,slots:p,emit:g,expose:L}){const u=_();me(()=>{const t=a(u);g("register",t==null?void 0:t.$parent,u)});const b=_(e.pageSize),f=_(e.currentPage),n=_({}),r=_({}),l=j(()=>{const t={...e};return Object.assign(t,a(r)),t}),x=(t,T)=>{var S;const{columns:O}=a(l);for(const C of T||O)for(const F of t)C.field===F.field?ye(C,F.path,F.value):(S=C.children)!=null&&S.length&&x(t,C.children)},q=_([]),E=t=>{q.value=t};L({setProps:(t={})=>{r.value=Object.assign(a(r),t),n.value=t},setColumn:x,selections:q});const s=j(()=>Object.assign({small:!1,background:!0,pagerCount:document.body.clientWidth<992?5:7,layout:"total, sizes, prev, pager, next, jumper",pageSizes:[10,20,30,50,100],disabled:!1,hideOnSinglePage:!1,total:10},a(l).pagination));$(()=>a(l).pageSize,t=>{b.value=t}),$(()=>a(l).currentPage,t=>{f.value=t}),$(()=>b.value,t=>{g("update:pageSize",t)}),$(()=>f.value,t=>{g("update:currentPage",t)});const v=j(()=>{const t={...o,...e};return delete t.columns,delete t.data,t}),d=()=>{const{selection:t,reserveSelection:T,align:O,headerAlign:S}=a(l);return t?m(W,{type:"selection",reserveSelection:T,align:O,headerAlign:S,width:"50"},null):void 0},w=()=>{const{align:t,headerAlign:T,expand:O}=a(l);return O?m(W,{type:"expand",align:t,headerAlign:T},{default:S=>B(p,"expand",S)}):void 0},U=t=>{const{columns:T,reserveIndex:O,pageSize:S,currentPage:C,align:F,headerAlign:te,showOverflowTooltip:pe}=a(l);return[w(),d()].concat((t||T).map(i=>{if(i.type==="index")return m(W,{type:"index",index:i.index?i.index:I=>((k,Y,Q,X)=>{const H=Y+1;return k?Q*(X-1)+H:H})(O,I,S,C),align:i.align||F,headerAlign:i.headerAlign||te,label:i.label,width:"65px"},null);{const I={...i};return I.children&&delete I.children,m(W,J({showOverflowTooltip:pe,align:F,headerAlign:te},I,{prop:i.field}),{default:k=>{var Y;return i.children&&i.children.length?(Q=>{const{align:X,headerAlign:H,showOverflowTooltip:ue}=a(l);return Q.map(h=>{const Z={...h};return Z.children&&delete Z.children,m(W,J({showOverflowTooltip:ue,align:X,headerAlign:H},Z,{prop:h.field}),{default:R=>{var ae;return h.children&&h.children.length?U(h.children):B(p,h.field,R)||((ae=h==null?void 0:h.formatter)==null?void 0:ae.call(h,R.row,R.column,R.row[h.field],R.$index))||R.row[h.field]},header:B(p,`${h.field}-header`)})})})(i.children):B(p,i.field,k)||((Y=i==null?void 0:i.formatter)==null?void 0:Y.call(i,k.row,k.column,k.row[i.field],k.$index))||k.row[i.field]},header:()=>B(p,`${i.field}-header`)||i.label})}}))};return()=>ge(m("div",null,[m(he,J({ref:u,data:a(l).data,"onSelection-change":E},a(v)),{default:()=>U(),append:()=>B(p,"append")}),a(l).pagination?m(Ce,J({pageSize:b.value,"onUpdate:pageSize":t=>b.value=t,currentPage:f.value,"onUpdate:currentPage":t=>f.value=t,class:"float-right mb-15px mt-15px"},a(s)),null):void 0]),[[fe,a(l).loading]])}}),[["__scopeId","data-v-b4105caf"],["__file","D:/zx/mall-newfeifan-zx-admin/src/components/Table/src/Table.vue"]]),V={key:0},ee=ne({name:"Search",__name:"Search",props:{schema:{type:Array,default:()=>[]},isCol:c.bool.def(!1),labelWidth:c.oneOfType([String,Number]).def("auto"),layout:c.string.validate(e=>["inline","bottom"].includes(e)).def("inline"),buttomPosition:c.string.validate(e=>["left","center","right"].includes(e)).def("center"),showSearch:c.bool.def(!0),showReset:c.bool.def(!0),expand:c.bool.def(!1),expandField:c.string.def(""),inline:c.bool.def(!0),model:{type:Object,default:()=>({})}},emits:["search","reset"],setup(e,{emit:o}){const{t:p}=re(),g=e,L=o,u=_(!0),b=j(()=>{let s=we(g.schema);if(g.expand&&g.expandField&&!a(u)){const v=be(s,d=>d.field===g.expandField);if(v>-1){const d=s.length;s.splice(v+1,d)}}return g.layout==="inline"&&(s=s.concat([{field:"action",formItemProps:{labelWidth:"0px"}}])),s}),{register:f,elFormRef:n,methods:r}=Re({model:g.model||{}}),l=async()=>{var s;await((s=a(n))==null?void 0:s.validate(async v=>{if(v){const{getFormData:d}=r,w=await d();L("search",w)}}))},x=async()=>{var d;(d=a(n))==null||d.resetFields();const{getFormData:s}=r,v=await s();L("reset",v)},q=j(()=>({textAlign:g.buttomPosition})),E=()=>{var s;(s=a(n))==null||s.resetFields(),u.value=!a(u)};return(s,v)=>{const d=Se,w=ke,U=Te;return P(),G(Pe,null,[m(U,{inline:e.inline,"is-col":e.isCol,"is-custom":!1,"label-width":e.labelWidth,schema:a(b),class:"-mb-15px","hide-required-asterisk":"",onRegister:a(f)},xe({action:A(()=>[e.layout==="inline"?(P(),G("div",V,[e.showSearch?(P(),D(w,{key:0,onClick:l},{default:A(()=>[m(d,{class:"mr-5px",icon:"ep:search"}),M(" "+N(a(p)("common.query")),1)]),_:1})):z("",!0),e.showReset?(P(),D(w,{key:1,onClick:x},{default:A(()=>[m(d,{class:"mr-5px",icon:"ep:refresh"}),M(" "+N(a(p)("common.reset")),1)]),_:1})):z("",!0),e.expand?(P(),D(w,{key:2,text:"",onClick:E},{default:A(()=>[M(N(a(p)(a(u)?"common.shrink":"common.expand"))+" ",1),m(d,{icon:a(u)?"ep:arrow-up":"ep:arrow-down"},null,8,["icon"])]),_:1})):z("",!0),K(s.$slots,"actionMore")])):z("",!0)]),_:2},[ve(Object.keys(s.$slots),t=>({name:t,fn:A(()=>[K(s.$slots,t)])}))]),1032,["inline","is-col","label-width","schema","onRegister"]),e.layout==="bottom"?(P(),G("div",{key:0,style:_e(a(q))},[e.showSearch?(P(),D(w,{key:0,type:"primary",onClick:l},{default:A(()=>[m(d,{class:"mr-5px",icon:"ep:search"}),M(" "+N(a(p)("common.query")),1)]),_:1})):z("",!0),e.showReset?(P(),D(w,{key:1,onClick:x},{default:A(()=>[m(d,{class:"mr-5px",icon:"ep:refresh-right"}),M(" "+N(a(p)("common.reset")),1)]),_:1})):z("",!0),e.expand?(P(),D(w,{key:2,text:"",onClick:E},{default:A(()=>[M(N(a(p)(a(u)?"common.shrink":"common.expand"))+" ",1),m(d,{icon:a(u)?"ep:arrow-up":"ep:arrow-down"},null,8,["icon"])]),_:1})):z("",!0),K(s.$slots,"actionMore")],4)):z("",!0)],64)}}}),ie=oe(ee,[["__file","D:/zx/mall-newfeifan-zx-admin/src/components/Search/src/Search.vue"]]),{t:y}=re(),de=e=>{const o=Ae({pageSize:10,currentPage:1,total:10,tableList:[],params:{...(e==null?void 0:e.defaultParams)||{}},loading:!0,exportLoading:!1,currentRow:null}),p=j(()=>({...o.params,pageSize:o.pageSize,pageNo:o.currentPage}));$(()=>o.currentPage,()=>{f.getList()}),$(()=>o.pageSize,()=>{o.currentPage===1||(o.currentPage=1),f.getList()});const g=_(),L=_(),u=async()=>{await ze();const n=a(g);return n||console.error("The table is not registered. Please use the register method to register"),n},b=async n=>{let r=1;n instanceof Array?(r=n.length,await Promise.all(n.map(async l=>{await((e==null?void 0:e.delListApi)&&(e==null?void 0:e.delListApi(l)))}))):await((e==null?void 0:e.delListApi)&&(e==null?void 0:e.delListApi(n))),le.success(y("common.delSuccess")),o.currentPage=(o.total%o.pageSize===r||o.pageSize===1)&&o.currentPage>1?o.currentPage-1:o.currentPage,await f.getList()},f={getList:async()=>{o.loading=!0;const n=await(e==null?void 0:e.getListApi(a(p)).finally(()=>{o.loading=!1}));n&&(o.tableList=n.list,o.total=n.total??0)},setProps:async(n={})=>{const r=await u();r==null||r.setProps(n)},setColumn:async n=>{const r=await u();r==null||r.setColumn(n)},getSelections:async()=>{const n=await u();return(n==null?void 0:n.selections)||[]},setSearchParams:n=>{o.params=Object.assign(o.params,{pageSize:o.pageSize,pageNo:1,...n}),o.currentPage!==1?o.currentPage=1:f.getList()},delList:async(n,r,l=!0)=>{const x=await u();!r||x!=null&&x.selections.length?l?se.confirm(y("common.delMessage"),y("common.confirmTitle"),{confirmButtonText:y("common.ok"),cancelButtonText:y("common.cancel"),type:"warning"}).then(async()=>{await b(n)}):await b(n):le.warning(y("common.delNoData"))},exportList:async n=>{o.exportLoading=!0,se.confirm(y("common.exportMessage"),y("common.confirmTitle"),{confirmButtonText:y("common.ok"),cancelButtonText:y("common.cancel"),type:"warning"}).then(async()=>{var l;const r=await((l=e==null?void 0:e.exportListApi)==null?void 0:l.call(e,a(p)));r&&$e.excel(r,n)}).finally(()=>{o.exportLoading=!1})}};return e!=null&&e.props&&f.setProps(e.props),{register:(n,r)=>{g.value=n,L.value=r},elTableRef:L,tableObject:o,methods:f,tableMethods:f}}});export{ie as _,De as __tla,ce as a,de as u};
|