import{l as e,a3 as a,x as t,aa as s,am as i,Y as l,a4 as o,$ as n,a0 as c,ac as d,af as r,z as p,a1 as u,a2 as m}from"./utils-lib.js?v=20260328163632";import{u as f}from"./index92.js?v=20260328163632";import{f as w,A as v,B as y}from"./database.js?v=20260328163632";import{u as g}from"./store.js?v=20260328163632";import{r as k,k as h,o as b,V as x,W as _,O as j,a3 as C,Y as z,N as R,X as q,Z as B}from"./base-lib.js?v=20260328163632";import"./naive-ui.js?v=20260328163632";import"./__commonjsHelpers__.js?v=20260328163632";import"./env-lib.js?v=20260328163632";const{isRefreshList:S,tabActive:A,rowData:K}=g(),M=k([]),O=e=>e.id,{BtOperation:U}=f({options:[{active:!0,label:e("备份"),onClick:()=>H(K.value.id)}]}),Y=k({page:1,pageSize:20,itemCount:0,pageSlot:5}),[D]=a(Y),H=async a=>{await t({loading:e("正在备份中，请稍等..."),request:w({id:a}),success:V,message:!0}),S.value=!0},I=k({columns:[s(),{title:e("文件名称"),key:"name"},{title:e("文件大小"),key:"size",width:150,render:e=>i(e.size)},{title:e("备份时间"),key:"addtime",width:150,render:e=>l(e.addtime)},o([{onClick:async a=>{await p({content:e("数据库【{0}】将被覆盖，是否继续?",[a.name]),title:e("恢复数据库"),type:"calc"}),t({loading:e("正在恢复备份，请稍等..."),request:v({id:K.value.id,db_type:A.value,path:a.filename}),message:!0,success:e=>{e.status&&(V(),S.value=!0)}})},title:e("恢复")},{onClick:e=>{window.open("".concat(window.location.origin,"/files/download_file?filename=").concat(encodeURIComponent(e.filename)),"_self")},title:e("下载")},{onClick:async({id:a})=>{await p({content:e("删除选中数据库备份文件后，该数据库备份文件将永久消失，是否继续操作？"),title:e("删除备份文件"),type:"calc"}),await t({loading:e("正在删除备份文件，请稍等..."),request:y({id:a}),success:V,message:!0}),S.value=!0},title:e("删除")}])],data:[]}),[L,N]=n(I),V=async()=>{t({request:c({table:"backup",p:Y.value.page,limit:Y.value.pageSize,search_type:1,search:K.value.id}),success:e=>{I.value.data=e.data.data,Y.value.itemCount=e.data.page.total}})},{BtBatch:W}=d({tableRef:N,checkedRowKeys:M,options:[{label:e("删除"),value:"delete",event:async(a,t,s,i,l)=>{const{label:o,value:n}=i,c=new Map([["delete",e("即将批量删除备份文件")]]),d=async e=>{const a=new Map([["delete",y]]).get(n);if("delete"===n)if(a)return await a({id:e.id})};await a({title:e("批量{0}",[o]),content:c.get(n)+e("，是否继续操作？"),column:[{title:e("文件名称"),key:"name"},r()],onConfirm:async()=>(await t(d),V(),l&&l(),!1)})}}]}),X={class:"p-[20px]"},Z={class:"text-14px text-[var(--text-color-2)]"},$=h({__name:"index",setup:a=>(b(V),(a,t)=>(x(),_("div",X,[j(z(m),null,{"header-left":C((()=>[j(z(U),{class:"gap-10px"})])),content:C((()=>[j(z(L),{"max-height":500,"row-key":z(O),"checked-row-keys":z(M),"onUpdate:checkedRowKeys":t[0]||(t[0]=e=>R(M)?M.value=e:null)},null,8,["row-key","checked-row-keys"])])),"footer-left":C((()=>[j(z(W))])),"footer-right":C((()=>[j(z(D),{"show-size-picker":"","page-sizes":z(u)([10,20,50,100]),onRefresh:z(V)},{suffix:C((()=>[q("span",Z,B(z(e)("共 {0} 条",[z(Y).itemCount])),1)])),_:1},8,["page-sizes","onRefresh"])])),_:1})])))});export{$ as default};
