diff --git a/src/mock/entity.js b/src/mock/entity.js index deb3548a..bca41de7 100644 --- a/src/mock/entity.js +++ b/src/mock/entity.js @@ -849,7 +849,7 @@ const getEntityType = (url) => { if (url.indexOf('/app?') > -1) { entityType = 'app' } - if (url.indexOf('/subscriber_id?') > -1) { + if (url.indexOf('/subscriber?') > -1) { entityType = 'subscriber_id' } return entityType diff --git a/src/views/charts2/charts/entityDetail/EntityDetailTabs.vue b/src/views/charts2/charts/entityDetail/EntityDetailTabs.vue index a69fd697..c9533e89 100644 --- a/src/views/charts2/charts/entityDetail/EntityDetailTabs.vue +++ b/src/views/charts2/charts/entityDetail/EntityDetailTabs.vue @@ -175,12 +175,14 @@ export default { }) */ this.initSetTag(entityDetailTabsName.deviceInformation, 0) this.initSetTag(entityDetailTabsName.accountInformation, 0) + const subscriberOfApp = axios.get(api.entity.entityList.subscriberRelatedApp, { params: relatedEntityParams }) + this.promiseData(subscriberOfApp) } }, promiseData (data1, data2, data3) { Promise.all([data1, data2, data3]).then(res => { const res0 = res[0].data - const res1 = res[1].data + const res1 = res[1] ? res[1].data : res[1] switch (this.entity.entityType) { case entityType.ip: { @@ -215,6 +217,12 @@ export default { this.initSetTag(entityDetailTabsName.relatedEntity, len1 + len2) break } + case entityType.subscriber: { + const len1 = res[0].status === 200 ? res0.data.result.length : 0 + // const len2 = res[1].status === 200 ? res1.data.result.length : 0 + this.initSetTag(entityDetailTabsName.relatedEntity, len1) + break + } } }) }, diff --git a/src/views/charts2/charts/entityDetail/tabs/DomainNameResolution.vue b/src/views/charts2/charts/entityDetail/tabs/DomainNameResolution.vue index a8d1883b..4a24b9fd 100644 --- a/src/views/charts2/charts/entityDetail/tabs/DomainNameResolution.vue +++ b/src/views/charts2/charts/entityDetail/tabs/DomainNameResolution.vue @@ -143,9 +143,8 @@ export default { } if (this.entity.entityType === entityType.subscriber) { - this.isNoData = true - this.initFlag = true - this.toggleLoading(false) + const subscriberOfApp = axios.get(api.entity.entityList.subscriberRelatedApp, { params: params }) + this.promiseData(subscriberOfApp) } }, promiseData (data1, data2, data3) { @@ -155,13 +154,19 @@ export default { this.toggleLoading(true) Promise.all([data1, data2, data3]).then(res => { const res0 = res[0].data - const res1 = res[1].data - if (res[0].status === 200 && res[1].status === 200) { - this.isNoData = res0.data.result.length === 0 && res1.data.result.length === 0 + const res1 = res[1] ? res[1].data : res[1] + if (this.entity.entityType === entityType.subscriber) { + if (res[0].status === 200) { + this.isNoData = res0.data.result.length === 0 + } + } else { + if (res[0].status === 200 && res[1].status === 200) { + this.isNoData = res0.data.result.length === 0 && res1.data.result.length === 0 + } } // app相关,显示ip、domain - if (this.entity.entityType === 'app' && !this.isNoData) { + if (this.entity.entityType === entityType.app && !this.isNoData) { if (res[0].status === 200) { this.relatedIpList = res0.data.result this.handleShowDataNum(this.showRelatedIpListInfo, this.relatedIpList) @@ -178,12 +183,12 @@ export default { this.errorMsg2 = this.errorMsgHandler(res1) } this.$emit('checkTag', entityDetailTabsName.relatedEntity, res0.data.result.length + res1.data.result.length) - } else if (this.entity.entityType === 'app') { + } else if (this.entity.entityType === entityType.app) { this.$emit('checkTag', entityDetailTabsName.relatedEntity, 0) } // ip相关,显示app,domain - if (this.entity.entityType === 'ip' && !this.isNoData) { + if (this.entity.entityType === entityType.ip && !this.isNoData) { if (res[0].status === 200) { this.relatedAppList = res0.data.result this.handleShowDataNum(this.showRelatedAppListInfo, this.relatedAppList) @@ -199,12 +204,12 @@ export default { this.errorMsg2 = this.errorMsgHandler(res1) } this.$emit('checkTag', entityDetailTabsName.relatedEntity, res0.data.result.length + res1.data.result.length) - } else if (this.entity.entityType === 'ip') { + } else if (this.entity.entityType === entityType.ip) { this.$emit('checkTag', entityDetailTabsName.relatedEntity, 0) } // domain相关,显示app,ip,domain - if (this.entity.entityType === 'domain') { + if (this.entity.entityType === entityType.domain) { const res2 = res[2].data if (res[0].status === 200 && res[1].status === 200 && res[2].status === 200) { this.isNoData = res0.data.result.length === 0 && res1.data.result.length === 0 && res2.data.result.length === 0 @@ -235,6 +240,19 @@ export default { } this.$emit('checkTag', entityDetailTabsName.relatedEntity, res0.data.result.length + res1.data.result.length + res2.data.result.length) } + + if (this.entity.entityType === entityType.subscriber && !this.isNoData) { + if (res0.status === 200) { + this.relatedAppList = res0.data.result + this.handleShowDataNum(this.showRelatedAppListInfo, this.relatedAppList) + } else { + this.showError1 = true + this.errorMsg1 = this.errorMsgHandler(res0) + } + this.$emit('checkTag', entityDetailTabsName.relatedEntity, res0.data.result.length) + } else if (this.entity.entityType === entityType.subscriber) { + this.$emit('checkTag', entityDetailTabsName.relatedEntity, 0) + } }).catch(e => { console.error(e) this.$emit('checkTag', entityDetailTabsName.relatedEntity, 0)