import{ad as m,d as F,h as i,Y as N,r as s,o as k,f as B,w as d,b as l,a2 as I,l as v,E as w}from"./index.e3896b23.js";const x=u=>m.get("/data-governance/standard-code/"+u),y=u=>u.id?m.put("/data-governance/standard-code",u):m.post("/data-governance/standard-code",u),S=v("\u53D6\u6D88"),R=v("\u786E\u5B9A"),$=F({__name:"add-or-update",emits:["refreshDataList"],setup(u,{expose:g,emit:C}){const n=i(!1),r=i(),a=N({dataId:"",dataName:""}),b=(o,e)=>{n.value=!0,a.id="",r.value&&r.value.resetFields(),a.standardId=e,o&&V(o)},V=o=>{x(o).then(e=>{Object.assign(a,e.data)})},E=i({dataId:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],dataName:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}),p=()=>{r.value.validate(o=>{if(!o)return!1;y(a).then(()=>{w.success({message:"\u64CD\u4F5C\u6210\u529F",duration:500,onClose:()=>{n.value=!1,C("refreshDataList")}})})})};return g({init:b}),(o,e)=>{const f=s("el-input"),c=s("el-form-item"),A=s("el-form"),_=s("el-button"),D=s("el-dialog");return k(),B(D,{modelValue:n.value,"onUpdate:modelValue":e[5]||(e[5]=t=>n.value=t),title:a.id?"\u4FEE\u6539":"\u65B0\u589E","close-on-click-modal":!1,width:"30%"},{footer:d(()=>[l(_,{onClick:e[3]||(e[3]=t=>n.value=!1)},{default:d(()=>[S]),_:1}),l(_,{type:"primary",onClick:e[4]||(e[4]=t=>p())},{default:d(()=>[R]),_:1})]),default:d(()=>[l(A,{ref_key:"dataFormRef",ref:r,model:a,rules:E.value,"label-width":"100px",onKeyup:e[2]||(e[2]=I(t=>p(),["enter"]))},{default:d(()=>[l(c,{label:"\u7801\u8868id",prop:"dataId"},{default:d(()=>[l(f,{modelValue:a.dataId,"onUpdate:modelValue":e[0]||(e[0]=t=>a.dataId=t),placeholder:"id"},null,8,["modelValue"])]),_:1}),l(c,{label:"\u7801\u8868name",prop:"dataName"},{default:d(()=>[l(f,{modelValue:a.dataName,"onUpdate:modelValue":e[1]||(e[1]=t=>a.dataName=t),placeholder:"name"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title"])}}});export{$ as _};
