import{r as p,n as me,_ as fe,d as oe,f as ge,a as u,A as ve,t as je,j as e,R as xe,J as Te,I as he,D as ce,B as ne,w as Ne,g as re,v as ue,K as Ie,L as Ye,F as O,S as Pe,b as we,l as De,y as Ae,M as Me,N as Le}from"./index-BtzNP73w.js";import{D as Se}from"./index-BGCT95LN.js";import{O as $e}from"./index-Bulw9wNg.js";import{h as Oe,s as ze}from"./FileSaver.min-QKvCmR1E.js";import{R as ye}from"./index-BQMiSoaL.js";import{R as Be}from"./MoreOutlined-DStrJbIi.js";import{F as Fe}from"./Table-BCm752cP.js";import{R as We}from"./PrinterOutlined-CKytW4eE.js";import{R as He,a as Ve,b as qe}from"./StopOutlined-CzEbTC0W.js";import{R as _e}from"./WarningOutlined-kGVAJm-X.js";import"./index-B6m4IotF.js";import"./iconUtil-D_WnT0lW.js";var Ge={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z"}}]},name:"up",theme:"outlined"},Ue=function(E,R){return p.createElement(me,fe({},E,{ref:R,icon:Ge}))},Qe=p.forwardRef(Ue),Ke={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm0 76c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm128.01 198.83c.03 0 .05.01.09.06l45.02 45.01a.2.2 0 01.05.09.12.12 0 010 .07c0 .02-.01.04-.05.08L557.25 512l127.87 127.86a.27.27 0 01.05.06v.02a.12.12 0 010 .07c0 .03-.01.05-.05.09l-45.02 45.02a.2.2 0 01-.09.05.12.12 0 01-.07 0c-.02 0-.04-.01-.08-.05L512 557.25 384.14 685.12c-.04.04-.06.05-.08.05a.12.12 0 01-.07 0c-.03 0-.05-.01-.09-.05l-45.02-45.02a.2.2 0 01-.05-.09.12.12 0 010-.07c0-.02.01-.04.06-.08L466.75 512 338.88 384.14a.27.27 0 01-.05-.06l-.01-.02a.12.12 0 010-.07c0-.03.01-.05.05-.09l45.02-45.02a.2.2 0 01.09-.05.12.12 0 01.07 0c.02 0 .04.01.08.06L512 466.75l127.86-127.86c.04-.05.06-.06.08-.06a.12.12 0 01.07 0z"}}]},name:"close-circle",theme:"outlined"},Je=function(E,R){return p.createElement(me,fe({},E,{ref:R,icon:Ke}))},Ce=p.forwardRef(Je),Xe={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM528.1 472h-32.2c-5.5 0-10.3 3.7-11.6 9.1L434.6 680l-46.1-198.7c-1.3-5.4-6.1-9.3-11.7-9.3h-35.4a12.02 12.02 0 00-11.6 15.1l74.2 276c1.4 5.2 6.2 8.9 11.6 8.9h32c5.4 0 10.2-3.6 11.6-8.9l52.8-197 52.8 197c1.4 5.2 6.2 8.9 11.6 8.9h31.8c5.4 0 10.2-3.6 11.6-8.9l74.4-276a12.04 12.04 0 00-11.6-15.1H647c-5.6 0-10.4 3.9-11.7 9.3l-45.8 199.1-49.8-199.3c-1.3-5.4-6.1-9.1-11.6-9.1z"}}]},name:"file-word",theme:"outlined"},Ze=function(E,R){return p.createElement(me,fe({},E,{ref:R,icon:Xe}))},et=p.forwardRef(Ze);const tt=oe.div`
  height: 100%;

`,nt=oe.div`
  height: 100%;
  overflow: auto;
  &::-webkit-scrollbar {
    display: none;
  }
  .searchTop {
    margin-bottom: 15px;
    overflow: hidden;
    border-radius: 6px;
    transition: height 0.5s ease;
    border: 1px solid ${o=>o.theme.colorBorder};
    background-color: ${o=>o.theme.colorBgContainer};
    .showworld {
      height: 36px;
      line-height: 36px;
      padding: 0 10px;
      margin-bottom: 10px;
      border-bottom: 1px dotted ${o=>o.theme.colorBorder};
      display: flex;
      justify-content: space-between;
    }
    .inputs {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-around;
      .inp {
        max-width: 320px;
        width: 90%;
        margin-bottom: 10px;
        display: flex;
        justify-content: space-around;
        align-items: center;
        .input {
          width: 70%;
          margin-left: 10px;
        }
        .btn {
          width: 100%;
        }
      }
    }
  }
  // 展开
  .spread {
    height: 260px;
  }
  .close {
    height: 36px;
  }

  // 主题内容
  .content {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    .card {
      width: 100%;
      border-radius: 10px;
      margin-bottom: 10px;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      border-radius: 6px;
      border: 1px solid ${o=>o.theme.colorBorder};
      background-color: ${o=>o.theme.colorBgContainer};
      .top {
        height: 100px;
        display: flex;
        .lt {
          width: 70%;
          padding-top: 10px;
          padding-left: 10px;
          p {
            height: 30px;
          }
        }
        .rt {
          width: 30%;
          display: flex;
          justify-content: center;
          align-items: center;
          color: ${o=>o.theme.colorPrimary};
          border-left: 1px solid ${o=>o.theme.colorBorder};
        }
      }
      .bot {
        height: 30px;
        padding: 0 10px;
        line-height: 30px;
        border-top: 1px solid ${o=>o.theme.colorBorder};
        display: flex;
        justify-content: space-between;
      }
    }
  }
`,rt=oe.div`
  height: 100%;
  .header {
    height: 40px;
    font-size: 16px;
    position: relative;
    .leftBtn {
      /* width: 100px; */
      height: 42px;
      line-height: 42px;
      text-align: center;
      position: absolute;
      margin-left: 15px;
      top: 0;
      left: 0;
    }
    .rightClose {
      width: 100px;
      height: 42px;
      font-size: 24px;
      line-height: 42px;
      text-align: center;
      position: absolute;
      cursor: pointer;
      top: 0;
      right: 0;
    }
  }
  // 后端返回的标签信息, 简单布局处理
  .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+ */ 
  }
`,ke=p.memo(()=>{const{userInfo:{userID:o}}=ge(i=>i),[E,R]=p.useState(!1),[N,z]=p.useState(""),[I,H]=p.useState(""),[V,y]=p.useState(u().add(-7,"d")),[q,B]=p.useState(u().startOf("day")),[F,_]=p.useState(null),{message:D}=ve.useApp(),{token:Z}=je.useToken(),[G,U]=p.useState(null),[Q,s]=p.useState(!1);p.useEffect(()=>{(async()=>{try{const x=await re("/api/PsyInforeport/GetListReport",{PNum:o,StartTime:u().add(-1,"year").format("YYYY-MM-DD"),EndTime:u().format("YYYY-MM-DD"),pageIndex:1,pageSize:99999});U(x.data.items)}catch(x){D.error(x),console.log(x)}})()},[D,o]);const a=i=>{z(i.target.value.trim())},l=i=>{H(i.target.value.trim())},f=i=>{y(i)},j=i=>{B(i)},b=()=>{R(!E)},S=async()=>{const i={PTaskname:N,PNum:o,NameChinese:I,StartTime:u(V).format("YYYY-MM-DD"),EndTime:u(q).format("YYYY-MM-DD"),pageIndex:1,pageSize:999999999};console.log("prams",i);const x=await re("/api/PsyInforeport/GetListReport",i);U(x.data.items),R(!1)},m=()=>{s(!1),_(null)},T=async(i,x=0)=>{if(!Q)try{const g=await ue("/api/PsyInforeport/GetUpdateReport",[i],{ReportType:x});g.code===200?(await _(g.data),await s(!0),D.success(g.msg,5)):D.warning(g.msg)}catch(g){D.error(g)}};return e.jsxs(nt,{theme:Z,children:[e.jsxs("div",{className:`searchTop ${E?"spread":"close"}`,children:[e.jsxs("div",{className:"showworld",children:[e.jsxs("span",{children:[e.jsx(xe,{})," 搜索"]}),e.jsx("span",{onClick:b,children:E?e.jsx(Qe,{}):e.jsx(Te,{})})]}),e.jsxs("div",{className:"inputs",children:[e.jsxs("div",{className:"inp",children:[e.jsx("span",{children:"任务名称: "}),e.jsx(he,{className:"input",value:N,onChange:a})]}),e.jsxs("div",{className:"inp",children:[e.jsx("span",{children:"量表名称: "}),e.jsx(he,{className:"input",value:I,onChange:l})]}),e.jsxs("div",{className:"inp",children:[e.jsx("span",{children:"开始时间: "}),e.jsx(ce,{className:"input",placeholder:"请选择开始日期",value:V,onChange:f})]}),e.jsxs("div",{className:"inp",children:[e.jsx("span",{children:"结束时间: "}),e.jsx(ce,{className:"input",placeholder:"请选择结束日期",value:q,onChange:j})]}),e.jsx("div",{className:"inp",children:e.jsxs(ne,{className:"btn",type:"primary",onClick:S,children:[e.jsx(xe,{})," 查询"]})})]})]}),e.jsx("div",{className:"content",children:G&&G.map(i=>e.jsxs("div",{className:"card",children:[e.jsxs("div",{className:"top",children:[e.jsxs("div",{className:"lt",children:[e.jsx("p",{className:"text-nowrap",children:i.pTaskname}),e.jsxs("p",{className:"text-nowrap",children:[i.nameChinese,"(",i.tableCode,")"]}),e.jsxs("p",{className:"text-nowrap",children:[i.pNum," - ",i.pName]})]}),e.jsx("div",{className:"rt",onClick:()=>T(i.id,1),children:"简单报告"})]}),e.jsxs("div",{className:"bot",children:[e.jsx("span",{children:"创建时间: "}),e.jsx("span",{children:i.createTime})]})]},i.id))}),e.jsx(Se,{onClose:m,closable:!1,open:Q,width:"100%",children:e.jsxs(rt,{children:[e.jsxs("p",{className:"header",children:[e.jsx("span",{className:"leftBtn"}),e.jsx("span",{className:"rightClose",children:e.jsx(Ce,{onClick:m})})]}),F?e.jsx("div",{className:"inner",id:"psyReport",dangerouslySetInnerHTML:{__html:F}}):e.jsx("div",{style:{marginTop:"100px",textAlign:"center"},children:e.jsx(Ne,{})})]})})]})});ke.displayName="PSYReportMobile";const st=oe.div`
  height: 100%;
  display: flex;
  flex-direction: column;
  .searchTop {
    padding: 16px 16px 0;
    margin-bottom: 10px;
    border-radius: 6px;
    background-color: ${o=>o.theme.colorBgContainer};
    .ant-form {
      display: flex;
      align-items: center;
      justify-content: space-between;
      .ant-form-item {
        margin-bottom: 16px;

        &:nth-child(1) {
          width: 200px;
        }
        
        &:nth-child(2) {
          width: 180px;
          .ant-form-item-control {
            width: 100px;
          }
        }
        &:nth-last-child(1) {
          margin-right: 40px;
          width: 150px;
        }
        &:nth-child(3) {
          width: 200px;
        }
        &:nth-last-child(2) {
          width: 160px;
        }
        &:nth-last-child(3) {
          width: 160px;
          margin-right: -50px;
        }
        &:nth-last-child(4) {
          width: 180px;
          margin-right: 30px;
          .ant-select {
            width: 100px;
          }
        }
      }
    }
  }
  .content {
    flex: 1;
    height: 0;
    display: flex;
    .leftOrgan {
      width: 200px;
      margin-right: 16px;
      border-radius: 6px;
      background-color: ${o=>o.theme.colorBgContainer};
      overflow: auto;
    }
    .rightTable {
      flex: 1;
      font-size: 12px;
      padding: 16px;
      border-radius: 6px;
      overflow: hidden;
      background-color: ${o=>o.theme.colorBgContainer};
      .tableBox {
        height: 100%;
        overflow: hidden;
        border-radius: 6px;
      }
    }
  }
`,ot=oe.div`
  height: 100%;
  .header {
    height: 40px;
    font-size: 16px;
    position: relative;
    .leftBtn {
      /* width: 100px; */
      height: 42px;
      line-height: 42px;
      text-align: center;
      position: absolute;
      margin-left: 15px;
      top: 0;
      left: 0;
    }
    .rightClose {
      width: 100px;
      height: 42px;
      font-size: 24px;
      line-height: 42px;
      text-align: center;
      position: absolute;
      cursor: pointer;
      top: 0;
      right: 0;
    }
  }
  // 后端返回的标签信息, 简单布局处理
  .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+ */ 
  }
`;var le={exports:{}},at=le.exports,be;function it(){return be||(be=1,function(o,E){(function(R,N){o.exports=N(Ie())})(typeof self<"u"?self:at,function(R){return function(){var N={155:function(s){s.exports=R}},z={};function I(s){var a=z[s];if(a!==void 0)return a.exports;var l=z[s]={exports:{}};return N[s](l,l.exports,I),l.exports}I.d=function(s,a){for(var l in a)I.o(a,l)&&!I.o(s,l)&&Object.defineProperty(s,l,{enumerable:!0,get:a[l]})},I.o=function(s,a){return Object.prototype.hasOwnProperty.call(s,a)},I.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})};var H={};I.r(H),I.d(H,{useReactToPrint:function(){return Q}});var V=I(155);function y({level:s="error",messages:a,suppressErrors:l=!1}){l||(s==="error"?console.error(a):s==="warning"?console.warn(a):console.debug(a))}function q(s,a){if(a||!s){const l=document.getElementById("printWindow");l&&document.body.removeChild(l)}}function B(s){return s instanceof Error?s:new Error("Unknown Error")}function F(s,a){const{documentTitle:l,onAfterPrint:f,onPrintError:j,preserveAfterPrint:b,print:S,suppressErrors:m}=a;setTimeout(()=>{var T,i;if(s.contentWindow){let x=function(){f==null||f(),q(b)};if(s.contentWindow.focus(),S)S(s).then(x).catch(g=>{j?j("print",B(g)):y({messages:["An error was thrown by the specified `print` function"],suppressErrors:m})});else{if(s.contentWindow.print){const g=(i=(T=s.contentDocument)===null||T===void 0?void 0:T.title)!==null&&i!==void 0?i:"",P=s.ownerDocument.title;l&&(s.ownerDocument.title=l,s.contentDocument&&(s.contentDocument.title=l)),s.contentWindow.print(),l&&(s.ownerDocument.title=P,s.contentDocument&&(s.contentDocument.title=g))}else y({messages:["Printing for this browser is not currently possible: the browser does not have a `print` method available for iframes."],suppressErrors:m});[/Android/i,/webOS/i,/iPhone/i,/iPad/i,/iPod/i,/BlackBerry/i,/Windows Phone/i].some(g=>{var P,A;return((A=(P=navigator.userAgent)!==null&&P!==void 0?P:navigator.vendor)!==null&&A!==void 0?A:"opera"in window&&window.opera).match(g)})?setTimeout(x,500):x()}}else y({messages:["Printing failed because the `contentWindow` of the print iframe did not load. This is possibly an error with `react-to-print`. Please file an issue: https://github.com/MatthewHerbst/react-to-print/issues/"],suppressErrors:m})},500)}function _(s){const a=[],l=document.createTreeWalker(s,NodeFilter.SHOW_ELEMENT,null);let f=l.nextNode();for(;f;)a.push(f),f=l.nextNode();return a}function D(s,a,l){const f=_(s),j=_(a);if(f.length===j.length)for(let b=0;b<f.length;b++){const S=f[b],m=j[b],T=S.shadowRoot;if(T!==null){const i=m.attachShadow({mode:T.mode});i.innerHTML=T.innerHTML,D(T,i,l)}}else y({messages:["When cloning shadow root content, source and target elements have different size. `onBeforePrint` likely resolved too early.",s,a],suppressErrors:l})}const Z=`
    @page {
        /* Remove browser default header (title) and footer (url) */
        margin: 0;
    }
    @media print {
        body {
            /* Tell browsers to print background colors */
            color-adjust: exact; /* Firefox. This is an older version of "print-color-adjust" */
            print-color-adjust: exact; /* Firefox/Safari */
            -webkit-print-color-adjust: exact; /* Chrome/Safari/Edge/Opera */
        }
    }
`;function G(s,a,l,f){var j,b,S,m,T;const{contentNode:i,clonedContentNode:x,clonedImgNodes:g,clonedVideoNodes:P,numResourcesToLoad:A,originalCanvasNodes:M}=l,{bodyClass:ee,fonts:W,ignoreGlobalStyles:K,pageStyle:J,nonce:k,suppressErrors:$,copyShadowRoots:X}=f;s.onload=null;const c=(j=s.contentDocument)!==null&&j!==void 0?j:(b=s.contentWindow)===null||b===void 0?void 0:b.document;if(c){const L=c.body.appendChild(x);X&&D(i,L,!!$),W&&(!((S=s.contentDocument)===null||S===void 0)&&S.fonts&&(!((m=s.contentWindow)===null||m===void 0)&&m.FontFace)?W.forEach(h=>{const t=new FontFace(h.family,h.source,{weight:h.weight,style:h.style});s.contentDocument.fonts.add(t),t.loaded.then(()=>{a(t)}).catch(n=>{a(t,["Failed loading the font:",t,"Load error:",B(n)])})}):(W.forEach(h=>{a(h)}),y({messages:['"react-to-print" is not able to load custom fonts because the browser does not support the FontFace API but will continue attempting to print the page'],suppressErrors:$})));const se=J??Z,ae=c.createElement("style");k&&(ae.setAttribute("nonce",k),c.head.setAttribute("nonce",k)),ae.appendChild(c.createTextNode(se)),c.head.appendChild(ae),ee&&c.body.classList.add(...ee.split(" "));const de=c.querySelectorAll("canvas");for(let h=0;h<M.length;++h){const t=M[h],n=de[h];if(n===void 0){y({messages:["A canvas element could not be copied for printing, has it loaded? `onBeforePrint` likely resolved too early.",t],suppressErrors:$});continue}const r=n.getContext("2d");r&&r.drawImage(t,0,0)}for(let h=0;h<g.length;h++){const t=g[h],n=t.getAttribute("src");if(n){const r=new Image;r.onload=()=>{a(t)},r.onerror=(d,v,C,w,Y)=>{a(t,["Error loading <img>",t,"Error",Y])},r.src=n}else a(t,['Found an <img> tag with an empty "src" attribute. This prevents pre-loading it.',t])}for(let h=0;h<P.length;h++){const t=P[h];t.preload="auto";const n=t.getAttribute("poster");if(n){const r=new Image;r.onload=()=>{a(t)},r.onerror=(d,v,C,w,Y)=>{a(t,["Error loading video poster",n,"for video",t,"Error:",Y])},r.src=n}else t.readyState>=2?a(t):t.src?(t.onloadeddata=()=>{a(t)},t.onerror=(r,d,v,C,w)=>{a(t,["Error loading video",t,"Error",w])},t.onstalled=()=>{a(t,["Loading video stalled, skipping",t])}):a(t,["Error loading video, `src` is empty",t])}const te="select",ie=i.querySelectorAll(te),pe=c.querySelectorAll(te);for(let h=0;h<ie.length;h++)pe[h].value=ie[h].value;if(!K){const h=document.querySelectorAll("style, link[rel~='stylesheet'], link[as='style']");for(let t=0,n=h.length;t<n;++t){const r=h[t];if(r.tagName.toLowerCase()==="style"){const d=c.createElement(r.tagName),v=r.sheet;if(v){let C="";try{const w=v.cssRules.length;for(let Y=0;Y<w;++Y)typeof v.cssRules[Y].cssText=="string"&&(C+=`${v.cssRules[Y].cssText}\r
`)}catch(w){y({messages:["A stylesheet could not be accessed. This is likely due to the stylesheet having cross-origin imports, and many browsers block script access to cross-origin stylesheets. See https://github.com/MatthewHerbst/react-to-print/issues/429 for details. You may be able to load the sheet by both marking the stylesheet with the cross `crossorigin` attribute, and setting the `Access-Control-Allow-Origin` header on the server serving the stylesheet. Alternatively, host the stylesheet on your domain to avoid this issue entirely.",r,`Original error: ${B(w).message}`],level:"warning"})}d.setAttribute("id",`react-to-print-${t}`),k&&d.setAttribute("nonce",k),d.appendChild(c.createTextNode(C)),c.head.appendChild(d)}}else if(r.getAttribute("href"))if(r.hasAttribute("disabled"))y({messages:["`react-to-print` encountered a <link> tag with a `disabled` attribute and will ignore it. Note that the `disabled` attribute is deprecated, and some browsers ignore it. You should stop using it. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-disabled. The <link> is:",r],level:"warning"}),a(r);else{const d=c.createElement(r.tagName);for(let v=0,C=r.attributes.length;v<C;++v){const w=r.attributes[v];w&&d.setAttribute(w.nodeName,(T=w.nodeValue)!==null&&T!==void 0?T:"")}d.onload=()=>{a(d)},d.onerror=(v,C,w,Y,Re)=>{a(d,["Failed to load",d,"Error:",Re])},k&&d.setAttribute("nonce",k),c.head.appendChild(d)}else y({messages:["`react-to-print` encountered a <link> tag with an empty `href` attribute. In addition to being invalid HTML, this can cause problems in many browsers, and so the <link> was not loaded. The <link> is:",r],level:"warning"}),a(r)}}}A===0&&F(s,f)}function U(s,a,l,f){s.onload=()=>{G(s,a,l,f)},document.body.appendChild(s)}function Q(s){const{contentRef:a,fonts:l,ignoreGlobalStyles:f,onBeforePrint:j,onPrintError:b,preserveAfterPrint:S,suppressErrors:m}=s;return(0,V.useCallback)(i=>{q(S,!0);const x=function({contentRef:c,optionalContent:L,suppressErrors:se}){return L&&(c&&y({level:"warning",messages:['"react-to-print" received a `contentRef` option and a optional-content param passed to its callback. The `contentRef` option will be ignored.']}),typeof L=="function")?L():c?c.current:void y({messages:['"react-to-print" did not receive a `contentRef` option or a optional-content param pass to its callback.'],suppressErrors:se})}({contentRef:a,optionalContent:i,suppressErrors:m});if(!x)return void y({messages:["There is nothing to print"],suppressErrors:m});const g=x.cloneNode(!0),P=document.querySelectorAll("link[rel~='stylesheet'], link[as='style']"),A=g.querySelectorAll("img"),M=g.querySelectorAll("video"),ee=l?l.length:0,W=(f?0:P.length)+A.length+M.length+ee,K=[],J=[],k=function(){const c=document.createElement("iframe");return c.width=`${document.documentElement.clientWidth}px`,c.height=`${document.documentElement.clientHeight}px`,c.style.position="absolute",c.style.top=`-${document.documentElement.clientHeight+100}px`,c.style.left=`-${document.documentElement.clientWidth+100}px`,c.id="printWindow",c.srcdoc="<!DOCTYPE html>",c}(),$=(c,L)=>{K.includes(c)?y({level:"debug",messages:["Tried to mark a resource that has already been handled",c],suppressErrors:m}):(L?(y({messages:['"react-to-print" was unable to load a resource but will continue attempting to print the page',...L],suppressErrors:m}),J.push(c)):K.push(c),K.length+J.length===W&&F(k,s))},X={contentNode:x,clonedContentNode:g,clonedImgNodes:A,clonedVideoNodes:M,numResourcesToLoad:W,originalCanvasNodes:x.querySelectorAll("canvas")};j?j().then(()=>{U(k,$,X,s)}).catch(c=>{b==null||b("onBeforePrint",B(c))}):U(k,$,X,s)},[s])}return H}()})}(le)),le.exports}var lt=it();const ct=Ye(lt),Ee=p.memo(()=>{const{message:o,modal:E}=ve.useApp(),{token:R}=je.useToken(),{userInfo:{isAdmin:N,userID:z},genderList:I}=ge(t=>t),[H,V]=p.useState([]),[y,q]=p.useState([]),[B,F]=p.useState([]),[_,D]=p.useState([]),[Z,G]=p.useState(null),[U,Q]=p.useState(0),[s]=O.useForm(),[a,l]=p.useState(!1),[f,j]=p.useState(!1),[b,S]=p.useState(null),[m,T]=p.useState(0),[i,x]=p.useState([]),g=p.useRef(null),P=[{title:"序 号",dataIndex:"id",width:50,align:"center",key:"id",render:(t,n,r)=>r+1},{title:e.jsx("span",{children:"风险提示"}),dataIndex:"reportLevel",width:80,align:"center",key:"id",render:t=>e.jsxs("span",{style:{color:X(t,!0),fontWeight:700},children:[c(t),X(t)]})},{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:(t,n)=>`${n.nameChinese}(${n.tableCode})`},{title:e.jsx("span",{children:"组织机构"}),dataIndex:"pOrganizationName",ellipsis:!0,align:"center",key:"id"},{title:e.jsx("span",{children:"账号"}),dataIndex:"pNum",align:"center",key:"id"},{title:e.jsx("span",{children:"姓名"}),dataIndex:"pName",align:"center",key:"id"},{title:e.jsx("span",{children:"性别"}),width:60,dataIndex:"pSex",align:"center",key:"id",render:t=>I[t]},{title:e.jsx("span",{children:"出生日期"}),dataIndex:"pBirthDate",width:120,align:"center",key:"id",render:t=>`${u(t).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:t=>`${u(t).format("YYYY-MM-DD")}`},{title:e.jsx("span",{children:"操 作"}),width:220,dataIndex:"id",align:"center",key:"id",render:(t,n)=>e.jsxs(we,{style:{color:R.colorPrimaryText},children:[e.jsx("span",{style:{cursor:"pointer"},onClick:()=>{E.confirm({title:"温馨提示",content:"确定删除吗?",onOk(){K(t)}})},children:"删除"}),e.jsx("span",{style:{display:N&&"none",cursor:"pointer"},onClick:()=>k(n.id,1),children:"简单报告"}),e.jsx("span",{style:{display:!N&&"none",cursor:"pointer"},onClick:()=>k(n.id,2),children:"标准报告"}),e.jsx("span",{style:{display:!N&&"none",cursor:"pointer"},onClick:()=>k(n.id,3),children:"完整报告"})]})}];p.useEffect(()=>{(async()=>{try{const n=await re("/api/PsyTaskName/All",{pageIndex:1,pageSize:999999});if(n.code===200){const v=n.data.items.map(C=>({label:C.ptaskname,value:C.ptaskname}));V(v),q(v)}else o.warning(n.msg);const r=await re("/api/PsyInfotablebrief/All",{pageIndex:1,pageSize:999999});if(r.code===200){const C=r.data.items.sort((w,Y)=>w.sortCode-Y.sortCode).map(w=>({label:w.nameChinese,value:w.nameChinese}));F(C),D(C)}else o.warning(r.msg);const d=await re("/api/PsyInforeport/GetListReport",{PNum:N?"":z,StartTime:u().add(-1,"year").format("YYYY-MM-DD"),EndTime:u().format("YYYY-MM-DD"),pageIndex:1,pageSize:50});G(d.data.items),Q(d.data.totalRecords)}catch(n){o.error(n),console.log(n)}})()},[o,z,N]);const A=t=>{const n=[];y.forEach(r=>{r.value.includes(t)&&n.push(r)}),V(n)},M=async t=>{j(!0);try{const n=await re("/api/PsyInforeport/GetListReport",t);G(n.data.items),Q(n.data.totalRecords)}catch(n){o.error(n)}finally{j(!1)}},ee=t=>{const n=[];_.forEach(r=>{r.value.includes(t)&&n.push(r)}),F(n)},W=(t,n)=>{const r={...s.getFieldValue()},d={PTaskname:r.PTaskname,ReportLevel:r.ReportLevel,PNum:r.PNum,NameChinese:r.NameChinese,pageIndex:t,pageSize:n};if(r.StartTime&&(d.StartTime=u(r.StartTime).format("YYYY-MM-DD")),r.EndTime&&(d.EndTime=u(r.EndTime).format("YYYY-MM-DD")),m&&(d.QorganizeId=m),u(r.StartTime).valueOf()>u(r.EndTime).valueOf()){o.warning("开始时间大于结束时间, 请重新选择");return}M(d)},K=async t=>{const n=await Le(`/api/PsyInforeport/Delete/${t}`);n.code===200?o.success("删除成功",4):o.warning(n.msg);const r=s.getFieldValue(),d={PTaskname:r.PTaskname,ReportLevel:r.ReportLevel,PNum:r.PNum,NameChinese:r.NameChinese,pageIndex:1,pageSize:50};if(m&&(d.QorganizeId=m),r.StartTime&&(d.StartTime=u(r.StartTime).format("YYYY-MM-DD")),r.EndTime&&(d.EndTime=u(r.EndTime).format("YYYY-MM-DD")),u(r.StartTime).valueOf()>u(r.EndTime).valueOf()){o.warning("开始时间大于结束时间, 请重新选择");return}M(d)},J=async t=>{if(f)return;const n={ReportLevel:t.ReportLevel,PTaskname:t.PTaskname,PNum:t.PNum,NameChinese:t.NameChinese,pageIndex:1,pageSize:50};if(m&&(n.QorganizeId=m),t.StartTime&&(n.StartTime=u(t.StartTime).format("YYYY-MM-DD")),t.EndTime&&(n.EndTime=u(t.EndTime).format("YYYY-MM-DD")),u(t.StartTime).valueOf()>u(t.EndTime).valueOf()){o.warning("开始时间大于结束时间, 请重新选择");return}M(n)},k=async(t,n=0)=>{if(!a)try{const r=await ue("/api/PsyInforeport/GetUpdateReport",[t],{ReportType:n});r.code===200?(S(r.data),l(!0),o.success(r.msg,5)):o.warning(r.msg)}catch(r){o.error(r)}},$=()=>{l(!1),S(null)},X=(t,n=!1)=>{switch(t){case"0":return n?"#5BC946":" 正常";case"1":return n?"#FFC125":" 关注";case"2":return n?"#FF8C00":" 追踪";case"3":return n?"#FF6347":" 高危";case"4":return n?"#B413EC":" 警戒";case"*":return n?"#ff0000":" 异常";default:return""}},c=t=>{switch(t){case"0":return e.jsx(qe,{});case"1":return e.jsx(Me,{});case"2":return e.jsx(Ve,{});case"3":return e.jsx(Ae,{});case"4":return e.jsx(_e,{});case"*":return e.jsx(He,{});default:return""}},L=t=>{if(f)return;const n=s.getFieldValue(),r={PTaskname:n.PTaskname,ReportLevel:n.ReportLevel,PNum:n.PNum,NameChinese:n.NameChinese,pageIndex:1,pageSize:50};if(t&&(r.QorganizeId=t),n.StartTime&&(r.StartTime=u(n.StartTime).format("YYYY-MM-DD")),n.EndTime&&(r.EndTime=u(n.EndTime).format("YYYY-MM-DD")),u(n.StartTime).valueOf()>u(n.EndTime).valueOf()){o.warning("开始时间大于结束时间, 请重新选择");return}M(r)},se=t=>{L(t),T(t)},de={selectedRowKeys:i,onChange:t=>{x(t)}},te=async t=>{if(i.length===0){o.info("请先选择人员");return}l(!0);try{const{code:n,msg:r,data:d}=await ue("/api/PsyInforeport/GetUpdateReport",i,{ReportType:t});n===200?(S(d),o.success(r)):o.warning(r)}catch(n){o.error(n)}},ie=(t,n="")=>`
      Content-Type: text/html; charset='utf-8'
      <!DOCTYPE html>
      <html>
      <head>
      <style>
        ${n}
      </style>
      </head>
      <body>
        ${t}
      </body>
      </html>
    `,pe=({filename:t,selector:n})=>{let r=window.document.querySelectorAll(n);const d=Array.from(r).reduce((w,Y)=>w+Y.innerHTML,"");let v=ie(d);const C=Oe.asBlob(v);ze(C,t+".docx")},h=({key:t})=>{switch(t){case"1":te(2);break;case"2":te(3);break}};return e.jsxs(st,{theme:R,children:[e.jsx("div",{className:"searchTop",children:e.jsxs(O,{form:s,layout:"inline",onFinish:J,initialValues:{StartTime:null,ReportLevel:"",EndTime:null,PNum:N?"":z,PTaskname:"",NameChinese:""},children:[e.jsx(O.Item,{label:"任务名称 : ",name:"PTaskname",children:e.jsx(ye,{options:H,allowClear:!0,placeholder:"任务名称",onChange:A})}),e.jsx(O.Item,{label:"用户账号 : ",name:"PNum",style:{display:N!==1&&"none"},children:e.jsx(he,{allowClear:!0,className:"input",placeholder:"账号"})}),e.jsx(O.Item,{label:"量表名称 : ",name:"NameChinese",children:e.jsx(ye,{options:B,allowClear:!0,placeholder:"量表名称",onChange:ee})}),e.jsx(O.Item,{label:"风险等级",name:"ReportLevel",children:e.jsx(Pe,{className:"select",placeholder:"风险等级",allowClear:!0,options:[{value:"0",label:"正常"},{value:"1",label:"关注"},{value:"2",label:"追踪"},{value:"3",label:"高危"},{value:"4",label:"警戒"},{value:"*",label:"异常"}]})}),e.jsx(O.Item,{label:"开始 : ",name:"StartTime",children:e.jsx(ce,{})}),e.jsx(O.Item,{label:" 至 : ",name:"EndTime",children:e.jsx(ce,{})}),e.jsx(O.Item,{children:e.jsxs(we,{children:[e.jsx(ne,{type:"primary",htmlType:"submit",children:"搜 索"}),N?e.jsx(De,{placement:"bottom",arrow:!0,menu:{items:[{label:e.jsx("span",{children:"多人标准报告"}),key:"1"},{type:"divider"},{label:e.jsx("span",{children:"多人完整报告"}),key:"2"}],onClick:h},trigger:["click"],children:e.jsxs(ne,{icon:e.jsx(Be,{}),children:["更 多 ",e.jsx(Te,{})," "]})}):e.jsx(ne,{onClick:()=>te(1),children:"多次简单报告"})]})})]})}),e.jsxs("div",{className:"content",children:[N!==0&&e.jsx("div",{className:"leftOrgan",children:e.jsx($e,{onSelectOrg:se})}),e.jsx("div",{className:"rightTable",children:e.jsx("div",{className:"tableBox",children:Z&&e.jsx(Fe,{size:"small",dataSource:Z,columns:P,sticky:!0,rowKey:t=>t.id,rowSelection:de,loading:f,pagination:{total:U,showSizeChanger:!0,showQuickJumper:!0,defaultPageSize:50,onChange:W,showTotal:t=>`共 ${t} 条`}})})})]}),e.jsx(Se,{onClose:$,closable:!1,open:a,width:794,children:e.jsxs(ot,{children:[e.jsxs("p",{className:"header",children:[e.jsxs("span",{className:"leftBtn",children:[e.jsxs(ne,{style:{marginLeft:"10px"},onClick:()=>pe({filename:`报告_${u().format("YYYY-MM-DD")}`,selector:"#psyReport"}),children:[e.jsx(et,{}),"导出Word"]}),e.jsx(ct,{trigger:()=>e.jsxs(ne,{style:{marginLeft:"10px"},children:[e.jsx(We,{}),"打印"]}),content:()=>g.current})]}),e.jsx("span",{className:"rightClose",children:e.jsx(Ce,{onClick:$})})]}),b&&g?e.jsx("div",{className:"inner",ref:g,id:"psyReport",dangerouslySetInnerHTML:{__html:b}}):e.jsx("div",{style:{marginTop:"100px",textAlign:"center"},children:e.jsx(Ne,{})})]})})]})});Ee.displayName="PSYReportPC";const dt=p.memo(()=>{const{isPC:o}=ge(E=>E);return e.jsx(tt,{children:o===1?e.jsx(Ee,{}):e.jsx(ke,{})})});dt.displayName="PSYReport";export{dt as default};
