From 5a4ec5fde4fa3cbb5cd6d47d1b1d112e63df498d Mon Sep 17 00:00:00 2001 From: likunming Date: Thu, 28 Mar 2024 15:02:05 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E4=BC=98=E5=8C=96=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- io.sc.platform.core.frontend/package.json | 2 +- .../src/platform/components/grid/WGrid.vue | 14 +++++++++++++- .../platform/components/toolbar/ChildrenBtn.vue | 4 +--- .../src/platform/components/toolbar/WToolbar.vue | 6 ++---- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/io.sc.platform.core.frontend/package.json b/io.sc.platform.core.frontend/package.json index 5aafb3b7..f4bda667 100644 --- a/io.sc.platform.core.frontend/package.json +++ b/io.sc.platform.core.frontend/package.json @@ -1,6 +1,6 @@ { "name": "platform-core", - "version": "8.1.146", + "version": "8.1.147", "description": "前端核心包,用于快速构建前端的脚手架", "//main": "库的主文件", "main": "dist/platform-core.js", diff --git a/io.sc.platform.core.frontend/src/platform/components/grid/WGrid.vue b/io.sc.platform.core.frontend/src/platform/components/grid/WGrid.vue index d3e01cb7..fe012fb3 100644 --- a/io.sc.platform.core.frontend/src/platform/components/grid/WGrid.vue +++ b/io.sc.platform.core.frontend/src/platform/components/grid/WGrid.vue @@ -913,6 +913,7 @@ const state = reactive({ middleHeight: 0, // 表格当前middle区域高度(表格列头及数据行区域) columnHeadHeight: 0, // 表格当前列头高度 tableTitleWidth: 0, // 当前表格title宽度 + titleTotalHeight: 0, // 当前表格title排除无数据行的总高度 }, pagination: { config: { @@ -1192,7 +1193,10 @@ const noDataTrHeightComputed = computed(() => { (state.refHeightWidth.middleScrollWidth - state.refHeightWidth.middleWidth > 0 ? 15 : 0) - otherHeight; return { - height: props.height > 0 ? props.height + 'px' : resultHeight + 'px', + height: + props.height > 0 + ? props.height - state.refHeightWidth.titleTotalHeight - (state.refHeightWidth.middleScrollWidth - state.refHeightWidth.middleWidth > 0 ? 15 : 0) + 'px' + : resultHeight + 'px', }; }); const noDataTrColspanComputed = computed(() => { @@ -1267,6 +1271,13 @@ const onResize = () => { state.refHeightWidth.middleHeight = state.refHeightWidth.columnHeadHeight + scrollHeight; } state.refHeightWidth.tableTitleWidth = tableRef.value.$el.getElementsByClassName('_table-title')[0]?.clientWidth; + let titleTotalHeight = tableRef.value.$el.getElementsByTagName('thead')[0].offsetHeight; + // 无数据时列头会增加一行,多表头的top距离计算会出错,需减掉多出来的提示行。 + if (table.rows.length === 0) { + const noDataTrHeight = tableRef.value.$el.getElementsByClassName('noDataTr')[0].offsetHeight; + titleTotalHeight = titleTotalHeight - noDataTrHeight; + } + state.refHeightWidth.titleTotalHeight = titleTotalHeight; } }; @@ -1708,6 +1719,7 @@ const stickyHeaderColumn = (time = 500) => { const noDataTrHeight = tableRef.value.$el.getElementsByClassName('noDataTr')[0].offsetHeight; titleTotalHeight = titleTotalHeight - noDataTrHeight; } + state.refHeightWidth.titleTotalHeight = titleTotalHeight; const titleRowHeight = titleTotalHeight / columnTitleState.columnTitleRowNum; if (columnTitleState.columnTitleRowNum) { const row1Height = titleRowHeight * 1; diff --git a/io.sc.platform.core.frontend/src/platform/components/toolbar/ChildrenBtn.vue b/io.sc.platform.core.frontend/src/platform/components/toolbar/ChildrenBtn.vue index be69688f..4d8a573d 100644 --- a/io.sc.platform.core.frontend/src/platform/components/toolbar/ChildrenBtn.vue +++ b/io.sc.platform.core.frontend/src/platform/components/toolbar/ChildrenBtn.vue @@ -1,7 +1,6 @@