tableConfig.tsx 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. import { BidStrategyEnum } from '@/services/launchAdq/enum'
  2. import React from 'react'
  3. import { Badge, Space, Tag } from 'antd'
  4. import '../index.less'
  5. import { copy } from '@/utils/utils'
  6. import { ADGROUP_STATUS, AUTO_ACQUISTION_STATUS, GOAL_ENUM } from '../const'
  7. import SwitchStatus from './switchStatus'
  8. import TimeSeriesLook from '@/pages/launchSystemNew/adq/ad/timeSeriesLook'
  9. import CreativePreview from '../../adMonitorListV3/CreativePreview'
  10. import { BID_MODE_ENUM, BID_SCENE_NORMAL_ENUM, COST_GUARANTEE_STATUS_ENUM, MARKETING_CARRIER_TYPE_ENUM, MARKETING_GOAL_ENUM, MARKETING_TARGET_TYPE_ENUM, MARKETING_TARGET_TYPE_GAME_ENUM, OPTIMIZATIONGOAL_ENUM, SITE_SET_ENUM, SMART_DELIVERY_GOAL_ENUM } from '../../tencentAdPutIn/const'
  11. function tableConfig(onChange: () => void, useType: string, creativeHandle?: (id: number) => void): any {
  12. return [
  13. {
  14. title: '启停',
  15. dataIndex: 'configuredStatus',
  16. key: 'configuredStatus',
  17. align: 'center',
  18. width: 40,
  19. fixed: 'left',
  20. render: (a: string, b: any) => {
  21. return <SwitchStatus configuredStatus={a} accountId={b?.accountId} isDeleted={b?.isDeleted} adgroupId={b?.adgroupId} onChange={onChange} />
  22. }
  23. },
  24. {
  25. title: '是否智投',
  26. dataIndex: 'smartDeliveryPlatform',
  27. key: 'smartDeliveryPlatform',
  28. align: 'center',
  29. width: 40,
  30. fixed: 'left',
  31. render: (a: string) => {
  32. return <Badge status={a ? "processing" : "error"} text={a ? '是' : '否'} />
  33. }
  34. },
  35. {
  36. title: '所属账号',
  37. dataIndex: 'accountId',
  38. key: 'accountId',
  39. align: 'center',
  40. width: 80,
  41. ellipsis: true,
  42. render: (a: string) => {
  43. return <Space>
  44. <a onClick={() => copy(a)} >{a}</a>
  45. </Space>
  46. }
  47. },
  48. {
  49. title: '腾讯备注',
  50. dataIndex: 'memo',
  51. key: 'memo',
  52. align: 'center',
  53. width: 80,
  54. ellipsis: true,
  55. render: (a: string) => {
  56. return a || '--'
  57. }
  58. },
  59. {
  60. title: '本地备注',
  61. dataIndex: 'remark',
  62. key: 'remark',
  63. align: 'center',
  64. width: 80,
  65. ellipsis: true,
  66. render: (a: string) => {
  67. return a || '--'
  68. }
  69. },
  70. {
  71. title: '广告ID',
  72. dataIndex: 'adgroupId',
  73. key: 'adgroupId',
  74. align: 'center',
  75. width: 100,
  76. ellipsis: true,
  77. render: (a: string, b: any) => {
  78. return <Space>
  79. <a onClick={() => copy(a)} >{a}</a>
  80. </Space>
  81. }
  82. },
  83. {
  84. title: '投手',
  85. dataIndex: 'putUserName',
  86. key: 'putUserName',
  87. align: 'center',
  88. width: 70,
  89. ellipsis: true
  90. },
  91. {
  92. title: '广告名称',
  93. dataIndex: 'adgroupName',
  94. key: 'adgroupName',
  95. width: 280,
  96. ellipsis: true,
  97. render: (a: string, b: any) => {
  98. return <a onClick={() => { creativeHandle?.(b?.adgroupId) }}>{a}</a>
  99. // return <InputUpdate title={a} dataIndex={'adgroupName'} record={b} handleSave={handleSave} />
  100. }
  101. },
  102. {
  103. title: '投放日期',
  104. dataIndex: 'beginDate',
  105. key: 'beginDate',
  106. align: 'center',
  107. width: 150,
  108. ellipsis: true,
  109. sorter: true,
  110. render: (a: string, b: { endDate: string }) => {
  111. return b?.endDate ? a + '~' + b.endDate : a + '~' + '长期投放'
  112. }
  113. },
  114. {
  115. title: '投放时间',
  116. dataIndex: 'timeSeries',
  117. key: 'timeSeries',
  118. align: 'center',
  119. width: 55,
  120. render: (a: string, b: { endDate: string }) => {
  121. return <TimeSeriesLook timeSeries={a} />
  122. }
  123. },
  124. {
  125. title: '首日开始投放时间',
  126. dataIndex: 'firstDayBeginTime',
  127. key: 'firstDayBeginTime',
  128. align: 'center',
  129. width: 70,
  130. },
  131. {
  132. title: '出价',
  133. dataIndex: 'bidAmount',
  134. key: 'bidAmount',
  135. width: 140,
  136. align: 'right',
  137. ellipsis: true,
  138. render: (a: string, b: { bidMode: string, optimizationGoal: string, smartDeliveryPlatform?: string, smartDeliverySceneSpec?: any }) => {
  139. if (b?.smartDeliveryPlatform && b?.smartDeliverySceneSpec) {
  140. const goalDto = SMART_DELIVERY_GOAL_ENUM[b.smartDeliverySceneSpec?.smartDeliveryGoal as keyof typeof SMART_DELIVERY_GOAL_ENUM]
  141. return `${goalDto?.smartDeliveryGoalSpec?.map(item => {
  142. const field_name = item.field_name
  143. const data = b.smartDeliverySceneSpec?.smartDeliveryGoalSpec?.[goalDto?.smartDeliveryGoalSpecName]?.[item.field_name]
  144. return `${item.title}: ${field_name?.includes('Roi') ? data : data / 100}${item?.unitTips || ''}`
  145. })}`
  146. }
  147. return `${BID_MODE_ENUM[b?.bidMode as keyof typeof BID_MODE_ENUM]} ${a}元/${b?.bidMode === 'BID_MODE_CPM' ? '千次曝光' : b?.bidMode === 'BID_MODE_CPC' ? '点击' : OPTIMIZATIONGOAL_ENUM[b?.optimizationGoal as keyof typeof OPTIMIZATIONGOAL_ENUM]}`
  148. }
  149. },
  150. {
  151. title: '深度优化行为出价',
  152. dataIndex: 'deepConversionBehaviorBid',
  153. key: 'deepConversionBehaviorBid',
  154. width: 140,
  155. align: 'right',
  156. ellipsis: true,
  157. render: (a: string, b: any) => {
  158. return b?.deepConversionSpec?.deepConversionWorthSpec?.expectedRoi ? b?.deepConversionSpec?.deepConversionWorthSpec?.expectedRoi + '/' + GOAL_ENUM[b?.deepConversionSpec?.deepConversionWorthSpec?.goal as keyof typeof GOAL_ENUM] : '--'
  159. }
  160. },
  161. {
  162. title: '出价类型',
  163. dataIndex: 'smartBidType',
  164. key: 'smartBidType',
  165. align: 'center',
  166. width: 80,
  167. ellipsis: true,
  168. render: (a: string, b: { endDate: string }) => {
  169. return a === 'SMART_BID_TYPE_CUSTOM' ? '手动出价' : '自动出价'
  170. }
  171. },
  172. {
  173. title: ['GAME', 'GAME_IAA'].includes(useType) ? '出价场景' : '出价策略',
  174. dataIndex: 'bidStrategy',
  175. key: 'bidStrategy',
  176. align: 'center',
  177. width: 70,
  178. ellipsis: true,
  179. render: (a: string, b: { bidScene: string }) => {
  180. if (['GAME', 'GAME_IAA'].includes(useType)) {
  181. return BID_SCENE_NORMAL_ENUM[b?.bidScene as keyof typeof BID_SCENE_NORMAL_ENUM] || '--'
  182. }
  183. return BidStrategyEnum[a as keyof typeof BidStrategyEnum]
  184. }
  185. },
  186. {
  187. title: '一键起量',
  188. dataIndex: 'autoAcquisitionEnabled',
  189. key: 'autoAcquisitionEnabled',
  190. align: 'center',
  191. width: 70,
  192. render: (a: boolean) => {
  193. return a ? <Tag color="success">开启</Tag> : <Tag color="error">关闭</Tag>
  194. }
  195. },
  196. {
  197. title: '一键起量状态',
  198. dataIndex: 'autoAcquisitionStatus',
  199. key: 'autoAcquisitionStatus',
  200. align: 'center',
  201. width: 120,
  202. ellipsis: true,
  203. render: (a: string) => AUTO_ACQUISTION_STATUS[a as keyof typeof AUTO_ACQUISTION_STATUS]
  204. },
  205. {
  206. title: '一键起量预算',
  207. dataIndex: 'autoAcquisitionBudget',
  208. key: 'autoAcquisitionBudget',
  209. align: 'right',
  210. width: 70
  211. },
  212. {
  213. title: '广告组日预算(元)',
  214. dataIndex: 'dailyBudget',
  215. key: 'dailyBudget',
  216. align: 'center',
  217. width: 70
  218. },
  219. {
  220. title: '营销目的',
  221. dataIndex: 'marketingGoal',
  222. key: 'marketingGoal',
  223. align: 'center',
  224. width: 80,
  225. ellipsis: true,
  226. render: (a: any) => {
  227. return MARKETING_GOAL_ENUM[a as keyof typeof MARKETING_GOAL_ENUM]
  228. }
  229. },
  230. {
  231. title: '推广产品类型',
  232. dataIndex: 'marketingTargetType',
  233. key: 'marketingTargetType',
  234. align: 'center',
  235. width: 80,
  236. ellipsis: true,
  237. render: (a: any) => {
  238. if (['GAME', 'GAME_IAA'].includes(useType)) {
  239. return MARKETING_TARGET_TYPE_GAME_ENUM[a as keyof typeof MARKETING_TARGET_TYPE_GAME_ENUM] || '--'
  240. }
  241. return MARKETING_TARGET_TYPE_ENUM[a as keyof typeof MARKETING_TARGET_TYPE_ENUM]
  242. }
  243. },
  244. {
  245. title: '营销载体类型',
  246. dataIndex: 'marketingCarrierType',
  247. key: 'marketingCarrierType',
  248. align: 'center',
  249. width: 80,
  250. ellipsis: true,
  251. render: (a: any) => {
  252. return MARKETING_CARRIER_TYPE_ENUM[a as keyof typeof MARKETING_CARRIER_TYPE_ENUM]
  253. }
  254. },
  255. {
  256. title: '是否开启自动版位功能',
  257. dataIndex: 'automaticSiteEnabled',
  258. key: 'automaticSiteEnabled',
  259. align: 'center',
  260. width: 80,
  261. render: (a: any, b: any) => {
  262. return a ? '开' : '关'
  263. }
  264. },
  265. {
  266. title: '版位选择',
  267. dataIndex: 'siteSet',
  268. key: 'siteSet',
  269. align: 'center',
  270. width: 80,
  271. ellipsis: true,
  272. render: (a: any) => {
  273. return a ? a.map((item: string | number) => SITE_SET_ENUM[item as keyof typeof SITE_SET_ENUM]).toString() : '--'
  274. }
  275. },
  276. {
  277. title: '定向条件描述',
  278. dataIndex: 'targetingTranslation',
  279. key: 'targetingTranslation',
  280. align: 'center',
  281. width: 80,
  282. ellipsis: true,
  283. render: (a: any) => {
  284. return a || '--'
  285. }
  286. },
  287. {
  288. title: '成本保障状态',
  289. dataIndex: 'costGuaranteeStatus',
  290. key: 'costGuaranteeStatus',
  291. align: 'center',
  292. width: 80,
  293. ellipsis: true,
  294. render: (a: any) => {
  295. return COST_GUARANTEE_STATUS_ENUM[a as keyof typeof COST_GUARANTEE_STATUS_ENUM]
  296. }
  297. },
  298. {
  299. title: '成本保障赔付金额',
  300. dataIndex: 'costGuaranteeMoney',
  301. key: 'costGuaranteeMoney',
  302. align: 'right',
  303. width: 70
  304. },
  305. {
  306. title: '创建时间',
  307. dataIndex: 'createdTime',
  308. key: 'createdTime',
  309. align: 'center',
  310. width: 140,
  311. ellipsis: true,
  312. },
  313. {
  314. title: '是否已删除',
  315. dataIndex: 'isDeleted',
  316. key: 'isDeleted',
  317. align: 'center',
  318. width: 60,
  319. render: (a: any, b: any) => {
  320. return <Badge status={!a ? "processing" : "error"} text={a ? '是' : '否'} />
  321. }
  322. },
  323. {
  324. title: '广告状态',
  325. dataIndex: 'systemStatus',
  326. key: 'systemStatus',
  327. align: 'center',
  328. width: 90,
  329. fixed: 'right',
  330. ellipsis: true,
  331. render: (a: string, b: any) => {
  332. return ADGROUP_STATUS[a as keyof typeof ADGROUP_STATUS]
  333. }
  334. },
  335. {
  336. title: '定向智能状态',
  337. dataIndex: 'smartTargetingStatus',
  338. key: 'smartTargetingStatus',
  339. align: 'center',
  340. width: 90,
  341. fixed: 'right',
  342. render: (a: string) => {
  343. return a === 'SMART_TARGETING_NONE' ? <Tag color="success">关闭</Tag> : a === 'SMART_TARGETING_AUTO' ? <Tag color='error'>开启</Tag> : '--'
  344. }
  345. },
  346. {
  347. title: '创意预览',
  348. dataIndex: 'dynamicCreativeList',
  349. key: 'dynamicCreativeList',
  350. width: 150,
  351. fixed: 'right',
  352. render: (a: any, b: any) => {
  353. if (a?.length) {
  354. let deliveryMode: string[] = []
  355. let creativePreview = a?.map((item: { creativeComponents: any, deliveryMode: string }) => {
  356. deliveryMode.push(item.deliveryMode)
  357. return { ...item?.creativeComponents }
  358. })
  359. return <Space><CreativePreview creativePreview={creativePreview} deliveryMode={deliveryMode} /><a onClick={() => { creativeHandle?.(b?.adgroupId) }}>详情</a></Space>
  360. }
  361. return null
  362. // return <Space><BoxOther creativeComponents={a?.[0]?.creativeComponents || {}} /><a onClick={() => { creativeHandle?.(b?.adgroupId) }}>详情</a></Space>
  363. }
  364. },
  365. {
  366. title: '操作',
  367. dataIndex: 'cz',
  368. key: 'cz',
  369. width: 65,
  370. align: 'center',
  371. fixed: 'right',
  372. render: (a: any, b: any) => {
  373. return <a style={{ color: '#1890ff' }} onClick={() => window.open(`https://ad.qq.com/atlas/${b?.accountId}/admanage/index?tab=adgroup&query={%22operation_status%22:[%22CALCULATE_STATUS_EXCLUDE_DEL%22],%22system_status%22:[],%22search_name%22:%22${b.adgroupId}%22}`)} target="_blank">腾讯广告</a>
  374. }
  375. },
  376. ]
  377. }
  378. export default tableConfig