import{u as H,A as z,r as a,J as N,o as O,B as R,f as m,a as $,c as F,h as s,t as h,i as B,g as n,w as i,E as k,v as V,x as G}from"./index-ad591d72.js";import{a as T}from"./index-5c7e7a37.js";import{e as U}from"./index-ab911583.js";import{_ as W}from"./_plugin-vue_export-helper-c27b6911.js";import"./request-2786ead7.js";import"./axios-4a70c6fc.js";const b=u=>(V("data-v-766fbf1d"),u=u(),G(),u),L={class:"card shadow"},M={style:{display:"flex","align-items":"center"}},X={class:"title"},Y={style:{display:"flex","align-items":"center"}},j={style:{color:"red","font-weight":"700"}},J={style:{"margin-top":"30px"}},P=b(()=>s("div",{id:"genderChart",style:{height:"300px"}},null,-1)),q=b(()=>s("div",{id:"dailyChart",style:{height:"300px"}},null,-1)),K=b(()=>s("div",{id:"contestChart",style:{height:"300px","margin-top":"100px"}},null,-1)),Q={__name:"statistics",setup(u){const{t:r,locale:D}=H();let g=z().appContext.config.globalProperties.$echarts;const x=a(0);a([]);const C=a([]),f=a([]),v=a([]),y=a(!1);let p,l;const E=()=>{T().then(t=>{if(t.Err){k.error(t.Err);return}console.log(t),x.value=t.count,t.count!=0&&(C.value=t.contestCount,f.value=t.claimCountsByDay,v.value=t.hourlyCounts,p.setOption({title:{text:r("chipCheck.subitem"),left:"center"},textStyle:{fontFamily:"Roboto, SourceHanSansCNs, Arial, Helvetica, sans-serif"},tooltip:{trigger:"item"},legend:{orient:"horizontal",left:"center",top:"bottom"},color:["#17609a","#91cd77","#ef6567","#f9c956","#75bedc"],series:[{type:"pie",radius:"50%",data:C.value,emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}},label:{fontWeight:"normal",fontSize:15,formatter:"{b}：{c}人，{d}%"}}]}),_(!1),window.onresize=()=>{p.resize(),l.resize()},l.on("click",function(o){y.value?(y.value=!1,_(!1)):(y.value=!0,_(!0,new Date().getFullYear()+"-"+o.name))}))})};function _(t,o){let e;if(t){const c=v.value[o],d=[],w=[];c.forEach((S,A)=>{S>0&&(d.push(`${A}:00`),w.push(S))}),e={title:{text:r("chipCheck.byTime")+":"+o,left:"center"},textStyle:{fontFamily:"Roboto, SourceHanSansCNs, Arial, Helvetica, sans-serif"},xAxis:{type:"category",data:d,boundaryGap:!0},yAxis:{type:"value"},color:["#17609a","#91cd77","#ef6567","#f9c956","#75bedc"],series:[{barWidth:"50%",type:"bar",data:w,label:{fontSize:"13px"}}]}}else e={title:{text:r("chipCheck.byDate"),left:"center"},textStyle:{fontFamily:"Roboto, SourceHanSansCNs, Arial, Helvetica, sans-serif"},xAxis:{type:"category",data:f.value.claimCountsByDayX},yAxis:{type:"value"},color:["#17609a","#91cd77","#ef6567","#f9c956","#75bedc"],series:[{barWidth:40,data:f.value.claimCountsByDayY,type:"bar",showBackground:!0,backgroundStyle:{color:"rgba(180, 180, 180, 0.2)"},label:{show:!0,position:"top",fontSize:"15px",color:"#000",formatter:"{c}"}}]};l.setOption(e)}N(()=>{}),O(()=>{const t=document.getElementById("genderChart");p=g.init(t);const o=document.getElementById("dailyChart");l=g.init(o),E()}),R(()=>D.value,()=>{p.setOption({title:{text:r("chipCheck.GenderDivision"),left:"center"}}),l.setOption({title:{text:r("chipCheck.byDate"),left:"center"}})});const I=()=>{U({returnType:"file"}).then(t=>{if(console.log(t),t.Err)k({message:t.Err,grouping:!0,type:"error"});else{const o=window.URL.createObjectURL(new Blob([t])),e=document.createElement("a");e.href=o,e.setAttribute("download","participantsDestribute_export.xlsx"),document.body.appendChild(e),e.click()}})};return(t,o)=>{const e=m("el-button"),c=m("el-col"),d=m("el-row");return $(),F("div",L,[s("div",M,[s("div",X,h(t.$t("distribution.statistics.title")),1),s("div",Y,[B(h(t.$t("distribution.statistics.count"))+"： ",1),s("span",j,h(x.value),1)]),n(e,{style:{"margin-left":"20px"},onClick:I},{default:i(()=>[B(h(t.$t("distribution.statistics.export")),1)]),_:1})]),s("div",J,[n(d,{style:{height:"300px"}},{default:i(()=>[n(c,{span:12,style:{height:"100%"}},{default:i(()=>[P]),_:1}),n(c,{span:12},{default:i(()=>[q]),_:1})]),_:1}),n(d,null,{default:i(()=>[n(c,{span:12},{default:i(()=>[K]),_:1})]),_:1})])])}}},it=W(Q,[["__scopeId","data-v-766fbf1d"]]);export{it as default};
