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';

class BS076ShowOperateLog 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);
        }
    }


    loadData = (ids) => {
        var orgId = this.props.login ? this.props.login.OrgId : '';
        let json = initFilter(orgId, ids);
        this.props.dispatch({
            type: 'app/getDataByPost',
            payload: json,
            url: 'BS/BSOperateLog/OrderEntities',
            onComplete: (ret) => {
                debugger
                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 ref={el => (this.componentRef = el)} style={{ padding: '20px', paddingTop: '20px' }} id={'tableId' + this.props.data.id}>
                <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>
                        </tr>
                        {(data && data.length > 0) ? data.map((item, i) => {
                            return <tr>
                                <td>{item.USRTNAME} </td>
                                <td>{enums.OPERATEPOINT_Enums.enums[item.OPERATEPOINT]} </td>
                                <td>{item.CREATE_TIME} </td>
                                <td>{item.OPERTETIME} </td>
                                <td>{item.ISINTTIME != null ? (item.ISINTTIME ? '是' : '否') : ""} </td>
                            </tr>
                        }) : <tr><td colSpan={5} style={{ textAlign: 'left' }}>查无记录</td></tr>}
                    </tbody>
                </table>
            </div>
        </div>
    }
}
export default connect(({ login, app }) => ({ login, app }))(BS076ShowOperateLog) 
