import{d as D,h as m,Y as c,r as s,o as y,f as k,w as a,b as t,a2 as w,l as f,E as U}from"./index.e3896b23.js";import{u as x,a as q}from"./cluster.85454835.js";const R=f("\u53D6\u6D88"),h=f("\u786E\u5B9A"),L=D({__name:"add-or-update",emits:["refreshDataList"],setup($,{expose:_,emit:b}){const r=m(!1),d=m(),u=c({name:"",alias:"",type:"",hosts:"",enabled:!0,note:""}),B=o=>{r.value=!0,u.id="",d.value&&d.value.resetFields(),o&&V(o)},V=o=>{x(o).then(e=>{Object.assign(u,e.data)})},A=m({name:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],alias:[{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"}],hosts:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}),p=()=>{d.value.validate(o=>{if(!o)return!1;q(u).then(()=>{U.success({message:"\u64CD\u4F5C\u6210\u529F",duration:500,onClose:()=>{r.value=!1,b("refreshDataList")}})})})};return _({init:B}),(o,e)=>{const i=s("el-input"),n=s("el-form-item"),C=s("fast-select"),E=s("el-switch"),v=s("el-form"),F=s("el-button"),g=s("el-dialog");return y(),k(g,{modelValue:r.value,"onUpdate:modelValue":e[9]||(e[9]=l=>r.value=l),title:u.id?"\u4FEE\u6539":"\u65B0\u589E","close-on-click-modal":!1},{footer:a(()=>[t(F,{onClick:e[7]||(e[7]=l=>r.value=!1)},{default:a(()=>[R]),_:1}),t(F,{type:"primary",onClick:e[8]||(e[8]=l=>p())},{default:a(()=>[h]),_:1})]),default:a(()=>[t(v,{ref_key:"dataFormRef",ref:d,model:u,rules:A.value,"label-width":"100px",onKeyup:e[6]||(e[6]=w(l=>p(),["enter"]))},{default:a(()=>[t(n,{label:"\u5B9E\u4F8B\u540D\u79F0",prop:"name"},{default:a(()=>[t(i,{modelValue:u.name,"onUpdate:modelValue":e[0]||(e[0]=l=>u.name=l),placeholder:"\u5B9E\u4F8B\u540D\u79F0"},null,8,["modelValue"])]),_:1}),t(n,{label:"\u522B\u540D",prop:"alias"},{default:a(()=>[t(i,{modelValue:u.alias,"onUpdate:modelValue":e[1]||(e[1]=l=>u.alias=l),placeholder:"\u522B\u540D"},null,8,["modelValue"])]),_:1}),t(n,{label:"\u5B9E\u4F8B\u7C7B\u578B",prop:"type"},{default:a(()=>[t(C,{modelValue:u.type,"onUpdate:modelValue":e[2]||(e[2]=l=>u.type=l),"dict-type":"production_cluster_type",placeholder:"\u8BF7\u9009\u62E9",clearable:""},null,8,["modelValue"])]),_:1}),t(n,{label:"\u5B9E\u4F8B\u5730\u5740",prop:"hosts"},{default:a(()=>[t(i,{modelValue:u.hosts,"onUpdate:modelValue":e[3]||(e[3]=l=>u.hosts=l),rows:3,type:"textarea",placeholder:"\u6DFB\u52A0 Flink \u96C6\u7FA4\u7684 JobManager \u7684 RestApi \u5730\u5740\u3002\u5F53 HA \u6A21\u5F0F\u65F6\uFF0C\u5730\u5740\u95F4\u7528\u82F1\u6587\u9017\u53F7\u5206\u9694\uFF0C\u4F8B\u5982\uFF1A192.168.40.135:8081,192.168.40.136:8081,192.168.40.137:8081"},null,8,["modelValue"])]),_:1}),t(n,{label:"\u542F\u7528",prop:"enabled"},{default:a(()=>[t(E,{modelValue:u.enabled,"onUpdate:modelValue":e[4]||(e[4]=l=>u.enabled=l),"active-value":!0,"inactive-value":!1},null,8,["modelValue"])]),_:1}),t(n,{label:"\u5907\u6CE8",prop:"note"},{default:a(()=>[t(i,{modelValue:u.note,"onUpdate:modelValue":e[5]||(e[5]=l=>u.note=l),placeholder:"\u5907\u6CE8"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title"])}}});export{L as _};
