import{l as e,K as s,aA as a,t,x as l,a0 as r,v as i}from"./utils-lib.js?v=20260328163632";import{B as u}from"./index85.js?v=20260328163632";import{s as o,o as n,k as p}from"./useMethod2.js?v=20260328163632";import{p as d}from"./database.js?v=20260328163632";import{u as m}from"./store.js?v=20260328163632";import{r as c,O as v,c as b,k as _,J as y,V as h,W as g,Y as w}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:f}=m(),x=[{content:e("若无法添加数据库，请按以下操作配置：")},{content:e("通过管理工具连接上 SQL Server")},{content:e("依次找到安全性 - 登录名 - NT AUTHORITYSYSTEM - 属性 - 服务器角色 - 勾选列表中的 sysadmin")},{content:e("重启 SQL Server 服务")}],j=c([]),k=c({label:e("数据库名"),ruleKey:"name",rules:[s({message:e("请输入数据库名"),trigger:["blur","input"]})],children:[{type:"input",key:"name",attrs:{class:"!w-380px",placeholder:e("新的数据库名称"),onInput:e=>{L.value.db_user=e,L.value.ps=e}}}]}),S=c({label:e("用户名"),ruleKey:"db_user",rules:[s({message:e("请输入数据库用户名"),trigger:["blur","input"]})],children:[{type:"input",key:"db_user",attrs:{class:"!w-380px",placeholder:e("请输入数据库用户名")}}]}),I=c({label:e("密码"),ruleKey:"db_password",rules:[s({message:e("请输入密码"),trigger:["blur","input"]})],children:[{type:"custom",key:"db_password",render:()=>v(u,{width:"340px",icon:"el-refresh",modelValue:L.value.db_password,"onUpdate:modelValue":e=>L.value.db_password=e,onIconClick:()=>L.value.db_password=a(16,"wp"),isActive:!0},null)}]}),A=b((()=>({label:e("关联网站"),children:[{type:"select",key:"pid",attrs:{class:"!w-380px",options:j.value,placeholder:e("请选择")}}]}))),K=b((()=>({label:e("添加至"),style:{"align-items":"center",width:"100%"},children:[{type:"select",key:"sid",attrs:{consistentMenuWidth:!1,placeholder:e("请选择"),options:o.value}},{type:"custom",key:"",render:()=>v("span",{class:"bt-link ml-10px",onClick:n},[e("管理远程数据库")])}]}))),T=c({formAttrs:{labelWidth:"auto"},formItems:[]}),q=b((()=>(T.value.formItems=[k.value,S.value,I.value,A.value,K.value],T.value))),[C,L,M]=t(q),O=async()=>{const{address:s,pid:a,...t}=L.value;let r={...t,db_type:"sqlserver"};""!==a&&(r.pid=a);const i=await l({loading:e("正在添加数据库"),request:d(r),message:!0,data:{status:Number}});return 0===i.status&&(f.value=!0),0===i.status},V=async()=>{await p(),l({request:r({table:"sites"}),success:s=>{let a=s.data.data.map((e=>({...e,label:e.name,value:e.id})));a.unshift({label:e("不关联"),value:""}),j.value=a}}),Object.assign(L.value,{pid:"",name:"",db_user:"",db_password:a(16,"wp"),sid:o.value.length&&o.value[0].value||0})},W=()=>{j.value=[]},Y={class:"p-24px px-40px"},H=_({__name:"index",setup:(e,{expose:s})=>(V(),y(W),s({onConfirm:O}),(e,s)=>(h(),g("div",Y,[v(w(C)),v(w(i),{options:w(x)},null,8,["options"])])))});export{H as default};
