基于Jeecgboot3.6.3的vue3版本的流程中仿钉钉流程的鼠标拖动功能支持

因为这个项目license问题无法开源,更多技术支持与服务请加入我的知识星球。

1、因为原先仿钉钉流程里不能进行鼠标拖动来查看流程,所以根据作者提供的信息进行修改,在hooks下增加下面文件useDraggableScroll.ts

javascript 复制代码
import { ref, onMounted, onBeforeUnmount, type Ref } from 'vue'

export function useDraggableScroll(containerRef: Ref<HTMLElement | null>) {
  const isDragging = ref(false);
  let startX: number, startY: number;
  let scrollLeft: number, scrollTop: number;

  const onMouseDown = (e: MouseEvent) => {
    if (!containerRef.value) return;
    isDragging.value = true;
    startX = e.pageX;
    startY = e.pageY;
    scrollLeft = containerRef.value.scrollLeft;
    scrollTop = containerRef.value.scrollTop;
    document.addEventListener('mousemove', onMouseMove);
    document.addEventListener('mouseup', onMouseUp);
  };

  const onMouseMove = (e: MouseEvent) => {
    if (!isDragging.value || !containerRef.value) return;
    const deltaX = e.pageX - startX;
    const deltaY = e.pageY - startY;
    containerRef.value.scrollLeft = scrollLeft - deltaX;
    containerRef.value.scrollTop = scrollTop - deltaY;
  };

  const onMouseUp = () => {
    isDragging.value = false;
    document.removeEventListener('mousemove', onMouseMove);
    document.removeEventListener('mouseup', onMouseUp);
  };

  onMounted(() => {
    containerRef.value?.addEventListener('mousedown', onMouseDown);
  });

  onBeforeUnmount(() => {
    containerRef.value?.removeEventListener('mousedown', onMouseDown);
  });

  return {
    isDragging,
  };
}

2、在lowflow\flowDesign\index修改增加相应的操作

import { useDraggableScroll } from '@/views/lowflow/hooks/useDraggableScroll'

const designerContainerRef = ref<HTMLElement | null>(null)

useDraggableScroll(designerContainerRef);

<div class="designer-container cursor-default active:cursor-grabbing" ref="designerContainerRef">

designer-container {

--flow-bg-color: v-bind(bgColor);

position: relative;

display: flex;

flex-direction: row;

height: 100%;

width: 100%;

overflow: auto;

background-color: var(--flow-bg-color);

padding: 80px 0;

3、ModelDesigner.vue的样式做下面的跳转,以便满足拖动等界面要求

javascript 复制代码
.el-dialog.is-fullscreen.ddDialog {
      overflow: hidden;
    }
    .ddDialog .el-dialog__body {
      height: 95%;
      overflow: auto;
    }

4、效果图

相关推荐
zandy101116 小时前
衡石科技chatbot分析手册--钉钉数据问答机器人配置
科技·机器人·钉钉·chatbot·衡石科技
JAVA拾贝17 小时前
Prometheus+Grafana运维监控并实现钉钉告警
运维·钉钉·grafana·prometheus·运维监控
ldj202010 天前
vue3整合element-plus
vue3
yunson_Liu14 天前
服务器获取外网IP,并发送到钉钉
服务器·钉钉
夜空孤狼啸15 天前
前端常用拖拽组件库(vue3、react、vue2)
前端·javascript·react.js·typescript·前端框架·vue3
sunshine_程序媛15 天前
vue3中的watch和watchEffect区别以及demo示例
前端·javascript·vue.js·vue3
lgbisha16 天前
华为云Flexus+DeepSeek征文|体验华为云ModelArts快速搭建Dify-LLM应用开发平台并创建自己dify钉钉群聊机器人
人工智能·ai·语言模型·自然语言处理·机器人·华为云·钉钉
meng半颗糖17 天前
vue3 双容器自动扩展布局 根据 内容的多少 动态定义宽度
前端·javascript·css·vue.js·elementui·vue3
3D虚拟工厂17 天前
3D虚拟工厂
3d·vue3·blender·数字孪生·three.js
LUCIAZZZ19 天前
钉钉机器人-自定义卡片推送快速入门
java·jvm·spring boot·机器人·钉钉·springboot