From 328292b9010c01f4942ffe2bf2bbcc65e5545585 Mon Sep 17 00:00:00 2001 From: likunming Date: Wed, 17 Apr 2024 11:55:34 +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 --- .../platform/components/grid/TreeGridRow.vue | 26 ++++++++++--------- .../src/platform/components/grid/WGrid.vue | 25 +++++++++++------- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/io.sc.platform.core.frontend/src/platform/components/grid/TreeGridRow.vue b/io.sc.platform.core.frontend/src/platform/components/grid/TreeGridRow.vue index 5520de8a..5b2daad7 100644 --- a/io.sc.platform.core.frontend/src/platform/components/grid/TreeGridRow.vue +++ b/io.sc.platform.core.frontend/src/platform/components/grid/TreeGridRow.vue @@ -44,18 +44,20 @@ 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 6ec0fb68..5c1cce7f 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 @@ -1,5 +1,6 @@ - + {{ state.noDataLabel }} @@ -251,6 +252,7 @@ const darkBgColor = getCssVar('dark'); const tableHeadBgColor = gc.theme.dark ? darkBgColor : gc.theme?.grid?.headBgColor || '#f5f7fa'; const tableBorderColor = gc.theme?.grid?.borderColor || 'rgba(0, 0, 0, 0.12)'; const stickyBgColor = gc.theme.dark ? darkBgColor : gc.theme?.grid?.stickyBgColor || '#ffffff'; +const onResizeRef = ref(false); const props = defineProps({ height: { type: Number, default: 0 }, // 表格高度 @@ -1148,7 +1150,8 @@ const selectionComputed = computed(() => { } }); -const tableHeightComputed = () => { +const tableHeightComputed = computed(() => { + onResizeRef.value; let availableHeight = 0; const parentHtmlElement = tableRef?.value?.$el?.parentElement; if (parentHtmlElement) { @@ -1163,9 +1166,10 @@ const tableHeightComputed = () => { height: props.height > 0 ? props.height + 'px' : availableHeight > 0 ? availableHeight + 'px' : '0px', }; return style; -}; +}); -const noDataTrHeightComputed = () => { +const noDataTrHeightComputed = computed(() => { + onResizeRef.value; let availableHeight = 0; let otherHeight = 0; let otherHeight2 = 0; @@ -1186,10 +1190,10 @@ const noDataTrHeightComputed = () => { availableHeight -= 1; //无数据增加的title行,下边框所占边框 const style = { - height: props.height > 0 ? props.height - otherHeight2 + 'px' : availableHeight > 0 ? availableHeight + 'px' : '0px', + height: props.height > 0 ? props.height - otherHeight2 - 1 + 'px' : availableHeight > 0 ? availableHeight + 'px' : '0px', }; return style; -}; +}); const noDataTrColspanComputed = computed(() => { let colspan = excludeColumnNum.value; @@ -1242,6 +1246,7 @@ const updateTicked = (evt: Event, row: any) => { }; const onResize = () => { + onResizeRef.value = !onResizeRef.value; handlerQueryFormShowField(); if (tableRef.value) { state.refHeightWidth.yLocation = tableRef.value.$el.getBoundingClientRect().y; @@ -1397,6 +1402,7 @@ const onRequest = async (ops: any) => { addRowKey(table.rows); stickyHeaderColumn(); emit('afterRequestData'); + table.treeExpand = false; }; const addRowKey = (rows: []) => { @@ -1756,6 +1762,7 @@ const stickyHeaderColumn = (time = 500) => { } }, time); + tableRef.value.$el.getElementsByTagName('table')[0].style.setProperty('table-layout', 'fixed'); tableRef.value.$el.getElementsByTagName('table')[0].style.setProperty('--tableHeadBgColor', tableHeadBgColor); tableRef.value.$el.getElementsByTagName('table')[0].style.setProperty('--stickyBgColor', stickyBgColor); tableRef.value.$el.getElementsByTagName('table')[0].style.setProperty('--tableBorderColor', tableBorderColor);