var z=Object.defineProperty,I=Object.defineProperties;var B=Object.getOwnPropertyDescriptors;var x=Object.getOwnPropertySymbols;var O=Object.prototype.hasOwnProperty,R=Object.prototype.propertyIsEnumerable;var w=(t,o,l)=>o in t?z(t,o,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[o]=l,V=(t,o)=>{for(var l in o||(o={}))O.call(o,l)&&w(t,l,o[l]);if(x)for(var l of x(o))R.call(o,l)&&w(t,l,o[l]);return t},P=(t,o)=>I(t,B(o));var v=(t,o,l)=>new Promise((b,m)=>{var a=d=>{try{g(l.next(d))}catch(i){m(i)}},y=d=>{try{g(l.throw(d))}catch(i){m(i)}},g=d=>d.done?b(d.value):Promise.resolve(d.value).then(a,y);g((l=l.apply(t,o)).next())});import{d as T,s as j}from"./companyManage.8b00a509.js";import{u as A}from"./useTreeSelectData.c9995d0b.js";import{d as D,r as _,z as h,R as F,f as c,g as S,n as G,w as s,e as r,v as H,h as $,i as J}from"./index.2f2d2ba5.js";const K=$(" \u63D0\u4EA4 "),L=$(" \u5173\u95ED "),M=D({name:"companyDialog"}),Z=Object.assign(M,{props:{visible:{type:Boolean,default:!1,required:!0},data:Object},emits:["close"],setup(t,{emit:o}){const l=t,{proxy:b}=J(),m=_(),a=_({}),y={companyName:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F01\u4E1A\u540D\u79F0",trigger:"blur"}],regionCode:[{required:!0,message:"\u8BF7\u9009\u62E9\u6240\u5C5E\u533A\u57DF",trigger:"change"}],contacts:[{required:!0,message:"\u8BF7\u8F93\u5165\u8054\u7CFB\u4EBA",trigger:"blur"}],contactsNo:[{required:!0,pattern:/^1[3456789]\d{9}$/,message:"\u624B\u673A\u53F7\u7801\u683C\u5F0F\u4E0D\u6B63\u786E",trigger:"blur"}],legalPerson:[{required:!0,message:"\u8BF7\u8F93\u5165\u6CD5\u4EBA",trigger:"blur"}],legalPersonContactsNo:[{required:!0,pattern:/^1[3456789]\d{9}$/,message:"\u624B\u673A\u53F7\u7801\u683C\u5F0F\u4E0D\u6B63\u786E",trigger:"blur"}]},g=f=>v(this,null,function*(){!f||(yield f.validate(e=>v(this,null,function*(){var u;e&&(yield j(P(V({},a.value),{regionCode:Array.isArray(a.value.regionCode)?(u=a.value.regionCode)==null?void 0:u.at(-1):[a.value.regionCode].at(-1)})),b.$message.success(`${l.data&&l.data.id?"\u7F16\u8F91":"\u65B0\u589E"}\u6210\u529F\uFF01`),o("close",!0))})))}),{cascaderProps:d}=A(),i=_([]);return h(()=>l.visible,f=>v(this,null,function*(){var e;if(f){if(i.value=(yield F()).data,(e=l.data)!=null&&e.companyId){const u=yield T(l.data.companyId);a.value=V({},u.data)}}else a.value={},m.value.resetFields()})),(f,e)=>{var N;const u=c("el-input"),p=c("el-form-item"),q=c("el-cascader"),U=c("el-form"),C=c("el-button"),k=c("el-dialog");return S(),G(k,{"model-value":t.visible,title:`${(N=t.data)!=null&&N.companyId?"\u7F16\u8F91":"\u65B0\u589E"}\u4F01\u4E1A`,width:"560px","destroy-on-close":"",onClose:e[8]||(e[8]=n=>o("close"))},{footer:s(()=>[r(C,{type:"primary",size:"small",onClick:e[6]||(e[6]=n=>g(m.value))},{default:s(()=>[K]),_:1}),r(C,{type:"info",size:"small",onClick:e[7]||(e[7]=n=>o("close"))},{default:s(()=>[L]),_:1})]),default:s(()=>[r(U,{ref_key:"formRef",ref:m,model:a.value,rules:y,"label-width":"90px","label-suffix":":",size:"small"},{default:s(()=>[r(p,{label:"\u4F01\u4E1A\u540D\u79F0",prop:"companyName"},{default:s(()=>[r(u,{modelValue:a.value.companyName,"onUpdate:modelValue":e[0]||(e[0]=n=>a.value.companyName=n),placeholder:"\u8BF7\u8F93\u5165",maxlength:"10"},null,8,["modelValue"])]),_:1}),r(p,{label:"\u6240\u5C5E\u533A\u57DF",prop:"regionCode"},{default:s(()=>[r(q,{modelValue:a.value.regionCode,"onUpdate:modelValue":e[1]||(e[1]=n=>a.value.regionCode=n),props:H(d),options:i.value,clearable:"",class:"w-full"},null,8,["modelValue","props","options"])]),_:1}),r(p,{label:"\u8054\u7CFB\u4EBA",prop:"contacts"},{default:s(()=>[r(u,{modelValue:a.value.contacts,"onUpdate:modelValue":e[2]||(e[2]=n=>a.value.contacts=n),placeholder:"\u8BF7\u8F93\u5165",maxlength:"10"},null,8,["modelValue"])]),_:1}),r(p,{label:"\u624B\u673A\u53F7\u7801",prop:"contactsNo"},{default:s(()=>[r(u,{modelValue:a.value.contactsNo,"onUpdate:modelValue":e[3]||(e[3]=n=>a.value.contactsNo=n),maxlength:"11",placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1}),r(p,{label:"\u6CD5\u4EBA",prop:"legalPerson"},{default:s(()=>[r(u,{modelValue:a.value.legalPerson,"onUpdate:modelValue":e[4]||(e[4]=n=>a.value.legalPerson=n),placeholder:"\u8BF7\u8F93\u5165",maxlength:"10"},null,8,["modelValue"])]),_:1}),r(p,{label:"\u624B\u673A\u53F7\u7801",prop:"legalPersonContactsNo"},{default:s(()=>[r(u,{modelValue:a.value.legalPersonContactsNo,"onUpdate:modelValue":e[5]||(e[5]=n=>a.value.legalPersonContactsNo=n),maxlength:"11",placeholder:"\u8BF7\u8F93\u5165"},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["model-value","title"])}}});export{Z as default};
