import {
    PageContainer,
    ProDescriptionsItemProps,
    ProTable,
} from '@ant-design/pro-components';
import { Divider } from 'antd';
import React, { useState } from 'react';
import UpdateForm from './components/UpdateForm';
const SubAccountManage: React.FC = () => {
    const [childAccountData, setChildAccountData] = useState<
        API.ChildAccountTableRow[]
    >([
        {
            index: 1,
            contactName: '子账号',
            contactMobile: '180****1123',
            updateBy: 'zd_001',
            updateTime: '2025-02.13 15:36:49',
            wechat: 'beautiful_world',
            receiveStatus: false,
            status: false,
            remark: '这是备注',
        },
    ]);
    const columns: ProDescriptionsItemProps<API.ChildAccountTableRow>[] = [
        {
            title: '序号',
            dataIndex: 'index',
        },
        {
            title: '姓名',
            dataIndex: 'contactName',
        },
        {
            title: '手机号',
            dataIndex: 'contactMobile',
        },
        {
            title: '创建人',
            dataIndex: 'updateBy',
        },
        {
            title: '创建时间',
            dataIndex: 'updateTime',
        },
        {
            title: '微信号',
            dataIndex: 'wechat',
        },
        {
            title: '接单状态',
            dataIndex: 'receiveStatus',
            valueEnum: {
                1: { text: '开启', status: 'Open' },
                0: { text: '关闭', status: 'Closed' },
            },
        },
        {
            title: '当前状态',
            dataIndex: 'status',
            valueEnum: {
                1: { text: '启用', status: 'Open' },
                0: { text: '禁用', status: 'Closed' },
            },
        },
        {
            title: '操作',
            dataIndex: 'option',
            valueType: 'option',
            render: (_, record) => {
                return (
                    <>
                        <UpdateForm />
                        <Divider type="vertical"></Divider>
                        <a>修改状态</a>
                    </>
                );
            },
        },
    ];
    return (
        <PageContainer title="子账号管理">
            <ProTable<API.ChildAccountTableRow>
                headerTitle="子账号列表"
                rowKey="index"
                dataSource={childAccountData}
                columns={columns}
                search={false}
            ></ProTable>
        </PageContainer>
    );
};

export default SubAccountManage;
