tableConfig.tsx 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  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. import VideoNews from "@/pages/launchSystemNew/components/newsModal/videoNews";
  7. import styles from './Material/index.less'
  8. const columns = (): TableProps<any>['columns'] => {
  9. return [
  10. {
  11. title: '广告',
  12. dataIndex: 'adgroup',
  13. key: 'adgroup',
  14. align: 'center',
  15. children: [
  16. {
  17. title: '广告名称',
  18. dataIndex: 'adgroupName',
  19. key: 'adgroupName',
  20. width: 250,
  21. render: (_, b) => {
  22. return <Text style={{ fontSize: 12 }}>{b?.adgroupsDto?.adgroupName}</Text>
  23. },
  24. onCell: (record, index = 0) => ({
  25. rowSpan: record?.isRowSpan ? record.rowSpan : !(index % record.rowSpan) ? record.rowSpan : 0
  26. })
  27. },
  28. {
  29. title: '营销内容',
  30. dataIndex: 'productName',
  31. key: 'productName',
  32. width: 200,
  33. render: (_, b) => {
  34. if (['MARKETING_TARGET_TYPE_FICTION'].includes(b.adgroupsDto?.marketingAssetOuterSpec?.marketingTargetType)) {
  35. return <Space size={0} direction="vertical">
  36. <Text style={{ fontSize: 12 }}>推广产品:{b?.productDto?.marketingAssetName}(产品ID:{b?.productDto?.marketingAssetId})</Text>
  37. {(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>}
  38. <Text style={{ fontSize: 12 }}>转化归因:{b?.userActionSetsList ? b?.userActionSetsList.map((item: { name: any; }) => item.name).toString() : '暂未配置'}</Text>
  39. </Space>
  40. } else if (['MARKETING_TARGET_TYPE_WECHAT_OFFICIAL_ACCOUNT'].includes(b.adgroupsDto?.marketingAssetOuterSpec?.marketingTargetType)) {
  41. return <Space size={0} direction="vertical">
  42. <Text style={{ fontSize: 12 }}>推广产品:微信公众号</Text>
  43. <Text style={{ fontSize: 12 }}>营销载体:微信公众号</Text>
  44. <Text style={{ fontSize: 12 }}>应用:{b?.productDto?.wechatOfficialAccountName}({b?.productDto?.wechatOfficialAccountId})</Text>
  45. <Text style={{ fontSize: 12 }}>转化归因:{b?.userActionSetsList ? b?.userActionSetsList.map((item: { name: any; }) => item.name).toString() : '暂未配置'}</Text>
  46. </Space>
  47. }
  48. return 'ERROR,请联系管理员'
  49. },
  50. onCell: (record, index = 0) => ({
  51. rowSpan: record?.isRowSpan ? record.rowSpan : !(index % record.rowSpan) ? record.rowSpan : 0
  52. }),
  53. },
  54. {
  55. title: '定向',
  56. dataIndex: 'targeting',
  57. key: 'targeting',
  58. width: 170,
  59. render: (_, b) => {
  60. return <Text style={{ fontSize: 12 }}>{b?.targetDto?.targetingName}</Text>
  61. },
  62. onCell: (record, index = 0) => ({
  63. rowSpan: record?.isRowSpan ? record.rowSpan : !(index % record.rowSpan) ? record.rowSpan : 0
  64. }),
  65. },
  66. {
  67. title: '预算与出价',
  68. dataIndex: 'dailyBudget',
  69. key: 'dailyBudget',
  70. width: 170,
  71. render: (_, b) => {
  72. let { optimizationGoal, dailyBudget, bidAmount, bidMode } = b?.adgroupsDto
  73. return <Space size={0} direction="vertical">
  74. <Text style={{ fontSize: 12 }}>广告日预算:{dailyBudget ? dailyBudget + '元/天' : '不限'}</Text>
  75. <Text style={{ fontSize: 12 }}>出价:{bidAmount}元/{optimizationGoal ? OPTIMIZATIONGOAL_ENUM[optimizationGoal] : ['BID_MODE_OCPM', 'BID_MODE_OCPC'].includes(bidMode) ? '千次曝光' : '点击'}</Text>
  76. </Space>
  77. },
  78. onCell: (record, index = 0) => ({
  79. rowSpan: record?.isRowSpan ? record.rowSpan : !(index % record.rowSpan) ? record.rowSpan : 0
  80. }),
  81. },
  82. ]
  83. },
  84. {
  85. title: '创意',
  86. dataIndex: 'dynamicDto',
  87. key: 'dynamicDto',
  88. align: 'center',
  89. children: [
  90. {
  91. title: '创意名称',
  92. dataIndex: 'dynamicCreativeName',
  93. key: 'dynamicCreativeName',
  94. width: 200,
  95. render: (_, b) => {
  96. return <Text style={{ fontSize: 12 }}>{b?.dynamicDto?.dynamicCreativeName}</Text>
  97. }
  98. },
  99. {
  100. title: '创意素材',
  101. dataIndex: 'dynamicGroup',
  102. key: 'dynamicGroup',
  103. width: 210,
  104. render: (_, b) => {
  105. let deliveryMode = b?.dynamicDto?.deliveryMode
  106. let dynamicGroup = b?.dynamicGroup
  107. if (dynamicGroup && Object.keys(dynamicGroup).length) {
  108. let keys = Object.keys(dynamicGroup)
  109. if (deliveryMode === "DELIVERY_MODE_CUSTOMIZE") {
  110. return <>
  111. <div className={style.detail_body_m}>
  112. {(keys.includes('video_id') || keys.includes('short_video1')) ? <>
  113. <Title style={{ fontSize: 12, color: '#1890ff', marginBottom: 0, width: '100%' }}>已选1个视频,0张图片</Title>
  114. <div className={style.video}>
  115. <VideoNews src={dynamicGroup?.video_id?.url || dynamicGroup?.short_video1?.url} />
  116. {dynamicGroup?.cover_id && <div className={style.cover_image} style={{ marginLeft: 4 }}>
  117. <img src={dynamicGroup?.cover_id?.url} />
  118. </div>}
  119. </div>
  120. </> : keys.includes('image_id') ? <>
  121. <Title style={{ fontSize: 12, color: '#1890ff', marginBottom: 0, width: '100%' }}>已选0个视频,1张图片</Title>
  122. <div className={style.cover_image}>
  123. <img src={dynamicGroup?.image_id?.url} />
  124. </div>
  125. </> : (keys.includes('image_list') || keys.includes('element_story')) ? <>
  126. <Title style={{ fontSize: 12, color: '#1890ff', marginBottom: 0, width: '100%' }}>已选1个组图, 0个视频</Title>
  127. {dynamicGroup?.[keys.includes('image_list') ? 'image_list' : 'element_story']?.map((item: { url: string | undefined; }, index: undefined) => <div className={style.cover_image} key={index} style={{ width: 30, height: 24, minWidth: 32 }}>
  128. <img src={item?.url} />
  129. </div>)}
  130. </> : null}
  131. </div>
  132. </>
  133. } else {
  134. return <div style={{ display: 'flex', gap: 5, flexWrap: 'wrap' }}>
  135. {dynamicGroup?.list?.map((item: any, index: number) => {
  136. if (Array.isArray(item)) {
  137. let length = item.length
  138. return <div className={styles.boxList_body_item} key={index} style={{ width: 30, height: 30 }}>
  139. <div className={styles.content} style={{ width: 30, height: 30 }}>
  140. {item.map((l, i) => <img src={l?.url} key={i} style={{ width: length === 6 ? 9.999 : 14.999 }} />)}
  141. </div>
  142. </div>
  143. } else if (item?.url?.includes('mp4')) {
  144. return <div className={styles.boxList_body_item} key={index} style={{ width: 30, height: 30 }}>
  145. <div className={styles.content} style={{ width: 30, height: 30 }}>
  146. <VideoNews src={item?.url} style={{ width: 30, height: 30 }} maskBodyStyle={{ backgroundColor: "rgba(242, 246, 254, 0.1)" }} />
  147. </div>
  148. </div>
  149. } else {
  150. return <div className={styles.boxList_body_item} key={index} style={{ width: 30, height: 30 }}>
  151. <div className={styles.content} style={{ width: 30, height: 30 }}><img src={item?.url} /></div>
  152. </div>
  153. }
  154. })}
  155. </div>
  156. }
  157. } else {
  158. return <Text style={{ fontSize: 12 }}>无需配置</Text>
  159. }
  160. }
  161. },
  162. {
  163. title: '创意文案',
  164. dataIndex: 'textDto',
  165. key: 'textDto',
  166. width: 200,
  167. render: (value, b) => {
  168. let deliveryMode = b?.dynamicDto?.deliveryMode
  169. if (value && Object.keys(value).length) {
  170. if (deliveryMode === "DELIVERY_MODE_CUSTOMIZE") {
  171. return <div className={style.detail_body} style={{ height: 'auto' }}>
  172. {Object.keys(value)?.map((key, index: number) => {
  173. return <div key={index}>
  174. {key === 'description' ? <>
  175. <Title level={5} style={{ fontSize: 12 }}>{'文案'}</Title>
  176. <div className={style.text}><Text ellipsis={{ tooltip: true }}>{value['description']?.toString()}</Text></div>
  177. </> : key === 'title' ? <>
  178. <Title level={5} style={{ fontSize: 12 }}>{'标题'}</Title>
  179. <div className={style.text}><Text ellipsis={{ tooltip: true }}>{value['title']?.toString()}</Text></div>
  180. </> : null}
  181. </div>
  182. })}
  183. </div>
  184. } else {
  185. return <div className={style.detail_body} style={{ height: 'auto' }}>
  186. {Object.keys(value)?.map((key, index: number) => {
  187. return <div key={index}>
  188. {key === 'description' ? <>
  189. <Title level={5} style={{ fontSize: 12 }}>{'文案'}</Title>
  190. <div className={style.text}><Text ellipsis={{ tooltip: true }}>{value['description']?.toString()}</Text></div>
  191. </> : key === 'title' ? <>
  192. <Title level={5} style={{ fontSize: 12 }}>{'标题'}</Title>
  193. <div className={style.text}><Text ellipsis={{ tooltip: true }}>{value['title']?.toString()}</Text></div>
  194. </> : null}
  195. </div>
  196. })}
  197. </div>
  198. }
  199. } else {
  200. return <Text style={{ fontSize: 12 }}>无需配置</Text>
  201. }
  202. }
  203. },
  204. {
  205. title: '跳转类型',
  206. dataIndex: 'pageListDto',
  207. key: 'pageListDto',
  208. width: 200,
  209. render: (_, b) => {
  210. let pageListDto = b?.pageListDto
  211. return <Text style={{ fontSize: 12, wordBreak: 'break-all' }}>原生推广页:{pageListDto?.map((item: { pageName: any; }) => item?.pageName)?.join(',')}</Text>
  212. }
  213. }
  214. ]
  215. }
  216. ]
  217. }
  218. export const columnsAddDynamic = (): TableProps<any>['columns'] => {
  219. return [
  220. {
  221. title: '广告',
  222. dataIndex: 'adgroup',
  223. key: 'adgroup',
  224. align: 'center',
  225. children: [
  226. {
  227. title: '广告名称',
  228. dataIndex: 'adgroupName',
  229. key: 'adgroupName',
  230. width: 250,
  231. render: (_, b) => {
  232. return <Text style={{ fontSize: 12 }}>{b?.adgroupsDto?.adgroupName}</Text>
  233. },
  234. onCell: (record, index = 0) => ({
  235. rowSpan: !(index % record.rowSpan) ? record.rowSpan : 0
  236. }),
  237. },
  238. ]
  239. },
  240. {
  241. title: '创意',
  242. dataIndex: 'dynamicDto',
  243. key: 'dynamicDto',
  244. align: 'center',
  245. children: [
  246. {
  247. title: '创意名称',
  248. dataIndex: 'dynamicCreativeName',
  249. key: 'dynamicCreativeName',
  250. width: 200,
  251. render: (_, b) => {
  252. return <Text style={{ fontSize: 12 }}>{b?.dynamicDto?.dynamicCreativeName}</Text>
  253. }
  254. },
  255. {
  256. title: '创意素材',
  257. dataIndex: 'dynamicGroup',
  258. key: 'dynamicGroup',
  259. width: 200,
  260. render: (_, b) => {
  261. let deliveryMode = b?.dynamicDto?.deliveryMode
  262. let dynamicGroup = b?.dynamicGroup
  263. if (dynamicGroup && Object.keys(dynamicGroup).length) {
  264. let keys = Object.keys(dynamicGroup)
  265. if (deliveryMode === "DELIVERY_MODE_CUSTOMIZE") {
  266. // 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>
  267. return <>
  268. <div className={style.detail_body_m}>
  269. {(keys.includes('video_id') || keys.includes('short_video1')) ? <>
  270. <Title style={{ fontSize: 12, color: '#1890ff', marginBottom: 0, width: '100%' }}>已选1个视频,0张图片</Title>
  271. <div className={style.video}>
  272. <VideoNews src={dynamicGroup?.video_id?.url || dynamicGroup?.short_video1?.url} />
  273. {dynamicGroup?.cover_id && <div className={style.cover_image} style={{ marginLeft: 4 }}>
  274. <img src={dynamicGroup?.cover_id?.url} />
  275. </div>}
  276. </div>
  277. </> : keys.includes('image_id') ? <>
  278. <Title style={{ fontSize: 12, color: '#1890ff', marginBottom: 0, width: '100%' }}>已选0个视频,1张图片</Title>
  279. <div className={style.cover_image}>
  280. <img src={dynamicGroup?.image_id?.url} />
  281. </div>
  282. </> : (keys.includes('image_list') || keys.includes('element_story')) ? <>
  283. <Title style={{ fontSize: 12, color: '#1890ff', marginBottom: 0, width: '100%' }}>已选1个组图, 0个视频</Title>
  284. {dynamicGroup?.[keys.includes('image_list') ? 'image_list' : 'element_story']?.map((item: { url: string | undefined; }, index: undefined) => <div className={style.cover_image} key={index} style={{ width: 30, height: 24, minWidth: 32 }}>
  285. <img src={item?.url} />
  286. </div>)}
  287. </> : null}
  288. </div>
  289. </>
  290. } else {
  291. return <div style={{ display: 'flex', gap: 5, flexWrap: 'wrap' }}>
  292. {dynamicGroup?.list?.map((item: any, index: number) => {
  293. if (Array.isArray(item)) {
  294. let length = item.length
  295. return <div className={styles.boxList_body_item} key={index} style={{ width: 30, height: 30 }}>
  296. <div className={styles.content} style={{ width: 30, height: 30 }}>
  297. {item.map((l, i) => <img src={l?.url} key={i} style={{ width: length === 6 ? 9.999 : 14.999 }} />)}
  298. </div>
  299. </div>
  300. } else if (item?.url?.includes('mp4')) {
  301. return <div className={styles.boxList_body_item} key={index} style={{ width: 30, height: 30 }}>
  302. <div className={styles.content} style={{ width: 30, height: 30 }}>
  303. <VideoNews src={item?.url} style={{ width: 30, height: 30 }} maskBodyStyle={{ backgroundColor: "rgba(242, 246, 254, 0.1)" }} />
  304. </div>
  305. </div>
  306. } else {
  307. return <div className={styles.boxList_body_item} key={index} style={{ width: 30, height: 30 }}>
  308. <div className={styles.content} style={{ width: 30, height: 30 }}><img src={item?.url} /></div>
  309. </div>
  310. }
  311. })}
  312. </div>
  313. }
  314. } else {
  315. return <Text style={{ fontSize: 12 }}>无需配置</Text>
  316. }
  317. }
  318. },
  319. {
  320. title: '创意文案',
  321. dataIndex: 'textDto',
  322. key: 'textDto',
  323. width: 200,
  324. render: (value, b) => {
  325. let deliveryMode = b?.dynamicDto?.deliveryMode
  326. if (value && Object.keys(value).length) {
  327. if (deliveryMode === "DELIVERY_MODE_CUSTOMIZE") {
  328. return <div className={style.detail_body} style={{ height: 'auto' }}>
  329. {Object.keys(value)?.map((key, index: number) => {
  330. return <div key={index}>
  331. {key === 'description' ? <>
  332. <Title level={5} style={{ fontSize: 12 }}>{'文案'}</Title>
  333. <div className={style.text}><Text ellipsis={{ tooltip: true }}>{value['description']?.toString()}</Text></div>
  334. </> : key === 'title' ? <>
  335. <Title level={5} style={{ fontSize: 12 }}>{'标题'}</Title>
  336. <div className={style.text}><Text ellipsis={{ tooltip: true }}>{value['title']?.toString()}</Text></div>
  337. </> : null}
  338. </div>
  339. })}
  340. </div>
  341. } else {
  342. return <div className={style.detail_body} style={{ height: 'auto' }}>
  343. {Object.keys(value)?.map((key, index: number) => {
  344. return <div key={index}>
  345. {key === 'description' ? <>
  346. <Title level={5} style={{ fontSize: 12 }}>{'文案'}</Title>
  347. <div className={style.text}><Text ellipsis={{ tooltip: true }}>{value['description']?.toString()}</Text></div>
  348. </> : key === 'title' ? <>
  349. <Title level={5} style={{ fontSize: 12 }}>{'标题'}</Title>
  350. <div className={style.text}><Text ellipsis={{ tooltip: true }}>{value['title']?.toString()}</Text></div>
  351. </> : null}
  352. </div>
  353. })}
  354. </div>
  355. }
  356. } else {
  357. return <Text style={{ fontSize: 12 }}>无需配置</Text>
  358. }
  359. }
  360. },
  361. {
  362. title: '跳转类型',
  363. dataIndex: 'pageListDto',
  364. key: 'pageListDto',
  365. width: 200,
  366. render: (_, b) => {
  367. let pageListDto = b?.pageListDto
  368. return <Text style={{ fontSize: 12, wordBreak: 'break-all' }}>原生推广页:{pageListDto?.map((item: { pageName: any; }) => item?.pageName)?.join(',')}</Text>
  369. }
  370. }
  371. ]
  372. }
  373. ]
  374. }
  375. export default columns