告警功能增加

This commit is contained in:
weiweiw 2024-11-11 09:49:34 +08:00
parent daff010eb7
commit 2d898be6c4
2 changed files with 5 additions and 8 deletions

View File

@ -201,16 +201,14 @@ export default {
// //
handleWarning(warning) { handleWarning(warning) {
console.log(warning) console.log(warning)
const formattedTime = new Date(warning.warningTime).toLocaleString(); // const formattedTime = new Date(warning.warningTime).toLocaleString();
// //
MessageBox.alert( MessageBox.alert(
` `
<p><strong>操作人</strong>${warning.operaUserName}</p>
<p><strong>事件</strong>${warning.warningEvent}</p> <p><strong>事件</strong>${warning.warningEvent}</p>
<p><strong>内容</strong>${warning.warningContent}</p>
<p><strong>等级</strong>${warning.warningGrade}</p>
<p><strong>IP</strong>${warning.warningIp}</p> <p><strong>IP</strong>${warning.warningIp}</p>
<p><strong>时间</strong>${formattedTime}</p> <p><strong>时间</strong>${warning.warningTime}</p>
`, `,
'告警通知', '告警通知',
{ {
@ -228,9 +226,8 @@ export default {
if (this.socket && this.socket.readyState === WebSocket.OPEN) { if (this.socket && this.socket.readyState === WebSocket.OPEN) {
const message = { const message = {
warningId, warningId,
status: '1' // 1
}; };
this.socket.send(JSON.stringify(message)); this.socket.send(warningId);
console.log(`已通知后端处理告警: ${warningId}`); console.log(`已通知后端处理告警: ${warningId}`);
} }
} }