import{d as B,h as i,Y as N,r,o as _,f as b,w as o,b as u,H as k,a2 as x,l as F,E as U}from"./index.e3896b23.js";import{a as P,b as w}from"./apiGroup.d1155eaa.js";const I=F("\u53D6\u6D88"),h=F("\u786E\u5B9A"),G=B({__name:"add-or-update",emits:["refreshDataList"],setup(q,{expose:V,emit:c}){const n=i(!1),p=i(),e=N({parentId:"",parentPath:"",path:"",name:"",type:1,orderNo:0,description:""}),g=(a,t,d)=>{n.value=!0,e.id="",p.value&&p.value.resetFields(),e.parentId=t,e.parentPath=d,a&&E(a)},E=a=>{P(a).then(t=>{Object.assign(e,t.data)})},v=i({name:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],type:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],orderNo:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}),m=()=>{p.value.validate(a=>{if(!a)return!1;e.type=e.parentId==0?1:e.type,w(e).then(()=>{U.success({message:"\u64CD\u4F5C\u6210\u529F",duration:500,onClose:()=>{n.value=!1,c("refreshDataList")}})})})};return V({init:g}),(a,t)=>{const d=r("el-input"),s=r("el-form-item"),y=r("fast-select"),C=r("el-input-number"),A=r("el-form"),f=r("el-button"),D=r("el-dialog");return _(),b(D,{modelValue:n.value,"onUpdate:modelValue":t[8]||(t[8]=l=>n.value=l),title:e.id?"\u4FEE\u6539":"\u65B0\u589E","close-on-click-modal":!1},{footer:o(()=>[u(f,{onClick:t[6]||(t[6]=l=>n.value=!1)},{default:o(()=>[I]),_:1}),u(f,{type:"primary",onClick:t[7]||(t[7]=l=>m())},{default:o(()=>[h]),_:1})]),default:o(()=>[u(A,{ref_key:"dataFormRef",ref:p,model:e,rules:v.value,"label-width":"100px",onKeyup:t[5]||(t[5]=x(l=>m(),["enter"]))},{default:o(()=>[u(s,{label:"\u7236\u7EA7\u76EE\u5F55",prop:"parentPath"},{default:o(()=>[u(d,{disabled:"",modelValue:e.parentPath,"onUpdate:modelValue":t[0]||(t[0]=l=>e.parentPath=l),placeholder:""},null,8,["modelValue"])]),_:1}),u(s,{label:"\u540D\u79F0",prop:"name"},{default:o(()=>[u(d,{modelValue:e.name,"onUpdate:modelValue":t[1]||(t[1]=l=>e.name=l),placeholder:"\u540D\u79F0"},null,8,["modelValue"])]),_:1}),e.parentId!=0?(_(),b(s,{key:0,label:"\u7C7B\u578B",prop:"type"},{default:o(()=>[u(y,{disabled:!!e.id,modelValue:e.type,"onUpdate:modelValue":t[2]||(t[2]=l=>e.type=l),placeholder:"\u7C7B\u578B","dict-type":"api_group_type",clearable:""},null,8,["disabled","modelValue"])]),_:1})):k("",!0),u(s,{label:"\u5E8F\u53F7",prop:"orderNo"},{default:o(()=>[u(C,{modelValue:e.orderNo,"onUpdate:modelValue":t[3]||(t[3]=l=>e.orderNo=l),max:9999,placeholder:"\u5E8F\u53F7"},null,8,["modelValue"])]),_:1}),u(s,{label:"\u63CF\u8FF0",prop:"description"},{default:o(()=>[u(d,{type:"textarea",modelValue:e.description,"onUpdate:modelValue":t[4]||(t[4]=l=>e.description=l)},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title"])}}});export{G as _};
