mh_jy_safe_web/src/components/CustomPages/SC/SC030ShowPrintPer.js
2025-08-25 10:08:30 +08:00

304 lines
15 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 { Checkbox, message, Radio } from "antd/lib/index";
import { Button, Descriptions, Modal, Popconfirm, Row, Col, Form, Input, Select, Table } from 'antd';
import React from 'react';
import { initFilter, extendRule, extendInclude, extendIgnoreDataRule, setDataFieldValue, guid, GetFileModel, showFiles, showApprove, showUserSign } from "../../../utils/common";
import { ExportToExcel } from '@woowalker/feui'
import styles from '../HI/StepForm.css';
import ReactToPrint from "react-to-print";
import moment from 'moment';
import config from "../../../config.js";
import XLSX from 'xlsx';
import { connect } from 'dva';
import FormPage from '../../../components/FormPage'
class SC030ShowPrintPer extends React.Component {
constructor(props) {
super(props);
this.state = {
data: null,
item: null,
btndisplay: 'none',
isTaskSign: false, //是否待办 审批
JOINRESULT: 0, //10 参加 20 请假
NOTJOINREASON: '',//请假原因
fileData: [],
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' + this.props.record.ID);
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,
});
}
//审批意见 改变
NOTJOINREASONCHANGE = (val) => {
this.state.NOTJOINREASON = val
}
//请假/参加
sign = () => {
let json = initFilter(this.props.login.OrgId, this.props.data.id, null, null, null, this.props.data.TaskID);
extendIgnoreDataRule(json)
this.props.dispatch({
type: 'app/getDataByPost',
payload: json,
url: 'SC/SCMtMeetingMinutes/MeetingMinutesSign',
onComplete: (ret) => {
if (ret) {
this.props.data.onCancel();
}
}
});
}
//请假/参加
sureCheck = (val) => {
if (val && val == 20 && (this.state.NOTJOINREASON == undefined || this.state.NOTJOINREASON == null || this.state.NOTJOINREASON.length < 1)) {
message.error("请填写请假备注!");
return false
}
let json = initFilter(this.props.login.OrgId, this.props.data.id, null, null, null, this.props.data.TaskID, val, this.state.NOTJOINREASON);
extendIgnoreDataRule(json)
this.props.dispatch({
type: 'app/getDataByPost',
payload: json,
url: 'SC/SCMTMeeting/PAllCheck',
onComplete: (ret) => {
if (ret) {
this.props.data.onCancel();
}
}
});
}
//加载数据(传过来的参数都在props里面包括登录信息)
loadData = (id) => {
var taskID = this.props.data.TaskID
var loginID = this.props.login.user.ID
var orgId = this.props.login ? this.props.login.OrgId : ''; //登录后有存储登录信息
let json = initFilter(orgId);
extendRule(json, 'ID', 1, id); //ID=‘’,字段,等于,条件值, 1代表=2代表不等于3小于4小于等于5大于6大于等于7以开始的Like,8以结束的Like9包含
extendInclude(json, 'Nav_Meeting');
extendInclude(json, 'Nav_ListPReview.Nav_User');
extendInclude(json, 'Nav_ListMinutesDetail.Nav_UserDeal');
extendInclude(json, 'Nav_ListMinutesDetail.Nav_DepartmentDeal');
extendInclude(json, 'Nav_ListMinutesDetail.Nav_Files.Nav_ImgFile');
extendInclude(json, 'Nav_Meeting.Nav_Department');
extendInclude(json, 'Nav_Meeting.Nav_UserHost');
extendInclude(json, 'Nav_Meeting.Nav_UserRecorder');
extendInclude(json, 'Nav_ListPAskForLeave.Nav_User');
extendInclude(json, 'Nav_ListPAbsence.Nav_User');
extendInclude(json, 'Nav_ListPJoin.Nav_User.Nav_Person.Nav_Post');
extendInclude(json, 'Nav_ListPJoin.Nav_User.Nav_Department.Nav_Parent');
extendInclude(json, 'Nav_ListPJoin.Nav_User');
extendInclude(json, 'Nav_Approve.Nav_ApproveDetails.Nav_ApproveUser');
extendIgnoreDataRule(json)
let attendanceAry = [], leaveAry = [];
let that = this;
let btndisplay = 'none';
this.props.dispatch({
type: 'app/getDataByPost',
payload: json,
// url: 'SC/MtMeetingMinutes/Get',
url: 'SC/SCMtMeetingMinutes/GetByDetailDeal',
onComplete: (ret) => { //返回查询结果ret
if (ret) { //判断是否有记录
var isTaskSign = false
if (ret.STATUS == 10 && taskID != undefined && taskID.length > 0) {
for (let i = 0; i < ret.Nav_ListPJoin.length; i++) {
if (ret.Nav_ListPJoin[i].USER_ID == loginID && ret.Nav_ListPJoin[i].ISRECORDRED == false) {
isTaskSign = true
break
}
}
// debugger
// if (!isTaskSign && ret.Nav_ListPReview != null && ret.Nav_ListPReview.length > 0) {
// for (let i = 0; i < ret.Nav_ListPReview.length; i++) {
// if (ret.Nav_ListPReview[i].USER_ID == loginID && ret.Nav_ListPReview[i].ISRECORDRED == false) {
// isTaskSign = true
// break
// }
// }
// }
}
this.setState({ //设置setState全局变量
data: ret, //将ret对象赋值给data, data供页面调用
isTaskSign: isTaskSign,// isTaskSign//有taskID 状态 审核完成 登陆者 属于参会人
})
}
}
});
}
//渲染页面
render() {
const { data, isTaskSign } = this.state;
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} pageStyle={"#tableId" + this.props.data.id + " { padding:0 40px;} img{width :120px}"} /></td>
<td><ExportToExcel fileName='会议纪要' tableId={'tableId' + this.props.data.id} /></td>
{isTaskSign ? <td><Button className={styles.sign} type={'primary'} icon={'check'} onClick={() => this.sign()} >签到</Button></td> : null}
</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 style={{ textAlign: 'center', margin: '15px' }}>会议纪要</h1>
{
data ? <div>
<Descriptions title="" size="middle" bordered>
<Descriptions.Item label="会议主题">{data.Nav_Meeting.THEME}</Descriptions.Item>
<Descriptions.Item label="会议编号">{data.Nav_Meeting.CODE}</Descriptions.Item>
<Descriptions.Item label="会议时间">{data.Nav_Meeting.BEGIN_TIME}</Descriptions.Item>
<Descriptions.Item label="会议地点">{data.Nav_Meeting.ADDRESS}</Descriptions.Item>
<Descriptions.Item label="发起部门">{data.Nav_Meeting.Nav_Department.NAME}</Descriptions.Item>
<Descriptions.Item label="主持人">{data.Nav_Meeting.Nav_UserHost.NAME}</Descriptions.Item>
<Descriptions.Item label="记录人">{data.Nav_Meeting.Nav_UserRecorder.NAME}</Descriptions.Item>
<Descriptions.Item label="请假人员">{
data?.Nav_ListPAskForLeave.map((item, i) => {
return (i > 0 ? "" : "") + item.Nav_User.NAME
})
}</Descriptions.Item>
<Descriptions.Item label="缺席人员">{data?.Nav_ListPAbsence.map((item, i) => {
return (i > 0 ? "" : "") + item.Nav_User.NAME
})
}</Descriptions.Item>
<Descriptions.Item label="参会人员">{data?.Nav_ListPJoin.map((item, i) => {
return (<a style={{ color: (item.ISRECORDRED ? "black" : "red") }}> {(i > 0 ? "" : "") + item.Nav_User.NAME}</a>)
})
}</Descriptions.Item>
{
data.Nav_Meeting.MEETINGTYPE == 20 ?
<Descriptions.Item label="审核意见" span={3} >{data.RESOLUTION}</Descriptions.Item>
: (
data.Nav_Meeting.MEETINGTYPE == 30 ?
<Descriptions.Item label="评审意见" span={3} >{data.RESOLUTION}</Descriptions.Item>
: (
data.Nav_Meeting.MEETINGTYPE == 10 ?
<Descriptions.Item label="会议决议" span={3} >{data.RESOLUTION}</Descriptions.Item>
: null
)
)
}
<Descriptions.Item label="会议记录">{data.MEETINGRECORD}</Descriptions.Item>
<Descriptions.Item label="审阅意见">{
showApprove(data.Nav_Approve?.Nav_ApproveDetails, this.props.app.enums.NodeApproveStatus.enums, config.picServerHost, 100, 65)
}</Descriptions.Item>
</Descriptions>
</div> : null
}
{/* 会议决议 */}
{data?.Nav_ListMinutesDetail ?
<table className={styles.PrintFormLight} >
<tbody>
<tr className={styles.showPrintHead2} >
<td colSpan={9}><h3>会议决议</h3></td>
</tr>
<tr className={styles.PrintFormLightTh}>
<td>会议决议</td>
<td>是否需要落实</td>
<td>落实部门</td> {/*部门/车间 班组人员归到车间 */}
<td>落实责任人</td>
<td>责任人意见</td>
<td>落实情况反馈</td>
<td>落实期限</td>
<td>落实效果</td>
<td>附件</td>
</tr>
{data?.Nav_ListMinutesDetail.map((item, i) => {
return <tr>
<td>{item.RESOLUTION}</td>
<td>{item.ISNEEDDEAL ? "是" : "否"}</td>
<td>{item?.Nav_DepartmentDeal?.NAME}</td> {/*部门/车间 班组人员归到车间 */}
<td>{item?.Nav_UserDeal?.NAME}</td>
<td>{item.OPINION}</td>
<td>{item.DEALBACK}</td>
<td>{item.LIMITDATETIME?.split(' ')[0]}</td>
<td>{item.DEALEFFECT ? this.props.app.enums.DEALEFFECT.enums[item.DEALEFFECT] : ""}</td>
<td>{showFiles(item.Nav_Files, config.picServerHost, this)}</td>
</tr>
})}
</tbody>
</table> : null
}
{/* 会议签到表 */}
{
data?.Nav_ListPJoin ?
<table className={styles.PrintFormLight} >
<tbody>
<tr className={styles.showPrintHead2} >
<td colSpan={5}><h3>会议签到表</h3></td>
</tr>
<tr className={styles.PrintFormLightTh}>
<td>序号</td>
<td>部门/车间</td> {/*部门/车间 班组人员归到车间 */}
<td>姓名</td>
<td>岗位</td>
<td>电子签名</td>
</tr>
{data?.Nav_ListPJoin.map((item, i) => {
return <tr>
<td>{(i + 1)}</td>
<td>{item.Nav_User.Nav_Department.DEPARTMENT_TYPE == 2 ? item.Nav_User.Nav_Department.Nav_Parent.NAME : item.Nav_User.Nav_Department.NAME}</td>
<td>{item.Nav_User.NAME}</td>
<td>{item.Nav_User.Nav_Person?.Nav_Post?.NAME}</td>
<td> {
item.ISRECORDRED ?
showUserSign(item.Nav_User, config.picServerHost, 100, 30)
: null
}</td>
</tr>
})}
</tbody>
</table> : null
}
</div>
{
GetFileModel(Modal, FormPage, this, this.state.fileForm.visible)
}
</div>
}
}
export default connect(({ login, app }) => ({ login, app }))(SC030ShowPrintPer)