import { PromotedObjectType } from "@/services/launchAdq/enum"
import { copy } from "@/utils/utils"
import { Image, Space } from "antd"
import React from "react"



function tableConfig(tableIdClick: (props: {
    activeKey: string, parma: {
        accountId?: string,//账户ID
        campaignId?: string,//计划ID
        adgroupId?: string,//广告ID
        adcreativeId?: string,//创意ID
        pageId?: string,//落地页ID
        targetingId?: string,//定向ID
    }
}) => void): any {
    return [
        {
            title: '所属账号',
            dataIndex: 'accountId',
            key: 'accountId',
            align: 'center',
            width: 80,
            ellipsis: true,
            render: (a: string) => {
                return <Space>
                    <a onClick={() => copy(a)} >{a}</a>
                </Space>
            }
        },
        {
            title: '推广目标ID',
            dataIndex: 'promotedObjectId',
            key: 'promotedObjectId',
            align: 'center',
            width: 100,
            fixed: 'left',
            ellipsis: true,
            render: (a: string) => {
                return <Space>
                    <a onClick={() => copy(a)} >{a}</a>
                </Space>
            }
        },
        {
            title: '推广目标名称',
            dataIndex: 'promotedObjectName',
            key: 'promotedObjectName',
            align: 'center',
            width: 100,
            ellipsis: true,
            render: (a: string) => {
                return <a style={{ wordBreak: 'break-all' }} onClick={() => { copy(a) }}>{a}</a>
            }
        },
        {
            title: '品牌形象',
            dataIndex: 'promotedObjectSpec',
            key: 'promotedObjectSpec',
            align: 'center',
            width: 50,
            ellipsis: true,
            render: (a: any) => {
                return <Image src={a?.wechatOfficialAccountSpec?.icon} style={{width:20}}/>
            }
        },
        {
            title: '推广目标类型',
            dataIndex: 'promotedObjectType',
            key: 'promotedObjectType',
            width: 140,
            align: 'center',
            render:(a:any)=>{
                return <span>{PromotedObjectType[a]}</span>
            }
        },
        {
            title: '创建时间',
            dataIndex: 'createdTime',
            key: 'createdTime',
            width: 200,
            align: 'center'
        },
        {
            title: '更新时间',
            dataIndex: 'lastModifiedTime',
            key: 'lastModifiedTime',
            width: 200,
            align: 'center'
        },
    ]
}


export default tableConfig