ruoyi-nbcio-plus基于vue3的flowable流程设计器组件的升级修改

本文主要是介绍ruoyi-nbcio-plus基于vue3的flowable流程设计器组件的升级修改,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

更多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、ProcessDesigner组件vue2代码如下:

<template><div class="process-design" :style="'display: flex; height:' + height"><my-process-designerv-model="xmlString"v-bind="controlForm"keyboardref="processDesigner":events="['element.click','connection.added','connection.removed','connection.changed']"@element-click="elementClick"@init-finished="initModeler"@element-contextmenu="elementContextmenu"@save="onSaveProcess"/><my-process-penal :bpmn-modeler="modeler" :appType="controlForm.appType" :prefix="controlForm.prefix" class="process-panel" /><!-- demo config --><div class="demo-control-bar"><div class="open-model-button" @click="controlDrawerVisible = true"><el-icon><setting /></el-icon></div></div><el-drawer v-model="controlDrawerVisible" size="400px" title="偏好设置" append-to-body destroy-on-close><el-form :model="controlForm" size="small" label-width="100px" class="control-form" @submit.prevent><el-form-item label="流程ID"><el-input v-model="controlForm.processId" @change="reloadProcessDesigner(true)" /></el-form-item><el-form-item label="流程名称"><el-input v-model="controlForm.processName" @change="reloadProcessDesigner(true)" /></el-form-item><el-form-item label="流转模拟"><el-switch v-model="controlForm.simulation" inactive-text="停用" active-text="启用" @change="reloadProcessDesigner()" /></el-form-item><el-form-item label="禁用双击"><el-switch v-model="controlForm.labelEditing" inactive-text="停用" active-text="启用" @change="changeLabelEditingStatus" /></el-form-item><el-form-item label="自定义渲染"><el-switch v-model="controlForm.labelVisible" inactive-text="停用" active-text="启用" @change="changeLabelVisibleStatus" /></el-form-item><el-form-item label="流程引擎"><el-radio-group v-model="controlForm.prefix" @change="reloadProcessDesigner()"><el-radio label="camunda">camunda</el-radio><el-radio label="flowable">flowable</el-radio><el-radio label="activiti">activiti</el-radio></el-radio-group></el-form-item><el-form-item label="工具栏"><el-radio-group v-model="controlForm.headerButtonSize"><el-radio label="small">small</el-radio><el-radio label="default">default</el-radio><el-radio label="large">large</el-radio></el-radio-group></el-form-item><el-switch v-model="pageMode" active-text="dark" inactive-text="light" @change="changePageMode"></el-switch></el-form></el-drawer></div>
</template><script>
import MyProcessDesigner from '@/package/designer';
// import MyProcessPalette from '@/package/palette';
import MyProcessPenal from '@/package/penal';
// 自定义渲染(隐藏了 label 标签)
import CustomRenderer from '@/modules/custom-renderer';
// 自定义元素选中时的弹出菜单(修改 默认任务 为 用户任务)
import CustomContentPadProvider from '@/package/designer/plugins/content-pad';
// 自定义左侧菜单(修改 默认任务 为 用户任务)
import CustomPaletteProvider from '@/package/designer/plugins/palette';import '@/package/theme/index.scss';
import 'bpmn-js/dist/assets/diagram-js.css';
import 'bpmn-js/dist/assets/bpmn-font/css/bpmn.css';
import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-codes.css';export default {name: 'ProcessDesigner',props: {bpmnXml: {type: String,required: true},designerForm: {type: Object,required: true}},components: {MyProcessDesigner,MyProcessPenal},data () {return {height: document.documentElement.clientHeight - 94.5 + "px;",xmlString: this.bpmnXml,modeler: null,controlDrawerVisible: false,infoTipVisible: false,pageMode: false,controlForm: {appType: this.designerForm.appType,processId: this.designerForm.processKey || '',processName: this.designerForm.processName || '',simulation: true,labelEditing: false,labelVisible: false,prefix: 'flowable',headerButtonSize: 'default',additionalModel: [CustomContentPadProvider, CustomPaletteProvider]},addis: {CustomContentPadProvider,CustomPaletteProvider}}},created() {console.log("ProcessDesigner created this.designerForm",this.designerForm)},methods: {reloadProcessDesigner(notDeep) {this.controlForm.additionalModel = [];for (const key in this.addis) {if (this.addis[key]) {console.log("reloadProcessDesigner this.addis[key]",this.addis[key])this.controlForm.additionalModel.push(this.addis[key]);}}!notDeep && (this.xmlString = undefined);this.reloadIndex += 1;this.modeler = null; // 避免 panel 异常},changeLabelEditingStatus(status) {this.addis.labelEditing = status ? { labelEditingProvider: ['value', ''] } : false;this.reloadProcessDesigner();},changeLabelVisibleStatus(status) {this.addis.customRenderer = status ? CustomRenderer : false;this.reloadProcessDesigner();},elementClick(element) {this.element = element;},initModeler(modeler) {setTimeout(() => {this.modeler = modeler;}, 10);},elementContextmenu(element) {},onSaveProcess(saveData) {this.$emit('save', saveData);}}
}
</script><style lang="scss">
body {overflow: hidden;margin: 0;box-sizing: border-box;
}
body,
body * {/* 滚动条 */&::-webkit-scrollbar-track-piece {background-color: #fff; /*滚动条的背景颜色*/-webkit-border-radius: 0; /*滚动条的圆角宽度*/}&::-webkit-scrollbar {width: 10px; /*滚动条的宽度*/height: 8px; /*滚动条的高度*/}&::-webkit-scrollbar-thumb:vertical {/*垂直滚动条的样式*/height: 50px;background-color: rgba(153, 153, 153, 0.5);-webkit-border-radius: 4px;outline: 2px solid #fff;outline-offset: -2px;border: 2px solid #fff;}&::-webkit-scrollbar-thumb {/*滚动条的hover样式*/background-color: rgba(159, 159, 159, 0.3);-webkit-border-radius: 4px;}&::-webkit-scrollbar-thumb:hover {/*滚动条的hover样式*/background-color: rgba(159, 159, 159, 0.5);-webkit-border-radius: 4px;}
}
.demo-control-bar {position: fixed;right: 8px;bottom: 48px;z-index: 1;
}
.open-model-button {width: 48px;height: 48px;display: flex;align-items: center;justify-content: center;border-radius: 4px;font-size: 32px;background: rgba(64, 158, 255, 1);color: #ffffff;cursor: pointer;
}
</style>

2、ProcessDesigner组件改造后的vue3代码如下:

<template><div class="process-design" :style="'display: flex; height:' + height"><my-process-designerv-model="xmlString"v-bind="controlForm"keyboardref="processDesigner":events="['element.click','connection.added','connection.removed','connection.changed']"@element-click="elementClick"@init-finished="initModeler"@element-contextmenu="elementContextmenu"@save="onSaveProcess"/><my-process-penal :bpmn-modeler="modeler" :appType="controlForm.appType" :prefix="controlForm.prefix" class="process-panel" /><!-- demo config --><div class="demo-control-bar"><div class="open-model-button" @click="controlDrawerVisible = true"><el-icon><setting /></el-icon></div></div><el-drawer v-model="controlDrawerVisible" size="400px" title="偏好设置" append-to-body destroy-on-close><el-form :model="controlForm" size="small" label-width="100px" class="control-form" @submit.prevent><el-form-item label="流程ID"><el-input v-model="controlForm.processId" @change="reloadProcessDesigner(true)" /></el-form-item><el-form-item label="流程名称"><el-input v-model="controlForm.processName" @change="reloadProcessDesigner(true)" /></el-form-item><el-form-item label="流转模拟"><el-switch v-model="controlForm.simulation" inactive-text="停用" active-text="启用" @change="reloadProcessDesigner()" /></el-form-item><el-form-item label="禁用双击"><el-switch v-model="controlForm.labelEditing" inactive-text="停用" active-text="启用" @change="changeLabelEditingStatus" /></el-form-item><el-form-item label="自定义渲染"><el-switch v-model="controlForm.labelVisible" inactive-text="停用" active-text="启用" @change="changeLabelVisibleStatus" /></el-form-item><el-form-item label="流程引擎"><el-radio-group v-model="controlForm.prefix" @change="reloadProcessDesigner()"><el-radio label="camunda">camunda</el-radio><el-radio label="flowable">flowable</el-radio><el-radio label="activiti">activiti</el-radio></el-radio-group></el-form-item><el-form-item label="工具栏"><el-radio-group v-model="controlForm.headerButtonSize"><el-radio label="small">small</el-radio><el-radio label="default">default</el-radio><el-radio label="large">large</el-radio></el-radio-group></el-form-item><el-switch v-model="pageMode" active-text="dark" inactive-text="light" @change="changePageMode"></el-switch></el-form></el-drawer></div>
</template><script lang="ts" setup>import MyProcessDesigner from '@/package/designer';// import MyProcessPalette from '@/package/palette';import MyProcessPenal from '@/package/penal';// 自定义渲染(隐藏了 label 标签)import CustomRenderer from '@/modules/custom-renderer';// 自定义元素选中时的弹出菜单(修改 默认任务 为 用户任务)import CustomContentPadProvider from '@/package/designer/plugins/content-pad';// 自定义左侧菜单(修改 默认任务 为 用户任务)import CustomPaletteProvider from '@/package/designer/plugins/palette';import '@/package/theme/index.scss';import 'bpmn-js/dist/assets/diagram-js.css';import 'bpmn-js/dist/assets/bpmn-font/css/bpmn.css';import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-codes.css';defineOptions({ name: 'ProcessDesigner' })const props = defineProps({bpmnXml: {type: String,required: true},designerForm: {type: Object,required: true}})const emit = defineEmits(['save'])const height = ref(document.documentElement.clientHeight - 94.5 + "px;")const xmlString = props.bpmnXmlconst modeler = ref(null)const element = ref(null)const controlDrawerVisible = ref(false)const infoTipVisible = ref(false)const pageMode = ref(false)const controlForm =  ref({appType: props.designerForm.appType,processId: props.designerForm.processKey || '',processName: props.designerForm.processName || '',simulation: true,labelEditing: false,labelVisible: false,prefix: 'flowable',headerButtonSize: 'default',additionalModel: [CustomContentPadProvider, CustomPaletteProvider]})const addis = ref({CustomContentPadProvider,CustomPaletteProvider})const reloadIndex = ref(0)const reloadProcessDesigner = (notDeep) => {controlForm.value['additionalModel'] = [];for (const key in addis.value) {if (addis.value[key]) {controlForm.value['additionalModel'].push(addis.value[key]);}}!notDeep && (xmlString = undefined);reloadIndex.value += 1;modeler = null; // 避免 panel 异常}const changeLabelEditingStatus = (status) => {addis.value['labelEditing'] = status ? { labelEditingProvider: ['value', ''] } : false;reloadProcessDesigner();}const changeLabelVisibleStatus = (status) => {addis.value['customRenderer'] = status ? CustomRenderer : false;reloadProcessDesigner();}const elementClick = (element) => {element.value = element;}const initModeler = (initmodeler) => {setTimeout(() => {modeler.value = initmodeler;}, 10);}const elementContextmenu = (element) => {}const onSaveProcess = (saveData) => {emit('save', saveData);}</script><style lang="scss">body {overflow: hidden;margin: 0;box-sizing: border-box;}body,body * {/* 滚动条 */&::-webkit-scrollbar-track-piece {background-color: #fff; /*滚动条的背景颜色*/-webkit-border-radius: 0; /*滚动条的圆角宽度*/}&::-webkit-scrollbar {width: 10px; /*滚动条的宽度*/height: 8px; /*滚动条的高度*/}&::-webkit-scrollbar-thumb:vertical {/*垂直滚动条的样式*/height: 50px;background-color: rgba(153, 153, 153, 0.5);-webkit-border-radius: 4px;outline: 2px solid #fff;outline-offset: -2px;border: 2px solid #fff;}&::-webkit-scrollbar-thumb {/*滚动条的hover样式*/background-color: rgba(159, 159, 159, 0.3);-webkit-border-radius: 4px;}&::-webkit-scrollbar-thumb:hover {/*滚动条的hover样式*/background-color: rgba(159, 159, 159, 0.5);-webkit-border-radius: 4px;}}.demo-control-bar {position: fixed;right: 8px;bottom: 48px;z-index: 1;}.open-model-button {width: 48px;height: 48px;display: flex;align-items: center;justify-content: center;border-radius: 4px;font-size: 32px;background: rgba(64, 158, 255, 1);color: #ffffff;cursor: pointer;}
</style>

3、效果图如下:

这篇关于ruoyi-nbcio-plus基于vue3的flowable流程设计器组件的升级修改的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/882320

相关文章

Nginx进行平滑升级的实战指南(不中断服务版本更新)

《Nginx进行平滑升级的实战指南(不中断服务版本更新)》Nginx的平滑升级(也称为热升级)是一种在不停止服务的情况下更新Nginx版本或添加模块的方法,这种升级方式确保了服务的高可用性,避免了因升... 目录一.下载并编译新版Nginx1.下载解压2.编译二.替换可执行文件,并平滑升级1.替换可执行文件

Mysql中设计数据表的过程解析

《Mysql中设计数据表的过程解析》数据库约束通过NOTNULL、UNIQUE、DEFAULT、主键和外键等规则保障数据完整性,自动校验数据,减少人工错误,提升数据一致性和业务逻辑严谨性,本文介绍My... 目录1.引言2.NOT NULL——制定某列不可以存储NULL值2.UNIQUE——保证某一列的每一

MyBatis-Plus 自动赋值实体字段最佳实践指南

《MyBatis-Plus自动赋值实体字段最佳实践指南》MyBatis-Plus通过@TableField注解与填充策略,实现时间戳、用户信息、逻辑删除等字段的自动填充,减少手动赋值,提升开发效率与... 目录1. MyBATis-Plus 自动赋值概述1.1 适用场景1.2 自动填充的原理1.3 填充策略

Spring Boot 中的默认异常处理机制及执行流程

《SpringBoot中的默认异常处理机制及执行流程》SpringBoot内置BasicErrorController,自动处理异常并生成HTML/JSON响应,支持自定义错误路径、配置及扩展,如... 目录Spring Boot 异常处理机制详解默认错误页面功能自动异常转换机制错误属性配置选项默认错误处理

Spring Boot从main方法到内嵌Tomcat的全过程(自动化流程)

《SpringBoot从main方法到内嵌Tomcat的全过程(自动化流程)》SpringBoot启动始于main方法,创建SpringApplication实例,初始化上下文,准备环境,刷新容器并... 目录1. 入口:main方法2. SpringApplication初始化2.1 构造阶段3. 运行阶

mybatis-plus QueryWrapper中or,and的使用及说明

《mybatis-plusQueryWrapper中or,and的使用及说明》使用MyBatisPlusQueryWrapper时,因同时添加角色权限固定条件和多字段模糊查询导致数据异常展示,排查发... 目录QueryWrapper中or,and使用列表中还要同时模糊查询多个字段经过排查这就导致只要whe

Olingo分析和实践之OData框架核心组件初始化(关键步骤)

《Olingo分析和实践之OData框架核心组件初始化(关键步骤)》ODataSpringBootService通过初始化OData实例和服务元数据,构建框架核心能力与数据模型结构,实现序列化、URI... 目录概述第一步:OData实例创建1.1 OData.newInstance() 详细分析1.1.1

从入门到精通详解LangChain加载HTML内容的全攻略

《从入门到精通详解LangChain加载HTML内容的全攻略》这篇文章主要为大家详细介绍了如何用LangChain优雅地处理HTML内容,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 目录引言:当大语言模型遇见html一、HTML加载器为什么需要专门的HTML加载器核心加载器对比表二

使用Go实现文件复制的完整流程

《使用Go实现文件复制的完整流程》本案例将实现一个实用的文件操作工具:将一个文件的内容完整复制到另一个文件中,这是文件处理中的常见任务,比如配置文件备份、日志迁移、用户上传文件转存等,文中通过代码示例... 目录案例说明涉及China编程知识点示例代码代码解析示例运行练习扩展小结案例说明我们将通过标准库 os

升级至三频BE12000! 华硕ROG魔盒Pro路由器首发拆解评测

《升级至三频BE12000!华硕ROG魔盒Pro路由器首发拆解评测》华硕前两天推出新一代电竞无线路由器——ROG魔盒Pro(StrixGR7Pro),该产品在无线规格、硬件配置及功能设计上实现全... 作为路由器行业的T1梯队厂商,华硕近期发布了新旗舰华硕ROG魔盒Pro,除了保留DIY属性以外,高达120