tableConfig.tsx 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  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, MARKETING_CARRIER_TYPE_ENUM, MARKETING_GOAL_ENUM, MARKETING_TARGET_TYPE_ENUM, MARKETING_TARGET_TYPE_GAME_ENUM, OPTIMIZATIONGOAL_ENUM, SITE_SET_ENUM } from '../../tencentAdPutIn/const'
  11. function tableConfig(onChange: () => void, creativeHandle?: (id: number) => void, useType?: 1 | 2): 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: 'accountId',
  27. key: 'accountId',
  28. align: 'center',
  29. width: 80,
  30. ellipsis: true,
  31. render: (a: string) => {
  32. return <Space>
  33. <a onClick={() => copy(a)} >{a}</a>
  34. </Space>
  35. }
  36. },
  37. {
  38. title: '腾讯备注',
  39. dataIndex: 'memo',
  40. key: 'memo',
  41. align: 'center',
  42. width: 80,
  43. ellipsis: true,
  44. render: (a: string) => {
  45. return a || '--'
  46. }
  47. },
  48. {
  49. title: '本地备注',
  50. dataIndex: 'remark',
  51. key: 'remark',
  52. align: 'center',
  53. width: 80,
  54. ellipsis: true,
  55. render: (a: string) => {
  56. return a || '--'
  57. }
  58. },
  59. {
  60. title: '广告ID',
  61. dataIndex: 'adgroupId',
  62. key: 'adgroupId',
  63. align: 'center',
  64. width: 100,
  65. ellipsis: true,
  66. render: (a: string, b: any) => {
  67. return <Space>
  68. <a onClick={() => copy(a)} >{a}</a>
  69. </Space>
  70. }
  71. },
  72. {
  73. title: '投手',
  74. dataIndex: 'putUserName',
  75. key: 'putUserName',
  76. align: 'center',
  77. width: 70,
  78. ellipsis: true
  79. },
  80. {
  81. title: '广告名称',
  82. dataIndex: 'adgroupName',
  83. key: 'adgroupName',
  84. width: 280,
  85. ellipsis: true,
  86. render: (a: string, b: any) => {
  87. return <a onClick={() => { creativeHandle?.(b?.adgroupId) }}>{a}</a>
  88. // return <InputUpdate title={a} dataIndex={'adgroupName'} record={b} handleSave={handleSave} />
  89. }
  90. },
  91. {
  92. title: '投放日期',
  93. dataIndex: 'beginDate',
  94. key: 'beginDate',
  95. align: 'center',
  96. width: 150,
  97. ellipsis: true,
  98. sorter: true,
  99. render: (a: string, b: { endDate: string }) => {
  100. return b?.endDate ? a + '~' + b.endDate : a + '~' + '长期投放'
  101. }
  102. },
  103. {
  104. title: '投放时间',
  105. dataIndex: 'timeSeries',
  106. key: 'timeSeries',
  107. align: 'center',
  108. width: 55,
  109. render: (a: string, b: { endDate: string }) => {
  110. return <TimeSeriesLook timeSeries={a} />
  111. }
  112. },
  113. {
  114. title: '首日开始投放时间',
  115. dataIndex: 'firstDayBeginTime',
  116. key: 'firstDayBeginTime',
  117. align: 'center',
  118. width: 70,
  119. },
  120. {
  121. title: '出价',
  122. dataIndex: 'bidAmount',
  123. key: 'bidAmount',
  124. width: 140,
  125. align: 'right',
  126. ellipsis: true,
  127. render: (a: string, b: { bidMode: string, optimizationGoal: string }) => {
  128. 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]}`
  129. }
  130. },
  131. {
  132. title: '深度优化行为出价',
  133. dataIndex: 'deepConversionBehaviorBid',
  134. key: 'deepConversionBehaviorBid',
  135. width: 140,
  136. align: 'right',
  137. ellipsis: true,
  138. render: (a: string, b: any) => {
  139. return b?.deepConversionSpec?.deepConversionWorthSpec?.expectedRoi ? b?.deepConversionSpec?.deepConversionWorthSpec?.expectedRoi + '/' + GOAL_ENUM[b?.deepConversionSpec?.deepConversionWorthSpec?.goal as keyof typeof GOAL_ENUM] : '--'
  140. }
  141. },
  142. {
  143. title: '出价类型',
  144. dataIndex: 'smartBidType',
  145. key: 'smartBidType',
  146. align: 'center',
  147. width: 80,
  148. ellipsis: true,
  149. render: (a: string, b: { endDate: string }) => {
  150. return a === 'SMART_BID_TYPE_CUSTOM' ? '手动出价' : '自动出价'
  151. }
  152. },
  153. {
  154. title: useType === 2 ? '出价场景' : '出价策略',
  155. dataIndex: 'bidStrategy',
  156. key: 'bidStrategy',
  157. align: 'center',
  158. width: 70,
  159. ellipsis: true,
  160. render: (a: string, b: { bidScene: string }) => {
  161. if (useType === 2) {
  162. return BID_SCENE_NORMAL_ENUM[b?.bidScene as keyof typeof BID_SCENE_NORMAL_ENUM] || '--'
  163. }
  164. return BidStrategyEnum[a as keyof typeof BidStrategyEnum]
  165. }
  166. },
  167. {
  168. title: '一键起量',
  169. dataIndex: 'autoAcquisitionEnabled',
  170. key: 'autoAcquisitionEnabled',
  171. align: 'center',
  172. width: 70,
  173. render: (a: boolean) => {
  174. return a ? <Tag color="success">开启</Tag> : <Tag color="error">关闭</Tag>
  175. }
  176. },
  177. {
  178. title: '一键起量状态',
  179. dataIndex: 'autoAcquisitionStatus',
  180. key: 'autoAcquisitionStatus',
  181. align: 'center',
  182. width: 120,
  183. ellipsis: true,
  184. render: (a: string) => AUTO_ACQUISTION_STATUS[a as keyof typeof AUTO_ACQUISTION_STATUS]
  185. },
  186. {
  187. title: '一键起量预算',
  188. dataIndex: 'autoAcquisitionBudget',
  189. key: 'autoAcquisitionBudget',
  190. align: 'right',
  191. width: 70
  192. },
  193. {
  194. title: '广告组日预算(元)',
  195. dataIndex: 'dailyBudget',
  196. key: 'dailyBudget',
  197. align: 'center',
  198. width: 70
  199. },
  200. {
  201. title: '营销目的',
  202. dataIndex: 'marketingGoal',
  203. key: 'marketingGoal',
  204. align: 'center',
  205. width: 80,
  206. ellipsis: true,
  207. render: (a: any) => {
  208. return MARKETING_GOAL_ENUM[a as keyof typeof MARKETING_GOAL_ENUM]
  209. }
  210. },
  211. {
  212. title: '推广产品类型',
  213. dataIndex: 'marketingTargetType',
  214. key: 'marketingTargetType',
  215. align: 'center',
  216. width: 80,
  217. ellipsis: true,
  218. render: (a: any) => {
  219. if (useType === 2) {
  220. return MARKETING_TARGET_TYPE_GAME_ENUM[a as keyof typeof MARKETING_TARGET_TYPE_GAME_ENUM] || '--'
  221. }
  222. return MARKETING_TARGET_TYPE_ENUM[a as keyof typeof MARKETING_TARGET_TYPE_ENUM]
  223. }
  224. },
  225. {
  226. title: '营销载体类型',
  227. dataIndex: 'marketingCarrierType',
  228. key: 'marketingCarrierType',
  229. align: 'center',
  230. width: 80,
  231. ellipsis: true,
  232. render: (a: any) => {
  233. return MARKETING_CARRIER_TYPE_ENUM[a as keyof typeof MARKETING_CARRIER_TYPE_ENUM]
  234. }
  235. },
  236. {
  237. title: '是否开启自动版位功能',
  238. dataIndex: 'automaticSiteEnabled',
  239. key: 'automaticSiteEnabled',
  240. align: 'center',
  241. width: 80,
  242. render: (a: any, b: any) => {
  243. return a ? '开' : '关'
  244. }
  245. },
  246. {
  247. title: '版位选择',
  248. dataIndex: 'siteSet',
  249. key: 'siteSet',
  250. align: 'center',
  251. width: 80,
  252. ellipsis: true,
  253. render: (a: any) => {
  254. return a ? a.map((item: string | number) => SITE_SET_ENUM[item as keyof typeof SITE_SET_ENUM]).toString() : '--'
  255. }
  256. },
  257. {
  258. title: '定向条件描述',
  259. dataIndex: 'targetingTranslation',
  260. key: 'targetingTranslation',
  261. align: 'center',
  262. width: 80,
  263. render: (a: any) => {
  264. return a || '--'
  265. }
  266. },
  267. {
  268. title: '创建时间',
  269. dataIndex: 'createdTime',
  270. key: 'createdTime',
  271. align: 'center',
  272. width: 140,
  273. ellipsis: true,
  274. },
  275. {
  276. title: '是否已删除',
  277. dataIndex: 'isDeleted',
  278. key: 'isDeleted',
  279. align: 'center',
  280. width: 60,
  281. render: (a: any, b: any) => {
  282. return <Badge status={!a ? "processing" : "error"} text={a ? '是' : '否'} />
  283. }
  284. },
  285. {
  286. title: '广告状态',
  287. dataIndex: 'systemStatus',
  288. key: 'systemStatus',
  289. align: 'center',
  290. width: 90,
  291. fixed: 'right',
  292. ellipsis: true,
  293. render: (a: string, b: any) => {
  294. return ADGROUP_STATUS[a as keyof typeof ADGROUP_STATUS]
  295. }
  296. },
  297. {
  298. title: '创意预览',
  299. dataIndex: 'dynamicCreativeList',
  300. key: 'dynamicCreativeList',
  301. width: 150,
  302. fixed: 'right',
  303. render: (a: any, b: any) => {
  304. if (a?.length) {
  305. let deliveryMode: string[] = []
  306. let creativePreview = a?.map((item: { creativeComponents: any, deliveryMode: string }) => {
  307. deliveryMode.push(item.deliveryMode)
  308. return { ...item?.creativeComponents }
  309. })
  310. return <Space><CreativePreview creativePreview={creativePreview} deliveryMode={deliveryMode} /><a onClick={() => { creativeHandle?.(b?.adgroupId) }}>详情</a></Space>
  311. }
  312. return null
  313. // return <Space><BoxOther creativeComponents={a?.[0]?.creativeComponents || {}} /><a onClick={() => { creativeHandle?.(b?.adgroupId) }}>详情</a></Space>
  314. }
  315. },
  316. {
  317. title: '操作',
  318. dataIndex: 'cz',
  319. key: 'cz',
  320. width: 65,
  321. align: 'center',
  322. fixed: 'right',
  323. render: (a: any, b: any) => {
  324. 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>
  325. }
  326. },
  327. ]
  328. }
  329. export default tableConfig