From c17dd616160da6b1d177dd34f35e47f986ba2f3c Mon Sep 17 00:00:00 2001
From: songshankun <songshankun@foxmail.com>
Date: 星期二, 21 十一月 2023 10:43:40 +0800
Subject: [PATCH] fix: 切换到没有任务的设备后重置设备数

---
 src/views/visualization.vue |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/src/views/visualization.vue b/src/views/visualization.vue
index 8facdd6..48cb2ba 100644
--- a/src/views/visualization.vue
+++ b/src/views/visualization.vue
@@ -1185,6 +1185,8 @@
       getTaskInfo({taskMode:1}).then((res) => {
         if (res.code === 200&&res.data) {
           this.TaskCount=res.data?.TaskCount ?? 0
+        }else {
+          this.TaskCount = 0
         }
       },err=>{
         this.TaskCount = 0
@@ -1289,7 +1291,12 @@
           }
           this.getProcessModelList();
           this.getStartArr()
-          this.cutClick(val?val:1)
+          if(this.ChannelAmount===1){
+            this.cutClick(1)
+          }else{
+            this.cutClick(val?val:1)
+          }
+
           if(info=='new'){
             return true;
           }
@@ -1300,6 +1307,12 @@
                   this.getProgressInfo();
                 }, 3000);
               }
+        }else{
+          this.TaskCount = 0
+          const allChannels = [0,1];
+          allChannels.forEach(channel => this.TasksCopy.push(this.newTaskPlaceholder(channel)))
+          this.TasksCopy.sort((a,b)=>a.Channel - b.Channel)
+          this.cutClick(1)
         }
         // if (res.code != 200 || this.TasksCopy.length == 0) {
         //   this.getcountdown();
@@ -1311,6 +1324,12 @@
         //   }
         // }
 
+      },err=>{
+        console.error(err)
+        const allChannels = [0,1];
+        allChannels.forEach(channel => this.TasksCopy.push(this.newTaskPlaceholder(channel)))
+        this.TasksCopy.sort((a,b)=>a.Channel - b.Channel)
+        this.cutClick(1)
       });
       // this.TasksCopy.push(this.object)
       // this.TasksCopy.push(this.object)

--
Gitblit v1.8.0