wjx 2 anos atrás
pai
commit
ead4714398

+ 37 - 4
src/pages/adMonitor/adMonitorList/index.tsx

@@ -1,5 +1,7 @@
-import { Tabs } from "antd"
-import React, { useState } from "react"
+import Ad from "@/pages/launchSystemNew/adq/ad"
+import { Card, Select, Tabs } from "antd"
+import { number } from "echarts"
+import React, { useEffect, useState } from "react"
 import { useModel } from "umi"
 import Monitor from "./monitor"
 import PlanList from "./planList"
@@ -9,8 +11,13 @@ const AdMonitorList: React.FC = () => {
     // 变量开始
     const [tab, setTab] = useState<string>('monitor')  // tab切换
     const { getPlanList, getPlanDetailList, getAllPlanList } = useModel('useAdMonitor.useMonitor')
+    const [userId, setUserId] = useState(localStorage.getItem("userId") as string)
+    const { getPicherList } = useModel('useOperating.useWxGroupList')
     // 变量结束
-
+    // 获取投手
+    useEffect(() => {
+        !getPicherList.data && getPicherList.run()
+    }, [])
     return <div className="adMonitorList">
         <Tabs activeKey={tab} className="adMonitorListTab" size="small" type="card" onChange={(activeKey: string) => {
             if (activeKey === 'monitor') {
@@ -23,8 +30,34 @@ const AdMonitorList: React.FC = () => {
         }}>
             <Tabs.TabPane tab="今日起量广告监控" key="monitor" />
             <Tabs.TabPane tab="广告列表" key="list" />
+            <Tabs.TabPane tab="广告列表2" key="list2" />
         </Tabs>
-        {tab === 'monitor' ? <Monitor onChange={() => { setTab('list') }} /> : tab === 'list' ? <PlanList /> : null}
+        {tab === 'monitor' ? <Monitor onChange={() => { setTab('list') }} /> : tab === 'list' ? <PlanList /> : <Card><Ad userId={userId}  Ts={()=>{
+            return <Select
+            showSearch
+            value={userId ? Number(userId) : undefined}
+            style={{ minWidth: 180, maxWidth: 250 }}
+            maxTagCount={1}
+            allowClear
+            placeholder="请选择投手"
+            // disabled={queryForm?.adgroup || queryForm?.accountId?.length > 0}
+            onChange={(value) => {
+                    setUserId(value?.toString() || '')
+            }}
+            filterOption={(input, option) =>
+                (option?.children as any).toLowerCase().indexOf(input.toLowerCase()) >= 0
+            }
+        >
+            {getPicherList?.data?.map((item: { nickname: string, userId: number }, index: number) =>
+                <Select.Option
+                    value={item.userId}
+                    key={item.userId + '' + index}
+                >
+                    {item.nickname}
+                </Select.Option>
+            )}
+        </Select>
+        }}/></Card>}
     </div>
 }
 

+ 22 - 17
src/pages/launchSystemNew/adq/ad/index.tsx

@@ -13,10 +13,11 @@ import PlanDetail from '@/pages/adMonitor/adMonitorList/components/planDetail'
 import { txAdConfig } from '../config'
 
 type Props = {
-    accountId: string,
-    adAccountId: string,
+    accountId?: string,
+    adAccountId?: string,
     userId: string,
-    queryParmas: {
+    Ts?: any,
+    queryParmas?: {
         accountId?: string,//账户ID
         campaignId?: string,//计划ID
         adgroupId?: string,//广告ID
@@ -24,7 +25,7 @@ type Props = {
         pageId?: string,//落地页ID
         targetingId?: string,//定向ID}
     },
-    tableIdClick: (props: {
+    tableIdClick?: (props: {
         activeKey: string, parma: {
             accountId?: string,//账户ID
             campaignId?: string,//计划ID
@@ -39,7 +40,7 @@ type Props = {
 const Ad: React.FC<Props> = (props) => {
 
     /***********************/
-    let { accountId, adAccountId, userId, tableIdClick, queryParmas } = props
+    let { accountId, adAccountId, userId, tableIdClick, queryParmas, Ts } = props
     const [selectedRows, setSelectedRows] = useState<any[]>([])
     const [update, setUpdate] = useState<{ visible: boolean, title: string }>({ visible: false, title: '' })
     const [model, setModel] = useState(true)
@@ -68,14 +69,14 @@ const Ad: React.FC<Props> = (props) => {
     /************************/
 
     useEffect(() => {
-        let { accountId, campaignId, adgroupId, ...obj } = queryParmas
-        let new_queryParmas = {
-            ...obj,
-            accountIdList: accountId ? [accountId] : [],
-            campaignIdList: campaignId ? [campaignId] : [],
-            adgroupIdList: adgroupId ? [adgroupId] : []
-        }
-        getList({ pageNum: 1, pageSize: 20, ...new_queryParmas, accountIdList: accountId ? [accountId] : [] })
+        // let { accountId, campaignId, adgroupId, ...obj } = queryParmas
+        // let new_queryParmas = {
+        //     ...obj,
+        //     accountIdList: accountId ? [accountId] : [],
+        //     campaignIdList: campaignId ? [campaignId] : [],
+        //     adgroupIdList: adgroupId ? [adgroupId] : []
+        // }
+        getList({ pageNum: 1, pageSize: 20 })
     }, [accountId, userId, queryParmas])
 
     // 获取列表
@@ -162,6 +163,7 @@ const Ad: React.FC<Props> = (props) => {
         putAdqAdgroupsSyncBatchApi.run({ adgroupIds: selectedRows?.map(item => item.adgroupId) }).then(res => {
             if (res) {
                 message.success('同步成功!')
+                listAjax.refresh()
             }
         })
     }, [selectedRows])
@@ -200,7 +202,10 @@ 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}}>
+        <Row gutter={[6, 6]} align='middle' style={{ marginBottom: 15 }}>
+            <Col>
+                {Ts && Ts()}
+            </Col>
             <Col>
                 <Input
                     placeholder='广告账号'
@@ -354,7 +359,7 @@ const Ad: React.FC<Props> = (props) => {
         </Row>
         <TableData
             isCard={false}
-            columns={() => tableConfig(onChange, details, handleSave, tableIdClick)}
+            columns={() => tableConfig(onChange, details, handleSave)}
             ajax={listAjax}
             syncAjax={sync}
             fixed={{ left: 2, right: 4 }}
@@ -415,8 +420,8 @@ const Ad: React.FC<Props> = (props) => {
                 let { current, pageSize } = pagination
                 // console.log(pagination)
                 // console.log({...queryFrom, pageNum: current, pageSize })
-                set_queryFrom({...queryFrom,pageNum:current,pageSize})
-                getList({...queryFrom, pageNum: current, pageSize })
+                set_queryFrom({ ...queryFrom, pageNum: current, pageSize })
+                getList({ ...queryFrom, pageNum: current, pageSize })
             }}
         />
         {detailShow && <PlanDetail visible={detailShow} onClose={() => { setDetailShow(false) }} data={detailData} />}

+ 1 - 1
src/pages/launchSystemNew/adq/ad/tableConfig.tsx

@@ -13,7 +13,7 @@ function tableConfig(
     onChange: () => void,
     details: (data: any) => void,
     handleSave: (data: any) => void,
-    tableIdClick: (props: {
+    tableIdClick?: (props: {
         activeKey: string,
         parma: {
             accountId?: string,//账户ID