当前位置: 首页 > news >正文

基于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.lryc.cn/news/142689.html

相关文章:

  • react图片预加载
  • 数据库管理
  • 【2023年11月第四版教材】《第8章-整合管理》(第3部分)
  • 初阶数据结构(三)链表
  • Python小知识 - 八大排序算法
  • 安卓动态申请权限
  • 关于亚马逊云科技云技能孵化营学习心得
  • 计算机安全学习笔记(III):强制访问控制 - MAC
  • java判断ip是否为指定网段
  • 如何通过人工智能和自动化提高供应链弹性?
  • 【Apollo学习笔记】——规划模块TASK之PATH_REUSE_DECIDER
  • 框架分析(6)-Ruby on Rails
  • LLMs NLP模型评估Model evaluation ROUGE and BLEU SCORE
  • BlazorServer中C#与JavaScript的相互调用
  • 深入理解 MD5 消息摘要算法和在密码存储中的应用及安全隐患
  • python网络爬虫指南二:多线程网络爬虫、动态内容爬取(待续)
  • 华为AirEgine9700S AC配置示例
  • VUE3基础
  • Qt应用开发(基础篇)——日历 QCalendarWidget
  • Python学习笔记:正则表达式、逻辑运算符、lamda、二叉树遍历规则、类的判断
  • 【滑动窗口】leetcode1004:最大连续1的个数
  • 力扣:73. 矩阵置零(Python3)
  • VB|基础语法 变量定义 函数定义 循环语句 IF判断语句等
  • Github 博客搭建
  • 模型预测笔记(三):通过交叉验证网格搜索机器学习的最优参数
  • 创建型模式-建造者模式
  • Rust常用加密算法
  • [管理与领导-55]:IT基层管理者 - 扩展技能 - 1 - 时间管理 -2- 自律与自身作则,管理者管好自己时间的五步法
  • 电子商务员考试题库及答案(中级)--判断题
  • (WAF)Web应用程序防火墙介绍