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