CustomerLimitConfigForm-9f653032.js 5.0 KB

1
  1. import{ar as f,d as B,i as G,r as n,f as J,o as h,x as g,w as u,g as i,a as t,q as O,y as P,R as X,Q as H,av as W,B as Z,aX as $,d2 as ee,G as ae,D as le,J as te,_ as se,__tla as re}from"./index-d02d27ca.js";import{_ as de,__tla as oe}from"./Dialog-08baefc8.js";import{E as ue,__tla as ie}from"./el-tree-select-641ce817.js";import{g as ne,__tla as ce}from"./index-6dc55a4f.js";import{d as V,h as me}from"./tree-0af4953a.js";import{b as pe,__tla as _e}from"./index-6f4e9084.js";import{u as fe,__tla as ye}from"./useMessage-57af7504.js";let T,c,L,x,S,ve=Promise.all([(()=>{try{return re}catch{}})(),(()=>{try{return oe}catch{}})(),(()=>{try{return ie}catch{}})(),(()=>{try{return ce}catch{}})(),(()=>{try{return _e}catch{}})(),(()=>{try{return ye}catch{}})()]).then(async()=>{c=(r=>(r[r.CUSTOMER_QUANTITY_LIMIT=1]="CUSTOMER_QUANTITY_LIMIT",r[r.CUSTOMER_LOCK_LIMIT=2]="CUSTOMER_LOCK_LIMIT",r))(c||{}),S=async r=>await f.get({url:"/crm/customer-limit-config/page",params:r}),x=async r=>await f.delete({url:"/crm/customer-limit-config/delete?id="+r}),T=se(B({__name:"CustomerLimitConfigForm",emits:["success"],setup(r,{expose:k,emit:R}){const{t:C}=G(),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}),Q=J({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();k({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 q()}});const A=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,A("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))},q=async()=>{const a=await pe();I.value=[],I.value=W(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=Z,_=$,z=ee,F=ae,E=le,j=de,D=te;return h(),g(j,{title:t(U),modelValue:t(m),"onUpdate:modelValue":e[5]||(e[5]=d=>H(m)?m.value=d:null)},{footer:u(()=>[i(E,{onClick:K,type:"primary",disabled:t(p)},{default:u(()=>[O("\u786E \u5B9A")]),_:1},8,["disabled"]),i(E,{onClick:e[4]||(e[4]=d=>m.value=!1)},{default:u(()=>[O("\u53D6 \u6D88")]),_:1})]),default:u(()=>[P((h(),g(F,{ref_key:"formRef",ref:y,model:t(s),rules:t(Q),"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]=d=>t(s).userIds=d),data:t(I),props:t(V),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]=d=>t(s).deptIds=d),data:t(v),props:t(V),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]=d=>t(s).maxCount=d),placeholder:"\u8BF7\u8F93\u5165\u6570\u91CF\u4E0A\u9650"},null,8,["modelValue"])]),_:1},8,["label"]),t(s).type===t(c).CUSTOMER_QUANTITY_LIMIT?(h(),g(o,{key:0,label:"\u6210\u4EA4\u5BA2\u6237\u662F\u5426\u5360\u7528\u62E5\u6709\u5BA2\u6237\u6570",prop:"dealCountEnabled"},{default:u(()=>[i(z,{modelValue:t(s).dealCountEnabled,"onUpdate:modelValue":e[3]||(e[3]=d=>t(s).dealCountEnabled=d)},null,8,["modelValue"])]),_:1})):X("",!0)]),_:1},8,["model","rules"])),[[D,t(p)]])]),_:1},8,["title","modelValue"])}}}),[["__file","D:/zx/mall-newfeifan-zx-business/src/views/crm/customer/limitConfig/CustomerLimitConfigForm.vue"]]),L=Object.freeze(Object.defineProperty({__proto__:null,default:T},Symbol.toStringTag,{value:"Module"}))});export{T as C,c as L,ve as __tla,L as a,x as d,S as g};