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) + } +})