import{_ as a}from"./index105.js?v=1761009159";import{V as e,x as s,P as l,p as t,h5 as i,l as o,j as n}from"./utils-lib.js?v=1761009159";import{c as r,r as d,bP as m,aD as p,q as u,H as c,v as f,x as g,e as _,B as y,C as b,I as v,y as w,Q as h,z as x,F as j,b0 as k,G as V,al as q,N as C,ak as O}from"./base-lib.js?v=1761009159";import{g as S}from"./useStore2.js?v=1761009159";import{getRedisBackupList as D,restoreModuleBack as N,backModuleDatabase as J}from"./database.js?v=1761009159";import{u as L}from"./column.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./index106.js?v=1761009159";const T={class:"p-20px"},z={class:"flex items-center p-20px"},B=r({__name:"index",props:{compData:{default:()=>({sid:0,keyList:[]})}},setup(r){const B=r,{refreshTableList:H}=S(),P=d(!1),U=d([]),A=d(0),F=d(!1),G=m(B.compData,"keyList"),I=m(B.compData,"sid"),Q=async()=>{await l({loading:P,request:D({data:JSON.stringify({sort:"desc"})}),data:[Array,U]})},E=async()=>{await l({loading:"正在备份数据库,请稍后...",request:J({},"redis"),message:!0}),Q()},K=async()=>{await l({loading:"正在备份数据库,请稍后...",request:J({data:JSON.stringify({db_idx:String(A.value),sid:I.value})},"redis"),message:!0}),Q(),F.value=!1},M=[{label:"名称",prop:"name",showOverflowTooltip:!0},{label:"路径",prop:"filepath",showOverflowTooltip:!0},{label:"备份时间",prop:"mtime",render:a=>p("span",e(a.mtime))},{label:"大小",render:a=>p("span",s(a.size))},L([{onClick:async a=>{await t({title:"覆盖数据",icon:"warning-filled",type:"input",input:{content:"覆盖数据"},content:"即将使用【"+a.name+"】对数据进行覆盖，是否继续?"}),await l({loading:"正在恢复备份中，请稍后...",request:N({data:JSON.stringify({file:a.filepath,sid:I.value})},"redis"),message:!0}),H()},title:"恢复"},{onClick:async a=>{await t({title:"删除备份【"+a.name+"】",content:"是否删除【"+a.name+"】备份?"}),await l({loading:"正在备份数据库,请稍后...",request:i({path:a.filepath}),message:!0}),Q()},title:"删除"}])];return u(()=>Q()),(e,s)=>{const l=V,t=o,i=O,r=q,d=n,m=a,p=c("bt-loading");return f(),g("div",T,[_(m,null,{"header-left":y(()=>[_(l,{type:"primary",onClick:E},{default:y(()=>s[3]||(s[3]=[b("立即备份",-1)])),_:1,__:[3]}),_(l,{onClick:s[0]||(s[0]=a=>F.value=!0)},{default:y(()=>s[4]||(s[4]=[b("指定备份",-1)])),_:1,__:[4]})]),content:y(()=>[v(_(t,{"max-height":"400",ref:"routeBackup",data:w(U),class:"h-full",column:M},null,8,["data"]),[[p,w(P)],[p,"正在加载备份列表，请稍后...","title"]])]),popup:y(()=>[_(d,{area:36,title:"指定备份数据库",onConfirm:K,"show-footer":"",modelValue:w(F),"onUpdate:modelValue":s[2]||(s[2]=a=>h(F)?F.value=a:null)},{default:y(()=>[x("div",z,[s[5]||(s[5]=b(" 数据库 ",-1)),_(r,{modelValue:w(A),"onUpdate:modelValue":s[1]||(s[1]=a=>h(A)?A.value=a:null),class:"ml-20px !w-[24rem]"},{default:y(()=>[(f(!0),g(j,null,k(w(G),(a,e)=>(f(),C(i,{key:e,value:a.id,label:a.name},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])])]),_:1},8,["modelValue"])]),_:1})])}}});export{B as default};
