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,17 +1069,19 @@ export default {
} else {
self.noData = true
option = chartConfig.getOptionNoData('noData')
if (self.$refs.resizeBox.offsetWidth < 200) {
option.xAxis.splitNumber = 1
} else if (self.$refs.resizeBox.offsetWidth < 300) {
option.xAxis.splitNumber = 3
} else if (self.$refs.resizeBox.offsetWidth < 500) {
option.xAxis.splitNumber = 5
if (self.$refs.resizeBox && getChart(self.chartIndex)) {
if (self.$refs.resizeBox.offsetWidth < 200) {
option.xAxis.splitNumber = 1
} else if (self.$refs.resizeBox.offsetWidth < 300) {
option.xAxis.splitNumber = 3
} else if (self.$refs.resizeBox.offsetWidth < 500) {
option.xAxis.splitNumber = 5
}
getChart(self.chartIndex) && getChart(self.chartIndex).clear()
getChart(self.chartIndex) && getChart(self.chartIndex).setOption(option)// 创建图表
}
getChart(self.chartIndex) && getChart(self.chartIndex).clear()
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 // 展示操作按键
}, 800)

View File

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

View File

@@ -695,6 +695,9 @@ export default {
promiseArr.push(pensPromise(item, arr, index))
})
Promise.all(promiseArr).then((res) => {
if (!getTopology(this.topologyIndex)) {
return
}
getTopology(this.topologyIndex).open(data)
getTopology(this.topologyIndex).lock(1)
this.objChange = false
@@ -719,7 +722,7 @@ export default {
getTopology(this.topologyIndex).centerView()
this.penToolTipScale = getTopology(this.topologyIndex).data.scale
setTimeout(() => {
getTopology(this.topologyIndex)&&getTopology(this.topologyIndex).data.pens.forEach(item => {
getTopology(this.topologyIndex) && getTopology(this.topologyIndex).data.pens.forEach(item => {
if (item.animatePlay) {
item.stopAnimate()
setTimeout(() => {