mh_jy_safe_web/src/components/CustomPages/SE/SE071ShowPrint.js
wyw 442fccbc36 1、年度培训计划 添加 接收角色
2、部门培训计划 添加 触发日期 培训角色
2026-04-10 16:38:14 +08:00

190 lines
9.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { Button, Descriptions, Modal, Badge, Popconfirm, Row, Col, Form, Input, Select, Table } from 'antd';
import React from 'react';
import { initFilter, extendRule, extendInclude, setDataFieldValue, showApprove, guid, initQueryFilter, ShowDateTime, ShowPrintClose, GetFileModel, showFiles } from '../../../utils/common';
import ReactToPrint from 'react-to-print';
import { ExportToExcel } from '@woowalker/feui'
import XLSX from 'xlsx';
import { connect } from 'dva';
import moment from 'moment';
import { message } from 'antd/lib/index';
import styles from '../../../components/CustomPages/HI/StepForm.css';
import config from '../../../config.js';
import FormPage from '../../FormPage'
class SE071ShowPrint extends React.Component {
constructor(props) {
super(props);
this.state = {
data: null,
btndisplay: 'none',
isCheck: false, //是否待办 审批
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);
}
}
onTableBtnExport() {
let TableWrap = document.getElementById('table1');
let Table = TableWrap.getElementsByTagName('table1')[0];
const wb = XLSX.utils.table_to_book(Table);
XLSX.writeFile(wb, this.props.record.Nav_Department.NAME + '.xlsx')
}
onClickApprove = (appVisible) => {
const newtmpData = {
data: { id: this.props.data.id, isShow: true, key: guid(), param: this.props.data.param, appVisible: appVisible, BtnAgreeDisplay: 'none' },
formCode: 'PF123',
}
this.setState({
tmpData: newtmpData,
});
}
loadData = (id) => {
var isCheck = (this.props.data.tableKey != undefined && this.props.data.tableKey == '1') ? true : false
var orgId = this.props.login ? this.props.login.OrgId : '';
let json = initFilter(orgId);
json.Parameter22 = this.props.data.ORG_ID_HV;
extendRule(json, 'ID', 1, id);
extendInclude(json, 'Nav_Department')
extendInclude(json, 'Nav_User')
extendInclude(json, 'Nav_Files.Nav_ImgFile.Nav_File')
extendInclude(json, 'Nav_ListPlanDetail.Nav_Department')
extendInclude(json, 'Nav_ListPlanDetail.Nav_ListDetailDepartment.Nav_Department')
extendInclude(json, 'Nav_ListPlanDetail.Nav_TrainTypeEnum')
extendInclude(json, 'Nav_ListPlanDetail.Nav_ApproveRole')
extendInclude(json, "Nav_Approve.Nav_ApproveDetails.Nav_ApproveUser");
this.props.dispatch({
type: 'app/getDataByPost',
payload: json,
url: 'SE/SETrainPlan/GetSuit',
onComplete: (ret) => {
if (ret) {
this.setState({
data: ret,
})
}
}
});
}
render() {
const { data } = this.state;
const enums = this.props.data.enums ? this.props.data.enums : this.props.app.enums;
return <div>
<div style={{ padding: '10px' }}>
<table>
<tr>
<td><Button onClick={() => this.onClickApprove(true)} style={{ marginRight: '8px' }} icon='export'>审批详情</Button></td>
<td><ReactToPrint trigger={() => <Button type={'default'} icon={'printer'} >打印</Button>} content={() => this.componentRef} /></td>
<td><ExportToExcel fileName='年度培训计划' tableId={'tableId' + this.props.data.id} /></td>
</tr>
</table>
</div>
<FormPage {...this.state.tmpData} />
<div ref={el => (this.componentRef = el)} style={{ padding: '20px', paddingTop: '20px' }} id={'tableId' + this.props.data.id}>
<h1 className={styles.showPrintHead}>年度培训计划</h1>
{
data ? <div>
<Descriptions title='' size='middle' bordered>
<Descriptions.Item label="计划年度">{data.YEAR}</Descriptions.Item>
<Descriptions.Item label="发起时间">{data.LAUNCH_TIME}</Descriptions.Item>
<Descriptions.Item label="发起部门">{data.Nav_Department.NAME}</Descriptions.Item>
<Descriptions.Item label="发起人员">{data.Nav_User?.NAME}</Descriptions.Item>
<Descriptions.Item label="计划名称">{data.PLAN_NAME}</Descriptions.Item>
<Descriptions.Item label="附件">{showFiles(data.Nav_Files, config.picServerHost, this)}</Descriptions.Item>
{
data.TYPE == 5 ?
<Descriptions.Item label="指导原则">{data.GUIDE_PRINCIPLE}</Descriptions.Item>
: null
}
{
data.TYPE == 5 ?
<Descriptions.Item label="培训要求">{data.TRAIN_REQUIREMENT}</Descriptions.Item>
: null
}
</Descriptions>
</div> : null
}
{
(data?.Nav_ListPlanDetail && data?.Nav_ListPlanDetail.length > 0) ?
<table className={styles.PrintFormLight}>
<tbody>
<tr>
<td colSpan={11} className={styles.showPrintHead2}>年度培训计划详情</td>
</tr>
<tr className={styles.PrintFormLightTh}>
<td>月份</td>
<td>触发日期</td>
<td>培训性质</td>
<td>培训类型</td>
<td>培训名称</td>
<td>培训对象</td>
<td>培训形式</td>
<td>考核方式</td>
<td>培训学时</td>
<td>培训组织</td>
<td>培训角色</td>
{/* <td>培训老师</td> */}
{
data.TYPE != 5 ?
<td>被培训组织</td>
: null
}
</tr>
{data?.Nav_ListPlanDetail?.map((item, i) => {
return <tr>
<td>{item.MONTH} </td>
<td>{item.DATE_TRAIN?.split(' ')[0]} </td>
<td>{enums.TrainInOut.enums[item.IN_OUT]} </td>
<td>{item.Nav_TrainTypeEnum.NAME} </td>
<td>{item.NAME} </td>
<td>{item.OBJECT} </td>
<td>{enums.TrainType.enums[item.TRAINTYPE]} </td>
<td>{enums.PlanCheckType.enums[item.CHECKTYPE]} </td>
<td>{item.CLASSHOUR} </td>
<td>{item.Nav_Department.NAME} </td>
<td>{item.Nav_ApproveRole?.NAME} </td>
{
data.TYPE != 5 ?
<td>{item.Nav_ListDetailDepartment?.map((itemtype, j) => { return (j > 0 ? '' : '') + itemtype.Nav_Department.NAME })}</td>
: null
}
</tr>
})}
<tr>
<td>审批详情</td> {/* 审核意见 如果已经审批 显示审批信息 */}
<td colSpan={11} style={{ textAlign: "left" }}>
{
showApprove(data.Nav_Approve?.Nav_ApproveDetails, enums.NodeApproveStatus.enums, config.picServerHost, 200)
}
</td>
</tr>
</tbody>
</table>
: null
}
</div>
{
GetFileModel(Modal, FormPage, this, this.state.fileForm.visible)
}
</div>
}
}
export default connect(({ login, app }) => ({ login, app }))(SE071ShowPrint)