2025-09-21 15:18:07 +08:00
|
|
|
import { message } from "antd/lib/index";
|
|
|
|
|
import { Button, Descriptions, Popconfirm, Row, Col, Form, Input, Select, Modal } from 'antd';
|
|
|
|
|
import React from 'react';
|
|
|
|
|
import { initFilter, extendRule, extendInclude, extendIgnoreDataRule, setDataFieldValue, guid, showFiles, GetFileModel } from "../../../utils/common";
|
|
|
|
|
import ReactToPrint from "react-to-print";
|
|
|
|
|
import config from "../../../config";
|
|
|
|
|
import XLSX from 'xlsx';
|
|
|
|
|
import { connect } from 'dva';
|
|
|
|
|
import stylesStep from '../HI/StepForm.css';
|
|
|
|
|
import FormPage from '../../../components/FormPage'
|
|
|
|
|
import moment from 'moment';
|
|
|
|
|
class SK010ShowPrint 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, this.props.data?.TaskID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentWillReceiveProps(NextProps) {
|
|
|
|
|
if (NextProps.data?.id && this.props.data?.id != NextProps.data?.id) {
|
|
|
|
|
this.loadData(NextProps.data?.id, this.props.data?.TaskID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onTableBtnAgree() {
|
|
|
|
|
this.props.dispatch({
|
|
|
|
|
type: 'app/getDataByPost',
|
|
|
|
|
url: 'SK/SKSecurityInspectionRecord/IdentityUpdate',
|
|
|
|
|
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, taskID) => {
|
|
|
|
|
let json = initFilter(this.props.login.OrgId);
|
|
|
|
|
extendRule(json, 'ID', 1, dataId);
|
|
|
|
|
extendRule(json, 'TASK_ID', 1, taskID);
|
|
|
|
|
extendIgnoreDataRule(json)
|
|
|
|
|
// extendRule(json, 'ID', 1, dataId);
|
|
|
|
|
// extendInclude(json, 'Nav_JobName');
|
|
|
|
|
// extendInclude(json, 'Nav_JobNameOut');
|
|
|
|
|
// extendInclude(json, 'Nav_OperationStep');
|
|
|
|
|
// extendInclude(json, 'Nav_DisclosurePerson');
|
|
|
|
|
// extendInclude(json, 'Nav_DisclosurePerson');
|
|
|
|
|
// extendInclude(json, 'Nav_Person');
|
|
|
|
|
// extendInclude(json, 'Nav_Person.Nav_User');
|
|
|
|
|
// extendInclude(json, 'Nav_Person.Nav_RelatedUser.Nav_Signs.Nav_ImgFile');
|
|
|
|
|
// extendInclude(json, 'Nav_DisclosuredPerson');
|
|
|
|
|
// extendInclude(json, 'Nav_DisclosuredPerson.Nav_User');
|
|
|
|
|
this.props.dispatch({
|
|
|
|
|
type: 'app/getDataByPost',
|
|
|
|
|
payload: json,
|
|
|
|
|
url: 'SK/SKSecurityInspectionRecord/GetIdentityUserEdit',
|
|
|
|
|
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' })
|
|
|
|
|
}
|
|
|
|
|
this.onClickApprove(false);
|
|
|
|
|
}
|
|
|
|
|
else { message.error('请先尝试刷新,若仍然加载失败,请联系管理员排查!'); }
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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")
|
|
|
|
|
}
|
|
|
|
|
onClickApprove = (appVisible) => {
|
|
|
|
|
const newtmpData = {
|
|
|
|
|
data: { id: this.props.data.id, isShow: true, key: guid(), param: this.props.data.param, appVisible: appVisible, BtnAgreeDisplay: 'inline' },
|
|
|
|
|
formCode: "PF123",
|
|
|
|
|
}
|
|
|
|
|
this.setState({
|
|
|
|
|
tmpData: newtmpData,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
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' }}>
|
|
|
|
|
<Button onClick={() => this.onClickApprove(true)} style={{ marginRight: '8px' }} icon="export">审批详情</Button>
|
|
|
|
|
<ReactToPrint
|
|
|
|
|
trigger={() => <Button type={'default'} icon={'printer'} style={{ marginLeft: '8px', display: data && data.STATUS === 30 ? "inline" : "none" }}>打印</Button>}
|
|
|
|
|
content={() => this.componentRef}
|
|
|
|
|
pageStyle=".printDIV { padding:0 40px;} img{width :120px}"
|
|
|
|
|
/>
|
|
|
|
|
<Button style={{ marginLeft: '8px', display: data && data.STATUS === 30 ? "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}>
|
|
|
|
|
<h1 style={{ textAlign: 'center', margin: '15px' }}>安全检查记录</h1>
|
|
|
|
|
{
|
|
|
|
|
data ?
|
|
|
|
|
<div>
|
|
|
|
|
<Descriptions size="middle" bordered className={stylesStep.description}>
|
|
|
|
|
<Descriptions.Item label="发起时间">{moment(data.CREATE_TIME).format('YYYY-MM-DD')}</Descriptions.Item>
|
|
|
|
|
<Descriptions.Item label="发起部门">{data.Nav_ApplyDepartment ? data.Nav_ApplyDepartment.NAME : ''}</Descriptions.Item>
|
|
|
|
|
<Descriptions.Item label="发起人">{data.Nav_ApplyUser ? data.Nav_ApplyUser.NAME : ''}</Descriptions.Item>
|
2025-10-09 14:45:47 +08:00
|
|
|
<Descriptions.Item label="生产单元">{data.Nav_ProductionUnit?.NAME}</Descriptions.Item>
|
2025-09-21 15:18:07 +08:00
|
|
|
<Descriptions.Item label="检查类型">{data.Nav_CheckType ? data.Nav_CheckType.NAME : ''}</Descriptions.Item>
|
|
|
|
|
<Descriptions.Item label="检查周期">{enums.SKPLANCHECKFREQUENCYEnum.enums[data.PLANCHECKFREQUENCY]}</Descriptions.Item>
|
|
|
|
|
<Descriptions.Item label="检查层级">{enums.SKDepartmentTypeEnum.enums[data.DEPARTMENT_TYPE]}</Descriptions.Item>
|
|
|
|
|
<Descriptions.Item label="检查时间">{moment(data.CHECK_TIME).format('YYYY-MM-DD HH:mm:ss')}</Descriptions.Item>
|
|
|
|
|
<Descriptions.Item label="检查人员">{data.CHECK_PERSON}</Descriptions.Item>
|
|
|
|
|
<Descriptions.Item label="检查附件">{
|
|
|
|
|
showFiles(data?.Nav_CheckRecordFiles, config.picServerHost, this)
|
|
|
|
|
}</Descriptions.Item>
|
|
|
|
|
</Descriptions>
|
|
|
|
|
</div> : null
|
|
|
|
|
}
|
|
|
|
|
<table style={{ tableLayout: 'fixed', width: '100%' }} className={stylesStep.PrintForm1}>
|
|
|
|
|
<tr>
|
|
|
|
|
<td style={{ width: "150px" }} className={stylesStep.fontBold}>序号</td>
|
|
|
|
|
<td width='10%' className={stylesStep.fontBold}>检查区域</td>
|
|
|
|
|
<td className={stylesStep.fontBold}>检查内容</td>
|
|
|
|
|
{/* <td width='10%' className={stylesStep.fontBold}>检查依据</td>
|
|
|
|
|
<td width='10%' className={stylesStep.fontBold}>判定标准</td> */}
|
|
|
|
|
<td className={stylesStep.fontBold}>检查人员</td>
|
|
|
|
|
<td width='10%' className={stylesStep.fontBold}>检查情况</td>
|
|
|
|
|
<td className={stylesStep.fontBold}>隐患描述</td>
|
|
|
|
|
<td width='10%' className={stylesStep.fontBold}>隐患等级</td>
|
|
|
|
|
<td width='10%' className={stylesStep.fontBold}>隐患地点</td>
|
|
|
|
|
<td className={stylesStep.fontBold}>隐患照片</td>
|
|
|
|
|
</tr>
|
|
|
|
|
{
|
|
|
|
|
data?.Nav_CheckRecordDetails && data.Nav_CheckRecordDetails?.map((item, i) => {
|
|
|
|
|
return <tr>
|
|
|
|
|
<td>
|
|
|
|
|
{i + 1}
|
|
|
|
|
{/* {item.MARK !== 0 ? <a style={{ color: "red" }}>*</a> : i + 1} */}
|
|
|
|
|
</td>
|
|
|
|
|
<td>
|
|
|
|
|
{
|
|
|
|
|
item.Nav_RiskArea?.NAME
|
|
|
|
|
}
|
|
|
|
|
</td>
|
|
|
|
|
<td>
|
|
|
|
|
{
|
|
|
|
|
item.Nav_Contents?.CHECKCONTENT
|
|
|
|
|
}
|
|
|
|
|
</td>
|
|
|
|
|
{/* <td>
|
|
|
|
|
{
|
|
|
|
|
item?.Nav_CheckRecordDetailBasics && item?.Nav_CheckRecordDetailBasics.map((item2, i) => {
|
|
|
|
|
|
|
|
|
|
return <a>{(i > 0 ? "," : "") + item2.Nav_Law.NAME}</a>
|
|
|
|
|
|
|
|
|
|
// return <tr><label> {item2.Nav_User?.NAME}</label></tr>
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
</td> */}
|
|
|
|
|
{/* <td>
|
|
|
|
|
{
|
|
|
|
|
item.CHECKSTANDARD
|
|
|
|
|
}
|
|
|
|
|
</td> */}
|
|
|
|
|
<td>
|
|
|
|
|
{
|
|
|
|
|
item?.Nav_CheckRecordDetailUsers && item?.Nav_CheckRecordDetailUsers.map((item2, i) => {
|
|
|
|
|
if (item2.ISCHECK) {
|
|
|
|
|
return <a style={{ color: "rgba(0, 0, 0, 0.65)" }}>{(i > 0 ? "," : "") + item2.Nav_User.NAME}</a>
|
|
|
|
|
} else {
|
|
|
|
|
return <a style={{ color: "red" }}>{(i > 0 ? "," : "") + item2.Nav_User.NAME}</a>
|
|
|
|
|
}
|
|
|
|
|
// return <tr><label> {item2.Nav_User?.NAME}</label></tr>
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
</td>
|
|
|
|
|
<td>
|
|
|
|
|
{
|
|
|
|
|
item.CHECK_RESULT == null? "无隐患" :enums.SKCheckResultEnum.enums[item.CHECK_RESULT]
|
|
|
|
|
}
|
|
|
|
|
</td>
|
|
|
|
|
<td>
|
|
|
|
|
{
|
|
|
|
|
item.Nav_Question?.DESCREPTION
|
|
|
|
|
}
|
|
|
|
|
</td>
|
|
|
|
|
<td>
|
|
|
|
|
{
|
|
|
|
|
enums.SKHiddenLevel.enums[item.HIDDEN_LEVEL]
|
|
|
|
|
}
|
|
|
|
|
</td>
|
|
|
|
|
<td>
|
|
|
|
|
{
|
|
|
|
|
item.HIDDEN_PLACE
|
|
|
|
|
}
|
|
|
|
|
</td>
|
|
|
|
|
<td>
|
|
|
|
|
{
|
|
|
|
|
showFiles(item?.Nav_CheckRecordDetailFiles, config.picServerHost, this)
|
|
|
|
|
}
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
</table>
|
|
|
|
|
<FormPage {...this.state.tmpData} />
|
|
|
|
|
</div>
|
|
|
|
|
{
|
|
|
|
|
GetFileModel(Modal, FormPage, this, this.state.fileForm.visible)
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2025-08-25 10:08:30 +08:00
|
|
|
export default connect(({ login, app }) => ({ login, app }))(SK010ShowPrint)
|