From 056c1c95bffeb1770f46688060b0b45929397384 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BE=9A=E7=9A=93?= <1736436516@qq.com>
Date: Tue, 26 Nov 2024 16:25:47 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E6=97=B6=E5=88=B7=E6=96=B05=E5=88=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/Max/CenterBottom.vue | 489 +++++++++++++++-------------
src/components/Max/LeftMiddle.vue | 58 ++--
src/components/Max/LeftTop.vue | 39 ++-
src/components/Max/RightTop.vue | 164 ++++++++--
src/main.ts | 4 +
5 files changed, 461 insertions(+), 293 deletions(-)
diff --git a/src/components/Max/CenterBottom.vue b/src/components/Max/CenterBottom.vue
index c0f7efe..6698887 100644
--- a/src/components/Max/CenterBottom.vue
+++ b/src/components/Max/CenterBottom.vue
@@ -1,6 +1,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+.el-tabs__active-bar {
+ background-color: transparent !important;
+}
+
+
+::v-deep .el-tabs__nav-wrap::after {
+ /* width: 15vw; */
+ position: static !important;
+}
+
\ No newline at end of file
diff --git a/src/components/Max/LeftMiddle.vue b/src/components/Max/LeftMiddle.vue
index 65d8a48..43f8b47 100644
--- a/src/components/Max/LeftMiddle.vue
+++ b/src/components/Max/LeftMiddle.vue
@@ -13,7 +13,9 @@ import { ref, onMounted, onBeforeUnmount } from 'vue';
import * as echarts from 'echarts';
import { BoxApi } from '@/utils/boxApi.ts';
import { DCaret } from '@element-plus/icons-vue';
+import { useGlobalTimerStore } from '@/stores/globalTimerStore';
+const globalTimerStore = useGlobalTimerStore();
const chartContainer = ref(null);
let myChart = null;
const cameras = ref([]);
@@ -98,7 +100,7 @@ const option = ref({
data: [], // 动态填充告警数量
type: "bar",
barWidth: 10,
- padding:[0],
+ padding: [0],
showBackground: true,
barBorderRadius: [30, 0, 0, 30],
backgroundStyle: { color: 'rgba(9, 68, 131, .2)' },
@@ -236,18 +238,14 @@ const fetchCameras = async () => {
}
};
-// 清理轮播和事件监听
-onBeforeUnmount(() => {
- if (dataZoomMoveTimer) {
- clearInterval(dataZoomMoveTimer);
- dataZoomMoveTimer = null; // 确保计时器被清空
+const resizeChart = () => {
+ if (myChart && !myChart.isDisposed()) {
+ myChart.resize();
+ } else {
+ console.warn('Attempted to resize a disposed ECharts instance.');
}
- if (myChart) {
- window.removeEventListener('resize', resizeChart); // 确保事件监听器被移除
- myChart.dispose();
- myChart = null;
- }
-});
+};
+
@@ -259,16 +257,26 @@ onMounted(async () => {
// 监听窗口变化事件,调整图表大小
window.addEventListener('resize', resizeChart);
+
+ globalTimerStore.registerCallback(fetchCameras);
+ globalTimerStore.startTimer();
+
});
-
-const resizeChart = () => {
- if (myChart && !myChart.isDisposed()) {
- myChart.resize();
- } else {
- console.warn('Attempted to resize a disposed ECharts instance.');
+// 清理轮播和事件监听
+onBeforeUnmount(() => {
+ if (dataZoomMoveTimer) {
+ clearInterval(dataZoomMoveTimer);
+ dataZoomMoveTimer = null; // 确保计时器被清空
}
-};
+ if (myChart) {
+ window.removeEventListener('resize', resizeChart); // 确保事件监听器被移除
+ myChart.dispose();
+ myChart = null;
+ }
+ globalTimerStore.unregisterCallback(fetchCameras);
+ globalTimerStore.stopTimer();
+});
// const resizeChart = () => {
@@ -283,23 +291,25 @@ const resizeChart = () => {