fix:页面报错处理
This commit is contained in:
@@ -112,6 +112,9 @@ export default {
|
||||
/* 使用setTimeout延迟渲染图表,避免样式错乱 */
|
||||
setTimeout(() => {
|
||||
const myChart = this.isInit ? echarts.init(document.getElementById(`chart-canvas-${this.chartId}`)) : getChart(this.chartId)
|
||||
if (!myChart) {
|
||||
return
|
||||
}
|
||||
myChart.setOption(chartOption)
|
||||
this.isInit && setChart(this.chartId, myChart) // 缓存;不使用vue的data是为避免整个chart被监听导致卡顿
|
||||
this.isInit = false
|
||||
|
||||
@@ -57,6 +57,8 @@ export default {
|
||||
this.initHexagonData(this.chartInfo, this.chartData).then(() => {
|
||||
this.getLayout().then(layout => {
|
||||
this.initHexagon(layout)
|
||||
}).catch(() => {
|
||||
|
||||
})
|
||||
})
|
||||
}, 200)
|
||||
@@ -331,9 +333,12 @@ export default {
|
||||
: '#FFFFFF'
|
||||
},
|
||||
getLayout () {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!this.$refs[`chart-canvas-${this.chartId}`]) {
|
||||
reject()
|
||||
}
|
||||
this.boxWidth = this.$refs[`chart-canvas-${this.chartId}`].offsetWidth - 2 * this.boxPadding
|
||||
this.boxHeight = this.$refs[`chart-canvas-${this.chartId}`].offsetHeight - 2 * this.boxPadding
|
||||
return new Promise(resolve => {
|
||||
let radius = 0
|
||||
let col = 0
|
||||
let row = 0
|
||||
@@ -384,6 +389,8 @@ export default {
|
||||
this.hexagonTimer = setTimeout(() => {
|
||||
this.getLayout().then(layout => {
|
||||
this.initHexagon(layout)
|
||||
}).catch(() => {
|
||||
|
||||
})
|
||||
}, 50)
|
||||
}
|
||||
|
||||
@@ -89,6 +89,9 @@ export default {
|
||||
/* 使用setTimeout延迟渲染图表,避免样式错乱 */
|
||||
setTimeout(() => {
|
||||
const myChart = this.isInit ? echarts.init(document.getElementById(`chart-canvas-${this.chartId}`)) : getChart(this.chartId)
|
||||
if (!myChart) {
|
||||
return
|
||||
}
|
||||
myChart.setOption(chartOption)
|
||||
this.isInit && setChart(this.chartId, myChart) // 缓存;不使用vue的data是为避免整个chart被监听导致卡顿
|
||||
this.isInit = false
|
||||
|
||||
@@ -93,6 +93,9 @@ export default {
|
||||
/* 使用setTimeout延迟渲染图表,避免样式错乱 */
|
||||
setTimeout(() => {
|
||||
const myChart = this.isInit ? echarts.init(document.getElementById(`chart-canvas-${this.chartId}`)) : getChart(this.chartId)
|
||||
if (!myChart) {
|
||||
return
|
||||
}
|
||||
myChart.setOption(chartOption)
|
||||
this.isInit && setChart(this.chartId, myChart) // 缓存;不使用vue的data是为避免整个chart被监听导致卡顿
|
||||
this.isInit = false
|
||||
|
||||
@@ -86,6 +86,9 @@ export default {
|
||||
/* 使用setTimeout延迟渲染图表,避免样式错乱 */
|
||||
setTimeout(() => {
|
||||
const myChart = this.isInit ? echarts.init(document.getElementById(`chart-canvas-${this.chartId}`)) : getChart(this.chartId)
|
||||
if (!myChart) {
|
||||
return
|
||||
}
|
||||
myChart.setOption(chartOption)
|
||||
this.isInit && setChart(this.chartId, myChart) // 缓存;不使用vue的data是为避免整个chart被监听导致卡顿
|
||||
this.isInit = false
|
||||
|
||||
@@ -1796,6 +1796,9 @@ export default {
|
||||
this.imgageLoading = true
|
||||
this.$get('monitor/project/topo/icon').then((imageAllId) => {
|
||||
const promiseArr = []
|
||||
if (!imageAllId || !imageAllId.data) {
|
||||
return
|
||||
}
|
||||
imgidList.forEach((item, index) => {
|
||||
if (item.data.imageId && imageAllId.data.list.find(image => item.data.imageId === image.id)) {
|
||||
promiseArr.push(this.dealImg(`monitor/project/topo/icon/${item.data.imageId}/1`))
|
||||
|
||||
@@ -798,6 +798,9 @@ export default {
|
||||
resolve(this.topoPrevDataS)
|
||||
}
|
||||
this.$get('monitor/project/topo', { projectId: this.obj.id }).then(res => {
|
||||
if (!res.data) {
|
||||
return
|
||||
}
|
||||
let data = res.data.topo
|
||||
if (!res.data.topo || !res.data.topo.pens.length) {
|
||||
this.showNoData = true
|
||||
@@ -1772,6 +1775,9 @@ export default {
|
||||
this.imgageLoading = true
|
||||
this.$get('monitor/project/topo/icon').then((imageAllId) => {
|
||||
const promiseArr = []
|
||||
if (!imageAllId || !imageAllId.data) {
|
||||
return
|
||||
}
|
||||
imgidList.forEach((item, index) => {
|
||||
if (item.data.imageId && imageAllId.data.list.find(image => item.data.imageId === image.id)) {
|
||||
promiseArr.push(this.dealImg(`monitor/project/topo/icon/${item.data.imageId}/1`))
|
||||
|
||||
@@ -40,13 +40,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
refresh () {
|
||||
this.containerShow = false
|
||||
new Promise(resolve => {
|
||||
this.$router.replace({ path: this.$route.path, query: {} })
|
||||
resolve()
|
||||
}).then(() => {
|
||||
this.$nextTick(() => { this.containerShow = true })
|
||||
})
|
||||
this.$store.commit('setIsRouteLive')
|
||||
}
|
||||
},
|
||||
destroyed () {
|
||||
|
||||
@@ -82,6 +82,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
jump (route) {
|
||||
console.log(route, this.route)
|
||||
if (route === this.route) {
|
||||
this.refresh()
|
||||
}
|
||||
|
||||
@@ -442,7 +442,12 @@ export default {
|
||||
this.chart = JSON.parse(JSON.stringify(chartData))
|
||||
this.chart.panelId = this.showPanel.id
|
||||
this.chart.panelName = this.showPanel.name
|
||||
if (this.chart.param) {
|
||||
this.chart.param = JSON.parse(this.chart.param)
|
||||
} else {
|
||||
this.chart.param = {}
|
||||
}
|
||||
|
||||
if (!this.chart.groupId || this.chart.groupId == -1) {
|
||||
this.chart.groupId = ''
|
||||
}
|
||||
@@ -856,7 +861,9 @@ export default {
|
||||
this.nowTimeType.start_time = this.searchTime[0]
|
||||
this.nowTimeType.end_time = this.searchTime[1]
|
||||
setTimeout(() => {
|
||||
if (this.$refs.pickTime && this.$refs.pickTime.$refs.timePicker) {
|
||||
this.$refs.pickTime.$refs.timePicker.setCustomTime(this.nowTimeType)
|
||||
}
|
||||
}, 100)
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user