/*
 * @Author: code4eat awesomedema@gmail.com
 * @Date: 2022-12-20 15:24:11
 * @LastEditors: code4eat awesomedema@gmail.com
 * @LastEditTime: 2023-06-25 10:23:18
 * @FilePath: /BudgetManaSystem/src/components/BMSTable/index.tsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { deepEqual } from "@/utils/tooljs"
import { ProTable, ProTableProps } from "@ant-design/pro-components"
import { useEffect, useState } from "react"

import './style.less'

export type BMSTablePropsType<T, U, ValueType> = ProTableProps<T, U, ValueType> & {
    
}

export const BMSTablePageDefaultConfig = {
    defaultPageSize:10
}

export const BMSTable = (props: BMSTablePropsType<any, any, any>) => {

    const { params,options = false,...rest } = props;
    // let prevParams:any = undefined;
    const [prevParams,set_prevParams] = useState<any>(undefined);

    useEffect(()=>{
        // console.log({'deepEqual(prevParams,params)':deepEqual(prevParams,params)});
        // console.log({prevParams,params});

        if(deepEqual(prevParams,params)){
            
        }else{
              
        }
        set_prevParams(params);
    },[params])
    
    return (
        <ProTable
            tableClassName="BMSTable"
            toolBarRender={false}
            options={options}
            pagination={{
                   showSizeChanger:true,
                   ...BMSTablePageDefaultConfig
            }}
            //locale={{emptyText:'暂无数据'}}
            params={{...params}}
            bordered={false}
            search={false}
            tableStyle={{
                border:'1px solid #DAE2F2',
                borderRadius:'8px'
            }}
            {...rest} 
        />
    )
}
