From 8c7db2af70540509bada3474a8534af8a89a99a5 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 12 Jan 2022 00:33:50 +0800 Subject: [PATCH] =?UTF-8?q?BPM=20=E6=A8=A1=E5=9E=8B=E9=87=8D=E6=9E=84=204?= =?UTF-8?q?=EF=BC=9A=E4=BF=AE=E6=94=B9=E6=A8=A1=E5=9E=8B=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=88=90=E5=8D=95=E7=8B=AC=E7=9A=84=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/model/vo/BpmModelBaseVO.java | 10 +- .../bpm/convert/model/BpmModelConvert.java | 33 +++--- yudao-admin-ui/src/router/index.js | 2 +- yudao-admin-ui/src/utils/dict.js | 1 + yudao-admin-ui/src/views/bpm/model/index.vue | 107 +++++++++++++++--- 5 files changed, 120 insertions(+), 33 deletions(-) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/model/vo/BpmModelBaseVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/model/vo/BpmModelBaseVO.java index b3f78c4da..19aef87ee 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/model/vo/BpmModelBaseVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/controller/model/vo/BpmModelBaseVO.java @@ -27,7 +27,15 @@ public class BpmModelBaseVO { @NotEmpty(message = "流程分类不能为空") private String category; - @ApiModelProperty(value = "表单编号", example = "1024") + @ApiModelProperty(value = "表单类型", notes = "参见 bpm_model_form_type 数据字典", example = "1") + private Integer formType; + @ApiModelProperty(value = "表单编号", example = "1024", notes = "在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空") private Long formId; + @ApiModelProperty(value = "自定义表单的提交路径,使用 Vue 的路由地址", example = "/bpm/oa/leave/create", + notes = "在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空") + private String formCustomCreatePath; + @ApiModelProperty(value = "自定义表单的查看路径,使用 Vue 的路由地址", example = "/bpm/oa/leave/view", + notes = "在表单类型为 {@link BpmModelFormTypeEnum#CUSTOM} 时,必须非空") + private String formCustomViewPath; } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/model/BpmModelConvert.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/model/BpmModelConvert.java index e2470f520..57b746f66 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/model/BpmModelConvert.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/model/BpmModelConvert.java @@ -12,6 +12,7 @@ import org.activiti.engine.repository.Deployment; import org.activiti.engine.repository.Model; import org.activiti.engine.repository.ProcessDefinition; import org.mapstruct.Mapper; +import org.mapstruct.MappingTarget; import org.mapstruct.factory.Mappers; import java.util.List; @@ -44,18 +45,15 @@ public interface BpmModelConvert { default BpmModelPageItemRespVO convert(Model model, BpmFormDO form, Deployment deployment, ProcessDefinition processDefinition) { BpmModelPageItemRespVO modelRespVO = new BpmModelPageItemRespVO(); 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.setDescription(metaInfo.getDescription()); - } + // 通用 copy + copyTo(model, modelRespVO); + // Form if (form != null) { modelRespVO.setFormId(form.getId()); modelRespVO.setFormName(form.getName()); } + // ProcessDefinition modelRespVO.setProcessDefinition(this.convert(processDefinition)); if (modelRespVO.getProcessDefinition() != null) { modelRespVO.getProcessDefinition().setSuspensionState(processDefinition.isSuspended() ? @@ -68,18 +66,23 @@ public interface BpmModelConvert { 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()); - } + // 通用 copy + copyTo(model, modelRespVO); return modelRespVO; } + default void copyTo(Model model, BpmModelBaseVO to) { + to.setName(model.getName()); + to.setKey(model.getKey()); + to.setCategory(model.getCategory()); + // metaInfo + BpmModelMetaInfoRespDTO metaInfo = JsonUtils.parseObject(model.getMetaInfo(), BpmModelMetaInfoRespDTO.class); + copyTo(metaInfo, to); + } + + void copyTo(BpmModelMetaInfoRespDTO from, @MappingTarget BpmModelBaseVO to); + default BpmDefinitionCreateReqDTO convert2(Model model) { BpmDefinitionCreateReqDTO createReqDTO = new BpmDefinitionCreateReqDTO(); createReqDTO.setModelId(model.getId()); diff --git a/yudao-admin-ui/src/router/index.js b/yudao-admin-ui/src/router/index.js index 9a046d5d5..35a9deac8 100644 --- a/yudao-admin-ui/src/router/index.js +++ b/yudao-admin-ui/src/router/index.js @@ -169,7 +169,7 @@ export const constantRoutes = [ hidden: true, children: [ { - path: 'manager/model/edit', + path: 'manager/model/design', component: (resolve) => require(['@/views/bpm/model/modelEditor'], resolve), name: '设计流程', meta: { title: '设计流程' } diff --git a/yudao-admin-ui/src/utils/dict.js b/yudao-admin-ui/src/utils/dict.js index 36475451b..ec8239029 100644 --- a/yudao-admin-ui/src/utils/dict.js +++ b/yudao-admin-ui/src/utils/dict.js @@ -36,6 +36,7 @@ export const DICT_TYPE = { // bpm BPM_MODEL_CATEGORY: 'bpm_model_category', + BPM_MODEL_FORM_TYPE: 'bpm_model_form_type', BPM_PROCESS_INSTANCE_STATUS: 'bpm_process_instance_status', BPM_PROCESS_INSTANCE_RESULT: 'bpm_process_instance_result', OA_LEAVE_STATUS: 'flow_status', diff --git a/yudao-admin-ui/src/views/bpm/model/index.vue b/yudao-admin-ui/src/views/bpm/model/index.vue index c9f0c444c..024145778 100644 --- a/yudao-admin-ui/src/views/bpm/model/index.vue +++ b/yudao-admin-ui/src/views/bpm/model/index.vue @@ -26,11 +26,11 @@ 新建流程模型 + v-hasPermi="['bpm:model:create']">新建流程 导入流程模型 + v-hasPermi="['bpm:model:import']">导入流程 @@ -82,9 +82,11 @@ - +