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 b3f78c4da9..19aef87ee7 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 e2470f5204..57b746f665 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 9a046d5d5f..35a9deac89 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 36475451bb..ec82390294 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 c9f0c444cd..0241457782 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 @@ - +