import { Button, Descriptions, Popconfirm, Row, Col, Form, Input, Select, Table } 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 '../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 HM042ShowPrint extends React.Component { constructor(props) { super(props); this.state = { data: null, BtnSignDisplay: 'none', isFinished: 'none', isAudit: 'none', tmpData: {}, DEALOPINION: '', }; }; //审批意见 改变 DEALOPINIONCHANGE = (val) => { this.state.DEALOPINION = val } componentDidMount() { if (this.props.data?.id) this.loadData(this.props.data?.id); } removeDuplicateObj(arr) { let obj = {}; arr = arr.reduce((newArr, next) => { obj[next.CHARGE_USER_ID] ? "" : (obj[next.CHARGE_USER_ID] = true && newArr.push(next)); return newArr; }, []); return arr; } componentWillReceiveProps(NextProps) { if (NextProps.data?.id && this.props.data?.id != NextProps.data?.id) { this.loadData(NextProps.data?.id); } } onChargeUserAgree(agree) { this.props.dispatch({ type: 'app/getDataByPost', url: 'HM/HMEvaluationPlan/ChargeUserAgree', payload: { ID: this.props.data.id, TaskID: this.props.data.TaskID, CHECK_STATUS: agree, AUDIT_OPINION: this.state.DEALOPINION }, onComplete: (ret) => { if (ret) { message.success('处理完成!'); this.setState({ isAudit: 'none' }) this.BtnClose(); } } }) } onPersonalAgree() { this.props.dispatch({ type: 'app/getDataByPost', url: 'HM/HMEvaluationPlan/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(); } loadData = (dataId) => { let json = initFilter(this.props.login.OrgId); extendRule(json, 'ID', 1, dataId); extendInclude(json, 'Nav_InitiatingDepartment'); extendInclude(json, 'Nav_ReleaseUser'); extendInclude(json, 'Nav_Details.Nav_ChargeUser'); extendInclude(json, 'Nav_Details.Nav_Areas.Nav_Area'); extendInclude(json, 'Nav_Details.Nav_Identifyings.Nav_Identifying'); extendInclude(json, 'Nav_Files.Nav_ImgFile.Nav_File'); extendInclude(json, 'Nav_GroupLeader.Nav_UserSignFiles.Nav_ImgFile.Nav_File'); extendInclude(json, 'Nav_DeputyGroupLeader.Nav_UserSignFiles.Nav_ImgFile.Nav_File'); this.props.dispatch({ type: 'app/getDataByPost', payload: json, url: 'HM/EvaluationPlan/Get', onComplete: (ret) => { if (ret) { if (this.props.data && this.props.data.loadDataDeal) { this.props.data.loadDataDeal(1); } this.onClickApprove(false); if (ret.STATUS >= 4) { this.state.isFinished = "inline"; } if (ret.STATUS == 2 && this.props.data.TaskID != null && ret.DEPUTY_GROUP_LEADER_OPINION == 0 && ret.GROUP_LEADER_OPINION == 0) { this.state.isAudit = "inline"; } this.setState({ data: ret }) if (ret.ID) { this.props.dispatch({ type: 'app/getDataByPost', url: 'HM/HMEvaluationPlan/GetEvaluationPlan', payload: { ID: this.props.data.id, }, onComplete: (result) => { if (result != null && this.props.data.TaskID != null) { if (result) { this.setState({ isAudit: 'inline' }) } } } }) this.props.dispatch({ type: 'app/getDataByPost', url: 'HM/HMEvaluationPlan/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") } onClickApprove = (appVisible) => { const newtmpData = { data: { id: this.props.data.id, isShow: true, key: guid(), appVisible: appVisible, BtnAgreeDisplay: 'inline' }, formCode: "PF123", } this.setState({ tmpData: newtmpData, }); } joinArea(data) { let ret = []; for (let it of data) { if (it.Nav_Area && it.Nav_Area.NAME) { ret.push(it.Nav_Area.NAME); } } return ret.join('、'); } joinIdentifying(data) { let ret = []; for (let it of data) { if (it.Nav_Identifying && it.Nav_Identifying.NAME) { ret.push(it.Nav_Identifying.NAME); } } return ret.join('、'); } renderLevel(level) { let str = ''; if (level == undefined) { return str; } if (level.indexOf('0') >= 0) { str += '部门 '; } if (level.indexOf('1') >= 0) { str += '车间 '; } if (level.indexOf('2') >= 0) { str += '班组 '; } if (level.indexOf('3') >= 0) { str += '公司 '; } return str; } render() { const { data } = this.state; return
} content={() => this.componentRef} />
(this.componentRef = el)} id={'tableId' + this.props.data.id} style={{ padding: '20px' }}>

年度风险评价计划审核表

{ data ?
{moment(data.EVALUATION_DATE).format('YYYY')} {data.DOCUMENT_NAME} {data.CREATE_TIME} {data.Nav_InitiatingDepartment ? data.Nav_InitiatingDepartment.NAME : ''} {data.Nav_ReleaseUser ? data.Nav_ReleaseUser.NAME : ''} {data.Nav_DeputyGroupLeader ? data.Nav_DeputyGroupLeader.NAME : ''} {data.Nav_GroupLeader ? data.Nav_GroupLeader.NAME : ''} { data.Nav_Details && data.Nav_Details.map((item, i) => { if (i == (data.Nav_Details.length - 1)) { if (item.DEAL_STATUS == 0) return else return item.Nav_ChargeUser ? item.Nav_ChargeUser.NAME : '' } else { if (item.DEAL_STATUS == 0) return else return item.Nav_ChargeUser ? item.Nav_ChargeUser.NAME + ' ' : '' } }) } {data.EVALUATION_CONTENT} { data.Nav_Files && data.Nav_Files.map((item, i) => { return {item.Nav_ImgFile.FILE_NAME} }) } { data.DEPUTY_GROUP_LEADER_OPINION != 0 ? this.props.app.enums.HMOpinionEnmu.enums[data.DEPUTY_GROUP_LEADER_OPINION] : ""} {data.DEPUTY_GROUP_LEADER_OPINION == 1 ? {data.Nav_DeputyGroupLeader.NAME} 0 ? config.picServerHost + data.Nav_DeputyGroupLeader.Nav_UserSignFiles[0].Nav_ImgFile?.Nav_File.FILE_PATH : ''} /> : ""} { data.GROUP_LEADER_OPINION != 0 ? this.props.app.enums.HMOpinionEnmu.enums[data.GROUP_LEADER_OPINION] : ""} {data.GROUP_LEADER_OPINION == 1 ? {data.Nav_GroupLeader.NAME} 0 ? config.picServerHost + data.Nav_GroupLeader.Nav_UserSignFiles[0].Nav_ImgFile?.Nav_File.FILE_PATH : ''} /> : ""} { data.Nav_Details && data.Nav_Details.map((item, i) => { return }) }
开始时间 结束时间 层级 辨识区域 类别 辨识对象 负责人 备注
{moment(item.START_TIME).format('YYYY-MM-DD')} {moment(item.END_TIME).format('YYYY-MM-DD')} {this.renderLevel(item.LEVEL)} {this.joinArea(item.Nav_Areas)} {this.joinIdentifying(item.Nav_Identifyings)} {this.props.app.enums.HMRiskTypeEnmu.enums[item.RISK_TYPE]} {item.Nav_ChargeUser?.NAME} {item.REMARK}


意见: this.DEALOPINIONCHANGE(evt.target.value)} />
: null }
} } export default connect(({ login, app }) => ({ login, app }))(HM042ShowPrint)