tableConfig.tsx 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. import { copy } from "@/utils/utils"
  2. import { Badge } from "antd"
  3. import React from "react"
  4. function tableConfig(tableIdClick: (props: {
  5. activeKey: string, parma: {
  6. accountId?: string,//账户ID
  7. campaignId?: string,//计划ID
  8. adgroupId?: string,//广告ID
  9. adcreativeId?: string,//创意ID
  10. pageId?: string,//落地页ID
  11. targetingId?: string,//定向ID
  12. }
  13. }) => void): any {
  14. return [
  15. {
  16. title: '所属账号',
  17. dataIndex: 'accountId',
  18. key: 'accountId',
  19. align: 'center',
  20. width: 70,
  21. fixed: 'left',
  22. ellipsis: true,
  23. render: (a: string) => {
  24. return <a onClick={() => {
  25. tableIdClick({ activeKey: '1', parma: { accountId: a } })
  26. }}>{a}</a>
  27. }
  28. },
  29. {
  30. title: '广告ID',
  31. dataIndex: 'adgroupId',
  32. key: 'adgroupId',
  33. align: 'center',
  34. width: 85,
  35. fixed: 'left',
  36. ellipsis: true,
  37. render: (a: string) => {
  38. return <a onClick={() => {
  39. tableIdClick({ activeKey: '3', parma: { adgroupId: a } })
  40. }}>{a}</a>
  41. }
  42. },
  43. {
  44. title: '推广计划ID',
  45. dataIndex: 'campaignId',
  46. key: 'campaignId',
  47. align: 'center',
  48. width: 85,
  49. fixed: 'left',
  50. ellipsis: true,
  51. render: (a: string) => {
  52. return <a onClick={() => {
  53. tableIdClick({ activeKey: '2', parma: { campaignId: a } })
  54. }}>{a}</a>
  55. }
  56. },
  57. {
  58. title: '广告名称',
  59. dataIndex: 'adgroupName',
  60. key: 'adgroupName',
  61. width: 280,
  62. ellipsis: true,
  63. render: (a: string) => {
  64. return <a style={{ wordBreak: 'break-all' }} onClick={() => { copy(a) }}>{a}</a>
  65. }
  66. },
  67. {
  68. title: '执行时间',
  69. dataIndex: 'createTime',
  70. key: 'createTime',
  71. width: 140,
  72. align: 'center'
  73. },
  74. {
  75. title: '操作者名字',
  76. dataIndex: 'operationByName',
  77. key: 'operationByName',
  78. width: 65,
  79. align: 'center'
  80. },
  81. {
  82. title: '操作类型名称',
  83. dataIndex: 'operationName',
  84. key: 'operationName',
  85. width: 60,
  86. align: 'center'
  87. },
  88. {
  89. title: '操作数',
  90. dataIndex: 'operationCount',
  91. key: 'operationCount',
  92. width: 60,
  93. align: 'center'
  94. },
  95. {
  96. title: '成功数',
  97. dataIndex: 'successCount',
  98. key: 'successCount',
  99. width: 60,
  100. align: 'center'
  101. },
  102. {
  103. title: '失败数',
  104. dataIndex: 'failCount',
  105. key: 'failCount',
  106. width: 60,
  107. align: 'center',
  108. render: (a: number) => {
  109. return <span style={a > 0 ? { color: 'red' } : {}}>{a}</span>
  110. }
  111. },
  112. {
  113. title: '状态',
  114. dataIndex: 'status',
  115. key: 'status',
  116. width: 70,
  117. align: 'center',
  118. render: (a:any) => {
  119. let obj={
  120. '成功':'success',
  121. '失败':'error',
  122. '执行中':'warning'
  123. }
  124. return <Badge status={obj[a]} text={a} />
  125. }
  126. },
  127. {
  128. title: '完成时间',
  129. dataIndex: 'updateTime',
  130. key: 'updateTime',
  131. width: 140,
  132. align: 'center'
  133. },
  134. {
  135. title: '错误消息',
  136. dataIndex: 'errorMsg',
  137. key: 'errorMsg',
  138. width: 400,
  139. ellipsis: true,
  140. },
  141. ]
  142. }
  143. export default tableConfig