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