tableConfig.tsx 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. import React from "react";
  2. import { COMPONENT_GENERATION_TYPE_ENUM, COMPONENT_SUB_TYPE, getComponentType } from "./const";
  3. import { Popconfirm, Space, Statistic, Tag } from "antd";
  4. import Image1X1 from "../../components/AdsComponent/Image1X1";
  5. import ImageXXX from "../../components/AdsComponent/ImageXXX";
  6. function columns12(del: (id: number[], accountId: number) => void, share: (data: any) => void, shareDetails: (data: any) => void): { label: string, fieldSHow?: { label: string, saveField: string, defaultValue: any[], data: any[] }, data: any[] }[] {
  7. return [
  8. {
  9. label: '基础字段',
  10. data: [
  11. {
  12. title: '组件详情',
  13. dataIndex: 'componentSubType1',
  14. key: 'componentSubType1',
  15. width: 380,
  16. fixed: 'left',
  17. label: '基础字段',
  18. default: 1,
  19. render(_: any, records: any) {
  20. const type = getComponentType(records?.componentSubType)
  21. if (type === 'IMAGE') {
  22. return <Image1X1 imageUrl={records?.componentValue?.image?.value?.imageUrl} />
  23. } else if (type === 'IMAGE_LIST') {
  24. return <ImageXXX imageList={records?.componentValue?.imageList?.value?.list || []} />
  25. } else if (type === 'VIDEO') {
  26. return <Image1X1
  27. imageUrl={records?.componentValue?.video?.value?.coverUrl || records?.componentValue?.shortVideo?.value?.shortVideo2Url}
  28. videoUrl={records?.componentValue?.video?.value?.videoUrl || records?.componentValue?.shortVideo?.value?.shortVideo1Url}
  29. />
  30. }
  31. return <div className='image-9x16'>联系技术添加</div>
  32. },
  33. },
  34. {
  35. title: '二级组件类型',
  36. dataIndex: 'componentSubType',
  37. key: 'componentSubType',
  38. width: 75,
  39. align: 'center',
  40. label: '基础字段',
  41. default: 2,
  42. render(value: any) {
  43. return <span style={{ fontSize: 12 }}>{COMPONENT_SUB_TYPE.find(item => item.value === value)?.label || '--'}</span>
  44. },
  45. },
  46. {
  47. title: '组件名称',
  48. dataIndex: 'componentCustomName',
  49. key: 'componentCustomName',
  50. width: 180,
  51. ellipsis: true,
  52. label: '基础字段',
  53. default: 3,
  54. render(value: any) {
  55. return <span style={{ fontSize: 12 }}>{value}</span>
  56. },
  57. },
  58. {
  59. title: '组件ID',
  60. dataIndex: 'componentId',
  61. key: 'componentId',
  62. width: 90,
  63. ellipsis: true,
  64. align: 'center',
  65. label: '基础字段',
  66. default: 4,
  67. render(value: any) {
  68. return <span style={{ fontSize: 12 }}>{value}</span>
  69. },
  70. },
  71. {
  72. title: '来源',
  73. dataIndex: 'generationType',
  74. key: 'generationType',
  75. width: 90,
  76. ellipsis: true,
  77. align: 'center',
  78. label: '基础字段',
  79. default: 5,
  80. render(value: any) {
  81. return <span style={{ fontSize: 12 }}>{COMPONENT_GENERATION_TYPE_ENUM['COMPONENT_GENERATION_TYPE_' + value as keyof typeof COMPONENT_GENERATION_TYPE_ENUM] || '--'}</span>
  82. },
  83. },
  84. {
  85. title: '广告账号',
  86. dataIndex: 'accountId',
  87. key: 'accountId',
  88. width: 90,
  89. ellipsis: true,
  90. align: 'center',
  91. label: '基础字段',
  92. default: 6,
  93. render(value: any) {
  94. return <span style={{ fontSize: 12 }}>{value || '--'}</span>
  95. },
  96. },
  97. {
  98. title: '组件共享类型',
  99. dataIndex: 'componentSharingType',
  100. key: 'componentSharingType',
  101. width: 70,
  102. align: 'center',
  103. label: '基础字段',
  104. default: 7,
  105. render(value: any) {
  106. return <span style={{ fontSize: 12 }}>{value === 'ORGANIZATION' ? '全部共享' : '部分共享'}</span>
  107. },
  108. },
  109. {
  110. title: '业务单元ID',
  111. dataIndex: 'organizationId',
  112. key: 'organizationId',
  113. width: 90,
  114. ellipsis: true,
  115. align: 'center',
  116. label: '基础字段',
  117. default: 8,
  118. render(value: any) {
  119. return <span style={{ fontSize: 12 }}>{value || '--'}</span>
  120. },
  121. },
  122. {
  123. title: '创建时间',
  124. dataIndex: 'createdTime',
  125. key: 'createdTime',
  126. width: 95,
  127. ellipsis: true,
  128. align: 'center',
  129. label: '基础字段',
  130. default: 9,
  131. sorter: true,
  132. render(value: any) {
  133. return <span style={{ fontSize: 12 }}>{value || '--'}</span>
  134. },
  135. },
  136. {
  137. title: '最后修改时间',
  138. dataIndex: 'lastModifiedTime',
  139. key: 'lastModifiedTime',
  140. width: 95,
  141. ellipsis: true,
  142. align: 'center',
  143. label: '基础字段',
  144. default: 10,
  145. render(value: any) {
  146. return <span style={{ fontSize: 12 }}>{value || '--'}</span>
  147. },
  148. },
  149. {
  150. title: '是否删除',
  151. dataIndex: 'isDeleted',
  152. key: 'isDeleted',
  153. width: 70,
  154. ellipsis: true,
  155. align: 'center',
  156. label: '基础字段',
  157. default: 11,
  158. render(value: any) {
  159. return value ? <Tag color="error" style={{ margin: 0 }}>是</Tag> : <Tag color="success" style={{ margin: 0 }}>否</Tag>
  160. },
  161. },
  162. {
  163. title: '组件状态',
  164. dataIndex: 'status',
  165. key: 'status',
  166. width: 70,
  167. align: 'center',
  168. label: '基础字段',
  169. default: 12,
  170. render(value: any) {
  171. return <span style={{ fontSize: 12 }}>{value || '--'}</span>
  172. },
  173. },
  174. {
  175. title: '操作',
  176. dataIndex: 'cz',
  177. key: 'cz',
  178. width: 80,
  179. label: '基础字段',
  180. align: 'center',
  181. default: 13,
  182. render(_: any, record: any) {
  183. if (!record?.isDeleted) {
  184. return <Space size={4}>
  185. <Popconfirm
  186. title="确定删除?"
  187. onConfirm={() => { del([record?.componentId], record?.accountId) }}
  188. >
  189. <a style={{ color: 'red', fontSize: 12 }}>删除</a>
  190. </Popconfirm>
  191. <a style={{ fontSize: 12 }} onClick={() => share(record)}>共享组件</a>
  192. <a style={{ fontSize: 12 }} onClick={() => shareDetails(record)}>共享详情</a>
  193. </Space>
  194. }
  195. return '--'
  196. },
  197. },
  198. ]
  199. },
  200. {
  201. label: '数据指标',
  202. data: [
  203. {
  204. title: '消耗', dataIndex: 'cost', label: '数据指标', width: 70, default: 14, align: 'right', sorter: true,
  205. render: (a: number) => <Statistic value={a || 0} precision={2} />
  206. },
  207. {
  208. title: '一键起量消耗', dataIndex: 'acquisitionCost', label: '数据指标', width: 70, default: 15, align: 'center', sorter: true,
  209. render: (a: number) => <Statistic value={a || 0} precision={2} />
  210. },
  211. {
  212. title: '千次展现均价', dataIndex: 'thousandDisplayPrice', label: '数据指标', width: 70, align: 'center', sorter: true, default: 16,
  213. render: (a: number) => <Statistic value={a || 0} precision={2} />
  214. },
  215. {
  216. title: '点击率', dataIndex: 'ctr', label: '数据指标', width: 70, align: 'center', sorter: true, default: 17,
  217. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  218. },
  219. {
  220. title: '公众号关注成本(点击归因)', dataIndex: 'fromFollowByClickCost', label: '数据指标', width: 100, align: 'center', sorter: true, default: 18,
  221. render: (a: number) => <Statistic value={a || 0} precision={2} />
  222. },
  223. {
  224. title: '公众号关注人数(点击归因)', dataIndex: 'fromFollowByClickUv', label: '数据指标', width: 100, align: 'center', sorter: true, default: 19,
  225. render: (a: number) => <Statistic value={a || 0} />
  226. },
  227. {
  228. title: '公众号关注成本(平台上报)', dataIndex: 'bizFollowCost', label: '数据指标', width: 100, align: 'center', sorter: true, default: 20,
  229. render: (a: number) => <Statistic value={a || 0} precision={2} />
  230. },
  231. {
  232. title: '公众号关注人数(平台上报)', dataIndex: 'bizFollowUv', label: '数据指标', width: 100, align: 'center', sorter: true, default: 21,
  233. render: (a: number) => <Statistic value={a || 0} />
  234. },
  235. {
  236. title: '加企业微信客服成本(人数)', dataIndex: 'scanFollowUserCost', label: '数据指标', width: 100, align: 'center', sorter: true, default: 22,
  237. render: (a: number) => <Statistic value={a || 0} precision={2} />
  238. },
  239. {
  240. title: '加企业微信客服人数', dataIndex: 'scanFollowUserCount', label: '数据指标', width: 90, align: 'center', sorter: true, default: 23,
  241. render: (a: number) => <Statistic value={a || 0} />
  242. },
  243. {
  244. title: '下单次数(点击归因)', dataIndex: 'orderByClickCount', label: '数据指标', width: 90, align: 'center', sorter: true, default: 24,
  245. render: (a: number) => <Statistic value={a || 0} />
  246. },
  247. {
  248. title: '下单成本(点击归因)', dataIndex: 'orderByClickCost', label: '数据指标', width: 90, align: 'center', sorter: true, default: 25,
  249. render: (a: number) => <Statistic value={a || 0} precision={2} />
  250. },
  251. {
  252. title: '下单率(点击归因)', dataIndex: 'orderByClickRate', label: '数据指标', width: 90, align: 'center', sorter: true, default: 26,
  253. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  254. },
  255. {
  256. title: '点击首日付费ROI', dataIndex: 'cheoutFdReward', label: '数据指标', width: 90, align: 'center', sorter: true, default: 27,
  257. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  258. },
  259. {
  260. title: '点击3日付费ROI', dataIndex: 'cheoutTdReward', label: '数据指标', width: 90, align: 'center', sorter: true, default: 28,
  261. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  262. },
  263. {
  264. title: '点击7日付费ROI', dataIndex: 'cheoutOwReward', label: '数据指标', width: 90, align: 'center', sorter: true, default: 29,
  265. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  266. },
  267. {
  268. title: '点击14日付费ROI', dataIndex: 'cheoutTwReward', label: '数据指标', width: 90, align: 'center', sorter: true, default: 30,
  269. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  270. },
  271. {
  272. title: '点击30日付费ROI', dataIndex: 'cheoutOmReward', label: '数据指标', width: 90, align: 'center', sorter: true, default: 31,
  273. render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
  274. },
  275. ]
  276. }
  277. ]
  278. }
  279. export default columns12