238 lines
12 KiB
JavaScript
238 lines
12 KiB
JavaScript
import { message } from "antd/lib/index";
|
|
import { Button,Descriptions, Popconfirm, Row, Col, Form, Input, Select, Table } from 'antd';
|
|
import React from 'react';
|
|
import { initFilter, extendRule, extendInclude,extendIgnoreDataRule, setDataFieldValue, guid, initQueryFilter,showFiles, GetFileModel,showUserSign } from "../../../utils/common";
|
|
import ReactToPrint from "react-to-print";
|
|
import styles from '../HI/StepForm.css';
|
|
import config from "../../../config";
|
|
import XLSX from 'xlsx';
|
|
import { connect } from 'dva';
|
|
import moment from 'moment';
|
|
class FO041ShowPrint extends React.Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = {
|
|
data: null,
|
|
enumData: null,
|
|
BtnAgreeDisplay: 'none',
|
|
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);
|
|
}
|
|
}
|
|
|
|
|
|
onTableBtnAgree() {
|
|
this.props.dispatch({
|
|
type: 'app/getDataByPost',
|
|
url: 'FO/FOLeaderWellRecord/PersonalAgree',
|
|
payload: {
|
|
ID: this.props.data.id,
|
|
TaskID: this.props.data.TaskID,
|
|
},
|
|
onComplete: (ret) => {
|
|
if (ret) {
|
|
message.success('确认成功!');
|
|
this.setState({ BtnAgreeDisplay: 'none' })
|
|
this.BtnClose();
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
BtnClose = () => {
|
|
if (typeof this.props.data.onCancel != "undefined"&&typeof this.props.data.onCancel == 'function')
|
|
this.props.data.onCancel();
|
|
}
|
|
|
|
loadData = (dataId) => {
|
|
let json = initFilter(this.props.login.OrgId);
|
|
extendRule(json, 'ID', 1, dataId);
|
|
extendIgnoreDataRule(json)
|
|
this.props.dispatch({
|
|
type: 'app/getDataByPost',
|
|
payload: json,
|
|
url: 'FO/FOLeaderWellRecord/GetEdit',
|
|
onComplete: (ret) => {
|
|
if (ret) {
|
|
if(this.props.data && this.props.data.loadDataDeal)
|
|
{
|
|
this.props.data.loadDataDeal(1);
|
|
}
|
|
this.setState({ data: ret })
|
|
if (this.props.data.tableKey=="2" ||this.props.data.tableKey==undefined) {
|
|
this.setState({ BtnAgreeDisplay: 'none' })
|
|
}else{
|
|
this.setState({ BtnAgreeDisplay: 'inline' })
|
|
}
|
|
}
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
onTableBtnExport() {
|
|
let TableWrap = document.getElementById('tableId' + this.props.data.id);
|
|
let Table = TableWrap.getElementsByTagName('table')[0];
|
|
const wb = XLSX.utils.table_to_book(Table);
|
|
XLSX.writeFile(wb, "领导带班下井记录.xlsx")
|
|
}
|
|
|
|
render() {
|
|
const { data } = this.state;
|
|
return <div>
|
|
<div style={{ padding: '10px' }}>
|
|
<ReactToPrint
|
|
trigger={() => <Button type={'default'} icon={'printer'} style={{ marginLeft: '8px',display: data && data.STATUS === 15?"inline":"none" }}>打印</Button>}
|
|
content={() => this.componentRef}
|
|
pageStyle=".printDIV { padding:0 40px;} img{width :120px}"
|
|
/>
|
|
<Button style={{ marginLeft: '8px',display: data && data.STATUS === 15?"inline":"none" }} onClick={() => this.onTableBtnExport()} icon="export" >导出</Button>
|
|
<Button type="primary" style={{ marginLeft: '8px', display: this.state.BtnAgreeDisplay }} onClick={() => this.onTableBtnAgree()} icon="check" >确认</Button>
|
|
</div>
|
|
|
|
|
|
{/* */}
|
|
<div ref={el => (this.componentRef = el)} style={{ padding: '20px' }} id={'tableId' + this.props.data.id} className="printDIV">
|
|
|
|
<h1 style={{ textAlign: 'center', margin: '15px' }}>领导带班下井记录</h1>
|
|
{
|
|
data?
|
|
<div>
|
|
<Descriptions size="middle" bordered className={styles.description}>
|
|
<Descriptions.Item label="公司">{data.Nav_Company?.NAME}</Descriptions.Item>
|
|
<Descriptions.Item label="生产单元">{data.Nav_ProductionUnit?.NAME}</Descriptions.Item>
|
|
<Descriptions.Item label="发起时间">{data.CREATE_TIME}</Descriptions.Item>
|
|
|
|
<Descriptions.Item label="发起部门">{data.Nav_ApplyDepartment?.NAME}</Descriptions.Item>
|
|
<Descriptions.Item label="发起人">{data.Nav_ApplyUser?.NAME}</Descriptions.Item>
|
|
<Descriptions.Item label="值班领导">{
|
|
data.Nav_Users && data.Nav_Users.map((item, i) => {
|
|
return item.Nav_User?.NAME + ' '
|
|
})
|
|
}</Descriptions.Item>
|
|
<Descriptions.Item label="值班开始时间">{data.JOB_START_DATE}</Descriptions.Item>
|
|
<Descriptions.Item label="值班结束时间">{data.JOB_END_DATE}</Descriptions.Item>
|
|
<Descriptions.Item label="班次">{data.Nav_Class?.NAME}</Descriptions.Item>
|
|
|
|
</Descriptions>
|
|
|
|
<Descriptions size="middle" bordered className={styles.description}>
|
|
<Descriptions.Item label="交接班地点">{data.PLACE}</Descriptions.Item>
|
|
<Descriptions.Item label="交班人">{
|
|
data.Nav_Users && data.Nav_Users.map((item, i) => {
|
|
return item.Nav_User?.NAME + ' '
|
|
})
|
|
}</Descriptions.Item>
|
|
<Descriptions.Item label="接班人">{
|
|
data.Nav_AfterUsers && data.Nav_AfterUsers.map((item, i) => {
|
|
return item.Nav_AfterUser?.NAME + ' '
|
|
})
|
|
|
|
}</Descriptions.Item>
|
|
</Descriptions>
|
|
|
|
<Descriptions size="middle" bordered className={styles.description}>
|
|
<Descriptions.Item label="交班人签字">{
|
|
data.Nav_Users && data.Nav_Users.map((item, i) => {
|
|
if (item.DEAL_STATUS == 1) {
|
|
return <img width={'150px'} style={{ margin: "0 0 0 5px" }} src={config.picServerHost + item.Nav_User?.FILE_PATH} title={item.Nav_User?.NAME} alt={item.Nav_User?.NAME} />
|
|
}
|
|
})
|
|
|
|
}</Descriptions.Item>
|
|
|
|
<Descriptions.Item label="接班人签字">{
|
|
data.Nav_AfterUsers && data.Nav_AfterUsers.map((item, i) => {
|
|
if (item.AFTER_USER_DEAL_STATUS == 1) {
|
|
return <img width={'150px'} style={{ margin: "0 0 0 5px" }} src={config.picServerHost + item.Nav_AfterUser?.FILE_PATH} title={item.Nav_AfterUser?.NAME} alt={item.Nav_AfterUser?.NAME} />
|
|
}
|
|
})
|
|
}</Descriptions.Item>
|
|
<Descriptions.Item label="附件">{showFiles(data.Nav_Files, config.picServerHost, this)}</Descriptions.Item>
|
|
</Descriptions>
|
|
{
|
|
data && data.Nav_Details?
|
|
<table style={{ width: '100%', textAlign: 'center', marginTop: '10px', borderTop: '1px solid #333', borderLeft: '1px solid #333' }} className={styles.PrintForm}>
|
|
<tbody>
|
|
|
|
<tr>
|
|
<td width="100px" className={styles.fontBold}>序号</td>
|
|
<td className={styles.fontBold}>开始时间</td>
|
|
<td className={styles.fontBold}>结束时间</td>
|
|
<td className={styles.fontBold}>巡视区域</td>
|
|
<td className={styles.fontBold}>现场情况描述</td>
|
|
<td className={styles.fontBold}>发现问题</td>
|
|
<td className={styles.fontBold}>处置措施</td>
|
|
<td className={styles.fontBold}>附件</td>
|
|
<td className={styles.fontBold}>现场责任人</td>
|
|
<td className={styles.fontBold}>现场责任人签名</td>
|
|
<td className={styles.fontBold}>交接事项</td>
|
|
</tr>
|
|
{
|
|
data.Nav_Details && data.Nav_Details.map((item, i) => {
|
|
return <tr>
|
|
<td width="100px">
|
|
{i + 1}
|
|
</td>
|
|
<td>
|
|
{item.START_DATE}
|
|
</td>
|
|
<td>
|
|
{item.END_DATE}
|
|
</td>
|
|
<td>
|
|
{
|
|
item?.Nav_DetailAreas && item?.Nav_DetailAreas.map((item2, i) => {
|
|
return item2?.Nav_Area?.NAME +';'
|
|
})
|
|
}
|
|
</td>
|
|
<td>
|
|
{item.DESCRIPTION}
|
|
</td>
|
|
<td>
|
|
{item.QUESTION}
|
|
</td>
|
|
<td>
|
|
{item.MEASURE}
|
|
</td>
|
|
<td>
|
|
{showFiles(item.Nav_DetailFiles, config.picServerHost, this)}
|
|
</td>
|
|
<td>
|
|
{item.Nav_User?.NAME}
|
|
</td>
|
|
<td>
|
|
{item.USER_DEAL_STATUS == 1?showUserSign(item.Nav_User, config.picServerHost):null}
|
|
</td>
|
|
<td>
|
|
{item.ITEM}
|
|
</td>
|
|
</tr>
|
|
})
|
|
}
|
|
</tbody>
|
|
</table> : null
|
|
}
|
|
|
|
</div>:null
|
|
}
|
|
</div>
|
|
</div>
|
|
}
|
|
|
|
}
|
|
export default connect(({ login }) => ({ login }))(FO041ShowPrint)
|