|
|
@ -56,22 +56,20 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject |
|
|
|
const [ask, setASk] = useState(true); //是否继续请求 |
|
|
|
const [setData, setSetData] = useState(); //设置总数 |
|
|
|
const [projectData, setProjectData] = useState([]); //项目总信息 |
|
|
|
const [socketData, setSocketData] = useState(); //推送数据 |
|
|
|
|
|
|
|
|
|
|
|
const exhibition = useRef({ workbench: [], statistical: [] }) //页面结构 |
|
|
|
const FormApi = useRef() |
|
|
|
const querydata = useRef([])//最新动态数据 |
|
|
|
// const socketData = useRef(1) //推送数据 |
|
|
|
|
|
|
|
// websocket 使用测试 |
|
|
|
useEffect(() => { |
|
|
|
if (socket) { |
|
|
|
socket.on('alarmSendSocket', function (msg) { |
|
|
|
// console.info(msg); |
|
|
|
|
|
|
|
// console.info(msg); |
|
|
|
console.log(msg); |
|
|
|
socket.on('alarmSendSocket', (msg) => { |
|
|
|
if (msg?.msgDataMap) { |
|
|
|
|
|
|
|
setSocketData(msg?.msgDataMap) |
|
|
|
} |
|
|
|
let a = msg; |
|
|
|
}); |
|
|
@ -81,6 +79,47 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject |
|
|
|
} |
|
|
|
}, [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(() => { |
|
|
|
consoleToollink() |
|
|
|
|
|
|
@ -919,7 +958,7 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject |
|
|
|
pathname: v.url, |
|
|
|
query: { |
|
|
|
keywordTarget: v.groupName == '应用异常' ? "" : 'source', |
|
|
|
keyword:v.SourceName, |
|
|
|
keyword: v.SourceName, |
|
|
|
} |
|
|
|
}) |
|
|
|
}}> |
|
|
@ -1157,9 +1196,9 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject |
|
|
|
{querydata.current?.map((v, index) => { |
|
|
|
let title = '' |
|
|
|
if (v.seed == 'discovery') { |
|
|
|
title = v.project + v.sources + ',诊断为' + v.type |
|
|
|
title = v.project + '【' + v.sources + '】' + ',诊断为' + v.type |
|
|
|
} else if (v.seed == 'confirm') { |
|
|
|
title = v.userName + '确认并关闭' + v.project + v.sources + v.type + '的问题' |
|
|
|
title = v.userName + '确认并关闭' + v.project + '【' + v.sources + '】' + v.type + '的问题' |
|
|
|
} else { |
|
|
|
title = '【信鸽-' + v.alarmPushConfig + '】已邮件通知' + |
|
|
|
v.userName?.map((u, i) => (i > 0 ? ',' + u : u)) + '【' + v.project + '】【' + |
|
|
|