import{_ as e}from"./index.vue_vue_type_script_setup_true_lang2.js?v=20260328163632";import{B as a}from"./index97.js?v=20260328163632";import{l as s,L as t,x as l,aa as o,ao as u,av as n,a4 as r,$ as i,ac as p,M as c,a3 as d,a0 as v,q as m,a1 as _,a2 as f}from"./utils-lib.js?v=20260328163632";import{B as h}from"./index91.js?v=20260328163632";import{u as x}from"./store.js?v=20260328163632";import{a as g,b as y,c as k,f as b,g as j,h as w,j as C,o as R,s as S,l as B,i as V,k as U,t as z}from"./useMethod2.js?v=20260328163632";import{_ as O}from"./index.vue_vue_type_script_setup_true_lang3.js?v=20260328163632";import{u as q}from"./index92.js?v=20260328163632";import{s as D,g as K}from"./database.js?v=20260328163632";import{B as M,s as H,n as L,au as P}from"./naive-ui.js?v=20260328163632";import{k as F,r as I,V as J,W as N,O as W,a3 as X,Y,N as Z,j as $,Z as A,X as E,c as G,w as Q,o as T,J as ee,_ as ae,a1 as se,F as te,K as le}from"./base-lib.js?v=20260328163632";import"./__commonjsHelpers__.js?v=20260328163632";import"./env-lib.js?v=20260328163632";import"./index85.js?v=20260328163632";import"./service.vue_vue_type_style_index_0_scoped_073b5b46_lang.js?v=20260328163632";const oe={class:"p-20px"},ue={class:"flex items-center leading-32px"},ne={class:"mr-8px"},re={class:"mt-8px leading-8 text-[12px] list-disc ml-20px"},ie=F({__name:"index",setup(e){const{safetyStatus:a}=x(),o=I(!1),u=async()=>{l({loading:s("正在设置安全状态，请稍候..."),request:D({status:a.value}),message:!0,success:e=>{e.status?Ve():a.value=!a.value}})};return(e,l)=>{const n=M,r=H;return J(),N("div",null,[W(n,{type:"default",onClick:l[0]||(l[0]=e=>o.value=!0)},{default:X((()=>[$(A(Y(s)("安全认证")),1)])),_:1}),W(Y(t),{title:Y(s)("安全认证"),modelValue:Y(o),"onUpdate:modelValue":l[2]||(l[2]=e=>Z(o)?o.value=e:null),area:400},{default:X((()=>[E("div",oe,[E("div",ue,[E("span",ne,A(Y(s)("安全认证：")),1),W(r,{value:Y(a),"onUpdate:value":[l[1]||(l[1]=e=>Z(a)?a.value=e:null),u],width:36},null,8,["value"])]),E("ul",re,[E("li",null,A(Y(s)("安全认证：开启后访问数据需要使用帐号和密码")),1)])])])),_:1},8,["title","modelValue"])])}}}),{safetyStatus:pe,pluginInfo:ce,rowData:de,isHaveServer:ve}=x(),me=I(""),_e=I(""),fe=I([]),he=e=>e.id;I("");const xe=G((()=>{var e;return-1===(null==(e=ce.value)?void 0:e.status_code)&&!ve.value})),ge=I(""),ye=I({columns:[o(),{title:s("数据库名"),key:"name"},{title:s("用户名"),key:"username",...u()},n({width:160,event:b}),g({event:(e,a)=>{V(e,a)}}),y(),k(),r([{onClick:b,title:s("改密")},{onClick:j,title:s("删除")}])],data:[]}),ke=I({page:1,pageSize:20,itemCount:0,pageSlot:5}),[be,je]=i(ye),[we]=d(ke),{BtBatch:Ce}=p({tableRef:je,checkedRowKeys:fe,options:[...w()]}),{BtOperation:Re}=q({options:[{active:!0,label:s("添加数据库"),onClick:()=>{C()}},{label:s("root密码"),onClick:async()=>{pe.value?B({rootPwd:ge.value,refresh:Ve},s("修改数据库密码")):c.error("请先开启安全认证")}},{type:"custom",render:()=>W(ie,null,null)},{label:s("远程服务器"),onClick:R},{type:"custom",render:()=>W(O,{compData:S.value},null)}]}),Se=()=>{ke.value.page=1,Be()},Be=()=>{let e={table:"databases",search_type:"mongodb",search:_e.value,p:ke.value.page,limit:ke.value.pageSize};""!==me.value&&(e.type=me.value),l({request:v(e),success:e=>{ye.value.data=e.data.data||[],ke.value.itemCount=e.data.page.total}})},Ve=async()=>{try{const e=await K({db_type:"mongodb"});(null==e?void 0:e.data.hasOwnProperty("auth"))&&(pe.value=e.data.auth,ge.value=e.data.db_password)}catch(e){}},Ue=async()=>{ze(),Ve(),U(),Be()},ze=()=>{de.value=null,_e.value="",Object.assign(ke.value,{page:1,itemCount:0})},Oe={class:"text-14px text-[var(--text-color-2)]"},qe=F({__name:"index",setup(t){const{isRefreshList:l}=x();return Q((()=>l.value),(e=>{e&&(Be(),l.value=!1)})),T(Ue),ee(ze),(t,l)=>{const o=L,u=P;return J(),N(te,null,[Y(xe)?(J(),ae(a,{key:0},{content:X((()=>[W(e,{type:"MongoDB"})])),_:1})):se("",!0),W(Y(f),null,{"header-left":X((()=>[W(Y(Re),{class:"gap-10px"})])),"header-right":X((()=>[W(u,{class:"!gap-10px"},{default:X((()=>[W(o,{value:Y(me),"onUpdate:value":[l[0]||(l[0]=e=>Z(me)?me.value=e:null),Y(Se)],options:Y(z),class:le([{"select-active":""!==Y(me)},"!w-140px"]),"consistent-menu-width":!1},null,8,["value","options","class","onUpdate:value"]),W(Y(m),{modelValue:Y(_e),"onUpdate:modelValue":l[1]||(l[1]=e=>Z(_e)?_e.value=e:null),placeholder:Y(s)("请输入数据库名称/备注"),class:"!w-[220px]",onSearch:Y(Se)},null,8,["modelValue","placeholder","onSearch"]),W(Y(h),{onRefresh:Y(Be)},null,8,["onRefresh"])])),_:1})])),content:X((()=>[W(Y(be),{"checked-row-keys":Y(fe),"onUpdate:checkedRowKeys":l[2]||(l[2]=e=>Z(fe)?fe.value=e:null),"row-key":Y(he),"scroll-x":1e3},null,8,["checked-row-keys","row-key"])])),"footer-left":X((()=>[W(Y(Ce))])),"footer-right":X((()=>[W(Y(we),{"show-size-picker":"","page-sizes":Y(_)([10,20,50,100]),onRefresh:Y(Be)},{suffix:X((()=>[E("span",Oe,A(Y(s)("共 {0} 条",[Y(ke).itemCount])),1)])),_:1},8,["page-sizes","onRefresh"])])),_:1})],64)}}});export{qe as default};
