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