/*
 * @Author: code4eat awesomedema@gmail.com
 * @Date: 2023-07-24 15:00:42
 * @LastEditors: code4eat awesomedema@gmail.com
 * @LastEditTime: 2024-11-18 16:39:16
 * @FilePath: /MediResourceManaSys/src/components/KCIMTable/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 KCIMTablePropsType<T, U, ValueType> = ProTableProps<T, U, ValueType> & {
    
}

export const KCIMTablePageDefaultConfig = {
    defaultPageSize:10
}

export const KCIMTable = (props: KCIMTablePropsType<any, any, any>) => {

    const { params,options = false,request,columns,...rest } = props;
    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="KCIMTable"
            toolBarRender={false}
            options={options}
            columns={columns?.map(a=>({...a,ellipsis:true}))}
            pagination={{
                   showSizeChanger:true,
                   ...KCIMTablePageDefaultConfig
            }}
            //locale={{emptyText:'暂无数据'}}
            params={{...params}}
            bordered={false}
            search={false}
            tableStyle={{
                border:'1px solid #DAE2F2',
                borderRadius:'8px'
            }}
            request={request?(params,sort,filter)=>request({...params},sort,filter):undefined}
            {...rest} 
        />
    )
}
