Explorar el Código

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

pm hace 11 meses
padre
commit
b624498a38
Se han modificado 1 ficheros con 10 adiciones y 7 borrados
  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) => ({