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

基于若依的ruoyi-nbcio流程管理系统仿钉钉流程json转bpmn的flowable的xml格式(简单支持发起人与审批人的流程)续

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

gitee源代码地址

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

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

       之前生产的xml,在bpmn设计里编辑有些内容不正确,包括审批人,关联表单等,所以这部分修正这些问题。

      1、前端增加formKey

     对于发起人节点,初始化时进行表单赋值

initStartNodeData(){this.initInitiator()this.startForm.formOperates = this.initFormOperates(this.value)this.startForm.formKey = this.value.properties.formKeythis.approverForm.formKey = this.value.properties.formKey},

   同时对确认保存的时候,进行formKey的保存与更新

/*** 开始节点确认保存*/startNodeComfirm() {this.properties.initiator = this.initiator['dep&user']this.properties.formKey = this.startForm.formKeyconst formOperates = this.startForm.formOperates.map(t=>({formId: t.formId, formOperate: t.formOperate}))Object.assign(this.properties,this.startForm, {formOperates})this.$emit("confirm", this.properties, '所有人');this.visible = false;},

 2、后端修改

  对开始发起人节点进行修改,把发起人赋予的formKey写入到开始节点里,兼容现有的系统

StartEvent createStartEvent(JSONObject flowNode) {String nodeType = flowNode.getString("type");StartEvent startEvent = new StartEvent();startEvent.setId(id("start"));if (Type.INITIATOR_TASK.isEqual(nodeType)) {JSONObject properties = flowNode.getJSONObject("properties");if(StringUtils.isNotEmpty(properties.getString("formKey"))) {startEvent.setFormKey(properties.getString("formKey"));}}return startEvent;}

   同时对创建用户任务进行修改,修正之前的用户信息与formKey信息

String createUserTask(JSONObject flowNode, String nodeType) {List<String> incoming = flowNode.getJSONArray("incoming").toJavaList(String.class);// 自动生成idString id = id("userTask");if (incoming != null && !incoming.isEmpty()) {UserTask userTask = new UserTask();JSONObject properties = flowNode.getJSONObject("properties");userTask.setName(properties.getString("title"));userTask.setId(id);List<ExtensionAttribute> attributes = new  ArrayList<ExtensionAttribute>();if (Type.INITIATOR_TASK.isEqual(nodeType)) {ExtensionAttribute extAttribute =  new ExtensionAttribute();extAttribute.setNamespace(ProcessConstants.NAMASPASE);extAttribute.setName("dataType");extAttribute.setValue("INITIATOR");attributes.add(extAttribute);userTask.addAttribute(extAttribute);//userTask.setFormKey(properties.getString("formKey"));userTask.setAssignee("${initiator}");} else if (Type.USER_TASK.isEqual(nodeType) || Type.APPROVER_TASK.isEqual(nodeType)) {JSONArray approvers = properties.getJSONArray("approvers");JSONObject approver = approvers.getJSONObject(0);ExtensionAttribute extDataTypeAttribute =  new ExtensionAttribute();extDataTypeAttribute.setNamespace(ProcessConstants.NAMASPASE);extDataTypeAttribute.setName("dataType");extDataTypeAttribute.setValue("USERS");userTask.addAttribute(extDataTypeAttribute);ExtensionAttribute extTextAttribute =  new ExtensionAttribute();extTextAttribute.setNamespace(ProcessConstants.NAMASPASE);extTextAttribute.setName("text");extTextAttribute.setValue(approver.getString("nickName"));userTask.addAttribute(extTextAttribute);userTask.setFormKey(properties.getString("formKey"));userTask.setAssignee(approver.getString("userName"));}ddProcess.addFlowElement(userTask);ddProcess.addFlowElement(connect(incoming.get(0), id));}return id;}

3、效果如下:

http://www.lryc.cn/news/221783.html

相关文章:

  • 虚幻引擎:如何进行关卡切换?
  • 工具类xxxUtil从application.properties中读取参数
  • 三国志14信息查询小程序(历史武将信息一览)制作更新过程05-后台接口的编写及调用
  • 时序预测 | MATLAB实现基于SVM-Adaboost支持向量机结合AdaBoost时间序列预测
  • useEffect和useLayoutEffect的区别
  • [科研图像处理]用matlab平替image-j,有点麻烦,但很灵活!
  • Node.js |(五)包管理工具 | 尚硅谷2023版Node.js零基础视频教程
  • 【ES专题】ElasticSearch集群架构剖析
  • Kafka与Flink的整合 -- sink、source
  • 小鱼ROS
  • 简单讲讲RISC-V跳转指令基于具体场景的实现
  • 第13章 Java IO流处理(一) File类
  • 测试面试题集锦(四)| Linux 与 Python 编程篇(附答案)
  • pytorch中的矩阵乘法
  • Java--Stream流详解
  • [PHP]ShopXO企业级B2C免费开源商城系统 v2.3.1
  • Python基础入门系列详解20篇
  • P02项目(学习)
  • pandas 笔记:get_dummies分类变量one-hot化
  • PTE作文练习(一)
  • 如何做到一套FPGA工程无缝兼容两款不同的板卡?
  • VSCode修改主题为Eclipse 绿色护眼模式
  • conan和cmake编译器版本不匹配问题解决
  • float单精度浮点数如何在计算机中存储
  • 机器视觉在虚拟现实与增强现实中的作用
  • 红黑数原理及存在原因
  • Ansible入门—安装部署及各个模块应用案例(超详细)
  • Spring Boot 3系列之-启动类详解
  • muduo源码剖析之Timer定时器
  • CocosCreator:背景滚动 、背景循环滚动