欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 健康 > 养生 > 基于jeecgboot-vue3的Flowable流程支持bpmn流程设计器与仿钉钉流程设计器-编辑多版本处理

基于jeecgboot-vue3的Flowable流程支持bpmn流程设计器与仿钉钉流程设计器-编辑多版本处理

2024/11/30 14:49:03 来源:https://blog.csdn.net/qq_40032778/article/details/140468722  浏览:    关键词:基于jeecgboot-vue3的Flowable流程支持bpmn流程设计器与仿钉钉流程设计器-编辑多版本处理

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

1、前端编辑带有仿钉钉流程的处理

/** 编辑流程设计弹窗页面 */const handleLoadXml = (row) => {console.log("handleLoadXml row",row)const params = {flowKey: row.key,version: row.version} queryByKeyAndVersion(params).then(res => {console.log("queryByKeyAndVersion res",res)if (res.code === 200 && res.result.hasOwnProperty("id")) {ddDesignerData.id = res.result.flowKeyddDesignerData.name = res.result.nameflowJsonData.value = JSON.parse(res.result.flowJson)flowJsonData.value.category = row.categoryflowJsonData.value.appType = row.appTypeddDesignerData.version = res.result.versiondesignerData.form.processType.push({id: row.category,appType: row.appType})ddDesignerOpen.value = true}else {designerData.title = "流程设计 - " + row.name;designerData.deploymentId = row.deploymentId;designerData.form = {processType: [],processName: row.name,processKey: row.key}if (row &&row.deploymentId) {const selectItem = categorys.value.find(item => item.id == row.category);modelForm.processType = selectItem; //以便编辑保存的时候获取到processTypedesignerData.form.processType.push(selectItem);designerData.loading = true;console.log("designerData",designerData)handleReadImage(row.deploymentId);designerData.title = "编辑流程图";  }xmlFrame.width = '90%'}})  }

2、后端检查是否有相应的仿钉钉flowKey和版本号相同的仿钉钉数据

<mapper namespace="org.jeecg.modules.flowable.FlowDd.mapper.FlowDdMapper"><select id="selectByKeyAndVersion" resultType="org.jeecg.modules.flowable.FlowDd.entity.FlowDd">select * from flow_ddwhere flow_key= #{flowKey} and version = #{version} limit 1</select>
</mapper>

3、前端编辑后保存

const ddSave = (data: any) => {console.log("ddSave data",data)saveXmlJson(data).then(res => {if(res.code === 200) {createMessage.success(res.message);ddDesignerData.loading = false;ddDesignerOpen.value = false;getList();}  })}  

其中前端数据如下:

const save = () => {const processModel = {code: pCode.value,name: pName.value,icon: {name: 'el:HomeFilled',color: '#409EFF'},process: props.process,flowJson: JSON.stringify(props.process),category: props.processType[0].id,appType: props.processType[0].appType,enable: true,version: props.version,sort: 0,groupId: '',remark: ''}emit('save', processModel);
}

4、后端保存跟原来差不多

@Override@Transactional(rollbackFor = Exception.class)public Result saveDdModel(ProcessModel processModel) {try {FlowSaveXmlVo vo = new FlowSaveXmlVo();BpmnModel bpmnModel = processModel.toBpmnModel();FlowDd flowDd = new FlowDd();flowDd.setId(processModel.getId());flowDd.setName(processModel.getName());flowDd.setFlowKey(processModel.getCode());flowDd.setVersion(processModel.getVersion()+1);//String flowJson = JSON.toJSONString(processModel);//有问题,会转换成大写的问题String flowJson = processModel.getFlowJson();flowDd.setFlowJson(flowJson);flowDdService.save(flowDd);String xml = new String(new BpmnXMLConverter().convertToXML(bpmnModel));vo.setAppType(processModel.getAppType());vo.setCategory(processModel.getCategory());vo.setXml(xml);vo.setDesignerType("DingDing");return this.saveXmlMode(vo);} catch (Exception e) {e.printStackTrace();throw new RuntimeException("创建失败: e=" + e.getMessage());}}

5、效果图

上面是v2版本了,对应bpmn图

编辑仿钉钉界面

仿钉钉保存后数据

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com