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 8dab681656..67c82b48ed 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 b47b32477b..382d1c56d4 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 242f75725e..b1d9b979bf 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 f82c72d510..2340356f8a 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 e368c023fb..779cf17828 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 b613f46a3e..bd43105652 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 @@