diff --git a/src/views/entityExplorer/EntityExplorer.vue b/src/views/entityExplorer/EntityExplorer.vue index c49e15a4..fd532044 100644 --- a/src/views/entityExplorer/EntityExplorer.vue +++ b/src/views/entityExplorer/EntityExplorer.vue @@ -28,7 +28,6 @@
{ - response.forEach((item1, index) => { - if (item1.status === 200 && item1.data.data.list) { - if (item1.data.data.list.length >= 5) { - this.newFilterData[index].showNum = 5 - } else { - this.newFilterData[index].showNum = item1.data.data.list.length - } - this.newFilterData[index].data = [] - item1.data.data.list.forEach((item, i) => { - let obj = { - label: item.value, - topColumn: this.newFilterData[index].topColumn, - value: item.uniqueEntities, - showNum: 5 + const requests = [aggCountry, aggCity, aggIPAsn, aggIPIsp, aggPort, aggDomain, aggAppCategory, aggTag] + requests.forEach((req, index) => { + this.newFilterData[index].loading = true + if (req) { + req.then(response => { + if (response.status === 200 && response.data.data.list) { + if (response.data.data.list.length >= 5) { + this.newFilterData[index].showNum = 5 + } else { + this.newFilterData[index].showNum = response.data.data.list.length } - if (index === 0) { - obj.flag = item.value // 接口字段名称为'China',svg名称为'CN',通过countryNameIdMapping进行转换 - } - if (index === 4) { - obj = { + this.newFilterData[index].data = [] + response.data.data.list.forEach(item => { + let obj = { + label: item.value, topColumn: this.newFilterData[index].topColumn, - topColumn1: this.newFilterData[index].topColumn1, - port: item.port, - l7Protocol: item.l7Protocol, value: item.uniqueEntities, showNum: 5 } - } - this.newFilterData[index].data.push(obj) - }) - } - }) - }).catch(e => { - this.$message.error(e.response.data.message) - }).finally(() => { - this.loadingLeft = false + if (index === 0) { + obj.flag = item.value // 接口字段名称为'China',svg名称为'CN',通过countryNameIdMapping进行转换 + } + if (index === 4) { + obj = { + topColumn: this.newFilterData[index].topColumn, + topColumn1: this.newFilterData[index].topColumn1, + port: item.port, + l7Protocol: item.l7Protocol, + value: item.uniqueEntities, + showNum: 5 + } + } + this.newFilterData[index].data.push(obj) + }) + } + }).catch(e => { + this.$message.error(e.response.data.message) + }).finally(() => { + this.newFilterData[index].loading = false + this.newFilterData[index].firstLoad = false + }) + } }) }, /** 实体列表查询 */ @@ -736,6 +754,7 @@ export default { const ssl = axios.get(api.npm.overview.sslConDelay, { params: params }) const tcpPercent = axios.get(api.npm.overview.tcpLostlenPercent, { params: params }) const packetPercent = axios.get(api.npm.overview.packetRetransPercent, { params: params }) + // 需要值都请求到才计算,使用promise.all Promise.all([tcp, http, ssl, tcpPercent, packetPercent]).then(res => { const scoreBase = {} res.forEach((t, i) => { @@ -759,7 +778,7 @@ export default { } }) this.$store.commit('setScoreBase', scoreBase) - }).catch((e) => { + }).catch(() => { }).finally(() => { }) }, @@ -806,8 +825,8 @@ export default { hideRelatedEntities (e) { this.isHideRelatedEntities = e this.reloadUrl({ hideRelated: e }) - this.queryFilterNew({ q: this.q, ...this.pageObj, ...this.timeFilter }) this.queryList({ q: this.q, ...this.pageObj, ...this.timeFilter }) + this.queryFilterNew({ q: this.q, ...this.pageObj, ...this.timeFilter }) this.queryCount({ q: this.q, ...this.pageObj, ...this.timeFilter }) } }, diff --git a/src/views/entityExplorer/EntityFilter.vue b/src/views/entityExplorer/EntityFilter.vue index 3a4287d2..6614e451 100644 --- a/src/views/entityExplorer/EntityFilter.vue +++ b/src/views/entityExplorer/EntityFilter.vue @@ -11,7 +11,7 @@
- +
+ @@ -54,15 +55,13 @@ import Loading from '@/components/common/Loading' import ChartNoData from '@/views/charts/charts/ChartNoData' import { countryNameIdMapping } from '@/utils/constants' +import _ from 'lodash' export default { name: 'EntityFilter', components: { ChartNoData, Loading }, props: { filterData: { type: Array - }, - loadingLeft: { - type: Boolean } }, computed: { @@ -73,6 +72,9 @@ export default { }) return length + }, + isFirstLoad () { + return this.myFilterData.some(d => d.firstLoad) } }, data () { @@ -85,6 +87,14 @@ export default { mounted () { this.myFilterData = this.filterData }, + watch: { + filterData: { + deep: true, + handler (n) { + this.myFilterData = _.cloneDeep(n) + } + } + }, methods: { /** * 判断文字是否溢出,超出则鼠标移入tooltip显示,否则鼠标移入不显示 @@ -113,7 +123,3 @@ export default { } } - -