From c003467c3ab7e8fb0911c3e18c1152b426fb17f9 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Thu, 3 Jun 2021 10:02:45 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E6=94=B9=E9=A6=96?= =?UTF-8?q?=E9=A1=B5topology=E5=9B=BE=E4=B8=8D=E6=98=BE=E7=A4=BA=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/common/project/topologyL5.vue | 40 ++++++++++--------- .../common/project/topologyPrev.vue | 40 ++++++++++--------- 2 files changed, 44 insertions(+), 36 deletions(-) diff --git a/nezha-fronted/src/components/common/project/topologyL5.vue b/nezha-fronted/src/components/common/project/topologyL5.vue index 4c6fe1202..2b6e2bd61 100644 --- a/nezha-fronted/src/components/common/project/topologyL5.vue +++ b/nezha-fronted/src/components/common/project/topologyL5.vue @@ -1710,27 +1710,31 @@ export default { }) } else { this.imgageLoading = true - const promiseArr = [] - imgidList.forEach((item, index) => { - if (item.data.imageId) { - promiseArr.push(this.dealImg(`monitor/project/topo/icon/${item.data.imageId}/1`)) - } else { - promiseArr.push('') - } - }) - Promise.all(promiseArr).then(res2 => { - this.iconArray = imgidList.map(item => { - return { - id: item.data.imageId + this.$get('monitor/project/topo/icon').then((imageAllId) => { + const promiseArr = [] + imgidList.forEach((item, index) => { + if (item.data.imageId && imageAllId.data.list.find(image => item.data.imageId === image.id)) { + promiseArr.push(this.dealImg(`monitor/project/topo/icon/${item.data.imageId}/1`)) + } else if (item.data.imageId) { + promiseArr.push(imgDefault) + } else { + promiseArr.push('') } }) - this.iconArray.forEach((item, index) => { - if (item.id) { - item.image = res2[index] - } + Promise.all(promiseArr).then((res2) => { + this.iconArray = imgidList.map(item => { + return { + id: item.data.imageId + } + }) + this.iconArray.forEach((item, index) => { + if (item.id) { + item.image = res2[index] + } + }) + this.imgInit = true + this.imgageLoading = false }) - this.imgInit = true - this.imgageLoading = false }) } }, diff --git a/nezha-fronted/src/components/common/project/topologyPrev.vue b/nezha-fronted/src/components/common/project/topologyPrev.vue index 4211a2da0..9f5262151 100644 --- a/nezha-fronted/src/components/common/project/topologyPrev.vue +++ b/nezha-fronted/src/components/common/project/topologyPrev.vue @@ -1710,27 +1710,31 @@ export default { }) } else { this.imgageLoading = true - const promiseArr = [] - imgidList.forEach((item, index) => { - if (item.data.imageId) { - promiseArr.push(this.dealImg(`monitor/project/topo/icon/${item.data.imageId}/1`)) - } else { - promiseArr.push('') - } - }) - Promise.all(promiseArr).then(res2 => { - this.iconArray = imgidList.map(item => { - return { - id: item.data.imageId + this.$get('monitor/project/topo/icon').then((imageAllId) => { + const promiseArr = [] + imgidList.forEach((item, index) => { + if (item.data.imageId && imageAllId.data.list.find(image => item.data.imageId === image.id)) { + promiseArr.push(this.dealImg(`monitor/project/topo/icon/${item.data.imageId}/1`)) + } else if (item.data.imageId) { + promiseArr.push(imgDefault) + } else { + promiseArr.push('') } }) - this.iconArray.forEach((item, index) => { - if (item.id) { - item.image = res2[index] - } + Promise.all(promiseArr).then((res2) => { + this.iconArray = imgidList.map(item => { + return { + id: item.data.imageId + } + }) + this.iconArray.forEach((item, index) => { + if (item.id) { + item.image = res2[index] + } + }) + this.imgInit = true + this.imgageLoading = false }) - this.imgInit = true - this.imgageLoading = false }) } },