Renxy 2 years ago
parent
commit
8efb381414
1 changed files with 8 additions and 4 deletions
  1. 8 4
      src/pages/PurchaseAdmin/PurchaseList/Detail/AuditFlow.js

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

@@ -31,9 +31,7 @@ function AuditFlow(props) {
     if (!tasks || tasks.length == 0) {
       return false;
     } else {
-      // 查询最后一个task的activityId
       let current = 0;
-      const activityId = tasks[tasks.length - 1].activity_id;
       flow.workflowActivityRules.forEach((item, index) => {
         let task = tasks.find(task => task.activity_id == item.activityId);
         if (task) {
@@ -65,6 +63,12 @@ function AuditFlow(props) {
     }
   }, [tasks, userId]);
 
+  const getTaskId = () => {
+    const runningTask = tasks.find(item => item.task_status == 'RUNNING' && item.userid == userId);
+    console.log('==========================', runningTask.taskid);
+    if (runningTask) return runningTask.taskid;
+  };
+
   const getDesc = item => {
     const { activityId } = item;
     if (!tasks || tasks.length == 0) return '';
@@ -192,10 +196,10 @@ function AuditFlow(props) {
         </Steps>
         {showAduit && status != -1 && (
           <div className={styles.btns} style={{ marginLeft: 80 }}>
-            <Button type="primary" onClick={() => onApprove(true, tasks[current].taskid)}>
+            <Button type="primary" onClick={() => onApprove(true, getTaskId())}>
               审批通过
             </Button>
-            <Button onClick={() => onApprove(false, tasks[current].taskid)} danger>
+            <Button onClick={() => onApprove(false, getTaskId())} danger>
               审批拒绝
             </Button>
           </div>