CustomerLimitConfigForm-20c82ee3.js 5.0 KB

1
  1. import{aA as f,d as D,P as J,r as n,x as B,o as h,C as T,A as u,f as i,a as t,D as E,k as W,a3 as Z,a2 as G,cT as H,V as X,bQ as $,cJ as ee,W as ae,J as le,Z as te,_ as se,__tla as de}from"./index-286756b9.js";import{_ as re,__tla as oe}from"./Dialog-4c2de357.js";import{E as ue,__tla as ie}from"./el-tree-select-7a83bfa8.js";import{g as ne,__tla as ce}from"./index-1aa850ac.js";import{d as L,h as me}from"./tree-0af4953a.js";import{b as pe,__tla as _e}from"./index-c725f8b2.js";import{u as fe,__tla as ye}from"./useMessage-084b1e70.js";let g,c,O,S,k,ve=Promise.all([(()=>{try{return de}catch{}})(),(()=>{try{return oe}catch{}})(),(()=>{try{return ie}catch{}})(),(()=>{try{return ce}catch{}})(),(()=>{try{return _e}catch{}})(),(()=>{try{return ye}catch{}})()]).then(async()=>{c=(d=>(d[d.CUSTOMER_QUANTITY_LIMIT=1]="CUSTOMER_QUANTITY_LIMIT",d[d.CUSTOMER_LOCK_LIMIT=2]="CUSTOMER_LOCK_LIMIT",d))(c||{}),k=async d=>await f.get({url:"/crm/customer-limit-config/page",params:d}),S=async d=>await f.delete({url:"/crm/customer-limit-config/delete?id="+d}),g=se(D({__name:"CustomerLimitConfigForm",emits:["success"],setup(d,{expose:x,emit:R}){const{t:C}=J(),b=fe(),m=n(!1),U=n(""),p=n(!1),w=n(""),s=n({id:void 0,type:c.CUSTOMER_LOCK_LIMIT,userIds:void 0,deptIds:void 0,maxCount:void 0,dealCountEnabled:!1}),A=B({type:[{required:!0,message:"\u89C4\u5219\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A",trigger:"change"}],maxCount:[{required:!0,message:"\u6570\u91CF\u4E0A\u9650\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}),y=n(),v=n(),I=n();x({open:async(a,e,l)=>{if(m.value=!0,U.value=C("action."+a),w.value=a,N(),l){p.value=!0;try{s.value=await(async o=>await f.get({url:"/crm/customer-limit-config/get?id="+o}))(l)}finally{p.value=!1}}else s.value.type=e;await Y(),await z()}});const Q=R,K=async()=>{if(y&&await y.value.validate()){p.value=!0;try{const a=s.value;w.value==="create"?(await(async e=>await f.post({url:"/crm/customer-limit-config/create",data:e}))(a),b.success(C("common.createSuccess"))):(await(async e=>await f.put({url:"/crm/customer-limit-config/update",data:e}))(a),b.success(C("common.updateSuccess"))),m.value=!1,Q("success")}finally{p.value=!1}}},N=()=>{var a;s.value={id:void 0,type:c.CUSTOMER_LOCK_LIMIT,userIds:void 0,deptIds:void 0,maxCount:void 0,dealCountEnabled:!1},(a=y.value)==null||a.resetFields()},Y=async()=>{const a=await ne();v.value=[],v.value.push(...me(a))},z=async()=>{const a=await pe();I.value=[],I.value=H(t(v));const e={};a.forEach(l=>{l.dept&&(e[l.deptId]||(e[l.deptId]=[]),e[l.deptId].push(l))}),M(I.value,e)},M=(a,e)=>{for(let l=0;l<a.length;l++){if(a[l].isUser)continue;const o=e[a[l].id];o&&(a[l].children||(a[l].children=[]),a[l].children.push(...o.map(_=>({id:_.id,name:_.username+"-"+_.nickname,isUser:!0,disabled:_.status===1})))),a[l].children&&a[l].children.length!==0&&M(a[l].children,e),a[l].disabled=!0,a[l].id="null"}};return(a,e)=>{const l=ue,o=X,_=$,F=ee,P=ae,V=le,j=re,q=te;return h(),T(j,{title:t(U),modelValue:t(m),"onUpdate:modelValue":e[5]||(e[5]=r=>G(m)?m.value=r:null)},{footer:u(()=>[i(V,{onClick:K,type:"primary",disabled:t(p)},{default:u(()=>[E("\u786E \u5B9A")]),_:1},8,["disabled"]),i(V,{onClick:e[4]||(e[4]=r=>m.value=!1)},{default:u(()=>[E("\u53D6 \u6D88")]),_:1})]),default:u(()=>[W((h(),T(P,{ref_key:"formRef",ref:y,model:t(s),rules:t(A),"label-width":"200px"},{default:u(()=>[i(o,{label:"\u89C4\u5219\u9002\u7528\u4EBA\u7FA4",prop:"userIds"},{default:u(()=>[i(l,{modelValue:t(s).userIds,"onUpdate:modelValue":e[0]||(e[0]=r=>t(s).userIds=r),data:t(I),props:t(L),multiple:"",filterable:"","check-on-click-node":"","node-key":"id",placeholder:"\u8BF7\u9009\u62E9\u89C4\u5219\u9002\u7528\u4EBA\u7FA4"},null,8,["modelValue","data","props"])]),_:1}),i(o,{label:"\u89C4\u5219\u9002\u7528\u90E8\u95E8",prop:"deptIds"},{default:u(()=>[i(l,{modelValue:t(s).deptIds,"onUpdate:modelValue":e[1]||(e[1]=r=>t(s).deptIds=r),data:t(v),props:t(L),multiple:"",filterable:"","check-strictly":"","node-key":"id",placeholder:"\u8BF7\u9009\u62E9\u89C4\u5219\u9002\u7528\u90E8\u95E8"},null,8,["modelValue","data","props"])]),_:1}),i(o,{label:t(s).type===t(c).CUSTOMER_QUANTITY_LIMIT?"\u62E5\u6709\u5BA2\u6237\u6570\u4E0A\u9650":"\u9501\u5B9A\u5BA2\u6237\u6570\u4E0A\u9650",prop:"maxCount"},{default:u(()=>[i(_,{modelValue:t(s).maxCount,"onUpdate:modelValue":e[2]||(e[2]=r=>t(s).maxCount=r),placeholder:"\u8BF7\u8F93\u5165\u6570\u91CF\u4E0A\u9650"},null,8,["modelValue"])]),_:1},8,["label"]),t(s).type===t(c).CUSTOMER_QUANTITY_LIMIT?(h(),T(o,{key:0,label:"\u6210\u4EA4\u5BA2\u6237\u662F\u5426\u5360\u7528\u62E5\u6709\u5BA2\u6237\u6570",prop:"dealCountEnabled"},{default:u(()=>[i(F,{modelValue:t(s).dealCountEnabled,"onUpdate:modelValue":e[3]||(e[3]=r=>t(s).dealCountEnabled=r)},null,8,["modelValue"])]),_:1})):Z("",!0)]),_:1},8,["model","rules"])),[[q,t(p)]])]),_:1},8,["title","modelValue"])}}}),[["__file","D:/zx/mall-newfeifan-zx-admin/src/views/crm/customer/limitConfig/CustomerLimitConfigForm.vue"]]),O=Object.freeze(Object.defineProperty({__proto__:null,default:g},Symbol.toStringTag,{value:"Module"}))});export{g as C,c as L,ve as __tla,O as a,S as d,k as g};