From bc4ea36aed76bd5e863e703d57394ae589575771 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Thu, 08 Jan 2026 17:31:12 +0800
Subject: [PATCH] feat:数据驾驶舱页面基本处理
---
applications/drone-command/src/views/dataCockpit/components/LeftContainer.vue | 98 ++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 92 insertions(+), 6 deletions(-)
diff --git a/applications/drone-command/src/views/dataCockpit/components/LeftContainer.vue b/applications/drone-command/src/views/dataCockpit/components/LeftContainer.vue
index 0708d8a..f21d5f8 100644
--- a/applications/drone-command/src/views/dataCockpit/components/LeftContainer.vue
+++ b/applications/drone-command/src/views/dataCockpit/components/LeftContainer.vue
@@ -1,18 +1,23 @@
<template>
- <div class="left-container">
+ <div class="left-container" :class="{ collapsed: collapsedModel }">
<div class="wrapper">
<TitleTemplate>异常情况告警</TitleTemplate>
<div class="category-container">
- <div class="category-item" v-for="(item, ind) in categoryList" :key="ind" @click="activeId = item.id"
- :class="{ active: activeId === item.id }">
+ <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>
</div>
</div>
<div class="content">
<component :is="currentComponent" />
</div>
+ </div>
+
+ <div class="collapse-btn" @click="toggleCollapse">
+ <span class="arrow" :class="collapsedModel ? 'right' : 'left'"></span>
</div>
</div>
</template>
@@ -23,32 +28,97 @@
import EquipmentWarning from './EquipmentWarning.vue'
import HistoryWarning from './HistoryWarning.vue'
-const activeId = ref(1)
+const props = defineProps({
+ activeId: {
+ type: Number,
+ default: 1
+ },
+ collapsed: {
+ type: Boolean,
+ default: false
+ }
+})
+
+const emit = defineEmits(['update:activeId', 'update:collapsed'])
+
+const activeIdModel = computed({
+ get: () => props.activeId,
+ set: (val) => emit('update:activeId', val)
+})
+
+const collapsedModel = computed({
+ get: () => props.collapsed,
+ set: (val) => emit('update:collapsed', val)
+})
const categoryList = ref([
{
id: 1,
name: '实时告警',
+ badge: 8,
component: RealWarning
},
{
id: 2,
name: '设备告警',
+ badge: 8,
component: EquipmentWarning
},
{
id: 3,
name: '历史告警',
+ badge: 8,
component: HistoryWarning
}
])
const currentComponent = computed(() => {
- return categoryList.value.find(i => i.id === activeId.value)?.component
+ return categoryList.value.find(i => i.id === activeIdModel.value)?.component
})
+
+const toggleCollapse = () => {
+ collapsedModel.value = !collapsedModel.value
+}
</script>
<style lang="scss" scoped>
+.left-container {
+ position: relative;
+ transition: transform 0.3s ease-in-out;
+
+ &.collapsed {
+ transform: translateX(-100%);
+ }
+}
+
+.collapse-btn {
+ 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 {
+ width: 24px;
+ height: 24px;
+ background: url('@/assets/images/dataCockpit/left-btn.png') center / 100% 100% no-repeat;
+ }
+
+ &:hover {
+ background: rgba(40, 79, 227, 0.6);
+ }
+}
+
.category-container {
display: flex;
justify-content: space-between;
@@ -95,6 +165,22 @@
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;
}
+
+ .badge {
+ position: absolute;
+ top: 16px;
+ right: 4px;
+ min-width: 16px;
+ height: 16px;
+ line-height: 16px;
+ font-size: 12px;
+ color: #FFFFFF;
+ background: #FF3B30;
+ border-radius: 9px;
+ text-align: center;
+ box-shadow: 0px 2px 6px rgba(255, 59, 48, 0.6);
+ pointer-events: none;
+ }
}
}
@@ -105,4 +191,4 @@
overflow-x: hidden;
overflow-y: auto;
}
-</style>
\ No newline at end of file
+</style>
--
Gitblit v1.9.3