NEZ-2756 fix:Project Topo json 中引用 icon 接口未变更

This commit is contained in:
zhangyu
2023-04-07 14:06:19 +08:00
parent 6a0cd49a02
commit 83d0e1c945
2 changed files with 10 additions and 3 deletions

View File

@@ -73,7 +73,8 @@ export default {
nodesArr: [], nodesArr: [],
offsetX: 0, offsetX: 0,
offsetY: 0, offsetY: 0,
moduleId: '' moduleId: '',
iconArray: []
} }
}, },
mixins: [topoUtil], mixins: [topoUtil],
@@ -120,6 +121,9 @@ export default {
// meta2d.on('add', this.appPen) // 添加新画笔· // meta2d.on('add', this.appPen) // 添加新画笔·
meta2d.on('click', this.topoClick) // click画笔· meta2d.on('click', this.topoClick) // click画笔·
setTopology(this.meta2dId, meta2d) setTopology(this.meta2dId, meta2d)
this.$get('/topology/icon').then(res => {
this.iconArray = [...res.data.list]
})
this.reload() this.reload()
}, },
reload () { reload () {
@@ -152,8 +156,11 @@ export default {
pen.text = name pen.text = name
} }
if (pen.data && pen.data.imageId) { if (pen.data && pen.data.imageId) {
const imageInfo = this.iconArray.find(item => item.id === pen.data.imageId)
pen.imageId = pen.data.imageId pen.imageId = pen.data.imageId
pen.image = `/monitor/project/topo/icon/${pen.data.imageId}/0` if (imageInfo) {
pen.image = `/topology/icon/0/${imageInfo.unit}/${imageInfo.name}`
}
} }
pen.data = { pen.data = {
params: { // 用于编辑时 重置为节点初始状态 params: { // 用于编辑时 重置为节点初始状态

View File

@@ -192,7 +192,7 @@ export default {
this.iconArray = [...res.data.list] this.iconArray = [...res.data.list]
this.iconArray.forEach((item, index) => { this.iconArray.forEach((item, index) => {
item.imageName = item.name item.imageName = item.name
item.image = `topology/icon/0/${item.unit}/${item.name}` item.image = `/topology/icon/0/${item.unit}/${item.name}`
if (this.imgId == item.id) { if (this.imgId == item.id) {
this.unit = item.unit this.unit = item.unit
this.imageName = item.imageName this.imageName = item.imageName