tableConfig.tsx 4.0 KB

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