import{p as y,r as n,t as w,f as k,j as e,B as v,A as F,d,I as H,D as b,g as S,a as L,l as M}from"./index-CKIL6d0V.js";import{d as $,e as E,B as _,c as z}from"./chartsConfig-B08bcqCP.js";import{R as P}from"./index-B2ZyvyaB.js";import{L as J}from"./index-BBmyp6e2.js";import{d as A}from"./htmlToPdf-CBQd1Ckv.js";import{R as O}from"./PrinterOutlined-IzRNsDbg.js";import{F as V}from"./Table-BaVi_066.js";import"./iconUtil-Co5gbObL.js";import"./index-C-LPyJas.js";const G=y.div`
  height: 100%;
  display: flex;
  .leftTable {
    flex: 1;
    display: flex;
    flex-direction: column;
    .topsearch {
      height: 60px;
      display: flex;
      background-color: ${t=>t.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;
  }
`,Z=y.div`
  height: 1100px;
  position: relative;
  .dom {
    height: 100%;
    padding: 16px;
    overflow: auto;
    .title {
      font-size: 18px;
      text-align: center;
    }
    .personInfo {
      border: 1px solid ${t=>t.theme.colorBorder};
      li {
        height: 36px;
        line-height: 36px;
        display: flex;
        border-bottom: 1px solid ${t=>t.theme.colorBorder};
        
        &:nth-last-child(1) {
          border: none;
        }
        span {
          flex: 1;
          border-right: 1px solid ${t=>t.theme.colorBorder};
          text-align: center;
          &:nth-last-child(1) {
            border: none;
          }
        }
      }
    }
    .traindata {
      border: 1px solid ${t=>t.theme.colorBorder};
      li {
        height: 36px;
        line-height: 36px;
        display: flex;
        border-bottom: 1px solid ${t=>t.theme.colorBorder};
        
        &:nth-last-child(1) {
          border: none;
        }
        span {
          flex: 1;
          border-right: 1px solid ${t=>t.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: 40%;
      }
      .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 ${t=>t.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;
  }
`,K=t=>{switch(t){case 1:return"轻";case 2:return"中";case 3:return"重";default:return""}},D=t=>{switch(t){case 1:return"低";case 2:return"中";case 3:return"高";default:return""}},Q=t=>{switch(t){case 1:return"无";case 2:return"中";case 3:return"高";default:return""}},U=t=>{switch(t){case 1:return"比较稳定";case 2:return"小幅波动";case 3:return"大幅波动";default:return""}},q=n.memo(t=>{const{token:x}=w.useToken(),p=n.useRef(null),{data:a}=t;let o=null;a&&(o=a.outputTrain_Subject_Infos?JSON.parse(a.outputTrain_Subject_Infos):[]);const[m,c]=n.useState(!1),{genderList:g}=k(r=>r),h=()=>{c(!0),setTimeout(()=>{A("训练报告",p.current),c(!1)},0)};return e.jsxs(Z,{theme:x,children:[a&&e.jsxs("div",{className:`dom ${m?"isprint":""}`,ref:p,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:a.pNum}),e.jsx("span",{children:"姓 名"}),e.jsx("span",{children:a.pName}),e.jsx("span",{children:"性 别"}),e.jsx("span",{children:g[a.pSex]}),e.jsx("span",{children:"年龄"}),e.jsx("span",{children:a.pAge})]}),e.jsxs("li",{children:[e.jsx("span",{children:"训练日期"}),e.jsx("span",{children:a.trainDate.split(" ")[0]}),e.jsx("span",{children:"训练总分"}),e.jsx("span",{children:a.totalScore})]}),e.jsxs("li",{children:[e.jsx("span",{children:"开始时间"}),e.jsx("span",{children:a.startTime.split(" ")[1]}),e.jsx("span",{children:"结束时间"}),e.jsx("span",{children:a.endTime.split(" ")[1]})]})]}),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:"专注度"})]}),o&&o.map((r,j)=>e.jsxs("li",{children:[e.jsx("span",{children:"训练区"}),e.jsx("span",{children:U(r.JinZhang)}),e.jsx("span",{children:Q(r.CognitiveStress)}),e.jsx("span",{children:K(r.Fatigue_State)}),e.jsx("span",{children:D(r.Energy_State)}),e.jsx("span",{children:D(r.Focus_State)})]},j))]}),e.jsx("div",{className:"chartLine",children:e.jsx(J,{option:$(JSON.parse(a.meanHr),"心率变化曲线图")})}),e.jsxs("div",{className:"charts",children:[e.jsx("div",{className:"radarChart",children:e.jsx(P,{option:E(JSON.parse(a.train))})}),e.jsx("div",{className:"barChart",children:e.jsx(_,{option:z(JSON.parse(a.subject),["时空估计","视觉检索","空间知觉","反应速度","注意力分配","手眼脑协调","工作记忆","注意广度"],"训练任务正确率")})})]}),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:a.rEvaluateDesc})]}),e.jsx("div",{className:"printbtn",children:e.jsx(v,{onClick:h,shape:"circle",icon:e.jsx(O,{})})})]})}),W=n.memo(()=>{const{token:t}=w.useToken(),{message:x}=F.useApp(),{genderList:p}=k(s=>s),[a,o]=n.useState(0),[m,c]=n.useState([]),[g,h]=n.useState(null),[r,j]=n.useState(""),[u,C]=n.useState(d().add(-5,"year")),[f,Y]=n.useState(d());n.useEffect(()=>{(async()=>{const{code:i,data:l,msg:N}=await S("/api/DVReport/GetSingleReport",{StartTime:d().add(-5,"year").format("YYYY-MM-DD HH:mm:ss"),EndTime:d().format("YYYY-MM-DD HH:mm:ss"),pageIndex:1,pageSize:9999});i===200?(c(l.items),h(l.items[0]),o(l.totalRecords)):x.error(N)})()},[]);const R=[{title:"账 号",dataIndex:"pNum",align:"center",key:"id",render:s=>e.jsx(e.Fragment,{children:s})},{title:"姓 名",dataIndex:"pName",align:"center",key:"id",render:s=>e.jsx(e.Fragment,{children:s})},{title:"性别",dataIndex:"pSex",align:"center",key:"id",render:s=>e.jsx(e.Fragment,{children:p[s]})},{title:"年龄",dataIndex:"pAge",align:"center",key:"id",render:s=>e.jsx(e.Fragment,{children:s})},{title:"总 分",dataIndex:"totalScore",align:"center",key:"id",render:s=>e.jsx(e.Fragment,{children:s})},{title:"训练时间",dataIndex:"trainDate",align:"center",key:"id",width:180,render:(s,i)=>e.jsx(e.Fragment,{children:s})},{title:"操 作",dataIndex:"id",align:"center",key:"id",fixed:"right",width:180,className:"columnStyle",render:(s,i)=>e.jsx(L,{children:e.jsxs(v,{onClick:l=>h(i),children:["预览",e.jsx(M,{})]})})}],I=(s,i)=>{console.log(s,i),C(s)},T=(s,i)=>{console.log(s,i),Y(s)},B=async()=>{const s={StartTime:u?d(u).format("YYYY-MM-DD HH:mm:ss"):d().add(-5,"year").format("YYYY-MM-DD HH:mm:ss"),EndTime:f?d(f).format("YYYY-MM-DD HH:mm:ss"):d().format("YYYY-MM-DD HH:mm:ss"),pageIndex:1,pageSize:9999,pName:r};console.log(s);const{code:i,data:l,msg:N}=await S("/api/DVReport/GetSingleReport",s);i===200?(c(l.items),h(l.items[0]),o(l.totalRecords)):x.error(N)};return e.jsxs(G,{theme:t,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(H,{className:"antd_input",value:r,allowClear:!0,onChange:s=>j(s.target.value),placeholder:"请输入姓名"})]}),e.jsxs("div",{className:"date",children:[e.jsxs("div",{className:"startDate",children:[e.jsx("span",{className:"label",children:"开 始: "}),e.jsx(b,{className:"date",value:u,onChange:I})]}),e.jsxs("div",{className:"endDate",children:[e.jsx("span",{className:"label",children:"结 束: "}),e.jsx(b,{className:"date",value:f,onChange:T})]})]}),e.jsx("div",{className:"btn",children:e.jsx(v,{onClick:B,children:"搜 索"})})]}),e.jsx("div",{className:"bottomtable",children:m&&e.jsx(V,{rowKey:s=>s.id,size:"small",showExpandColumn:!1,columns:R,dataSource:m,sticky:!0,pagination:{total:a||0,showSizeChanger:!0,showQuickJumper:!0,defaultPageSize:13,showTotal:()=>`共 ${a} 条`}})})]}),e.jsx("div",{className:"rightReport",children:e.jsx(q,{data:g})})]})});W.displayName="DarkPersonReport";export{W as default};
