import{l as e,cN as s,dW as a,t as r,v as l,x as t}from"./utils-lib.js?v=20260328163632";import{u}from"./store.js?v=20260328163632";import{c as o,r as i,k as p,V as d,W as n,O as v,Y as b}from"./base-lib.js?v=20260328163632";import{r as c,g as m}from"./index100.js?v=20260328163632";import{O as _,P as g}from"./database.js?v=20260328163632";import"./naive-ui.js?v=20260328163632";import"./__commonjsHelpers__.js?v=20260328163632";import"./env-lib.js?v=20260328163632";import"./index92.js?v=20260328163632";import"./useMethod2.js?v=20260328163632";import"./index85.js?v=20260328163632";import"./service.vue_vue_type_style_index_0_scoped_073b5b46_lang.js?v=20260328163632";const{tabActive:y}=u(),h={mysql:"3306",sqlserver:"1433",mongodb:"27017",redis:"6379",pgsql:"5432",gbase8s:"9088"},x={mysql:"root",sqlserver:"sa",mongodb:"root",pgsql:"postgres",gbase8s:"gbasedbt"},j=o((()=>{const s=[{content:e("支持阿里云、腾讯云等云厂商的云数据库")},{content:e("注意1：请确保本服务器有访问数据库的权限")},{content:e("注意2：请确保填写的管理员帐号具备足够的权限")}];return"mysql"===y.value&&s.unshift({content:e("支持MySQL5.5、MariaDB10.1及以上版本")}),s})),w=i({label:e("数据库端口"),ruleKey:"db_port",rules:[{required:!0,message:e("请输入服务器端口"),trigger:["blur","input"]}],children:[{type:"input",key:"db_port",attrs:{class:"!w-240px",placeholder:e("请输入服务器端口")}}]}),f=i({label:e("管理员名称"),ruleKey:"db_user",rules:[{required:!0,message:e("请输入管理员名称"),trigger:["blur","input"]}],children:[{type:"input",key:"db_user",attrs:{class:"!w-240px",placeholder:e("请输入管理员名称")}}]}),q=i({label:e("管理员密码"),ruleKey:"db_password",rules:[{required:!0,message:e("请输入管理员密码"),trigger:["blur","input"]}],children:[{type:"input",key:"db_password",attrs:{class:"!w-240px",placeholder:e("请输入管理员密码")}}]}),k=i({label:e("备注"),children:[{type:"input",key:"ps",attrs:{class:"!w-240px",placeholder:e("请输入服务器备注")}}]}),K={class:"p-20px"},A=p({__name:"index",setup(p,{expose:y}){const{tabActive:A}=u(),M=i({label:e("服务器地址"),ruleKey:"db_host",rules:[{validator:(r,l,t)=>""===l?new Error(e("请输入服务器地址")):!(!s(l)&&!a(l)||""===l)||new Error(e("请输入正确的服务器地址")),trigger:["blur","input"]}],children:[{type:"input",key:"db_host",attrs:{class:"!w-240px",placeholder:e("请输入服务器地址"),"onUpdate:value":e=>{I.value.ps=e}}}]}),O=i({formAttrs:{labelWidth:"auto"},formItems:[]}),W=o((()=>(O.value.formItems=[M.value,w.value,..."redis"!==A.value?[f.value]:[],q.value,k.value],O.value))),[E,I,N]=r(W);var S,B,C,D;return Object.assign(I.value,{db_host:(null==(S=c.value)?void 0:S.db_host)||"",db_port:(null==(C=null==(B=c.value)?void 0:B.db_port)?void 0:C.toString())||h[A.value],db_password:c.value?c.value.db_password:"",ps:(null==(D=c.value)?void 0:D.ps)||""}),"redis"!==A.value&&(I.value.db_user=c.value?c.value.db_user:x[A.value]),y({onConfirm:async()=>{await N.value.validate();let s={...I.value,db_port:Number(I.value.db_port),db_type:A.value};c.value&&(s.id=c.value.id);const a=c.value?_:g;return(await t({loading:e("正在{0}云服务器，请稍后...",[c.value?e("编辑"):e("添加")]),request:a(s),message:!0,success:()=>{m()}})).status}}),(e,s)=>(d(),n("div",K,[v(b(E),{class:"px-20px"}),v(b(l),{options:b(j)},null,8,["options"])]))}});export{A as default};
