import { message } from "antd/lib/index"; import { Button, Descriptions, Popconfirm, Row, Col, Form, Input, Select, Modal } from 'antd'; import React from 'react'; import { initFilter, extendRule, extendInclude, extendIgnoreDataRule, setDataFieldValue, guid, showFiles, GetFileModel, showUserSign, approveView } from "../../../utils/common"; import ReactToPrint from "react-to-print"; import config from "../../../config"; import XLSX from 'xlsx'; import { connect } from 'dva'; import stylesStep from '../HI/StepForm.css'; import FormPage from '../../../components/FormPage' import moment from 'moment'; class SK012ShowPrint extends React.Component { constructor(props) { super(props); this.state = { data: null, enumData: null, detailUsers: [], BtnAgreeDisplay: 'none', fileForm: { title: "", visible: false, }, }; }; componentDidMount() { if (this.props.data?.id) this.loadData(this.props.data?.id, this.props.data?.TaskID); } componentWillReceiveProps(NextProps) { if (NextProps.data?.id && this.props.data?.id != NextProps.data?.id) { this.loadData(NextProps.data?.id, this.props.data?.TaskID); } } onTableBtnAgree() { this.props.dispatch({ type: 'app/getDataByPost', url: 'SK/SKSecurityInspectionRecordSummary/IdentityUpdateNew', payload: { ID: this.props.data.id, TaskID: this.props.data.TaskID, }, onComplete: (ret) => { if (ret) { message.success('确认成功!'); this.setState({ BtnAgreeDisplay: 'none' }) this.BtnClose(); } } }) } BtnClose = () => { if (typeof this.props.data.onCancel != "undefined" && typeof this.props.data.onCancel == 'function') this.props.data.onCancel(); } loadData = (dataId, taskID) => { let json = initFilter(this.props.login.OrgId); json.Parameter22 = this.props.data.ORG_ID_HV; extendRule(json, 'ID', 1, dataId); extendRule(json, 'TASK_ID', 1, taskID); extendIgnoreDataRule(json) // extendRule(json, 'ID', 1, dataId); // extendInclude(json, 'Nav_JobName'); // extendInclude(json, 'Nav_JobNameOut'); // extendInclude(json, 'Nav_OperationStep'); // extendInclude(json, 'Nav_DisclosurePerson'); // extendInclude(json, 'Nav_DisclosurePerson'); // extendInclude(json, 'Nav_Person'); // extendInclude(json, 'Nav_Person.Nav_User'); // extendInclude(json, 'Nav_Person.Nav_RelatedUser.Nav_Signs.Nav_ImgFile'); // extendInclude(json, 'Nav_DisclosuredPerson'); // extendInclude(json, 'Nav_DisclosuredPerson.Nav_User'); this.props.dispatch({ type: 'app/getDataByPost', payload: json, url: 'SK/SKSecurityInspectionRecordSummary/GetIdentityUserEdit', onComplete: (ret) => { if (ret) { if (this.props.data && this.props.data.loadDataDeal) { this.props.data.loadDataDeal(1); } let users = [] let uniqueUsers = [] if (ret.Nav_CheckRecordDetails) { ret.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({ data: ret, detailUsers: uniqueUsers }) if (this.props.data.tableKey == "2" || this.props.data.tableKey == undefined) { this.setState({ BtnAgreeDisplay: 'none' }) } else { this.setState({ BtnAgreeDisplay: 'inline' }) } approveView(this, false); } } }); } 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; const enums = this.props.data.enums ? this.props.data.enums : this.props.app.enums; 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.HIDDEN_PLACE } | { item?.Nav_CheckRecordDetailReasons && item?.Nav_CheckRecordDetailReasons.map((item2, i) => { return {(i > 0 ? "," : "") + item2.Nav_Reason.NAME} // return | |||||||
| { showFiles(item?.Nav_CheckRecordDetailFiles, config.picServerHost, this) } | }) }