xujunjie 2 年 前
コミット
703f41eaf4
1 ファイル変更8 行追加7 行削除
  1. 8 7
      src/pages/PurchaseAdmin/PurchaseList/Detail/AuditFlow.js

+ 8 - 7
src/pages/PurchaseAdmin/PurchaseList/Detail/AuditFlow.js

@@ -54,13 +54,14 @@ function AuditFlow(props) {
     if (!tasks || tasks.length == 0) {
       return false;
     } else {
-      // 查询最后一个task的activityId
-      const activityId = tasks[tasks.length - 1].activity_id;
-      const task = tasks.find(task => task.activity_id == activityId);
-      if (!task) return false;
-      if (task.task_status == 'RUNNING' && task.userid == userId) return true;
+      // 查询处于RUNNING的task activityId
+      const runningTask = tasks.filter(item => item.task_status == 'RUNNING');
+      // const task = tasks.find(task => task.activity_id == activityId);
+      if (runningTask.length == 0) return false;
+      // if (task.task_status == 'RUNNING' && task.userid == userId) return true;
+      return runningTask.find(task => task.userid == userId);
     }
-  }, [tasks, flow]);
+  }, [tasks, userId]);
 
   const getDesc = item => {
     const { activityId } = item;
@@ -151,7 +152,7 @@ function AuditFlow(props) {
           processCode,
           deptId,
           userId,
-          formComponentValues,  
+          formComponentValues,
         });
         setFlow(flow);
         console.log(flow);