diff --git a/nezha-fronted/src/components/charts/chart-list-group.vue b/nezha-fronted/src/components/charts/chart-list-group.vue index 452be2a0f..a074f0407 100644 --- a/nezha-fronted/src/components/charts/chart-list-group.vue +++ b/nezha-fronted/src/components/charts/chart-list-group.vue @@ -1430,7 +1430,7 @@ export default { if (this.additionalInfo) { this.$set(chartInfo, 'param', { endpointId: this.additionalInfo.id }) } - this.$refs['editChart' + chartInfo.id][0].getAlertList(filterType) + this.$refs['editChart' + chartInfo.id][0] && this.$refs['editChart' + chartInfo.id][0].getAlertList(filterType) }, getAlertRuleChartData (chartInfo) { const vm = this diff --git a/nezha-fronted/src/components/charts/chart-list.vue b/nezha-fronted/src/components/charts/chart-list.vue index 76de45428..ab098e9ff 100644 --- a/nezha-fronted/src/components/charts/chart-list.vue +++ b/nezha-fronted/src/components/charts/chart-list.vue @@ -884,7 +884,7 @@ export default { getChartData (chartInfo, pos, filterType) { const chartItem = chartInfo if (chartItem.type === 'group') { - this.$refs['editChart' + chartItem.id][0].setData(chartItem) + this.$refs['editChart' + chartItem.id][0] && this.$refs['editChart' + chartItem.id][0].setData(chartItem) return } if (chartItem.type === 'assetInfo') { @@ -1686,7 +1686,7 @@ export default { if (this.obj) { this.$set(chartInfo, 'param', { endpointId: this.obj.id }) } - this.$refs['editChart' + chartInfo.id][0].getAlertList(null, null, chartInfo) + this.$refs['editChart' + chartInfo.id][0] && this.$refs['editChart' + chartInfo.id][0].getAlertList(null, null, chartInfo) }, getAlertRuleChartData (chartInfo) { const vm = this diff --git a/nezha-fronted/src/components/charts/line-chart-block.vue b/nezha-fronted/src/components/charts/line-chart-block.vue index e43eb31ba..7fe88c5a8 100644 --- a/nezha-fronted/src/components/charts/line-chart-block.vue +++ b/nezha-fronted/src/components/charts/line-chart-block.vue @@ -1057,14 +1057,14 @@ export default { const vm = this setTimeout(function () { const divHeight = self.$refs.legendArea ? self.$refs.legendArea.offsetHeight : 0 - if (!chartInfo.height && getChart(self.chartIndex)) { - getChart(self.chartIndex).resize({ height: (250 - divHeight - chartResizeTool.titleHeight - chartResizeTool.chartBlankHeight) }) + if (!chartInfo.height) { + getChart(self.chartIndex) && getChart(self.chartIndex).resize({ height: (250 - divHeight - chartResizeTool.titleHeight - chartResizeTool.chartBlankHeight) }) } else { - getChart(self.chartIndex).resize({ height: (chartInfo.height * vm.stepWidth - divHeight - chartResizeTool.titleHeight - chartResizeTool.chartBlankHeight) }) + getChart(self.chartIndex) && getChart(self.chartIndex).resize({ height: (chartInfo.height * vm.stepWidth - divHeight - chartResizeTool.titleHeight - chartResizeTool.chartBlankHeight) }) } if (dataArg && dataArg.length > 0) { - getChart(self.chartIndex).clear() - getChart(self.chartIndex).setOption(option)// 创建图表 + getChart(self.chartIndex) && getChart(self.chartIndex).clear() + getChart(self.chartIndex) && getChart(self.chartIndex).setOption(option)// 创建图表 self.noData = false } else { self.noData = true @@ -1076,8 +1076,8 @@ export default { } else if (self.$refs.resizeBox.offsetWidth < 500) { option.xAxis.splitNumber = 5 } - getChart(self.chartIndex).clear() - 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.firstShow = true // 展示操作按键 @@ -1087,7 +1087,7 @@ export default { getChart(this.chartIndex).on('magictypechanged', function (params) { self.isStackArea = !self.isStackArea if (self.isStackArea) { - getChart(self.chartIndex).setOption({ + getChart(self.chartIndex) && getChart(self.chartIndex).setOption({ toolbox: { feature: { dataZoom: { @@ -1160,7 +1160,7 @@ export default { } }) } else { - getChart(self.chartIndex).setOption({ + getChart(self.chartIndex) && getChart(self.chartIndex).setOption({ toolbox: { feature: { dataZoom: {