import { deviceAmountPage } from '@/services/facility/index';


import React, { useRef, useEffect } from 'react';
import { useIntl, useAccess } from '@umijs/max';
import { message, Tag } from 'antd';
import { ActionType, PageContainer, ProTable } from '@ant-design/pro-components';




const LogTableList: React.FC = () => {
    const actionRef = useRef<ActionType>();

    const columns = [
        {
            title: 'ID',
            dataIndex: 'id',
            valueType: 'text',
            search: false,
        },
        {
            title: '服务费金额',
            dataIndex: 'amout',
            valueType: 'text',
            search: false,
        },
        {
            title: '服务费产生日期',
            dataIndex: 'incomeDay',
            valueType: 'dateRange',
            render: (_, record) => {
                return record?.incomeDay
            },
            search: {
                transform: (value) => {
                    return {
                        incomeDayBegin: value[0],
                        incomeDayEnd: value[1],
                    };
                },
            },
        },
        {
            title: '创建时间',
            dataIndex: 'createTime',
            valueType: 'text',
            search: false,
        },
    ];

    return (
        <PageContainer>
            <div style={{ width: '100%', float: 'right' }}>
                <ProTable
                    actionRef={actionRef}
                    rowKey="id"
                    key="logList"
                    search={{
                        labelWidth: 120,
                    }}
                    request={async (params, sorter, filter) => {
                        let { data } = await deviceAmountPage(params)
                        return {
                            data: data?.records || [],
                            total: data?.total,
                        };
                    }}
                    columns={columns}
                />
            </div>
        </PageContainer>
    );
};

export default LogTableList;
