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