diff --git a/nezha-fronted/src/components/common/ChartDiagram/diagram.vue b/nezha-fronted/src/components/common/ChartDiagram/diagram.vue index 25b548a08..1ca5826e2 100644 --- a/nezha-fronted/src/components/common/ChartDiagram/diagram.vue +++ b/nezha-fronted/src/components/common/ChartDiagram/diagram.vue @@ -825,8 +825,9 @@ export default { opacity: data.data.opacity, name: data.name } - if (this.fromOverView) { // 优化从首页来的加载速度 + if (this.fromOverView || this.fromChartBox) { // 优化从首页来的加载速度 const arr = data.pens.filter(item => !item.type) + this.imgInit = false this.addNodeInit(arr) } const timer = setInterval(() => { @@ -1577,7 +1578,7 @@ export default { const group = this.tools.find(tool => tool.group === this.uploadPic.unit) this.iconArray.push({ ...iconInfo.data.list[0], - image: data + image: data.data }) if (group) { group.children.push({ @@ -1585,7 +1586,7 @@ export default { data: { ...imageTemp2.data, text: res.data.imageName, - image: data, + image: data.data, imageId: res.data.id, unit: this.uploadPic.unit } @@ -1598,7 +1599,7 @@ export default { data: { ...imageTemp2.data, text: res.data.imageName, - image: data, + image: data.data, imageId: res.data.id, unit: this.uploadPic.unit } diff --git a/nezha-fronted/src/components/common/project/topologyL5.vue b/nezha-fronted/src/components/common/project/topologyL5.vue index 3ae46332d..74cb7e3d7 100644 --- a/nezha-fronted/src/components/common/project/topologyL5.vue +++ b/nezha-fronted/src/components/common/project/topologyL5.vue @@ -1588,7 +1588,7 @@ export default { const group = this.tools.find(tool => tool.group === this.uploadPic.unit) this.iconArray.push({ ...iconInfo.data.list[0], - image: data + image: data.data }) if (group) { group.children.push({ @@ -1596,9 +1596,13 @@ export default { data: { ...imageTemp.data, text: res.data.imageName, - image: data, + image: data.data, imageId: res.data.id, - unit: this.uploadPic.unit + unit: this.uploadPic.unit, + rect: { + width: data.width, + height: data.height + } } }) } else { @@ -1609,9 +1613,13 @@ export default { data: { ...imageTemp.data, text: res.data.imageName, - image: data, + image: data.data, imageId: res.data.id, - unit: this.uploadPic.unit + unit: this.uploadPic.unit, + rect: { + width: data.width, + height: data.height + } } }] }) @@ -1686,9 +1694,13 @@ export default { data: { ...imageTemp.data, text: item.imageName, - image: res2[index], + image: res2[index].data, imageId: item.id, - unit: item.unit + unit: item.unit, + rect: { + width: res2[index].width, + height: res2[index].height + } } }) } else { @@ -1701,7 +1713,11 @@ export default { text: item.imageName, image: res2[index], imageId: item.id, - unit: item.unit + unit: item.unit, + rect: { + width: res2[index].width, + height: res2[index].height + } } }] }) @@ -1750,12 +1766,29 @@ export default { this.$axios .get(url) .then((res) => { - return { - data: ('data:image/jpeg;base64,' + res.data) + const imageInfo = { + data: ('data:image/jpeg;base64,' + res.data), + // width: res.headers.width === -1 ? 100 : (res.headers.width > 900 ? 900 : res.headers.width), + // height: res.headers.height === -1 ? 100 : (res.headers.height > 900 ? 900 : res.headers.height) + width: res.headers.width === -1 ? 100 : Number(res.headers.width), + height: res.headers.height === -1 ? 100 : Number(res.headers.height) } + if (imageInfo.width > 900 || imageInfo.height > 900) { + if (imageInfo.height > imageInfo.width) { + imageInfo.width = imageInfo.width * 900 / imageInfo.height + imageInfo.height = 900 + } else if (imageInfo.height < imageInfo.width) { + imageInfo.height = imageInfo.height * 900 / imageInfo.width + imageInfo.width = 900 + } else { + imageInfo.height = 900 + imageInfo.width = 900 + } + } + return imageInfo }) .then(data => { - resolve(data.data, data.header) + resolve(data) // changeImage(data,(img)=>{ // resolve(img) // })