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