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


const brandColumns = (del: (id: number) => void, edit: (data: any) => void): TableProps<any>['columns'] => {


    const data: any[] = [
        {
            title: '操作',
            dataIndex: 'cz',
            key: 'cz',
            align: 'center',
            width: 85,
            render: (a: any, b: any) => {
                return <Space>
                    <a onClick={() => edit(b)} style={{ fontSize: 12 }}>修改</a>
                    <Popconfirm
                        title="确定删除?"
                        onConfirm={() => del(b.id)}
                        okText="是"
                        cancelText="否"
                    >
                        <a style={{ color: 'red', fontSize: 12 }}>删除</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) => {
                return <Image width={25} style={{ borderRadius: 4 }} src={a} />
            }
        },
        {
            title: '头像名称',
            dataIndex: 'name',
            key: 'name',
            render: (a: any) => {
                return <span style={{ fontSize: "12px" }}>{a}</span>
            }
        },
        {
            title: '创建时间',
            dataIndex: 'createTime',
            key: 'createTime',
            align: 'center',
            width: 140,
            render: (a: any, b: any) => {
                return <span style={{ fontSize: "12px" }}>{a}</span>
            }
        }
    ]

    return data
}

export default brandColumns