Sfoglia il codice sorgente

同步队列修改

duy 12 ore fa
parent
commit
f3d2152228
2 ha cambiato i file con 93 aggiunte e 7 eliminazioni
  1. 16 0
      src/api/manager/wbsformelement.js
  2. 77 7
      src/views/manager/projectinfo/tree.vue

+ 16 - 0
src/api/manager/wbsformelement.js

@@ -96,4 +96,20 @@ export const copyNode = (formData) => {
     method: 'post',
     data: formData
   })
+}
+//删除同步记录
+export const deleteRecord = (data) => {
+  return request({
+    url: '/api/blade-manager/synchronousRecord/delete',
+    method: 'get',
+    params:data
+  })
+}
+//刷新同步记录状态
+export const reFlush = (data) => {
+  return request({
+    url: '/api/blade-manager/synchronousRecord/reFlush',
+    method: 'get',
+    params:data
+  })
 }

+ 77 - 7
src/views/manager/projectinfo/tree.vue

@@ -2539,19 +2539,20 @@
       
                 <div class="progress-text">
                   <div class="progress-text-btn">
-                    <div>同步进度</div>
+                    <div style="font-weight: bold;">同步进度</div>
                     
                   </div>
                 
                    <div>
                    
-                     <el-button type="text" icon="el-icon-refresh" style="color:orange"></el-button>
-                    <el-button type="text" icon="el-icon-delete" style="color:red"></el-button>
+                     <el-button type="text" icon="el-icon-refresh" style="color:orange" @click="refreshSyncList(item.id)" :loading="refreshListLoad"></el-button>
+                    <el-button type="text" icon="el-icon-delete" style="color:red" @click="delSyncItem(item.id)" :loading="delSyncLoad"></el-button>
                    </div>
                 </div>
      
-                  <div>
+                  <div style="padding-right: 10px;padding-left: 10px;">
                     <el-progress 
+                    text-inside
                       class="custom-progress" 
                     :percentage="item.progress"
                     text-color="#2550A2"
@@ -2791,7 +2792,9 @@ import {
   updateBatchElements,
   getTemplate,
   importWbsElement,
-  querySyncRecord
+  querySyncRecord,
+  reFlush,
+  deleteRecord
 } from "@/api/manager/wbsformelement";
 import {
  
@@ -3248,8 +3251,10 @@ export default {
 
       },
       tableListByType:[],
-      tableListByTypeLoad:false
-      
+      tableListByTypeLoad:false,
+      refreshListLoad:false,
+      delSyncLoad:false,
+       syncListTimer: null // 用于存储定时器ID
     };
   },
   computed: {
@@ -6263,6 +6268,10 @@ async saveLinkTab() {
 
 
         this.syncListDialog=true
+          // 启动定时器,每5秒请求一次
+        this.syncListTimer = setInterval(() => {
+          this.getSyncListDataNew();
+        }, 5000);
         this.getSyncListDataNew ()
         this.closeProSyncTag()
        
@@ -6280,6 +6289,11 @@ async saveLinkTab() {
     },
     closeSyncListTag(){
       this.syncListDialog=false;
+       // 清除定时器,停止请求
+      if (this.syncListTimer) {
+        clearInterval(this.syncListTimer);
+        this.syncListTimer = null;
+      }
        this.updateNodeTable()
     },
     handleCheckAllChange(val) {
@@ -6509,15 +6523,28 @@ async saveLinkTab() {
                     
                   
                       this.syncListDialog=true
+                              this.syncListTimer = setInterval(() => {
+                            this.getSyncListDataNew();
+                          }, 5000);
                               this.getSyncListDataNew ()
                     }else{
                      
                
                       this.syncListDialog=false
+                       // 清除定时器,停止请求
+                        if (this.syncListTimer) {
+                          clearInterval(this.syncListTimer);
+                          this.syncListTimer = null;
+                        }
                     }
                     
                     }else{
                       this.syncListDialog=false
+                       // 清除定时器,停止请求
+                      if (this.syncListTimer) {
+                        clearInterval(this.syncListTimer);
+                        this.syncListTimer = null;
+                      }
                     
                       this.$message.error(res.data.msg)
                     }
@@ -6560,6 +6587,9 @@ async saveLinkTab() {
    SyncbtnProGress(){
     this.syncListDialog=true
     this.getSyncListDataNew()
+     this.syncListTimer = setInterval(() => {
+      this.getSyncListDataNew();
+    }, 5000);
 
    },
    getSyncListDataNew(){
@@ -6578,6 +6608,46 @@ async saveLinkTab() {
                       this.syncListDataNew=[]
                     }
         });
+   },
+   //刷新 
+   refreshSyncList(id){
+    this.refreshListLoad=true
+         reFlush({ id}).then((res) => {
+
+        if(res.data.code==200){
+          this.$message.success(res.data.msg)
+                   this.getSyncListDataNew()
+                    }else{
+                     this.$message.error(res.data.msg)
+                    }
+        }).finally(()=>{
+          this.refreshListLoad=false
+        })
+
+   },
+   delSyncItem(id){
+        this.delSyncLoad=true
+
+       this.$confirm("是否删除该条数据" , {
+        distinguishCancelAndClose: true,
+        confirmButtonText: "删除",
+        cancelButtonText: "取消",
+      }).then(() => {
+       
+       
+
+         deleteRecord({ id}).then((res) => {
+
+        if(res.data.code==200){
+          this.$message.success(res.data.msg)
+                   this.getSyncListDataNew()
+                    }else{
+                     this.$message.error(res.data.msg)
+                    }
+        }).finally(()=>{
+          this.delSyncLoad=false
+        })
+      });
    }
   },
   watch: {