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