From 490f907ada7c51b325bf493013b789b4d4e964ba Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 3 Jan 2022 01:12:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=20bpmnProcessDesigner=20?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E8=AE=BE=E8=AE=A1=E5=99=A8=E7=9A=84=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=EF=BC=8C=E5=9F=BA=E6=9C=AC=E5=8F=AF=E7=94=A8=E4=BA=86?= =?UTF-8?q?=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/form/BpmFormController.java | 15 ++-- .../form/vo/BpmFormSimpleRespVO.java | 17 ++++ .../controller/model/vo/BpmModelRespVO.java | 5 ++ .../bpm/convert/form/BpmFormConvert.java | 3 +- .../bpm/convert/model/ModelConvert.java | 15 +++- .../bpm/enums/BpmErrorCodeConstants.java | 2 + .../bpm/service/form/BpmFormService.java | 8 ++ .../service/form/impl/BpmFormServiceImpl.java | 5 ++ .../model/impl/BpmModelServiceImpl.java | 19 ++-- yudao-admin-ui/src/api/bpm/form.js | 7 +- yudao-admin-ui/src/components/RADME.md | 15 +++- .../package/designer/ProcessDesigner.vue | 30 +++++-- .../package/penal/PropertiesPanel.vue | 7 +- .../package/penal/base/ElementBaseInfo.vue | 67 +++++++++------ yudao-admin-ui/src/main.js | 3 +- yudao-admin-ui/src/views/bpm/model/index.vue | 86 ++++--------------- .../src/views/bpm/model/modelEditor.vue | 62 ++++++++++--- yudao-admin-ui/vue.config.js | 1 + .../util/validation/ValidationUtils.java | 9 +- 更新日志.md | 1 + 20 files changed, 242 insertions(+), 135 deletions(-) create mode 100644 yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/vo/BpmFormSimpleRespVO.java diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/BpmFormController.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/BpmFormController.java index 270dbfaf6..8feafe828 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/BpmFormController.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/BpmFormController.java @@ -1,9 +1,9 @@ package cn.iocoder.yudao.adminserver.modules.bpm.controller.form; +import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.*; import cn.iocoder.yudao.adminserver.modules.bpm.convert.form.BpmFormConvert; import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.form.BpmFormDO; import cn.iocoder.yudao.adminserver.modules.bpm.service.form.BpmFormService; -import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.*; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import io.swagger.annotations.Api; @@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.validation.Valid; -import java.util.Collection; import java.util.List; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @@ -62,13 +61,11 @@ public class BpmFormController { return success(BpmFormConvert.INSTANCE.convert(form)); } - @GetMapping("/list") - @ApiOperation("获得动态表单列表") - @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) - @PreAuthorize("@ss.hasPermission('bpm:form:query')") - public CommonResult> getFormList(@RequestParam("ids") Collection ids) { - List list = formService.getFormList(ids); - return success(BpmFormConvert.INSTANCE.convertList(list)); + @GetMapping("/list-all-simple") + @ApiOperation(value = "获得动态表单的精简列表", notes = "用于表单下拉框") + public CommonResult> getSimpleForms() { + List list = formService.getFormList(); + return success(BpmFormConvert.INSTANCE.convertList2(list)); } @GetMapping("/page") diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/vo/BpmFormSimpleRespVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/vo/BpmFormSimpleRespVO.java new file mode 100644 index 000000000..c4ee7e3c3 --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/form/vo/BpmFormSimpleRespVO.java @@ -0,0 +1,17 @@ +package cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@ApiModel("流程表单精简 Response VO") +@Data +public class BpmFormSimpleRespVO { + + @ApiModelProperty(value = "表单编号", required = true, example = "1024") + private Long id; + + @ApiModelProperty(value = "表单名称", required = true, example = "芋道") + private String name; + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/model/vo/BpmModelRespVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/model/vo/BpmModelRespVO.java index 0a13a7a09..8e8251b90 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/model/vo/BpmModelRespVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/model/vo/BpmModelRespVO.java @@ -6,6 +6,8 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; +import java.util.Date; + @ApiModel("流程模型的创建 Request VO") @Data @EqualsAndHashCode(callSuper = true) @@ -18,4 +20,7 @@ public class BpmModelRespVO extends BpmModelBaseVO { @ApiModelProperty(value = "BPMN XML", required = true) private String bpmnXml; + @ApiModelProperty(value = "创建时间", required = true) + private Date createTime; + } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/form/BpmFormConvert.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/form/BpmFormConvert.java index 97df03ebb..19a666550 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/form/BpmFormConvert.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/form/BpmFormConvert.java @@ -2,6 +2,7 @@ package cn.iocoder.yudao.adminserver.modules.bpm.convert.form; import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.BpmFormCreateReqVO; import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.BpmFormRespVO; +import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.BpmFormSimpleRespVO; import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.BpmFormUpdateReqVO; import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.form.BpmFormDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; @@ -26,7 +27,7 @@ public interface BpmFormConvert { BpmFormRespVO convert(BpmFormDO bean); - List convertList(List list); + List convertList2(List list); PageResult convertPage(PageResult page); diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/model/ModelConvert.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/model/ModelConvert.java index 6495f8019..640e13cdf 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/model/ModelConvert.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/model/ModelConvert.java @@ -57,7 +57,20 @@ public interface ModelConvert { return modelRespVO; } - BpmModelRespVO convert(Model model); + default BpmModelRespVO convert(Model model) { + BpmModelRespVO modelRespVO = new BpmModelRespVO(); + modelRespVO.setId(model.getId()); + modelRespVO.setName(model.getName()); + modelRespVO.setKey(model.getKey()); + modelRespVO.setCategory(model.getCategory()); + modelRespVO.setCreateTime(model.getCreateTime()); + BpmModelMetaInfoRespDTO metaInfo = JsonUtils.parseObject(model.getMetaInfo(), BpmModelMetaInfoRespDTO.class); + if (metaInfo != null) { + modelRespVO.setFormId(metaInfo.getFormId()); + modelRespVO.setDescription(metaInfo.getDescription()); + } + return modelRespVO; + } default BpmDefinitionCreateReqDTO convert2(Model model) { BpmDefinitionCreateReqDTO createReqDTO = new BpmDefinitionCreateReqDTO(); diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/BpmErrorCodeConstants.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/BpmErrorCodeConstants.java index f561b8260..18a0bb846 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/BpmErrorCodeConstants.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/BpmErrorCodeConstants.java @@ -26,6 +26,8 @@ public interface BpmErrorCodeConstants { // ========== OA 工作流模块 1-009-002-000 ========== ErrorCode BPM_MODEL_KEY_EXISTS = new ErrorCode(1009002000, "已经存在流程标识为【{}】的流程"); ErrorCode BPMN_MODEL_NOT_EXISTS = new ErrorCode(1009002001, "流程模型不存在"); + ErrorCode BPMN_MODEL_KEY_VALID = new ErrorCode(1009002002, "流程标识格式不正确,需要以字母或下划线开头,后接任意字母、数字、中划线、下划线、句点!"); + ErrorCode BPMN_MODEL_ERROR = new ErrorCode(1004001002, "工作流模型异常"); ErrorCode BPMN_MODEL_PROCESS_NOT_EXISTS = new ErrorCode(1004001009, "流程数据为空"); diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/form/BpmFormService.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/form/BpmFormService.java index c073db628..a08a7ee3d 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/form/BpmFormService.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/form/BpmFormService.java @@ -7,6 +7,7 @@ import cn.iocoder.yudao.adminserver.modules.bpm.controller.form.vo.BpmFormUpdate import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.form.BpmFormDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; +import org.activiti.engine.repository.Model; import javax.validation.Valid; import java.util.Collection; @@ -52,6 +53,13 @@ public interface BpmFormService { */ BpmFormDO getForm(Long id); + /** + * 获得动态表单列表 + * + * @return 动态表单列表 + */ + List getFormList(); + /** * 获得动态表单列表 * diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/form/impl/BpmFormServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/form/impl/BpmFormServiceImpl.java index 66392d599..582ce7878 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/form/impl/BpmFormServiceImpl.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/form/impl/BpmFormServiceImpl.java @@ -75,6 +75,11 @@ public class BpmFormServiceImpl implements BpmFormService { return formMapper.selectById(id); } + @Override + public List getFormList() { + return formMapper.selectList(); + } + @Override public List getFormList(Collection ids) { return formMapper.selectBatchIds(ids); diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/model/impl/BpmModelServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/model/impl/BpmModelServiceImpl.java index 508c17a1d..66179a6f9 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/model/impl/BpmModelServiceImpl.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/model/impl/BpmModelServiceImpl.java @@ -13,6 +13,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import cn.iocoder.yudao.framework.common.util.object.PageUtils; +import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; import lombok.extern.slf4j.Slf4j; import org.activiti.engine.RepositoryService; import org.activiti.engine.repository.Model; @@ -29,8 +30,7 @@ import java.util.List; import java.util.Map; import java.util.Set; -import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.BPMN_MODEL_NOT_EXISTS; -import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.BPM_MODEL_KEY_EXISTS; +import static cn.iocoder.yudao.adminserver.modules.bpm.enums.BpmErrorCodeConstants.*; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; @@ -89,6 +89,9 @@ public class BpmModelServiceImpl implements BpmModelService { @Override public BpmModelRespVO getModel(String id) { Model model = repositoryService.getModel(id); + if (model == null) { + return null; + } BpmModelRespVO modelRespVO = ModelConvert.INSTANCE.convert(model); // 拼接 bpmn XML byte[] bpmnBytes = repositoryService.getModelEditorSource(id); @@ -99,12 +102,12 @@ public class BpmModelServiceImpl implements BpmModelService { @Override @Transactional(rollbackFor = Exception.class) // 因为进行多个 activiti 操作,所以开启事务 public String createModel(BpmModelCreateReqVO createReqVO) { + checkKeyNCName(createReqVO.getKey()); // 校验流程标识已经存在 Model keyModel = this.getModelByKey(createReqVO.getKey()); if (keyModel != null) { - throw exception(BPM_MODEL_KEY_EXISTS); + throw exception(BPM_MODEL_KEY_EXISTS, createReqVO.getKey()); } - // TODO @芋艿:需要校验下 key 的格式 // 创建流程定义 Model model = repositoryService.newModel(); @@ -119,12 +122,12 @@ public class BpmModelServiceImpl implements BpmModelService { @Override @Transactional(rollbackFor = Exception.class) // 因为进行多个 activiti 操作,所以开启事务 public void updateModel(BpmModelUpdateReqVO updateReqVO) { + checkKeyNCName(updateReqVO.getKey()); // 校验流程模型存在 Model model = repositoryService.getModel(updateReqVO.getId()); if (model == null) { throw exception(BPMN_MODEL_NOT_EXISTS); } - // TODO @芋艿:需要校验下 key 的格式 // 修改流程定义 ModelConvert.INSTANCE.copy(model, updateReqVO); @@ -173,4 +176,10 @@ public class BpmModelServiceImpl implements BpmModelService { return repositoryService.createModelQuery().modelKey(key).singleResult(); } + private void checkKeyNCName(String key) { + if (!ValidationUtils.isXmlNCName(key)) { + throw exception(BPMN_MODEL_KEY_VALID); + } + } + } diff --git a/yudao-admin-ui/src/api/bpm/form.js b/yudao-admin-ui/src/api/bpm/form.js index 768ff7a69..1a5b3c6e1 100644 --- a/yudao-admin-ui/src/api/bpm/form.js +++ b/yudao-admin-ui/src/api/bpm/form.js @@ -43,5 +43,10 @@ export function getFormPage(query) { }) } -export class exportFormExcel { +// 获得动态表单的精简列表 +export function getSimpleForms() { + return request({ + url: '/bpm/form/list-all-simple', + method: 'get' + }) } diff --git a/yudao-admin-ui/src/components/RADME.md b/yudao-admin-ui/src/components/RADME.md index 63c3b8457..21e7a8235 100644 --- a/yudao-admin-ui/src/components/RADME.md +++ b/yudao-admin-ui/src/components/RADME.md @@ -5,4 +5,17 @@ github 地址:https://github.com/JakHuang/form-generator * generator * parser * render -* tinymce \ No newline at end of file +* tinymce + +## bpmn-process-designer + +github 地址:https://github.com/miyuesc/bpmn-process-designer + +* bpmnProcessDesigner + +TODO 目前存在的问题,如果选择 activiti 类型时,因为不支持内置表单的设计,所以会报 Error: unknown type activiti:FormData 错误。具体可见 https://github.com/miyuesc/bpmn-process-designer/issues/16 。 + +另外几个流程设计器的选型: + +* https://gitee.com/jimlow/vue-bpmn 相比差一些,已经停止维护,不算推荐。 +* https://github.com/GoldSubmarine/workflow-bpmn-modeler 仅支持 flowable 流程引擎。如果只考虑 flowable 的话,也是非常不错的选择。 \ No newline at end of file diff --git a/yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/ProcessDesigner.vue b/yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/ProcessDesigner.vue index 83df81ef4..f45dc194c 100644 --- a/yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/ProcessDesigner.vue +++ b/yudao-admin-ui/src/components/bpmnProcessDesigner/package/designer/ProcessDesigner.vue @@ -4,7 +4,7 @@ @@ -111,8 +112,9 @@ export default { componentName: "MyProcessDesigner", props: { value: String, // xml 字符串 - processId: String, - processName: String, + processId: String, // 流程 key 标识 + processName: String, // 流程 name 名字 + formId: Number, // 流程 form 表单编号 translations: Object, // 自定义的翻译文件 additionalModel: [Object, Array], // 自定义model moddleExtension: Object, // 自定义moddle @@ -244,6 +246,11 @@ export default { this.bpmnModeler = null; }); }, + watch: { + value: function (newValue) { // 在 xmlString 发生变化时,重新创建,从而绘制流程图 + this.createNewDiagram(newValue); + } + }, methods: { initBpmnModeler() { if (this.bpmnModeler) return; @@ -445,6 +452,17 @@ export default { this.previewType = "json"; this.previewModelVisible = true; }); + }, + /* ------------------------------------------------ 芋道源码 methods ------------------------------------------------------ */ + async processSave() { + const { err, xml } = await this.bpmnModeler.saveXML(); + // 读取异常时抛出异常 + if (err) { + this.msgError('保存模型失败,请重试!') + return + } + // 触发 save 事件 + this.$emit('save', xml) } } }; diff --git a/yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/PropertiesPanel.vue b/yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/PropertiesPanel.vue index 5af450dbf..21d16ecac 100644 --- a/yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/PropertiesPanel.vue +++ b/yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/PropertiesPanel.vue @@ -3,7 +3,8 @@
常规
- +
消息与信号
@@ -89,7 +90,8 @@ export default { idEditDisabled: { type: Boolean, default: false - } + }, + model: Object, // 流程模型的数据 }, provide() { return { @@ -159,6 +161,7 @@ export default { // 初始化数据 initFormOnChanged(element) { let activatedElement = element; + // debugger if (!activatedElement) { activatedElement = window.bpmnInstances.elementRegistry.find(el => el.type === "bpmn:Process") ?? diff --git a/yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/base/ElementBaseInfo.vue b/yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/base/ElementBaseInfo.vue index 533f3509e..6a77a948f 100644 --- a/yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/base/ElementBaseInfo.vue +++ b/yudao-admin-ui/src/components/bpmnProcessDesigner/package/penal/base/ElementBaseInfo.vue @@ -1,43 +1,53 @@ - - diff --git a/yudao-admin-ui/src/views/bpm/model/modelEditor.vue b/yudao-admin-ui/src/views/bpm/model/modelEditor.vue index 73792405a..e995f22b9 100644 --- a/yudao-admin-ui/src/views/bpm/model/modelEditor.vue +++ b/yudao-admin-ui/src/views/bpm/model/modelEditor.vue @@ -1,11 +1,14 @@ @@ -18,6 +21,7 @@ import CustomContentPadProvider from "@/components/bpmnProcessDesigner/package/d import CustomPaletteProvider from "@/components/bpmnProcessDesigner/package/designer/plugins/palette"; // import xmlObj2json from "./utils/xml2json"; import MyProcessPalette from "@/components/bpmnProcessDesigner/package/palette/ProcessPalette"; +import {createModel, getModel, updateModel} from "@/api/bpm/model"; // 自定义侧边栏 // import MyProcessPanel from "../package/process-panel/ProcessPanel"; @@ -32,23 +36,34 @@ export default { controlDrawerVisible: false, translationsSelf: translations, controlForm: { - processId: "", - processName: "", simulation: true, labelEditing: false, labelVisible: false, prefix: "activiti", headerButtonSize: "mini", - // additionalModel: [] additionalModel: [CustomContentPadProvider, CustomPaletteProvider] }, addis: { CustomContentPadProvider, CustomPaletteProvider - } + }, + // 流程模型的信息 + model: {}, }; }, - created() {}, + created() { + // 如果 modelId 非空,说明是修改流程模型 + const modelId = this.$route.query && this.$route.query.modelId + if (modelId) { + getModel(modelId).then(response => { + this.xmlString = response.data.bpmnXml + this.model = { + ...response.data, + bpmnXml: undefined, // 清空 bpmnXml 属性 + } + }) + } + }, methods: { initModeler(modeler) { setTimeout(() => { @@ -70,7 +85,34 @@ export default { // this.xmlString = undefined; // this.$refs.processDesigner.processRestart(); // } - } + }, + save(bpmnXml) { + const data = { + ...this.model, + bpmnXml: bpmnXml, // this.bpmnXml 只是初始化流程图,后续修改无法通过它获得 + } + + // 修改的提交 + if (data.id) { + updateModel(data).then(response => { + this.msgSuccess("修改成功") + // 跳转回去 + this.close() + }) + return + } + // 添加的提交 + createModel(data).then(response => { + this.msgSuccess("保存成功") + // 跳转回去 + this.close() + }) + }, + /** 关闭按钮 */ + close() { + this.$store.dispatch("tagsView/delView", this.$route); + this.$router.push({ path: "/bpm/manager/model", query: { t: Date.now()}}) + }, } }; diff --git a/yudao-admin-ui/vue.config.js b/yudao-admin-ui/vue.config.js index 0e1363575..7588779de 100644 --- a/yudao-admin-ui/vue.config.js +++ b/yudao-admin-ui/vue.config.js @@ -35,6 +35,7 @@ module.exports = { // detail: https://cli.vuejs.org/config/#devserver-proxy [process.env.VUE_APP_BASE_API]: { target: `http://localhost:48080`, + // target: `http://api-dashboard.yudao.iocoder.cn`, changeOrigin: true, pathRewrite: { ['^' + process.env.VUE_APP_BASE_API]: '' diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/validation/ValidationUtils.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/validation/ValidationUtils.java index 28b68a8f9..6b4cd4d03 100644 --- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/validation/ValidationUtils.java +++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/validation/ValidationUtils.java @@ -12,7 +12,9 @@ import java.util.regex.Pattern; */ public class ValidationUtils { - private static Pattern PATTERN_URL = Pattern.compile("^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]"); + private static final Pattern PATTERN_URL = Pattern.compile("^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]"); + + private static final Pattern PATTERN_XML_NCNAME = Pattern.compile("[a-zA-Z_][\\-_.0-9_a-zA-Z$]*"); public static boolean isMobile(String mobile) { if (StrUtil.length(mobile) != 11) { @@ -27,4 +29,9 @@ public class ValidationUtils { && PATTERN_URL.matcher(url).matches(); } + public static boolean isXmlNCName(String str) { + return StringUtils.hasText(str) + && PATTERN_XML_NCNAME.matcher(str).matches(); + } + } diff --git a/更新日志.md b/更新日志.md index e0eb1ec8e..647ee2945 100644 --- a/更新日志.md +++ b/更新日志.md @@ -28,6 +28,7 @@ * 【优化】引入 form generator 0.2.0 版本,并重构相关代码 * 【新增】新增流程表单,支持动态进行表单的配置 +* 【新增】引入 bpmn-process-designer 0.0.1 版本,提供流程设计器的能力 ### 🐞 Bug Fixes