diff --git a/src/views/dashboard/Pam/RiskSummary.vue b/src/views/dashboard/Pam/RiskSummary.vue index f2f408e25..d5df9a8b5 100644 --- a/src/views/dashboard/Pam/RiskSummary.vue +++ b/src/views/dashboard/Pam/RiskSummary.vue @@ -96,6 +96,14 @@ export default { } ] + // 过滤出值大于0的项目 + let filteredData = data.filter(item => item.value > 0) + + // 如果没有值大于0的项目,则显示前5个 + if (filteredData.length === 0) { + filteredData = data.slice(0, 5) + } + return { grid: { top: '5%', @@ -123,7 +131,7 @@ export default { }, yAxis: { type: 'category', - data: data.map(item => item.name), + data: filteredData.map(item => item.name), axisLine: { show: false }, axisTick: { show: false }, axisLabel: { @@ -145,7 +153,7 @@ export default { series: [ { type: 'bar', - data: data.map(item => item.value), + data: filteredData.map(item => item.value), barWidth: '60%', label: { show: false, diff --git a/src/views/dashboard/Pam/SummaryChart.vue b/src/views/dashboard/Pam/SummaryChart.vue index e0fffacbe..265f8d69a 100644 --- a/src/views/dashboard/Pam/SummaryChart.vue +++ b/src/views/dashboard/Pam/SummaryChart.vue @@ -79,19 +79,14 @@ export default { show: false }, tooltip: { - trigger: 'axis', - axisPointer: { - type: 'cross', - label: { - } - } + trigger: 'axis' }, legend: { show: false }, grid: { left: '3%', - right: 0, + right: '3%', bottom: 0 }, xAxis: [ @@ -99,7 +94,7 @@ export default { show: false, type: 'category', boundaryGap: false, - data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] + data: [this.$t('Privileged'), this.$t('ResetSecret'), this.$t('Connectable'), this.$t('Valid')] } ], yAxis: [ @@ -110,7 +105,6 @@ export default { ], series: [ { - name: 'Line 1', type: 'line', stack: 'Total', smooth: true, @@ -123,7 +117,6 @@ export default { }, showSymbol: false, areaStyle: { - opacity: 0.8, color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ { offset: 0, @@ -138,12 +131,27 @@ export default { emphasis: { focus: 'series' }, - data: [0, 232, 101, 264, 90, 340, 0] + data: [] } ] } } }, + watch: { + config: { + handler(newData) { + if (this.chart) { + this.chart.setOption({ + series: [{ + data: [newData.privileged, newData.resetSecret, newData.valid, newData.connectable] + }] + }) + } + }, + immediate: true, + deep: true + } + }, mounted() { this.initChart() window.addEventListener('resize', this.resizeChart)