tableConfig.tsx 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. import { Space, TableProps, Typography } from "antd"
  2. import React from "react"
  3. import { OPTIMIZATIONGOAL_ENUM } from "../const";
  4. const { Text, Title } = Typography;
  5. import style from './index.less'
  6. const columns = (): TableProps<any>['columns'] => {
  7. return [
  8. {
  9. title: '广告',
  10. dataIndex: 'adgroup',
  11. key: 'adgroup',
  12. align: 'center',
  13. children: [
  14. {
  15. title: '广告名称',
  16. dataIndex: 'adgroupName',
  17. key: 'adgroupName',
  18. width: 250,
  19. render: (_, b) => {
  20. return <Text style={{ fontSize: 12 }}>{b?.adgroupsDto?.adgroupName}</Text>
  21. },
  22. onCell: (record, index = 0) => ({
  23. rowSpan: !(index % record.rowSpan) ? record.rowSpan : 0
  24. }),
  25. },
  26. {
  27. title: '营销内容',
  28. dataIndex: 'productName',
  29. key: 'productName',
  30. width: 200,
  31. render: (_, b) => {
  32. if (['MARKETING_TARGET_TYPE_FICTION'].includes(b.adgroupsDto?.marketingAssetOuterSpec?.marketingTargetType)) {
  33. return <Space size={0} direction="vertical">
  34. <Text style={{ fontSize: 12 }}>推广产品:{b?.productDto?.marketingAssetName}(产品ID:{b?.productDto?.marketingAssetId})</Text>
  35. {(b.adgroupsDto?.marketingCarrierType === 'MARKETING_CARRIER_TYPE_WECHAT_OFFICIAL_ACCOUNT' && b?.marketingCarrierDto) && <Text style={{ fontSize: 12 }}>营销载体:{b.marketingCarrierDto.map((item: { wechatOfficialAccountName: any; wechatOfficialAccountId: any; }) => `${item?.wechatOfficialAccountName}(${item?.wechatOfficialAccountId})`)?.toString()}</Text>}
  36. <Text style={{ fontSize: 12 }}>转化归因:{b?.userActionSetsList ? b?.userActionSetsList.map((item: { name: any; }) => item.name).toString() : '暂未配置'}</Text>
  37. </Space>
  38. } else if (['MARKETING_TARGET_TYPE_WECHAT_OFFICIAL_ACCOUNT'].includes(b.adgroupsDto?.marketingAssetOuterSpec?.marketingTargetType)) {
  39. return <Space size={0} direction="vertical">
  40. <Text style={{ fontSize: 12 }}>推广产品:微信公众号</Text>
  41. <Text style={{ fontSize: 12 }}>营销载体:微信公众号</Text>
  42. <Text style={{ fontSize: 12 }}>应用:{b?.productDto?.wechatOfficialAccountName}({b?.productDto?.wechatOfficialAccountId})</Text>
  43. <Text style={{ fontSize: 12 }}>转化归因:{b?.userActionSetsList ? b?.userActionSetsList.map((item: { name: any; }) => item.name).toString() : '暂未配置'}</Text>
  44. </Space>
  45. }
  46. return 'ERROR,请联系管理员'
  47. },
  48. onCell: (record, index = 0) => ({
  49. rowSpan: !(index % record.rowSpan) ? record.rowSpan : 0
  50. }),
  51. },
  52. {
  53. title: '定向',
  54. dataIndex: 'targeting',
  55. key: 'targeting',
  56. width: 170,
  57. render: (_, b) => {
  58. return <Text style={{ fontSize: 12 }}>{b?.targetDto?.targetingName}</Text>
  59. },
  60. onCell: (record, index = 0) => ({
  61. rowSpan: !(index % record.rowSpan) ? record.rowSpan : 0
  62. }),
  63. },
  64. {
  65. title: '预算与出价',
  66. dataIndex: 'dailyBudget',
  67. key: 'dailyBudget',
  68. width: 170,
  69. render: (_, b) => {
  70. let { optimizationGoal, dailyBudget, bidAmount, bidMode } = b?.adgroupsDto
  71. return <Space size={0} direction="vertical">
  72. <Text style={{ fontSize: 12 }}>广告日预算:{dailyBudget ? dailyBudget + '元/天' : '不限'}</Text>
  73. <Text style={{ fontSize: 12 }}>出价:{bidAmount}元/{optimizationGoal ? OPTIMIZATIONGOAL_ENUM[optimizationGoal] : ['BID_MODE_OCPM', 'BID_MODE_OCPC'].includes(bidMode) ? '千次曝光' : '点击'}</Text>
  74. </Space>
  75. },
  76. onCell: (record, index = 0) => ({
  77. rowSpan: !(index % record.rowSpan) ? record.rowSpan : 0
  78. }),
  79. },
  80. ]
  81. },
  82. {
  83. title: '创意',
  84. dataIndex: 'dynamicDto',
  85. key: 'dynamicDto',
  86. align: 'center',
  87. children: [
  88. {
  89. title: '创意名称',
  90. dataIndex: 'dynamicCreativeName',
  91. key: 'dynamicCreativeName',
  92. width: 200,
  93. render: (_, b) => {
  94. return <Text style={{ fontSize: 12 }}>{b?.dynamicDto?.dynamicCreativeName}</Text>
  95. }
  96. },
  97. {
  98. title: '创意素材',
  99. dataIndex: 'dynamicGroup',
  100. key: 'dynamicGroup',
  101. width: 200,
  102. render: (_, b) => {
  103. let deliveryMode = b?.dynamicDto?.deliveryMode
  104. let dynamicGroup = b?.dynamicGroup
  105. if (dynamicGroup && Object.keys(dynamicGroup).length) {
  106. let keys = Object.keys(dynamicGroup)
  107. if (deliveryMode === "DELIVERY_MODE_CUSTOMIZE") {
  108. return <Text style={{ fontSize: 12, color: '#1890ff' }}>已选{(keys.includes('video_id') || keys.includes('short_video1')) ? '1个视频,0张图片' : keys.includes('image_id') ? '0个视频,1张图片' : (keys.includes('image_list') || keys.includes('element_story') ? '1个组图, 0个视频' : '')}</Text>
  109. } else {
  110. return <Text style={{ fontSize: 12 }}>开发中</Text>
  111. }
  112. } else {
  113. return <Text style={{ fontSize: 12 }}>无需配置</Text>
  114. }
  115. }
  116. },
  117. {
  118. title: '创意文案',
  119. dataIndex: 'textDto',
  120. key: 'textDto',
  121. width: 200,
  122. render: (value, b) => {
  123. console.log('textDto-->', value)
  124. let deliveryMode = b?.dynamicDto?.deliveryMode
  125. if (value && Object.keys(value).length) {
  126. if (deliveryMode === "DELIVERY_MODE_CUSTOMIZE") {
  127. return <div className={style.detail_body} style={{ height: 'auto' }}>
  128. {Object.keys(value)?.map((key, index: number) => {
  129. return <div key={index}>
  130. {key === 'description' ? <>
  131. <Title level={5} style={{ fontSize: 12 }}>{'文案'}</Title>
  132. <div className={style.text}><Text ellipsis={{ tooltip: true }}>{value['description']?.toString()}</Text></div>
  133. </> : key === 'title' ? <>
  134. <Title level={5} style={{ fontSize: 12 }}>{'标题'}</Title>
  135. <div className={style.text}><Text ellipsis={{ tooltip: true }}>{value['title']?.toString()}</Text></div>
  136. </> : null}
  137. </div>
  138. })}
  139. </div>
  140. } else {
  141. return <Text style={{ fontSize: 12 }}>开发中</Text>
  142. }
  143. } else {
  144. return <Text style={{ fontSize: 12 }}>无需配置</Text>
  145. }
  146. }
  147. },
  148. {
  149. title: '跳转类型',
  150. dataIndex: 'pageListDto',
  151. key: 'pageListDto',
  152. width: 200,
  153. render: (_, b) => {
  154. let pageListDto = b?.pageListDto
  155. return <Text style={{ fontSize: 12, wordBreak: 'break-all' }}>原生推广页:{pageListDto?.[0]?.pageName}</Text>
  156. }
  157. }
  158. ]
  159. }
  160. ]
  161. }
  162. export default columns