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