diff --git a/nezha-fronted/src/components/common/ChartDiagram/diagram.vue b/nezha-fronted/src/components/common/ChartDiagram/diagram.vue index 4f36e4862..49a5ced7b 100644 --- a/nezha-fronted/src/components/common/ChartDiagram/diagram.vue +++ b/nezha-fronted/src/components/common/ChartDiagram/diagram.vue @@ -339,6 +339,7 @@ import topoTooltip from '../project/L5/topoTooltip' import { getMetricTypeValue } from '../js/tools' import bus from '../../../libs/bus' import CanvasContextMenu from '@/components/common/project/L5/CanvasContextMenu' +import {imageTemp} from "../project/L5/services/canvas"; // 注册到画布 registerNode('rectangleImg2', myShape, myAnchors, myIconRect2, myTextRect2) registerNode('myCube', myCubec, myCubeAnchors, null, null) @@ -1572,42 +1573,40 @@ export default { if (res.code == 200) { this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') }) this.uploadPicShow = false - this.dealImg(`monitor/project/topo/icon/${res.data.id}/1`).then((data, header) => { - const group = this.tools.find(tool => tool.group === this.uploadPic.unit) - if (group) { - group.children.push({ - ...imageTemp2, - data: { - ...imageTemp2.data, - text: res.data.imageName, - image: data.data, - imageId: res.data.id, - unit: this.uploadPic.unit, - rect: { - width: data.width, - height: data.height - } - } + this.$get('monitor/project/topo/icon', { id: res.data.id }).then(iconInfo => { + this.dealImg(`monitor/project/topo/icon/${res.data.id}/1`).then((data, header) => { + const group = this.tools.find(tool => tool.group === this.uploadPic.unit) + this.iconArray.push({ + ...iconInfo.data.list[0], + image: data }) - } else { - this.tools.push({ - group: this.uploadPic.unit, - children: [{ - ...imageTemp2, + if (group) { + group.children.push({ + ...imageTemp, data: { - ...imageTemp2.data, + ...imageTemp.data, text: res.data.imageName, - image: data.data, + image: data, imageId: res.data.id, - unit: this.uploadPic.unit, - rect: { - width: data.width, - height: data.height - } + unit: this.uploadPic.unit } - }] - }) - } + }) + } else { + this.tools.push({ + group: this.uploadPic.unit, + children: [{ + ...imageTemp, + data: { + ...imageTemp.data, + text: res.data.imageName, + image: data, + imageId: res.data.id, + unit: this.uploadPic.unit + } + }] + }) + } + }) }) } else { this.$message.error(res.msg) diff --git a/nezha-fronted/src/components/common/project/topologyL5.vue b/nezha-fronted/src/components/common/project/topologyL5.vue index 4da084ea5..3ae46332d 100644 --- a/nezha-fronted/src/components/common/project/topologyL5.vue +++ b/nezha-fronted/src/components/common/project/topologyL5.vue @@ -1618,7 +1618,6 @@ export default { } }) }) - } else { this.$message.error(res.msg) }