فهرست منبع

feat: 手动测流后页面不刷新

hum 1 سال پیش
والد
کامیت
8943f1bb90
2فایلهای تغییر یافته به همراه25 افزوده شده و 3 حذف شده
  1. 24 2
      ruoyi-ui/src/views/analysis/task/waiting/manual.vue
  2. 1 1
      ruoyi-ui/src/views/analysis/task/waiting/simulation.vue

+ 24 - 2
ruoyi-ui/src/views/analysis/task/waiting/manual.vue

@@ -18,7 +18,7 @@
 <script>
 import {getSiteSection, listPlainPoint} from "@/api/site/berthing";
 import {getConfig} from "@/api/site/site";
-import {getWaterLevel, manualMeasure} from "@/api/analysis/achievement";
+import {getLatestTask, getWaterLevel, manualMeasure} from "@/api/analysis/achievement";
 import ChartList from '@/views/site/plain-point/chart-list';
 import Chart from '@/views/site/plain-point/chart';
 
@@ -117,10 +117,32 @@ export default {
         data.positions = this.plain.sections.filter((s) => this.plain.positions.includes(s.x));
       }
       manualMeasure(data).then(() => {
-        this.$message.success("加测指令下发成功");
+        if (this.notify) {
+          return this.$message.warning('请勿重复下发指令');
+        }
+        this.notify = this.$notify.success({
+          title: '成功',
+          message: '加测指令下发成功,收到测流开始指令后页面会自动跳转',
+          showClose: false,
+          duration: 0,
+        });
         this.dialogFormVisible = false;
+        this.checkStarting();
       });
+    },
+    checkStarting() {
+      getLatestTask(this.site.siteId).then((res) => {
+        if (res.data.status === 0) {
+          this.notify.close();
+          this.$emit('refresh');
+        } else {
+          this.timer = setTimeout(() => this.checkStarting(), 2e3)
+        }
+      })
     }
+  },
+  beforeDestroy() {
+    if(this.timer)clearTimeout(this.timer);
   }
 }
 </script>

+ 1 - 1
ruoyi-ui/src/views/analysis/task/waiting/simulation.vue

@@ -15,7 +15,7 @@
       </div>
     </div>
 
-    <Manual ref="manual" />
+    <Manual ref="manual" @refresh="$emit('refresh')" />
   </div>
 </template>