import{d as j,r,A as Ve,t as We,k as Ze,u as _e,j as e,R as ee,a as d,o as Xe,B as u,h as w,D as se,I as R,S as es,b as te,ae as ss,g,v as D,H as ts}from"./index-BtzNP73w.js";import{O as as}from"./index-Bulw9wNg.js";import{F as T}from"./Table-BCm752cP.js";import{R as P}from"./MoreOutlined-DStrJbIi.js";import{R as ns}from"./PlusCircleOutlined-Dx3NdtuO.js";import{P as is}from"./index-CW4Fb3Fw.js";import{R as ls}from"./DeleteOutlined-ClifBhia.js";import"./index-B6m4IotF.js";import"./iconUtil-D_WnT0lW.js";const rs=j.div`
  height: 100%;
  .topInfo {
    height: 90px;
    display: flex;
    padding: 16px;
    margin-bottom: 10px;
    border-radius: 8px;
    background-color: ${n=>n.theme.colorBgContainer};

    .info {
      flex: 1;
      font-size: 14px;
      p {
        margin-bottom: 10px;
        span {
          margin-right: 10px;
        }
        span.psys {
          cursor: pointer;
          color: ${n=>n.theme.colorPrimary};
        }
      }
      .progress {
        display: flex;
        .line {
          padding: 0 50px 0 10px;
          flex: 1;
        }
      }
    }
  }
  .bot {
    height: calc(100% - 120px);
    
    .btns {
      height: 60px;
      line-height: 60px;
      padding-left: 30px;
      margin-bottom: 10px;
      border-radius: 8px;
      background-color: ${n=>n.theme.colorBgContainer};
      display: flex;
      .item {
        margin-right: 15px;
      }
    }
    .tableList {
      height: calc(100% - 70px);
      padding: 16px;
      background-color: ${n=>n.theme.colorBgContainer};
      overflow: hidden;
    }
  }
`,os=j.div`
  height: 600px;
  .box {
    height: 100%;
    padding: 16px;
    background-color: ${n=>n.theme.colorBgContainer};
    .tableScroll {
      height: 100%;
      overflow: auto;
    }
  }
`,ae=j.div`
  height: 600px;
  .box {
    height: 100%;
    display: flex;
    flex-direction: column;
    .topsearch {
      height: 60px;
      padding: 16px;
      display: flex;
      .btn {
        flex: 1;
        text-align: right;
        .searchbtn {
          margin-right: 16px;
        }
      }
      .nameinput {
        width: 300px;
        > span {
          margin-right: 10px;
        }
        .input {
          width: 200px;
        }
      }
      .pnuminput {
        width: 300px;
        > span {
          margin-right: 10px;
        }
        .input {
          width: 200px;
        }
      }
    }
    .list {
      flex: 1;
      display: flex;
      overflow: hidden;
      .organ {
        width: 220px;
        height: 100%;
        margin-right: 16px;
        border-radius: 6px;
      }
      .tableBox {
        flex: 1;
        height: 100%;
        overflow: auto;
        border-radius: 6px;
      }
    }
  }
`,cs=j.div`
  height: 600px;
  .box {
    height: 100%;
    .topsearch {
      height: 60px;
      padding: 0 20px;

      display: flex;
      justify-content: space-between;
      .btn {
        height: 100%;
        line-height: 60px;
      }
      .nameinput {
        height: 100%;
        line-height: 60px;
        > span {
          margin-right: 10px;
        }
        .searchInput {
          width: 200px;
        }
      }
      .range {
        line-height: 60px;
        .title {
          margin-right: 16px;
        }
      }
    }
    .list {
      height: calc(100% - 60px);
      padding: 16px;
      .tableScroll {
        height: 100%;
        overflow: auto;
      }
    }
  }
`,ds=j.div`
  height: 600px;
  overflow: hidden;
  .psyQuestions {
    height: 530px;
    overflow: auto;
    position: relative;
    .fixed {
      position: sticky;
      top: 0;
      left: 0;
    }
    .psyQuestion {
      line-height: 30px;
      text-indent: 2em;
      background-color: ${n=>n.theme.colorBgContainer};
      padding: 10px;
      border-bottom: 1px dashed ${n=>n.theme.colorBorder};
      .img {
        max-height: 200px;
        vertical-align: top;
      }
    }
  }
`,ps=j.div`
  padding: 16px;
  overflow: hidden;
  .start {
    width: 100%;
    margin-bottom: 16px;
    .datePicker {
      width: 70%;
    }
  }
  .end {
    width: 100%;
    margin-bottom: 16px;
    .datePicker {
      width: 70%;
    }
  }
`,hs=r.memo(()=>{const{message:n}=Ve.useApp(),{token:S}=We.useToken(),l=Ze(),k=_e(),[ne,ie]=r.useState([]),[le,$]=r.useState(!1),[re,Y]=r.useState(!1),[C,Q]=r.useState(null),[q,K]=r.useState(null),[z,oe]=r.useState([]),[G,m]=r.useState([]),[ce,f]=r.useState(0),[H,de]=r.useState(0),[I,pe]=r.useState(""),[v,he]=r.useState(""),[J,xe]=r.useState(""),[b,A]=r.useState([]),[U,me]=r.useState([]),[V,F]=r.useState([]),[ue,W]=r.useState(!1),[y,ge]=r.useState(null),[fe,ye]=r.useState([]),[L,je]=r.useState([]),[Z,ke]=r.useState([]),[be,M]=r.useState(!1),[Ne,E]=r.useState(!1),[B,N]=r.useState(!1),we=[{title:"序 号",dataIndex:"id",align:"center",key:"id",render:(s,a,t)=>e.jsx(e.Fragment,{children:t+1})},{title:"账 号",dataIndex:"pNum",align:"center",key:"id"},{title:"姓 名",dataIndex:"pName",align:"center",key:"id"},{title:"性 别",dataIndex:"pSexDesc",align:"center",key:"id"},{title:"出生日期",dataIndex:"pBirthDate",align:"center",key:"id",render:s=>e.jsx(e.Fragment,{children:d(s).format("YYYY-MM-DD")})},{title:"组织机构",dataIndex:"pOrganizationName",align:"center",key:"id"},{title:"操 作",dataIndex:"ptasknameid",align:"center",key:"ptasknameid",render:(s,a)=>e.jsx(te,{children:e.jsx(is,{placement:"top",title:"确定删除吗?",onConfirm:()=>Ce(a),okText:"确定",cancelText:"取消",children:l.state.isFinish/l.state.isFinishcount!==1&&e.jsxs("span",{style:{cursor:"pointer",color:S.colorPrimaryText},children:[e.jsx(ls,{}),"  删 除"]})})})}],Pe=[{title:"序 号",dataIndex:"id",align:"center",key:"id",render:(s,a,t)=>e.jsx(e.Fragment,{children:t+1})},{title:"账 号",dataIndex:"pNum",align:"center",key:"id"},{title:"姓 名",dataIndex:"pName",align:"center",key:"id"},{title:"性 别",dataIndex:"pSexDesc",align:"center",key:"id"},{title:"出生日期",dataIndex:"pBirthDate",align:"center",key:"id",render:s=>e.jsx(e.Fragment,{children:d(s).format("YYYY-MM-DD")})},{title:"组织机构",dataIndex:"pOrganizationName",align:"center",key:"id"}],_=[{title:"序 号",width:60,dataIndex:"id",align:"center",key:"id",render:(s,a,t)=>e.jsx(e.Fragment,{children:t+1})},{title:"量表名称",ellipsis:!0,dataIndex:"nameChinese",align:"center",key:"id"},{title:"量表编号",dataIndex:"nameEnglish",align:"center",key:"id"},{title:"总题数",dataIndex:"questionSum",align:"center",key:"id"},{title:"预计用时",dataIndex:"costTime",align:"center",key:"id"},{title:"适用范围",dataIndex:"tableType",ellipsis:!0,align:"center",key:"id",render:s=>Se(s)},{title:"操作",dataIndex:"id",align:"center",key:"id",render:(s,a)=>e.jsx("span",{style:{cursor:"pointer",color:S.colorPrimaryText},onClick:()=>Fe(a),children:"详情"})}],Se=s=>s.split(",").map(t=>{let i="";return Z.forEach(o=>{o.value===String(t)&&(i=o.label)}),e.jsxs("span",{children:[i,"   "]},t)});r.useEffect(()=>{const s=l.state.lsPNum,a=l.state.lsTableCode;(async()=>{try{const i=await g("/api/Dict/GetDict_PsyTableType");if(i.code===200){const c=[];for(let x in i.data)c.push({label:i.data[x],value:x});ke(c)}const o=await g("/api/Person/All",{pageIndex:1,pageSize:9999}),p=await g("/api/PsyInfotablebrief/All",{pageIndex:1,pageSize:999999});if(p.code===200){let c=p.data.items.sort((h,Ue)=>h.id-Ue.id);ie(c);const x=o.data?o.data.filter(h=>s.includes(h.pNum)):[],O=o.data?o.data.filter(h=>!s.includes(h.pNum)):[],He=c.filter(h=>a.includes(h.nameEnglish)),Je=c.filter(h=>!a.includes(h.nameEnglish));m(O),F(Je),oe(x),me(He)}else n.warning(p.msg)}catch(i){n.error(i),console.log(i)}})()},[l,n]);const Ce=async s=>{const a={PTaskNameId:l.state.pTasknameId,PNum:s.pNum,IsDel:3};try{const{code:t,msg:i}=await D("/api/PsyInfotesttasklist/Delete",{},a);t===200?(n.success(i),k("/layout/psyTasks")):n.warning(i)}catch(t){n.error(t)}},X={selectedRowKeys:b,onChange:s=>{A(s)}},Ie=s=>{he(s.target.value)},ve=s=>{pe(s.target.value)},De=async()=>{const s={PNum:I,PName:v,QorganizeId:H,pageIndex:1,pageSize:9999},a=l.state.lsPNum;try{const{data:t,total:i,code:o}=await g("/api/Person/All",s);if(o)m([]),f(0);else{const p=t?t.filter(c=>!a.includes(c.pNum)):[];m(p),f(i-a.length)}}catch(t){n.error(t)}},Te=s=>{Ye(s)},Ye=async s=>{de(s);const a={PNum:I,PName:v,QorganizeId:s,pageIndex:1,pageSize:9999},t=l.state.lsPNum;try{const{data:i,total:o,code:p}=await g("/api/Person/All",a);if(p)m([]),f(0);else{const c=i?i.filter(x=>!t.includes(x.pNum)):[];m(c),f(o-t.length)}}catch(i){n.error(i),console.log(i)}},ze=async(s,a)=>{const t={PNum:I,PName:v,QorganizeId:H,pageIndex:s,pageSize:a},i=l.state.lsPNum;try{const{data:o,total:p,code:c}=await g("/api/Person/All",t);if(c)m([]),f(0);else{const x=o?o.filter(O=>!i.includes(O.pNum)):[];m(x),f(p-i.length)}}catch(o){n.error(o)}},Ae=s=>{xe(s.target.value)},Fe=async s=>{W(!0),ge(s);try{const{code:a,data:t,msg:i}=await g("/api/Psyinfotablecontent/All",{TableCode:s.nameEnglish,pageIndex:1,pageSize:999});a===200?ye(t.items):n.warning(i)}catch(a){n.error(a)}},Le=()=>{let s=!0;switch(y&&y.nameEnglish){case"Adhd":s=!1;break;case"Cbcl2to3":s=!1;break;case"Cgi":s=!1;break;case"Cmi":s=!1;break;case"Embu":s=!1;break;case"Epps":s=!1;break;case"Group":s=!1;break;case"Issi":s=!1;break;case"Lsas":s=!1;break;case"Mast":s=!1;break;case"Psqi":s=!1;break;case"Shirritant":s=!1;break;case"Tess":s=!1;break;case"Upi":s=!1;break;case"Whoqol":s=!1;break;case"Yffs":s=!1;break;case"Zyqx":s=!1;break;default:s=!0;break}return e.jsxs("ul",{className:"psyQuestions",children:[e.jsx("li",{className:"psyQuestion fixed",children:y&&y.guide}),s?fe.map((a,t)=>{const i=ts(a.questionContent,[".bmp",".gif"]);return e.jsxs("li",{className:"psyQuestion",children:[t+1," .",i?e.jsx("img",{className:"img",src:Me(a.questionContent),alt:""}):a.questionContent]},a.id)}):e.jsx("li",{className:"psyQuestion",children:" 该量表不支持展示 "})]})},Me=s=>""+s,Ee=async()=>{if(!B)if(b.length===0)n.info("请选择人员",3);else{const s=l.state.pTasknameId,a=[];G.forEach(t=>{b.includes(t.id)&&a.push({ptasknameid:s,pNum:t.pNum})}),N(!0);try{const{code:t,msg:i}=await D("/api/PsyInfotesttasklist/ApendPsyPerson",a);t===200?(n.success(i),A([]),M(!1),k("/layout/psyTasks")):n.warning(i)}catch(t){n.error(t)}finally{N(!1)}N(!0)}},Be=s=>{je(s)},Oe=()=>{const s=ne.filter(a=>a.nameChinese.includes(J));if(L.length===0)F(s);else{const a=s.filter(t=>{const i=t.tableType.split(",");if(L.some(p=>i.includes(p)))return t});F(a)}},Re=async()=>{if(!B)if(b.length===0)n.info("请选择量表",3);else{const s=l.state.pTasknameId,a=b.map(t=>({ptasknameid:s,TableCode:t}));N(!0);try{const{code:t,msg:i}=await D("/api/PsyInfotesttasklist/ApendPsyGauge",a);t===200?(n.success(i),A([]),E(!1),k("/layout/psyTasks")):n.warning(i)}catch(t){n.error(t)}finally{N(!1)}}},$e=()=>{Q(d(l.state.startTime)),K(d(l.state.endTime)),Y(!0)},Qe=s=>{Q(s)},qe=s=>{C?K(s):n.info("请输入开始日期")},Ke=async()=>{try{const{code:s,msg:a}=await D("/api/PsyTaskName/TimeExpand",{},{ptasknameid:l.state.pTasknameId,startTime:d(C).format("YYYY-MM-DD"),endTime:d(q).format("YYYY-MM-DD")});s===200&&(n.success(a),k("/layout/psyTasks"))}catch(s){console.log(s)}finally{Y(!1)}},Ge=()=>{Y(!1)};return e.jsxs(rs,{theme:S,children:[e.jsxs("div",{className:"topInfo",children:[e.jsxs("div",{className:"info",children:[e.jsxs("p",{children:[e.jsx("span",{children:"任务名称 :"})," ",l.state.pTaskName]}),e.jsxs("p",{children:[e.jsx("span",{children:"发布人员 :"})," ",l.state.publisher]})]}),e.jsxs("div",{className:"info",children:[e.jsxs("p",{children:[e.jsx("span",{children:"人员量表 :"}),l.state.pNumCount,"/人 ,   ",e.jsxs("span",{className:"psys",title:"当前任务下已经存在的量表",onClick:()=>$(!0),children:[l.state.tableCodeCount,"/表 ",e.jsx(ee,{})]})]}),e.jsxs("p",{children:[e.jsx("span",{children:"有效日期 :"}),e.jsxs("span",{children:[" ",d(l.state.startTime).format("YYYY-MM-DD")," 至  ",d(l.state.endTime).format("YYYY-MM-DD")," ",e.jsx("span",{className:"psys",onClick:$e,children:"延长"})]})]})]}),e.jsxs("div",{className:"info",children:[e.jsxs("p",{children:[e.jsx("span",{children:"发布日期 :"})," ",l.state.createTime]}),e.jsxs("div",{className:"progress",children:[e.jsx("span",{children:"测评进度 : "}),e.jsx("div",{className:"line",children:e.jsx(Xe,{size:["100%",16],format:s=>e.jsxs("span",{children:[s.toFixed(1),"%"]}),percent:l.state.isFinish/l.state.isFinishcount*100,showInfo:!0})})]})]})]}),e.jsxs("div",{className:"bot",children:[e.jsxs("div",{className:"btns",children:[e.jsx("div",{className:"item",children:e.jsx(u,{type:"primary",onClick:()=>M(!0),title:l.state.isFinish/l.state.isFinishcount===1?"测评进度为100%时禁止添加人员":"",disabled:l.state.isFinish/l.state.isFinishcount===1,children:"添加人员"})}),e.jsx("div",{className:"item",children:e.jsx(u,{type:"primary",title:l.state.isFinish/l.state.isFinishcount===1?"测评进度为100%时禁止添加量表":"",onClick:()=>E(!0),disabled:l.state.isFinish/l.state.isFinishcount===1,children:"添加量表"})}),e.jsx("div",{className:"item",children:e.jsx(u,{onClick:()=>k("/layout/psyTasks"),children:"返 回"})})]}),e.jsx("div",{className:"tableList",children:z.length>0&&e.jsx(T,{rowKey:s=>s.id,columns:we,dataSource:z||[],size:"small",pagination:{total:z.length,showSizeChanger:!0,showQuickJumper:!0,defaultPageSize:50,showTotal:s=>`共 ${s} 条`}})})]}),e.jsx(w,{text:e.jsxs("span",{children:[e.jsx(P,{}),"  延长日期"]}),width:400,zIndex:9999,open:re,onOk:Ke,onCancel:Ge,maskClosable:!1,children:e.jsxs(ps,{children:[e.jsxs("div",{className:"start",children:[e.jsx("span",{children:"开始日期: "}),"    ",e.jsx(se,{className:"datePicker",value:C,format:"YYYY-MM-DD",disabled:d().valueOf()>d(C).valueOf(),disabledDate:s=>s&&s<d().startOf("day"),placeholder:"选择日期",onChange:Qe})]}),e.jsxs("div",{className:"end",children:[e.jsx("span",{children:"结束日期: "}),"    ",e.jsx(se,{className:"datePicker",value:q,format:"YYYY-MM-DD",disabledDate:s=>s&&s<d().add(1,"day"),placeholder:"选择日期",onChange:qe})]})]})}),e.jsx(w,{text:e.jsxs("span",{children:[e.jsx(P,{}),"  量 表 详 情"]}),width:1200,open:le,footer:null,onCancel:()=>$(!1),maskClosable:!1,children:e.jsx(os,{children:e.jsx("div",{className:"box",children:e.jsx("div",{className:"tableScroll",children:U.length>0&&e.jsx(T,{rowKey:s=>s.id,columns:_,dataSource:U||[],size:"small",pagination:!1})})})})}),e.jsx(w,{text:e.jsxs("span",{children:[e.jsx(P,{}),"  添 加 人 员"]}),width:1200,open:be,footer:null,onCancel:()=>M(!1),maskClosable:!1,children:e.jsx(ae,{children:e.jsx(ae,{children:e.jsxs("div",{className:"box",children:[e.jsxs("div",{className:"topsearch",children:[e.jsxs("div",{className:"pnuminput",children:[e.jsx("span",{children:"账号: "}),e.jsx(R,{className:"input",value:I,onChange:ve,allowClear:!0,placeholder:"输入账号查询"})]}),e.jsxs("div",{className:"nameinput",children:[e.jsx("span",{children:"姓 名: "}),e.jsx(R,{className:"input",value:v,onChange:Ie,allowClear:!0,placeholder:"输入姓名查询"})]}),e.jsxs("div",{className:"btn",children:[e.jsxs(u,{className:"searchbtn",type:"primary",onClick:De,children:[e.jsx(ee,{})," 查 询"]}),e.jsxs(u,{onClick:Ee,children:[e.jsx(ns,{})," 添 加"]})]})]}),e.jsxs("div",{className:"list",children:[e.jsx("div",{className:"organ",children:e.jsx(as,{onSelectOrg:Te})}),e.jsx("div",{className:"tableBox",children:e.jsx(T,{rowKey:s=>s.id,columns:Pe,rowSelection:X,dataSource:G,size:"small",sticky:!0,pagination:{total:ce,showSizeChanger:!0,showQuickJumper:!0,defaultPageSize:50,onChange:ze,showTotal:s=>`共 ${s} 条`}})})]})]})})})}),e.jsx(w,{text:e.jsxs("span",{children:[e.jsx(P,{}),"  添 加 量 表"]}),width:1200,open:Ne,footer:null,onCancel:()=>E(!1),maskClosable:!1,children:e.jsx(cs,{children:e.jsxs("div",{className:"box",children:[e.jsxs("div",{className:"topsearch",children:[e.jsxs("div",{className:"nameinput",children:[e.jsx("span",{children:"量表名称: "}),e.jsx(R,{value:J,onChange:Ae,allowClear:!0,placeholder:"输入量表名称查询",className:"searchInput"})]}),e.jsxs("div",{className:"range",children:[e.jsx("span",{className:"title",children:"适用范围: "}),e.jsx(es,{mode:"multiple",allowClear:!0,style:{width:"400px"},placeholder:"请选择适用范围",value:L,onChange:Be,options:Z})]}),e.jsx("div",{className:"btn",children:e.jsxs(te,{children:[e.jsx(u,{onClick:Oe,children:"查询"}),e.jsx(u,{type:"primary",onClick:Re,loading:B,children:"添 加"})]})})]}),e.jsx("div",{className:"list",children:e.jsx("div",{className:"tableScroll",children:V.length>0&&e.jsx(T,{rowKey:s=>s.nameEnglish,columns:_,dataSource:V||[],size:"small",rowSelection:X,pagination:!1})})})]})})}),e.jsx(w,{text:e.jsxs("span",{children:[e.jsx(P,{}),"  量表详情"]}),width:800,zIndex:9999,open:ue,footer:null,onCancel:()=>W(!1),maskClosable:!1,children:e.jsx(ds,{theme:S,children:e.jsx(ss,{defaultActiveKey:"1",items:[{key:"1",label:"量表说明",children:y&&y.description},{key:"2",label:"量表题目",children:Le()}]})})})]})});hs.displayName="EditTask";export{hs as default};
