import{_ as a}from"./index.vue_vue_type_script_setup_true_lang.js?v=1753954525509";import{b1 as e,eg as s,o as t,m as l}from"./page_layout.js?v=1753954525509";import{_ as r}from"./index.vue_vue_type_script_setup_true_lang2.js?v=1753954525509";import{k as o,P as d,$ as i,r as n,e as u,c as p,U as _,a1 as m,a2 as c,Q as b,W as v,X as f,l as x,v as g,j as h,a3 as j,N as w}from"./vue.js?v=1753954525509";import"./public.js?v=1753954525509";import{g as D}from"./index126.js?v=1753954525509";import{aq as $,cA as y,cG as U}from"./naive.js?v=1753954525509";import"./common.js?v=1753954525509";import"./__commonjsHelpers__.js?v=1753954525509";import"./index96.js?v=1753954525509";import"./index127.js?v=1753954525509";import"./soft.js?v=1753954525509";const q={class:"w-240px"},k={class:"w-240px"},C={class:"w-240px"},E={class:"w-240px"},R={class:"ml-8px"},A=o({__name:"index",props:{data:{}},setup(o,{expose:A}){const{t:G}=d(),H=o,{status:L}=H.data,N=e(),{remoteList:P}=i(N),Q=n(null),W=u({sid:P.value.length>0?P.value[0].id:null,name:"",db_user:"",password:"",active:!1,ssl:""}),X=p((()=>P.value.map((a=>({label:"".concat(a.ps," (").concat(a.db_host,")"),value:a.id}))))),z={name:{required:!0,message:G("Database.form.index_15"),trigger:["blur","change"]},db_user:{required:!0,message:G("Database.form.index_16"),trigger:["blur","change"]},password:{required:!0,message:G("Database.form.index_17"),trigger:["blur","change"]},sid:{trigger:"change",validator:(a,e)=>null!==e||new Error(G("Database.tools.index_64"))}},B=a=>{W.db_user=a},F=()=>{D()};return A({onConfirm:async({hide:a})=>{var e;try{await(null==(e=Q.value)?void 0:e.validate());const t=(()=>{const{sid:a}=W;if(null===a)throw l.error(G("Database.tools.index_64")),new Error(G("Database.tools.index_64"));return{...w(W),sid:a,ps:W.name}})();await s(N.type,t),N.setRefresh(!0),a()}catch(t){console.error(t)}}}),(e,s)=>{const l=$,o=y,d=r,i=U,n=t,u=a;return _(),m(u,{ref_key:"formRef",ref:Q,model:f(W),rules:z,class:"p-20px"},{default:c((()=>[b(o,{label:e.$t("Database.index_12"),path:"name"},{default:c((()=>[v("div",q,[b(l,{value:f(W).name,"onUpdate:value":[s[0]||(s[0]=a=>f(W).name=a),B],placeholder:e.$t("Database.form.index_2")},null,8,["value","placeholder"])])])),_:1},8,["label"]),x(b(o,{label:e.$t("Database.index_13"),path:"db_user"},{default:c((()=>[v("div",k,[b(l,{value:f(W).db_user,"onUpdate:value":s[1]||(s[1]=a=>f(W).db_user=a),placeholder:e.$t("Database.form.index_4")},null,8,["value","placeholder"])])])),_:1},8,["label"]),[[g,f(L)]]),x(b(o,{label:e.$t("Database.index_14"),path:"password"},{default:c((()=>[v("div",C,[b(d,{value:f(W).password,"onUpdate:value":s[2]||(s[2]=a=>f(W).password=a)},null,8,["value"])])])),_:1},8,["label"]),[[g,f(L)]]),b(o,{label:e.$t("Database.form.index_9"),path:"sid"},{default:c((()=>[v("div",E,[b(i,{value:f(W).sid,"onUpdate:value":s[3]||(s[3]=a=>f(W).sid=a),options:f(X)},null,8,["value","options"])]),v("div",R,[b(n,{onClick:F},{default:c((()=>[h(j(e.$t("Database.form.index_10")),1)])),_:1})])])),_:1},8,["label"])])),_:1},8,["model"])}}});export{A as default};
