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

let columns = (handleBand: (value: any) => void, sync: (value: 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: 'localCsgroupName',
            key: 'localCsgroupName',
            width: 150,
            render(value, records) {
                return <span style={{ fontSize: 12 }}>{value ? value + `（${records.localCsgroupId}）` : '--'}</span>
            }
        },
        {
            title: '广告账号',
            dataIndex: 'accountId',
            key: 'accountId',
            width: 75,
            align: 'center',
            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 data={record} />
                    <Button icon={<ApiOutlined />} style={{ border: 'none', fontSize: 12 }} size='small' onClick={() => handleBand(record)}>与本地客服组绑定关系</Button>
                    <Button icon={<SyncOutlined />} style={{ border: 'none', fontSize: 12, color: '#FAAD14' }} size='small' onClick={() => sync(record)}>同步</Button>
                </Space>
            }
        }
    ]
}
export default columns