import { message } from "antd/lib/index"; import { Button, Popconfirm, Row, Col, Checkbox, Radio, Form, Input, Select, Table, Upload, Icon, PageHeader, Modal } from 'antd'; import React from 'react'; import { initFilter, extendRule, extendInclude, setDataFieldValue, guid, initQueryFilter } from "../../../utils/common"; import ReactToPrint from "react-to-print"; import styles from '../../CustomPages/HI/StepForm.css'; import XLSX from 'xlsx'; import { connect } from 'dva'; import moment from 'moment'; class SE005ShowPrint extends React.Component { constructor(props) { super(props); this.state = { safe: null, }; }; componentDidMount() { if (window.navigator.userAgent.indexOf("Windows") < 1) { this.setState({ isMobile: true }) } 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); } } BtnClose = () => { if (typeof this.props.data.onCancel != "undefined" && typeof this.props.data.onCancel == 'function') this.props.data.onCancel(); } loadData = () => { if (this.props.data.id == "") return; let json = initFilter(this.props.login.OrgId); json.Parameter22 = this.props.data.ORG_ID_HV; json.OrgType = 2; extendRule(json, 'ID', 1, this.props.data.id); extendInclude(json, 'Nav_LaunchDepartment'); extendInclude(json, 'Nav_LaunchUser'); extendInclude(json, 'Nav_Points'); extendInclude(json, 'Nav_Points.Nav_Point'); extendInclude(json, 'Nav_JoinDepartment'); extendInclude(json, 'Nav_JoinDepartment.Nav_Department'); json.IgnoreDataRule = true; this.props.dispatch({ type: 'app/getDataByPost', payload: json, url: 'SE/SafeSurvey/Get', onComplete: (ret) => { if (ret) { this.setState({ safe: ret }) } } }); } onTableBtnExport() { let TableWrap = document.getElementById('tableId' + this.props.data.id); let Table = TableWrap.getElementsByTagName('table')[0]; const wb = XLSX.utils.table_to_book(Table); let name = '安全意识调查问卷'; name += '.xlsx'; XLSX.writeFile(wb, name) } getJoinDepartment() { let arr = []; if (this.state.safe && this.state.safe.Nav_JoinDepartment) { for (let it of this.state.safe.Nav_JoinDepartment) { if (it.Nav_Department) { if (it.Nav_Department.NAME == "宁化行洛坑钨矿有限公司") { arr.push("公司领导") } else { arr.push(it.Nav_Department.NAME) } } } } return arr; } render() { const { safe } = this.state; return
} content={() => this.componentRef} />
(this.componentRef = el)} id={'tableId' + this.props.data.id} style={{ padding: '20px' }}>

安全意识调查问卷

调查名称 {safe ? safe.NAME : ''}
发起时间 {safe ? safe.LAUNCH_TIME : null} 发起部门 {safe ? safe.Nav_LaunchDepartment.NAME : ''} 发起人员 {safe ? safe.Nav_LaunchUser.NAME : ''} 截止时间 {safe ? moment(safe.END_TIME).format('YYYY-MM-DD') : ''}
参与人员 {this.getJoinDepartment().join('、')}
调查内容 {safe && safe.Nav_Points && safe.Nav_Points.map(it => it.Nav_Point.NAME).join('、')}
} } export default connect(({ login, app }) => ({ login, app }))(SE005ShowPrint)