import{d as y,h as i,Y as U,r as d,o as c,f as N,w as t,b as l,a2 as w,l as b,E as D}from"./index.e3896b23.js";import{u as j,f as k,t as q}from"./database.32bfd96d.js";const I=b("\u53D6\u6D88"),T=b("\u6D4B\u8BD5"),x=b("\u786E\u5B9A"),R=y({__name:"add-or-update",emits:["refreshDataList"],setup(P,{expose:A,emit:f}){const n=i(!1),m=i(),u=U({name:"",databaseType:"",databaseIp:"",databasePort:"",databaseName:"",userName:"",password:"",jdbcUrl:"",projectId:""}),F=o=>{n.value=!0,u.id="",m.value&&m.value.resetFields(),o&&V(o)},V=o=>{j(o).then(e=>{Object.assign(u,e.data)})},g=i({name:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],databaseType:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],databaseIp:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],databasePort:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],databaseName:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],userName:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],password:[{required:!0,message:"\u5FC5\u586B\u9879\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}),E=()=>{m.value.validate(o=>{if(!o)return!1;k(u).then(()=>{D.success({message:"\u64CD\u4F5C\u6210\u529F",duration:500,onClose:()=>{n.value=!1,f("refreshDataList")}})})})},B=()=>{m.value.validate(o=>{if(!o)return!1;q(u).then(()=>{D.success({message:"\u6D4B\u8BD5\u8FDE\u63A5\u6210\u529F",duration:500,onClose:()=>{f("refreshDataList")}})})})};return A({init:F}),(o,e)=>{const r=d("el-input"),s=d("el-form-item"),_=d("fast-select"),C=d("el-form"),p=d("el-button"),v=d("el-dialog");return c(),N(v,{modelValue:n.value,"onUpdate:modelValue":e[12]||(e[12]=a=>n.value=a),title:u.id?"\u4FEE\u6539":"\u65B0\u589E","close-on-click-modal":!1},{footer:t(()=>[l(p,{onClick:e[9]||(e[9]=a=>n.value=!1)},{default:t(()=>[I]),_:1}),l(p,{type:"primary",onClick:e[10]||(e[10]=a=>B())},{default:t(()=>[T]),_:1}),l(p,{type:"primary",onClick:e[11]||(e[11]=a=>E())},{default:t(()=>[x]),_:1})]),default:t(()=>[l(C,{ref_key:"dataFormRef",ref:m,model:u,rules:g.value,"label-width":"120px",onKeyup:e[8]||(e[8]=w(a=>E(),["enter"]))},{default:t(()=>[l(s,{label:"\u540D\u79F0",prop:"name"},{default:t(()=>[l(r,{modelValue:u.name,"onUpdate:modelValue":e[0]||(e[0]=a=>u.name=a),placeholder:"\u540D\u79F0"},null,8,["modelValue"])]),_:1}),l(s,{label:"\u6570\u636E\u5E93\u7C7B\u578B",prop:"databaseType"},{default:t(()=>[l(_,{modelValue:u.databaseType,"onUpdate:modelValue":e[1]||(e[1]=a=>u.databaseType=a),"dict-type":"database_type",placeholder:"\u8BF7\u9009\u62E9",clearable:""},null,8,["modelValue"])]),_:1}),l(s,{label:"\u4E3B\u673Aip",prop:"databaseIp"},{default:t(()=>[l(r,{modelValue:u.databaseIp,"onUpdate:modelValue":e[2]||(e[2]=a=>u.databaseIp=a),placeholder:"\u4E3B\u673Aip"},null,8,["modelValue"])]),_:1}),l(s,{label:"\u7AEF\u53E3",prop:"databasePort"},{default:t(()=>[l(r,{modelValue:u.databasePort,"onUpdate:modelValue":e[3]||(e[3]=a=>u.databasePort=a),placeholder:"\u7AEF\u53E3"},null,8,["modelValue"])]),_:1}),l(s,{label:"\u5E93\u540D(\u670D\u52A1\u540D)",prop:"databaseName"},{default:t(()=>[l(r,{modelValue:u.databaseName,"onUpdate:modelValue":e[4]||(e[4]=a=>u.databaseName=a),placeholder:"\u5E93\u540D(\u670D\u52A1\u540D)"},null,8,["modelValue"])]),_:1}),l(s,{label:"\u7528\u6237\u540D",prop:"userName"},{default:t(()=>[l(r,{modelValue:u.userName,"onUpdate:modelValue":e[5]||(e[5]=a=>u.userName=a),placeholder:"\u7528\u6237\u540D"},null,8,["modelValue"])]),_:1}),l(s,{label:"\u5BC6\u7801",prop:"password"},{default:t(()=>[l(r,{modelValue:u.password,"onUpdate:modelValue":e[6]||(e[6]=a=>u.password=a),placeholder:"\u5BC6\u7801"},null,8,["modelValue"])]),_:1}),l(s,{label:"jdbc\u8FDE\u63A5\u4E32",prop:"jdbcUrl"},{default:t(()=>[l(r,{modelValue:u.jdbcUrl,"onUpdate:modelValue":e[7]||(e[7]=a=>u.jdbcUrl=a),placeholder:"jdbc\u8FDE\u63A5\u4E32(\u82E5\u586B\u5199\u5C06\u4EE5\u586B\u5199\u7684\u5185\u5BB9\u8FDE\u63A5,\u5426\u5219\u4F1A\u540E\u53F0\u81EA\u52A8\u6784\u5EFA\u8FDE\u63A5)"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title"])}}});export{R as _};
