wjx 2 سال پیش
والد
کامیت
a73cd6ebf5

+ 2 - 2
src/Hook/useEcharts.tsx

@@ -490,7 +490,7 @@ function BarMonitor(props: {
     xName?: string,
     yName?: string,
     planID?: string,
-    onChange?: (id?: string) => void,
+    onChange?: (id: string, accountId: number[]) => void,
 }) {
     const { data, style, fontColor, title, xName, yName, planID, onChange } = props
     const colors = ['#f8128d', '#fa40a3', '#f56db5', '#f58bc4', '#f7a1cf', '#f5b7d8', '#facee5', '#f8c8e2', '#f8d6e8', '#fae8f1']
@@ -619,7 +619,7 @@ function BarMonitor(props: {
             myChart.on('click', (params: any) => {
                 let v = params.dataIndex
                 let d: any = (data as any[])[v]
-                onChange && onChange(d.name)
+                onChange && onChange(d.name, [d.accountId])
             });
         }
     }, [ref?.current, data, planID])

+ 6 - 4
src/models/useOperating/useWxGroupList.ts

@@ -1,5 +1,5 @@
 import { useCallback, useEffect, useReducer } from 'react';
-import { allOfMember, listGroup, getAllZhMemBerApi } from '@/services/operating/account';
+import { allOfMember, listGroup, getAllZhMemBerApi, getPicherListApi } from '@/services/operating/account';
 import { useAjax } from '@/Hook/useAjax';
 import { getWxlist } from '@/services/operating/material';
 import { getMpsTimeOut } from '@/services/user';
@@ -80,6 +80,7 @@ export default function useWxGroupList() {
   const getAllZhMemBer = useAjax(() => getAllZhMemBerApi()); //获取账户下属公众号
   const catWx = useAjax((userId) => getMpsTimeOut(userId)); //查询公众号是否过期
   const getversions = useAjax(() => getVersions()); //获取版本号
+  const getPicherList = useAjax(() => getPicherListApi()); //获取投手
   const getWxlists = useAjax((id) => getWxlist(id));
   const [state, dispatch] = useReducer(weChatReducer, {
     tabsKey: '自己',
@@ -165,9 +166,9 @@ export default function useWxGroupList() {
       //     dispatch({ type: 'allWx', params: { allWx } });
       //   }
       // });
-      getAllZhMemBer.run().then(res => {
-        dispatch({ type: 'allOfMember', params: { allOfMember: res } });
-      })
+      // getAllZhMemBer.run().then(res => {
+      //   dispatch({ type: 'allOfMember', params: { allOfMember: res } });
+      // })
       // getAllOfMember.run().then((res) => {
       //   let groupAllWx: any[] = [];
       //   res?.forEach((item: any) => {
@@ -274,5 +275,6 @@ export default function useWxGroupList() {
     initSelectWx,
     getWxlists,
     getversions,
+    getPicherList
   };
 }

+ 1 - 1
src/pages/adMonitor/adMonitorList/components/planDetail.tsx

@@ -41,7 +41,7 @@ function PlanDetail(props: Props) {
                 setAdCostSpeedDtoListOri(() => [...res?.data?.adCostSpeedVOList])
                 let spendData: any = { legendName: '花费' }
                 let exposureData: any = { legendName: '曝光次数' }
-                res?.data?.adCostSpeedVOList?.reverse()?.forEach((item: { day: string, time: string, cost: string, viewCount: string }) => {
+                res?.data?.adCostSpeedVOList?.forEach((item: { day: string, time: string, cost: string, viewCount: string }) => {
                     if (queryForm.timeUnit === 'hour') {
                         spendData[item?.time] = item?.cost
                         exposureData[item?.time] = item?.viewCount

+ 7 - 7
src/pages/adMonitor/adMonitorList/config.ts

@@ -15,8 +15,8 @@ const qiliangpaihang = [
             // { title: '自动扩量', dataIndex: 'autoExpand', label: '设置信息' },
             // { title: '深度优化目标', dataIndex: 'depthOptimizeTarget', label: '设置信息' },
             // { title: '曝光评估', dataIndex: 'impressionAppraise', label: '设置信息' },
-            { title: '投放时间', dataIndex: 'adBeginTime', label: '设置信息', width: 145 },
-            { title: '广告状态', dataIndex: 'adStatus', default: 12, label: '设置信息' },
+            { title: '投放时间', dataIndex: 'adBeginTime', label: '设置信息', default: 12, width: 135 },
+            { title: '广告状态', dataIndex: 'adStatus', label: '设置信息' },
             // { title: '创意状态', dataIndex: 'adCreativeStatus', label: '设置信息' },
             { title: '推广目标', dataIndex: 'promotedObjectType', label: '设置信息' },
             // { title: '购买类型', dataIndex: 'adBuyType', label: '设置信息' },
@@ -111,8 +111,8 @@ const qiliangpaihangminute = [
             // { title: '自动扩量', dataIndex: 'autoExpand', label: '设置信息' },
             // { title: '深度优化目标', dataIndex: 'depthOptimizeTarget', label: '设置信息' },
             // { title: '曝光评估', dataIndex: 'impressionAppraise', label: '设置信息' },
-            { title: '投放时间', dataIndex: 'adBeginTime', label: '设置信息', width: 145 },
-            { title: '广告状态', dataIndex: 'adStatus', default: 12, label: '设置信息' },
+            { title: '投放时间', dataIndex: 'adBeginTime', label: '设置信息', default: 12, width: 135 },
+            { title: '广告状态', dataIndex: 'adStatus', label: '设置信息' },
             // { title: '创意状态', dataIndex: 'adCreativeStatus', label: '设置信息' },
             { title: '推广目标', dataIndex: 'promotedObjectType', label: '设置信息' },
             // { title: '购买类型', dataIndex: 'adBuyType', label: '设置信息' },
@@ -126,9 +126,9 @@ const qiliangpaihangminute = [
             // { title: '出价方式', dataIndex: 'biddingMethod', label: '费用' },
             { title: '当前出价', dataIndex: 'bidAmount', label: '费用', width: 80 },
             // { title: '计划预算', dataIndex: 'planBudget', label: '费用' },
-            { title: '广告总消耗', dataIndex: 'costTotal', label: '费用', width: 100, disabled: true },
-            { title: '今日消耗', dataIndex: 'costDay', label: '费用', width: 90, disabled: true },
-            { title: '当前小时消耗', dataIndex: 'costHour', label: '费用', width: 80, disabled: true },
+            { title: '广告总消耗', dataIndex: 'costTotal', label: '费用', width: 100 },
+            { title: '今日消耗', dataIndex: 'costDay', label: '费用', width: 90 },
+            { title: '当前小时消耗', dataIndex: 'costHour', label: '费用', width: 80 },
             { title: '前第1小时消耗', dataIndex: 'costLastHour', label: '费用', width: 80, disabled: true },
             { title: '前第2小时消耗', dataIndex: 'costLastTwoHour', label: '费用', width: 80, disabled: true },
             { title: '前第3小时消耗', dataIndex: 'costLastThreeHour', label: '费用', width: 80, disabled: true },

+ 93 - 84
src/pages/adMonitor/adMonitorList/monitor.tsx

@@ -25,15 +25,13 @@ interface newListType extends ListType {
 function Monitor(props: { onChange: () => void }) {
     const { onChange } = props
     const { getPlanList, getTotalCost, getPlanCost, getPlanDetailList, getMinuteList, getAdqAccountList } = useModel('useAdMonitor.useMonitor')
-    const { state } = useModel('useOperating.useWxGroupList')
+    const { getPicherList } = useModel('useOperating.useWxGroupList')
     // 变量开始
     const [queryForm, setQueryForm] = useState<newListType>({ totalTimeUnit: 'day', planTimeUnit: 'hour', pageNum: 1, pageSize: 20 }) // 搜索变量//startTime: moment().format('YYYY-MM-DD'), endTime: moment().format('YYYY-MM-DD'),
     const { BarMonitor, LineMonitor } = useEcharts()
     const [barDis, setBarDis] = useState<any[]>([])
     const [lineDis, setLineDis] = useState<any[]>([])
     const [lineTitle, setLineTitle] = useState<string>('广告总消耗趋势')
-    const [datas, setDatas] = useState<any[]>([])  // 所有数据
-    const [pichers, setPichers] = useState<any[]>([]) // 投手数据
     const [mode, setMode] = useState<string>('total') // 总/明细
     const [px, setPx] = useState<boolean>(false)//设置顶部图形的排列方式
     const [planDetailList, setPlanDetailList] = useState<any[]>([])
@@ -41,68 +39,41 @@ function Monitor(props: { onChange: () => void }) {
     const [visible, setVisible] = useState<boolean>(false) // 详情弹窗控制
     const [aId, setAId] = useState<any>()
     const [downLoadLoading, setDownLoadLoading] = useState<boolean>(false)
+    const [hour, setHour] = useState<any>()
+    const [clickAccountId, setClickAccountId] = useState<number[]>([])
     const { totalTimeUnit, planTimeUnit, adgroup, accountId, sysUserId, pageNum, pageSize, campaign, sortField, sort } = queryForm
-
     // 变量结束
+
+    // 获取投手
     useEffect(() => {
-        if (state?.allOfMember?.length > 0) {//组长数据存在使用组长数据
-            setDatas(state?.allOfMember)
-        } else if (state?.myallOfUser?.length > 0) {//否则个人
-            setDatas(state?.myallOfUser)
-        }
-    }, [state])
+        getPicherList.run()
+    }, [])
     // 获取广告账号
     useEffect(() => {
         getAdqAccountList.run()
     }, [])
-    // 处理投手
-    useEffect(() => {
-        if (datas.length > 0) {
-            let new_pichers = datas?.map((item: { key: { nickname: string, userId: number } }) => ({ nickName: item?.key?.nickname, userId: item?.key?.userId }))
-            if (JSON.stringify(pichers) !== JSON.stringify(new_pichers)) {//避免重复设置触发条件多次请求接口
-                setPichers(new_pichers)
-            }
-        }
-    }, [datas, pichers])
     // // 获取排行数据,柱图
     useEffect(() => {
-        if (pichers.length > 0) {
-            getPlanCostList()
-        }
-    }, [totalTimeUnit, accountId, sysUserId, pichers])
-    // 获取起量计划列表 底部table
-    useEffect(() => {
-        if (pichers.length > 0) {
-            if (mode === 'total') {
-                getList()
-            } else if (mode === 'detail') {
-                if (adgroup) {
-                    getDetailList(adgroup)
-                }
-            } else if (mode === 'minute') {
-                if (adgroup) {
-                    getMinuList(adgroup)
-                }
-            }
-        }
-    }, [accountId, sysUserId, pageNum, pageSize, campaign, pichers, adgroup, sortField, sort, mode])
+        getPlanCostList()
+    }, [totalTimeUnit, accountId, sysUserId])
     // 获取今日计划总消耗图谱,折线
     useEffect(() => {
-        if (pichers.length > 0) {
-            getTootalCostList()
+        getTootalCostList()
+    }, [planTimeUnit, adgroup, accountId, sysUserId])
+    // 获取起量计划列表 底部table
+    useEffect(() => {
+        if (mode === 'total') {
+            getList()
         }
-    }, [planTimeUnit, adgroup, accountId, sysUserId, pichers])
+    }, [accountId, sysUserId, pageNum, pageSize, campaign, adgroup, sortField, sort, mode, hour])
+    
     // 获取起量明细表 点击
     useEffect(() => {
-        // if (adgroup) {
-        //     getDetailList(adgroup)
-        // } else {
-        //     setMode('total')//切到总表
-        // }
         if (!adgroup) {
             setMode('total')//切到总表
         }
     }, [adgroup])
+
     /** 获取折线图 */
     const getTootalCostList = useCallback(async () => {
         let { totalTimeUnit, planTimeUnit, pageNum, pageSize, adgroup, sysUserId, accountId, ...newQueryForm } = queryForm
@@ -115,7 +86,7 @@ function Monitor(props: { onChange: () => void }) {
         })
         setLineDis(() => data)
         setLineTitle(() => res?.data?.adName ? res?.data?.adName + '_消耗趋势' : '广告总消耗趋势')
-    }, [queryForm, lineDis, pichers])
+    }, [queryForm, lineDis])
 
     /** 获取柱状图 */
     const getPlanCostList = useCallback(async () => {
@@ -123,8 +94,8 @@ function Monitor(props: { onChange: () => void }) {
         let { adgroup, ...planQueryFrom } = newQueryForm
         let newPitcherIds = sysUserId?.join()
         let res = await getPlanCost.run({ ...planQueryFrom, timeUnit: totalTimeUnit, sysUserId: newPitcherIds, accountId: accountId?.join() })
-        let data = res?.data?.planCostDtoList?.map((item: { adId: number, cost: number, adName: string }) => {
-            return { name: item.adId.toString(), value: item.cost, adName: item.adName }
+        let data = res?.data?.planCostDtoList?.map((item: { adId: number, cost: number, adName: string, accountId: number }) => {
+            return { name: item.adId.toString(), value: item.cost, adName: item.adName, accountId: item.accountId }
         })
         data = data?.sort((a: any, b: any) => {
             var value1 = a['value'];
@@ -132,26 +103,27 @@ function Monitor(props: { onChange: () => void }) {
             return value2 - value1;
         })
         setBarDis(() => data)
-    }, [queryForm, barDis, pichers])
+    }, [queryForm, barDis])
 
     // 气量Table总表
     const getList = useCallback(() => {
         let { totalTimeUnit, planTimeUnit, timeUnit, sysUserId, accountId, ...newQueryForm } = queryForm
-        getPlanList.run({ ...newQueryForm, sysUserId, accountId: accountId?.join() })
-    }, [queryForm, pichers])
+        getPlanList.run({ ...newQueryForm, sysUserId, accountId, hour })
+    }, [queryForm, hour])
 
 
     // 起量明细表 点击
-    const getDetailList = useCallback((adgroup: any) => {
+    const getDetailList = useCallback((adgroup: any, clickAccountId: any[]) => {
+        setClickAccountId(clickAccountId)
         let { totalTimeUnit, planTimeUnit, timeUnit, pageNum, pageSize, adgroup: aa, sysUserId, accountId, ...newQueryForm } = queryForm
         if (adgroup) {
             setMode('detail')//切到明细
-            getPlanDetailList.run({ ...newQueryForm, adgroupId: adgroup, sysUserId, accountId: accountId?.join() }).then((res: any) => {
+            getPlanDetailList.run({ ...newQueryForm, adgroupId: adgroup, sysUserId, accountId: accountId ? accountId : clickAccountId }).then((res: any) => {
                 setPlanDetailList(res?.data ? [...res?.data] : [])
                 setQueryForm({ ...queryForm, adgroup })
             })
         }
-    }, [queryForm, getPlanList, pichers, planDetailList])
+    }, [queryForm, getPlanList, planDetailList])
 
     // 详情
     const details = (data: any) => {
@@ -160,16 +132,17 @@ function Monitor(props: { onChange: () => void }) {
     }
 
     // 起量5min表
-    const getMinuList = useCallback((adgroup: any) => {
+    const getMinuList = useCallback((adgroup: any, clickAccountId: any[]) => {
+        setClickAccountId(clickAccountId)
         let { totalTimeUnit, planTimeUnit, timeUnit, pageNum, pageSize, adgroup: aa, sysUserId, accountId, ...newQueryForm } = queryForm
         if (adgroup) {
             setMode('minute')
-            getMinuteList.run({ ...newQueryForm, adgroupId: adgroup, sysUserId, accountId: accountId?.join() }).then((res: any) => {
+            getMinuteList.run({ ...newQueryForm, adgroupId: adgroup, sysUserId, accountId: accountId ? accountId : clickAccountId }).then((res: any) => {
                 setMinuteList(res?.data ? [...res?.data] : [])
                 setQueryForm({ ...queryForm, adgroup })
             })
         }
-    }, [queryForm, getPlanList, pichers, minuteList, adgroup])
+    }, [queryForm, getPlanList, minuteList, adgroup])
 
     // 计划详情
     const planDetail = (data: any) => {
@@ -185,6 +158,7 @@ function Monitor(props: { onChange: () => void }) {
         getPlanDetailList.refresh()
         getMinuteList.refresh()
     }
+
     // 接口自动刷新10分钟一次
     useEffect(() => {
         let time = setInterval(() => {
@@ -193,7 +167,8 @@ function Monitor(props: { onChange: () => void }) {
         return () => {
             clearInterval(time)
         }
-    }, [pichers])
+    }, [])
+
     //图形排列样式改变重新获取数据刷新图形
     const set = useCallback((b) => {
         setPx(b)
@@ -203,7 +178,6 @@ function Monitor(props: { onChange: () => void }) {
 
     // 下载
     const downLoadExcel = useCallback(() => {
-        // downLoadUpAdApi, downLoadDetailApi, downLoadDetailMinuteApi
         let ajax: any = null
         let params: any = {}
         let { totalTimeUnit, planTimeUnit, timeUnit, sysUserId, accountId, adgroup, pageNum, pageSize, ...newQueryForm } = queryForm
@@ -228,7 +202,7 @@ function Monitor(props: { onChange: () => void }) {
                 downloadFile1(res, 'octet-stream', formatDate(new Date()) + ".xlsx")
             }).catch(() => setDownLoadLoading(false))
         }
-    }, [queryForm, mode, pichers, downLoadLoading])
+    }, [queryForm, mode, downLoadLoading])
 
     // 处理折线图数据
     const timePickerHandle = async (values: any, formatString: [string, string]) => {
@@ -259,6 +233,17 @@ function Monitor(props: { onChange: () => void }) {
         }
     }
 
+    const disabledTime = () => {
+        let h = moment().format('H')
+        let H: number[] = []
+        for (let index = Number(h) + 1; index < 23; index++) {
+            H.push(index)
+        }
+        return {
+            disabledHours: () => H
+        }
+    }
+
     return <Space direction='vertical' style={{ width: '100%' }} className="monitor">
         <Card hoverable >
             <div style={{ display: 'flex', justifyContent: 'space-between' }}>
@@ -271,17 +256,19 @@ function Monitor(props: { onChange: () => void }) {
                         maxTagCount={1}
                         disabled={queryForm?.accountId?.length > 0}
                         allowClear placeholder="请选择投手"
-                        onChange={(value: string) => { setQueryForm({ ...queryForm, sysUserId: value, pageNum: 1 }) }}
+                        onChange={(value: number[]) => {
+                            setQueryForm({ ...queryForm, sysUserId: value, pageNum: 1 }) 
+                        }}
                         filterOption={(input, option) =>
                             (option?.children as any).toLowerCase().indexOf(input.toLowerCase()) >= 0
                         }
                     >
-                        {pichers?.map((item: { nickName: string, userId: number }, index: number) =>
+                        {getPicherList?.data?.map((item: { nickname: string, userId: number }, index: number) =>
                             <Select.Option
                                 value={item.userId}
                                 key={item.userId + '' + index}
                             >
-                                {item.nickName}
+                                {item.nickname}
                             </Select.Option>
                         )}
                     </Select>
@@ -296,31 +283,42 @@ function Monitor(props: { onChange: () => void }) {
                         filterOption={(input, option) =>
                             (option?.children as any).toLowerCase().indexOf(input.toLowerCase()) >= 0
                         }
-                        onChange={(value: string) => {
+                        onChange={(value: number[]) => {
                             setQueryForm({ ...queryForm, accountId: value, pageNum: 1 })
                         }}
                     >
-                        {getAdqAccountList?.data?.data?.map((item: { id: number, accountId: number, wechatAccountName: string }) => <Select.Option
+                        {getAdqAccountList?.data?.data?.map((item: { id: number, accountId: number }) => <Select.Option
                             value={item.accountId}
                             key={item.id}
                         >
-                            {item.accountId + "_" + item.wechatAccountName}
+                            {item.accountId}
                         </Select.Option>)}
                     </Select>
-                    <Input value={queryForm.campaign} placeholder="计划ID" onChange={(e) => {
-                        let value = e.target.value
-                        if (!isNaN(Number(value))) {
-                            setQueryForm({ ...queryForm, campaign: value })
-                        }
-                    }}
-                        allowClear />
-                    <Input value={queryForm.adgroup} placeholder="广告ID" onChange={(e) => {
-                        let value = e.target.value
-                        if (!isNaN(Number(value))) {
-                            setQueryForm({ ...queryForm, adgroup: e.target.value })
-                        }
-                    }
-                    } allowClear />
+                    <Input
+                        value={queryForm.campaign}
+                        placeholder="计划ID"
+                        onChange={(e) => {
+                            let value = e.target.value
+                            if (!isNaN(Number(value))) {
+                                setQueryForm({ ...queryForm, campaign: value })
+                            }
+                        }}
+                        allowClear
+                    />
+                    <Input
+                        value={queryForm.adgroup}
+                        placeholder="广告ID"
+                        onChange={(e) => {
+                            let value = e.target.value
+                            if (!isNaN(Number(value))) {
+                                setQueryForm({ ...queryForm, adgroup: e.target.value })
+                            }
+                            if (!value) {
+                                setClickAccountId([])
+                            }
+                        }}
+                        allowClear 
+                        />
                 </Space>
                 <Space>
                     <Tag color="#2db7f5" onClick={refresh}><RedoOutlined />   刷新</Tag>
@@ -347,7 +345,7 @@ function Monitor(props: { onChange: () => void }) {
                             </Radio.Group>
                         </Space>
                     </div>
-                    {getPlanCost?.loading ? <Spin /> : <BarMonitor style={{ width: '100%', height: '100%' }} data={barDis} xName="今日消耗" yName="广告名称" onChange={(value?: string) => { setQueryForm({ ...queryForm, adgroup: value }); setMode('detail') }} planID={queryForm?.adgroup} />}
+                    {getPlanCost?.loading ? <Spin /> : <BarMonitor style={{ width: '100%', height: '100%' }} data={barDis} xName="今日消耗" yName="广告名称" onChange={(value: string, accountId) => { getDetailList(value, accountId) }} planID={queryForm?.adgroup} />}
                 </div>
                 <div>
                     <div className="selectTime">
@@ -379,12 +377,23 @@ function Monitor(props: { onChange: () => void }) {
                     <Space>
                         <Radio.Group onChange={(e: RadioChangeEvent) => {
                             let value = e.target.value
-                            setMode(value)
+                            switch (value) {
+                                case 'total':
+                                    setMode(value)
+                                    break;
+                                case 'detail':
+                                    getDetailList(queryForm.adgroup, clickAccountId)
+                                    break
+                                case 'minute':
+                                    getMinuList(queryForm.adgroup, clickAccountId)
+                                    break
+                            }
                         }} value={mode} size='small'>
                             <Radio.Button value="total">总</Radio.Button>
                             <Radio.Button value="detail" disabled={!adgroup}>小时</Radio.Button>
                             <Radio.Button value="minute" disabled={!adgroup}>5min</Radio.Button>
                         </Radio.Group>
+                        {mode === 'total' && <TimePicker disabledTime={disabledTime} size='small' style={{ width: 110 }} onChange={(e) => { setHour(e ? moment(e).format('H') : null) }} format="HH" />}
                         <Button size="small" icon={<CloudDownloadOutlined />} loading={downLoadLoading} onClick={downLoadExcel}>{mode === 'total' ? '总表' : mode === 'detail' ? '小时表' : '5min表'}下载</Button>
                     </Space>
                 }

+ 15 - 36
src/pages/adMonitor/adMonitorList/planList.tsx

@@ -5,7 +5,7 @@ import moment from "moment"
 import { downloadFile1, formatDate } from "@/utils/downloadFile"
 import { Button, Card, DatePicker, Input, Select, Space } from "antd"
 import PlanDetail from "./components/planDetail"
-import { CHUANGYIZHUANGTAI, GUANGGAOZHUANGTAI } from "./enum"
+import { GUANGGAOZHUANGTAI } from "./enum"
 import TableData from "@/pages/launchSystemNew/components/TableData";
 import { CloudDownloadOutlined } from "@ant-design/icons"
 import { guanggao } from "./config"
@@ -14,12 +14,10 @@ import columnsPlanList from './tablePlanListConfig'
 
 const PlanList: React.FC = () => {
     const { getAllPlanList, getBookListAll, getAdqAccountList } = useModel('useAdMonitor.useMonitor')
-    const { state } = useModel('useOperating.useWxGroupList')
+    const { getPicherList } = useModel('useOperating.useWxGroupList')
     // 变量开始
     const [queryForm, setQueryForm] = useState<allPlanProps>({ pageNum: 1, pageSize: 20, createStartTime: moment().subtract(3, 'days').format('YYYY-MM-DD'), createEndTime: moment().format('YYYY-MM-DD') }) // 搜索变量
     const [visible, setVisible] = useState<boolean>(false) // 详情弹窗控制
-    const [datas, setDatas] = useState<any[]>([])  // 所有数据
-    const [pichers, setPichers] = useState<any[]>([]) // 投手数据
     const [adId, setAdId] = useState<any>()
     const [downLoadLoading, setDownLoadLoading] = useState<boolean>(false)
     // 变量结束
@@ -29,23 +27,10 @@ const PlanList: React.FC = () => {
         getAdqAccountList.run()
     }, [])
 
+    // 获取投手
     useEffect(() => {
-        if (state?.allOfMember?.length > 0) {
-            setDatas(state?.allOfMember)
-        } else if (state?.myallOfUser?.length > 0) {
-            setDatas(state?.myallOfUser)
-        }
-    }, [state])
-
-    // 处理公众号
-    useEffect(() => {
-        if (datas.length > 0) {
-            let new_pichers = datas?.map((item: { key: { nickname: string, userId: number } }) => ({ nickName: item.key.nickname, userId: item.key.userId }))
-            if (JSON.stringify(pichers) !== JSON.stringify(new_pichers)) {//避免重复设置触发条件多次请求接口
-                setPichers(new_pichers)
-            }
-        }
-    }, [datas, queryForm?.sysUserId, pichers])
+        getPicherList.run()
+    }, [])
 
     useEffect(() => {
         if (sessionStorage.getItem('ADIDORNAME')) {
@@ -99,24 +84,11 @@ const PlanList: React.FC = () => {
     const downLoadExcel = useCallback(() => {
         setDownLoadLoading(true)
         let newQueryForm = JSON.parse(JSON.stringify(queryForm))
-        // let { page, pageSize, ...newQueryForm } = queryForm
-        Object.keys(newQueryForm).forEach((key: any) => {
-            if (key === 'mpAppIds') {
-                newQueryForm[key] = newQueryForm[key].join()
-            } else if (key === 'pitcherIds') {
-                newQueryForm[key] = newQueryForm[key]
-            }
-        })
-        if (!newQueryForm['pitcherIds'] && (!queryForm['mpAppIds'] || queryForm['mpAppIds']?.length === 0)) {
-            newQueryForm['pitcherIds'] = pichers?.map(item => item.userId)
-        }
         downLoadAllAdListApi(newQueryForm).then(res => {
             setDownLoadLoading(false)
             downloadFile1(res, 'octet-stream', formatDate(new Date()) + ".xlsx")
         }).catch(() => setDownLoadLoading(false))
-    }, [queryForm, pichers, downLoadLoading])
-
-    console.log('queryForm--->', queryForm);
+    }, [queryForm, downLoadLoading])
     
     return <Space direction='vertical' style={{ width: '100%' }} className="planlist">
         {/* 详情弹窗 */}
@@ -130,7 +102,7 @@ const PlanList: React.FC = () => {
                         filterOption={(input, option) =>
                             (option?.children as any).toLowerCase().indexOf(input.toLowerCase()) >= 0
                         }
-                        value={queryForm?.sysUserId?.map((s: any) => s.toString())}
+                        value={queryForm?.sysUserId}
                         mode='multiple'
                         maxTagCount={1}
                         style={{ minWidth: 150 }}
@@ -138,7 +110,14 @@ const PlanList: React.FC = () => {
                         placeholder="请选择投手"
                         onChange={(value: any[]) => { setQueryForm({ ...queryForm, pageNum: 1, sysUserId: value }) }}
                     >
-                        {pichers?.map((item: { nickName: string, userId: number }, index: number) => <Select.Option value={item.userId.toString()} key={item.userId + '' + index}>{item.nickName}</Select.Option>)}
+                        {getPicherList?.data?.map((item: { nickname: string, userId: number }, index: number) =>
+                            <Select.Option
+                                value={item.userId}
+                                key={item.userId + '' + index}
+                            >
+                                {item.nickname}
+                            </Select.Option>
+                        )}
                     </Select>
                     <Select
                         showSearch

+ 17 - 8
src/pages/adMonitor/adMonitorList/tableMonitorConfig.tsx

@@ -7,7 +7,7 @@ import { ReactComponent as RocketSvg } from '@/assets/rocket.svg'
 import './index.less'
 import { CHUANGYIZHUANGTAI, GOUMAILEIXING, GUANGGAOZHUANGTAI, TUIGUANGMUBIAO, YOUHUAMUBIAO } from './enum'
 import Box from './components/box'
-function columnsMonitor(planDetail: (id: number) => void, getDetailList: (adId: any) => void, details: (id: number) => void, getMinuList: (id: number) => void, mode: string) {
+function columnsMonitor(planDetail: (id: number) => void, getDetailList: (adId: any, accountId: any[]) => void, details: (id: number) => void, getMinuList: (id: number, accountId: any[]) => void, mode: string) {
     const { copy } = useCopy()
     return function columns() {
         let newArr: ColumnsType<any> = [
@@ -16,7 +16,8 @@ function columnsMonitor(planDetail: (id: number) => void, getDetailList: (adId:
                 dataIndex: 'currTime',
                 key: 'currTime',
                 align: 'center',
-                width: 160
+                width: 160,
+                ellipsis: true
             },
             {
                 title: '广告名称',
@@ -26,7 +27,7 @@ function columnsMonitor(planDetail: (id: number) => void, getDetailList: (adId:
                 width: 170,
                 ellipsis: true,
                 render: (str, b) => {
-                    return <a style={{ color: '#1890ff', fontSize: 12 }} onClick={() => { getDetailList(b.adgroupId) }}>{str}</a>
+                    return <a style={{ color: '#1890ff', fontSize: 12 }} onClick={() => { getDetailList(b.adgroupId, [b.accountId]) }}>{str}</a>
                 }
             },
             {
@@ -35,6 +36,7 @@ function columnsMonitor(planDetail: (id: number) => void, getDetailList: (adId:
                 key: 'adgroupId',
                 align: 'center',
                 width: 100,
+                ellipsis: true,
                 render: (a: any) => {
                     return <a onClick={() => { copy(a) }} style={{ color: '#3946c3' }}>{a}</a>
                 }
@@ -56,6 +58,7 @@ function columnsMonitor(planDetail: (id: number) => void, getDetailList: (adId:
                 key: 'campaignId',
                 align: 'center',
                 width: 100,
+                ellipsis: true,
                 render: (a: any) => {
                     return <a onClick={() => { copy(a) }} style={{ color: '#3946c3' }}>{a}</a>
                 }
@@ -65,6 +68,7 @@ function columnsMonitor(planDetail: (id: number) => void, getDetailList: (adId:
                 dataIndex: 'accountId',
                 key: 'accountId',
                 width: 70,
+                ellipsis: true,
                 align: 'center'
             },
             {
@@ -72,6 +76,7 @@ function columnsMonitor(planDetail: (id: number) => void, getDetailList: (adId:
                 dataIndex: 'putUserName',
                 key: 'putUserName',
                 align: 'center',
+                ellipsis: true,
                 width: 65
             },
             {
@@ -130,9 +135,7 @@ function columnsMonitor(planDetail: (id: number) => void, getDetailList: (adId:
                 key: 'adBeginTime',
                 width: 110,
                 align: 'center',
-                render: (a: any, b: any) => {
-                    return a
-                }
+                ellipsis: true
             },
             {
                 title: '广告状态',
@@ -140,6 +143,7 @@ function columnsMonitor(planDetail: (id: number) => void, getDetailList: (adId:
                 key: 'adStatus',
                 align: 'center',
                 width: 105,
+                ellipsis: true,
                 render: (a: any) => {
                     return GUANGGAOZHUANGTAI[a] || '--'
                 }
@@ -160,6 +164,7 @@ function columnsMonitor(planDetail: (id: number) => void, getDetailList: (adId:
                 key: 'promotedObjectType',
                 align: 'center',
                 width: 80,
+                ellipsis: true,
                 render: (a: any) => {
                     return TUIGUANGMUBIAO[a]
                 }
@@ -180,6 +185,7 @@ function columnsMonitor(planDetail: (id: number) => void, getDetailList: (adId:
                 key: 'dailyBudget',
                 width: 110,
                 align: 'center',
+                ellipsis: true,
                 render: (a: any) => {
                     return <Statistic value={a || 0} />
                 }
@@ -200,6 +206,7 @@ function columnsMonitor(planDetail: (id: number) => void, getDetailList: (adId:
                 key: 'bidAmount',
                 width: 110,
                 align: 'center',
+                ellipsis: true,
                 render: (a: any) => {
                     return <div style={a >= 500 ? { backgroundColor: 'rgba(255, 80, 82, .72)', height: 26, color: '#fff', display: 'flex', justifyContent: 'center', alignItems: 'center', fontWeight: 600 } : {}}><Statistic value={a || 0} valueStyle={a >= 500 ? { fontSize: 14 } : {}} /></div>
                 }
@@ -220,6 +227,7 @@ function columnsMonitor(planDetail: (id: number) => void, getDetailList: (adId:
                 key: 'costTotal',
                 align: 'center',
                 width: 100,
+                ellipsis: true,
                 sorter: true,
                 render: (a: any) => {
                     return <div style={{ height: 26, position: 'relative' }}>
@@ -264,6 +272,7 @@ function columnsMonitor(planDetail: (id: number) => void, getDetailList: (adId:
                 key: 'costHour',
                 align: 'center',
                 width: 110,
+                ellipsis: true,
                 sorter: true,
                 render: (a: any) => {
                     return <div style={{ height: 26, position: 'relative' }}>
@@ -661,9 +670,9 @@ function columnsMonitor(planDetail: (id: number) => void, getDetailList: (adId:
                                 <a style={{ color: '#1890ff' }} onClick={() => { planDetail(b) }}>广告详情</a>
                             </Menu.Item>
                             {mode === 'minute' ? <Menu.Item key="1">
-                                <a style={{ color: '#1890ff' }} onClick={() => { getDetailList(b.adgroupId) }}>小时</a>
+                                <a style={{ color: '#1890ff' }} onClick={() => { getDetailList(b.adgroupId, [b.accountId]) }}>小时</a>
                             </Menu.Item> : <Menu.Item key="1">
-                                <a style={{ color: '#1890ff' }} onClick={() => { getMinuList(b?.adgroupId) }}>5min</a>
+                                <a style={{ color: '#1890ff' }} onClick={() => { getMinuList(b?.adgroupId, [b.accountId]) }}>5min</a>
                             </Menu.Item>}
                             
                             <Menu.Item key="2">

+ 1 - 1
src/pages/adMonitor/adMonitorList/tablePlanListConfig.tsx

@@ -25,7 +25,7 @@ function columnsMonitor(details: (id: number) => void) {
                 render: (str: any, b: any) => {
                     return <div style={{ display: 'flex', flexFlow: 'column nowrap', fontSize: 12 }}>
                         <div style={{ color: '#459ae9', fontSize: 10 }}>{b.adgroupName}</div>
-                        <div style={{ color: '#888' }}>广告ID:{b?.adGroupId}</div>
+                        <div style={{ color: '#888' }}>广告ID:{b?.adgroupId}</div>
                     </div>
                 }
             },

+ 1 - 1
src/pages/launchSystemNew/components/TableData/index.tsx

@@ -262,7 +262,7 @@ const Tab = React.memo((props: any) => {
             {dataSource || !ajax?.loading ? <Tables
                 className={`all_table ${className ? className : ''}`}
                 bordered
-                sortDirections={['ascend', 'descend', null]}
+                sortDirections={['descend', 'ascend', null]}
                 current={page}
                 pageSize={pageSize}
                 columns={newColumns?.length > 0 ? newColumns : columns()}

+ 4 - 0
src/services/operating/account.ts

@@ -67,6 +67,10 @@ export async function allOfMember() {
 export async function getAllZhMemBerApi() {
   return request(`${api}/erp/resourceOfUser/allOfMember/10`);
 }
+/** 获取投手 */
+export async function getPicherListApi() {
+  return request(`${api}/erp/user/subUserWithSelf`);
+}
 
 /**编辑公众号分组 */
 export async function editGroup(params: EditGroup) {