告警事件列表修复

This commit is contained in:
renna 2025-07-18 10:44:03 +08:00
parent 573fe982ca
commit e2f92ab293
3 changed files with 124 additions and 11 deletions

View File

@ -1173,10 +1173,10 @@ function handleUnauthorizedEntry(vehicleId, payload) {
time: `${formatTimeRange(new Date())}越界`,
description: '越界告警',
level: 'high',
type: 'access',
type: 'report', // reportAlarmNotification.vue
rawData: payload
});
console.log('越界告警------------------------------------', vehicles.value[vehicleId].type);
//
if (vehicles.value[vehicleId]) {
vehicles.value[vehicleId].critical = true;
@ -1504,6 +1504,7 @@ defineExpose({
weatherStationVisible,
vehicleDetailVisible,
vehicleDetail,
alarmList, //
toggleWeatherStationVisibility() {
weatherStationVisible.value = !weatherStationVisible.value;
},
@ -1729,4 +1730,50 @@ function createDefaultStyle(iconSrc, heading) {
})
});
}
</script>
</script>
<style scoped>
/* 告警按钮样式 */
.alarm-btn {
position: absolute;
top: 20px;
left: 20px;
width: 40px;
height: 40px;
background-color: rgba(41, 44, 56, 0.8);
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
z-index: 1000;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
transition: all 0.3s;
}
.alarm-btn:hover {
background-color: rgba(41, 44, 56, 1);
transform: scale(1.05);
}
.alarm-btn img {
width: 24px;
height: 24px;
}
.alarm-badge {
position: absolute;
top: -5px;
right: -5px;
background-color: #ff4d4f;
color: white;
font-size: 12px;
min-width: 18px;
height: 18px;
border-radius: 9px;
display: flex;
align-items: center;
justify-content: center;
padding: 0 4px;
}
</style>

View File

@ -1,5 +1,5 @@
<template>
<div class="alarm-notification-container">
<div class="alarm-notification-container" v-show="visible">
<!-- 标签页头部 -->
<div class="detail-tabs">
<div class="tab-header">
@ -23,7 +23,7 @@
:class="{ active: activeTab === 'report' }"
@click="activeTab = 'report'"
>
界告警
界告警
</div>
<div
class="tab-item"
@ -35,7 +35,7 @@
</div>
<div class="tab-actions">
<div class="close-btn" @click="$emit('close')">
<div class="close-btn" @click="handleClose">
<i class="close-icon">×</i>
</div>
</div>
@ -47,7 +47,7 @@
<div class="alarm-item" v-for="(item, index) in filteredAlarms" :key="index">
<div class="alarm-icon1" :class="item.level">
<img v-if="item.type === 'car'" src="@/assets/images/clarm_conflict.png" class="alarm-img" alt="车辆冲突" />
<img v-else-if="item.type === 'report'" src="@/assets/images/clarm_over.png" class="alarm-img" alt="界告警" />
<img v-else-if="item.type === 'report'" src="@/assets/images/clarm_over.png" class="alarm-img" alt="界告警" />
<img v-else-if="item.type === 'speed'" src="@/assets/images/speed.png" class="alarm-img" alt="超速告警" />
<i v-else class="alarm-dot"></i>
</div>
@ -71,7 +71,10 @@ import { ref, computed } from 'vue';
//
const activeTab = ref('all');
//
// /
const visible = ref(true);
//
const alarmList = ref([]);
//
@ -82,12 +85,42 @@ const filteredAlarms = computed(() => {
return alarmList.value.filter(item => item.type === activeTab.value);
});
//
//
function handleClose() {
visible.value = false;
emit('close');
}
// emit
const emit = defineEmits(['close']);
// /
defineExpose({
//
updateAlarmList(newList) {
if (newList && Array.isArray(newList)) {
alarmList.value = newList;
}
},
//
show() {
visible.value = true;
},
//
hide() {
visible.value = false;
},
// /
toggle() {
visible.value = !visible.value;
},
//
isVisible() {
return visible.value;
}
});
</script>

View File

@ -51,9 +51,13 @@
</div>
<!-- 报警通知面板 -->
<AlarmNotification v-if="showAlarmPanel" @close="showAlarmPanel = false" />
<AlarmNotification
ref="alarmNotificationRef"
v-if="showAlarmPanel"
@close="handleAlarmClose"
/>
<!-- 报警通知按钮 -->
<div class="alarm-btn" @click="showAlarmPanel = !showAlarmPanel">
<div class="alarm-btn" @click="toggleAlarmPanel">
<i class="alarm-icon"></i>
<span class="alarm-badge" v-if="alarmCount > 0">{{ alarmCount }}</span>
</div>
@ -120,6 +124,20 @@ const hasNewSpeed = ref(false);
//
const currentTime = ref('');
//
const alarmNotificationRef = ref(null);
// vehicleMovementRef
watch(() => vehicleMovementRef.value?.alarmList, (newAlarmList) => {
if (newAlarmList && alarmNotificationRef.value) {
//
alarmNotificationRef.value.updateAlarmList(newAlarmList);
//
alarmCount.value = newAlarmList.length;
}
}, { deep: true });
//
function updateCurrentTime() {
const now = new Date();
@ -174,6 +192,12 @@ function handleSetCategoryVisibility(type, settings) {
}
}
//
function handleAlarmClose() {
showAlarmPanel.value = false;
console.log('告警面板已关闭');
}
//
const isDevelopment = process.env.NODE_ENV === 'development';
@ -181,6 +205,15 @@ function toggleEventList() {
showEventList.value = !showEventList.value;
}
function toggleAlarmPanel() {
showAlarmPanel.value = !showAlarmPanel.value;
//
if (showAlarmPanel.value && alarmNotificationRef.value && vehicleMovementRef.value) {
alarmNotificationRef.value.updateAlarmList(vehicleMovementRef.value.alarmList);
}
}
function getRouteDrawControlExpose() {
// OpenLayersMaprefRouteDrawControlref
return mapRef.value?.$refs?.routeDrawControlRef;