From 212d7987889571125133c954f3e94958385ed4be Mon Sep 17 00:00:00 2001 From: Lemon <1599456917@qq.com> Date: Sat, 22 Feb 2025 11:53:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=20?= =?UTF-8?q?=E5=BC=B9=E6=A1=86=E8=A1=A8=E5=8D=95=E8=AF=A6=E6=83=85=20?= =?UTF-8?q?=E5=BD=93=E6=B5=81=E7=A8=8B=E8=A1=A8=E5=8D=95=E8=BF=87=E9=95=BF?= =?UTF-8?q?=E6=97=B6=E5=80=99=E5=A2=9E=E5=8A=A0=E5=AF=B9=E5=BA=94=E5=BE=80?= =?UTF-8?q?=E4=B8=8A=E5=BE=80=E4=B8=8B=E8=B7=B3=E8=BD=AC=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E5=B9=B6=E5=86=85=E5=AE=B9=E5=9C=A8=E5=BC=B9=E6=A1=86=E5=86=85?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bpm/model/CategoryDraggableModel.vue | 152 +++++++++++++++++- 1 file changed, 150 insertions(+), 2 deletions(-) diff --git a/src/views/bpm/model/CategoryDraggableModel.vue b/src/views/bpm/model/CategoryDraggableModel.vue index 71b79b781..5f195b46a 100644 --- a/src/views/bpm/model/CategoryDraggableModel.vue +++ b/src/views/bpm/model/CategoryDraggableModel.vue @@ -254,8 +254,32 @@ - - + +
+ +
+ + +
+
+ + + +
+
+ + + +
+
@@ -274,6 +298,8 @@ import { cloneDeep, isEqual } from 'lodash-es' import { useTagsView } from '@/hooks/web/useTagsView' import { useDebounceFn } from '@vueuse/core' import { subString } from '@/utils/index' +import { ArrowUpBold, ArrowDownBold } from '@element-plus/icons-vue' +import { ElBacktop } from 'element-plus' defineOptions({ name: 'BpmModel' }) @@ -609,9 +635,109 @@ watchEffect(() => { isExpand.value = false } }) + +// 添加顶部按钮显示控制 +const showTopBtn = ref(false) + +// 控制底部按钮显示 +const showBottomBtn = ref(false) + +// 修改滚动事件处理 +const handleScroll = () => { + const container = document.querySelector('.form-detail-container') + if (container) { + const { scrollTop, scrollHeight, clientHeight } = container + // 当滚动到一定距离时显示顶部按钮 + showTopBtn.value = scrollTop > 100 + // 当未滚动到底部时显示底部按钮 + showBottomBtn.value = scrollTop + clientHeight < scrollHeight - 10 + } +} + +// 添加滚动到顶部方法 +const scrollToTop = () => { + const container = document.querySelector('.form-detail-container') + if (container) { + container.scrollTo({ + top: 0, + behavior: 'smooth' + }) + } +} + +// 添加滚动到底部方法 +const scrollToBottom = () => { + const container = document.querySelector('.form-detail-container') + if (container) { + container.scrollTo({ + top: container.scrollHeight, + behavior: 'smooth' + }) + } +} + +// 在组件挂载后添加滚动监听 +onMounted(() => { + const container = document.querySelector('.form-detail-container') + if (container) { + container.addEventListener('scroll', handleScroll) + } +}) + +// 在组件卸载前移除滚动监听 +onUnmounted(() => { + const container = document.querySelector('.form-detail-container') + if (container) { + container.removeEventListener('scroll', handleScroll) + } +})