import{C as k,D as h,F as w}from"./element-plus.a63a26dd.js";import{P as x}from"./index.da3823b2.js";import{b as R,c as U,d as q}from"./supplier.6c2e696a.js";import"./lodash.2473fc51.js";import{d as _,s as f,r as S,b as I,Z as F,o as P,c as j,U as a,L as s,u as l}from"./@vue.18505fe0.js";const A={class:"edit-popup"},L=_({name:"supplierEdit"}),H=_({...L,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(N,{expose:B,emit:b}){const m=b,i=f(),n=f(),p=S("add"),D=I(()=>p.value=="edit"?"\u7F16\u8F91\u4F9B\u5E94\u5546\u6237\u8868":"\u65B0\u589E\u4F9B\u5E94\u5546\u6237\u8868"),u=F({id:"",mer_name:"",phone:"",settle_cycle:"",address:"",mark:"",status:""}),y=F({mer_name:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u6237\u540D\u79F0",trigger:["blur"]}],phone:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u6237\u7535\u8BDD",trigger:["blur"]}],settle_cycle:[{required:!0,message:"\u8BF7\u8F93\u5165\u7ED3\u7B97\u5468\u671F\uFF0C\u5355\u4F4D\u5929",trigger:["blur"]}],address:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u6237\u5730\u5740",trigger:["blur"]}],status:[{required:!0,message:"\u8BF7\u9009\u62E9\u72B6\u6001",trigger:["blur"]}]}),c=async o=>{for(const e in u)o[e]!=null&&o[e]!=null&&(u[e]=o[e])},g=async o=>{const e=await R({id:o.id});c(e)},V=async()=>{var e,r;await((e=i.value)==null?void 0:e.validate());const o={...u};p.value=="edit"?await U(o):await q(o),(r=n.value)==null||r.close(),m("success")},E=(o="add")=>{var e;p.value=o,(e=n.value)==null||e.open()},v=()=>{m("close")};return B({open:E,setFormData:c,getDetail:g}),(o,e)=>{const r=k,d=h,C=w;return P(),j("div",A,[a(x,{ref_key:"popupRef",ref:n,title:l(D),async:!0,width:"550px",onConfirm:V,onClose:v},{default:s(()=>[a(C,{ref_key:"formRef",ref:i,model:l(u),"label-width":"90px",rules:l(y)},{default:s(()=>[a(d,{label:"\u5546\u6237\u540D\u79F0",prop:"mer_name"},{default:s(()=>[a(r,{modelValue:l(u).mer_name,"onUpdate:modelValue":e[0]||(e[0]=t=>l(u).mer_name=t),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u6237\u540D\u79F0",readonly:!1},null,8,["modelValue"])]),_:1}),a(d,{label:"\u5546\u6237\u7535\u8BDD",prop:"phone"},{default:s(()=>[a(r,{modelValue:l(u).phone,"onUpdate:modelValue":e[1]||(e[1]=t=>l(u).phone=t),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u6237\u7535\u8BDD",readonly:!1},null,8,["modelValue"])]),_:1}),a(d,{label:"\u7ED3\u7B97\u5468\u671F",prop:"settle_cycle"},{default:s(()=>[a(r,{modelValue:l(u).settle_cycle,"onUpdate:modelValue":e[2]||(e[2]=t=>l(u).settle_cycle=t),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u7ED3\u7B97\u5468\u671F\uFF0C\u5355\u4F4D\u5929",readonly:!1},null,8,["modelValue"])]),_:1}),a(d,{label:"\u5546\u6237\u5730\u5740",prop:"address"},{default:s(()=>[a(r,{modelValue:l(u).address,"onUpdate:modelValue":e[3]||(e[3]=t=>l(u).address=t),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u6237\u5730\u5740",readonly:!1},null,8,["modelValue"])]),_:1}),a(d,{label:"\u5546\u6237\u5907\u6CE8",prop:"mark"},{default:s(()=>[a(r,{modelValue:l(u).mark,"onUpdate:modelValue":e[4]||(e[4]=t=>l(u).mark=t),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u6237\u5907\u6CE8",readonly:!1},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});export{H as _};
