tableConfig.tsx 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. import { CampaignTypeEnum, ConfiguredStatusEnum, PromotedObjectType, SpeedMode } from '@/services/launchAdq/enum'
  2. import { copy } from '@/utils/utils'
  3. import { CopyOutlined } from '@ant-design/icons'
  4. import { Badge, Space, Switch } from 'antd'
  5. import React from 'react'
  6. function tableConfig(
  7. switchHandle: (data: any, Status: any) => void,
  8. tableIdClick: (props: {
  9. activeKey: string,
  10. parma: {
  11. accountId?: string,//账户ID
  12. campaignId?: string,//计划ID
  13. adgroupId?: string,//广告ID
  14. adcreativeId?: string,//创意ID
  15. pageId?: string,//落地页ID
  16. targetingId?: string,//定向ID
  17. }
  18. }) => void): any {
  19. return [
  20. {
  21. title: '启停',
  22. dataIndex: 'qt',
  23. key: 'qt',
  24. align: 'center',
  25. width: 50,
  26. fixed: 'left',
  27. render: (a: string, b: any) => {
  28. return <Switch defaultChecked={b?.configuredStatus === 'AD_STATUS_NORMAL'} onChange={(checked: boolean) => {
  29. switchHandle(b, checked)
  30. }} />
  31. }
  32. },
  33. {
  34. title: '所属账号',
  35. dataIndex: 'accountId',
  36. key: 'accountId',
  37. align: 'center',
  38. width: 90,
  39. fixed: 'left',
  40. ellipsis: true,
  41. render: (a: string) => {
  42. return <Space>
  43. <a onClick={() => copy(a)} >{a}</a>
  44. </Space>
  45. }
  46. },
  47. {
  48. title: '计划ID',
  49. dataIndex: 'campaignId',
  50. key: 'campaignId',
  51. align: 'center',
  52. width: 100,
  53. fixed: 'left',
  54. ellipsis: true,
  55. render: (a: string) => {
  56. return <Space>
  57. <a onClick={() => copy(a)} >{a}</a>
  58. </Space>
  59. }
  60. },
  61. {
  62. title: '计划名称',
  63. dataIndex: 'campaignName',
  64. key: 'campaignName',
  65. align: 'center',
  66. width: 350,
  67. },
  68. {
  69. title: '推广计划类型',
  70. dataIndex: 'campaignType',
  71. key: 'campaignType',
  72. align: 'center',
  73. width: 130,
  74. render: (a: string | number) => {
  75. return CampaignTypeEnum[a]
  76. }
  77. },
  78. {
  79. title: '推广目标类型',
  80. dataIndex: 'promotedObjectType',
  81. key: 'promotedObjectType',
  82. align: 'center',
  83. width: 130,
  84. render: (a: string | number) => {
  85. return PromotedObjectType[a]
  86. }
  87. },
  88. {
  89. title: '投放速度模式',
  90. dataIndex: 'speedMode',
  91. key: 'speedMode',
  92. align: 'center',
  93. width: 130,
  94. render: (a: string | number) => {
  95. return SpeedMode[a]
  96. }
  97. },
  98. {
  99. title: '广告组日预算(分)',
  100. dataIndex: 'dailyBudget',
  101. key: 'dailyBudget',
  102. align: 'center',
  103. width: 130,
  104. },
  105. {
  106. title: '推广计划总预算(分)',
  107. dataIndex: 'totalBudget',
  108. key: 'totalBudget',
  109. align: 'center',
  110. width: 130,
  111. },
  112. {
  113. title: '创建时间',
  114. dataIndex: 'createdTime',
  115. key: 'createdTime',
  116. align: 'center',
  117. width: 160,
  118. },
  119. {
  120. title: '是否已删除',
  121. dataIndex: 'isDeleted',
  122. key: 'isDeleted',
  123. align: 'center',
  124. width: 70,
  125. fixed: 'right',
  126. render: (a: any, b: any) => {
  127. return <Badge status={!a ? "processing" : "error"} text={a ? '是' : '否'} />
  128. }
  129. },
  130. {
  131. title: '计划状态',
  132. dataIndex: 'configuredStatus',
  133. key: 'configuredStatus',
  134. align: 'center',
  135. width: 70,
  136. fixed: 'right',
  137. render: (a: string) => {
  138. return <Badge status={a === 'AD_STATUS_NORMAL' ? "processing" : "error"} text={ConfiguredStatusEnum[a]} />
  139. }
  140. },
  141. {
  142. title: '操作',
  143. dataIndex: 'cz',
  144. key: 'cz',
  145. width: 65,
  146. align: 'center',
  147. fixed: 'right',
  148. render: (a: any, b: any) => {
  149. return <a style={{ color: '#1890ff' }} onClick={() => window.open(`https://ad.qq.com/atlas/${b?.accountId}/admanage/adgroup?campaignid=${b?.campaignId}&query={%22operation_status%22:[%22CALCULATE_STATUS_EXCLUDE_DEL%22],%22system_status%22:[]}`)} target="_blank">腾讯计划</a>
  150. }
  151. },
  152. ]
  153. }
  154. export default tableConfig