| 1 |
- import{O as e,a as t,k as a,m as l,g as o,x as i,A as n,t as s,z as r,q as p}from"./element-plus.Coxisi3K.js";import{h as d,i as u,X as m,Y as c,Z as y,y as _,z as v,p as b,E as f,Q as h,m as w}from"./index.Zdt67uUk.js";import{_ as j,a as k,P as g}from"./PageContent.JEZkrk7m.js";import{P as q}from"./wechat.BHGV-KbI.js";import{E as C}from"./sql.CxG21rpJ.js";import{u as x}from"./vue-router.yxIMtaxH.js";import{M as I,aU as D,aD as R,a_ as z,bL as E,bk as A,aL as V,u as Q,v as U,F as T,aX as P,I as F,bJ as L,H as O,bb as S,s as X,t as H,q as N,aS as $}from"./@vue.DbmRtknU.js";import"./lodash-es.DaM9m3L-.js";import"./async-validator.j0i5Y79Y.js";import"./@popperjs.DxtSUbXb.js";import"./@ctrl.BEgk5vdO.js";import"./dayjs.DCWbrgJ0.js";import"./memoize-one.BAtLgO95.js";import"./normalize-wheel-es.TzhA1irr.js";import"./@floating-ui.8vigAAFV.js";import"./pinia.BlfmsheH.js";import"./@vueuse.Dnsd2JKX.js";import"./vue-i18n.DXLOBfKS.js";import"./@intlify.DPMNdUn_.js";import"./nprogress.BTjJXJ-u.js";import"./codemirror.CYSLATvI.js";import"./diff-match-patch.DkK4wJpa.js";import"./vue-web-terminal.D-rog7dz.js";import"./vue.MGxsMDTR.js";/* empty css */import"./axios.Da-QW0H8.js";import"./qs.BQjOrGHM.js";import"./side-channel.4q28KFJj.js";import"./es-errors.DTEWvbA_.js";import"./object-inspect.DvQZIv3_.js";import"./side-channel-list.Do0-XmF5.js";import"./side-channel-map.DNHQ53lO.js";import"./get-intrinsic.Bbe5x-9b.js";import"./es-object-atoms.CyiuHMUS.js";import"./math-intrinsics.pM-JTNwN.js";import"./gopd.BudZp56J.js";import"./es-define-property.F0aoeP8o.js";import"./has-symbols.BcO-SUVM.js";import"./get-proto.Cb_fpw-j.js";import"./dunder-proto.WEH3rgQR.js";import"./call-bind-apply-helpers.DJjIjCF_.js";import"./function-bind.DrnB-baK.js";import"./hasown.BXcyoiLU.js";import"./call-bound.22gFUC2Q.js";import"./side-channel-weakmap.DpSeWE6i.js";import"./pinia-plugin-persistedstate.COWkwNh5.js";import"./exceljs.DLSZe_6I.js";const J=["element-loading-text"],M={class:"category-tabs",style:{"margin-bottom":"16px",padding:"10px 16px",background:"#fff","border-radius":"8px"}},Z={class:"data-table__toolbar--right"},B={class:"data-table__content"},G={class:"dialog-footer"},K={key:1,class:"employee-records-section"},W={style:{"margin-bottom":"16px"}},Y=I({name:"Quota",inheritAttrs:!1,__name:"index",setup(I){const Y=x(),{searchRef:ee,contentRef:te,handleQueryClick:ae,handleResetClick:le,refreshList:oe}=_(),ie=D(),{pageLoading:ne,loadingText:se}=v(),re=N(()=>Y.query.employee_id),pe=N(()=>Y.query.institution_id),de=N(()=>Y.query.enterprise_id),ue=[{key:"quota",label:"额度管理"},{key:"employee",label:"员工发放记录"}],me=D(Y.query.tab||"quota"),ce=D(""),ye=D(""),_e=D([]),ve=D(!1),be=D(!1),fe=D(""),he=D("");async function we(){var e,t,a;if(ce.value){ve.value=!0;try{const l=de.value||(null==(e=b().getCurrentEnterprise)?void 0:e.enterprise_id)||"",o=await f.detailEmployee(l,ce.value),i=null==(t=null==o?void 0:o.data)?void 0:t.data;if(i){const e=(null==(a=(await h.employeeRecords(ce.value,{institution_id:ye.value||void 0})).data.data)?void 0:a.items)||[];_e.value=[{employee_id:i.employee_id,name:i.employee_name,employee_no:i.employee_no,department_name:"",employee_mobile:i.employee_mobile,couponCount:e.length}]}else _e.value=[],p.warning("未找到该员工")}catch(l){_e.value=[]}finally{ve.value=!1}}}R(()=>{});const je=$({permPrefix:"module_payment:quota",colon:!0,isExpandable:!0,showNumber:3,form:{labelWidth:"auto"},formItems:[{prop:"employee_id",label:"员工ID",type:"input",attrs:{placeholder:"请输入员工ID",clearable:!0}},{prop:"institution_id",label:"制度ID",type:"input",attrs:{placeholder:"请输入制度ID",clearable:!0}},{prop:"status",label:"状态",type:"select",options:[{label:"全部",value:""},{label:"正常",value:"QUOTA_ACTIVE"},{label:"冻结",value:"QUOTA_FROZEN"},{label:"已用完",value:"QUOTA_EXHAUSTED"},{label:"已过期",value:"QUOTA_EXPIRED"}],attrs:{placeholder:"请选择状态",clearable:!0,style:{width:"167.5px"}}}]}),ke=$([{prop:"selection",label:"选择框",show:!1},{prop:"index",label:"序号",show:!0},{prop:"quota_id",label:"额度ID",show:!0},{prop:"employee_id",label:"员工ID",show:!0},{prop:"institution_id",label:"制度ID",show:!0},{prop:"quota_type",label:"额度类型",show:!0},{prop:"total_amount",label:"总金额",show:!0},{prop:"available_amount",label:"可用金额",show:!0},{prop:"status",label:"状态",show:!0},{prop:"created_time",label:"创建时间",show:!0},{prop:"operation",label:"操作",show:!0}]),ge=$({permPrefix:"module_payment:quota",pk:"quota_id",cols:ke,hideColumnFilter:!1,toolbar:[],defaultToolbar:["refresh","filter"],pagination:!0,initialParams:N(()=>({employee_id:re.value,institution_id:pe.value})),indexAction:async e=>{var t,a;const l={page_no:e.page_no,page_size:e.page_size};e.employee_id&&(l.employee_id=e.employee_id),e.institution_id&&(l.institution_id=e.institution_id),e.status&&(l.status=e.status);const o=await h.listQuota(l);return{list:(null==(t=o.data.data)?void 0:t.items)||[],total:(null==(a=o.data.data)?void 0:a.total)||0}}}),qe=$({title:"",visible:!1,type:"create"}),Ce=D();function xe(e,t){qe.type=e,Ce.value=t,qe.title="create"===e?"发放额度":"update"===e?"编辑额度":"额度详情",qe.visible=!0}async function Ie(){qe.visible=!1}function De(){var e;null==(e=ie.value)||e.submitForm()}function Re(){qe.visible=!1,oe()}function ze(e){if(!e)return"-";const t=w.find(t=>t.value===e);return t?t.label:e}return(p,_)=>{const v=t,b=i,f=l,h=o,w=a,x=s,I=n,D=r,R=z("hasPerm"),N=e;return E((V(),Q("div",{class:"app-container","element-loading-text":A(se)},[U("div",M,[(V(),Q(T,null,P(ue,e=>F(v,{key:e.key,type:me.value===e.key?"primary":"default",onClick:t=>{return a=e.key,void(me.value=a);var a}},{default:L(()=>[O(S(e.label),1)]),_:2},1032,["type","onClick"])),64))]),"quota"===me.value?(V(),Q(T,{key:0},[F(q,{ref_key:"searchRef",ref:ee,"search-config":je,onQueryClick:A(ae),onResetClick:A(le)},null,8,["search-config","onQueryClick","onResetClick"]),F(g,{ref_key:"contentRef",ref:te,"content-config":ge},{toolbar:L(({toolbarRight:e,onToolbar:t,removeIds:a,cols:l})=>[F(j,{"remove-ids":a,"perm-create":["module_payment:quota:create"],onAdd:_[0]||(_[0]=e=>xe("create"))},null,8,["remove-ids"]),U("div",Z,[F(k,{buttons:e,cols:l,"on-toolbar":t},null,8,["buttons","cols","on-toolbar"])])]),table:L(({data:e,loading:t,tableRef:a,onSelectionChange:l})=>[U("div",B,[E((V(),X(w,{ref:a,data:e,height:"100%",border:"",onSelectionChange:l},{empty:L(()=>[F(b,{"image-size":80,description:"暂无数据"})]),default:L(()=>{var e,t,a,l,o,i,n,s,r,p;return[(null==(e=ke.find(e=>"selection"===e.prop))?void 0:e.show)?(V(),X(f,{key:0,type:"selection","min-width":"55",align:"center"})):H("",!0),(null==(t=ke.find(e=>"quota_id"===e.prop))?void 0:t.show)?(V(),X(f,{key:"quota_id",label:"额度ID",prop:"quota_id","min-width":"150","show-overflow-tooltip":""})):H("",!0),(null==(a=ke.find(e=>"employee_id"===e.prop))?void 0:a.show)?(V(),X(f,{key:"employee_id",label:"员工ID",prop:"employee_id","min-width":"150","show-overflow-tooltip":""})):H("",!0),(null==(l=ke.find(e=>"institution_id"===e.prop))?void 0:l.show)?(V(),X(f,{key:"institution_id",label:"制度ID",prop:"institution_id","min-width":"150","show-overflow-tooltip":""})):H("",!0),(null==(o=ke.find(e=>"quota_type"===e.prop))?void 0:o.show)?(V(),X(f,{key:"quota_type",label:"额度类型",prop:"quota_type","min-width":"100"},{default:L(e=>[O(S(ze(e.row.quota_type)),1)]),_:1})):H("",!0),(null==(i=ke.find(e=>"total_amount"===e.prop))?void 0:i.show)?(V(),X(f,{key:"total_amount",label:"总金额",prop:"total_amount","min-width":"100",align:"right"},{default:L(e=>[O(S(e.row.total_amount?`¥${e.row.total_amount.toFixed(2)}`:"-"),1)]),_:1})):H("",!0),(null==(n=ke.find(e=>"available_amount"===e.prop))?void 0:n.show)?(V(),X(f,{key:"available_amount",label:"可用金额",prop:"available_amount","min-width":"100",align:"right"},{default:L(e=>[O(S(e.row.available_amount?`¥${e.row.available_amount.toFixed(2)}`:"-"),1)]),_:1})):H("",!0),(null==(s=ke.find(e=>"status"===e.prop))?void 0:s.show)?(V(),X(f,{key:"status",label:"状态",prop:"status","min-width":"100"},{default:L(e=>[F(h,{type:A(d)[e.row.status]},{default:L(()=>[O(S(A(u)[e.row.status]||e.row.status),1)]),_:2},1032,["type"])]),_:1})):H("",!0),(null==(r=ke.find(e=>"created_time"===e.prop))?void 0:r.show)?(V(),X(f,{key:"created_time",label:"创建时间",prop:"created_time","min-width":"160",sortable:""})):H("",!0),(null==(p=ke.find(e=>"operation"===e.prop))?void 0:p.show)?(V(),X(f,{key:9,fixed:"right",label:"操作",align:"center","min-width":"160"},{default:L(e=>[E((V(),X(v,{type:"info",size:"small",link:"",icon:"View",onClick:t=>xe("detail",e.row.quota_id)},{default:L(()=>[..._[6]||(_[6]=[O(" 详情 ",-1)])]),_:1},8,["onClick"])),[[R,["module_payment:quota:detail"]]]),E((V(),X(v,{type:"primary",size:"small",link:"",icon:"edit",onClick:t=>xe("update",e.row.quota_id)},{default:L(()=>[..._[7]||(_[7]=[O(" 编辑 ",-1)])]),_:1},8,["onClick"])),[[R,["module_payment:quota:update"]]])]),_:1})):H("",!0)]}),_:1},8,["data","onSelectionChange"])),[[N,t]])])]),_:1},8,["content-config"]),F(C,{modelValue:qe.visible,"onUpdate:modelValue":_[1]||(_[1]=e=>qe.visible=e),title:qe.title,onClose:Ie},{footer:L(()=>[U("div",G,["detail"!==qe.type?(V(),X(v,{key:0,type:"primary",onClick:De},{default:L(()=>[..._[8]||(_[8]=[O(" 确定 ",-1)])]),_:1})):(V(),X(v,{key:1,type:"primary",onClick:Ie},{default:L(()=>[..._[9]||(_[9]=[O("确定",-1)])]),_:1})),F(v,{onClick:Ie},{default:L(()=>[..._[10]||(_[10]=[O("取消",-1)])]),_:1})])]),default:L(()=>["detail"===qe.type?(V(),X(m,{key:0,"quota-id":Ce.value},null,8,["quota-id"])):(V(),X(c,{key:1,ref_key:"formRef",ref:ie,type:qe.type,"quota-id":Ce.value,"employee-id":re.value,"institution-id":pe.value,onSuccess:Re},null,8,["type","quota-id","employee-id","institution-id"]))]),_:1},8,["modelValue","title"])],64)):H("",!0),"employee"===me.value?(V(),Q("div",K,[U("div",W,[F(D,{inline:!0},{default:L(()=>[F(I,{label:"员工ID"},{default:L(()=>[F(x,{modelValue:ce.value,"onUpdate:modelValue":_[2]||(_[2]=e=>ce.value=e),placeholder:"请输入员工ID",clearable:"",style:{width:"200px"}},null,8,["modelValue"])]),_:1}),F(I,{label:"制度ID"},{default:L(()=>[F(x,{modelValue:ye.value,"onUpdate:modelValue":_[3]||(_[3]=e=>ye.value=e),placeholder:"可选",clearable:"",style:{width:"200px"}},null,8,["modelValue"])]),_:1}),F(I,null,{default:L(()=>[F(v,{type:"primary",onClick:we},{default:L(()=>[..._[11]||(_[11]=[O("查询",-1)])]),_:1}),F(v,{onClick:_[4]||(_[4]=e=>{ce.value="",ye.value="",_e.value=[],ve.value=!1})},{default:L(()=>[..._[12]||(_[12]=[O("重置",-1)])]),_:1})]),_:1})]),_:1})]),E((V(),X(w,{data:_e.value,border:"","max-height":"calc(100vh - 300px)"},{empty:L(()=>[F(b,{"image-size":60,description:"请输入员工ID查询"})]),default:L(()=>[F(f,{type:"index",label:"序号",width:"50"}),F(f,{prop:"employee_id",label:"员工ID","min-width":"160","show-overflow-tooltip":""}),F(f,{label:"员工姓名","min-width":"120"},{default:L(e=>{var t;return[O(S((null==(t=e.row)?void 0:t.name)||"-"),1)]}),_:1}),F(f,{prop:"employee_no",label:"工号",width:"120"}),F(f,{prop:"department_name",label:"部门",width:"120"}),F(f,{prop:"employee_mobile",label:"手机号",width:"130"}),F(f,{label:"已发点券",width:"100",align:"right"},{default:L(e=>[O(S(e.row.couponCount??"-"),1)]),_:1}),F(f,{label:"操作",width:"100",align:"center"},{default:L(e=>[F(v,{type:"primary",size:"small",link:"",onClick:t=>{return a=e.row,fe.value=a.employee_id,he.value=a.name||"",void(be.value=!0);var a}},{default:L(()=>[..._[13]||(_[13]=[O(" 详情 ",-1)])]),_:1},8,["onClick"])]),_:1})]),_:1},8,["data"])),[[N,ve.value]])])):H("",!0),F(y,{visible:be.value,"onUpdate:visible":_[5]||(_[5]=e=>be.value=e),"employee-id":fe.value,"institution-id":ye.value||void 0,"employee-name":he.value},null,8,["visible","employee-id","institution-id","employee-name"])],8,J)),[[N,A(ne)]])}}});export{Y as default};
|