xiatian 5 ani în urmă
părinte
comite
245859edcf

+ 37 - 0
src/modules/reports/views/ComputeJobList.vue

@@ -102,6 +102,42 @@ export default {
     }
   },
   methods: {
+    getStatus() {
+      let doingIds = this.getDoingId();
+      if (doingIds != "") {
+        this.$httpWithoutBar
+          .get(TASK_API + "/reportsCompute/getList?ids=" + doingIds)
+          .then(response => {
+            response.data.forEach(element => {
+              this.tableData.forEach(e => {
+                if (e.id == element.id) {
+                  e.status = element.status;
+                  e.statusName = element.statusName;
+                  e.startTime = element.startTime;
+                  e.endTime = element.endTime;
+                  e.errorDesc = element.errorDesc;
+                }
+              });
+            });
+            setTimeout(() => {
+              this.getStatus();
+            }, 5000);
+          });
+      }
+    },
+    getDoingId() {
+      var tempData = [];
+      this.tableData.forEach(element => {
+        if (
+          element.status == "NONE" ||
+          element.status == "COMPUTING" ||
+          element.status == "STOPING"
+        ) {
+          tempData.push(element.id);
+        }
+      });
+      return tempData.join(",");
+    },
     back() {
       this.$router.push({
         path: "/reports/overview"
@@ -162,6 +198,7 @@ export default {
           this.$nextTick(function() {
             this.paginationShow = true;
           });
+          this.getStatus();
         })
         .finally(() => (this.loading = false));
     },

+ 33 - 0
src/modules/reports/views/Overview.vue

@@ -318,6 +318,38 @@ export default {
     }
   },
   methods: {
+    getStatus() {
+      let doingIds = this.getDoingId();
+      if (doingIds != "") {
+        this.$httpWithoutBar
+          .get(REPORTS_API + "/project/getProjectList?ids=" + doingIds)
+          .then(response => {
+            response.data.forEach(element => {
+              this.tableData.forEach(e => {
+                if (e.id == element.id) {
+                  e.reportStatus = element.reportStatus;
+                  e.reportStatusName = element.reportStatusName;
+                }
+              });
+            });
+            setTimeout(() => {
+              this.getStatus();
+            }, 5000);
+          });
+      }
+    },
+    getDoingId() {
+      var tempData = [];
+      this.tableData.forEach(element => {
+        if (
+          element.reportStatus == "WAITCOMPUTE" ||
+          element.reportStatus == "COMPUTING"
+        ) {
+          tempData.push(element.id);
+        }
+      });
+      return tempData.join(",");
+    },
     doCompute(row) {
       this.loading = true;
       let url = REPORTS_API + "/project/compute/" + row.id;
@@ -446,6 +478,7 @@ export default {
           this.$nextTick(function() {
             this.paginationShow = true;
           });
+          this.getStatus();
         })
         .finally(() => (this.loading = false));
     },

+ 33 - 0
src/modules/reports/views/Project.vue

@@ -378,6 +378,38 @@ export default {
     }
   },
   methods: {
+    getStatus() {
+      let doingIds = this.getDoingId();
+      if (doingIds != "") {
+        this.$httpWithoutBar
+          .get(REPORTS_API + "/project/getProjectList?ids=" + doingIds)
+          .then(response => {
+            response.data.forEach(element => {
+              this.tableData.forEach(e => {
+                if (e.id == element.id) {
+                  e.reportStatus = element.reportStatus;
+                  e.reportStatusName = element.reportStatusName;
+                }
+              });
+            });
+            setTimeout(() => {
+              this.getStatus();
+            }, 5000);
+          });
+      }
+    },
+    getDoingId() {
+      var tempData = [];
+      this.tableData.forEach(element => {
+        if (
+          element.reportStatus == "WAITCOMPUTE" ||
+          element.reportStatus == "COMPUTING"
+        ) {
+          tempData.push(element.id);
+        }
+      });
+      return tempData.join(",");
+    },
     deleteProject(row) {
       this.$confirm("确定删除?", "提示", {
         confirmButtonText: "确定",
@@ -551,6 +583,7 @@ export default {
           this.$nextTick(function() {
             this.paginationShow = true;
           });
+          this.getStatus();
         })
         .finally(() => (this.loading = false));
     },