import{a2 as A,D as T,C as S,U as I,L,F as N}from"./element-plus.55d71530.js";import{P as O}from"./index.9939838f.js";import{r}from"./index.b7f6427b.js";import"./lodash.d6737109.js";import"./dayjs.37feae28.js";import{a as P}from"./useDictOptions.eaced2f1.js";import{a as j}from"./fault_type.71ce5c7e.js";import{d as B,s as b,r as G,b as M,_ as E,o as z,c as H,V as u,M as s,u as a,S as y}from"./@vue.96c135a1.js";function oe(o){return r.get({url:"/fault_code.fault_code/lists",params:o})}function J(o){return r.post({url:"/fault_code.fault_code/add",params:o})}function K(o){return r.post({url:"/fault_code.fault_code/edit",params:o})}function se(o){return r.post({url:"/fault_code.fault_code/delete",params:o})}function Q(o){return r.get({url:"/fault_code.fault_code/detail",params:o})}const W={class:"edit-popup"},X=B({name:"faultCodeEdit"}),de=B({...X,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(o,{expose:V,emit:g}){const f=g,m=b(),p=b(),c=G("add"),{optionsData:v}=P({fault:{api:j}}),D=M(()=>c.value=="edit"?"\u7F16\u8F91\u6545\u969C\u4EE3\u7801":"\u65B0\u589E\u6545\u969C\u4EE3\u7801"),t=E({id:"",type_id:"",codes:"",fault_name:"",detail:"",status:1}),x=E({codes:[{required:!0,message:"\u8BF7\u8F93\u5165\u6545\u969C\u7801",trigger:["blur"]}],fault_name:[{required:!0,message:"\u8BF7\u8F93\u5165\u6545\u969C\u540D\u79F0",trigger:["blur"]}],detail:[{required:!0,message:"\u8BF7\u8F93\u5165\u6545\u969C\u8BE6\u60C5",trigger:["blur"]}]}),_=async l=>{for(const e in t)l[e]!=null&&l[e]!=null&&(t[e]=l[e])},w=async l=>{const e=await Q({id:l.id});_(e)},R=async()=>{var e,n;await((e=m.value)==null?void 0:e.validate());const l={...t};c.value=="edit"?await K(l):await J(l),(n=p.value)==null||n.close(),f("success")},k=(l="add")=>{var e;c.value=l,(e=p.value)==null||e.open()},U=()=>{f("close")};return V({open:k,setFormData:_,getDetail:w}),(l,e)=>{const n=A,i=T,F=S,C=I,h=L,q=N;return z(),H("div",W,[u(O,{ref_key:"popupRef",ref:p,title:a(D),async:!0,width:"70%",onConfirm:R,onClose:U},{default:s(()=>[u(q,{ref_key:"formRef",ref:m,model:a(t),"label-width":"90px",rules:a(x)},{default:s(()=>[u(i,{label:"\u5206\u7C7B",prop:"type_id"},{default:s(()=>[u(n,{class:"flex-1",modelValue:a(t).type_id,"onUpdate:modelValue":e[0]||(e[0]=d=>a(t).type_id=d),data:a(v).fault,clearable:"",filterable:"","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}),u(i,{label:"\u9002\u7528\u578B\u53F7",prop:"codes"},{default:s(()=>[u(F,{modelValue:a(t).codes,"onUpdate:modelValue":e[1]||(e[1]=d=>a(t).codes=d),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u9002\u7528\u578B\u53F7"},null,8,["modelValue"])]),_:1}),u(i,{label:"\u6545\u969C\u63CF\u8FF0",prop:"detail"},{default:s(()=>[u(F,{type:"textarea",modelValue:a(t).detail,"onUpdate:modelValue":e[2]||(e[2]=d=>a(t).detail=d),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u6545\u969C\u63CF\u8FF0"},null,8,["modelValue"])]),_:1}),u(i,{label:"\u72B6\u6001",prop:"status"},{default:s(()=>[u(h,{modelValue:a(t).status,"onUpdate:modelValue":e[3]||(e[3]=d=>a(t).status=d)},{default:s(()=>[u(C,{label:0},{default:s(()=>[y("\u5173\u95ED")]),_:1}),u(C,{label:1},{default:s(()=>[y("\u5F00\u542F")]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});export{de as _,se as a,oe as b};
