

/*
 * @Author: code4eat awesomedema@gmail.com
 * @Date: 2022-12-16 09:42:52
 * @LastEditors: code4eat awesomedema@gmail.com
 * @LastEditTime: 2023-03-31 12:41:30
 * @FilePath: /BudgetManaSystem/src/pages/budgetMana/monthlySet/index.tsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */



import BMSPagecontainer from '@/components/BMSPageContainer';

import { useEffect, useRef, useState } from 'react';
import './style.less';

import { Tree, TreeProps, Tabs, Input, Modal, Transfer, Divider, Select, Popconfirm, message, Button, Skeleton, Popover } from 'antd';
import { DataNode } from 'antd/es/tree';

import expandedIcon from '../../../../static/treenode_open.png';
import closeIcon from '../../../../static/treenode_collapse.png';
import { BMSTable } from '@/components/BMSTable';
import { ActionType, ModalForm, ProColumns, ProColumnType, ProForm, ProFormDependency, ProFormDigit, ProFormInstance, ProFormSelect, ProFormText, ProFormTextArea } from '@ant-design/pro-components';
import { createFromIconfontCN } from '@ant-design/icons';
import { addTableData, checkMonthlyReq, delTableDataRequest, downloadTemplateReq, editCheckProject, editManaIndexTableData, editTableData, editTableSalaryRequest, generateCheckProjectTableData, getCheckItemCalcStatus, getCheckProjectTableData, getCostData, getDepLists, getEmps, getHesuanUnits, getIncomeData, getManaIndexGroup, getManaIndexTableData, getNoCheckTableData, getPageCheckStatus, getProjects, getSalaryInfoTableData, importMonthlyperformanceRelaFiles } from './service';
import { TransferDirection } from 'antd/es/transfer';

import editIcon from '../../../../static/editIcon.png';
import conformIcon from '../../../../static/confirmIcon.png';
import { getComputeDate } from '@/pages/Home/service';
import BMSModalForm from '@/components/BMSModalForm';
import { DefaultOptionType } from 'antd/es/select';
import { getTreeData, getTreeDataRespType } from '../monthlyInfoCheck/service';
import DirectoryTree from 'antd/es/tree/DirectoryTree';
import BMSUpload from '@/components/BMSUpload';
import FormItem from 'antd/es/form/FormItem';
import { getDeepestTreeData } from '@/utils/tooljs';




const IconFont = createFromIconfontCN({
    scriptUrl: '//at.alicdn.com/t/c/font_1927152_4nm5kxbv4m3.js',
});


export type TableListItem = {
    key: number;
    name: string;
};



const MonthlyDataCheck: React.FC = () => {

    const [treeData, set_treeData] = useState<getTreeDataRespType[]>([]);

    const [ifShowTip, set_ifShowTip] = useState(false);

    const [expandedKeys, setExpandedKeys] = useState<React.Key[]>([]);
    const [searchValue, setSearchValue] = useState('');
    const [autoExpandParent, setAutoExpandParent] = useState(true);
    const [auditType, set_auditType] = useState('0');

    const [tableColumn, set_tableColumn] = useState<ProColumns & { [key: string]: any }[]>([]);
    const [currentSelectedTreeNode, set_currentSelectedTreeNode] = useState<any | undefined>();
    const [currentSelectedTabKey, set_currentSelectedTabKey] = useState<string>('1');

    const [currentComputeDate, set_currentComputeDate] = useState<string | undefined>(undefined);

    const [editTableCellId, set_editTableCellId] = useState<number | undefined>(undefined);

    const [tableDataSearchKeywords, set_tableDataSearchKeywords] = useState<string>('');

    const [tableDataFilterParams, set_tableDataFilterParams] = useState<any | undefined>(undefined);

    const [editModalVisible, set_editModalVisible] = useState(false);

    const [loading, set_loading] = useState(false);

    const [currentEditRecord, set_currentEditRecord] = useState<undefined | any>(undefined);

    const [inputSalaryNum, set_inputSalaryNum] = useState(0);  //固定工资金额

    const [checkItemvalNum, set_checkItemvalNum] = useState(0); //考核项目数值

    const [isTableEdit, set_isTableEdit] = useState(false);

    const [totalNum, set_totalNum] = useState(0);  //收入和成本数据的总和数值

    const [tableH,set_tableH] = useState(0);

    const [manaIndexGroups, set_manaIndexGroups] = useState<{ id: number, groupCode: string, groupName: string, hospId: number }[]>([]); //管理指标分组
    const [currentSelectedManaGroup, set_currentSelectedManaGroup] = useState<{ id: number, groupCode: string, groupName: string, hospId: number }>();

    const formRef = useRef<ProFormInstance>();

    const tableRef = useRef<ActionType>();

    const tableColumnOne = [
        {
            title: '职类',
            dataIndex: 'unitTypeName',
            key: 'unitTypeName',
     
        },
        {
            title: '核算单元名称',
            dataIndex: 'unitName',
            key: 'unitName',
          
        },
        {
            title: '科室',
            dataIndex: 'deptName',
            key: 'deptName',
           
        },
        {
            title: '工号',
            dataIndex: 'empNo',
            key: 'empNo',
            
        },
        {
            title: '姓名',
            dataIndex: 'empName',
            key: 'empName',
            
        },
        {
            title: '工资类型',
            dataIndex: 'salaryType',
            key: 'salaryType',
           
        },

    ]

    const tableColumnTwo = [
        {
            title: '职类',
            dataIndex: 'unitTypeName',
            key: 'unitTypeName',
           
        },
        {
            title: '核算单元名称',
            dataIndex: 'unitName',
            key: 'unitName',
         
        },
        {
            title: '科室',
            dataIndex: 'deptName',
            key: 'deptName',
           
        },
        {
            title: '项目名称',
            dataIndex: 'assessmentName',
            key: 'assessmentName',
            
        },
        {
            title: '分配方式',
            dataIndex: 'distributionType',
            key: 'distributionType',
          
            render: (record: any) => {

                if (record == 1) return '占比'
                if (record == 2) return '绝对数'
                if (record == 3) return '自动计算'
            }
        },
        {
            title: '数值',
            dataIndex: 'value',
            key: 'value',
         
        },
        {
            title: '工号',
            dataIndex: 'targetValue',
            key: 'targetValue',
          
        },
        {
            title: '姓名',
            dataIndex: 'targetValueName',
            key: 'targetValueName',
          
        },
        {
            title: '说明',
            dataIndex: 'description',
            key: 'description',
          
        }

    ];

    const tableColumnThree = [
        {
            title: '项目名称',
            dataIndex: 'itemName',
            key: 'itemName',
        
        },
        {
            title: '类型',
            dataIndex: 'itemTypeName',
            key: 'itemTypeName',
          

        },
        {
            title: '点值',
            dataIndex: 'orderPointValue',
            key: 'orderPointValue',
         
        },
    ];

    const tableColumnFive = [
        {
            title: '年度',
            dataIndex: 'year',
            key: 'year',
           
        },
        {
            title: '月份',
            dataIndex: 'month',
            key: 'month',
           
        },
        {
            title: '项目名称',
            dataIndex: 'itemName',
            key: 'itemName',
        
        },
        {
            title: '项目类型',
            dataIndex: 'itemTypeName',
            key: 'itemTypeName',
         
        },
        {
            title: '金额',
            dataIndex: 'cost',
            key: 'cost',
          
        },
        // {
        //     title: '操作人',
        //     dataIndex: 'unitType',
        //     key: 'unitType',
        //     align: 'center'
        // },
        // {
        //     title: '操作时间',
        //     dataIndex: 'unitType',
        //     key: 'unitType',
        //     align: 'center'
        // },
    ]

    let inervalhander = undefined;

    const getCurrentComputeDate = async () => {
        const resp = await getComputeDate();
        set_currentComputeDate(resp);
    }

    const onSelectHandle: TreeProps['onSelect'] = (selectedKeys, info) => {

        const { node } = info;
        //set_tableDataFilterParams({...tableDataFilterParams,current:1})
        set_currentSelectedTreeNode(node);

    };


    const onExpand = (newExpandedKeys: React.Key[]) => {
        setExpandedKeys(newExpandedKeys);
        setAutoExpandParent(false);
    };


    //固定金额编辑金额
    const editHandle = async (record: any) => {
        const { id, deptCode, salaryType, unitCode, userId } = record;
        if (id == editTableCellId) {
            //保存
            // console.log({ inputSalaryNum,currentSelectedTreeNode });

            if (inputSalaryNum) {

                const resp = await editTableSalaryRequest({
                    computeDate: currentComputeDate as string,
                    unitCode,
                    deptCode, salaryType,
                    salary: inputSalaryNum,
                    userId: `${userId}`,
                    id

                });
                if (resp) {
                    tableRef.current?.reload();
                }
            }

            set_editTableCellId(undefined);
        } else {
            //编辑
            set_editTableCellId(id);
        }

    }


    //考核项目编辑数值
    const editCheckItemValHandle = async (record: any) => {
        const { id, itemCode, itemName, itemType, orderPointValue, executePointValue, hospId, unitCode } = record;
        if (id == editTableCellId) {
            //保存
            if (checkItemvalNum) {
                const resp = await editCheckProject({
                    computeDate: currentComputeDate as string,
                    itemCode,
                    itemName,
                    itemType,
                    orderPointValue,
                    value: checkItemvalNum,
                    executePointValue,
                    hospId,
                    unitCode,
                    id

                });
                if (resp) {
                    tableRef.current?.reload();
                }
            }

            set_editTableCellId(undefined);
        } else {
            //编辑
            set_editTableCellId(id);
        }

    }

    const checkProjectEditHandle = (record: any) => {
        //   console.log({record});
        const { props: { record: _record } } = record;
        set_currentEditRecord(_record);
        set_editModalVisible(true);

    }

    const tableDataAddHandle = () => {
        set_editModalVisible(true);
    }

    //表格行编辑
    const tableEditActHandle = (record: any) => {
        //console.log({'edit':record});
        set_isTableEdit(true);
        set_currentEditRecord(record);
        set_editModalVisible(true);
    }


    //管理指标row编辑
    const EditManaIndexTableRow = ({ record }: { record: any }) => {

        const { value, columns, unitName, id, unitCode, totalScore, computeDate, groupId } = record;

        return (
            <ModalForm
                title={`编辑${unitName}实际值`}
                width={500}
                // layout='inline'
                trigger={
                    <a key={'1'} style={{ textAlign: 'center', width: '100%' }}>编辑</a>
                }
                initialValues={record}
                onFinish={async (values) => {


                    const editResult = value.map((a: any) => {
                        return {
                            ...a,
                            value: values[`value${a.code}`]
                        }
                    })

                    const data = {
                        id,
                        unitCode,
                        unitName,
                        totalScore,
                        computeDate,
                        groupId,
                        value: editResult
                    }
                    const resp = await editManaIndexTableData(data);
                    if (resp) {
                        tableRef.current?.reload();
                    }
                    return true
                }}
            >
                {
                    value.map((item: any, index: any) => {
                        const findTitle = columns.filter((a: any) => a.key == item.code);
                        return (
                            findTitle.length > 0 ? <ProFormDigit key={index} label={`${findTitle[0].dataIndex}`} name={`value${item.code}`} min={1} max={10} /> : null
                        )
                    })
                }
            </ModalForm>
        )
    }


    const onTabChange = (activeKey: string) => {
        set_currentSelectedTabKey(activeKey);
    }

    //获取核算单元树结构
    const getCheckUnitTreeDataFunc = async (computeDate: string) => {
        const resp = await getTreeData(computeDate);
        if (resp) {
            set_treeData(resp);
        }
    }


    const getCalcStatus =async () => {
        const resp = await getCheckItemCalcStatus(currentComputeDate as string,'ASSESSMENT');
        if(resp){
           if(resp.calculating){
            //继续计算
            set_loading(true);
            return false
           }else{
            //计算已完成
            set_loading(false);
            return true
           }
        }else{
           tableRef.current?.reload();
           return true
        }
   }

    const getTableData = async (type: '1' | '2' | '3' | '4' | '5' | '6', params: any, sort: any, filter: any) => {

        if (currentComputeDate) {
            if (type == '1') {
                const resp = await getSalaryInfoTableData({
                    computeDate: currentComputeDate,
                    ...params
                });
                if (resp) {
                    return {
                        data: resp.list,
                        total: resp.totalCount,
                        pageSize: resp.pageSize,
                        totalPage: resp.totalPage,
                        success: true
                    }
                }
            }
            if (type == '2') {
                const resp = await getNoCheckTableData({
                    computeDate: currentComputeDate,
                    ...params
                });
                if (resp) {
                    return {
                        data: resp.list,
                        total: resp.totalCount,
                        pageSize: resp.pageSize,
                        totalPage: resp.totalPage,
                        success: true
                    }
                }
            }
            if (type == '3') {

                

                if(!loading){
                    //计算完和未计算

                    const resp = await getCheckProjectTableData({
                        computeDate: currentComputeDate,
                        unitCode: currentSelectedTreeNode.code,
                        ...params
                    });
                    if (resp) {
                        return {
                            data: resp.list,
                            success: true,
                            total: resp.totalCount,
                            pageSize: resp.pageSize,
                            totalPage: resp.totalPage,
                        }
                    }
                }
            }
            if (type == '4') {
                if (currentSelectedManaGroup) {

                    const resp = await getManaIndexTableData({ ...params, computeDate: currentComputeDate, groupId: currentSelectedManaGroup.id });
                    if (resp) {
                        const columns = resp.title.map((item: any) => (item.children ? {
                            title: () => {
                                return <div>{item.name} <span style={{ fontSize: 14, fontFamily: 'SourceHanSansCN-Medium, SourceHanSansCN', fontWeight: 500, color: item.arrow == 'up' ? '#00BF8F' : '#FF4060' }}>{item.arrow == 'up' ? '↑' : '↓'}</span></div>
                            },
                            key: item.code,
                            dataIndex: item.name,
                            children: item.children.map((a: any) => {
                                return {
                                    title: a.name,
                                    dataIndex: `${a.code}${item.code}`,
                                    key: `${a.code}${item.code}`,
                                    width: 100,
                                    align: 'center',
                                }

                            })
                        } : {
                            title: item.name,
                            dataIndex: item.code,
                            key: item.code,
                            width: 100,
                            align: 'center',
                        }));




                        set_tableColumn([{
                            title: '核算单元',
                            dataIndex: 'unitName',
                            key: 'unitName',
                          
                            width: 120,
                            fixed: 'left',
                        }, ...columns,
                        {
                            title: '总得分',
                            dataIndex: 'totalScore',
                            key: 'totalScore',
                          
                            width: 100,
                            fixed: 'right',
                        },
                        ]);

                        const data = resp.managerData.map((item: any) => {

                            let rowData: { [key: string]: any } = {};

                            for (let index = 0; index < item.value.length; index++) {
                                for (const key in item.value[index]) {

                                    if (key != 'code') {
                                        rowData[`${key}${item.value[index].code}`] = item.value[index][`${key}`]
                                    }
                                }
                            }

                            return { ...item, ...rowData, id: item.id, columns }
                        });

                        return {
                            data: data,
                            success: true,
                            total: resp.totalCount,
                            pageSize: resp.pageSize,
                            totalPage: resp.totalPage,
                        }
                    }
                }

            }

            if (type == '5') {
                const resp = await getIncomeData({
                    computeDate: currentComputeDate,
                    ...params
                });
                if (resp) {
                    set_totalNum(resp.sum);
                    return {
                        data: resp.pageList.list,
                        success: true,
                        total: resp.pageList.totalCount,
                        pageSize: resp.pageList.pageSize,
                        totalPage: resp.pageList.totalPage,
                    }
                }
            }
            if (type == '6') {
                const resp = await getCostData({
                    computeDate: currentComputeDate,
                    ...params
                });
                if (resp) {
                    set_totalNum(resp.sum);
                    return {
                        data: resp.pageList.list,
                        success: true,
                        total: resp.pageList.totalCount,
                        pageSize: resp.pageList.pageSize,
                        totalPage: resp.pageList.totalPage,
                    }
                }
            }
        }

        return []
    }

    const tableDataSearchHandle = (paramName: string) => {


        set_tableDataFilterParams({
            ...tableDataFilterParams,
            [`${paramName}`]: tableDataSearchKeywords
        })
    }

    //表格删除确认
    const delActionHandle = async (record: any, index: number) => {

        const { id } = record;
        const resp = await delTableDataRequest({
            computeDate: currentComputeDate as string,
            id,
            index
        });
        if (resp) {
            tableRef.current?.reload();
            message.success('删除成功！')
        }

    };




    interface RecordType {
        key: string;
        title: string;
        description: string;
    }


    const mockData: RecordType[] = Array.from({ length: 20 }).map((_, i) => ({
        key: i.toString(),
        title: `content${i + 1}`,
        description: `description of content${i + 1}`,
    }));

    const initialTargetKeys = mockData.filter((item) => Number(item.key) > 10).map((item) => item.key);


    const TransferNode = () => {

        const [targetKeys, setTargetKeys] = useState(initialTargetKeys);
        const [selectedKeys, setSelectedKeys] = useState<string[]>([]);

        const onChange = (nextTargetKeys: string[], direction: TransferDirection, moveKeys: string[]) => {
            console.log('targetKeys:', nextTargetKeys);
            console.log('direction:', direction);
            console.log('moveKeys:', moveKeys);
            setTargetKeys(nextTargetKeys);
        };

        const onSelectChange = (sourceSelectedKeys: string[], targetSelectedKeys: string[]) => {
            console.log('sourceSelectedKeys:', sourceSelectedKeys);
            console.log('targetSelectedKeys:', targetSelectedKeys);
            setSelectedKeys([...sourceSelectedKeys, ...targetSelectedKeys]);
        };



        return (
            <Transfer
                dataSource={mockData}
                titles={['未添加人员', '已添加人员']}
                targetKeys={targetKeys}
                selectedKeys={selectedKeys}
                onChange={onChange}
                listStyle={{
                    width: '45%'
                }}
                onSelectChange={onSelectChange}
                render={(item) => item.title}
            />
        )
    }



    const dataList: any[] = [];

    const generateList = (data: getTreeDataRespType[]) => {
        for (let i = 0; i < data.length; i++) {
            const node = data[i];
            const { code, name } = node;
            dataList.push({ code: code, name: name });
            if (node.child) {
                generateList(node.child);
            }
        }
    };

    generateList(treeData as any);

    const getParentKey = (key: React.Key, tree: any[]): React.Key => {
        let parentKey: React.Key;
        for (let i = 0; i < tree.length; i++) {
            const node = tree[i];
            if (node.child) {
                if (node.child.some((item: { code: React.Key; }) => item.code === key)) {
                    parentKey = node.code;
                } else if (getParentKey(key, node.child)) {
                    parentKey = getParentKey(key, node.child);
                }
            }
        }
        return parentKey!;
    };
    //考核项目树结构搜索
    const onTreeSearchKeyChange = (e: React.ChangeEvent<HTMLInputElement>) => {
        const { value } = e.target;
        const newExpandedKeys = dataList
            .map((item) => {
                if (item.name.indexOf(value) > -1) {
                    return getParentKey(item.code, treeData);
                }
                return null;
            });

        const b = newExpandedKeys.filter((item, i, self) => item && self.indexOf(item) === i);

        setExpandedKeys(newExpandedKeys as React.Key[]);
        setSearchValue(value);
        setAutoExpandParent(true);
    }


    //获取数据
    const confirmGenerateHandle: any = async (index: number, others?: any) => {


        if (index == 3) {
            const resp = await generateCheckProjectTableData({
                computeDate: currentComputeDate as string,
                unitCode: others ? currentSelectedTreeNode.code : ''
            });

            set_loading(false);

            if (resp) {
                tableRef.current?.reload();
            }
            return Promise.resolve(true);
            
        }
    }

    const generateFunc = (index: number, others?: any) => {
        /**
         * index 获取的表格类型下标
         */

        if (index == 3&&!loading) {
            Modal.confirm({
                title: '注意',
                cancelText: '',
                closable: true,
                content: others ? '获取单个操作会覆盖上次获取的该核算单元的数据，确定要继续操作？' : '获取所有操作会覆盖所有已获取的数据，确定要继续操作？',
                onOk: () => { set_loading(true);confirmGenerateHandle(index,others) }
            })
        }

    }

    const onVisibleChangeHandle = (bool: boolean) => {
        set_editModalVisible(bool);
        if (!bool) {
            set_isTableEdit(false);
        }
    }

    const onManaIndexGroupClick = (manaIndexGroup: any) => {
        set_currentSelectedManaGroup(manaIndexGroup);
    }

    const tableFormCommit = async (formData: any, type: 'edit' | 'add') => {

        if (type == 'edit') {
            //编辑
            const body = {
                id: currentEditRecord.id,
                computeDate: currentComputeDate as string,
                unitCode: formData.unitCode,
                deptCode: formData.deptCode,
                nonAssessmentCode: typeof formData.assessmentCode == 'number' ? formData.assessmentCode : formData.assessmentCode.value,
                targetValue: `${formData.userId?formData.userId:''}`,
                value: `${formData.value}`,
                description: formData.description
            }

            const resp = await editTableData(body);

            if (resp) {
                tableRef.current?.reload();
            }
            set_isTableEdit(false);

        } else if (type == 'add') {
            //新增
            const body = {

                computeDate: currentComputeDate as string,
                unitCode: formData.unitCode,
                deptCode: formData.deptCode,
                nonAssessmentCode: formData.assessmentCode.value,
                targetValue: `${formData.userId?formData.userId:''}`,
                value: `${formData.value}`,
                description: formData.description

            }

            const resp = await addTableData(body);
            if (resp) {
                tableRef.current?.reload();
            }
        }

        // set_editModalVisible(false);
        set_currentEditRecord(undefined);
        return true;
    }

    //获取管理指标分组
    const getManaIndiGroupRequest = async () => {

        const resp = await getManaIndexGroup();
        if (resp) {
            set_manaIndexGroups(resp);
            if (resp.length > 0) {
                // const titleResp = await getManaIndexTableData({ computeDate: currentComputeDate as string, groupId: resp[0].groupCode });
                // if (titleResp) {
                //     const columns = titleResp.title.map((item: any) => (item.children ? {
                //         title: () => {
                //             return <div>{item.name} <span style={{ fontSize: 14, fontFamily: 'SourceHanSansCN-Medium, SourceHanSansCN', fontWeight: 500, color: item.arrow == 'up' ? '#00BF8F' : '#FF4060' }}>↓</span></div>
                //         },
                //         key: item.code,
                //         dataIndex: item.name,
                //         children: item.children.map((a: any) => {
                //             return {
                //                 title: a.name,
                //                 dataIndex: `${a.code}${item.code}`,
                //                 key: `${a.code}${item.code}`,
                //                 width: 100,
                //                 align: 'center',
                //             }

                //         })
                //     } : {
                //         title: item.name,
                //         dataIndex: item.code,
                //         key: item.code,
                //         width: 100,
                //         align: 'center',
                //     }));




                //     set_tableColumn([{
                //         title: '核算单元',
                //         dataIndex: 'unitName',
                //         key: 'unitName',
                //         align: 'center',
                //         width: 120,
                //         fixed: 'left',
                //     }, ...columns,
                //     {
                //         title: '总得分',
                //         dataIndex: 'totalScore',
                //         key: 'totalScore',
                //         align: 'center',
                //         width: 100,
                //         fixed:'right',

                //     },
                //     {
                //         title: '操作',
                //         key: 'option',
                //         valueType: 'option',
                //         width: 100,
                //         align: 'center',
                //         fixed: 'right',
                //         render: (_: any, record: any) => [
                //             <EditManaIndexTableRow record={record} key={'edit'} />
                //         ],
                //     }]);
                // }

                set_currentSelectedManaGroup(resp[0])
            }
        }
    }

    const importData = (index: number, name: string) => {

        return (
            <ModalForm
                width={360}
                title={`导入${name}数据`}
                trigger={
                    <span key="3">导入</span>
                }
                submitter={{
                    render: (props, defaultDoms) => {
                        const needBtn = defaultDoms.filter((b) => {
                            return b.key != 'rest'
                        })
                        return [
                            // <Button
                            //     key="ok"
                            //     onClick={auditType == '0' ? () => downloadTemplate(index) : () => { }}
                            // >
                            //     下载模板
                            // </Button>,
                            ...needBtn,
                        ];
                    },
                }}
                onFinish={async (values) => {
                    // console.log({values});
                    const { importFile: { fileList } } = values;

                    let formData = new FormData();
                    formData.append('file', fileList[0].originFileObj);
                    formData.append('computeDate', currentComputeDate as string);

                    const resp = await importMonthlyperformanceRelaFiles(index, formData);

                    if (resp) {
                        tableRef.current?.reload();
                        return true;
                    }

                }}
            >
                <FormItem name={'importFile'}>
                    <BMSUpload downloadTemplateFile={auditType == '0' ? () => downloadTemplate(index) : () => { }} />
                </FormItem>

            </ModalForm>
        )
    }

    const checkHandle = async (type: string) => {

        const resp = await checkMonthlyReq(
            currentComputeDate as string,
            type == '0' ? '1' : '0',   //审核类型  1审核 0取消审核
        );

        if (resp) {
            if (type == '0') {
                message.success('审核提交成功！');
                set_auditType('1');
            }
            if (type == '1') {
                message.success('取消审核提交成功！');
                set_auditType('0');
            }
        }
    }


    const pageCheckStatusFunc = async (time: string) => {
        const resp = await getPageCheckStatus(time);
        if (resp) {
            set_auditType(`${resp}`);  //0 未审核 1 已审核
        }
    }

    const downloadTemplate = async (index: number, id?: number) => {

        await downloadTemplateReq(index, id);

    }

    
    const handleResize = (e:any)=>{
        const wH = e.target.innerHeight;
        const tableHeight = wH - 320;
        set_tableH(tableHeight);
    }

    function doResize(){
        setTimeout(() => {
            const ev: any = new Event('resize');
            window.dispatchEvent(ev);
        },0)
    }


    useEffect(()=>{
         if(loading){
            inervalhander = setInterval(()=>{
                   getCalcStatus();
               },60000)
         }
    },[loading])



    useEffect(() => {
        console.log({currentSelectedManaGroup});
        set_tableDataFilterParams({
            ...tableDataFilterParams,
            id: currentSelectedManaGroup?.id,
        });
    }, [currentSelectedManaGroup]);

    useEffect(() => {
        tableRef.current?.reloadAndRest && tableRef.current?.reloadAndRest();
    }, [currentSelectedTreeNode]);

    useEffect(() => {
        //清空表格筛选项
        set_tableDataFilterParams(undefined);
        set_currentSelectedTreeNode(undefined);

        if (currentSelectedTabKey == '1') {
            set_tableColumn(tableColumnOne as ProColumns[]);
        }
        if (currentSelectedTabKey == '2') {
            set_tableColumn(tableColumnTwo as ProColumns[]);
        }
        if (currentSelectedTabKey == '3') {
            if (currentComputeDate) {
                getCheckUnitTreeDataFunc(currentComputeDate as string);
            }
            set_tableColumn(tableColumnThree as ProColumns[]);
        }
        if (currentSelectedTabKey == '4') {
            getManaIndiGroupRequest();   //获取分组
        }
        if (currentSelectedTabKey == '5') {
            set_tableColumn(tableColumnFive as ProColumns[]);
        }
        if (currentSelectedTabKey == '6') {
            set_tableColumn(tableColumnFive as ProColumns[]);
        }

    }, [currentSelectedTabKey]);



    useEffect(() => {
        //初始化左侧树结构数据后

        if (treeData?.length > 0) {

            if (treeData[0].child && treeData[0].child.length > 0) {
                const [node, nodeParent] = getDeepestTreeData(treeData[0], 'child');
                set_currentSelectedTreeNode(node);
                setExpandedKeys([nodeParent.code]);
            }

        }

    }, [treeData]);


    useEffect(() => {

        if (currentComputeDate) {
            pageCheckStatusFunc(currentComputeDate);  //获取页面查核状态
            getCalcStatus();
        }

    }, [currentComputeDate]);


    useEffect(() => {

        getCurrentComputeDate();
        set_tableColumn(tableColumnOne as ProColumns[]);

        window.addEventListener('resize',(e)=>handleResize(e)) //监听窗口大小改变
        doResize();
        return ()=>{
            window.removeEventListener('resize',(e)=>handleResize(e));
        }

    }, [])

    return (
        <div className='MonthlyDataCheck'>
            {
                true && (
                    <BMSModalForm formRef={formRef} visible={editModalVisible} initialValues={isTableEdit ? { ...currentEditRecord } : {}} title={isTableEdit ? '编辑' : '新增'}
                        size="middle" width={737} onVisibleChange={onVisibleChangeHandle}
                        modalProps={{
                            destroyOnClose: true
                        }}
                        onFinish={(val: any) => tableFormCommit(val, isTableEdit ? 'edit' : 'add')}
                    >
                        {
                            currentSelectedTabKey == '1' && (
                                <>
                                    <ProFormText width="md" name="itemName" label="项目名" disabled />
                                    <ProFormText width="md" name="itemTypeName" label="类型" disabled />
                                    <ProFormDigit width="md" label="点值" name="pointValue" min={0} />
                                    <ProFormText width="md" name="createUser" label="操作人" disabled />
                                </>
                            )
                        }
                        {
                            currentSelectedTabKey == '2' && (
                                <>
                                    <ProForm.Group >
                                        <ProFormSelect
                                            name="deptCode"
                                            label="科室名称"
                                            placeholder="请选择"
                                            colProps={{ span: 12 }}
                                            rules={[{ required: true }]}
                                            request={async () => {
                                                const resp = await getDepLists();
                                                if (resp) {

                                                    return resp.map((a: any) => ({
                                                        label: a.deptName, value: a.deptCode, d: a
                                                    }))
                                                }
                                                return []
                                            }}
                                            fieldProps={{
                                                showSearch: true,
                                                onChange: (value) => {
                                                    formRef.current?.setFieldValue('unitCode', '');
                                                }
                                            }}
                                        />

                                        <ProFormDependency name={['deptCode']}>
                                            {
                                                ({ deptCode }) => {
                                                    // console.log({deptCode});
                                                    return (
                                                        <ProFormSelect
                                                            disabled={deptCode ? false : true}
                                                            name="unitCode"
                                                            label="核算单元"
                                                            colProps={{ span: 12 }}
                                                            placeholder="请选择"
                                                            rules={[{ required: true }]}
                                                            params={deptCode}
                                                            request={async () => {
                                                                if (deptCode) {
                                                                    const resp = await getHesuanUnits(deptCode);
                                                                    if (resp) {
                                                                        return resp.map((a: any) => ({
                                                                            label: a.unitName, value: a.unitCode, d: a
                                                                        }))
                                                                    }
                                                                }
                                                                return []
                                                            }}
                                                            fieldProps={{
                                                                showSearch: true,
                                                                onChange: (value) => {

                                                                    formRef.current?.setFieldValue('targetValue', '');
                                                                }
                                                            }}
                                                        />
                                                    )
                                                }
                                            }
                                        </ProFormDependency>

                                    </ProForm.Group>
                                    <ProForm.Group>
                                        <ProFormSelect
                                            name="assessmentCode"
                                            label="项目名称"
                                            placeholder="请选择"
                                            colProps={{ span: 12 }}
                                            rules={[{ required: true }]}
                                            request={async () => {
                                                const resp = await getProjects();
                                                if (resp) {
                                                    return resp.map((a: any) => ({
                                                        label: a.name, value: a.code, d: a
                                                    }))
                                                }
                                                return []
                                            }}
                                            fieldProps={{
                                                labelInValue: true,
                                                onChange: (value) => {

                                                    const { d: { distributionTypeName } } = value;
                                                    formRef.current?.setFieldValue('distributionTypeName', distributionTypeName);
                                                }
                                            }}
                                        />
                                        <ProFormDependency name={['assessmentCode']}>
                                            {
                                                ({ assessmentCode }) => {
                                                    return (
                                                        <ProFormText disabled name="distributionTypeName" label="分配方式" colProps={{ span: 12 }} />
                                                    )
                                                }
                                            }
                                        </ProFormDependency>

                                    </ProForm.Group>
                                    <ProForm.Group>
                                        <ProFormDigit label="数值" name="value" colProps={{ span: 12 }} min={-1000000000000000} />
                                        <ProFormDependency name={['unitCode', 'distributionTypeName']}>
                                            {
                                                ({ unitCode, distributionTypeName }) => {

                                                    return (
                                                        <ProFormSelect
                                                            name="userId"
                                                            label="人员姓名"
                                                            colProps={{ span: 12 }}
                                                            placeholder="请选择"
                                                            rules={[{ required: distributionTypeName != '占比' ? true : false }]}
                                                            params={unitCode}
                                                            fieldProps={{
                                                                showSearch: true,
                                                            }}
                                                            request={async () => {
                                                                if (unitCode) {
                                                                    const resp = await getEmps(unitCode);

                                                                    if (resp) {
                                                                        return resp.map((a: any) => ({
                                                                            label: a.name, value: a.userId, d: a
                                                                        }))
                                                                    }
                                                                }

                                                                return []
                                                            }}
                                                        />
                                                    )
                                                }
                                            }
                                        </ProFormDependency>

                                    </ProForm.Group>
                                    <ProForm.Group >
                                        <ProFormTextArea
                                            name="description"
                                            label="说明"
                                            colProps={{ span: 24 }}
                                            placeholder="请输入"
                                        />
                                    </ProForm.Group>
                                </>
                            )
                        }
                    </BMSModalForm>
                )

            }

            <>
                {
                    (
                        <div className='rightContent'>
                            <BMSPagecontainer title={`核算年月：${currentComputeDate}`} ghost>
                                <div className='checkBtn' onClick={() => checkHandle(`${auditType}`)}>{auditType == '0' ? '审核' : '取消审核'}</div>
                                {/* <div className='midLine'>
                            <span>点击检查</span>
                            是否有未对照的人员信息、未对照的科室信息及未设置的收费项目信息
                        </div> */}
                                <Tabs
                                    defaultActiveKey="1"
                                    onChange={onTabChange}
                                    items={[
                                        {
                                            label: `固定工资`,
                                            key: '1',
                                        },
                                        {
                                            label: `非考核项目`,
                                            key: '2',
                                        },
                                        {
                                            label: `考核项目`,
                                            key: '3',
                                        },
                                        {
                                            label: `管理指标`,
                                            key: '4',
                                        },
                                        {
                                            label: `收入数据`,
                                            key: '5',
                                        },
                                        {
                                            label: `成本数据`,
                                            key: '6',
                                        },
                                    ]}
                                />

                                {
                                    currentSelectedTabKey == '1' && (
                                        <div className='tabContent'>
                                            <div className='tableToolbar'>
                                                <div className='filter'>
                                                    <div className='search'>
                                                        <span>科室名称：</span><Input className='searchInput' allowClear placeholder="请输入" onChange={(e) => {
                                                            set_tableDataSearchKeywords(e.target.value);
                                                            if (e.target.value.length == 0) {
                                                                set_tableDataFilterParams({
                                                                    ...tableDataFilterParams,
                                                                    deptName: ''
                                                                });
                                                            }
                                                        }} suffix={
                                                            <IconFont type="iconsousuo" onClick={() => tableDataSearchHandle('deptName')} />
                                                        } />
                                                    </div>
                                                </div>
                                                <Popover open={ifShowTip} content={'当前处于审核中，无法操作！'} placement='topRight'>
                                                    <div className={auditType == '1' ? 'btnGroup disabled' : 'btnGroup'}
                                                        onMouseEnter={() => auditType == '0' ? set_ifShowTip(false) : set_ifShowTip(true)}
                                                        onMouseLeave={() => set_ifShowTip(false)}
                                                    >
                                                        {/* <span key="1">调整</span> */}
                                                        {/* <span key="2" onClick={() => generateFunc()}>获取</span> */}
                                                        {importData(1, '固定工资')}
                                                    </div>
                                                </Popover>
                                            </div>
                                            {currentComputeDate && <BMSTable actionRef={tableRef} params={tableDataFilterParams} rowKey='id'
                                                columns={auditType == '0' ? [...tableColumn, {
                                                    title: '金额',
                                                    dataIndex: 'salary',
                                                    key: 'salary',
                                                    align: 'center',
                                                    width: '10%',
                                                    render: (text: any, record: any) => {

                                                        return (
                                                            <div style={{ display: 'flex', flexDirection: 'row', width: '100%', justifyContent: 'center', alignItems: 'center' }}>

                                                                <div style={{ width: '80px', height: 16, display: 'flex', flexDirection: 'row', justifyContent: 'center', alignItems: 'center' }}>
                                                                    {
                                                                        editTableCellId == record.id ? <Input size='small' defaultValue={record.salary} placeholder='请输入' onChange={(e) => { set_inputSalaryNum(Number(e.target.value)) }} style={{ width: '80px' }} /> : <span>{text}</span>
                                                                    }
                                                                </div>
                                                                {auditType == '0' && <img onClick={() => editHandle(record)} style={{ width: 16, height: 16, cursor: 'pointer', marginLeft: 8 }} src={editTableCellId == record.id ? conformIcon : editIcon} alt="" />}
                                                            </div>
                                                        )
                                                    }
                                                },

                                                {
                                                    title: '操作',
                                                    key: 'option',
                                                    valueType: 'option',
                                                    render: (_: any, record) => [
                                                        <Popconfirm
                                                            key={'del'}
                                                            title="是否确认删除？"
                                                            onConfirm={() => delActionHandle(record, 1)}
                                                            // onCancel={()=>{}}
                                                            okText="是"
                                                            cancelText="否"
                                                        >
                                                            <a >删除</a>
                                                        </Popconfirm>
                                                    ],
                                                },] : [

                                                    ...tableColumn, {
                                                        title: '金额',
                                                        dataIndex: 'salary',
                                                        key: 'salary',
                                                  
                                                        width: '10%',
                                                        // shouldCellUpdate:(record:any, prevRecord:any) => true,
                                                        render: (text: any, record: any) => {

                                                            return (
                                                                <div style={{ display: 'flex', flexDirection: 'row', width: '100%', justifyContent: 'center', alignItems: 'center' }}>

                                                                    <div style={{ width: '80px', height: 16, display: 'flex', flexDirection: 'row', justifyContent: 'center', alignItems: 'center' }}>
                                                                        {
                                                                            editTableCellId == record.id ? <Input size='small' defaultValue={record.salary} placeholder='请输入' onChange={(e) => { set_inputSalaryNum(Number(e.target.value)) }} style={{ width: '80px' }} /> : <span>{text}</span>
                                                                        }
                                                                    </div>
                                                                    {auditType == '0' && <img onClick={() => editHandle(record)} style={{ width: 16, height: 16, cursor: 'pointer', marginLeft: 8 }} src={editTableCellId == record.id ? conformIcon : editIcon} alt="" />}
                                                                </div>
                                                            )
                                                        }
                                                    },

                                                ]} request={(params, sort, filter) => getTableData('1', params, sort, filter)} />}
                                        </div>
                                    )
                                }

                                {
                                    currentSelectedTabKey == '2' && (
                                        <div className='tabContent'>
                                            <div className='tableToolbar'>
                                                <div className='filter'>
                                                    <div className='search'>
                                                        <span>科室名称：</span><Input className='searchInput' allowClear placeholder="请输入" onChange={(e) => {
                                                            set_tableDataSearchKeywords(e.target.value);
                                                            if (e.target.value.length == 0) {
                                                                set_tableDataFilterParams({
                                                                    ...tableDataFilterParams,
                                                                    deptName: ''
                                                                });
                                                            }
                                                        }} suffix={
                                                            <IconFont type="iconsousuo" onClick={() => tableDataSearchHandle('deptName')} />
                                                        } />
                                                    </div>
                                                </div>
                                                <Popover open={ifShowTip} content={'当前处于审核中，无法操作！'} >
                                                    <div className={auditType == '1' ? 'btnGroup disabled' : 'btnGroup'}
                                                        onMouseEnter={() => auditType == '0' ? set_ifShowTip(false) : set_ifShowTip(true)}
                                                        onMouseLeave={() => set_ifShowTip(false)}
                                                    >
                                                        {/* <span key="1" onClick={() => generateFunc(2)} >获取</span>
                                            <span key="2" >导入</span> */}
                                                        {importData(2, '非考核项目')}
                                                        <span key="3" onClick={auditType == '0' ? () => tableDataAddHandle() : () => { }}>添加</span>
                                                    </div>
                                                </Popover>
                                            </div>
                                            {currentComputeDate && <BMSTable scroll={{ x: 120 * 10, y: 500 }} actionRef={tableRef} rowKey='id' params={tableDataFilterParams}
                                                columns={auditType == '0' ? [...tableColumn, {
                                                    title: '操作',
                                                    fixed: 'right',
                                                    key: 'option',
                                                 
                                                    width: 130,
                                                    valueType: 'option',
                                                    render: (_: any, record: any) => [
                                                        <a key={'edit'} onClick={() => tableEditActHandle(record)}>编辑</a>,
                                                        <Divider type='vertical' key='line' />,
                                                        <Popconfirm
                                                            key={'del'}
                                                            title="是否确认删除？"
                                                            onConfirm={() => delActionHandle(record, 2)}
                                                            // onCancel={()=>{}}
                                                            okText="是"
                                                            cancelText="否"
                                                        >
                                                            <a >删除</a>
                                                        </Popconfirm>
                                                    ],
                                                }] : [...tableColumn]} request={(params, sort, filter) => getTableData('2', params, sort, filter)} />}
                                        </div>
                                    )
                                }

                                {
                                    currentSelectedTabKey == '3' && (
                                        <div className='tabContent'>

                                            <div className='tabContentInner'>
                                                <div className='leftTree'>
                                                    <div className='search'>
                                                        <Input className='searchInput' allowClear onChange={onTreeSearchKeyChange} placeholder="请输入名称" suffix={
                                                            <IconFont type="iconsousuo" />
                                                        } />
                                                    </div>
                                                    <div className='treeWrap'>
                                                        {
                                                            treeData && treeData.length > 0 && currentSelectedTreeNode && (
                                                                <DirectoryTree
                                                                    fieldNames={{ title: 'name', key: 'code', children: 'child' }}
                                                                    rootStyle={{ height: '100%', paddingBottom: 50, overflowY: 'scroll', overflowX: 'hidden' }}
                                                                    onSelect={onSelectHandle}
                                                                    onExpand={onExpand}
                                                                    expandedKeys={expandedKeys}
                                                                    autoExpandParent={autoExpandParent}
                                                                    selectedKeys={[currentSelectedTreeNode.code]}
                                                                    blockNode={true}
                                                                    icon={() => null}
                                                                    titleRender={
                                                                        (nodeData: any) => {
                                                                            const strTitle = nodeData.name as string;
                                                                            const index = strTitle.indexOf(searchValue);
                                                                            const beforeStr = strTitle.substring(0, index);
                                                                            const afterStr = strTitle.slice(index + searchValue.length);
                                                                            const title =
                                                                                index > -1 ? (
                                                                                    <span>
                                                                                        {beforeStr}
                                                                                        <span className="site-tree-search-value" style={{ color: 'red', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{searchValue}</span>
                                                                                        {afterStr}
                                                                                    </span>
                                                                                ) : (
                                                                                    <span className='strTitle'>{strTitle}</span>
                                                                                );
                                                                            return <div style={{
                                                                                display: 'flex', flexDirection: 'row',
                                                                                width: '100%',
                                                                                justifyContent: 'flex-start', alignItems: 'center', height: 32,
                                                                                borderRadius: '4px',
                                                                                overflow: 'hidden',
                                                                                color: '#17181A',
                                                                                textOverflow: 'ellipsis',
                                                                                whiteSpace: 'nowrap'

                                                                            }}>{title}</div>
                                                                        }
                                                                    }
                                                                    defaultSelectedKeys={[treeData[0].child[0].code]}
                                                                    treeData={treeData as unknown as DataNode[]}
                                                                    // treeData={treeDataNew}
                                                                    switcherIcon={(props: any) => {
                                                                        const { expanded } = props;
                                                                        return !expanded ? <img style={{ width: 20, height: 20, position: 'relative', top: 5 }} src={expandedIcon} /> : <img style={{ width: 20, height: 20, position: 'relative', top: 5 }} src={closeIcon} />
                                                                    }}
                                                                />
                                                            )
                                                        }
                                                    </div>
                                                </div>
                                                <div className='rightTable'>
                                                    <div className='tableToolbar'>
                                                        <div className='filter'>
                                                            {/* <div className='search' style={{ marginRight: 24 }}>
                                                        <span>类型：</span><Input className='searchInput' allowClear placeholder="请输入" onChange={(e) => {
                                                            set_tableDataSearchKeywords(e.target.value);
                                                            if (e.target.value.length == 0) {
                                                                set_tableDataFilterParams({
                                                                    ...tableDataFilterParams,
                                                                    itemType: ''
                                                                });
                                                            }
                                                        }} suffix={
                                                            <IconFont type="iconsousuo" onClick={() => tableDataSearchHandle('itemType')} />
                                                        } />
                                                    </div> */}
                                                            <div className='search'>
                                                                <span>项目名称：</span><Input className='searchInput' allowClear placeholder="请输入" onChange={(e) => {
                                                                    set_tableDataSearchKeywords(e.target.value);
                                                                    if (e.target.value.length == 0) {
                                                                        set_tableDataFilterParams({
                                                                            ...tableDataFilterParams,
                                                                            itemName: ''
                                                                        });
                                                                    }
                                                                }} suffix={
                                                                    <IconFont type="iconsousuo" onClick={() => tableDataSearchHandle('itemName')} />
                                                                } />
                                                            </div>
                                                        </div>
                                                        <Popover open={ifShowTip} content={'当前处于审核中，无法操作！'} >
                                                            <div className={auditType == '1'||loading ? 'btnGroup disabled' : 'btnGroup'}
                                                                onMouseEnter={() => auditType == '0' ? set_ifShowTip(false) : set_ifShowTip(true)}
                                                                onMouseLeave={() => set_ifShowTip(false)}
                                                            >
                                                                <span key="1" onClick={auditType == '0'? () => generateFunc(3, true) : () => { }}>获取单个</span>
                                                                <span key="2" onClick={auditType == '0'? () => generateFunc(3) : () => { }}>获取所有</span>
                                                            </div>
                                                        </Popover>
                                                    </div>
                                                    {currentComputeDate && <BMSTable actionRef={tableRef} loading={{ spinning: loading, tip: '正在计算数据...' }}   rowKey='id' params={tableDataFilterParams} columns={auditType == '0' ? [...tableColumn, {
                                                        title: '数值',
                                                        dataIndex: 'value',
                                                        key: 'value',
                                                   
                                                        render: (text: any, record: any) => {

                                                            return (
                                                                <div key={'editCheckitem'} style={{ display: 'flex', flexDirection: 'row', width: '100%', justifyContent: 'center', alignItems: 'center' }}>

                                                                    <div style={{ width: '80px', height: 16, display: 'flex', flexDirection: 'row', justifyContent: 'center', alignItems: 'center' }}>
                                                                        {
                                                                            editTableCellId == record.id ? <Input size='small' defaultValue={record.value} placeholder='请输入' onChange={(e) => { set_checkItemvalNum(Number(e.target.value)) }} style={{ width: '80px' }} /> : <span>{text}</span>
                                                                        }
                                                                    </div>
                                                                    <img onClick={() => editCheckItemValHandle(record)} style={{ width: 16, height: 16, cursor: 'pointer', marginLeft: 8 }} src={editTableCellId == record.id ? conformIcon : editIcon} alt="" />
                                                                </div>
                                                            )
                                                        }
                                                    },
                                                    {
                                                        title: '操作',
                                                        key: 'option',
                                                        valueType: 'option',
                                                        render: (_: any, record: any) => [
                                                            <Popconfirm
                                                                key={'del'}
                                                                title="是否确认删除？"
                                                                onConfirm={() => delActionHandle(record, 3)}
                                                                // onCancel={()=>{}}
                                                                okText="是"
                                                                cancelText="否"
                                                            >
                                                                <a >删除</a>
                                                            </Popconfirm>
                                                        ],
                                                    }] : [
                                                        ...tableColumn, {
                                                            title: '数值',
                                                            dataIndex: 'value',
                                                            key: 'value',
                                                          
                                                        }
                                                    ]} request={(params, sort, filter) => getTableData('3', params, sort, filter)} />}
                                                </div>

                                            </div>

                                        </div>
                                    )
                                }
                                {
                                    currentSelectedTabKey == '4' && (
                                        <div className='tabContent'>
                                            <div className='tableToolbar'>
                                                <div className='filter'>
                                                    <div className='tabs'>
                                                        {
                                                            manaIndexGroups.map((item, index) => {
                                                                return (
                                                                    <div key={index} className={currentSelectedManaGroup?.id == item.id ? 'tab on' : 'tab'} onClick={() => onManaIndexGroupClick(item)}>{item.groupName}</div>
                                                                )
                                                            })
                                                        }

                                                    </div>
                                                    <div className='search'>
                                                        {/* <span>核算单元名称：</span><Input className='searchInput' allowClear placeholder="请输入" onChange={(e) => {
                                                    set_tableDataSearchKeywords(e.target.value);
                                                    if (e.target.value.length == 0) {
                                                        set_tableDataFilterParams({
                                                            ...tableDataFilterParams,
                                                            unitName: ''
                                                        });
                                                    }
                                                }} suffix={
                                                    <IconFont type="iconsousuo" onClick={() => tableDataSearchHandle()} />
                                                } /> */}
                                                    </div>
                                                </div>
                                                <Popover open={ifShowTip} content={'当前处于审核中，无法操作！'} placement='topRight'>
                                                    <div className={auditType == '1' ? 'btnGroup disabled' : 'btnGroup'}
                                                        onMouseEnter={() => auditType == '0' ? set_ifShowTip(false) : set_ifShowTip(true)}
                                                        onMouseLeave={() => set_ifShowTip(false)}
                                                    >
                                                        {/* <span key="1">获取</span> */}
                                                        {importData(4, '管理指标')}
                                                    </div>
                                                </Popover>
                                            </div>
                                            {currentComputeDate && tableColumn && <BMSTable className='BMS-ManaIndextable' rowClassName={() => 'BMS-ManaIndextable-row'} bordered actionRef={tableRef} scroll={{ x: (100 * (tableColumn.length - 2)) + 120 + 100,y:tableH}} rowKey='unitCode' columns={auditType == '0' ? [...tableColumn,
                                            {
                                                title: '操作',
                                                key: 'option',
                                                valueType: 'option',
                                                width: 100,
                                               
                                                fixed: 'right',
                                                render: (_: any, record: any) => [
                                                    <EditManaIndexTableRow record={record} key={'edit'} />
                                                ],
                                            }] : [...tableColumn]} pagination={false} params={tableDataFilterParams} request={(params, sort, filter) => getTableData('4', params, sort, filter)} />}
                                        </div>
                                    )
                                }
                                {
                                    currentSelectedTabKey == '5' && (
                                        <div className='tabContent' >
                                            <div className='tableToolbar'>
                                                <div className='filter'>
                                                    <div className='search'>
                                                        <span>项目名称：</span><Input className='searchInput' allowClear placeholder="请输入" onChange={(e) => {
                                                            set_tableDataSearchKeywords(e.target.value);
                                                            if (e.target.value.length == 0) {
                                                                set_tableDataFilterParams({
                                                                    ...tableDataFilterParams,
                                                                    itemName: ''
                                                                });
                                                            }
                                                        }} suffix={
                                                            <IconFont type="iconsousuo" onClick={() => tableDataSearchHandle('itemName')} />
                                                        } />
                                                    </div>
                                                </div>
                                                <Popover open={ifShowTip} content={'当前处于审核中，无法操作！'} placement='topRight'>
                                                    <div className={auditType == '1' ? 'btnGroup disabled' : 'btnGroup'}
                                                        onMouseEnter={() => auditType == '0' ? set_ifShowTip(false) : set_ifShowTip(true)}
                                                        onMouseLeave={() => set_ifShowTip(false)}
                                                    >
                                                        {/* <span key="1">获取</span> */}
                                                        {importData(5, '收入')}
                                                    </div>
                                                </Popover>
                                            </div>
                                            {currentComputeDate && <BMSTable actionRef={tableRef} rowKey='id' params={tableDataFilterParams} columns={tableColumn} request={(params, sort, filter) => getTableData('5', params, sort, filter)} />}
                                            <div className='totalCount'>合计：{totalNum}</div>
                                        </div>
                                    )
                                }
                                {
                                    currentSelectedTabKey == '6' && (
                                        <div className='tabContent'>
                                            <div className='tableToolbar'>
                                                <div className='filter'>
                                                    <div className='search'>
                                                        <span>项目名称：</span><Input className='searchInput' allowClear placeholder="请输入" onChange={(e) => {
                                                            set_tableDataSearchKeywords(e.target.value);
                                                            if (e.target.value.length == 0) {
                                                                set_tableDataFilterParams({
                                                                    ...tableDataFilterParams,
                                                                    itemName: ''
                                                                });
                                                            }
                                                        }} suffix={
                                                            <IconFont type="iconsousuo" onClick={() => tableDataSearchHandle('itemName')} />
                                                        } />
                                                    </div>
                                                </div>
                                                <Popover open={ifShowTip} content={'当前处于审核中，无法操作！'} placement='topRight'>
                                                    <div className={auditType == '1' ? 'btnGroup disabled' : 'btnGroup'}
                                                        onMouseEnter={() => auditType == '0' ? set_ifShowTip(false) : set_ifShowTip(true)}
                                                        onMouseLeave={() => set_ifShowTip(false)}
                                                    >
                                                        {/* <span key="1">获取</span> */}
                                                        {importData(6, '成本')}
                                                    </div>
                                                </Popover>
                                            </div>
                                            {currentComputeDate && <BMSTable actionRef={tableRef} rowKey='id' params={tableDataFilterParams} columns={tableColumn} request={(params, sort, filter) => getTableData('6', params, sort, filter)} />}
                                            <div className='totalCount'>合计：{totalNum}</div>
                                        </div>
                                    )
                                }


                            </BMSPagecontainer>
                        </div>
                    )
                }
            </>

        </div>
    );

};

export default MonthlyDataCheck;