From 8a10568b24c3677cd3d58430dfe866d9faaec055 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 9 Jan 2022 00:17:52 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BF=AE=E6=94=B9=20Parser.vue=20?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=EF=BC=8C=E5=AE=9E=E7=8E=B0=20submit=20?= =?UTF-8?q?=E4=BC=A0=E9=80=92=20conf=20=E5=92=8C=20values=20=E5=8F=82?= =?UTF-8?q?=E6=95=B0=202.=20=E5=AE=8C=E6=88=90=E6=B5=81=E7=A8=8B=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E7=9A=84=E5=89=8D=E7=AB=AF=20UI=20=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../definition/BpmDefinitionConvert.java | 15 +- .../impl/BpmProcessDefinitionServiceImpl.java | 13 +- yudao-admin-ui/src/api/bpm/definition.js | 8 + yudao-admin-ui/src/api/bpm/processInstance.js | 8 + .../src/components/parser/Parser.vue | 9 +- .../src/views/bpm/processInstance/create.vue | 180 ++++++++++-------- .../src/views/bpm/processInstance/index.vue | 2 +- 7 files changed, 147 insertions(+), 88 deletions(-) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/definition/BpmDefinitionConvert.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/definition/BpmDefinitionConvert.java index 8dab68165..67c82b48e 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/definition/BpmDefinitionConvert.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/definition/BpmDefinitionConvert.java @@ -17,6 +17,7 @@ import org.mapstruct.factory.Mappers; import java.util.List; import java.util.Map; +import java.util.function.Function; /** * Bpm 流程定义的 Convert @@ -59,10 +60,18 @@ public interface BpmDefinitionConvert { BpmProcessDefinitionExtDO convert2(BpmDefinitionCreateReqDTO bean); - @Named("convertList3") - List convertList3(List list); + default List convertList3(List list, + Map processDefinitionDOMap) { + return CollectionUtils.convertList(list, processDefinition -> { + BpmProcessDefinitionRespVO respVO = convert3(processDefinition); + BpmProcessDefinitionExtDO processDefinitionExtDO = processDefinitionDOMap.get(processDefinition.getId()); + if (processDefinitionExtDO != null) { + respVO.setFormId(processDefinitionExtDO.getFormId()); + } + return respVO; + }); + } - @Named("convert3") @Mapping(source = "suspended", target = "suspensionState", qualifiedByName = "convertSuspendedToSuspensionState") BpmProcessDefinitionRespVO convert3(ProcessDefinition bean); diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmProcessDefinitionServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmProcessDefinitionServiceImpl.java index b47b32477..382d1c56d 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmProcessDefinitionServiceImpl.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmProcessDefinitionServiceImpl.java @@ -79,8 +79,7 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ Map deploymentMap = getDeploymentMap(deploymentIds); // 获得 BpmProcessDefinitionDO Map - List processDefinitionDOs = Collections.emptyList(); - processDefinitionDOs = processDefinitionMapper.selectListByProcessDefinitionIds( + List processDefinitionDOs = processDefinitionMapper.selectListByProcessDefinitionIds( convertList(processDefinitions, ProcessDefinition::getId)); Map processDefinitionDOMap = CollectionUtils.convertMap(processDefinitionDOs, BpmProcessDefinitionExtDO::getProcessDefinitionId); @@ -104,8 +103,16 @@ public class BpmProcessDefinitionServiceImpl implements BpmProcessDefinitionServ } else if (Objects.equals(SuspensionState.ACTIVE.getStateCode(), listReqVO.getSuspensionState())) { definitionQuery.active(); } + // 执行查询 + List processDefinitions = definitionQuery.list(); + + // 获得 BpmProcessDefinitionDO Map + List processDefinitionDOs = processDefinitionMapper.selectListByProcessDefinitionIds( + convertList(processDefinitions, ProcessDefinition::getId)); + Map processDefinitionDOMap = CollectionUtils.convertMap(processDefinitionDOs, + BpmProcessDefinitionExtDO::getProcessDefinitionId); // 执行查询,并返回 - return BpmDefinitionConvert.INSTANCE.convertList3(definitionQuery.list()); + return BpmDefinitionConvert.INSTANCE.convertList3(processDefinitions, processDefinitionDOMap); } @Override diff --git a/yudao-admin-ui/src/api/bpm/definition.js b/yudao-admin-ui/src/api/bpm/definition.js index 242f75725..b1d9b979b 100644 --- a/yudao-admin-ui/src/api/bpm/definition.js +++ b/yudao-admin-ui/src/api/bpm/definition.js @@ -8,6 +8,14 @@ export function getProcessDefinitionPage(query) { }) } +export function getProcessDefinitionList(query) { + return request({ + url: '/bpm/process-definition/list', + method: 'get', + params: query + }) +} + export function getProcessDefinitionBpmnXML(id) { return request({ url: '/bpm/process-definition/get-bpmn-xml?id=' + id, diff --git a/yudao-admin-ui/src/api/bpm/processInstance.js b/yudao-admin-ui/src/api/bpm/processInstance.js index f82c72d51..2340356f8 100644 --- a/yudao-admin-ui/src/api/bpm/processInstance.js +++ b/yudao-admin-ui/src/api/bpm/processInstance.js @@ -8,6 +8,14 @@ export function getMyProcessInstancePage(query) { }) } +export function createProcessInstance(data) { + return request({ + url: '/bpm/process-instance/create', + method: 'POST', + data: data + }) +} + export function cancelProcessInstance(id, reason) { return request({ url: '/bpm/process-instance/cancel', diff --git a/yudao-admin-ui/src/components/parser/Parser.vue b/yudao-admin-ui/src/components/parser/Parser.vue index e368c023f..779cf1782 100644 --- a/yudao-admin-ui/src/components/parser/Parser.vue +++ b/yudao-admin-ui/src/components/parser/Parser.vue @@ -173,8 +173,13 @@ export default { submitForm() { this.$refs[this.formConf.formRef].validate(valid => { if (!valid) return false - // 触发sumit事件 - this.$emit('submit', this[this.formConf.formModel]) + // 触发 submit 事件 + // update by 芋道源码 + // this.$emit('submit', this[this.formConf.formModel]) + this.$emit('submit', { + conf: this.formConfCopy, + values: this[this.formConf.formModel] + }) return true }) } diff --git a/yudao-admin-ui/src/views/bpm/processInstance/create.vue b/yudao-admin-ui/src/views/bpm/processInstance/create.vue index b613f46a3..bd4310565 100644 --- a/yudao-admin-ui/src/views/bpm/processInstance/create.vue +++ b/yudao-admin-ui/src/views/bpm/processInstance/create.vue @@ -1,70 +1,65 @@