tablePlanListConfig.tsx 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  1. import { Statistic, Tooltip } from 'antd'
  2. import React from 'react'
  3. import './index.less'
  4. import { ReactComponent as RocketSvg } from '@/assets/rocket.svg'
  5. import { GOUMAILEIXING, GUANGGAOZHUANGTAI, TUIGUANGMUBIAO, CHUANGYIZHUANGTAI, YOUHUAMUBIAO } from './enum'
  6. import Box from './components/box'
  7. function columnsMonitor(details: (id: number) => void) {
  8. return function columns() {
  9. let newArr: any = [
  10. {
  11. title: '数据日期',
  12. dataIndex: 'beginToEnd',
  13. key: 'beginToEnd',
  14. align: 'center',
  15. width: 100,
  16. fixed: 'left'
  17. },
  18. {
  19. title: '广告名称/ID',
  20. dataIndex: 'adgroupName',
  21. key: 'adgroupName',
  22. align: 'left',
  23. width: 210,
  24. ellipsis: true,
  25. render: (str: any, b: any) => {
  26. return <div style={{ display: 'flex', flexFlow: 'column nowrap', fontSize: 12 }}>
  27. <div style={{ color: '#459ae9', fontSize: 10 }} className='oneText'>{b.adgroupName}</div>
  28. <div style={{ color: '#888' }}>广告ID:{b?.adgroupId}</div>
  29. </div>
  30. }
  31. },
  32. {
  33. title: '投放计划名称/ID',
  34. dataIndex: 'campaignName/campaignId',
  35. key: 'campaignName/campaignId',
  36. align: 'left',
  37. width: 180,
  38. ellipsis: true,
  39. render: (str: any, b: any) => {
  40. return <div style={{ display: 'flex', flexFlow: 'column nowrap', fontSize: 12 }}>
  41. <div style={{ color: '#459ae9', fontSize: 10 }} className='oneText'>{b.campaignName}</div>
  42. <div style={{ color: '#888' }}>计划ID:{b?.campaignId}</div>
  43. </div>
  44. }
  45. },
  46. {
  47. title: '创意名称/ID',
  48. dataIndex: 'creativeName/creativeId',
  49. key: 'creativeName/creativeId',
  50. align: 'left',
  51. width: 210,
  52. render: (str: any, b: any) => {
  53. return <div style={{ display: 'flex', flexFlow: 'column nowrap', fontSize: 12 }}>
  54. <div style={{ color: '#459ae9', fontSize: 10 }} className='oneText'>{b.creativeName}</div>
  55. <div style={{ color: '#888' }}>创意ID:{b?.creativeId}</div>
  56. </div>
  57. }
  58. },
  59. {
  60. title: '创意预览',
  61. dataIndex: 'creativePreview',
  62. key: 'creativePreview',
  63. width: 110,
  64. align: 'center',
  65. render: (a: any, b: any) => {
  66. // return a && a?.length > 0 ? <a href={a[0]} target='_blank'>预览</a> : '--'
  67. return <Box b={b} />
  68. }
  69. },
  70. {
  71. title: '广告账户',
  72. dataIndex: 'accountId',
  73. key: 'accountId',
  74. width: 70,
  75. align: 'center'
  76. },
  77. {
  78. title: '投手',
  79. dataIndex: 'putUserName',
  80. key: 'putUserName',
  81. width: 70,
  82. align: 'center',
  83. render: (a: any) => {
  84. return a || '--'
  85. }
  86. },
  87. {
  88. title: '创建日期',
  89. dataIndex: 'adCreateTime',
  90. key: 'adCreateTime',
  91. align: 'center',
  92. width: 110
  93. },
  94. {
  95. title: '广告状态',
  96. dataIndex: 'adStatus',
  97. key: 'adStatus',
  98. align: 'center',
  99. width: 105,
  100. render: (a: any) => {
  101. return <span dangerouslySetInnerHTML={{ __html: GUANGGAOZHUANGTAI[a] || '--' }}></span>
  102. }
  103. },
  104. // {
  105. // title: '创意状态',
  106. // dataIndex: "adCreativeStatus",
  107. // key: "adCreativeStatus",
  108. // align: 'center',
  109. // width: 105,
  110. // render: (a: any) => {
  111. // return CHUANGYIZHUANGTAI[a] || '--'
  112. // }
  113. // },
  114. // {
  115. // title: '购买类型',
  116. // dataIndex: 'adBuyType',
  117. // key: 'adBuyType',
  118. // align: 'center',
  119. // width: 110,
  120. // render: (a: any) => {
  121. // return GOUMAILEIXING[a] || '--'
  122. // }
  123. // },
  124. // {
  125. // title: '自动扩量',
  126. // dataIndex: 'autoExpand',
  127. // key: 'autoExpand',
  128. // width: 110,
  129. // align: 'center',
  130. // render: (a: any) => {
  131. // return a
  132. // }
  133. // },
  134. // {
  135. // title: '曝光评估',
  136. // dataIndex: 'impressionAppraise',
  137. // key: 'impressionAppraise',
  138. // align: 'center',
  139. // width: 115,
  140. // render: (a: any) => {
  141. // return a || '--'
  142. // }
  143. // },
  144. {
  145. title: '投放时间',
  146. dataIndex: 'adBeginTime',
  147. key: 'adBeginTime',
  148. align: 'center',
  149. width: 120,
  150. render: (a: any, b: any) => {
  151. return a ? <div style={{ display: 'flex', flexFlow: 'column nowrap' }}>
  152. <span>{a}</span>
  153. {/* <span>{b?.adEndDate}</span> */}
  154. </div> : '--'
  155. }
  156. },
  157. // {
  158. // title: '当日成本偏差',
  159. // dataIndex: 'dayCostOffset',
  160. // key: 'dayCostOffset',
  161. // align: 'center',
  162. // width: 90,
  163. // render: (a: any) => {
  164. // return a || '--'
  165. // }
  166. // },
  167. {
  168. title: '推广目标',
  169. dataIndex: 'promotedObjectType',
  170. key: 'promotedObjectType',
  171. align: 'center',
  172. width: 80,
  173. ellipsis: true,
  174. render: (a: any) => {
  175. return TUIGUANGMUBIAO[a] || '推广公众号'
  176. }
  177. },
  178. // {
  179. // title: '深度优化目标',
  180. // dataIndex: 'depthOptimizeTarget',
  181. // key: 'depthOptimizeTarget',
  182. // width: 110,
  183. // align: 'center',
  184. // render: (a: any) => {
  185. // return a
  186. // }
  187. // },
  188. {
  189. title: '广告预算',
  190. dataIndex: 'adBudget',
  191. key: 'adBudget',
  192. align: 'center',
  193. width: 110,
  194. render: (a: any) => {
  195. return a ? <Statistic value={a | 0} /> : '--'
  196. }
  197. },
  198. {
  199. title: '出价方式',
  200. dataIndex: 'bidMode',
  201. key: 'bidMode',
  202. align: 'center',
  203. width: 80,
  204. render: (a: any) => {
  205. return a || '--'
  206. }
  207. },
  208. {
  209. title: '当前出价',
  210. dataIndex: 'bidAmount',
  211. key: 'bidAmount',
  212. align: 'center',
  213. width: 80,
  214. render: (a: any) => {
  215. return a ? <Statistic value={a | 0} /> : '--'
  216. }
  217. },
  218. // {
  219. // title: '计划预算',
  220. // dataIndex: 'planBudget',
  221. // key: 'planBudget',
  222. // align: 'center',
  223. // width: 80,
  224. // render: (a: any) => {
  225. // return a ? <Statistic value={a | 0} /> : '--'
  226. // }
  227. // },
  228. {
  229. title: '广告总消耗',
  230. dataIndex: 'cost',
  231. key: 'cost',
  232. align: 'center',
  233. width: 100,
  234. sorter: true,
  235. render: (a: any) => {
  236. return <Statistic value={a || 0} />
  237. }
  238. },
  239. // {
  240. // title: '今日消耗',
  241. // dataIndex: 'todayCostTotal',
  242. // key: 'todayCostTotal',
  243. // align: 'center',
  244. // width: 105,
  245. // render: (a: any) => {
  246. // return <Statistic value={a || 0} />
  247. // }
  248. // },
  249. {
  250. title: '单位时间消耗速度',
  251. dataIndex: 'costSpeed',
  252. key: 'costSpeed',
  253. align: 'center',
  254. width: 120,
  255. render: (a: any, b: any) => {
  256. return <div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
  257. {/* <div>当前:<span></span></div>
  258. <div>前第一小时:<span></span></div> */}
  259. <RocketSvg /> <a onClick={() => details(b)} style={{ marginLeft: 10 }}>详情</a>
  260. </div>
  261. }
  262. },
  263. {
  264. title: '曝光量',
  265. dataIndex: 'viewCount',
  266. key: 'viewCount',
  267. align: 'center',
  268. width: 70,
  269. sorter: true,
  270. render: (a: number) => {
  271. return <span style={a <= 8 ? { color: '#0f990f', fontWeight: 600 } : a >= 100 ? { color: 'red', fontWeight: 600 } : {}}> {a || '--'}</span >
  272. },
  273. },
  274. {
  275. title: '千次曝光成本',
  276. dataIndex: 'thousandDisplayPrice',
  277. key: 'thousandDisplayPrice',
  278. align: 'center',
  279. width: 115,
  280. sorter: true,
  281. render: (a: any) => {
  282. return <Statistic value={a ? a?.toFixed(2) : 0} />
  283. }
  284. },
  285. {
  286. title: '点击量',
  287. dataIndex: 'clickCount',
  288. key: 'clickCount',
  289. align: 'center',
  290. width: 70,
  291. sorter: true,
  292. render: (a: number) => {
  293. return <span style={a <= 8 ? { color: '#0f990f', fontWeight: 600 } : a >= 100 ? { color: 'red', fontWeight: 600 } : {}}> {a || '--'}</span >
  294. },
  295. },
  296. {
  297. title: '点击均价',
  298. dataIndex: 'avgClickAmount',
  299. key: 'avgClickAmount',
  300. align: 'center',
  301. width: 115,
  302. sorter: true,
  303. render: (a: any) => {
  304. return <Statistic value={a ? a?.toFixed(2) : 0} />
  305. }
  306. },
  307. {
  308. title: '点击率',
  309. dataIndex: 'clickRate',
  310. key: 'clickRate',
  311. align: 'center',
  312. width: 115,
  313. sorter: true,
  314. render: (a: any) => {
  315. a = a ? parseFloat((a * 100).toFixed(2)) : 0
  316. return a + '%'
  317. }
  318. },
  319. {
  320. title: '不感兴趣点击次数',
  321. dataIndex: 'noInterestCount',
  322. key: 'noInterestCount',
  323. align: 'center',
  324. width: 70,
  325. sorter: true,
  326. render: (a: number) => {
  327. return <span style={a <= 8 ? { color: '#0f990f', fontWeight: 600 } : a >= 100 ? { color: 'red', fontWeight: 600 } : {}}> {a || '--'}</span >
  328. },
  329. },
  330. {
  331. title: '优化目标',
  332. dataIndex: 'optimizationGoal',
  333. key: 'optimizationGoal',
  334. align: 'center',
  335. width: 115,
  336. render: (a: any) => {
  337. return <Tooltip title={YOUHUAMUBIAO[a]}>
  338. <div className='oneText'>{YOUHUAMUBIAO[a] || '--'}</div>
  339. </Tooltip>
  340. }
  341. },
  342. {
  343. title: '转化目标量',
  344. dataIndex: 'conversionsCount',
  345. key: 'conversionsCount',
  346. align: 'center',
  347. width: 115,
  348. sorter: true,
  349. render: (a: any) => {
  350. return <Statistic value={a || 0} />
  351. }
  352. },
  353. {
  354. title: '转化目标成本',
  355. dataIndex: 'conversionsCost',
  356. key: 'conversionsCost',
  357. align: 'center',
  358. width: 115,
  359. sorter: true,
  360. render: (a: any) => {
  361. return <Statistic value={a ? a?.toFixed(2) : 0} />
  362. }
  363. },
  364. {
  365. title: '目标转化率',
  366. dataIndex: 'conversionsRate',
  367. key: 'conversionsRate',
  368. align: 'center',
  369. width: 115,
  370. sorter: true,
  371. render: (a: any) => {
  372. a = a ? parseFloat((a * 100).toFixed(2)) : 0
  373. return a + '%'
  374. }
  375. },
  376. {
  377. title: '深度转化量',
  378. dataIndex: 'deepConversionsCount',
  379. key: 'deepConversionsCount',
  380. align: 'center',
  381. width: 115,
  382. sorter: true,
  383. render: (a: any) => {
  384. return <Statistic value={a || 0} />
  385. }
  386. },
  387. {
  388. title: '下单量',
  389. dataIndex: 'orderCount',
  390. key: 'orderCount',
  391. align: 'center',
  392. width: 115,
  393. sorter: true,
  394. render: (a: any) => {
  395. return <Statistic value={a || 0} />
  396. }
  397. },
  398. {
  399. title: '首日新增下单量',
  400. dataIndex: 'firstDayOrderCount',
  401. key: 'firstDayOrderCount',
  402. align: 'center',
  403. width: 115,
  404. sorter: true,
  405. render: (a: any) => {
  406. return <Statistic value={a || 0} />
  407. }
  408. },
  409. {
  410. title: '下单成本',
  411. dataIndex: 'orderCost',
  412. key: 'orderCost',
  413. align: 'center',
  414. width: 115,
  415. sorter: true,
  416. render: (a: any) => {
  417. return <Statistic value={a ? a?.toFixed(2) : 0} />
  418. }
  419. },
  420. {
  421. title: '下单率',
  422. dataIndex: 'orderRate',
  423. key: 'orderRate',
  424. align: 'center',
  425. width: 115,
  426. sorter: true,
  427. render: (a: any) => {
  428. a = a ? parseFloat((a * 100).toFixed(2)) : 0
  429. return a + '%'
  430. }
  431. },
  432. {
  433. title: '下单金额',
  434. dataIndex: 'orderAmount',
  435. key: 'orderAmount',
  436. align: 'center',
  437. width: 115,
  438. sorter: true,
  439. render: (a: any) => {
  440. return <Statistic value={a || 0} />
  441. }
  442. },
  443. {
  444. title: '首日新增下单金额',
  445. dataIndex: 'firstDayOrderAmount',
  446. key: 'firstDayOrderAmount',
  447. align: 'center',
  448. width: 115,
  449. sorter: true,
  450. render: (a: any) => {
  451. return <Statistic value={a || 0} />
  452. }
  453. },
  454. {
  455. title: '下单客单价',
  456. dataIndex: 'atvAmount',
  457. key: 'atvAmount',
  458. align: 'center',
  459. width: 115,
  460. sorter: true,
  461. render: (a: any) => {
  462. return <Statistic value={a ? a?.toFixed(2) : 0} />
  463. }
  464. },
  465. {
  466. title: '下单ROI',
  467. dataIndex: 'orderROI',
  468. key: 'orderROI',
  469. align: 'center',
  470. width: 115,
  471. sorter: true,
  472. render: (a: any) => {
  473. a = a ? parseFloat((a * 100).toFixed(2)) : 0
  474. return a + '%'
  475. }
  476. },
  477. {
  478. title: '首日新增下单ROI',
  479. dataIndex: 'firstDayOrderRoi',
  480. key: 'firstDayOrderRoi',
  481. align: 'center',
  482. width: 115,
  483. sorter: true,
  484. render: (a: any) => {
  485. a = a ? parseFloat((a * 100).toFixed(2)) : 0
  486. return a + '%'
  487. }
  488. },
  489. {
  490. title: '公众号关注人数',
  491. dataIndex: 'mpFollowUser',
  492. key: 'mpFollowUser',
  493. align: 'center',
  494. width: 115,
  495. sorter: true,
  496. render: (a: any) => {
  497. return a || '--'
  498. }
  499. },
  500. {
  501. title: '公众号关注率',
  502. dataIndex: 'mpFollowRate',
  503. key: 'mpFollowRate',
  504. align: 'center',
  505. width: 115,
  506. sorter: true,
  507. render: (a: any) => {
  508. a = a ? parseFloat((a * 100).toFixed(2)) : 0
  509. return a + '%'
  510. }
  511. },
  512. {
  513. title: '公众号关注成本',
  514. dataIndex: 'mpFollowCost',
  515. key: 'mpFollowCost',
  516. align: 'center',
  517. width: 115,
  518. sorter: true,
  519. render: (a: any) => {
  520. return <Statistic value={a ? a?.toFixed(2) : 0} />
  521. }
  522. },
  523. {
  524. title: '操作',
  525. dataIndex: 'event',
  526. key: 'event',
  527. align: 'center',
  528. width: 90,
  529. render: (a: any, b: any) => {
  530. return <a style={{ color: '#1890ff' }} onClick={() => window.open(`https://ad.qq.com/atlas/${b?.accountId}/admanage/adcreative?adgroupid=${b?.adgroupId}&query={%22configured_status%22:[%22AD_STATUS_EXCLUDE_DELETED%22],%22status%22:[]}`)} target="_blank">腾讯广告</a>
  531. }
  532. }
  533. ]
  534. return newArr
  535. }
  536. }
  537. export default columnsMonitor