import{P as a,iw as e,ix as n,x as t,iy as s,p as i,M as o,l,ah as r,$ as c}from"./utils-lib.js?v=1761009159";import{_ as m}from"./index105.js?v=1761009159";import{r as d,o as p,c as u,q as f,aF as _,H as y,v as b,x as w,e as g,B as h,y as C,C as v,I as j,G as k}from"./base-lib.js?v=1761009159";import{p as x}from"./useMethods.js?v=1761009159";import{c as q,a as W,u as z}from"./column.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./index106.js?v=1761009159";const D=d(),H=p({loading:!1,list:[]}),I=[{label:"删除",value:"delete",event:async(a,e,n,t)=>{const{label:i,value:o}=t,l=async(a,e)=>{const{container_id:n,container_name:t,name:i}=a;if("delete"===o)return await s({data:JSON.stringify({container_id:n,container_name:t,name:i})})};await a({title:"批量".concat(i,"容器备份"),content:"批量".concat(i,"已选的容器备份，删除后备份文件将无法恢复，是否继续操作！"),column:[{label:"文件名",prop:"name"},q()],onConfirm:async()=>(await e(l),F(),!1)})}}],M=async()=>{a({request:e({container_id:D.value.id}),message:!0,success:async a=>{a.status&&(await F(),await x(!0))}})},A=async e=>{try{await i({icon:"warning-filled",title:"删除备份文件",width:"45rem",content:"删除[".concat(e.name,"]备份文件后，该备份文件将永久消失，是否继续操作？")}),a({loading:"正在删除...",request:s({container_id:e.container_id,container_name:e.container_name,name:e.name}),success:async({status:a})=>{a&&(await F(),o.success("删除成功"))},error:a=>{o.request(a)}})}catch(n){}},B=async a=>{window.open("/download?filename="+encodeURIComponent(a.filename),"_blank","noopener,noreferrer")},F=async()=>{H.loading=!0,a({request:n({container_id:D.value.id}),data:Array,success:a=>{H.list=a,H.loading=!1}})},G={class:"p-[1.6rem]"},J=u({__name:"index",props:{compData:{default:()=>({})}},setup(a){const e=a,n=d(),s=[W({key:"name"}),{label:"文件名",prop:"name",minWidth:140},{label:"存储位置",prop:"filename",minWidth:180,isCustom:!0},{label:"文件大小",prop:"size",minWidth:86,isCustom:!0,render:a=>t(a.size)},{label:"备份时间",prop:"addtime",minWidth:120,isCustom:!0},z([{onClick:B,title:"下载"},{onClick:A,title:"删除"}])];return f(()=>{(a=>{D.value=a.compData.row,F()})(e)}),_(()=>{H.list=[],H.loading=!1,D.value={}}),(a,e)=>{const t=k,i=l,o=r,d=m,p=c,u=y("bt-loading");return b(),w("div",G,[g(d,null,{"header-left":h(()=>[g(t,{type:"primary",onClick:C(M)},{default:h(()=>e[0]||(e[0]=[v("容器备份",-1)])),_:1,__:[0]},8,["onClick"])]),content:h(()=>[j(g(i,{ref_key:"backupTable",ref:n,column:C(s),"max-height":"420",data:C(H).list,description:"备份列表为空"},null,8,["column","data"]),[[u,C(H).loading],[u,"正在加载镜像列表，请稍后...","title"]])]),"footer-left":h(()=>[g(o,{"table-ref":C(n),options:C(I)},null,8,["table-ref","options"])]),_:1}),g(p,{class:"mt-[2rem] ml-[1rem]",options:[{content:"备份任务创建成功后后台进行，可以关闭黑色窗口，备份完成可能需要1分钟以上！"}]})])}}});export{J as default};
