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, setDataFieldValue, extendIgnoreDataRule, guid, showFiles, GetFileModel } 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 FormPage from '../../../components/FormPage' class FO008ShowPrint 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); } 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: 'FO/FOPreOperSch/PersonalAgree', 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 json = initFilter(this.props.login.OrgId); json.Parameter22 = this.props.data.ORG_ID_HV; extendRule(json, 'ID', 1, dataId); extendInclude(json, 'Nav_User'); extendInclude(json, 'Nav_Department'); extendInclude(json, 'Nav_PreOperSchUser.Nav_RealDepartmentPost'); extendInclude(json, 'Nav_PreOperSchUser.Nav_User'); extendInclude(json, 'Nav_PreOperSchFile.Nav_ImgFile'); extendIgnoreDataRule(json) this.props.dispatch({ type: 'app/getDataByPost', payload: json, url: 'FO/PreOperSch/Get', onComplete: (ret) => { if (ret) { this.setState({ data: ret }) if (this.props.data.tableKey == "2" || this.props.data.tableKey == undefined) { this.setState({ BtnAgreeDisplay: 'none' }) } else { this.setState({ BtnAgreeDisplay: '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; return
} content={() => this.componentRef} pageStyle=".printDIV { padding:0 40px;} img{width :120px}" />
{/* 班前会议记录表 */}
(this.componentRef = el)} id={'tableId' + this.props.data.id} style={{ padding: '20px' }} className="printDIV">

作业方案讨论记录表

{ data ?
文件名称 {data.FILE_NAME} 发起时间 {data.LANUNCH_TIME ? moment(data.LANUNCH_TIME).format('YYYY-MM-DD') : null}
发起部门 {data.Nav_Department ? data.Nav_Department.NAME : ''} 发起人员 {data.Nav_User ? data.Nav_User.NAME : ''}
参与人员 { data.Nav_PreOperSchUser && data.Nav_PreOperSchUser.map((item, i) => { if (i == (data.Nav_PreOperSchUser.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 + ' ' } }) }
附件 { showFiles(data?.Nav_PreOperSchFile, config.picServerHost, this) }
讨论记录 {data.CONTENT}
电子签名 { data.Nav_PreOperSchUser && data.Nav_PreOperSchUser.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 }) => ({ login }))(FO008ShowPrint)