import{C as w,D as x,F as R}from"./element-plus.4a7d92a3.js";import{P as h}from"./index.66d65d7d.js";import{a as k,b as U,c as q}from"./config.4309408f.js";import"./lodash.9dc701ad.js";import{d as F,s as f,r as I,b as P,Z as _,o as j,c as A,U as t,L as n,u as l}from"./@vue.18505fe0.js";const L={class:"edit-popup"},N=F({name:"configEdit"}),H=F({...N,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(O,{expose:v,emit:y}){const i=y,m=f(),r=f(),p=I("add"),C=P(()=>p.value=="edit"?"\u7F16\u8F91\u914D\u7F6E\u8868":"\u65B0\u589E\u914D\u7F6E\u8868"),o=_({id:"",type:"",name:"",value:""}),b=_({name:[{required:!0,message:"\u8BF7\u8F93\u5165\u540D\u79F0",trigger:["blur"]}],value:[{required:!0,message:"\u8BF7\u8F93\u5165\u503C",trigger:["blur"]}]}),c=async a=>{for(const e in o)a[e]!=null&&a[e]!=null&&(o[e]=a[e])},B=async a=>{const e=await k({id:a.id});c(e)},g=async()=>{var e,u;await((e=m.value)==null?void 0:e.validate());const a={...o};p.value=="edit"?await U(a):await q(a),(u=r.value)==null||u.close(),i("success")},D=(a="add")=>{var e;p.value=a,(e=r.value)==null||e.open()},V=()=>{i("close")};return v({open:D,setFormData:c,getDetail:B}),(a,e)=>{const u=w,d=x,E=R;return j(),A("div",L,[t(h,{ref_key:"popupRef",ref:r,title:l(C),async:!0,width:"550px",onConfirm:g,onClose:V},{default:n(()=>[t(E,{ref_key:"formRef",ref:m,model:l(o),"label-width":"90px",rules:l(b)},{default:n(()=>[t(d,{label:"\u7C7B\u578B",prop:"type"},{default:n(()=>[t(u,{modelValue:l(o).type,"onUpdate:modelValue":e[0]||(e[0]=s=>l(o).type=s),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u7C7B\u578B",readonly:!1},null,8,["modelValue"])]),_:1}),t(d,{label:"\u540D\u79F0",prop:"name"},{default:n(()=>[t(u,{modelValue:l(o).name,"onUpdate:modelValue":e[1]||(e[1]=s=>l(o).name=s),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u540D\u79F0",readonly:!1},null,8,["modelValue"])]),_:1}),t(d,{label:"\u503C",prop:"value"},{default:n(()=>[t(u,{modelValue:l(o).value,"onUpdate:modelValue":e[2]||(e[2]=s=>l(o).value=s),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u503C",readonly:!1},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});export{H as _};
