Browse Source

侧弹的实时刷新

zhulizhen1111 4 years ago
parent
commit
cf44d4aa21
2 changed files with 21 additions and 18 deletions
  1. 12 0
      src/views/strategy/animationBox.vue
  2. 9 18
      src/views/strategy/index.vue

+ 12 - 0
src/views/strategy/animationBox.vue

@@ -76,6 +76,18 @@ export default {
         }
     },
     components: { bomBox, strategyLine },
+    mounted(){
+        this.isShowDraw()
+    },
+    methods:{
+        isShowDraw(){
+            if(this.chillerCommandQ.isNew){
+                this.showDraw = true
+            }else{
+                this.showDraw = false
+            }
+        }
+    },
     props: ['data', 'chillerHourList', 'chillerCommandQ']
 }
 </script>

+ 9 - 18
src/views/strategy/index.vue

@@ -62,7 +62,8 @@ export default {
             now: '',
             chillerOrg: {},
             chillerHourList: [],
-            idArr: []
+            idArr: [],
+            clearId:null,
         }
     },
     components: {
@@ -75,7 +76,6 @@ export default {
         lookSnapshot() {
             this.showTodayStrategy = true
             this.getData()
-            // console.log(this.$store.state);
         },
         formatTime() {
             let year = new Date().getFullYear()
@@ -83,13 +83,6 @@ export default {
             let date = new Date().getDate() >= 10 ? new Date().getDate() : '0' + new Date().getDate()
             return (this.today = year + '' + month + '' + date)
         },
-        getPer5Time() {
-            let now = new Date().getTime()
-            let datetime = now - 5 * 60 * 1000
-            let hours = new Date(datetime).getHours() < 10 ? '0' + new Date(datetime).getHours() : new Date(datetime).getHours()
-            let minute = new Date(datetime).getMinutes() < 10 ? '0' + new Date(datetime).getMinutes() : new Date(datetime).getMinutes()
-            return (this.now = hours + '' + minute)
-        },
         getChiller() {
             let params = {
                 getParams: {}
@@ -119,8 +112,6 @@ export default {
                     }
                 }
             }
-            console.log(this.$store.state.userInfo.userId)
-            // return
             getCommand(params).then(res => {
                 this.tableData = res.content ? res.content : []
                 if (this.tableData.length > 0) {
@@ -128,19 +119,19 @@ export default {
                         this.idArr.push(el.appealId)
                     })
                 }
-                console.log(this.tableData)
             })
         }
     },
     mounted() {
         this.formatTime()
-        this.getPer5Time()
-        // let vm = this
-        // setInterval(function(){
-        //    vm.getData()
-        // },1500)
-        // this.getQuickData();
+        let vm = this
+        this.clearId = setInterval(function(){
+           vm.getChiller()
+        },10000*60)
         this.getChiller()
+    },
+    destroyed(){
+        window.clearInterval(thius.clearId)
     }
 }
 </script>