From e528859a473a01c557dceee61aa1f2a23a4f33d8 Mon Sep 17 00:00:00 2001 From: wisonic-s Date: Wed, 22 May 2024 18:41:45 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=A7=86=E5=9B=BE):=20=E9=80=8F=E8=A7=86?= =?UTF-8?q?=E8=A1=A8=E6=94=AF=E6=8C=81=E6=BB=9A=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/components/ChartComponentS2.vue | 35 ++++++++++++++----- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/core/frontend/src/views/chart/components/ChartComponentS2.vue b/core/frontend/src/views/chart/components/ChartComponentS2.vue index c2124fdfd2..ad13661221 100644 --- a/core/frontend/src/views/chart/components/ChartComponentS2.vue +++ b/core/frontend/src/views/chart/components/ChartComponentS2.vue @@ -540,7 +540,12 @@ export default { initScroll() { const customAttr = JSON.parse(this.chart.customAttr) const senior = JSON.parse(this.chart.senior) - if (senior?.scrollCfg?.open && (this.chart.type === 'table-normal' || (this.chart.type === 'table-info' && !this.showPage))) { + if (senior?.scrollCfg?.open) { + if (this.chart.type !== 'table-normal') { + if (this.chart.type === 'table-info' && !this.showPage) { + return + } + } // 防止多次渲染 this.myChart.facet.timer?.stop() if (this.myChart.store.get('scrollY') !== 0) { @@ -556,15 +561,27 @@ export default { } const rowHeight = customAttr.size.tableItemHeight const headerHeight = customAttr.size.tableTitleHeight - const scrollBarSize = this.myChart.theme.scrollBar.size - const scrollHeight = rowHeight * this.chart.data.tableRow.length + headerHeight - offsetHeight + scrollBarSize - // 显示内容没撑满 - if (scrollHeight < scrollBarSize) { - return + let duration, scrollHeight + if (this.chart.type === 'table-pivot') { + const totalHeight = this.myChart.facet.viewCellHeights.getTotalHeight() + const viewHeight = this.myChart.facet.rowHeader.cfg.viewportHeight + if (totalHeight <= viewHeight) { + return + } + scrollHeight = totalHeight - viewHeight + const scrollViewCount = (totalHeight - viewHeight) / rowHeight + duration = scrollViewCount / senior.scrollCfg.row * senior.scrollCfg.interval + } else { + const scrollBarSize = this.myChart.theme.scrollBar.size + scrollHeight = rowHeight * this.chart.data.tableRow.length + headerHeight - offsetHeight + scrollBarSize + // 显示内容没撑满 + if (scrollHeight < scrollBarSize) { + return + } + const viewHeight = offsetHeight - headerHeight - scrollBarSize + const scrollViewCount = this.chart.data.tableRow.length - viewHeight / rowHeight + duration = scrollViewCount / senior.scrollCfg.row * senior.scrollCfg.interval } - const viewHeight = offsetHeight - headerHeight - scrollBarSize - const scrollViewCount = this.chart.data.tableRow.length - viewHeight / rowHeight - const duration = scrollViewCount / senior.scrollCfg.row * senior.scrollCfg.interval this.myChart.facet.scrollWithAnimation({ offsetY: { value: scrollHeight,