import { message } from "antd/lib/index"; import { Button, Descriptions, Row, Col, Form, Input, Select, Modal } from 'antd'; import React from 'react'; import { initFilter, extendRule, extendInclude, extendOrder, setDataFieldValue, guid, showFiles, GetFileModel, approveView } from "../../../utils/common"; import ReactToPrint from "react-to-print"; import styles from '../HI/StepForm.css'; import moment from 'moment'; import config from '../../../config'; import XLSX from 'xlsx'; import { connect } from 'dva'; import FormPage from '../../../components/FormPage' class HM101ShowPrint extends React.Component { constructor(props) { super(props); this.state = { data: null, tmpData: {}, BtnSignDisplay: 'none', 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); } } loadData = (dataId) => { let json = initFilter(this.props.login.OrgId); extendRule(json, 'ID', 1, dataId); extendInclude(json, 'Nav_LiableUser'); extendInclude(json, 'Nav_Files.Nav_ImgFile'); extendInclude(json, 'Nav_Detail.Nav_Users.Nav_User'); extendInclude(json, 'Nav_Detail.Nav_Identifyings.Nav_Identifying'); extendInclude(json, 'Nav_Detail.Nav_User'); extendInclude(json, 'Nav_Detail.Nav_Area'); this.props.dispatch({ type: 'app/getDataByPost', payload: json, url: 'HM/HazardTask/Get', onComplete: (ret) => { if (ret) { for (let i = 0; i < ret.Nav_Detail.length; i++) { ret.Nav_Detail[i].Nav_Users.sort((a, b) => { return a.ROW_NO > b.ROW_NO ? 1 : -1; }); } if (this.props.data && this.props.data.loadDataDeal) { this.props.data.loadDataDeal(1); } approveView(this, false); this.setState({ data: ret }); this.props.dispatch({ type: 'app/getDataByPost', url: 'HM/HazardTask/GetUserDealStatus', payload: { ID: this.props.data.id, }, onComplete: (result) => { if (result != null && this.props.data.TaskID != null) { if (result) { this.setState({ BtnSignDisplay: 'inline' }) } } } }) } } }); } 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") } onPersonalAgree() { this.props.dispatch({ type: 'app/getDataByPost', url: 'HM/HMHazardTask/UserSignin', payload: { ID: this.props.data.id, TaskID: this.props.data.TaskID, }, onComplete: (ret) => { if (ret) { message.success('确认成功!'); this.setState({ BtnSignDisplay: 'none' }) this.BtnClose(); } } }) } BtnClose = () => { if (typeof this.props.data.onCancel != "undefined" && typeof this.props.data.onCancel == 'function') this.props.data.onCancel(); } render() { const { data } = this.state; return
} content={() => this.componentRef} />
(this.componentRef = el)} id={'tableId' + this.props.data.id} style={{ padding: '20px' }}>

职业危害辨识任务制定表

{ data ?
{/* {data.CODE} */} {this.props.app.enums.FMDepartmentType.enums[data.LEVEL]} {data.Nav_LiableUser ? data.Nav_LiableUser.NAME : ''} {moment(data.START_TIME).format('YYYY-MM-DD') + '~' + moment(data.END_TIME).format('YYYY-MM-DD')} { data.Nav_Detail && data.Nav_Detail.map((item, i) => { if (i == (data.Nav_Detail.length - 1)) { return item.Nav_Area ? item.Nav_Area.NAME : '' } else { return item.Nav_Area.NAME + ' ' } }) } { showFiles(data?.Nav_Files, config.picServerHost, this) } { data.Nav_Detail && data.Nav_Detail.map((item, i) => { return }) }
辨识区域 职业危害名称 辨识人员 记录人
{item.Nav_Area?.NAME} { item.Nav_Identifyings && item.Nav_Identifyings.map((item1, i) => { if (i == (item.Nav_Identifyings.length - 1)) { return item1.Nav_Identifying.NAME } else { return item1.Nav_Identifying.NAME + ' ' } }) } { item.Nav_Users && item.Nav_Users.map((item1, i) => { if (i == (item1.Nav_User.length - 1)) { if (item1.DEAL_STATUS == 0) return else return item1.Nav_User.NAME } else { if (item1.DEAL_STATUS == 0) return else return item1.Nav_User.NAME + ' ' } }) } {item.Nav_User?.NAME}
: null }
{ GetFileModel(Modal, FormPage, this, this.state.fileForm.visible) }
} } export default connect(({ login, app }) => ({ login, app }))(HM101ShowPrint)