import{_ as a}from"./index105.js?v=1761009159";import{_ as e}from"./index114.js?v=1761009159";import{P as s,e as l,O as t,l as o,ah as r,W as n}from"./utils-lib.js?v=1761009159";import{c as i,r as u,o as d,V as p,g as m,w as c,q as _,H as f,v,x as g,y as b,N as y,B as h,e as j,D as x,z as w,C as k,Q as C,K as q,F as S,b0 as V,I as U,G as A,ak as H,al as N,A as O}from"./base-lib.js?v=1761009159";import{_ as R}from"./index133.js?v=1761009159";import{g as T}from"./useStore2.js?v=1761009159";import{d as J,o as L,a as z,f as B,i as D,g as F,j as G}from"./useMethod4.js?v=1761009159";import{a as I,g as K,u as M}from"./column.js?v=1761009159";import{getModulesCloudServer as P,getModulesList as Q}from"./database.js?v=1761009159";import{e as W}from"./validator.js?v=1761009159";import{_ as E}from"./index.vue_vue_type_script_setup_true_lang4.js?v=1761009159";import{_ as X}from"./index.vue_vue_type_script_setup_true_lang3.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./index106.js?v=1761009159";import"./index.vue_vue_type_style_index_0_scoped_cdc7f4d3_lang.js?v=1761009159";const Y={class:"flex items-center"},Z={class:"w-[20rem] truncate inline-block"},$=i({__name:"index",setup(i){const{refs:{isRefreshTable:$,isLoading:aa,isHaveServer:ea},resetRefresh:sa,refreshTableList:la}=T(),ta=u(null),oa=u([]),ra=d({total:0,page:1,row:10}),na=p([]),ia=u("all"),ua=u(""),da=u([]),pa=J().filter(a=>"back"!==a.value),ma=m(()=>!ea.value),ca=async()=>(await s({request:P({data:JSON.stringify({type:"sqlserver"})},"mongodb"),data:[Array,da]}),da.value.length||(ea.value=!1),da.value),_a=async()=>{let a={p:ra.page,limit:ra.row,tables:"databases",search:ua.value,sid:"all"===ia.value?"":ia.value};""===a.sid&&delete a.sid,await s({loading:aa,request:Q({data:JSON.stringify(a)},"sqlserver"),data:{data:[Array,oa],page:n(ra)}})},fa=async()=>{_a(),await ca(),na.value=[I(),...B(D),F(da.value,"sqlserver"),K({table:"databases"}),M([{onClick:a=>D(a),title:"改密"},{onClick:a=>G(a),title:"删除"}])]};return c(()=>$.value,async a=>{a&&await _a(),sa()}),_(()=>fa()),(s,n)=>{const i=R,u=A,d=l,p=H,m=N,c=t,_=o,T=r,J=e,B=a,D=f("bt-loading");return v(),g("div",null,[b(ma)?(v(),y(i,{key:0},{content:h(()=>[j(X,{type:"SqlServer"})]),_:1})):x("",!0),j(B,null,{"header-left":h(()=>[w("div",Y,[j(u,{type:"primary",onClick:n[0]||(n[0]=a=>b(L)(ca))},{default:h(()=>n[6]||(n[6]=[k("添加数据库",-1)])),_:1,__:[6]}),j(u,{onClick:b(z)},{default:h(()=>n[7]||(n[7]=[k("远程数据库",-1)])),_:1,__:[7]},8,["onClick"]),j(E,{"comp-data":b(da),class:"ml-[10px]"},null,8,["comp-data"]),j(d,{onClick:n[1]||(n[1]=a=>b(W)({name:"数据库",type:12})),icon:"desired",class:"ml-[12px]",iconClass:"text-medium"},{default:h(()=>n[8]||(n[8]=[k("需求反馈",-1)])),_:1,__:[8]})])]),"header-right":h(()=>[j(m,{modelValue:b(ia),"onUpdate:modelValue":n[2]||(n[2]=a=>C(ia)?ia.value=a:null),onChange:b(la),class:q(["!w-[14rem] mr-[8px]",{"custom-types-bg-green":"all"!==b(ia)}])},{default:h(()=>[j(p,{label:"全部",value:"all"}),(v(!0),g(S,null,V(b(da),(a,e)=>(v(),y(p,{key:e,label:"".concat("all"!==b(ia)?"已选：":"").concat(a.ps),value:a.id},{default:h(()=>[w("span",Z,O(a.ps),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","onChange","class"]),j(c,{class:"w-[26rem]",modelValue:b(ua),"onUpdate:modelValue":n[3]||(n[3]=a=>C(ua)?ua.value=a:null),onSearch:b(la),placeholder:"请输入数据库名称/备注"},null,8,["modelValue","onSearch"])]),content:h(()=>[U(j(_,{ref_key:"sqlTableRef",ref:ta,column:b(na),data:b(oa)},null,8,["column","data"]),[[D,b(aa)]])]),"footer-left":h(()=>[j(T,{options:b(pa),"table-ref":b(ta)},null,8,["options","table-ref"])]),"footer-right":h(()=>[j(J,{total:b(ra).total,page:b(ra).page,"onUpdate:page":n[4]||(n[4]=a=>b(ra).page=a),row:b(ra).row,"onUpdate:row":n[5]||(n[5]=a=>b(ra).row=a),onChange:b(la)},null,8,["total","page","row","onChange"])]),_:1})])}}});export{$ as default};
