| 
					
				 | 
			
			
				@@ -1,4 +1,4 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import { Button, Card, Drawer, Empty, Space, Spin, Table, Tabs, Typography, message } from "antd" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { Button, Card, Drawer, Empty, Popconfirm, Space, Spin, Table, Tabs, Typography, message } from "antd" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import React, { useEffect, useState } from "react" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import '../index.less' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import style from './index.less' 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -11,6 +11,8 @@ import { CheckOutlined, SearchOutlined } from "@ant-design/icons"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import WechatAccount from "../../components/WechatAccount"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { cartesianProduct } from "@/utils/utils"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { columnsAddDynamic } from "./tableConfig"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { useAjax } from "@/Hook/useAjax"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { createDynamicTaskApi } from "@/services/adqV3"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const { Text, Title } = Typography; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -29,6 +31,8 @@ const AddDynamic: React.FC<PULLIN.NewAddDynamic> = ({ visible, onChange, onClose 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const [tableData, setTableData] = useState<any>({}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const [activeKey, setActiveKey] = useState<string>() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const [dynamicCount, setDynamicCount] = useState<number>(0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const createDynamicTask = useAjax((params) => createDynamicTaskApi(params)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /****************************************/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     useEffect(() => { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -148,10 +152,109 @@ const AddDynamic: React.FC<PULLIN.NewAddDynamic> = ({ visible, onChange, onClose 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         setTableData(newTableData) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    const onSubmit = () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const { dynamic, dynamicMaterialDTos, dynamicCreativesTextDTOS } = addelivery 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let dynamicMaterialDTOS = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if ((materialData && Object.keys(materialData).length && dynamicMaterialDTos && Object.keys(dynamicMaterialDTos).length)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let mType = Object.keys(materialData)[0]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dynamicMaterialDTOS = dynamicMaterialDTos.dynamicGroup?.map((item: any) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (mType === 'image') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return [{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        type: mType, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        valueJson: JSON.stringify({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            value: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                imageUrl: item?.image_id?.url, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                imageId: item?.image_id?.id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                materialType: item?.image_id?.materialType 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else if (mType === 'image_list' || mType === 'element_story') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    let key = 'image_list' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (mType === 'element_story') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        key = 'element_story' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    let list = item?.[key]?.map((l: any) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        return { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            imageUrl: l?.url, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            imageId: l?.id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            materialType: l?.materialType 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return [{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        type: mType, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        valueJson: JSON.stringify({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            value: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                list 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else if (['short_video', 'video'].includes(mType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    let value: any = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        materialType: item?.video_id?.materialType || item?.short_video1?.materialType || 0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        videoUrl: item?.video_id?.url || item?.short_video1?.url, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        videoId: item?.video_id?.id || item?.short_video1?.id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (item?.cover_id?.url) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        value.imageUrl = item?.cover_id?.url 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        value.imageId = item?.cover_id?.id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        value.materialCoverType = item?.cover_id?.materialType 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return [{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        type: mType, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        valueJson: JSON.stringify({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            value 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    }] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return [{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    type: mType, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    valueJson: '' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let accountIdParamDTOMap: any = {} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        accountCreateLogs.forEach(item => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let { pageList, productList, userActionSetsList, accountId, wechatChannelList } = item 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let userActionSetsListDto = userActionSetsList?.map((item: any) => ({ id: item?.userActionSetId, type: item?.type })) // dataSourceId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            let map: any = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                userActionSetsList: userActionSetsListDto, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                pageList: pageList?.map((item: { pageId: any }) => item.pageId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (productList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                map.productDTOS = productList?.map(item => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    return { productId: item.marketingAssetId } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (wechatChannelList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                map.wechatChannelId = wechatChannelList?.[0]?.wechatOfficialAccountId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            accountIdParamDTOMap[accountId] = map 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let params = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            accountAdgroupMaps: adData.map(item => `${item.accountId},${item.adgroupId}`), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dynamicCreativesDTO: dynamic, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dynamicCreativesTextDTOS, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dynamicMaterialDTOS, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            accountIdParamDTOMap 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        console.log('----->', params) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        createDynamicTask.run(params).then(res => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (res) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                message.success('创建任务提交成功') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                onChange?.() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return <Drawer 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         title={<strong>添加创意</strong>} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         visible={visible} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        width={1450} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        width={1500} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         onClose={onClose} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         bodyStyle={{ backgroundColor: '#f1f4fc', padding: 10 }} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     > 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -238,7 +341,12 @@ const AddDynamic: React.FC<PULLIN.NewAddDynamic> = ({ visible, onChange, onClose 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         activeKey={activeKey} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         tabBarExtraContent={<Space> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             <span>创意总数:{dynamicCount}</span> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            <Button type='primary'>提交创建</Button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            <Popconfirm 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                title="确定提交?" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                onConfirm={onSubmit} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            > 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                <Button type='primary' loading={createDynamicTask.loading}>提交创建</Button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            </Popconfirm> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         </Space>} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     > 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         {adData.map(item => <Tabs.TabPane tab={item.adgroupId} key={item.adgroupId} />)} 
			 |