353 lines
		
	
	
		
			20 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			353 lines
		
	
	
		
			20 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
import { Button, Descriptions } from 'antd';
 | 
						||
import React from 'react';
 | 
						||
import { initFilter, extendRule, extendInclude, guid, showFiles, showApprove, showUsersSign, showUserSign } from '../../../utils/common';
 | 
						||
import ReactToPrint from 'react-to-print';
 | 
						||
import { ExportToExcel } from '@woowalker/feui'
 | 
						||
import XLSX from 'xlsx';
 | 
						||
import { connect } from 'dva';
 | 
						||
import styles from '../../../components/CustomPages/HI/StepForm.css';
 | 
						||
import config from '../../../config.js';
 | 
						||
import FormPage from '../../FormPage'
 | 
						||
class BS070ShowPrint extends React.Component {
 | 
						||
    constructor(props) {
 | 
						||
        super(props);
 | 
						||
        this.state = {
 | 
						||
            Nav_SafeCheck: {},
 | 
						||
            Nav_ListSafeCheckDetail: [],
 | 
						||
            Nav_ApproveApply: {},
 | 
						||
            Nav_ListApplySign: [],
 | 
						||
            Nav_ListSafeCheckDetailRisk: [],
 | 
						||
            Nav_ListCheckSign: [],
 | 
						||
            Nav_ApproveCheck: {},
 | 
						||
            Nav_RiskSubmit: {},
 | 
						||
            Nav_ListRiskSubmitContent: [],
 | 
						||
            Nav_ListRiskSubmitContentDeal: [],
 | 
						||
            Nav_ApproveRisk: {}
 | 
						||
        }
 | 
						||
    }
 | 
						||
 | 
						||
    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')
 | 
						||
 | 
						||
    }
 | 
						||
 | 
						||
    loadData = (id) => {
 | 
						||
        // id=  CHECKID +'_'+SUBMITID   CHECKID\SUBMITID 可能只有其一 但是一定会有_
 | 
						||
        var orgId = this.props.login ? this.props.login.OrgId : '';
 | 
						||
        let json = initFilter(orgId);
 | 
						||
        extendRule(json, 'ID', 1, id);
 | 
						||
        this.props.dispatch({
 | 
						||
            type: 'app/getDataByPost',
 | 
						||
            payload: json,
 | 
						||
            url: 'BS/BSSafeCheck/GetSum',
 | 
						||
            onComplete: (ret) => {
 | 
						||
                if (ret) {
 | 
						||
                    this.setState({
 | 
						||
                        Nav_SafeCheck: ret.Nav_SafeCheck,
 | 
						||
                        Nav_ListSafeCheckDetail: ret.Nav_ListSafeCheckDetail,
 | 
						||
                        Nav_ApproveApply: ret.Nav_ApproveApply,
 | 
						||
                        Nav_ListApplySign: ret.Nav_ListApplySign,
 | 
						||
                        Nav_ListSafeCheckDetailRisk: ret.Nav_ListSafeCheckDetailRisk,
 | 
						||
                        Nav_ListCheckSign: ret.Nav_ListCheckSign,
 | 
						||
                        Nav_ApproveCheck: ret.Nav_ApproveCheck,
 | 
						||
                        Nav_RiskSubmit: ret.Nav_RiskSubmit,
 | 
						||
                        Nav_ListRiskSubmitContent: ret.Nav_ListRiskSubmitContent,
 | 
						||
                        Nav_ListRiskSubmitContentDeal: ret.Nav_ListRiskSubmitContentDeal,
 | 
						||
                        Nav_ApproveRisk: ret.Nav_ApproveRisk
 | 
						||
                    })
 | 
						||
                }
 | 
						||
            }
 | 
						||
        });
 | 
						||
    }
 | 
						||
    render() {
 | 
						||
        const {
 | 
						||
            Nav_SafeCheck,
 | 
						||
            Nav_ListSafeCheckDetail,
 | 
						||
            Nav_ApproveApply,
 | 
						||
            Nav_ListApplySign,
 | 
						||
            Nav_ListSafeCheckDetailRisk,
 | 
						||
            Nav_ListCheckSign,
 | 
						||
            Nav_ApproveCheck,
 | 
						||
            Nav_RiskSubmit,
 | 
						||
            Nav_ListRiskSubmitContent,
 | 
						||
            Nav_ListRiskSubmitContentDeal,
 | 
						||
            Nav_ApproveRisk
 | 
						||
        } = 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><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>
 | 
						||
            <div ref={el => (this.componentRef = el)} style={{ padding: '20px', paddingTop: '20px' }} id={'tableId' + this.props.data.id}>
 | 
						||
                <h1 className={styles.showPrintHead} >{Nav_SafeCheck?.Nav_CheckType?.NAME}安全检查汇总</h1>
 | 
						||
                {
 | 
						||
                    Nav_SafeCheck ? <div>
 | 
						||
                        <Descriptions title="" size="middle" bordered>
 | 
						||
                            <Descriptions.Item label="检查范围">{enums.BSMineTypeEnum.enums[Nav_SafeCheck.CHECKOBJECT]}</Descriptions.Item>
 | 
						||
                            <Descriptions.Item label="检查类型">{Nav_SafeCheck?.Nav_CheckType?.NAME}</Descriptions.Item>
 | 
						||
                            <Descriptions.Item label="检查层级">{Nav_SafeCheck?.Nav_CheckTypeLevel?.Nav_Enums?.NAME}</Descriptions.Item>
 | 
						||
                            <Descriptions.Item label="检查区域"><p >{
 | 
						||
                                Nav_SafeCheck?.Nav_ListCheckRiskArea?.map((item, i) => {
 | 
						||
                                    // return <p className={styles.pLin}> {item.Nav_RiskArea.NAME}</p>
 | 
						||
                                    return (i > 0 ? "," : "") + item.Nav_RiskArea.NAME
 | 
						||
                                })
 | 
						||
                            }</p></Descriptions.Item>
 | 
						||
                            <Descriptions.Item label="检查项目"><p>{
 | 
						||
                                Nav_SafeCheck?.Nav_ListCheckProject?.map((item, i) => {
 | 
						||
                                    // return <p className={styles.pLin}> {item.Nav_CheckProject.NAME}</p>
 | 
						||
                                    return (i > 0 ? "," : "") + item.Nav_CheckProject.NAME
 | 
						||
                                })
 | 
						||
 | 
						||
                            }</p></Descriptions.Item>
 | 
						||
                            <Descriptions.Item label="检查项目分类"><p  style={{ width: '75%' }}>{
 | 
						||
                                Nav_SafeCheck.Nav_ListCheckProjectCategory && Nav_SafeCheck.Nav_ListCheckProjectCategory.map((item, i) => {
 | 
						||
                                    // return <p className={styles.pLin}> {item.Nav_CheckProjectCategory.NAME}</p>
 | 
						||
                                    return (i > 0 ? "," : "") + item.Nav_CheckProjectCategory.NAME
 | 
						||
                                })
 | 
						||
                            }</p> </Descriptions.Item>
 | 
						||
                            <Descriptions.Item label="检查时间">{Nav_SafeCheck.CHECKTIME}</Descriptions.Item>
 | 
						||
                            {/* <Descriptions.Item label="检查人员" style={{ maxWidth:'150px' }}>{Nav_SafeCheck.CheckUsers}</Descriptions.Item> */}
 | 
						||
                            <Descriptions.Item label="检查人员"  ><p style={{ width: '95%' }}> {Nav_SafeCheck.CheckUsers}</p></Descriptions.Item>
 | 
						||
                            <Descriptions.Item label="附件">{
 | 
						||
                                Nav_SafeCheck.Nav_Files && Nav_SafeCheck.Nav_Files.map((item, i) => {
 | 
						||
                                    return <a width={'20%'} title={item.Nav_ImgFile.FILE_NAME} target='_blank' href={config.picServerHost + item.Nav_ImgFile.Nav_File.FILE_PATH} >{item.Nav_ImgFile.FILE_NAME} </a>
 | 
						||
                                })
 | 
						||
                            }</Descriptions.Item>
 | 
						||
 | 
						||
                        </Descriptions>
 | 
						||
                    </div> : null
 | 
						||
                }
 | 
						||
 | 
						||
                {
 | 
						||
                    Nav_ListSafeCheckDetail ? <table className={styles.PrintFormLight}>
 | 
						||
                        <tbody>
 | 
						||
                            <tr>
 | 
						||
                                <td colSpan={7} style={{ textAlign: "center", fontSize: '20px' }}>安全检查任务制定</td>
 | 
						||
                            </tr>
 | 
						||
                            <tr className={styles.PrintFormLightTh}>
 | 
						||
                                <td style={{ width: '100px' }}>序号</td>
 | 
						||
                                <td>检查区域</td>
 | 
						||
                                <td>检查人员</td>
 | 
						||
                                <td>检查项目</td>
 | 
						||
                                <td>检查内容</td>
 | 
						||
                                <td>检查依据</td>
 | 
						||
                            </tr>
 | 
						||
                            {Nav_ListSafeCheckDetail.map((item, i) => {
 | 
						||
                                return <tr>
 | 
						||
                                    <td>{item.ROW_NO}</td>
 | 
						||
                                    <td >{item.Nav_CheckArea?.NAME}</td>
 | 
						||
                                    <td>{
 | 
						||
                                        item.Nav_ListCheckDetailUser.map((user, j) => {
 | 
						||
                                            if (user.SAFECHECKSTATE >= 60) {
 | 
						||
                                                return <a style={{ color: "rgba(0, 0, 0, 0.65)" }}>{(j > 0 ? "," : "") + user.Nav_User.NAME}</a>
 | 
						||
                                            } else {
 | 
						||
                                                return <a style={{ color: "red" }}>{(j > 0 ? "," : "") + user.Nav_User.NAME}</a>
 | 
						||
                                            }
 | 
						||
                                        })
 | 
						||
                                    }</td>
 | 
						||
 | 
						||
                                    <td>{item.Nav_CheckProject?.NAME}</td>
 | 
						||
                                    <td>{item.CHECKCONTENT}</td>
 | 
						||
                                    <td>{item.CHECKPROOF}</td>
 | 
						||
                                </tr>
 | 
						||
                            })}
 | 
						||
 | 
						||
 | 
						||
                            <tr>
 | 
						||
                                <td colSpan={2} >任务制定审核人</td>
 | 
						||
                                <td colSpan={4} style={{ textAlign: "left" }}>
 | 
						||
                                    {
 | 
						||
                                        showApprove(Nav_ApproveApply?.Nav_ApproveDetails, this.props.app.enums.NodeApproveStatus.enums, config.picServerHost, 200)
 | 
						||
                                    }
 | 
						||
                                </td>
 | 
						||
                            </tr>
 | 
						||
 | 
						||
                            {
 | 
						||
                                Nav_SafeCheck.STATUSPLAN >= 20 ?
 | 
						||
                                    <tr >
 | 
						||
                                        <td colSpan={2} >检查人员确认</td>
 | 
						||
                                        <td colSpan={4} style={{ textAlign: "left" }}>
 | 
						||
                                            {
 | 
						||
                                                showUsersSign(Nav_ListApplySign, config.picServerHost, 200, 70)
 | 
						||
                                            }
 | 
						||
                                        </td>
 | 
						||
                                    </tr>
 | 
						||
                                    : null
 | 
						||
                            }
 | 
						||
                        </tbody>
 | 
						||
                    </table> : null
 | 
						||
                }
 | 
						||
 | 
						||
 | 
						||
 | 
						||
                {
 | 
						||
                    (Nav_ListSafeCheckDetailRisk && (Nav_SafeCheck == null || Nav_SafeCheck.STATECHECK > 5)) ? <table className={styles.PrintFormLight}>
 | 
						||
                        <tbody>
 | 
						||
                            <tr><td colSpan={8} style={{ textAlign: "center", fontSize: '20px' }} >隐患上报记录</td>
 | 
						||
                            </tr>
 | 
						||
                            <tr className={styles.PrintFormLightTh}>
 | 
						||
                                <td>序号</td>
 | 
						||
                                <td>检查区域</td>
 | 
						||
                                <td>检查内容</td>
 | 
						||
                                <td>问题描述</td>
 | 
						||
                                <td>问题等级</td>
 | 
						||
                                <td>隐患地点</td>
 | 
						||
                                <td>隐患原因</td>
 | 
						||
                                <td style={{ maxWidth: "20%" }}>整改建议与措施</td>
 | 
						||
                                {/* <td>附件</td> */}
 | 
						||
                            </tr>
 | 
						||
 | 
						||
                            {
 | 
						||
                                Nav_ListSafeCheckDetailRisk != null && Nav_ListSafeCheckDetailRisk.length > 0 ?
 | 
						||
                                    Nav_ListSafeCheckDetailRisk.map((item, i) => {
 | 
						||
                                        return <tr key={i}>
 | 
						||
                                            {/* <td>{item.ROW_NO}</td> */}
 | 
						||
                                            <td>{(i + 1)}</td>
 | 
						||
                                            <td>{item.Nav_CheckArea?.NAME}</td>
 | 
						||
                                            <td>{item.CHECKCONTENT}</td>
 | 
						||
                                            <td>{(item.CHECKRESULT == 0 || (item.CHECKRESULT != null && item.CHECKRESULT == 20)) ?
 | 
						||
                                                item.Nav_ListCheckDetailQuestion?.map((question, j) => {
 | 
						||
                                                    return <p className={styles.pLin}> {question.Nav_Question?.DESCREPTION}</p>
 | 
						||
                                                })
 | 
						||
                                                : item.CHECKRESULT_DESCRIPTION}</td>
 | 
						||
 | 
						||
                                            <td>{enums.BSQuestionLevelEnum.enums[item.QUESTION_LEVEL]}</td>
 | 
						||
 | 
						||
                                            <td>{item.ADDRESS}</td>
 | 
						||
                                            <td>{
 | 
						||
                                                item.Nav_ListCheckDetailReason?.map(item => {
 | 
						||
                                                    return <p className={styles.pLin}> {item.Nav_RiskReason?.NAME}</p>
 | 
						||
                                                })
 | 
						||
                                            }</td>
 | 
						||
 | 
						||
                                            <td>{(item.CHECKRESULT != null && item.CHECKRESULT == 20) ?
 | 
						||
                                                item.Nav_ListCheckDetailQuestion?.map((question, j) => {
 | 
						||
                                                    return <p className={styles.pLin}> {question.Nav_Question?.DEMAND}</p>
 | 
						||
                                                })
 | 
						||
                                                : ""}</td>
 | 
						||
                                            {/* <td>{
 | 
						||
                                            showFiles(item?.Nav_Files, config.picServerHost)
 | 
						||
                                        }</td> */}
 | 
						||
                                        </tr>
 | 
						||
                                    }) :
 | 
						||
                                    (Nav_SafeCheck.STATECHECK <= 5 ? <tr><td colSpan={8} style={{ height: '50px' }}>待检查</td></tr> : <tr><td colSpan={8} style={{ height: '50px' }}>检查无异常</td></tr>)
 | 
						||
                                // <tr><td colSpan={8} style={{ height: '50px' }}>检查无异常</td></tr>
 | 
						||
 | 
						||
                            }
 | 
						||
 | 
						||
                            <tr>
 | 
						||
                                <td colSpan={2}>检查人员签字  </td>
 | 
						||
                                <td colSpan={6} style={{ textAlign: "left" }}>
 | 
						||
                                    {
 | 
						||
                                        showUsersSign(Nav_ListCheckSign, config.picServerHost, 200, 70)
 | 
						||
                                    }
 | 
						||
                                </td>
 | 
						||
                            </tr>
 | 
						||
                            <tr>
 | 
						||
                                <td colSpan={2} >审核意见   </td>
 | 
						||
                                <td colSpan={6} style={{ textAlign: "left" }}>
 | 
						||
                                    {
 | 
						||
                                        showApprove(Nav_ApproveCheck?.Nav_ApproveDetails, this.props.app.enums.NodeApproveStatus.enums, config.picServerHost, 200, 80)
 | 
						||
                                    }
 | 
						||
                                </td>
 | 
						||
                            </tr>
 | 
						||
                        </tbody>
 | 
						||
                    </table> : null
 | 
						||
                }
 | 
						||
 | 
						||
                {
 | 
						||
                    Nav_ListRiskSubmitContentDeal ?
 | 
						||
                        <table className={styles.PrintFormLight}>
 | 
						||
                            <tbody>
 | 
						||
                                <tr>
 | 
						||
                                    <td style={{ textAlign: "center", fontSize: '20px' }} >隐患整改记录</td>
 | 
						||
                                </tr>
 | 
						||
                                {
 | 
						||
                                    Nav_ListRiskSubmitContentDeal?.map(item => {
 | 
						||
                                        return <tr>
 | 
						||
                                            <td>
 | 
						||
                                                <div >
 | 
						||
                                                    <Descriptions title="" size="middle" bordered>
 | 
						||
                                                        <Descriptions.Item label="隐患地点">{item.Nav_SubmitContent?.ADDRESS}</Descriptions.Item>
 | 
						||
                                                        <Descriptions.Item label="检查问题描述">{item.Nav_SubmitContent?.DESCREPTION}</Descriptions.Item>
 | 
						||
                                                        <Descriptions.Item label="整改建议与措施">{item.Nav_SubmitContent?.DEMAND}</Descriptions.Item>
 | 
						||
                                                        <Descriptions.Item label="整改期限">{item.Nav_SubmitContent?.LastDateUser}</Descriptions.Item>
 | 
						||
                                                        <Descriptions.Item label="整改实施单位">{item.Nav_SubmitContent?.Nav_DepartmentDeal?.NAME}</Descriptions.Item>
 | 
						||
                                                        <Descriptions.Item label="附件(整改前)" >{
 | 
						||
                                                            showFiles(item.Nav_Files, config.picServerHost, true, 20)
 | 
						||
                                                        }</Descriptions.Item>
 | 
						||
                                                        <Descriptions.Item label="附件(整改后)" >{
 | 
						||
                                                            showFiles(item.Nav_FilesAfter, config.picServerHost, true, 20)
 | 
						||
                                                        }</Descriptions.Item>
 | 
						||
                                                        <Descriptions.Item label="整改后情况描述">{item.DEALDESCRIBE}</Descriptions.Item>
 | 
						||
 | 
						||
                                                        {
 | 
						||
                                                            ((item.DEALSITUATION >= 5 && item.DEALSITUATION != 20) || item.ISDEALSIGN || item.ISCHECKSIGN) ?
 | 
						||
                                                                <Descriptions.Item label="整改落实人签名">{
 | 
						||
                                                                    showUserSign(item.Nav_UserActualDeal, config.picServerHost, null, null, item.DATETIME_ACTUAL_DEAL)
 | 
						||
                                                                }</Descriptions.Item>
 | 
						||
                                                                :
 | 
						||
                                                                <Descriptions.Item label="整改落实人签名">{ }</Descriptions.Item>
 | 
						||
                                                        }
 | 
						||
 | 
						||
                                                        {
 | 
						||
                                                            item.ISDEALSIGN ?
 | 
						||
                                                                <Descriptions.Item label="整改责任人签名">{
 | 
						||
                                                                    showUserSign(item.Nav_UserDeal, config.picServerHost, null, null, item.DATETIME_DEALSIGN)
 | 
						||
                                                                }</Descriptions.Item>
 | 
						||
                                                                :
 | 
						||
                                                                <Descriptions.Item label="整改责任人签名">{
 | 
						||
                                                                }</Descriptions.Item>
 | 
						||
                                                        }
 | 
						||
                                                        {
 | 
						||
                                                            item.ISCHECKSIGN ?
 | 
						||
                                                                <Descriptions.Item label="整改验收人签名">{
 | 
						||
                                                                    showUserSign(item.Nav_UserCheck, config.picServerHostnull, null, null, item.DATETIME_CHECKSIGN)
 | 
						||
                                                                }</Descriptions.Item>
 | 
						||
                                                                :
 | 
						||
                                                                <Descriptions.Item label="整改验收人签名">{
 | 
						||
                                                                }</Descriptions.Item>
 | 
						||
                                                        }
 | 
						||
 | 
						||
                                                        <Descriptions.Item label="审核意见">{
 | 
						||
                                                            showApprove(item?.Nav_ApproveCheckAudit?.Nav_ApproveDetails, this.props.app.enums.NodeApproveStatus.enums, config.picServerHost, 200)
 | 
						||
                                                        }</Descriptions.Item>
 | 
						||
                                                    </Descriptions>
 | 
						||
                                                </div>
 | 
						||
                                            </td>
 | 
						||
                                        </tr>
 | 
						||
                                    })
 | 
						||
                                }
 | 
						||
                            </tbody>
 | 
						||
                        </table>
 | 
						||
                        : null
 | 
						||
                }
 | 
						||
 | 
						||
 | 
						||
            </div>
 | 
						||
        </div>
 | 
						||
    }
 | 
						||
}
 | 
						||
export default connect(({ login, app }) => ({ login, app }))(BS070ShowPrint) 
 |