更多ruoyi-nbcio功能请看演示系统
gitee源代码地址
前后端代码: https://gitee.com/nbacheng/ruoyi-nbcio
演示地址:RuoYi-Nbcio后台管理系统
因为之前不支持在流程设计器进行自定义业务表单的关联选择,所以这部分实现这个。
1、前端
对不同应用类型做不同的处理
/** 查询表单列表 */ getFormList() { if(this.appType[0].id === 'OA' ) { listForm().then(response => { this.formOptions = response.rows; console.log("listForm this.formOptions=",this.formOptions); }); } else if(this.appType[0].id === 'ZDYYW') { listCustomForm().then(response => { this.formOptions = response.rows; console.log("listCustomForm this.formOptions=",this.formOptions); }); } },
同时自定义业务表单类型,只能在开始节点进行选择,用户节点不能选择
2、后端
发布的时候增加一个自定义业务表单的关联处理
if(StrUtil.equalsAnyIgnoreCase(appType, "OA")) { return deployFormService.saveInternalDeployForm(deployment.getId(), bpmnModel); } else if(StrUtil.equalsAnyIgnoreCase(appType, "ZDYYW")) { return customFormService.saveCustomDeployForm(deployment.getId(), deployment.getName(), bpmnModel); }
具体处理实现如下:
@Override @Transactional(rollbackFor = Exception.class) public boolean saveCustomDeployForm(String deployId, String deployName, BpmnModel bpmnModel) { // 获取开始节点 StartEvent startEvent = ModelUtils.getStartEvent(bpmnModel); if (ObjectUtil.isNull(startEvent)) { throw new RuntimeException("开始节点不存在,请检查流程设计是否有误!"); } // 更新开始节点表单信息与流程信息到自定义业务关联表 WfCustomFormBo customFormBo = buildCustomForm(deployId, deployName, startEvent); if (ObjectUtil.isNotNull(customFormBo)) { updateByBo(customFormBo); return true; } return false; } /** * 构建部署表单关联信息对象 * @param deployId 部署ID * @param node 节点信息 * @return 部署表单关联对象。若无表单信息(formKey),则返回null */ private WfCustomFormBo buildCustomForm(String deployId, String deployName, FlowNode node) { String formKey = ModelUtils.getFormKey(node); if (StringUtils.isEmpty(formKey)) { return null; } Long formId = Convert.toLong(StringUtils.substringAfter(formKey, "key_")); WfCustomFormVo customFormVo = queryById(formId); if (ObjectUtil.isNull(customFormVo)) { throw new ServiceException("表单信息查询错误"); } WfCustomFormBo customFormBo = new WfCustomFormBo(); customFormBo.setId(formId); customFormBo.setBusinessName(customFormVo.getBusinessName()); customFormBo.setBusinessService(customFormVo.getBusinessService()); customFormBo.setCreateBy(customFormBo.getCreateBy()); customFormBo.setRouteName(customFormVo.getRouteName()); customFormBo.setDeployId(deployId); customFormBo.setFlowName(deployName); return customFormBo; }
3、效果图如下: