import{C as w,D as x,F as R}from"./element-plus.73c9e9a6.js";import{P as k}from"./index.fa58e261.js";import{b as g,c as h,d as A}from"./unit.14e32b28.js";import"./lodash.403d4198.js";import{d as _,s as c,r as I,b as P,Z as f,o as j,c as q,U as a,L as r,u as l}from"./@vue.663bc523.js";const L={class:"edit-popup"},N=_({name:"unitEdit"}),H=_({...N,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(O,{expose:b,emit:D}){const m=D,i=c(),d=c(),p=I("add"),V=P(()=>p.value=="edit"?"\u7F16\u8F91\u8BA1\u91CF\u5355\u4F4D":"\u65B0\u589E\u8BA1\u91CF\u5355\u4F4D"),u=f({id:"",name:"",py:"",number:"",data:"",more:""}),E=f({name:[{required:!0,message:"\u8BF7\u8F93\u5165\u5355\u4F4D\u540D\u79F0",trigger:["blur"]}]}),F=async o=>{for(const e in u)o[e]!=null&&o[e]!=null&&(u[e]=o[e])},C=async o=>{const e=await g({id:o.id});F(e)},y=async()=>{var e,n;await((e=i.value)==null?void 0:e.validate());const o={...u};p.value=="edit"?await h(o):await A(o),(n=d.value)==null||n.close(),m("success")},B=(o="add")=>{var e;p.value=o,(e=d.value)==null||e.open()},v=()=>{m("close")};return b({open:B,setFormData:F,getDetail:C}),(o,e)=>{const n=w,s=x,U=R;return j(),q("div",L,[a(k,{ref_key:"popupRef",ref:d,title:l(V),async:!0,width:"550px",onConfirm:y,onClose:v},{default:r(()=>[a(U,{ref_key:"formRef",ref:i,model:l(u),"label-width":"90px",rules:l(E)},{default:r(()=>[a(s,{label:"\u5355\u4F4D\u540D\u79F0",prop:"name"},{default:r(()=>[a(n,{modelValue:l(u).name,"onUpdate:modelValue":e[0]||(e[0]=t=>l(u).name=t),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5355\u4F4D\u540D\u79F0"},null,8,["modelValue"])]),_:1}),a(s,{label:"\u62FC\u97F3\u4FE1\u606F",prop:"py"},{default:r(()=>[a(n,{modelValue:l(u).py,"onUpdate:modelValue":e[1]||(e[1]=t=>l(u).py=t),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u62FC\u97F3\u4FE1\u606F"},null,8,["modelValue"])]),_:1}),a(s,{label:"\u5355\u4F4D\u7F16\u53F7",prop:"number"},{default:r(()=>[a(n,{modelValue:l(u).number,"onUpdate:modelValue":e[2]||(e[2]=t=>l(u).number=t),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5355\u4F4D\u7F16\u53F7"},null,8,["modelValue"])]),_:1}),a(s,{label:"\u5907\u6CE8\u4FE1\u606F",prop:"data"},{default:r(()=>[a(n,{modelValue:l(u).data,"onUpdate:modelValue":e[3]||(e[3]=t=>l(u).data=t),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5907\u6CE8\u4FE1\u606F"},null,8,["modelValue"])]),_:1}),a(s,{label:"\u6269\u5C55\u4FE1\u606F",prop:"more"},{default:r(()=>[a(n,{modelValue:l(u).more,"onUpdate:modelValue":e[4]||(e[4]=t=>l(u).more=t),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u6269\u5C55\u4FE1\u606F"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});export{H as _};
