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