From aa18dc7a4c70744b1ceccfe5a9c4cf66d3ff42a6 Mon Sep 17 00:00:00 2001 From: lixuefeng <1126141216@qq.com> Date: Thu, 11 Dec 2025 17:27:40 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B1=BB=E5=9E=8B=EF=BC=9A=E5=BC=80=E5=8F=91?= =?UTF-8?q?=20=E6=8F=8F=E8=BF=B0=EF=BC=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/monitor/components/alarmRate.vue | 32 ++++++++++++++++++++-- src/views/monitor/components/box-2.vue | 4 +-- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/views/monitor/components/alarmRate.vue b/src/views/monitor/components/alarmRate.vue index d2e95a8..be9bf82 100644 --- a/src/views/monitor/components/alarmRate.vue +++ b/src/views/monitor/components/alarmRate.vue @@ -19,7 +19,7 @@ }, total: { type: Number, - default: () => 123456 + default: () => 0 }, colors: { type: Array, @@ -42,7 +42,14 @@ itemGap: fitChartSize(6), formatter: (name) => { let obj = props.dataList.find((item) => item.name == name) - return `{name|${name}} {value|${obj?.value}}{value|%}` + let total = getTotal(); + if(total==0){ + return `{name|${name}} {value|0}{value|%}` + }else{ + let value = ((obj?.value/total).toFixed(4)*100).toFixed(2); + return `{name|${name}} {value|${value}}{value|%}` + } + }, textStyle: { rich: { @@ -126,7 +133,26 @@ return `{value|${getTotal()}}` + '\n' + `{name|告警总数}` } } - setOption(params) + const changeChart = setOption(params) + changeChart.off('legendselectchanged'); + changeChart.on('legendselectchanged', function (e) { + var echartsArr = []; + for (let key in e.selected) { + if (e.selected[key]) { + echartsArr.push(key) + } + } + var echartsNum = 0; + props.dataList.forEach(item => { + if(echartsArr.includes(item.name)){ + echartsNum += parseFloat(item.value) + } + }) + params.series[0].label.formatter = () => { + return `{value|${echartsNum}}` + '\n' + `{name|告警总数}` + } + setOption(params) + }); } diff --git a/src/views/monitor/components/box-2.vue b/src/views/monitor/components/box-2.vue index b0be99d..ebf6d84 100644 --- a/src/views/monitor/components/box-2.vue +++ b/src/views/monitor/components/box-2.vue @@ -439,8 +439,6 @@ const handleCollect = async (id, status, index) => { if(thisVideo.value){ thisVideo.value.isCollect =1 } - console.log("88888888") - console.log( videoList.value[index].isCollect); if(index!=null){ videoList.value[index].isCollect = 1 } @@ -451,7 +449,7 @@ const handleCollect = async (id, status, index) => { } if(index!=null){ videoList.value[index].isCollect = 0 - + } } pubSub.publish('videoCollect', id)