import React from "react"
import { Image, Popconfirm, Space } from 'antd'

let columns = (del: (id: number) => void, edit: (data: any) => void) => {


    let data: any[] = [
        {
            title: '操作',
            dataIndex: 'cz',
            key: 'cz',
            align: 'center',
            width: 100,
            render: (a: any, b: any) => {
                return <Space>
                    <a onClick={() => edit(b)}>修改</a>
                    <Popconfirm
                        title="确定删除?"
                        onConfirm={() => del(b.id)}
                        okText="是"
                        cancelText="否"
                    >
                        <a style={{ color: 'red' }}>删除</a>
                    </Popconfirm>
                </Space>
            }
        },
        {
            title: 'ID',
            dataIndex: 'id',
            key: 'id',
            width: 60,
            align: 'center',
            render: (a: any, b: any) => {
                return <span style={{ fontSize: "12px" }}>{a}</span>
            }
        },
        {
            title: '头像预览图',
            dataIndex: 'brandImgUrl',
            key: 'brandImgUrl',
            width: 120,
            ellipsis: true,
            align: 'center',
            render: (a: any, b: any) => {
                return <Image width={40} style={{ borderRadius: 4 }} src={a} />
            }
        },
        {
            title: '头像名称',
            dataIndex: 'name',
            key: 'name',
            align: 'center',
            render: (a: any, b: any) => {
                return <span style={{ fontSize: "12px" }}>{a}</span>
            }
        },
        {
            title: '创建时间',
            dataIndex: 'createTime',
            key: 'createTime',
            align: 'center',
            render: (a: any, b: any) => {
                return <span style={{ fontSize: "12px" }}>{a}</span>
            }
        }
    ]

    return data
}

export default columns