基于若依ruoyi-nbcio支持flowable流程增加自定义业务表单(二)

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

gitee源代码地址

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

演示地址:RuoYi-Nbcio后台管理系统

之前讲了自定义业务表单,现在讲如何与流程进行关联

1、后端部分

WfCustomFormMapper.xml

<update id="updateCustom" parameterType="Object">update wf_custom_form set deploy_id= #{customFormVo.deployId}, flow_name=#{customFormVo.flowName} where id = #{customFormVo.id}</update>

WfCustomFormMapper.java

import com.ruoyi.workflow.domain.WfCustomForm;
import com.ruoyi.workflow.domain.vo.CustomFormVo;
import com.ruoyi.workflow.domain.vo.WfCustomFormVo;import org.apache.ibatis.annotations.Param;import com.ruoyi.common.core.mapper.BaseMapperPlus;/*** 流程业务单Mapper接口** @author nbacheng* @date 2023-10-09*/
public interface WfCustomFormMapper extends BaseMapperPlus<WfCustomFormMapper, WfCustomForm, WfCustomFormVo> {void updateCustom(@Param("customFormVo") CustomFormVo customFormVo);
}

control接口

/*** 关联流程业务单*/@SaCheckPermission("workflow:customForm:edit")@Log(title = "流程业务单", businessType = BusinessType.UPDATE)@RepeatSubmit()@PostMapping("/updateCustom")public R<Void> updateCustom( @RequestBody CustomFormVo customFormVo) {iWfCustomFormService.updateCustom(customFormVo);return R.ok("关联流程成功!");}

CustomFormVo.java

package com.ruoyi.workflow.domain.vo;import lombok.Data;/*** @Author nbacheng* @Date 2022/5/3* @Description:* @Version 1.0*/
@Data
public class CustomFormVo {private String id;private String deployId;	private String flowName;
}

2、前端部分

customForm的index.vue代码如下

<template><div class="app-container"><el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"><el-form-item label="业务表单名称" prop="businessName"><el-inputv-model="queryParams.businessName"placeholder="请输入业务表单名称"clearable@keyup.enter.native="handleQuery"/></el-form-item><el-form-item label="业务服务名称" prop="businessService"><el-inputv-model="queryParams.businessService"placeholder="请输入业务服务名称"clearable@keyup.enter.native="handleQuery"/></el-form-item><el-form-item label="流程名称" prop="flowName"><el-inputv-model="queryParams.flowName"placeholder="请输入流程名称"clearable@keyup.enter.native="handleQuery"/></el-form-item><el-form-item label="关联流程发布主键" prop="deployId"><el-inputv-model="queryParams.deployId"placeholder="请输入关联流程发布主键"clearable@keyup.enter.native="handleQuery"/></el-form-item><el-form-item label="前端路由地址" prop="routeName"><el-inputv-model="queryParams.routeName"placeholder="请输入前端路由地址"clearable@keyup.enter.native="handleQuery"/></el-form-item><el-form-item label="组件注入方法" prop="component"><el-inputv-model="queryParams.component"placeholder="请输入组件注入方法"clearable@keyup.enter.native="handleQuery"/></el-form-item><el-form-item><el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button><el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button></el-form-item></el-form><el-row :gutter="10" class="mb8"><el-col :span="1.5"><el-buttontype="primary"plainicon="el-icon-plus"size="mini"@click="handleAdd"v-hasPermi="['workflow:customForm:add']">新增</el-button></el-col><el-col :span="1.5"><el-buttontype="success"plainicon="el-icon-edit"size="mini":disabled="single"@click="handleUpdate"v-hasPermi="['workflow:customForm:edit']">修改</el-button></el-col><el-col :span="1.5"><el-buttontype="danger"plainicon="el-icon-delete"size="mini":disabled="multiple"@click="handleDelete"v-hasPermi="['workflow:customForm:remove']">删除</el-button></el-col><el-col :span="1.5"><el-buttontype="warning"plainicon="el-icon-download"size="mini"@click="handleExport"v-hasPermi="['workflow:customForm:export']">导出</el-button></el-col><right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar></el-row><el-table v-loading="loading" :data="customFormList" @selection-change="handleSelectionChange"><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 slot-scope="scope"><el-buttonsize="mini"type="text"icon="el-icon-edit"@click="relationProcess(scope.row)"v-hasPermi="['workflow:customForm:edit']">关联流程</el-button><el-button<el-buttonsize="mini"type="text"icon="el-icon-edit"@click="handleUpdate(scope.row)"v-hasPermi="['workflow:customForm:edit']">修改</el-button><el-buttonsize="mini"type="text"icon="el-icon-delete"@click="handleDelete(scope.row)"v-hasPermi="['workflow:customForm:remove']">删除</el-button></template></el-table-column></el-table><paginationv-show="total>0":total="total":page.sync="queryParams.pageNum":limit.sync="queryParams.pageSize"@pagination="getList"/><!-- 添加或修改流程业务单对话框 --><el-dialog :title="title" :visible.sync="open" width="680px" append-to-body><el-form ref="form" :model="form" :rules="rules" label-width="160px"><el-form-item label="业务表单名称" prop="businessName"><el-input v-model="form.businessName" placeholder="请输入业务表单名称" /></el-form-item><el-form-item label="业务服务名称" prop="businessService"><el-input v-model="form.businessService" placeholder="请输入业务服务名称" /></el-form-item><el-form-item label="流程名称" prop="flowName"><el-input v-model="form.flowName" placeholder="请输入流程名称" /></el-form-item><el-form-item label="关联流程发布主键" prop="deployId"><el-input v-model="form.deployId" placeholder="请输入关联流程发布主键" /></el-form-item><el-form-item label="前端路由地址" prop="routeName"><el-input v-model="form.routeName" type="textarea" placeholder="请输入内容" /></el-form-item><el-form-item label="组件注入方法" prop="component"><el-input v-model="form.component" type="textarea" placeholder="请输入内容" /></el-form-item></el-form><div slot="footer" class="dialog-footer"><el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button><el-button @click="cancel">取 消</el-button></div></el-dialog><!--挂载布置流程--><a-modal @cancel="flowOpen = false" :title="flowTitle" :visible.sync="flowOpen" width="70%" append-to-body><el-row :gutter="64"><el-form :model="queryFlowParams" ref="queryFlowForm" :inline="true" label-width="100px"><el-form-item label="流程名称" prop="processName"><el-input v-model="queryFlowParams.processName" placeholder="请输入名称" clearable size="small"@keyup.enter.native="handleFlowQuery" /></el-form-item><el-form-item label="流程应用类型" prop="appType"><el-select @change="handleFlowQuery" v-model="queryFlowParams.appType" placeholder="请选择应用类型" clearableprop="appType"><el-optionv-for="dict in dict.type.wf_app_type":key="dict.value":label="dict.label":value="dict.value"></el-option></el-select></el-form-item><el-form-item label="激活" prop="active"><el-switch v-model="queryFlowParams.active" active-color="#13ce66" inactive-color="#ff4949" @change="handleQuery"></el-switch></el-form-item><el-form-item><el-button type="primary" icon="el-icon-search" size="mini" @click="handleFlowQuery">搜索</el-button><el-button icon="el-icon-refresh" size="mini" @click="resetFlowQuery">重置</el-button></el-form-item></el-form></el-row><el-row :gutter="64"><el-col :span="20" :xs="64" style="width: 100%"><el-table ref="singleTable" :data="deployList" border highlight-current-row@current-change="handleCurrentChange" style="width: 100%"><el-table-column type="selection" width="55" align="center" /><el-table-column label="流程标识" align="center" prop="processKey" :show-overflow-tooltip="true" /><el-table-column label="流程名称" align="center" :show-overflow-tooltip="true"><template slot-scope="scope"><el-button type="text" @click="handleProcessView(scope.row)"><span>{{ scope.row.processName }}</span></el-button></template></el-table-column><el-table-column label="流程分类" align="center" prop="categoryName" :formatter="categoryFormat" /><el-table-column label="应用类型" align="center" prop="appType" width="100"><template slot-scope="scope"><dict-tag :options="dict.type.wf_app_type" :value="scope.row.appType"/></template></el-table-column><el-table-column label="流程版本" align="center"><template slot-scope="scope"><el-tag size="medium" >v{{ scope.row.version }}</el-tag></template></el-table-column><el-table-column label="状态" align="center"><template slot-scope="scope"><el-tag type="success" v-if="!scope.row.suspended">激活</el-tag><el-tag type="warning" v-if="scope.row.suspended">挂起</el-tag></template></el-table-column><el-table-column label="部署时间" align="center" prop="deploymentTime" width="180"/><el-table-column label="操作" align="center" class-name="small-padding fixed-width"><template slot-scope="scope"><el-button size="mini" type="text" @click="submitCustom(scope.row)">确定</el-button></template></el-table-column></el-table><el-pagination v-show="deployTotal>0" :total="deployTotal" :current-page.sync="queryParams.pageNum":page-size.sync="queryParams.pageSize" @size-change="getDeployList" @current-change="getDeployList" /></el-col></el-row></a-modal><!-- 流程图 --><el-dialog :title="processView.title" :visible.sync="processView.open" width="70%" append-to-body><process-viewer :key="`designer-${processView.index}`" :xml="processView.xmlData" :style="{height: '400px'}" /></el-dialog></div>
</template><script>
import { listCustomForm, getCustomForm, delCustomForm, addCustomForm, updateCustomForm, updateCustom } from "@/api/workflow/customForm";
import { listAllCategory } from '@/api/workflow/category'
import { listDeploy, listPublish, getBpmnXml, changeState, delDeploy } from '@/api/workflow/deploy'
import ProcessViewer from '@/components/ProcessViewer'export default {name: "CustomForm",dicts: ['wf_app_type'],components: {ProcessViewer},data() {return {// 按钮loadingbuttonLoading: false,// 遮罩层loading: true,// 选中数组ids: [],// 非单个禁用single: true,// 非多个禁用multiple: true,// 显示搜索条件showSearch: true,// 总条数total: 0,// 流程业务单表格数据customFormList: [],// 弹出层标题title: "",// 是否显示弹出层open: false,// 查询参数queryParams: {pageNum: 1,pageSize: 10,businessName: undefined,businessService: undefined,flowName: undefined,deployId: undefined,routeName: undefined,component: undefined,},//查询布置流程相关参数flowOpen: false,deployTotal: 0,flowTitle: '',deployList: [],categoryOptions: [],// 查询参数queryFlowParams: {pageNum: 1,pageSize: 10,flowName: undefined,appType: 'ZDYYW',},// 挂载自定义表单到流程实例customParam: {id: null,deployId: null},processView: {title: '',open: false,index: undefined,xmlData:"",},// 表单参数form: {},// 表单校验rules: {id: [{ required: true, message: "主键不能为空", trigger: "blur" }],businessName: [{ required: true, message: "业务表单名称不能为空", trigger: "blur" }],businessService: [{ required: true, message: "业务服务名称不能为空", trigger: "blur" }],flowName: [{ required: false, message: "流程名称不能为空", trigger: "blur" }],deployId: [{ required: false, message: "关联流程发布主键不能为空", trigger: "blur" }],routeName: [{ required: true, message: "前端路由地址不能为空", trigger: "blur" }],component: [{ required: true, message: "组件注入方法不能为空", trigger: "blur" }],}};},created() {this.getList();},methods: {relationProcess(row) {this.flowOpen = true;this.customParam.id = row.id;this.getCategoryList();this.getDeployList();},/** 选择流程更新自定义表单信息 */submitCustom(row) {if(row.appType != 'ZDYYW') {this.$message.warning("不是自定义业务应用类型不能绑定");return;}this.customParam.deployId = row.deploymentId;const params = {id: this.customParam.id,deployId: row.deploymentId,flowName: row.processName,}updateCustom(params).then(res => {this.$message.success(res.msg);this.flowOpen = false;this.getList();})},categoryFormat(row, column) {return this.categoryOptions.find(k => k.code === row.category)?.categoryName ?? '';},/** 查看流程图 */handleProcessView(row) {let definitionId = row.definitionId;this.processView.title = "流程图";this.processView.index = definitionId;// 发送请求,获取xmlgetBpmnXml(definitionId).then(response => {this.processView.xmlData = response.data;})this.processView.open = true;},/** 查询流程业务单列表 */getList() {this.loading = true;listCustomForm(this.queryParams).then(response => {this.customFormList = response.rows;this.total = response.total;this.loading = false;});},/** 查询流程分类列表 */getCategoryList() {listAllCategory().then(response => this.categoryOptions = response.data);},/** 查询流程部署列表 */getDeployList() {this.loading = true;listDeploy(this.queryFlowParams).then(response => {this.deployList = response.rows;this.deployTotal = response.total;this.loading = false;});},/** 搜索按钮操作 */handleFlowQuery() {this.queryFlowParams.pageNum = 1;this.getDeployList();},/** 重置按钮操作 */resetFlowQuery() {this.resetForm("queryFlowForm");this.handleQuery();},handleCurrentChange(data) {/*console.log("handleCurrentChange data",data);if (data) {this.currentRow = JSON.parse(data.formContent);}*/},// 取消按钮cancel() {this.open = false;this.reset();},// 表单重置reset() {this.form = {id: undefined,businessName: undefined,businessService: undefined,flowName: undefined,deployId: undefined,routeName: undefined,component: undefined,createBy: undefined,createTime: undefined,updateBy: undefined,updateTime: undefined};this.resetForm("form");},/** 搜索按钮操作 */handleQuery() {this.queryParams.pageNum = 1;this.getList();},/** 重置按钮操作 */resetQuery() {this.resetForm("queryForm");this.handleQuery();},// 多选框选中数据handleSelectionChange(selection) {this.ids = selection.map(item => item.id)this.single = selection.length!==1this.multiple = !selection.length},/** 新增按钮操作 */handleAdd() {this.reset();this.open = true;this.title = "添加流程业务单";},/** 修改按钮操作 */handleUpdate(row) {this.loading = true;this.reset();const id = row.id || this.idsgetCustomForm(id).then(response => {this.loading = false;this.form = response.data;this.open = true;this.title = "修改流程业务单";});},/** 提交按钮 */submitForm() {this.$refs["form"].validate(valid => {if (valid) {this.buttonLoading = true;if (this.form.id != null) {updateCustomForm(this.form).then(response => {this.$modal.msgSuccess("修改成功");this.open = false;this.getList();}).finally(() => {this.buttonLoading = false;});} else {addCustomForm(this.form).then(response => {this.$modal.msgSuccess("新增成功");this.open = false;this.getList();}).finally(() => {this.buttonLoading = false;});}}});},/** 删除按钮操作 */handleDelete(row) {const ids = row.id || this.ids;this.$modal.confirm('是否确认删除流程业务单编号为"' + ids + '"的数据项?').then(() => {this.loading = true;return delCustomForm(ids);}).then(() => {this.loading = false;this.getList();this.$modal.msgSuccess("删除成功");}).catch(() => {}).finally(() => {this.loading = false;});},/** 导出按钮操作 */handleExport() {this.download('workflow/customForm/export', {...this.queryParams}, `customForm_${new Date().getTime()}.xlsx`)}}
};
</script>

3、效果图

当然不是自定义业务应用类型不让绑定

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

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

相关文章

【SoC FPGA】HPS启动过程

SoC HPS启动流程 Boot ROMPreloaderBoot Loader HPS的启动是一个多阶段的过程&#xff0c;每一个阶段都会完成对应的工作并且将下一个阶段的执行代码引导起来。每个阶段均负责加载下一个阶段。第一个软件阶段是引导 ROM&#xff0c;引导 ROM 代码查找并且执行称为预加载器的第 …

数据挖掘实战(3):如何对比特币走势进行预测?

⭐️⭐️⭐️⭐️⭐️欢迎来到我的博客⭐️⭐️⭐️⭐️⭐️ &#x1f434;作者&#xff1a;秋无之地 &#x1f434;简介&#xff1a;CSDN爬虫、后端、大数据领域创作者。目前从事python爬虫、后端和大数据等相关工作&#xff0c;主要擅长领域有&#xff1a;爬虫、后端、大数据…

203、RabbitMQ 之 使用 direct 类型的 Exchange 实现 消息路由 (RoutingKey)

目录 ★ 使用direct实现消息路由代码演示这个情况二ConstantUtil 常量工具类ConnectionUtil 连接RabbitMQ的工具类Publisher 消息生产者测试消息生产者 Consumer01 消息消费者01测试消费者结果&#xff1a; Consumer02 消息消费者02测试消费者结果&#xff1a; 完整代码&#x…

机器学习(22)---信息熵、纯度、条件熵、信息增益

文章目录 1、信息熵2、信息增益3、例题分析 1、信息熵 1. 信息熵(information entropy)是度量样本集合纯度最常用的一种指标。信息的混乱程度越大&#xff0c;不确定性越大&#xff0c;信息熵越大&#xff1b;对于纯度&#xff0c;就是信息熵越大&#xff0c;纯度越低。 2. 纯度…

Text-to-SQL小白入门(八)RLAIF论文:AI代替人类反馈的强化学习

学习RLAIF论文前&#xff0c;可以先学习一下基于人类反馈的强化学习RLHF&#xff0c;相关的微调方法&#xff08;比如强化学习系列RLHF、RRHF、RLTF、RRTF&#xff09;的论文、数据集、代码等汇总都可以参考GitHub项目&#xff1a;GitHub - eosphoros-ai/Awesome-Text2SQL: Cur…

论文阅读/写作扫盲

第一节&#xff1a;期刊科普 JCR分区和中科院分区是用于对期刊进行分类和评估的两种常见方法。它们的存在是为了帮助学术界和研究人员更好地了解期刊的学术质量、影响力和地位。 JCR分区&#xff08;Journal Citation Reports&#xff09;&#xff1a;JCR分区是由Clarivate Ana…

android U广播详解(一)

概念介绍 进程队列 BroadcastQueueModernImpl 的设计围绕着为设备上的每个潜在进程维护一个单独的 BroadcastProcessQueue 实例。表明用于传送到特定进程的Pending {link BroadcastRecord} 条目队列。整个类都标记为 {code NotThreadSafe}&#xff0c;因为调用者有责任始终与…

Excel往Word复制表格时删除空格

1.背景 在编写文档&#xff0c;经常需要从Excel往Word里复制表格 但是复制过去的表格前面会出现空格&#xff08;缩进&#xff09; 再WPS中试了很多方法&#xff0c;终于摆脱了挨个删除的困扰 2. WPS排版中删除 选择表格菜单栏-选在【开始】-【排版】选择【更多段落处理】-【段…

ROS-PX4仿真笔记_1

offbord模式测试 rosrun offboard_pkg position stablelize模式 lqr控制器实验 roslaunch px4 fast_test.launch 无人机起飞1.5-2m sh mybot_gazebo.sh#roslaunch px4 fast_racing.launch & sleep 20; roslaunch ego_planner single_run_in_gazebo.launch & sleep 1…

快速解决“找不到msvcr120.dll无法执行代码”问题,总结5解决方法

计算机已经成为我们生活和工作中不可或缺的一部分。然而&#xff0c;在使用计算机的过程中&#xff0c;我们常常会遇到各种问题&#xff0c;其中之一就是找不到msvcr120.dll文件。这个问题可能会可能导致计算机程序软件&#xff0c;游戏无法正常运行&#xff0c;影响到我们的工…

使用testMe自动生成单元测试用例

文章目录 1、testMe简介2、插件对比2.1 testMe2.2 Squaretest2.3 Diffblue 3、IDEA插件安装4、单测用例4.1 maven依赖4.2 生成用例 5、自定义模板6、使用自定义模板生成用例7、调试用例 1、testMe简介 公司对于系统单元测试覆盖率有要求&#xff0c;需要达到50%或80%以上才可以…

身份证号码,格式校验:@IdCard(自定义注解)

目标 自定义一个用于校验 身份证号码 格式的注解IdCard&#xff0c;能够和现有的 Validation 兼容&#xff0c;使用方式和其他校验注解保持一致&#xff08;使用 Valid 注解接口参数&#xff09;。 校验逻辑 有效格式 符合国家标准。 公民身份号码按照GB11643&#xff0d;…