import{d as D,r as o,u as S,k as w,t as H,a as l,g as j,j as e,B as k}from"./index-BtzNP73w.js";import{G as p}from"./index-2wwBw2Mo.js";import{L as c}from"./index-BYyeyiZH.js";import{R as Y}from"./index-BYZ7EzgM.js";import{d as C,a as $,s as h,b as B}from"./chartsConfig-CLQzSBgN.js";const T=D.div`
  height: 100%;
  padding: 10px;
  .layout {
    height: 100%;
    display: flex;
    flex-direction: column;
    .top {
      height: 30%;
      display: flex;
      margin-bottom: 20px;
      .date {
        width: 250px;
        padding-top: 15px;
        border-radius: 10px;
        border: 1px solid ${a=>a.theme.colorBorder};
        .backbtn {
          width: 100%;
          height: 40px;
          text-align: center;
          .btn {
            width: 80%;
          }
        }
        .com {
          height: 30px;
          line-height: 30px;
          font-size: 16px;
        }
        .title {
          padding-left: 30px;
        }
        .value {
          text-align: center;
        }
      }
      .panelbox {
        flex: 4;
        border-radius: 10px;
        border: 1px solid ${a=>a.theme.colorBorder};
        margin: 0 20px;

        display: flex;
        flex-direction: column;
        .paneltitle {
          height: 30px;
          line-height: 30px;
          font-size: 20px;
          text-align: center;
          font-weight: bold;
        }
        .panels{
          flex: 1;
          display: flex;
          .panel {
            flex: 1;
          }
        }
      }
      .radar {
        width: 300px;
        border-radius: 10px;
        border: 1px solid ${a=>a.theme.colorBorder};
      }
    }
    .bottom {
      flex: 1;
      display: flex;
      .bottomleft {
        width: 250px;
        border-radius: 10px;
        box-sizing: border-box;
        border: 1px solid ${a=>a.theme.colorBorder};
        margin-right: 20px;
        overflow: auto;
        .list {
          width: 248px;
          height: 100%;
          .items {
            height: 36px;
            line-height: 36px;
            font-size: 16px;
            display: flex;
            .item {
              flex: 1;
              text-align: center;
              &:nth-child(1) {
                width: 60px;
              }
              &:nth-child(2) {
                width: 150px;
              }
              &:nth-last-child(-n + 2) {
                flex: 2;
              }
            }
          }
          .col {
            cursor: pointer;
            &:hover {
              background-color: ${a=>a.theme.colorBorder};
            }
          }
          .select {
            color: ${a=>a.theme.textCheckedColor};
            background-color: ${a=>a.theme.colorBorder};
          }
          .disabled {
            color: ${a=>a.theme.colorTextDisabled};
            background-color: ${a=>a.theme.colorBgContainerDisabled};
            cursor: not-allowed;
            &:hover {
              background-color: ${a=>a.theme.controlItemBgActiveDisabled};
            }
          }
          .header {
            font-weight: 700;
            background-color: ${a=>a.theme.colorBgContainer};
          }
        }
      }
      .bottomcenter {
        flex: 1;
        border-radius: 10px;
        box-sizing: border-box;
        border: 1px solid ${a=>a.theme.colorBorder};
        padding: 20px;
        display: flex;
        flex-direction: column;
        .bt {
          flex: 3;
          display: flex;
          .btl {
            flex: 3;
            padding-bottom: 20px;
          }
          .btr {
            flex: 1;
            padding-bottom: 20px;
          }
        }
        .bc {
          flex: 1;
          display: flex;
          justify-content: space-around;
          border-radius: 10px;
          box-sizing: border-box;
          border: 1px solid ${a=>a.theme.colorBorder};
          .infoitem {
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            .word {
              font-size: 16px;
            }
          }
        }
        .bb {
          flex: 3;
          display: flex;
          box-sizing: border-box;
          .lineitem {
            padding-top: 20px;
            flex: 1;
          }
        }
      }
    }
  }

`,M=o.memo(()=>{const a=S(),{state:b}=w(),{token:y}=H.useToken(),[u,N]=o.useState(b),[r,g]=o.useState([]),[v,_]=o.useState([{id:1,pNum:1011,pAge:18,pName:"演示一",pSexDesc:"女",currentDate:l().format("YYYY-MM-DD"),currentTime:l().format("HH:mm:ss")},{id:2,pNum:10112,pAge:18,pName:"演示二",pSexDesc:"女",currentDate:l().format("YYYY-MM-DD"),currentTime:l().format("HH:mm:ss")}]),[i,I]=o.useState({cognitiveStress:1,createTime:l().format("YYYY-MM-DD HH:mm:ss"),currentDate:l().format("YYYY-MM-DD HH:mm:ss"),currentTime:l().format("HH:mm:ss"),deviceID:"0",energy_State:1,fatigue_State:2,focus_State:1,hfnorm:28.3819522857666,id:0,jinZhang:1,lfDivideHf:2.52,lfnorm:71.61,maxHr:88.36,meanHr:83.3,minHr:76.82,personID:"0",pnn50:36,rmssd:61.21,rr:"743,733,733,733,756,756,756,753,753,753,738,738,679,679,679,697,697,697,781,781,781,695,695,695,709,709,694,694,694,703,703,703,728,728,728,739,739,739,679",saO2:99,sdnn:69.67,temperature:36.29,tp:2846.20703125,barData:[50,50],pieData:[{value:"50",name:"PNN50"},{value:"50",name:"其他"}],radarData:[{value:[2,2,2,2,2]}],lineData:[]}),f=o.useCallback(async()=>{const s=await j("/api/DVPsyIndicator/All_muti");if(s.code===200&&s.data.length>0){const t=s.data.sort((x,P)=>P.dV_PsyIndicator?0:x.dV_PsyIndicator?-1:1);_(t),s.data.map(x=>{x.id===u&&I(x)})}const d=await j("/api/DVPsyIndicator/DVLine6Time",{PersonID:u});d.code===200&&d.data?g(d.data):g([])},[u]);o.useEffect(()=>{f();const s=setInterval(()=>{f()},2e4);return()=>{clearInterval(s)}},[f]);const m=(s,d)=>{let t=0;return d==="情绪稳定性"?s===0||s===1?t=100:s===2?t=50:s===3?t=0:t=100:s===0||s===1?t=0:s===2?t=50:s===3?t=100:t=0,B(t,d)},V=s=>[s.dV_PsyIndicator&&s.dV_PsyIndicator.jinZhang,s.dV_PsyIndicator&&s.dV_PsyIndicator.focus_State,s.dV_PsyIndicator&&s.dV_PsyIndicator.energy_State,s.dV_PsyIndicator&&s.dV_PsyIndicator.fatigue_State,s.dV_PsyIndicator&&s.dV_PsyIndicator.cognitiveStress],n=(s,d)=>{switch(d){case"meanHr":return s.map(t=>t.meanHr.toFixed(2)).reverse();case"jinZhang":return s.map(t=>t.jinZhang).reverse();case"cognitiveStress":return s.map(t=>t.cognitiveStress).reverse();case"fatigue_State":return s.map(t=>t.fatigue_State).reverse();case"energy_State":return s.map(t=>t.energy_State).reverse();case"focus_State":return s.map(t=>t.focus_State).reverse();case"time":return s.map(t=>t.time.split(" ")[1]).reverse();default:return[]}};return e.jsx(T,{theme:y,children:e.jsxs("div",{className:"layout",children:[e.jsxs("div",{className:"top",children:[e.jsxs("div",{className:"date",children:[e.jsx("div",{className:"backbtn",children:e.jsx(k,{className:"btn",onClick:()=>a("/layout/DarkVisonMonitor"),children:"返回监测页"})}),e.jsx("p",{className:"com title",children:e.jsx("span",{children:"在训日期"})}),e.jsx("p",{className:"com value",children:e.jsx("span",{children:i.dV_PsyIndicator&&i.dV_PsyIndicator.createTime.split(" ")[0]})}),e.jsx("p",{className:"com title",children:e.jsx("span",{children:"在训时间"})}),e.jsx("p",{className:"com value",children:e.jsx("span",{children:i.dV_PsyIndicator&&i.dV_PsyIndicator.createTime.split(" ")[1]})}),e.jsx("p",{className:"com title",children:e.jsx("span",{children:"训练区域"})}),e.jsx("p",{className:"com value",children:e.jsx("span",{})})]}),e.jsxs("div",{className:"panelbox",children:[e.jsx("div",{className:"paneltitle",children:e.jsx("span",{children:"身心综合状态"})}),e.jsxs("div",{className:"panels",children:[e.jsx("div",{className:"panel",children:e.jsx(p,{option:m(i.dV_PsyIndicator&&i.dV_PsyIndicator.jinZhang,"情绪稳定性")})}),e.jsx("div",{className:"panel",children:e.jsx(p,{option:m(i.dV_PsyIndicator&&i.dV_PsyIndicator.cognitiveStress,"脑力应激")})}),e.jsx("div",{className:"panel",children:e.jsx(p,{option:m(i.dV_PsyIndicator&&i.dV_PsyIndicator.fatigue_State,"疲劳度")})}),e.jsx("div",{className:"panel",children:e.jsx(p,{option:m(i.dV_PsyIndicator&&i.dV_PsyIndicator.energy_State,"兴奋度")})}),e.jsx("div",{className:"panel",children:e.jsx(p,{option:m(i.dV_PsyIndicator&&i.dV_PsyIndicator.focus_State,"专注度")})})]})]}),e.jsx("div",{className:"radar",children:e.jsx(Y,{option:C(V(i))})})]}),e.jsxs("div",{className:"bottom",children:[e.jsx("div",{className:"bottomleft",children:e.jsxs("ul",{className:"list",children:[e.jsx("li",{className:"items header",children:e.jsx("span",{className:"item",children:"人员列表"})}),v.map(s=>e.jsx("li",{className:`items col ${u===s.id?"select":""} ${s.dV_PsyIndicator?"":"disabled"}`,onClick:()=>s.dV_PsyIndicator?N(s.id):null,title:s.pNum,children:e.jsx("span",{className:"item",children:s.pName})},s.id))]})}),e.jsxs("div",{className:"bottomcenter",children:[e.jsxs("div",{className:"bt",children:[e.jsx("div",{className:"btl",children:e.jsx(c,{option:$(n(r,"meanHr"),"HRV曲线图",n(r,"time"))})}),e.jsx("div",{className:"btr",children:e.jsx(c,{option:h(n(r,"jinZhang"),"情绪稳定性",n(r,"time"))})})]}),e.jsxs("div",{className:"bc",children:[e.jsxs("div",{className:"infoitem",children:[e.jsx("span",{className:"word",children:"平均心率(次/分)"}),e.jsx("span",{className:"word",children:i.dV_PsyIndicator&&i.dV_PsyIndicator.meanHr.toFixed(2)})]}),e.jsxs("div",{className:"infoitem",children:[e.jsx("span",{className:"word",children:"最大心率(次/分)"}),e.jsx("span",{className:"word",children:i.dV_PsyIndicator&&i.dV_PsyIndicator.maxHr.toFixed(2)})]}),e.jsxs("div",{className:"infoitem",children:[e.jsx("span",{className:"word",children:"最小心率(次/分)"}),e.jsx("span",{className:"word",children:i.dV_PsyIndicator&&i.dV_PsyIndicator.minHr.toFixed(2)})]}),e.jsxs("div",{className:"infoitem",children:[e.jsx("span",{className:"word",children:"血氧饱和度(%)"}),e.jsx("span",{className:"word",children:i.dV_PsyIndicator&&i.dV_PsyIndicator.saO2.toFixed(2)})]})]}),e.jsxs("div",{className:"bb",children:[e.jsx("div",{className:"lineitem",children:e.jsx(c,{option:h(n(r,"cognitiveStress"),"脑力应激",n(r,"time"))})}),e.jsx("div",{className:"lineitem",children:e.jsx(c,{option:h(n(r,"fatigue_State"),"疲劳度",n(r,"time"))})}),e.jsx("div",{className:"lineitem",children:e.jsx(c,{option:h(n(r,"energy_State"),"兴奋度",n(r,"time"))})}),e.jsx("div",{className:"lineitem",children:e.jsx(c,{option:h(n(r,"focus_State"),"专注度",n(r,"time"))})})]})]})]})]})})});M.displayName="DarkHome";export{M as default};
