1 |
- import{aT as f,ac as se,_ as re,d as ie,w as I,ag as de,bs as M,Z as me,z as ce,r as d,aC as pe,o as h,G as F,C as n,H as ve,l as u,j as t,h as B,M as w,a as j,b$ as O,L as P,J as L,aq as fe,aN as be}from"./index.js";import{A as Ee}from"./addr-query.f67f9a06.js";import{u as g,a as _e}from"./useTask.8a645393.js";import Ce from"./contact-modal.118bef.js";const{VITE_PROXY_DOMAIN_REAL:$e,VITE_PROXY_USER_REAL:he}=se(),V=he+"/admin/",T="http://project.test241.wanyuhengtong.com/user/",Ie=(l={})=>f.request("post",`${V}customerlist`,{data:l}),Fe=(l={})=>f.request("post",`${V}customercreate`,{data:l}),ge=(l={})=>f.request("post",`${V}customerupdate`,{data:l}),ke=(l={})=>f.request("post",`${V}customerselect`,{data:l}),Me=(l={})=>f.request("post",`${V}customerstatus`,{data:l}),ye=(l={})=>f.request("post",`${T}customer/info`,{data:l}),De=(l={})=>f.request("post",`${T}customer/create`,{data:l}),Ae=(l={})=>f.request("post",`${T}customer/save`,{data:l}),je=(l={})=>f.request("post",`${T}customer/status`,{data:l}),Ve={class:"flex w-full"},qe={class:"flex justify-between"},we=B("span",null,"\u64CD\u4F5C",-1),Be={class:"w-full flex justify-end"},Te=ie({__name:"modal",props:{data:{type:null,required:!0,default:{kh:"0",name:"",pid:"",id:""}},pid:{type:String,required:!0},visible:{type:Boolean,required:!0},breadcrumb:{type:Array,required:!0}},emits:["refresh"],setup(l,{emit:Y}){const _=l,X={code:"",name:"",pid:"",id:"",kh:"0"},k=I(""),G=de(()=>e.value.id?"\u7F16\u8F91\u4F01\u4E1A/\u7EC4\u7EC7":"\u6DFB\u52A0\u4F01\u4E1A/\u7EC4\u7EC7"),C=M(_,"visible"),e=M(_,"data"),N=g({initialData:{}}),U=g({initialData:{},success(o){let{member:a,middle:m,branch:b,parentName:c,companyName:i,area:y}=o;i=i.split(c)[1],e.value.customer_member=a;const v=m==="0"&&b==="0";e.value.code=v?"":m,k.value=v?"0":"",e.value.organizeName=c,e.value.name=i,e.value.branch=b,e.value.middle=m,e.value.area=y}});function q(){C.value=!1,Y("refresh")}const x=g({success:q}),R=g({success:q}),S=g({success:q}),z=g({success:q}),H=_e(R,x,z,S),r=me({visible:!1,index:-1,data:{}}),$=I(null),J={name:[{required:!0,message:"\u8BF7\u8F93\u5165\u7EC4\u7EC7\u540D\u79F0",trigger:"blur"}],kh:[{required:!0,message:"\u8BF7\u9009\u62E9\u7EC4\u5408/\u4F01\u4E1A",trigger:"blur"}],code:[{required:!0,message:"\u8BF7\u9009\u62E9\u4F01\u4E1A\u6240\u5728\u5730",trigger:"blur"}]};function Q(){e.value={...X},C.value=!1}function Z(o){const{info:a,code:m,name:b}=o,{province:c,city:i}=a;e.value.code=m,e.value.area=b,e.value.branch=c.code,e.value.middle=i.code,k.value=""}function K(){e.value.code="",e.value.area="",e.value.middle="",e.value.province_code=""}async function W(){try{await $.value.validate();let o={};const{id:a,kh:m,organizeName:b,name:c,middle:i,branch:y,customer_member:v}=e.value;if(m==="0")o.pid=_.pid||"0",o.name=e.value.name||"0";else{if(!v||v.length===0){be.warning("\u81F3\u5C11\u6DFB\u52A0\u4E00\u6761\u8054\u7CFB\u65B9\u5F0F");return}o.parent=_.pid||"0",o.companyName=b+c,o.area=k.value==="0"?"\u4E0D\u9650\u533A\u57DF":e.value.area,o.customer_member=v,o.middle=i,o.branch=y}const p=a===void 0||!a,E=m==="1";p||(o.id=a);let D=null,A=null;p?(D=E?S:R,A=E?De:Fe):(D=E?z:x,A=E?Ae:ge),D.run(A(o))}catch{}}function ee(){r.data={},r.index=-1,r.visible=!0}function ae(o,a){r.data={...o},r.index=a,r.visible=!0}function te(o){e.value.customer_member||(e.value.customer_member=[]),o===-1?e.value.customer_member.push(r.data):e.value.customer_member[o]=r.data}return ce(()=>C.value,o=>{var a;!o||(_.data.id?e.value.kh==="0"?N.run(ke({id:e.value.id})):U.run(ye({id:e.value.id,companyNo:e.value.companyNo})):(e.value.kh="0",e.value.organizeName=((a=_.breadcrumb[_.breadcrumb.length-1])==null?void 0:a.name)||""))},{immediate:!0}),(o,a)=>{const m=d("ElOption"),b=d("ElSelect"),c=d("ElFormItem"),i=d("ElCol"),y=d("ElRadio"),v=d("ElInput"),p=d("ElTableColumn"),E=d("ElButton"),D=d("ElTable"),A=d("ElRow"),ue=d("ElForm"),le=d("ElDialog"),oe=pe("loading");return h(),F(le,{modelValue:u(C),"onUpdate:modelValue":a[7]||(a[7]=s=>fe(C)?C.value=s:null),title:u(G),center:"",onClose:Q},{default:n(()=>[ve((h(),F(ue,{model:u(e),rules:J,size:"small",ref_key:"formRef",ref:$},{default:n(()=>[t(A,{gutter:10},{default:n(()=>[t(i,{span:6},{default:n(()=>[t(c,{prop:"kh",label:"\u7EC4\u7EC7/\u4F01\u4E1A"},{default:n(()=>[t(b,{modelValue:u(e).kh,"onUpdate:modelValue":a[0]||(a[0]=s=>u(e).kh=s),disabled:!!u(e).id,style:{width:"100%"}},{default:n(()=>[t(m,{value:"0",label:"\u7EC4\u7EC7"}),t(m,{value:"1",label:"\u4F01\u4E1A"})]),_:1},8,["modelValue","disabled"])]),_:1})]),_:1}),u(e).kh==="1"?(h(),F(i,{key:0,span:18},{default:n(()=>[t(c,{prop:"code",label:"\u4F01\u4E1A\u6240\u5728\u533A\u57DF"},{default:n(()=>[B("div",Ve,[t(y,{modelValue:k.value,"onUpdate:modelValue":a[1]||(a[1]=s=>k.value=s),label:"0",onClick:K},{default:n(()=>[w("\u4E0D\u9650")]),_:1},8,["modelValue"]),t(u(Ee),{modelValue:u(e).code,"onUpdate:modelValue":a[2]||(a[2]=s=>u(e).code=s),style:{width:"100%"},onChange:Z},null,8,["modelValue"])])]),_:1})]),_:1})):j("v-if",!0),u(e).kh==="1"?(h(),F(i,{key:1,span:24},{default:n(()=>[t(c,{label:"\u4F01\u4E1A\u540D\u79F0",prop:"name"},{default:n(()=>[t(v,{modelValue:u(e).name,"onUpdate:modelValue":a[3]||(a[3]=s=>u(e).name=s),style:{width:"100%"},placeholder:"\u540D\u79F0"},O({_:2},[l.pid&&l.pid!=="0"?{name:"prepend",fn:n(()=>[w(P(u(e).organizeName),1)]),key:"0"}:void 0]),1032,["modelValue"])]),_:1})]),_:1})):(h(),F(i,{key:2,span:18},{default:n(()=>[t(c,{label:"\u7EC4\u7EC7\u540D\u79F0",prop:"name"},{default:n(()=>[t(v,{modelValue:u(e).name,"onUpdate:modelValue":a[4]||(a[4]=s=>u(e).name=s),style:{width:"100%"},placeholder:"\u540D\u79F0"},O({_:2},[l.pid&&l.pid!=="0"?{name:"prepend",fn:n(()=>[w(P(u(e).organizeName),1)]),key:"0"}:void 0]),1032,["modelValue"])]),_:1})]),_:1})),u(e).kh==="1"?(h(),F(i,{key:3,span:24,class:"mb-[10px]"},{default:n(()=>[t(D,{size:"small",border:"",data:u(e).customer_member||[]},{default:n(()=>[t(p,{label:"\u8054\u7CFB\u4EBA",prop:"contactor"}),t(p,{label:"\u8054\u7CFB\u7535\u8BDD",prop:"commobile"}),t(p,{label:"\u804C\u4F4D",prop:"position"}),t(p,{label:"\u6240\u5728\u90E8\u95E8",prop:"comdepart"}),t(p,{label:"\u5FAE\u4FE1\u53F7",prop:"wxaccount"}),t(p,{label:"qq\u53F7",prop:"qqaccount"}),t(p,{label:"\u90AE\u7BB1",prop:"email"}),t(p,{label:"\u64CD\u4F5C"},{header:n(()=>[B("div",qe,[we,t(E,{type:"primary",link:"",icon:u(L)("add"),onClick:ee},null,8,["icon"])])]),default:n(({row:s,$index:ne})=>[t(E,{type:"primary",link:"",icon:u(L)("edit"),onClick:Ue=>ae(s,ne)},null,8,["icon","onClick"])]),_:1})]),_:1},8,["data"])]),_:1})):j("v-if",!0)]),_:1}),t(Ce,{visible:r.visible,"onUpdate:visible":a[5]||(a[5]=s=>r.visible=s),data:r.data,"onUpdate:data":a[6]||(a[6]=s=>r.data=s),index:r.index,onSubmit:te},null,8,["visible","data","index"]),B("div",Be,[t(E,{type:"primary",loading:u(H).loading,onClick:W},{default:n(()=>[w("\u4FDD\u5B58")]),_:1},8,["loading"])])]),_:1},8,["model"])),[[oe,u(N).loading||u(U).loading]])]),_:1},8,["modelValue","title"])}}});var Ne=re(Te,[["__file","C:/Users/Administrator/Desktop/projects/purchase-vue3/src/views/serviceParam/business/cpns/modal.vue"]]),Oe=Object.freeze(Object.defineProperty({__proto__:null,default:Ne},Symbol.toStringTag,{value:"Module"}));export{Ne as M,Me as a,je as b,Ie as h,Oe as m};
|