import{u as a,l as e,am as t,Y as s,$ as l,z as i,M as n,bo as o,x as r,a2 as u,_ as d}from"./utils-lib.js?v=20260328163632";import{k as p}from"./useMethod2.js?v=20260328163632";import{u as c}from"./store.js?v=20260328163632";import{y as m,z as v}from"./database.js?v=20260328163632";import{r as y,c as _,x as b,e as g,O as x,k as f,i as h,o as j,J as w,V as D,W as k,a3 as T,Y as z,Z as M,a1 as S,X as q,U as A,j as O,l as H}from"./base-lib.js?v=20260328163632";import{D as J}from"./naive-ui.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{panel:N}=a(),{tabActive:Y,refreshTableList:C}=c(),E=y(!1),F=y(!1),I=_((()=>N.value.isDbRecycle)),L=y(),P=b([]),R=y([]),U=y(!1),V=y(),W=y(),X=g({title:e("警告"),titleType:"warning",description:e("删除数据库后，数据库内的所有数据将被清空，且不可恢复。")}),Z=y({columns:[{title:e("数据库名称"),key:"name"},{title:e("数据库大小"),key:"size",render:a=>t(a.size,!0,2)},{title:e("数据库位置"),render:a=>{var t;let s=e("本地数据库");return null==(t=P.value)||t.forEach((t=>{t.id===a.sid&&(s="mysql"===Y.value?t.db_host:t.ps,"127.0.0.1"===t.db_host&&(s=e("本地数据库")))})),x("span",{title:s},[s])}},{width:160,title:e("创建时间"),key:"addtime",render:a=>s(a.addtime)},{width:100,title:e("删除结果"),render:a=>0===a.sid&&I.value?x("span",null,[e("移至回收站")]):x("span",{class:"text-danger"},[e("彻底删除")])}],data:[]}),[$,B]=l(Z),G=async a=>{await i({type:"input",title:e("二次验证信息-删除数据库"),content:"<span>\n        ".concat(e("移至回收站的数据库如需彻底删除请前往数据库回收站，"),'\n        <span class="text-danger">').concat(e("远程数据库将直接彻底删除"),"</span>\n        ").concat(e("，是否继续操作？"),"\n      </span>"),icon:"warning-filled",isHtml:!0,input:{content:e("删除数据库")}});const t=n.load(e("正在删除数据库，请稍后..."));if(U.value){let a=[];await Promise.all(V.value.map((async e=>{try{const t=await m({id:e.id});a.push({name:null==e?void 0:e.name,msg:t.msg,status:t.status})}catch(t){}}))),W.value&&W.value(),o(a,{title:e("删除")}),C()}else{0===(await r({request:m({id:R.value[0]}),message:!0,data:{status:Number}})).status&&C()}t.close(),a&&a()},K=()=>{(async()=>{const a=await p();P.value=a})(),(async()=>{L.value(!1),r({loading:E,request:v({ids:JSON.stringify(R.value),db_type:Y.value}),success:a=>{var t;(null==a?void 0:a.data)&&Array.isArray(a.data)&&(a.data,Z.value.data=a.data,F.value=null==(t=a.data)?void 0:t.some((a=>a.sid)),F.value&&(X.titleType="error",X.description=e("当前列表存在彻底删除后无法恢复的数据库，请仔细查看列表，以防误删，是否继续操作？")),L.value(!0))}})})()},Q=()=>{E.value=!1,F.value=!1,P.value=[],Z.value.data=[],Object.assign(X,{title:e("警告"),titleType:"warning",description:e("删除数据库后，数据库内的所有数据将被清空，且不可恢复。")})},aa={class:"p-[28px]"},ea={key:0,class:"text-danger"},ta={class:"text-danger mt-4px"},sa={key:1,class:"text-danger mt-[4px]"},la=d(f({__name:"index",props:{compData:{default:()=>({ids:[],isMult:!1,rows:{}})}},setup(a,{expose:t}){const s=a;return L.value=h("popupSetFooter",(a=>{})),j((()=>{var a;R.value=s.compData.ids,U.value=s.compData.isMult,V.value=s.compData.rows,(null==(a=s.compData)?void 0:a.clearSelection)&&(W.value=s.compData.clearSelection),K()})),w(Q),t({onConfirm:G}),(a,t)=>{const s=J,l=A("bt-loading");return D(),k("div",aa,[x(s,{title:z(e)("警告"),type:z(X).titleType,"show-icon":"",closable:!1},{header:T((()=>[O(M(z(X).description),1)])),_:1},8,["title","type"]),x(z(u),null,{content:T((()=>[H(x(z($),{"max-height":300},null,512),[[l,z(E)],[l,z(e)("正在检查删除数据，请稍候..."),"title"]])])),_:1}),z(F)?(D(),k("p",ea,M(z(e)("注意：远程数据库暂不支持数据库回收站，选中的数据库将彻底删除")),1)):S("",!0),q("p",ta,M(z(e)("请仔细阅读以上要删除信息，防止数据库被误删")),1),z(I)||z(F)?S("",!0):(D(),k("p",sa,M(z(e)("当前数据库回收站尚未开启，请谨慎操作！")),1))])}}}),[["__scopeId","data-v-7a0c7317"]]);export{la as default};
