fix: 处理页面报错信息

This commit is contained in:
zhangyu
2021-11-26 18:14:45 +08:00
parent 2b3dbebf30
commit 8a4e97ed09
3 changed files with 33 additions and 17 deletions

View File

@@ -1069,6 +1069,7 @@ export default {
} else { } else {
self.noData = true self.noData = true
option = chartConfig.getOptionNoData('noData') option = chartConfig.getOptionNoData('noData')
if (self.$refs.resizeBox && getChart(self.chartIndex)) {
if (self.$refs.resizeBox.offsetWidth < 200) { if (self.$refs.resizeBox.offsetWidth < 200) {
option.xAxis.splitNumber = 1 option.xAxis.splitNumber = 1
} else if (self.$refs.resizeBox.offsetWidth < 300) { } else if (self.$refs.resizeBox.offsetWidth < 300) {
@@ -1079,7 +1080,8 @@ export default {
getChart(self.chartIndex) && getChart(self.chartIndex).clear() getChart(self.chartIndex) && getChart(self.chartIndex).clear()
getChart(self.chartIndex) && getChart(self.chartIndex).setOption(option)// 创建图表 getChart(self.chartIndex) && getChart(self.chartIndex).setOption(option)// 创建图表
} }
self.$refs['localLoading' + self.chartIndex].endLoading() }
self.$refs['localLoading' + self.chartIndex] && self.$refs['localLoading' + self.chartIndex].endLoading()
self.firstShow = true // 展示操作按键 self.firstShow = true // 展示操作按键
}, 800) }, 800)

View File

@@ -336,7 +336,7 @@ import alertTable from '../project/popData/alertTable'
import assetTable from '../project/popData/assetTable' import assetTable from '../project/popData/assetTable'
import endpointTable from '../project/popData/endpointTable' import endpointTable from '../project/popData/endpointTable'
import topoTooltip from '../project/L5/topoTooltip' import topoTooltip from '../project/L5/topoTooltip'
import { getMetricTypeValue, dealLegendAlias} from '../js/tools' import { getMetricTypeValue, dealLegendAlias } from '../js/tools'
import bus from '../../../libs/bus' import bus from '../../../libs/bus'
import CanvasContextMenu from '@/components/common/project/L5/CanvasContextMenu' import CanvasContextMenu from '@/components/common/project/L5/CanvasContextMenu'
// 注册到画布 // 注册到画布
@@ -699,6 +699,9 @@ export default {
}, 100) }, 100)
} else { } else {
Promise.all(promiseArr).then((res) => { Promise.all(promiseArr).then((res) => {
if (!getTopology(this.topologyIndex)) {
return
}
getTopology(this.topologyIndex).open(data) getTopology(this.topologyIndex).open(data)
getTopology(this.topologyIndex).lock(1) getTopology(this.topologyIndex).lock(1)
this.objChange = false this.objChange = false
@@ -781,6 +784,9 @@ export default {
// 打开topology数据 // 打开topology数据
openTopologyData (data) { openTopologyData (data) {
return new Promise(resolve => { return new Promise(resolve => {
if (!document.getElementById('topology-canvas' + this.topologyIndexF)) {
return
}
if (!getTopology(this.topologyIndex)) { if (!getTopology(this.topologyIndex)) {
const options = { const options = {
...canvasOptions ...canvasOptions
@@ -1388,7 +1394,8 @@ export default {
} }
break break
case 'resize': { case 'resize': {
const domRect = document.getElementById('topology-canvas' + this.topologyIndexF).getBoundingClientRect() const dom = document.getElementById('topology-canvas' + 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
} }
@@ -1398,7 +1405,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-canvas' + 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
} }
@@ -1916,7 +1924,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-canvas' + this.topologyIndexF)
const domRect = dom ? dom.getBoundingClientRect() : {}
getTopology(this.topologyIndex).canvasPos = domRect getTopology(this.topologyIndex).canvasPos = domRect
getTopology(this.topologyIndex).resize() getTopology(this.topologyIndex).resize()
}, 100) }, 100)
@@ -2038,7 +2047,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-canvas' + 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()
@@ -2063,7 +2073,8 @@ export default {
winResize () { winResize () {
setTimeout(() => { setTimeout(() => {
const domRect = document.getElementById('topology-canvas' + this.topologyIndex).getBoundingClientRect() const dom = document.getElementById('topology-canvas' + this.topologyIndex)
const domRect = dom ? dom.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)
@@ -2074,7 +2085,7 @@ export default {
x: this.$refs['topology-canvas' + this.topologyIndexF].offsetWidth, x: this.$refs['topology-canvas' + this.topologyIndexF].offsetWidth,
y: this.$refs['topology-canvas' + this.topologyIndexF].offsetHeight y: this.$refs['topology-canvas' + this.topologyIndexF].offsetHeight
} }
getTopology(this.topologyIndex).data.pens.forEach(item => { getTopology(this.topologyIndex) && getTopology(this.topologyIndex).data.pens.forEach(item => {
if (flag) { if (flag) {
return return
} }

View File

@@ -695,6 +695,9 @@ export default {
promiseArr.push(pensPromise(item, arr, index)) promiseArr.push(pensPromise(item, arr, index))
}) })
Promise.all(promiseArr).then((res) => { Promise.all(promiseArr).then((res) => {
if (!getTopology(this.topologyIndex)) {
return
}
getTopology(this.topologyIndex).open(data) getTopology(this.topologyIndex).open(data)
getTopology(this.topologyIndex).lock(1) getTopology(this.topologyIndex).lock(1)
this.objChange = false this.objChange = false
@@ -719,7 +722,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)&&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(() => {