vue + SpringBoot + flowable 实现工作流审批功能 (流程图部署)
创始人
2024-11-03 16:40:45
0

目录

搭建前端vue项目

vue init webpack project_name 初始化项目

导入 element-ui 框架 

npm install element-ui -s

设置 element-ui 全局配置 编辑 main.js 文件

        import ElementUI from "element-ui"; // ui框架导入        import 'element-ui/lib/theme-chalk/index.css' // ui css 样式导入

导入 axios

        npm install axios

        npm install  workflow-bpmn-modeler

添加main.js 配置文件

搭建后端springBoot项目

导入pom文件

编写yml 配置文件

自动更新异常问题 数据源配置添加&nullCatalogMeansCurrent=true

前端基础配置 bpmn 文件使用

截图展示前端样式

流程分类

 人员users 属性​编辑

组 groups 属性

@save 保存方法参数

后端接口

实体类 接受前端传过来的数据

flowUtils 工作流工具类

保存之后 数据库保存到 ACT_RE_DEPLOYMENT、xml 数据保存到 ACT_GE_BYTEARRAY​编辑


搭建前端vue项目

vue init webpack project_name 初始化项目

导入 element-ui 框架 

  1. npm install element-ui -s

设置 element-ui 全局配置 编辑 main.js 文件

        import ElementUI from "element-ui"; // ui框架导入
        import 'element-ui/lib/theme-chalk/index.css' // ui css 样式导入

导入 axios

        npm install axios

        npm install  workflow-bpmn-modeler

添加main.js 配置文件

import ElementUI from "element-ui"; // ui框架导入 import 'element-ui/lib/theme-chalk/index.css' // ui css 样式导入 import axios from 'axios' Vue.prototype.$axios = axios Vue.config.productionTip = false Vue.use(ElementUI)

搭建后端springBoot项目

导入pom文件

                              org.springframework.boot             spring-boot-starter-web             2.2.0.RELEASE                                                 mysql             mysql-connector-java             8.0.28                                org.mybatis.spring.boot             mybatis-spring-boot-starter             2.1.3                               org.springframework.boot             spring-boot-starter             2.2.0.RELEASE                                        org.flowable             flowable-spring-boot-starter             6.3.0         

编写yml 配置文件

server:   port: 8001  spring:   security:      user:       name: admin       password: admin   # 数据源配置        datasource:     driver-class-name: com.mysql.cj.jdbc.Driver     username: bhz     password: Bhz123456     url: jdbc:mysql://localhost:3306/csvn?serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true    mvc:     view:       suffix: .html flowable:   #  是否主动更新创建flowable关联表   database-schema-update: true   idm:     enabled: true   async-executor-activate: false # mapper 映射文件配置 mybatis:   mapper-locations: classpath:mapper/*.xml   configuration:     map-underscore-to-camel-case: true

自动更新异常问题 数据源配置添加&nullCatalogMeansCurrent=true

问题参考: Flowable工作流启动错误:java.sql.SQLSyntaxErrorException: Table ‘act_ge_property‘ doesn‘t exist_java flowable 在流程启动之后报错,事物回滚了,流程正常启动了-CSDN博客


前端基础配置 bpmn 文件使用

import bpmnModeler from 'workflow-bpmn-modeler'
参数(常用)数据类型含义

:xml

String流程图展示xml字符串
@savefunction模型保存方法
:users[{name:'',id:''}]用户信息
:groups[{name:'',id:''}]组信息
:categorys[{name:'',id:''}]流程分类
:is-viewtrue|false是否可编辑 

截图展示前端样式

流程分类

 人员users 属性
组 groups 属性

@save 保存方法参数
    save(bpmn) {       console.log(bpmn)     }

后端接口

实体类 接受前端传过来的数据

package com.bu.sys.flow.dto;  import lombok.Data;  /**  * @author haizhuangbu  * @date 2024/5/17 20:54  * @mark FlowDto  */ @Data public class FlowDto {      private ProcessDto process;      private String xml;      private String svg;   } 

flowUtils 工作流工具类

package com.bu.utils;  import com.bu.sys.flow.dto.FlowDto; import com.bu.sys.flow.dto.ProcessDto; import org.flowable.engine.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping;  /**  * @author haizhuangbu  * @date 2024/5/17 17:42  * @mark FlowUtils 工作流工具  */ @Component public class FlowUtils {      @Autowired     private RepositoryService repositoryService; // 流程图部署      @Autowired     private RuntimeService runtimeService; // 启动流程      @Autowired     private TaskService taskService; // 任务执行      @Autowired     private IdentityService identityService; // 用户信息      @Autowired     private HistoryService historyService; // 历史信息       public void saveFlow(FlowDto flowDto) {         ProcessDto process = flowDto.getProcess();         repositoryService.createDeployment()                 // 第一参数 流程名称、第二个参数 xml 类型                 .addString(process.getName(), flowDto.getXml())                 .category(process.getCategory())                 .name(process.getName())                 .key(process.getName())                 .deploy();     }   } 

保存之后 数据库保存到 ACT_RE_DEPLOYMENT、xml 数据保存到 ACT_GE_BYTEARRAY


相关内容

热门资讯

技巧辅助挂!pokermast... 技巧辅助挂!pokermaster修改器,丹东约战麻将辅助器,演示教程(有挂细节)1、点击下载安装,...
现场直击!wepokerplu... 现场直击!wepokerplus万能挂,丰城双剑新版最强高分攻略,操作教程(有挂方针)1.丰城双剑新...
插件辅助挂!wepoker有辅... 插件辅助挂!wepoker有辅助器吗,乐平包王攻略,学习教程(有挂方略)1、首先打开乐平包王攻略辅助...
据玩家消息!拱趴大菠萝辅助神器... 据玩家消息!拱趴大菠萝辅助神器,多乐跑得快辅助器,机巧教程(证实有挂)1、在拱趴大菠萝辅助神器插件功...
此事备受玩家关注!来玩app破... 此事备受玩家关注!来玩app破解版,h5能反杀吗,绝活教程(有挂详细)1、打开软件启动之后找到中间准...
值得注意的是!aapoker破... 值得注意的是!aapoker破解侠是真的吗,蜀山四川游戏修改工具,经验教程(有挂助手)1、金币登录送...
第三方辅助!wepoker脚本... 第三方辅助!wepoker脚本,广东星悦有外开挂辅助器吗,法门教程(有挂分析)广东星悦有外开挂辅助器...
此事引发广泛关注!德州透视脚本... 此事引发广泛关注!德州透视脚本,崇阳斗棋辅助脚本视频,诀窍教程(的确有挂)暗藏猫腻,小编详细说明崇阳...
黑科技辅助挂!wepoker买... 黑科技辅助挂!wepoker买脚本靠谱吗,情怀七喜游戏辅助,法门教程(有挂方法)1、每一步都需要思考...
方法辅助挂!aapoker怎么... 方法辅助挂!aapoker怎么设置提高好牌几率,蘑菇云辅助使用视频,绝活儿教程(讲解有挂)1、完成蘑...