diff --git a/src/components/CustomPages/SK/SK027ShowPrintNew.js b/src/components/CustomPages/SK/SK027ShowPrintNew.js new file mode 100644 index 0000000..d51d75f --- /dev/null +++ b/src/components/CustomPages/SK/SK027ShowPrintNew.js @@ -0,0 +1,533 @@ +import { Button, Descriptions, Modal } from 'antd'; +import React from 'react'; +import { initFilter, extendRule, GetFileModel, guid, showFiles, showApprove, showUsersSign, showUserSign,showFileImg,extendIgnoreDataRule } from '../../../utils/common'; +import ReactToPrint from 'react-to-print'; +import { ExportToExcel } from '@woowalker/feui' +import XLSX from 'xlsx'; +import { connect } from 'dva'; +import stylesStep from '../../../components/CustomPages/HI/StepForm.css'; +import config from '../../../config.js'; +import FormPage from '../../FormPage' +import moment from 'moment'; +class SK027ShowPrintNew extends React.Component { + constructor(props) { + super(props); + this.state = { + tmpData: {}, + data1: null, + data2: null, + data3: null, + data4: null, + detailUsers:[], + fileData: [], + fileForm: { + title: "", + visible: false, + }, + + } + } + + 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); + } + } + + onTableBtnExport() { + let TableWrap = document.getElementById('table1'); + let Table = TableWrap.getElementsByTagName('table1')[0]; + const wb = XLSX.utils.table_to_book(Table); + XLSX.writeFile(wb, this.props.record.Nav_Department.NAME + '.xlsx') + + } + + loadData = (id) => { + // id= CHECKID +'_'+SUBMITID CHECKID\SUBMITID 可能只有其一 但是一定会有_ + var orgId = this.props.login ? this.props.login.OrgId : ''; + let json = initFilter(orgId); + extendRule(json, 'ID', 1, id); + extendIgnoreDataRule(json) + this.props.dispatch({ + type: 'app/getDataByPost', + payload: json, + url: 'SK/SKSecurityInspectionRecordSummary/SKGetAll', + onComplete: (ret) => { + if (ret) { + let users=[] + let uniqueUsers =[] + if(ret.data1.Nav_CheckRecordDetails) + { + ret.data1.Nav_CheckRecordDetails.forEach(item => { + item.Nav_CheckRecordDetailUsers.forEach(item2=>{ + users.push(item2) + }) + }) + } + if(users) + { + uniqueUsers= users.reduce((acc, user) => { + // 如果累积数组中还没有这个 user_id,则添加 + if (!acc.some(item => item.USER_ID === user.USER_ID)) { + acc.push(user); + } + return acc; + }, []); + } + this.setState({ detailUsers:uniqueUsers,data1: ret.data1, + data2: ret.data2,data3: ret.data3, data4: ret.data4}) + } + } + }); + } + + render() { + const { data1,data2,data3,data4,detailUsers } = this.state; + const enums = this.props.data.enums ? this.props.data.enums : this.props.app.enums; + return
+
+ + + {/* */} + {/* onClick={() => this.CheckerCheckToActual(10)} */} + + + +
} content={() => this.componentRef} />
+
+
(this.componentRef = el)} style={{ padding: '20px', paddingTop: '20px' }} id={'tableId' + this.props.data.id}> +

安全检查记录汇总表

+ { + data1 ? +
+ + {moment(data1.CREATE_TIME).format('YYYY-MM-DD')} + {data1.Nav_ApplyDepartment ? data1.Nav_ApplyDepartment.NAME : ''} + {data1.Nav_ApplyUser ? data1.Nav_ApplyUser.NAME : ''} + {data1.Nav_ProductionUnit? data1.Nav_ProductionUnit.NAME : ''} + {data1.Nav_CheckType ? data1.Nav_CheckType.NAME : ''} + {enums.SKPLANCHECKFREQUENCYEnum.enums[data1.PLANCHECKFREQUENCY]} + {enums.SKDepartmentTypeEnum.enums[data1.DEPARTMENT_TYPE]} + {moment(data1.CHECK_TIME).format('YYYY-MM-DD HH:mm:ss')} + {data1.CHECK_PERSON} + { + showFiles(data1?.Nav_CheckRecordFiles, config.picServerHost, this) + } + +
: null + } + + + + + + {/* + */} + + + + + + + + + { + data1?.Nav_CheckRecordDetails && data1.Nav_CheckRecordDetails?.sort((x, y) => (x.RISK_AREA_ID > y.RISK_AREA_ID) ? 1 : -1).map((item, i) => { + return + + + + {/* + }) + } + */} + {/* */} + + }) + } + + + + + + + + + }) + } +
序号检查区域检查内容检查依据判定标准检查人员检查情况隐患描述隐患等级整改措施隐患地点隐患照片
+ {i + 1} + {/* {item.MARK !== 0 ? * : i + 1} */} + + { + item.Nav_RiskArea?.NAME + } + + { + item.Nav_Contents?.CHECKCONTENT + } + + { + item?.Nav_CheckRecordDetailBasics && item?.Nav_CheckRecordDetailBasics.map((item2, i) => { + + return {(i > 0 ? "," : "") + item2.Nav_Law.NAME} + + // return
+ { + item.CHECKSTANDARD + } + + { + item?.Nav_CheckRecordDetailUsers && item?.Nav_CheckRecordDetailUsers.map((item2, i) => { + if (item2.ISCHECK) { + return {(i > 0 ? "," : "") + item2.Nav_User.NAME} + } else { + return {(i > 0 ? "," : "") + item2.Nav_User.NAME} + } + //return
+ { + item.CHECK_RESULT == null? "无隐患" :enums.SKCheckResultEnum.enums[item.CHECK_RESULT] + } + + { + item.Nav_Question?.DESCREPTION + } + + { + enums.SKHiddenLevel.enums[item.HIDDEN_LEVEL] + } + + { + item.RECTIFICATION_MEASURES + } + + { + item.HIDDEN_PLACE + } + + { + showFiles(item?.Nav_CheckRecordDetailFiles, config.picServerHost, this) + } +
+ { + this.state.detailUsers ? +
+ + { + this.state.detailUsers?.filter(it => it.ISCHECK).map((item, i) => { + return showUserSign(item.Nav_User, config.picServerHost) + }) + } + +
:null + } +

{data2 && data2 != [] ?"隐患上报表":null}

+ + { + data2 ? +
+ + {moment(data2.CREATE_TIME).format('YYYY-MM-DD')} + {data2.Nav_ApplyDepartment ? data2.Nav_ApplyDepartment.NAME : ''} + {data2.Nav_ApplyUser ? data2.Nav_ApplyUser.NAME : ''} + {data2.Nav_ProductionUnit? data2.Nav_ProductionUnit.NAME : ''} + {data2.Nav_CheckType ? data2.Nav_CheckType.NAME : ''} + {enums.SKPLANCHECKFREQUENCYEnum.enums[data2.PLANCHECKFREQUENCY]} + {enums.SKDepartmentTypeEnum.enums[data2.DEPARTMENT_TYPE]} + {moment(data2.CHECK_TIME).format('YYYY-MM-DD HH:mm:ss')} + {data2.CHECK_PERSON} + { + showFiles(data2?.Nav_ReportFiles, config.picServerHost, this) + } + +
: null + } + { data2 && data2.Nav_ReportDetails ? + + + + + + + + + + + + + + { + data2?.Nav_ReportDetails && data2.Nav_ReportDetails?.map((item, i) => { + return + + + + + + + + + + + + }) + } +
序号检查区域检查内容隐患描述隐患等级整改措施隐患地点整改责任人整改期限隐患照片
+ {i + 1} + {/* {item.MARK !== 0 ? * : i + 1} */} + + { + item.Nav_RiskArea?.NAME + } + + { + item.Nav_Contents?.CHECKCONTENT + } + + { + item.Nav_Question?.DESCREPTION + } + + { + enums.SKHiddenLevel.enums[item.HIDDEN_LEVEL] + } + + { + item.RECTIFICATION_MEASURES + } + + { + item.HIDDEN_PLACE + } + + { + item.ISCHECK? {item.Nav_RecitifyUser?.NAME}: + {item.Nav_RecitifyUser?.NAME} + } + {/* { + item.Nav_RecitifyUser?.NAME + } */} + + { + moment(item.RECITIFY_TIME).format('YYYY-MM-DD') + } + + { + showFiles(item?.Nav_ReportDetailFiles, config.picServerHost, this) + } +
:null + } + + { + data2 && data2.Nav_ReportDetails ? +
+ + { + data2.Nav_ReportDetails?.map((item, i) => { + if (item && item.ISCHECK ) { + showUserSign(item.Nav_RecitifyUser, config.picServerHost) + } + }) + } + +
:null + } + + { + data3 && data3 != []? + + + + {data3 && data3 != [] ? :null} + + { + data3?.map(head => { + return + + + }) + } + +
隐患整改通知
+ { + head ? +
+ + {moment(head.CREATE_TIME).format('YYYY-MM-DD')} + {head.Nav_ApplyDepartment ? head.Nav_ApplyDepartment.NAME : ''} + {head.Nav_ApplyUser ? head.Nav_ApplyUser.NAME : ''} + {head.Nav_ProductionUnit? head.Nav_ProductionUnit.NAME : ''} + {head.Nav_CheckType ? head.Nav_CheckType.NAME : ''} + {enums.SKPLANCHECKFREQUENCYEnum.enums[head.PLANCHECKFREQUENCY]} + {enums.SKDepartmentTypeEnum.enums[head.DEPARTMENT_TYPE]} + {head.CHECK_TIME ? moment(head.CHECK_TIME).format('YYYY-MM-DD HH:mm:ss') : null} + {head.CHECK_PERSON} + { + showFiles(head?.Nav_RectifyFiles, config.picServerHost, this) + } + +
: null + } + + + + + {/* */} + + + + + + + + + + { + head?.Nav_RectifyDetails && head.Nav_RectifyDetails?.map((item, i) => { + return + + + {/* */} + + + + + + + + + + }) + } +
序号检查区域检查内容隐患描述隐患等级隐患地点整改措施整改期限整改落实人验收人隐患照片
+ {i + 1} + + { + item.Nav_RiskArea?.NAME + } + + { + item.Nav_Contents?.CHECKCONTENT + } + + { + item.Nav_Question?.DESCREPTION?item.Nav_Question.DESCREPTION:item.HIDDEN_DESCRIPTION + } + + { + enums.SKHiddenLevel.enums[item.HIDDEN_LEVEL] + } + + { + item.HIDDEN_PLACE + } + + { + item.RECTIFICATION_MEASURES + } + + { + item.RECITIFY_TIME ? moment(item.RECITIFY_TIME).format('YYYY-MM-DD') : null + } + + { + item.Nav_ImplementUser?.NAME + } + + { + item.Nav_AcceptUser?.NAME + } + + { + showFiles(item?.Nav_RectifyDetailFiles, config.picServerHost, this) + } +
+
+ : null + } + + { + data4 && data4 != []? + + + + {data4 && data4 != [] ? :null} + + { + data4?.map(head => { + return + + + }) + } + +
隐患整改记录
+ { + head ? +
+ + {head.CODE} + {moment(head.CREATE_TIME).format('YYYY-MM-DD')} + {head.Nav_ApplyDepartment ? head.Nav_ApplyDepartment.NAME : ''} + {head.Nav_ApplyUser ? head.Nav_ApplyUser.NAME : ''} + {head.Nav_ProductionUnit? head.Nav_ProductionUnit.NAME : ''} + {head.Nav_RiskArea ? head.Nav_RiskArea.NAME : ''} + {head.Nav_Contents ? head.Nav_Contents.CHECKCONTENT : ''} + {head.HIDDEN_PLACE} + {head.Nav_Question?.DESCREPTION?head.Nav_Question.DESCREPTION:head.HIDDEN_DESCRIPTION} + {enums.SKHiddenLevel.enums[head.HIDDEN_LEVEL]} + {head.RECTIFICATION_MEASURES} + {moment(head.RECITIFY_TIME).format('YYYY-MM-DD')} + {head.Nav_RecitifyUser && head.Nav_RecitifyUser.Nav_Department ? head.Nav_RecitifyUser.Nav_Department.NAME : ''} + {head.Nav_RecitifyUser ? head.Nav_RecitifyUser.NAME : ''} + {head.RECTIFICATION_MONEY} + { + showFiles(head?.Nav_RectifyFiles, config.picServerHost, this) + } + {head.Nav_ImplementUser ? head.Nav_ImplementUser.NAME : ''} + + {head.RECTIFICATION_DESCRIPTION} + + {head.COMPLETE_DATE?moment(head.COMPLETE_DATE).format('YYYY-MM-DD'):null} + { + showFileImg(head?.Nav_RectifyPhotoas, config.picServerHost, this) + } + { + showFileImg(head?.Nav_RectifyPhotobs, config.picServerHost, this) + } + {head.Nav_AcceptUser ? head.Nav_AcceptUser.NAME : ''} + {head.ACCEPT_DATE?moment(head.ACCEPT_DATE).format('YYYY-MM-DD'):null} + {enums.SKAcceptResultEnum.enums[head.ACCEPT_RESULTE]} + {head.ACCEPT_OPINION} + { + head.Nav_RecitifyUser && head.Nav_RecitifyUser.FILE_PATH ? + showUserSign(head.Nav_RecitifyUser, config.picServerHost) + : head.Nav_RecitifyUser ? head.Nav_RecitifyUser.NAME : '' + } + { + (head.STATUS == 20 ||head.STATUS == 30) && head.Nav_AcceptUser && head.Nav_AcceptUser.FILE_PATH ? + showUserSign(head.Nav_AcceptUser, config.picServerHost) + : head.Nav_AcceptUser ? head.Nav_AcceptUser.NAME : '' + } + +
: null + } +
+ : null + } + +
+ + + { + GetFileModel(Modal, FormPage, this, this.state.fileForm.visible) + } +
+ } +} +export default connect(({ login, app }) => ({ login, app }))(SK027ShowPrintNew) diff --git a/src/utils/customConfig.js b/src/utils/customConfig.js index 3fc4ebe..7be96ca 100644 --- a/src/utils/customConfig.js +++ b/src/utils/customConfig.js @@ -253,6 +253,7 @@ const SK022ShowPrint = createLoadableComponent(() => import('../components/Custo const SK024ShowPrint = createLoadableComponent(() => import('../components/CustomPages/SK/SK024ShowPrint')); const SK026ShowPrint = createLoadableComponent(() => import('../components/CustomPages/SK/SK026ShowPrint')); const SK027ShowPrint = createLoadableComponent(() => import('../components/CustomPages/SK/SK027ShowPrint')); +const SK027ShowPrintNew = createLoadableComponent(() => import('../components/CustomPages/SK/SK027ShowPrintNew')); const SK031ShowPrint = createLoadableComponent(() => import('../components/CustomPages/SK/SK031ShowPrint')); const SK033ShowPrint = createLoadableComponent(() => import('../components/CustomPages/SK/SK033ShowPrint')); // 该组件已在上方声明,此处去除重复定义 @@ -502,6 +503,7 @@ export default function (componentName, formId, formParam, data, formCode, formD SK024ShowPrint: , SK026ShowPrint: , SK027ShowPrint: , + SK027ShowPrintNew: , SK031ShowPrint: , SK033ShowPrint: , SK035ShowPrint: ,