Browse Source

实时监控 在系统时间的基础上延迟5分钟

luyanan 6 years ago
parent
commit
b093c11348

+ 5 - 9
src/views/bridgesConsole/bridgeDetail/components/BInfoDialog02.vue

@ -60,20 +60,13 @@ export default {
60 60
  data() {
61 61
    return {
62 62
      serverList: [],
63
      dialogW: '',
64
      bridgeId: '',
65
      bridgeName: '',
63
      dialogW: this.$parent.dialogW,
64
      bridgeName: this.$parent.bridgeName,
66 65
      dialogTableVisible: false,
67 66
      pageSize: 4,
68 67
      pageNo: 1
69 68
    }
70 69
  },
71
  created() {
72
    this.bridgeId = this.$parent.bridgeId
73
    this.bridgeName = this.$parent.bridgeName
74
    this.dialogW = this.$parent.dialogW
75
    this.serverList = queryInfo.queryServers(this.bridgeId)
76
  },
77 70
  computed: {
78 71
    serverShowList() {
79 72
      return this.serverList.slice((this.pageNo - 1) * this.pageSize, this.pageNo * this.pageSize)
@ -82,6 +75,9 @@ export default {
82 75
  methods: {
83 76
    handleCurrentChange(val) {
84 77
      this.pageNo = val
78
    },
79
    queryServerList() {
80
      this.serverList = queryInfo.queryServers(this.$parent.bridgeId)
85 81
    }
86 82
  }
87 83
}

+ 5 - 8
src/views/bridgesConsole/bridgeDetail/components/BInfoDialog03.vue

@ -59,19 +59,13 @@ export default {
59 59
  },
60 60
  data() {
61 61
    return {
62
      dialogW: '',
63
      deviceList: [],
64
      bridgeId: '',
62
      dialogW: this.$parent.dialogW,
63
      deviceList: this.$parent.deviceList,
65 64
      dialogTableVisible: false,
66 65
      pageSize: 4,
67 66
      pageNo: 1
68 67
    }
69 68
  },
70
  created() {
71
    this.bridgeId = this.$parent.bridgeId
72
    this.dialogW = this.$parent.dialogW
73
    this.deviceList = queryInfo.queryDevices(this.bridgeId)
74
  },
75 69
  computed: {
76 70
    deviceShowList() {
77 71
      return this.deviceList.slice((this.pageNo - 1) * this.pageSize, this.pageNo * this.pageSize)
@ -80,6 +74,9 @@ export default {
80 74
  methods: {
81 75
    handleCurrentChange(val) {
82 76
      this.pageNo = val
77
    },
78
    queryDeviceList() {
79
      this.deviceList = queryInfo.queryDevices(this.$parent.bridgeId)
83 80
    }
84 81
  }
85 82
}

+ 6 - 11
src/views/bridgesConsole/bridgeDetail/components/BInfoDialog04.vue

@ -62,23 +62,15 @@ export default {
62 62
  },
63 63
  data() {
64 64
    return {
65
      dialogW: '',
66
      bridgeId: '',
65
      dialogW: this.$parent.dialogW,
67 66
      transducerList: [],
68
      childCableMain: {},
69
      childAddr: {},
67
      childCableMain: this.$parent.cableMain,
68
      childAddr: this.$parent.addr,
70 69
      dialogTableVisible: false,
71 70
      pageSize: 4,
72 71
      pageNo: 1
73 72
    }
74 73
  },
75
  created() {
76
    this.childCableMain = this.$parent.cableMain
77
    this.childAddr = this.$parent.addr
78
    this.dialogW = this.$parent.dialogW
79
    this.bridgeId = this.$parent.bridgeId
80
    this.transducerList = queryInfo.queryTrans(this.bridgeId)
81
  },
82 74
  computed: {
83 75
    transducerShowList() {
84 76
      return this.transducerList.slice((this.pageNo - 1) * this.pageSize, this.pageNo * this.pageSize)
@ -87,6 +79,9 @@ export default {
87 79
  methods: {
88 80
    handleCurrentChange(val) {
89 81
      this.pageNo = val
82
    },
83
    queryTransList() {
84
      this.transducerList = queryInfo.queryTrans(this.$parent.bridgeId)
90 85
    }
91 86
  }
92 87
}

+ 7 - 3
src/views/bridgesConsole/bridgeDetail/components/updatePersonInfo.vue

@ -20,7 +20,7 @@
20 20
        </el-col>
21 21
        <el-col :span="12">
22 22
          <el-form-item label="联系电话" prop="phone">
23
            <el-input v-model="ruleForm.phone" placeholder="请填写联系电话"></el-input>
23
            <el-input v-model="ruleForm.phone" placeholder="请填写联系电话" maxlength="11"></el-input>
24 24
          </el-form-item>
25 25
        </el-col>
26 26
        <el-col :span="12">
@ -47,8 +47,12 @@ export default {
47 47
  data() {
48 48
    var validPhone = (rule, value, callback) => {
49 49
      const reg = /^1[3|4|5|7|8][0-9]\d{8}$/
50
      if (!reg.test(value)) {
51
        callback(new Error('请输入正确的手机号码'))
50
      if (value.length > 0) {
51
        if (!reg.test(value)) {
52
          callback(new Error('请输入正确的手机号码'))
53
        } else {
54
          callback()
55
        }
52 56
      } else {
53 57
        callback()
54 58
      }

+ 33 - 6
src/views/bridgesConsole/bridgeDetail/index.vue

@ -119,16 +119,29 @@ export default {
119 119
      addr: {},
120 120
      dangerList: '',
121 121
      serverSeqArr: [],
122
      serverList: [],
123
      deviceList: [],
124
      transducerList: [],
122 125
      monitorList: [],
123 126
      currentNo: 1,
124 127
      currentSize: 4,
125 128
      currentTime: '',
126 129
      sysTime: '',
130
      localTimeiv: '',
131
      eastEightDistrict: 8 * 60 * 60 * 1000,
127 132
      jishiTime: null,
128 133
      maxShowLength: 300,
129 134
      monitorCache: []
130 135
    }
131 136
  },
137
  watch: {
138
    '$route'(to, from) {
139
      if (!(to.path === '/bridgeHome/bridgeDetail')) {
140
        clearTimeout(this.jishiTime)
141
        this.jishiTime = null
142
      }
143
    }
144
  },
132 145
  computed: {
133 146
    monitorShowList() {
134 147
      return this.monitorList.slice((this.currentNo - 1) * this.currentSize, this.currentNo * this.currentSize)
@ -175,7 +188,9 @@ export default {
175 188
    getSysTime() {
176 189
      getSysTime().then(res => {
177 190
        if (res.success) {
178
          this.sysTime = res.data + (8 * 60 * 60 * 1000)
191
          this.sysTime = res.data + this.eastEightDistrict -(5 * 60 * 1000)
192
          const localTime = new Date().getTime() + this.eastEightDistrict
193
          this.localTimeiv = localTime - this.sysTime
179 194
          this.first_Q = true
180 195
          this.getTimingMonitor()
181 196
        }
@ -189,10 +204,11 @@ export default {
189 204
    },
190 205
    getTimingMonitor() {
191 206
      var that = this
192
      var preTime = 2 * 1000
207
      var preTime = 2 * 60 * 1000
193 208
      var arr = this.serverSeqArr
194 209
      var startTime = this.formatTime(this.first_Q ? (this.sysTime - preTime) : this.sysTime)
195 210
      var endTime = this.formatTime(this.sysTime)
211
      that.sysTime += 1000
196 212
      getMonitorByTime({ seq: arr, begin: startTime, end: endTime }).then(res => {
197 213
        var mCache = that.monitorCache
198 214
        var mList = []
@ -232,10 +248,18 @@ export default {
232 248
            }
233 249
          }
234 250
          that.monitorList = mList
235
          that.sysTime += 1000
236
          that.jishiTime = setTimeout(function() {
251
          var st = new Date().getTime() + that.eastEightDistrict - that.localTimeiv
252
          var iv = that.sysTime - st
253
          if (iv < 0) {
254
            iv = 1
255
          }
256
          // console.log('upNow:' + that.sysTime)
257
          // console.log('now:' + st)
258
          // console.log('interval:' + iv)
259
          // console.log(typeof(iv))
260
          that.jishiTime = setTimeout(() => {
237 261
            that.getTimingMonitor()
238
          }, 1000)
262
          }, iv)
239 263
        }
240 264
      })
241 265
    },
@ -276,17 +300,20 @@ export default {
276 300
      this.$refs.BInfoDialog01.dialogTableVisible = true
277 301
    },
278 302
    queryServerInfo() {
303
      this.$refs.BInfoDialog02.queryServerList()
279 304
      this.$refs.BInfoDialog02.dialogTableVisible = true
280 305
    },
281 306
    queryBoxInfo() {
307
      this.$refs.BInfoDialog03.queryDeviceList()
282 308
      this.$refs.BInfoDialog03.dialogTableVisible = true
283 309
    },
284 310
    querySensorInfo() {
311
      this.$refs.BInfoDialog04.queryTransList()
285 312
      this.$refs.BInfoDialog04.dialogTableVisible = true
286 313
    },
287 314
    updatePersonInfo() {
288
      this.$refs.updatePersonInfo.dialogTableVisible = true
289 315
      this.$refs.updatePersonInfo.getUserSelf()
316
      this.$refs.updatePersonInfo.dialogTableVisible = true
290 317
    },
291 318
    updateLoginPwd() {
292 319
      this.$refs.updateLoginPwd.dialogTableVisible = true