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