import{a2 as h,D as R,C as T,v as N,t as U,F as I}from"./element-plus.55d71530.js";import{a as S,b as q,c as P,d as L}from"./fault_type.208ae61a.js";import{P as M}from"./index.e651cfa0.js";import{a as O}from"./useDictOptions.39c074af.js";import{d as j,s as c,r as z,b as G,_ as H,o as f,c as J,V as l,M as s,u,L as K,R as Q,a as _}from"./@vue.96c135a1.js";const W={class:"edit-popup"},X=_("div",{class:"form-tips"},"\u9ED8\u8BA4\u4E3A0\uFF0C \u6570\u503C\u8D8A\u5927\u8D8A\u6392\u524D",-1),ae=j({__name:"edit",emits:["success","close"],setup(Y,{expose:F,emit:B}){const d=B,i=c(),p=c(),r=z("add"),E=G(()=>r.value=="edit"?"\u7F16\u8F91\u5206\u7C7B":"\u65B0\u589E\u5206\u7C7B"),t=H({id:"",pid:"",name:"",level:"",sort:0,status:1}),v={pid:[{required:!0,message:"\u8BF7\u9009\u62E9\u4E0A\u7EA7\u5206\u7C7B",trigger:["change"]}],name:[{required:!0,message:"\u8BF7\u8F93\u5165\u5206\u7C7B\u540D\u79F0",trigger:["blur"]}]},{optionsData:C}=O({fault:{api:S}}),V=async()=>{var a,e;await((a=i.value)==null?void 0:a.validate()),r.value=="edit"?await q(t):await P(t),(e=p.value)==null||e.close(),d("success")},D=(a="add")=>{var e;r.value=a,(e=p.value)==null||e.open()},m=a=>{for(const e in t)a[e]!=null&&a[e]!=null&&(t[e]=a[e])},b=async a=>{const e=await L({id:a.id});m(e)},y=()=>{d("close")};return F({open:D,setFormData:m,getDetail:b}),(a,e)=>{const A=h,n=R,w=T,x=N,g=U,k=I;return f(),J("div",W,[l(M,{ref_key:"popupRef",ref:p,title:u(E),async:!0,width:"550px",onConfirm:V,onClose:y},{default:s(()=>[l(k,{ref_key:"formRef",ref:i,model:u(t),"label-width":"84px",rules:v},{default:s(()=>[u(t).pid!==0?(f(),K(n,{key:0,label:"\u4E0A\u7EA7\u5206\u7C7B",prop:"pid"},{default:s(()=>[l(A,{class:"flex-1",modelValue:u(t).pid,"onUpdate:modelValue":e[0]||(e[0]=o=>u(t).pid=o),data:u(C).fault,clearable:"","node-key":"id",props:{value:"id",label:"name"},"check-strictly":"","default-expand-all":!0,placeholder:"\u8BF7\u9009\u62E9\u4E0A\u7EA7\u5206\u7C7B"},null,8,["modelValue","data"])]),_:1})):Q("",!0),l(n,{label:"\u5206\u7C7B\u540D\u79F0",prop:"name"},{default:s(()=>[l(w,{modelValue:u(t).name,"onUpdate:modelValue":e[1]||(e[1]=o=>u(t).name=o),placeholder:"\u8BF7\u8F93\u5165\u5206\u7C7B\u540D\u79F0",maxlength:100},null,8,["modelValue"])]),_:1}),l(n,{label:"\u6392\u5E8F",prop:"sort"},{default:s(()=>[_("div",null,[l(x,{modelValue:u(t).sort,"onUpdate:modelValue":e[2]||(e[2]=o=>u(t).sort=o),min:0,max:9999},null,8,["modelValue"]),X])]),_:1}),l(n,{label:"\u5206\u7C7B\u72B6\u6001"},{default:s(()=>[l(g,{modelValue:u(t).status,"onUpdate:modelValue":e[3]||(e[3]=o=>u(t).status=o),"active-value":1,"inactive-value":0},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["title"])])}}});export{ae as _};
