From 4aaf97fe8b2a624eb7c64341c18c6f71555c3d58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=B2=E4=B9=88=E4=BA=86?= Date: Wed, 28 Feb 2024 20:01:21 +0800 Subject: [PATCH] =?UTF-8?q?echarts=E7=9A=84resize=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=8C=E8=B0=90=E6=B3=A2=E5=9C=A8=E7=BA=BF=E7=9B=91=E6=B5=8B?= =?UTF-8?q?=E7=82=B9=E9=87=8D=E6=96=B0=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/echarts/MyEchart.vue | 18 +- src/components/tree/pms/pointTree.vue | 36 +- src/styles/element.scss | 11 +- .../monitoringPoint/online/index.vue | 119 ++++--- .../online/navigation/index.vue | 43 --- .../monitoringPoint/online/navigation/map.vue | 320 ------------------ .../online/wentaizhibiaohegelv/index.vue | 3 +- .../monitoringPoint/online/index.vue | 37 +- .../online/navigation/index.vue | 2 +- 9 files changed, 146 insertions(+), 443 deletions(-) delete mode 100644 src/views/pqs/harmonicMonitoring/monitoringPoint/online/navigation/index.vue delete mode 100644 src/views/pqs/harmonicMonitoring/monitoringPoint/online/navigation/map.vue diff --git a/src/components/echarts/MyEchart.vue b/src/components/echarts/MyEchart.vue index 73631442..0dfa751e 100644 --- a/src/components/echarts/MyEchart.vue +++ b/src/components/echarts/MyEchart.vue @@ -15,6 +15,8 @@ const chartRef = ref() const props = defineProps(['options']) let chart: echarts.ECharts | any = null const resizeHandler = () => { + // 不在视野中的时候不进行resize + if(chartRef.value!.offsetHeight == 0) return chart.getZr().painter.getViewportRoot().style.display = 'none' requestAnimationFrame(() => { chart.resize() @@ -197,13 +199,25 @@ const handlerXAxis = () => { } } } +let throttle: ReturnType +// 动态计算table高度 +const resizeObserver = new ResizeObserver(entries => { + for (const entry of entries) { + if (throttle) { + clearTimeout(throttle) + } + throttle = setTimeout(() => { + resizeHandler() + }, 100) + } +}) onMounted(() => { initChart() - window.addEventListener('resize', resizeHandler) + resizeObserver.observe(chartRef.value!) }) defineExpose({ initChart }) onBeforeUnmount(() => { - window.removeEventListener('resize', resizeHandler) + resizeObserver.unobserve(chartRef.value!) chart?.dispose() }) watch( diff --git a/src/components/tree/pms/pointTree.vue b/src/components/tree/pms/pointTree.vue index e07e4329..362d965b 100644 --- a/src/components/tree/pms/pointTree.vue +++ b/src/components/tree/pms/pointTree.vue @@ -1,25 +1,25 @@ - + diff --git a/src/styles/element.scss b/src/styles/element.scss index e6b025af..91a1fbef 100644 --- a/src/styles/element.scss +++ b/src/styles/element.scss @@ -130,6 +130,13 @@ } } -.el-select{ +.el-select { min-width: 220px; -} \ No newline at end of file +} + +.el-tabs__content { + height: calc(100% - 40px); + .el-tab-pane{ + height: 100%; + } +} diff --git a/src/views/pqs/harmonicMonitoring/monitoringPoint/online/index.vue b/src/views/pqs/harmonicMonitoring/monitoringPoint/online/index.vue index d1a35a04..9b1eafa5 100644 --- a/src/views/pqs/harmonicMonitoring/monitoringPoint/online/index.vue +++ b/src/views/pqs/harmonicMonitoring/monitoringPoint/online/index.vue @@ -1,38 +1,53 @@ - - diff --git a/src/views/pqs/harmonicMonitoring/monitoringPoint/online/navigation/map.vue b/src/views/pqs/harmonicMonitoring/monitoringPoint/online/navigation/map.vue deleted file mode 100644 index 93cdcc3b..00000000 --- a/src/views/pqs/harmonicMonitoring/monitoringPoint/online/navigation/map.vue +++ /dev/null @@ -1,320 +0,0 @@ - - - - diff --git a/src/views/pqs/harmonicMonitoring/monitoringPoint/online/wentaizhibiaohegelv/index.vue b/src/views/pqs/harmonicMonitoring/monitoringPoint/online/wentaizhibiaohegelv/index.vue index baa5818d..24dff4b2 100644 --- a/src/views/pqs/harmonicMonitoring/monitoringPoint/online/wentaizhibiaohegelv/index.vue +++ b/src/views/pqs/harmonicMonitoring/monitoringPoint/online/wentaizhibiaohegelv/index.vue @@ -4,7 +4,7 @@ - + { } }, xAxis: { + name:'指标类型', type: 'category', axisLine: { lineStyle: { diff --git a/src/views/pqs/voltageSags/monitoringPoint/online/index.vue b/src/views/pqs/voltageSags/monitoringPoint/online/index.vue index b7127a24..2700315a 100644 --- a/src/views/pqs/voltageSags/monitoringPoint/online/index.vue +++ b/src/views/pqs/voltageSags/monitoringPoint/online/index.vue @@ -1,23 +1,23 @@ - -