diff --git a/src/views/entityExplorer/EntityExplorer.vue b/src/views/entityExplorer/EntityExplorer.vue index 1a236445..a5ac7744 100644 --- a/src/views/entityExplorer/EntityExplorer.vue +++ b/src/views/entityExplorer/EntityExplorer.vue @@ -73,12 +73,12 @@
-
+
- APP + {{ item.name }}
@@ -86,8 +86,8 @@
{{ $t('network.total') }}
- -
{{ numberWithCommas(entityAppTotal) }}
+ +
{{ numberWithCommas(item.total) }}
@@ -95,107 +95,17 @@
{{ $t('entity.active') }}
- +
- {{ numberWithCommas(entityAppActive) }} + {{ numberWithCommas(item.active) }} {{ $t('entity.inLastHour') }}
- -
-
- - {{$t('overall.domain')}} - -
-
-
- -
{{ $t('network.total') }}
-
- -
{{ numberWithCommas(entityDomainTotal) }}
-
-
- -
- -
{{ $t('entity.active') }}
-
- -
- {{ numberWithCommas(entityDomainActive) }} - {{ $t('entity.inLastHour') }} -
-
-
-
-
- -
-
- - IP - -
-
-
- -
{{ $t('network.total') }}
-
- -
{{ numberWithCommas(entityIpTotal) }}
-
-
- -
- -
{{ $t('entity.active') }}
-
- -
- {{ numberWithCommas(entityIpActive) }} - {{ $t('entity.inLastHour') }} -
-
-
-
-
- -
-
- - {{ $t('overall.subscriber') }} - -
-
-
- -
{{ $t('network.total') }}
-
- -
{{ numberWithCommas(entitySubscriberTotal) }}
-
-
- -
- -
{{ $t('entity.active') }}
-
- -
- {{ numberWithCommas(entitySubscriberActive) }} - {{ $t('entity.inLastHour') }} -
-
-
-
-
-
+ @@ -211,11 +121,7 @@ import { getNowDate, getNowTime, getSecond } from '@/utils/date-util' import { ref } from 'vue' import _ from 'lodash' import Loading from '@/components/common/Loading' -import { - overwriteUrl, - urlParamsHandler, - numberWithCommas -} from '@/utils/tools' +import { overwriteUrl, urlParamsHandler, numberWithCommas } from '@/utils/tools' import Parser from '@/components/advancedSearch/meta/parser' import { handleErrorTip, invalidErrorTip } from '@/components/advancedSearch/meta/error' import { columnList } from '@/utils/static-data' @@ -236,23 +142,6 @@ export default { return { showList: false, listMode: 'list', // entity列表的模式,list|block - - entityAppTotal: '-', - entityAppNew: '-', - entityAppActive: '-', - - entityDomainTotal: '-', - entityDomainNew: '-', - entityDomainActive: '-', - - entityIpTotal: '-', - entityIpNew: '-', - entityIpActive: '-', - - entitySubscriberTotal: '-', - entitySubscriberNew: '-', - entitySubscriberActive: '-', - newFilterData: [ { icon: 'cn-icon cn-icon-registration-country', @@ -333,17 +222,6 @@ export default { str: '', metaList: [], listLoading: false, - // 实体详情搜索页面 底部列表 - loadingApp: false, - loadingDomain: false, - loadingIp: false, - loadingSubscriber: false, - // Active - loadingAppActive: false, - loadingDomainActive: false, - loadingIpActive: false, - loadingSubscriberActive: false, - initFlag: true, // 初始化标志,避免初始化时pageSize和pageNo会调用搜索 timer: null, // 初始化标志的延时器,需要销毁 summaryCount: { @@ -354,7 +232,14 @@ export default { subscriberCount: 0 }, loadingCount: false, // 实体基数统计的loading - keywordList: [] + keywordList: [], + // 首页实体计数 + homeEntityList: [ + { name: 'APP', total: '-', loadingTotal: false, active: '-', loadingActive: false }, + { name: this.$t('overall.domain'), total: '-', loadingTotal: false, active: '-', loadingActive: false }, + { name: 'IP', total: '-', loadingTotal: false, active: '-', loadingActive: false }, + { name: this.$t('overall.subscriber'), total: '-', loadingTotal: false, active: '-', loadingActive: false } + ] } }, methods: { @@ -610,22 +495,27 @@ export default { 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) { + if (response.status === 200 && response.data.data.data) { + if (response.data.data.data.length >= 5) { this.newFilterData[index].showNum = 5 } else { - this.newFilterData[index].showNum = response.data.data.list.length + this.newFilterData[index].showNum = response.data.data.data.length } this.newFilterData[index].data = [] - response.data.data.list.forEach(item => { + response.data.data.data.forEach(item => { let obj = { label: item.value, topColumn: this.newFilterData[index].topColumn, - value: item.uniqueEntities, + value: item.count, showNum: 5 } + for (const ite in item) { + if (ite !== 'count') { + obj.label = item[ite] + } + } if (index === 0) { - obj.flag = item.value // 接口字段名称为'China',svg名称为'CN',通过countryNameIdMapping进行转换 + obj.flag = item.label // 接口字段名称为'China',svg名称为'CN',通过countryNameIdMapping进行转换 } if (index === 4) { obj = { @@ -633,7 +523,7 @@ export default { topColumn1: this.newFilterData[index].topColumn1, port: item.port, l7Protocol: item.l7Protocol, - value: item.uniqueEntities, + value: item.count, showNum: 5 } } @@ -705,81 +595,46 @@ export default { this.loadingCount = false }) }, - - queryListTotal (params) { - const queryParams = { - ...params, - startTime: getSecond(params.startTime), - endTime: getSecond(params.endTime) - } - axios.get(api.entityListTotal, { params: queryParams }).then(response => { - if (response.status === 200) { - this.pageObj.total = response.data.data.result - } - }).catch(e => { - this.$message.error(this.errorMsgHandler(e)) - console.error(e) - }) - }, - handleQ (params) { - return Object.keys(params).map(param => { - return `${param}='${params[param]}'` - }).join(' AND ') - }, - getEntityIndexData () { - // Total - this.loadingApp = true - this.loadingDomain = true - this.loadingIp = true - this.loadingSubscriber = true - // Active - this.loadingAppActive = true - this.loadingDomainActive = true - this.loadingIpActive = true - this.loadingSubscriberActive = true + this.homeEntityList.forEach(item => { + item.loadingTotal = true + item.loadingActive = true + }) axios.get(api.entity.entityList.entityTotal).then(response => { if (response.status === 200) { - this.entityDomainTotal = response.data.data.domainCount - this.entityIpTotal = response.data.data.ipCount - this.entityAppTotal = response.data.data.appCount - this.entitySubscriberTotal = response.data.data.subscriberCount + this.homeEntityList[0].total = response.data.data.appCount || '-' + this.homeEntityList[1].total = response.data.data.domainCount || '-' + this.homeEntityList[2].total = response.data.data.ipCount || '-' + this.homeEntityList[3].total = response.data.data.subscriberCount || '-' + this.homeEntityList[4].total = response.data.data.cellCount || '-' } }).catch(e => { this.$message.error(this.errorMsgHandler(e)) console.error(e) }).finally(() => { - this.loadingDomain = false - this.loadingIp = false - this.loadingApp = false - this.loadingSubscriber = false + this.homeEntityList.forEach(item => { + item.loadingTotal = false + }) }) // Active axios.get(api.entity.entityList.entityActive).then(response => { if (response.status === 200) { - this.entityDomainActive = response.data.data.domainCount - this.entityIpActive = response.data.data.ipCount - this.entityAppActive = response.data.data.appCount - this.entitySubscriberActive = response.data.data.subscriberCount + this.homeEntityList[0].active = response.data.data.appCount || '-' + this.homeEntityList[1].active = response.data.data.domainCount || '-' + this.homeEntityList[2].active = response.data.data.ipCount || '-' + this.homeEntityList[3].active = response.data.data.subscriberCount || '-' + this.homeEntityList[4].active = response.data.data.cellCount || '-' } }).catch((e) => { this.$message.error(this.errorMsgHandler(e)) console.error(e) }).finally(() => { - this.loadingDomainActive = false - this.loadingIpActive = false - this.loadingAppActive = false - this.loadingSubscriberActive = false + this.homeEntityList.forEach(item => { + item.loadingActive = false + }) }) }, - setListMode (mode) { - this.listMode = mode - const newParam = { - listMode: mode - } - this.reloadUrl(newParam) - }, /** * 向地址栏添加/删除参数 */