1 |
- import{d as ne,ag as c,r as _,l as ge,a as t,K as $,L as R,x as me,I as fe,f as g,H as he,aj as K,s as ye,G as B,_ as oe,h as re,aL as we,aQ as xe,o as P,c as J,aZ as be,q as ve,w as A,az as V,v as D,n as I,t as M,P as k,au as _e,F as Pe,j as Se,C as ze,e as Ae,aW as le,aX as ie,an as ke,__tla as Le}from"./index-6d7b82ba.js";import{g as W,_ as Te,__tla as Oe}from"./Form-bee7ccb5.js";import{E as Ce,__tla as je}from"./index-e37504b6.js";import{u as Fe,__tla as $e}from"./useForm-089edf95.js";import{d as Re}from"./download-20922b56.js";let se,ce,de,De=Promise.all([(()=>{try{return Le}catch{}})(),(()=>{try{return Oe}catch{}})(),(()=>{try{return je}catch{}})(),(()=>{try{return $e}catch{}})()]).then(async()=>{let Y,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:m,expose:L}){const u=_();ge(()=>{const a=t(u);m("register",a==null?void 0:a.$parent,u)});const x=_(e.pageSize),f=_(e.currentPage),n=_({}),r=_({}),l=$(()=>{const a={...e};return Object.assign(a,t(r)),a}),b=(a,T)=>{var S;const{columns:O}=t(l);for(const C of T||O)for(const j of a)C.field===j.field?ye(C,j.path,j.value):(S=C.children)!=null&&S.length&&b(a,C.children)},N=_([]),U=a=>{N.value=a};L({setProps:(a={})=>{r.value=Object.assign(t(r),a),n.value=a},setColumn:b,selections:N});const i=$(()=>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},t(l).pagination));R(()=>t(l).pageSize,a=>{x.value=a}),R(()=>t(l).currentPage,a=>{f.value=a}),R(()=>x.value,a=>{m("update:pageSize",a)}),R(()=>f.value,a=>{m("update:currentPage",a)});const v=$(()=>{const a={...o,...e};return delete a.columns,delete a.data,a}),d=()=>{const{selection:a,reserveSelection:T,align:O,headerAlign:S}=t(l);return a?g(B,{type:"selection",reserveSelection:T,align:O,headerAlign:S,width:"50"},null):void 0},w=()=>{const{align:a,headerAlign:T,expand:O}=t(l);return O?g(B,{type:"expand",align:a,headerAlign:T},{default:S=>W(p,"expand",S)}):void 0},E=a=>{const{columns:T,reserveIndex:O,pageSize:S,currentPage:C,align:j,headerAlign:ae,showOverflowTooltip:pe}=t(l);return[w(),d()].concat((a||T).map(s=>{if(s.type==="index")return g(B,{type:"index",index:s.index?s.index:q=>((z,G,Q,X)=>{const H=G+1;return z?Q*(X-1)+H:H})(O,q,S,C),align:s.align||j,headerAlign:s.headerAlign||ae,label:s.label,width:"65px"},null);{const q={...s};return q.children&&delete q.children,g(B,K({showOverflowTooltip:pe,align:j,headerAlign:ae},q,{prop:s.field}),{default:z=>{var G;return s.children&&s.children.length?(Q=>{const{align:X,headerAlign:H,showOverflowTooltip:ue}=t(l);return Q.map(h=>{const Z={...h};return Z.children&&delete Z.children,g(B,K({showOverflowTooltip:ue,align:X,headerAlign:H},Z,{prop:h.field}),{default:F=>{var te;return h.children&&h.children.length?E(h.children):W(p,h.field,F)||((te=h==null?void 0:h.formatter)==null?void 0:te.call(h,F.row,F.column,F.row[h.field],F.$index))||F.row[h.field]},header:W(p,`${h.field}-header`)})})})(s.children):W(p,s.field,z)||((G=s==null?void 0:s.formatter)==null?void 0:G.call(s,z.row,z.column,z.row[s.field],z.$index))||z.row[s.field]},header:()=>W(p,`${s.field}-header`)||s.label})}}))};return()=>me(g("div",null,[g(he,K({ref:u,data:t(l).data,"onSelection-change":U},t(v)),{default:()=>E(),append:()=>W(p,"append")}),t(l).pagination?g(Ce,K({pageSize:x.value,"onUpdate:pageSize":a=>x.value=a,currentPage:f.value,"onUpdate:currentPage":a=>f.value=a,class:"float-right mb-15px mt-15px"},t(i)),null):void 0]),[[fe,t(l).loading]])}}),[["__scopeId","data-v-b4105caf"],["__file","D:/zx/mall-newfeifan-zx-admin/src/components/Table/src/Table.vue"]]),Y={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(),m=e,L=o,u=_(!0),x=$(()=>{let i=we(m.schema);if(m.expand&&m.expandField&&!t(u)){const v=xe(i,d=>d.field===m.expandField);if(v>-1){const d=i.length;i.splice(v+1,d)}}return m.layout==="inline"&&(i=i.concat([{field:"action",formItemProps:{labelWidth:"0px"}}])),i}),{register:f,elFormRef:n,methods:r}=Fe({model:m.model||{}}),l=async()=>{var i;await((i=t(n))==null?void 0:i.validate(async v=>{if(v){const{getFormData:d}=r,w=await d();L("search",w)}}))},b=async()=>{var d;(d=t(n))==null||d.resetFields();const{getFormData:i}=r,v=await i();L("reset",v)},N=$(()=>({textAlign:m.buttomPosition})),U=()=>{var i;(i=t(n))==null||i.resetFields(),u.value=!t(u)};return(i,v)=>{const d=Se,w=ze,E=Te;return P(),J(Pe,null,[g(E,{inline:e.inline,"is-col":e.isCol,"is-custom":!1,"label-width":e.labelWidth,schema:t(x),class:"-mb-15px","hide-required-asterisk":"",onRegister:t(f)},be({action:A(()=>[e.layout==="inline"?(P(),J("div",Y,[e.showSearch?(P(),D(w,{key:0,onClick:l},{default:A(()=>[g(d,{class:"mr-5px",icon:"ep:search"}),I(" "+M(t(p)("common.query")),1)]),_:1})):k("",!0),e.showReset?(P(),D(w,{key:1,onClick:b},{default:A(()=>[g(d,{class:"mr-5px",icon:"ep:refresh"}),I(" "+M(t(p)("common.reset")),1)]),_:1})):k("",!0),e.expand?(P(),D(w,{key:2,text:"",onClick:U},{default:A(()=>[I(M(t(p)(t(u)?"common.shrink":"common.expand"))+" ",1),g(d,{icon:t(u)?"ep:arrow-up":"ep:arrow-down"},null,8,["icon"])]),_:1})):k("",!0),V(i.$slots,"actionMore")])):k("",!0)]),_:2},[ve(Object.keys(i.$slots),a=>({name:a,fn:A(()=>[V(i.$slots,a)])}))]),1032,["inline","is-col","label-width","schema","onRegister"]),e.layout==="bottom"?(P(),J("div",{key:0,style:_e(t(N))},[e.showSearch?(P(),D(w,{key:0,type:"primary",onClick:l},{default:A(()=>[g(d,{class:"mr-5px",icon:"ep:search"}),I(" "+M(t(p)("common.query")),1)]),_:1})):k("",!0),e.showReset?(P(),D(w,{key:1,onClick:b},{default:A(()=>[g(d,{class:"mr-5px",icon:"ep:refresh-right"}),I(" "+M(t(p)("common.reset")),1)]),_:1})):k("",!0),e.expand?(P(),D(w,{key:2,text:"",onClick:U},{default:A(()=>[I(M(t(p)(t(u)?"common.shrink":"common.expand"))+" ",1),g(d,{icon:t(u)?"ep:arrow-up":"ep:arrow-down"},null,8,["icon"])]),_:1})):k("",!0),V(i.$slots,"actionMore")],4)):k("",!0)],64)}}}),se=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=$(()=>({...o.params,pageSize:o.pageSize,pageNo:o.currentPage}));R(()=>o.currentPage,()=>{f.getList()}),R(()=>o.pageSize,()=>{o.currentPage===1||(o.currentPage=1),f.getList()});const m=_(),L=_(),u=async()=>{await ke();const n=t(m);return n||console.error("The table is not registered. Please use the register method to register"),n},x=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(t(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 b=await u();!r||b!=null&&b.selections.length?l?ie.confirm(y("common.delMessage"),y("common.confirmTitle"),{confirmButtonText:y("common.ok"),cancelButtonText:y("common.cancel"),type:"warning"}).then(async()=>{await x(n)}):await x(n):le.warning(y("common.delNoData"))},exportList:async n=>{o.exportLoading=!0,ie.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,t(p)));r&&Re.excel(r,n)}).finally(()=>{o.exportLoading=!1})}};return e!=null&&e.props&&f.setProps(e.props),{register:(n,r)=>{m.value=n,L.value=r},elTableRef:L,tableObject:o,methods:f,tableMethods:f}}});export{se as _,De as __tla,ce as a,de as u};
|