import{l as e,K as s,N as a,t,x as l}from"./utils-lib.js?v=20260328163632";import{B as r}from"./index85.js?v=20260328163632";import{s as u,o as i,k as o}from"./useMethod2.js?v=20260328163632";import{p as n}from"./database.js?v=20260328163632";import{u as p}from"./store.js?v=20260328163632";import{r as d,O as m,c,k as b,V as _,_ as v,Y as y}from"./base-lib.js?v=20260328163632";import"./naive-ui.js?v=20260328163632";import"./__commonjsHelpers__.js?v=20260328163632";import"./env-lib.js?v=20260328163632";import"./service.vue_vue_type_style_index_0_scoped_073b5b46_lang.js?v=20260328163632";const{isRefreshList:g}=p(),h={labelStyle:"min-width: 100px"},f=d({label:e("数据库名"),attrs:h,ruleKey:"name",rules:[s({message:e("请输入数据库名"),trigger:["blur","input"]})],children:[{type:"input",key:"name",attrs:{class:"!w-380px",placeholder:e("新的数据库名称"),onInput:e=>{C.value.db_user=e,C.value.ps=e}}}]}),w=d({label:e("用户名"),attrs:h,ruleKey:"db_user",rules:[s({message:e("请输入数据库用户名"),trigger:["blur","input"]})],children:[{type:"input",key:"db_user",attrs:{class:"!w-380px",placeholder:e("请输入数据库用户名")}}]}),j=d({label:e("密码"),attrs:h,ruleKey:"db_password",rules:[s({message:e("请输入密码"),trigger:["blur","input"]})],children:[{type:"custom",key:"db_password",render:()=>m(r,{width:"340px",icon:"el-refresh",modelValue:C.value.db_password,"onUpdate:modelValue":e=>C.value.db_password=e,onIconClick:()=>C.value.db_password=a(16),isActive:!0},null)}]}),x=c((()=>({label:e("添加至"),attrs:h,style:{"align-items":"center",width:"100%"},children:[{type:"select",key:"sid",attrs:{consistentMenuWidth:!1,placeholder:e("请选择"),options:u.value}},{type:"custom",key:"",render:()=>m("span",{class:"bt-link ml-10px",onClick:i},[e("管理远程数据库")])}]}))),k=d({formAttrs:{labelWidth:"auto"},formItems:[]}),I=c((()=>(k.value.formItems=[f.value,w.value,j.value,x.value],k.value))),[K,C,V]=t(I),q=async()=>{const{address:s,...a}=C.value;let t={...a,db_type:"pgsql"};const r=await l({loading:e("正在添加数据库"),request:n(t),message:!0,data:{status:Number}});return 0===r.status&&(g.value=!0),0===r.status},A=b({__name:"index",setup:(e,{expose:s})=>((async()=>{await o(),Object.assign(C.value,{name:"",db_user:"",db_password:a(16),sid:u.value.length&&u.value[0].value||0})})(),s({onConfirm:q}),(e,s)=>(_(),v(y(K),{class:"p-24px"})))});export{A as default};
