import React from "react" import { Badge, Popover, Space, TableProps, Tag, Typography } from "antd" import { AD_STATUS_ENUM, DELIVERY_MODE_ENUM, DYNAMIC_CREATIVE_TYPE_ENUM, MARKETING_GOAL_ENUM } from "../const" import TargetingTooltip from "../../components/TargetingTooltip" import { QuestionCircleFilled } from "@ant-design/icons" import AdgroupTooltip from "../../components/AdgroupTooltip" import DynamicTooltip from "../../components/DynamicTooltip" import { copy } from "@/utils/utils" const columns = (geoLocationList: any, modelList: any, callback: (data: any, type: 'log' | 'page' | 'copy' | 'zxLog', allData?: any) => void): TableProps['columns'] => { return [ { title: '操作', dataIndex: 'cz', key: 'cz', width: 130, fixed: 'left', render: (_, records) => { return { callback(records, 'log', records) }}>日志 { callback(records, 'copy') }}>复制 {records?.submitRule && <> { callback(records, 'zxLog') }}>执行记录 } } }, { title: '任务类型', dataIndex: 'taskType', key: 'taskType', width: 50, align: 'center', fixed: 'left', render(value) { return value === 'GAME' ? '游戏' : '小说' }, }, { title: '任务广告状态', dataIndex: 'status', key: 'status', width: 80, align: 'center', fixed: 'left', render(value) { let a = { 0: 执行中} />, 1: 全部失败} />, 2: 部分成功} />, 100: 全部成功} />, '-2': 任务终止} />, } return a[value as keyof typeof a] }, }, { title: '任务名称', dataIndex: 'taskName', key: 'taskName', width: 120, ellipsis: true, fixed: 'left', render(value) { return {value} } }, { title: '任务提交规则', dataIndex: 'submitRule', key: 'submitRule', width: 80, align: 'center', render(value) { let a = { 0: 默认, 1: 立即提交, 2: 定时提交, 3: 分批提交 } return a[value as keyof typeof a] || '--' }, }, { title: 'ID', dataIndex: 'id', key: 'id', align: 'center', width: 70, ellipsis: true, render(value) { return {value} } }, { title: '广告状态', dataIndex: 'configuredStatus', key: 'configuredStatus', align: 'center', width: 50, render: (_, b) => { let configuredStatus = b?.adgroupDTO?.configuredStatus if (configuredStatus) { return {AD_STATUS_ENUM[configuredStatus as keyof typeof AD_STATUS_ENUM]} } else { return -- } } }, { title: '广告详情', dataIndex: 'adgroupDTO', key: 'adgroupDTO', width: 200, ellipsis: true, render(value, records) { return
{value?.adgroupName}
} >
} }, { title: '定向详情', dataIndex: 'targetings', key: 'targetings', width: 300, render(value, records) { return
{value?.map((item: any, index: number) => } >
{index + 1}、{item?.targetingName || '--'}
)}
} }, { title: '创意详情', dataIndex: 'dynamicCreativesDTO', key: 'dynamicCreativesDTO', width: 200, ellipsis: true, render(value) { return
{value?.dynamicCreativeName}
} >
} }, { title: '创建时间', dataIndex: 'createTime', key: 'createTime', align: 'center', width: 125, ellipsis: true, render: (value) => { return {value || '--'} } }, { title: 任务反馈, dataIndex: 'total', key: 'total', width: 480, render: (value, records) => { return 广告总数:{value} {广告成功数:{records?.successCount || 0}} 创意总数:{records?.dynamicCreativeCount || 0} {创意成功数:{records?.dynamicCreativeSuccessCount || 0}} } } ] } export default columns export const columnsLog = (sync: (value: any) => void): TableProps['columns'] => { return [ { title: '广告账号', dataIndex: 'accountId', key: 'accountId', width: 100, ellipsis: true, align: 'center', render(value) { return {value} } }, { title: '广告名称', dataIndex: 'adgroupName', key: 'adgroupName', width: 160, ellipsis: true, render(value) { return {value} } }, { title: '定向名称', dataIndex: 'targetingsName', key: 'targetingsName', width: 150, ellipsis: true, render(value) { return {value} } }, { title: '营销目的', dataIndex: 'marketingGoal', key: 'marketingGoal', width: 100, ellipsis: true, align: 'center', render(value) { return {MARKETING_GOAL_ENUM[value as keyof typeof MARKETING_GOAL_ENUM]} }, }, { title: '出价', dataIndex: 'bidAmount', key: 'bidAmount', width: 90, align: 'center', render(value) { return {value} } }, { title: '广告创建状态', dataIndex: 'adgroupStatus', key: 'adgroupStatus', width: 90, align: 'center', render(value) { const a = { 0: 执行中} />, 1: 失败} />, 101: 同步异常} />, 100: 成功} /> } return a[value as keyof typeof a] }, }, { title: 任务反馈, dataIndex: 'dynamicCreativeCount', key: 'dynamicCreativeCount', width: 280, render: (value, records) => { return 创意总数:{records?.dynamicCreativeCount || 0} {创意成功数:{records?.dynamicCreativeSuccessCount || 0}} } }, { title: '错误信息', dataIndex: 'failMsg', key: 'failMsg', width: 180, ellipsis: true, render(value) { return {value} } }, { title: '操作', dataIndex: 'cz', key: 'cz', width: 70, align: 'center', render(_, records) { return records?.adgroupStatus === 101 ? sync(records)}>同步 : '--' } } ] } export const columnsDynamicLog = (): TableProps['columns'] => { return [ { title: '创意名称', dataIndex: 'dynamicCreativeName', key: 'dynamicCreativeName', width: 150, ellipsis: true, render(value) { return {value} } }, { title: '创意ID', dataIndex: 'dynamicCreativeId', key: 'dynamicCreativeId', width: 80, ellipsis: true, align: 'center', render(value) { return {value} } }, { title: '投放模式', dataIndex: 'deliveryMode', key: 'deliveryMode', width: 80, ellipsis: true, align: 'center', render(value) { return {DELIVERY_MODE_ENUM[value as keyof typeof DELIVERY_MODE_ENUM]} } }, { title: '动态创意类型', dataIndex: 'dynamicCreativeType', key: 'dynamicCreativeType', width: 80, ellipsis: true, align: 'center', render(value) { return {DYNAMIC_CREATIVE_TYPE_ENUM[value as keyof typeof DYNAMIC_CREATIVE_TYPE_ENUM]} } }, { title: '任务ID', dataIndex: 'taskId', key: 'taskId', width: 70, ellipsis: true, align: 'center', render(value) { return {value} } }, { title: '广告组ID', dataIndex: 'adgroupId', key: 'adgroupId', width: 80, ellipsis: true, align: 'center', render(value) { return {value} } }, { title: '创意模板ID', dataIndex: 'creativeTemplateId', key: 'creativeTemplateId', width: 75, ellipsis: true, align: 'center', render(value) { return {value} } }, { title: '创意创建状态', dataIndex: 'creativeStatus', key: 'creativeStatus', width: 80, align: 'center', render(value) { const a = { 0: 执行中} />, 1: 失败} />, 100: 成功} /> } return a[value as keyof typeof a] }, }, { title: '失败信息', dataIndex: 'failMsg', key: 'failMsg', width: 280, render: (value) => { return value ? copy(value)}>{value} : '--' } } ] } export const columnsExecuteLog = (): TableProps['columns'] => { return [ { title: '执行时间', dataIndex: 'nextTime', key: 'nextTime', width: 145, ellipsis: true, align: 'center', render(value) { return {value} } }, { title: '提交广告数量', dataIndex: 'submitAdCount', key: 'submitAdCount', width: 110, align: 'center', render(value) { return {value} } }, { title: '提交创意总数', dataIndex: 'submitCreativeCount', key: 'submitCreativeCount', width: 110, align: 'center', render(value) { return {value} } }, { title: '提交状态', dataIndex: 'submitStatus', key: 'submitStatus', render(value) { const a = { 2: 执行中} />, 0: 已终止} />, 1: 待执行} />, 3: 完成} /> } return a[value as keyof typeof a] }, } ] }