Răsfoiți Sursa

作业执行详情每五秒调用接口刷新页面

pm 11 luni în urmă
părinte
comite
b624498a38
1 a modificat fișierele cu 10 adăugiri și 7 ștergeri
  1. 10 7
      src/views/mes/job/jobplay/jobPlayDetail.vue

+ 10 - 7
src/views/mes/job/jobplay/jobPlayDetail.vue

@@ -176,17 +176,20 @@ export default {
       ticketPointsList: [],
     };
   },
-  mounted() {
-    this.getJobPlayInfo();
-  },
   // mounted() {
-  //   setInterval(() => {
-  //     this.getJobPlayInfo();
-  //   }, 5000);
+  //   localStorage.setItem('ticketId',this.$route.query.ticketId);
+  //   this.getJobPlayInfo();
   // },
+  mounted() {
+    const ticketId=this.$route.query.ticketId
+    localStorage.setItem('ticketId',ticketId);
+    setInterval(() => {
+      this.getJobPlayInfo();
+    }, 5000);
+  },
   methods: {
     getJobPlayInfo() {
-      const ticketId = this.$route.query.ticketId;
+      const ticketId = this.$route.query.ticketId?this.$route.query.ticketId:localStorage.getItem('ticketId')
       getJobPlayTicketInfo(ticketId).then((res) => {
         console.log(res, "作业执行详细信息");
         this.jobTicket = [res.data.jobTicket].map((item) => ({