140 lines
6.5 KiB
JavaScript
140 lines
6.5 KiB
JavaScript
|
|
import { Button, Descriptions, Badge, Popconfirm, Row, Col, Form, Input, Select, Table } from 'antd';
|
||
|
|
import React from 'react';
|
||
|
|
import { initFilter, extendRule, extendInclude, setDataFieldValue, showApprove, guid, initQueryFilter, ShowDateTime, ShowPrintClose, showFiles } from '../../../utils/common';
|
||
|
|
import ReactToPrint from 'react-to-print';
|
||
|
|
import { ExportToExcel } from '@woowalker/feui'
|
||
|
|
import XLSX from 'xlsx';
|
||
|
|
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 BS074ShowPrint extends React.Component {
|
||
|
|
constructor(props) {
|
||
|
|
super(props);
|
||
|
|
this.state = {
|
||
|
|
data: null,
|
||
|
|
btndisplay: 'none',
|
||
|
|
isCheck: 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');
|
||
|
|
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,
|
||
|
|
});
|
||
|
|
}
|
||
|
|
loadData = (id) => {
|
||
|
|
var isCheck = (this.props.data.tableKey != undefined && this.props.data.tableKey == '1') ? true : false
|
||
|
|
var orgId = this.props.login ? this.props.login.OrgId : '';
|
||
|
|
let json = initFilter(orgId);
|
||
|
|
extendRule(json, 'ID', 1, id);
|
||
|
|
extendInclude(json, 'Nav_ListRiskSubmitContent.Nav_RiskArea')
|
||
|
|
extendInclude(json, 'Nav_ListRiskSubmitContent.Nav_DepartmentDeal')
|
||
|
|
extendInclude(json, 'Nav_ListRiskSubmitContent.Nav_UserDeal')
|
||
|
|
extendInclude(json, 'Nav_ListRiskSubmitContent.Nav_UserCheck')
|
||
|
|
extendInclude(json, 'Nav_ListRiskSubmitContent.Nav_UserActualDeal')
|
||
|
|
json.IgnoreDataRule = true
|
||
|
|
this.props.dispatch({
|
||
|
|
type: 'app/getDataByPost',
|
||
|
|
payload: json,
|
||
|
|
url: 'BS/BSRiskSubmitNoticePerson/GetNoticePeson',
|
||
|
|
onComplete: (ret) => {
|
||
|
|
if (ret) {
|
||
|
|
this.setState({
|
||
|
|
data: ret,
|
||
|
|
})
|
||
|
|
}
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|
||
|
|
render() {
|
||
|
|
const { data } = this.state;
|
||
|
|
const enums = this.props.data.enums ? this.props.data.enums : this.props.app.enums;
|
||
|
|
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} /></td>
|
||
|
|
<td><ExportToExcel fileName='隐患通知' tableId={'tableId' + this.props.data.id} /></td>
|
||
|
|
</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 className={styles.showPrintHead}>隐患通知</h1>
|
||
|
|
{
|
||
|
|
data ? <div >
|
||
|
|
<Descriptions title='' size='middle' bordered>
|
||
|
|
<Descriptions.Item label="编码">{data.CODE}</Descriptions.Item>
|
||
|
|
<Descriptions.Item label="隐患通知名称">{data.NAME}</Descriptions.Item>
|
||
|
|
<Descriptions.Item label="隐患等级">{enums.BSQuestionLevelEnum.enums[data.QUESTION_LEVEL]}</Descriptions.Item>
|
||
|
|
</Descriptions>
|
||
|
|
</div> : null
|
||
|
|
}
|
||
|
|
{
|
||
|
|
(data?.Nav_ListRiskSubmitContent && data?.Nav_ListRiskSubmitContent.length > 0) ?
|
||
|
|
<table className={styles.PrintFormLight}>
|
||
|
|
<tbody>
|
||
|
|
<tr>
|
||
|
|
<td colSpan={9} className={styles.showPrintHead2}>隐患上报明细</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_ListRiskSubmitContent?.map((item, i) => {
|
||
|
|
return <tr>
|
||
|
|
<td>{item.DESCREPTION} </td>
|
||
|
|
<td>{item.DEMAND} </td>
|
||
|
|
<td>{item.Nav_RiskArea.NAME} </td>
|
||
|
|
<td>{item.ADDRESS} </td>
|
||
|
|
<td>{item.LastDateUser} </td>
|
||
|
|
<td>{item.Nav_DepartmentDeal.NAME} </td>
|
||
|
|
<td>{item.Nav_UserDeal.NAME} </td>
|
||
|
|
<td>{item.Nav_UserCheck.NAME} </td>
|
||
|
|
<td>{item.Nav_UserActualDeal.NAME} </td>
|
||
|
|
</tr>
|
||
|
|
})}
|
||
|
|
</tbody>
|
||
|
|
</table>
|
||
|
|
: null
|
||
|
|
}
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
}
|
||
|
|
}
|
||
|
|
export default connect(({ login, app }) => ({ login, app }))(BS074ShowPrint)
|