tableConfig.tsx 8.3 KB

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