NEZ-1358 fix: 处理Panel切换后无法加载 以及部分页面报错的问题
This commit is contained in:
@@ -634,10 +634,6 @@ export default {
|
|||||||
|
|
||||||
// 获取panel详情数据,获取panel下所有chart列表
|
// 获取panel详情数据,获取panel下所有chart列表
|
||||||
getData (params) {
|
getData (params) {
|
||||||
if (this.finshGetData) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.finshGetData = true
|
|
||||||
const param = {
|
const param = {
|
||||||
panelId: params.panelId,
|
panelId: params.panelId,
|
||||||
query: params.query,
|
query: params.query,
|
||||||
@@ -710,21 +706,16 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
this.finshGetData = false
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!param.query) delete param.query
|
if (!param.query) delete param.query
|
||||||
// 根据panelId获得panel下的所有图表
|
// 根据panelId获得panel下的所有图表
|
||||||
// const groupId = true ? '&groupId=0' : ''
|
// const groupId = true ? '&groupId=0' : ''
|
||||||
if (!params.panelId) {
|
if (!params.panelId) {
|
||||||
this.finshGetData = false
|
|
||||||
return
|
return
|
||||||
} // 没有panelId不调用接口
|
} // 没有panelId不调用接口
|
||||||
this.$get('visual/panel/chart?panelId=' + params.panelId + '&groupId=0' + '&pageSize=-1').then(response => {
|
this.$get('visual/panel/chart?panelId=' + params.panelId + '&groupId=0' + '&pageSize=-1').then(response => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
setTimeout(() => {
|
|
||||||
this.finshGetData = false
|
|
||||||
}, 100)
|
|
||||||
response.data.list.forEach((item, index) => {
|
response.data.list.forEach((item, index) => {
|
||||||
item.isLoaded = false
|
item.isLoaded = false
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1056,8 +1056,8 @@ export default {
|
|||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
const vm = this
|
const vm = this
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
const divHeight = self.$refs.legendArea.offsetHeight
|
const divHeight = self.$refs.legendArea ? self.$refs.legendArea.offsetHeight : 0
|
||||||
if (!chartInfo.height) {
|
if (!chartInfo.height && getChart(self.chartIndex)) {
|
||||||
getChart(self.chartIndex).resize({ height: (250 - divHeight - chartResizeTool.titleHeight - chartResizeTool.chartBlankHeight) })
|
getChart(self.chartIndex).resize({ height: (250 - divHeight - chartResizeTool.titleHeight - chartResizeTool.chartBlankHeight) })
|
||||||
} else {
|
} else {
|
||||||
getChart(self.chartIndex).resize({ height: (chartInfo.height * vm.stepWidth - divHeight - chartResizeTool.titleHeight - chartResizeTool.chartBlankHeight) })
|
getChart(self.chartIndex).resize({ height: (chartInfo.height * vm.stepWidth - divHeight - chartResizeTool.titleHeight - chartResizeTool.chartBlankHeight) })
|
||||||
|
|||||||
@@ -719,7 +719,7 @@ export default {
|
|||||||
getTopology(this.topologyIndex).centerView()
|
getTopology(this.topologyIndex).centerView()
|
||||||
this.penToolTipScale = getTopology(this.topologyIndex).data.scale
|
this.penToolTipScale = getTopology(this.topologyIndex).data.scale
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
getTopology(this.topologyIndex).data.pens.forEach(item => {
|
getTopology(this.topologyIndex)&&getTopology(this.topologyIndex).data.pens.forEach(item => {
|
||||||
if (item.animatePlay) {
|
if (item.animatePlay) {
|
||||||
item.stopAnimate()
|
item.stopAnimate()
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -768,7 +768,10 @@ export default {
|
|||||||
},
|
},
|
||||||
// 打开topology数据
|
// 打开topology数据
|
||||||
openTopologyData (data) {
|
openTopologyData (data) {
|
||||||
return new Promise(resolve => {
|
return new Promise((resolve, reject) => {
|
||||||
|
if (!document.getElementById('topology-canvas' + this.topologyIndexF)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
if (!getTopology(this.topologyIndex)) {
|
if (!getTopology(this.topologyIndex)) {
|
||||||
const canvas = new Topology('topology-canvas' + this.topologyIndexF, canvasOptions)
|
const canvas = new Topology('topology-canvas' + this.topologyIndexF, canvasOptions)
|
||||||
canvas.open(data)
|
canvas.open(data)
|
||||||
@@ -1080,7 +1083,7 @@ export default {
|
|||||||
// 摘除已选择的module
|
// 摘除已选择的module
|
||||||
modulesDiff (data) {
|
modulesDiff (data) {
|
||||||
this.modules = this.allModules
|
this.modules = this.allModules
|
||||||
if (getTopology(this.topologyIndex).data.pens) {
|
if (getTopology(this.topologyIndex) && getTopology(this.topologyIndex).data.pens) {
|
||||||
getTopology(this.topologyIndex).data.pens.forEach(item => {
|
getTopology(this.topologyIndex).data.pens.forEach(item => {
|
||||||
if (item.type == 0) {
|
if (item.type == 0) {
|
||||||
this.modules = this.modules.filter(item1 => item.data.moduleId !== item1.id)
|
this.modules = this.modules.filter(item1 => item.data.moduleId !== item1.id)
|
||||||
@@ -1422,7 +1425,8 @@ export default {
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 'resize': {
|
case 'resize': {
|
||||||
const domRect = document.getElementById('topology-canvas' + this.topologyIndexF).getBoundingClientRect()
|
const dom = document.getElementById('topology-camvas' + this.topologyIndexF)
|
||||||
|
const domRect = dom ? dom.getBoundingClientRect() : {}
|
||||||
if (getTopology(this.topologyIndex)) {
|
if (getTopology(this.topologyIndex)) {
|
||||||
getTopology(this.topologyIndex).canvasPos = domRect
|
getTopology(this.topologyIndex).canvasPos = domRect
|
||||||
}
|
}
|
||||||
@@ -1432,7 +1436,8 @@ export default {
|
|||||||
if (this.$refs.topTool) {
|
if (this.$refs.topTool) {
|
||||||
this.$refs.topTool.scaleNum = parseInt(data * 100)
|
this.$refs.topTool.scaleNum = parseInt(data * 100)
|
||||||
}
|
}
|
||||||
const domRect = document.getElementById('topology-canvas' + this.topologyIndexF).getBoundingClientRect()
|
const dom = document.getElementById('topology-camvas' + this.topologyIndexF)
|
||||||
|
const domRect = dom ? dom.getBoundingClientRect() : {}
|
||||||
if (getTopology(this.topologyIndex)) {
|
if (getTopology(this.topologyIndex)) {
|
||||||
getTopology(this.topologyIndex).canvasPos = domRect
|
getTopology(this.topologyIndex).canvasPos = domRect
|
||||||
}
|
}
|
||||||
@@ -1892,7 +1897,8 @@ export default {
|
|||||||
index: 0,
|
index: 0,
|
||||||
list: [JSON.parse(JSON.stringify(getTopology(this.topologyIndex).data))]
|
list: [JSON.parse(JSON.stringify(getTopology(this.topologyIndex).data))]
|
||||||
}
|
}
|
||||||
const domRect = document.getElementById('topology-canvas' + this.topologyIndexF).getBoundingClientRect()
|
const dom = document.getElementById('topology-camvas' + this.topologyIndexF)
|
||||||
|
const domRect = dom ? dom.getBoundingClientRect() : {}
|
||||||
getTopology(this.topologyIndex).canvasPos = domRect
|
getTopology(this.topologyIndex).canvasPos = domRect
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -1994,7 +2000,8 @@ export default {
|
|||||||
this.$store.commit('setShowTopoScreen', this.topoScreenState)
|
this.$store.commit('setShowTopoScreen', this.topoScreenState)
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
getTopology(this.topologyIndex).lock(1)
|
getTopology(this.topologyIndex).lock(1)
|
||||||
const domRect = document.getElementById('topology-canvas' + this.topologyIndexF).getBoundingClientRect()
|
const dom = document.getElementById('topology-camvas' + this.topologyIndexF)
|
||||||
|
const domRect = dom ? dom.getBoundingClientRect() : {}
|
||||||
getTopology(this.topologyIndex).canvasPos = domRect
|
getTopology(this.topologyIndex).canvasPos = domRect
|
||||||
this.reload()
|
this.reload()
|
||||||
})
|
})
|
||||||
@@ -2021,7 +2028,8 @@ export default {
|
|||||||
this.editTopologyFlag = false
|
this.editTopologyFlag = false
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
getTopology(this.topologyIndex).lock(1)
|
getTopology(this.topologyIndex).lock(1)
|
||||||
const domRect = document.getElementById('topology-canvas' + this.topologyIndexF).getBoundingClientRect()
|
const dom = document.getElementById('topology-camvas' + this.topologyIndexF)
|
||||||
|
const domRect = dom ? dom.getBoundingClientRect() : {}
|
||||||
getTopology(this.topologyIndex).canvasPos = domRect
|
getTopology(this.topologyIndex).canvasPos = domRect
|
||||||
this.$store.commit('setShowTopoScreen', this.topoScreenState)
|
this.$store.commit('setShowTopoScreen', this.topoScreenState)
|
||||||
})
|
})
|
||||||
@@ -2068,7 +2076,8 @@ export default {
|
|||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.previewData = topologyData
|
this.previewData = topologyData
|
||||||
getTopology(this.topologyIndex).lock(1)
|
getTopology(this.topologyIndex).lock(1)
|
||||||
const domRect = document.getElementById('topology-canvas' + this.topologyIndexF).getBoundingClientRect()
|
const dom = document.getElementById('topology-camvas' + this.topologyIndexF)
|
||||||
|
const domRect = dom ? dom.getBoundingClientRect() : {}
|
||||||
getTopology(this.topologyIndex).canvasPos = domRect
|
getTopology(this.topologyIndex).canvasPos = domRect
|
||||||
this.initPens(topologyData)
|
this.initPens(topologyData)
|
||||||
// this.reload()
|
// this.reload()
|
||||||
|
|||||||
Reference in New Issue
Block a user