import{B as R,C as E,I as C,J as D,D as F}from"./element-plus-z3MwpXC9.js";import{g as T,h as U}from"./dict-C5jzI4Wg.js";import{P as q}from"./index-CdmO5-Ss.js";import{d as B,s as c,r as I,b as N,Z as P,o as S,c as h,V as t,M as s,u as l,S as _}from"./@vue-TMcuEboY.js";const z={class:"edit-popup"},K=B({__name:"edit",emits:["success","close"],setup(A,{expose:V,emit:y}){const p=y,i=c(),u=c(),m=I("add"),b=N(()=>m.value=="edit"?"编辑字典类型":"新增字典类型"),o=P({id:"",name:"",type:"",status:1,remark:""}),v={name:[{required:!0,message:"请输入字典名称",trigger:["blur"]}],type:[{required:!0,message:"请输入字典类型",trigger:["blur"]}]},w=async()=>{var a,e;await((a=i.value)==null?void 0:a.validate()),m.value=="edit"?await T(o):await U(o),(e=u.value)==null||e.close(),p("success")},x=()=>{p("close")};return V({open:(a="add")=>{var e;m.value=a,(e=u.value)==null||e.open()},setFormData:a=>{for(const e in o)a[e]!=null&&a[e]!=null&&(o[e]=a[e])}}),(a,e)=>{const d=R,n=E,f=C,g=D,k=F;return S(),h("div",z,[t(q,{ref_key:"popupRef",ref:u,title:l(b),async:!0,width:"550px",onConfirm:w,onClose:x},{default:s(()=>[t(k,{class:"ls-form",ref_key:"formRef",ref:i,rules:v,model:l(o),"label-width":"84px"},{default:s(()=>[t(n,{label:"字典名称",prop:"name"},{default:s(()=>[t(d,{modelValue:l(o).name,"onUpdate:modelValue":e[0]||(e[0]=r=>l(o).name=r),placeholder:"请输入字典名称",clearable:""},null,8,["modelValue"])]),_:1}),t(n,{label:"字典类型",prop:"type"},{default:s(()=>[t(d,{modelValue:l(o).type,"onUpdate:modelValue":e[1]||(e[1]=r=>l(o).type=r),placeholder:"请输入字典类型",clearable:""},null,8,["modelValue"])]),_:1}),t(n,{label:"字典状态",required:"",prop:"status"},{default:s(()=>[t(g,{modelValue:l(o).status,"onUpdate:modelValue":e[2]||(e[2]=r=>l(o).status=r)},{default:s(()=>[t(f,{value:1},{default:s(()=>e[4]||(e[4]=[_("正常")])),_:1}),t(f,{value:0},{default:s(()=>e[5]||(e[5]=[_("停用")])),_:1})]),_:1},8,["modelValue"])]),_:1}),t(n,{label:"备注",prop:"remark"},{default:s(()=>[t(d,{modelValue:l(o).remark,"onUpdate:modelValue":e[3]||(e[3]=r=>l(o).remark=r),type:"textarea",autosize:{minRows:4,maxRows:6},clearable:"",maxlength:"200","show-word-limit":""},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["title"])])}}});export{K as _};
