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

基于jeecgboot-vue3的Flowable流程-自定义业务表单处理(一)支持同一个业务多个关联流程的选择支持

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

这部分先讲讲支持自定义业务表单一个业务服务表单多个流程的支持处理

1、后端mapper部分

如下,修改selectSysCustomFormByServiceName为list对象,以便支持多个

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.flowable.mapper.SysCustomFormMapper"><resultMap type="org.jeecg.modules.flowable.entity.SysCustomForm" id="sysCustomFormResult"><result property="id" column="id"/><result property="businessName" column="business_name"/><result property="businessService" column="business_service"/><result property="flowName" column="flow_name"/><result property="deployId" column="deploy_id"/><result property="routeName" column="route_name"/><result property="component" column="component"/><result property="createBy" column="create_by"/><result property="createTime" column="create_time"/><result property="updateBy" column="update_by"/><result property="updateTime" column="update_time"/><result property="sysOrgCode" column="sys_org_code"/></resultMap><select id="selectSysCustomFormById" parameterType="String" resultType="org.jeecg.modules.flowable.entity.SysCustomForm">select id, business_name, business_service, deploy_id, route_name,component,create_time, update_time, create_by, update_by, sys_org_code from sys_custom_form where id = #{formId}</select><select id="selectSysCustomFormByServiceName" parameterType="String" resultMap="sysCustomFormResult">select id, business_name, business_service, flow_name, deploy_id, route_name,component,create_time, update_time, create_by, update_by, sys_org_code from sys_custom_form where business_service = #{serviceName}</select><update id="updateCustom" parameterType="Object">update sys_custom_form set deploy_id= #{customFormVo.deployId}, flow_name=#{customFormVo.flowName} where id = #{customFormVo.id}</update><select id="selectBussinessKeyByDeployId" parameterType="String" resultType="String">select id from sys_custom_form where deploy_id = #{deployid}</select></mapper>

2、对流程启动也要修改,因为根据用户选择出来的id进行处理

 public Result startProcessInstanceByDataId(String dataId, String selectFlowId, String serviceName, Map<String, Object> variables) {//提交审批的时候进行流程实例关联初始化if (StringUtils.isEmpty(selectFlowId)){return Result.error("未找到关联流程selectFlowId:"+selectFlowId);}/*if (serviceName==null){return Result.error("未找到serviceName:"+serviceName);}*/SysCustomForm sysCustomForm = sysCustomFormService.getById(selectFlowId);if(sysCustomForm ==null){return Result.error("未找到sysCustomForm:"+serviceName);}//优先考虑自定义业务表是否关联流程,再看通用的表单流程关联表ProcessDefinition processDefinition;String deployId = sysCustomForm.getDeployId();if(StringUtils.isEmpty(deployId)) {SysDeployForm sysDeployForm  = sysDeployFormService.selectSysDeployFormByFormId(sysCustomForm.getId());if(sysDeployForm ==null){          	return Result.error("自定义表单也没关联流程定义表,流程没定义关联自定义表单"+sysCustomForm.getId());}processDefinition = repositoryService.createProcessDefinitionQuery().parentDeploymentId(sysDeployForm.getDeployId()).latestVersion().singleResult();}else {processDefinition = repositoryService.createProcessDefinitionQuery().parentDeploymentId(deployId).latestVersion().singleResult();}LambdaQueryWrapper<FlowMyBusiness> flowMyBusinessLambdaQueryWrapper = new LambdaQueryWrapper<>();flowMyBusinessLambdaQueryWrapper.eq(FlowMyBusiness::getDataId, dataId);FlowMyBusiness business = flowMyBusinessService.getOne(flowMyBusinessLambdaQueryWrapper);if (business==null){if(processDefinition==null) {return Result.error("自定义表单也没关联流程定义表,流程没定义关联自定义表单"+sysCustomForm.getId());}boolean binit = flowCommonService.initActBusiness(sysCustomForm.getBusinessName(), dataId, serviceName, processDefinition.getKey(), processDefinition.getId(), sysCustomForm.getRouteName());if(!binit) {return Result.error("自定义表单也没关联流程定义表,流程没定义关联自定义表单"+sysCustomForm.getId());}FlowMyBusiness businessnew = flowMyBusinessService.getOne(flowMyBusinessLambdaQueryWrapper);//流程实例关联初始化结束if (StrUtil.isNotBlank(businessnew.getProcessDefinitionId())){return this.startProcessInstanceById(businessnew.getProcessDefinitionId(),variables);}return this.startProcessInstanceByKey(businessnew.getProcessDefinitionKey(),variables);}else {return Result.error("已经存在这个dataid实例,不要重复申请:"+dataId);}}

3、前端代码如下:

<template><span><a-button :type="btnType" @click="applySubmit()" :loading="submitLoading">{{text}}</a-button><a-modal :z-index="100" :title="firstInitiatorTitle" @cancel="firstInitiatorOpen = false" v-model:open="firstInitiatorOpen":width="'50%'" append-to-body><a-descriptions bordered layout="vertical"><a-descriptions-item :span="3"><a-badge status="processing" text="选择提醒" /></a-descriptions-item><a-descriptions-item label="重新发起新流程按钮" labelStyle="{ color: '#fff', fontWeight: 'bold', fontSize='18px'}">重新发起新流程会删除之前发起的任务,重新开始.</a-descriptions-item><a-descriptions-item label="继续发起老流程按钮">继续发起流程就在原来流程基础上继续流转.</a-descriptions-item></a-descriptions><span slot="footer" class="dialog-footer"><el-button type="primary" @click="ReStartByDataId(true)">重新发起新流程</el-button><el-button type="primary" @click="ReStartByDataId(false)">继续发起老流程</el-button><el-button @click="firstInitiatorOpen = false">取 消</el-button></span></a-modal><!--挂载关联多个流程--><a-modal @cancel="flowOpen = false" :title="flowTitle" v-model:open="flowOpen" width="70%" append-to-body><el-row :gutter="64"><el-col :span="20" :xs="64" style="width: 100%"><el-table ref="singleTable" :data="processList" border highlight-current-row style="width: 100%"><el-table-column type="selection" width="55" align="center" /><el-table-column label="主键" align="center" prop="id" v-if="true"/><el-table-column label="业务表单名称" align="center" prop="businessName" /><el-table-column label="业务服务名称" align="center" prop="businessService" /><el-table-column label="流程名称" align="center" prop="flowName" /><el-table-column label="关联流程发布主键" align="center" prop="deployId" /><el-table-column label="前端路由地址" align="center" prop="routeName" /><el-table-column label="组件注入方法" align="center" prop="component" /><el-table-column label="操作" align="center" class-name="small-padding fixed-width"><template #default="scope"><el-button size="small" type="primary" @click="selectProcess(scope.row)">确定</el-button></template></el-table-column></el-table></el-col></el-row></a-modal></span>
</template><script lang="ts" setup>import { ref, reactive  } from 'vue';import { useRouter, useRoute } from 'vue-router';import {definitionStartByDataId,isFirstInitiator,deleteActivityAndJoin,getProcesss} from "/@/views/flowable/api/definition";import { useMessage } from '/@/hooks/web/useMessage';const { createMessage, createConfirm } = useMessage();defineOptions({ name: 'ActApplyBtn' })const props = defineProps({btnType: {type: String,default: 'link',required: false},dataId: {type: String,default: '',required: true},serviceName: {type: String,default: '',required: true},variables: {type: Object,default: {},},text: {type: String,default: '提交申请',required: false}})const emit = defineEmits(['success'])// 获取路由器对象 href跳转用到const router = useRouter();const route = useRoute();const modalVisible = ref(false)const submitLoading = ref(false)const form = ref<any>({})const firstInitiatorOpen = ref(false)const firstInitiatorTitle = ref('')// 关联流程数据const processList = ref<any>([])const flowOpen = ref(false)const flowTitle = ref('')const selectFlowId = ref('')  //选择或使用的流程IDconst error = ref('')const selectProcess = (row) => {selectFlowId.value = row.id;flowOpen.value = false;var params = Object.assign({dataId: props.dataId}, props.variables);definitionStartByDataId(props.dataId, selectFlowId.value, props.serviceName, params).then(res => {//console.log("startByDataId res",res);if (res.code == 200 ) {createMessage.success(res.msg);emit('success');} else {createMessage.error(res.msg);}}).finally(() => (submitLoading.value = false));}const ReStartByDataId = (isNewFlow: boolean) => {if(isNewFlow) {submitLoading.value = true;deleteActivityAndJoin(props.dataId,props.variables).then(res => {if (res.code == 200 && res.result) { //若删除成功var params = Object.assign({dataId: props.dataId}, props.variables);definitionStartByDataId(props.dataId, selectFlowId.value, props.serviceName, params).then(res => {if (res.code == 200) {firstInitiatorOpen.value = false;createMessage.success(res.message);emit('success');} else {createMessage.error(res.message);}})}}).finally(() => (submitLoading.value = false));}else {//继续原有流程流转,跳到流程处理界面上//console.log("props.variables",props.variables);router.push({path: '/flowable/task/record/index',query: {procInsId: props.variables.processInstanceId,deployId: props.variables.deployId,taskId: props.variables.taskId,businessKey: props.dataId,nodeType: "",appType: "ZDYYW",finished: true},})}}const applySubmit = () => {if (props.dataId && props.dataId.length < 1) {error.value = '必须传入参数dataId';createMessage.error(error.value);return;}if (props.serviceName && props.serviceName.length < 1) {error.value = '必须传入参数serviceName';createMessage.error(error.value);return;} else {error.value = '';}//对于自定义业务,判断是否是驳回或退回的第一个发起人节点submitLoading.value = true;isFirstInitiator(props.dataId, props.variables).then(res => {if (res.code === 200 && res.result) { //若是,弹出窗口选择重新发起新流程还是继续老流程firstInitiatorTitle.value = "根据自己需要进行选择"firstInitiatorOpen.value = true;}else {submitLoading.value = true;const processParams = {serviceName: props.serviceName}/**查询关联流程信息 */getProcesss(processParams).then(res => {processList.value = res.result;submitLoading.value = false;if (processList.value && processList.value.length > 1) {flowOpen.value = true;}else if (processList.value && processList.value.length === 1) {selectFlowId.value = res.result[0].id;var params = Object.assign({dataId: props.dataId}, props.variables);definitionStartByDataId(props.dataId, selectFlowId.value, props.serviceName, params).then(res => {console.log("definitionStartByDataId res",res);if (res.code == 200 ) {createMessage.success(res.message);emit('success');} else {createMessage.error(res.message);}}).finally(() => (submitLoading.value = false));} else {createMessage.error("检查该业务是否已经关联流程!");}}).finally(() => (submitLoading.value = false));}}).finally(() => (submitLoading.value = false));}
</script>

4、效果图如下:

相关文章:

基于jeecgboot-vue3的Flowable流程-自定义业务表单处理(一)支持同一个业务多个关联流程的选择支持

因为这个项目license问题无法开源&#xff0c;更多技术支持与服务请加入我的知识星球。 这部分先讲讲支持自定义业务表单一个业务服务表单多个流程的支持处理 1、后端mapper部分 如下&#xff0c;修改selectSysCustomFormByServiceName为list对象&#xff0c;以便支持多个 &…...

解决数据丢失问题的MacOS 数据恢复方法

每个人都经历过 Mac 硬盘或 USB 驱动器、数码相机、SD/存储卡等数据丢失的情况。我们中的一些人可能认为已删除或格式化的数据将永远丢失&#xff0c;因此就此作罢。对于 macOS 用户来说&#xff0c;当文件被删除时&#xff0c;垃圾箱已被清空&#xff0c;他们可能不知道如何恢…...

[ARM-2D 专题]3. ##运算符

C语言的宏系统相当强大&#xff0c;它允许使用##符号来处理预处理期的文本替换。这种用法被称为标记连接&#xff08;token pasting&#xff09;操作&#xff0c;其结果是将两个标记紧紧地连接在一起&#xff0c;而省略掉它们之间的所有空格。在复杂的宏定义中&#xff0c;运用…...

基于语音识别的智能电子病历(五)电子病历编辑器

前言 首先我们要明确一个概念&#xff1a;很多电子病历的编辑器&#xff0c;在输入文字的地方&#xff0c;有个麦克风按钮&#xff0c;点击一下&#xff0c;可以进行录音&#xff0c;然后识别的文字会自动输入到电子病历中&#xff0c;这种方式其实不能称为“基于语音识别的智…...

云计算技术高速发展,优势凸显

云计算是一种分布式计算技术&#xff0c;其特点是通过网络“云”将巨大的数据计算处理程序分解成无数个小程序&#xff0c;并通过多部服务器组成的系统进行处理和分析这些小程序&#xff0c;最后将结果返回给用户。它融合了分布式计算、效用计算、负载均衡、并行计算、网络存储…...

文本三剑客其二

文本三剑客其二 sed和awk grep就是查找文本当中的内容&#xff0c;扩展正则表达式。 sed 对文本内容进行增删改查 sed是一种流编辑器&#xff0c;一次处理一行内容。 如果只是展示&#xff0c;会放在缓冲区&#xff08;模式空间&#xff09;&#xff0c;展示结束之后&…...

【达梦数据库】typeorm+node.js+达梦数据库返回自增列值

1.配置环境&#xff0c;下载依赖包 typeorm init --name test22 --database mysql typeorm-dm&#xff0c;uuid,typeorm2,修改连接信息 修改src/ data-source.ts 文件 连接dm&#xff0c;可参考刚刚安装typeorm-dm 模块中的 README.md 3.修改自增信息 /* 修改前*/PrimaryGen…...

【ARMv8/ARMv9 硬件加速系列 2.1 -- ARM NEON 向量寄存器单个元素赋值】

文章目录 NEON 向量寄存器单个元素赋值对 v0.4s中的一个元素赋值对 v1.16b 中的一个元素赋值MOVI (Move Immediate)NEON 向量寄存器单个元素赋值 在ARMv8架构中,你可以使用特定的指令来对v0.4s和v1.16b中的单个元素赋值。这通常通过使用MOV(Move)指令的变种实现,具体取决于…...

GD32学习

参考视频13.立创开发板GD32教程&#xff1a;串口配置_哔哩哔哩_bilibili 固件库跟用户手册基本上差不多&#xff0c;只不过用用户手册编写程序的话会更加的底层&#xff0c;固件库的话就是把一些函数封装起来&#xff0c;用的时候拿过来即可&#xff0c;目前我还没有找到固件库…...

LangChain:如何高效管理 LLM 聊天历史记录?

LangChain 团队发布了一篇关于使用 Dragonfly DB 来有效管理 LangChain 应用程序聊天历史记录的教程。 该教程旨在解决用户在使用 LangChain 应用程序时普遍遇到的一个问题&#xff1a;如何高效地管理聊天历史记录。 LangChain 团队在推文中强调了 Dragonfly DB 在管理聊天历…...

【React】useState 更新延迟的原因是什么,怎么解决?

useState 更新延迟的原因 异步更新:React 中的 useState 更新是异步的,这意味着当你调用更新函数(如 setData)时,React 并不立即同步更新状态,而是将其放入一个待处理的队列中,稍后在适当的时候(如在下一次渲染之前)进行处理。因此,如果你尝试在调用更新函数后立即读…...

非关系型数据库NoSQL数据层解决方案 之 redis springboot整合与读写操作 2024详解以及window版redis5.0.14下载百度网盘

redis下载安装以及基本使用 下载地址 链接&#xff1a;百度网盘 请输入提取码 提取码&#xff1a;0410 一个名对应一个数值 内存级 在内存里进行操作 准备启动 我们现在就有一个redis客户端的服务器了 我们再启动一个cmd 操作redis数据库 redis里面的基本数据类型有五种 …...

jigdo无法下载的文件

问题描述 用jigdo下载Debian的iso镜像&#xff0c;剩下最后一个文件下载不了&#xff0c;提示信息&#xff1a; Found 0 of the 1 files required by the template Copied input files to temporary file debian-12.5.0-amd64-DLBD-2.iso.tmp - repeat command and supply mo…...

C#面:C# 类的执行顺序?

C# 类的执行顺序可以分为以下几个步骤&#xff1a; 静态字段初始化&#xff1a;在类的第一次使用之前&#xff0c;静态字段会被初始化。静态字段的初始化顺序是按照它们在代码中的声明顺序进行的。静态构造函数&#xff1a;如果类中定义了静态构造函数&#xff0c;它会在类的第…...

昇思25天学习打卡营第3天|数据集Dataset

一、简介&#xff1a; 数据是深度学习的基础&#xff0c;高质量的数据输入将在整个深度神经网络中起到积极作用。有一种说法是模型最终训练的结果&#xff0c;10%受到算法影响&#xff0c;剩下的90%都是由训练的数据质量决定。&#xff08;doge&#xff09; MindSpore提供基于…...

SpringCloud 服务调用 spring-cloud-starter-openfeign

在Spring Cloud中&#xff0c;spring-cloud-starter-openfeign 是一个用于声明式Web服务客户端&#xff08;例如REST客户端&#xff09;的启动器。它使得在Spring Cloud应用中调用其他HTTP服务变得非常简单&#xff0c;只需创建一个接口并使用注解来定义服务调用的细节。 以下…...

基于Elementui组件,在vue中实现多种省市区前端静态JSON数据展示并支持与后端交互功能,提供后端名称label和id

基于Elementui组件&#xff0c;在vue中实现多种省市区前端静态数据&#xff08;本地JSON数据&#xff09;展示并支持与后端交互功能&#xff0c;提供后端名称label和id 话不多说&#xff0c;先上图 1.支持传递给后端选中省市区的id和名称&#xff0c;示例非常完整&#xff0c…...

基于DPU的云原生裸金属网络解决方案

1. 方案背景和挑战 裸金属服务器是云上资源的重要部分&#xff0c;其网络需要与云上的虚拟机和容器互在同一个VPC下&#xff0c;并且能够像容器和虚拟机一样使用云的网络功能和能力。 传统的裸金属服务器使用开源的 OpenStack Ironic 组件&#xff0c;配合 OpenStack Neutron…...

pip install镜像源(更新和换源)

pip install镜像源&#xff08;更新和换源&#xff09; 1.pip安装依赖包默认访问的源&#xff1a; 因为服务器架设在国外的缘故&#xff0c;很多时候不好用网速不行&#xff0c;这时候就需要选择国内的一些安装源安装相应的包 https://pypi.Python.org/simple/2.设置默认源 …...

基础语法——组合与继承

继承 定义派生类&#xff0c;即继承的一般语法结构如下 class 派生类名 : [继承方式] 基类名 { }; 例如 class Point{int x, y; public:Point(int a0, int b0): x(a), y(b){}virtual double area() {return 0.0; };virtual double volume() { return 0.0; } }; class Circl…...

ROS2新手必看:用turtlesim小乌龟快速入门机器人仿真(附完整安装指南)

ROS2实战入门&#xff1a;从turtlesim小乌龟探索机器人仿真世界 引言&#xff1a;为什么选择turtlesim作为ROS2的起点&#xff1f; 在机器人操作系统(ROS)的学习道路上&#xff0c;很多开发者都会遇到一个共同的困境&#xff1a;理论概念抽象难懂&#xff0c;而直接上手复杂项…...

目标检测新手必看:如何用Python手写IOU计算函数(附完整代码)

目标检测实战&#xff1a;从零编写Python版IOU计算函数 刚接触目标检测时&#xff0c;最让人困惑的莫过于那些神秘的评估指标。其中IOU&#xff08;交并比&#xff09;就像一把尺子&#xff0c;能量化算法预测框与真实框的贴合程度。但纸上得来终觉浅&#xff0c;今天我们就用P…...

从南邮实验报告看数据结构:顺序表、链表、二叉树、图,这些实验到底在练什么?

解码数据结构实验&#xff1a;从顺序表到图算法的编程思维进阶之路 当你第一次翻开数据结构实验手册&#xff0c;看到那些关于顺序表、链表、二叉树和图算法的题目时&#xff0c;是否曾困惑过这些看似枯燥的操作练习究竟能带来什么实际价值&#xff1f;南邮的这一系列实验设计绝…...

zotero-style:提升文献管理效率的3个核心方案

zotero-style&#xff1a;提升文献管理效率的3个核心方案 【免费下载链接】zotero-style zotero-style - 一个 Zotero 插件&#xff0c;提供了一系列功能来增强 Zotero 的用户体验&#xff0c;如阅读进度可视化和标签管理&#xff0c;适合研究人员和学者。 项目地址: https:/…...

WarcraftHelper终极指南:5大核心功能让魔兽争霸3在现代系统完美运行

WarcraftHelper终极指南&#xff1a;5大核心功能让魔兽争霸3在现代系统完美运行 【免费下载链接】WarcraftHelper Warcraft III Helper , support 1.20e, 1.24e, 1.26a, 1.27a, 1.27b 项目地址: https://gitcode.com/gh_mirrors/wa/WarcraftHelper WarcraftHelper是一款…...

AI结对编程:借助快马平台智能生成qclaw官网的AI功能模块

最近在开发qclaw官网时&#xff0c;尝试用AI辅助完成了一个合同条款分析功能&#xff0c;整个过程比想象中顺畅很多。这个功能的核心是让用户输入合同文本后&#xff0c;自动评估风险等级并给出提示。下面分享下具体实现思路和与AI协作的实践经验。 功能设计要点 首先明确这个…...

Llama-3.2V-11B-cot部署教程:WSL2环境下双4090识别与分配验证

Llama-3.2V-11B-cot部署教程&#xff1a;WSL2环境下双4090识别与分配验证 1. 项目概述 Llama-3.2V-11B-cot是基于Meta Llama-3.2V-11B-cot多模态大模型开发的高性能视觉推理工具。该工具针对双卡4090环境进行了深度优化&#xff0c;特别适合在WSL2环境下部署使用。通过本教程…...

LFM2.5-1.2B-Thinking-GGUF部署指南:ss端口监听+curl health检测标准化运维流程

LFM2.5-1.2B-Thinking-GGUF部署指南&#xff1a;ss端口监听curl health检测标准化运维流程 1. 平台简介 LFM2.5-1.2B-Thinking-GGUF是Liquid AI推出的轻量级文本生成模型&#xff0c;特别适合在资源有限的环境中快速部署和使用。这个镜像内置了GGUF模型文件和llama.cpp运行时…...

bert-base-chinese新手教程:从零开始学习中文预训练模型部署与使用

bert-base-chinese新手教程&#xff1a;从零开始学习中文预训练模型部署与使用 1. 认识bert-base-chinese模型 1.1 什么是BERT模型 BERT&#xff08;Bidirectional Encoder Representations from Transformers&#xff09;是Google在2018年发布的预训练语言模型。它通过大规…...

AMD GPU高效部署Ollama:专业本地大语言模型实战指南

AMD GPU高效部署Ollama&#xff1a;专业本地大语言模型实战指南 【免费下载链接】ollama-for-amd Get up and running with Llama 3, Mistral, Gemma, and other large language models.by adding more amd gpu support. 项目地址: https://gitcode.com/gh_mirrors/ol/ollama…...