tableConfig.tsx 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. import React from "react"
  2. import Lazyimg from "react-lazyimg-component"
  3. import style from './index.less'
  4. import { Statistic, Typography } from "antd";
  5. import { formatBytes, formatSecondsToTime } from "@/utils/utils";
  6. import PlayVideo from "../cloudNew/playVideo";
  7. const { Text } = Typography;
  8. function columns12(): { label: string, fieldSHow?: { label: string, saveField: string, defaultValue: any[], data: any[] }, data: any[] }[] {
  9. return [
  10. {
  11. label: '自定义指标',
  12. data: [
  13. {
  14. title: '素材预览', dataIndex: 'preview', label: '自定义指标', width: 320, default: 1,
  15. render: (a: any, records: any) => {
  16. if (a === '总计')
  17. return <Text ellipsis strong>总计</Text>
  18. return <div className={style.preview_table}>
  19. <div className={style.preview_content}>
  20. {records.source === 'video' && <div className={style.playr}>
  21. <PlayVideo videoUrl={records.preview_url}>{(onPlay) => <img onClick={(e) => {
  22. e.stopPropagation(); e.preventDefault()
  23. onPlay()
  24. }} src={require('../../../../../public/image/play.png')} alt="" />}</PlayVideo>
  25. </div>}
  26. <Lazyimg
  27. animateType="transition"
  28. src={records.source === 'image' ? records.preview_url : records?.key_frame_image_url}
  29. className={`${style.coverImg} lazy`}
  30. animateClassName={['transition-enter', 'transition-enter-active']}
  31. />
  32. </div>
  33. <div className={style.body}>
  34. <Text ellipsis strong>{records?.description}</Text>
  35. <div>
  36. <div>尺寸:{records.width}*{records.height}</div>
  37. {records.source === 'video' && records.image_duration_millisecond && <div>时长:{formatSecondsToTime(Math.floor(records.image_duration_millisecond / 1000))}</div>}
  38. </div>
  39. <div>
  40. <Text style={{ fontSize: 12 }}>{formatBytes(records?.file_size)}</Text>
  41. <div>设计师:{records?.create_name || '--'}</div>
  42. </div>
  43. </div>
  44. </div>
  45. }
  46. },
  47. {
  48. title: '投手', dataIndex: 'pitcher_name', label: '自定义指标', width: 80, align: 'center', default: 2,
  49. render: (a: string) => a || '--'
  50. },
  51. {
  52. title: '创建时间', dataIndex: 'created_time', label: '自定义指标', width: 135, align: 'center', ellipsis: true,
  53. render: (a: string) => a || '--'
  54. },
  55. {
  56. title: '消耗', dataIndex: 'cost', label: '自定义指标', width: 110, default: 3, align: 'right', sorter: true,
  57. render: (a: string) => <Statistic value={a || 0} precision={2} />
  58. },
  59. {
  60. title: '曝光量', dataIndex: 'view_count', label: '自定义指标', width: 110, default: 4, align: 'center', sorter: true,
  61. render: (a: string) => <Statistic value={a || 0} />
  62. },
  63. {
  64. title: '点击量', dataIndex: 'valid_click_count', label: '自定义指标', width: 100, default: 5, align: 'center', sorter: true,
  65. render: (a: string) => <Statistic value={a || 0} />
  66. },
  67. {
  68. title: '公众号关注人数(点击归因)', dataIndex: 'from_follow_by_click_uv', label: '自定义指标', width: 85, default: 6, align: 'center', sorter: true,
  69. render: (a: string) => <Statistic value={a || 0} />
  70. },
  71. {
  72. title: '公众号关注成本(点击归因)', dataIndex: 'from_follow_by_click_cost', label: '自定义指标', width: 85, default: 7, align: 'right', sorter: true,
  73. render: (a: string) => <Statistic value={a || 0} precision={2} />
  74. },
  75. {
  76. title: '公众号关注人数(平台上报)', dataIndex: 'biz_follow_uv', label: '自定义指标', width: 85, default: 8, align: 'center', sorter: true,
  77. render: (a: string) => <Statistic value={a || 0} />
  78. },
  79. {
  80. title: '目标转化量', dataIndex: 'conversions_count', label: '自定义指标', width: 65, default: 9, align: 'center', sorter: true,
  81. render: (a: string) => <Statistic value={a || 0} />
  82. },
  83. {
  84. title: '目标转化成本', dataIndex: 'conversions_cost', label: '自定义指标', width: 65, default: 10, align: 'right', sorter: true,
  85. render: (a: string) => <Statistic value={a || 0} precision={2} />
  86. },
  87. {
  88. title: '深度目标转化量', dataIndex: 'deep_conversions_count', label: '自定义指标', width: 65, default: 11, align: 'center', sorter: true,
  89. render: (a: string) => <Statistic value={a || 0} />
  90. },
  91. {
  92. title: '加企业微信客服次数', dataIndex: 'scan_follow_count', label: '自定义指标', width: 70, default: 12, align: 'center', sorter: true,
  93. render: (a: string) => <Statistic value={a || 0} />
  94. },
  95. {
  96. title: '加企业微信客服人数', dataIndex: 'scan_follow_user_count', label: '自定义指标', width: 70, default: 13, align: 'center', sorter: true,
  97. render: (a: string) => <Statistic value={a || 0} />
  98. },
  99. {
  100. title: '下单次数', dataIndex: 'order_pv', label: '自定义指标', width: 60, default: 14, align: 'center', sorter: true,
  101. render: (a: string) => <Statistic value={a || 0} />
  102. },
  103. {
  104. title: '下单金额', dataIndex: 'order_amount', label: '自定义指标', width: 80, default: 15, align: 'right', sorter: true,
  105. render: (a: string) => <Statistic value={a || 0} precision={2} />
  106. },
  107. {
  108. title: '下单次数(点击归因)', dataIndex: 'order_by_click_count', label: '自定义指标', width: 75, default: 16, align: 'center', sorter: true,
  109. render: (a: string) => <Statistic value={a || 0} />
  110. },
  111. {
  112. title: '下单金额(点击归因)', dataIndex: 'order_by_click_amount', label: '自定义指标', width: 75, default: 17, align: 'right', sorter: true,
  113. render: (a: string) => <Statistic value={a || 0} precision={2} />
  114. },
  115. {
  116. title: '点击广告当天内,下单次数', dataIndex: 'first_day_order_by_click_count', label: '自定义指标', width: 80, default: 18, align: 'center', sorter: true,
  117. render: (a: string) => <Statistic value={a || 0} />
  118. },
  119. {
  120. title: '点击首日下单次数(首日新增下单量)', dataIndex: 'first_day_order_count', label: '自定义指标', width: 100, default: 19, align: 'center', sorter: true,
  121. render: (a: string) => <Statistic value={a || 0} />
  122. },
  123. {
  124. title: '首日新增下单金额(点击归因)', dataIndex: 'first_day_order_by_click_amount', label: '自定义指标', width: 95, default: 20, align: 'right', sorter: true,
  125. render: (a: string) => <Statistic value={a || 0} precision={2} />
  126. },
  127. {
  128. title: '点击首日下单金额', dataIndex: 'first_day_order_amount', label: '自定义指标', width: 110, default: 21, align: 'right', sorter: true,
  129. render: (a: string) => <Statistic value={a || 0} precision={2} />
  130. },
  131. {
  132. title: '点击均价', dataIndex: 'cpc', label: '自定义指标', width: 60, default: 22, align: 'right', sorter: true,
  133. render: (a: string) => <Statistic value={a || 0} precision={2} />
  134. },
  135. {
  136. title: '千次曝光成本', dataIndex: 'thousand_display_price', label: '自定义指标', width: 65, default: 23, align: 'right', sorter: true,
  137. render: (a: string) => <Statistic value={a || 0} precision={2} />
  138. },
  139. {
  140. title: '点击率', dataIndex: 'ctr', label: '自定义指标', width: 75, default: 24, align: 'center', sorter: true,
  141. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 50 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  142. },
  143. {
  144. title: '公众号关注成本(平台上报)', dataIndex: 'biz_follow_cost', label: '自定义指标', width: 85, default: 25, align: 'right', sorter: true,
  145. render: (a: string) => <Statistic value={a || 0} precision={2} />
  146. },
  147. {
  148. title: '公众号关注率(平台上报)', dataIndex: 'biz_follow_rate', label: '自定义指标', width: 80, default: 26, align: 'center', sorter: true,
  149. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 50 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  150. },
  151. {
  152. title: '目标转化率', dataIndex: 'conversions_rate', label: '自定义指标', width: 75, default: 27, align: 'center', sorter: true,
  153. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 50 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  154. },
  155. {
  156. title: '深度目标转化率', dataIndex: 'deep_conversions_rate', label: '自定义指标', width: 75, default: 28, align: 'center', sorter: true,
  157. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 50 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  158. },
  159. {
  160. title: '加企业微信客服成本', dataIndex: 'scan_follow_user_cost', label: '自定义指标', width: 75, default: 29, align: 'right', sorter: true,
  161. render: (a: string) => <Statistic value={a || 0} precision={2} />
  162. },
  163. {
  164. title: '加企业微信客服率', dataIndex: 'scan_follow_user_rate', label: '自定义指标', width: 75, default: 30, align: 'center', sorter: true,
  165. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 50 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  166. },
  167. {
  168. title: '下单单价', dataIndex: 'order_unit_price', label: '自定义指标', width: 60, default: 31, align: 'right', sorter: true,
  169. render: (a: string) => <Statistic value={a || 0} precision={2} />
  170. },
  171. {
  172. title: '下单率', dataIndex: 'order_rate', label: '自定义指标', width: 70, default: 32, align: 'center', sorter: true,
  173. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 50 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  174. },
  175. {
  176. title: '下单成本', dataIndex: 'order_by_display_cost', label: '自定义指标', width: 75, default: 33, align: 'right', sorter: true,
  177. render: (a: string) => <Statistic value={a || 0} precision={2} />
  178. },
  179. {
  180. title: '下单ROI', dataIndex: 'order_roi', label: '自定义指标', width: 75, default: 34, align: 'center', sorter: true,
  181. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 50 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  182. },
  183. {
  184. title: '下单率(点击归因)', dataIndex: 'order_by_click_rate', label: '自定义指标', width: 75, default: 35, align: 'center', sorter: true,
  185. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 50 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  186. },
  187. {
  188. title: '下单成本(点击归因)', dataIndex: 'order_by_click_cost', label: '自定义指标', width: 75, default: 36, align: 'right', sorter: true,
  189. render: (a: string) => <Statistic value={a || 0} precision={2} />
  190. },
  191. {
  192. title: '首日新增下单ROI', dataIndex: 'first_day_order_roi', label: '自定义指标', width: 75, default: 37, align: 'center', sorter: true,
  193. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 50 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  194. }
  195. ]
  196. },
  197. ]
  198. }
  199. export default columns12