import { PromotedObjectType } from '@/services/launchAdq/enum'
import React from 'react'
import { Space } from 'antd'
function tableConfig(callback:(data:any,type:'edit'|'look')=>void):any{
    return [
        {
            title: 'ID',
            dataIndex: 'id',
            key: 'id',
            align: 'center',
            width:70,
        },
        {
            title: '广告名称',
            dataIndex: 'adgroupName',
            key: 'adgroupName',
            align: 'center',
        },
        {
            title: '广告推广目标类型',
            dataIndex: 'promotedObjectType',
            key: 'promotedObjectType',
            align: 'center',
           render:(a: string | number)=>{
            return PromotedObjectType[a]
           } 
        },
        {
            title: '投放日期',
            dataIndex: 'beginDate',
            key: 'beginDate',
            align: 'center',
            render:(a: string,b: { endDate: string })=>{
                return b?.endDate ? a+'~'+b.endDate : a+'~'+'长期投放'
            }
        },
        {
            title: '广告出价',
            dataIndex: 'bidAmount',
            key: 'bidAmount',
            align: 'center',  
        },
        {
            title: '创建时间',
            dataIndex: 'createTime',
            key: 'createTime',
            align: 'center',
        },
        {
            title:'操作',
            dataIndex:'cz',
            key: 'cz',
            align: 'center',  
            render:(a: any,b: any)=>{
               return <Space>
                    <a onClick={()=>{
                        callback(b,'look')
                    }}>详情</a>
                </Space>
            }
        }
    ]
}
export default tableConfig