import{d as E,p as n,ad as h,i as _,a as c,c as b,j as A,z as m,m as i,v,t as N,l as k,k as f,K as O,L as T,M as g,_ as V}from"./index-deffec86.js";import{t as j,d as L,e as S}from"./common-8a6acaa7.js";const q={class:"app-container"},z={class:"flex-export-data"},I=E({__name:"index",props:{taskName:String,taskOption:Object},setup(F){const u=F,r=n(""),p=n(0),o=n(0),l=n(0),s=n(1);h(()=>{clearTimeout(l.value)});const D=()=>{x()},d=async()=>{var t;const a={task_name:u.taskName,task_id:o.value,...(t=u.taskOption)==null?void 0:t.param},{data:e}=await S(a);s.value=e.status,e.status===1?(e.completed.path&&(r.value="https://qmjs.ynsport.cn/zwapi"+e.completed.path),l.value!==0&&g({title:"\u6E29\u99A8\u63D0\u793A",message:"\u5BFC\u51FA\u5B8C\u6210\uFF01",type:"success"})):(e.status===2?(p.value=parseFloat(e.processing.rate),o.value=e.processing.task_id):e.status===3&&(p.value=0,o.value=e.waiting.task_id),l.value=window.setTimeout(d,3e3))},w=async()=>{const a={task_id:o.value};await j(a),g({title:"\u6E29\u99A8\u63D0\u793A",message:"\u5BFC\u51FA\u4EFB\u52A1\u53D6\u6D88\u6210\u529F\uFF01",type:"success"}),clearTimeout(l.value),d()},x=async()=>{var t;const a={task_name:u.taskName,...(t=u.taskOption)==null?void 0:t.param},{data:e}=await L(a);o.value=e.task_id,d()},y=()=>{const a=document.createElement("a");a.href=r.value,a.download="exportData",a.click()};return(a,e)=>{const t=_("el-button"),C=_("el-progress"),B=_("el-col");return c(),b("div",q,[A("div",z,[s.value!==2?(c(),m(t,{key:0,disabled:s.value===3,onClick:D},{default:i(()=>[v(N(s.value!==3?"\u5BFC\u51FA":"\u7B49\u5F85\u4E2D"),1)]),_:1},8,["disabled"])):k("v-if",!0),s.value===2?(c(),m(B,{key:1,span:8,class:"fr ml-20",align:"right"},{default:i(()=>[f(C,{percentage:p.value,class:"el-progress"},null,8,["percentage"])]),_:1})):k("v-if",!0),s.value!==1?(c(),m(t,{key:2,class:"ml-20",onClick:w},{default:i(()=>e[0]||(e[0]=[v(" \u53D6\u6D88 ")])),_:1})):k("v-if",!0),O(f(t,{onClick:y},{default:i(()=>e[1]||(e[1]=[v("\u4E0B\u8F7D\u6570\u636E")])),_:1},512),[[T,s.value===1&&r.value!==""]])])])}}});const K=V(I,[["__scopeId","data-v-353bc09b"]]);export{K as E};
