From 9a37c5e1b2190c3f6ec71483923922189091dd52 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Wed, 18 Dec 2024 09:42:01 +0800
Subject: [PATCH] 事件模拟更新
---
src/views/survey/components/box/fireContent.vue | 54 +++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 37 insertions(+), 17 deletions(-)
diff --git a/src/views/survey/components/box/fireContent.vue b/src/views/survey/components/box/fireContent.vue
index 0c30979..fdb448c 100644
--- a/src/views/survey/components/box/fireContent.vue
+++ b/src/views/survey/components/box/fireContent.vue
@@ -2,7 +2,7 @@
* @Author: shuishen 1109946754@qq.com
* @Date: 2024-11-04 16:32:04
* @LastEditors: shuishen 1109946754@qq.com
- * @LastEditTime: 2024-11-05 17:42:44
+ * @LastEditTime: 2024-12-03 12:57:49
* @FilePath: \bigScreen\src\views\survey\components\box\fireContent.vue
* @Description:
*
@@ -15,25 +15,27 @@
let $echarts = inject('echarts')
const curEcharts = ref(null)
-let myEcharts = reactive(null)
+let myEcharts = reactive({
+ chart: ''
+})
let typeLevel = [
{
- name: '低',
+ name: '暂定',
itemStyle: {
- color: '#31B5FF'
+ color: '#ADADAD'
}
},
{
name: '一般',
itemStyle: {
- color: '#FFC000'
+ color: '#FFC000'
}
},
{
name: '较大',
itemStyle: {
-
+
color: '#F4090F'
}
},
@@ -49,17 +51,17 @@
getRiskSourceStatistic().then(res => {
let data = res.data.data
let dataRsult = []
- var total = 0;
+ var total = 0
data.forEach(item => {
dataRsult.push({
name: item.riskLevel,
value: item.num,
itemStyle: typeLevel.find(i => i.name == item.riskLevel).itemStyle
})
- total = total + item.num;
+ total = total + item.num
})
- myEcharts.setOption({
+ myEcharts.chart.setOption({
title: {
text: "总数",
subtext: String(total),
@@ -73,16 +75,18 @@
color: "#fff",
},
textAlign: "center",
- right: "43%",
+ left: "62%",
+ // right: "43%",
top: "36%",
},
+
legend: {
orient: "vertical",
- top: '8%',
- right: "8%",
+ top: "40%",
+ left: "5%",
textStyle: {
- color: '#fff'
- }
+ color: "#fff",
+ },
},
grid: {
@@ -103,7 +107,14 @@
type: 'pie',
left: '-5%',
radius: ['45%', '75%'],
- data: dataRsult
+ data: dataRsult,
+ left: "25%",
+ label: {
+ show: false,
+ },
+ labelLine: {
+ show: false,
+ },
}
]
})
@@ -111,15 +122,24 @@
}
nextTick(() => {
- myEcharts = $echarts.init(curEcharts.value)
+ myEcharts.chart = $echarts.init(curEcharts.value)
getRiskSource()
})
const echartsResize = () => {
- myEcharts && myEcharts.resize()
+ myEcharts.chart && myEcharts.chart.resize()
}
useEchartsResize(echartsResize)
+
+onUnmounted(() => {
+ if (myEcharts.chart) {
+ myEcharts.chart.clear()
+ myEcharts.chart.dispose()
+
+ myEcharts.chart = null
+ }
+})
</script>
<template>
--
Gitblit v1.9.3