From 7fb4bf34318f02134e1c113dcc296c058c00511b Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Sun, 20 Apr 2025 08:42:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B7=A5=E4=BD=9C=E6=B5=81list=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E5=9C=A8=E5=BC=80=E5=90=AF=E7=BC=A9=E6=94=BE=E4=BC=9A?= =?UTF-8?q?=E6=9C=89=E8=AF=AF=E5=B7=AE=E5=AF=BC=E8=87=B4=E8=A7=A6=E5=BA=95?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=B8=8D=E4=BC=9A=E8=A7=A6=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 ++++++ apps/web-antd/src/views/workflow/task/allTaskWaiting.vue | 5 ++++- apps/web-antd/src/views/workflow/task/constant.ts | 7 +++++++ apps/web-antd/src/views/workflow/task/myDocument.vue | 3 ++- apps/web-antd/src/views/workflow/task/taskCopyList.vue | 3 ++- apps/web-antd/src/views/workflow/task/taskFinish.vue | 3 ++- apps/web-antd/src/views/workflow/task/taskWaiting.vue | 3 ++- 7 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 apps/web-antd/src/views/workflow/task/constant.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d273a42..f8e539c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# 1.3.3 + +**BUG FIX** + +- 工作流list展示在开启缩放会有误差导致触底逻辑不会触发 + # 1.3.2 **REFACTOR** diff --git a/apps/web-antd/src/views/workflow/task/allTaskWaiting.vue b/apps/web-antd/src/views/workflow/task/allTaskWaiting.vue index d1843616..2288acf5 100644 --- a/apps/web-antd/src/views/workflow/task/allTaskWaiting.vue +++ b/apps/web-antd/src/views/workflow/task/allTaskWaiting.vue @@ -28,6 +28,7 @@ import { categoryTree } from '#/api/workflow/category'; import { pageByAllTaskFinish, pageByAllTaskWait } from '#/api/workflow/task'; import { ApprovalCard, ApprovalPanel, CopyComponent } from '../components'; +import { bottomOffset } from './constant'; const emptyImage = Empty.PRESENTED_IMAGE_SIMPLE; @@ -140,7 +141,9 @@ const handleScroll = debounce(async (e: Event) => { // e.target.scrollHeight 是元素的总高度。 const { scrollTop, clientHeight, scrollHeight } = e.target as HTMLElement; // 判断是否滚动到底部 - const isBottom = scrollTop + clientHeight >= scrollHeight; + const isBottom = scrollTop + clientHeight >= scrollHeight - bottomOffset; + console.log('scrollTop + clientHeight', scrollTop + clientHeight); + console.log('scrollHeight', scrollHeight); // 滚动到底部且没有加载完成 if (isBottom && !isLoadComplete.value) { diff --git a/apps/web-antd/src/views/workflow/task/constant.ts b/apps/web-antd/src/views/workflow/task/constant.ts new file mode 100644 index 00000000..9fc943c7 --- /dev/null +++ b/apps/web-antd/src/views/workflow/task/constant.ts @@ -0,0 +1,7 @@ +/** + * 底部偏移量 + * 在缩放时会差大概0.5px 导致触底逻辑不会触发 + * 在这里设置手动补偿 + * @see https://gitee.com/dapppp/ruoyi-plus-vben5/issues/IC28RE#note_40175381 + */ +export const bottomOffset = 2; diff --git a/apps/web-antd/src/views/workflow/task/myDocument.vue b/apps/web-antd/src/views/workflow/task/myDocument.vue index 395cf012..12a39cf2 100644 --- a/apps/web-antd/src/views/workflow/task/myDocument.vue +++ b/apps/web-antd/src/views/workflow/task/myDocument.vue @@ -24,6 +24,7 @@ import { cloneDeep, debounce } from 'lodash-es'; import { pageByCurrent } from '#/api/workflow/instance'; import { ApprovalCard, ApprovalPanel } from '../components'; +import { bottomOffset } from './constant'; const emptyImage = Empty.PRESENTED_IMAGE_SIMPLE; @@ -95,7 +96,7 @@ const handleScroll = debounce(async (e: Event) => { // e.target.scrollHeight 是元素的总高度。 const { scrollTop, clientHeight, scrollHeight } = e.target as HTMLElement; // 判断是否滚动到底部 - const isBottom = scrollTop + clientHeight >= scrollHeight; + const isBottom = scrollTop + clientHeight >= scrollHeight - bottomOffset; // 滚动到底部且没有加载完成 if (isBottom && !isLoadComplete.value) { diff --git a/apps/web-antd/src/views/workflow/task/taskCopyList.vue b/apps/web-antd/src/views/workflow/task/taskCopyList.vue index f3abea85..3505f8fe 100644 --- a/apps/web-antd/src/views/workflow/task/taskCopyList.vue +++ b/apps/web-antd/src/views/workflow/task/taskCopyList.vue @@ -26,6 +26,7 @@ import { categoryTree } from '#/api/workflow/category'; import { pageByTaskCopy } from '#/api/workflow/task'; import { ApprovalCard, ApprovalPanel, CopyComponent } from '../components'; +import { bottomOffset } from './constant'; const emptyImage = Empty.PRESENTED_IMAGE_SIMPLE; @@ -99,7 +100,7 @@ const handleScroll = debounce(async (e: Event) => { // e.target.scrollHeight 是元素的总高度。 const { scrollTop, clientHeight, scrollHeight } = e.target as HTMLElement; // 判断是否滚动到底部 - const isBottom = scrollTop + clientHeight >= scrollHeight; + const isBottom = scrollTop + clientHeight >= scrollHeight - bottomOffset; // 滚动到底部且没有加载完成 if (isBottom && !isLoadComplete.value) { diff --git a/apps/web-antd/src/views/workflow/task/taskFinish.vue b/apps/web-antd/src/views/workflow/task/taskFinish.vue index 81729db1..d9641b0b 100644 --- a/apps/web-antd/src/views/workflow/task/taskFinish.vue +++ b/apps/web-antd/src/views/workflow/task/taskFinish.vue @@ -26,6 +26,7 @@ import { categoryTree } from '#/api/workflow/category'; import { pageByTaskFinish } from '#/api/workflow/task'; import { ApprovalCard, ApprovalPanel, CopyComponent } from '../components'; +import { bottomOffset } from './constant'; const emptyImage = Empty.PRESENTED_IMAGE_SIMPLE; @@ -99,7 +100,7 @@ const handleScroll = debounce(async (e: Event) => { // e.target.scrollHeight 是元素的总高度。 const { scrollTop, clientHeight, scrollHeight } = e.target as HTMLElement; // 判断是否滚动到底部 - const isBottom = scrollTop + clientHeight >= scrollHeight; + const isBottom = scrollTop + clientHeight >= scrollHeight - bottomOffset; // 滚动到底部且没有加载完成 if (isBottom && !isLoadComplete.value) { diff --git a/apps/web-antd/src/views/workflow/task/taskWaiting.vue b/apps/web-antd/src/views/workflow/task/taskWaiting.vue index bce8ea2e..4a2024af 100644 --- a/apps/web-antd/src/views/workflow/task/taskWaiting.vue +++ b/apps/web-antd/src/views/workflow/task/taskWaiting.vue @@ -27,6 +27,7 @@ import { categoryTree } from '#/api/workflow/category'; import { pageByTaskWait } from '#/api/workflow/task'; import { ApprovalCard, ApprovalPanel, CopyComponent } from '../components'; +import { bottomOffset } from './constant'; const emptyImage = Empty.PRESENTED_IMAGE_SIMPLE; @@ -100,7 +101,7 @@ const handleScroll = debounce(async (e: Event) => { // e.target.scrollHeight 是元素的总高度。 const { scrollTop, clientHeight, scrollHeight } = e.target as HTMLElement; // 判断是否滚动到底部 - const isBottom = scrollTop + clientHeight >= scrollHeight; + const isBottom = scrollTop + clientHeight >= scrollHeight - bottomOffset; // 滚动到底部且没有加载完成 if (isBottom && !isLoadComplete.value) {