From f6739d7542be48f7f8139c3d5fc7b2326e5cfc8d Mon Sep 17 00:00:00 2001
From: songshankun <songshankun@foxmail.com>
Date: 星期三, 22 十一月 2023 11:06:35 +0800
Subject: [PATCH] feat: 轮询plc时间调整; 接口报错时也轮询plc

---
 src/views/visualization.vue |   41 ++++++++++++++++++++++++++++++++++-------
 1 files changed, 34 insertions(+), 7 deletions(-)

diff --git a/src/views/visualization.vue b/src/views/visualization.vue
index 8f94cce..8811c49 100644
--- a/src/views/visualization.vue
+++ b/src/views/visualization.vue
@@ -914,12 +914,12 @@
     getModelList(){
       for (let i in this.TasksCopy){
         this.TasksCopy[i].isUpdateIcon=false;
-        if(this.TasksCopy[i].Procedure.ID&&this.TasksCopy[i].number){
+        // number:this.TasksCopy[i].number
+        if(this.TasksCopy[i].Procedure.ID){
           processModelList({
             procedureId: this.TasksCopy[i].Procedure.ID,
             page: 1,
             pageSize:6,
-            number:this.TasksCopy[i].number
           }).then(res=>{
             if(res.code==200){
               this.processList=res.data?res.data:[];
@@ -943,12 +943,11 @@
       this.listData=list;
       this.index=index
       if( Object.keys(this.listData).length > 0){
-        if(this.listData.Procedure.ID&&this.listData.number){
+        if(this.listData.Procedure.ID){
           this.$refs.processModel.islook=true
           return true;
         }
       }
-      this.$message.error('褰撳墠宸ュ簭鏃犵紪鍙凤紝鏃犳硶鏌ョ湅宸ュ簭!')
     },
     getProcessModelList(){
       this.getModelList()
@@ -1186,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
@@ -1193,8 +1194,8 @@
       }).finally(()=>{
         this.pollingTaskCountTimer = setTimeout(()=>{
           this.getTaskCountStatistics()
-        //   20绉掍竴娆¤疆璇�
-        },20000)
+        //   20绉掍竴娆¤疆璇� // 鏀逛竴鍒嗛挓
+        },60000)
       });
     },
 
@@ -1290,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;
           }
@@ -1301,6 +1307,19 @@
                   this.getProgressInfo();
                 }, 3000);
               }
+        }else{
+          this.TaskCount = 0
+          const allChannels = [0,1];
+          this.workers = []
+          allChannels.forEach(channel => this.TasksCopy.push(this.newTaskPlaceholder(channel)))
+          this.TasksCopy.sort((a,b)=>a.Channel - b.Channel)
+          this.cutClick(1)
+          this.getProgressInfo();
+          if (!this.procInfoTimer&&!this.resprocInfoTimer) {
+            this.procInfoTimer = setInterval(() => {
+              this.getProgressInfo();
+            }, 3000);
+          }
         }
         // if (res.code != 200 || this.TasksCopy.length == 0) {
         //   this.getcountdown();
@@ -1312,6 +1331,14 @@
         //   }
         // }
 
+      },err=>{
+        console.error(err)
+        this.TaskCount = 0
+        const allChannels = [0,1];
+        this.workers = []
+        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