import{d as j,r as a,A as v,t as D,j as e,h as F,w as E,g as w,a as y,b as M,y as Y,M as P,v as z}from"./index-BtzNP73w.js";import{F as N}from"./Table-BCm752cP.js";import{R as A,a as B,b as L}from"./StopOutlined-CzEbTC0W.js";import{R as G}from"./WarningOutlined-kGVAJm-X.js";const O=j.div`
  height: 100%;
  overflow: auto;
  opacity: 0.8;

`,V=j.div`
    // 后端返回的标签信息, 简单布局处理
  .inner {
    padding: 20px;
    & > table {
      width: 100%;
    }
    white-space:pre-wrap; /* css3.0 */ 
    white-space:-moz-pre-wrap; /* Firefox */ 
    white-space:-pre-wrap; /* Opera 4-6 */ 
    white-space:-o-pre-wrap; /* Opera 7 */ 
    word-wrap:break-word; /* Internet Explorer 5.5+ */ 
  }
`,_=a.memo(I=>{const{pnum:i}=I,{message:n}=v.useApp(),{token:R}=D.useToken(),d=a.useRef(null),[p,u]=a.useState(null),[k,h]=a.useState(0),[x,f]=a.useState(!1),[m,C]=a.useState(null);console.log("pnum",i);const[S,c]=a.useState(!1);a.useEffect(()=>{c(!0),(async()=>{try{const t=await w("/api/PsyInforeport/GetListReport",{PNum:i,StartTime:"1900-01-01",EndTime:"2099-12-31",pageIndex:1,pageSize:50});u(t.data.items),h(t.data.totalRecords),c(!1)}catch(t){n.error(t),console.log(t)}})()},[n,i]);const T=[{title:"序 号",dataIndex:"id",width:50,align:"center",key:"id",render:(r,t,s)=>s+1},{title:e.jsx("span",{children:"风险提示"}),dataIndex:"reportLevel",width:80,align:"center",key:"id",render:r=>e.jsxs("span",{style:{color:g(r,!0),fontWeight:700},children:[b(r),g(r)]})},{title:e.jsx("span",{children:"任务名称"}),dataIndex:"pTaskname",ellipsis:!0,align:"center",key:"id"},{title:e.jsx("span",{children:"量表名称"}),dataIndex:"nameChinese",ellipsis:!0,align:"center",key:"id",render:(r,t)=>`${t.nameChinese}(${t.tableCode})`},{title:e.jsx("span",{children:"出生日期"}),dataIndex:"pBirthDate",width:120,align:"center",key:"id",render:r=>`${y(r).format("YYYY-MM-DD")}`},{title:e.jsx("span",{children:"报告总评"}),dataIndex:"reportEvaluate",width:150,align:"center",ellipsis:!0,key:"id"},{title:e.jsx("span",{children:"创建时间"}),dataIndex:"createTime",width:120,align:"center",key:"id",render:r=>`${y(r).format("YYYY-MM-DD")}`},{title:e.jsx("span",{children:"操 作"}),width:220,dataIndex:"id",align:"center",key:"id",render:(r,t)=>e.jsxs(M,{style:{color:R.colorPrimaryText},children:[e.jsx("span",{style:{cursor:"pointer"},onClick:()=>l(t.id,1),children:"简单报告"}),e.jsx("span",{style:{cursor:"pointer"},onClick:()=>l(t.id,2),children:"标准报告"}),e.jsx("span",{style:{cursor:"pointer"},onClick:()=>l(t.id,3),children:"完整报告"})]})}],g=(r,t=!1)=>{switch(r){case"0":return t?"#5BC946":" 正常";case"1":return t?"#FFC125":" 关注";case"2":return t?"#FF8C00":" 追踪";case"3":return t?"#FF6347":" 高危";case"4":return t?"#B413EC":" 警戒";case"*":return t?"#ff0000":" 异常";default:return""}},b=r=>{switch(r){case"0":return e.jsx(L,{});case"1":return e.jsx(P,{});case"2":return e.jsx(B,{});case"3":return e.jsx(Y,{});case"4":return e.jsx(G,{});case"*":return e.jsx(A,{});default:return""}},$=async(r,t)=>{c(!0);const s={PNum:i,StartTime:"1900-01-01",EndTime:"2099-12-31",pageIndex:r,pageSize:t};try{const o=await w("/api/PsyInforeport/GetListReport",s);o.code===200?(u(o.data.items),h(o.data.totalRecords),c(!1)):n.warning(o.msg)}catch(o){n.error(o),console.log(o)}},l=async(r,t=0)=>{if(!x)try{const s=await z("/api/PsyInforeport/GetUpdateReport",[r],{ReportType:t});s.code===200?s.data?(C(s.data),f(!0)):n.info(s.msg):n.warning(s.msg)}catch(s){n.error(s)}};return e.jsxs(O,{children:[e.jsx("div",{className:"tableBox",children:p&&e.jsx(N,{size:"small",dataSource:p,columns:T,sticky:!0,rowKey:r=>r.id,loading:S,pagination:{total:k,showSizeChanger:!0,showQuickJumper:!0,defaultPageSize:50,onChange:$,showTotal:r=>`共 ${r} 条`}})}),e.jsx(F,{title:e.jsx("span",{style:{cursor:"pointer"},children:"  报告详情"}),width:794,footer:null,maskClosable:!1,onCancel:()=>f(!1),open:x,children:e.jsx(V,{children:m&&d?e.jsx("div",{className:"inner",ref:d,id:"psyReport",dangerouslySetInnerHTML:{__html:m}}):e.jsx("div",{style:{marginTop:"100px",textAlign:"center"},children:e.jsx(E,{tip:"报告实时生成中......请稍后"})})})})]})});_.displayName="ReportInfo";export{_ as R};
