浏览代码

演练/培训:下发后延迟刷新页面

jingyuanchao 1 年之前
父节点
当前提交
3cf5cd56b7
共有 2 个文件被更改,包括 19 次插入20 次删除
  1. 8 9
      src/views/core/drill/plan/index.vue
  2. 11 11
      src/views/core/edu/plan/index.vue

+ 8 - 9
src/views/core/drill/plan/index.vue

@@ -619,6 +619,11 @@ export default {
         this.loading = false;
       });
     },
+    delayFlush(time) {
+      setTimeout(() => {
+        this.getList()
+      }, time)
+    },
     //初始化与计划相关的角色信息
     initPlanRoleList() {
       listPlanRole({}).then((response) => {
@@ -917,9 +922,7 @@ export default {
           })
           .then(() => {
             publishPlan(row.id, 1);
-            setTimeout(() => {
-              this.getList()
-            }, 100)
+            this.delayFlush(1000);
           });
       } else {
         if (row.planStatus == 0) {
@@ -929,9 +932,7 @@ export default {
             (state) => {
               if (state == 0 || state == 1) {
                 publishPlan(row.id, state);
-                setTimeout(() => {
-                  this.getList()
-                }, 100)
+                this.delayFlush(1000);
               }
             },
             {
@@ -948,9 +949,7 @@ export default {
             })
             .then(() => {
               publishPlan(row.id, 0);
-              setTimeout(() => {
-                this.getList()
-              }, 100)
+              this.delayFlush(1000);
             });
         }
       }

+ 11 - 11
src/views/core/edu/plan/index.vue

@@ -997,9 +997,7 @@ export default {
           })
           .then(() => {
             publishPlan(row.id, 1);
-            setTimeout(() => {
-              this.getList()
-            }, 100)
+            this.delayFlush(1000)
           });
       } else {
         if (row.planStatus == 0) {
@@ -1009,9 +1007,7 @@ export default {
             (state) => {
               if (state == 0 || state == 1) {
                 publishPlan(row.id, state);
-                setTimeout(() => {
-                  this.getList()
-                }, 100)
+                this.delayFlush(1000)
               }
             },
             {
@@ -1028,13 +1024,17 @@ export default {
             })
             .then(() => {
               publishPlan(row.id, 0);
-              setTimeout(() => {
-                this.getList()
-              }, 100)
+              this.delayFlush(1000)
             });
         }
       }
     },
+
+    delayFlush(time) {
+      setTimeout(() => {
+        this.getList()
+      }, time)
+    },
     getMsgStr(row, type) {
       let str = "是否确认" + type + "该计划?";
       if (row.standard == 1) {
@@ -1049,8 +1049,8 @@ export default {
       if (row.planCycle == 0) {
         if (row.done == 1) {
           msg = '因存在已完成任务,无周期任务不允许撤回,如需删除下发任务请点击"删除"';
-          this.$alert(msg,'系统提示',{
-            confirmButtonText:"确认"
+          this.$alert(msg, '系统提示', {
+            confirmButtonText: "确认"
           })
           return
         } else {