1 |
- import{d as I,a1 as q,r as v,K as l,e as c,f as N,j as n,L as o,t as u,i as f,m as k,y as i,C as S}from"./vue-A59npLRR.js";import{c as B,_ as V}from"./index-EwE51S_X.js";import{e as P,f as Z,h as D}from"./dataexport-ejJtIN-s.js";import"./echarts-cxb9vJr1.js";const j={class:"default-main"},A={style:{display:"flex","align-items":"center"}},E=I({name:"routine/dataexport/taskControl",__name:"taskControl",setup(K){const g=q(),t=v({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(B({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(g.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 x=()=>{D(t.task.id).then(s=>{window.location.href=s.data.url})},w=[{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=l("el-alert"),_=l("el-table-column"),d=l("el-tag"),y=l("el-table"),h=l("el-progress"),T=l("el-button"),C=l("el-result");return c(),N("div",j,[n(r,{title:"《"+(t.task.name??"")+"》正在执行中,请勿刷新浏览器或关闭标签页...",type:"error",closable:!1,effect:"dark",class:"mb20"},null,8,["title"]),n(y,{data:t.task.subtask,border:"",style:{width:"100%"}},{default:o(()=>[n(_,{prop:"id",label:"序号",align:"center",width:"60"}),n(_,{label:"任务标题"},{default:o(a=>[f("div",A,"第 "+u(a.row.min)+" 到 "+u(a.row.min+a.row.max)+" 行数据",1)]),_:1}),n(_,{prop:"status_text",align:"center",label:"状态",width:"100"},{default:o(a=>[f("div",null,[a.row.status==0?(c(),i(d,{key:0,type:"info"},{default:o(()=>[k(u(a.row.status_text),1)]),_:2},1024)):a.row.status==1?(c(),i(d,{key:1},{default:o(()=>[k(u(a.row.status_text),1)]),_:2},1024)):a.row.status==2?(c(),i(d,{key:2,type:"success"},{default:o(()=>[k(u(a.row.status_text),1)]),_:2},1024)):(c(),i(d,{key:3,type:"danger"},{default:o(()=>[k(u(a.row.status_text),1)]),_:2},1024))])]),_:1})]),_:1},8,["data"]),n(h,{class:"task-progress",color:w,"stroke-width":16,percentage:t.task.lastprogress,"text-inside":!0},null,8,["percentage"]),Number(t.task.lastprogress)>=100?(c(),i(C,{key:0,icon:"success",title:"数据已备好","sub-title":"点击下载导出的数据包文件"},{extra:o(()=>[n(T,{onClick:x,type:"primary"},{default:o(()=>[k("下载ZIP")]),_:1})]),_:1})):S("",!0)])}}}),F=V(E,[["__scopeId","data-v-ab8caf44"]]);export{F as default};
|