|
|
@@ -8,6 +8,7 @@ import { useModalContext } from '/@/components/Modal';
|
|
|
import { onMountedOrActivated } from '/@/hooks/core/onMountedOrActivated';
|
|
|
import { useDebounceFn } from '@vueuse/core';
|
|
|
import componentSetting from '/@/settings/componentSetting';
|
|
|
+import { useAppStore } from '/@/store/modules/app';
|
|
|
|
|
|
export function useTableScroll(
|
|
|
propsRef: ComputedRef<BasicTableProps>,
|
|
|
@@ -21,6 +22,7 @@ export function useTableScroll(
|
|
|
const tableHeightRef: Ref<Nullable<number>> = ref(null);
|
|
|
|
|
|
const modalFn = useModalContext();
|
|
|
+ const appStore = useAppStore();
|
|
|
|
|
|
// Greater than animation time 280
|
|
|
const debounceRedoHeight = useDebounceFn(redoHeight, 100);
|
|
|
@@ -58,7 +60,7 @@ export function useTableScroll(
|
|
|
let bodyEl: HTMLElement | null;
|
|
|
|
|
|
async function calcTableHeight() {
|
|
|
- const { resizeHeightOffset, pagination, maxHeight, minHeight } = unref(propsRef);
|
|
|
+ const { resizeHeightOffset = 2, pagination, maxHeight, minHeight } = unref(propsRef);
|
|
|
const tableData = unref(getDataSourceRef);
|
|
|
|
|
|
const table = unref(tableElRef);
|
|
|
@@ -100,13 +102,18 @@ export function useTableScroll(
|
|
|
if (!headEl) return;
|
|
|
|
|
|
// Table height from bottom
|
|
|
- const { bottomIncludeBody } = getViewportOffset(headEl);
|
|
|
+ const vpoffset = getViewportOffset(headEl);
|
|
|
+ // Table height after calculating the scale on html tag
|
|
|
+ const bottomIncludeBody = vpoffset.bottomIncludeBody / appStore.heightScale;
|
|
|
// Table height from bottom height-custom offset
|
|
|
|
|
|
const paddingHeight = 32;
|
|
|
// Pager height
|
|
|
let paginationHeight = 2;
|
|
|
- if (!isBoolean(pagination)) {
|
|
|
+ // 经实践发现只有指定pagination为false才不会显示分页器
|
|
|
+ if (pagination === false) {
|
|
|
+ paginationHeight = -8;
|
|
|
+ } else {
|
|
|
paginationEl = tableEl.querySelector('.ant-pagination') as HTMLElement;
|
|
|
if (paginationEl) {
|
|
|
const offsetHeight = paginationEl.offsetHeight;
|
|
|
@@ -115,8 +122,6 @@ export function useTableScroll(
|
|
|
// TODO First fix 24
|
|
|
paginationHeight += 24;
|
|
|
}
|
|
|
- } else {
|
|
|
- paginationHeight = -8;
|
|
|
}
|
|
|
|
|
|
let footerHeight = 0;
|
|
|
@@ -132,7 +137,8 @@ export function useTableScroll(
|
|
|
headerHeight = (headEl as HTMLElement).offsetHeight;
|
|
|
}
|
|
|
|
|
|
- let height = bottomIncludeBody - (resizeHeightOffset || 0) - paddingHeight - paginationHeight - footerHeight - headerHeight;
|
|
|
+ // 高度为表格高度减去底部各个元素高度-内外边距-布局下边距
|
|
|
+ let height = bottomIncludeBody - resizeHeightOffset - paddingHeight - paginationHeight - footerHeight - headerHeight;
|
|
|
// update-begin--author:liaozhiyang---date:20240603---for【TV360X-861】列表查询区域不可往上滚动
|
|
|
// 10+6(外层边距padding:10 + 内层padding-bottom:6)
|
|
|
height -= 16;
|