import { message } from "antd/lib/index"; import { Button, Descriptions, Badge, Popconfirm, Row, Col, Form, Input, Select, Modal } from 'antd'; import React from 'react'; import { initFilter, extendRule, extendInclude, setDataFieldValue, guid, showFiles, GetFileModel, onBeforeSaveHandleRecordLog } 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 FoTeamActivityShowPrint extends React.Component { constructor(props) { super(props); this.state = { data: null, item: null, enumData: null, btndisplay: 'none', readDisplay: 'none', isFinished: 'none', isMobile: false, 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); } } 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.state.data.Nav_Taem?.NAME + ".xlsx") } onTableBtnAgree() { onBeforeSaveHandleRecordLog(this.props, 'FO010', 'FO010_onTableBtnAgree') this.props.dispatch({ type: 'app/getDataByPost', url: 'FO/FOTeamActivity/TeamActivityUserUpdate', payload: { ID: this.props.data.id, //ORG_ID: this.props.data.OrgId, TaskID: this.props.data.TaskID, //传参到后端(消息表ID) }, onComplete: (ret) => { if (ret) { message.success('签到成功!'); this.BtnClose(); } } }) } onTableBtnRead() { onBeforeSaveHandleRecordLog(this.props, 'FO010', 'FO010_onTableBtnRead') this.props.dispatch({ type: 'app/getDataByPost', url: 'FO/FOTeamActivity/TeamActivityUserRead', payload: { ID: this.props.data.id, TaskID: this.props.data.TaskID, //传参到后端(消息表ID) }, onComplete: (ret) => { if (ret) { message.success('已阅成功!'); this.BtnClose(); } } }) } BtnClose = () => { if (typeof this.props.data.onCancel != "undefined" && typeof this.props.data.onCancel == 'function') this.props.data.onCancel(); } //加载数据(传过来的参数都在props里面,包括登录信息) loadData = (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以结束的Like,9包含 extendInclude(json, 'Nav_Taem'); extendInclude(json, 'Nav_User'); extendInclude(json, 'Nav_MainUser'); extendInclude(json, 'Nav_TeamActivityUser.Nav_User'); extendInclude(json, 'Nav_TeamActivityUser.Nav_User.Nav_Person.Nav_Post'); extendInclude(json, 'Nav_TeamActivityFile.Nav_ImgFile'); json.IgnoreDataRule = true; let attendanceAry = [], leaveAry = []; let that = this; let btndisplay = 'none'; this.state.readDisplay = 'none'; this.props.dispatch({ type: 'app/getDataByPost', payload: json, url: 'FO/TeamActivity/Get', onComplete: (ret) => { //返回查询结果ret if (ret) { //判断是否有记录 //data?.Nav_TeamActivityUser.map(item => { //当data有值时遍历(map)data记录集 ret?.Nav_TeamActivityUser.forEach(item => { //当data有值时遍历(forEach)data记录集 if (item.ATTEND_STATUS === 1) { //参会人员 attendanceAry.push(item.Nav_User.NAME); //将人员添加到attendanceAry数组 } else if (item.ATTEND_STATUS === 2) { //缺席人员, leaveAry.push(item.Nav_User.NAME); //将人员添加到attendanceAry数组 } //if (item.Nav_User.ID.toLowerCase() == that.props.login.userId.toLowerCase() && item.TA_STATUS===1 && item.ATTEND_STATUS === 1 && item.SIGN_IN_STATUS === 0) { if (item.Nav_User.ID.toLowerCase() == that.props.login.userId.toLowerCase() && item.ATTEND_STATUS === 1 && item.SIGN_IN_STATUS === 0 || !(this.props.data.tableKey == "2" || this.props.data.tableKey == undefined)) { btndisplay = 'inline'; //签到按扭显示变量 } if (item.Nav_User.ID.toLowerCase() == that.props.login.userId.toLowerCase() && item.ATTEND_STATUS === 2) { this.state.readDisplay = 'inline'; } }) this.setState({ //设置setState全局变量 data: ret, //将ret对象赋值给data, data供页面调用 attendance: attendanceAry, leave: leaveAry, btndisplay: btndisplay }) if (ret.TA_STATUS == 2) { this.setState({ isFinished: 'inline' }) } } else { message.error('数据加载获取失败,请联系管理员排查!'); } } }); } //渲染页面 render() { const { data, isMobile } = this.state; return
} content={() => this.componentRef} pageStyle=".printDIV { padding:0 40px;} img{width :120px}" />
{/* 班组安全活动记录表 */}
(this.componentRef = el)} style={{ padding: isMobile ? '0px 0px 20px 0px' : '20px' }} id={'tableId' + this.props.id}>

班组安全活动记录表

{ data ?
{ data.Nav_TeamActivityUser.map((item, index) => { return }) }
活动主题 {data.TITLE} 活动日期 {moment(data.ACTIVITY_TIME).format('YYYY-MM-DD')} 活动地点 {data.ADDRESS}
班组名称 {data.Nav_Taem ? data.Nav_Taem.NAME : ''} 主持人 {data.Nav_MainUser ? data.Nav_MainUser.NAME : ''} 记录人 {data.Nav_User ? data.Nav_User.NAME : ''}
活动时长 {data.DURATION}
活动记录 {data.ACTIVITY_CONTENT}
附件 { showFiles(data?.Nav_TeamActivityFile, config.picServerHost, this) }
姓名 工号 岗位 出席状态 签名
{item.SIGN_IN_STATUS == 1 ? item.Nav_User.NAME : ({item.Nav_User.NAME + " "})} {item.Nav_User.CODE} {item.Nav_User.Nav_Person.Nav_Post.NAME} {item.ATTEND_STATUS == 1 ? '参会' : '请假'} {item.ATTEND_STATUS == 1 && item.SIGN_IN_STATUS == 1 ? item.Nav_User.FILE_PATH && : ""}
: null }
{ GetFileModel(Modal, FormPage, this, this.state.fileForm.visible) }
} } export default connect(({ login }) => ({ login }))(FoTeamActivityShowPrint)