import{p as Y,r as p,t as C,A as R,d as h,j as e,D as g,B as f,g as N}from"./index-CKIL6d0V.js";import{P as B}from"./index-ByXZCobc.js";import{a as E,B as P,c as M}from"./chartsConfig-B08bcqCP.js";import{d as $}from"./htmlToPdf-CBQd1Ckv.js";const A=Y.div`
  height: 100%;
  width: 796px;
  overflow: auto;
  margin: 0 auto;
  &::-webkit-scrollbar {
    display: none;
  }
  .topsearch {
    height: 60px;
    display: flex;
    padding-top: 10px;
    .left {
      flex: 3;
      display: flex;
      padding: 0 16px;
      .startDate {
        width: 50%;
        display: flex;
        margin-right: 16px;
        .label {
          width: 40px;
          line-height: 30px;
        }
        .date {
          height: 30px;
        }
      }
      .endDate {
        width: 50%;
        display: flex;
        margin-right: 16px;
        .label {
          width: 40px;
          line-height: 30px;
        }
        .date {
          height: 30px;
        }
      }
    }
    .right {
      flex: 1;
      .space {
        margin-right: 20px;
      }
    }
  }
  .teamReport {
    padding: 10px;
    font-size: 16px;
    border: 1px solid ${s=>s.theme.colorBorder};
    > .title {
      font-size: 18px;
      text-align: center;
    }
    .basicInfo {
      height: 36px;
      line-height: 36px;
      display: flex;
      border: 1px solid ${s=>s.theme.colorBorder};
      span {
        flex: 1;
        text-align: center;
        border-right: 1px solid ${s=>s.theme.colorBorder};
        &:nth-child(2) {
          flex: 2;
        }
        &:nth-last-child(1) {
          border: none;
        }
      }
    }
    .trainType {
      line-height: 36px;
    }
    .spaceTimeEstimate {
      margin-bottom: 10px;
      border: 1px solid ${s=>s.theme.colorBorder};
      li {
        height: 36px;
        line-height: 36px;
        display: flex;
        border-bottom: 1px solid ${s=>s.theme.colorBorder};
        
        &:nth-last-child(1) {
          border: none;
        }
        span {
          flex: 1;
          border-right: 1px solid ${s=>s.theme.colorBorder};
          text-align: center;
          &:nth-last-child(1) {
            border: none;
          }
        }
        .special {
          flex: 2.5;
        }
      }
    }

    .empty {
      justify-content: center;
    }

    .charts {
      height: 300px;
      display: flex;
      .leftpie {
        flex: 1;
      }
      .rightbar {
        flex: 2;
      }
    }
  }
  .isprint.teamReport {
    color: #000;
    background-color: #fff;
  }
  .dividerLine {
    height: 50px;
    display: flex;
    align-items: center;
    .line {
      flex: 1;
      height: 1px;
      border-top: 1px solid ${s=>s.theme.colorText};
    }
    .world {
      text-align: center;
      padding: 0 20px;
      height: 100%;
      line-height: 50px;
    }
  }
`,H=s=>{switch(s){case 1:return"轻";case 2:return"中";case 3:return"重";default:return""}},D=s=>{switch(s){case 1:return"低";case 2:return"中";case 3:return"高";default:return""}},L=s=>{switch(s){case 1:return"无";case 2:return"中";case 3:return"高";default:return""}},F=s=>{switch(s){case 1:return"比较稳定";case 2:return"小幅波动";case 3:return"大幅波动";default:return""}},m=s=>!!(Array.isArray(s)&&s.length>0),I=(s=[])=>{const l=[{value:0,name:"优秀型"},{value:0,name:"成长型"},{value:0,name:"失调型"},{value:0,name:"警示型"}];return JSON.parse(s).forEach((a,o)=>{l[o].value=a}),l},d=s=>{const{title:l}=s;return e.jsxs("div",{className:"dividerLine",children:[e.jsx("div",{className:"line"}),e.jsx("div",{className:"world",children:l}),e.jsx("div",{className:"line"})]})},O=s=>{const l=[{name:"时空估计能力",top1:"",top2:"",top3:"",top4:"",top5:""},{name:"视觉检索能力",top1:"",top2:"",top3:"",top4:"",top5:""},{name:"空间知觉能力",top1:"",top2:"",top3:"",top4:"",top5:""},{name:"注意力反应速度",top1:"",top2:"",top3:"",top4:"",top5:""},{name:"注意力分配能力",top1:"",top2:"",top3:"",top4:"",top5:""},{name:"手眼脑协调能力",top1:"",top2:"",top3:"",top4:"",top5:""},{name:"注意广度能力",top1:"",top2:"",top3:"",top4:"",top5:""},{name:"工作记忆能力",top1:"",top2:"",top3:"",top4:"",top5:""}],a=s.map(r=>{const i=[];for(const x in r)i.push(r[x]);return i});return l.map((r,i)=>(r.top1=a[0]?a[0][i]:"",r.top2=a[1]?a[1][i]:"",r.top3=a[2]?a[2][i]:"",r.top4=a[3]?a[3][i]:"",r.top5=a[4]?a[4][i]:"",r))},V=p.memo(()=>{const s=p.useRef(null),{token:l}=C.useToken(),{message:a}=R.useApp(),[o,r]=p.useState(h().add(-5,"year")),[i,x]=p.useState(h()),[n,j]=p.useState({}),[v,u]=p.useState(!1);p.useEffect(()=>{(async()=>{const{code:c,data:S,msg:k}=await N("/api/DVReport/GetCompositeReport",{StartTime:h().add(-5,"year").format("YYYY-MM-DD HH:mm:ss"),EndTime:h().format("YYYY-MM-DD HH:mm:ss")});c===200?j(S):a.error(k)})()},[]);const b=(t,c)=>{r(t)},y=(t,c)=>{x(t)},T=async()=>{N("/api/DVReport/GetCompositeReport",{StartTime:o.format("YYYY-MM-DD"),EndTime:i.format("YYYY-MM-DD")}).then(t=>{t.code===200?j(t.data):a.success(t.msg,3)})},w=()=>{u(!0),setTimeout(()=>{$("训练报告",s.current),u(!1)},0)};return e.jsxs(A,{theme:l,children:[e.jsxs("div",{className:"topsearch",children:[e.jsxs("div",{className:"left",children:[e.jsxs("div",{className:"startDate",children:[e.jsx("span",{className:"label",children:"开 始: "}),e.jsx(g,{className:"date",value:o,onChange:b})]}),e.jsxs("div",{className:"endDate",children:[e.jsx("span",{className:"label",children:"结 束: "}),e.jsx(g,{className:"date",value:i,onChange:y})]})]}),e.jsxs("div",{className:"right",children:[e.jsx(f,{className:"space",onClick:T,children:"搜索"}),e.jsx(f,{onClick:w,children:"导出"})]})]}),n&&e.jsxs("div",{className:`teamReport ${v?"isprint":""}`,ref:s,children:[e.jsx("p",{className:"title",children:"团体报告"}),e.jsx(d,{title:"基本信息"}),e.jsxs("div",{className:"basicInfo",children:[e.jsx("span",{children:"训练日期"}),e.jsx("span",{children:n.trainDate}),e.jsx("span",{children:"训练人数"}),e.jsx("span",{children:n.trainCount})]}),e.jsx(d,{title:"总体数据"}),e.jsxs("ul",{className:"spaceTimeEstimate",children:[e.jsxs("li",{className:"title",children:[e.jsx("span",{children:"top10"}),e.jsx("span",{className:"special",children:"开始时间"}),e.jsx("span",{className:"special",children:"结束时间"}),e.jsx("span",{children:"编号"}),e.jsx("span",{children:"姓名"}),e.jsx("span",{children:"总成绩"})]}),m(n.grid)?n.grid.map(t=>e.jsxs("li",{children:[e.jsx("span",{children:t.ranking}),e.jsx("span",{className:"special",children:t.startTime}),e.jsx("span",{className:"special",children:t.endTime}),e.jsx("span",{className:"text-nowrap",children:t.pNum}),e.jsx("span",{className:"text-nowrap",children:t.pName}),e.jsx("span",{children:t.totalScore})]},t.ranking)):e.jsx("li",{className:"empty",children:"暂无数据"})]}),e.jsx(d,{title:"训练状态及成绩分布图"}),e.jsxs("div",{className:"charts",children:[e.jsx("div",{className:"leftpie",children:n.train&&e.jsx(B,{option:E(I(n.train),"训练状态类型饼图")})}),e.jsx("div",{className:"rightbar",children:n.totalScoreDistribution&&e.jsx(P,{option:M(JSON.parse(n.totalScoreDistribution),["80-100","60-80","40-60","20-40","0-20"],"总成绩分布情况")})})]}),e.jsx(d,{title:"身心状态排行"}),e.jsxs("ul",{className:"spaceTimeEstimate",children:[e.jsxs("li",{className:"title",children:[e.jsx("span",{children:"TOP5"}),e.jsx("span",{children:"姓名"}),e.jsx("span",{children:"状态总分"}),e.jsx("span",{children:"情绪稳定性"}),e.jsx("span",{children:"脑力应激"}),e.jsx("span",{children:"专注度"}),e.jsx("span",{children:"疲劳度"}),e.jsx("span",{children:"兴奋度"})]}),m(n.mind)?n.mind.map(t=>e.jsxs("li",{children:[e.jsx("span",{children:t.top5}),e.jsx("span",{className:"text-nowrap",children:t.pName}),e.jsx("span",{children:t.psyScore}),e.jsx("span",{children:F(t.jinZhang)}),e.jsx("span",{children:L(t.cognitiveStress)}),e.jsx("span",{children:H(t.focusState)}),e.jsx("span",{children:D(t.fatigue)}),e.jsx("span",{children:D(t.energyState)})]},t.top5)):e.jsx("li",{className:"empty",children:"暂无数据"})]}),e.jsx(d,{title:"心理科目排行"}),e.jsxs("ul",{className:"spaceTimeEstimate",children:[e.jsxs("li",{className:"title",children:[e.jsx("span",{children:"心理科目排行"}),e.jsx("span",{children:"Top1"}),e.jsx("span",{children:"Top2"}),e.jsx("span",{children:"Top3"}),e.jsx("span",{children:"Top4"}),e.jsx("span",{children:"Top5"})]}),m(n.subjectTask)?O(n.subjectTask).map((t,c)=>e.jsxs("li",{children:[e.jsx("span",{children:t.name}),e.jsx("span",{className:"text-nowrap",children:t.top1}),e.jsx("span",{className:"text-nowrap",children:t.top2}),e.jsx("span",{className:"text-nowrap",children:t.top3}),e.jsx("span",{className:"text-nowrap",children:t.top4}),e.jsx("span",{className:"text-nowrap",children:t.top5})]},c)):e.jsx("li",{className:"empty",children:"暂无数据"})]})]})]})});V.displayName="DarkTeamReport";export{V as default};
