Browse Source

Merge branch 'develop' of http://git.zanxiangnet.com/wjx/ad-manage

wjx 1 year ago
parent
commit
10e919414f

+ 4 - 0
src/pages/launchSystemNew/adq/ad/index.less

@@ -0,0 +1,4 @@
+
+.clearCheckbox .ant-checkbox-inner {
+    border-color: #FFF;
+}

+ 93 - 33
src/pages/launchSystemNew/adq/ad/index.tsx

@@ -1,11 +1,11 @@
 
 import { useAjax } from '@/Hook/useAjax'
-import { AdStatusEnum, PromotedObjectType } from '@/services/launchAdq/enum'
-import { Col, Row, Input, Select, message, Space, Button, Popconfirm, Switch, notification, Modal, Tooltip, Checkbox, Dropdown, Menu } from 'antd'
+import { AdStatusEnum, OptimizationGoalEnum, PromotedObjectType } from '@/services/launchAdq/enum'
+import { Col, Row, Input, Select, message, Space, Button, Switch, notification, Modal, Tooltip, Checkbox, Dropdown, Menu } from 'antd'
 import React, { useEffect, useCallback, useState } from 'react'
 import TableData from '../../components/TableData'
 import tableConfig from './tableConfig'
-import { putAdqAdgroupsSync, getAdqAdgroupsList, delListAdqAdgroupsApi, newEditAdqAdgroupsDataApi, editAdqAdgroupsDataApi, putAdqAdgroupsSyncBatch, putModifyCustomAudienceApi } from '@/services/launchAdq/adq'
+import { putAdqAdgroupsSync, getAdqAdgroupsList, delListAdqAdgroupsApi, newEditAdqAdgroupsDataApi, editAdqAdgroupsDataApi, putAdqAdgroupsSyncBatch, putModifyCustomAudienceApi, getPutUserApi } from '@/services/launchAdq/adq'
 import { CopyOutlined, DeleteOutlined, DownOutlined, ExclamationCircleOutlined, FieldTimeOutlined, FormOutlined, PauseCircleOutlined, PlayCircleOutlined, QuestionCircleOutlined, SyncOutlined, TransactionOutlined } from '@ant-design/icons'
 import UpdateAd from './updateAd'
 import Copy from './copy'
@@ -15,6 +15,7 @@ import Log from '../log'
 import EarlyWarning from '@/components/EarlyWarning'
 import SetEarlyWarning from '@/components/EarlyWarning/setEarlyWarning'
 import CrowdPackModal from '../../components/crowdPackModal'
+import './index.less'
 
 type Props = {
     accountId?: string,
@@ -67,6 +68,8 @@ const Ad: React.FC<Props> = (props) => {
         statusList?: any[],
         memoList?: any[]
         remarkList?: any[]
+        optimizationGoal?: string,
+        putUserIdList?: number[]
     }>({ pageNum: 1, pageSize: 20 })
     const listAjax = useAjax((params) => getAdqAdgroupsList(params), { formatResult: true })
     const syncAjax = useAjax((adAccountId) => putAdqAdgroupsSync(adAccountId))
@@ -75,8 +78,13 @@ const Ad: React.FC<Props> = (props) => {
     const editAdqAdgroups = useAjax((params) => editAdqAdgroupsDataApi(params))
     const putModifyCustomAudience = useAjax((params) => putModifyCustomAudienceApi(params))
     const putAdqAdgroupsSyncBatchApi = useAjax((params) => putAdqAdgroupsSyncBatch(params))
+    const getPutUser = useAjax((params) => getPutUserApi(params))
     /************************/
 
+    useEffect(() => {
+        getPutUser.run({ userId })
+    }, [userId])
+
     useEffect(() => {
         // let { accountId, campaignId, adgroupId, ...obj } = queryParmas
         // let new_queryParmas = {
@@ -86,7 +94,7 @@ const Ad: React.FC<Props> = (props) => {
         //     adgroupIdList: adgroupId ? [adgroupId] : []
         // }
         getList({ pageNum: 1, pageSize: 20 })
-    }, [accountId, userId, queryParmas])
+    }, [accountId, userId, queryParmas, model])
 
     // 获取列表
     const getList = useCallback((params: {
@@ -101,9 +109,13 @@ const Ad: React.FC<Props> = (props) => {
         statusList?: any[],
         memoList?: any[]
         remarkList?: any[]
+        isDeepConversionSpec?: boolean
     }) => {
+        if (!model) {
+            params.isDeepConversionSpec = true
+        }
         listAjax.run({ ...params, userId })
-    }, [userId, listAjax])
+    }, [userId, listAjax, model])
     // 同步 
     const sync = useCallback(() => {
         // if (selectedRows?.length === 0) {
@@ -265,14 +277,14 @@ const Ad: React.FC<Props> = (props) => {
         {/* 复制广告 */}
         {copyData.visible && <Copy selectedRows={selectedRows} {...copyData} onClose={() => setCopyData({ visible: false })} onChange={() => { setCopyData({ visible: false }); listAjax.refresh(); setSelectedRows([]) }} />}
         <Row gutter={[6, 6]} align='middle' style={{ marginBottom: 15 }}>
-            <Col>
-                {Ts && Ts()}
-            </Col>
+            {Ts && <Col>
+                {Ts()}
+            </Col>}
             <Col>
                 <Input
                     placeholder='广告账号'
                     allowClear
-                    style={{ width: 120 }}
+                    style={{ width: 100 }}
                     onChange={(e) => {
                         let value = e.target.value
                         let arr: any = []
@@ -284,22 +296,11 @@ const Ad: React.FC<Props> = (props) => {
                     }}
                 />
             </Col>
-            <Col>
-                <Input
-                    placeholder='广告名称'
-                    allowClear
-                    style={{ width: 120 }}
-                    onChange={(e) => {
-                        let value = e.target.value
-                        set_queryFrom({ ...queryFrom, adgroupName: value })
-                    }}
-                />
-            </Col>
             <Col>
                 <Input
                     placeholder='广告ID'
                     allowClear
-                    style={{ width: 120 }}
+                    style={{ width: 100 }}
                     onChange={(e) => {
                         let value = e.target.value
                         let arr: any = []
@@ -315,7 +316,7 @@ const Ad: React.FC<Props> = (props) => {
                 <Input
                     placeholder='计划ID'
                     allowClear
-                    style={{ width: 120 }}
+                    style={{ width: 100 }}
                     onChange={(e) => {
                         let value = e.target.value
                         let arr: any = []
@@ -329,8 +330,8 @@ const Ad: React.FC<Props> = (props) => {
             </Col>
             <Col>
                 <Select
-                    placeholder='推广目标选择'
-                    style={{ width: 120 }}
+                    placeholder='推广目标'
+                    style={{ width: 110 }}
                     showSearch
                     filterOption={(input: any, option: any) =>
                         (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
@@ -347,8 +348,8 @@ const Ad: React.FC<Props> = (props) => {
             </Col>
             <Col>
                 <Select
-                    placeholder='是否已删除'
-                    style={{ width: 120 }}
+                    placeholder='已删除?'
+                    style={{ width: 100 }}
                     showSearch
                     filterOption={(input: any, option: any) =>
                         (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
@@ -383,6 +384,17 @@ const Ad: React.FC<Props> = (props) => {
                     }
                 </Select>
             </Col>
+            <Col>
+                <Input
+                    placeholder='广告名称'
+                    allowClear
+                    style={{ width: 120 }}
+                    onChange={(e) => {
+                        let value = e.target.value
+                        set_queryFrom({ ...queryFrom, adgroupName: value })
+                    }}
+                />
+            </Col>
             <Col>
                 <Input
                     placeholder='腾讯备注'
@@ -415,15 +427,63 @@ const Ad: React.FC<Props> = (props) => {
                     }}
                 />
             </Col>
+            <Col>
+                <Select
+                    placeholder='优化目标'
+                    style={{ width: 100 }}
+                    showSearch
+                    filterOption={(input: any, option: any) =>
+                        (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
+                    }
+                    allowClear
+                    value={queryFrom.optimizationGoal}
+                    onChange={(value: any) => {
+                        set_queryFrom({ ...queryFrom, optimizationGoal: value })
+                    }}
+                >
+                    {Object.keys(OptimizationGoalEnum).map(key => <Select.Option value={key} key={key}>{OptimizationGoalEnum[key]}</Select.Option>)}
+                </Select>
+            </Col>
+            <Col>
+                <Select
+                    placeholder='投手'
+                    mode='multiple'
+                    style={{ minWidth: 100 }}
+                    maxLength={1}
+                    showSearch
+                    filterOption={(input: any, option: any) =>
+                        (option!.children as unknown as string).toLowerCase().includes(input.toLowerCase())
+                    }
+                    allowClear
+                    value={queryFrom.putUserIdList}
+                    onChange={(value: any) => {
+                        set_queryFrom({ ...queryFrom, putUserIdList: value })
+                    }}
+                >
+                    {getPutUser?.data ? Object.keys(getPutUser?.data).map(key => <Select.Option value={key} key={key}>{getPutUser?.data[key]}</Select.Option>) : null}
+                </Select>
+            </Col>
             <Col>
                 <Space>
-                    <Button type='primary' onClick={() => {
-                        if (isClearSelect) {
-                            setSelectedRows([])
-                        }
-                        getList({ ...queryFrom, pageNum: 1 })
-                    }}>搜索</Button>
-                    <Checkbox checked={isClearSelect} onChange={(e) => setIsClearSelect(e.target.checked)}>搜索清空已选</Checkbox>
+                    <Button
+                        type="primary"
+                        onClick={() => {
+                            if (isClearSelect) {
+                                setSelectedRows([])
+                            }
+                            getList({ ...queryFrom, pageNum: 1 })
+                        }}
+                    >
+                        <Space>
+                            <span>搜索</span>
+                            <Checkbox className='clearCheckbox' onClick={(e) => e.stopPropagation()} checked={isClearSelect} onChange={(e) => setIsClearSelect(e.target.checked)} />
+                            <Tooltip title="勾选搜索清空已选">
+                                <QuestionCircleOutlined />
+                            </Tooltip>
+                        </Space>
+
+                    </Button>
+
                     {selectedRows?.length > 0 && <Button type='link' style={{ padding: 0, color: 'red' }} onClick={() => {
                         setSelectedRows([])
                     }}>清空已选</Button>}

+ 12 - 0
src/services/launchAdq/adq.ts

@@ -361,6 +361,18 @@ export async function putPromotedObjectSync(data: any) {
 
 /**
  * 修改人群包
+ * @param params 
+ * @returns 
+ */
+export async function getPutUserApi(params: { userId: number }) {
+  return request(api + `/adq/adgroups/get/putUser/list`, {
+    method: 'GET',
+    params
+  });
+}
+
+/**
+ * 获取投手
  * @param data 
  * @returns 
  */