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 } 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 SK020ShowPrint extends React.Component { constructor(props) { super(props); this.state = { data: null, enumData: null, 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/SKHiddenDangerRectifyNotice/IdentityUpdate', 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); 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/SKHiddenDangerRectifyNotice/GetIdentityUserEdit', onComplete: (ret) => { if (ret) { if (this.props.data && this.props.data.loadDataDeal) { this.props.data.loadDataDeal(1); } this.setState({ data: ret }) if (this.props.data.tableKey == "2" || this.props.data.tableKey == undefined) { this.setState({ BtnAgreeDisplay: 'none' }) } else { this.setState({ BtnAgreeDisplay: 'inline' }) } this.onClickApprove(false); } else { message.error('请先尝试刷新,若仍然加载失败,请联系管理员排查!'); } } }); } 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") } onClickApprove = (appVisible) => { const newtmpData = { data: { id: this.props.data.id, isShow: true, key: guid(), param: this.props.data.param, appVisible: appVisible, BtnAgreeDisplay: 'inline' }, formCode: "PF123", } this.setState({ tmpData: newtmpData, }); } render() { const { data } = this.state; const enums = this.props.data.enums ? this.props.data.enums : this.props.app.enums; return
} content={() => this.componentRef} pageStyle=".printDIV { padding:0 40px;} img{width :120px}" />
(this.componentRef = el)} style={{ padding: '20px' }} id={'tableId' + this.props.data.id}>

隐患整改通知表

{ data ?
{moment(data.CREATE_TIME).format('YYYY-MM-DD')} {data.Nav_ApplyDepartment ? data.Nav_ApplyDepartment.NAME : ''} {data.Nav_ApplyUser ? data.Nav_ApplyUser.NAME : ''} {data.Nav_ProductionUnit?.NAME} {data.Nav_CheckType ? data.Nav_CheckType.NAME : ''} {enums.SKPLANCHECKFREQUENCYEnum.enums[data.PLANCHECKFREQUENCY]} {enums.SKDepartmentTypeEnum.enums[data.DEPARTMENT_TYPE]} {data.CHECK_TIME ? moment(data.CHECK_TIME).format('YYYY-MM-DD HH:mm:ss') : null} {data.CHECK_PERSON} { showFiles(data?.Nav_RectifyFiles, config.picServerHost, this) }
: null } {/* */} { data?.Nav_RectifyDetails && data.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?.Nav_RectifyDetailReasons && item?.Nav_RectifyDetailReasons.map((item2, i) => { return {(i > 0 ? "," : "") + item2.Nav_Reason.NAME} // return
{ 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) }
{ GetFileModel(Modal, FormPage, this, this.state.fileForm.visible) }
} } export default connect(({ login, app }) => ({ login, app }))(SK020ShowPrint)