From 5ba4d8a1fedff6062e99e464f00b9181d44b816d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=88=98=E6=B4=AA=E6=B4=AA?= <2498601771@qq.com>
Date: Mon, 25 Dec 2023 16:27:45 +0800
Subject: [PATCH] =?UTF-8?q?CN-1520=20fix:=20=E8=B0=83=E6=95=B4=E5=AE=9E?=
=?UTF-8?q?=E4=BD=93=E5=88=97=E8=A1=A8=E9=A1=B5=E6=8E=A5=E5=8F=A3=E8=AF=B7?=
=?UTF-8?q?=E6=B1=82=E6=96=B9=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/entityExplorer/EntityExplorer.vue | 115 ++++++++++++--------
src/views/entityExplorer/EntityFilter.vue | 22 ++--
2 files changed, 81 insertions(+), 56 deletions(-)
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 {
}
}
-
-