tableConfig.tsx 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. import { AdStatusEnum, BidModeEnum, BidStrategyEnum, OptimizationGoalEnum, PromotedObjectType } from '@/services/launchAdq/enum'
  2. import React from 'react'
  3. import { Badge, Popover, Space } from 'antd'
  4. import Box from '@/pages/adMonitor/adMonitorList/components/box'
  5. import SwitchStatus from './switchStatus'
  6. import TimeSeriesLook from './timeSeriesLook'
  7. import { ReactComponent as RocketSvg } from '@/assets/rocket.svg'
  8. import '../index.less'
  9. import { copy } from '@/utils/utils'
  10. import InputUpdate from './inputUpdate'
  11. function tableConfig(
  12. onChange: () => void,
  13. details: (data: any) => void,
  14. handleSave: (data: any) => void,
  15. handleSaveDaily: (data: any) => void
  16. ): any {
  17. return [
  18. {
  19. title: '启停',
  20. dataIndex: 'configuredStatus',
  21. key: 'configuredStatus',
  22. align: 'center',
  23. width: 40,
  24. fixed: 'left',
  25. render: (a: string, b: any) => {
  26. return <SwitchStatus configuredStatus={a} isDeleted={b?.isDeleted} adgroupId={b?.adgroupId} onChange={onChange} />
  27. }
  28. },
  29. {
  30. title: '所属账号',
  31. dataIndex: 'accountId',
  32. key: 'accountId',
  33. align: 'center',
  34. width: 80,
  35. ellipsis: true,
  36. render: (a: string) => {
  37. return <Space>
  38. <a onClick={() => copy(a)} >{a}</a>
  39. </Space>
  40. }
  41. },
  42. {
  43. title: '腾讯备注',
  44. dataIndex: 'memo',
  45. key: 'memo',
  46. align: 'center',
  47. width: 80,
  48. ellipsis: true,
  49. },
  50. {
  51. title: '本地备注',
  52. dataIndex: 'remark',
  53. key: 'remark',
  54. align: 'center',
  55. width: 80,
  56. ellipsis: true,
  57. },
  58. {
  59. title: '广告ID',
  60. dataIndex: 'adgroupId',
  61. key: 'adgroupId',
  62. align: 'center',
  63. width: 100,
  64. ellipsis: true,
  65. render: (a: string, b: any) => {
  66. return <Space>
  67. <a onClick={() => copy(a)} >{a}</a>
  68. </Space>
  69. }
  70. },
  71. {
  72. title: '所属计划ID',
  73. dataIndex: 'campaignId',
  74. key: 'campaignId',
  75. align: 'center',
  76. width: 100,
  77. ellipsis: true,
  78. render: (a: string, b: any) => {
  79. return <Space >
  80. <a onClick={() => copy(a)} >{a}</a>
  81. </Space>
  82. }
  83. },
  84. {
  85. title: '投手',
  86. dataIndex: 'putUserName',
  87. key: 'putUserName',
  88. align: 'center',
  89. width: 70,
  90. ellipsis: true
  91. },
  92. {
  93. title: '广告名称',
  94. dataIndex: 'adgroupName',
  95. key: 'adgroupName',
  96. width: 280,
  97. ellipsis: true,
  98. render: (a: string, b: any) => {
  99. return <InputUpdate title={a} dataIndex={'adgroupName'} record={b} handleSave={handleSave} />
  100. }
  101. },
  102. {
  103. title: '推广目标类型',
  104. dataIndex: 'promotedObjectType',
  105. key: 'promotedObjectType',
  106. align: 'center',
  107. width: 75,
  108. ellipsis: true,
  109. render: (a: string | number) => {
  110. return PromotedObjectType[a]
  111. }
  112. },
  113. {
  114. title: '投放日期',
  115. dataIndex: 'beginDate',
  116. key: 'beginDate',
  117. align: 'center',
  118. width: 150,
  119. ellipsis: true,
  120. render: (a: string, b: { endDate: string }) => {
  121. return b?.endDate ? a + '~' + b.endDate : a + '~' + '长期投放'
  122. }
  123. },
  124. {
  125. title: '投放时间',
  126. dataIndex: 'timeSeries',
  127. key: 'timeSeries',
  128. align: 'center',
  129. width: 55,
  130. render: (a: string, b: { endDate: string }) => {
  131. return <TimeSeriesLook timeSeries={a} />
  132. }
  133. },
  134. {
  135. title: '首日开始投放时间',
  136. dataIndex: 'firstDayBeginTime',
  137. key: 'firstDayBeginTime',
  138. align: 'center',
  139. width: 70,
  140. },
  141. {
  142. title: '出价',
  143. dataIndex: 'bidAmount',
  144. key: 'bidAmount',
  145. width: 140,
  146. ellipsis: true,
  147. render: (a: string, b: { bidMode: string, optimizationGoal: string }) => {
  148. return `${BidModeEnum[b?.bidMode]} ${a}元/${b?.bidMode === 'BID_MODE_CPM' ? '千次曝光' : b?.bidMode === 'BID_MODE_CPC' ? '点击' : OptimizationGoalEnum[b?.optimizationGoal]}`
  149. }
  150. },
  151. {
  152. title: '深度优化ROI',
  153. dataIndex: 'expectedRoi',
  154. key: 'expectedRoi',
  155. width: 70,
  156. align: 'center',
  157. ellipsis: true,
  158. render: (a: string, b: { deepConversionSpec: any }) => {
  159. return b?.deepConversionSpec?.deepConversionWorthSpec?.expectedRoi || '--'
  160. }
  161. },
  162. {
  163. title: '出价类型',
  164. dataIndex: 'smartBidType',
  165. key: 'smartBidType',
  166. align: 'center',
  167. width: 80,
  168. ellipsis: true,
  169. render: (a: string, b: { endDate: string }) => {
  170. return a === 'SMART_BID_TYPE_CUSTOM' ? '手动出价' : '自动出价'
  171. }
  172. },
  173. {
  174. title: '出价类型',
  175. dataIndex: 'bidStrategy',
  176. key: 'bidStrategy',
  177. align: 'center',
  178. width: 70,
  179. ellipsis: true,
  180. render: (a: string, b: { endDate: string }) => {
  181. return BidStrategyEnum[a]
  182. }
  183. },
  184. {
  185. title: '广告组日预算(元)',
  186. dataIndex: 'dailyBudget',
  187. key: 'dailyBudget',
  188. align: 'center',
  189. width: 70,
  190. render: (a: string, b: any) => {
  191. return <InputUpdate title={a} isNum={true} dataIndex={'dailyBudget'} record={b} handleSave={handleSaveDaily} />
  192. }
  193. },
  194. {
  195. title: '是否开启自动版位功能',
  196. dataIndex: 'automaticSiteEnabled',
  197. key: 'automaticSiteEnabled',
  198. align: 'center',
  199. width: 80,
  200. render: (a: any, b: any) => {
  201. return a ? '开' : '关'
  202. }
  203. },
  204. {
  205. title: '创建时间',
  206. dataIndex: 'createdTime',
  207. key: 'createdTime',
  208. align: 'center',
  209. width: 140,
  210. ellipsis: true,
  211. },
  212. {
  213. title: '是否已删除',
  214. dataIndex: 'isDeleted',
  215. key: 'isDeleted',
  216. align: 'center',
  217. width: 60,
  218. render: (a: any, b: any) => {
  219. return <Badge status={!a ? "processing" : "error"} text={a ? '是' : '否'} />
  220. }
  221. },
  222. {
  223. title: '广告状态',
  224. dataIndex: 'status',
  225. key: 'status',
  226. align: 'center',
  227. width: 70,
  228. fixed: 'right',
  229. ellipsis: true,
  230. render: (a: string, b: any) => {
  231. return b?.rejectMessageList?.filter((str: any) => str)?.length > 0 ? <Popover
  232. style={{ width: 500 }}
  233. overlayStyle={{ width: 500, fontSize: 12 }}
  234. placement="left"
  235. content={b?.rejectMessageList?.map((str: string, eq: number) => {
  236. return str ? <><strong style={{ fontSize: 13 }}>{eq + 1}:</strong>{str}<br /></> : ""
  237. })}>
  238. {AdStatusEnum[a]}
  239. </Popover> :
  240. AdStatusEnum[a]
  241. }
  242. },
  243. {
  244. title: '创意预览',
  245. dataIndex: 'creativePreview',
  246. key: 'creativePreview',
  247. width: 70,
  248. align: 'center',
  249. fixed: 'right',
  250. render: (a: any, b: any) => {
  251. return <Box b={b} />
  252. }
  253. },
  254. {
  255. title: '广告详情',
  256. dataIndex: 'costSpeed',
  257. key: 'costSpeed',
  258. align: 'center',
  259. width: 80,
  260. className: 'padding2',
  261. fixed: 'right',
  262. render: (a: any, b: any) => {
  263. return <div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', lineHeight: 'normal', fontSize: 10 }}>
  264. <RocketSvg /> <a onClick={() => details(b)} style={{ marginLeft: 10 }}>详情</a>
  265. </div>
  266. }
  267. },
  268. {
  269. title: '操作',
  270. dataIndex: 'cz',
  271. key: 'cz',
  272. width: 65,
  273. align: 'center',
  274. fixed: 'right',
  275. render: (a: any, b: any) => {
  276. return <a style={{ color: '#1890ff' }} onClick={() => window.open(`https://ad.qq.com/atlas/${b?.accountId}/admanage/adgroup?tab=adgroup&query={%22operation_status%22:[%22CALCULATE_STATUS_EXCLUDE_DEL%22],%22system_status%22:[],%22search_name%22:%22${b.adgroupId}%22}`)} target="_blank">腾讯广告</a>
  277. }
  278. },
  279. ]
  280. }
  281. export default tableConfig