NEZ-1408 fix:处理页面报错
This commit is contained in:
@@ -863,7 +863,7 @@ export default {
|
||||
this.$refs['localLoadingScreen' + this.chartIndex].endLoading()
|
||||
} else {
|
||||
// this.showLoading = false;
|
||||
this.$refs['localLoading' + this.chartIndex].endLoading()
|
||||
this.$refs['localLoading' + this.chartIndex] && this.$refs['localLoading' + this.chartIndex].endLoading()
|
||||
}
|
||||
},
|
||||
resize (chartItem) {
|
||||
|
||||
@@ -228,7 +228,7 @@ export default {
|
||||
this.$refs['localLoadingScreen' + this.chartIndex].endLoading()
|
||||
} else {
|
||||
// this.showLoading = false;
|
||||
this.$refs['localLoading' + this.chartIndex].endLoading()
|
||||
this.$refs['localLoading' + this.chartIndex] && this.$refs['localLoading' + this.chartIndex].endLoading()
|
||||
}
|
||||
},
|
||||
showLoad (chartItem) {
|
||||
@@ -498,7 +498,7 @@ export default {
|
||||
this.$nextTick(() => {
|
||||
const vm = this
|
||||
setTimeout(function () {
|
||||
const divHeight = self.$refs.legendArea.offsetHeight
|
||||
const divHeight = self.$refs.legendArea ? self.$refs.legendArea.offsetHeight : 20
|
||||
if (!self.chartData.height) {
|
||||
getChart(self.chartIndex).resize({ height: (400 - divHeight - self.$chartResizeTool.titleHeight - self.$chartResizeTool.chartBlankHeight) })
|
||||
} else {
|
||||
@@ -573,16 +573,16 @@ export default {
|
||||
if (self.pieData[0]) {
|
||||
if (self.pieData[0].data.length > 0) {
|
||||
getChart(self.chartIndex).clear()
|
||||
getChart(self.chartIndex).setOption(self.option)// 创建图表
|
||||
getChart(self.chartIndex) && getChart(self.chartIndex).setOption(self.option)// 创建图表
|
||||
self.noData = false
|
||||
} else {
|
||||
self.noData = true
|
||||
self.option = chartConfig.getOption('noData')
|
||||
getChart(self.chartIndex).clear()
|
||||
getChart(self.chartIndex).setOption(self.option)// 创建图表
|
||||
getChart(self.chartIndex) && getChart(self.chartIndex).setOption(self.option)// 创建图表
|
||||
}
|
||||
}
|
||||
self.$refs['localLoading' + self.chartIndex].endLoading()
|
||||
self.$refs['localLoading' + self.chartIndex] && self.$refs['localLoading' + self.chartIndex].endLoading()
|
||||
self.firstShow = true // 展示操作按键
|
||||
}, 100)
|
||||
})
|
||||
@@ -621,12 +621,12 @@ export default {
|
||||
setTimeout(function () {
|
||||
self.$set(self.option.tooltip, 'formatter', self.formatterFunc)
|
||||
if (self.pieData[0].data.length > 0) {
|
||||
self.echartScreen.setOption(self.option)// 显示全屏界面
|
||||
self.echartScreen && self.echartScreen.setOption(self.option)// 显示全屏界面
|
||||
self.noData = false
|
||||
} else {
|
||||
self.noData = true
|
||||
self.option = chartConfig.getOption('noData')
|
||||
self.echartScreen.setOption(self.option)// 显示全屏界面
|
||||
self.echartScreen && self.echartScreen.setOption(self.option)// 显示全屏界面
|
||||
}
|
||||
self.echartScreen.on('finished', function () {
|
||||
const legendDiv = document.getElementById('screenLegendArea' + self.chartIndex)
|
||||
|
||||
@@ -404,7 +404,7 @@ export default {
|
||||
this.$refs['localLoading' + this.chartIndex].startLoading()
|
||||
},
|
||||
endLoading (area) {
|
||||
this.$refs['localLoading' + this.chartIndex].endLoading()
|
||||
this.$refs['localLoading' + this.chartIndex] && this.$refs['localLoading' + this.chartIndex].endLoading()
|
||||
},
|
||||
preview () {
|
||||
this.$refs.chartsPreview.show(this.data)
|
||||
@@ -538,7 +538,7 @@ export default {
|
||||
series: series
|
||||
}
|
||||
const chart = echarts.init(document.querySelector('#littleChart'))
|
||||
chart.setOption(option)// 创建图表
|
||||
chart && chart.setOption(option)// 创建图表
|
||||
},
|
||||
timeFormat (val) {
|
||||
return this.utcTimeToTimezoneStr(val)
|
||||
|
||||
@@ -195,7 +195,7 @@ export default {
|
||||
if (area === 'screen') {
|
||||
this.$refs['localLoadingScreen' + this.chartIndex].endLoading()
|
||||
} else {
|
||||
this.$refs['localLoading' + this.chartIndex].endLoading()
|
||||
this.$refs['localLoading' + this.chartIndex] && this.$refs['localLoading' + this.chartIndex].endLoading()
|
||||
}
|
||||
},
|
||||
clearChart () {
|
||||
|
||||
@@ -1916,7 +1916,7 @@ export default {
|
||||
},
|
||||
mounted () {
|
||||
this.init()
|
||||
window.addEventListener('resize', () => this.resize(), false)
|
||||
window.addEventListener('resize', this.resize, false)
|
||||
},
|
||||
beforeDestroy () {
|
||||
window.removeEventListener('resize', this.resize, false)
|
||||
|
||||
@@ -224,7 +224,7 @@ export default {
|
||||
this.$refs['localLoadingScreen' + this.chartIndex].endLoading()
|
||||
} else {
|
||||
// this.showLoading = false;
|
||||
this.$refs['localLoading' + this.chartIndex].endLoading()
|
||||
this.$refs['localLoading' + this.chartIndex] && this.$refs['localLoading' + this.chartIndex].endLoading()
|
||||
}
|
||||
},
|
||||
showLoad (chartItem) {
|
||||
@@ -398,14 +398,14 @@ export default {
|
||||
this.$nextTick(() => {
|
||||
const vm = this
|
||||
setTimeout(function () {
|
||||
const divHeight = self.$refs.legendArea.offsetHeight
|
||||
const divHeight = self.$refs.legendArea ? self.$refs.legendArea.offsetHeight : 20
|
||||
if (!self.chartData.height) {
|
||||
getChart(self.chartIndex).resize({ height: (400 - divHeight - self.$chartResizeTool.titleHeight - self.$chartResizeTool.chartBlankHeight) })
|
||||
} else {
|
||||
getChart(self.chartIndex).resize({ height: (self.chartData.height * vm.stepWidth - divHeight - self.$chartResizeTool.titleHeight - self.$chartResizeTool.chartBlankHeight) })
|
||||
}
|
||||
self.$set(self.option.tooltip, 'formatter', self.formatterFunc)
|
||||
self.$set(self.option.tooltip, 'position', function (point, params, dom, rect, size) {
|
||||
self.option.tooltip && self.$set(self.option.tooltip, 'formatter', self.formatterFunc)
|
||||
self.option.tooltip && self.$set(self.option.tooltip, 'position', function (point, params, dom, rect, size) {
|
||||
dom.style.transform = 'translateZ(0)'
|
||||
const windowWidth = window.innerWidth// 窗口宽度
|
||||
const windowHeight = window.innerHeight// 窗口高度
|
||||
@@ -472,16 +472,16 @@ export default {
|
||||
})
|
||||
if (self.pieData[0].data.length > 0) {
|
||||
getChart(self.chartIndex).clear()
|
||||
getChart(self.chartIndex).setOption(self.option)// 创建图表
|
||||
getChart(self.chartIndex) && getChart(self.chartIndex).setOption(self.option)// 创建图表
|
||||
self.noData = false
|
||||
} else {
|
||||
self.noData = true
|
||||
self.option = chartConfig.getOption('noData')
|
||||
getChart(self.chartIndex).clear()
|
||||
getChart(self.chartIndex).setOption(self.option)// 创建图表
|
||||
getChart(self.chartIndex) && getChart(self.chartIndex).setOption(self.option)// 创建图表
|
||||
}
|
||||
|
||||
self.$refs['localLoading' + self.chartIndex].endLoading()
|
||||
self.$refs['localLoading' + self.chartIndex] && self.$refs['localLoading' + self.chartIndex].endLoading()
|
||||
self.firstShow = true // 展示操作按键
|
||||
}, 100)
|
||||
})
|
||||
@@ -519,12 +519,12 @@ export default {
|
||||
self.echartScreen.resize({ height: (sumHeight - divHeight - 58) })// 图表的高度
|
||||
setTimeout(function () {
|
||||
if (self.pieData[0].data.length > 0) {
|
||||
self.echartScreen.setOption(self.option)// 显示全屏界面
|
||||
self.echartScreen && self.echartScreen.setOption(self.option)// 显示全屏界面
|
||||
self.noData = false
|
||||
} else {
|
||||
self.noData = true
|
||||
self.option = chartConfig.getOption('noData')
|
||||
self.echartScreen.setOption(self.option)// 显示全屏界面
|
||||
self.echartScreen && self.echartScreen.setOption(self.option)// 显示全屏界面
|
||||
}
|
||||
self.echartScreen.on('finished', function () {
|
||||
const legendDiv = document.getElementById('screenLegendArea' + self.chartIndex)
|
||||
|
||||
@@ -320,7 +320,7 @@ export default {
|
||||
this.$refs['localLoadingScreen' + this.chartIndex].endLoading()
|
||||
} else {
|
||||
// this.showLoading = false;
|
||||
this.$refs['localLoading' + this.chartIndex].endLoading()
|
||||
this.$refs['localLoading' + this.chartIndex] && this.$refs['localLoading' + this.chartIndex].endLoading()
|
||||
}
|
||||
},
|
||||
showLoad (chartItem) {
|
||||
|
||||
@@ -288,7 +288,7 @@ export default {
|
||||
if (area === 'screen') {
|
||||
this.$refs['localLoadingScreen' + this.chartIndex].endLoading()
|
||||
} else {
|
||||
this.$refs['localLoading' + this.chartIndex].endLoading()
|
||||
this.$refs['localLoading' + this.chartIndex] && this.$refs['localLoading' + this.chartIndex].endLoading()
|
||||
}
|
||||
},
|
||||
resize (chartItem) {
|
||||
|
||||
@@ -203,7 +203,7 @@ export default {
|
||||
if (area === 'screen') {
|
||||
this.$refs['localLoadingScreen' + this.chartIndex].endLoading()
|
||||
} else {
|
||||
this.$refs['localLoading' + this.chartIndex].endLoading()
|
||||
this.$refs['localLoading' + this.chartIndex] && this.$refs['localLoading' + this.chartIndex].endLoading()
|
||||
}
|
||||
},
|
||||
clearChart () {
|
||||
|
||||
@@ -1081,9 +1081,9 @@ export default {
|
||||
this.echartModalStore.resize()
|
||||
this.echartModalStore.clear()
|
||||
if (dataArg.length < 1) {
|
||||
this.echartModalStore.setOption(chartConfig.getOption('noData'))
|
||||
this.echartModalStore && this.echartModalStore.setOption(chartConfig.getOption('noData'))
|
||||
} else {
|
||||
this.echartModalStore.setOption(option)// 创建图表
|
||||
this.echartModalStore && this.echartModalStore.setOption(option)// 创建图表
|
||||
}
|
||||
|
||||
this.$refs.loadingPreview.endLoading()
|
||||
@@ -1295,9 +1295,9 @@ export default {
|
||||
this.echartModalStore.resize()
|
||||
this.echartModalStore.clear()
|
||||
if (dataArg[0].data.length < 1) {
|
||||
this.echartModalStore.setOption(chartConfig.getOption('noData'))
|
||||
this.echartModalStore && this.echartModalStore.setOption(chartConfig.getOption('noData'))
|
||||
} else {
|
||||
this.echartModalStore.setOption(option)// 创建图表
|
||||
this.echartModalStore && this.echartModalStore.setOption(option)// 创建图表
|
||||
}
|
||||
|
||||
this.$refs.loadingPreview.endLoading()
|
||||
@@ -1360,9 +1360,9 @@ export default {
|
||||
this.echartModalStore.resize()
|
||||
this.echartModalStore.clear()
|
||||
if (dataArg[0].data.length < 1) {
|
||||
this.echartModalStore.setOption(chartConfig.getOption('noData'))
|
||||
this.echartModalStore && this.echartModalStore.setOption(chartConfig.getOption('noData'))
|
||||
} else {
|
||||
this.echartModalStore.setOption(option)// 创建图表
|
||||
this.echartModalStore && this.echartModalStore.setOption(option)// 创建图表
|
||||
}
|
||||
|
||||
this.$refs.loadingPreview.endLoading()
|
||||
|
||||
@@ -149,7 +149,7 @@ export default {
|
||||
this.$refs['localLoadingScreen' + this.chartIndex].endLoading()
|
||||
} else {
|
||||
// this.showLoading = false;
|
||||
this.$refs['localLoading' + this.chartIndex].endLoading()
|
||||
this.$refs['localLoading' + this.chartIndex] && this.$refs['localLoading' + this.chartIndex].endLoading()
|
||||
}
|
||||
},
|
||||
showLoad (chartItem) {
|
||||
|
||||
@@ -345,7 +345,7 @@ export default {
|
||||
this.caretShow = true
|
||||
if (getChart(this.chartIndex)) {
|
||||
setTimeout(() => {
|
||||
getChart(this.chartIndex).setOption({
|
||||
getChart(this.chartIndex) && getChart(this.chartIndex).setOption({
|
||||
toolbox: {
|
||||
show: true
|
||||
}
|
||||
@@ -357,7 +357,7 @@ export default {
|
||||
this.caretShow = false
|
||||
if (getChart(this.chartIndex)) {
|
||||
setTimeout(() => {
|
||||
getChart(this.chartIndex).setOption({
|
||||
getChart(this.chartIndex) && getChart(this.chartIndex).setOption({
|
||||
toolbox: {
|
||||
show: false
|
||||
}
|
||||
@@ -368,7 +368,7 @@ export default {
|
||||
mouseEnterFullChart () {
|
||||
if (this.echartModalStore) {
|
||||
setTimeout(() => {
|
||||
this.echartModalStore.setOption({
|
||||
this.echartModalStore && this.echartModalStore.setOption({
|
||||
toolbox: {
|
||||
show: true
|
||||
}
|
||||
@@ -380,7 +380,7 @@ export default {
|
||||
if (this.echartModalStore) {
|
||||
setTimeout(() => {
|
||||
if (this.echartModalStore) {
|
||||
this.echartModalStore.setOption({
|
||||
this.echartModalStore && this.echartModalStore.setOption({
|
||||
toolbox: {
|
||||
show: false
|
||||
}
|
||||
@@ -451,7 +451,7 @@ export default {
|
||||
if (unit.type == 'Time' || option.yAxis.maxInterval === 1) {
|
||||
delete option.yAxis.maxInterval
|
||||
}
|
||||
getChart(this.chartIndex).setOption({
|
||||
getChart(this.chartIndex) && getChart(this.chartIndex).setOption({
|
||||
yAxis: {
|
||||
...option.yAxis
|
||||
}
|
||||
@@ -567,7 +567,7 @@ export default {
|
||||
if (unit.type == 'Time' || option.yAxis.maxInterval === 1) {
|
||||
delete option.yAxis.maxInterval
|
||||
}
|
||||
echart.setOption({
|
||||
echart && echart.setOption({
|
||||
yAxis: {
|
||||
...option.yAxis
|
||||
}
|
||||
@@ -1259,12 +1259,12 @@ export default {
|
||||
}
|
||||
option.series = self.seriesItemArrScreen
|
||||
if (dataArg && dataArg.length > 0) {
|
||||
self.echartModalStore.setOption(option)// 显示全屏界面
|
||||
self.echartModalStore && self.echartModalStore.setOption(option)// 显示全屏界面
|
||||
self.noData = false
|
||||
} else {
|
||||
self.noData = true
|
||||
option = chartConfig.getOptionNoData('noData')
|
||||
self.echartModalStore.setOption(option)// 显示全屏界面
|
||||
self.echartModalStore && self.echartModalStore.setOption(option)// 显示全屏界面
|
||||
}
|
||||
self.echartModalStore.on('finished', function () {
|
||||
const legendDiv = document.getElementById('screenLegendArea' + self.chartIndex)
|
||||
@@ -1952,7 +1952,7 @@ export default {
|
||||
if (unit.type == 'Time' || option.yAxis.maxInterval === 1) {
|
||||
delete option.yAxis.maxInterval
|
||||
}
|
||||
getChart(this.chartIndex).setOption({
|
||||
getChart(this.chartIndex) && getChart(this.chartIndex).setOption({
|
||||
series: this.seriesItem,
|
||||
yAxis: {
|
||||
...option.yAxis
|
||||
@@ -1999,7 +1999,7 @@ export default {
|
||||
if (unit.type == 'Time' || option.yAxis.maxInterval === 1) {
|
||||
delete option.yAxis.maxInterval
|
||||
}
|
||||
this.echartModalStore.setOption({
|
||||
this.echartModalStore && this.echartModalStore.setOption({
|
||||
series: this.seriesItemScreen,
|
||||
yAxis: {
|
||||
...option.yAxis
|
||||
@@ -2135,7 +2135,7 @@ export default {
|
||||
} else {
|
||||
minInterval = 20 * 60 * 1000
|
||||
}
|
||||
getChart(this.chartIndex).setOption({ xAxis: { minInterval: minInterval } })
|
||||
getChart(this.chartIndex) && getChart(this.chartIndex).setOption({ xAxis: { minInterval: minInterval } })
|
||||
} else {
|
||||
if (this.$refs.resizeBox.offsetWidth < 200) {
|
||||
splitNumber = 1
|
||||
@@ -2144,7 +2144,7 @@ export default {
|
||||
} else if (this.$refs.resizeBox.offsetWidth < 500) {
|
||||
splitNumber = 5
|
||||
}
|
||||
getChart(this.chartIndex).setOption({ xAxis: { splitNumber: splitNumber } })
|
||||
getChart(this.chartIndex) && getChart(this.chartIndex).setOption({ xAxis: { splitNumber: splitNumber } })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ export default {
|
||||
this.$refs['localLoadingScreen' + this.chartIndex].endLoading()
|
||||
} else {
|
||||
// this.showLoading = false;
|
||||
this.$refs['localLoading' + this.chartIndex].endLoading()
|
||||
this.$refs['localLoading' + this.chartIndex] && this.$refs['localLoading' + this.chartIndex].endLoading()
|
||||
}
|
||||
},
|
||||
showLoad (chartItem) {
|
||||
|
||||
@@ -147,7 +147,7 @@ export default {
|
||||
this.$refs['localLoadingScreen' + this.chartIndex].endLoading()
|
||||
} else {
|
||||
// this.showLoading = false;
|
||||
this.$refs['localLoading' + this.chartIndex].endLoading()
|
||||
this.$refs['localLoading' + this.chartIndex] && this.$refs['localLoading' + this.chartIndex].endLoading()
|
||||
}
|
||||
},
|
||||
showLoad (chartItem) {
|
||||
|
||||
@@ -287,7 +287,7 @@ export default {
|
||||
this.terminalSocket.onclose = () => {
|
||||
// 报错sorry的,还没来得及看信息就关闭
|
||||
// this.$emit("closeConsole",this.terminal.name);//
|
||||
this.term.setOption('disableStdin', true)
|
||||
this.term && this.term.setOption('disableStdin', true)
|
||||
}
|
||||
|
||||
// 错误
|
||||
@@ -319,7 +319,7 @@ export default {
|
||||
this.conFinish = false
|
||||
},
|
||||
setFontSize (fontSize) {
|
||||
this.term.setOption('fontSize', fontSize)
|
||||
this.term && this.term.setOption('fontSize', fontSize)
|
||||
const consoleBox = document.getElementById('ternimalContainer' + this.idIndex)
|
||||
const width = document.body.clientWidth// 可视宽度
|
||||
let height = parseInt(consoleBox.style.height)
|
||||
|
||||
@@ -90,7 +90,7 @@ export default {
|
||||
return this.chart.getOption()
|
||||
},
|
||||
setOption: function (option) {
|
||||
this.chart.setOption(option)
|
||||
this.chart && this.chart.setOption(option)
|
||||
},
|
||||
setSeries: function (series, legend, legendData) {
|
||||
if (!this.chart) {
|
||||
@@ -181,12 +181,12 @@ export default {
|
||||
if (this.option.series instanceof Array) {
|
||||
this.option.series = this.option.series.filter((item, index) => index < this.dataSize)
|
||||
}
|
||||
this.chart.setOption(this.option)
|
||||
this.chart && this.chart.setOption(this.option)
|
||||
} else {
|
||||
this.noData = true
|
||||
const option = chartConfig.getOption('noData')
|
||||
this.chart.clear()
|
||||
this.chart.setOption(option)
|
||||
this.chart && this.chart.setOption(option)
|
||||
}
|
||||
|
||||
// 坐标轴label鼠标悬浮提示
|
||||
@@ -543,7 +543,7 @@ export default {
|
||||
const option = {
|
||||
series: this.optionSeriesAll
|
||||
}
|
||||
this.chart.setOption(option)
|
||||
this.chart && this.chart.setOption(option)
|
||||
this.chart.resize()
|
||||
},
|
||||
chartInit () {
|
||||
|
||||
@@ -654,8 +654,8 @@ export default {
|
||||
]
|
||||
prometheusOption.title.text = vm.$t('config.agent.agent.agent')
|
||||
prometheusOption.legend.data = [vm.$t('config.agent.up'), vm.$t('config.agent.down')]
|
||||
tooltipEndpointChart.setOption(endpointOption, true)
|
||||
tooltipPrometheusChart.setOption(prometheusOption, true)
|
||||
tooltipEndpointChart && tooltipEndpointChart.setOption(endpointOption, true)
|
||||
tooltipPrometheusChart && tooltipPrometheusChart.setOption(prometheusOption, true)
|
||||
}, 100)
|
||||
/* setTimeout(function() {
|
||||
tooltipEndpointChart.setOption(endpointOption);
|
||||
@@ -1168,7 +1168,7 @@ export default {
|
||||
const limit = geo[0].scaleLimit
|
||||
const value = zoom + val
|
||||
if (value <= limit.max && value >= limit.min) {
|
||||
this.$refs.dataCenterMap.setOption({ geo: { zoom: value } })
|
||||
this.$refs.dataCenterMap && this.$refs.dataCenterMap.setOption({ geo: { zoom: value } })
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1424,7 +1424,7 @@ export default {
|
||||
const limit = geo[0].scaleLimit
|
||||
const value = zoom + val
|
||||
if (value <= limit.max && value >= limit.min) {
|
||||
this.$refs.dataCenterMap.setOption({ geo: { zoom: value } })
|
||||
this.$refs.dataCenterMap && this.$refs.dataCenterMap.setOption({ geo: { zoom: value } })
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user