fix: 实体列表左侧筛选dns占比错误修复

This commit is contained in:
chenjinsong
2022-05-17 19:18:26 +08:00
parent 3b8539ae95
commit 1033eb9ddc
3 changed files with 38 additions and 4 deletions

View File

@@ -6,7 +6,7 @@
<span>{{itemData.label}}</span>
</div>
</div>
<button @click="esc" class="el-dialog__headerbtn" type="button"><i class="el-dialog__close el-icon el-icon-close"></i></button>
<!-- <button @click="esc" class="el-dialog__headerbtn" type="button"><i class="el-dialog__close el-icon el-icon-close"></i></button>-->
<div class="filter-top-box">
<div class="filter-top-body">
<loading :loading="loading"></loading>
@@ -33,8 +33,8 @@
<el-table-column prop="percent" :label="$t('overall.percent')" >
<template #default="scope">
<div class="top-table-percent" >
{{(totalCount === 0 ? 0 : parseFloat(scope.row.count / totalCount) * 100).toFixed(2)}}%
<div class="top-table-progress"><el-progress :percentage="(totalCount === 0 ? 0 : parseFloat(scope.row.count / totalCount) * 100).toFixed(2)" :show-text="false" color="#23BF9A"></el-progress></div>
{{totalCount2(scope.row)}}%
<div class="top-table-progress"><el-progress :percentage="totalCount2(scope.row)" :show-text="false" color="#23BF9A"></el-progress></div>
</div>
</template>
</el-table-column>
@@ -61,6 +61,13 @@ export default {
custom: []
}
},
computed: {
totalCount2 () {
return function (row) {
return (this.totalCount === 0 ? 0 : parseFloat(row.count / this.totalCount) * 100).toFixed(2)
}
}
},
methods: {
indexMethod (index) {
return index + 1

View File

@@ -298,6 +298,9 @@ export default {
type: 'dns',
title: this.$t('dns.dnsServer'),
totalCount: 0,
osTotalCount: 0,
orgTotalCount: 0,
softwareTotalCount: 0,
data: [
{
label: this.$t('overall.dnsServerInfo.role'),
@@ -554,6 +557,9 @@ export default {
d.value = response.data.result[d.column]
})
this.filterData[3].totalCount = response.data.result.count
this.filterData[3].osTotalCount = response.data.result.osTotalCount
this.filterData[3].orgTotalCount = response.data.result.orgTotalCount
this.filterData[3].softwareTotalCount = response.data.result.softwareTotalCount
if (this.limitFilterType) {
this.cleanFilterData(0)
this.cleanFilterData(1)

View File

@@ -28,7 +28,7 @@
:loading="loading"
:popover-data="popoverData"
:item-data="itemData"
:total-count="filters.totalCount"
:total-count="totalCount"
@filter="filter"
></entity-top>
</el-popover>
@@ -61,11 +61,32 @@ export default {
topData: [],
entityTopTenData: [],
currentColumn: '',
totalCount: 0,
loading: false,
popoverData: [],
itemData: {}
}
},
watch: {
currentColumn (n, o) {
if (n === 'dnsServerOrgCount') {
this.totalCount = this.filterData[3].orgTotalCount
} else if (n === 'dnsServerSoftwareCount') {
this.totalCount = this.filterData[3].softwareTotalCount
} else if (n === 'dnsServerOsCount') {
this.totalCount = this.filterData[3].osTotalCount
} else {
let count = 0
this.filterData.forEach(f => {
const filter = f.data.some(d => d.column === n)
if (filter) {
count = f.totalCount
}
})
this.totalCount = count
}
}
},
methods: {
showTopDialog (i, item, filter) {
if (this.currentColumn === item.column && item.showTopTen) {