Browse Source

bridgeMonitor time query

luyanan 6 years ago
parent
commit
2e916ce2a4

+ 20 - 5
src/views/bridgesConsole/bridgeMonitor/index.vue

@ -69,7 +69,7 @@ export default {
69 69
          return time.getTime() > Date.now()
70 70
        }
71 71
      },
72
      valueDate: this.formatTime(Date.now()).substring(0, 8),
72
      valueDate: this.formatTime(Date.now() + 8 * 60 * 60 * 1000).substring(0, 8),
73 73
      TimeVal: '000000',
74 74
      optionsTime: [],
75 75
      serverSeqArr: [],
@ -108,10 +108,22 @@ export default {
108 108
      var that = this
109 109
      that.optionsTime = []
110 110
      const nowHour = new Date().getHours()
111
      console.log(nowHour)
112
      if (nowHour > 0) {
113
        that.valueDate = this.formatTime(Date.now() + 8 * 60 * 60 * 1000).substring(0, 8)
114
      } else {
115
        that.valueDate = this.formatTime(Date.now() + 8 * 60 * 60 * 1000 - 1 * 60 * 60 * 1000).substring(0, 8)
116
      }
111 117
      for (let i = 0; i < 24; i++) {
112 118
        var num = (i < 10 ? ('0' + i) : i)
113
        var numpre = ((i - 1) < 10 ? ('0' + (i - 1)) : (i - 1))
114
        var oPt = {
119
        var numpre = ''
120
        var oPt = {}
121
        if (i > 0) {
122
          numpre = ((i - 1) < 10 ? ('0' + (i - 1)) : (i - 1))
123
        } else {
124
          numpre = 23
125
        }
126
        oPt = {
115 127
          value: `${num}0000`,
116 128
          label: `${num}:00:00 - ${num}:59:59`,
117 129
          disb: false
@ -119,9 +131,12 @@ export default {
119 131
        if (nowHour === i) {
120 132
          that.TimeVal = `${numpre}0000`
121 133
        }
122
        if (nowHour <= i && that.valueDate === that.formatTime(Date.now()).substring(0, 8)) {
134
        if (nowHour <= i && nowHour !== 0 && that.valueDate === that.formatTime(Date.now() + 8 * 60 * 60 * 1000).substring(0, 8)) {
123 135
          oPt.disb = true
124 136
        }
137
        if (nowHour === 0) {
138
          oPt.disb = false
139
        }
125 140
        that.optionsTime.push(oPt)
126 141
      }
127 142
    },
@ -153,7 +168,7 @@ export default {
153 168
      var eDate = that.formatTime(sDateForm + 8 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000).substring(0, 14)
154 169
      var arr = that.serverSeqArr
155 170
      var flag = false
156
      if (that.valueDate === that.formatTime(Date.now()).substring(0, 8)) {
171
      if (that.valueDate === that.formatTime(Date.now() + 8 * 60 * 60 * 1000).substring(0, 8)) {
157 172
        flag = true
158 173
      }
159 174
      if (arr === null || arr.length === 0) {

+ 1 - 1
src/views/layout/components/Navbar.vue

@ -32,7 +32,7 @@ export default {
32 32
    },
33 33
    logout() {
34 34
      this.$store.dispatch('LogOut').then(() => {
35
        location.reload() // 涓轰簡閲嶆柊瀹炰緥鍖杤ue-router瀵硅薄 閬垮厤bug
35
        location.reload() // 为了重新实例化vue-router对象 避免bug
36 36
      })
37 37
    }
38 38
  }