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