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