import { PromotedObjectType } from "@/services/launchAdq/enum";
import { Popconfirm } from "antd";
import React from "react";

export function Columns(del: (id: number) => void) {

    const columns: any = [
        {
            title: 'ID',
            dataIndex: 'id',
            key: 'id',
            width: 60,
            align: 'center'
        },
        {
            title: '创建人',
            dataIndex: 'putUserName',
            key: 'putUserName',
            width: 60
        },
        {
            title: '策略组名称',
            dataIndex: 'strategyKey',
            key: 'strategyKey',
            width: 300
        },
        {
            title: '推广目标',
            dataIndex: 'promotedObjectType',
            key: 'promotedObjectType',
            width: 90,
            align: 'center',
            render: (a: string, b: any) => {
                return PromotedObjectType[a]
            }
        },
        {
            title: '创建时间',
            dataIndex: 'createTime',
            key: 'createTime',
            ellipsis: true,
            width: 130
        },
        {
            title: '操作',
            dataIndex: 'cz',
            key: 'cz',
            fixed: 'right',
            width: 55,
            align: 'center',
            render: (a: any, b: any) => {
                return <Popconfirm
                    title="是否删除?"
                    onConfirm={() => del(b?.id)}
                >
                    <a style={{ color: 'red' }}>删除</a>
                </Popconfirm>
            }
        }
    ];

    return columns
}