import { Button, Descriptions, Badge, Popconfirm, Row, Col, Form, Input, Select, Table } from 'antd'; import React from 'react'; import { initFilter, extendRule, extendInclude, extendIgnoreDataRule, setDataFieldValue, showApprove, showUsersSign, guid, showFiles, initQueryFilter } from "../../../utils/common"; import ReactToPrint from "react-to-print"; import { ExportToExcel } from '@woowalker/feui' import XLSX from 'xlsx'; import { connect } from 'dva'; import moment from 'moment'; import { message } from "antd/lib/index"; import styles from '../HI/StepForm.css'; import config from "../../../config.js"; import FormPage from '../../../components/FormPage' class BS034ShowPrint extends React.Component { constructor(props) { super(props); this.state = { data: null, BtnAgreeDisplay: 'none', }; }; componentDidMount() { if (this.props.data?.id) this.loadData(this.props.data?.id); } componentWillReceiveProps(NextProps) { if (NextProps.data?.id && this.props.data?.id != NextProps.data?.id) { this.loadData(NextProps.data?.id); } } BtnClose = () => { if (typeof this.props.data.onCancel != "undefined" && typeof this.props.data.onCancel == 'function') this.props.data.onCancel(); } loadData = () => { let json = initFilter(this.props.login.OrgId); extendRule(json, 'ID', 1, this.props.data.id); // extendInclude(json, 'Nav_ListSafeCheckDetail.Nav_CheckMain'); // extendInclude(json, 'Nav_ListSafeCheckDetail.Nav_CheckMain.Nav_CheckProject'); // extendInclude(json, 'Nav_ListSafeCheckDetail.Nav_CheckMain.Nav_CheckQuestion'); // extendInclude(json, 'Nav_ListCheckUserSign.Nav_ImgFile.Nav_File'); //extendInclude(json, 'Nav_ListSafeCheckDetail.Nav_ListCheckDetailUser.Nav_User.Nav_UserSignFiles.Nav_ImgFile.Nav_File'); extendInclude(json, 'Nav_CheckType'); extendInclude(json, 'Nav_CheckTypeLevel.Nav_Enums'); extendInclude(json, 'Nav_ListCheckRiskArea.Nav_RiskArea'); extendInclude(json, 'Nav_ListCheckProject.Nav_CheckProject'); extendInclude(json, 'Nav_ListCheckProjectCategory.Nav_CheckProjectCategory'); extendInclude(json, 'Nav_Files.Nav_ImgFile.Nav_File'); extendInclude(json, 'Nav_ListCheckUserSign.Nav_User.Nav_UserSignFiles.Nav_ImgFile.Nav_File'); extendInclude(json, 'Nav_ApproveCheckAudit.Nav_ApproveDetails.Nav_ApproveUser.Nav_UserSignFiles.Nav_ImgFile.Nav_File'); extendIgnoreDataRule(json) this.props.dispatch({ type: 'app/getDataByPost', payload: json, url: 'BS/BSSafeCheck/GetCheckInfo034ShowPrint', onComplete: (ret) => { if (ret) { let strRiskAreaNAME = '' if (ret.Nav_ListCheckRiskArea && ret.Nav_ListCheckRiskArea.length > 0) { for (let i = 0; i < ret.Nav_ListCheckRiskArea.length; i++) { strRiskAreaNAME += (strRiskAreaNAME.length > 0 ? "," : "") + ret.Nav_ListCheckRiskArea[i].Nav_RiskArea.NAME; } } let strCheckProjectNAME = '' if (ret.Nav_ListCheckProject && ret.Nav_ListCheckProject.length > 0) { for (let i = 0; i < ret.Nav_ListCheckProject.length; i++) { strCheckProjectNAME += (strCheckProjectNAME.length > 0 ? "," : "") + ret.Nav_ListCheckProject[i].Nav_CheckProject.NAME; } } let strProjectCategoryNAME = '' if (ret.Nav_ListCheckProjectCategory && ret.Nav_ListCheckProjectCategory.length > 0) { for (let i = 0; i < ret.Nav_ListCheckProjectCategory.length; i++) { strProjectCategoryNAME += (strProjectCategoryNAME.length > 0 ? "," : "") + ret.Nav_ListCheckProjectCategory[i].Nav_CheckProjectCategory.NAME; } } ret.RiskAreaNAME = strRiskAreaNAME ret.CheckProjectNAME = strCheckProjectNAME ret.ProjectCategoryNAME = strProjectCategoryNAME this.setState({ //设置setState全局变量 data: ret, //将ret对象赋值给data, data供页面调用 }) } } }); } // sureCheck = () => { // let json = initFilter(this.props.login.OrgId, this.props.data.id, null, null, null, this.props.data.TaskID); // // extendRule(json, 'ID', 1, this.props.data.id); // // extendRule(json, "Parameter1", 1, this.props.data.TaskID) // this.props.dispatch({ // type: 'app/getDataByPost', // payload: json, // url: 'BS/BSSafeCheck/sendCheck', // onComplete: (ret) => { // this.BtnClose() // } // }); // } onClickApprove = (appVisible) => { const newtmpData = { data: { id: this.props.data.id, isShow: true, key: guid(), PARAM2: this.props.data.PARAM2, appVisible: appVisible, BtnAgreeDisplay: 'none' }, formCode: "PF123", } this.setState({ tmpData: newtmpData, }); } onTableBtnExport() { let TableWrap = document.getElementById('tableId' + this.props.data.id); let Table = TableWrap.getElementsByTagName('table')[0]; const wb = XLSX.utils.table_to_book(Table); XLSX.writeFile(wb, "安全检查表.xlsx") } render() { const { data } = this.state; return
{/* */}
} content={() => this.componentRef} pageStyle={"#tableId" + this.props.data.id + " { padding:0 40px;} img{width :120px}"} />
{/* 检查表制定 */}
(this.componentRef = el)} style={{ padding: '20px', paddingTop: '20px' }} id={'tableId' + this.props.data.id}>

{data?.Nav_CheckType?.NAME}记录表

{ // paddingLeft: '50px' data ?
{data.NAME?.replace('任务表', '记录表')} {data.CODE} {data.Nav_CheckType.NAME} {data.CHECKOBJECT_DESCRIPTION} {data.Nav_CheckTypeLevel.Nav_Enums.NAME} {data.CHECKTIME} {data.RiskAreaNAME} {data.CheckProjectNAME} {/* ret.Nav_ListCheckProjectCategory[i].Nav_CheckProjectCategory.NAME */} { // data.ProjectCategoryNAME data.Nav_ListCheckProjectCategory && data.Nav_ListCheckProjectCategory.map((item, i) => { return (i > 0 ? "," : "") + item.Nav_CheckProjectCategory.NAME }) } {data.CheckUsers} { showFiles(data.Nav_Files, config.picServerHost) }
: null } { data ? {data.Nav_ListSafeCheckDetail.map((item, i) => { return {/* */} })}
检查项目 检查内容 检查依据 问题描述 问题等级 整改建议与措施 检查人员 备注 隐患地点 附件
{item.Nav_CheckProject.NAME} {item.CHECKCONTENT} {item.CHECKPROOF} {(item.CHECKRESULT == 0 || (item.CHECKRESULT != null && item.CHECKRESULT == 20)) ? item.Nav_ListCheckDetailQuestion?.map((question, j) => { return (j > 0 ? ',' : '') + question.Nav_Question.DESCREPTION }) : item.CHECKRESULT_DESCRIPTION} {item.CHECKRESULT == 0 ? "" : item.QUESTION_LEVEL_DESCRIPTION} {(item.CHECKRESULT != null && item.CHECKRESULT == 20) ? item.Nav_ListCheckDetailQuestion?.map((question, j) => { return (j > 0 ? ',' : '') + question.Nav_Question.DEMAND }) : ""}{item.CHECKRESULT_DESCRIPTION}{ item.Nav_ListCheckDetailUser.map((user, j) => { return (j > 0 ? "," : "") + user.Nav_User?.NAME }) } {item.REMARK_RESULT} {item.ADDRESS} { showFiles(item.Nav_Files, config.picServerHost) }
检查人员签字 { showUsersSign(data.Nav_ListCheckUserSign, config.picServerHost) // data.Nav_ListCheckUserSign.map((sign, i) => { // return {sign.Nav_User.NAME // }) }
审核意见 { showApprove(data.Nav_ApproveCheckAudit?.Nav_ApproveDetails, this.props.app.enums.NodeApproveStatus.enums, config.picServerHost) // // 如果第一个有人 并且不是当前节点 不显示信息 // (data.STATUCHECK > 5 && data.Nav_ApproveCheckAudit && data.Nav_ApproveCheckAudit.Nav_ApproveDetails) ? data.Nav_ApproveCheckAudit?.Nav_ApproveDetails?.map((approvedetail, i) => { // return (i > 0 ? ";" : "") + ((approvedetail.Nav_ApproveUser && approvedetail.Nav_ApproveUser.NAME) ? approvedetail.Nav_ApproveUser.NAME : '审批流未匹配到人员') + "(" + approvedetail.NAME + "):" + (approvedetail.NODE_APPROVE_TIME == '0001-01-01 00:00:00' ? "待审核" : approvedetail.NODE_APPROVE_TIME) // }) : '' }
: null }
} } export default connect(({ login, app }) => ({ login, app }))(BS034ShowPrint)