Browse Source

推送 50%

dev
wenlele 2 years ago
parent
commit
b74707a5e2
  1. 55
      web/client/src/sections/control/containers/control.jsx

55
web/client/src/sections/control/containers/control.jsx

@ -56,22 +56,20 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject
const [ask, setASk] = useState(true); // const [ask, setASk] = useState(true); //
const [setData, setSetData] = useState(); // const [setData, setSetData] = useState(); //
const [projectData, setProjectData] = useState([]); // const [projectData, setProjectData] = useState([]); //
const [socketData, setSocketData] = useState(); //
const exhibition = useRef({ workbench: [], statistical: [] }) // const exhibition = useRef({ workbench: [], statistical: [] }) //
const FormApi = useRef() const FormApi = useRef()
const querydata = useRef([])// const querydata = useRef([])//
// const socketData = useRef(1) //
// websocket 使 // websocket 使
useEffect(() => { useEffect(() => {
if (socket) { if (socket) {
socket.on('alarmSendSocket', function (msg) { socket.on('alarmSendSocket', (msg) => {
// console.info(msg);
// console.info(msg);
console.log(msg);
if (msg?.msgDataMap) { if (msg?.msgDataMap) {
setSocketData(msg?.msgDataMap)
} }
let a = msg; let a = msg;
}); });
@ -81,6 +79,47 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject
} }
}, [socket]) }, [socket])
useEffect(() => {
if (socketData) {
console.log(socketData)
console.log(problemsList)
let workbench = workData
let problems = problemsList
if (socketData?.appear?.length > 0) {
socketData?.appear?.map(v => {
if (v.type == '应用异常') {
workbench.appNewAdd++
} else if (v.type == '设备异常') {
workbench.toolNewAdd++
} else {
workbench.dataNewAdd++
}
})
}
if (socketData?.confirm?.length > 0) {
socketData?.confirm?.map(v => {
if (v.type == '应用异常') {
workbench.appConfirme++
} else if (v.type == '设备异常') {
workbench.toolConfirme++
} else {
workbench.dataConfirme++
}
})
}
workbench.appSurplus += (workbench.appNewAdd - workbench.appConfirme)
workbench.toolSurplus += (workbench.toolNewAdd - workbench.toolConfirme)
workbench.dataSurplus += (workbench.dataNewAdd - workbench.dataConfirme)
setWorkData({ ...workbench })
if (socketData?.notice?.length > 0) {
}
}
}, [socketData])
useEffect(() => { useEffect(() => {
consoleToollink() consoleToollink()
@ -1157,9 +1196,9 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject
{querydata.current?.map((v, index) => { {querydata.current?.map((v, index) => {
let title = '' let title = ''
if (v.seed == 'discovery') { if (v.seed == 'discovery') {
title = v.project + v.sources + ',诊断为' + v.type title = v.project + '【' + v.sources + '】' + ',诊断为' + v.type
} else if (v.seed == 'confirm') { } else if (v.seed == 'confirm') {
title = v.userName + '确认并关闭' + v.project + v.sources + v.type + '的问题' title = v.userName + '确认并关闭' + v.project + '【' + v.sources + '】' + v.type + '的问题'
} else { } else {
title = '【信鸽-' + v.alarmPushConfig + '】已邮件通知' + title = '【信鸽-' + v.alarmPushConfig + '】已邮件通知' +
v.userName?.map((u, i) => (i > 0 ? ',' + u : u)) + '【' + v.project + '】【' + v.userName?.map((u, i) => (i > 0 ? ',' + u : u)) + '【' + v.project + '】【' +

Loading…
Cancel
Save