Skip to content

Commit 5952828

Browse files
committed
feat: 流程审批,预测下个节点是否需要选择审批人
1 parent b346545 commit 5952828

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

src/views/bpm/processInstance/detail/ProcessInstanceOperationButton.vue

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,30 @@ const openPopover = async (type: string) => {
695695
message.warning('表单校验不通过,请先完善表单!!')
696696
return
697697
}
698+
// 获取修改的流程变量, 暂时只支持流程表单
699+
const variables = getUpdatedProcessInstanceVariables()
700+
const param = {
701+
processInstanceId: props.processInstance.id,
702+
processVariablesStr: JSON.stringify(variables)
703+
}
704+
// 流程通过时,根据表单变量查询新的流程节点,判断下一个节点类型是否为自选审批人
705+
const res = await ProcessInstanceApi.getApprovalDetail(param)
706+
//当前待审批节点id
707+
const activityId = res.todoTask?.taskDefinitionKey
708+
if (res.activityNodes && res.activityNodes.length > 0) {
709+
// 找到当前节点的索引
710+
const currentNodeIndex = res.activityNodes.findIndex((node) => node.id === activityId)
711+
const nextNode = res.activityNodes[currentNodeIndex + 1]
712+
if (
713+
nextNode.candidateStrategy === CandidateStrategy.START_USER_SELECT &&
714+
!nextNode.tasks &&
715+
nextNode.candidateUsers?.length === 0
716+
) {
717+
// 自选审批人,则弹出选择审批人弹窗
718+
activityNodes.value = [nextNode]
719+
dialogVisibleSelectApproveUser.value = true
720+
}
721+
}
698722
}
699723
if (type === 'return') {
700724
// 获取退回节点
@@ -788,6 +812,7 @@ const handleAudit = async (pass: boolean, formRef: FormInstance | undefined) =>
788812
}
789813
await TaskApi.approveTask(data)
790814
popOverVisible.value.approve = false
815+
dialogVisibleSelectApproveUser.value = false
791816
message.success('审批通过成功')
792817
} else {
793818
// 审批不通过数据

src/views/bpm/processInstance/detail/ProcessInstanceSimpleViewer.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ watch(
4242
const finishedSequenceFlowActivityIds: string[] = newModelView.finishedSequenceFlowActivityIds
4343
setSimpleModelNodeTaskStatus(
4444
newModelView.simpleModel,
45-
newModelView.processInstance.status,
45+
newModelView.processInstance?.status,
4646
rejectedTaskActivityIds,
4747
unfinishedTaskActivityIds,
4848
finishedActivityIds,
@@ -171,5 +171,4 @@ const setSimpleModelNodeTaskStatus = (
171171
}
172172
</script>
173173

174-
<style lang="scss" scoped>
175-
</style>
174+
<style lang="scss" scoped></style>

0 commit comments

Comments
 (0)