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