import{_ as a}from"./index105.js?v=1761009159";import{u as e,p as t,M as s,P as l,l as i,x as n}from"./utils-lib.js?v=1761009159";import{c as r,r as o,V as p,aA as d,o as u,q as c,H as m,v as y,x as v,e as f,y as g,B as x,I as b,D as h,z as w,aY as j,aD as q}from"./base-lib.js?v=1761009159";import{batchDelMysqlData as _,deleteDatabase as D,checkDelData as S,checkModulesDelData as A,getMysqlCloudServer as J,getModulesCloudServer as M}from"./database.js?v=1761009159";import{x as N}from"./useMethod4.js?v=1761009159";import{g as O}from"./useStore2.js?v=1761009159";import{h as T,i as H}from"./validator.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./column.js?v=1761009159";import"./index106.js?v=1761009159";const k={class:"p-[28px]"},R={key:0,class:"text-danger"},z={key:1,class:"text-danger mt-[4px]"},B=r({__name:"index",props:{compData:{default:()=>({ids:[],isMult:!1,rows:[],config:{enable:!1,exclude:[]}})}},setup(r,{expose:B}){var C;const E=r,{refs:{tabActive:F},refreshTableList:I}=O(),{panel:L}=e(),{enable:P,exclude:V}=null==(C=E.compData)?void 0:C.config,{ids:Y,isMult:G}=E.compData,K=o(!1),Q=p([]),U=o(L.value.isDbRecycle),W=p([]),X=p(!1),Z=d("popupSetFooter"),$=u({title:"警告",titleType:"warning",description:"删除数据库后，数据库内的所有数据将被清空，且不可恢复。"}),aa=async(a,e,t)=>{const{id:i,name:n}=W.value[e],r="mysql"===F.value?null:F.value,o=await l({request:D({id:i,name:n},r)});a.push({id:i,name:n,status:o.status}),e===W.value.length-1&&(I(),t?N(a,{title:"删除数据库"}):s.request(o)),e<W.value.length-1&&aa(a,e+1,t)},ea=[{label:"数据库名称",prop:"name"},{label:"数据库大小",prop:"total",render:a=>q("span",n(a.total,!0,2))},{label:"数据库位置",render:a=>{var e;let t="本地数据库";return null==(e=Q.value)||e.forEach(e=>{e.id===a.sid&&(t="mysql"===F.value?e.db_host:e.ps,"127.0.0.1"===e.db_host&&(t="本地数据库"))}),q("span",t)}},{width:160,label:"创建时间",prop:"addtime"},{width:100,label:"删除结果",render:a=>{let e=0===a.sid;return e&&U.value?q("span","移至回收站"):q("span",{class:"text-danger"},"彻底删除")}}];return c(()=>{(async()=>{let a={data:JSON.stringify({type:F.value})};await l({request:"mysql"===F.value?J():M(a,F.value),data:[Array,Q]})})(),(async()=>{Z(!1);const{data:a}=await l({loading:X,request:"mysql"===F.value?S({ids:JSON.stringify(Y)}):A({data:JSON.stringify({ids:JSON.stringify(Y)})},F.value),data:{data:[Array,W]}});K.value=null==a?void 0:a.some(a=>a.sid),K.value&&($.titleType="error",$.description="当前列表存在彻底删除后无法恢复的数据库，请仔细查看列表，以防误删，是否继续操作？"),Z(!0)})()}),B({onConfirm:async a=>{await t({type:"input",title:"二次验证信息-删除数据库",content:'移至回收站的数据库如需彻底删除请前往数据库回收站，<span class="text-danger">远程数据库将直接彻底删除</span>，是否继续操作？',icon:"warning-filled",isHtml:!0,input:{content:"删除数据库"}});let e=[];const l=s.load("正在删除...");if(G&&"mysql"===F.value){const a=T(E.compData.rows,V,P),e=await _(a),{data:t}=H(e.data);N(t,{title:"删除"}),I()}else await aa(e,0,G);l.close(),a()}}),(e,t)=>{const s=j,l=i,n=a,r=m("bt-loading");return y(),v("div",k,[f(s,{title:"警告",type:g($).titleType,"show-icon":"",closable:!1,description:g($).description},null,8,["type","description"]),f(n,null,{content:x(()=>[b(f(l,{ref:"deleteRef",data:g(W),column:g(ea),"max-height":300},null,8,["data","column"]),[[r,g(X)],[r,"正在检查删除数据，请稍候...","title"]])]),_:1}),g(K)?(y(),v("p",R,"注意：远程数据库暂不支持数据库回收站，选中的数据库将彻底删除")):h("",!0),t[0]||(t[0]=w("p",{class:"text-danger mt-4px"},"请仔细阅读以上要删除信息，防止数据库被误删",-1)),g(U)||g(K)?h("",!0):(y(),v("p",z,"当前数据库回收站尚未开启,请谨慎操作!"))])}}});export{B as default};
