tablePlanListConfig.tsx 20 KB

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