import { Button, Descriptions, Popconfirm, Row, Col, Form, Modal, Input, Select, Table } from 'antd'; import React from 'react'; import { initFilter, extendRule, extendInclude, extendIgnoreDataRule, setDataFieldValue, guid, showFiles, GetFileModel, approveView } from "../../../utils/common"; import ReactToPrint from "react-to-print"; import styles from '../HI/StepForm.css'; import config from "../../../config"; import XLSX from 'xlsx'; import { connect } from 'dva'; import moment from 'moment'; import { message } from "antd/lib/index"; import FormPage from '../../../components/FormPage' class HM104ShowPrint extends React.Component { constructor(props) { super(props); this.state = { data: null, BtnAgreeDisplay: 'none', tmpData: {}, 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); } } onTableBtnAgree() { this.props.dispatch({ type: 'app/getDataByPost', url: 'HM/HMJobtaskIdentify/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) => { let that = this; let json = initFilter(that.props.login.OrgId); json.Parameter22 = this.props.data.ORG_ID_HV; extendRule(json, 'ID', 1, dataId); extendIgnoreDataRule(json) that.props.dispatch({ type: 'app/getDataByPost', payload: json, url: 'HM/HMJobtaskIdentify/GetEdit', onComplete: (ret) => { if (ret) { if (that.props.data && that.props.data.loadDataDeal) { that.props.data.loadDataDeal(1); } that.setState({ data: ret }); if (that.props.data.tableKey === "2" || that.props.data.tableKey === undefined) { that.setState({ BtnAgreeDisplay: 'none' }) } else { that.setState({ BtnAgreeDisplay: 'inline' }) } approveView(this, 'inline', false); //归档才显示打印和导出按钮 // if(ret.PRE_MEETING_STATUS==5){ // this.setState({ isFinished: 'inline' }) // } } 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") } render() { const { data } = this.state; const enums = this.props.data.enums ? this.props.data.enums : this.props.app.enums; // let aaa = Math.random(); return
} content={() => this.componentRef} pageStyle=".printDIV { padding:0 40px;} img{width :120px}" />
(this.componentRef = el)} style={{ padding: '20px' }} id={'tableId' + this.props.data.id} className="printDIV">

作业任务识别表

{ data ? {/* */} {/* */} { data.Nav_Details && data.Nav_Details.map((item, i) => { return {/* */} }) } {/* }) } */} }) }
编号 {data.CODE} 发起人员 {data.Nav_CreateUser ? data.Nav_CreateUser.NAME : ''}
发起时间 {data.CREATE_TIME ? moment(data.CREATE_TIME).format('YYYY-MM-DD') : null} 完成时间 {data.COMPLETE_DATE ? moment(data.COMPLETE_DATE).format('YYYY-MM-DD') : null}
识别部门 {data.Nav_CreateUser.Nav_Department ? data.Nav_CreateUser.Nav_Department.NAME : ''} 识别人员 { data.Nav_IdentifyUser && data.Nav_IdentifyUser.map((item, i) => { if (i == (data.Nav_IdentifyUser.length - 1)) { if (item.DEAL_STATUS == 0) return else return item.Nav_User.NAME } else { if (item.DEAL_STATUS == 0) return else return item.Nav_User.NAME + ' ' } }) }
序号辨识区域任务名称 作业周期 岗位涉及风险
{i + 1} {item.Nav_Area?.NAME} {item.Nav_OperationStep?.NAME} {enums.HMCycleTypeEnum.enums[item.CYCLE_TYPE]} { item.Nav_DetailPost && item.Nav_DetailPost.map((item, i) => { return
{ item.Nav_DetailRisk && item.Nav_DetailRisk.map((item, i) => { return
附件 { showFiles(data?.Nav_Files, config.picServerHost, this) }
识别人员签名 { data.Nav_IdentifyUser && data.Nav_IdentifyUser.map((item, i) => { if (item.DEAL_STATUS == 1) { if (item.Nav_User != null && item.Nav_User.FILE_PATH != null) return {item.Nav_User?.NAME} else return } }) }
: null }
{ GetFileModel(Modal, FormPage, this, this.state.fileForm.visible) }
} } export default connect(({ login, app }) => ({ login, app }))(HM104ShowPrint)