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, showUserSign, showFileImg, GetFileModel, 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 '../../FormPage' import moment from 'moment'; class SK080ShowPrint 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); } } 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); extendIgnoreDataRule(json) this.props.dispatch({ type: 'app/getDataByPost', payload: json, url: 'SK/SKMajorAccidentHazardManage/SKGet', 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' }) } 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") } // 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 ?
{data.CODE} {moment(data.CREATE_TIME).format('YYYY-MM-DD')} {data.Nav_ApplyDepartment ? data.Nav_ApplyDepartment.NAME : ''} {data.Nav_ApplyUser ? data.Nav_ApplyUser.NAME : ''} {data.Nav_RectifyRecord ? data.Nav_RectifyRecord?.CODE : ''} {data.Nav_RectifyRecord && data.Nav_RectifyRecord.Nav_ProductionUnit ? data.Nav_RectifyRecord.Nav_ProductionUnit.NAME : ''} {data.Nav_RectifyRecord && data.Nav_RectifyRecord.Nav_RiskArea ? data.Nav_RectifyRecord.Nav_RiskArea.NAME : ''} {data.Nav_RectifyRecord ? data.Nav_RectifyRecord.HIDDEN_PLACE : ''} { showFileImg(data.Nav_RectifyRecord && data.Nav_RectifyRecord.Nav_RectifyPhotoas ? data.Nav_RectifyRecord.Nav_RectifyPhotoas : null, config.picServerHost, this) } { showFileImg(data.Nav_RectifyRecord && data.Nav_RectifyRecord.Nav_RectifyPhotobs ? data.Nav_RectifyRecord.Nav_RectifyPhotobs : null, config.picServerHost, this) } {data.HIDDEN_DESCRIPTION} {data.HIDDEN_REASON} {data.Nav_ChargeUser ? data.Nav_ChargeUser.NAME : ''} { data?.Nav_Users && data?.Nav_Users.map((item2, i) => { return {(i > 0 ? "," : "") + item2.Nav_User.NAME} }) } {data.REVIEW_DESCRIPTION} { showFileImg(data?.Nav_Files, config.picServerHost, this) } {enums.SKReviewResultEnum.enums[data.REVIEW_RESULT]} {data.Nav_MonitorDepart ? data.Nav_MonitorDepart.NAME : ''} {data.MONITOR_OPINION}
: null }
{ GetFileModel(Modal, FormPage, this, this.state.fileForm.visible) }
} } export default connect(({ login, app }) => ({ login, app }))(SK080ShowPrint)