import{u as I,A as B,r as p,J as D,o as E,B as z,f as g,a as O,c as A,h as a,t as h,i as b,g as s,w as r,E as F,v as H,x as M}from"./index-ad591d72.js";import{e as N}from"./index-5c7e7a37.js";import{k as R}from"./index-7e3b9e04.js";import{_ as V}from"./_plugin-vue_export-helper-c27b6911.js";import"./request-2786ead7.js";import"./axios-4a70c6fc.js";const y=i=>(H("data-v-e2d22983"),i=i(),M(),i),$={class:"card shadow"},G={style:{display:"flex","align-items":"center"}},U={class:"title"},W={style:{display:"flex","align-items":"center"}},L={style:{color:"red","font-weight":"700"}},T={style:{"margin-top":"30px"}},X=y(()=>a("div",{id:"genderChart",style:{height:"300px"}},null,-1)),j=y(()=>a("div",{id:"contestChart",style:{height:"300px"}},null,-1)),J=y(()=>a("div",{id:"dailyChart",style:{height:"300px","margin-top":"100px"}},null,-1)),P={__name:"statistics",setup(i){const{t:n,locale:S}=I();let u=B().appContext.config.globalProperties.$echarts;const C=p(0),f=p([]),x=p([]),m=p([]);let l,c,d;const w=()=>{N().then(e=>{console.log(e),C.value=e.count,e.genderCounts&&(localStorage.getItem("lang")=="zh"?f.value=e.genderCounts.map(t=>{if(t.name==="M")return{...t,name:"男"};if(t.name==="F")return{...t,name:"女"};if(t.name==="男")return{...t,name:"男"};if(t.name==="女")return{...t,name:"女"}}):f.value=e.genderCounts.map(t=>{if(t.name==="M")return{...t,name:"Male"};if(t.name==="F")return{...t,name:"Female"};if(t.name==="男")return{...t,name:"Male"};if(t.name==="女")return{...t,name:"Female"}}),x.value=e.contestCounts,m.value=e.dailyChartData,l.setOption({title:{text:n("chipCheck.GenderDivision"),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:f.value,emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}},label:{normal:{formatter:"{b}：{c}，{d}%",textStyle:{fontWeight:"normal",fontSize:15}}}}]}),c.setOption({title:{text:n("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:x.value,emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}},label:{normal:{formatter:"{b}：{c}，{d}%",textStyle:{fontWeight:"normal",fontSize:15}}}}]}),d.setOption({title:{text:n("chipCheck.byDate"),left:"center"},textStyle:{fontFamily:"Roboto, SourceHanSansCNs, Arial, Helvetica, sans-serif"},xAxis:{type:"category",data:m.value.dailyData},yAxis:{type:"value"},color:["#17609a","#91cd77","#ef6567","#f9c956","#75bedc"],series:[{barWidth:40,data:m.value.dailyValues,type:"bar",showBackground:!0,backgroundStyle:{color:"rgba(180, 180, 180, 0.2)"},label:{show:!0,position:"top",textStyle:{fontSize:"15px",color:"#000"},formatter:"{c}"}}]}),window.onresize=()=>{l.resize(),c.resize(),d.resize()})})};D(()=>{}),E(()=>{const e=document.getElementById("genderChart");l=u.init(e);const t=document.getElementById("contestChart");c=u.init(t);const o=document.getElementById("dailyChart");d=u.init(o),w()}),z(()=>S.value,()=>{l.setOption({title:{text:n("chipCheck.GenderDivision"),left:"center"}}),c.setOption({title:{text:n("chipCheck.subitem"),left:"center"}}),d.setOption({title:{text:n("chipCheck.byDate"),left:"center"}})});const k=()=>{R({returnType:"file"}).then(e=>{if(console.log(e),e.Err)F({message:e.Err,grouping:!0,type:"error"});else{const t=window.URL.createObjectURL(new Blob([e])),o=document.createElement("a");o.href=t,o.setAttribute("download","participantsChip_export.xlsx"),document.body.appendChild(o),o.click()}})};return(e,t)=>{const o=g("el-button"),_=g("el-col"),v=g("el-row");return O(),A("div",$,[a("div",G,[a("div",U,h(e.$t("chipCheck.ChipDetectionDataStatistics")),1),a("div",W,[b(h(e.$t("chipCheck.chipCheckCount"))+"： ",1),a("span",L,h(C.value),1)]),s(o,{style:{"margin-left":"20px"},onClick:k},{default:r(()=>[b(h(e.$t("chipCheck.chipCheckExport")),1)]),_:1})]),a("div",T,[s(v,{style:{height:"300px"}},{default:r(()=>[s(_,{span:12,style:{height:"100%"}},{default:r(()=>[X]),_:1}),s(_,{span:12},{default:r(()=>[j]),_:1})]),_:1}),s(v,null,{default:r(()=>[s(_,{span:12},{default:r(()=>[J]),_:1})]),_:1})])])}}},ot=V(P,[["__scopeId","data-v-e2d22983"]]);export{ot as default};
