diff --git a/web/client/src/sections/control/containers/control.jsx b/web/client/src/sections/control/containers/control.jsx index ad8ec55..189e5df 100644 --- a/web/client/src/sections/control/containers/control.jsx +++ b/web/client/src/sections/control/containers/control.jsx @@ -85,135 +85,142 @@ const Control = (props) => { : "" attribute(v) }) - // dispatch(install.getProjectPoms({ global: 1 })).then((res) => { //获取已绑定项目 - // if (res.success) { - // let data = res.payload.data?.rows?.filter(v => v.pepProjectIsDelete !== 1)?.map(v => ({ pepProjectId: v.id, pepProjectName: v.pepProjectName || v.name })) - // setPomsList(data) - // setProjectId(data[0]?.pepProjectId) - // } - // }) + async function concentration2 () { + await dispatch(install.getProjectPoms({ global: 1 })).then((res) => { //获取已绑定项目 + if (res.success) { + let data = res.payload.data?.rows?.filter(v => v.pepProjectIsDelete !== 1)?.map(v => ({ pepProjectId: v.id, pepProjectName: v.pepProjectName || v.name })) + setPomsList(data) + setProjectId(data[0]?.pepProjectId) + } + }) + } + concentration2() return () => { } }, []) useEffect(() => { - async function csz () { + async function concentration1 () { if (pepProjectId) setProjectId(pepProjectId) if (!projectId) { // 工作台数据请求 - // await dispatch(control.getConsoleCount({ pepProjectId: pepProjectId })).then(res => { - // if (res.success) setWorkData(res.payload.data) - // }) - + await dispatch(control.getConsoleCount({ pepProjectId: pepProjectId })).then(res => { + if (res.success) setWorkData(res.payload.data) + }) // 查询BI分析数据-数据 - // dispatch(control.getDataAlarmsAggDay({ pepProjectId: pepProjectId })).then(res => { - // if (res.success) setDataBI(res.payload.data) - // }) + await dispatch(control.getDataAlarmsAggDay({ pepProjectId: pepProjectId })).then(res => { + if (res.success) setDataBI(res.payload.data) + }) // 查询BI分析数据-视频异常 - // dispatch(control.getVideoAlarmsAggDay({ pepProjectId: pepProjectId })).then(res => { - // if (res.success) setVideoBI(res.payload.data) - // }) + await dispatch(control.getVideoAlarmsAggDay({ pepProjectId: pepProjectId })).then(res => { + if (res.success) setVideoBI(res.payload.data) + }) // 查询BI分析数据-应用 - // dispatch(control.getAppAlarmsAggDay({ pepProjectId: pepProjectId })).then(res => { - // if (res.success) setAppBI(res.payload.data) - // }) - // dispatch(control.getAlarmsHandleStatistics({ pepProjectId: pepProjectId })).then(res => { - // if (res.success) setEfficiencyBI(res.payload.data[0]) - // }) + await dispatch(control.getAppAlarmsAggDay({ pepProjectId: pepProjectId })).then(res => { + if (res.success) setAppBI(res.payload.data) + }) + await dispatch(control.getAlarmsHandleStatistics({ pepProjectId: pepProjectId })).then(res => { + if (res.success) setEfficiencyBI(res.payload.data[0]) + }) } - - // 统计概览--异常&问题 - // await dispatch(control.getConsoleAbnormal({ pepProjectId: pepProjectId || projectId })).then(res => { - // if (res.success) { - // if (res.payload.data?.length > 4) { - // setProblemsList([...res.payload.data, ...res.payload.data]) - // startmarquee('problems') - // } else { - // setProblemsList(res.payload.data) - // } - // } - // }) + await dispatch(control.getConsoleAbnormal({ pepProjectId: pepProjectId || projectId })).then(res => { + if (res.success) { + if (res.payload.data?.length > 4) { + setProblemsList([...res.payload.data, ...res.payload.data]) + startmarquee('problems') + } else { + setProblemsList(res.payload.data) + } + } + }) + // 统计概览--相关成员与web应用 + await dispatch(control.getConsoleUser({ pepId: pepProjectId || projectId })).then(res => { + if (res.success) { + if (res.payload.data?.personnel?.length > 5) { + setMemberList([...res.payload.data?.personnel, ...res.payload.data?.personnel]) + startmarquee('member') + } else { + setMemberList(res.payload.data?.personnel) + } + if (res.payload.data?.webApp?.length > 3) { + setWebList([...res.payload.data?.webApp, ...res.payload.data?.webApp]) + startmarquee('web') + } else { + setWebList(res.payload.data?.webApp) + } + } + }) } - csz() - // 统计概览--相关成员与web应用 - // dispatch(control.getConsoleUser({ pepId: pepProjectId || projectId })).then(res => { - // if (res.success) { - // if (res.payload.data?.personnel?.length > 5) { - // setMemberList([...res.payload.data?.personnel, ...res.payload.data?.personnel]) - // startmarquee('member') - // } else { - // setMemberList(res.payload.data?.personnel) - // } - // if (res.payload.data?.webApp?.length > 3) { - // setWebList([...res.payload.data?.webApp, ...res.payload.data?.webApp]) - // startmarquee('web') - // } else { - // setWebList(res.payload.data?.webApp) - // } - // } - // }) + concentration1() + + + + + }, [pepProjectId, projectId]) // console.log(exhibition?.current?.dynamic); useEffect(() => { //查询最新动态 - // if (exhibition?.current?.dynamic?.length > 0) { - // console.log(query?.page); - // dispatch(control.getLatestDynamic({ ...query, projectCorrelationId: pepProjectId })).then(res => { - // // console.log(res.payload.data); - // if (res.payload.data?.appear?.length || 0 + res.payload.data?.confirm?.length + res.payload.data?.notice?.length < 10) setASk(false) - // let data = [] - // if (res.success) { - // if (exhibition?.current?.dynamic?.find(v => v.key == 'discovery')) { - // res.payload.data?.appear?.map(v => data.push({ - // seed: 'discovery', - // project: v.projectName, - // sources: v.alarmInfo?.sourceName, - // type: v.type, - // time: v.time, - // id: v.id, - // })) - // } - // if (exhibition?.current?.dynamic?.find(v => v.key == 'confirm')) { - // res.payload.data?.confirm?.map(v => data.push({ - // seed: 'confirm', - // project: v.projectName, - // sources: v.alarmInfo?.source, - // type: v.alarmInfo?.type, - // time: v.confirmTime, - // userName: v.userName, - // id: v.id, - // })) - // } - // if (exhibition?.current?.dynamic?.find(v => v.key == 'notice')) { - // res.payload.data?.notice?.map(v => data.push({ - // seed: 'notice', - // time: v.time, - // project: v.projectName, - // userName: v.userName?.map(u => u.name), - // alarmPushConfig: v.alarmPushConfig?.name, - // tactics: v.tactics, - // interval: v.tacticsParams?.interval, - // deviceProportion: v.tacticsParams?.deviceProportion, - // id: v.id, - // })) - // } - // data.sort((a, b) => { - // if (moment(a.time).isBefore(b.time)) { - // return 1 - // } else { - // return -1 - // } - // }) - // console.log(data) - // querydata.current = data - // setQueryData1(data) - // } - // }) - // } - + async function concentration3 () { + if (exhibition?.current?.dynamic?.length > 0) { + console.log(query?.page); + await dispatch(control.getLatestDynamic({ ...query, projectCorrelationId: pepProjectId })).then(res => { + // console.log(res.payload.data); + if (res.payload.data?.appear?.length || 0 + res.payload.data?.confirm?.length + res.payload.data?.notice?.length < 10) setASk(false) + let data = [] + if (res.success) { + if (exhibition?.current?.dynamic?.find(v => v.key == 'discovery')) { + res.payload.data?.appear?.map(v => data.push({ + seed: 'discovery', + project: v.projectName, + sources: v.alarmInfo?.sourceName, + type: v.type, + time: v.time, + id: v.id, + })) + } + if (exhibition?.current?.dynamic?.find(v => v.key == 'confirm')) { + res.payload.data?.confirm?.map(v => data.push({ + seed: 'confirm', + project: v.projectName, + sources: v.alarmInfo?.source, + type: v.alarmInfo?.type, + time: v.confirmTime, + userName: v.userName, + id: v.id, + })) + } + if (exhibition?.current?.dynamic?.find(v => v.key == 'notice')) { + res.payload.data?.notice?.map(v => data.push({ + seed: 'notice', + time: v.time, + project: v.projectName, + userName: v.userName?.map(u => u.name), + alarmPushConfig: v.alarmPushConfig?.name, + tactics: v.tactics, + interval: v.tacticsParams?.interval, + deviceProportion: v.tacticsParams?.deviceProportion, + id: v.id, + })) + } + data.sort((a, b) => { + if (moment(a.time).isBefore(b.time)) { + return 1 + } else { + return -1 + } + }) + console.log(data) + querydata.current = data + setQueryData1(data) + } + }) + } + } + concentration3() }, [pepProjectId, exhibition.current]) useEffect(() => { @@ -370,9 +377,9 @@ const Control = (props) => { }) const consoleToollink = () => { - // dispatch(control.getConsoleToollink()).then(res => { - // if (res.success) setToolShow(res.payload.data) - // }) + dispatch(control.getConsoleToollink()).then(res => { + if (res.success) setToolShow(res.payload.data) + }) } //轮播