Browse Source

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

luyanan 6 years ago
parent
commit
b093c11348

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

60
  data() {
60
  data() {
61
    return {
61
    return {
62
      serverList: [],
62
      serverList: [],
63
      dialogW: '',
64
      bridgeId: '',
65
      bridgeName: '',
63
      dialogW: this.$parent.dialogW,
64
      bridgeName: this.$parent.bridgeName,
66
      dialogTableVisible: false,
65
      dialogTableVisible: false,
67
      pageSize: 4,
66
      pageSize: 4,
68
      pageNo: 1
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
  computed: {
70
  computed: {
78
    serverShowList() {
71
    serverShowList() {
79
      return this.serverList.slice((this.pageNo - 1) * this.pageSize, this.pageNo * this.pageSize)
72
      return this.serverList.slice((this.pageNo - 1) * this.pageSize, this.pageNo * this.pageSize)
82
  methods: {
75
  methods: {
83
    handleCurrentChange(val) {
76
    handleCurrentChange(val) {
84
      this.pageNo = val
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
  },
59
  },
60
  data() {
60
  data() {
61
    return {
61
    return {
62
      dialogW: '',
63
      deviceList: [],
64
      bridgeId: '',
62
      dialogW: this.$parent.dialogW,
63
      deviceList: this.$parent.deviceList,
65
      dialogTableVisible: false,
64
      dialogTableVisible: false,
66
      pageSize: 4,
65
      pageSize: 4,
67
      pageNo: 1
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
  computed: {
69
  computed: {
76
    deviceShowList() {
70
    deviceShowList() {
77
      return this.deviceList.slice((this.pageNo - 1) * this.pageSize, this.pageNo * this.pageSize)
71
      return this.deviceList.slice((this.pageNo - 1) * this.pageSize, this.pageNo * this.pageSize)
80
  methods: {
74
  methods: {
81
    handleCurrentChange(val) {
75
    handleCurrentChange(val) {
82
      this.pageNo = val
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
  },
62
  },
63
  data() {
63
  data() {
64
    return {
64
    return {
65
      dialogW: '',
66
      bridgeId: '',
65
      dialogW: this.$parent.dialogW,
67
      transducerList: [],
66
      transducerList: [],
68
      childCableMain: {},
69
      childAddr: {},
67
      childCableMain: this.$parent.cableMain,
68
      childAddr: this.$parent.addr,
70
      dialogTableVisible: false,
69
      dialogTableVisible: false,
71
      pageSize: 4,
70
      pageSize: 4,
72
      pageNo: 1
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
  computed: {
74
  computed: {
83
    transducerShowList() {
75
    transducerShowList() {
84
      return this.transducerList.slice((this.pageNo - 1) * this.pageSize, this.pageNo * this.pageSize)
76
      return this.transducerList.slice((this.pageNo - 1) * this.pageSize, this.pageNo * this.pageSize)
87
  methods: {
79
  methods: {
88
    handleCurrentChange(val) {
80
    handleCurrentChange(val) {
89
      this.pageNo = val
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
        </el-col>
20
        </el-col>
21
        <el-col :span="12">
21
        <el-col :span="12">
22
          <el-form-item label="联系电话" prop="phone">
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
          </el-form-item>
24
          </el-form-item>
25
        </el-col>
25
        </el-col>
26
        <el-col :span="12">
26
        <el-col :span="12">
47
  data() {
47
  data() {
48
    var validPhone = (rule, value, callback) => {
48
    var validPhone = (rule, value, callback) => {
49
      const reg = /^1[3|4|5|7|8][0-9]\d{8}$/
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
      } else {
56
      } else {
53
        callback()
57
        callback()
54
      }
58
      }

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

119
      addr: {},
119
      addr: {},
120
      dangerList: '',
120
      dangerList: '',
121
      serverSeqArr: [],
121
      serverSeqArr: [],
122
      serverList: [],
123
      deviceList: [],
124
      transducerList: [],
122
      monitorList: [],
125
      monitorList: [],
123
      currentNo: 1,
126
      currentNo: 1,
124
      currentSize: 4,
127
      currentSize: 4,
125
      currentTime: '',
128
      currentTime: '',
126
      sysTime: '',
129
      sysTime: '',
130
      localTimeiv: '',
131
      eastEightDistrict: 8 * 60 * 60 * 1000,
127
      jishiTime: null,
132
      jishiTime: null,
128
      maxShowLength: 300,
133
      maxShowLength: 300,
129
      monitorCache: []
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
  computed: {
145
  computed: {
133
    monitorShowList() {
146
    monitorShowList() {
134
      return this.monitorList.slice((this.currentNo - 1) * this.currentSize, this.currentNo * this.currentSize)
147
      return this.monitorList.slice((this.currentNo - 1) * this.currentSize, this.currentNo * this.currentSize)
175
    getSysTime() {
188
    getSysTime() {
176
      getSysTime().then(res => {
189
      getSysTime().then(res => {
177
        if (res.success) {
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
          this.first_Q = true
194
          this.first_Q = true
180
          this.getTimingMonitor()
195
          this.getTimingMonitor()
181
        }
196
        }
189
    },
204
    },
190
    getTimingMonitor() {
205
    getTimingMonitor() {
191
      var that = this
206
      var that = this
192
      var preTime = 2 * 1000
207
      var preTime = 2 * 60 * 1000
193
      var arr = this.serverSeqArr
208
      var arr = this.serverSeqArr
194
      var startTime = this.formatTime(this.first_Q ? (this.sysTime - preTime) : this.sysTime)
209
      var startTime = this.formatTime(this.first_Q ? (this.sysTime - preTime) : this.sysTime)
195
      var endTime = this.formatTime(this.sysTime)
210
      var endTime = this.formatTime(this.sysTime)
211
      that.sysTime += 1000
196
      getMonitorByTime({ seq: arr, begin: startTime, end: endTime }).then(res => {
212
      getMonitorByTime({ seq: arr, begin: startTime, end: endTime }).then(res => {
197
        var mCache = that.monitorCache
213
        var mCache = that.monitorCache
198
        var mList = []
214
        var mList = []
232
            }
248
            }
233
          }
249
          }
234
          that.monitorList = mList
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
            that.getTimingMonitor()
261
            that.getTimingMonitor()
238
          }, 1000)
262
          }, iv)
239
        }
263
        }
240
      })
264
      })
241
    },
265
    },
276
      this.$refs.BInfoDialog01.dialogTableVisible = true
300
      this.$refs.BInfoDialog01.dialogTableVisible = true
277
    },
301
    },
278
    queryServerInfo() {
302
    queryServerInfo() {
303
      this.$refs.BInfoDialog02.queryServerList()
279
      this.$refs.BInfoDialog02.dialogTableVisible = true
304
      this.$refs.BInfoDialog02.dialogTableVisible = true
280
    },
305
    },
281
    queryBoxInfo() {
306
    queryBoxInfo() {
307
      this.$refs.BInfoDialog03.queryDeviceList()
282
      this.$refs.BInfoDialog03.dialogTableVisible = true
308
      this.$refs.BInfoDialog03.dialogTableVisible = true
283
    },
309
    },
284
    querySensorInfo() {
310
    querySensorInfo() {
311
      this.$refs.BInfoDialog04.queryTransList()
285
      this.$refs.BInfoDialog04.dialogTableVisible = true
312
      this.$refs.BInfoDialog04.dialogTableVisible = true
286
    },
313
    },
287
    updatePersonInfo() {
314
    updatePersonInfo() {
288
      this.$refs.updatePersonInfo.dialogTableVisible = true
289
      this.$refs.updatePersonInfo.getUserSelf()
315
      this.$refs.updatePersonInfo.getUserSelf()
316
      this.$refs.updatePersonInfo.dialogTableVisible = true
290
    },
317
    },
291
    updateLoginPwd() {
318
    updateLoginPwd() {
292
      this.$refs.updateLoginPwd.dialogTableVisible = true
319
      this.$refs.updateLoginPwd.dialogTableVisible = true