wjx 5 månader sedan
förälder
incheckning
3663e3bb16

+ 37 - 57
src/pages/launchSystemV3/components/ConversionSelect/index.tsx

@@ -90,55 +90,42 @@ const ConversionSelect: React.FC<Props> = (props) => {
     }
 
     /** 一键设置 */
-    const setOnekey = (isFirst?: boolean) => {
-        // let newData: PULLIN.AccountCreateLogsProps[] = JSON.parse(JSON.stringify(data))
-        // const hide = message.loading(`正在设置...`, 0, () => {
-        //     message.success('设置成功');
-        // });
-        // if (isFirst) {
-        //     setLoading(true)
-        //     let ajax = data.map(item => getWechatOfficialAccountApi({ accountId: item.accountId }))
-        //     Promise.all(ajax).then(res => {
-        //         if (res) {
-        //             res.forEach(a => {
-        //                 let data = a?.data?.[0] || {}
-        //                 newData = newData.map(item => {
-        //                     if (item.accountId.toString() === data.accountId.toString()) {
-        //                         return { ...item, newConversionList: [data] }
-        //                     }
-        //                     return item
-        //                 })
-        //             })
-        //             setData(newData)
-        //         }
-        //         message.success('设置完成');
-        //         setLoading(false)
-        //         hide()
-        //     }).catch(() => {
-        //         message.success('设置失败');
-        //         setLoading(false)
-        //         hide()
-        //     })
-        // } else {
-        //     let wechatChannelNames: string[] = data[selectAdz - 1]['newConversionList']?.map((item: { wechatOfficialAccountName: string }) => item.wechatOfficialAccountName) || []
-        //     getWechatOfficialAccounts.run({ accountIdList: newData?.filter(item => item.accountId !== data[selectAdz - 1].accountId)?.map(item => item?.accountId) }).then(res => {
-        //         if (res?.length > 0) {
-        //             res.forEach((i: { accountId: number, wechatOfficialAccountName: string }) => {
-        //                 if (wechatChannelNames.includes(i.wechatOfficialAccountName)) {
-        //                     newData = newData.map(item => {
-        //                         if (item.accountId.toString() === i.accountId.toString()) {
-        //                             return { ...item, newConversionList: [i] }
-        //                         }
-        //                         return item
-        //                     })
-        //                 }
-        //             })
-        //             setData(newData)
-        //         }
-        //         message.success('设置完成');
-        //         hide()
-        //     })
-        // }
+    const setOnekey = () => {
+        let conversionData: number[] = data[selectAdz - 1]['newConversionList']?.map((item: { conversionId: number }) => item.conversionId) || []
+        let newData: PULLIN.AccountCreateLogsProps[] = JSON.parse(JSON.stringify(data))
+        const hide = message.loading(`正在设置...`, 0, () => {
+            message.success('设置成功');
+        });
+        let dataAjax = newData?.filter(item => item.accountId !== data[selectAdz - 1].accountId)?.map(item => item?.accountId).map(accountId => {
+            let { optimizationGoal, deepConversionSpec, siteSet, marketingSubGoal, marketingGoal } = adgroups
+            let params: any = {}
+            if (putInType === 'NOVEL') {
+                params = { accountId, pageNum: 1, pageSize: 10, conversionName, createSourceType: 'SELF_CREATED', optimizationGoal, deepWorthOptimizationGoal: deepConversionSpec?.deepConversionWorthSpec?.goal, siteSet, taskType: putInType }
+            } else {
+                params = { accountId, pageNum: 1, pageSize: 10, marketingGoal, marketingSubGoal, conversionName, createSourceType: 'SELF_CREATED', optimizationGoal, deepWorthOptimizationGoal: deepConversionSpec?.deepConversionWorthSpec?.goal, siteSet, taskType: putInType }
+            }
+            return getConversionInfoApi({ ...params, conversionId: conversionData?.[0] }).then(res => {
+                if (res.data?.records) {
+                    let data = res.data?.records
+                    if (data?.length > 0) {
+                        newData = newData.map(item => {
+                            if (item.accountId.toString() === params?.accountId.toString()) {
+                                return { ...item, newConversionList: res.data?.records }
+                            }
+                            return item
+                        })
+                    }
+                }
+            })
+        })
+        Promise.all(dataAjax).then(() => {
+            setData(newData)
+            message.success('设置完成');
+            hide()
+        }).catch(() => {
+            hide()
+            message.error('设置失败')
+        })
     }
 
 
@@ -168,14 +155,7 @@ const ConversionSelect: React.FC<Props> = (props) => {
                 <Space style={{ marginBottom: 10 }} align="end" size={0}>
                     <Input.Search enterButton allowClear onSearch={(value) => setConversionName(value)} placeholder="搜索转化名称" />
                     <Button icon={<SyncOutlined />} type='link' loading={getConversionInfo?.loading} onClick={() => { getList(data[selectAdz - 1].accountId) }}>刷新</Button>
-                    {/* {data?.length > 1 && <Button disabled={!data[selectAdz - 1]['newConversionList']?.length} onClick={() => setOnekey()} type="link" loading={getConversionInfo.loading}>
-                        <Space>
-                            <span>一键设置</span>
-                            <Tooltip color="#FFF" overlayInnerStyle={{ color: '#000' }} title="设置其它账号有相同名称的商品为那个账号的商品(注意需要用户商品称相同,否则不设置)">
-                                <QuestionCircleOutlined />
-                            </Tooltip>
-                        </Space>
-                    </Button>} */}
+                    {data?.length > 1 && <Button disabled={!data[selectAdz - 1]['newConversionList']?.length} onClick={() => setOnekey()} type="link" loading={getConversionInfo.loading}>一键设置</Button>}
                     {(data[selectAdz - 1]?.newConversionList || [])?.length > 0 && <Button type='link' onClick={() => { clearGoods() }}>清空</Button>}
                 </Space>
                 <Table

+ 1 - 1
src/pages/launchSystemV3/components/GoodsModal/index.tsx

@@ -104,7 +104,7 @@ const GoodsModal: React.FC<Props> = (props) => {
             message.success('设置成功');
         });
         let dataAjax = newData?.filter(item => item.accountId !== data[selectAdz - 1].accountId)?.map(item => item?.accountId).map(accountId => {
-            return getByRemotemarketingAssetContentApi({ pageNum: 1, pageSize: 10, accountId: accountId, marketingIdList })
+            return getByRemotemarketingAssetContentApi({ pageNum: 1, pageSize: 10, accountId: accountId, marketingIdList, marketingAssetType: marketingTargetType })
         })
         Promise.all(dataAjax).then(res => {
             if (res?.length > 0) {

+ 6 - 11
src/pages/launchSystemV3/material/cloudNew/selectGroupCloudNew.tsx

@@ -10,7 +10,6 @@ import './global.less'
 import '../../tencentAdPutIn/index.less'
 import { showFieldList } from "./const"
 import { EyeOutlined, SortAscendingOutlined } from "@ant-design/icons"
-import { useSize } from "ahooks"
 import PlayVideo from "./playVideo"
 import Lazyimg from "react-lazyimg-component"
 
@@ -25,8 +24,6 @@ const SelectGroupCloudNew: React.FC<CLOUDNEW.SelectGroupCloudNewProps> = ({ num,
 
     /*****************************************/
     const { getAllUserAccount } = useModel('useLaunchAdq.useAdAuthorize')
-    const ref = useRef<HTMLDivElement>(null);
-    const size = useSize(ref);
     const [rowNum, setRowNum] = useState<number>(0)
 
     const [checkFolderAll, setCheckFolderAll] = useState<boolean>(false);
@@ -42,11 +39,9 @@ const SelectGroupCloudNew: React.FC<CLOUDNEW.SelectGroupCloudNewProps> = ({ num,
 
     // 根据内容宽度计算列数
     useEffect(() => {
-        if (size?.width) {
-            let rowNum = Math.floor((size?.width - 26) / 220)
-            setRowNum(rowNum || 1)
-        }
-    }, [size?.width])
+        let rowNum = Math.floor(1350 / 220)
+        setRowNum(rowNum || 1)
+    }, [])
 
     // 处理全选按钮状态
     useEffect(() => {
@@ -154,9 +149,9 @@ const SelectGroupCloudNew: React.FC<CLOUDNEW.SelectGroupCloudNewProps> = ({ num,
                                                 const remainDataLength = remainData.length
                                                 const remainNum = num - newCheckedFolderList.length
                                                 if (remainNum > remainDataLength) {
-                                                    newCheckedFolderList.push(...remainData.map(i => ({ ...i,  material_type: defaultParams.materialType, id: i.image_id || i.video_id, oss_url: i.preview_url, materialType: 1 })))
+                                                    newCheckedFolderList.push(...remainData.map(i => ({ ...i, material_type: defaultParams.materialType, id: i.image_id || i.video_id, oss_url: i.preview_url, materialType: 1 })))
                                                 } else {
-                                                    newCheckedFolderList.push(...remainData.splice(0, remainNum).map(i => ({ ...i,  material_type: defaultParams.materialType, id: i.image_id || i.video_id, oss_url: i.preview_url, materialType: 1 })))
+                                                    newCheckedFolderList.push(...remainData.splice(0, remainNum).map(i => ({ ...i, material_type: defaultParams.materialType, id: i.image_id || i.video_id, oss_url: i.preview_url, materialType: 1 })))
                                                 }
                                                 newCheckedFolderList = Array.from(new Set(newCheckedFolderList.map(item => JSON.stringify(item)))).map(item => JSON.parse(item));
                                             } else { // 取消全选
@@ -239,7 +234,7 @@ const SelectGroupCloudNew: React.FC<CLOUDNEW.SelectGroupCloudNewProps> = ({ num,
                             </div>
                             <div className={`${style.content} content_global`}>
                                 <Spin spinning={getPageRemoteImageDataList.loading}>
-                                    <div className={style.content_scroll} ref={ref}>
+                                    <div className={`${style.content_scroll} scroll`}>
                                         {getPageRemoteImageDataList?.data?.records?.length > 0 ? <Checkbox.Group value={checkedFolderList?.map(item => item.id)} style={{ width: '100%' }}>
                                             <div className={style.content_scroll_div}>
                                                 {getPageRemoteImageDataList?.data?.records.map((item: any) => {

+ 2 - 2
src/pages/launchSystemV3/tencenTasset/accountAssetSharing/modifyAccountGroup.tsx

@@ -93,8 +93,8 @@ const ModifyAccountGroup: React.FC<Props> = ({ initialValues, visible, onChange,
                         return option!.value?.toString().toLowerCase().includes(input.toLowerCase())
                     }}
                     showSearch
-                    placeholder="请选择员工"
-                    options={getAccountAllList?.data?.map((item: { accountId: any }) => ({ label: item.accountId, value: item.accountId }))}
+                    placeholder="请选择授权主账户"
+                    options={getAccountAllList?.data?.filter((item: { adUnitAccount: boolean }) => !item?.adUnitAccount)?.map((item: { accountId: any }) => ({ label: item.accountId, value: item.accountId }))}
                 />
             </Form.Item>
         </Form>