tableConfig.tsx 9.2 KB

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