tableConfig.tsx 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. import { TargetingSourceTypeEnum, } from '@/services/launchAdq/enum'
  2. import React from 'react'
  3. import { Badge, Space, Tooltip } from 'antd'
  4. import { copy } from '@/utils/utils'
  5. import { CopyOutlined } from '@ant-design/icons'
  6. function tableConfig(tableIdClick: any): any {
  7. return [
  8. {
  9. title: '所属账号',
  10. dataIndex: 'accountId',
  11. key: 'accountId',
  12. align: 'center',
  13. width: 100,
  14. ellipsis: true,
  15. render: (a: string) => {
  16. return <Space>
  17. <a onClick={() => copy(a)} >{a}</a>
  18. </Space>
  19. }
  20. },
  21. {
  22. title: '定向ID',
  23. dataIndex: 'targetingId',
  24. key: 'targetingId',
  25. align: 'center',
  26. width: 100,
  27. ellipsis: true,
  28. render: (a: string) => {
  29. return <a onClick={() => copy(a)}>{a}</a>
  30. }
  31. },
  32. {
  33. title: '定向名称',
  34. dataIndex: 'targetingName',
  35. key: 'targetingName',
  36. align: 'center',
  37. width: 250
  38. },
  39. {
  40. title: '定向描述',
  41. dataIndex: 'description',
  42. key: 'description',
  43. align: 'center',
  44. width: 250
  45. },
  46. {
  47. title: '地理位置',
  48. dataIndex: 'targetingTranslation',
  49. key: 'targetingTranslation',
  50. align: 'center',
  51. width: 600,
  52. render: (a: any) => {
  53. return <Tooltip
  54. overlayInnerStyle={a?.length > 200 ? { width: 800 } : {}}
  55. title={
  56. <div style={{ display: 'flex', flexFlow: 'column' }}>
  57. {
  58. a?.split(';')?.filter((str: any) => !!str)?.map((str: string, index: number) => {
  59. let arr = str?.split(':')
  60. return <span key={index}>{arr[0]}:<a>{arr[1]}</a></span>
  61. })
  62. }
  63. </div>
  64. }>
  65. <div style={{ display: 'flex', flexFlow: 'column' }}>
  66. {
  67. a?.split(';')?.filter((str: any) => !!str)?.map((str: string, index: number) => {
  68. if (str.includes('地理位置')) {
  69. let arr = str?.split(':')
  70. return <span key={index}>{arr[0]}:<a>{arr[1]}....</a></span>
  71. } else {
  72. return null
  73. }
  74. })
  75. }
  76. </div>
  77. </Tooltip>
  78. }
  79. },
  80. {
  81. title: '定向包来源',
  82. dataIndex: 'targetingSourceType',
  83. key: 'targetingSourceType',
  84. align: 'center',
  85. width: 170,
  86. render: (a: string | number, b: any) => {
  87. return <div style={{ display: 'flex', flexFlow: 'column' }}>
  88. <span> {a && TargetingSourceTypeEnum[a]}</span>
  89. {
  90. !!b?.shareFromAccountId && <span>来源账号ID:<a>{b?.shareFromAccountId}</a></span>
  91. }
  92. {
  93. !!b?.shareFromTargetingId && <span>来源包ID:<a>{b?.shareFromTargetingId}</a></span>
  94. }
  95. </div>
  96. }
  97. },
  98. {
  99. title: '是否包含不支持定向',
  100. dataIndex: 'includeUnsupportedTargeting',
  101. key: 'includeUnsupportedTargeting',
  102. align: 'center',
  103. width: 120,
  104. render: (a: boolean) => {
  105. return <Badge status={!a ? "processing" : "error"} text={a ? '包含' : '不包含'} />
  106. }
  107. },
  108. {
  109. title: '创建时间',
  110. dataIndex: 'createdTime',
  111. key: 'createdTime',
  112. align: 'center',
  113. width: 160,
  114. },
  115. {
  116. title: '最后修改时间',
  117. dataIndex: 'lastModifiedTime',
  118. key: 'lastModifiedTime',
  119. align: 'center',
  120. width: 160,
  121. },
  122. ]
  123. }
  124. export default tableConfig