import { Badge } from "antd"
import React from "react"

let type = {
    0: { text: '导入excel成功', color: 'cyan' },
    1: { text: '创建中', color: 'processing' },
    2: { text: '部分成功', color: 'warning' },
    3: { text: '全部成功', color: 'success' },
    '-1': { text: '创建失败', color: 'error' },
    '-2': { text: '全部失败', color: 'error' },
}
function columns(platformName: string, see: (props:any) => void) {
    return [
        // {
        //     title: 'ID',
        //     dataIndex: 'id',
        //     key: 'id',
        //     align: 'center',
        // },
        {
            title: '创建人',
            dataIndex: 'createUser',
            key: 'createUser',
            align: 'center',
            render: (a: any) => {
                return a?.nickName
            }
        },
        {
            title: '创建时间',
            dataIndex: 'autoLinkReocrds',
            key: 'autoLinkReocrds',
            align: 'center',
            render: (a: any) => {
                return a[0]?.createTime
            }
        },
        {
            title: '导入的文件名',
            dataIndex: 'fileName',
            key: 'fileName',
            align: 'center',
        },
        {
            title: '创建状态',
            dataIndex: 'createStatus',
            key: 'createStatus',
            align: 'center',
            render: (a: any) => {
                return <><Badge text={type[a]?.text} status={type[a]?.color} /></>
            }
        },
        {
            title: '导入的记录总数',
            dataIndex: 'recordCount',
            key: 'recordCount',
            align: 'center',
        },
        {
            title: '链接创建成功数',
            dataIndex: 'successCount',
            key: 'successCount',
            align: 'center',
            render: (a: any, b: any) => {
                return <span style={b?.recordCount !== a ? { color: 'red' } : {}}>{a}</span>
            }
        },
        {
            title: '操作',
            dataIndex: 'cz',
            key: 'cz',
            align: 'center',
            render: (a:any,data:any) => {
                return <>
                    <a onClick={()=>{see(data)}}>查看详情</a>
                </>
            }
        }
        // {
        //     title: '请求ID',
        //     dataIndex: 'requestId',
        //     key: 'requestId',
        //     align: 'center',
        // },
    ]
}
export default columns