wjx 2 年之前
父節點
當前提交
fe46171bff

+ 1 - 3
src/pages/launchSystemNew/launchManage/adAuthorize/tableConfig.tsx

@@ -70,9 +70,7 @@ export function columnsMp(): any {
             align: 'center',
             render: (a: any) => {
                 return <Tooltip title={a}>
-                    <div className="name-wrapper">
-                        <p>{ a }</p>
-                    </div>
+                    <div className="name-wrapper">{ a }</div>
                 </Tooltip>
             }
         },

+ 33 - 0
src/pages/launchSystemNew/launchManage/taskList/batchCreativeCopy.tsx

@@ -0,0 +1,33 @@
+import { Modal } from "antd"
+import React, { useState } from "react"
+import style from './index.less'
+
+interface Props {
+    publicData: any,
+    data: any,
+    visible?: boolean,
+    onClose?: () => void,
+    onChange?: () => void
+}
+/**
+ * 批量复制
+ * @returns 
+ */
+const BatchCreativeCopy: React.FC<Props> = (props) => {
+
+    /*******************************/
+    const { visible, onClose, onChange } = props
+    const [oriData, setOriData] = useState<any[]>([])  // 创意数据
+    /*******************************/
+
+
+    const handleOk = () => {
+
+    }
+
+    return <Modal title="批量复制" visible={visible} onOk={handleOk} width={1000} onCancel={() => { onClose && onClose() }} className={style.batchCopy}>
+        
+    </Modal>
+}
+
+export default React.memo(BatchCreativeCopy)

+ 58 - 0
src/pages/launchSystemNew/launchManage/taskList/index.less

@@ -0,0 +1,58 @@
+.batchCopy {
+    .info {
+        border: 1px solid rgb(226, 226, 226);
+        padding: 0 10px;
+        width: 100%;
+        border-radius: 4px;
+        .items {
+            width: 100%;
+            display: flex;
+            justify-content: space-between;
+            margin: 10px 0;
+
+            .item {
+                width: 50%;
+                display: flex;
+                justify-content: flex-start;
+                align-items: center;
+                .label {
+                    font-size: 14px;
+                    font-weight: 500;
+                    width: 110px;
+                    text-align: right;
+                    margin-right: 10px;
+                }
+            }
+        }
+        margin-bottom: 20px;
+    }
+    .title {
+        font-size: 16px;
+        font-weight: 700;
+        margin-bottom: 20px;
+    }
+    .originality {
+        border: 1px dashed rgb(228, 228, 228);
+        padding: 10px;
+        box-sizing: border-box;
+        border-radius: 4px;
+        &+div{
+            margin-top: 10px;
+        }
+        .head {
+            display: flex;
+            justify-content: space-between;
+            align-items: center;
+            font-weight: 700;
+            font-size: 14px;
+
+            .clear{
+                display: none;
+            }
+
+            &:hover .clear {
+                display: inline-block;
+            }
+        }
+    }
+}

+ 6 - 7
src/pages/launchSystemNew/launchManage/taskList/index.tsx

@@ -1,16 +1,13 @@
 import { useAjax } from "@/Hook/useAjax"
-import { getListByCorpAccount } from "@/services/enterpriseWeChat/userMange"
 import { PromotedObjectType } from "@/services/launchAdq/enum"
 import { getTaskListApi, TaskListProps } from "@/services/launchAdq/taskList"
-import { Button, Card, Input, Select, Space } from "antd"
+import { Input, Select, Space } from "antd"
 import React, { useEffect, useState } from "react"
 import LookLanding from "../../components/lookLanding"
 import TableData from "../../components/TableData"
 import Log from "./log"
 import tableConfig from './tableConfig'
 
-
-
 const TaskList: React.FC = () => {
 
     /*************************/
@@ -18,6 +15,7 @@ const TaskList: React.FC = () => {
     const [logVisible, setLogVisible] = useState<boolean>(false)
     const [lookVisible, setLookVisible] = useState<boolean>(false)
     const [logData, setLogData] = useState<{ taskId: number, campaignName: string } | number>({ taskId: 0, campaignName: '' })
+    const [allData, setAllData] = useState<any>({})
 
     const getTaskList = useAjax((params) => getTaskListApi(params), { formatResult: true })
     /*************************/
@@ -38,11 +36,12 @@ const TaskList: React.FC = () => {
         getTaskList.run(queryForm)
     }
 
-    const callback = (data: any, type: 'log' | 'page') => {
+    const callback = (data: any, type: 'log' | 'page', allData?: any) => {
         switch (type) {
             case 'log':
                 setLogData({ ...data })
                 setLogVisible(true)
+                setAllData(allData)
                 break
             case 'page':
                 setLogData(data)
@@ -83,13 +82,13 @@ const TaskList: React.FC = () => {
                 </Select>
             </Space>}
             onChange={(props: any) => {
-                let { sortData, pagination } = props
+                let { pagination } = props
                 let { current, pageSize } = pagination
                 setQueryForm({ ...queryForm, pageNum: current, pageSize })
             }}
         />
         {/* 日志 */}
-        {logVisible && <Log {...logData as any} visible={logVisible} onClose={() => setLogVisible(false)} />}
+        {logVisible && <Log {...logData as any} visible={logVisible} onClose={() => setLogVisible(false)} allData={allData}/>}
         {/* 查看落地页 */}
         {lookVisible && <LookLanding visible={lookVisible} onClose={() => setLookVisible(false)} id={logData as any} />}
     </>

+ 46 - 5
src/pages/launchSystemNew/launchManage/taskList/log.tsx

@@ -4,11 +4,13 @@ import { Button, Drawer, Select, Space } from "antd"
 import React, { useEffect, useState } from "react"
 import { useModel } from "umi"
 import TableData from "../../components/TableData"
+import BatchCreativeCopy from "./batchCreativeCopy"
 import tableConfig from './logTableConfig'
 
 interface Props {
     taskId: number,  // 任务ID
     campaignName: string, // 计划名称
+    allData: any, // 所有数据
     visible?: boolean,
     onClose?: () => void
 }
@@ -19,13 +21,16 @@ interface Props {
 const Log: React.FC<Props> = (props) => {
 
     /*****************************/
-    const { taskId, campaignName, visible, onClose } = props
+    const { taskId, campaignName, allData, visible, onClose } = props
     const [queryForm, setQueryForm] = useState<TaskLogListProps>({ pageNum: 1, pageSize: 20, taskId })
+    const [selectedRowKeys, setSelectedRowKeys] = useState<any[]>([])
+    const [visibleCopy, setVisibleCopy] = useState<boolean>(false)
+    const [data, setData] = useState<any>({})
 
     const { getAdAccount } = useModel('useLaunchAdq.useAdAuthorize')
     const getTaskLogList = useAjax((params) => getTaskLogListApi(params), { formatResult: true })
     /*****************************/
-
+    
     useEffect(() => {
         getAdAccount.run()
     }, [])
@@ -34,13 +39,24 @@ const Log: React.FC<Props> = (props) => {
         getList()
     }, [queryForm])
 
+    /** 获取列表 */
     const getList = () => {
         getTaskLogList.run(queryForm)
     }
 
-    return <Drawer bodyStyle={{ padding: 0 }} title={campaignName + ' 日志'} width={1000} placement="right" onClose={() => { onClose && onClose() }} visible={visible}>
+    /** 批量复制 */
+    const copyCreative = (data: any) => {
+        console.log(data);
+        setData(data)
+        setVisibleCopy(true)
+    }
+
+    return <Drawer bodyStyle={{ padding: 0 }} title={campaignName + ' 日志'} width={1200} placement="right" onClose={() => { onClose && onClose() }} visible={visible}>
+        <Space>
+            <Button></Button>
+        </Space>
         <TableData
-            columns={() => tableConfig()}
+            columns={() => tableConfig(copyCreative)}
             ajax={getTaskLogList}
             dataSource={getTaskLogList?.data?.data?.records}
             loading={getTaskLogList?.loading}
@@ -48,6 +64,28 @@ const Log: React.FC<Props> = (props) => {
             total={getTaskLogList?.data?.data?.total}
             page={getTaskLogList?.data?.data?.current}
             pageSize={getTaskLogList?.data?.data?.size}
+            rowSelection={{
+                type: 'checkbox',
+                selectedRowKeys: selectedRowKeys?.map((item: {id: number}) => item.id.toString()),
+                onSelect: (record: any, selected: boolean, selectedRows: any, nativeEvent: any) => {
+                    let oldSelectedRowKeys: any[] = JSON.parse(JSON.stringify(selectedRowKeys))
+                    if (selected) { // 新增
+                        oldSelectedRowKeys.push(record)
+                    } else { // 减少
+                        oldSelectedRowKeys = oldSelectedRowKeys.filter((item: {id: number}) => item.id != record.id)
+                    }
+                    setSelectedRowKeys(oldSelectedRowKeys)
+                },
+                onSelectAll: (selected: boolean, selectedRows: any, changeRows: any) => {
+                    let oldSelectedRowKeys: any[] = JSON.parse(JSON.stringify(selectedRowKeys))
+                    if (selected) {
+                        oldSelectedRowKeys = [...oldSelectedRowKeys, ...changeRows]
+                    } else {
+                        oldSelectedRowKeys = oldSelectedRowKeys.filter((item: {id: number}) => !changeRows?.some((item1: {id: number}) => item1.id == item.id))
+                    }
+                    setSelectedRowKeys(oldSelectedRowKeys)
+                }
+            }}
             leftChild={<Space>
                 <Select
                     placeholder="媒体账户"
@@ -69,11 +107,14 @@ const Log: React.FC<Props> = (props) => {
                 </Select>
             </Space>}
             onChange={(props: any) => {
-                let { sortData, pagination } = props
+                let { pagination } = props
                 let { current, pageSize } = pagination
                 setQueryForm({ ...queryForm, pageNum: current, pageSize })
             }}
         />
+
+        {/* 批量复制 */}
+        {visibleCopy && <BatchCreativeCopy data={data} publicData={allData} visible={visibleCopy} onClose={() => setVisibleCopy(false)} onChange={() => {  }}/>}
     </Drawer>
 }
 

+ 40 - 14
src/pages/launchSystemNew/launchManage/taskList/logTableConfig.tsx

@@ -1,16 +1,8 @@
-import { Badge, message } from "antd"
+import { copy } from "@/utils/utils";
+import { DownOutlined } from "@ant-design/icons";
+import { Badge, Button, Dropdown, Menu, Space } from "antd"
 import React from "react"
-function tableConfig(): any {
-    const copy = (str: string) => {
-        let element = document.createElement("textarea");
-        element.id = 'myTextarea'
-        element.textContent = str
-        document.body.append(element);
-        (document.getElementById('myTextarea') as any).select();
-        document.execCommand("Copy")
-        document.body.removeChild(element);
-        message.success(`复制成功:${str}`)
-    }
+function tableConfig(copyCreative: (data: any) => void): any {
     return [
         {
             title: 'ID',
@@ -39,6 +31,17 @@ function tableConfig(): any {
                 return <span style={{ fontSize: "12px" }}>{a || '--'}</span>
             }
         },
+        {
+            title: '品牌形象',
+            dataIndex: 'promotedObjectId',
+            key: 'promotedObjectId',
+            width: 140,
+            align: 'center',
+            ellipsis: true,
+            render: (a: any, b: any) => {
+                return <span style={{ fontSize: "12px" }}>{a || '--'}</span>
+            }
+        },
         {
             title: '创建状态',
             dataIndex: 'createStatus',
@@ -47,7 +50,7 @@ function tableConfig(): any {
             width: 90,
             render: (a: any, b: any) => {
                 if (a) {
-                    return a === 0 ? <Badge status="warning" text={<span style={{ fontSize: "12px" }}>创建中</span>}/> : a === 100 ? <Badge status="success" text={<span style={{ fontSize: "12px" }}>创建成功</span>} /> : <Badge status="error" text={<span style={{ fontSize: "12px" }}>创建失败</span>} />
+                    return a === 0 ? <Badge status="warning" text={<span style={{ fontSize: "12px" }}>创建中</span>} /> : a === 100 ? <Badge status="success" text={<span style={{ fontSize: "12px" }}>创建成功</span>} /> : <Badge status="error" text={<span style={{ fontSize: "12px" }}>创建失败</span>} />
                 } else {
                     return <span>--</span>
                 }
@@ -58,7 +61,8 @@ function tableConfig(): any {
             dataIndex: 'createTime',
             key: 'createTime',
             align: 'center',
-            width: 130,
+            width: 150,
+            ellipsis: true,
             render: (a: any, b: any) => {
                 return <span style={{ fontSize: "12px" }}>{a || '--'}</span>
             }
@@ -73,6 +77,28 @@ function tableConfig(): any {
                 return <a style={{ fontSize: "12px" }} onClick={() => copy(a)}>{a || '--'}</a>
             }
         },
+        {
+            title: '操作',
+            dataIndex: 'cz',
+            key: 'cz',
+            width: 100,
+            align: 'center',
+            render: (a: any, b: any) => {
+                return <Dropdown trigger={['click']} overlay={<Menu items={[
+                    {
+                        key: '1',
+                        label: (<Button size="small" type="link" onClick={() => { copyCreative(b) }}>批量复制</Button>)
+                    }
+                ]} />}>
+                    <a onClick={e => e.preventDefault()} style={{ fontSize: 12 }}>
+                        <Space>
+                            操作
+                            <DownOutlined />
+                        </Space>
+                    </a>
+                </Dropdown>
+            }
+        }
     ]
 }
 

+ 2 - 2
src/pages/launchSystemNew/launchManage/taskList/tableConfig.tsx

@@ -5,7 +5,7 @@ import TargetingPopover from "../../components/targetingPopover"
 import { EyeOutlined } from "@ant-design/icons"
 import AdPopover from "../../components/adPopover"
 import AdcreativePopover from "../../components/adcreativePopover"
-function tableConfig(callback: (data: any, type: 'log' | 'page') => void): any {
+function tableConfig(callback: (data: any, type: 'log' | 'page', allData?: any) => void): any {
     return [
         {
             title: 'ID',
@@ -154,7 +154,7 @@ function tableConfig(callback: (data: any, type: 'log' | 'page') => void): any {
             fixed: 'right',
             render: (a: any, b: any) => {
                 return <Space style={{ marginLeft: 10 }}>
-                    <a style={{ color: '#1890ff', fontSize: 12 }} onClick={() => { callback({ taskId: b.id, campaignName: b.campaignName }, 'log') }}>日志</a>
+                    <a style={{ color: '#1890ff', fontSize: 12 }} onClick={() => { callback({ taskId: b.id, campaignName: b.campaignName }, 'log', b) }}>日志</a>
                 </Space>
             }
         }

+ 27 - 14
src/utils/utils.ts

@@ -1,3 +1,4 @@
+import { message } from 'antd';
 import { RcFile } from 'antd/lib/upload';
 import { parse } from 'querystring';
 
@@ -99,20 +100,32 @@ export const getImgSize = (file: RcFile): Promise<{ width: number, height: numbe
 // 返回落地页组件key
 export const getTypeKey = (key: string): string => {
   switch (key) {
-      case 'TOP_IMAGE':
-          return 'topImageSpec'
-      case 'TOP_SLIDER':
-          return 'topSliderSpec'
-      case 'TOP_VIDEO':
-          return 'topVideoSpec'
-      case 'IMAGE':
-          return 'imageSpec'
-      case 'TEXT':
-          return 'textSpec'
-      case 'GH':
-          return 'ghSpec'
-      case 'ENTERPRISE_WX':
-          return 'enterpriseWxSpec'
+    case 'TOP_IMAGE':
+      return 'topImageSpec'
+    case 'TOP_SLIDER':
+      return 'topSliderSpec'
+    case 'TOP_VIDEO':
+      return 'topVideoSpec'
+    case 'IMAGE':
+      return 'imageSpec'
+    case 'TEXT':
+      return 'textSpec'
+    case 'GH':
+      return 'ghSpec'
+    case 'ENTERPRISE_WX':
+      return 'enterpriseWxSpec'
   }
   return ''
+}
+
+// 点击复制
+export const copy = (str: string) => {
+  let element = document.createElement("textarea");
+  element.id = 'myTextarea'
+  element.textContent = str
+  document.body.append(element);
+  (document.getElementById('myTextarea') as any).select();
+  document.execCommand("Copy")
+  document.body.removeChild(element);
+  message.success(`复制成功:${str}`)
 }