168 lines
7.9 KiB
JavaScript
168 lines
7.9 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, initQueryFilter, 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 WB023ShowPrint 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/recordSign',
|
|
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_Type')
|
|
extendInclude(json, 'Nav_User')
|
|
extendInclude(json, 'Nav_Users.Nav_User')
|
|
extendInclude(json, 'Nav_DisCloseUsers.Nav_User')
|
|
extendInclude(json, 'Nav_RecordDetails.Nav_Files.Nav_ImgFile')
|
|
extendInclude(json, 'Nav_DisCloseFiles.Nav_ImgFile')
|
|
json.IgnoreDataRule = true;
|
|
this.props.dispatch({
|
|
type: 'app/getDataByPost',
|
|
payload: json,
|
|
url: 'WB/DangerousJob/Get',
|
|
onComplete: (ret) => {
|
|
if (ret) {
|
|
ret.Nav_RecordDetails.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' })
|
|
}
|
|
if (ret.Nav_Users && ret.Nav_Users.length > 0) {
|
|
var userNmaes = ''
|
|
ret.Nav_Users.forEach(item => {
|
|
userNmaes = (userNmaes.length > 0 ? " " : "") + item.Nav_User.NAME
|
|
});
|
|
ret.userNmaes = userNmaes
|
|
}
|
|
this.setState({
|
|
data: ret,
|
|
})
|
|
}
|
|
}
|
|
});
|
|
}
|
|
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
|
|
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.userNmaes}</Descriptions.Item>
|
|
<Descriptions.Item label="现场监护人">{data.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 colSpan={1}>序号</td>
|
|
<td colSpan={15}>安全措施</td>
|
|
<td colSpan={1}>是否涉及</td>
|
|
<td colSpan={15}>说明</td>
|
|
<td colSpan={15}>附件</td>
|
|
|
|
</tr>
|
|
{data?.Nav_RecordDetails?.map((item, i) => {
|
|
return <tr>
|
|
<td colSpan={1}>{item.ROW_NUM} </td>
|
|
<td colSpan={15}>{item.MEASURE} </td>
|
|
<td colSpan={1}>{enums.ISORNOT.enums[item.ISORNOT]} </td>
|
|
<td colSpan={15}>{item.REMARK} </td>
|
|
<td colSpan={15}>{showFiles(data.Nav_Files, config.picServerHost, this)} </td>
|
|
</tr>
|
|
})}
|
|
</tbody>
|
|
</table>
|
|
}
|
|
</div>
|
|
{
|
|
GetFileModel(Modal, FormPage, this, this.state.fileForm.visible)
|
|
}
|
|
</div>
|
|
}
|
|
}
|
|
export default connect(({ login, app }) => ({ login, app }))(WB023ShowPrint)
|