基于jeecg-boot的flowable流程跳转功能实现

更多nbcio-boot功能请看演示系统

gitee源代码地址

后端代码: https://gitee.com/nbacheng/nbcio-boot

前端代码:https://gitee.com/nbacheng/nbcio-vue.git

在线演示(包括H5) : http://122.227.135.243:9888

      今天我们实现nbcio-boot的flowable的流程跳转功能。

一、前端实现

界面实现,就是点击跳转出来的窗口

<!--跳转流程--><a-modal :z-index="100" :title="jumpTitle" @cancel="jumpOpen = false" :visible.sync="jumpOpen" :width="'40%'" append-to-body><el-form ref="jumpForm" :model="jumpForm" label-width="160px"><el-form-item label="跳转节点" prop="jumpType" :rules="[{ required: true, message: '请选择跳转节点', trigger: 'blur' }]"><a-tablesize="middle":columns="jumpNodeColumns":loading="jumpNodeLoading":pagination="false":dataSource="jumpNodeData":rowKey="(record) => record.id":rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange ,type:'radio' }"/></el-form-item><el-form-item label="处理意见" prop="comment" :rules="[{ required: true, message: '请输入处理意见', trigger: 'blur' }]"><el-input type="textarea" v-model="jumpForm.comment" placeholder="请输入处理意见" /></el-form-item><el-form-item label="附件"  prop="commentFileDto.fileurl"><j-upload v-model="jumpForm.commentFileDto.fileurl"   ></j-upload></el-form-item></el-form><span slot="footer" class="dialog-footer"><el-button @click="jumpOpen = false">取 消</el-button><el-button type="primary" @click="jumpComplete(true)">确 定</el-button></span></a-modal>

  相关处理函数如下:

/** 跳转 */handleJump() {this.jumpOpen = true;this.jumpTitle = "跳转流程";this.jumpNodeLoading = trueuserTaskList({ taskId: this.taskForm.taskId }).then((res) => {this.jumpNodeLoading = falsethis.jumpNodeData = res.result})},jumpComplete() {if (this.selectedRows.length < 1) {this.$message.warning('请选择跳转节点')return}// 流程信息this.jumpForm.deployId = this.$route.query && this.$route.query.deployId;this.jumpForm.taskId = this.$route.query && this.$route.query.taskId;this.jumpForm.procInsId = this.$route.query && this.$route.query.procInsId;this.jumpForm.instanceId = this.$route.query && this.$route.query.procInsId;// 初始化表单this.jumpForm.procDefId = this.$route.query && this.$route.query.procDefId;this.jumpForm.businessKey = this.$route.query && this.$route.query.businessKey;this.jumpForm.category = this.$route.query && this.$route.query.category;this.jumpForm.dataId = this.$route.query && this.$route.query.businessKey;//节点类型this.jumpForm.nodeType = this.$route.query && this.$route.query.nodeType;//online表单id和数据idthis.jumpForm.onlineId = this.$route.query && this.$route.query.onlineId;if (this.jumpForm.category === 'online') {this.jumpForm.onlineDataId = this.$route.query && this.$route.query.businessKey;}  //对formdesigner后续加签审批的时候需要用到this.jumpForm.values = this.taskForm.values;//目标选择的节点信息this.jumpForm.targetActId = this.selectedRows[0].id;this.jumpForm.targetActName = this.selectedRows[0].name;console.log("this.jumpForm=",this.jumpForm);jumpTask(this.jumpForm).then(res => {if (res.success) {this.$message.success('跳转成功')this.jumpOpen = false;this.goBack();} else {this.$message.error('跳转失败:' + res.message)}});},/*** 跳转节点列表选择*/onSelectChange (selectedRowKeys, selectedRows) {this.selectedRowKeys = selectedRowKeysthis.selectedRows = selectedRows},

二、后端代码实现

@Override@Transactional(rollbackFor = Exception.class)public void jumpTask(FlowTaskVo flowTaskVo) {//校验任务是否存在Task task = taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult();//当前节点idString currentActId = task.getTaskDefinitionKey();//获取流程实例idString processInstanceId = task.getProcessInstanceId();//当前活动节点名称(任务名称)String currentActName = task.getName();//获取当前操作人姓名SysUser loginuser = iFlowThirdService.getLoginUser();String name = loginuser.getRealname();String type = FlowComment.JUMP.getType();//添加跳转意见 name + "将任务跳转到【" + targetActName + "】,跳转原因:" + comment + ";";taskService.addComment(task.getId(), processInstanceId, type,"当前任务["+currentActName +"]由" + name + "跳转到[" + flowTaskVo.getTargetActName() + "],跳转原因:" + flowTaskVo.getComment());//执行跳转操作runtimeService.createChangeActivityStateBuilder().processInstanceId(processInstanceId).moveActivityIdTo(currentActId, flowTaskVo.getTargetActId()).changeState();}@Overridepublic Result userTaskList(FlowTaskVo flowTaskVo) {List<UserTaskVo> resultList = new ArrayList<UserTaskVo>();// 当前任务 taskTask task = taskService.createTaskQuery().taskId(flowTaskVo.getTaskId()).singleResult();// 获取流程定义信息ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(task.getProcessDefinitionId()).singleResult();//根据流程定义获取deploymentString deploymentId = processDefinition.getDeploymentId();Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();if (ObjectUtil.isEmpty(deployment)) {throw new FlowableException("流程还没布置");}//获取bpmnModel并转为modelNodeBpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinition.getId());//获取主流程Process mainProcess = bpmnModel.getMainProcess();//获取用户任务节点类型,深入子流程mainProcess.findFlowElementsOfType(UserTask.class, true).forEach(userTask -> {UserTaskVo userTaskResult = new UserTaskVo();userTaskResult.setId(userTask.getId());userTaskResult.setProcessDefinitionId(processDefinition.getId());userTaskResult.setName(userTask.getName());resultList.add(userTaskResult);});return Result.OK(resultList);}

三、效果图

 

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/90062.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

SSM框架的学习与应用(Spring + Spring MVC + MyBatis)-Java EE企业级应用开发学习记录(第五天)MyBatis的注解开发

SSM框架的学习与应用(Spring Spring MVC MyBatis)-Java EE企业级应用开发学习记录&#xff08;第五天&#xff09;MyBatis的注解开发 ​ 昨天我们深入学习了MyBatis多表之间的关联映射&#xff0c;了解掌握了一对一关联映射&#xff0c;一对多关联映射&#xff0c;嵌套查询方…

excel 分组排序

excel中会遇到对不同分组数据进行排序&#xff0c;比如对于不同班级里的学生按照分数高低进行升序排序&#xff0c;可以采用如下公式 SUMPRODUCT((A$2:A$12A2)*(C$2:C$12>C2))1 如果需要 进行降序排序&#xff0c;将公式中的大于号替换为小于号即可

Leetcode80. 删除有序数组中的重复项 II

给你一个有序数组 nums &#xff0c;请你 原地 删除重复出现的元素&#xff0c;使得出现次数超过两次的元素只出现两次 &#xff0c;返回删除后数组的新长度。 不要使用额外的数组空间&#xff0c;你必须在 原地 修改输入数组 并在使用 O(1) 额外空间的条件下完成。 class Solu…

Postman中参数区别及使用说明

一、Params与Body 二者区别在于请求参数在http协议中位置不一样。Params 它会将参数放入url中以&#xff1f;区分以&拼接Body则是将请求参数放在请求体中 后端接受数据: 二、body中不同格式 2.1 multipart/form-data key - value 格式输入&#xff0c;主要特点是可以上…

整合SSM:Mybatis层

SSM&#xff08;SpringSpringMVCMyBatis&#xff09;框架集由Spring、MyBatis两个开源框架整合而成.为了加深记忆学习,也为了后续资源方便使用.所以决定就对SSM做一个整合,首先是Mybatis层。 思路&#xff1a; 1.开发环境 基本环境&#xff1a; IDEA MySQL 8.0.22 Tomcat 9…

SpringBoot简单上手

spring boot 是spring快速开发脚手架&#xff0c;通过约定大于配置&#xff0c;优化了混乱的依赖管理&#xff0c;和复杂的配置&#xff0c;让我们用java-jar方式,运行启动java web项目 入门案例 创建工程 先创建一个空的工程 创建一个名为demo_project的项目&#xff0c;并且…

成集云 | 抖店客户静默下单催付数据同步钉钉 | 解决方案

源系统成集云目标系统 方案介绍 随着各品牌全渠道铺货&#xff0c;主播在平台上直播时客户下了订单后不能及时付款&#xff0c;第一时间客户收不到提醒&#xff0c;不仅造成了客户付款率下降&#xff0c;更大量消耗了企业的人力成本和经济。而成集云与钉钉深度合作&#xff0…

vue中实现echarts三维散点图

需要安装 echarts 同时引入 echarts-gl 我安装的版本&#xff1a; "echarts": "^5.3.2", "echarts-gl": "^2.0.9", import Vue from "vue"; import * as echarts from "echarts"; Vue.prototype.$echarts echa…

YOLO目标检测——蔬菜检测数据集下载分享

YOLO蔬菜检测数据集&#xff0c;真实场景的高质量图片数据&#xff0c;数据场景丰富&#xff0c;图片格式为jpg&#xff0c;共21000张图片。 数据集点击下载&#xff1a;YOLO蔬菜检测数据集21000图片数据说明.rar

Java自定义捕获异常

需求分析 ElectricalCustomerVO electricalCustomerVO new ElectricalCustomerVO(); electricalCustomerVO.setElcNumber(chatRecordsLog.getDeviceNumber()); List<ElectricalCustomerVO> electricalCustomerlist electricalCustomerMapper.selectElectricalCustomer…

11.物联网lwip,网卡原理

一。LWIP协议栈内存管理 1.LWIP内存管理方案 &#xff08;1&#xff09;堆heap 1.灰色为已使用内存 2.黑色为未使用内存 3.紫色为使用后内存 按照某种算法&#xff0c;把数据放在内存块中 &#xff08;2&#xff09;池pool 设置内存池&#xff0c;设置成大小相同的内存块。 2…

MyBatisx代码生成

MyBatisx代码生成 1.创建数据库表 CREATE TABLE sys_good (good_id int(11) NOT NULL,good_name varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,good_desc varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,PRIMARY KEY (good_id) ) ENGINEInnoDB DEFAULT CHA…