wjx пре 10 месеци
родитељ
комит
4f23574cd3

+ 24 - 4
src/pages/launchSystemV3/adqv3/ad/index.tsx

@@ -1,6 +1,6 @@
 import { useAjax } from "@/Hook/useAjax";
 import { PauseCircleOutlined, PlayCircleOutlined, PlusOutlined, QuestionCircleOutlined, TransactionOutlined } from "@ant-design/icons";
-import { Button, Checkbox, Col, Input, Row, Select, Space, Tooltip, Typography, message } from "antd"
+import { Button, Checkbox, Col, Input, Modal, Row, Select, Space, Tooltip, Typography, message } from "antd"
 import React, { useCallback, useEffect, useState } from "react"
 import { ADGROUP_STATUS } from "../const";
 import { getAdqV3AdListApi, modifyStatusBatchApi, syncBatchApi } from "@/services/launchAdq/adqv3";
@@ -11,6 +11,8 @@ import TableData from "@/pages/launchSystemNew/components/TableData";
 import AddDynamic from "../../tencentAdPutIn/create/addDynamic";
 import { arraysHaveSameValues } from "@/utils/utils";
 import { MARKETING_CARRIER_TYPE_ENUM, MARKETING_GOAL_ENUM, MARKETING_TARGET_TYPE_ENUM, SITE_SET_ENUM } from "../../tencentAdPutIn/const";
+import Log from "../components/log";
+import '../../tencentAdPutIn/index.less'
 const { Text } = Typography;
 
 const Ad: React.FC<ADQV3.AdProps> = ({ userId, creativeHandle }) => {
@@ -21,7 +23,8 @@ const Ad: React.FC<ADQV3.AdProps> = ({ userId, creativeHandle }) => {
     const [selectedRows, setSelectedRows] = useState<any[]>([])
     const [update, setUpdate] = useState<{ visible: boolean }>({ visible: false })
     const [addDynamicVisible, setAddDynamicVisible] = useState<boolean>(false)
-    const [handleType, setHandleType] = useState<number>(2)
+    const [handleType, setHandleType] = useState<number>(1)
+    const [czjlShow, setCzjlShow] = useState(false)
 
     const syncBatch = useAjax((params) => syncBatchApi(params))
     const modifyStatusBatch = useAjax((params) => modifyStatusBatchApi(params))
@@ -242,6 +245,9 @@ const Ad: React.FC<ADQV3.AdProps> = ({ userId, creativeHandle }) => {
                         value={handleType}
                         options={[{ label: '广告操作', value: 1 }, { label: '创意操作', value: 2 }]}
                     /></Col>
+                    <Col>
+                        <Button type='dashed' onClick={() => { setCzjlShow(true) }}>操作记录</Button>
+                    </Col>
                     {handleType === 1 ? <>
                         <Col><Button type='primary' style={{ background: '#67c23a', borderColor: '#67c23a' }} loading={modifyStatusBatch.loading} icon={<PlayCircleOutlined />} disabled={selectedRows.length === 0} onClick={() => adStatus(true)}>启动</Button></Col>
                         <Col><Button type='primary' style={{ background: '#e6a23c', borderColor: '#e6a23c' }} loading={modifyStatusBatch.loading} icon={<PauseCircleOutlined />} disabled={selectedRows.length === 0} onClick={() => adStatus(false)}>暂停</Button></Col>
@@ -250,7 +256,7 @@ const Ad: React.FC<ADQV3.AdProps> = ({ userId, creativeHandle }) => {
                         <Col><Button type='primary' icon={<PlusOutlined />} disabled={selectedRows.length === 0} onClick={addDynamic}>添加创意</Button></Col>
                         <Col>
                             <Space>
-                                <Tooltip title="选择的广告必须与已选广告的营销目的、营销载体、推广内容、广告版位一致">
+                                <Tooltip title="选择的广告必须与已选广告的营销目的、营销载体、推广内容、广告版位、微信公众号与小程序定投、版位选择一致">
                                     <QuestionCircleOutlined style={{ color: 'red' }} />
                                 </Tooltip>
                                 {selectedRows?.length > 0 && <div style={{ maxWidth: '380px' }}>
@@ -367,9 +373,23 @@ const Ad: React.FC<ADQV3.AdProps> = ({ userId, creativeHandle }) => {
                 setAddDynamicVisible(false)
             }}
             onChange={() => {
-
+                setAddDynamicVisible(false)
+                getAdqV3AdList.refresh()
+                setSelectedRows([])
             }}
         />}
+
+        {czjlShow && <Modal
+            visible={czjlShow}
+            onCancel={() => { setCzjlShow(false) }}
+            onOk={() => { setCzjlShow(false) }}
+            width={1200}
+            footer={null}
+            title={<strong>广告操作记录</strong>}
+            className="modalResetCss"
+        >
+            <Log userId={userId} />
+        </Modal>}
     </div>
 }
 

+ 148 - 0
src/pages/launchSystemV3/adqv3/components/log/index.tsx

@@ -0,0 +1,148 @@
+import { useAjax } from "@/Hook/useAjax"
+import { getLogListApi } from "@/services/launchAdq/adq"
+import { Button, Col, Input, Modal, Row } from "antd"
+import React, { useCallback, useEffect, useState } from "react"
+import tableConfig from "./tableConfig"
+import TableData from "@/pages/launchSystemNew/components/TableData"
+import DynamicLog from "@/pages/launchSystemV3/tencentAdPutIn/taskList/dynamicLog"
+
+type Props = {
+    userId: number,
+}
+/**
+ * 操作记录
+ */
+const Log: React.FC<Props> = (props) => {
+
+    /**************************/
+    let { userId } = props
+    const [queryparams, setQueryparams] = useState<{ accountId?: string, adgroupId?: string, adgroupName?: string, pageNum: number, pageSize: number, userId: number }>({ pageNum: 1, pageSize: 20, userId })
+    const [logVisible, setLogVisible] = useState<boolean>(false)
+    const [logData, setLogData] = useState<any>({})
+
+    const getLogList = useAjax((params) => getLogListApi(params), { formatResult: true })
+    /**************************/
+    useEffect(() => {
+        getList(queryparams)
+    }, [])
+
+    const getList = useCallback((params: any) => {
+        getLogList.run({ ...params, userId })
+    }, [userId])
+
+    const callback = (records: any, type: string) => {
+        setLogData(records)
+        setLogVisible(true)
+    }
+
+    return <div>
+        <TableData
+            isCard={false}
+            columns={() => tableConfig(callback)}
+            ajax={getLogList}
+            dataSource={getLogList?.data?.data?.records}
+            loading={getLogList?.data?.loading}
+            scroll={{ y: 550 }}
+            total={getLogList?.data?.data?.total}
+            page={getLogList?.data?.data?.current}
+            pageSize={getLogList?.data?.data?.size}
+            gutter={[10, 10]}
+            leftChild={<>
+                <Row gutter={[10, 10]}>
+                    <Col>
+                        <Input
+                            placeholder='广告账号'
+                            allowClear
+                            style={{ width: 150 }}
+                            value={queryparams.accountId}
+                            onBlur={(e) => {
+                                let value = e.target.value
+                                setQueryparams({ ...queryparams, pageNum: 1, pageSize: 20, accountId: value })
+                            }}
+                            onKeyDownCapture={(e: any) => {
+                                let key = e.key
+                                if (key === 'Enter') {
+                                    let value = e.target.value
+                                    setQueryparams({ ...queryparams, pageNum: 1, pageSize: 20, accountId: value })
+                                }
+                            }}
+                            onChange={(e) => {
+                                setQueryparams({ ...queryparams, pageNum: 1, pageSize: 20, accountId: e.target.value })
+                            }}
+                        />
+                    </Col>
+                    <Col>
+                        <Input
+                            placeholder='广告组id'
+                            allowClear
+                            style={{ width: 150 }}
+                            value={queryparams.adgroupId}
+                            onBlur={(e) => {
+                                let value = e.target.value
+                                setQueryparams({ ...queryparams, pageNum: 1, pageSize: 20, adgroupId: value })
+                            }}
+                            onKeyDownCapture={(e: any) => {
+                                let key = e.key
+                                if (key === 'Enter') {
+                                    let value = e.target.value
+                                    setQueryparams({ ...queryparams, pageNum: 1, pageSize: 20, adgroupId: value })
+                                }
+                            }}
+                            onChange={(e) => {
+                                setQueryparams({ ...queryparams, pageNum: 1, pageSize: 20, adgroupId: e.target.value })
+                            }}
+                        />
+                    </Col>
+                    <Col>
+                        <Input
+                            placeholder='广告名称'
+                            allowClear
+                            style={{ width: 150 }}
+                            value={queryparams.adgroupName}
+                            onBlur={(e) => {
+                                setQueryparams({ ...queryparams, pageNum: 1, pageSize: 20, adgroupName: e.target.value })
+                            }}
+                            onKeyDownCapture={(e: any) => {
+                                let key = e.key
+                                if (key === 'Enter') {
+                                    setQueryparams({ ...queryparams, pageNum: 1, pageSize: 20, adgroupName: e.target.value })
+                                }
+                            }}
+                            onChange={(e) => {
+                                setQueryparams({ ...queryparams, pageNum: 1, pageSize: 20, adgroupName: e.target.value })
+                            }}
+                        />
+
+                    </Col>
+                    <Col>
+                        <Button type='primary' onClick={() => { getList({ ...queryparams, pageNum: 1 }) }}>搜索</Button>
+                    </Col>
+                </Row>
+            </>}
+            onChange={(props: any) => {
+                let { sortData, pagination } = props
+                let { current, pageSize } = pagination
+                setQueryparams({ ...queryparams, pageNum: current, pageSize })
+                getList({ ...queryparams, pageNum: current, pageSize })
+            }}
+        />
+
+        {/* 任务日志 */}
+        {logVisible && <Modal
+            title={<strong>{logData?.adgroupName + ' 创意创建日志'}</strong>}
+            visible={logVisible}
+            onCancel={() => {
+                setLogData({})
+                setLogVisible(false)
+            }}
+            width={900}
+            footer={null}
+            className="modalResetCss"
+        >
+            <DynamicLog isHandle record={logData} />
+        </Modal>}
+    </div>
+}
+
+
+export default React.memo(Log)

+ 167 - 0
src/pages/launchSystemV3/adqv3/components/log/tableConfig.tsx

@@ -0,0 +1,167 @@
+import { copy } from "@/utils/utils"
+import { Badge, Space } from "antd"
+import React from "react"
+
+function tableConfig(callback: (records: any, type: string) => void): any {
+    return [
+        {
+            title: '操作',
+            dataIndex: 'cz',
+            key: 'cz',
+            width: 70,
+            align: 'center',
+            fixed: 'left',
+            render: (_: any, records: any) => {
+                return records?.operationName === '添加创意' ? <Space>
+                    <a style={{ color: '#1890ff', fontSize: 12 }} onClick={() => { callback(records, 'log') }}>创意日志</a>
+                </Space> : '--'
+            }
+        },
+        {
+            title: '所属账号',
+            dataIndex: 'accountId',
+            key: 'accountId',
+            align: 'center',
+            width: 80,
+            fixed: 'left',
+            ellipsis: true,
+            render: (a: string) => {
+                return <Space>
+                    <a style={{ fontSize: 12 }} onClick={() => copy(a)} >{a}</a>
+                </Space>
+            }
+        },
+        {
+            title: '广告ID',
+            dataIndex: 'adgroupId',
+            key: 'adgroupId',
+            align: 'center',
+            width: 100,
+            fixed: 'left',
+            ellipsis: true,
+            render: (a: string) => {
+                return <Space>
+                    <a style={{ fontSize: 12 }} onClick={() => copy(a)} >{a}</a>
+                </Space>
+            }
+        },
+        {
+            title: '广告名称',
+            dataIndex: 'adgroupName',
+            key: 'adgroupName',
+            width: 280,
+            ellipsis: true,
+            render: (a: string) => {
+                return <a style={{ wordBreak: 'break-all', fontSize: 12 }} onClick={() => { copy(a) }}>{a}</a>
+            }
+        },
+        {
+            title: '执行时间',
+            dataIndex: 'createTime',
+            key: 'createTime',
+            width: 140,
+            align: 'center',
+            render: (a: string) => {
+                return <span style={{ fontSize: 12 }}>{a}</span>
+            }
+        },
+        {
+            title: '操作者名字',
+            dataIndex: 'operationByName',
+            key: 'operationByName',
+            width: 65,
+            align: 'center',
+            render: (a: string) => {
+                return <span style={{ fontSize: 12 }}>{a}</span>
+            }
+        },
+        {
+            title: '操作类型名称',
+            dataIndex: 'operationName',
+            key: 'operationName',
+            width: 70,
+            align: 'center',
+            render: (a: string) => {
+                return <span style={{ fontSize: 12 }}>{a}</span>
+            }
+        },
+        {
+            title: '操作数',
+            dataIndex: 'operationCount',
+            key: 'operationCount',
+            width: 60,
+            align: 'center',
+            render: (a: string) => {
+                return <span style={{ fontSize: 12 }}>{a}</span>
+            }
+        },
+        {
+            title: '成功数',
+            dataIndex: 'successCount',
+            key: 'successCount',
+            width: 60,
+            align: 'center',
+            render: (a: string) => {
+                return <span style={{ fontSize: 12 }}>{a}</span>
+            }
+        },
+        {
+            title: '失败数',
+            dataIndex: 'failCount',
+            key: 'failCount',
+            width: 60,
+            align: 'center',
+            render: (a: number) => {
+                return <span style={a > 0 ? { color: 'red', fontSize: 12 } : { fontSize: 12 }}>{a}</span>
+            }
+        },
+        {
+            title: '状态',
+            dataIndex: 'status',
+            key: 'status',
+            width: 70,
+            align: 'center',
+            render: (a: any) => {
+                let obj = {
+                    '成功': 'success',
+                    '失败': 'error',
+                    '执行中': 'warning'
+                }
+                return <Badge status={obj[a]} text={a} />
+            }
+        },
+        {
+            title: '完成时间',
+            dataIndex: 'updateTime',
+            key: 'updateTime',
+            width: 140,
+            align: 'center',
+            render: (a: string) => {
+                return <span style={{ fontSize: 12 }}>{a}</span>
+            }
+        },
+        {
+            title: '错误消息',
+            dataIndex: 'errorMsg',
+            key: 'errorMsg',
+            width: 400,
+            ellipsis: true,
+            render: (a: string) => {
+                return <span style={{ fontSize: 12 }}>{a}</span>
+            }
+        },
+        {
+            title: '操作参数',
+            dataIndex: 'requestJson',
+            key: 'requestJson',
+            width: 400,
+            ellipsis: true,
+            render: (a: string) => {
+                return <span style={{ fontSize: 12 }}>{a}</span>
+            }
+        },
+    ]
+}
+
+
+export default tableConfig

+ 4 - 4
src/pages/launchSystemV3/adqv3/config.ts

@@ -45,10 +45,10 @@ const txDynamicConfig = [
             { title: '所属账号', dataIndex: 'accountId', label: '广告详情', default: 9, width: 75 },
             { title: '广告ID', dataIndex: 'adgroupId', label: '广告详情', default: 10, width: 90 },
             { title: '创意名称', dataIndex: 'dynamicCreativeName', label: '广告详情', default: 11, width: 120 },
-            { title: '创意ID', dataIndex: 'dynamicCreativeId', label: '广告详情', default: 12, width: 60 },
-            { title: '投放模式', dataIndex: 'deliveryMode', label: '广告详情', default: 13, width: 100 },
-            { title: '创意形式匹配方式', dataIndex: 'dynamicCreativeType', label: '广告详情', default: 14, width: 100 },
-            { title: '状态', dataIndex: 'systemStatus', label: '广告详情', default: 15, width: 100 },
+            { title: '创意ID', dataIndex: 'dynamicCreativeId', label: '广告详情', default: 12, width: 80 },
+            { title: '投放模式', dataIndex: 'deliveryMode', label: '广告详情', default: 13, width: 90 },
+            { title: '创意形式匹配方式', dataIndex: 'dynamicCreativeType', label: '广告详情', default: 14, width: 85 },
+            { title: '创意形式', dataIndex: 'creativeTemplateId', label: '广告详情', default: 15, width: 100 }
         ]
     }
 ]

+ 31 - 37
src/pages/launchSystemV3/adqv3/creative/index.tsx

@@ -27,8 +27,22 @@ const Creative: React.FC<ADQV3.CreativeProps> = ({ queryForm, setQueryForm, user
         setQueryForm({ ...queryForm, ...values })
     }
 
-    return <div>
-        <Form
+    return <TableData
+        isCard={false}
+        columns={() => tableConfig()}
+        ajax={getDynamicCreativeV3List}
+        fixed={{ left: 2, right: 4 }}
+        dataSource={getDynamicCreativeV3List?.data?.data?.records}
+        loading={getDynamicCreativeV3List?.loading}
+        scroll={{ y: 560 }}
+        total={getDynamicCreativeV3List?.data?.data?.total}
+        page={getDynamicCreativeV3List?.data?.data?.current}
+        pageSize={getDynamicCreativeV3List?.data?.data?.size}
+        myKey={'dynamicCreativeId'}
+        gutter={[0, 10]}
+        config={txDynamicConfig}
+        configName="创意3.0"
+        leftChild={<Form
             layout="inline"
             form={form}
             name="basignCreative"
@@ -37,16 +51,16 @@ const Creative: React.FC<ADQV3.CreativeProps> = ({ queryForm, setQueryForm, user
         >
             <Row gutter={[10, 10]}>
                 <Col><Form.Item name='accountId' style={{ marginRight: 0 }}>
-                    <Input placeholder="广告账号" allowClear />
+                    <Input placeholder="广告账号" style={{ width: 120 }} allowClear />
                 </Form.Item></Col>
                 <Col><Form.Item name='adgroupId' style={{ marginRight: 0 }}>
-                    <Input placeholder="广告ID" allowClear />
+                    <Input placeholder="广告ID" style={{ width: 120 }} allowClear />
                 </Form.Item></Col>
                 <Col><Form.Item name='creativeName' style={{ marginRight: 0 }}>
-                    <Input placeholder="创意名称" allowClear />
+                    <Input placeholder="创意名称" style={{ width: 150 }} allowClear />
                 </Form.Item></Col>
                 <Col><Form.Item name='creativeId' style={{ marginRight: 0 }}>
-                    <Input placeholder="创意ID" allowClear />
+                    <Input placeholder="创意ID" style={{ width: 120 }} allowClear />
                 </Form.Item></Col>
                 <Col><Form.Item name='isDeleted'>
                     <Select
@@ -62,39 +76,19 @@ const Creative: React.FC<ADQV3.CreativeProps> = ({ queryForm, setQueryForm, user
                     </Select>
                 </Form.Item></Col>
                 <Col><Form.Item style={{ marginRight: 0 }}>
-                    <Button type="primary" htmlType="submit">搜索</Button>
-                    <Button onClick={() => form.resetFields()}>重置</Button>
+                    <Space>
+                        <Button type="primary" htmlType="submit">搜索</Button>
+                        <Button onClick={() => form.resetFields()}>重置</Button>
+                    </Space>
                 </Form.Item></Col>
             </Row>
-        </Form>
-
-        <TableData
-            isCard={false}
-            columns={() => tableConfig()}
-            ajax={getDynamicCreativeV3List}
-            fixed={{ left: 2, right: 4 }}
-            dataSource={getDynamicCreativeV3List?.data?.data?.records}
-            loading={getDynamicCreativeV3List?.loading}
-            scroll={{ y: 560 }}
-            total={getDynamicCreativeV3List?.data?.data?.total}
-            page={getDynamicCreativeV3List?.data?.data?.current}
-            pageSize={getDynamicCreativeV3List?.data?.data?.size}
-            myKey={'dynamicCreativeId'}
-            gutter={[0, 10]}
-            config={txDynamicConfig}
-            configName="创意3.0"
-            leftChild={<Space direction='vertical'>
-                <Row gutter={[10, 10]} align='middle'>
-
-                </Row>
-            </Space>}
-            onChange={(props: any) => {
-                let { pagination } = props
-                let { current, pageSize } = pagination
-                setQueryForm({ ...queryForm, pageNum: current, pageSize })
-            }}
-        />
-    </div>
+        </Form>}
+        onChange={(props: any) => {
+            let { pagination } = props
+            let { current, pageSize } = pagination
+            setQueryForm({ ...queryForm, pageNum: current, pageSize })
+        }}
+    />
 }
 
 export default React.memo(Creative)

+ 10 - 18
src/pages/launchSystemV3/adqv3/creative/tableConfig.tsx

@@ -2,7 +2,9 @@ import React from 'react'
 import { Space, Switch, Image, Popover } from 'antd'
 import '../index.less'
 import { copy } from '@/utils/utils'
-import { AD_STATUS, DELIVERY_MODE, DYNAMIC_CREATIVE_TYPE } from '../const'
+import { DELIVERY_MODE, DYNAMIC_CREATIVE_TYPE } from '../const'
+import { creativeTemplate } from '../../tencentAdPutIn/const'
+
 function tableConfig(): any {
     return [
         {
@@ -16,15 +18,6 @@ function tableConfig(): any {
                 return <Switch size="small" checked={a === 'AD_STATUS_NORMAL'} onChange={(checked) => { }} />
             }
         },
-        // {
-        //     title: '创意预览',
-        //     dataIndex: 'creativeComponents',
-        //     key: 'creativeComponents',
-        //     width: 130,
-        //     render: (a: any) => {
-        //         return <Box creativeComponents={a} />
-        //     }
-        // },
         {
             title: '品牌形象',
             dataIndex: 'brand',
@@ -180,9 +173,7 @@ function tableConfig(): any {
             width: 100,
             ellipsis: true,
             render: (a: string, b: any) => {
-                return <Space>
-                    <a onClick={() => copy(a)} >{a}</a>
-                </Space>
+                return <a onClick={() => copy(a)} >{a}</a>
             }
         },
         {
@@ -206,15 +197,16 @@ function tableConfig(): any {
             }
         },
         {
-            title: '状态',
-            dataIndex: 'configuredStatus',
-            key: 'configuredStatus',
+            title: '创意形式',
+            dataIndex: 'creativeTemplateId',
+            key: 'creativeTemplateId',
             align: 'center',
             width: 120,
+            ellipsis: true,
             render: (a: string) => {
-                return AD_STATUS[a]
+                return creativeTemplate[a]
             }
-        },
+        }
     ]
 }
 export default tableConfig

+ 5 - 2
src/pages/launchSystemV3/tencentAdPutIn/const.ts

@@ -518,7 +518,7 @@ export enum TEXT_LINK_TYPE_ENUM {
 
 /** 创意文案类型 */
 export const TextTypeList = [
-	{ label: '全部相同', value: 0 }, 
+	{ label: '全部相同', value: 0 },
 	{ label: '按创意组一一对应', value: 1 },
 	{ label: '按文案顺序分配', value: 2 },
 	{ label: '根据文案叉乘', value: 3 },
@@ -530,4 +530,7 @@ export enum OPTION_ENUM {
 	OPTION_CREATIVE_OVERRIDE_CANVAS = '创意素材替换原生页顶部素材',
 	OPTION_KEEP_DIFFERENT = '不替换替换原生页顶部素材',
 	OPTION_CREATIVE_OVERRIDE_CANVAS_DYNAMIC = '创意素材替换原生页顶部素材(由下游系统动态替换)'
-}
+}
+
+/** 创意ID对应名称 */
+export const creativeTemplate = { "311": "常规大图 1:1", "618": "常规视频  4:3", "641": "常规多图 1:1 三图", "642": "常规多图 1:1 四图", "643": "常规多图 1:1 六图", "711": "横版大图 16:9", "712": "竖版大图 9:16", "713": "通栏大图 7:2", "714": "横版小图 3:2", "720": "横版视频 16:9", "721": "竖版视频 9:16", "722": "贴片视频 16:9", "910": "激励浏览广告", "925": "Banner图片 20:7", "1529": "闪屏视频  9:16", "1707": "卡片广告 横版大图 16:9", "1708": "卡片广告 横版视频 16:9", "2106": "常规图片", "2107": "橱窗广告 - 图片", "2109": "橱窗广告 - 视频" }

+ 111 - 3
src/pages/launchSystemV3/tencentAdPutIn/create/addDynamic.tsx

@@ -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} />)}

+ 34 - 6
src/pages/launchSystemV3/tencentAdPutIn/taskList/dynamicLog.tsx

@@ -1,6 +1,6 @@
 import { useAjax } from "@/Hook/useAjax"
 import { getDynamicListApi } from "@/services/adqV3"
-import { Button, Card, Space, Table, Tag, Typography } from "antd"
+import { Button, Card, Table, Tag, Typography } from "antd"
 import React, { useEffect, useState } from "react"
 import '../index.less'
 import { columnsDynamicLog } from "./tableConfig"
@@ -8,13 +8,14 @@ const { Title } = Typography;
 
 
 interface Props {
-    record: any
+    record: any,
+    isHandle?: boolean
 }
 /**
  * 创意日志
  * @returns 
  */
-const DynamicLog: React.FC<Props> = ({ record }) => {
+const DynamicLog: React.FC<Props> = ({ record, isHandle }) => {
 
     /****************************************/
     const [queryForm, setQueryForm] = useState<PULLIN.GetDynamicV3LogProps>({ pageNum: 1, pageSize: 20 })
@@ -23,11 +24,38 @@ const DynamicLog: React.FC<Props> = ({ record }) => {
 
     useEffect(() => {
         if (record?.id) {
-            getDynamicList.run({ ...queryForm, adgroupCreateLogId: record?.id })
+            let params = {}
+            if (isHandle) {
+                params = { ...queryForm, operateLogId: record?.id }
+            } else {
+                params = { ...queryForm, adgroupCreateLogId: record?.id }
+            }
+            getDynamicList.run(params)
         }
-    }, [record?.id, queryForm])
+    }, [record?.id, queryForm, isHandle])
 
-    return <Card
+    return isHandle ? <Table
+        columns={columnsDynamicLog()}
+        dataSource={getDynamicList?.data?.data?.records}
+        size="small"
+        loading={getDynamicList?.loading}
+        scroll={{ y: 300 }}
+        bordered
+        rowKey={'dynamicCreativeId'}
+        pagination={{
+            pageSize: queryForm.pageSize,
+            current: queryForm.pageNum,
+            total: getDynamicList?.data?.data?.total || 0,
+            showTotal: (total) => <Tag color="cyan">总共{total}数据</Tag>
+        }}
+        onChange={(pagination) => {
+            let { current, pageSize } = pagination
+            let newQueryForm = JSON.parse(JSON.stringify(queryForm))
+            newQueryForm.pageNum = current
+            newQueryForm.pageSize = pageSize
+            setQueryForm(newQueryForm)
+        }}
+    /> : <Card
         hoverable
         className="cardResetCss"
     >

+ 0 - 1
src/pages/launchSystemV3/tencentAdPutIn/taskList/log.tsx

@@ -18,7 +18,6 @@ const Log: React.FC<Props> = (props) => {
 
     /*****************************/
     const { data, visible, onClose } = props
-    console.log(data)
     const { id, taskName } = data
     const [queryForm, setQueryForm] = useState<PULLIN.GetTaskV3LogProps>({ pageNum: 1, pageSize: 20 })