zhulizhen1111 4 anos atrás
pai
commit
ee72da4d0d
1 arquivos alterados com 22 adições e 13 exclusões
  1. 22 13
      src/views/strategy/index.vue

+ 22 - 13
src/views/strategy/index.vue

@@ -28,7 +28,8 @@
             <div class='starte-right'>
                 <p class='strate-right-title'>当前状态</p>
                 <water-unit :data='chillerOrg ' :type='1'></water-unit>
-                <animation-box ref="box"
+                <animation-box
+                    ref='box'
                     v-if='Object.keys(chillerCommand).length>=0||chillerHourList.length>=0'
                     :data='chillerOrg'
                     :chillerHourList='chillerHourList'
@@ -63,7 +64,7 @@ export default {
             chillerOrg: {},
             chillerHourList: [],
             idArr: [],
-            clearId:null,
+            clearId: null
         }
     },
     components: {
@@ -97,11 +98,11 @@ export default {
                 this.chillerOrg = res.chillerOrg || {}
                 this.chillerCommand = res.chillerCommand || {}
                 this.chillerHourList = res.chillerHourList || []
-                 if(Object.keys(this.chillerCommand).length>=0||this.chillerHourList.length>=0){
-                    let vm =this
-                    setTimeout(function(){
-                         vm.$refs.box.isShowDraw()
-                    },100) 
+                if (Object.keys(this.chillerCommand).length >= 0 || this.chillerHourList.length >= 0) {
+                    let vm = this
+                    setTimeout(function() {
+                        vm.$refs.box.isShowDraw()
+                    }, 100)
                 }
             })
         },
@@ -126,19 +127,27 @@ export default {
                     })
                 }
             })
+        },
+        whenMinutes() {
+            // 00 15 30 45
+            let minutes = new Date().getMinutes()
+            let arrs = ['00', '15', '30', '45']
+            arrs.forEach(el => {
+                if (el == minutes) {
+                    this.getChiller()
+                }
+            })
         }
     },
     mounted() {
         this.formatTime()
         let vm = this
-        this.clearId = setInterval(function(){
-           vm.getChiller()
-           vm.$refs.box.isShowDraw()
-        },1000*60)
+        this.clearId = setInterval(function() {
+            vm.whenMinutes()
+        }, 1000 * 60)
         this.getChiller()
-       
     },
-    destroyed(){
+    destroyed() {
         window.clearInterval(this.clearId)
     }
 }