import{P as x,Q as E,C as R,D as g,F as k}from"./element-plus.8e273e86.js";import{P as D}from"./index.8afed1db.js";import{g as U,h as T}from"./dict.4be781ca.js";import{d as q,s as c,r as P,b as I,Z as N,o as h,c as z,U as o,L as a,u as t,R as B}from"./@vue.76ce7aa3.js";const A={class:"edit-popup"},J=q({__name:"edit",emits:["success","close"],setup(G,{expose:_,emit:F}){const p=F,i=c(),n=c(),m=P("add"),b=I(()=>m.value=="edit"?"\u7F16\u8F91\u5B57\u5178\u7C7B\u578B":"\u65B0\u589E\u5B57\u5178\u7C7B\u578B"),u=N({id:"",name:"",type:"",status:1,remark:""}),V={name:[{required:!0,message:"\u8BF7\u8F93\u5165\u5B57\u5178\u540D\u79F0",trigger:["blur"]}],type:[{required:!0,message:"\u8BF7\u8F93\u5165\u5B57\u5178\u7C7B\u578B",trigger:["blur"]}]},y=async()=>{var l,e;await((l=i.value)==null?void 0:l.validate()),m.value=="edit"?await U(u):await T(u),(e=n.value)==null||e.close(),p("success")},C=()=>{p("close")};return _({open:(l="add")=>{var e;m.value=l,(e=n.value)==null||e.open()},setFormData:l=>{for(const e in u)l[e]!=null&&l[e]!=null&&(u[e]=l[e])}}),(l,e)=>{const d=R,r=g,f=x,w=E,v=k;return h(),z("div",A,[o(D,{ref_key:"popupRef",ref:n,title:t(b),async:!0,width:"550px",onConfirm:y,onClose:C},{default:a(()=>[o(v,{class:"ls-form",ref_key:"formRef",ref:i,rules:V,model:t(u),"label-width":"84px"},{default:a(()=>[o(r,{label:"\u5B57\u5178\u540D\u79F0",prop:"name"},{default:a(()=>[o(d,{modelValue:t(u).name,"onUpdate:modelValue":e[0]||(e[0]=s=>t(u).name=s),placeholder:"\u8BF7\u8F93\u5165\u5B57\u5178\u540D\u79F0",clearable:""},null,8,["modelValue"])]),_:1}),o(r,{label:"\u5B57\u5178\u7C7B\u578B",prop:"type"},{default:a(()=>[o(d,{modelValue:t(u).type,"onUpdate:modelValue":e[1]||(e[1]=s=>t(u).type=s),placeholder:"\u8BF7\u8F93\u5165\u5B57\u5178\u7C7B\u578B",clearable:""},null,8,["modelValue"])]),_:1}),o(r,{label:"\u5B57\u5178\u72B6\u6001",required:"",prop:"status"},{default:a(()=>[o(w,{modelValue:t(u).status,"onUpdate:modelValue":e[2]||(e[2]=s=>t(u).status=s)},{default:a(()=>[o(f,{label:1},{default:a(()=>e[4]||(e[4]=[B("\u6B63\u5E38")])),_:1}),o(f,{label:0},{default:a(()=>e[5]||(e[5]=[B("\u505C\u7528")])),_:1})]),_:1},8,["modelValue"])]),_:1}),o(r,{label:"\u5907\u6CE8",prop:"remark"},{default:a(()=>[o(d,{modelValue:t(u).remark,"onUpdate:modelValue":e[3]||(e[3]=s=>t(u).remark=s),type:"textarea",autosize:{minRows:4,maxRows:6},clearable:"",maxlength:"200","show-word-limit":""},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["title"])])}}});export{J as _};
