From 43b179bc275e5a8dfb0fead3d2965da07b6182df Mon Sep 17 00:00:00 2001 From: chenjinsong <523037378@qq.com> Date: Wed, 3 Jun 2020 20:45:58 +0800 Subject: [PATCH] =?UTF-8?q?NEZ-290=20fix:=20=E4=BF=AE=E5=A4=8D=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E6=8B=96=E6=8B=BD=E7=A7=BB=E4=BD=8D=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/charts/chart-list.vue | 38 +++++++++---------- .../common/bottomBox/tabs/panelTab.vue | 3 +- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/nezha-fronted/src/components/charts/chart-list.vue b/nezha-fronted/src/components/charts/chart-list.vue index b0e6ea0ea..8a650e228 100644 --- a/nezha-fronted/src/components/charts/chart-list.vue +++ b/nezha-fronted/src/components/charts/chart-list.vue @@ -55,7 +55,7 @@ animation:150, handle:'.chartTitle', }" > -
+
0) { @@ -203,7 +201,7 @@ this.dataListDragTmp = [...this.dataList]; }, end (event) { - console.info("end event:", event) + //console.info("end event:", event) let item = event.item; let oldIndex = event.oldIndex; let newIndex = event.newIndex; @@ -271,7 +269,7 @@ if(item.id===newPrevItem.id){ prevItemIndexInTotal = index; } - }) + }); //console.log('从前往后移动:prev元素在总列表中之后的元素的index='+prevItemIndexInTotal) if(prevItemIndexInTotal { if (this.dataList.length > 0 ) { this.dataList.forEach((item,index) => { - + this.$refs['editChart'+item.id][0].showLoad(item);//之后要实现 this.setChartSize(item.span, index);//设置该图表宽度 if(!item.isLoaded ){ @@ -582,7 +579,6 @@ }, loadChartData(scrollTop){ if (this.dataList.length > 0 ) { - let chartListInViewport = []; this.dataList.forEach((item,index) => { if(!item.isLoaded){ //获得当前显示在浏览器的图表,从后台获取数据 @@ -609,7 +605,7 @@ } }else { if (!isSearch && this.$refs['editChart'+item.id] && this.$refs['editChart'+item.id][0]) { - + this.$refs['editChart'+item.id][0].showLoad(item); } this.setChartSize(item, realIndex); // 设置该图表宽度 @@ -1320,7 +1316,7 @@ this.chartDataCacheGroup.set(duplicateChartId,duplicateChartData); this.$nextTick(() => { if (this.$refs['editChart'+duplicateChartId][0]) { - + this.$refs['editChart'+duplicateChartId][0].showLoad(duplicateChart);//之后要实现 } @@ -1393,18 +1389,18 @@ * 第一种情况 由于元素随页面向上滚动, 整个页面滚动的距离 大于 (元素距离页面顶部的距离 + 元素本身的高度 )-> 超出 * 第二种情况 由于元素随页面向下滚动, 整个页面滚动的距离 小于 (元素距离页面顶部的距离 - 浏览器可见区域高度 )-> 超出 * */ - //console.log("___isInView____","元素距离页面顶部的距离mainOffsetTop="+mainOffsetTop)//不变 - //console.log("___isInView____","元素高度mainHeight="+mainHeight)//不变 - //console.log("___isInView____","scrollTop页面滚动的距离windowScrollTop="+windowScrollTop)//变 - //console.log("___isInView____","浏览器可见区域高度windowHeight="+windowHeight)//不变 - //console.log(item.title,(mainOffsetTop+mainHeight),"<",(windowScrollTop+windowHeight),((mainOffsetTop+mainHeight) < (windowScrollTop+windowHeight))) + /*console.log("___isInView____","元素距离页面顶部的距离mainOffsetTop="+mainOffsetTop)//不变 + console.log("___isInView____","元素高度mainHeight="+mainHeight)//不变 + console.log("___isInView____","scrollTop页面滚动的距离windowScrollTop="+windowScrollTop)//变 + console.log("___isInView____","浏览器可见区域高度windowHeight="+windowHeight)//不变 + console.log(item.title,(mainOffsetTop+mainHeight/3),"<",(windowScrollTop+windowHeight),((mainOffsetTop+mainHeight/3) < (windowScrollTop+windowHeight)))*/ if((mainOffsetTop+mainHeight/3) < (windowScrollTop+windowHeight)){ let chartType = item.type; item.isLoaded = true; if(chartType!=='url'){ that.getChartDataForSearch(item,index); } else { - + that.$refs['editChart'+item.id][0].showLoad(item); } } diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/panelTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/panelTab.vue index 50518511a..b4a32e316 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/panelTab.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/panelTab.vue @@ -388,6 +388,7 @@ } else { _self.showTopBtn = false; } + _self.$refs.chartList.loadChartData(scrollbarWrap.scrollTop); /*if (scrollbarWrap.scrollHeight - scrollbarWrap.scrollTop - scrollbarWrap.offsetHeight < 20) { _self.$refs.chartList.pageDataList(true, _self.panelId); }*/ @@ -432,7 +433,7 @@ immediate: true, handler(n, o) { setTimeout(() => { - if ((n && !o) || n.id != o.id) { + if (n && n.id) { this.getTableData(n.id); } }, 500);