shenwu 2 år sedan
förälder
incheckning
6947b7c6a7

+ 1 - 0
public/ad.svg

@@ -0,0 +1 @@
+<svg t="1659929288532" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1372" width="200" height="200"><path d="M104.6 222.3V716h814.8V222.3H104.6zM873.4 670H150.6V268.3h722.8V670z" p-id="1373"></path><path d="M351.7 517.3h75.1l27.6 89.4H504l-91.2-275.5h-47.2l-90.4 275.5H324l27.7-89.4z m60.9-46h-46.7l23.4-75.7 23.3 75.7zM755.8 471.1v-3.8c0-74.9-61-135.9-135.9-135.9h-95.5V607h95.5c74.9 0 135.9-61 135.9-135.9z m-185.4-93.7h49.5c49.6 0 89.9 40.3 89.9 89.9v3.8c0 49.6-40.3 89.9-89.9 89.9h-49.5V377.4zM127.3 755.7h769.1v46H127.3z" p-id="1374"></path></svg>

+ 8 - 3
src/Hook/useAjax.tsx

@@ -1,4 +1,5 @@
 import { CombineService, Mutate } from '@ahooksjs/use-request/lib/types'
+import e from '@umijs/deps/compiled/express'
 import { message } from 'antd'
 import moment from 'moment'
 import { useRequest } from 'umi'
@@ -50,8 +51,12 @@ export function useAjax(fnc: CombineService<any, any>, options?: Options) {
         formatResult: (res) => {
             let reqTime = moment().format('YYYY-MM-DD HH:mm:ss')
             res['reqTime'] = reqTime
-            return options?.formatResult ? { ...res, reqTime } : res.data
-
+            if(res.data){
+                return options?.formatResult ? { ...res, reqTime } : res.data 
+            }else{
+                console.log('res===>',res)
+                return res
+            }
         },
         onSuccess: (res) => {
             if (res) {
@@ -59,7 +64,7 @@ export function useAjax(fnc: CombineService<any, any>, options?: Options) {
             }
             return null
         },
-        onError: () => {
+        onError: (err) => {
         }
     })
     return ajax

+ 1 - 1
src/app.tsx

@@ -4,7 +4,7 @@ import { Button, notification, Result } from 'antd';
 import { history, RequestConfig } from 'umi';
 import RightContent from '@/components/RightContent';
 import { ResponseError } from 'umi-request';
-import { queryCurrent, getMenu, getAdAccountAllOfMember } from './services/user';
+import { queryCurrent, getMenu } from './services/user';
 import defaultSettings from '../config/defaultSettings';
 import { DesktopOutlined, MessageOutlined, SendOutlined, TeamOutlined, QrcodeOutlined, DatabaseOutlined, ReadOutlined, MobileOutlined, FundViewOutlined, RadarChartOutlined, BarChartOutlined, WechatOutlined, BookOutlined, FileImageOutlined, EyeOutlined, UserOutlined } from '@ant-design/icons';
 import { getMyMenu, headrRouter } from '../config/routerConfig';

+ 53 - 82
src/pages/launchSystemNew/adq/ad/index.tsx

@@ -1,114 +1,87 @@
-import { FnAjax, useAjax } from '@/Hook/useAjax'
-import { Data, ListData, SysAdgroupsDTO } from '@/services/launchAdq'
+
+import { useAjax } from '@/Hook/useAjax'
 import { PromotedObjectType } from '@/services/launchAdq/enum'
-import { createSysAdgroups, getSysAdgroupsInfo, getSysAdgroupsList } from '@/services/launchAdq/localAd'
-import { Col, Row, Input, Select, Button } from 'antd'
+import { Col, Row, Input, Select, Button, message } from 'antd'
 import React, { useEffect, useState, useCallback } from 'react'
 import TableData from '../../components/TableData'
 import tableConfig from './tableConfig'
+import { putAdqAdgroupsSync, getAdqAdgroupsList } from '@/services/launchAdq/adq'
 
-export interface ModalConfig {
-    visible: boolean;
-    title?: string;
-    type?:'add'|'look'|'edit',
-    dataInfo?:null
-}
-
-function Ad(props:{accountId:string}) {
-    const {accountId} = props
-    // 变量
-    const [modalConfig, setModalConfig] = useState<ModalConfig>({
-        visible: false,
-        type:'add'
-    })
-    const [oldsearchData, setOldsearchData] = useState<any>(null)
+function Ad(props: { accountId: string, adAccountId: string ,userId:string}) {
+    let { accountId, adAccountId,userId } = props
     // api方法
-    const sysAdgroupsList: FnAjax<ListData<SysAdgroupsDTO> | any>  = useAjax((params) => getSysAdgroupsList(params),{formatResult:true})
-    const getSysAdgroupsInfos:any = useAjax((adgroupsId) => getSysAdgroupsInfo(adgroupsId),{formatResult:true})
-    const createSysAdgroup = useAjax((params) => createSysAdgroups(params))
-    // 初始获取列表
+    const listAjax = useAjax((params) => getAdqAdgroupsList(params), { formatResult: true })
+    const syncAjax = useAjax((adAccountId) => putAdqAdgroupsSync(adAccountId))
+    console.log('创意=====》')
     useEffect(() => {
-        getList({ pageSize: 20, pageNum: 1 })
-    }, [])
+        getList({ pageNum: 1, pageSize: 20 })
+    }, [accountId,userId])
     // 获取列表
-    const getList = useCallback((arg: { pageSize: number, pageNum: number, adgroupName?: string, promotedObjectType?: string }) => {
-        Object.keys(arg).forEach(key => {
-            !arg[key] && delete arg[key]
-        })
-        if (JSON.stringify(arg) !== JSON.stringify(oldsearchData)) {
-            setOldsearchData(arg)
-            sysAdgroupsList.run(arg)
+    const getList = useCallback((params: {
+        pageNum: number;
+        pageSize: number;
+        accountId?: string;
+        adcreativeName?: string;
+    }) => {
+        if (!params.adcreativeName || params.adcreativeName !== listAjax?.params[0]?.adcreativeName) {
+            !params.adcreativeName && delete params.adcreativeName
+            listAjax.run({ ...params,userId, accountId })
         }
-    }, [oldsearchData])
+    }, [accountId,userId,listAjax])
+    // 同步 
+    const sync = useCallback(() => {
+        if(!adAccountId){
+            message.error('请先选择要同步的广点通账号!')
+            return
+        }
+        syncAjax.run({adAccountId}).then(res => {
+            res && listAjax.refresh()
+            res ? message.success('同步成功!') : message.error('同步失败!')
 
-    // 设置变量
-    const handleModalConfig = useCallback((arg: ModalConfig) => {
-        setModalConfig({ ...modalConfig, ...arg })
-    }, [modalConfig])
-    // submit
-    const submit = useCallback((arg: any) => {
-        console.log(arg)
-        createSysAdgroup.run(arg).then(res => {
-            if (res) {
-                sysAdgroupsList.refresh()
-                handleModalConfig({ visible: false,dataInfo:null,type:'add' })
-            }
-        })
-    }, [sysAdgroupsList])
-    // 获取详情
-    const getInfo = useCallback((adgroupsId,type)=>{
-        getSysAdgroupsInfos.run(adgroupsId).then((res: any)=>{
-            setModalConfig({...modalConfig,visible:true,type,dataInfo:res.data})
         })
-    },[modalConfig])
-    // 回调
-    const callback=useCallback((data,type)=>{
-        getInfo(data.id,type)
-
-    },[])
+    }, [adAccountId, listAjax])
     return <div>
-        {/* <TableData
-            columns={()=>tableConfig(callback)}
-            ajax={sysAdgroupsList}
-            dataSource={sysAdgroupsList?.data?.data?.records}
-            loading={sysAdgroupsList?.loading}
-            scroll={{ y: 600 }}
-            total={sysAdgroupsList?.data?.data?.total}
-            page={sysAdgroupsList?.data?.data?.current}
-            pageSize={sysAdgroupsList?.data?.data?.size}
+        <TableData
+            columns={tableConfig}
+            ajax={listAjax}
+            syncAjax={sync}
+            dataSource={listAjax?.data?.data?.records}
+            loading={listAjax?.loading || syncAjax?.loading}
+            scroll={{ x: 2500 }}
+            total={listAjax?.data?.data?.total}
+            page={listAjax?.data?.data?.current}
+            pageSize={listAjax?.data?.data?.size}
+            myKey={'adgroupId'}
             leftChild={<>
                 <Row gutter={[10, 10]}>
-                    <Col span={24}><Button type='primary' onClick={() => {
-                        handleModalConfig({ visible: true })
-                    }}>新建广告模板</Button></Col>
                     <Col>
                         <Input
-                            placeholder='广告名称'
+                            placeholder='创意名称'
                             allowClear
                             onBlur={(e) => {
                                 let value = e.target.value
-                                getList({ pageNum: 1, pageSize: 20, adgroupName: value })
+                                getList({ pageNum: 1, pageSize: 20, adcreativeName: value })
                             }}
                             onKeyDownCapture={(e: any) => {
                                 let key = e.key
                                 if (key === 'Enter') {
                                     let value = e.target.value
-                                    getList({ pageNum: 1, pageSize: 20, adgroupName: value })
+                                    getList({ pageNum: 1, pageSize: 20, adcreativeName: value })
                                 }
                             }}
                             onChange={(e) => {
                                 let value = e.target.value
                                 if (!value) {
-                                    getList({ pageNum: 1, pageSize: 20, adgroupName: value })
+                                    getList({ pageNum: 1, pageSize: 20, adcreativeName: value })
                                 }
                             }}
                         />
                     </Col>
                     <Col>
-                        <Select placeholder='推广目标选择' style={{ minWidth: 200 }} showSearch filterOption={(input, option) =>
+                        <Select placeholder='推广目标选择' style={{ minWidth: 200 }} showSearch filterOption={(input: any, option: any) =>
                             (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
-                        } allowClear onChange={(value) => {
-                            getList({ pageNum: 1, pageSize: 20, promotedObjectType: value })
+                        } allowClear onChange={(value: any) => {
+                            getList({ pageNum: 1, pageSize: 20, accountId })
                         }}>
                             {
                                 Object.keys(PromotedObjectType).map(key => {
@@ -121,13 +94,11 @@ function Ad(props:{accountId:string}) {
                 </Row>
             </>}
             onChange={(props: any) => {
-                let { sortData, pagination } = props
-                let { current, pageSize } = pagination
-                getList({pageNum:current,pageSize})
+                // let { sortData, pagination } = props
+                // let { current, pageSize } = pagination
+                // getList({ pageNum: current, pageSize })
             }}
-        // config={guanggao}
-        // configName={'广告模板列表'}
-        /> */}
+        />
     </div>
 }
 export default Ad

+ 116 - 22
src/pages/launchSystemNew/adq/ad/tableConfig.tsx

@@ -1,64 +1,158 @@
-import { PromotedObjectType } from '@/services/launchAdq/enum'
+import { AdStatusEnum, ConfiguredStatusEnum, OptimizationGoalEnum, PromotedObjectType } from '@/services/launchAdq/enum'
 import React from 'react'
-import { Space } from 'antd'
-function tableConfig(callback:(data:any,type:'edit'|'look')=>void):any{
+import { Badge, Switch } from 'antd'
+function tableConfig():any{
     return [
         {
-            title: 'ID',
-            dataIndex: 'id',
-            key: 'id',
+            title: '启停',
+            dataIndex: 'qt',
+            key: 'qt',
             align: 'center',
-            width:70,
+            width:50,
+            fixed:'left',
+            render:(a:string)=>{
+                return <Switch /> 
+            }
+        },
+        {
+            title: '所属账号',
+            dataIndex: 'accountId',
+            key: 'accountId',
+            align: 'center',
+            width:90,
+            fixed:'left',
+            render:(a:string)=>{
+                return <a>{a}</a>
+            }
+        },
+        {
+            title: '广告ID',
+            dataIndex: 'adgroupId',
+            key: 'adgroupId',
+            align: 'center',
+            width:100,
+            fixed:'left',
+            render:(a:string)=>{
+                return <a>{a}</a>
+            }
+        },
+        {
+            title: '所属计划ID',
+            dataIndex: 'campaignId',
+            key: 'campaignId',
+            align: 'center',
+            width:100,
+            fixed:'left',
+            render:(a:string)=>{
+                return <a>{a}</a>
+            }
         },
         {
             title: '广告名称',
             dataIndex: 'adgroupName',
             key: 'adgroupName',
             align: 'center',
+            width:300,
         },
         {
-            title: '广告推广目标类型',
+            title: '推广目标类型',
             dataIndex: 'promotedObjectType',
             key: 'promotedObjectType',
             align: 'center',
+            width:130,
            render:(a: string | number)=>{
             return PromotedObjectType[a]
            } 
         },
+        {
+            title: '广告优化目标类型',
+            dataIndex: 'optimizationGoal',
+            key: 'optimizationGoal',
+            align: 'center',
+            width:130,
+           render:(a: string | number)=>{
+            return OptimizationGoalEnum[a]
+           } 
+        },
         {
             title: '投放日期',
             dataIndex: 'beginDate',
             key: 'beginDate',
             align: 'center',
+            width:160,
             render:(a: string,b: { endDate: string })=>{
                 return b?.endDate ? a+'~'+b.endDate : a+'~'+'长期投放'
             }
         },
         {
-            title: '广告出价',
+            title: '首日开始投放时间',
+            dataIndex: 'firstDayBeginTime',
+            key: 'firstDayBeginTime',
+            align: 'center',
+            width:130,
+        },
+        {
+            title: '广告出价(分)',
             dataIndex: 'bidAmount',
             key: 'bidAmount',
             align: 'center',  
+            width:130,
+        },
+        {
+            title: '广告组日预算(分)',
+            dataIndex: 'dailyBudget',
+            key: 'dailyBudget',
+            align: 'center',  
+            width:130,
+        },
+        {
+            title: '是否开启自动版位功能',
+            dataIndex: 'automaticSiteEnabled',
+            key: 'automaticSiteEnabled',
+            align: 'center', 
+            width:150,
+            render: (a: any, b: any) => {
+                return a? '开' : '关'
+            }
+        },
+        {
+            title: '是否已删除',
+            dataIndex: 'isDeleted',
+            key: 'isDeleted',
+            align: 'center',
+            width:100,
+            render: (a: any, b: any) => {
+                return  <Badge status={!a ? "processing" :"error" } text={a? '是' : '否'} />
+            }
         },
         {
             title: '创建时间',
-            dataIndex: 'createTime',
-            key: 'createTime',
+            dataIndex: 'createdTime',
+            key: 'createdTime',
             align: 'center',
+            width:160,
         },
         {
-            title:'操作',
-            dataIndex:'cz',
-            key: 'cz',
-            align: 'center',  
-            render:(a: any,b: any)=>{
-               return <Space>
-                    <a onClick={()=>{
-                        callback(b,'look')
-                    }}>详情</a>
-                </Space>
+            title: '客户设置的状态',
+            dataIndex: 'configuredStatus',
+            key: 'configuredStatus',
+            align: 'center',
+            width:130,
+            render:(a:string)=>{
+                return  <Badge status={a==='AD_STATUS_NORMAL' ? "processing" :"error" } text={ConfiguredStatusEnum[a]} />
+            }
+        },
+        {
+            title: '广告状态',
+            dataIndex: 'status',
+            key: 'status',
+            align: 'center',
+            width:70,
+            fixed:'right',
+            render:(a:string)=>{
+                return AdStatusEnum[a]
             }
-        }
+        },
     ]
 }
 export default tableConfig

+ 138 - 0
src/pages/launchSystemNew/adq/campaign/index.tsx

@@ -0,0 +1,138 @@
+
+import { useAjax } from '@/Hook/useAjax'
+import { CampaignTypeEnum, ConfiguredStatusEnum, PromotedObjectType } from '@/services/launchAdq/enum'
+import { Col, Row, Input, Select, Button, message } from 'antd'
+import React, { useEffect, useState, useCallback } from 'react'
+import TableData from '../../components/TableData'
+import tableConfig from './tableConfig'
+import { getAdqCampaignList, putAdqCampaignPage } from '@/services/launchAdq/adq'
+
+function Campaign(props: { accountId: string, adAccountId: string, userId: string }) {
+    let { accountId, adAccountId, userId } = props
+    // api方法
+    const listAjax = useAjax((params) => getAdqCampaignList(params), { formatResult: true })
+    const syncAjax = useAjax((adAccountId) => putAdqCampaignPage(adAccountId))
+    console.log('创意=====》')
+    useEffect(() => {
+        getList({ pageNum: 1, pageSize: 20 })
+    }, [accountId, userId])
+    // 获取列表
+    const getList = useCallback((params: {
+        pageNum: number;
+        pageSize: number;
+        userId?: string;//用户ID
+        accountId?: string;//账号本地ID
+        campaignName?: string;//计划名称
+        configuredStatus?: string;//计划状态
+        campaignType?: string;//计划类型
+        promotedObjectType?: string;//推广目标类型
+    }) => {
+        if (!params.campaignName || params.campaignName !== listAjax?.params[0]?.adcreativeName) {
+            !params.campaignName && delete params.campaignName
+            listAjax.run({ ...params, userId, accountId })
+        }
+    }, [accountId, userId, listAjax])
+    // 同步 
+    const sync = useCallback(() => {
+        if (!adAccountId) {
+            message.error('请先选择要同步的广点通账号!')
+            return
+        }
+        syncAjax.run(adAccountId).then(res => {
+            console.log(res)
+            res && listAjax.refresh()
+            res ? message.success('同步成功!') : message.error('同步失败!')
+
+        })
+    }, [adAccountId, listAjax])
+    return <div>
+        <TableData
+            columns={tableConfig}
+            ajax={listAjax}
+            syncAjax={sync}
+            dataSource={listAjax?.data?.data?.records}
+            loading={listAjax?.loading || syncAjax?.loading}
+            scroll={{ x: 2000 }}
+            total={listAjax?.data?.data?.total}
+            page={listAjax?.data?.data?.current}
+            pageSize={listAjax?.data?.data?.size}
+            myKey={'adcreativeId'}
+            leftChild={<>
+                <Row gutter={[10, 10]}>
+                    <Col>
+                        <Input
+                            placeholder='创意名称'
+                            allowClear
+                            onBlur={(e) => {
+                                let value = e.target.value
+                                getList({ pageNum: 1, pageSize: 20, campaignName: value })
+                            }}
+                            onKeyDownCapture={(e: any) => {
+                                let key = e.key
+                                if (key === 'Enter') {
+                                    let value = e.target.value
+                                    getList({ pageNum: 1, pageSize: 20, campaignName: value })
+                                }
+                            }}
+                            onChange={(e) => {
+                                let value = e.target.value
+                                if (!value) {
+                                    getList({ pageNum: 1, pageSize: 20, campaignName: value })
+                                }
+                            }}
+                        />
+                    </Col>
+                    <Col>
+                        <Select placeholder='推广目标选择' style={{ minWidth: 200 }} showSearch filterOption={(input: any, option: any) =>
+                            (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
+                        } allowClear onChange={(value: any) => {
+                            getList({ pageNum: 1, pageSize: 20, promotedObjectType:value })
+                        }}>
+                            {
+                                Object.keys(PromotedObjectType).map(key => {
+                                    // let obj = JSON.parse(PromotedObjectType[key])
+                                    return <Select.Option value={key} key={key}>{PromotedObjectType[key]}</Select.Option>
+                                })
+                            }
+                        </Select>
+                    </Col>
+                    <Col>
+                        <Select placeholder='计划状态' style={{ minWidth: 200 }} showSearch filterOption={(input: any, option: any) =>
+                            (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
+                        } allowClear onChange={(value: any) => {
+                            getList({ pageNum: 1, pageSize: 20, configuredStatus: value })
+                        }}>
+                            {
+                                Object.keys(ConfiguredStatusEnum).map(key => {
+                                    // let obj = JSON.parse(PromotedObjectType[key])
+                                    return <Select.Option value={key} key={key}>{ConfiguredStatusEnum[key]}</Select.Option>
+                                })
+                            }
+                        </Select>
+                    </Col>
+                    <Col>
+                        <Select placeholder='计划类型' style={{ minWidth: 200 }} showSearch filterOption={(input: any, option: any) =>
+                            (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
+                        } allowClear onChange={(value: any) => {
+                            getList({ pageNum: 1, pageSize: 20, campaignType: value })
+                        }}>
+                            {
+                                Object.keys(CampaignTypeEnum).map(key => {
+                                    // let obj = JSON.parse(PromotedObjectType[key])
+                                    console.log(key)
+                                    return <Select.Option value={key} key={key}>{CampaignTypeEnum[key]}</Select.Option>
+                                })
+                            }
+                        </Select>
+                    </Col>
+                </Row>
+            </>}
+            onChange={(props: any) => {
+                // let { sortData, pagination } = props
+                // let { current, pageSize } = pagination
+                // getList({ pageNum: current, pageSize })
+            }}
+        />
+    </div>
+}
+export default Campaign

+ 120 - 0
src/pages/launchSystemNew/adq/campaign/tableConfig.tsx

@@ -0,0 +1,120 @@
+import {  CampaignTypeEnum, ConfiguredStatusEnum, PromotedObjectType, SpeedMode } from '@/services/launchAdq/enum'
+import { Badge,Switch } from 'antd'
+import React from 'react'
+function tableConfig():any{
+    return [
+        {
+            title: '启停',
+            dataIndex: 'qt',
+            key: 'qt',
+            align: 'center',
+            width:50,
+            fixed:'left',
+            render:(a:string)=>{
+                return <Switch /> 
+            }
+        },
+        {
+            title: '所属账号',
+            dataIndex: 'accountId',
+            key: 'accountId',
+            align: 'center',
+            width:90,
+            fixed:'left',
+            render:(a:string)=>{
+                return <a>{a}</a>
+            }
+        },
+        {
+            title: '计划ID',
+            dataIndex: 'campaignId',
+            key: 'campaignId',
+            align: 'center',
+            width:100,
+            fixed:'left',
+            render:(a:string)=>{
+                return <a>{a}</a>
+            }
+        },
+        {
+            title: '计划名称',
+            dataIndex: 'campaignName',
+            key: 'campaignName',
+            align: 'center',
+            width:300,
+        },
+        {
+            title: '推广计划类型',
+            dataIndex: 'campaignType',
+            key: 'campaignType',
+            align: 'center',
+            width:130,
+           render:(a: string | number)=>{
+            return CampaignTypeEnum[a]
+           } 
+        },
+        {
+            title: '推广目标类型',
+            dataIndex: 'promotedObjectType',
+            key: 'promotedObjectType',
+            align: 'center',
+            width:130,
+           render:(a: string | number)=>{
+            return PromotedObjectType[a]
+           } 
+        },
+        {
+            title: '投放速度模式',
+            dataIndex: 'speedMode',
+            key: 'speedMode',
+            align: 'center',
+            width:130,
+           render:(a: string | number)=>{
+            return SpeedMode[a]
+           } 
+        },
+        {
+            title: '广告组日预算(分)',
+            dataIndex: 'dailyBudget',
+            key: 'dailyBudget',
+            align: 'center',  
+            width:130,
+        },
+        {
+            title: '推广计划总预算(分)',
+            dataIndex: 'totalBudget',
+            key: 'totalBudget',
+            align: 'center',  
+            width:130,
+        },
+        {
+            title: '是否已删除',
+            dataIndex: 'isDeleted',
+            key: 'isDeleted',
+            align: 'center',
+            width:100,
+            render: (a: any, b: any) => {
+                return  <Badge status={!a ? "processing" :"error" } text={a? '是' : '否'} />
+            }
+        },
+        {
+            title: '创建时间',
+            dataIndex: 'createdTime',
+            key: 'createdTime',
+            align: 'center',
+            width:160,
+        },
+        {
+            title: '计划状态',
+            dataIndex: 'configuredStatus',
+            key: 'configuredStatus',
+            align: 'center',
+            width:70,
+            fixed:'right',
+            render:(a:string)=>{
+                return  <Badge status={a==='AD_STATUS_NORMAL' ? "processing" :"error" } text={ConfiguredStatusEnum[a]} />
+            }
+        },
+    ]
+}
+export default tableConfig

+ 11 - 6
src/pages/launchSystemNew/adq/creative/index.tsx

@@ -7,14 +7,15 @@ import TableData from '../../components/TableData'
 import tableConfig from './tableConfig'
 import { getAdqAdcreativeList, putAdqTargetingSyncAll } from '@/services/launchAdq/adq'
 
-function Creative(props: { accountId: string, adAccountId: string }) {
-    let { accountId, adAccountId } = props
+function Creative(props: { accountId: string, adAccountId: string ,userId:string}) {
+    let { accountId, adAccountId,userId } = props
     // api方法
     const listAjax = useAjax((params) => getAdqAdcreativeList(params), { formatResult: true })
     const syncAjax = useAjax((adAccountId) => putAdqTargetingSyncAll(adAccountId))
+    console.log('创意=====》')
     useEffect(() => {
         getList({ pageNum: 1, pageSize: 20 })
-    }, [accountId])
+    }, [accountId,userId])
     // 获取列表
     const getList = useCallback((params: {
         pageNum: number;
@@ -24,11 +25,15 @@ function Creative(props: { accountId: string, adAccountId: string }) {
     }) => {
         if (!params.adcreativeName || params.adcreativeName !== listAjax?.params[0]?.adcreativeName) {
             !params.adcreativeName && delete params.adcreativeName
-            accountId && listAjax.run({ ...params, accountId })
+            listAjax.run({ ...params,userId, accountId })
         }
-    }, [accountId])
+    }, [accountId,userId,listAjax])
     // 同步 
     const sync = useCallback(() => {
+        if(!adAccountId){
+            message.error('请先选择要同步的广点通账号!')
+            return
+        }
         syncAjax.run(adAccountId).then(res => {
             console.log(res)
             res && listAjax.refresh()
@@ -43,7 +48,7 @@ function Creative(props: { accountId: string, adAccountId: string }) {
             syncAjax={sync}
             dataSource={listAjax?.data?.data?.records}
             loading={listAjax?.loading || syncAjax?.loading}
-            scroll={{ x: 2000 }}
+            // scroll={{ x: 2000 }}
             total={listAjax?.data?.data?.total}
             page={listAjax?.data?.data?.current}
             pageSize={listAjax?.data?.data?.size}

+ 227 - 208
src/pages/launchSystemNew/adq/creative/tableConfig.tsx

@@ -3,61 +3,77 @@ import React from 'react'
 import { Space } from 'antd'
 function tableConfig(): any {
     return [
+        {
+            title: '所属账号',
+            dataIndex: 'accountId',
+            key: 'accountId',
+            align: 'center',
+            width:70,
+            render:(a:string)=>{
+                return <a>{a}</a>
+            }
+        },
         {
             title: '创意ID',
             dataIndex: 'adcreativeId',
             key: 'adcreativeId',
             align: 'center',
-            width: 70
+            width: 70,
+            render:(a:string)=>{
+                return <a>{a}</a>
+            }
         },
         {
-            title: '计划ID',
+            title: '所属计划ID',
             dataIndex: 'campaignId',
             key: 'campaignId',
             align: 'center',
-            width: 70
-        },
-        {
-            title: '附加创意组件ID',
-            dataIndex: 'componentId',
-            key: 'componentId',
-            align: 'center',
-            width: 70
-        },
-        {
-            title: '互动推广页落地页ID',
-            dataIndex: 'playablePageMaterialId',
-            key: 'playablePageMaterialId',
-            align: 'center',
-            width: 70
-        },
-        {
-            title: '朋友圈头像昵称跳转页ID',
-            dataIndex: 'profileId',
-            key: 'profileId',
-            align: 'center',
-            width: 70
+            width: 70,
+            render:(a:string)=>{
+                return <a>{a}</a>
+            }
         },
+        // {
+        //     title: '附加创意组件ID',
+        //     dataIndex: 'componentId',
+        //     key: 'componentId',
+        //     align: 'center',
+        //     width: 120
+        // },
+        // {
+        //     title: '互动推广页落地页ID',
+        //     dataIndex: 'playablePageMaterialId',
+        //     key: 'playablePageMaterialId',
+        //     align: 'center',
+        //     width: 140
+        // },
+        // {
+        //     title: '朋友圈头像昵称跳转页ID',
+        //     dataIndex: 'profileId',
+        //     key: 'profileId',
+        //     align: 'center',
+        //     width: 170
+        // },
         {
             title: '创意名称',
             dataIndex: 'adcreativeName',
             key: 'adcreativeName',
             align: 'center',
         },
-        {
-            title: '创意形式类型',
-            dataIndex: 'creativeTemplateCategory',
-            key: 'creativeTemplateCategory',
-            align: 'center',
-        },
-        {
-            title: 'QQ小游戏监控参数',
-            dataIndex: 'qqMiniGameTrackingQueryString',
-            key: 'qqMiniGameTrackingQueryString',
-            align: 'center',
-        },
-        {
-            title: '广告推广目标类型',
+        // {
+        //     title: '创意形式类型',
+        //     dataIndex: 'creativeTemplateCategory',
+        //     key: 'creativeTemplateCategory',
+        //     align: 'center',
+        // },
+        // {
+        //     title: 'QQ小游戏监控参数',
+        //     dataIndex: 'qqMiniGameTrackingQueryString',
+        //     key: 'qqMiniGameTrackingQueryString',
+        //     align: 'center',
+        // },
+        {
+            title: '推广目标类型',
             dataIndex: 'promotedObjectType',
             key: 'promotedObjectType',
             align: 'center',
@@ -65,102 +81,105 @@ function tableConfig(): any {
                 return PromotedObjectType[a]
             }
         },
-        {
-            title: '推广目标ID',
-            dataIndex: 'promotedObjectId',
-            key: 'promotedObjectId',
-            align: 'center',
-        },
-        {
-            title: '落地页类型',
-            dataIndex: 'pageType',
-            key: 'pageType',
-            align: 'center',
-            render: (a: string) => {
-                return PageTypeEnum[a]
-            }
-        },
-        {
-            title: '落地页类型',
-            dataIndex: 'playablePageMaterialId',
-            key: 'playablePageMaterialId',
-            align: 'center',
-            render: (a: string) => {
-                return PageTypeEnum[a]
-            }
-        },
-        {
-            title: '简版原生页子类型',
-            dataIndex: 'simpleCanvasSubType',
-            key: 'simpleCanvasSubType',
-            align: 'center',
-            render: (a: string) => {
-                return PageTypeEnum[a]
-            }
-        },
-        {
-            title: '创意来源',
-            dataIndex: 'source',
-            key: 'source',
-            align: 'center',
-            render: (a: string) => {
-                return SourceEnum[a]
-            }
-        },
-        {
-            title: '数据版本类型',
-            dataIndex: 'creativeTemplateVersionType',
-            key: 'creativeTemplateVersionType',
-            align: 'center',
-            render: (a: string) => {
-                return CreativeTemplateVersionTypeEnum[a]
-            }
-        },
-        {
-            title: '是否支持版位突破',
-            dataIndex: 'enableBreakthroughSiteset',
-            key: 'enableBreakthroughSiteset',
-            align: 'center',
-            // render: (a: string) => {
-            //     return PageTypeEnum[a]
-            // }
-        },
-        {
-            title: '应用直达页URL',
-            dataIndex: 'deepLinkUrl',
-            key: 'deepLinkUrl',
-            align: 'center',
-        },
-        {
-            title: '通用链接页URL',
-            dataIndex: 'universalLinkUrl',
-            key: 'universalLinkUrl',
-            align: 'center',
-        },
-        {
-            title: '简易原生页嵌入',
-            dataIndex: 'webviewUrl',
-            key: 'webviewUrl',
-            align: 'center',
-        },
-        {
-            title: '头像点击跳转信息',
-            dataIndex: 'headClickType',
-            key: 'headClickType',
-            align: 'center',
-            render: (a: string) => {
-                return HeadClickTypeEnum[a]
-            }
-        },
-        {
-            title: '链接名称类型',
-            dataIndex: 'linkNameType',
-            key: 'linkNameType',
-            align: 'center',
-            render: (a: string) => {
-                return LinkPageNameTypeEnum[a]
-            }
-        },
+        // {
+        //     title: '推广目标ID',
+        //     dataIndex: 'promotedObjectId',
+        //     key: 'promotedObjectId',
+        //     align: 'center',
+        // },
+        // {
+        //     title: '落地页类型',
+        //     dataIndex: 'pageType',
+        //     key: 'pageType',
+        //     align: 'center',
+        //     render: (a: string) => {
+        //         return PageTypeEnum[a]
+        //     }
+        // },
+        // {
+        //     title: '互动推广页落地页 id',
+        //     dataIndex: 'playablePageMaterialId',
+        //     key: 'playablePageMaterialId',
+        //     align: 'center',
+        //     // render: (a: string) => {
+        //     //     return PageTypeEnum[a]
+        //     // }
+        // },
+        // {
+        //     title: '简版原生页子类型',
+        //     dataIndex: 'simpleCanvasSubType',
+        //     key: 'simpleCanvasSubType',
+        //     align: 'center',
+        //     // render: (a: string) => {
+        //     //     return PageTypeEnum[a]
+        //     // }
+        // },
+        // {
+        //     title: '创意来源',
+        //     dataIndex: 'source',
+        //     key: 'source',
+        //     align: 'center',
+        //     // render: (a: string) => {
+        //     //     return SourceEnum[a]
+        //     // }
+        // },
+        // {
+        //     title: '数据版本类型',
+        //     dataIndex: 'creativeTemplateVersionType',
+        //     key: 'creativeTemplateVersionType',
+        //     align: 'center',
+        //     // render: (a: string) => {
+        //     //     return CreativeTemplateVersionTypeEnum[a]
+        //     // }
+        // },
+        // {
+        //     title: '是否支持版位突破',
+        //     dataIndex: 'enableBreakthroughSiteset',
+        //     key: 'enableBreakthroughSiteset',
+        //     align: 'center',
+        //     render: (a: any, b: any) => {
+        //         return a? '是' : '否'
+        //     }
+        //     // render: (a: string) => {
+        //     //     return PageTypeEnum[a]
+        //     // }
+        // },
+        // {
+        //     title: '应用直达页URL',
+        //     dataIndex: 'deepLinkUrl',
+        //     key: 'deepLinkUrl',
+        //     align: 'center',
+        // },
+        // {
+        //     title: '通用链接页URL',
+        //     dataIndex: 'universalLinkUrl',
+        //     key: 'universalLinkUrl',
+        //     align: 'center',
+        // },
+        // {
+        //     title: '简易原生页嵌入',
+        //     dataIndex: 'webviewUrl',
+        //     key: 'webviewUrl',
+        //     align: 'center',
+        // },
+        // {
+        //     title: '头像点击跳转信息',
+        //     dataIndex: 'headClickType',
+        //     key: 'headClickType',
+        //     align: 'center',
+        //     render: (a: string) => {
+        //         return HeadClickTypeEnum[a]
+        //     }
+        // },
+        // {
+        //     title: '链接名称类型',
+        //     dataIndex: 'linkNameType',
+        //     key: 'linkNameType',
+        //     align: 'center',
+        //     render: (a: string) => {
+        //         return LinkPageNameTypeEnum[a]
+        //     }
+        // },
         {
             title: '跳转落地页类型',
             dataIndex: 'linkPageType',
@@ -170,48 +189,48 @@ function tableConfig(): any {
                 return LinkPageTypeEnum[a]
             }
         },
-        {
-            title: '挂件图',
-            dataIndex: 'marketingPendantImageId',
-            key: 'marketingPendantImageId',
-            align: 'center'
-        },
-        {
-            title: '页面级转化跟踪URL',
-            dataIndex: 'pageTrackUrl',
-            key: 'pageTrackUrl',
-            align: 'center'
-        },
-        {
-            title: '页面级转化跟踪URL',
-            dataIndex: 'pageTrackUrl',
-            key: 'pageTrackUrl',
-            align: 'center'
-        },
+        // {
+        //     title: '挂件图',
+        //     dataIndex: 'marketingPendantImageId',
+        //     key: 'marketingPendantImageId',
+        //     align: 'center'
+        // },
+        // {
+        //     title: '页面级转化跟踪URL',
+        //     dataIndex: 'pageTrackUrl',
+        //     key: 'pageTrackUrl',
+        //     align: 'center'
+        // },
+        // {
+        //     title: '页面级转化跟踪URL',
+        //     dataIndex: 'pageTrackUrl',
+        //     key: 'pageTrackUrl',
+        //     align: 'center'
+        // },
         {
             title: '创意形式ID',
             dataIndex: 'adcreativeTemplateId',
             key: 'adcreativeTemplateId',
             align: 'center',
         },
-        {
-            title: '是否开启自动版位功能',
-            dataIndex: 'automaticSiteEnabled',
-            key: 'automaticSiteEnabled',
-            align: 'center',
-            render: (a: any, b: any) => {
-                return a? '开' : '关'
-            }
-        },
-        {
-            title: '数据展示',
-            dataIndex: 'conversionDataType',
-            key: 'conversionDataType',
-            align: 'center',
-            render: (a: any, b: any) => {
-                return b.conversionDataType || b.conversionTargetType ? '开' : '关'
-            }
-        },
+        // {
+        //     title: '是否开启自动版位功能',
+        //     dataIndex: 'automaticSiteEnabled',
+        //     key: 'automaticSiteEnabled',
+        //     align: 'center',
+        //     render: (a: any, b: any) => {
+        //         return a? '开' : '关'
+        //     }
+        // },
+        // {
+        //     title: '数据展示',
+        //     dataIndex: 'conversionDataType',
+        //     key: 'conversionDataType',
+        //     align: 'center',
+        //     render: (a: any, b: any) => {
+        //         return b.conversionDataType || b.conversionTargetType ? '开' : '关'
+        //     }
+        // },
         {
             title: '行动开关',
             dataIndex: 'linkNameType',
@@ -221,46 +240,46 @@ function tableConfig(): any {
                 return b.linkNameType || b.linkPageType ? '开' : '关'
             }
         },
-        {
-            title: '倒计时组件开关',
-            dataIndex: 'countdownSwitch',
-            key: 'countdownSwitch',
-            align: 'center',
-            render: (a: any, b: any) => {
-                return a? '开' : '关'
-            }
-        },
-        {
-            title: '视频广告评论开关',
-            dataIndex: 'feedsVideoCommentSwitch',
-            key: 'feedsVideoCommentSwitch',
-            align: 'center',
-            render: (a: any, b: any) => {
-                return a? '开' : '关'
-            }
-        },
-        {
-            title: '是否已删除',
-            dataIndex: 'isDeleted',
-            key: 'isDeleted',
-            align: 'center',
-            render: (a: any, b: any) => {
-                return a? '是' : '否'
-            }
-        },
-        {
-            title: '动态创意广告自动生成',
-            dataIndex: 'isDynamicCreative',
-            key: 'isDynamicCreative',
-            align: 'center',
-            render: (a: any, b: any) => {
-                return a? '是' : '否'
-            }
-        },
+        // {
+        //     title: '倒计时组件开关',
+        //     dataIndex: 'countdownSwitch',
+        //     key: 'countdownSwitch',
+        //     align: 'center',
+        //     render: (a: any, b: any) => {
+        //         return a? '开' : '关'
+        //     }
+        // },
+        // {
+        //     title: '视频广告评论开关',
+        //     dataIndex: 'feedsVideoCommentSwitch',
+        //     key: 'feedsVideoCommentSwitch',
+        //     align: 'center',
+        //     render: (a: any, b: any) => {
+        //         return a? '开' : '关'
+        //     }
+        // },
+        // {
+        //     title: '是否已删除',
+        //     dataIndex: 'isDeleted',
+        //     key: 'isDeleted',
+        //     align: 'center',
+        //     render: (a: any, b: any) => {
+        //         return a? '是' : '否'
+        //     }
+        // },
+        // {
+        //     title: '动态创意广告自动生成',
+        //     dataIndex: 'isDynamicCreative',
+        //     key: 'isDynamicCreative',
+        //     align: 'center',
+        //     render: (a: any, b: any) => {
+        //         return a? '是' : '否'
+        //     }
+        // },
         {
             title: '创建时间',
-            dataIndex: 'createTime',
-            key: 'createTime',
+            dataIndex: 'createdTime',
+            key: 'createdTime',
             align: 'center',
         },
     ]

+ 69 - 66
src/pages/launchSystemNew/adq/index.tsx

@@ -1,100 +1,103 @@
-import React, { useState, useEffect, useCallback } from 'react'
-import { Button, Card, Col, Menu, Row, Tabs } from 'antd';
+import React, { useState, useEffect } from 'react'
+import {  Card, Col, Menu, Row, Select, Tabs } from 'antd';
 // import './index.less'
+import Campaign from './campaign';
 import Ad from './ad';
 import Creative from './creative';
 import LandingPage from './landingPage';
 import { getAdAccountAllOfMember } from '@/services/launchAdq/adq';
 import Targeting from './targeting';
+import { useAjax } from '@/Hook/useAjax';
+import { IdcardFilled } from '@ant-design/icons';
 import { useModel } from 'umi';
 const { TabPane } = Tabs;
 let Menus: any = Menu
 const tabsConfig = [
     { key: '1', tab: '账户信息', jsx: () => null },
-    { key: '2', tab: '计划', jsx: () => null },
+    { key: '2', tab: '计划', jsx:(props: any) => <Campaign {...props} />},
     { key: '3', tab: '广告', jsx: (props: any) => <Ad {...props} /> },
     { key: '4', tab: '创意', jsx: (props: any) => <Creative {...props} /> },
     { key: '5', tab: '落地页', jsx: (props: any) => <LandingPage {...props} /> },
     { key: '6', tab: '定向', jsx: (props: any) => <Targeting {...props} /> },
 ]
 function Adq() {
-    const { getAdAccount } = useModel('useLaunchAdq.useAdAuthorize')
-    const [activeKey, setActiveKey] = useState('6')
-    const [menuKey, setmenuKey] = useState(['1'])
-    const [childrenObj, setChildrenObj] = useState<any>({})
-    const [accountId, setaccountId] = useState<any>()
-    const [idS,setIds]=useState({//需要用到的accountId,adAccountId
-        accountId:'',
-        adAccountId:''
+    const userInfo = useModel('@@initialState', model => model.initialState?.currentUser)
+    const allOfMember = useAjax(() => getAdAccountAllOfMember(), { formatResult: true })
+    const [userAll, setUserAll] = useState([])
+    const [activeKey, setActiveKey] = useState('2')
+    const [userId, setUserId] = useState<any>('1'||userInfo?.userId?.toString())
+    const [selectedArr, setSelectedArr] = useState([])
+    const [idS, setIds] = useState({//需要用到的accountId,adAccountId
+        accountId: '',
+        adAccountId: ''
     })
-    const all = useCallback(()=>{
-        getAdAccountAllOfMember()
-    },[])
     useEffect(() => {
-        // 获取账号列表
-        let name = menuKey[0]
-        console.log(name)
-        if (name && !childrenObj[name]) {
-            getAdAccount?.run().then(res => {
-                if (res.data) {
-                    setChildrenObj({
-                        ...childrenObj,
-                        [name]: res.data?.map((item: { accountId: any; id:number}) => {
-                            return { key: item.accountId+'_'+item.id, label: item.accountId + '_' + item.id, }
+        allOfMember.run().then(res => {
+            if (res?.data) {
+                let useAll: any = []
+                res?.data?.forEach((item: { key: { userId: any; nickName: any; }; value: any[]; }) => {
+                    let obj = {
+                        key: item.key.userId,
+                        label: item.key.nickName,
+                        icon: <IdcardFilled />,
+                    }
+                    if (item?.value) {
+                        obj['childrenarr'] = item?.value?.map(item => {
+                            return { key: item.accountId + '_' + item.id, label: item.accountId }
                         })
-                    })
-                    setaccountId(res.data[0].accountId+'_'+res.data[0].id)
-                    setIds({
-                        accountId:res.data[0].accountId,
-                        adAccountId:res.data[0].id
-                    })
-                }
-            })
+                    }
+                    useAll.push(obj)
+                })
+                setUserAll(useAll)
+            }
+        })
+    }, [])
+    useEffect(() => {
+        if (userAll.length > 0 && userId) {
+            let newArr: any = userAll?.filter((item: any) => item.key == userId)
+            setSelectedArr(newArr[0]?.childrenarr || [])
         }
-    }, [menuKey, childrenObj])
-    // const children = useMemo(()=>{
-    //     return getAdAccount?.data?.data?.map((item: { accountId: any; })=>{
-    //         return {key:item.accountId,label:item.accountId+'_'+menuKey[0],}
-    //     })
-
-    // },[menuKey])
-    
-    return <Row >
-        <Col span={3} style={{ height: 'calc(100vh - 150px)' }}>
+    }, [userAll, userId])
+    console.log('selectedArr===>', selectedArr)
+    return <Row style={{ position: 'relative' }}>
+        <Col style={{ height: '100%', overflowY: 'auto', position: 'absolute', left: 0, top: 0, bottom: 0, width: 150, background: '#fff' }}>
             <Menus
                 theme='light'
-                onClick={(e: any) => {
-                    let arr = e.key.split('_')
-                    let accountId = arr[0]
-                    let adAccountId = arr[1]
-                    setIds({accountId,adAccountId})
-                    setaccountId(e.key)
+                onClick={(e: any) => {//点击菜单
+                    setUserId(e.key)
                 }}
-                onOpenChange={(openKeys: any) => {
-                    setmenuKey(openKeys?.length > 1 ? openKeys.filter((k: any, i: any) => i === 1) : openKeys)
-                }}
-
-                // style={{ width: 256 }}
-                selectedKeys={accountId}
+                selectedKeys={userId}
                 mode="inline"
                 multiple={false}
-                openKeys={menuKey}
-                items={[
-                    {
-                        key: 1,
-                        label: '沈武',
-                        children: childrenObj[1] || []
-                    },
-                ]}
+                items={userAll}
             />
         </Col>
-        <Col span={21}>
-            <Card extra={<Button type='primary' onClick={all}>组员接口请求</Button>}>
-                <Tabs activeKey={activeKey} type="card" onChange={(activeKey) => { setActiveKey(activeKey) }} >
+        <Col span={21} style={{ marginLeft: 150 }}>
+            <Card>
+                <Tabs activeKey={activeKey} type="card" onChange={(activeKey) => { setActiveKey(activeKey) }} tabBarExtraContent={
+                    <Select placeholder='广点通账号' style={{ minWidth: 200 }} showSearch filterOption={(input: any, option: any) =>
+                        (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
+                    } allowClear onChange={(value: any) => {
+                        let accountId = ''
+                        let adAccountId = ''
+                        if (value) {
+                            let arr = value.split('_')
+                            accountId = arr[0]
+                            adAccountId = arr[1]
+                        }
+                        setIds({ accountId, adAccountId })
+                    }} >
+                        {
+                            selectedArr?.map((item: any) => {
+                                return <Select.Option value={item.key} key={item.key}>{item.label}</Select.Option>
+                            })
+                        }
+                    </Select>
+                }>
                     {
                         tabsConfig?.map(item => {
                             return <TabPane tab={item.tab} key={item.key} >
-                                {item.jsx(idS)}
+                                {activeKey=== item.key && item.jsx({...idS, userId })}
                             </TabPane>
                         })
                     }

+ 16 - 11
src/pages/launchSystemNew/adq/landingPage/index.tsx

@@ -5,10 +5,11 @@ import { getAdqLandingPageList, putAdqLandingPage } from '@/services/launchAdq/a
 import TableData from '../../components/TableData'
 import tableConfig from './tableConfig'
 
-function LandingPage(props: { accountId: string, adAccountId: string }) {
-    let { accountId, adAccountId } = props
+function LandingPage(props: { accountId: string, adAccountId: string, userId: string }) {
+    let { accountId, adAccountId, userId } = props
     const listAjax = useAjax((params) => getAdqLandingPageList(params), { formatResult: true })
     const syncAjax = useAjax((adAccountId) => putAdqLandingPage(adAccountId))
+    console.log('落地页=====》')
     useEffect(() => {
         getList({ pageNum: 1, pageSize: 20 })
     }, [accountId])
@@ -22,21 +23,25 @@ function LandingPage(props: { accountId: string, adAccountId: string }) {
         pageTemplateId?: string;
         pageStatus?: string;
     }) => {
-        if(!params.pageName || params.pageName!== listAjax?.params[0]?.pageName){
-            !params.pageName &&  delete params.pageName
-            accountId &&  listAjax.run({ ...params, accountId })
+        if (!params.pageName || params.pageName !== listAjax?.params[0]?.pageName) {
+            !params.pageName && delete params.pageName
+            listAjax.run({ ...params, userId, accountId })
         }
-    }, [accountId,listAjax])
+    }, [accountId, listAjax, userId])
     // 同步 
     const sync = useCallback(() => {
+        if(!adAccountId){
+            message.error('请先选择要同步的广点通账号!')
+            return
+        }
         syncAjax.run(adAccountId).then(res => {
             console.log(res)
             res && listAjax.refresh()
-            res? message.success('同步成功!') : message.error('同步失败!')
+            res ? message.success('同步成功!') : message.error('同步失败!')
 
         })
     }, [adAccountId, listAjax])
-   
+
     return <div>
         <TableData
             columns={tableConfig}
@@ -57,19 +62,19 @@ function LandingPage(props: { accountId: string, adAccountId: string }) {
                             allowClear
                             onBlur={(e) => {
                                 let value = e.target.value
-                                getList({ pageNum: 1, pageSize: 20,pageName:value })
+                                getList({ pageNum: 1, pageSize: 20, pageName: value })
                             }}
                             onKeyDownCapture={(e: any) => {
                                 let key = e.key
                                 if (key === 'Enter') {
                                     let value = e.target.value
-                                    getList({ pageNum: 1, pageSize: 20,pageName:value })
+                                    getList({ pageNum: 1, pageSize: 20, pageName: value })
                                 }
                             }}
                             onChange={(e) => {
                                 let value = e.target.value
                                 if (!value) {
-                                    getList({ pageNum: 1, pageSize: 20,pageName:value })
+                                    getList({ pageNum: 1, pageSize: 20, pageName: value })
                                 }
                             }}
                         />

+ 35 - 22
src/pages/launchSystemNew/adq/landingPage/tableConfig.tsx

@@ -4,11 +4,24 @@ import { Badge, Space } from 'antd'
 function tableConfig(): any {
     return [
         {
-            title: 'ID',
+            title: '所属账号',
+            dataIndex: 'accountId',
+            key: 'accountId',
+            align: 'center',
+            width:70,
+            render:(a:string)=>{
+                return <a>{a}</a>
+            }
+        },
+        {
+            title: '落地页ID',
             dataIndex: 'pageId',
             key: 'pageId',
             align: 'center',
-            width:100
+            width:100,
+            render:(a:string)=>{
+                return <a>{a}</a>
+            }
         },
         {
             title: '落地页名称',
@@ -16,16 +29,16 @@ function tableConfig(): any {
             key: 'pageName',
             align: 'center',
         },
-        {
-            title: '原生页类型',
-            dataIndex: 'canvasType',
-            key: 'canvasType',
-            align: 'center',
-            width:110,
-            render: (a: string | number) => {
-                return CanvasTypeEnum[a]
-            }
-        },
+        // {
+        //     title: '原生页类型',
+        //     dataIndex: 'canvasType',
+        //     key: 'canvasType',
+        //     align: 'center',
+        //     width:110,
+        //     render: (a: string | number) => {
+        //         return CanvasTypeEnum[a]
+        //     }
+        // },
         {
             title: '落地页类型',
             dataIndex: 'pageType',
@@ -56,16 +69,16 @@ function tableConfig(): any {
                 return SourceTypeEnum[a]
             }
         },
-        {
-            title: '微信原生页视频资源状态',
-            dataIndex: 'videoResourceStatus',
-            key: 'videoResourceStatus',
-            align: 'center',
-            width:160,
-            render: (a: any, b: any) => {
-                return  <Badge status={a === 'VIDEO_RESOURCE_STATUS_VALID' ? "processing" :a === 'VIDEO_RESOURCE_STATUS_PENDING'? "warning" :"error" } text={VideoResourceStatusEnum[a]} />
-            }
-        },
+        // {
+        //     title: '微信原生页视频资源状态',
+        //     dataIndex: 'videoResourceStatus',
+        //     key: 'videoResourceStatus',
+        //     align: 'center',
+        //     width:160,
+        //     render: (a: any, b: any) => {
+        //         return  <Badge status={a === 'VIDEO_RESOURCE_STATUS_VALID' ? "processing" :a === 'VIDEO_RESOURCE_STATUS_PENDING'? "warning" :"error" } text={VideoResourceStatusEnum[a]} />
+        //     }
+        // },
         {
             title: '创建时间',
             dataIndex: 'createdTime',

+ 19 - 26
src/pages/launchSystemNew/adq/targeting/index.tsx

@@ -1,17 +1,18 @@
-import React, { useEffect, useCallback } from 'react'
+import React, { useEffect, useCallback, useState } from 'react'
 import { Col, Input, message, Row } from 'antd'
 import { useAjax } from '@/Hook/useAjax'
 import { getAdqTargetingList, putAdqTargetingSyncAll } from '@/services/launchAdq/adq'
 import TableData from '../../components/TableData'
 import tableConfig from './tableConfig'
 
-function Targeting(props: { accountId: string, adAccountId: string }) {
-    let { accountId, adAccountId } = props
+function Targeting(props: { adAccountId: any, userId: string, accountId: any }) {
+    let { accountId, adAccountId, userId } = props
     const listAjax = useAjax((params) => getAdqTargetingList(params), { formatResult: true })
     const syncAjax = useAjax((adAccountId) => putAdqTargetingSyncAll(adAccountId))
+    console.log('定向=====》')
     useEffect(() => {
         getList({ pageNum: 1, pageSize: 20 })
-    }, [accountId])
+    }, [userId, accountId])
     // 获取列表
     const getList = useCallback((params: {
         pageNum: number;
@@ -19,17 +20,22 @@ function Targeting(props: { accountId: string, adAccountId: string }) {
         accountId?: string;
         targetingName?: string;
     }) => {
-        if(!params.targetingName || params.targetingName!== listAjax?.params[0]?.targetingName){
-            !params.targetingName &&  delete params.targetingName
-            accountId &&  listAjax.run({ ...params, accountId })
+        console.log(accountId)
+        if (!params.targetingName || params.targetingName !== listAjax?.params[0]?.targetingName) {
+            !params.targetingName && delete params.targetingName
+            listAjax.run({ ...params, userId, accountId })
         }
-    }, [accountId])
+    }, [accountId,listAjax,userId])
     // 同步 
     const sync = useCallback(() => {
+        if(!adAccountId){
+            message.error('请先选择要同步的广点通账号!')
+            return
+        }
         syncAjax.run(adAccountId).then(res => {
             console.log(res)
             res && listAjax.refresh()
-            res? message.success('同步成功!') : message.error('同步失败!')
+            res ? message.success('同步成功!') : message.error('同步失败!')
 
         })
     }, [adAccountId, listAjax])
@@ -53,37 +59,24 @@ function Targeting(props: { accountId: string, adAccountId: string }) {
                             allowClear
                             onBlur={(e) => {
                                 let value = e.target.value
-                                getList({ pageNum: 1, pageSize: 20,targetingName:value })
+                                getList({ pageNum: 1, pageSize: 20,  targetingName: value })
                             }}
                             onKeyDownCapture={(e: any) => {
                                 let key = e.key
                                 if (key === 'Enter') {
                                     let value = e.target.value
-                                    getList({ pageNum: 1, pageSize: 20,targetingName:value })
+                                    getList({ pageNum: 1, pageSize: 20, targetingName: value })
                                 }
                             }}
                             onChange={(e) => {
                                 let value = e.target.value
                                 if (!value) {
-                                    getList({ pageNum: 1, pageSize: 20,targetingName:value })
+                                    getList({ pageNum: 1, pageSize: 20, targetingName: value })
                                 }
                             }}
                         />
+
                     </Col>
-                    {/* <Col>
-                        <Select placeholder='推广目标选择' style={{ minWidth: 200 }} showSearch filterOption={(input: any, option: any) =>
-                            (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
-                        } allowClear onChange={(value: any) => {
-                            getList({ pageNum: 1, pageSize: 20, accountId})
-                        }}>
-                            {
-                                Object.keys(PromotedObjectType).map(key => {
-                                    // let obj = JSON.parse(PromotedObjectType[key])
-                                    return <Select.Option value={key} key={key}>{PromotedObjectType[key]}</Select.Option>
-                                })
-                            }
-                        </Select>
-                    </Col> */}
                 </Row>
             </>}
             onChange={(props: any) => {

+ 15 - 2
src/pages/launchSystemNew/adq/targeting/tableConfig.tsx

@@ -4,11 +4,24 @@ import { Badge, Tooltip } from 'antd'
 function tableConfig(): any {
     return [
         {
-            title: 'ID',
+            title: '所属账号',
+            dataIndex: 'accountId',
+            key: 'accountId',
+            align: 'center',
+            width:70,
+            render:(a:string)=>{
+                return <a>{a}</a>
+            }
+        },
+        {
+            title: '定向ID',
             dataIndex: 'targetingId',
             key: 'targetingId',
             align: 'center',
-            width: 100
+            width: 100,
+            render:(a:string)=>{
+                return <a>{a}</a>
+            }
         },
         {
             title: '定向名称',

+ 37 - 11
src/services/launchAdq/adq.ts

@@ -15,6 +15,38 @@ export async function getAdAccountAllOfMember() {
 //     }
 //   }).then(res=>res.json())
 // }
+
+/**
+ * 获取ADQ计划列表
+ * @param adgroupName 广告名称
+ * @param promotedObjectType 广告类型
+ * @param accountId 账户ID
+ * @param adgroupName 广告名称
+ */
+ export async function getAdqCampaignList(params: {
+  pageNum: number;
+  pageSize: number;
+  userId?:string;//用户ID
+  accountId?: string;//账号本地ID
+  campaignName?:string;//计划名称
+  configuredStatus?:string;//计划状态
+  campaignType?:string;//计划类型
+  promotedObjectType?:string;//推广目标类型
+}) {
+  return request(api + '/adq/campaign/list', {
+    method: 'POST',
+    data: params,
+  });
+}
+/**
+ * 按账号同步计划
+ * @param adAccountId 本地ID
+ */
+ export async function putAdqCampaignPage(adAccountId: any) {
+  return request(api + `/adq/campaign/syncAll/${adAccountId} `, {
+    method: 'PUT',
+  });
+}
 /**
  * 获取ADQ广告列表
  * @param adgroupName 广告名称
@@ -35,18 +67,12 @@ export async function getAdAccountAllOfMember() {
 }
 /**
  * 同步ADQ广告列表
- * @param accountId 账户ID
- * @param adgroupIds id列表
- * @param lastModifiedTime 时间 yyyy
+ *@param adAccountId 本地ID
  */
- export async function putAdqAdgroupsSync(params: {
-  adgroupIds?: any[];
-  accountId: string;
-  lastModifiedTime?:string
-}) {
-  return request(api + '/adgroups/sync', {
-    method: 'POST',
-    data: params,
+ export async function putAdqAdgroupsSync(data: any) {
+  return request(api + `/adq/adgroups/sync`, {
+    method: 'PUT',
+    data
   });
 }
 /**

+ 29 - 3
src/services/launchAdq/enum.ts

@@ -392,9 +392,9 @@ export enum TargetingSourceTypeEnum {
 }
 /**数据版本类型*/
 export enum CreativeTemplateVersionTypeEnum {
-  CREATIVE_TEMPLATE_VERSION_TYPE_UNKOWN='未知',
-  CREATIVE_TEMPLATE_VERSION_TYPE_OLD='未精简前的创意模板等价于',
-  CREATIVE_TEMPLATE_VERSION_TYPE_NEW='精简合并后的创意模板'
+  CREATIVE_TEMPLATE_VERSION_TYPE_UNKOWN = '未知',
+  CREATIVE_TEMPLATE_VERSION_TYPE_OLD = '未精简前的创意模板等价于',
+  CREATIVE_TEMPLATE_VERSION_TYPE_NEW = '精简合并后的创意模板',
 }
 /**头像跳转信息*/
 export enum HeadClickTypeEnum {
@@ -421,3 +421,29 @@ export enum SourceEnum {
   AD_CREATIVE_AUTO_DERIVE = '自动衍生创意',
   AD_CREATIVE_AUTO_GENERATE = '自动生成创意',
 }
+/**客户设置的状态*/
+export enum ConfiguredStatusEnum {
+  AD_STATUS_NORMAL = '有效',
+  AD_STATUS_SUSPEND = '暂停',
+}
+/**广告状态*/
+export enum AdStatusEnum {
+  STATUS_UNKNOWN = '未知状态',
+  STATUS_PENDING = '审核中',
+  STATUS_DENIED = '审核不通过',
+  STATUS_FROZEN = '冻结',
+  STATUS_SUSPEND = '暂停中',
+  STATUS_READY = '未到投放时间',
+  STATUS_ACTIVE = '投放中',
+  STATUS_STOP = '投放结束',
+  STATUS_PREPARE = '准备中',
+  STATUS_DELETED = '已删除',
+  STATUS_ACTIVE_ACCOUNT_FROZEN = '广告被暂停(账户资金被冻结)',
+  STATUS_ACTIVE_ACCOUNT_EMPTY = '广告被暂停(账户余额不足)',
+  STATUS_ACTIVE_ACCOUNT_LIMIT = '广告被暂停(账户达日限额)',
+  STATUS_ACTIVE_CAMPAIGN_LIMIT = '广告被暂停(推广计划达日限额)',
+  STATUS_ACTIVE_CAMPAIGN_SUSPEND = '广告被暂停(推广计划暂停)',
+  STATUS_ACTIVE_AD_LIMIT = '广告被暂停(广告达日限额)',
+  STATUS_PART_READY = '部分待投放',
+  STATUS_PART_ACTIVE = '部分投放中',
+}