Forráskód Böngészése

feat: 流程审批,预测下个节点是否需要选择审批人

lizhixian 5 hónapja
szülő
commit
59528284ca

+ 25 - 0
src/views/bpm/processInstance/detail/ProcessInstanceOperationButton.vue

@@ -695,6 +695,30 @@ const openPopover = async (type: string) => {
       message.warning('表单校验不通过,请先完善表单!!')
       return
     }
+    // 获取修改的流程变量, 暂时只支持流程表单
+    const variables = getUpdatedProcessInstanceVariables()
+    const param = {
+      processInstanceId: props.processInstance.id,
+      processVariablesStr: JSON.stringify(variables)
+    }
+    // 流程通过时,根据表单变量查询新的流程节点,判断下一个节点类型是否为自选审批人
+    const res = await ProcessInstanceApi.getApprovalDetail(param)
+    //当前待审批节点id
+    const activityId = res.todoTask?.taskDefinitionKey
+    if (res.activityNodes && res.activityNodes.length > 0) {
+      // 找到当前节点的索引
+      const currentNodeIndex = res.activityNodes.findIndex((node) => node.id === activityId)
+      const nextNode = res.activityNodes[currentNodeIndex + 1]
+      if (
+        nextNode.candidateStrategy === CandidateStrategy.START_USER_SELECT &&
+        !nextNode.tasks &&
+        nextNode.candidateUsers?.length === 0
+      ) {
+        // 自选审批人,则弹出选择审批人弹窗
+        activityNodes.value = [nextNode]
+        dialogVisibleSelectApproveUser.value = true
+      }
+    }
   }
   if (type === 'return') {
     // 获取退回节点
@@ -788,6 +812,7 @@ const handleAudit = async (pass: boolean, formRef: FormInstance | undefined) =>
       }
       await TaskApi.approveTask(data)
       popOverVisible.value.approve = false
+      dialogVisibleSelectApproveUser.value = false
       message.success('审批通过成功')
     } else {
       // 审批不通过数据

+ 2 - 3
src/views/bpm/processInstance/detail/ProcessInstanceSimpleViewer.vue

@@ -42,7 +42,7 @@ watch(
       const finishedSequenceFlowActivityIds: string[] = newModelView.finishedSequenceFlowActivityIds
       setSimpleModelNodeTaskStatus(
         newModelView.simpleModel,
-        newModelView.processInstance.status,
+        newModelView.processInstance?.status,
         rejectedTaskActivityIds,
         unfinishedTaskActivityIds,
         finishedActivityIds,
@@ -171,5 +171,4 @@ const setSimpleModelNodeTaskStatus = (
 }
 </script>
 
-<style lang="scss" scoped>
-</style>
+<style lang="scss" scoped></style>