diff --git a/nezha-fronted/src/components/charts/chart-list.vue b/nezha-fronted/src/components/charts/chart-list.vue index 1262fe852..6041106f7 100644 --- a/nezha-fronted/src/components/charts/chart-list.vue +++ b/nezha-fronted/src/components/charts/chart-list.vue @@ -634,10 +634,6 @@ export default { // 获取panel详情数据,获取panel下所有chart列表 getData (params) { - if (this.finshGetData) { - return - } - this.finshGetData = true const param = { panelId: params.panelId, query: params.query, @@ -710,21 +706,16 @@ export default { } }) }) - this.finshGetData = false return } if (!param.query) delete param.query // 根据panelId获得panel下的所有图表 // const groupId = true ? '&groupId=0' : '' if (!params.panelId) { - this.finshGetData = false return } // 没有panelId不调用接口 this.$get('visual/panel/chart?panelId=' + params.panelId + '&groupId=0' + '&pageSize=-1').then(response => { if (response.code === 200) { - setTimeout(() => { - this.finshGetData = false - }, 100) response.data.list.forEach((item, index) => { item.isLoaded = false }) diff --git a/nezha-fronted/src/components/charts/line-chart-block.vue b/nezha-fronted/src/components/charts/line-chart-block.vue index 9a0ebaaa4..e43eb31ba 100644 --- a/nezha-fronted/src/components/charts/line-chart-block.vue +++ b/nezha-fronted/src/components/charts/line-chart-block.vue @@ -451,7 +451,7 @@ export default { } getChart(this.chartIndex).setOption({ yAxis: { - ...option.yAxis + ...option.yAxis } }) } @@ -1056,8 +1056,8 @@ export default { this.$nextTick(() => { const vm = this setTimeout(function () { - const divHeight = self.$refs.legendArea.offsetHeight - if (!chartInfo.height) { + 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) }) } else { getChart(self.chartIndex).resize({ height: (chartInfo.height * vm.stepWidth - divHeight - chartResizeTool.titleHeight - chartResizeTool.chartBlankHeight) }) @@ -1682,7 +1682,7 @@ export default { this.chartInfo.param.nullType = this.chartInfo.param.nullType || 'null' query += '&nullType=' + this.chartInfo.param.nullType } - axiosArr = [this.$get('/prom/api/v1/query_range?query=' + query+ '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step)] + axiosArr = [this.$get('/prom/api/v1/query_range?query=' + query + '&start=' + this.$stringTimeParseToUnix(startTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&step=' + step)] } } // 一个图表 diff --git a/nezha-fronted/src/components/common/project/topologyL5.vue b/nezha-fronted/src/components/common/project/topologyL5.vue index 62a2d637e..f0d3119b6 100644 --- a/nezha-fronted/src/components/common/project/topologyL5.vue +++ b/nezha-fronted/src/components/common/project/topologyL5.vue @@ -719,7 +719,7 @@ export default { getTopology(this.topologyIndex).centerView() this.penToolTipScale = getTopology(this.topologyIndex).data.scale setTimeout(() => { - getTopology(this.topologyIndex).data.pens.forEach(item => { + getTopology(this.topologyIndex)&&getTopology(this.topologyIndex).data.pens.forEach(item => { if (item.animatePlay) { item.stopAnimate() setTimeout(() => { @@ -768,7 +768,10 @@ export default { }, // 打开topology数据 openTopologyData (data) { - return new Promise(resolve => { + return new Promise((resolve, reject) => { + if (!document.getElementById('topology-canvas' + this.topologyIndexF)) { + return + } if (!getTopology(this.topologyIndex)) { const canvas = new Topology('topology-canvas' + this.topologyIndexF, canvasOptions) canvas.open(data) @@ -1080,7 +1083,7 @@ export default { // 摘除已选择的module modulesDiff (data) { this.modules = this.allModules - if (getTopology(this.topologyIndex).data.pens) { + if (getTopology(this.topologyIndex) && getTopology(this.topologyIndex).data.pens) { getTopology(this.topologyIndex).data.pens.forEach(item => { if (item.type == 0) { this.modules = this.modules.filter(item1 => item.data.moduleId !== item1.id) @@ -1422,7 +1425,8 @@ export default { } break case 'resize': { - const domRect = document.getElementById('topology-canvas' + this.topologyIndexF).getBoundingClientRect() + const dom = document.getElementById('topology-camvas' + this.topologyIndexF) + const domRect = dom ? dom.getBoundingClientRect() : {} if (getTopology(this.topologyIndex)) { getTopology(this.topologyIndex).canvasPos = domRect } @@ -1432,7 +1436,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-camvas' + this.topologyIndexF) + const domRect = dom ? dom.getBoundingClientRect() : {} if (getTopology(this.topologyIndex)) { getTopology(this.topologyIndex).canvasPos = domRect } @@ -1892,7 +1897,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-camvas' + this.topologyIndexF) + const domRect = dom ? dom.getBoundingClientRect() : {} getTopology(this.topologyIndex).canvasPos = domRect }) }, @@ -1994,7 +2000,8 @@ export default { this.$store.commit('setShowTopoScreen', this.topoScreenState) this.$nextTick(() => { getTopology(this.topologyIndex).lock(1) - const domRect = document.getElementById('topology-canvas' + this.topologyIndexF).getBoundingClientRect() + const dom = document.getElementById('topology-camvas' + this.topologyIndexF) + const domRect = dom ? dom.getBoundingClientRect() : {} getTopology(this.topologyIndex).canvasPos = domRect this.reload() }) @@ -2021,7 +2028,8 @@ export default { this.editTopologyFlag = false this.$nextTick(() => { getTopology(this.topologyIndex).lock(1) - const domRect = document.getElementById('topology-canvas' + this.topologyIndexF).getBoundingClientRect() + const dom = document.getElementById('topology-camvas' + this.topologyIndexF) + const domRect = dom ? dom.getBoundingClientRect() : {} getTopology(this.topologyIndex).canvasPos = domRect this.$store.commit('setShowTopoScreen', this.topoScreenState) }) @@ -2068,7 +2076,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-camvas' + this.topologyIndexF) + const domRect = dom ? dom.getBoundingClientRect() : {} getTopology(this.topologyIndex).canvasPos = domRect this.initPens(topologyData) // this.reload()