190 lines
9.1 KiB
JavaScript
190 lines
9.1 KiB
JavaScript
import { Button, Descriptions, Modal, Popconfirm, Row, Col, Form, Input, Select, Table } from 'antd';
|
|
import React from 'react';
|
|
import { initFilter, extendRule, extendInclude, setDataFieldValue, showApprove, guid, showUsersSign, GetFileModel, showFiles } from '../../../utils/common';
|
|
import ReactToPrint from 'react-to-print';
|
|
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 WB019ShowPrint extends React.Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = {
|
|
data: null,
|
|
btndisplay: 'none',
|
|
isCheck: false, //是否待办 审批
|
|
BtnAgreeDisplay: 'table',
|
|
isSign: true,
|
|
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);
|
|
}
|
|
}
|
|
BtnClose = () => {
|
|
if (typeof this.props.data.onCancel != "undefined" && typeof this.props.data.onCancel == 'function')
|
|
this.props.data.onCancel();
|
|
}
|
|
onTableBtnAgree() {
|
|
let json = initFilter(this.props.login.OrgId);
|
|
json.Parameter1 = this.props.data.id;
|
|
json.Parameter2 = this.props.data.TaskID;
|
|
json.Parameter3 = this.props.login.userId;
|
|
this.props.dispatch({
|
|
type: 'app/getDataByPost',
|
|
url: 'WB/WBDangerousJob/discloseSign',
|
|
payload: json,
|
|
onComplete: (ret) => {
|
|
if (ret) {
|
|
message.success('确认成功!');
|
|
this.state.isSign = false;
|
|
this.BtnClose();
|
|
}
|
|
}
|
|
})
|
|
}
|
|
loadData = (id) => {
|
|
var orgId = this.props.login ? this.props.login.OrgId : '';
|
|
let json = initFilter(orgId);
|
|
extendRule(json, 'ID', 1, id);
|
|
extendInclude(json, 'Nav_Project')
|
|
extendInclude(json, 'Nav_DisCloseUser')
|
|
extendInclude(json, 'Nav_Type')
|
|
extendInclude(json, 'Nav_User')
|
|
extendInclude(json, 'Nav_DisCloseUsers.Nav_User')
|
|
extendInclude(json, 'Nav_DisCloseDetails')
|
|
extendInclude(json, 'Nav_DisCloseFiles.Nav_ImgFile')
|
|
this.props.dispatch({
|
|
type: 'app/getDataByPost',
|
|
payload: json,
|
|
url: 'WB/DangerousJob/Get',
|
|
onComplete: (ret) => {
|
|
if (ret) {
|
|
ret.Nav_DisCloseDetails.sort((a, b) => a.ROW_NUM - b.ROW_NUM);
|
|
if (this.props.data.tableKey == "2" || this.props.data.tableKey == undefined) {
|
|
this.setState({ BtnAgreeDisplay: 'none' })
|
|
} else {
|
|
this.setState({ BtnAgreeDisplay: 'table' })
|
|
}
|
|
var listUsers = []
|
|
ret.Nav_DisCloseUsers.forEach(element => {
|
|
if (element.DEAL_STATUS == 1)
|
|
listUsers.push(element)
|
|
});
|
|
this.setState({
|
|
data: ret,
|
|
listUsers: listUsers
|
|
})
|
|
console.log(this.state.data)
|
|
|
|
}
|
|
}
|
|
});
|
|
}
|
|
render() {
|
|
const { data } = this.state; const enums = this.props.data.enums ? this.props.data.enums : this.props.app.enums; const tableKey = this.props.data.tableKey; const listUsers = this.state.listUsers
|
|
return <div>
|
|
<div style={{ padding: '10px' }}>
|
|
<table>
|
|
<tbody>
|
|
<tr>
|
|
<td><ReactToPrint trigger={() => <Button type={'default'} icon={'printer'} >打印</Button>} content={() => this.componentRef} /></td>
|
|
{this.state.isSign && (tableKey != null && (tableKey == "1" || tableKey == "4")) && (
|
|
<>
|
|
<td><Button type={"primary"} style={{ marginLeft: '8px' }} onClick={() => this.onTableBtnAgree()} icon="check" >签到</Button></td>
|
|
</>
|
|
)}
|
|
</tr>
|
|
</tbody>
|
|
</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 style={{ width: '95%' }}>
|
|
<Descriptions title='' size='middle' bordered>
|
|
<Descriptions.Item label="项目名称">{data.Nav_Project.NAME}</Descriptions.Item>
|
|
<Descriptions.Item label="外包单位名称">{data.Nav_Project.UNIT_NAME}</Descriptions.Item>
|
|
<Descriptions.Item label="作业类别">{data.Nav_Type.NAME}</Descriptions.Item>
|
|
<Descriptions.Item label="危险作业名称">{data.DANGEROUS_JOB_NAME}</Descriptions.Item>
|
|
<Descriptions.Item label="危险作业具体事项">{data.DANGEROUS_JOB_ITEM}</Descriptions.Item>
|
|
<Descriptions.Item label="作业风险辨识">{data.JOB_RISK_IDENTIFY}</Descriptions.Item>
|
|
<Descriptions.Item label="作业开始时间">{data.START_TIME}</Descriptions.Item>
|
|
<Descriptions.Item label="作业结束时间">{data.END_TIME}</Descriptions.Item>
|
|
<Descriptions.Item label="作业地点">{data.JOB_ADDRESS}</Descriptions.Item>
|
|
|
|
<Descriptions.Item label="现场监护人">{data.Nav_User.NAME}</Descriptions.Item>
|
|
<Descriptions.Item label="交底时间">{data.DISCLOSE_TIME}</Descriptions.Item>
|
|
<Descriptions.Item label="交底人">{data.Nav_DisCloseUser.NAME}</Descriptions.Item>
|
|
<Descriptions.Item label="被交底人">{data.Nav_DisCloseUsers?.map((item, i) => {
|
|
// DEAL_STATUS==0 变红
|
|
return (i > 0 ? ',' : '') + item.Nav_User.NAME
|
|
})}</Descriptions.Item>
|
|
<Descriptions.Item label="附件">{showFiles(data.Nav_DisCloseFiles, config.picServerHost, this)}</Descriptions.Item>
|
|
</Descriptions>
|
|
</div> : null
|
|
}
|
|
{
|
|
<table className={styles.PrintFormLight}>
|
|
<tbody>
|
|
<tr className={styles.PrintFormLightTh}>
|
|
<td >序号</td>
|
|
<td colSpan={5}>安全措施</td>
|
|
<td >是否涉及</td>
|
|
<td colSpan={5}>说明</td>
|
|
</tr>
|
|
{data?.Nav_DisCloseDetails?.map((item, i) => {
|
|
return <tr>
|
|
<td colSpan={1}>{item.ROW_NUM} </td>
|
|
<td colSpan={5}>{item.MEASURE} </td>
|
|
<td colSpan={1}>{enums.ISORNOT.enums[item.ISORNOT]} </td>
|
|
<td colSpan={5}>{item.REMARK} </td>
|
|
</tr>
|
|
})}
|
|
{/* {
|
|
(listUsers && listUsers.length > 0) ?
|
|
<tr>
|
|
<td>签名</td>
|
|
<td colSpan={11} style={{ textAlign: "left" }}>
|
|
{
|
|
showUsersSign(listUsers, config.picServerHost, 200)
|
|
}
|
|
</td>
|
|
</tr>
|
|
: null
|
|
} */}
|
|
<tr>
|
|
<td>签名</td>
|
|
<td colSpan={11} style={{ textAlign: "left" }}>
|
|
{
|
|
showUsersSign(listUsers, config.picServerHost, 200)
|
|
}
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
}
|
|
</div>
|
|
{
|
|
GetFileModel(Modal, FormPage, this, this.state.fileForm.visible)
|
|
}
|
|
</div>
|
|
}
|
|
}
|
|
export default connect(({ login, app }) => ({ login, app }))(WB019ShowPrint)
|