diff --git a/src/api/bpm/processInstance/index.ts b/src/api/bpm/processInstance/index.ts index 5d6eefd7..06d0e1b9 100644 --- a/src/api/bpm/processInstance/index.ts +++ b/src/api/bpm/processInstance/index.ts @@ -102,3 +102,8 @@ export const getFormFieldsPermission = async (params: any) => { export const getProcessInstanceBpmnModelView = async (id: string) => { return await request.get({ url: '/bpm/process-instance/get-bpmn-model-view?id=' + id }) } + +// 获取下一个执行的流程节点 +export const getNextFlowNodes = async (params: any) => { + return await request.get({ url: '/bpm/process-instance/get-next-flow-nodes', params }) +} \ No newline at end of file diff --git a/src/components/SimpleProcessDesignerV2/src/consts.ts b/src/components/SimpleProcessDesignerV2/src/consts.ts index c5404f18..97a6b024 100644 --- a/src/components/SimpleProcessDesignerV2/src/consts.ts +++ b/src/components/SimpleProcessDesignerV2/src/consts.ts @@ -162,6 +162,10 @@ export enum CandidateStrategy { * 指定用户 */ USER = 30, + /** + * 审批人自选 + */ + APPROVE_USER_SELECT = 34, /** * 发起人自选 */ @@ -542,6 +546,7 @@ export const CANDIDATE_STRATEGY: DictDataVO[] = [ { label: '连续多级部门负责人', value: CandidateStrategy.MULTI_LEVEL_DEPT_LEADER }, { label: '指定岗位', value: CandidateStrategy.MULTI_LEVEL_DEPT_LEADER }, { label: '发起人自选', value: CandidateStrategy.START_USER_SELECT }, + { label: '审批人自选', value: CandidateStrategy.APPROVE_USER_SELECT }, { label: '发起人本人', value: CandidateStrategy.START_USER }, { label: '发起人部门负责人', value: CandidateStrategy.START_USER_DEPT_LEADER }, { label: '发起人连续部门负责人', value: CandidateStrategy.START_USER_MULTI_LEVEL_DEPT_LEADER }, diff --git a/src/views/bpm/processInstance/detail/ProcessInstanceOperationButton.vue b/src/views/bpm/processInstance/detail/ProcessInstanceOperationButton.vue index 9e6dbc69..1c0e8919 100644 --- a/src/views/bpm/processInstance/detail/ProcessInstanceOperationButton.vue +++ b/src/views/bpm/processInstance/detail/ProcessInstanceOperationButton.vue @@ -718,29 +718,31 @@ const closePopover = (type: string, formRef: FormInstance | undefined) => { const initNextAssigneesFormField = async () => { // 获取修改的流程变量, 暂时只支持流程表单 const variables = getUpdatedProcessInstanceVariables() - const data = await ProcessInstanceApi.getApprovalDetail({ + const data = await ProcessInstanceApi.getNextFlowNodes({ processInstanceId: props.processInstance.id, + taskId: runningTask.value.id, processVariablesStr: JSON.stringify(variables) }) - - const activityId = data.todoTask?.taskDefinitionKey - if (data.activityNodes && data.activityNodes.length > 0) { - // 找到当前节点的索引 - const currentNodeIndex = data.activityNodes.findIndex((node: any) => node.id === activityId) - const nextNode = data.activityNodes[currentNodeIndex + 1] - // 情况一:发起人选择审批人:此时一般是因为条件发生变化,需要当前审批人补充选择 - if ( - nextNode.candidateStrategy === CandidateStrategy.START_USER_SELECT && - !nextNode.tasks && - nextNode.candidateUsers?.length === 0 - ) { - // 自选审批人,则弹出选择审批人弹窗 - // TODO @小北:需要考虑下,这里的 nextNode 可能是多个节点,需要怎么处理;类似你在后端的处理哈 - // TODO @小北:有点纠结,是不是写个预测下一个节点的接口,更合适? - nextAssigneesActivityNode.value = [nextNode] + if (data && data.length > 0) { + data.forEach((node: any) => { + if ( + node.candidateStrategy === CandidateStrategy.START_USER_SELECT && + node.candidateUsers && node.task + ) { + nextAssigneesActivityNode.value.push(node) + } + }) + if (nextAssigneesActivityNode.value.length > 0) { nextAssigneesVisible.value = true } - // TODO @小北:情况二:审批人选择的情况 + + // // 自选审批人,则弹出选择审批人弹窗 + // // TODO @小北:需要考虑下,这里的 nextNode 可能是多个节点,需要怎么处理;类似你在后端的处理哈 + // // TODO @小北:有点纠结,是不是写个预测下一个节点的接口,更合适? + // nextAssigneesActivityNode.value = [nextNode] + // nextAssigneesVisible.value = true + // } + // // TODO @小北:情况二:审批人选择的情况 } }