/*
 * Creater:     YQL
 * CreateDate:  2022/09/05
 * Describe：   公共上传模块
 * 谨慎修改：组件、接口、表单、按钮显示隐藏均为配置
 * */
import React, { Component } from 'react';
import {
    message,
    Input,
    Button,
    Col,
    Form,
    Row,
    DatePicker,
    Icon,
    Spin,
    Select,
    Drawer,
    Progress,
    Modal,
    Tabs, Radio, Checkbox
} from 'antd';
import moment from 'moment';
import { Util, dayFormat } from 'tools/index';
import PubilcTablePagination from '../common/PubilcTablePagination';
import fetchJsonp from "fetch-jsonp";
import store from "../../store";
import Reports from '../raqSoft/reportsEmbed';
import ShowLoadModal from "../../components/showLoadingModal";
const FormItem = Form.Item;
class PublicUploadModular extends Component {
    constructor(props) {
        super(props);
        this.state = {
            page: 1,
            pageSize: 20,
            total: 0,
            loading: false,
            startDate: '',
            endDate: '',
            status: '', //状态  ''全部,0队列中,1上传中,2上传成功,99上传失败
            columns: [],
            uploadRecordData: [],
            uploadParams: '',  //当前功能模块传参
            typeResultOBJ: {},    //当前功能模型配置详情
            modalFunType: '',    //当前功能模块调用类型，取决于核心功能配置的reqType: 'code'/'dll'
            formData: {},    //Table组件表单数据
            maskStatus: false, //整体遮罩
            drawerVisible: false, //抽屉显示-隐藏

            modalVisible: false,   //进度条
            readlyUpLoadNum: 0,  //已完成个数(临时)
            readlySucessNum: 0,  //对账成功数
            currentPercent: 0,   // 更新进度条数值
            upLoadStatus: false,     //对账是否结束 true：成功，false：失败
        }
    }

    componentDidMount() {
        let params = '';
        if (this.props.location) {
            if (this.props.location.state) { params = this.props.location.state?.params || ''; }
        } else {
            if (this.props.paras) {
                params = this.props.paras?.params || '';
            } else {
                params = this.props?.params || '';
            }
        }
        params !== '' ? sessionStorage.setItem('uploadParams', params) : '';
        let uploadParams = sessionStorage.getItem('uploadParams');
        this.setState({
            uploadParams: params ? params : uploadParams
        }, function () {
            this.getTypeInfo();
            this.getColumn();
        });
    }

    // 获取表头信息
    getColumn = async () => {
        let data = {
            params: [{
                compontName: Util.getValueByUrlStr(this.state.uploadParams, 'componentName'),
                type: 'C',
                reactCode: [Util.getValueByUrlStr(this.state.uploadParams, 'componentName')]
            }]
        };
        const resObj = await React.$asyncPost(this, '01040073', data);
        if (resObj) {
            let errorCode = resObj.errorCode;
            if (+errorCode === 0) {
                let columns = resObj.result && resObj.result.C.length > 0 ? JSON.parse(JSON.stringify(resObj.result.C)).map(item => {
                    if (item.code === 'action') {
                        return {
                            align: item.align,
                            widthNum: parseInt(item.width),
                            width: item.width,
                            dataIndex: item.dataIndex,
                            title: item.title,
                            display: item.display,
                            key: item.seqNo,
                            render: (text, record) => (
                                <span>
                                    {this.state.typeResultOBJ?.detail?.visible === 'Y' ?
                                        <span style={{ color: 'rgba(1,6,0,0.57)', marginRight: '13px', cursor: 'pointer' }}
                                            onClick={() => this.uploadRecordItemDetail(record)}>{this.state.typeResultOBJ?.detail?.butName ? this.state.typeResultOBJ?.detail?.butName : '详情'}</span> : ''}

                                    {this.state.typeResultOBJ?.upload?.visible === 'Y' ?
                                        +record.uploadResult === 0 || +record.uploadResult === 3 ?
                                            <span style={{ color: '#2e41ff', cursor: 'pointer' }} onClick={() => this.uploadRecordItemAct(record)}>{this.state.typeResultOBJ?.upload?.uploadName ? this.state.typeResultOBJ?.upload?.uploadName : '上传'}</span> :
                                            +record.uploadResult === 2 || +record.uploadResult === 4 ?
                                                <span style={{ color: '#2e41ff', marginRight: '13px', cursor: 'pointer' }} onClick={() => this.uploadRecordItemAct(record)}>{this.state.typeResultOBJ?.upload?.uploadName ? '重新' + this.state.typeResultOBJ?.upload?.uploadName : '重新上传'}</span> : ''
                                        : ''}

                                    {this.state.typeResultOBJ?.delete?.visible === 'Y' ?
                                        +record.uploadResult === 2 || +record.uploadResult === 4 ?
                                            <span style={{ color: 'rgba(255,0,15,0.57)', cursor: 'pointer' }}
                                                onClick={() => this.uploadRecordItemDelete(record)}>{this.state.typeResultOBJ?.delete?.butName ? this.state.typeResultOBJ?.delete?.butName : '删除'}</span> : ''
                                        : ''}
                                </span>
                            )
                        }
                    } else if (item.code === 'responseMessage') {
                        return {
                            align: item.align,
                            widthNum: parseInt(item.width),
                            width: item.width,
                            dataIndex: item.dataIndex,
                            title: item.title,
                            display: item.display,
                            key: item.seqNo,
                            // render: (text, record) => (
                            //     <span>{text && text.toString().length > 60 ? text.substring(0,60)+'...' :text}</span>
                            // )
                        }
                    } else {
                        return {
                            align: item.align,
                            widthNum: parseInt(item.width),
                            width: item.width,
                            dataIndex: item.dataIndex,
                            title: item.title,
                            display: item.display,
                            key: item.seqNo
                        }
                    }
                }) : '';
                this.renderList(columns);//对指定的列进行渲染操作
                this.setState({
                    columns: columns,
                    formData: resObj.result?.formData
                });
                this.getFormDictData(resObj.result?.formData);//获取表单内的字典数据
            } else {
                message.error(resObj.errorMessage)
            }
        }
    };

    //获取表单内的字典数据
    getFormDictData = async (formData) => {
        if (!formData || formData.length < 1) {
            return
        }
        for (let i = 0; i < formData.length; i++) {
            //linkCode 有值，说明需要通过请求获取该表单类型下的字典
            if (formData[i].linkCode) {
                let data = {
                    params: [{
                        modularType: Util.getValueByUrlStr(this.state.uploadParams, 'modularType')
                    }]
                };
                const resObj = await React.$asyncPost(this, formData[i].linkCode, data);
                if (resObj) {
                    let errorCode = resObj.errorCode;
                    if (+errorCode === 0) {
                        this.setState({
                            [formData[i].code + "Dict"]: Util.addKeyValueToDataSource(resObj.result.Data)
                        })
                    } else {
                        message.error(resObj.errorMessage)
                    }
                }
            }
            //循环结束后调用查询，尽量延迟首次查询的时间点，待所有表单数据准备完成后执行
            if (i + 1 === formData.length) {
                setTimeout(() => { this.uploadRecordListQuery(); }, 800);
            }
        }
    };

    //对表头列进行渲染操作    上传状态字典数组：uploadResultDict
    renderList = (columnsValue) => {
        for (let i = 0; i < columnsValue.length; i++) {
            //状态渲染
            if (columnsValue[i].dataIndex === 'uploadResult') {
                columnsValue[i].render = (text) => {
                    //上传状态字典数组：uploadResultDict
                    let { uploadResultDict } = this.state;
                    if (uploadResultDict) {
                        for (let j = 0; j < uploadResultDict.length; j++) {
                            if (+text === +uploadResultDict[j].code && +text === 0) {
                                return (<span style={{ color: '#c8c8c8' }}>{uploadResultDict[j].desc}</span>)
                            } else if (+text === +uploadResultDict[j].code && +text === 1) {
                                return (<span style={{ color: '#2e41ff' }}>{uploadResultDict[j].desc}</span>)
                            } else if (+text === +uploadResultDict[j].code && +text === 2) {
                                return (<span style={{ color: '#19c909' }}>{uploadResultDict[j].desc}</span>)
                            } else if (+text === +uploadResultDict[j].code && +text === 3) {
                                return (<span style={{ color: '#EE3F3F' }}>{uploadResultDict[j].desc}</span>)
                            } else if (+text === +uploadResultDict[j].code && +text === 4) {
                                return (<span style={{ color: '#2e41ff' }}>{uploadResultDict[j].desc}</span>)
                            }
                        }
                    }
                }
            }
        }
    };

    //获取功能类型配置详情
    getTypeInfo = async () => {
        let data = {
            params: [{
                modularType: Util.getValueByUrlStr(this.state.uploadParams, 'modularType')
            }]
        };
        const resObj = await React.$asyncPost(this, '15030001', data);
        if (resObj) {
            let errorCode = resObj.errorCode;
            if (+errorCode === 0) {
                this.setState({
                    typeResultOBJ: resObj?.result,
                    modalFunType: resObj?.result?.upload?.reqType
                });
            } else {
                message.error(resObj.errorMessage)
            }
        }
    };

    //查询
    uploadRecordListQuery = async () => {
        //显示加载框
        this.childLoadExamine.showModal();
        let { page, pageSize } = this.state;
        let formValuesOBJ = this.getFormValues();
        let data = {
            params: [{
                modularType: Util.getValueByUrlStr(this.state.uploadParams, 'modularType'),
                componentName: Util.getValueByUrlStr(this.state.uploadParams, 'componentName'),
                ...formValuesOBJ
            }],
            pagination: [{
                pageSize: pageSize,
                currentPage: page
            }]
        };
        try {
            let resObj = await this.requestWayPackage('query', data);
            if (resObj) {
                let errorCode = resObj.errorCode;
                if (+errorCode === 0) {
                    let resListData = resObj.result && resObj.result.Data;
                    if (!resListData || resListData.length === 0) {
                        this.childLoadExamine.close();
                        message.warning('查询数据为空！');
                        this.setState({
                            uploadRecordData: [],
                            total: 0
                        });
                        return
                    }
                    for (let i = 0; i < resListData.length; i++) {
                        resListData[i].key = i;
                    }
                    this.setState({
                        uploadRecordData: Util.addKeyValueToDataSource(resListData),
                        total: resObj.result.TotalCount
                    }, function () {
                        this.setState({
                            maskStatus: false
                        });
                    })
                }
                this.childLoadExamine.close();
            } else {
                this.childLoadExamine.close();
            }
        } catch (err) {
            this.childLoadExamine.close();
        }
    };

    //全量上传
    uploadRecordALLAct = async () => {
        let { uploadRecordData } = this.state;
        let that = this;
        if (!uploadRecordData || uploadRecordData.length < 1) {
            message.warning('没有可操作数据！');
            return
        }
        this.setState({ modalVisible: true });
        for (let i = 0; i < uploadRecordData.length; i++) {
            //批量时，不是已提交的状态才允许调用上传。已提交为最终状态
            if (+uploadRecordData[i].uploadResult !== 4) {
                await that.uploadRecordItemAct(uploadRecordData[i], 'batch');

                this.setState({
                    readlyUpLoadNum: i + 1,  //已完成个数(临时)
                    readlySucessNum: i + 1,  //对账成功数
                    currentPercent: Math.floor(100 / uploadRecordData.length * (i + 1)),   // 更新进度条数值
                    upLoadStatus: i === uploadRecordData.length - 1
                });
            }
        }
    };

    //上传
    uploadRecordItemAct = async (record, state) => {
        let formValuesOBJ = this.getFormValues();
        let data = {
            params: [{
                modularType: Util.getValueByUrlStr(this.state.uploadParams, 'modularType'),
                ...formValuesOBJ,
                items: { ...record }
            }]
        };
        //不是批量的才显示遮罩
        if (state !== 'batch') {
            //显示遮罩
            this.setState({ maskStatus: true });
        }
        let resObj = await this.requestWayPackage('upload', data);
        if (resObj) {
            let errorCode = resObj.errorCode;
            if (+errorCode !== 0) {
                this.setState({ maskStatus: false });
                message.error(resObj.errorMessage);
            }
            //保存记录
            let markData = {
                params: [{
                    modularType: Util.getValueByUrlStr(this.state.uploadParams, 'modularType'),
                    items: { ...record },
                    result: resObj
                }]
            };
            if (this.state.modalFunType === 'dll') {
                const markResObj = await this.requestWayPackage('mark', markData);
                //reqDllSecFlag === 'Y' 二次调用dll
                if (+markResObj.errorCode === 0 && markResObj.reqDllSecFlag === 'Y') { //这里考虑重复上传时errorCode为0,但后台要求继续后续调用的情况,【注意】第二次mark保存必须带uploadTimes且必须大于1
                    this.uploadRecordItemActDllSec(record, state, markResObj)
                } else {
                    if (state !== 'batch') {
                        this.setState({ maskStatus: false });
                        this.uploadRecordListQuery();
                    }
                }
            } else {
                if (state !== 'batch') {
                    this.setState({ maskStatus: false });
                    this.uploadRecordListQuery();
                }
            }
        }
    };

    //二次dll上传调用
    uploadRecordItemActDllSec = async (record, state, markResObj) => {
        let resObj = await this.requestDllSecond('upload', markResObj?.result);
        if (resObj) {
            let errorCode = resObj.errorCode;
            if (+errorCode !== 0) {
                message.error(resObj.errorMessage)
            }
            if (state !== 'batch') {
                this.setState({ maskStatus: false });
                this.uploadRecordListQuery();
            }
            //保存记录
            let markData = {
                params: [{
                    modularType: Util.getValueByUrlStr(this.state.uploadParams, 'modularType'),
                    items: { ...record },
                    result: resObj,
                    uploadTimes: 2
                }]
            };
            const markResObj = await this.requestWayPackage('mark', markData);
        }
    };

    //获取Form表单键值，处理日期值的格式
    getFormValues = () => {
        let formValues = this.props.form.getFieldsValue();
        if (formValues.startDate !== undefined) {
            formValues.startDate = moment(formValues?.startDate).format(dayFormat);
        }
        if (formValues.endDate !== undefined) {
            formValues.endDate = moment(formValues?.endDate).format(dayFormat);
        }
        return formValues
    };

    // 提供修改page和pageSize的回调函数
    compilePage = (page, pageSize) => {
        this.setState({ page, pageSize }, () => {
            this.uploadRecordListQuery();
        })
    };

    //公共上传组件请求方式封装  CODE/DLL
    requestWayPackage = async (type, data) => {
        let { typeResultOBJ } = this.state;
        let requestParams = typeResultOBJ[type];
        if (requestParams?.reqType === 'dll') {
            const resObj = await React.$asyncPost(this, requestParams?.reqCode, data);
            if (resObj) {
                let errorCode = resObj.errorCode;
                if (+errorCode === 0) {
                    let dllParams = "{'inputDir':'" + requestParams?.reqDllRoute + "','clsName':'" + requestParams?.reqDllClsName + "','funcName':'" + requestParams?.reqDllFunName + "','dllInput':'" + JSON.stringify(resObj?.result) + "'}";
                    if (typeof (CefSharp) != "undefined") { // 新元素定制浏览器
                        CefSharp.BindObjectAsync("xysCefToJavaScripts");
                        return new Promise((resolve, reject) => {
                            xysCefToJavaScripts.driveLocalHardware(dllParams).then((returnVale) => {
                                resolve(JSON.parse(returnVale));
                            })
                        })
                    } else {
                        const frame = chrome?.webview?.hostObjects?.Bridge || ''; // 新版浏览器
                        if (frame) {
                            frame.DynamicLoadingDLL(dllParams)
                                .then(
                                    data => {
                                        resolve(JSON.parse(data));
                                    },
                                    err => {
                                        console.log(err);
                                        reject(err);
                                    }
                                )
                        }
                    }
                } else {
                    message.error(resObj.errorMessage);
                }
            }
        } else if (requestParams?.reqType === 'code') {
            return new Promise((resolve, reject) => {
                const resObj = React.$asyncPost(this, requestParams?.reqCode, data);
                resolve(resObj);
            })
        } else {
            message.warning('无效请求方式，请检查医保基础配置');
        }
    };

    //二次dll调用函数
    requestDllSecond = async (type, dllResult) => {
        let { typeResultOBJ } = this.state;
        let requestParams = typeResultOBJ[type];
        if (dllResult) {
            let dllParams = "{'inputDir':'" + requestParams?.reqDllRoute + "','clsName':'" + requestParams?.reqDllClsName + "','funcName':'" + requestParams?.reqDllFunName + "','dllInput':'" + JSON.stringify(dllResult) + "'}";
            if (typeof (CefSharp) != "undefined") {   // 新元素定制浏览器
                CefSharp.BindObjectAsync("xysCefToJavaScripts");
                return new Promise((resolve, reject) => {
                    xysCefToJavaScripts.driveLocalHardware(dllParams).then((returnVale) => {
                        resolve(JSON.parse(returnVale));
                    })
                })
            } else {
                const frame = chrome?.webview?.hostObjects?.Bridge || ''; // 新版浏览器
                if (frame) {
                    frame.DynamicLoadingDLL(dllParams)
                        .then(
                            data => {
                                resolve(JSON.parse(data));
                            },
                            err => {
                                console.log(err);
                                reject(err);
                            }
                        )
                }
            }
        }
    };

    //详情
    uploadRecordItemDetail = async (record) => {
        //rpx:报表模式
        if (this.state.typeResultOBJ?.detail?.reqType === 'rpx') {
            this.setState({
                drawerItems: record,
                drawerVisible: true
            });
        }
        //其他为code或dll模式
        else {
            message.warning('详情模块其他展示模式暂未开放');
            // let data = {
            //     params: [{
            //         modularType:Util.getValueByUrlStr(this.state.uploadParams,'modularType'),
            //         items: {...record}
            //     }]
            // };
            // let resObj = await this.requestWayPackage('detail',data);
            // if (resObj) {
            //     let errorCode = resObj.errorCode;
            //     if (+errorCode === 0) {
            //         this.setState({
            //             drawerVisible:true
            //         });
            //     }else {
            //         message.error(resObj.errorMessage)
            //     }
            // }
        }
    };

    //删除
    uploadRecordItemDelete = async (record) => {
        let data = {
            params: [{
                modularType: Util.getValueByUrlStr(this.state.uploadParams, 'modularType'),
                items: { ...record }
            }]
        };
        let resObj = await this.requestWayPackage('delete', data);
        if (resObj) {
            let errorCode = resObj.errorCode;
            if (+errorCode === 0) {
                message.success('删除操作成功');
                this.uploadRecordListQuery();
            } else {
                message.error(resObj.errorMessage)
            }
            //保存记录
            let markData = {
                params: [{
                    modularType: Util.getValueByUrlStr(this.state.uploadParams, 'modularType'),
                    items: { ...record },
                    result: resObj,
                    tab: 'delete'
                }]
            };
            if (this.state.modalFunType === 'dll') {
                const markResObj = await this.requestWayPackage('mark', markData);
            }
        }
    };

    //抽屉关闭事件
    drawerOnClose = () => {
        this.setState({
            drawerVisible: false,
        });
    };

    //公共组件加载等待框
    onLoadModalRef = (ref) => {
        this.childLoadExamine = ref;
    };

    //关闭进度窗口
    closeLoadModal = () => {
        this.setState({
            modalVisible: false,
            currentPercent: 0,   // 更新进度条数值
            readlyUpLoadNum: 0,
            readlySucessNum: 0,
            upLoadStatus: false,     //上传是否结束 true：成功，false：失败
            maskStatus: false
        });
        this.uploadRecordListQuery();
    };

    render() {
        let { page, pageSize, total, loading, columns, uploadRecordData } = this.state;
        const { getFieldDecorator } = this.props.form;
        const params = {
            page,
            pageSize,
            total,
            loading,
            columns,
            data: uploadRecordData,
            x: 900,
            y: store.getState().tableHeight.y + 81 - this.state.headerHeight,
            height: store.getState().tableHeight.y + 158 - 85 + 'px',
            rowKey: 'uploadId',
            componentName: Util.getValueByUrlStr(this.state.uploadParams, 'componentName')
        };
        return (
            <div>
                <Spin spinning={this.state.maskStatus} tip="数据整理中，请勿离开...">
                    <Row justify='space-between' style={{ paddingTop: '10px' }}>
                        <Col span={20} style={{ paddingLeft: '20px' }}>
                            <Form>
                                {
                                    this.state.formData && this.state.formData.length > 0 ?
                                        this.state.formData.map((item, index) => {
                                            if (item?.typeCode === 'Date') {
                                                return (
                                                    <Col span={item?.col}>
                                                        <FormItem {...{ labelCol: { span: item?.labelCol }, wrapperCol: { span: item?.wrapperCol } }} label={item?.descripts}>
                                                            {getFieldDecorator(item?.code, {
                                                                initialValue: moment(new Date, dayFormat).subtract(item?.default, 'days'),
                                                                rules: [{ required: false, message: item?.placeholder }],
                                                            })(
                                                                <DatePicker
                                                                    allowClear={false}
                                                                    placeholder={item?.placeholder}
                                                                    format={dayFormat} />
                                                            )}
                                                        </FormItem>
                                                    </Col>
                                                )
                                            } else if (item?.typeCode === 'Input') {
                                                return (
                                                    <Col span={item?.col}>
                                                        <FormItem {...{ labelCol: { span: item?.labelCol }, wrapperCol: { span: item?.wrapperCol } }} label={item?.descripts}>
                                                            {getFieldDecorator(item?.code, {
                                                                initialValue: item?.default,
                                                                rules: [{ required: false, message: item?.placeholder }],
                                                            })(
                                                                <Input placeholder={item?.placeholder} />
                                                            )}
                                                        </FormItem>
                                                    </Col>
                                                )
                                            } else if (item?.typeCode === 'Select') {
                                                return (
                                                    <Col span={item?.col}>
                                                        <FormItem {...{ labelCol: { span: item?.labelCol }, wrapperCol: { span: item?.wrapperCol } }} label={item?.descripts}>
                                                            {getFieldDecorator(item?.code, {
                                                                initialValue: item?.default,
                                                                rules: [{ required: false, message: item?.placeholder }],
                                                            })(
                                                                <Select allowClear showSearch>{
                                                                    this.state[item?.code + "Dict"] && this.state[item?.code + "Dict"].map(data => {
                                                                        return (<Select.Option value={data?.code} key={data?.id}>{data?.desc}</Select.Option>)
                                                                    })
                                                                }
                                                                </Select>
                                                            )}
                                                        </FormItem>
                                                    </Col>
                                                )
                                            } else if (item?.typeCode === 'Radio') {
                                                return (
                                                    <Col span={item?.col}>
                                                        <FormItem {...{ labelCol: { span: item?.labelCol }, wrapperCol: { span: item?.wrapperCol } }} label={item?.descripts}>
                                                            {getFieldDecorator(item?.code, {
                                                                initialValue: item?.default,
                                                                rules: [{ required: false, message: item?.placeholder }],
                                                            })(
                                                                <Radio.Group>
                                                                    {
                                                                        this.state[item?.code + "Dict"] && this.state[item?.code + "Dict"].map(data => {
                                                                            return (<Radio value={data?.code}>{data?.desc}</Radio>)
                                                                        })
                                                                    }
                                                                </Radio.Group>
                                                            )}
                                                        </FormItem>
                                                    </Col>
                                                )
                                            } else if (item?.typeCode === 'CheckBox') {
                                                return (
                                                    <Col span={item?.col}>
                                                        <FormItem {...{ labelCol: { span: item?.labelCol }, wrapperCol: { span: item?.wrapperCol } }} label={item?.descripts}>
                                                            {getFieldDecorator(item?.code, {
                                                                initialValue: item?.default,
                                                                rules: [{ required: false, message: item?.placeholder }],
                                                            })(
                                                                <Checkbox.Group>
                                                                    {
                                                                        this.state[item?.code + "Dict"] && this.state[item?.code + "Dict"].map(data => {
                                                                            return (<Checkbox value={data?.code}>{data?.desc}</Checkbox>)
                                                                        })
                                                                    }
                                                                </Checkbox.Group>
                                                            )}
                                                        </FormItem>
                                                    </Col>
                                                )
                                            } else {

                                            }
                                        })
                                        : ''
                                }
                            </Form>
                        </Col>
                        <Col span={4} style={{ textAlign: 'right', paddingRight: '20px' }}>
                            <Button type='primary' onClick={this.uploadRecordListQuery}>查询</Button>
                            {this.state.typeResultOBJ?.upload?.visible === 'Y' ?
                                <Button type='primary' style={{ marginLeft: '20px' }} onClick={this.uploadRecordALLAct} >{this.state.typeResultOBJ?.upload?.uploadName ? '全量' + this.state.typeResultOBJ?.upload?.uploadName : '全量上传'}</Button> : ''}
                        </Col>
                    </Row>
                    <Row style={{ marginTop: 20 }}>
                        <PubilcTablePagination param={params} compilePage={this.compilePage} getColumns={this.getColumn} />
                    </Row>

                    {/*公用加载框*/}
                    <ShowLoadModal onRef={this.onLoadModalRef} />

                    <Drawer style={{ paddingTop: '50px' }}
                        title="预览信息" placement="right" closable={true} width='65%' onClose={this.drawerOnClose} visible={this.state.drawerVisible}>
                        <Row gutter={10} style={{ marginBottom: '15px' }}>
                            <div style={{ height: store.getState().tableHeight.y + 130 + 'px', overflow: 'auto' }}>
                                <Reports
                                    raqName={this.state.typeResultOBJ?.detail?.reqCode}
                                    params={{
                                        modularType: Util.getValueByUrlStr(this.state.uploadParams, 'modularType'),
                                        insuAdmNo: this.state.drawerItems?.insuAdmNo || '',
                                        drawerItems: this.state.drawerItems
                                    }}
                                />
                            </div>
                        </Row>
                    </Drawer>

                    {/*进度框*/}
                    <Modal
                        visible={this.state.modalVisible}
                        title={[<div>数据整理中&nbsp;&nbsp;<Spin spinning={!this.state.upLoadStatus} /></div>]}
                        onCancel={this.closeLoadModal}
                        closable={false}
                        centered={true}
                        maskClosable={false}  //关闭点击遮罩退出
                        footer={[
                            <Button type='primary' onClick={this.closeLoadModal} disabled={!this.state.upLoadStatus}>
                                {!this.state.upLoadStatus ? '正在操作...' : '关闭并刷新数据'}
                            </Button>
                        ]}
                    >
                        <Row style={{ textAlign: "center" }}>
                            <p>
                                共<span style={{ color: '#8e841a' }}>{uploadRecordData.length}</span>条账单<br />
                                完成<span style={{ color: '#0a9237' }}>{this.state.readlyUpLoadNum}</span>条 ,剩余<span style={{ color: '#FF8000' }}>{uploadRecordData.length - this.state.readlyUpLoadNum}</span>条<br />
                            </p>
                            <Progress type="circle" strokeColor={{ '0%': '#108ee9', '100%': '#87d068' }} status={this.state.upLoadStatus ? this.state.readlyUpLoadNum === uploadRecordData.length ? "success" : "exception" : "normal"} percent={this.state.currentPercent} />
                        </Row>
                    </Modal>


                    {/*<Tabs activeKey={currentKeys} onChange={handleTabsChange}>*/}
                    {/*    <Tabs.TabPane tab="诊断信息" key="1">*/}
                    {/*        <div style={{ padding: '12px' }}>*/}
                    {/*            <PubilcTablePagination*/}
                    {/*                param={{*/}
                    {/*                    columns: fundDiagnosisColumns && fundDiagnosisColumns.length > 0 ? fundDiagnosisColumns : [], 	// 表头配置*/}
                    {/*                    data: diagnosisTableData, // 表格数据*/}
                    {/*                    loading: fundPayLoading,*/}
                    {/*                    pageSize: '20',*/}
                    {/*                    componentName: 'FundDiagnosis',*/}
                    {/*                    // x: fundPayTotalWidth, // 表格的宽度*/}
                    {/*                    // y: store.getState().commonData.y - 584 - clientQueryHeight,*/}
                    {/*                    // height: store.getState().commonData.y - 534 - clientQueryHeight + 'px',*/}
                    {/*                }}*/}
                    {/*                getColumns={getFundDiagnosis}*/}
                    {/*            />*/}
                    {/*        </div>*/}
                    {/*    </Tabs.TabPane>*/}
                    {/*</Tabs>*/}
                </Spin>
            </div>
        );
    }
}
const PublicUploadModularForm = Form.create()(PublicUploadModular);
export default PublicUploadModularForm;
