1 |
- import{d as ae,af as c,r as _,k as pe,a,J as R,K as $,v as ue,H as ge,f as g,G as me,ai as H,s as fe,D as I,h as ne,aK as he,aR as ye,o as P,c as Q,aN as we,n as xe,w as A,ay as V,q as B,m as M,t as N,O as z,at as be,F as ve,_ as _e,B as Pe,e as Se,aX as oe,aY as le,am as ke,__tla as Ae}from"./index-73e02845.js";import{g as q,_ as ze,__tla as Le}from"./Form-b293d17b.js";import{E as Oe,__tla as Te}from"./index-c1a24aa4.js";import{_ as Ce}from"./_plugin-vue_export-helper-1b428a4d.js";import{u as je,__tla as Fe}from"./useForm-e5bbfc1f.js";import{d as Re}from"./download-20922b56.js";let re,ie,se,$e=Promise.all([(()=>{try{return Ae}catch{}})(),(()=>{try{return Le}catch{}})(),(()=>{try{return Te}catch{}})(),(()=>{try{return Fe}catch{}})()]).then(async()=>{let Z,y;ie=Ce(ae({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=_();pe(()=>{const t=a(u);m("register",t==null?void 0:t.$parent,u)});const x=_(e.pageSize),f=_(e.currentPage),n=_({}),l=_({}),r=R(()=>{const t={...e};return Object.assign(t,a(l)),t}),b=(t,O)=>{var S;const{columns:T}=a(r);for(const C of O||T)for(const j of t)C.field===j.field?fe(C,j.path,j.value):(S=C.children)!=null&&S.length&&b(t,C.children)},W=_([]),K=t=>{W.value=t};L({setProps:(t={})=>{l.value=Object.assign(a(l),t),n.value=t},setColumn:b,selections:W});const i=R(()=>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(r).pagination));$(()=>a(r).pageSize,t=>{x.value=t}),$(()=>a(r).currentPage,t=>{f.value=t}),$(()=>x.value,t=>{m("update:pageSize",t)}),$(()=>f.value,t=>{m("update:currentPage",t)});const v=R(()=>{const t={...o,...e};return delete t.columns,delete t.data,t}),d=()=>{const{selection:t,reserveSelection:O,align:T,headerAlign:S}=a(r);return t?g(I,{type:"selection",reserveSelection:O,align:T,headerAlign:S,width:"50"},null):void 0},w=()=>{const{align:t,headerAlign:O,expand:T}=a(r);return T?g(I,{type:"expand",align:t,headerAlign:O},{default:S=>q(p,"expand",S)}):void 0},U=t=>{const{columns:O,reserveIndex:T,pageSize:S,currentPage:C,align:j,headerAlign:ee,showOverflowTooltip:ce}=a(r);return[w(),d()].concat((t||O).map(s=>{if(s.type==="index")return g(I,{type:"index",index:s.index?s.index:D=>((k,E,J,X)=>{const G=E+1;return k?J*(X-1)+G:G})(T,D,S,C),align:s.align||j,headerAlign:s.headerAlign||ee,label:s.label,width:"65px"},null);{const D={...s};return D.children&&delete D.children,g(I,H({showOverflowTooltip:ce,align:j,headerAlign:ee},D,{prop:s.field}),{default:k=>{var E;return s.children&&s.children.length?(J=>{const{align:X,headerAlign:G,showOverflowTooltip:de}=a(r);return J.map(h=>{const Y={...h};return Y.children&&delete Y.children,g(I,H({showOverflowTooltip:de,align:X,headerAlign:G},Y,{prop:h.field}),{default:F=>{var te;return h.children&&h.children.length?U(h.children):q(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:q(p,`${h.field}-header`)})})})(s.children):q(p,s.field,k)||((E=s==null?void 0:s.formatter)==null?void 0:E.call(s,k.row,k.column,k.row[s.field],k.$index))||k.row[s.field]},header:()=>q(p,`${s.field}-header`)||s.label})}}))};return()=>ue(g("div",null,[g(me,H({ref:u,data:a(r).data,"onSelection-change":K},a(v)),{default:()=>U(),append:()=>q(p,"append")}),a(r).pagination?g(Oe,H({pageSize:x.value,"onUpdate:pageSize":t=>x.value=t,currentPage:f.value,"onUpdate:currentPage":t=>f.value=t,class:"float-right mb-15px mt-15px"},a(i)),null):void 0]),[[ge,a(r).loading]])}}),[["__scopeId","data-v-ade6697d"]]),Z={key:0},re=ae({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}=ne(),m=e,L=o,u=_(!0),x=R(()=>{let i=he(m.schema);if(m.expand&&m.expandField&&!a(u)){const v=ye(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:l}=je({model:m.model||{}}),r=async()=>{var i;await((i=a(n))==null?void 0:i.validate(async v=>{if(v){const{getFormData:d}=l,w=await d();L("search",w)}}))},b=async()=>{var d;(d=a(n))==null||d.resetFields();const{getFormData:i}=l,v=await i();L("reset",v)},W=R(()=>({textAlign:m.buttomPosition})),K=()=>{var i;(i=a(n))==null||i.resetFields(),u.value=!a(u)};return(i,v)=>{const d=_e,w=Pe,U=ze;return P(),Q(ve,null,[g(U,{inline:e.inline,"is-col":e.isCol,"is-custom":!1,"label-width":e.labelWidth,schema:a(x),class:"-mb-15px","hide-required-asterisk":"",onRegister:a(f)},we({action:A(()=>[e.layout==="inline"?(P(),Q("div",Z,[e.showSearch?(P(),B(w,{key:0,onClick:r},{default:A(()=>[g(d,{class:"mr-5px",icon:"ep:search"}),M(" "+N(a(p)("common.query")),1)]),_:1})):z("",!0),e.showReset?(P(),B(w,{key:1,onClick:b},{default:A(()=>[g(d,{class:"mr-5px",icon:"ep:refresh"}),M(" "+N(a(p)("common.reset")),1)]),_:1})):z("",!0),e.expand?(P(),B(w,{key:2,text:"",onClick:K},{default:A(()=>[M(N(a(p)(a(u)?"common.shrink":"common.expand"))+" ",1),g(d,{icon:a(u)?"ep:arrow-up":"ep:arrow-down"},null,8,["icon"])]),_:1})):z("",!0),V(i.$slots,"actionMore")])):z("",!0)]),_:2},[xe(Object.keys(i.$slots),t=>({name:t,fn:A(()=>[V(i.$slots,t)])}))]),1032,["inline","is-col","label-width","schema","onRegister"]),e.layout==="bottom"?(P(),Q("div",{key:0,style:be(a(W))},[e.showSearch?(P(),B(w,{key:0,type:"primary",onClick:r},{default:A(()=>[g(d,{class:"mr-5px",icon:"ep:search"}),M(" "+N(a(p)("common.query")),1)]),_:1})):z("",!0),e.showReset?(P(),B(w,{key:1,onClick:b},{default:A(()=>[g(d,{class:"mr-5px",icon:"ep:refresh-right"}),M(" "+N(a(p)("common.reset")),1)]),_:1})):z("",!0),e.expand?(P(),B(w,{key:2,text:"",onClick:K},{default:A(()=>[M(N(a(p)(a(u)?"common.shrink":"common.expand"))+" ",1),g(d,{icon:a(u)?"ep:arrow-up":"ep:arrow-down"},null,8,["icon"])]),_:1})):z("",!0),V(i.$slots,"actionMore")],4)):z("",!0)],64)}}}),{t:y}=ne(),se=e=>{const o=Se({pageSize:10,currentPage:1,total:10,tableList:[],params:{...(e==null?void 0:e.defaultParams)||{}},loading:!0,exportLoading:!1,currentRow:null}),p=R(()=>({...o.params,pageSize:o.pageSize,pageNo:o.currentPage}));$(()=>o.currentPage,()=>{f.getList()}),$(()=>o.pageSize,()=>{o.currentPage===1||(o.currentPage=1),f.getList()});const m=_(),L=_(),u=async()=>(await ke(),a(m)),x=async n=>{let l=1;n instanceof Array?(l=n.length,await Promise.all(n.map(async r=>{await((e==null?void 0:e.delListApi)&&(e==null?void 0:e.delListApi(r)))}))):await((e==null?void 0:e.delListApi)&&(e==null?void 0:e.delListApi(n))),oe.success(y("common.delSuccess")),o.currentPage=(o.total%o.pageSize===l||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 l=await u();l==null||l.setProps(n)},setColumn:async n=>{const l=await u();l==null||l.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,l,r=!0)=>{const b=await u();!l||b!=null&&b.selections.length?r?le.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):oe.warning(y("common.delNoData"))},exportList:async n=>{o.exportLoading=!0,le.confirm(y("common.exportMessage"),y("common.confirmTitle"),{confirmButtonText:y("common.ok"),cancelButtonText:y("common.cancel"),type:"warning"}).then(async()=>{var r;const l=await((r=e==null?void 0:e.exportListApi)==null?void 0:r.call(e,a(p)));l&&Re.excel(l,n)}).finally(()=>{o.exportLoading=!1})}};return e!=null&&e.props&&f.setProps(e.props),{register:(n,l)=>{m.value=n,L.value=l},elTableRef:L,tableObject:o,methods:f,tableMethods:f}}});export{re as _,$e as __tla,ie as a,se as u};
|