From 1d46e10e2a56b2cf56d5453d908e06d2ba24ef3e Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Tue, 13 Jan 2026 14:44:43 +0800
Subject: [PATCH] feat: 校验调整

---
 applications/drone-command/src/views/dataCockpit/components/LeftContainer.vue |   55 ++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 40 insertions(+), 15 deletions(-)

diff --git a/applications/drone-command/src/views/dataCockpit/components/LeftContainer.vue b/applications/drone-command/src/views/dataCockpit/components/LeftContainer.vue
index f21d5f8..7b54029 100644
--- a/applications/drone-command/src/views/dataCockpit/components/LeftContainer.vue
+++ b/applications/drone-command/src/views/dataCockpit/components/LeftContainer.vue
@@ -7,7 +7,7 @@
 				<div class="category-item" v-for="(item, ind) in categoryList" :key="ind"
 					@click="activeIdModel = item.id" :class="{ active: activeIdModel === item.id }">
 					{{ item.name }}
-					<span class="badge">{{ item.badge }}</span>
+					<span class="badge" v-if="item.badge">{{ item.badge }}</span>
 				</div>
 			</div>
 
@@ -27,6 +27,8 @@
 import RealWarning from './RealWarning.vue'
 import EquipmentWarning from './EquipmentWarning.vue'
 import HistoryWarning from './HistoryWarning.vue'
+import { alarmStatisticsApi } from '@/api/dataCockpit'
+import { onMounted } from 'vue'
 
 const props = defineProps({
 	activeId: {
@@ -55,19 +57,19 @@
 	{
 		id: 1,
 		name: '实时告警',
-		badge: 8,
+		badge: 0,
 		component: RealWarning
 	},
 	{
 		id: 2,
 		name: '设备告警',
-		badge: 8,
+		badge: 0,
 		component: EquipmentWarning
 	},
 	{
 		id: 3,
 		name: '历史告警',
-		badge: 8,
+		badge: 0,
 		component: HistoryWarning
 	}
 ])
@@ -79,6 +81,24 @@
 const toggleCollapse = () => {
 	collapsedModel.value = !collapsedModel.value
 }
+
+const updateBadges = async () => {
+	const res = await alarmStatisticsApi()
+	const data = res?.data?.data || {}
+	const realTotal = data.realTimeAlarmCount ?? 0
+	const historyTotal = data.historyAlarmCount ?? 0
+	const deviceTotal = data.deviceAlarmCount ?? 0
+	categoryList.value = categoryList.value.map((item) => {
+		if (item.id === 1) return { ...item, badge: realTotal }
+		if (item.id === 2) return { ...item, badge: deviceTotal }
+		if (item.id === 3) return { ...item, badge: historyTotal }
+		return item
+	})
+}
+
+onMounted(() => {
+	updateBadges()
+})
 </script>
 
 <style lang="scss" scoped>
@@ -95,17 +115,12 @@
 	position: absolute;
 	top: 50%;
 	left: 357px;
-	background: rgba(17, 23, 34, 0.8);
-	border: 1px solid #333355;
-	border-left: none;
-	border-radius: 0 4px 4px 0;
 	cursor: pointer;
 	display: flex;
 	align-items: center;
 	justify-content: center;
 	color: #fff;
 	z-index: 10;
-	backdrop-filter: blur(5px);
 	transform: translateY(-50%);
 
 	.arrow {
@@ -120,8 +135,19 @@
 }
 
 .category-container {
+	position: relative;
 	display: flex;
 	justify-content: space-between;
+
+	&::after {
+		content: '';
+		position: absolute;
+		left: 0;
+		bottom: 0;
+		width: 100%;
+		height: 1px;
+		background: #333355;
+	}
 
 	.category-item {
 		position: relative;
@@ -155,8 +181,7 @@
 			left: 0;
 			bottom: 0;
 			width: 100%;
-			height: 1px;
-			background: #333355;
+			height: 0;
 		}
 
 		&.active::after {
@@ -164,19 +189,19 @@
 			background: #284FE3;
 			box-shadow: 0px 3px 2px 0px rgba(15, 89, 255, 0.1), 0px 7px 5px 0px rgba(15, 89, 255, 0.15), 0px 13px 10px 0px rgba(15, 89, 255, 0.18), 0px 22px 18px 0px rgba(15, 89, 255, 0.21), 0px 42px 33px 0px rgba(15, 89, 255, 0.26), 0px 100px 80px 0px rgba(15, 89, 255, 0.36);
 			border-radius: 5px 5px 0px 0px;
+			z-index: 9;
 		}
 
 		.badge {
 			position: absolute;
 			top: 16px;
 			right: 4px;
-			min-width: 16px;
-			height: 16px;
-			line-height: 16px;
+			min-width: 18px;
+			line-height: 18px;
 			font-size: 12px;
 			color: #FFFFFF;
 			background: #FF3B30;
-			border-radius: 9px;
+			border-radius: 50%;
 			text-align: center;
 			box-shadow: 0px 2px 6px rgba(255, 59, 48, 0.6);
 			pointer-events: none;

--
Gitblit v1.9.3