diff --git a/api/.vscode/launch.json b/api/.vscode/launch.json index f87c4f7..7a3b8d3 100644 --- a/api/.vscode/launch.json +++ b/api/.vscode/launch.json @@ -16,9 +16,9 @@ "-p 4600", "-f http://localhost:4600", // 研发 - // "-g postgres://postgres:123@10.8.30.32:5432/orational_service", + "-g postgres://postgres:123@10.8.30.32:5432/orational_service", // 测试 - "-g postgres://FashionAdmin:123456@10.8.30.156:5432/POMS", + // "-g postgres://FashionAdmin:123456@10.8.30.156:5432/POMS", "-k 10.8.30.72:29092,10.8.30.73:29092,10.8.30.74:29092", "--iotaProxy http://10.8.30.157:17007", "--redisHost 10.8.30.112", diff --git a/web/client/src/sections/control/containers/control.jsx b/web/client/src/sections/control/containers/control.jsx index 0aefc4b..92072cc 100644 --- a/web/client/src/sections/control/containers/control.jsx +++ b/web/client/src/sections/control/containers/control.jsx @@ -2,7 +2,7 @@ import React, { useEffect, useState, useRef } from 'react'; import { connect } from 'react-redux'; import { Timeline, Card, Button, Modal, Form, Tooltip } from '@douyinfe/semi-ui'; import { push } from 'react-router-redux'; -import '../style.less' +import './control.less' import PerfectScrollbar from "perfect-scrollbar"; import repairFQA from '../../means/containers/repairFQA'; import { Setup, OutHidden } from "$components"; @@ -16,11 +16,12 @@ let equipmentScrollbar; let webScrollbar; let problemsScrollbar; let alarmScrollbar; +let pomsListScrollbar const Control = (props) => { const { dispatch, actions, user, loading, socket, pepProjectId } = props - const { control } = actions + const { control, install } = actions const [timelineList, setTimelineList] = useState(['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''])//最新动态列表 const [memberList, setMemberList] = useState([])//相关成员列表 @@ -45,6 +46,8 @@ const Control = (props) => { const [query, setQuery] = useState({ limit: 10, page: 0, projectCorrelationId: '', types: '1,2,3,4' }); //最新动态 const [querydata, setQueryData] = useState([]); //最新动态数据 const [long, setLong] = useState(''); //最新动态设置 + const [pomsList, setPomsList] = useState([]); //项目 + const [projectId, setProjectId] = useState(''); //项目id const exhibition = useRef({ workbench: [], statistical: [] }) //页面结构 @@ -66,7 +69,7 @@ const Control = (props) => { let a = msg; }); return () => { - socket.off("alarmSendSocket"); + socket.off("alarmSendSocket") } } }, [socket]) @@ -83,15 +86,46 @@ const Control = (props) => { attribute(v) }) + + }, []) useEffect(() => { - // 工作台数据请求 - dispatch(control.getConsoleCount({ pepProjectId: pepProjectId })).then(res => { - if (res.success) setWorkData(res.payload.data) - }) + if (pepProjectId) setProjectId('') + if (!pepProjectId) { + 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) + } + }) + } + if (!projectId) { + // 工作台数据请求 + 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) + }) + //查询BI分析数据-视频异常 + 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]) + }) + } + // 统计概览--异常&问题 - dispatch(control.getConsoleAbnormal({ pepProjectId: pepProjectId })).then(res => { + dispatch(control.getConsoleAbnormal({ pepProjectId: pepProjectId || projectId })).then(res => { if (res.success) { if (res.payload.data?.length > 4) { setProblemsList([...res.payload.data, ...res.payload.data]) @@ -102,7 +136,7 @@ const Control = (props) => { } }) // 统计概览--相关成员与web应用 - dispatch(control.getConsoleUser({ pepId: pepProjectId })).then(res => { + 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]) @@ -118,26 +152,11 @@ const Control = (props) => { } } }) - // 查询BI分析数据-数据 - 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) - }) - //查询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]) - }) - }, [pepProjectId]) + }, [pepProjectId, projectId]) + useEffect(() => { //查询最新动态 - console.log(31116541541); if (exhibition?.current?.dynamic?.length > 0) { dispatch(control.getLatestDynamic({ ...query, projectCorrelationId: pepProjectId })).then(res => { console.log(res.payload.data); @@ -192,6 +211,16 @@ const Control = (props) => { } } + const pomsList = document.getElementById("pomsList"); + if (pomsList) { + pomsListScrollbar = new PerfectScrollbar("#pomsList", { + suppressScrollX: true, + }); + if (pomsList && pomsListScrollbar) { + pomsListScrollbar.update(); + } + } + const domProject1 = document.getElementById("overview"); if (domProject1) { overviewScrollbar = new PerfectScrollbar("#overview", { @@ -305,7 +334,7 @@ const Control = (props) => { workbench: ['project', 'data', 'app', 'device'], statistical: ['milestone', 'personnel', 'web', 'problem'], analyse: ['dataInterrupt', 'dataAbnormal', 'policyHit', 'videoException', 'appAbnormal', 'deviceAbnormal', 'problemAnalysis'], - dynamic: ['discovery', 'notice', 'handle', 'confirm'], + dynamic: ['discovery', 'notice', 'confirm'], } let listAll = [ @@ -359,7 +388,7 @@ const Control = (props) => { exhibition.current = { ...exhibition.current, [title]: TableDisplay } setTableSetup([{ list: data }]) } - console.log(exhibition.current); + console.log(memberList) return ( <> @@ -477,6 +506,18 @@ const Control = (props) => { {/* 统计概览 */}