import{d as B,r as n,a9 as h,a as _,o as c,c as N,f as b,i as m,e as i,j as v,t as A,h as k,b as f,H as O,I as T,a6 as g,_ as V}from"./index-8184dd63-1780045603901v=1.0.0.js";import{t as j,a as I,b as S}from"./common-5ba50e89-1780045603901v=1.0.0.js";const q={class:"app-container"},L={class:"flex-export-data"},R=B({__name:"index",props:{taskName:String,taskOption:Object},setup(x){const u=x,r=n(""),p=n(0),o=n(0),l=n(0),s=n(1);h(()=>{clearTimeout(l.value)});const D=()=>{y()},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))},F=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()},y=async()=>{var t;const a={task_name:u.taskName,...(t=u.taskOption)==null?void 0:t.param},{data:e}=await I(a);o.value=e.task_id,d()},w=()=>{const a=document.createElement("a");a.href=r.value,a.download="exportData",a.click()};return(a,e)=>{const t=_("el-button"),C=_("el-progress"),E=_("el-col");return c(),N("div",q,[b("div",L,[s.value!==2?(c(),m(t,{key:0,disabled:s.value===3,onClick:D},{default:i(()=>[v(A(s.value!==3?"\u5BFC\u51FA":"\u7B49\u5F85\u4E2D"),1)]),_:1},8,["disabled"])):k("v-if",!0),s.value===2?(c(),m(E,{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:F},{default:i(()=>[...e[0]||(e[0]=[v(" \u53D6\u6D88 ",-1)])]),_:1})):k("v-if",!0),O(f(t,{onClick:w},{default:i(()=>[...e[1]||(e[1]=[v("\u4E0B\u8F7D\u6570\u636E",-1)])]),_:1},512),[[T,s.value===1&&r.value!==""]])])])}}});const M=V(R,[["__scopeId","data-v-a72f49c3"],["__file","D:/desktop/yunNan/vue-area-submit/src/components/Export/index.vue"]]);export{M as E};
