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