import{d as y,h as m,Y as B,r as s,o as E,f as k,w as o,b as u,a2 as A,l as _,aC as T,aD as N,E as x}from"./index.e3896b23.js";const U=_("\u53D6\u6D88"),w=_("\u786E\u5B9A"),q=y({__name:"type-add-or-update",emits:["refreshDataList"],setup(R,{expose:c,emit:b}){const r=m(!1),n=m(),t=B({id:"",dictType:"",dictName:"",sort:0,remark:""}),V=m({dictType:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],dictName:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}),v=a=>{r.value=!0,t.id="",n.value&&n.value.resetFields(),a&&g(a)},g=a=>{T(a).then(e=>{Object.assign(t,e.data)})},p=()=>{n.value.validate(a=>{if(!a)return!1;N(t).then(()=>{x.success({message:"\u64CD\u4F5C\u6210\u529F",duration:500,onClose:()=>{r.value=!1,b("refreshDataList")}})})})};return c({init:v}),(a,e)=>{const i=s("el-input"),d=s("el-form-item"),C=s("el-input-number"),D=s("el-form"),f=s("el-button"),F=s("el-dialog");return E(),k(F,{modelValue:r.value,"onUpdate:modelValue":e[7]||(e[7]=l=>r.value=l),title:t.id?"\u4FEE\u6539":"\u65B0\u589E","close-on-click-modal":!1,draggable:""},{footer:o(()=>[u(f,{onClick:e[5]||(e[5]=l=>r.value=!1)},{default:o(()=>[U]),_:1}),u(f,{type:"primary",onClick:e[6]||(e[6]=l=>p())},{default:o(()=>[w]),_:1})]),default:o(()=>[u(D,{ref_key:"dataFormRef",ref:n,model:t,rules:V.value,"label-width":"80px",onKeyup:e[4]||(e[4]=A(l=>p(),["enter"]))},{default:o(()=>[u(d,{prop:"dictType",label:"\u5B57\u5178\u7C7B\u578B"},{default:o(()=>[u(i,{modelValue:t.dictType,"onUpdate:modelValue":e[0]||(e[0]=l=>t.dictType=l),placeholder:"\u5B57\u5178\u7C7B\u578B"},null,8,["modelValue"])]),_:1}),u(d,{prop:"dictName",label:"\u5B57\u5178\u540D\u79F0"},{default:o(()=>[u(i,{modelValue:t.dictName,"onUpdate:modelValue":e[1]||(e[1]=l=>t.dictName=l),placeholder:"\u5B57\u5178\u540D\u79F0"},null,8,["modelValue"])]),_:1}),u(d,{prop:"sort",label:"\u6392\u5E8F"},{default:o(()=>[u(C,{modelValue:t.sort,"onUpdate:modelValue":e[2]||(e[2]=l=>t.sort=l),"controls-position":"right",min:0,label:"\u6392\u5E8F"},null,8,["modelValue"])]),_:1}),u(d,{prop:"remark",label:"\u5907\u6CE8"},{default:o(()=>[u(i,{modelValue:t.remark,"onUpdate:modelValue":e[3]||(e[3]=l=>t.remark=l),placeholder:"\u5907\u6CE8"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title"])}}});export{q as _};
