import{p as W,r as n,t as _,j as e,f as K,d as F,u as te,A as se,v as ae,y as oe,B as H,g as ne,C as me,z as ge,E as xe,I as re,G as U,a as X,H as ke,w as Pe,J as Oe}from"./index-CKIL6d0V.js";const ze=W.div`
  height: 100%;

`,Re=W.div`
  height: 100%;
  font-size: 14px;
  .title {
    height: 36px;
    line-height: 36px;
    padding: 0 10px;
    margin-bottom: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    display: flex;
    justify-content: space-between;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};

    .questionNUm {
      font-size: 14px;
      text-align: right;
    }
  }

  .content {
    height: calc(100% - 46px);
    overflow: auto;
    padding-top: 15px;
    position: relative;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};


    .progressBar {
      width: 100%;
      height: 15px;
      position: absolute;
      left: 0;
      top: 0;
    }
    .common {
      min-height: 60px;
      text-align: center;
      border-bottom: 1px dotted ${r=>r.theme.colorBorder};
    }
    .topQuestion {
      padding-bottom: 15px;

      .describe {
        padding: 10px;
        font-size: 14px;
        margin-bottom: 15px;
        text-align: left;
      }
      .img {
        max-height: 360px;
        max-width: 90%;
      }
    }
    .centerSelection {
      letter-spacing: 2px;
      padding-top: 25px;
      position: relative;
      .select {
        position: absolute;
        text-align: left;
        margin-left: 15px;
        top: 5px;
        left: 0;
      }
      
      .checkboxstyle {
        padding-left: 10px;
        margin-top: 10px;
        text-align: left;
      }
    }
    .nextQuest {
      padding-top: 15px;
      line-height: 40px;
      border: none;

      .next {
        letter-spacing: 2px;
        margin-left: 20px;
      }
      .last {
        letter-spacing: 2px;
      }
    }
  }

`,Ye=W.div`
    width: 100%; 
    height: 100%;
    position: relative;
    border: 1px solid ${r=>r.theme.colorBorder};
    background-color: ${r=>r.theme.colorBgLayout};

    .progress-grow {
      width: ${r=>`${r.width}%`};
      height: 100%;
      background: repeating-linear-gradient(
        45deg, ${r=>r.theme.colorPrimary} 0px, ${r=>r.theme.colorPrimary} 15px, ${r=>r.theme.colorBgContainer}, 16px, ${r=>r.theme.colorBgContainer} 30px
      );
      background-size: 42px 100%;
      background-position: 0 0;
      animation: grow 3s linear infinite;
      transition: 0.5s;

      opacity: 0.4;
    }

    @keyframes grow {
     0% {
        background-position: 0 0;
      }
      100% {
        background-position: 42px 0;
      }
    }
`,ee=n.memo(r=>{const{token:b}=_.useToken(),{width:N}=r;return e.jsx(Ye,{theme:b,width:N,children:e.jsx("div",{className:"progress-grow"})})});ee.displayName="YProgress";const He=r=>{const b=r.split(":").map(B=>Number(B));return b[2]*1e3+b[1]*1e3*60+b[0]*1e3*60*60},Me=(r,b)=>{const{answerTime:N,changeAnswerTime:B}=K(R=>R),[u,a]=n.useState(()=>{let R=0;return N&&(R=He(N)),R});return n.useEffect(()=>{let R=setInterval(()=>{a(I=>I+1e3)},1e3);return()=>{clearInterval(R)}},[]),n.useEffect(()=>{const R=F.utc(u).format("HH:mm:ss");B(R)},[B,u]),n.useImperativeHandle(b,()=>u),e.jsx(e.Fragment,{children:F.utc(u).format("HH:mm:ss")})},ie=n.memo(n.forwardRef(Me)),be=n.memo(r=>{const b=te(),N=n.useRef(),{token:B}=_.useToken(),{message:u}=se.useApp(),{info:a}=r,{isPC:R,userInfo:I,changeCurrentQuestion:T,changeAnswerList:v,answerList:w,currentQuestion:t}=K(C=>C),[s,D]=n.useState([]),[Y,O]=n.useState(!1);n.useEffect(()=>{(async()=>{try{const{code:i,data:k,msg:x}=await ne("/api/Psyinfotablecontent/All",{TableCode:a.tableCode,pageIndex:1,pageSize:999});i===200?D(k.items):u.warning(x)}catch(i){u.error(i)}})()},[a,u,v,T]);const P=n.useCallback(()=>{t>0&&T(t-1)},[t,T]),S=n.useCallback(()=>{if(!w[t]){u.info("请选择选项",2);return}t+1<a.questionSum?T(t+1):t+1===a.questionSum&&u.info("已经完成答题,请提交",2)},[a,t,w,T,u]),A=n.useCallback(()=>{if(t===a.questionSum)return!1;const C=w[a.questionSum-1];if(!C)return!0;let i=!1;return C.forEach(k=>{k>0&&(i=!0)}),i},[w,t,a]),c=n.useCallback(()=>{const C={},i={};C.taskID=a.id,C.TableChinese=a.nameChinese,C.org=I.pOrganizationName,i.pNum=I.userID,i.ptasknameid=a.ptasknameid,i.tableCode=a.tableCode,i.checkday=F().format("YYYY-MM-DD HH:mm:ss"),i.consumeTime=F.utc(N.current).format("HH:mm:ss");let k=[];w.forEach(x=>{k=[...k,...x]}),k=k.map(x=>x?1:0),i.answerString=k.join("|"),A()?i.isFinish=1:w.length!==0?i.isFinish=2:i.isFinish=0,O(!0),ae("/api/PsyInfotesttasklist/Update",i,C).then(x=>{x.code===200?(u.success(x.msg,3),b("/layout/psyTasks")):u.warning(x.msg),O(!1)})},[w,a,u,I,b,A]),q=n.useCallback((C=!0)=>s[t]?C?s[t].questionContent:s[t]:!1,[t,s]),m=C=>{const i=[0,0,0,0,0,0,0,0,0];C.forEach(x=>{i[x-1]=x});const k=[...w];k[t]=i,v(k)},p=()=>e.jsx(me.Group,{className:"checkboxstyle",value:w[t],onChange:m,children:e.jsx(ge,{children:q(!1)&&Object.keys(q(!1)).map((C,i)=>{const k=q(!1)[`answer${i}`];return k&&e.jsx(xe,{span:24,children:e.jsxs(me,{value:i,children:[i,". ",k]})},k)})})});return e.jsxs(Re,{theme:B,children:[e.jsxs("div",{className:"title",children:[e.jsx("span",{className:"common titleContent",children:a.nameChinese}),e.jsxs("span",{className:"common timer",children:[R?"累计答题时间: ":"",e.jsx(ie,{ref:N})]}),e.jsxs("span",{className:"common questionNUm",children:["第",t+1,"题 / 共",a.questionSum,"题"]})]}),e.jsxs("div",{className:"content",children:[e.jsx("div",{className:"progressBar",children:e.jsx(ee,{width:(t+1)/a.questionSum*100})}),e.jsxs("div",{className:"common topQuestion",children:[e.jsxs("p",{className:"describe",children:["问题描述: ",a.guide]}),q()]}),e.jsxs("div",{className:"common centerSelection",children:[e.jsxs("div",{className:"select",children:[e.jsxs("span",{style:{display:R?"inline-block":"none"},title:"快捷操作: 选项也可通过键盘点击选择选项, 数字对应选项, enter回车键对应下一题按钮,esc对应上一题按钮",children:[e.jsx(oe,{})," "]}),"请选择 :"]}),p()]}),e.jsxs("div",{className:"common nextQuest",children:[e.jsx(H,{className:"last",disabled:t===0,onClick:P,children:"上一题"}),e.jsx(H,{className:"next",onClick:S,children:"下一题"}),e.jsx(H,{loading:Y,type:"primary",className:"next",onClick:c,children:A()?"提 交":"保存并退出"})]})]})]})});be.displayName="Adhd";const Ue=W.div`
  height: 100%;
  font-size: 14px;
  .title {
    height: 36px;
    line-height: 36px;
    padding: 0 10px;
    margin-bottom: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    display: flex;
    justify-content: space-between;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};

    .questionNUm {
      font-size: 14px;
      text-align: right;
    }
  }

  .content {
    height: calc(100% - 46px);
    overflow: auto;
    padding-top: 15px;
    position: relative;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};


    .progressBar {
      width: 100%;
      height: 15px;
      position: absolute;
      left: 0;
      top: 0;
    }
    .common {
      min-height: 60px;
      text-align: center;
      border-bottom: 1px dotted ${r=>r.theme.colorBorder};
    }
    .topQuestion {
      padding-bottom: 15px;

      .describe {
        padding: 10px;
        font-size: 14px;
        margin-bottom: 15px;
        text-align: left;
      }
    }
    .centerSelection {
      letter-spacing: 2px;
      padding-top: 25px;
      position: relative;
      .select {
        position: absolute;
        text-align: left;
        margin-left: 15px;
        top: 5px;
        left: 0;
      }
      .itemlatout {
        text-align: left;
        margin-bottom: 15px;
      }
      .moreSelect {
        padding: 10px;
      }
      .input {
        margin-top: 10px;
        width: 30%;
      }
    }
    .nextQuest {
      padding-top: 15px;
      line-height: 40px;
      border: none;

      .next {
        letter-spacing: 2px;
        margin-left: 20px;
      }
      .last {
        letter-spacing: 2px;
      }
    }
  }

`,Fe=(r=[])=>{for(let b=r.length-1;b>0;b--){const N=Math.floor(Math.random()*(b+1)),B=r[b];r[b]=r[N],r[N]=B}return r},ve=n.memo(r=>{const b=te(),N=n.useRef(),{token:B}=_.useToken(),{message:u}=se.useApp(),{info:a}=r,{isPC:R,userInfo:I,project:T,changeCurrentQuestion:v,changeAnswerList:w,answerList:t,currentQuestion:s}=K(h=>h),[D,Y]=n.useState(!1),[O,P]=n.useState([]),[S,A]=n.useState(!1),[c,q]=n.useState([]),[m,p]=n.useState("");n.useEffect(()=>{(async()=>{try{const{code:l,data:o,msg:d}=await ne("/api/Psyinfotablecontent/All",{TableCode:a.tableCode,pageIndex:1,pageSize:999});l===200?P(o.items):u.warning(d)}catch(l){u.error(l)}})()},[a,u,w,v]);const C=n.useCallback(h=>{if(t[s]){const o=[...t];o[s]=h.target.value,w(o);return}let l=null;return new Promise(o=>{const d=[...t];d[s]=h.target.value,w(d),o()}).then(()=>{!D&&s+1<a.questionSum&&(l=setTimeout(()=>{v(s+1)},500))}),()=>{clearTimeout(l)}},[t,s,D,a,w,v]),i=n.useCallback(()=>{s>0&&(v(s-1),Y(!0))},[s,v]),k=n.useCallback(()=>{if(!t[s]){u.info("请选择选项",2);return}s+1<a.questionSum?v(s+1):s+1===a.questionSum&&u.info("已经完成答题,请提交",2),s===t.length-1&&Y(!1)},[a,s,t,v,u]),x=n.useCallback(()=>{if(s===99&&!m){u.info("请输入内容",2);return}const h={},l={};h.taskID=a.id,h.TableChinese=a.nameChinese,h.org=I.pOrganizationName,l.pNum=I.userID,l.ptasknameid=a.ptasknameid,l.tableCode=a.tableCode,l.checkday=F().format("YYYY-MM-DD HH:mm:ss"),l.consumeTime=F.utc(N.current).format("HH:mm:ss"),l.answerString=t.join("|")+`@@${m}`,m?l.isFinish=1:t.length!==0?l.isFinish=2:l.isFinish=0,A(!0),ae("/api/PsyInfotesttasklist/Update",l,h).then(o=>{o.code===200?(u.success(o.msg,3),b("/layout/psyTasks")):u.warning(o.msg),A(!1)})},[t,a,u,I,b,m,s]),L=n.useCallback((h=!0)=>O[s]?h?O[s].questionContent:O[s]:!1,[s,O]);n.useEffect(()=>{const h=[];L(!1)&&Object.keys(L(!1)).forEach((d,g)=>{const E=L(!1)[`answer${g}`];E&&h.push({key:g,name:E})});const o=T.OperateOptions.Psy.AnswerRandom?Fe(h):h;q(o)},[L,T]);const f=n.useCallback(h=>{if(s!==99)switch(h.keyCode){case 13:k();break;case 27:i();break;case 49:c[0]&&C({target:{value:c[0].key}});break;case 50:c[1]&&C({target:{value:c[1].key}});break;case 51:c[2]&&C({target:{value:c[2].key}});break;case 52:c[3]&&C({target:{value:c[3].key}});break;case 53:c[4]&&C({target:{value:c[4].key}});break;case 54:c[5]&&C({target:{value:c[5].key}});break;case 55:c[6]&&C({target:{value:c[6].key}});break;case 56:c[7]&&C({target:{value:c[7].key}});break;case 57:c[8]&&C({target:{value:c[8].key}});break;case 97:c[0]&&C({target:{value:c[0].key}});break;case 98:c[1]&&C({target:{value:c[1].key}});break;case 99:c[2]&&C({target:{value:c[2].key}});break;case 100:c[3]&&C({target:{value:c[3].key}});break;case 101:c[4]&&C({target:{value:c[4].key}});break;case 102:c[5]&&C({target:{value:c[5].key}});break;case 103:c[6]&&C({target:{value:c[6].key}});break;case 104:c[7]&&C({target:{value:c[7].key}});break;case 105:c[8]&&C({target:{value:c[8].key}});break}},[k,i,C,c,s]);n.useEffect(()=>(window.addEventListener("keydown",f),()=>{window.removeEventListener("keydown",f)}),[f]);const y=()=>e.jsx(U.Group,{onChange:C,value:t[s],children:e.jsx(X,{direction:"vertical",className:"itemlatout",children:c.length>0&&c.map(h=>e.jsxs(U,{value:h.key,children:[Number(h.key)-1,". ",h.name]},h.key))})}),j=h=>{p(h.target.value)};return e.jsxs(Ue,{theme:B,children:[e.jsxs("div",{className:"title",children:[e.jsx("span",{className:"common titleContent",children:a.nameChinese}),e.jsxs("span",{className:"common timer",children:[R?"累计答题时间: ":"",e.jsx(ie,{ref:N})]}),e.jsxs("span",{className:"common questionNUm",children:["第",s+1,"题 / 共",a.questionSum,"题"]})]}),e.jsxs("div",{className:"content",children:[e.jsx("div",{className:"progressBar",children:e.jsx(ee,{width:(s+1)/a.questionSum*100})}),e.jsxs("div",{className:"common topQuestion",children:[e.jsxs("p",{className:"describe",children:["问题描述: ",a.guide]}),L()]}),e.jsxs("div",{className:"common centerSelection",children:[e.jsxs("div",{className:"select",children:[e.jsxs("span",{style:{display:R?"inline-block":"none"},title:"快捷操作: 选项也可通过键盘点击选择选项, 数字对应选项, enter回车键对应下一题按钮,esc对应上一题按钮",children:[e.jsx(oe,{})," "]}),"请选择 :"]}),y(),s===99&&e.jsxs("div",{className:"moreSelect",children:[e.jsx("span",{children:"请输入问题,若无问题请输入没有问题,不要空着: "}),e.jsx(re,{className:"input",value:m,onChange:j})]})]}),e.jsxs("div",{className:"common nextQuest",children:[e.jsx(H,{className:"last",disabled:s===0,onClick:i,children:"上一题"}),D&&e.jsx(H,{className:"next",onClick:k,children:"下一题"}),e.jsx(H,{loading:S,type:"primary",className:"next",onClick:x,children:t.length===99&&m?"提 交":"保存并退出"})]})]})]})});ve.displayName="Cbcl2to3";const Ve=W.div`
  height: 100%;
  font-size: 14px;
  .title {
    height: 36px;
    line-height: 36px;
    padding: 0 10px;
    margin-bottom: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    display: flex;
    justify-content: space-between;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};

    .questionNUm {
      font-size: 14px;
      text-align: right;
    }
  }

  .content {
    height: calc(100% - 46px);
    overflow: auto;
    padding-top: 15px;
    position: relative;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};


    .progressBar {
      width: 100%;
      height: 15px;
      position: absolute;
      left: 0;
      top: 0;
    }
    .common {
      min-height: 60px;
      text-align: center;
      border-bottom: 1px dotted ${r=>r.theme.colorBorder};
    }
    .topQuestion {
      padding-bottom: 15px;

      .describe {
        padding: 10px;
        font-size: 14px;
        margin-bottom: 15px;
        text-align: left;
      }
      .img {
        max-height: 360px;
        max-width: 90%;
      }
    }
    .centerSelection {
      letter-spacing: 2px;
      padding-top: 25px;
      position: relative;
      .select {
        position: absolute;
        text-align: left;
        margin-left: 15px;
        top: 5px;
        left: 0;
      }
      .itemlatout {
        text-align: left;
        margin-bottom: 15px;
      }
      .fixedTitle {
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);

        width: 360px;
        height: 36px;
        line-height: 36px;
      }
      
      .leftSelect {
        width: 50%;
        display: inline-block;
        /* text-align: left;
        padding-left: 180px; */
        p {
          height: 36px;
          line-height: 36px;
        }
        .inp {
          width: 100%;
          .input {
            width: 30%;
          }
        }
      }
      .rightSelect {
        width: 50%;
        display: inline-block;
        p {
          height: 36px;
          line-height: 36px;
        }
      }
    }
    .nextQuest {
      padding-top: 15px;
      line-height: 40px;
      border: none;

      .next {
        letter-spacing: 2px;
        margin-left: 20px;
      }
      .last {
        letter-spacing: 2px;
      }
    }
  }

`,ye=n.memo(r=>{const b=te(),N=n.useRef(),{token:B}=_.useToken(),{message:u}=se.useApp(),{info:a}=r,{isPC:R,userInfo:I,changeCurrentQuestion:T,changeAnswerList:v,answerList:w,currentQuestion:t}=K(f=>f),[s,D]=n.useState([]),[Y,O]=n.useState(!1),[P,S]=n.useState(""),[A,c]=n.useState("");n.useEffect(()=>{(async()=>{try{const{code:y,data:j,msg:h}=await ne("/api/Psyinfotablecontent/All",{TableCode:a.tableCode,pageIndex:1,pageSize:999});y===200?D(j.items):u.warning(h)}catch(y){u.error(y)}})()},[a,u]);const q=n.useCallback(f=>{const y=[...w];y[t]=f.target.value,v(y)},[w,t,v]),m=n.useCallback(()=>{t>0&&T(t-1)},[t,T]),p=n.useCallback(()=>{if(!w[t]){u.info("请选择选项");return}t+1<a.questionSum?T(t+1):t+1===a.questionSum&&u.info("已经完成答题,请提交",2)},[a,t,w,T,u]),C=n.useCallback(()=>{if(t===3){if(!P){u.info("请选择 疗效",2);return}if(!A){u.info("请选择 副作用",2);return}}const f={},y={};f.taskID=a.id,f.TableChinese=a.nameChinese,f.org=I.pOrganizationName,y.pNum=I.userID,y.ptasknameid=a.ptasknameid,y.tableCode=a.tableCode,y.checkday=F().format("YYYY-MM-DD HH:mm:ss"),y.consumeTime=F.utc(N.current).format("HH:mm:ss"),y.answerString=w.join("|"),A?(y.isFinish=1,y.answerString=w.join("|")+`|${P}|${A}`):w.length!==0?y.isFinish=2:y.isFinish=0,O(!0),ae("/api/PsyInfotesttasklist/Update",y,f).then(j=>{j.code===200?(u.success(j.msg,3),b("/layout/psyTasks")):u.warning(j.msg),O(!1)})},[w,a,u,I,b,t,P,A]),i=n.useCallback((f=!0)=>s[t]?f?s[t].questionContent:s[t]:!1,[t,s]),k=f=>{S(f.target.value)},x=f=>{P?c(f.target.value):u.info("请先选择疗效, 再选择副反应")},L=f=>{if(f){if(f===1)return e.jsx(U.Group,{onChange:k,value:P,children:e.jsx(X,{direction:"vertical",className:"itemlatout",children:i(!1)&&Object.keys(i(!1)).filter((y,j)=>j<=4).map((y,j)=>{const h=i(!1)[`answer${j}`];return h&&e.jsxs(U,{value:j,children:[j,". ",h]},h)})})});if(f===2)return e.jsx(U.Group,{onChange:x,value:A,children:e.jsx(X,{direction:"vertical",className:"itemlatout",children:i(!1)&&Object.keys(i(!1)).filter((y,j)=>j>4).map((y,j)=>{const h=i(!1)[`answer${j+5}`];return h&&e.jsxs(U,{value:j+1,children:[j+5,". ",h]},h)})})})}else return e.jsx(U.Group,{onChange:q,value:w[t],children:e.jsx(X,{direction:"vertical",className:"itemlatout",children:i(!1)&&Object.keys(i(!1)).map((y,j)=>{const h=i(!1)[`answer${j}`];return h&&e.jsxs(U,{value:j,children:[j,". ",h]},h)})})})};return e.jsxs(Ve,{theme:B,children:[e.jsxs("div",{className:"title",children:[e.jsx("span",{className:"common titleContent",children:a.nameChinese}),e.jsxs("span",{className:"common timer",children:[R?"累计答题时间: ":"",e.jsx(ie,{ref:N})]}),e.jsxs("span",{className:"common questionNUm",children:["第",t+1,"题 / 共",a.questionSum,"题"]})]}),e.jsxs("div",{className:"content",children:[e.jsx("div",{className:"progressBar",children:e.jsx(ee,{width:(t+1)/a.questionSum*100})}),e.jsxs("div",{className:"common topQuestion",children:[e.jsxs("p",{className:"describe",children:["问题描述: ",a.guide]}),i()]}),e.jsxs("div",{className:"common centerSelection",children:[e.jsxs("div",{className:"select",children:[e.jsxs("span",{style:{display:R?"inline-block":"none"},title:"快捷操作: 选项也可通过键盘点击选择选项, 数字对应选项, enter回车键对应下一题按钮,esc对应上一题按钮",children:[e.jsx(oe,{})," "]}),"请选择 :"]}),t!==2&&L(),t===2&&e.jsxs("div",{children:[e.jsx("p",{className:"fixedTitle",children:"请先选择'疗效', 再选择'副反应'"}),e.jsxs("div",{className:"leftSelect",children:[e.jsx("p",{children:"疗效"}),L(1)]}),e.jsxs("div",{className:"rightSelect",children:[e.jsx("p",{children:"副反应"}),L(2)]})]})]}),e.jsxs("div",{className:"common nextQuest",children:[e.jsx(H,{className:"last",disabled:t===0,onClick:m,children:"上一题"}),e.jsx(H,{className:"next",onClick:p,children:"下一题"}),e.jsx(H,{loading:Y,type:"primary",className:"next",onClick:C,children:A?"提 交":"保存并退出"})]})]})]})});ye.displayName="Cgi";const Ge=W.div`
  height: 100%;
  font-size: 14px;
  .title {
    height: 36px;
    line-height: 36px;
    padding: 0 10px;
    margin-bottom: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    display: flex;
    justify-content: space-between;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};

    .questionNUm {
      font-size: 14px;
      text-align: right;
    }
  }

  .content {
    height: calc(100% - 46px);
    overflow: auto;
    padding-top: 15px;
    position: relative;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};


    .progressBar {
      width: 100%;
      height: 15px;
      position: absolute;
      left: 0;
      top: 0;
    }
    .common {
      min-height: 60px;
      text-align: center;
      border-bottom: 1px dotted ${r=>r.theme.colorBorder};
    }
    .topQuestion {
      padding-bottom: 15px;

      .describe {
        padding: 10px;
        font-size: 14px;
        margin-bottom: 15px;
        text-align: left;
      }
      .img {
        max-height: 360px;
        max-width: 90%;
      }
    }
    .centerSelection {
      letter-spacing: 2px;
      padding-top: 25px;
      position: relative;
      .select {
        position: absolute;
        text-align: left;
        margin-left: 15px;
        top: 5px;
        left: 0;
      }
      .itemlatout {
        text-align: left;
        margin-bottom: 15px;
      }
      .groupselectStyle {
        width: 100%;
        height: 40px;
        text-align: center;
        .input {
          width: 30%;
        }
      }
    }
    .nextQuest {
      padding-top: 15px;
      line-height: 40px;
      border: none;

      .next {
        letter-spacing: 2px;
        margin-left: 20px;
      }
      .last {
        letter-spacing: 2px;
      }
    }
  }

`,Xe=(r=[])=>{for(let b=r.length-1;b>0;b--){const N=Math.floor(Math.random()*(b+1)),B=r[b];r[b]=r[N],r[N]=B}return r},we=n.memo(r=>{const b=te(),N=n.useRef(),{token:B}=_.useToken(),{message:u}=se.useApp(),{info:a}=r,{isPC:R,project:I,userInfo:T,changeCurrentQuestion:v,changeAnswerList:w,answerList:t,currentQuestion:s}=K(y=>y),[D,Y]=n.useState(!1),[O,P]=n.useState([]),[S,A]=n.useState(!1),[c,q]=n.useState([]);n.useEffect(()=>{(async()=>{try{const{code:j,data:h,msg:l}=await ne("/api/Psyinfotablecontent/All",{TableCode:a.tableCode,pageIndex:1,pageSize:999});j===200?P(h.items):u.warning(l)}catch(j){u.error(j)}})()},[a,u]);const m=n.useCallback(y=>{if(t[s]){const h=[...t];h[s]=y.target.value,w(h);return}let j=null;return new Promise(h=>{const l=[...t];l[s]=y.target.value,w(l),h()}).then(()=>{!D&&s+1<a.questionSum&&(j=setTimeout(()=>{v(s+1)},500))}),()=>{clearTimeout(j)}},[t,s,D,a,w,v]),p=n.useCallback(()=>{s>0&&(v(s-1),Y(!0))},[s,v]),C=n.useCallback(()=>{if(!t[s]){u.info("请选择选项",2);return}s+1<a.questionSum?v(s+1):s+1===a.questionSum&&u.info("已经完成答题,请提交",2),s===t.length-1&&Y(!1)},[a,s,t,v,u]),i=n.useCallback(()=>{const y={},j={};y.taskID=a.id,y.TableChinese=a.nameChinese,y.org=T.pOrganizationName,j.pNum=T.userID,j.ptasknameid=a.ptasknameid,j.tableCode=a.tableCode,j.checkday=F().format("YYYY-MM-DD HH:mm:ss"),j.consumeTime=F.utc(N.current).format("HH:mm:ss"),j.answerString=t.join("|"),t.length===a.questionSum?j.isFinish=1:t.length!==0?j.isFinish=2:j.isFinish=0,A(!0),ae("/api/PsyInfotesttasklist/Update",j,y).then(h=>{h.code===200?(u.success(h.msg,3),b("/layout/psyTasks")):u.warning(h.msg),A(!1)})},[t,a,u,T,b]),k=()=>{if(O[s])if(O[s].questionContent.includes("|")){const y=O[s].questionContent.split("|");return T.pSex===1?y[0]:y[1]}else return O[s].questionContent},x=n.useCallback((y=!0)=>O[s]?y?O[s].questionContent:O[s]:!1,[s,O]);n.useEffect(()=>{const y=[];x(!1)&&Object.keys(x(!1)).forEach((l,o)=>{const d=x(!1)[`answer${o}`];d&&y.push({key:o,name:d})});const h=I.OperateOptions.Psy.AnswerRandom?Xe(y):y;q(h)},[x,I]);const L=n.useCallback(y=>{switch(y.keyCode){case 13:C();break;case 27:p();break;case 49:c[0]&&m({target:{value:c[0].key}});break;case 50:c[1]&&m({target:{value:c[1].key}});break;case 51:c[2]&&m({target:{value:c[2].key}});break;case 52:c[3]&&m({target:{value:c[3].key}});break;case 53:c[4]&&m({target:{value:c[4].key}});break;case 54:c[5]&&m({target:{value:c[5].key}});break;case 55:c[6]&&m({target:{value:c[6].key}});break;case 56:c[7]&&m({target:{value:c[7].key}});break;case 57:c[8]&&m({target:{value:c[8].key}});break;case 97:c[0]&&m({target:{value:c[0].key}});break;case 98:c[1]&&m({target:{value:c[1].key}});break;case 99:c[2]&&m({target:{value:c[2].key}});break;case 100:c[3]&&m({target:{value:c[3].key}});break;case 101:c[4]&&m({target:{value:c[4].key}});break;case 102:c[5]&&m({target:{value:c[5].key}});break;case 103:c[6]&&m({target:{value:c[6].key}});break;case 104:c[7]&&m({target:{value:c[7].key}});break;case 105:c[8]&&m({target:{value:c[8].key}});break}},[C,p,m,c]);n.useEffect(()=>(window.addEventListener("keydown",L),()=>{window.removeEventListener("keydown",L)}),[L]);const f=()=>(x(!1)&&Object.keys(x(!1)).forEach((y,j)=>{x(!1)[`answer${j}`]}),e.jsx(U.Group,{onChange:m,value:t[s],children:e.jsx(X,{direction:"vertical",className:"itemlatout",children:c.length>0&&c.map((y,j)=>e.jsxs(U,{value:y.key,children:[j+1,". ",y.name]},y.key))})}));return e.jsxs(Ge,{theme:B,children:[e.jsxs("div",{className:"title",children:[e.jsx("span",{className:"common titleContent",children:a.nameChinese}),e.jsxs("span",{className:"common timer",children:[R?"累计答题时间: ":"",e.jsx(ie,{ref:N})]}),e.jsxs("span",{className:"common questionNUm",children:["第",s+1,"题 / 共",a.questionSum,"题"]})]}),e.jsxs("div",{className:"content",children:[e.jsx("div",{className:"progressBar",children:e.jsx(ee,{width:(s+1)/a.questionSum*100})}),e.jsxs("div",{className:"common topQuestion",children:[e.jsxs("p",{className:"describe",children:["问题描述: ",a.guide]}),k()]}),e.jsxs("div",{className:"common centerSelection",children:[e.jsxs("div",{className:"select",children:[e.jsxs("span",{style:{display:R?"inline-block":"none"},title:"快捷操作: 选项也可通过键盘点击选择选项, 数字对应选项, enter回车键对应下一题按钮,esc对应上一题按钮",children:[e.jsx(oe,{})," "]}),"请选择 :"]}),f()]}),e.jsxs("div",{className:"common nextQuest",children:[e.jsx(H,{className:"last",disabled:s===0,onClick:p,children:"上一题"}),D&&e.jsx(H,{className:"next",onClick:C,children:"下一题"}),e.jsx(H,{loading:S,type:"primary",className:"next",onClick:i,children:t.length===a.questionSum?"提 交":"保存并退出"})]})]})]})});we.displayName="Cmi";const We=W.div`
  height: 100%;
  font-size: 14px;
  .title {
    height: 36px;
    line-height: 36px;
    padding: 0 10px;
    margin-bottom: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    display: flex;
    justify-content: space-between;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};

    .questionNUm {
      font-size: 14px;
      text-align: right;
    }
  }

  .content {
    height: calc(100% - 46px);
    overflow: auto;
    padding-top: 15px;
    position: relative;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};


    .progressBar {
      width: 100%;
      height: 15px;
      position: absolute;
      left: 0;
      top: 0;
    }
    .common {
      min-height: 60px;
      text-align: center;
      border-bottom: 1px dotted ${r=>r.theme.colorBorder};
    }
    .topQuestion {
      padding-bottom: 15px;

      .describe {
        padding: 10px;
        font-size: 14px;
        margin-bottom: 15px;
        text-align: left;
      }
      .img {
        max-height: 360px;
        max-width: 90%;
      }
    }
    .centerSelection {
      letter-spacing: 2px;
      padding-top: 25px;
      position: relative;
      .select {
        position: absolute;
        text-align: left;
        margin-left: 15px;
        top: 5px;
        left: 0;
      }
      .itemlatout {
        text-align: left;
        margin-bottom: 15px;
        margin-left: 15px;
      }
      .groupselectStyle {
        width: 100%;
        height: 40px;
        text-align: center;
        .input {
          width: 30%;
        }
      }
    }
    .nextQuest {
      padding-top: 15px;
      line-height: 40px;
      border: none;

      .next {
        letter-spacing: 2px;
        margin-left: 20px;
      }
      .last {
        letter-spacing: 2px;
      }
    }
  }
`,Ze=(r=[])=>{for(let b=r.length-1;b>0;b--){const N=Math.floor(Math.random()*(b+1)),B=r[b];r[b]=r[N],r[N]=B}return r},je=n.memo(r=>{const b=te(),N=n.useRef(),{token:B}=_.useToken(),{message:u}=se.useApp(),{info:a}=r,{isPC:R,project:I,userInfo:T,changeCurrentQuestion:v,changeAnswerList:w,answerList:t,currentQuestion:s,changeAnswerTime:D}=K(l=>l),[Y,O]=n.useState(!1),[P,S]=n.useState([]),[A,c]=n.useState(!1),[q,m]=n.useState(!1),[p,C]=n.useState([]);n.useEffect(()=>{(async()=>{try{const{code:o,data:d,msg:g}=await ne("/api/Psyinfotablecontent/All",{TableCode:a.tableCode,pageIndex:1,pageSize:999});o===200?S(d.items):u.warning(g)}catch(o){u.error(o)}})()},[a,u]);const i=n.useCallback(()=>{const l={},o={};l.taskID=a.id,l.TableChinese=a.nameChinese,l.org=T.pOrganizationName,o.pNum=T.userID,o.ptasknameid=a.ptasknameid,o.tableCode=a.tableCode,o.checkday=F().format("YYYY-MM-DD HH:mm:ss"),o.consumeTime=F.utc(N.current).format("HH:mm:ss"),o.answerString=t.join("|"),t.length===a.questionSum?o.isFinish=1:t.length!==0?o.isFinish=2:o.isFinish=0,c(!0),ae("/api/PsyInfotesttasklist/Update",o,l).then(d=>{d.code===200?(u.success(d.msg,3),b("/layout/psyTasks"),w([]),v(0),D("00:00:00")):u.warning(d.msg),c(!1)})},[t,a,u,T,b,w,v,D]),k=n.useCallback(l=>{if(t[s]){const d=[...t];d[s]=l.target.value,w(d);return}let o=null;return new Promise(d=>{const g=[...t];g[s]=l.target.value,w(g),console.log(g.length,a.questionSum);let E=g.length===a.questionSum;d(E)}).then(d=>{!Y&&s+1<a.questionSum&&(o=setTimeout(()=>{v(s+1)},500)),d&&m(!0)}),()=>{clearTimeout(o)}},[t,s,Y,a,w,v]);n.useEffect(()=>{q&&(i(),m(!1))},[q,i]);const x=n.useCallback(()=>{s>0&&(v(s-1),O(!0))},[s,v]),L=n.useCallback(()=>{if(!t[s]){u.info("请选择选项",2);return}s+1<a.questionSum?v(s+1):s+1===a.questionSum&&u.info("已经完成答题,请提交",2),s===t.length-1&&O(!1)},[a,s,t,v,u]),f=n.useCallback((l=!0)=>P[s]?l?P[s].questionContent:P[s]:!1,[s,P]);n.useEffect(()=>{const l=[];f(!1)&&Object.keys(f(!1)).forEach((g,E)=>{const Q=f(!1)[`answer${E}`];Q&&l.push({key:E,name:Q})});const d=I.OperateOptions.Psy.AnswerRandom?Ze(l):l;C(d)},[f,I]);const y=n.useCallback(l=>{switch(l.keyCode){case 13:L();break;case 27:x();break;case 49:p[0]&&k({target:{value:p[0].key}});break;case 50:p[1]&&k({target:{value:p[1].key}});break;case 51:p[2]&&k({target:{value:p[2].key}});break;case 52:p[3]&&k({target:{value:p[3].key}});break;case 53:p[4]&&k({target:{value:p[4].key}});break;case 54:p[5]&&k({target:{value:p[5].key}});break;case 55:p[6]&&k({target:{value:p[6].key}});break;case 56:p[7]&&k({target:{value:p[7].key}});break;case 57:p[8]&&k({target:{value:p[8].key}});break;case 97:p[0]&&k({target:{value:p[0].key}});break;case 98:p[1]&&k({target:{value:p[1].key}});break;case 99:p[2]&&k({target:{value:p[2].key}});break;case 100:p[3]&&k({target:{value:p[3].key}});break;case 101:p[4]&&k({target:{value:p[4].key}});break;case 102:p[5]&&k({target:{value:p[5].key}});break;case 103:p[6]&&k({target:{value:p[6].key}});break;case 104:p[7]&&k({target:{value:p[7].key}});break;case 105:p[8]&&k({target:{value:p[8].key}});break}},[L,x,k,p]);n.useEffect(()=>(window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y)}),[y]);const j=l=>""+l,h=()=>e.jsx(U.Group,{onChange:k,value:t[s],children:e.jsx(X,{direction:"vertical",className:"itemlatout",children:p.length>0&&p.map((l,o)=>e.jsxs(U,{value:l.key,children:[o+1,". ",l.name]},l.key))})});return e.jsxs(We,{theme:B,children:[e.jsxs("div",{className:"title",children:[e.jsx("span",{className:"common titleContent",children:a.nameChinese}),e.jsxs("span",{className:"common timer",children:[R?"累计答题时间: ":"",e.jsx(ie,{ref:N})]}),e.jsxs("span",{className:"common questionNUm",children:["第",s+1,"题 / 共",a.questionSum,"题"]})]}),e.jsxs("div",{className:"content",children:[e.jsx("div",{className:"progressBar",children:e.jsx(ee,{width:(s+1)/a.questionSum*100})}),e.jsxs("div",{className:"common topQuestion",children:[e.jsxs("p",{className:"describe",children:["问题描述: ",a.guide]}),f()&&ke(f(),[".bmp",".gif"])?e.jsx("img",{className:"img",src:j(f()),alt:""}):f()]}),e.jsxs("div",{className:"common centerSelection",children:[e.jsxs("div",{className:"select",children:[e.jsxs("span",{style:{display:R?"inline-block":"none"},title:"快捷操作: 选项也可通过键盘点击选择选项, 数字对应选项, enter回车键对应下一题按钮,esc对应上一题按钮",children:[e.jsx(oe,{})," "]}),"请选择 :"]}),h()]}),e.jsxs("div",{className:"common nextQuest",children:[e.jsx(H,{className:"last",disabled:s===0,onClick:x,children:"上一题"}),Y&&e.jsx(H,{className:"next",onClick:L,children:"下一题"}),e.jsx(H,{loading:A,type:"primary",className:"next",onClick:i,children:t.length===a.questionSum?"提 交":"保存并退出"})]})]})]})});je.displayName="Common";const Je=W.div`
  height: 100%;
  font-size: 14px;
  .title {
    height: 36px;
    line-height: 36px;
    padding: 0 10px;
    margin-bottom: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    display: flex;
    justify-content: space-between;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};

    .questionNUm {
      font-size: 14px;
      text-align: right;
    }
  }

  .content {
    height: calc(100% - 46px);
    overflow: auto;
    padding-top: 15px;
    position: relative;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};


    .progressBar {
      width: 100%;
      height: 15px;
      position: absolute;
      left: 0;
      top: 0;
    }
    .common {
      min-height: 60px;
      text-align: center;
      border-bottom: 1px dotted ${r=>r.theme.colorBorder};
    }
    .topQuestion {
      padding-bottom: 15px;

      .describe {
        padding: 10px;
        font-size: 14px;
        margin-bottom: 15px;
        text-align: left;
      }
      .img {
        max-height: 360px;
        max-width: 90%;
      }
    }
    .centerSelection {
      letter-spacing: 2px;
      padding: 25px 0;
      position: relative;
      display: flex;
      flex-wrap: wrap;

      .fixedTitle {
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);

        width: 360px;
        height: 36px;
        line-height: 36px;
      }
      .leftSelect {
        width: 50%;
        margin: 0 auto;
        p {
          height: 36px;
          line-height: 36px;
        }
        .inp {
          width: 100%;
          .input {
            width: 30%;
          }
        }
      }
      .rightSelect {
        width: 50%;
        margin: 0 auto;
        p {
          height: 36px;
          line-height: 36px;
        }
      }
    }
    .nextQuest {
      padding-top: 15px;
      line-height: 40px;
      border: none;

      .next {
        letter-spacing: 2px;
        margin-left: 20px;
      }
      .last {
        letter-spacing: 2px;
      }
    }
  }

`,Ce=n.memo(r=>{const b=te(),N=n.useRef(),{token:B}=_.useToken(),{message:u}=se.useApp(),{info:a}=r,{isPC:R,userInfo:I,changeCurrentQuestion:T,changeAnswerList:v,answerList:w,currentQuestion:t,changeAnswerTime:s}=K(o=>o),[D,Y]=n.useState(!1),[O,P]=n.useState([]),[S,A]=n.useState(!1),[c,q]=n.useState([]),[m,p]=n.useState(()=>{const o=[];return w.forEach((d,g)=>{g%2===0&&o.push(d)}),o}),[C,i]=n.useState(()=>{const o=[];return w.forEach((d,g)=>{g%2!==0&&o.push(d)}),o});n.useEffect(()=>{(async()=>{try{const{code:d,data:g,msg:E}=await ne("/api/Psyinfotablecontent/All",{TableCode:a.tableCode,pageIndex:1,pageSize:999});d===200?P(g.items):u.warning(E)}catch(d){u.error(d)}})()},[a,u]);const k=n.useCallback(o=>{const d=[...m];d[t]=o.target.value,p(d)},[t,m]),x=n.useCallback(o=>{if(!m[t]){u.warning("请先选择 父亲选项");return}if(C[t]){const g=[...C];g[t]=o.target.value,i(g);return}let d=null;return new Promise(g=>{const E=[...C];E[t]=o.target.value,i(E);const Q=[];E.forEach((z,$)=>{Q.push(m[$]),Q.push(z)}),v(Q),g()}).then(()=>{!D&&t+1<a.questionSum&&(d=setTimeout(()=>{T(t+1)},500))}),()=>{clearTimeout(d)}},[t,m,C,v,T,a,D,u]),L=n.useCallback(()=>{t>0&&(T(t-1),Y(!0))},[t,T]),f=n.useCallback(()=>{if(!m[t]){u.info("请选择 父亲选项",2);return}if(C[t]===void 0){u.info("请选择 母亲选项",2);return}t+1<a.questionSum?T(t+1):t+1===a.questionSum&&u.info("已经完成答题,请提交",2),t===C.length-1&&Y(!1)},[T,t,a,m,C,u]),y=n.useCallback(()=>{const o={},d={};o.taskID=a.id,o.TableChinese=a.nameChinese,o.org=I.pOrganizationName,d.pNum=I.userID,d.ptasknameid=a.ptasknameid,d.tableCode=a.tableCode,d.checkday=F().format("YYYY-MM-DD HH:mm:ss"),d.consumeTime=F.utc(N.current).format("HH:mm:ss"),d.answerString=w.join("|"),C.length===a.questionSum?d.isFinish=1:0<C.length?d.isFinish=2:d.isFinish=0,A(!0),ae("/api/PsyInfotesttasklist/Update",d,o).then(g=>{g.code===200?(u.success(g.msg,3),b("/layout/psyTasks"),v([]),T(0),s("00:00:00")):u.warning(g.msg),A(!1)})},[w,a,u,I,b,v,T,s,C]),j=n.useCallback((o=!0)=>O[t]?o?O[t].questionContent:O[t]:!1,[t,O]);n.useEffect(()=>{const o=[];j(!1)&&Object.keys(j(!1)).forEach((d,g)=>{const E=j(!1)[`answer${g}`];E&&o.push({key:g,name:E})}),q(o)},[j]);const h=n.useCallback(o=>{switch(o.keyCode){case 13:f();break;case 27:L();break;case 49:c[0]&&k({target:{value:c[0].key}});break;case 50:c[1]&&k({target:{value:c[1].key}});break;case 51:c[2]&&k({target:{value:c[2].key}});break;case 52:c[3]&&k({target:{value:c[3].key}});break;case 53:c[4]&&x({target:{value:c[4].key}});break;case 54:c[5]&&x({target:{value:c[5].key}});break;case 55:c[6]&&x({target:{value:c[6].key}});break;case 56:c[7]&&x({target:{value:c[7].key}});break;case 97:c[0]&&k({target:{value:c[0].key}});break;case 98:c[1]&&k({target:{value:c[1].key}});break;case 99:c[2]&&k({target:{value:c[2].key}});break;case 100:c[3]&&k({target:{value:c[3].key}});break;case 101:c[4]&&x({target:{value:c[4].key}});break;case 102:c[5]&&x({target:{value:c[5].key}});break;case 103:c[6]&&x({target:{value:c[6].key}});break;case 104:c[7]&&x({target:{value:c[7].key}});break}},[f,L,k,c,x]);n.useEffect(()=>(window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h)}),[h]);const l=o=>{if(o===1)return e.jsx(U.Group,{onChange:k,value:m[t],children:e.jsx(X,{direction:"vertical",className:"itemlatout",children:j(!1)&&Object.keys(j(!1)).filter((d,g)=>g<=4).map((d,g)=>{const E=j(!1)[`answer${g}`];return E&&e.jsxs(U,{value:g,children:[g,". ",E]},E)})})});if(o===2)return e.jsx(U.Group,{onChange:x,value:C[t],children:e.jsx(X,{direction:"vertical",className:"itemlatout",children:j(!1)&&Object.keys(j(!1)).filter((d,g)=>g>4).map((d,g)=>{const E=j(!1)[`answer${g+5}`];return E&&e.jsxs(U,{value:g+5,children:[g+5,". ",E]},E)})})})};return e.jsxs(Je,{theme:B,children:[e.jsxs("div",{className:"title",children:[e.jsx("span",{className:"common titleContent",children:a.nameChinese}),e.jsxs("span",{className:"common timer",children:[R?"累计答题时间: ":"",e.jsx(ie,{ref:N})]}),e.jsxs("span",{className:"common questionNUm",children:["第",t+1,"题 / 共",a.questionSum,"题"]})]}),e.jsxs("div",{className:"content",children:[e.jsx("div",{className:"progressBar",children:e.jsx(ee,{width:(t+1)/a.questionSum*100})}),e.jsxs("div",{className:"common topQuestion",children:[e.jsxs("p",{className:"describe",children:["问题描述: ",a.guide]}),j()]}),e.jsxs("div",{className:"common centerSelection",children:[e.jsx("p",{className:"fixedTitle",children:"请先选择'父亲选项', 再选择'母亲选项'"}),e.jsxs("div",{className:"leftSelect",children:[e.jsx("p",{children:"父亲选项"}),l(1)]}),e.jsxs("div",{className:"rightSelect",children:[e.jsx("p",{children:"母亲选项"}),l(2)]})]}),e.jsxs("div",{className:"common nextQuest",children:[e.jsx(H,{className:"last",disabled:t===0,onClick:L,children:"上一题"}),D&&e.jsx(H,{className:"next",onClick:f,children:"下一题"}),e.jsx(H,{loading:S,type:"primary",className:"next",onClick:y,children:C.length===a.questionSum?"提 交":"保存并退出"})]})]})]})});Ce.displayName="Embu";const _e=W.div`
  height: 100%;
  font-size: 14px;
  .title {
    height: 36px;
    line-height: 36px;
    padding: 0 10px;
    margin-bottom: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    display: flex;
    justify-content: space-between;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};

    .questionNUm {
      font-size: 14px;
      text-align: right;
    }
  }

  .content {
    height: calc(100% - 46px);
    overflow: auto;
    padding-top: 15px;
    position: relative;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};


    .progressBar {
      width: 100%;
      height: 15px;
      position: absolute;
      left: 0;
      top: 0;
    }
    .common {
      min-height: 60px;
      text-align: center;
      border-bottom: 1px dotted ${r=>r.theme.colorBorder};
    }
    .topQuestion {
      padding-bottom: 15px;

      .describe {
        padding: 10px;
        font-size: 14px;
        margin-bottom: 15px;
        text-align: left;
      }
      .img {
        max-height: 360px;
        max-width: 90%;
      }
    }
    .centerSelection {
      letter-spacing: 2px;
      padding-top: 25px;
      position: relative;
      .select {
        position: absolute;
        text-align: left;
        margin-left: 15px;
        top: 5px;
        left: 0;
      }
      .itemlatout {
        text-align: left;
        margin-bottom: 15px;
        margin-left: 15px;
      }
    }
    .nextQuest {
      padding-top: 15px;
      line-height: 40px;
      border: none;

      .next {
        letter-spacing: 2px;
        margin-left: 20px;
      }
      .last {
        letter-spacing: 2px;
      }
    }
  }

`,Ke=(r=[])=>{for(let b=r.length-1;b>0;b--){const N=Math.floor(Math.random()*(b+1)),B=r[b];r[b]=r[N],r[N]=B}return r},et=r=>{const b=[];for(let N=0;N<r.length;N++){const B=r[N];B.answer1=r[N].questionContent,B.answer2=r[N+1]&&r[N+1].questionContent,B.questionContent="",r[N].questionCode%2!==0&&b.push(B)}return b},Ne=n.memo(r=>{const b=te(),N=n.useRef(),{token:B}=_.useToken(),{message:u}=se.useApp(),{info:a}=r,{isPC:R,userInfo:I,project:T,changeCurrentQuestion:v,changeAnswerList:w,answerList:t,currentQuestion:s}=K(f=>f),[D,Y]=n.useState(!1),[O,P]=n.useState([]),[S,A]=n.useState(!1),[c,q]=n.useState([]);n.useEffect(()=>{(async()=>{try{const{code:y,data:j}=await ne("/api/Psyinfotablecontent/All",{TableCode:a.tableCode,pageIndex:1,pageSize:999});y===200&&P(et(j.items))}catch(y){u.error(y)}})()},[a,u,w,v]);const m=n.useCallback(f=>{if(t[s]){const j=[...t];j[s]=f.target.value,w(j);return}let y=null;return new Promise(j=>{const h=[...t];h[s]=f.target.value,w(h),j()}).then(()=>{!D&&s+1<a.questionSum&&(y=setTimeout(()=>{v(s+1)},500))}),()=>{clearTimeout(y)}},[t,s,D,a,w,v]),p=n.useCallback(()=>{s>0&&(v(s-1),Y(!0))},[s,v]),C=n.useCallback(()=>{if(!t[s]){u.info("请选择选项",2);return}s+1<a.questionSum?v(s+1):s+1===a.questionSum&&u.info("已经完成答题,请提交",2),s===t.length-1&&Y(!1)},[a,s,t,v,u]),i=n.useCallback(()=>{const f={},y={};f.taskID=a.id,f.TableChinese=a.nameChinese,f.org=I.pOrganizationName,y.pNum=I.userID,y.ptasknameid=a.ptasknameid,y.tableCode=a.tableCode,y.checkday=F().format("YYYY-MM-DD HH:mm:ss"),y.consumeTime=F.utc(N.current).format("HH:mm:ss"),y.answerString=t.join("|"),t.length===a.questionSum?y.isFinish=1:t.length!==0?y.isFinish=2:y.isFinish=0,A(!0),ae("/api/PsyInfotesttasklist/Update",y,f).then(j=>{j.code===200?(u.success(j.msg,3),b("/layout/psyTasks")):u.warning(j.msg),A(!1)})},[t,a,u,I,b]),k=n.useCallback((f=!0)=>O[s]?f?O[s].questionContent:O[s]:!1,[s,O]);n.useEffect(()=>{const f=[];k(!1)&&Object.keys(k(!1)).forEach((h,l)=>{const o=k(!1)[`answer${l}`];o&&f.push({key:l,name:o})});const j=T.OperateOptions.Psy.AnswerRandom?Ke(f):f;q(j)},[k,T]);const x=n.useCallback(f=>{switch(f.keyCode){case 13:C();break;case 27:p();break;case 49:c[0]&&m({target:{value:c[0].key}});break;case 50:c[1]&&m({target:{value:c[1].key}});break;case 51:c[2]&&m({target:{value:c[2].key}});break;case 52:c[3]&&m({target:{value:c[3].key}});break;case 53:c[4]&&m({target:{value:c[4].key}});break;case 54:c[5]&&m({target:{value:c[5].key}});break;case 55:c[6]&&m({target:{value:c[6].key}});break;case 56:c[7]&&m({target:{value:c[7].key}});break;case 57:c[8]&&m({target:{value:c[8].key}});break;case 97:c[0]&&m({target:{value:c[0].key}});break;case 98:c[1]&&m({target:{value:c[1].key}});break;case 99:c[2]&&m({target:{value:c[2].key}});break;case 100:c[3]&&m({target:{value:c[3].key}});break;case 101:c[4]&&m({target:{value:c[4].key}});break;case 102:c[5]&&m({target:{value:c[5].key}});break;case 103:c[6]&&m({target:{value:c[6].key}});break;case 104:c[7]&&m({target:{value:c[7].key}});break;case 105:c[8]&&m({target:{value:c[8].key}});break}},[C,p,m,c]);n.useEffect(()=>(window.addEventListener("keydown",x),()=>{window.removeEventListener("keydown",x)}),[x]);const L=f=>""+f;return e.jsxs(_e,{theme:B,children:[e.jsxs("div",{className:"title",children:[e.jsx("span",{className:"common titleContent",children:a.nameChinese}),e.jsxs("span",{className:"common timer",children:[R?"累计答题时间: ":"",e.jsx(ie,{ref:N})]}),e.jsxs("span",{className:"common questionNUm",children:["第",s+1,"题 / 共",a.questionSum,"题"]})]}),e.jsxs("div",{className:"content",children:[e.jsx("div",{className:"progressBar",children:e.jsx(ee,{width:(s+1)/a.questionSum*100})}),e.jsxs("div",{className:"common topQuestion",children:[e.jsxs("p",{className:"describe",children:["问题描述: ",a.guide]}),k()&&ke(k(),[".bmp",".gif"])?e.jsx("img",{className:"img",src:L(k()),alt:""}):k()]}),e.jsxs("div",{className:"common centerSelection",children:[e.jsxs("div",{className:"select",children:[e.jsxs("span",{style:{display:R?"inline-block":"none"},title:"快捷操作: 选项也可通过键盘点击选择选项, 数字对应选项, enter回车键对应下一题按钮,esc对应上一题按钮",children:[e.jsx(oe,{})," "]}),"请选择 :"]}),e.jsx(U.Group,{onChange:m,value:t[s],children:e.jsx(X,{direction:"vertical",className:"itemlatout",children:c.length>0&&c.map((f,y)=>e.jsxs(U,{value:f.key,children:[y+1,". ",f.name]},f.key))})})]}),e.jsxs("div",{className:"common nextQuest",children:[e.jsx(H,{className:"last",disabled:s===0,onClick:p,children:"上一题"}),D&&e.jsx(H,{className:"next",onClick:C,children:"下一题"}),e.jsx(H,{loading:S,type:"primary",className:"next",onClick:i,children:t.length===a.questionSum?"提 交":"保存并退出"})]})]})]})});Ne.displayName="Epps";const tt=W.div`
  height: 100%;
  font-size: 14px;
  .title {
    height: 36px;
    line-height: 36px;
    padding: 0 10px;
    margin-bottom: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    display: flex;
    justify-content: space-between;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};

    .questionNUm {
      font-size: 14px;
      text-align: right;
    }
  }

  .content {
    height: calc(100% - 46px);
    overflow: auto;
    padding-top: 15px;
    position: relative;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};


    .progressBar {
      width: 100%;
      height: 15px;
      position: absolute;
      left: 0;
      top: 0;
    }
    .common {
      min-height: 60px;
      text-align: center;
      border-bottom: 1px dotted ${r=>r.theme.colorBorder};
    }
    .topQuestion {
      padding-bottom: 15px;

      .describe {
        padding: 10px;
        font-size: 14px;
        margin-bottom: 15px;
        text-align: left;
      }
      .img {
        max-height: 360px;
        max-width: 90%;
      }
    }
    .centerSelection {
      letter-spacing: 2px;
      padding-top: 25px;
      position: relative;
      .select {
        position: absolute;
        text-align: left;
        margin-left: 15px;
        top: 5px;
        left: 0;
      }
      .itemlatout {
        text-align: left;
        margin-bottom: 15px;
      }
      .groupselectStyle {
        width: 100%;
        height: 40px;
        text-align: center;
        .input {
          width: 30%;
        }
      }
    }
    .nextQuest {
      padding-top: 15px;
      line-height: 40px;
      border: none;

      .next {
        letter-spacing: 2px;
        margin-left: 20px;
      }
      .last {
        letter-spacing: 2px;
      }
    }
  }

`,st=(r=[])=>{for(let b=r.length-1;b>0;b--){const N=Math.floor(Math.random()*(b+1)),B=r[b];r[b]=r[N],r[N]=B}return r},Se=n.memo(r=>{const b=te(),N=n.useRef(),{token:B}=_.useToken(),{message:u}=se.useApp(),{info:a}=r,{isPC:R,userInfo:I,project:T,changeCurrentQuestion:v,changeAnswerList:w,answerList:t,currentQuestion:s,changeAnswerTime:D}=K(o=>o),[Y,O]=n.useState(()=>s<t.length),[P,S]=n.useState([]),[A,c]=n.useState(!1),[q,m]=n.useState([]),[p,C]=n.useState(()=>t[37]);n.useEffect(()=>{(async()=>{try{const{code:d,data:g,msg:E}=await ne("/api/Psyinfotablecontent/All",{TableCode:a.tableCode,pageIndex:1,pageSize:999});d===200?S(g.items):u.warning(E)}catch(d){u.error(d)}})()},[a,u]);const i=n.useCallback(o=>{if(t[s]){const g=[...t];g[s]=o.target.value,w(g);return}let d=null;return new Promise(g=>{const E=[...t];E[s]=o.target.value,w(E),g()}).then(()=>{!Y&&s+1<a.questionSum&&(d=setTimeout(()=>{v(s+1)},500))}),()=>{clearTimeout(d)}},[t,s,Y,a,w,v]),k=n.useCallback(()=>{s>0&&(v(s-1),O(!0))},[s,v]),x=n.useCallback(()=>{if(!t[s]){u.info("请选择选项",2);return}if(s===37&&!p){u.info("请输入答案");return}s+1<a.questionSum?v(s+1):s+1===a.questionSum&&u.info("已经完成答题,请提交",2),s===t.length-1&&O(!1)},[a,s,t,v,u,p]),L=n.useCallback(()=>{const o={},d={};o.taskID=a.id,o.TableChinese=a.nameChinese,o.org=I.pOrganizationName,d.pNum=I.userID,d.ptasknameid=a.ptasknameid,d.tableCode=a.tableCode,d.checkday=F().format("YYYY-MM-DD HH:mm:ss"),d.consumeTime=F.utc(N.current).format("HH:mm:ss"),d.answerString=t.join("|"),t.length===a.questionSum?d.isFinish=1:t.length!==0?d.isFinish=2:d.isFinish=0,c(!0),ae("/api/PsyInfotesttasklist/Update",d,o).then(g=>{g.code===200?(u.success(g.msg,3),b("/layout/psyTasks"),w([]),v(0),D("00:00:00")):u.warning(g.msg),c(!1)})},[t,a,u,I,b,w,v,D]),f=n.useCallback((o=!0)=>P[s]?o?P[s].questionContent:P[s]:!1,[s,P]);n.useEffect(()=>{const o=[];f(!1)&&Object.keys(f(!1)).forEach((E,Q)=>{const z=f(!1)[`answer${Q}`];z&&o.push({key:Q,name:z})});const g=T.OperateOptions.Psy.AnswerRandom?st(o):o;m(g)},[f,T]);const y=o=>{if(new RegExp("[~'!@#￥$%^&*()-+_=:]").test(o.target.value)){u.info("输入内容不能包含特殊字符");return}C(o.target.value.trim());const g=[...t];g[s]=o.target.value,w(g)},j=n.useCallback(o=>{if(s!==37)switch(o.keyCode){case 13:x();break;case 27:k();break;case 49:q[0]&&i({target:{value:q[0].key}});break;case 50:q[1]&&i({target:{value:q[1].key}});break;case 51:q[2]&&i({target:{value:q[2].key}});break;case 52:q[3]&&i({target:{value:q[3].key}});break;case 53:q[4]&&i({target:{value:q[4].key}});break;case 54:q[5]&&i({target:{value:q[5].key}});break;case 55:q[6]&&i({target:{value:q[6].key}});break;case 56:q[7]&&i({target:{value:q[7].key}});break;case 57:q[8]&&i({target:{value:q[8].key}});break;case 97:q[0]&&i({target:{value:q[0].key}});break;case 98:q[1]&&i({target:{value:q[1].key}});break;case 99:q[2]&&i({target:{value:q[2].key}});break;case 100:q[3]&&i({target:{value:q[3].key}});break;case 101:q[4]&&i({target:{value:q[4].key}});break;case 102:q[5]&&i({target:{value:q[5].key}});break;case 103:q[6]&&i({target:{value:q[6].key}});break;case 104:q[7]&&i({target:{value:q[7].key}});break;case 105:q[8]&&i({target:{value:q[8].key}});break}},[x,k,i,q,s]);n.useEffect(()=>(window.addEventListener("keydown",j),()=>{window.removeEventListener("keydown",j)}),[j]);const h=o=>""+o,l=()=>s===37?e.jsxs("div",{className:"groupselectStyle",children:[e.jsx("span",{children:"输入答案后,请按下一题:   "}),e.jsx(re,{className:"input",value:p,onChange:o=>y(o)})]}):e.jsx(U.Group,{onChange:i,value:t[s],children:e.jsx(X,{direction:"vertical",className:"itemlatout",children:q.length>0&&q.map((o,d)=>e.jsxs(U,{value:o.key,children:[d+1,". ",o.name]},o.key))})});return e.jsxs(tt,{theme:B,children:[e.jsxs("div",{className:"title",children:[e.jsx("span",{className:"common titleContent",children:a.nameChinese}),e.jsxs("span",{className:"common timer",children:[R?"累计答题时间: ":"",e.jsx(ie,{ref:N})]}),e.jsxs("span",{className:"common questionNUm",children:["第",s+1,"题 / 共",a.questionSum,"题"]})]}),e.jsxs("div",{className:"content",children:[e.jsx("div",{className:"progressBar",children:e.jsx(ee,{width:(s+1)/a.questionSum*100})}),e.jsxs("div",{className:"common topQuestion",children:[e.jsxs("p",{className:"describe",children:["问题描述: ",a.guide]}),f()&&e.jsx("img",{className:"img",src:h(f()),alt:""})]}),e.jsxs("div",{className:"common centerSelection",children:[e.jsxs("div",{className:"select",children:[e.jsxs("span",{style:{display:R?"inline-block":"none"},title:"快捷操作: 选项也可通过键盘点击选择选项, 数字对应选项, enter回车键对应下一题按钮,esc对应上一题按钮",children:[e.jsx(oe,{})," "]}),"请选择 :"]}),l()]}),e.jsxs("div",{className:"common nextQuest",children:[e.jsx(H,{className:"last",disabled:s===0,onClick:k,children:"上一题"}),(Y||s===37)&&e.jsx(H,{className:"next",onClick:x,children:"下一题"}),e.jsx(H,{loading:A,type:"primary",className:"next",onClick:L,children:t.length===a.questionSum?"提 交":"保存并退出"})]})]})]})});Se.displayName="Group";const at=W.div`
  height: 100%;
  font-size: 14px;
  .title {
    height: 36px;
    line-height: 36px;
    padding: 0 10px;
    margin-bottom: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    display: flex;
    justify-content: space-between;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};
    .questionNUm {
      font-size: 14px;
      text-align: right;
    }
  }
  .content {
    height: calc(100% - 46px);
    overflow: auto;
    padding-top: 15px;
    position: relative;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};
    .progressBar {
      width: 100%;
      height: 15px;
      position: absolute;
      left: 0;
      top: 0;
    }
    .common {
      min-height: 60px;
      text-align: center;
      border-bottom: 1px dotted ${r=>r.theme.colorBorder};
    }
    .topQuestion {
      padding-bottom: 15px;

      .describe {
        padding: 10px;
        font-size: 14px;
        margin-bottom: 15px;
        text-align: left;
      }
      .img {
        max-height: 360px;
        max-width: 90%;
      }
    }
    .centerSelection {
      letter-spacing: 2px;
      padding-top: 25px;
      position: relative;
      .select {
        position: absolute;
        text-align: left;
        margin-left: 15px;
        top: 5px;
        left: 0;
      }
      .itemlatout {
        text-align: left;
        margin-bottom: 15px;
      }
      .moreSelect {
        padding: 10px;
      }
      .input {
        margin-top: 10px;
        width: 30%;
        min-width: 300px;
      }
    }
    .nextQuest {
      padding-top: 15px;
      line-height: 40px;
      border: none;

      .next {
        letter-spacing: 2px;
        margin-left: 20px;
      }
      .last {
        letter-spacing: 2px;
      }
    }
  }
`,nt=(r=[])=>{for(let b=r.length-1;b>0;b--){const N=Math.floor(Math.random()*(b+1)),B=r[b];r[b]=r[N],r[N]=B}return r},pe=[{label:"配偶",value:"1"},{label:"其他家人",value:"2"},{label:"朋友",value:"3"},{label:"亲戚",value:"4"},{label:"同事",value:"5"},{label:"工作单位",value:"6"},{label:"党团工会等官方或半官方组织",value:"7"},{label:"宗教, 社会团体等非官方组织",value:"8"},{label:"其他 (请在文本框中输入)",value:"9"}],qe=n.memo(r=>{const b=te(),N=n.useRef(),{token:B}=_.useToken(),{message:u}=se.useApp(),{info:a}=r,{isPC:R,userInfo:I,project:T,changeCurrentQuestion:v,changeAnswerList:w,answerList:t,currentQuestion:s,changeAnswerTime:D}=K(V=>V),[Y,O]=n.useState(!1),[P,S]=n.useState([]),[A,c]=n.useState(!1),[q,m]=n.useState(!1),[p,C]=n.useState(!1),[i,k]=n.useState([]),[x,L]=n.useState(()=>pe.map(()=>0)),[f,y]=n.useState(()=>pe.map(()=>0)),[j,h]=n.useState(""),[l,o]=n.useState("");n.useEffect(()=>{(async()=>{try{const{code:G,data:J,msg:ce}=await ne("/api/Psyinfotablecontent/All",{TableCode:a.tableCode,pageIndex:1,pageSize:999});G===200?S(J.items):u.warning(ce)}catch(G){u.error(G)}})()},[a,u]),n.useEffect(()=>{s===9&&t[s]===2?(m(!1),O(!0)):(m(!0),L(pe.map(()=>0))),s===10&&t[s]===2?(C(!1),O(!0)):(C(!0),y(pe.map(()=>0)))},[s,t]);const d=n.useCallback(V=>{if(t[s]){const J=[...t];J[s]=V.target.value,w(J);return}let G=null;return new Promise(J=>{const ce=[...t];ce[s]=V.target.value,w(ce),s===9&&V.target.value===2?(m(!1),J(!1)):s===10&&V.target.value===2?(C(!1),J(!1)):(m(!0),C(!0),J(!0))}).then(J=>{!Y&&s+1<a.questionSum&&J&&(G=setTimeout(()=>{v(s+1)},500))}),()=>{clearTimeout(G)}},[t,s,Y,a,w,v]),g=n.useCallback(()=>{s>0&&(v(s-1),O(!0))},[s,v]),E=n.useCallback(()=>{if(!t[s]){u.info("请选择选项",2);return}s+1<a.questionSum?v(s+1):s+1===a.questionSum&&u.info("已经完成答题,请提交",2),s===t.length-1&&O(!1)},[a,s,t,v,u]),Q=n.useCallback(()=>{const V={},G={};V.taskID=a.id,V.TableChinese=a.nameChinese,V.org=I.pOrganizationName,G.pNum=I.userID,G.ptasknameid=a.ptasknameid,G.tableCode=a.tableCode,G.checkday=F().format("YYYY-MM-DD HH:mm:ss"),G.consumeTime=F.utc(N.current).format("HH:mm:ss"),G.answerString=t.join("|")+`@@${x.join("|")}|${j}@@${f.join("|")}|${l}`,t.length===a.questionSum?G.isFinish=1:t.length!==0?G.isFinish=2:G.isFinish=0,c(!0),ae("/api/PsyInfotesttasklist/Update",G,V).then(J=>{J.code===200?(u.success(J.msg,3),b("/layout/psyTasks"),w([]),v(0),D("00:00:00")):u.warning(J.msg),c(!1)})},[t,a,u,I,b,w,v,D,x,f,j,l]),z=n.useCallback((V=!0)=>P[s]?V?P[s].questionContent:P[s]:!1,[s,P]);n.useEffect(()=>{const V=[];z(!1)&&Object.keys(z(!1)).forEach((ce,he)=>{const fe=z(!1)[`answer${he}`];fe&&V.push({key:he,name:fe})});const J=T.OperateOptions.Psy.AnswerRandom?nt(V):V;k(J)},[z,T]);const $=n.useCallback(V=>{if(!(s===9||s===10))switch(V.keyCode){case 13:E();break;case 27:g();break;case 49:i[0]&&d({target:{value:i[0].key}});break;case 50:i[1]&&d({target:{value:i[1].key}});break;case 51:i[2]&&d({target:{value:i[2].key}});break;case 52:i[3]&&d({target:{value:i[3].key}});break;case 53:i[4]&&d({target:{value:i[4].key}});break;case 54:i[5]&&d({target:{value:i[5].key}});break;case 55:i[6]&&d({target:{value:i[6].key}});break;case 56:i[7]&&d({target:{value:i[7].key}});break;case 57:i[8]&&d({target:{value:i[8].key}});break;case 97:i[0]&&d({target:{value:i[0].key}});break;case 98:i[1]&&d({target:{value:i[1].key}});break;case 99:i[2]&&d({target:{value:i[2].key}});break;case 100:i[3]&&d({target:{value:i[3].key}});break;case 101:i[4]&&d({target:{value:i[4].key}});break;case 102:i[5]&&d({target:{value:i[5].key}});break;case 103:i[6]&&d({target:{value:i[6].key}});break;case 104:i[7]&&d({target:{value:i[7].key}});break;case 105:i[8]&&d({target:{value:i[8].key}});break}},[E,g,d,i,s]);n.useEffect(()=>(window.addEventListener("keydown",$),()=>{window.removeEventListener("keydown",$)}),[$]);const M=()=>e.jsx(U.Group,{onChange:d,value:t[s],children:e.jsx(X,{direction:"vertical",className:"itemlatout",children:i.length>0&&i.map((V,G)=>e.jsxs(U,{value:V.key,children:[G+1,". ",V.name]},V.key))})}),Z=V=>{const G=[...x];pe.forEach((J,ce)=>{V.includes(J.value)?G[ce]=1:G[ce]=0}),L(G)},le=V=>{const G=[...f];pe.forEach((J,ce)=>{V.includes(J.value)?G[ce]=1:G[ce]=0}),y(G)},ue=V=>{h(V.target.value)},de=V=>{o(V.target.value)};return e.jsxs(at,{theme:B,children:[e.jsxs("div",{className:"title",children:[e.jsx("span",{className:"common titleContent",children:a.nameChinese}),e.jsxs("span",{className:"common timer",children:[R?"累计答题时间: ":"",e.jsx(ie,{ref:N})]}),e.jsxs("span",{className:"common questionNUm",children:["第",s+1,"题 / 共",a.questionSum,"题"]})]}),e.jsxs("div",{className:"content",children:[e.jsx("div",{className:"progressBar",children:e.jsx(ee,{width:(s+1)/a.questionSum*100})}),e.jsxs("div",{className:"common topQuestion",children:[e.jsxs("p",{className:"describe",children:["问题描述: ",a.guide]}),z()]}),e.jsxs("div",{className:"common centerSelection",children:[e.jsxs("div",{className:"select",children:[e.jsxs("span",{style:{display:R?"inline-block":"none"},title:"快捷操作: 选项也可通过键盘点击选择选项, 数字对应选项, enter回车键对应下一题按钮,esc对应上一题按钮",children:[e.jsx(oe,{})," "]}),"请选择 :"]}),M(),s===9&&e.jsxs("div",{className:"moreSelect",children:[e.jsx("p",{children:"选下列来源时, 请勾选完下列来源后按下一题"}),e.jsx(me.Group,{options:pe,disabled:q,onChange:Z}),e.jsx("br",{}),e.jsx(re,{disabled:x[x.length-1]!==1,className:"input",value:j,onChange:ue})]}),s===10&&e.jsxs("div",{className:"moreSelect",children:[e.jsx("p",{children:"选下列来源时, 请勾选完下列来源后按下一题"}),e.jsx(me.Group,{options:pe,disabled:p,onChange:le}),e.jsx("br",{}),e.jsx(re,{disabled:f[f.length-1]!==1,className:"input",value:l,onChange:de})]})]}),e.jsxs("div",{className:"common nextQuest",children:[e.jsx(H,{className:"last",disabled:s===0,onClick:g,children:"上一题"}),Y&&e.jsx(H,{className:"next",onClick:E,children:"下一题"}),e.jsx(H,{loading:A,type:"primary",className:"next",onClick:Q,children:t.length===a.questionSum?"提 交":"保存并退出"})]})]})]})});qe.displayName="Issi";const it=W.div`
  height: 100%;
  font-size: 14px;
  .title {
    height: 36px;
    line-height: 36px;
    padding: 0 10px;
    margin-bottom: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    display: flex;
    justify-content: space-between;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};

    .questionNUm {
      font-size: 14px;
      text-align: right;
    }
  }

  .content {
    height: calc(100% - 46px);
    overflow: auto;
    padding-top: 15px;
    position: relative;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};


    .progressBar {
      width: 100%;
      height: 15px;
      position: absolute;
      left: 0;
      top: 0;
    }
    .common {
      min-height: 60px;
      text-align: center;
      border-bottom: 1px dotted ${r=>r.theme.colorBorder};
    }
    .topQuestion {
      padding-bottom: 15px;

      .describe {
        padding: 10px;
        font-size: 14px;
        margin-bottom: 15px;
        text-align: left;
      }
      .img {
        max-height: 360px;
        max-width: 90%;
      }
    }
    .centerSelection {
      letter-spacing: 2px;
      padding: 25px 0;
      position: relative;
      display: flex;
      flex-wrap: wrap;

      .fixedTitle {
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);

        width: 360px;
        height: 36px;
        line-height: 36px;
      }
      .leftSelect {
        width: 50%;
        margin: 0 auto;
        p {
          height: 36px;
          line-height: 36px;
        }
        .inp {
          width: 100%;
          .input {
            width: 30%;
          }
        }
      }
      .rightSelect {
        width: 50%;
        margin: 0 auto;
        p {
          height: 36px;
          line-height: 36px;
        }
      }
    }
    .nextQuest {
      padding-top: 15px;
      line-height: 40px;
      border: none;

      .next {
        letter-spacing: 2px;
        margin-left: 20px;
      }
      .last {
        letter-spacing: 2px;
      }
    }
  }

`,Te=n.memo(r=>{const b=te(),N=n.useRef(),{token:B}=_.useToken(),{message:u}=se.useApp(),{info:a}=r,{isPC:R,userInfo:I,changeCurrentQuestion:T,changeAnswerList:v,answerList:w,currentQuestion:t,changeAnswerTime:s}=K(h=>h),[D,Y]=n.useState([]),[O,P]=n.useState(!1),[S,A]=n.useState([]),[c,q]=n.useState(()=>{const h=[];return w.forEach((l,o)=>{o%2===0&&h.push(l)}),h}),[m,p]=n.useState(()=>{const h=[];return w.forEach((l,o)=>{o%2!==0&&h.push(l)}),h});n.useEffect(()=>{(async()=>{try{const{code:l,data:o,msg:d}=await ne("/api/Psyinfotablecontent/All",{TableCode:a.tableCode,pageIndex:1,pageSize:999});l===200?Y(o.items):u.warning(d)}catch(l){u.error(l)}})()},[a,u]);const C=n.useCallback(h=>{const l=[...c],o=[...m];l[t]=h.target.value,h.target.value===1&&(o[t]=1,p(o)),q(l)},[t,c,m]),i=n.useCallback(h=>{if(c[t]===1){u.warning("若 害怕/焦虑 选择 无 , 回避只能是 从未");return}if(!c[t]){u.warning("请先选择害怕/焦虑");return}if(m[t]){const o=[...m];o[t]=h.target.value,p(o);return}let l=null;return new Promise(o=>{const d=[...m];d[t]=h.target.value,p(d);const g=[];d.forEach((E,Q)=>{g.push(c[Q]),g.push(E)}),v(g),o()}).then(()=>{t+1<a.questionSum&&(l=setTimeout(()=>{T(t+1)},500))}),()=>{clearTimeout(l)}},[t,c,m,v,T,a,u]),k=n.useCallback(()=>{t>0&&T(t-1)},[t,T]),x=n.useCallback(()=>{if(!c[t]){u.info("请选择 害怕/焦虑 选择选项");return}if(!m[t]){u.info("请选择 回避 选项");return}t+1<a.questionSum?T(t+1):t+1===a.questionSum&&u.info("已经完成答题,请提交")},[T,t,a,c,m,u]),L=n.useCallback(()=>{const h={},l={};h.taskID=a.id,h.TableChinese=a.nameChinese,h.org=I.pOrganizationName,l.pNum=I.userID,l.ptasknameid=a.ptasknameid,l.tableCode=a.tableCode,l.checkday=F().format("YYYY-MM-DD HH:mm:ss"),l.consumeTime=F.utc(N.current).format("HH:mm:ss");const o=[];m.forEach((d,g)=>{o.push(c[g]),o.push(d)}),l.answerString=o.join("|"),m.length===a.questionSum?l.isFinish=1:0<m.length?l.isFinish=2:l.isFinish=0,P(!0),ae("/api/PsyInfotesttasklist/Update",l,h).then(d=>{d.code===200?(u.success(d.msg,3),b("/layout/psyTasks"),v([]),T(0),s("00:00:00")):u.warning(d.msg),P(!1)})},[a,u,I,b,v,T,s,m,c]),f=n.useCallback((h=!0)=>D[t]?h?D[t].questionContent:D[t]:!1,[t,D]);n.useEffect(()=>{const h=[];f(!1)&&Object.keys(f(!1)).forEach((l,o)=>{const d=f(!1)[`answer${o}`];d&&h.push({key:o<5?o:o-4,name:d})}),A(h)},[f]);const y=n.useCallback(h=>{switch(h.keyCode){case 13:x();break;case 27:k();break;case 49:S[0]&&C({target:{value:S[0].key}});break;case 50:S[1]&&C({target:{value:S[1].key}});break;case 51:S[2]&&C({target:{value:S[2].key}});break;case 52:S[3]&&C({target:{value:S[3].key}});break;case 53:S[4]&&i({target:{value:S[4].key}});break;case 54:S[5]&&i({target:{value:S[5].key}});break;case 55:S[6]&&i({target:{value:S[6].key}});break;case 56:S[7]&&i({target:{value:S[7].key}});break;case 97:S[0]&&C({target:{value:S[0].key}});break;case 98:S[1]&&C({target:{value:S[1].key}});break;case 99:S[2]&&C({target:{value:S[2].key}});break;case 100:S[3]&&C({target:{value:S[3].key}});break;case 101:S[4]&&i({target:{value:S[4].key}});break;case 102:S[5]&&i({target:{value:S[5].key}});break;case 103:S[6]&&i({target:{value:S[6].key}});break;case 104:S[7]&&i({target:{value:S[7].key}});break}},[x,k,C,S,i]);n.useEffect(()=>(window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y)}),[y]);const j=h=>{if(h===1)return e.jsx(U.Group,{onChange:C,value:c[t],children:e.jsx(X,{direction:"vertical",className:"itemlatout",children:S.length>0&&S.filter((l,o)=>o<4).map((l,o)=>e.jsxs(U,{value:l.key,children:[o+1,". ",l.name]},l.key))})});if(h===2)return e.jsx(U.Group,{onChange:i,value:m[t],children:e.jsx(X,{direction:"vertical",className:"itemlatout",children:S.length>0&&S.filter((l,o)=>o>=4).map((l,o)=>e.jsxs(U,{value:l.key,children:[o+5,". ",l.name]},l.key))})})};return e.jsxs(it,{theme:B,children:[e.jsxs("div",{className:"title",children:[e.jsx("span",{className:"common titleContent",children:a.nameChinese}),e.jsxs("span",{className:"common timer",children:[R?"累计答题时间: ":"",e.jsx(ie,{ref:N})]}),e.jsxs("span",{className:"common questionNUm",children:["第",t+1,"题 / 共",a.questionSum,"题"]})]}),e.jsxs("div",{className:"content",children:[e.jsx("div",{className:"progressBar",children:e.jsx(ee,{width:(t+1)/a.questionSum*100})}),e.jsxs("div",{className:"common topQuestion",children:[e.jsxs("p",{className:"describe",children:["问题描述: ",a.guide]}),f()]}),e.jsxs("div",{className:"common centerSelection",children:[e.jsx("p",{className:"fixedTitle",children:"请先选择'害怕/焦虑', 再选择回避"}),e.jsxs("div",{className:"leftSelect",children:[e.jsx("p",{children:"害怕/焦虑"}),j(1)]}),e.jsxs("div",{className:"rightSelect",children:[e.jsx("p",{children:"回避"}),j(2)]})]}),e.jsxs("div",{className:"common nextQuest",children:[e.jsx(H,{className:"last",disabled:t===0,onClick:k,children:"上一题"}),e.jsx(H,{className:"next",onClick:x,children:"下一题"}),e.jsx(H,{loading:O,type:"primary",className:"next",onClick:L,children:m.length===a.questionSum?"提 交":"保存并退出"})]})]})]})});Te.displayName="Isas";const rt=W.div`
  height: 100%;
  font-size: 14px;
  .title {
    height: 36px;
    line-height: 36px;
    padding: 0 10px;
    margin-bottom: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    display: flex;
    justify-content: space-between;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};

    .questionNUm {
      font-size: 14px;
      text-align: right;
    }
  }

  .content {
    height: calc(100% - 46px);
    overflow: auto;
    padding-top: 15px;
    position: relative;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};


    .progressBar {
      width: 100%;
      height: 15px;
      position: absolute;
      left: 0;
      top: 0;
    }
    .common {
      min-height: 60px;
      text-align: center;
      border-bottom: 1px dotted ${r=>r.theme.colorBorder};
    }
    .topQuestion {
      padding-bottom: 15px;

      .describe {
        padding: 10px;
        font-size: 14px;
        margin-bottom: 15px;
        text-align: left;
      }
      .img {
        max-height: 360px;
        max-width: 90%;
      }
    }
    .centerSelection {
      letter-spacing: 2px;
      padding-top: 25px;
      position: relative;
      .select {
        position: absolute;
        text-align: left;
        margin-left: 15px;
        top: 5px;
        left: 0;
      }
      .itemlatout {
        text-align: left;
        margin-bottom: 15px;
      }
      .input {
        width: 30%;
        min-width: 200px;
        margin-bottom: 16px;
      }
    }
    .nextQuest {
      padding-top: 15px;
      line-height: 40px;
      border: none;

      .next {
        letter-spacing: 2px;
        margin-left: 20px;
      }
      .last {
        letter-spacing: 2px;
      }
    }
  }

`,ot=(r=[])=>{for(let b=r.length-1;b>0;b--){const N=Math.floor(Math.random()*(b+1)),B=r[b];r[b]=r[N],r[N]=B}return r},Ee=n.memo(r=>{const b=te(),N=n.useRef(),{token:B}=_.useToken(),{message:u}=se.useApp(),{info:a}=r,{isPC:R,userInfo:I,project:T,changeCurrentQuestion:v,changeAnswerList:w,answerList:t,currentQuestion:s,changeAnswerTime:D}=K(g=>g),[Y,O]=n.useState(!1),[P,S]=n.useState([]),[A,c]=n.useState(!1),[q,m]=n.useState(""),[p,C]=n.useState(""),[i,k]=n.useState([]);n.useEffect(()=>{(async()=>{try{const{code:E,data:Q,msg:z}=await ne("/api/Psyinfotablecontent/All",{TableCode:a.tableCode,pageIndex:1,pageSize:999});E===200?S(Q.items):u.warning(z)}catch(E){u.error(E)}})()},[a,u]);const x=n.useCallback(g=>{if(t[s]){const Q=[...t];Q[s]=g.target.value,w(Q);return}let E=null;return new Promise(Q=>{const z=[...t];z[s]=g.target.value,w(z),s===23||s===24?(Q(!1),O(!0)):Q(!0)}).then(Q=>{Q&&!Y&&s+1<a.questionSum&&(E=setTimeout(()=>{v(s+1)},500))}),()=>{clearTimeout(E)}},[t,s,Y,a,w,v]),L=n.useCallback(()=>{s>0&&(v(s-1),O(!0))},[s,v]),f=n.useCallback(()=>{if(t[s]===void 0){u.info("请选择选项",2);return}s+1<a.questionSum?v(s+1):s+1===a.questionSum&&u.info("已经完成答题,请提交",2),s===t.length-1&&O(!1)},[a,s,t,v,u]),y=n.useCallback(()=>{const g={},E={};g.taskID=a.id,g.TableChinese=a.nameChinese,g.org=I.pOrganizationName,E.pNum=I.userID,E.ptasknameid=a.ptasknameid,E.tableCode=a.tableCode,E.checkday=F().format("YYYY-MM-DD HH:mm:ss"),E.consumeTime=F.utc(N.current).format("HH:mm:ss"),E.answerString=t.join("|")+`@@${q}@@${p}`,t.length===a.questionSum?E.isFinish=1:t.length!==0?E.isFinish=2:E.isFinish=0,c(!0),console.log(g),console.log(E),ae("/api/PsyInfotesttasklist/Update",E,g).then(Q=>{Q.code===200?(u.success(Q.msg,3),b("/layout/psyTasks"),w([]),v(0),D("00:00:00")):u.warning(Q.msg),c(!1)})},[t,a,u,I,b,w,v,D,q,p]),j=n.useCallback((g=!0)=>P[s]?g?P[s].questionContent:P[s]:!1,[s,P]);n.useEffect(()=>{const g=[];j(!1)&&Object.keys(j(!1)).forEach((z,$)=>{const M=j(!1)[`answer${$}`];M&&g.push({key:$,name:M})});const Q=T.OperateOptions.Psy.AnswerRandom?ot(g):g;k(Q)},[j,T]);const h=n.useCallback(g=>{if(!(s===23||s===24))switch(g.keyCode){case 13:f();break;case 27:L();break;case 49:i[0]&&x({target:{value:i[0].key}});break;case 50:i[1]&&x({target:{value:i[1].key}});break;case 51:i[2]&&x({target:{value:i[2].key}});break;case 52:i[3]&&x({target:{value:i[3].key}});break;case 53:i[4]&&x({target:{value:i[4].key}});break;case 54:i[5]&&x({target:{value:i[5].key}});break;case 55:i[6]&&x({target:{value:i[6].key}});break;case 56:i[7]&&x({target:{value:i[7].key}});break;case 57:i[8]&&x({target:{value:i[8].key}});break;case 97:i[0]&&x({target:{value:i[0].key}});break;case 98:i[1]&&x({target:{value:i[1].key}});break;case 99:i[2]&&x({target:{value:i[2].key}});break;case 100:i[3]&&x({target:{value:i[3].key}});break;case 101:i[4]&&x({target:{value:i[4].key}});break;case 102:i[5]&&x({target:{value:i[5].key}});break;case 103:i[6]&&x({target:{value:i[6].key}});break;case 104:i[7]&&x({target:{value:i[7].key}});break;case 105:i[8]&&x({target:{value:i[8].key}});break}},[f,L,x,i,s]);n.useEffect(()=>(window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h)}),[h]);const l=()=>e.jsx(U.Group,{onChange:x,value:t[s],children:e.jsx(X,{direction:"vertical",className:"itemlatout",children:i.length>0&&i.map((g,E)=>e.jsxs(U,{value:g.key,children:[E+1,". ",g.name]},g.key))})}),o=g=>{m(g.target.value?g.target.value:"")},d=g=>{C(g.target.value?g.target.value:"")};return e.jsxs(rt,{theme:B,children:[e.jsxs("div",{className:"title",children:[e.jsx("span",{className:"common titleContent",children:a.nameChinese}),e.jsxs("span",{className:"common timer",children:[R?"累计答题时间: ":"",e.jsx(ie,{ref:N})]}),e.jsxs("span",{className:"common questionNUm",children:["第",s+1,"题 / 共",a.questionSum,"题"]})]}),e.jsxs("div",{className:"content",children:[e.jsx("div",{className:"progressBar",children:e.jsx(ee,{width:(s+1)/a.questionSum*100})}),e.jsxs("div",{className:"common topQuestion",children:[e.jsxs("p",{className:"describe",children:["问题描述: ",a.guide]}),j()]}),e.jsxs("div",{className:"common centerSelection",children:[e.jsxs("div",{className:"select",children:[e.jsxs("span",{style:{display:R?"inline-block":"none"},title:"快捷操作: 选项也可通过键盘点击选择选项, 数字对应选项, enter回车键对应下一题按钮,esc对应上一题按钮",children:[e.jsx(oe,{})," "]}),"请选择 :"]}),l(),e.jsx("br",{}),s===23&&t[s]===1&&e.jsx(re,{className:"input",placeholder:"请输入数字",type:"number",allowClear:!0,value:q,onChange:o}),s===24&&t[s]===1&&e.jsx(re,{className:"input",placeholder:"请输入数字",type:"number",allowClear:!0,value:p,onChange:d})]}),e.jsxs("div",{className:"common nextQuest",children:[e.jsx(H,{className:"last",disabled:s===0,onClick:L,children:"上一题"}),Y&&e.jsx(H,{className:"next",onClick:f,children:"下一题"}),e.jsx(H,{loading:A,type:"primary",className:"next",onClick:y,children:t.length===a.questionSum?"提 交":"保存并退出"})]})]})]})});Ee.displayName="Mast";const lt=W.div`
  height: 100%;
  font-size: 14px;
  .title {
    height: 36px;
    line-height: 36px;
    padding: 0 10px;
    margin-bottom: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    display: flex;
    justify-content: space-between;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};

    .questionNUm {
      font-size: 14px;
      text-align: right;
    }
  }
  .content {
    height: calc(100% - 46px);
    overflow: auto;
    padding-top: 15px;
    position: relative;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};
    .progressBar {
      width: 100%;
      height: 15px;
      position: absolute;
      left: 0;
      top: 0;
    }
    .common {
      min-height: 60px;
      text-align: center;
      border-bottom: 1px dotted ${r=>r.theme.colorBorder};
    }
    .topQuestion {
      padding-bottom: 15px;
      .describe {
        padding: 10px;
        font-size: 14px;
        margin-bottom: 15px;
        text-align: left;
      }
      .img {
        max-height: 360px;
        max-width: 90%;
      }
    }
    .centerSelection {
      letter-spacing: 2px;
      padding-top: 25px;
      position: relative;
      .select {
        position: absolute;
        text-align: left;
        margin-left: 15px;
        top: 5px;
        left: 0;
      }
      .itemlatout {
        text-align: left;
        margin-bottom: 15px;
      }
      .input {
        width: 20%;
        min-width: 240px;
      }
      .specialSelect {
        margin-bottom: 20px;
      }
    }
    .nextQuest {
      padding-top: 15px;
      line-height: 40px;
      border: none;
      .next {
        letter-spacing: 2px;
        margin-left: 20px;
      }
      .last {
        letter-spacing: 2px;
      }
    }
  }
`,ct=(r=[])=>{for(let b=r.length-1;b>0;b--){const N=Math.floor(Math.random()*(b+1)),B=r[b];r[b]=r[N],r[N]=B}return r},Ae=n.memo(r=>{const b=te(),N=n.useRef(),{token:B}=_.useToken(),{message:u}=se.useApp(),{info:a}=r,{isPC:R,userInfo:I,project:T,changeCurrentQuestion:v,changeAnswerList:w,answerList:t,currentQuestion:s,changeAnswerTime:D}=K($=>$),[Y,O]=n.useState([]),[P,S]=n.useState(!1),[A,c]=n.useState([]),[q,m]=n.useState(""),[p,C]=n.useState(""),[i,k]=n.useState(""),[x,L]=n.useState("");n.useEffect(()=>{if(a.answerString&&a.answerString.includes("@@")){const M=a.answerString.split("@@")[1],Z=a.answerString.split("@@")[2],le=a.answerString.split("@@")[3],ue=a.answerString.split("@@")[4];m(M),C(Z),k(le),L(ue)}(async()=>{try{const{code:M,data:Z,msg:le}=await ne("/api/Psyinfotablecontent/All",{TableCode:a.tableCode,pageIndex:1,pageSize:999});M===200?O(Z.items):u.warning(le)}catch(M){u.warning(M)}})()},[a,u]);const f=n.useCallback($=>{if(s===13&&!x){u.warning("请输入描述再选择选项");return}if(t[s]){const Z=[...t];Z[s]=$.target.value,w(Z);return}let M=null;return new Promise(Z=>{const le=[...t];le[s]=$.target.value,w(le),Z()}).then(()=>{s+1<a.questionSum&&(M=setTimeout(()=>{v(s+1)},500))}),()=>{clearTimeout(M)}},[t,s,a,w,v,x,u]),y=n.useCallback(()=>{s>0&&v(s-1)},[s,v]),j=n.useCallback(()=>{if(s===0){if(q===""){u.warning("请输入上床时间",2);return}else if(!/^(?:(?:[0-2][0-3])|(?:[0-1][0-9])):[0-5][0-9]$/.test(q)){u.warning("请输入正确的时间格式, 如 22:30",3);return}}else if(s===2){if(p===""){u.warning("请输入起床时间",2);return}else if(!/^(?:(?:[0-2][0-3])|(?:[0-1][0-9])):[0-5][0-9]$/.test(p)){u.warning("请输入正确的时间格式, 如 22:30",3);return}}else if(s===3){if(i===""){u.warning("请输入实际睡眠时间",2);return}else if(!/^(([1-9])|(1\d)|(2[0-4]))$/.test(i)){u.warning("请输入实际睡眠时间, 如 9",3);return}}else if(s===13&&x===""){u.warning("请输入其他原因",2);return}if(t[s]===void 0){u.info("请选择选项",2);return}s+1<a.questionSum?v(s+1):s+1===a.questionSum&&u.info("已经完成答题,请提交",2)},[a,s,t,v,u,q,p,i,x]),h=n.useCallback(()=>{const $={},M={};$.taskID=a.id,$.TableChinese=a.nameChinese,$.org=I.pOrganizationName,M.pNum=I.userID,M.ptasknameid=a.ptasknameid,M.tableCode=a.tableCode,M.checkday=F().format("YYYY-MM-DD HH:mm:ss"),M.consumeTime=F.utc(N.current).format("HH:mm:ss"),M.answerString=t.join("|")+`@@${q}@@${p}@@${i}@@${x}`,t.length===a.questionSum?M.isFinish=1:t.length!==0?M.isFinish=2:M.isFinish=0,S(!0),ae("/api/PsyInfotesttasklist/Update",M,$).then(Z=>{Z.code===200?(u.success(Z.msg,3),b("/layout/psyTasks"),w([]),v(0),D("00:00:00")):u.warning(Z.msg),S(!1)})},[t,a,u,I,b,w,v,D,q,p,i,x]),l=n.useCallback(($=!0)=>Y[s]?$?Y[s].questionContent:Y[s]:!1,[s,Y]);n.useEffect(()=>{const $=[];l(!1)&&Object.keys(l(!1)).forEach((le,ue)=>{const de=l(!1)[`answer${ue}`];de&&$.push({key:ue,name:de})});const Z=T.OperateOptions.Psy.AnswerRandom?ct($):$;c(Z)},[l,T]);const o=n.useCallback($=>{if(!(s===0||s===2||s===3))switch($.keyCode){case 13:j();break;case 27:y();break;case 49:A[0]&&f({target:{value:A[0].key}});break;case 50:A[1]&&f({target:{value:A[1].key}});break;case 51:A[2]&&f({target:{value:A[2].key}});break;case 52:A[3]&&f({target:{value:A[3].key}});break;case 53:A[4]&&f({target:{value:A[4].key}});break;case 54:A[5]&&f({target:{value:A[5].key}});break;case 55:A[6]&&f({target:{value:A[6].key}});break;case 56:A[7]&&f({target:{value:A[7].key}});break;case 57:A[8]&&f({target:{value:A[8].key}});break;case 97:A[0]&&f({target:{value:A[0].key}});break;case 98:A[1]&&f({target:{value:A[1].key}});break;case 99:A[2]&&f({target:{value:A[2].key}});break;case 100:A[3]&&f({target:{value:A[3].key}});break;case 101:A[4]&&f({target:{value:A[4].key}});break;case 102:A[5]&&f({target:{value:A[5].key}});break;case 103:A[6]&&f({target:{value:A[6].key}});break;case 104:A[7]&&f({target:{value:A[7].key}});break;case 105:A[8]&&f({target:{value:A[8].key}});break}},[j,y,f,A,s]);n.useEffect(()=>(window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o)}),[o]);const d=()=>e.jsx(U.Group,{onChange:f,value:t[s],children:e.jsx(X,{direction:"vertical",className:"itemlatout",children:A.length>0&&A.map(($,M)=>e.jsxs(U,{value:$.key,children:[M+1,". ",$.name]},$.key))})}),g=$=>{m($.target.value?$.target.value:"");const M=[...t];M[s]=0,w(M)},E=$=>{C($.target.value?$.target.value:"");const M=[...t];M[s]=0,w(M)},Q=$=>{k($.target.value?$.target.value:"");const M=[...t];M[s]=0,w(M)},z=$=>{L($.target.value?$.target.value:"");const M=[...t];M[s]=0,w(M)};return e.jsxs(lt,{theme:B,children:[e.jsxs("div",{className:"title",children:[e.jsx("span",{className:"common titleContent",children:a.nameChinese}),e.jsxs("span",{className:"common timer",children:[R?"累计答题时间: ":"",e.jsx(ie,{ref:N})]}),e.jsxs("span",{className:"common questionNUm",children:["第",s+1,"题 / 共",a.questionSum,"题"]})]}),e.jsxs("div",{className:"content",children:[e.jsx("div",{className:"progressBar",children:e.jsx(ee,{width:(s+1)/a.questionSum*100})}),e.jsxs("div",{className:"common topQuestion",children:[e.jsxs("p",{className:"describe",children:["问题描述: ",a.guide]}),l()]}),e.jsxs("div",{className:"common centerSelection",children:[e.jsxs("div",{className:"select",children:[e.jsxs("span",{style:{display:R?"inline-block":"none"},title:"快捷操作: 选项也可通过键盘点击选择选项, 数字对应选项, enter回车键对应下一题按钮,esc对应上一题按钮",children:[e.jsx(oe,{})," "]}),"请选择 :"]}),s===13&&e.jsxs("div",{className:"specialSelect",children:[e.jsx("span",{children:"请先描述,再进行选择: "}),e.jsx(re,{className:"input",allowClear:!0,value:x,onChange:z})]}),d(),s===0&&e.jsxs("div",{className:"specialSelect",children:[e.jsx("span",{children:"上床时间, 例如22:00, 输入后请按下一题: "}),e.jsx(re,{className:"input",allowClear:!0,value:q,onChange:g})]}),s===2&&e.jsxs("div",{className:"specialSelect",children:[e.jsx("span",{children:"起床时间, 例如07:00, 输入后请按下一题: "}),e.jsx(re,{className:"input",allowClear:!0,value:p,onChange:E})]}),s===3&&e.jsxs("div",{className:"specialSelect",children:[e.jsx("span",{children:"实际睡眠时间, 例如8, 输入后请按下一题: "}),e.jsx(re,{className:"input",allowClear:!0,value:i,onChange:Q})]})]}),e.jsxs("div",{className:"common nextQuest",children:[e.jsx(H,{className:"last",disabled:s===0,onClick:y,children:"上一题"}),e.jsx(H,{className:"next",onClick:j,children:"下一题"}),e.jsx(H,{loading:P,type:"primary",className:"next",onClick:h,children:t[23]?"提 交":"保存并退出"})]})]})]})});Ae.displayName="Psqi";const ut=W.div`
  height: 100%;
  font-size: 14px;
  .title {
    height: 36px;
    line-height: 36px;
    padding: 0 10px;
    margin-bottom: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    display: flex;
    justify-content: space-between;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};

    .questionNUm {
      font-size: 14px;
      text-align: right;
    }
  }

  .content {
    height: calc(100% - 46px);
    overflow: auto;
    padding-top: 15px;
    position: relative;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};


    .progressBar {
      width: 100%;
      height: 15px;
      position: absolute;
      left: 0;
      top: 0;
    }
    .common {
      min-height: 60px;
      text-align: center;
      border-bottom: 1px dotted ${r=>r.theme.colorBorder};
    }
    .topQuestion {
      padding-bottom: 15px;

      .describe {
        padding: 10px;
        font-size: 14px;
        margin-bottom: 15px;
        text-align: left;
      }
      .img {
        max-height: 360px;
        max-width: 90%;
      }
    }
    .centerSelection {
      letter-spacing: 2px;
      padding-top: 25px;
      position: relative;
      .select {
        position: absolute;
        text-align: left;
        margin-left: 15px;
        top: 5px;
        left: 0;
      }
      .itemlatout {
        text-align: left;
        margin-bottom: 15px;
      }
      .moreSelect {
        padding: 10px;
      }
      .input {
        margin-top: 10px;
        width: 30%;
        min-width: 240px;
      }
    }
    .nextQuest {
      padding-top: 15px;
      line-height: 40px;
      border: none;

      .next {
        letter-spacing: 2px;
        margin-left: 20px;
      }
      .last {
        letter-spacing: 2px;
      }
    }
  }

`,pt=(r=[])=>{for(let b=r.length-1;b>0;b--){const N=Math.floor(Math.random()*(b+1)),B=r[b];r[b]=r[N],r[N]=B}return r},{TextArea:mt}=re,Qe=n.memo(r=>{const b=te(),N=n.useRef(),{token:B}=_.useToken(),{message:u}=se.useApp(),{info:a}=r,{isPC:R,userInfo:I,project:T,changeCurrentQuestion:v,changeAnswerList:w,answerList:t,currentQuestion:s,changeAnswerTime:D}=K(l=>l),[Y,O]=n.useState(!1),[P,S]=n.useState([]),[A,c]=n.useState(!1),[q,m]=n.useState(""),[p,C]=n.useState([]);n.useEffect(()=>{(async()=>{try{const{code:o,data:d,msg:g}=await ne("/api/Psyinfotablecontent/All",{TableCode:a.tableCode,pageIndex:1,pageSize:999});o===200?S(d.items):u.warning(g)}catch(o){u.error(o)}})()},[a,u]);const i=n.useCallback(l=>{if(t[s]){const d=[...t];d[s]=l.target.value,w(d);return}let o=null;return new Promise(d=>{const g=[...t];g[s]=l.target.value,w(g),d()}).then(()=>{!Y&&s+1<a.questionSum&&(o=setTimeout(()=>{v(s+1)},500))}),()=>{clearTimeout(o)}},[t,s,Y,a,w,v]),k=n.useCallback(()=>{s>0&&(v(s-1),O(!0))},[s,v]),x=n.useCallback(()=>{if(!t[s]){u.info("请选择选项",2);return}s+1<a.questionSum?v(s+1):s+1===a.questionSum&&u.info("已经完成答题,请提交",2),s===t.length-1&&O(!1)},[a,s,t,v,u]),L=n.useCallback(()=>{const l={},o={};l.taskID=a.id,l.TableChinese=a.nameChinese,l.org=I.pOrganizationName,o.pNum=I.userID,o.ptasknameid=a.ptasknameid,o.tableCode=a.tableCode,o.checkday=F().format("YYYY-MM-DD HH:mm:ss"),o.consumeTime=F.utc(N.current).format("HH:mm:ss"),o.answerString=t.join("|")+`@@${q}`,q?o.isFinish=1:t.length!==0?o.isFinish=2:o.isFinish=0,c(!0),ae("/api/PsyInfotesttasklist/Update",o,l).then(d=>{d.code===200?(u.success(d.msg,3),b("/layout/psyTasks"),w([]),v(0),D("00:00:00")):u.warning(d.msg),c(!1)})},[t,a,u,I,b,w,v,D,q]),f=n.useCallback((l=!0)=>P[s]?l?P[s].questionContent:P[s]:!1,[s,P]);n.useEffect(()=>{const l=[];f(!1)&&Object.keys(f(!1)).forEach((g,E)=>{const Q=f(!1)[`answer${E}`];Q&&l.push({key:E,name:Q})});const d=T.OperateOptions.Psy.AnswerRandom?pt(l):l;C(d)},[f,T]);const y=n.useCallback(l=>{if(s!==27)switch(l.keyCode){case 13:x();break;case 27:k();break;case 49:p[0]&&i({target:{value:p[0].key}});break;case 50:p[1]&&i({target:{value:p[1].key}});break;case 51:p[2]&&i({target:{value:p[2].key}});break;case 52:p[3]&&i({target:{value:p[3].key}});break;case 53:p[4]&&i({target:{value:p[4].key}});break;case 54:p[5]&&i({target:{value:p[5].key}});break;case 55:p[6]&&i({target:{value:p[6].key}});break;case 56:p[7]&&i({target:{value:p[7].key}});break;case 57:p[8]&&i({target:{value:p[8].key}});break;case 97:p[0]&&i({target:{value:p[0].key}});break;case 98:p[1]&&i({target:{value:p[1].key}});break;case 99:p[2]&&i({target:{value:p[2].key}});break;case 100:p[3]&&i({target:{value:p[3].key}});break;case 101:p[4]&&i({target:{value:p[4].key}});break;case 102:p[5]&&i({target:{value:p[5].key}});break;case 103:p[6]&&i({target:{value:p[6].key}});break;case 104:p[7]&&i({target:{value:p[7].key}});break;case 105:p[8]&&i({target:{value:p[8].key}});break}},[x,k,i,p,s]);n.useEffect(()=>(window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y)}),[y]);const j=()=>e.jsx(U.Group,{onChange:i,value:t[s],children:e.jsx(X,{direction:"vertical",className:"itemlatout",children:p.length>0&&p.map((l,o)=>e.jsxs(U,{value:l.key,children:[o+1,". ",l.name]},l.key))})}),h=l=>{m(l.target.value)};return e.jsxs(ut,{theme:B,children:[e.jsxs("div",{className:"title",children:[e.jsx("span",{className:"common titleContent",children:a.nameChinese}),e.jsxs("span",{className:"common timer",children:[R?"累计答题时间: ":"",e.jsx(ie,{ref:N})]}),e.jsxs("span",{className:"common questionNUm",children:["第",s+1,"题 / 共",a.questionSum,"题"]})]}),e.jsxs("div",{className:"content",children:[e.jsx("div",{className:"progressBar",children:e.jsx(ee,{width:(s+1)/a.questionSum*100})}),e.jsxs("div",{className:"common topQuestion",children:[e.jsxs("p",{className:"describe",children:["问题描述: ",a.guide]}),f()]}),e.jsxs("div",{className:"common centerSelection",children:[e.jsxs("div",{className:"select",children:[e.jsxs("span",{style:{display:R?"inline-block":"none"},title:"快捷操作: 选项也可通过键盘点击选择选项, 数字对应选项, enter回车键对应下一题按钮,esc对应上一题按钮",children:[e.jsx(oe,{})," "]}),"请选择 :"]}),j(),s===27&&e.jsxs("div",{className:"moreSelect",children:[e.jsx("span",{children:"其他 (请写明): "}),e.jsx("br",{}),e.jsx(mt,{className:"input",rows:4,value:q,onChange:h})]})]}),e.jsxs("div",{className:"common nextQuest",children:[e.jsx(H,{className:"last",disabled:s===0,onClick:k,children:"上一题"}),Y&&e.jsx(H,{className:"next",onClick:x,children:"下一题"}),e.jsx(H,{loading:A,type:"primary",className:"next",onClick:L,children:q?"提 交":"保存并退出"})]})]})]})});Qe.displayName="Shirritant";const dt=W.div`
  height: 100%;
  font-size: 14px;
  .title {
    height: 36px;
    line-height: 36px;
    padding: 0 10px;
    margin-bottom: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    display: flex;
    justify-content: space-between;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};

    .questionNUm {
      font-size: 14px;
      text-align: right;
    }
  }

  .content {
    height: calc(100% - 46px);
    overflow: auto;
    padding-top: 15px;
    position: relative;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};


    .progressBar {
      width: 100%;
      height: 15px;
      position: absolute;
      left: 0;
      top: 0;
    }
    .common {
      min-height: 60px;
      text-align: center;
      border-bottom: 1px dotted ${r=>r.theme.colorBorder};
    }
    .topQuestion {
      padding-bottom: 15px;

      .describe {
        padding: 10px;
        font-size: 14px;
        margin-bottom: 15px;
        text-align: left;
      }
      
      .inp {
        display: inline-block;
        .input {
          width: 240px;
        }
      }
    }
    .centerSelection {
      letter-spacing: 2px;
      padding-top: 25px;
      position: relative;
      display: flex;
      flex-wrap: wrap;
      .fixedTitle {
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 360px;
        height: 36px;
        line-height: 36px;
      }
      .leftSelect {
        width: 50%;
        padding-left: 10px;
        margin: 0 auto;
        p {
          height: 36px;
          line-height: 36px;
        }
      }
      .rightSelect {
        width: 50%;
        margin: 0 auto;
        p {
          height: 36px;
          line-height: 36px;
        }
      }
      .select {
        position: absolute;
        text-align: left;
        margin-left: 15px;
        top: 5px;
        left: 0;
      }
      .itemlatout {
        text-align: left;
        margin-bottom: 15px;
      }
    }
    .nextQuest {
      padding-top: 15px;
      line-height: 40px;
      border: none;

      .next {
        letter-spacing: 2px;
        margin-left: 20px;
      }
      .last {
        letter-spacing: 2px;
      }
    }
  }

`,$e=n.memo(r=>{const b=te(),N=n.useRef(),{token:B}=_.useToken(),{message:u}=se.useApp(),{info:a}=r,{isPC:R,userInfo:I,changeCurrentQuestion:T,changeAnswerList:v,answerList:w,currentQuestion:t,changeAnswerTime:s}=K(Q=>Q),[D,Y]=n.useState([]),[O,P]=n.useState(!1),[S,A]=n.useState(null),[c,q]=n.useState(null),[m,p]=n.useState([]),[C,i]=n.useState(()=>{const Q=[];return w.forEach((z,$)=>{$%2===0&&Q.push(z)}),Q}),[k,x]=n.useState(()=>{const Q=[];return w.forEach((z,$)=>{$%2!==0&&Q.push(z)}),Q});n.useEffect(()=>{if(a.answerString&&a.answerString.includes("@@")){const z=a.answerString.split("@@")[1],$=a.answerString.split("@@")[2];A(z),q($)}(async()=>{try{const{code:z,data:$,msg:M}=await ne("/api/Psyinfotablecontent/All",{TableCode:a.tableCode,pageIndex:1,pageSize:999});z===200?Y($.items):u.warning(M)}catch(z){u.error(z)}})()},[a,u]);const L=n.useCallback(Q=>{if(t===33&&!S){u.warning("请如输入问题");return}if(t===34&&!c){u.warning("请如输入问题");return}const z=[...C];z[t]=Q.target.value,i(z)},[t,C,S,u,c]),f=n.useCallback(Q=>{if(!C[t]){u.warning("请选择 严重问题");return}if(k[t]){const $=[...k];$[t]=Q.target.value,x($);return}let z=null;return new Promise($=>{const M=[...k];M[t]=Q.target.value,x(M);const Z=[];M.forEach((le,ue)=>{Z.push(C[ue]),Z.push(le)}),v(Z),$()}).then(()=>{t+1<a.questionSum&&(z=setTimeout(()=>{T(t+1)},500))}),()=>{clearTimeout(z)}},[t,C,k,v,T,a,u]),y=n.useCallback(()=>{t>0&&T(t-1)},[t,T]),j=n.useCallback(()=>{if(!C[t]){u.info("请选择 严重问题");return}if(!k[t]){u.info("请选择 处理 选项");return}t+1<a.questionSum?T(t+1):t+1===a.questionSum&&u.info("已经完成答题,请提交")},[T,t,a,C,k,u]),h=n.useCallback(()=>{const Q={},z={};Q.taskID=a.id,Q.TableChinese=a.nameChinese,Q.org=I.pOrganizationName,z.pNum=I.userID,z.ptasknameid=a.ptasknameid,z.tableCode=a.tableCode,z.checkday=F().format("YYYY-MM-DD HH:mm:ss"),z.consumeTime=F.utc(N.current).format("HH:mm:ss"),z.answerString=w.join("|")+`@@${S}@@${c}`,k.length===a.questionSum?z.isFinish=1:0<k.length?z.isFinish=2:z.isFinish=0,P(!0),ae("/api/PsyInfotesttasklist/Update",z,Q).then($=>{$.code===200?(u.success($.msg,3),b("/layout/psyTasks"),v([]),T(0),s("00:00:00")):u.warning($.msg),P(!1)})},[w,a,u,I,b,v,T,s,k,S,c]),l=n.useCallback((Q=!0)=>D[t]?Q?D[t].questionContent:D[t]:!1,[t,D]);n.useEffect(()=>{const Q=[];l(!1)&&Object.keys(l(!1)).forEach((z,$)=>{const M=l(!1)[`answer${$}`];M&&Q.push({key:$<6?$:$-5,name:M})}),p(Q)},[l]);const o=n.useCallback(Q=>{if(!(t===33||t===34))switch(Q.keyCode){case 13:j();break;case 27:y();break;case 49:m[0]&&L({target:{value:m[0].key}});break;case 50:m[1]&&L({target:{value:m[1].key}});break;case 51:m[2]&&L({target:{value:m[2].key}});break;case 52:m[3]&&L({target:{value:m[3].key}});break;case 53:m[4]&&L({target:{value:m[4].key}});break;case 54:m[5]&&f({target:{value:m[5].key}});break;case 55:m[6]&&f({target:{value:m[6].key}});break;case 56:m[7]&&f({target:{value:m[7].key}});break;case 57:m[8]&&f({target:{value:m[8].key}});break;case 97:m[0]&&L({target:{value:m[0].key}});break;case 98:m[1]&&L({target:{value:m[1].key}});break;case 99:m[2]&&L({target:{value:m[2].key}});break;case 100:m[3]&&L({target:{value:m[3].key}});break;case 101:m[4]&&L({target:{value:m[4].key}});break;case 102:m[5]&&f({target:{value:m[5].key}});break;case 103:m[6]&&f({target:{value:m[6].key}});break;case 104:m[7]&&f({target:{value:m[7].key}});break;case 105:m[8]&&f({target:{value:m[8].key}});break}},[j,y,L,m,f,t]);n.useEffect(()=>(window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o)}),[o]);const d=Q=>{if(Q===1)return e.jsx(U.Group,{onChange:L,value:C[t],children:e.jsx(X,{direction:"vertical",className:"itemlatout",children:m.length>0&&m.filter((z,$)=>$<5).map((z,$)=>e.jsxs(U,{value:z.key,children:[$+1,". ",z.name]},z.key))})});if(Q===2)return e.jsx(U.Group,{onChange:f,value:k[t],children:e.jsx(X,{direction:"vertical",className:"itemlatout",children:m.length>0&&m.filter((z,$)=>$>=5).map((z,$)=>e.jsxs(U,{value:z.key,children:[$+6,". ",z.name]},z.key))})})},g=Q=>{A(Q.target.value.trim())},E=Q=>{q(Q.target.value.trim())};return e.jsxs(dt,{theme:B,children:[e.jsxs("div",{className:"title",children:[e.jsx("span",{className:"common titleContent",children:a.nameChinese}),e.jsxs("span",{className:"common timer",children:[R?"累计答题时间: ":"",e.jsx(ie,{ref:N})]}),e.jsxs("span",{className:"common questionNUm",children:["第",t+1,"题 / 共",a.questionSum,"题"]})]}),e.jsxs("div",{className:"content",children:[e.jsx("div",{className:"progressBar",children:e.jsx(ee,{width:(t+1)/a.questionSum*100})}),e.jsxs("div",{className:"common topQuestion",children:[e.jsxs("p",{className:"describe",children:["问题描述: ",a.guide]}),l(),t===33&&e.jsxs("div",{className:"inp",children:["  请输入: ",e.jsx(re,{className:"input",value:S,allowClear:!0,onChange:g})]}),t===34&&e.jsxs("div",{className:"inp",children:["  请输入: ",e.jsx(re,{className:"input",value:c,allowClear:!0,onChange:E})]})]}),D.length>0?e.jsxs("div",{className:"common centerSelection",children:[e.jsx("p",{className:"fixedTitle",children:"请先选择严重问题, 再选择处理方式"}),e.jsxs("div",{className:"leftSelect",children:[e.jsx("p",{children:"严重问题"}),d(1)]}),e.jsxs("div",{className:"rightSelect",children:[e.jsx("p",{children:"处理"}),d(2)]})]}):e.jsx(Pe,{}),e.jsxs("div",{className:"common nextQuest",children:[e.jsx(H,{className:"last",disabled:t===0,onClick:y,children:"上一题"}),e.jsx(H,{className:"next",onClick:j,children:"下一题"}),e.jsx(H,{loading:O,type:"primary",className:"next",onClick:h,children:k.length===a.questionSum?"提 交":"保存并退出"})]})]})]})});$e.displayName="Tess";const ht=W.div`
  height: 100%;
  font-size: 14px;
  .title {
    height: 36px;
    line-height: 36px;
    padding: 0 10px;
    margin-bottom: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    display: flex;
    justify-content: space-between;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};

    .questionNUm {
      font-size: 14px;
      text-align: right;
    }
  }

  .content {
    height: calc(100% - 46px);
    overflow: auto;
    padding-top: 15px;
    position: relative;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};


    .progressBar {
      width: 100%;
      height: 15px;
      position: absolute;
      left: 0;
      top: 0;
    }
    .common {
      min-height: 60px;
      text-align: center;
      border-bottom: 1px dotted ${r=>r.theme.colorBorder};
    }
    .topQuestion {
      padding-bottom: 15px;

      .describe {
        padding: 10px;
        font-size: 14px;
        margin-bottom: 15px;
        text-align: left;
      }
      .img {
        max-height: 360px;
        max-width: 90%;
      }
    }
    .centerSelection {
      letter-spacing: 2px;
      padding-top: 25px;
      position: relative;
      .select {
        position: absolute;
        text-align: left;
        margin-left: 15px;
        top: 5px;
        left: 0;
      }
      .itemlatout {
        text-align: left;
        margin-bottom: 15px;
      }
      .groupselectStyle {
        width: 100%;
        height: 40px;
        text-align: center;
        .input {
          width: 30%;
        }
      }
    }
    .nextQuest {
      padding-top: 15px;
      line-height: 40px;
      border: none;

      .next {
        letter-spacing: 2px;
        margin-left: 20px;
      }
      .last {
        letter-spacing: 2px;
      }
    }
  }
`,ft=W.div`
  .question {
    line-height: 24px;
    span {
      color: ${r=>r.theme.colorPrimary};
    }
  }
  .upicontent {
    width: 100%;
    padding: 10px;
    margin-bottom: 20px;
    text-align: center;
    .input {
      width: 40%;
      min-width: 240px;
      margin: 0 auto;
    }
  }
`,gt=(r=[])=>{for(let b=r.length-1;b>0;b--){const N=Math.floor(Math.random()*(b+1)),B=r[b];r[b]=r[N],r[N]=B}return r},{TextArea:xt}=re,Le=n.memo(r=>{const b=te(),N=n.useRef(),{token:B}=_.useToken(),{message:u}=se.useApp(),{info:a}=r,{isPC:R,userInfo:I,project:T,changeCurrentQuestion:v,changeAnswerList:w,answerList:t,currentQuestion:s,changeAnswerTime:D}=K(g=>g),[Y,O]=n.useState(!1),[P,S]=n.useState([]),[A,c]=n.useState(!1),[q,m]=n.useState(""),[p,C]=n.useState(""),[i,k]=n.useState([]);n.useEffect(()=>{(async()=>{try{const{code:E,data:Q,msg:z}=await ne("/api/Psyinfotablecontent/All",{TableCode:a.tableCode,pageIndex:1,pageSize:999});E===200?S(Q.items):u.warning(z)}catch(E){u.error(E)}})()},[a,u]);const x=n.useCallback(g=>{if(t[s]){const Q=[...t];Q[s]=g.target.value,w(Q);return}let E=null;return new Promise(Q=>{const z=[...t];z[s]=g.target.value,w(z),Q()}).then(()=>{!Y&&s+1<=a.questionSum&&(E=setTimeout(()=>{v(s+1)},500))}),()=>{clearTimeout(E)}},[t,s,Y,a,w,v]),L=n.useCallback(()=>{s>0&&(v(s-1),O(!0))},[s,v]),f=n.useCallback(()=>{if(!t[s]){u.info("请选择选项");return}s+1<=a.questionSum&&v(s+1),s===t.length-1&&O(!1)},[a,s,t,v,u]),y=n.useCallback(()=>{const g={},E={};g.taskID=a.id,g.TableChinese=a.nameChinese,g.org=I.pOrganizationName,E.pNum=I.userID,E.ptasknameid=a.ptasknameid,E.tableCode=a.tableCode,E.checkday=F().format("YYYY-MM-DD HH:mm:ss"),E.consumeTime=F.utc(N.current).format("HH:mm:ss"),E.answerString=t.join("|")+`@@${p}@@${q}`,t.length===a.questionSum?E.isFinish=1:t.length!==0?E.isFinish=2:E.isFinish=0,c(!0),ae("/api/PsyInfotesttasklist/Update",E,g).then(Q=>{Q.code===200?(u.success(Q.msg,3),b("/layout/psyTasks"),w([]),v(0),D("00:00:00")):u.warning(Q.msg),c(!1)})},[t,a,u,I,b,w,v,D,q,p]),j=n.useCallback((g=!0)=>P[s]?g?P[s].questionContent:P[s]:!1,[s,P]);n.useEffect(()=>{const g=[];j(!1)&&Object.keys(j(!1)).forEach((z,$)=>{const M=j(!1)[`answer${$}`];M&&g.push({key:$,name:M})});const Q=T.OperateOptions.Psy.AnswerRandom?gt(g):g;k(Q)},[j,T]);const h=n.useCallback(g=>{if(s!==63)switch(g.keyCode){case 13:f();break;case 27:L();break;case 49:i[0]&&x({target:{value:i[0].key}});break;case 50:i[1]&&x({target:{value:i[1].key}});break;case 51:i[2]&&x({target:{value:i[2].key}});break;case 52:i[3]&&x({target:{value:i[3].key}});break;case 53:i[4]&&x({target:{value:i[4].key}});break;case 54:i[5]&&x({target:{value:i[5].key}});break;case 55:i[6]&&x({target:{value:i[6].key}});break;case 56:i[7]&&x({target:{value:i[7].key}});break;case 57:i[8]&&x({target:{value:i[8].key}});break;case 97:i[0]&&x({target:{value:i[0].key}});break;case 98:i[1]&&x({target:{value:i[1].key}});break;case 99:i[2]&&x({target:{value:i[2].key}});break;case 100:i[3]&&x({target:{value:i[3].key}});break;case 101:i[4]&&x({target:{value:i[4].key}});break;case 102:i[5]&&x({target:{value:i[5].key}});break;case 103:i[6]&&x({target:{value:i[6].key}});break;case 104:i[7]&&x({target:{value:i[7].key}});break;case 105:i[8]&&x({target:{value:i[8].key}});break}},[f,L,x,i,s]);n.useEffect(()=>(window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h)}),[h]);const l=()=>s===63?e.jsxs(ft,{theme:B,children:[e.jsx("p",{className:"question",children:"上述1-60个问题中有想咨询的问题,请写下问题的题号(如有多个,请用英文逗号分开)"}),e.jsx("div",{className:"upicontent",children:e.jsx(re,{className:"input",placeholder:"如 1, 2, 3 等等",value:p,onChange:o,allowClear:!0})}),e.jsxs("p",{className:"question",children:["你有什么想咨询的心理问题,请写在下面, ",e.jsx("span",{children:"如没有请不要填写."}),"(字数控制在125个以内)"]}),e.jsx("div",{className:"upicontent ",children:e.jsx(xt,{className:"input",rows:4,maxLength:125,showCount:!0,allowClear:!0,value:q,onChange:d})})]}):e.jsx(U.Group,{onChange:x,value:t[s],children:e.jsx(X,{direction:"vertical",className:"itemlatout",children:i.length>0&&i.map((g,E)=>e.jsxs(U,{value:g.key,children:[E+1,". ",g.name]},g.key))})}),o=g=>{C(g.target.value)},d=g=>{m(g.target.value)};return e.jsxs(ht,{theme:B,children:[e.jsxs("div",{className:"title",children:[e.jsx("span",{className:"common titleContent",children:a.nameChinese}),e.jsxs("span",{className:"common timer",children:[R?"累计答题时间: ":"",e.jsx(ie,{ref:N})]}),e.jsxs("span",{className:"common questionNUm",children:["第",s+1,"题 / 共",a.questionSum,"题"]})]}),e.jsxs("div",{className:"content",children:[e.jsx("div",{className:"progressBar",children:e.jsx(ee,{width:(s+1)/a.questionSum*100})}),e.jsxs("div",{className:"common topQuestion",children:[e.jsxs("p",{className:"describe",children:["问题描述: ",a.guide]}),j()]}),e.jsxs("div",{className:"common centerSelection",children:[e.jsxs("div",{className:"select",children:[e.jsxs("span",{style:{display:R?"inline-block":"none"},title:"快捷操作: 选项也可通过键盘点击选择选项, 数字对应选项, enter回车键对应下一题按钮,esc对应上一题按钮",children:[e.jsx(oe,{})," "]}),"请选择 :"]}),l()]}),e.jsxs("div",{className:"common nextQuest",children:[e.jsx(H,{className:"last",disabled:s===0,onClick:L,children:"上一题"}),Y&&e.jsx(H,{className:"next",onClick:f,children:"下一题"}),e.jsx(H,{loading:A,type:"primary",className:"next",onClick:y,children:t.length===a.questionSum?"提 交":"保存并退出"})]})]})]})});Le.displayName="Upi";const kt=W.div`
  height: 100%;
  font-size: 14px;
  .title {
    height: 36px;
    line-height: 36px;
    padding: 0 10px;
    margin-bottom: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    display: flex;
    justify-content: space-between;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};

    .questionNUm {
      font-size: 14px;
      text-align: right;
    }
  }

  .content {
    height: calc(100% - 46px);
    overflow: auto;
    padding-top: 15px;
    position: relative;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};


    .progressBar {
      width: 100%;
      height: 15px;
      position: absolute;
      left: 0;
      top: 0;
    }
    .common {
      min-height: 60px;
      text-align: center;
      border-bottom: 1px dotted ${r=>r.theme.colorBorder};
    }
    .topQuestion {
      padding-bottom: 15px;

      .describe {
        padding: 10px;
        font-size: 14px;
        margin-bottom: 15px;
        text-align: left;
      }
      .img {
        max-height: 360px;
        max-width: 90%;
      }
    }
    .centerSelection {
      letter-spacing: 2px;
      padding-top: 25px;
      position: relative;
      .select {
        position: absolute;
        text-align: left;
        margin-left: 15px;
        top: 5px;
        left: 0;
      }
      .itemlatout {
        text-align: left;
        margin-bottom: 15px;
      }
      .moreSelect {
        padding: 10px;
      }
      .input {
        margin-top: 10px;
        width: 30%;
        min-width: 240px;
      }
    }
    .nextQuest {
      padding-top: 15px;
      line-height: 40px;
      border: none;

      .next {
        letter-spacing: 2px;
        margin-left: 20px;
      }
      .last {
        letter-spacing: 2px;
      }
    }
  }

`,bt=(r=[])=>{for(let b=r.length-1;b>0;b--){const N=Math.floor(Math.random()*(b+1)),B=r[b];r[b]=r[N],r[N]=B}return r},Ie=n.memo(r=>{const b=te(),N=n.useRef(),{token:B}=_.useToken(),{message:u}=se.useApp(),{info:a}=r,{isPC:R,userInfo:I,project:T,changeCurrentQuestion:v,changeAnswerList:w,answerList:t,currentQuestion:s,changeAnswerTime:D}=K(l=>l),[Y,O]=n.useState(!1),[P,S]=n.useState([]),[A,c]=n.useState(!1),[q,m]=n.useState(null),[p,C]=n.useState([]);n.useEffect(()=>{(async()=>{try{const{code:o,data:d,msg:g}=await ne("/api/Psyinfotablecontent/All",{TableCode:a.tableCode,pageIndex:1,pageSize:999});o===200?S(d.items):u.warning(g)}catch(o){u.error(o)}})()},[a,u]);const i=n.useCallback(l=>{if(t[s]){const d=[...t];d[s]=l.target.value,w(d);return}let o=null;return new Promise(d=>{const g=[...t];g[s]=l.target.value,w(g),d()}).then(()=>{!Y&&s+1<a.questionSum&&(o=setTimeout(()=>{v(s+1)},500))}),()=>{clearTimeout(o)}},[t,s,Y,a,w,v]),k=n.useCallback(()=>{s>0&&(v(s-1),O(!0))},[s,v]),x=n.useCallback(()=>{if(!t[s]&&s!==102){u.info("请选择选项");return}s+1<a.questionSum?v(s+1):q&&u.info("已经完成答题,请提交"),s===t.length-1&&O(!1)},[a,s,t,v,u,q]),L=n.useCallback(()=>{const l={},o={};l.taskID=a.id,l.TableChinese=a.nameChinese,l.org=I.pOrganizationName,o.pNum=I.userID,o.ptasknameid=a.ptasknameid,o.tableCode=a.tableCode,o.checkday=F().format("YYYY-MM-DD HH:mm:ss"),o.consumeTime=F.utc(N.current).format("HH:mm:ss"),o.answerString=t.join("|")+`|0@@${q}`,q||q===0?o.isFinish=1:t.length!==0?o.isFinish=2:o.isFinish=0,c(!0),ae("/api/PsyInfotesttasklist/Update",o,l).then(d=>{d.code===200?(u.success(d.msg,3),b("/layout/psyTasks"),w([]),v(0),D("00:00:00")):u.warning(d.msg),c(!1)})},[t,a,u,I,b,w,v,D,q]),f=n.useCallback((l=!0)=>P[s]?l?P[s].questionContent:P[s]:!1,[s,P]);n.useEffect(()=>{const l=[];f(!1)&&Object.keys(f(!1)).forEach((g,E)=>{const Q=f(!1)[`answer${E}`];Q&&l.push({key:E,name:Q})});const d=T.OperateOptions.Psy.AnswerRandom?bt(l):l;C(d)},[f,T]);const y=n.useCallback(l=>{if(s!==102)switch(l.keyCode){case 13:x();break;case 27:k();break;case 49:p[0]&&i({target:{value:p[0].key}});break;case 50:p[1]&&i({target:{value:p[1].key}});break;case 51:p[2]&&i({target:{value:p[2].key}});break;case 52:p[3]&&i({target:{value:p[3].key}});break;case 53:p[4]&&i({target:{value:p[4].key}});break;case 54:p[5]&&i({target:{value:p[5].key}});break;case 55:p[6]&&i({target:{value:p[6].key}});break;case 56:p[7]&&i({target:{value:p[7].key}});break;case 57:p[8]&&i({target:{value:p[8].key}});break;case 97:p[0]&&i({target:{value:p[0].key}});break;case 98:p[1]&&i({target:{value:p[1].key}});break;case 99:p[2]&&i({target:{value:p[2].key}});break;case 100:p[3]&&i({target:{value:p[3].key}});break;case 101:p[4]&&i({target:{value:p[4].key}});break;case 102:p[5]&&i({target:{value:p[5].key}});break;case 103:p[6]&&i({target:{value:p[6].key}});break;case 104:p[7]&&i({target:{value:p[7].key}});break;case 105:p[8]&&i({target:{value:p[8].key}});break}},[x,k,i,p,s]);n.useEffect(()=>(window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y)}),[y]);const j=()=>e.jsx(U.Group,{onChange:i,value:t[s],children:e.jsx(X,{direction:"vertical",className:"itemlatout",children:p.length>0&&p.map((l,o)=>e.jsxs(U,{value:l.key,children:[o+1,". ",l.name]},l.key))})}),h=l=>{l.target.value<0?m(0):l.target.value>100?m(100):m(l.target.value)};return e.jsxs(kt,{theme:B,children:[e.jsxs("div",{className:"title",children:[e.jsx("span",{className:"common titleContent",children:a.nameChinese}),e.jsxs("span",{className:"common timer",children:[R?"累计答题时间: ":"",e.jsx(ie,{ref:N})]}),e.jsxs("span",{className:"common questionNUm",children:["第",s+1,"题 / 共",a.questionSum,"题"]})]}),e.jsxs("div",{className:"content",children:[e.jsx("div",{className:"progressBar",children:e.jsx(ee,{width:(s+1)/a.questionSum*100})}),e.jsxs("div",{className:"common topQuestion",children:[e.jsxs("p",{className:"describe",children:["问题描述: ",a.guide]}),f()]}),e.jsxs("div",{className:"common centerSelection",children:[e.jsxs("div",{className:"select",children:[e.jsxs("span",{style:{display:R?"inline-block":"none"},title:"快捷操作: 选项也可通过键盘点击选择选项, 数字对应选项, enter回车键对应下一题按钮,esc对应上一题按钮",children:[e.jsx(oe,{})," "]}),"请选择 :"]}),j(),s===102&&e.jsxs("div",{className:"moreSelect",children:[e.jsx("span",{children:"输入分数: "}),e.jsx(re,{className:"input",type:"number",allowClear:!0,value:q,onChange:h})]})]}),e.jsxs("div",{className:"common nextQuest",children:[e.jsx(H,{className:"last",disabled:s===0,onClick:k,children:"上一题"}),Y&&e.jsx(H,{className:"next",onClick:x,children:"下一题"}),e.jsx(H,{loading:A,type:"primary",className:"next",onClick:L,children:q||q===0?"提 交":"保存并退出"})]})]})]})});Ie.displayName="Whoqol";const vt=W.div`
  height: 100%;
  font-size: 14px;
  .title {
    height: 36px;
    line-height: 36px;
    padding: 0 10px;
    margin-bottom: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    display: flex;
    justify-content: space-between;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};

    .questionNUm {
      font-size: 14px;
      text-align: right;
    }
  }

  .content {
    height: calc(100% - 46px);
    overflow: auto;
    padding-top: 15px;
    position: relative;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};


    .progressBar {
      width: 100%;
      height: 15px;
      position: absolute;
      left: 0;
      top: 0;
    }
    .common {
      min-height: 60px;
      text-align: center;
      border-bottom: 1px dotted ${r=>r.theme.colorBorder};
    }
    .topQuestion {
      padding-bottom: 15px;

      .describe {
        padding: 10px;
        font-size: 14px;
        margin-bottom: 15px;
        text-align: left;
      }
      .img {
        max-height: 360px;
        max-width: 90%;
      }
    }
    .centerSelection {
      letter-spacing: 2px;
      padding-top: 25px;
      position: relative;
      display: flex;
      .select {
        position: absolute;
        text-align: left;
        margin-left: 15px;
        top: 5px;
        left: 0;
      }
      .itemlatout {
        text-align: left;
        margin-bottom: 15px;
      }
      .fixedTitle {
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);

        width: 300px;
        height: 36px;
        line-height: 36px;
      }
      .leftSelect {
        width: 50%;
        p {
          height: 36px;
          line-height: 36px;
        }
        .inp {
          width: 100%;
          .input {
            width: 30%;
          }
        }
      }
      .rightSelect {
        width: 50%;
        p {
          height: 36px;
          line-height: 36px;
        }
      }
    }
    .nextQuest {
      padding-top: 15px;
      line-height: 40px;
      border: none;

      .next {
        letter-spacing: 2px;
        margin-left: 20px;
      }
      .last {
        letter-spacing: 2px;
      }
    }
  }
`,Be=n.memo(r=>{const b=te(),N=n.useRef(),{token:B}=_.useToken(),{message:u}=se.useApp(),{info:a}=r,{isPC:R,userInfo:I,changeCurrentQuestion:T,changeAnswerList:v,answerList:w,currentQuestion:t,changeAnswerTime:s}=K(h=>h),[D,Y]=n.useState([]),[O,P]=n.useState(!1),[S,A]=n.useState([]),[c,q]=n.useState(()=>{const h=[];return w.forEach((l,o)=>{o%2===0&&h.push(l)}),h}),[m,p]=n.useState(()=>{const h=[];return w.forEach((l,o)=>{o%2!==0&&h.push(l)}),h});n.useEffect(()=>{(async()=>{try{const{code:l,data:o,msg:d}=await ne("/api/Psyinfotablecontent/All",{TableCode:a.tableCode,pageIndex:1,pageSize:999});l===200?Y(o.items):u.warning(d)}catch(l){u.error(l)}})()},[a,u]);const C=n.useCallback(h=>{const l=[...m];if(!c[t]){u.warning("请先选择 倾向性");return}l[t]=h.target.value,p(l);const o=[];l.forEach((d,g)=>{o.push(c[g]),o.push(d)}),v(o)},[t,c,m,v,u]),i=n.useCallback(()=>{t>0&&T(t-1)},[t,T]),k=n.useCallback(()=>{if(!c[t]){u.warning("请选择 倾向性",2);return}if(![0,1,2,3].includes(m[t])){u.warning("请选择 有效性 选项",2);return}t+1<a.questionSum?T(t+1):t+1===a.questionSum&&u.info("已经完成答题,请提交")},[T,t,a,c,m,u]),x=n.useCallback(h=>{const l=[...c],o=[...m];l[t]=h.target.value,q(l),t===35||t===41?h.target.value===1?(o[t]=0,p(o)):(o[t]=4,p(o)):t===18||t===38?(o[t]=4,p(o)):t===61?h.target.value===2?(o[t]=0,p(o)):(o[t]=null,p(o)):h.target.value===2?(o[t]=0,p(o)):(o[t]=4,p(o))},[t,c,m]);n.useEffect(()=>{const h=[];m.forEach((l,o)=>{h.push(c[o]),h.push(l)}),v(h)},[m,c,v]);const L=n.useCallback(()=>{const h={},l={};h.taskID=a.id,h.TableChinese=a.nameChinese,h.org=I.pOrganizationName,l.pNum=I.userID,l.ptasknameid=a.ptasknameid,l.tableCode=a.tableCode,l.checkday=F().format("YYYY-MM-DD HH:mm:ss"),l.consumeTime=F.utc(N.current).format("HH:mm:ss"),l.answerString=w.join("|"),m.length===a.questionSum?l.isFinish=1:0<m.length?l.isFinish=2:l.isFinish=0,P(!0),ae("/api/PsyInfotesttasklist/Update",l,h).then(o=>{o.code===200?(u.success(o.msg,3),b("/layout/psyTasks"),v([]),T(0),s("00:00:00")):u.warning(o.msg),P(!1)})},[w,a,u,I,b,v,T,s,m]),f=n.useCallback((h=!0)=>D[t]?h?D[t].questionContent:D[t]:!1,[t,D]);n.useEffect(()=>{const h=[];f(!1)&&Object.keys(f(!1)).forEach((l,o)=>{const d=f(!1)[`answer${o}`];d&&h.push({key:o<3?o:o-2,name:d})}),A(h)},[f]);const y=n.useCallback(h=>{let l=!1;switch(t===35||t===41?c[t]===1&&(l=!0):t===18||t===38?l=!1:c[t]===2?l=!0:l=!1,h.keyCode){case 13:k();break;case 27:i();break;case 49:S[0]&&x({target:{value:S[0].key}});break;case 50:S[1]&&x({target:{value:S[1].key}});break;case 51:S[2]&&!l&&C({target:{value:S[2].key}});break;case 52:S[3]&&!l&&C({target:{value:S[3].key}});break;case 53:S[4]&&!l&&C({target:{value:S[4].key}});break;case 97:S[0]&&x({target:{value:S[0].key}});break;case 98:S[1]&&x({target:{value:S[1].key}});break;case 99:S[2]&&!l&&C({target:{value:S[2].key}});break;case 100:S[3]&&!l&&C({target:{value:S[3].key}});break;case 101:S[4]&&!l&&C({target:{value:S[4].key}});break}},[k,i,x,S,C,t,c]);n.useEffect(()=>(window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y)}),[y]);const j=h=>{if(!(!S&&S.length===0)){if(h===1)return e.jsx(U.Group,{onChange:x,value:c[t],children:e.jsx(X,{direction:"vertical",className:"itemlatout",children:S.filter((l,o)=>o<2).map((l,o)=>e.jsxs(U,{value:l.key,children:[o+1,". ",l.name]},l.key))})});if(h===2)return e.jsx(U.Group,{onChange:C,value:m[t],disabled:m[t]===0,children:e.jsx(X,{direction:"vertical",className:"itemlatout",children:S.filter((l,o)=>o>=2).map((l,o)=>e.jsxs(U,{value:l.key,children:[o+3,". ",l.name]},l.key))})})}};return e.jsxs(vt,{theme:B,children:[e.jsxs("div",{className:"title",children:[e.jsx("span",{className:"common titleContent",children:a.nameChinese}),e.jsxs("span",{className:"common timer",children:[R?"累计答题时间: ":"",e.jsx(ie,{ref:N})]}),e.jsxs("span",{className:"common questionNUm",children:["第",t+1,"题 / 共",a.questionSum,"题"]})]}),e.jsxs("div",{className:"content",children:[e.jsx("div",{className:"progressBar",children:e.jsx(ee,{width:(t+1)/a.questionSum*100})}),e.jsxs("div",{className:"common topQuestion",children:[e.jsxs("p",{className:"describe",children:["问题描述: ",a.guide]}),f()]}),e.jsxs("div",{className:"common centerSelection",children:[e.jsx("p",{className:"fixedTitle",children:"请先选择'倾向性', 再选择'有效性'"}),e.jsxs("div",{className:"leftSelect",children:[e.jsx("p",{children:"倾向性"}),j(1)]}),e.jsxs("div",{className:"rightSelect",children:[e.jsx("p",{children:"有效性"}),j(2)]})]}),e.jsxs("div",{className:"common nextQuest",children:[e.jsx(H,{className:"last",disabled:t===0,onClick:i,children:"上一题"}),e.jsx(H,{className:"next",onClick:k,children:"下一题"}),e.jsx(H,{loading:O,type:"primary",className:"next",onClick:L,children:m.length===a.questionSum?"提 交":"保存并退出"})]})]})]})});Be.displayName="Yffs";const yt=W.div`
  height: 100%;
  font-size: 14px;
  .title {
    height: 36px;
    line-height: 36px;
    padding: 0 10px;
    margin-bottom: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    display: flex;
    justify-content: space-between;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};

    .questionNUm {
      font-size: 14px;
      text-align: right;
    }
  }

  .content {
    height: calc(100% - 46px);
    overflow: auto;
    padding-top: 15px;
    position: relative;
    border-radius: 6px;
    background-color: ${r=>r.theme.colorBgContainer};


    .progressBar {
      width: 100%;
      height: 15px;
      position: absolute;
      left: 0;
      top: 0;
    }
    .common {
      min-height: 60px;
      text-align: center;
      border-bottom: 1px dotted ${r=>r.theme.colorBorder};
    }
    .topQuestion {
      padding-bottom: 15px;

      .describe {
        padding: 10px;
        font-size: 14px;
        margin-bottom: 15px;
        text-align: left;
      }
      .img {
        max-height: 360px;
        max-width: 90%;
      }
    }
    .centerSelection {
      letter-spacing: 2px;
      padding-top: 25px;
      position: relative;
      .select {
        position: absolute;
        text-align: left;
        margin-left: 15px;
        top: 5px;
        left: 0;
      }
      .itemlatout {
        text-align: left;
        margin-bottom: 15px;
      }
      .checkboxstyle {
        width: 95%;
        margin: 10px auto;
        text-align: left;
      }
    }
    .nextQuest {
      padding-top: 15px;
      line-height: 40px;
      border: none;

      .next {
        letter-spacing: 2px;
        margin-left: 20px;
      }
      .last {
        letter-spacing: 2px;
      }
    }
  }
`,De=n.memo(r=>{const b=te(),N=n.useRef(),{token:B}=_.useToken(),{message:u}=se.useApp(),{info:a}=r,{isPC:R,userInfo:I,changeCurrentQuestion:T,changeAnswerList:v,answerList:w,currentQuestion:t,changeAnswerTime:s}=K(i=>i),[D,Y]=n.useState([]),[O,P]=n.useState(!1);n.useEffect(()=>{(async()=>{let k=a.answerString?a.answerString.split("|"):[];try{const{code:x,data:L,msg:f}=await ne("/api/Psyinfotablecontent/All",{TableCode:a.tableCode,pageIndex:1,pageSize:999});if(x===200){let y=[];for(let l=0;l<L.items.length;)y.push(L.items.slice(l,l+=5));Y(y);let j=0;if(k.length){let l=[];for(let o=0;o<k.length;)l.push(k.slice(o,o+=5));l.forEach((o,d)=>{o.forEach(g=>{g>0&&(j=d+1)})}),T(j)}else T(0);L.items.forEach((l,o)=>{Number(k[o])===1?k[o]=l.questionCode:k[o]=0});let h=[];for(let l=0;l<k.length;)h.push(k.slice(l,l+=5));v(h)}else u.warning(f)}catch(x){u.error(x)}})()},[a,u,v,T]);const S=n.useCallback(()=>{t>0&&T(t-1)},[t,T]),A=n.useCallback(()=>{const i=w[t];let k=i?i.find(x=>x>0):!1;if(i){if(!k){u.warning("至少选择一个选项",2);return}}else{u.warning("至少选择一个选项",2);return}t+1<a.questionSum?T(t+1):t+1===a.questionSum&&u.info("已经完成答题,请提交",2)},[a,t,w,T,u]),c=n.useCallback(()=>{const i=w[a.questionSum-1]?w[a.questionSum-1]:null;if(!i)return!1;let k=!1;return i.forEach(x=>{x!==0&&(k=!0)}),k},[w,a]),q=n.useCallback(()=>{const i={},k={};i.taskID=a.id,i.TableChinese=a.nameChinese,i.org=I.pOrganizationName,k.pNum=I.userID,k.ptasknameid=a.ptasknameid,k.tableCode=a.tableCode,k.checkday=F().format("YYYY-MM-DD HH:mm:ss"),k.consumeTime=F.utc(N.current).format("HH:mm:ss");let x=[];w.forEach(L=>{x=[...x,...L]}),x=x.map(L=>L?1:0),k.answerString=x.join("|"),c()?k.isFinish=1:w.length!==0?k.isFinish=2:k.isFinish=0,P(!0),ae("/api/PsyInfotesttasklist/Update",k,i).then(L=>{L.code===200?(u.success(L.msg,3),b("/layout/psyTasks"),v([]),T(0),s("00:00:00")):u.warning(L.msg),P(!1)})},[w,a,u,I,b,v,T,s,c]),m=n.useCallback((i=!0)=>D[t]?i?D[t].questionContent:D[t]:!1,[t,D]),p=i=>{const k=[0,0,0,0,0],x=[...w];D[t]&&D[t].forEach((L,f)=>{i.includes(L.questionCode)&&(k[f]=L.questionCode)}),x[t]=k,v(x)},C=()=>e.jsx(me.Group,{className:"checkboxstyle",value:w[t],onChange:p,children:e.jsx(ge,{children:D[t]&&D[t].map(i=>e.jsx(xe,{span:24,children:e.jsx(me,{value:i.questionCode,children:i.questionContent})},i.questionCode))})});return e.jsxs(yt,{theme:B,children:[e.jsxs("div",{className:"title",children:[e.jsx("span",{className:"common titleContent",children:a.nameChinese}),e.jsxs("span",{className:"common timer",children:[R?"累计答题时间: ":"",e.jsx(ie,{ref:N})]}),e.jsxs("span",{className:"common questionNUm",children:["第",t+1,"题 / 共",a.questionSum,"题"]})]}),e.jsxs("div",{className:"content",children:[e.jsx("div",{className:"progressBar",children:e.jsx(ee,{width:(t+1)/a.questionSum*100})}),e.jsxs("div",{className:"common topQuestion",children:[e.jsxs("p",{className:"describe",children:["问题描述: ",a.guide]}),m()]}),e.jsxs("div",{className:"common centerSelection",children:[e.jsxs("div",{className:"select",children:[e.jsxs("span",{style:{display:R?"inline-block":"none"},title:"快捷操作: 选项也可通过键盘点击选择选项, 数字对应选项, enter回车键对应下一题按钮,esc对应上一题按钮",children:[e.jsx(oe,{})," "]}),"请选择 :"]}),C()]}),e.jsxs("div",{className:"common nextQuest",children:[e.jsx(H,{className:"last",disabled:t===0,onClick:S,children:"上一题"}),e.jsx(H,{className:"next",onClick:A,children:"下一题"}),e.jsx(H,{loading:O,type:"primary",className:"next",onClick:q,children:c()?"提 交":"保存并退出"})]})]})]})});De.displayName="Zyqx";const wt=n.memo(()=>{const{state:r}=Oe(),b=()=>{switch(r.tableCode){case"Adhd":return e.jsx(be,{info:r});case"Cbcl2to3":return e.jsx(ve,{info:r});case"Cgi":return e.jsx(ye,{info:r});case"Cmi":return e.jsx(we,{info:r});case"Embu":return e.jsx(Ce,{info:r});case"Epps":return e.jsx(Ne,{info:r});case"Group":return e.jsx(Se,{info:r});case"Issi":return e.jsx(qe,{info:r});case"Lsas":return e.jsx(Te,{info:r});case"Mast":return e.jsx(Ee,{info:r});case"Psqi":return e.jsx(Ae,{info:r});case"Shirritant":return e.jsx(Qe,{info:r});case"Tess":return e.jsx($e,{info:r});case"Upi":return e.jsx(Le,{info:r});case"Whoqol":return e.jsx(Ie,{info:r});case"Yffs":return e.jsx(Be,{info:r});case"Zyqx":return e.jsx(De,{info:r});default:return e.jsx(je,{info:r})}};return e.jsx(ze,{children:b()})});wt.displayName="AnswerPage";export{wt as default};
