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)