import { Button, Space, TableProps } from "antd"
import React from "react"
import UserInfo from "./userInfo"
import { EditOutlined } from "@ant-design/icons"

let columns = (handleEdit: (data: any) => void): TableProps<any>['columns'] => {

    return [
        {
            title: '客服组名称',
            dataIndex: 'groupName',
            key: 'groupName',
            width: 300,
            render(value, records) {
                return <span style={{ fontSize: 12 }}>{value}（ID：{records.groupId}）</span>
            }
        },
        {
            title: '客服人数',
            dataIndex: 'groupMemberCnt',
            key: 'groupMemberCnt',
            width: 75,
            align: 'center',
            render(value) {
                return <span style={{ fontSize: 12 }}>{value}</span>
            }
        },
        {
            title: '创建时间',
            dataIndex: 'createTime',
            key: 'createTime',
            width: 150,
            render(value) {
                return <span style={{ fontSize: 12 }}>{value}</span>
            }
        },
        {
            title: '企业名称',
            dataIndex: 'corpName',
            key: 'corpName',
            width: 110,
            align: 'center',
            ellipsis: true,
            render(value) {
                return <span style={{ fontSize: 12 }}>{value}</span>
            }
        },
        {
            title: '企业ID',
            dataIndex: 'tencentCorpId',
            key: 'tencentCorpId',
            width: 310,
            render(value) {
                return <span style={{ fontSize: 12 }}>{value}</span>
            }
        },
        {
            title: '操作',
            dataIndex: 'cz',
            key: 'cz',
            render(_, record) {
                return <Space>
                    <UserInfo userInfoList={record.userInfoList} createTime={record.createTime} groupMemberCnt={record.groupMemberCnt}/>
                    <Button icon={<EditOutlined />} style={{ border: 'none', fontSize: 12 }} size='small' onClick={() => handleEdit(record)}>修改</Button>
                </Space>
            }
        }
    ]
}
export default columns