import{d as y,r,t as D,f as R,j as e,B as g,cj as P,A as W,a as c,I as _,D as w,g as x,b as V,m as k}from"./index-BtzNP73w.js";import"./index-CJeWDVq8.js";import{R as G}from"./index-BYZ7EzgM.js";import{L as J}from"./index-BYyeyiZH.js";import{a as U,d as Z}from"./chartsConfig-CLQzSBgN.js";import{d as K}from"./htmlToPdf-DfRLdXs-.js";import{R as Q}from"./PrinterOutlined-CKytW4eE.js";import{F as q}from"./Table-BCm752cP.js";import{P as X}from"./index-CW4Fb3Fw.js";import"./iconUtil-D_WnT0lW.js";import"./index-B6m4IotF.js";const ee=y.div`
  height: 100%;
  display: flex;
  .leftTable {
    flex: 1;
    display: flex;
    flex-direction: column;
    .topsearch {
      height: 60px;
      display: flex;
      background-color: ${s=>s.theme.colorBgContainer};
      .inp {
        flex: 2;
        display: flex;
        padding: 0 16px;
        align-items: center;
        .label {
          width: 60px;
          line-height: 30px;
        }
        .antd_input {
          height: 30px;
        }
      }
      .date {
        flex: 4;
        display: flex;
        padding: 0 16px;
        .startDate {
          width: 50%;
          display: flex;
          align-items: center;
          margin-right: 16px;
          .label {
            width: 40px;
            line-height: 30px;
          }
          .date {
            height: 30px;
          }
        }
        .endDate {
          width: 50%;
          display: flex;
          align-items: center;
          margin-right: 16px;
          .label {
            width: 40px;
            line-height: 30px;
          }
          .date {
            height: 30px;
          }
        }
      }
      .btn {
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
      }
    }
    .bottomtable {
      flex: 1;
      padding: 16px 0;
      box-sizing: border-box;
      overflow: hidden;
      border-radius: 6px;
    }
  }
  .rightReport {
    width: 794px;
    height: 100%;
    overflow: auto;
    position: relative;
  }
`,te=y.div`
  height: 1100px;
  position: relative;
  .dom {
    height: 100%;
    padding: 16px;
    overflow: auto;
    .title {
      font-size: 18px;
      text-align: center;
    }
    .personInfo {
      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;
          }
        }
      }
    }
    .traindata {
      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: 3;
        }
      }
    }
    
    .chartLine {
      height: 200px;
      padding-top: 20px;
    }
    .charts {
      height: 240px;
      display: flex;
      justify-content: center;
      .radarChart {
        width: 100%;
      }
      /* .barChart {
        width: 60%;
      } */
    }
    .suggestText {
      text-indent: 2em;
      font-size: 14px;
    }
  }
  .isprint.dom {
    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;
    }
  }
  .printbtn {
    position: absolute;
    top: 16px;
    right: 20px;
    height: 40px;
    width: 40px;
  }
`,se=s=>{switch(s){case 1:return"轻";case 2:return"中";case 3:return"重";default:return""}},T=s=>{switch(s){case 1:return"低";case 2:return"中";case 3:return"高";default:return""}},ae=s=>{switch(s){case 1:return"无";case 2:return"中";case 3:return"高";default:return""}},ne=s=>{switch(s){case 1:return"比较稳定";case 2:return"小幅波动";case 3:return"大幅波动";default:return""}},ie=s=>{const n=`t0${(s.trainType*10-10).toString()}`;let i="";return Object.keys(s).forEach(t=>{n==="t06"?t.includes(n)&&t.endsWith("CoordinationTotal")&&(i=s[t]):t.includes(n)&&t.endsWith("AbilityTotal")&&(i=s[t])}),i},re=s=>{const n=`t0${(s.trainType*10-10).toString()}`;let i="";return Object.keys(s).forEach(t=>{t.includes(n)&&t.endsWith("Unanswered")&&(i=s[t])}),i},le=s=>{const n=`t0${(s.trainType*10-10).toString()}`;let i="";return Object.keys(s).forEach(t=>{n==="t06"?t.includes(n)&&t.endsWith("CoordinationTime")&&(i=s[t]):t.includes(n)&&t.endsWith("AbilityTime")&&(i=s[t])}),P(i)},de=s=>{const n=`t0${(s.trainType*10-10).toString()}`;let i="";return Object.keys(s).forEach(t=>{n==="t06"?t.includes(n)&&t.endsWith("CorrectRate")&&(i=s[t]):t.includes(n)&&t.endsWith("AbilityCorrectRate")&&(i=s[t])}),i},ce=s=>{const n=`t0${(s.trainType*10-10).toString()}`;let i="";return Object.keys(s).forEach(t=>{n==="t06"?t.includes(n)&&t.endsWith("CoordinationScore")&&(i=s[t]):t.includes(n)&&t.endsWith("AbilityScore")&&(i=s[t])}),i},oe=r.memo(s=>{const{token:n}=D.useToken(),i=r.useRef(null),{data:t,type:o,evaluate:h}=s;t&&t.outputTrain_Subject_Infos&&JSON.parse(t.outputTrain_Subject_Infos);const[m,u]=r.useState(!1),{genderList:p}=R(f=>f),j=()=>{u(!0),setTimeout(()=>{K("训练报告",i.current),u(!1)},0)};return e.jsxs(te,{theme:n,children:[t&&e.jsxs("div",{className:`dom ${m?"isprint":""}`,ref:i,children:[e.jsx("p",{className:"title",children:"单人训练报告"}),e.jsxs("div",{className:"dividerLine",children:[e.jsx("div",{className:"line"}),e.jsx("div",{className:"world",children:"基本信息"}),e.jsx("div",{className:"line"})]}),e.jsxs("ul",{className:"personInfo",children:[e.jsxs("li",{children:[e.jsx("span",{children:"账 号"}),e.jsx("span",{children:t.pNum}),e.jsx("span",{children:"姓 名"}),e.jsx("span",{children:t.pName}),e.jsx("span",{children:"性 别"}),e.jsx("span",{children:p[t.pSex]}),e.jsx("span",{children:"年龄"}),e.jsx("span",{children:t.pAge})]}),e.jsxs("li",{children:[e.jsx("span",{children:"训练日期"}),e.jsx("span",{children:t.trainDate.split(" ")[0]}),e.jsx("span",{children:"训练总分"}),e.jsx("span",{children:t.totalScore})]}),e.jsxs("li",{children:[e.jsx("span",{children:"开始时间"}),e.jsx("span",{children:t.startTime.split(" ")[1]}),e.jsx("span",{children:"结束时间"}),e.jsx("span",{children:t.endTime.split(" ")[1]})]})]}),t.evaluate!==3&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"dividerLine",children:[e.jsx("div",{className:"line"}),e.jsx("div",{className:"world",children:"训练数据"}),e.jsx("div",{className:"line"})]}),e.jsxs("ul",{className:"traindata",children:[e.jsxs("li",{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:"得分"})]}),e.jsxs("li",{children:[e.jsx("span",{children:o&&o[t.trainType]}),e.jsx("span",{children:ie(t)}),e.jsx("span",{children:re(t)}),e.jsx("span",{children:le(t)}),e.jsx("span",{children:de(t)}),e.jsx("span",{children:ce(t)})]})]}),e.jsxs("div",{className:"dividerLine",children:[e.jsx("div",{className:"line"}),e.jsx("div",{className:"world",children:"训练数据"}),e.jsx("div",{className:"line"})]}),e.jsxs("ul",{className:"traindata",children:[e.jsxs("li",{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:"专注度"})]}),e.jsxs("li",{children:[e.jsx("span",{children:o&&o[t.trainType]}),e.jsx("span",{children:ne(t.pJinZhang)}),e.jsx("span",{children:ae(t.pCognitiveStress)}),e.jsx("span",{children:se(t.pFatigueState)}),e.jsx("span",{children:T(t.pEnergyState)}),e.jsx("span",{children:T(t.pFocusState)})]})]}),e.jsx("div",{className:"chartLine",children:e.jsx(J,{option:U(JSON.parse(t.meanHr),"心率变化曲线图")})}),e.jsx("div",{className:"charts",children:e.jsx("div",{className:"radarChart",children:e.jsx(G,{option:Z(JSON.parse(t.train))})})})]}),e.jsxs("div",{className:"dividerLine",children:[e.jsx("div",{className:"line"}),e.jsx("div",{className:"world",children:"评价建议"}),e.jsx("div",{className:"line"})]}),e.jsx("div",{className:"suggestText",children:h&&h[t.evaluate]})]}),e.jsx("div",{className:"printbtn",children:e.jsx(g,{onClick:j,shape:"circle",icon:e.jsx(Q,{})})})]})}),he=r.memo(()=>{const{token:s}=D.useToken(),{message:n}=W.useApp(),{genderList:i}=R(a=>a),[t,o]=r.useState(0),[h,m]=r.useState([]),[u,p]=r.useState(null),[j,f]=r.useState(""),[v,C]=r.useState(c().add(-5,"year")),[b,Y]=r.useState(c()),[N,I]=r.useState(null),[pe,$]=r.useState(null),[E,F]=r.useState(null);r.useEffect(()=>{(async()=>{const{code:l,data:d,msg:S}=await x("/api/VRRePort/GetSingleReport",{StartTime:c().add(-5,"year").format("YYYY-MM-DD HH:mm:ss"),EndTime:c().format("YYYY-MM-DD HH:mm:ss"),pageIndex:1,pageSize:9999});l===200?(m(d.items),p(d.items[0]),o(d.totalRecords)):n.error(S);const z=await x("/api/Dict/GetDict_TrainType");I(z.data);const B=await x("/api/Dict/GetDict_TrainModule");$(B.data);const O=await x("/api/Dict/GetDict_VRREvaluate");F(O.data)})()},[]);const L=[{title:"序 号",dataIndex:"id",align:"center",width:65,key:"id",render:(a,l,d)=>e.jsx(e.Fragment,{children:d+1})},{title:"账 号",dataIndex:"pNum",align:"center",key:"id",render:a=>e.jsx(e.Fragment,{children:a})},{title:"姓 名",dataIndex:"pName",align:"center",key:"id",render:a=>e.jsx(e.Fragment,{children:a})},{title:"训练类型",dataIndex:"trainType",align:"center",key:"id",render:a=>e.jsx(e.Fragment,{children:N&&N[a]})},{title:"总 分",dataIndex:"totalScore",align:"center",width:65,key:"id",render:a=>e.jsx(e.Fragment,{children:a})},{title:"训练时间",dataIndex:"trainDate",width:180,align:"center",key:"id",render:a=>e.jsx(e.Fragment,{children:a})},{title:"操 作",dataIndex:"id",align:"center",key:"id",className:"columnStyle",fixed:"right",width:180,render:(a,l)=>e.jsxs(V,{children:[e.jsx(X,{placement:"top",title:"确定删除吗?",onConfirm:d=>confirm(l.id),okText:"确定",cancelText:"取消",children:e.jsx(g,{size:"small",children:"删 除"})}),e.jsxs(g,{size:"small",onClick:d=>p(l),children:["预览",e.jsx(k,{})]})]})}],A=(a,l)=>{console.log(a,l),C(a)},H=(a,l)=>{console.log(a,l),Y(a)},M=async()=>{const a={StartTime:v?c(v).format("YYYY-MM-DD HH:mm:ss"):c().add(-5,"year").format("YYYY-MM-DD HH:mm:ss"),EndTime:b?c(b).format("YYYY-MM-DD HH:mm:ss"):c().format("YYYY-MM-DD HH:mm:ss"),pageIndex:1,pageSize:9999,pName:j},{code:l,data:d,msg:S}=await x("/api/VRRePort/GetSingleReport",a);l===200?(m(d.items),p(d.items[0]),o(d.totalRecords)):n.error(S)};return e.jsxs(ee,{theme:s,children:[e.jsxs("div",{className:"leftTable",children:[e.jsxs("div",{className:"topsearch",children:[e.jsxs("div",{className:"inp",children:[e.jsx("span",{className:"label",children:"姓 名: "}),e.jsx(_,{className:"antd_input",value:j,allowClear:!0,onChange:a=>f(a.target.value),placeholder:"请输入姓名"})]}),e.jsxs("div",{className:"date",children:[e.jsxs("div",{className:"startDate",children:[e.jsx("span",{className:"label",children:"开 始: "}),e.jsx(w,{className:"date",value:v,onChange:A})]}),e.jsxs("div",{className:"endDate",children:[e.jsx("span",{className:"label",children:"结 束: "}),e.jsx(w,{className:"date",value:b,onChange:H})]})]}),e.jsx("div",{className:"btn",children:e.jsx(g,{onClick:M,children:"搜 索"})})]}),e.jsx("div",{className:"bottomtable",children:h&&e.jsx(q,{rowKey:a=>a.id,size:"small",showExpandColumn:!1,columns:L,dataSource:h,sticky:!0,pagination:{total:t||0,showSizeChanger:!0,showQuickJumper:!0,defaultPageSize:13,showTotal:()=>`共 ${t} 条`}})})]}),e.jsx("div",{className:"rightReport",children:e.jsx(oe,{data:u,type:N,evaluate:E})})]})});he.displayName="VROnce";export{he as default};
