tableConfig.tsx 3.7 KB

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