ruoyi-nbcio-plus基于vue3的flowable的自定义业务提交申请组件的升级修改

news2025/9/19 19:46:33

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

gitee源代码地址

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

演示地址:RuoYi-Nbcio后台管理系统 http://122.227.135.243:9666/

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

gitee源代码地址

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

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

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

1、原先的ActApplyBtn.vue组件vue2代码如下:

<style lang="less">
</style>
<template>
    <span>
      <a-button :type="btnType" @click="applySubmit()" :loading="submitLoading">{{text}}</a-button>
      <a-modal :z-index="100" :title="firstInitiatorTitle" @cancel="firstInitiatorOpen = false" :visible.sync="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" :visible.sync="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 slot-scope="scope">
                   <el-button size="mini" type="text" @click="selectProcess(scope.row)">确定</el-button>
                 </template>
               </el-table-column>
              </el-table>
          </el-col>
        </el-row>
      </a-modal>

    </span>
</template>

<script>
  import {
    startByDataId,
    isFirstInitiator,
    deleteActivityAndJoin,
    getProcesss
  } from "@/api/workflow/process";

  export default {
    name: 'ActApplyBtn',
    components: {},
    props: {
      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
      }

    },
    data() {
      return {
        modalVisible: false,
        submitLoading: false,
        form: {},
        firstInitiatorOpen: false,
        firstInitiatorTitle: '',
        // 关联流程数据
        processList: [],
        flowOpen: false,
        flowTitle: '',
        selectFlowId: '',  //选择或使用的流程ID
      };
    },
    created() {
    },
    watch: {},
    methods: {
      selectProcess(row) {
        this.selectFlowId = row.id;
        this.flowOpen = false;
        var params = Object.assign({
          dataId: this.dataId
        }, this.variables);
        startByDataId(this.dataId, this.selectFlowId, this.serviceName, params)
          .then(res => {
            //console.log("startByDataId res",res);
            if (res.code == 200 ) {
              this.$message.success(res.msg);
              this.$emit('success');
            } else {
              this.$message.error(res.msg);
            }
          })
          .finally(() => (this.submitLoading = false));
      },
      ReStartByDataId(isNewFlow) {
          if(isNewFlow) {
            this.submitLoading = true;
            deleteActivityAndJoin(this.dataId,this.variables)
            .then(res => {
              if (res.success && res.result) { //若删除成功
                var params = Object.assign({
                  dataId: this.dataId
                }, this.variables);
                startByDataId(this.dataId, this.selectFlowId, this.serviceName, params)
                  .then(res => {
                    if (res.success) {
                      this.firstInitiatorOpen = false;
                      this.$message.success(res.message);
                      this.$emit('success');
                    } else {
                      this.$message.error(res.message);
                    }
                  })
              }
            })
            .finally(() => (this.submitLoading = false));
          }
          else {//继续原有流程流转,跳到流程处理界面上
            //console.log("this.variables",this.variables);
            this.$router.push({ path: '/flowable/task/record/index',
              query: {
                procInsId: this.variables.processInstanceId,
                deployId: this.variables.deployId,
                taskId: this.variables.taskId,
                businessKey: this.dataId,
                nodeType: "",
                category: "zdyyw",
                finished: true
              }})
          }
      },
      applySubmit() {
        if (this.dataId && this.dataId.length < 1) {
          this.error = '必须传入参数dataId';
          this.$message.error(this.error);
          return;
        }
        if (this.serviceName && this.serviceName.length < 1) {
          this.error = '必须传入参数serviceName';
          this.$message.error(this.error);
          return;
        } else {
          this.error = '';
        }
        //对于自定义业务,判断是否是驳回或退回的第一个发起人节点
        this.submitLoading = true;
        isFirstInitiator(this.dataId, this.variables)
          .then(res => {
            if (res.code === 200 && res.data) { //若是,弹出窗口选择重新发起新流程还是继续老流程
              this.firstInitiatorTitle = "根据自己需要进行选择"
              this.firstInitiatorOpen = true;
            }
            else {
              this.submitLoading = true;
              const processParams = {
                 serviceName: this.serviceName
              }
              getProcesss(processParams).then(res => {/**查询关联流程信息 */
                this.processList = res.data;
                  this.submitLoading = false;
                  if (this.processList && this.processList.length > 1) {
                    this.flowOpen = true;
                  }
                  else if (this.processList && this.processList.length === 1) {
                    this.selectFlowId = res.data[0].id;
                    var params = Object.assign({
                      dataId: this.dataId
                    }, this.variables);
                    startByDataId(this.dataId, this.selectFlowId, this.serviceName, params)
                      .then(res => {
                        console.log("startByDataId res",res);
                        if (res.code == 200 ) {
                          this.$message.success(res.msg);
                          this.$emit('success');
                        } else {
                          this.$message.error(res.msg);
                        }
                      })
                      .finally(() => (this.submitLoading = false));
                  } else {
                    this.$message.error("检查该业务是否已经关联流程!");
                  }
              })
              .finally(() => (this.submitLoading = false));
            }
          })
          .finally(() => (this.submitLoading = false));
        }
    }

  };
</script>

2、修改成vue3版本的代码如下:

<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:visible="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:visible="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 {
    startByDataId,
    isFirstInitiator,
    deleteActivityAndJoin,
    getProcesss
  } from "@/api/workflow/process";

  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'
  ])

  const router = useRouter()
  const { proxy } = getCurrentInstance() as ComponentInternalInstance

  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('')  //选择或使用的流程ID
  const error = ref('')

  const selectProcess = (row) => {
    selectFlowId.value = row.id;
    flowOpen.value = false;
    var params = Object.assign({
      dataId: props.dataId
    }, props.variables);
    startByDataId(props.dataId, selectFlowId.value, props.serviceName, params)
      .then(res => {
        //console.log("startByDataId res",res);
        if (res.code == 200 ) {
          proxy?.$modal.msgSuccess(res.msg);
          emit('success');
        } else {
          proxy?.$modal.msgError(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);
          startByDataId(props.dataId, selectFlowId.value, props.serviceName, params)
            .then(res => {
              if (res.code == 200) {
                firstInitiatorOpen.value = false;
                proxy?.$modal.msgSuccess(res.message);
                emit('success');
              } else {
                proxy?.$modal.msgError(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: "",
          category: "zdyyw",
          finished: true
        },
      })
    }
  }
  const applySubmit = () => {
    if (props.dataId && props.dataId.length < 1) {
      error.value = '必须传入参数dataId';
      proxy?.$modal.msgError(error.value);
      return;
    }
    if (props.serviceName && props.serviceName.length < 1) {
      error.value = '必须传入参数serviceName';
      proxy?.$modal.msgError(error.value);
      return;
    } else {
      error.value = '';
    }
    //对于自定义业务,判断是否是驳回或退回的第一个发起人节点
    submitLoading.value = true;
    isFirstInitiator(props.dataId, props.variables)
      .then(res => {
        if (res.code === 200 && res.data) { //若是,弹出窗口选择重新发起新流程还是继续老流程
          firstInitiatorTitle.value = "根据自己需要进行选择"
          firstInitiatorOpen.value = true;
        }
        else {
          submitLoading.value = true;
          const processParams = {
             serviceName: props.serviceName
          }
          getProcesss(processParams).then(res => {/**查询关联流程信息 */
            processList.value = res.data;
              submitLoading.value = false;
              if (processList.value && processList.value.length > 1) {
                flowOpen.value = true;
              }
              else if (processList.value && processList.value.length === 1) {
                selectFlowId.value = res.data[0].id;
                var params = Object.assign({
                  dataId: props.dataId
                }, props.variables);
                startByDataId(props.dataId, selectFlowId.value, props.serviceName, params)
                  .then(res => {
                    console.log("startByDataId res",res);
                    if (res.code == 200 ) {
                      proxy?.$modal.msgSuccess(res.msg);
                      emit('success');
                    } else {
                      proxy?.$modal.msgError(res.msg);
                    }
                  })
                  .finally(() => (submitLoading.value = false));
              } else {
                proxy?.$modal.msgError("检查该业务是否已经关联流程!");
              }
          })
          .finally(() => (submitLoading.value = false));
        }
      })
      .finally(() => (submitLoading.value = false));
    }
</script>

3、效果图

就是下面提交申请这个组件

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Shotcut:免费且开源的优质视频剪辑工具

Shotcut&#xff1a;您的专业级免费开源视频编辑利器&#xff0c;助您轻松实现创意无限的剪辑梦想&#xff01;- 精选真开源&#xff0c;释放新价值。 概览 Shotcut&#xff0c;一款广受赞誉的免费、开源跨平台视频编辑软件&#xff0c;以其卓越的功能性和易用性赢得了全球用户…

【MATLAB源码-第6期】基于matlab的QPSK的误码率BER和误符号率SER仿真。

1、算法描述 QPSK&#xff0c;有时也称作四位元PSK、四相位PSK、4-PSK&#xff0c;在坐标图上看是圆上四个对称的点。通过四个相位&#xff0c;QPSK可以编码2位元符号。图中采用格雷码来达到最小位元错误率&#xff08;BER&#xff09; — 是BPSK的两倍. 这意味著可以在BPSK系统…

【动手学深度学习】15_汉诺塔问题

注&#xff1a; 本系列仅为个人学习笔记&#xff0c;学习内容为《算法小讲堂》&#xff08;视频传送门&#xff09;&#xff0c;通俗易懂适合编程入门小白&#xff0c;需要具备python语言基础&#xff0c;本人小白&#xff0c;如内容有误感谢您的批评指正 汉诺塔&#xff08;To…

成都百洲文化传媒有限公司靠谱吗?怎么样?

随着互联网的迅猛发展&#xff0c;电子商务行业迎来了前所未有的发展机遇。在这个变革的浪潮中&#xff0c;成都百洲文化传媒有限公司凭借其深厚的行业经验和创新的服务模式&#xff0c;正逐渐成为电商服务领域的新领军者。 一、创新引领&#xff0c;塑造电商服务新标准 成都百…

antd+Vue 3实现table行内upload文件图片上传【超详细图解】

目录 一、背景 二、效果图 三、代码 一、背景 一名被组长逼着干前端的苦逼后端&#xff0c;在一个晴天霹雳的日子&#xff0c;被要求前端订单产品实现上传产品图片并立刻回显图片。 二、效果图 三、代码 <template><a-table :dataSource"dataSource" :c…

三、Mat、Bitmap和Image数据类型之间的转换(OpenCvSharp)

在OpenCV中可以通过ImRead方法读取照片&#xff0c;通过ImShow方法显示照片&#xff1b;但是无法在PictureBox控件中显示 PictureBox控件只能展示Bitmap和Image数据类型图片 为此查阅了网上很多篇博文&#xff0c;将三种数据类型之间的转换进行了归纳整理&#xff0c;感谢网上…

头歌机器学习实验 第7次实验 局部加权线性回归

任务描述 本关任务&#xff1a;编写一个利用局部加权计算回归系数的小程序。 相关知识 为了完成本关任务&#xff0c;你需要掌握&#xff1a;1.局部加权算法的思想&#xff1b;2.局部加权的核心算法。 局部加权算法的思想 在局部加权算法中 &#xff0c;我们给待预测点附近…

头歌-机器学习 第16次实验 EM算法

第1关:极大似然估计 任务描述 本关任务:根据本节课所学知识完成本关所设置的选择题。 相关知识 为了完成本关任务,你需要掌握: 什么是极大似然估计; 极大似然估计的原理; 极大似然估计的计算方法。 什么是极大似然估计 没有接触过或者没有听过”极大似然估计“的同学…

[dvwa] file upload

file upload 0x01 low 直接上传.php 内容写<? eval($_POST[jj]);?> 用antsword连 路径跳两层 0x02 medium 添加了两种验证&#xff0c;格式为图片&#xff0c;大小限制小于1000 上传 POST /learndvwa/vulnerabilities/upload/ HTTP/1.1 Host: dvt.dv Content-Le…

✌2024/4/6—力扣—最长公共前缀✌

代码实现&#xff1a; char *longestCommonPrefix(char **strs, int strsSize) {if (strsSize 0) {return "";}for (int i 0; i < strlen(strs[0]); i) { // 列for (int j 1; j < strsSize; j) { // 行if (strs[0][i] ! strs[j][i]) { // 如果比较字符串的第…

Covalent Network(CQT)推出以太坊质押迁移计划,以增强长期结构化数据可用性、塑造万亿级 LLM 参数体系

作为 Web3 领先的链上数据层&#xff0c;Covalent Network&#xff08;CQT&#xff09;宣布了其将质押操作从 Moonbeam 迁移回以太坊的决定。此举是 Covalent Network&#xff08;CQT&#xff09;走向以太坊时光机&#xff08;EWM&#xff09;的第一步&#xff0c;EWM 是一个为…

Android自定义控件ScrollView实现上下滑动功能

本文实例为大家分享了Android ScrollView实现上下滑动功能的具体代码&#xff0c;供大家参考&#xff0c;具体内容如下 package com.example.zhuang; import android.content.Context; import android.util.AttributeSet; import android.util.DisplayMetrics; import android…

Asterisk 21.2.0编译安装经常遇到的问题和解决办法之pjproject

目录 Asterisk社区官方的说法然而买家秀是这样的pjproject-2.14下载不了的问题如何解决 Asterisk社区官方的说法 编译安装Asterisk 21.2.0版本 按照官网文档&#xff0c;原则上只需要如下几步&#xff1a; ./contrib/scripts/install_prereq install ./configure make make i…

建立一个网站需要多长时间?如何从零开始制作企业网站,建站流程是怎么样的

为了维持你的品牌形象&#xff0c;你必须有一个在线的网站存在&#xff0c;但是创建一个网站需要多长时间呢&#xff1f;从开始到结束&#xff0c;你最期待什么&#xff1f; 我们将介绍网站开发过程的步骤以及每个步骤可能需要多少时间。我们还将探讨您设计和部署网站的选项&a…

手机银行客户端框架之TMF框架介绍

腾讯移动开发平台&#xff08;Tencent Mobile Framework&#xff09;整合了腾讯在移动产品中开发、测试、发布和运营的技术能力&#xff0c;为企业提供一站式、覆盖全生命周期的移动端技术平台。核心服务包括移动客户端开发组件、H5容器、灰度发布、热更新、离线包、网关服务、…

[【JSON2WEB】 13 基于REST2SQL 和 Amis 的 SQL 查询分析器

【JSON2WEB】01 WEB管理信息系统架构设计 【JSON2WEB】02 JSON2WEB初步UI设计 【JSON2WEB】03 go的模板包html/template的使用 【JSON2WEB】04 amis低代码前端框架介绍 【JSON2WEB】05 前端开发三件套 HTML CSS JavaScript 速成 【JSON2WEB】06 JSON2WEB前端框架搭建 【J…

wpf下如何实现超低延迟的RTMP或RTSP播放

技术背景 我们在做Windows平台RTMP和RTSP播放模块对接的时候&#xff0c;有开发者需要在wpf下调用&#xff0c;如果要在wpf下使用&#xff0c;只需要参考C#的对接demo即可&#xff0c;唯一不同的是&#xff0c;视频流数据显示的话&#xff0c;要么通过控件模式&#xff0c;要么…

Python球球大作战

文章目录 写在前面球球大作战程序设计注意事项写在后面 写在前面 安装pygame的命令&#xff1a; pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pygame球球大作战 《球球大作战》是一款简单易上手、充满趣味性和竞技性的休闲手游。游戏的核心玩法可以用一句话概…

李廉洋:4.11黄金原油早盘#行情走势#分析及策略。

美国通胀数据超出预期&#xff0c;抑制了对美联储降息的押注。Coex Partners有限公司宏观经济学家Henrik Gullberg表示&#xff1a;“对新兴市场和风险资产来说&#xff0c;(通胀)高企持续时间更长是个坏消息&#xff0c;还因为它增加了美国和全球经济更明显下滑的风险。CPI数据…

(一)基于IDEA的JAVA基础13

数组遍历 遍历数组就是把数组内的数据一个个的取出来 1.我们可以用for循环&#xff0c;依次把数字类的元素取出来。 2.增强型for循环。 用第一个方法写一下&#xff0c;看一下 public class Test01 { public static void main(String[] args) { //存储一组数据{…