import{p as a,n as e,Q as t,P as s,cI as o,W as l,l as i,ah as r,b as n}from"./utils-lib.js?v=1761009159";import{_ as p}from"./index105.js?v=1761009159";import{_ as u}from"./index114.js?v=1761009159";import{_ as c}from"./index126.js?v=1761009159";import{c as m,r as d,o as f,q as b,H as _,v as h,x as g,e as w,B as k,C as y,I as j,y as v,V as x,G as C}from"./base-lib.js?v=1761009159";import{c as R,a as H,h as q,g as D,u as A}from"./column.js?v=1761009159";import{p as I}from"./useController6.js?v=1761009159";import{DelBackup as T,BackupSite as B}from"./site.js?v=1761009159";import{u as E}from"./useStore4.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./index106.js?v=1761009159";import"./validator.js?v=1761009159";const L={class:"h-full"},O=m({__name:"index",props:{compData:{default:()=>[]}},setup(m){const O=m,{isRefreshList:P}=E(),S=n(),U=d(!1),V=d(),z=d([]),G=d(),Q=[{label:"删除",value:"delete",event:async(a,e,t,s)=>{const o=async a=>await T({id:a.id});await a({title:"批量删除备份文件",content:"批量删除已选备份文件，是否继续操作？",column:[{prop:"filename",label:"文件名"},R()],onConfirm:async()=>(await e(o),await X(),P.value=!0,!1)})}}],{id:W,name:$}=O.compData,F=f({p:1,limit:10,search:W,type:0,table:"backup",total:0}),J=a=>{a.backup_status?S.error("备份中的文件不可下载"):window.open("/download?filename="+a.filename,"_self","noopener,noreferrer")},K=async(e,t=!1)=>{try{"boolean"!=typeof t&&(t=!1),t||await a({width:"40rem",title:"删除备份",content:'<p>删除选中站点备份文件后，<span class="text-danger">该站点备份文件将永久消失</span>，是否继续？</p>',icon:"warning-filled",isHtml:!0});const s=await T({id:e.id});return t||(S.request(s),P.value=!0),await X(),0===z.value.length&&(F.p=1,X()),s}catch(s){}},M=a=>{e({isAsync:!0,title:"备份日志",area:64,compData:a,component:()=>t(()=>import("./backup-log.js?v=1761009159"),__vite__mapDeps([]),import.meta.url)})},N=async()=>{(await s({loading:"正在备份站点...",request:B({id:W,backstage:1}),message:!0})).status&&(X(),P.value=!0)},X=async(a=!1,e=!0)=>{e&&(U.value=!0),await s({request:o({p:F.p,limit:F.limit,search:W,type:F.type.toString(),table:"backup"}),data:{data:[Array,z],page:l(F)}}),e&&(U.value=!1),a&&S.success("刷新成功"),clearTimeout(G.value),z.value.some(a=>1===a.backup_status)&&(G.value=setTimeout(()=>{X(!1,!1)},3e3))},Y=x([H(),{label:"文件名称",prop:"name"},{label:"存储位置",width:100,render:a=>{if(-1!=a.filename.indexOf("|")){let e=a.filename.match(/\|(.+)\|/,"$1");return w("span",null,[I[e[1]]])}return w("span",null,[y("本地")])}},q({prop:"size"}),{width:160,prop:"addtime",label:"备份时间"},D({table:"backup"}),A([{isHide:a=>1===a.backup_status,onClick:J,title:"下载"},{isHide:a=>1===a.backup_status,render:a=>w("span",{class:"cursor-pointer text-".concat(a.backup_status?"danger":"primary"),onClick:()=>{a.backup_status?M(a):K(a)}},[a.backup_status?"备份中":"删除",a.backup_status?w("span",{class:"omit"},null):""])}])]);return b(()=>{X()}),(a,e)=>{const t=C,s=c,o=i,l=r,n=u,m=p,d=_("bt-loading");return h(),g("div",L,[w(m,null,{"header-left":k(()=>[w(t,{type:"primary",onClick:N},{default:k(()=>e[3]||(e[3]=[y("备份站点",-1)])),_:1,__:[3]})]),"header-right":k(()=>[w(s,{onRefresh:e[0]||(e[0]=()=>X(!0))})]),content:k(()=>[j(w(o,{ref_key:"routeBackupRef",ref:V,data:v(z),"max-height":408,column:v(Y)},null,8,["data","column"]),[[d,v(U)],[d,"正在加载中，请稍后...","title"]])]),"footer-left":k(()=>[w(l,{options:Q,tableRef:v(V)},null,8,["tableRef"])]),"footer-right":k(()=>[w(n,{page:v(F).p,"onUpdate:page":e[1]||(e[1]=a=>v(F).p=a),row:v(F).limit,"onUpdate:row":e[2]||(e[2]=a=>v(F).limit=a),total:v(F).total,onChange:X},null,8,["page","row","total"])]),_:1})])}}});export{O as default};
function __vite__mapDeps(indexes) {
  if (!__vite__mapDeps.viteFileDeps) {
    __vite__mapDeps.viteFileDeps = []
  }
  return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
}
