2025-08-25 10:08:30 +08:00
|
|
|
import { message } from "antd/lib/index";
|
|
|
|
|
import { Button, Modal, Row, Col, Form, Input, Select, Table } from 'antd';
|
|
|
|
|
import React from 'react';
|
|
|
|
|
import { initFilter, extendRule, extendInclude, setDataFieldValue, guid, GetFileModel, showFiles } 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';
|
|
|
|
|
import config from "../../../config";
|
|
|
|
|
import FormPage from '../../FormPage'
|
|
|
|
|
|
|
|
|
|
const EduCardStatus = {
|
|
|
|
|
'草稿': 0,
|
|
|
|
|
'公司培训': 1,
|
|
|
|
|
'部门培训': 2,
|
|
|
|
|
'班组培训': 3,
|
|
|
|
|
'员工签到': 4,
|
|
|
|
|
'审阅中': 5,
|
|
|
|
|
'归档': 6,
|
|
|
|
|
}
|
|
|
|
|
class SE063ShowPrint extends React.Component {
|
|
|
|
|
constructor(props) {
|
|
|
|
|
super(props);
|
|
|
|
|
this.state = {
|
|
|
|
|
data: null,
|
|
|
|
|
CODE: "",
|
|
|
|
|
NAME: "",
|
|
|
|
|
ID_CARD_NUMBER: "",
|
|
|
|
|
IN_TIME: "",
|
|
|
|
|
depName: "",
|
|
|
|
|
POSTNAME: "",
|
|
|
|
|
fileData: [],
|
|
|
|
|
fileForm: {
|
|
|
|
|
title: "",
|
|
|
|
|
visible: false,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
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 = (dataId) => {
|
|
|
|
|
let json = initFilter(this.props.login.OrgId);
|
2025-12-22 15:33:31 +08:00
|
|
|
json.Parameter22 = this.props.data.ORG_ID_HV;
|
2025-08-25 10:08:30 +08:00
|
|
|
let userID = this.props.data.parentRecord.USER_ID;
|
|
|
|
|
extendRule(json, 'USERID', 1, userID);
|
|
|
|
|
json.IgnoreDataRule = true;
|
|
|
|
|
this.props.dispatch({
|
|
|
|
|
type: 'app/getDataByPost',
|
|
|
|
|
payload: json,
|
|
|
|
|
url: 'SE/SENewUserDetail/Get',
|
|
|
|
|
onComplete: (ret) => {
|
|
|
|
|
ret.sort((a, b) => { return a.Nav_NewUser.TRAIN_STATUS - b.Nav_NewUser.TRAIN_STATUS });
|
|
|
|
|
this.state.CODE = ret[ret.length - 1].CODE;
|
|
|
|
|
this.state.NAME = ret[ret.length - 1].Nav_User?.NAME;
|
|
|
|
|
this.state.ID_CARD_NUMBER = ret[ret.length - 1].ID_CARD_NUMBER;
|
|
|
|
|
this.state.IN_TIME = ret[ret.length - 1].IN_TIME;
|
|
|
|
|
this.state.depName = ret[ret.length - 1].Nav_Department?.NAME;
|
|
|
|
|
this.state.POSTNAME = ret[ret.length - 1].Nav_Post?.NAME;
|
|
|
|
|
this.setState({ data: ret })
|
|
|
|
|
// let top = ret.Nav_Department?.Nav_Parent?.Nav_Parent?.NAME;
|
|
|
|
|
// if (top != undefined) {
|
|
|
|
|
// this.state.depName = top + "/" + ret.Nav_Department?.Nav_Parent?.NAME + "/" + ret.Nav_Department?.NAME
|
|
|
|
|
// } else {
|
|
|
|
|
// this.state.depName = ret.Nav_Department?.Nav_Parent?.NAME + "/" + ret.Nav_Department?.NAME
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
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 = '';
|
|
|
|
|
if (this.state.data && this.state.data.CODE)
|
|
|
|
|
name += this.state.data.CODE
|
|
|
|
|
name += '三级安全教育卡.xlsx'
|
|
|
|
|
XLSX.writeFile(wb, name)
|
|
|
|
|
}
|
|
|
|
|
fmtEnum(name, value) {
|
|
|
|
|
const enums = this.props.app.enums;
|
|
|
|
|
if (!enums || !enums[name]) return '';
|
|
|
|
|
return enums[name].enums[value] || '';
|
|
|
|
|
}
|
|
|
|
|
returnModel(level) {
|
|
|
|
|
let str = '';
|
|
|
|
|
if (level == undefined) {
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
if (level.indexOf('1') >= 0) {
|
|
|
|
|
str += '讲授法 ';
|
|
|
|
|
}
|
|
|
|
|
if (level.indexOf('2') >= 0) {
|
|
|
|
|
str += '视听法 ';
|
|
|
|
|
}
|
|
|
|
|
if (level.indexOf('3') >= 0) {
|
|
|
|
|
str += '研讨法 ';
|
|
|
|
|
}
|
|
|
|
|
if (level.indexOf('4') >= 0) {
|
|
|
|
|
str += '演示法 ';
|
|
|
|
|
}
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
render() {
|
|
|
|
|
const { data } = this.state;
|
|
|
|
|
|
|
|
|
|
return <div>
|
|
|
|
|
<div style={{ padding: '10px' }}>
|
|
|
|
|
<ReactToPrint
|
|
|
|
|
trigger={() => <Button type={'primary'} icon={'printer'} >打印</Button>}
|
|
|
|
|
content={() => this.componentRef}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div ref={el => (this.componentRef = el)} id={'tableId' + this.props.data.id}>
|
|
|
|
|
<h1 style={{ textAlign: 'center' }}>三级安全教育卡</h1>
|
|
|
|
|
{
|
|
|
|
|
data ? <table style={{ width: '100%', textAlign: 'center', borderTop: '1px solid #333', borderLeft: '1px solid #333' }} className={styles.PrintForm}>
|
|
|
|
|
<tbody>
|
|
|
|
|
<tr>
|
|
|
|
|
<td colSpan={2} rowSpan={1} className={styles.fontBold}>工号</td>
|
|
|
|
|
<td colSpan={5} rowSpan={1}>{this.state.CODE}</td>
|
|
|
|
|
<td colSpan={2} rowSpan={1} className={styles.fontBold}>姓名</td>
|
|
|
|
|
<td colSpan={5} rowSpan={1}>{this.state.NAME}</td>
|
|
|
|
|
<td colSpan={2} rowSpan={1} className={styles.fontBold}>身份证号</td>
|
|
|
|
|
<td colSpan={5} rowSpan={1}>{this.state.ID_CARD_NUMBER}</td>
|
|
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td colSpan={2} rowSpan={1} className={styles.fontBold}>入职时间</td>
|
|
|
|
|
<td colSpan={5} rowSpan={1}>{moment(this.state.IN_TIME).format('YYYY-MM-DD')}</td>
|
|
|
|
|
<td colSpan={2} rowSpan={1} className={styles.fontBold}>部门</td>
|
|
|
|
|
<td colSpan={5} rowSpan={1}>{this.state.depName}</td>
|
|
|
|
|
<td colSpan={2} rowSpan={1} className={styles.fontBold}>岗位</td>
|
|
|
|
|
<td colSpan={5} rowSpan={1}>{this.state.POSTNAME}</td>
|
|
|
|
|
</tr>
|
|
|
|
|
{
|
|
|
|
|
data && data.map(it => {
|
|
|
|
|
return <>
|
|
|
|
|
<tr>
|
|
|
|
|
<td colSpan={21} rowSpan={1} className={styles.fontBold}>
|
|
|
|
|
{
|
|
|
|
|
this.fmtEnum('SEThreeLevelSafeTrainType', it.Nav_NewUser.TRAIN_STATUS)
|
|
|
|
|
}
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td colSpan={2} rowSpan={1} className={styles.fontBold}>开始时间</td>
|
|
|
|
|
<td colSpan={2} rowSpan={1}>{moment(it.Nav_NewUser.START_TIME).format('YYYY-MM-DD')}</td>
|
|
|
|
|
<td colSpan={2} rowSpan={1} className={styles.fontBold}>结束时间</td>
|
|
|
|
|
<td colSpan={2} rowSpan={1}>{moment(it.Nav_NewUser.END_TIME).format('YYYY-MM-DD')}</td>
|
|
|
|
|
<td colSpan={2} rowSpan={1} className={styles.fontBold}>培训地点</td>
|
|
|
|
|
<td colSpan={2} rowSpan={1}>{it.Nav_NewUser.TAINNING_ADDR}</td>
|
|
|
|
|
<td colSpan={2} rowSpan={1} className={styles.fontBold}>组织部门</td>
|
|
|
|
|
<td colSpan={2} rowSpan={1}>{it.Nav_NewUser.Nav_Department ? it.Nav_NewUser.Nav_Department.NAME : null}</td>
|
|
|
|
|
<td colSpan={2} rowSpan={1} className={styles.fontBold}>记录人</td>
|
|
|
|
|
<td colSpan={3} rowSpan={1}>{it.Nav_NewUser.Nav_User ? it.Nav_NewUser.Nav_User.NAME : null}</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td colSpan={2} rowSpan={1} className={styles.fontBold}>培训学时</td>
|
|
|
|
|
<td colSpan={2} rowSpan={1}>{it.Nav_NewUser.TRAINNING_TIME}</td>
|
|
|
|
|
|
|
|
|
|
<td colSpan={2} rowSpan={1} className={styles.fontBold}>培训老师</td>
|
|
|
|
|
<td colSpan={2} rowSpan={1}>{it.Nav_NewUser.TEACHER}</td>
|
|
|
|
|
|
|
|
|
|
<td colSpan={2} rowSpan={1} className={styles.fontBold}>培训形式</td>
|
|
|
|
|
<td colSpan={2} rowSpan={1}>{this.returnModel(it.Nav_NewUser.TRAIN_MODEL)}</td>
|
|
|
|
|
|
|
|
|
|
<td colSpan={2} rowSpan={1} className={styles.fontBold}>考核结果</td>
|
|
|
|
|
<td colSpan={2} rowSpan={1}>{this.fmtEnum('SEExaminationResultsEnum', it.EXAMINATION_RESULTS)}</td>
|
|
|
|
|
<td colSpan={2} rowSpan={1} className={styles.fontBold}>考核分数</td>
|
|
|
|
|
<td colSpan={3} rowSpan={1}>{it.SCORE}</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td colSpan={2} rowSpan={1} className={styles.fontBold}>培训内容</td>
|
|
|
|
|
<td colSpan={19} rowSpan={1} className={styles.fontBold}>
|
|
|
|
|
{it.Nav_NewUser.Nav_Content.NAME}
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td colSpan={2} rowSpan={1} className={styles.fontBold}>签名</td>
|
|
|
|
|
<td colSpan={19} rowSpan={1} >
|
|
|
|
|
{
|
2025-11-23 17:52:02 +08:00
|
|
|
it.Nav_User && it.Nav_User.FILE_PATH && it.Nav_User.FILE_PATH.length > 0 && it.STATUS == 1 ? <img width={'150px'} alt={it.Nav_User.NAME} src={config.picServerHost + it.Nav_User?.FILE_PATH} /> : <img width={'150px'} alt={it.Nav_User.NAME} />
|
2025-08-25 10:08:30 +08:00
|
|
|
}
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td colSpan={2} rowSpan={1} className={styles.fontBold}>附件</td>
|
|
|
|
|
<td colSpan={19} rowSpan={1}>
|
|
|
|
|
{
|
|
|
|
|
showFiles((it.Nav_NewUser.Nav_Files != null && it.Nav_NewUser.Nav_Files.length > 0 ? (it.Nav_NewUser.Nav_Files.concat(it.Nav_Files)) : it.Nav_Files), config.picServerHost, this)
|
|
|
|
|
}
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</>
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
</tbody>
|
|
|
|
|
</table> : null
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
{
|
|
|
|
|
GetFileModel(Modal, FormPage, this, this.state.fileForm.visible)
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default connect(({ login, app }) => ({ login, app }))(SE063ShowPrint)
|