import{h as g,r as I,p as u,l as q,q as l,N as o,o as f,V as c,M as _,W as k,a4 as N,O as S,t as n}from"./vue-a39e6937.js";import{i as V,_ as B}from"./index-ba596ae9.js";import{e as P,f as Z,h as D}from"./dataexport-120e1788.js";const A={class:"default-main"},E={style:{display:"flex","align-items":"center"}},M=g({name:"routine/dataexport/taskControl"}),O=g({...M,setup(R){const x=S(),t=I({task:{},subTask:[],requestIdx:0}),p=()=>{let s=[];for(const e in t.subTask[t.requestIdx])b(t.subTask[t.requestIdx][e].id,1),s.push(V({url:Z(t.task.id,t.subTask[t.requestIdx][e].id),method:"get"}).then(r=>{b(r.data.subId,2),t.task.lastprogress+=t.task.subtask_progress}));s.length?Promise.all(s).then(e=>{s=[],t.requestIdx++,p()}):t.task.lastprogress=100},b=(s,e)=>{for(const r in t.task.subtask)if(t.task.subtask[r].id==s){t.task.subtask[r].status=e,t.task.subtask[r].status_text=m(e);break}};P(x.params.id).then(s=>{t.task=s.data.task,t.subTask=s.data.subtaskPage;for(const e in t.task.subtask)t.task.subtask[e].status_text=m(t.task.subtask[e].status);p()});const y=()=>{D(t.task.id).then(s=>{window.location.href=s.data.url})},h=[{color:"#909399",percentage:20},{color:"#a0cfff",percentage:40},{color:"#409eff",percentage:60},{color:"#95d475",percentage:80},{color:"#67c23a",percentage:100}],m=s=>{let e="";switch(s){case 0:e="准备好";break;case 1:e="进行中";break;case 2:e="完成";break;case 3:e="失败";break}return e};return(s,e)=>{const r=n("el-alert"),i=n("el-table-column"),d=n("el-tag"),w=n("el-table"),T=n("el-progress"),C=n("el-button"),v=n("el-result");return u(),q("div",A,[l(r,{title:"《"+(t.task.name??"")+"》正在执行中，请勿刷新浏览器或关闭标签页...",type:"error",closable:!1,effect:"dark",class:"mb20"},null,8,["title"]),l(w,{data:t.task.subtask,border:"",style:{width:"100%"}},{default:o(()=>[l(i,{prop:"id",label:"序号",align:"center",width:"60"}),l(i,{label:"任务标题"},{default:o(a=>[f("div",E,"第 "+c(a.row.min)+" 到 "+c(a.row.min+a.row.max)+" 行数据",1)]),_:1}),l(i,{prop:"status_text",align:"center",label:"状态",width:"100"},{default:o(a=>[f("div",null,[a.row.status==0?(u(),_(d,{key:0,type:"info"},{default:o(()=>[k(c(a.row.status_text),1)]),_:2},1024)):a.row.status==1?(u(),_(d,{key:1},{default:o(()=>[k(c(a.row.status_text),1)]),_:2},1024)):a.row.status==2?(u(),_(d,{key:2,type:"success"},{default:o(()=>[k(c(a.row.status_text),1)]),_:2},1024)):(u(),_(d,{key:3,type:"danger"},{default:o(()=>[k(c(a.row.status_text),1)]),_:2},1024))])]),_:1})]),_:1},8,["data"]),l(T,{class:"task-progress",color:h,"stroke-width":16,percentage:t.task.lastprogress,"text-inside":!0},null,8,["percentage"]),Number(t.task.lastprogress)>=100?(u(),_(v,{key:0,icon:"success",title:"数据已备好","sub-title":"点击下载导出的数据包文件"},{extra:o(()=>[l(C,{onClick:y,type:"primary"},{default:o(()=>[k("下载ZIP")]),_:1})]),_:1})):N("",!0)])}}});const z=B(O,[["__scopeId","data-v-0b133252"]]);export{z as default};
