

/*
 * @Author: code4eat awesomedema@gmail.com
 * @Date: 2022-12-16 09:42:52
 * @LastEditors: code4eat awesomedema@gmail.com
 * @LastEditTime: 2023-07-24 09:30:42
 * @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, useImperativeHandle, useMemo, useRef, useState } from 'react';
import './style.less';

import { Tree, TreeProps, Tabs, Input, Modal, Transfer, Popconfirm, message, 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, ProColumns, ProColumnType } from '@ant-design/pro-components';
import { createFromIconfontCN } from '@ant-design/icons';
import { checkRequest, delPersonRequest, generateDataRequest, getDepInfoTableData, getPersonInfoTableData, getProjectInfoTableData, getTotalEmps, getTransactionInfo, getTreeData, getTreeDataRespType, jixiaoDataImport, PersonInfoTableDataType, saveEmpsRequest } from './service';
import { TransferDirection, TransferItem, TransferProps } from 'antd/es/transfer';
import { getComputeDate } from '@/pages/Home/service';


import 'dayjs/locale/zh-cn';
import locale from 'antd/es/date-picker/locale/zh_CN';
import { getCurrentCheckStatus } from '@/services/auth';
import React from 'react';
import DirectoryTree from 'antd/es/tree/DirectoryTree';
import { getDeepestTreeData } from '@/utils/tooljs';
import { ColumnsType, TableRowSelection } from 'antd/es/table/interface';
import { difference } from 'lodash';

import '../../../../src/utils/zhongtaiA'
import { getJiezhuanStatus } from '../monthlySet/service';


const IconFont = createFromIconfontCN({
    scriptUrl: '',
});

const SearchIcon = createFromIconfontCN({
    scriptUrl: '',
});


const depInfoTableColumn = [
    {
        title: '科室代码',
        dataIndex: 'deptCode',
        key: 'deptCode',

    },
    {
        title: '科室名称',
        dataIndex: 'deptName',
        key: 'deptName',

    },
    {
        title: '类型',
        dataIndex: 'deptTypeName',
        key: 'deptTypeName',

    },
]

const chargeInfoTableColumn = [
    {
        title: '项目代码',
        dataIndex: 'itemCode',
        key: 'itemCode',

    },
    {
        title: '项目名称',
        dataIndex: 'itemName',
        key: 'itemName',

    },
    {
        title: '类型',
        dataIndex: 'itemType',
        key: 'itemType',

    },
    {
        title: '点值',
        dataIndex: 'itemPoint',
        key: 'itemPoint',

    },
    {
        title: '核心',
        dataIndex: 'coreFlag',
        key: 'coreFlag',

        render: (_: any) => {
            return _ == 1 ? '是' : '否'
        }
    },
]




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


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

    const [treeData, set_treeData] = useState<getTreeDataRespType[]>([]);
    const [tableColumn, set_tableColumn] = useState<ProColumns[]>([]);
    const [currentSelectedTreeNode, set_currentSelectedTreeNode] = useState<any | undefined>();
    const [currentSelectedTabKey, set_currentSelectedTabKey] = useState<string>('1');
    const [currentComputeDate, set_currentComputeDate] = useState<string | undefined>();

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

    const [auditType, set_auditType] = useState('0');

    const [empInfoSearchKeywords, set_empInfoSearchKeywords] = useState('');

    const [empFilterParams, set_empFilterParams] = useState<any | undefined>(undefined);

    const [depInfoSearchKeywords, set_depInfoSearchKeywords] = useState('');

    const [depFilterParams, set_depFilterParams] = useState<any | undefined>(undefined);

    const [itemInfoSearchKeywords, set_itemInfoSearchKeywords] = useState('');

    const [itemFilterParams, set_itemFilterParams] = useState<any | undefined>(undefined);

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

    const [ifBanAllAction, set_ifBanAllAction] = useState(true);  //是否掩藏所有操作



    const tableRef = useRef<ActionType>();


    const personTableColumn = [
        {
            title: '工号',
            dataIndex: 'empNo',
            key: 'empNo',

        },
        {
            title: '姓名',
            dataIndex: 'empName',
            key: 'empName',

        },
        {
            title: '岗位层级',
            dataIndex: 'positionLevelName',
            key: 'positionLevelName',

        },
        {
            title: '职务',
            dataIndex: 'jobTitleName',
            key: 'jobTitleName',

        },
        {
            title: '岗位系数',
            dataIndex: 'positionRate',
            key: 'positionRate',

        },
        {
            title: '年资',
            dataIndex: 'seniority',
            key: 'seniority',

        },
    ];


    const delPersonHandle = async (record: any) => {

        const { props: { record: { id } } } = record;

        const currentComputeDateResp = await getComputeDate();
        if (currentComputeDateResp) {
            const resp = await delPersonRequest({
                computeDate: currentComputeDateResp,
                id: id
            });
            if (resp) {
                tableRef.current?.reload();
            }
        }
    }



    const onSelect: TreeProps['onSelect'] = (selectedKeys, info) => {
        // console.log('selected', selectedKeys, info);
        const { node } = info;
        set_currentSelectedTreeNode(node);
    };


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


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

    const getJiezhuanStatusHandle =async () => {
        const resp = await getJiezhuanStatus(currentComputeDate as string);
        if(resp == 2){
              set_ifBanAllAction(true);
        }else{
              set_ifBanAllAction(false);
        }
    }


    const getTableData = async (type: 'PERSON' | 'DEP' | 'CHARGE', params: any, sort: any, filter: any) => {
        // console.log({ currentSelectedTreeNode });
        // console.log({ params, sort, filter });

        if (currentSelectedTreeNode && currentComputeDate) {
            if (type == 'PERSON') {
                const resp = await getPersonInfoTableData({
                    computeDate: currentComputeDate,
                    unitCode: currentSelectedTreeNode.code,
                    ...params,
                });
                if (resp) {
                    return {
                        data: resp.list,
                        success: true,
                        total: resp.totalCount,
                        pageSize: resp.pageSize,
                        totalPage: resp.totalPage,
                    }
                }
                return {
                    data: [],
                    success: true
                }
            }
            if (type == 'DEP') {
                const resp = await getDepInfoTableData({
                    computeDate: currentComputeDate,
                    unitCode: currentSelectedTreeNode.code,
                    ...params
                });
                if (resp) {
                    return {
                        data: resp.list,
                        success: true,
                        total: resp.totalCount,
                        pageSize: resp.pageSize,
                        totalPage: resp.totalPage,
                    }
                }
                return {
                    data: [],
                    success: true
                }
            }
            if (type == 'CHARGE') {
                const resp = await getProjectInfoTableData({
                    computeDate: currentComputeDate,
                    unitCode: currentSelectedTreeNode.code,
                    ...params
                });
                if (resp) {

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

        return []
    }


    interface TableTransferProps extends TransferProps<TransferItem> {
        leftColumns: ColumnsType<any>;
        rightColumns: ColumnsType<any>;
    }


    const transferTableColumn = [
        {
            title: '工号',
            dataIndex: 'empNo',
        },
        {
            title: '姓名',
            dataIndex: 'name',

        },
    ]

    const addPersonFunc = () => {
        const ref = React.createRef<{ save: any }>();
        Modal.confirm({
            title: '添加人员',
            icon: <></>,
            width: 640,
            okText: '确定',
            centered: true,
            cancelText: '取消',
            content: <TableTransfer
                ref={ref}
                leftColumns={transferTableColumn}
                rightColumns={transferTableColumn}
            ></TableTransfer>,
            onOk: () => {
                return ref.current && ref.current.save();
            }
        })
    }

    const TableTransfer = React.forwardRef(({ leftColumns, rightColumns, ...restProps }: TableTransferProps, ref) => {

        const [_data, _set_data] = useState<any>();
        const [targetKeys, setTargetKeys] = useState<string[]>([]);
        const [datasource, set_datasource] = useState<any[]>([]);
        const [selectedKeys, setSelectedKeys] = useState<string[]>([]);

        //获取单元
        const getFuncList = async () => {

            const resp = await getTotalEmps({
                computeDate: currentComputeDate as string,
                unitCode: currentSelectedTreeNode.code
            });
            if (resp) {
                //_set_data(resp);
                const allData = resp.allEmployees.concat(resp.checkEmployees);
                set_datasource(allData);
                const defaultSelctedkeys = resp.checkEmployees.map((item: any) => item.empNo);
                setTargetKeys(defaultSelctedkeys);
            }
        }

        const onChange = (nextTargetKeys: string[]) => {
            setTargetKeys(nextTargetKeys);
        };

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

        useImperativeHandle(ref, () => ({
            save: async () => {
                const items = datasource.filter(a => targetKeys.includes(a.empNo));
                const resp = await saveEmpsRequest(items);
                if (resp) {
                    tableRef.current?.reload();
                }
            }
        }));

        useEffect(() => {
            getFuncList();
        }, [])

        return (
            <Transfer className='TableTransfer' showSearch
                titles={['待选项', '已选项']}
                locale={{
                    itemUnit: '项',
                    itemsUnit: '项',
                    searchPlaceholder: '请输入',
                }}
                oneWay={true}
                onChange={onChange}
                onSelectChange={onSelectChange}
                dataSource={datasource}
                rowKey={record => record.empNo}
                targetKeys={targetKeys}
                selectedKeys={selectedKeys}
                filterOption={(inputValue, item) => {
                    return item.name!.indexOf(inputValue) !== -1

                }}
            >
                {({
                    direction,
                    filteredItems,
                    onItemSelectAll,
                    onItemSelect,
                    selectedKeys: listSelectedKeys,
                    disabled: listDisabled,
                }) => {

                    // console.log({ filteredItems, listSelectedKeys,direction });
                    const columns = direction === 'left' ? leftColumns : rightColumns;

                    const rowSelection: TableRowSelection<TransferItem> = {
                        getCheckboxProps: (item) => ({ disabled: listDisabled || item.disabled }),
                        onSelectAll(selected, selectedRows) {
                            const treeSelectedKeys = selectedRows.map(({ empNo }) => empNo);
                            const diffKeys = selected
                                ? difference(treeSelectedKeys, listSelectedKeys)
                                : difference(listSelectedKeys, treeSelectedKeys);
                            onItemSelectAll(diffKeys as string[], selected);
                        },
                        onSelect({ empNo }, selected) {
                            onItemSelect(empNo as string, selected);
                        },
                        selectedRowKeys: listSelectedKeys,
                    };

                    return (
                        <BMSTable
                            rowSelection={rowSelection}
                            columns={columns as TransferItem[]}
                            dataSource={filteredItems}
                            size="small"
                            bordered={false}
                            rowKey={'empNo'}
                            pagination={{ showTitle: false, pageSize: 9, showLessItems: false, simple: true, showTotal: () => false }}
                            tableAlertRender={false}
                            style={{ pointerEvents: listDisabled ? 'none' : undefined }}
                            onRow={({ empNo, disabled: itemDisabled }) => ({
                                onClick: () => {
                                    if (itemDisabled || listDisabled) return;
                                    onItemSelect(empNo as string, !listSelectedKeys.includes(empNo as string));
                                },
                            })}
                        />
                    );
                }}
            </Transfer>
        )
    })



    const confirmGenerateHandle = async (type: number) => {
        const resp = await generateDataRequest({
            computeDate: currentComputeDate as string,
            generateType: type
        });
        if (resp) {
            message.success('生成数据成功');
            tableRef.current?.reload();
        } else {
            message.success('生成数据错误！');
        }
    }

    const generateFunc = (type: number) => {

        let msg = '';

        if (type == 1) msg = '生成操作会根据基础设定的单元人员对照信息重新生成数据，手动调整的人员信息将会丢失，确定继续生成操作？';
        if (type == 2) msg = '生成操作会覆盖现有的科室数据，确定继续生成操作？';
        if (type == 3) msg = '生成操作会覆盖现有的收费项目数据，确定继续生成操作？';


        Modal.confirm({
            title: '注意',
            content: msg,
            okText: '确定',
            cancelText: '取消',
            onOk: () => confirmGenerateHandle(type)

        })
    }

    const searchEmpHandle = () => {
        set_empFilterParams({
            empInfo: empInfoSearchKeywords
        })
        // tableRef.current?.reload();
    }

    const searchDepHandle = () => {
        set_depFilterParams({
            deptName: depInfoSearchKeywords
        })
    }

    const searchItemHandle = () => {
        set_itemFilterParams({
            itemName: itemInfoSearchKeywords
        })
    }

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

        const resp = await checkRequest({
            computeDate: currentComputeDate as string,
            auditType: 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 getCheckStatus = async (computeDate: string) => {
        const resp = await getCurrentCheckStatus(computeDate);
        if (resp) {
            set_auditType(`${resp}`);  //0 未审核 1 已审核
        }
    }

    const dataList: 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 onExpand = (newExpandedKeys: React.Key[]) => {
        setExpandedKeys(newExpandedKeys);
        setAutoExpandParent(false);
    };

    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 getTreeReqFunc = async (computeDate: string) => {
        const resp = await getTreeData(computeDate);
        set_treeData(resp);
    }

    const importHandle = async () => {
        const resp = await jixiaoDataImport(currentComputeDate as string);
        if (resp) {
            message.success('操作成功！');
            tableRef.current?.reload();
        }
    }

    const checkBtnHandle = () => {
        //点击检查按钮事件
        const _tableColumns: ProColumns[] = [
            {
                title: '异动类型',
                width: 120,
                dataIndex: 'messageType'
            },
            {
                title: '异动信息',
                dataIndex: 'message',
                ellipsis: true
            }
        ];

        const getInfo = async () => {
            const resp = await getTransactionInfo(currentComputeDate as string);
            if (resp) {
                return {
                    data: resp,
                    success: true,
                }
            }
            return []
        }

        Modal.info({
            title: '异动详情',
            icon: <></>,
            width: 640,
            okText: '知道了',
            centered: true,
            cancelText: '',
            content: (
                <BMSTable columns={[..._tableColumns]} request={async () => getInfo()} />
            ),
            onOk: () => {
                // return ref.current && ref.current.save();
            }
        })

    }

    useEffect(() => {

        if (currentComputeDate) {
            getTreeReqFunc(currentComputeDate);
            getCheckStatus(currentComputeDate);
            getJiezhuanStatusHandle();
        }
    }, [currentComputeDate]);

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

    useEffect(() => {
        if (currentSelectedTabKey == '1') {
            set_tableColumn(personTableColumn as ProColumns[]);
        }
        if (currentSelectedTabKey == '2') {
            set_tableColumn(depInfoTableColumn as ProColumns[]);
        }
        if (currentSelectedTabKey == '3') {
            set_tableColumn(chargeInfoTableColumn 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(() => {
        set_tableColumn(personTableColumn as ProColumns[]);
        getCurrentComputeDate();

    }, []);


    return (
        <div className='MonthlyInfoCheck'>
            <div className='leftTree'>
                <div className='search'>
                    <Input
                        className='searchInput'
                        placeholder="请输入类目名称"
                        size='small'
                        allowClear

                        style={{ marginBottom: 16 }}
                        onChange={onTreeSearchKeyChange}
                        suffix={
                            <SearchIcon type='iconsousuo' />
                        }
                    />
                </div>
                {
                    treeData && treeData.length > 0 && currentSelectedTreeNode && (
                        <DirectoryTree
                            fieldNames={{ title: 'name', key: 'code', children: 'child' }}
                            rootStyle={{ height: '100%', paddingBottom: 50, overflowY: 'scroll', overflowX: 'hidden' }}
                            onSelect={onSelect}
                            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 style={{width:16,height:'92vh',background:'#F5F7FA'}}></div> */}
            <div className='rightContent'>
                <BMSPagecontainer title={`核算年月：${currentComputeDate}`} ghost>
                    {
                        !ifBanAllAction && (
                            <>
                                <div className={auditType == '0' ? 'importBtn disabled' : 'importBtn '} onClick={() => importHandle()} style={{ right: auditType == '0' ? '64px' : '93px' }}>绩效数据导入</div>
                                <div className='checkBtn' onClick={() => checkHandle(`${auditType}`)}>{auditType == '0' ? '审核' : '取消审核'}</div>
                                {!ifBanAllAction&&(
                                    <div className='midLine'>
                                    <span onClick={() => checkBtnHandle()}>点击检查</span>
                                    是否有未对照的人员信息、未对照的科室信息及未设置的收费项目信息
                                </div>
                                )}
                            </>
                        )
                    }

                    <Tabs
                        defaultActiveKey="1"
                        onChange={onTabChange}
                        items={[
                            {
                                label: `人员信息`,
                                key: '1',
                            },
                            {
                                label: `科室信息`,
                                key: '2',
                            },
                            {
                                label: `收费项目信息`,
                                key: '3',
                            },
                        ]}
                    />

                    {
                        currentSelectedTabKey == '1' && (
                            <div className='tabContent'>
                                <div className='tableToolbar'>
                                    <div className='search'>
                                        <span>人员：</span><Input className='searchInput' allowClear onChange={(e) => {

                                            set_empInfoSearchKeywords(e.target.value)
                                            if (e.target.value.length == 0) {
                                                set_empFilterParams({
                                                    ...empFilterParams,
                                                    empInfo: ''
                                                });
                                            }
                                        }} placeholder="输入工号/姓名" suffix={
                                            <IconFont type="iconsousuo" onClick={() => searchEmpHandle()} />
                                        } />
                                    </div>
                                    {
                                        !ifBanAllAction && (
                                            <Popover open={ifShowTip} content={'当前处于审核中，无法操作！'} >
                                                <div className={auditType != '0' ? 'btnGroup disabled' : 'btnGroup'}
                                                    onMouseEnter={() => auditType == '0' ? set_ifShowTip(false) : set_ifShowTip(true)}
                                                    onMouseLeave={() => set_ifShowTip(false)}
                                                >
                                                    {/* <span key="1">调整</span> */}
                                                    <span key="2" onClick={auditType == '0' ? () => generateFunc(1) : () => { }}>生成</span>
                                                    <span key="3" onClick={auditType == '0' ? () => addPersonFunc() : () => { }}>添加</span>
                                                </div>
                                            </Popover>
                                        )
                                    }


                                </div>
                                {currentSelectedTreeNode && <BMSTable params={empFilterParams} actionRef={tableRef} rowKey='empNo' columns={(auditType == '0' && !ifBanAllAction) ? [...tableColumn, {
                                    title: '操作',
                                    key: 'option',
                                    valueType: 'option',
                                    render: (record: any) => [

                                        <Popconfirm key="popconfirm" title={`确认删除吗?`} okText="是" cancelText="否" onConfirm={() => delPersonHandle(record)}>
                                            <a key={'del'}>删除</a>
                                        </Popconfirm>
                                    ],
                                },] : [...tableColumn]} request={(params, sort, filter) => getTableData('PERSON', params, sort, filter)} />}
                            </div>
                        )
                    }

                    {
                        currentSelectedTabKey == '2' && (
                            <div className='tabContent'>
                                <div className='tableToolbar'>
                                    <div className='search'>
                                        <span>科室名称：</span><Input className='searchInput' allowClear placeholder="请输入" onChange={(e) => {
                                            set_depInfoSearchKeywords(e.target.value);

                                            if (e.target.value.length == 0) {
                                                set_depFilterParams({
                                                    ...depFilterParams,
                                                    deptName: ''
                                                });
                                            }
                                        }} suffix={
                                            <IconFont type="iconsousuo" onClick={() => searchDepHandle()} />
                                        } />
                                    </div>
                                    {
                                        !ifBanAllAction && (
                                            <>
                                                <Popover open={ifShowTip} content={'当前处于审核中，无法操作！'} >
                                                    <div className={auditType != '0' ? 'btnGroup disabled' : 'btnGroup'}
                                                        onMouseEnter={() => auditType == '0' ? set_ifShowTip(false) : set_ifShowTip(true)}
                                                        onMouseLeave={() => set_ifShowTip(false)}
                                                    >
                                                        {/* <span key="1">调整</span> */}
                                                        <span key="2" onClick={auditType == '0' ? () => generateFunc(2) : () => { }}>生成</span>
                                                    </div>
                                                </Popover>
                                            </>
                                        )
                                    }

                                </div>
                                {currentSelectedTreeNode && <BMSTable actionRef={tableRef} params={depFilterParams} rowKey='deptCode' columns={tableColumn} request={(params, sort, filter) => getTableData('DEP', params, sort, filter)} />}
                            </div>
                        )
                    }

                    {
                        currentSelectedTabKey == '3' && (
                            <div className='tabContent'>
                                <div className='tableToolbar'>
                                    <div className='search'>
                                        <span>项目名称：</span><Input className='searchInput' allowClear placeholder="请输入" onChange={(e) => {
                                            set_itemInfoSearchKeywords(e.target.value);
                                            if (e.target.value.length == 0) {
                                                set_depFilterParams({
                                                    ...itemFilterParams,
                                                    itemName: ''
                                                });
                                            }
                                        }} suffix={
                                            <IconFont type="iconsousuo" onClick={() => searchItemHandle()} />
                                        } />
                                    </div>
                                    {
                                        !ifBanAllAction && (
                                            <Popover open={ifShowTip} content={'当前处于审核中，无法操作！'} >
                                                <div className={auditType != '0' ? 'btnGroup disabled' : 'btnGroup'}
                                                    onMouseEnter={() => auditType == '0' ? set_ifShowTip(false) : set_ifShowTip(true)}
                                                    onMouseLeave={() => set_ifShowTip(false)}
                                                >
                                                    {/* <span key="1">调整</span> */}
                                                    <span key="2" onClick={auditType == '0' ? () => generateFunc(3) : () => { }}>生成</span>
                                                </div>
                                            </Popover>
                                        )
                                    }

                                </div>
                                {currentSelectedTreeNode && <BMSTable actionRef={tableRef} params={itemFilterParams} rowKey='id' columns={tableColumn} request={(params, sort, filter) => getTableData('CHARGE', params, sort, filter)} />}
                            </div>
                        )
                    }


                </BMSPagecontainer>
            </div>
        </div>
    );

};

export default MonthlyInfoCheck;