NEZ-1029 fix: topology bug修改

This commit is contained in:
zhangyu
2021-09-26 12:56:50 +08:00
parent 5879ca0c8a
commit 61c2259cdd
2 changed files with 57 additions and 53 deletions

View File

@@ -21,7 +21,7 @@
<el-collapse-item :title="item.group" :name="item.group"> <el-collapse-item :title="item.group" :name="item.group">
<template slot="title"> <template slot="title">
<div style="display: flex;width: 100%;"> <div style="display: flex;width: 100%;">
<i class="nz-icon nz-icon-arrow-right"></i> <div style="flex: 1">{{item.group}}</div> <i class="nz-icon nz-icon-delete title-delete" @click="tooltipDeleteTitle(item)"></i> <i class="nz-icon nz-icon-caret-right"></i> <div style="flex: 1">{{item.group}}</div> <i class="nz-icon nz-icon-delete title-delete" @click="tooltipDeleteTitle(item)"></i>
</div> </div>
</template> </template>
<div v-for="(btn, i) in item.children" :key="'info2'+'-'+index+'-'+i" class="buttons" :title="btn.data.text"> <div v-for="(btn, i) in item.children" :key="'info2'+'-'+index+'-'+i" class="buttons" :title="btn.data.text">
@@ -738,10 +738,9 @@ export default {
// } // }
// getTopology(this.topologyIndex).fitView(); // getTopology(this.topologyIndex).fitView();
this.oldTopologyData = JSON.stringify(getTopology(this.topologyIndex).data) this.oldTopologyData = JSON.stringify(getTopology(this.topologyIndex).data)
this.winResize() this.getNodesArr()
}) })
} }
this.winResize()
}) })
}) })
}, },
@@ -1573,42 +1572,40 @@ export default {
if (res.code == 200) { if (res.code == 200) {
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') }) this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
this.uploadPicShow = false this.uploadPicShow = false
this.dealImg(`monitor/project/topo/icon/${res.data.id}/1`).then((data, header) => { this.$get('monitor/project/topo/icon', { id: res.data.id }).then(iconInfo => {
const group = this.tools.find(tool => tool.group === this.uploadPic.unit) this.dealImg(`monitor/project/topo/icon/${res.data.id}/1`).then((data, header) => {
if (group) { const group = this.tools.find(tool => tool.group === this.uploadPic.unit)
group.children.push({ this.iconArray.push({
...imageTemp2, ...iconInfo.data.list[0],
data: { image: 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
}
}
}) })
} else { if (group) {
this.tools.push({ group.children.push({
group: this.uploadPic.unit,
children: [{
...imageTemp2, ...imageTemp2,
data: { data: {
...imageTemp2.data, ...imageTemp2.data,
text: res.data.imageName, text: res.data.imageName,
image: data.data, image: data,
imageId: res.data.id, imageId: res.data.id,
unit: this.uploadPic.unit, unit: this.uploadPic.unit
rect: {
width: data.width,
height: data.height
}
} }
}] })
}) } else {
} this.tools.push({
group: this.uploadPic.unit,
children: [{
...imageTemp2,
data: {
...imageTemp2.data,
text: res.data.imageName,
image: data,
imageId: res.data.id,
unit: this.uploadPic.unit
}
}]
})
}
})
}) })
} else { } else {
this.$message.error(res.msg) this.$message.error(res.msg)
@@ -1732,6 +1729,7 @@ export default {
imgArr.push({ ...item }) imgArr.push({ ...item })
}) })
Promise.all(promiseArr).then((res2, header) => { Promise.all(promiseArr).then((res2, header) => {
// console.log(res2)
this.iconArray = [...res.data.list] this.iconArray = [...res.data.list]
this.iconArray.forEach((item, index) => { this.iconArray.forEach((item, index) => {
item.image = res2[index].data item.image = res2[index].data
@@ -2052,7 +2050,7 @@ export default {
winResize () { winResize () {
setTimeout(() => { setTimeout(() => {
const domRect = getTopology(this.topologyIndex).divLayer.canvas.getBoundingClientRect() const domRect = document.getElementById('topology-canvas' + this.topologyIndex).getBoundingClientRect()
getTopology(this.topologyIndex).canvasPos = domRect getTopology(this.topologyIndex).canvasPos = domRect
if (this.fromOverView) { if (this.fromOverView) {
getTopology(this.topologyIndex).open(this.oldTopologyData) getTopology(this.topologyIndex).open(this.oldTopologyData)

View File

@@ -1138,7 +1138,7 @@ export default {
onMessage (event, data, e) { onMessage (event, data, e) {
// console.log('onMessage', event, data) // console.log('onMessage', event, data)
// console.log(getTopology(this.topologyIndex)) // console.log(getTopology(this.topologyIndex))
// this.notModuleIDArr=[]; this.notModuleIDArr = []
// this.toolShow.attr = false // this.toolShow.attr = false
// this.toolShow.topTool = false // this.toolShow.topTool = false
// this.$nextTick(() => { // this.$nextTick(() => {
@@ -1583,23 +1583,15 @@ export default {
if (res.code == 200) { if (res.code == 200) {
this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') }) this.$message({ duration: 2000, type: 'success', message: this.$t('tip.saveSuccess') })
this.uploadPicShow = false this.uploadPicShow = false
this.dealImg(`monitor/project/topo/icon/${res.data.id}/1`).then((data, header) => { this.$get('monitor/project/topo/icon', { id: res.data.id }).then(iconInfo => {
const group = this.tools.find(tool => tool.group === this.uploadPic.unit) this.dealImg(`monitor/project/topo/icon/${res.data.id}/1`).then((data, header) => {
if (group) { const group = this.tools.find(tool => tool.group === this.uploadPic.unit)
group.children.push({ this.iconArray.push({
...imageTemp, ...iconInfo.data.list[0],
data: { image: data
...imageTemp.data,
text: res.data.imageName,
image: data,
imageId: res.data.id,
unit: this.uploadPic.unit
}
}) })
} else { if (group) {
this.tools.push({ group.children.push({
group: this.uploadPic.unit,
children: [{
...imageTemp, ...imageTemp,
data: { data: {
...imageTemp.data, ...imageTemp.data,
@@ -1608,9 +1600,23 @@ export default {
imageId: res.data.id, imageId: res.data.id,
unit: this.uploadPic.unit 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 { } else {
this.$message.error(res.msg) this.$message.error(res.msg)