import React from 'react' import { Space, Switch, Image, Popover, TableProps, Typography, Badge } from 'antd' import '../index.less' import { copy } from '@/utils/utils' import { DELIVERY_MODE, DYNAMIC_CREATIVE_TYPE } from '../const' import { ELEMENT_ENUM, SITE_SET_ENUM, creativeTemplate } from '../../tencentAdPutIn/const' import { AD_STATUS } from '.' const { Text } = Typography; function tableConfig(reviewStatusDetails: (value: any) => void, suspendHandle: (b: any, suspend: '启动' | '暂停') => void): any { return [ { title: '启停', dataIndex: 'configuredStatus', key: 'configuredStatus', align: 'center', width: 40, fixed: 'left', render: (a: string, b: any) => { return { suspendHandle(b, checked ? '启动' : '暂停') }} /> } }, { title: '品牌形象', dataIndex: 'brand', key: 'brand', width: 110, ellipsis: true, render: (_: any[], b: any) => { let brand = b?.creativeComponents?.brand return brand?.length > 0 ? {brand?.[0]?.value?.brandName} : '--' } }, { title: '文本标题', dataIndex: 'title', key: 'title', width: 140, ellipsis: true, render: (_: any[], b: any) => { let title = b?.creativeComponents?.title return title?.length > 0 ? title.map((item: { value: { content: any } }, index: number) => `标题${index + 1}:${item?.value?.content}`)?.toString() : '--' } }, { title: '文本描述', dataIndex: 'description', key: 'description', width: 140, ellipsis: true, render: (_: any[], b: any) => { let description = b?.creativeComponents?.description return description?.length > 0 ? description.map((item: { value: { content: any } }, index: number) => `描述${index + 1}:${item?.value?.content}`)?.toString() : '--' } }, { title: '单图片', dataIndex: 'image', key: 'image', width: 140, ellipsis: true, render: (_: any[], b: any) => { let image = b?.creativeComponents?.image return
{image?.length > 0 ?
{image?.map((item: { componentId: string; value: { imageUrl: string | undefined } }, index: string) => )}
: '--'}
} }, { title: '图集', dataIndex: 'imageList', key: 'imageList', width: 140, ellipsis: true, render: (_: any[], b: any) => { let imageList = b?.creativeComponents?.imageList return imageList?.length > 0 ?
{imageList?.map((item: { value: { list: any[] } }, index: React.Key | null | undefined) => {item?.value?.list?.map((list: any, i: number) => )} )}
: '--' } }, { title: '视频', dataIndex: 'video', key: 'video', width: 140, ellipsis: true, render: (_: any[], b: any) => { let video = b?.creativeComponents?.video return video?.length > 0 ? {video?.map((item: { value: { videoUrl: string | undefined } }, index: React.Key | null | undefined) => } destroyTooltipOnHide mouseEnterDelay={0.5} > : '--' } }, { title: '轮播', dataIndex: 'floatingZone', key: 'floatingZone', width: 150, ellipsis: true, render: (_: any[], b: any) => { let floatingZone = b?.creativeComponents?.floatingZone return floatingZone?.length > 0 ?
{floatingZone?.map((item: { value: { floatingZoneImageUrl: string | undefined; floatingZoneName: boolean | React.ReactChild | React.ReactFragment | React.ReactPortal | null | undefined; floatingZoneDesc: boolean | React.ReactChild | React.ReactFragment | React.ReactPortal | null | undefined } }, index: React.Key | null | undefined) =>
{item?.value?.floatingZoneName}
{item?.value?.floatingZoneDesc}
)}
: '--' } }, { title: '所属账号', dataIndex: 'accountId', key: 'accountId', align: 'center', width: 80, ellipsis: true, render: (a: string) => { return copy(a)} >{a} } }, { title: '广告ID', dataIndex: 'adgroupId', key: 'adgroupId', align: 'center', width: 100, ellipsis: true, render: (a: string, b: any) => { return copy(a)} >{a} } }, { title: '创意名称', dataIndex: 'dynamicCreativeName', key: 'dynamicCreativeName', align: 'center', width: 120, ellipsis: true }, { title: '创意ID', dataIndex: 'dynamicCreativeId', key: 'dynamicCreativeId', align: 'center', width: 100, ellipsis: true, render: (a: string, b: any) => { return copy(a)} >{a} } }, { title: '是否已删除', dataIndex: 'isDeleted', key: 'isDeleted', align: 'center', width: 60, render: (a: any) => { return } }, { title: '投放模式', dataIndex: 'deliveryMode', key: 'deliveryMode', align: 'center', width: 120, render: (a: string) => { return DELIVERY_MODE[a as keyof typeof DELIVERY_MODE] } }, { title: '创意形式匹配方式', dataIndex: 'dynamicCreativeType', key: 'dynamicCreativeType', align: 'center', width: 120, render: (a: string) => { return DYNAMIC_CREATIVE_TYPE[a as keyof typeof DYNAMIC_CREATIVE_TYPE] } }, { title: '创意形式', dataIndex: 'creativeTemplateId', key: 'creativeTemplateId', align: 'center', width: 120, ellipsis: true, render: (a: string) => { return creativeTemplate[a as keyof typeof creativeTemplate] || '--' } }, { title: '审核状态', dataIndex: 'reviewStatusCn', key: 'reviewStatusCn', align: 'center', width: 100, render: (a: string, b: any) => { return {a} { reviewStatusDetails(b) }}>详情 } } ] } export const tableConfigDetail = (): TableProps['columns'] => { return [ { title: '创意组件', dataIndex: 'componentInfo', key: 'componentInfo', width: 180, render: (value) => { if (value) { let { componentId, componentType } = value return {ELEMENT_ENUM[componentType as keyof typeof ELEMENT_ENUM]} {componentId} } return null }, onCell: (record) => ({ rowSpan: record.rowSpan }) }, { title: '组件审核结果', dataIndex: 'temReviewStatus', key: 'temReviewStatus', width: 120, render: (_, records) => { if (!records?.componentInfo) { return null } return {AD_STATUS[records?.componentInfo?.reviewStatus as keyof typeof AD_STATUS]} } }, { title: '组件元素', dataIndex: 'elementName', key: 'elementName', width: 155, render: (value, records) => { return <> {value}
{records.elementType === 'VIDEO' ?
} destroyTooltipOnHide mouseEnterDelay={0.5} >