shenwu 2 vuotta sitten
vanhempi
commit
081fee78c7

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

@@ -1,6 +1,7 @@
 import Ad from "@/pages/launchSystemNew/adq/ad"
-import { Card, Tabs } from "antd"
-import React, { useState } from "react"
+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"
@@ -10,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') {
@@ -26,7 +32,32 @@ const AdMonitorList: React.FC = () => {
             <Tabs.TabPane tab="广告列表" key="list" />
             <Tabs.TabPane tab="广告列表2" key="list2" />
         </Tabs>
-        {tab === 'monitor' ? <Monitor onChange={() => { setTab('list') }} /> : tab === 'list' ? <PlanList /> : <Card><Ad userId={localStorage.getItem("userId") as string} /></Card>}
+        {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>
 }
 

+ 10 - 6
src/pages/launchSystemNew/adq/ad/index.tsx

@@ -16,6 +16,7 @@ type Props = {
     accountId?: string,
     adAccountId?: string,
     userId: string,
+    Ts?: any,
     queryParmas?: {
         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)
@@ -75,7 +76,7 @@ const Ad: React.FC<Props> = (props) => {
         //     campaignIdList: campaignId ? [campaignId] : [],
         //     adgroupIdList: adgroupId ? [adgroupId] : []
         // }
-        getList({ pageNum: 1, pageSize: 20})
+        getList({ pageNum: 1, pageSize: 20 })
     }, [accountId, userId, queryParmas])
 
     // 获取列表
@@ -201,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='广告账号'
@@ -355,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 }}
@@ -416,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} />}