Browse Source

实时监控显示、历史监测进度条

luyanan 6 years ago
parent
commit
a37b4a61d1

+ 1 - 1
src/api/bridgeInfo.js

61
// 监测信息
61
// 监测信息
62
export function getMonitorByDay(params) {
62
export function getMonitorByDay(params) {
63
  return request({
63
  return request({
64
    url: '/ajax/collect/wave/server/day',
64
    url: '/ajax/collect/wave/server/dayTime',
65
    method: 'get',
65
    method: 'get',
66
    params
66
    params
67
  })
67
  })

+ 9 - 3
src/views/bridgesConsole/bridgeDetail/index.vue

29
        <el-card class="box-card block-group">
29
        <el-card class="box-card block-group">
30
          <div slot="header" class="block-title">
30
          <div slot="header" class="block-title">
31
            <span>实时监测</span>
31
            <span>实时监测</span>
32
            <el-button v-if="serverSeqArr.length" type="text" @click="updateDataList">刷新</el-button>
32
          </div>
33
          </div>
33
          <el-row class="line-chart-box" v-if="monitorList.length">
34
          <el-row class="line-chart-box" v-if="monitorList.length">
34
            <el-col :xs="24" :sm="24" :lg="24" v-for="item in monitorShowList" :key="item.index">
35
            <el-col :xs="24" :sm="24" :lg="24" v-for="item in monitorShowList" :key="item.index">
159
    if (this.bridgeId) {
160
    if (this.bridgeId) {
160
      this.serverSeqArr = queryInfo.queryServers(this.bridgeId, true)
161
      this.serverSeqArr = queryInfo.queryServers(this.bridgeId, true)
161
      if (this.serverSeqArr.length) {
162
      if (this.serverSeqArr.length) {
162
        this.getSysTime()
163
        this.getDangerList()
163
        this.updateDataList()
164
      }
164
      }
165
    }
165
    }
166
  },
166
  },
167
  methods: {
167
  methods: {
168
    updateDataList() {
169
      this.monitorList = []
170
      this.monitorCache = []
171
      this.getSysTime()
172
      this.getDangerList()
173
    },
168
    getDangerList() {
174
    getDangerList() {
169
      var arr = this.serverSeqArr
175
      var arr = this.serverSeqArr
170
      const param = {
176
      const param = {
192
        if (res.success && res.data && res.data.length > 0) {
198
        if (res.success && res.data && res.data.length > 0) {
193
          // that.sysTime = res.data + that.eastEightDistrict - (5 * 60 * 1000)
199
          // that.sysTime = res.data + that.eastEightDistrict - (5 * 60 * 1000)
194
          const nowt = parseTime(res.data[0].ctime, true, true)
200
          const nowt = parseTime(res.data[0].ctime, true, true)
195
          that.sysTime = (new Date(nowt)).getTime() + that.eastEightDistrict - 2 * 60 * 1000
201
          that.sysTime = (new Date(nowt)).getTime() + that.eastEightDistrict - 10 * 1000
196
          const localTime = new Date().getTime() + that.eastEightDistrict
202
          const localTime = new Date().getTime() + that.eastEightDistrict
197
          that.localTimeiv = localTime - that.sysTime
203
          that.localTimeiv = localTime - that.sysTime
198
          that.first_Q = true
204
          that.first_Q = true

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

3
    <el-card class="box-card block-group">
3
    <el-card class="box-card block-group">
4
      <div slot="header" class="block-title">
4
      <div slot="header" class="block-title">
5
          <el-date-picker
5
          <el-date-picker
6
            style="width: 200px;margin-right:15px"
6
            v-model="valueDate"
7
            v-model="valueDate"
8
            :editable="false"
7
            type="date"
9
            type="date"
8
            value-format="yyyyMMdd"
10
            value-format="yyyyMMdd"
9
            :picker-options="pickerOptions0"
11
            :picker-options="pickerOptions0"
10
            @change="changeDate">
12
            @change="changeDate">
11
          </el-date-picker>
13
          </el-date-picker>
12
          <!-- <el-date-picker
13
            v-model="dateRange"
14
            type="datetimerange"
15
            align="right"
16
            start-placeholder="开始日期"
17
            end-placeholder="结束日期"
18
            :default-time="['12:00:00', '08:00:00']">
19
          </el-date-picker> -->
14
          <el-select v-model="TimeVal">
15
            <el-option
16
              v-for="item in optionsTime"
17
              :key="item.value"
18
              :label="item.label"
19
              :value="item.value"
20
              @change="changeTimeRange">
21
            </el-option>
22
          </el-select>
20
          <el-button type="primary" @click="getMonitorByDay">查询</el-button>
23
          <el-button type="primary" @click="getMonitorByDay">查询</el-button>
21
      </div>
24
      </div>
22
      <el-row class="line-chart-box" v-if="alarmList.length">
23
        <el-col :xs="24" :sm="24" :lg="24" v-for="item in alarmShowList" :key="item.index">
25
      <el-row class="line-chart-box">
26
        <el-col :xs="24" :sm="24" :lg="24" v-for="item in alarmShowList" :key="item.index" v-if="alarmList.length">
24
          <lineChart :chartData="item" :historyM="historyM"></lineChart>
27
          <lineChart :chartData="item" :historyM="historyM"></lineChart>
25
        </el-col>
28
        </el-col>
29
        <div class="progress-box" v-if="progressShow">
30
          <span>正在加载 {{proBar}}%</span>
31
          <el-progress :text-inside="true" :stroke-width="18" :percentage="proBar"></el-progress>
32
        </div>
26
      </el-row>
33
      </el-row>
27
      <DefaultPage v-if="!alarmList.length"></DefaultPage>
34
      <DefaultPage v-if="!alarmList.length && !progressShow"></DefaultPage>
28
      <div class="pagination-container">
35
      <div class="pagination-container">
29
        <el-pagination
36
        <el-pagination
30
          background
37
          background
49
import lineChart from '../lineChart/LineChart'
56
import lineChart from '../lineChart/LineChart'
50
57
51
import DefaultPage from '@/components/DefaultPage'
58
import DefaultPage from '@/components/DefaultPage'
59
import NProgress from 'nprogress'
52
60
53
export default {
61
export default {
54
  data() {
62
  data() {
60
          return time.getTime() > Date.now() - 8.64e7
68
          return time.getTime() > Date.now() - 8.64e7
61
        }
69
        }
62
      },
70
      },
63
      valueDate: this.formatTime((new Date()).getTime() + ((8 - 24) * 60 * 60 * 1000)),
64
      dateRange: '',
71
      valueDate: this.formatTime(Date.now() - 8.64e7).substring(0, 8),
72
      TimeVal: '000000',
73
      optionsTime: [],
65
      serverSeqArr: [],
74
      serverSeqArr: [],
66
      alarmList: [],
75
      alarmList: [],
67
      monitorCache: [],
76
      monitorCache: [],
68
      pageSize: 2,
77
      pageSize: 2,
69
      pageNo: 1
78
      pageNo: 1,
79
      progressShow: false,
80
      proBar: 0
70
    }
81
    }
71
  },
82
  },
72
  components: {
83
  components: {
80
  },
91
  },
81
  created() {
92
  created() {
82
    this.bridgeId = Cookies.get('bridgeId')
93
    this.bridgeId = Cookies.get('bridgeId')
94
    this.optionsCreat()
83
    this.serverSeqArr = queryInfo.queryServers(this.bridgeId, true)
95
    this.serverSeqArr = queryInfo.queryServers(this.bridgeId, true)
84
    if (this.serverSeqArr.length) {
96
    if (this.serverSeqArr.length) {
85
      this.getMonitorByDay()
97
      this.getMonitorByDay()
86
    }
98
    }
87
  },
99
  },
88
  methods: {
100
  methods: {
101
    optionsCreat() {
102
      for (let i = 0; i < 24; i++) {
103
        var num = (i < 10 ? ('0' + i) : i)
104
        var oPt = {
105
          value: `${num}0000`,
106
          label: `${num}:00:00 - ${num}:59:59`
107
        }
108
        this.optionsTime.push(oPt)
109
      }
110
    },
89
    formatTime(time) {
111
    formatTime(time) {
90
      var d = new Date()
112
      var d = new Date()
91
      d.setTime(time)
113
      d.setTime(time)
92
      d = JSON.stringify(d).replace(/[^\d]/g, '').substring(0, 8)
114
      d = JSON.stringify(d).replace(/[^\d]/g, '')
93
      return d
115
      return d
94
    },
116
    },
117
    changeProgress() {
118
      var that = this
119
      var clearInt = setInterval(function() {
120
        that.proBar = that.proBar + parseInt((Math.random() * 10), 10)
121
        if (that.proBar >= 84) {
122
          that.proBar = 84
123
          clearInterval(clearInt)
124
        }
125
      }, 1000 * Math.random())
126
    },
95
    getMonitorByDay() {
127
    getMonitorByDay() {
128
      this.progressShow = true
129
      NProgress.start()
96
      var that = this
130
      var that = this
97
      var date = that.valueDate
131
      that.proBar = 0
132
      that.alarmList = []
133
      that.changeProgress()
134
      var sDate = that.valueDate + that.TimeVal
135
      var sDateForm = (new Date(parseTime(sDate, true, true))).getTime()
136
      var eDate = that.formatTime(sDateForm + 8 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000).substring(0, 14)
98
      var arr = this.serverSeqArr
137
      var arr = this.serverSeqArr
99
      getMonitorByDay({ seq: arr, day: date }).then(res => {
138
      getMonitorByDay({ seq: arr, begin: sDate, end: eDate }).then(res => {
139
        NProgress.inc()
100
        if (res.success && res.data) {
140
        if (res.success && res.data) {
141
          this.progressShow = false
101
          var monitorList = []
142
          var monitorList = []
102
          for (let i = 0; i < res.data.length; i++) {
143
          for (let i = 0; i < res.data.length; i++) {
103
            var str = res.data[i].cid
144
            var str = res.data[i].cid
128
    },
169
    },
129
    changeDate(val) {
170
    changeDate(val) {
130
      this.valueDate = val
171
      this.valueDate = val
131
      if (this.serverSeqArr.length) {
132
        this.getMonitorByDay()
133
      }
172
    },
173
    changeTimeRange(val) {
174
      this.TimeVal = val
134
    },
175
    },
135
    handleCurrentChange(val) {
176
    handleCurrentChange(val) {
136
      this.pageNo = val
177
      this.pageNo = val
147
    margin-left: 15px;
188
    margin-left: 15px;
148
  }
189
  }
149
}
190
}
191
.progress-box{
192
  width: 400px;
193
  padding: 80px;
194
  margin: auto;
195
  text-align: center;
196
  line-height: 40px;
197
  color:#999;
198
  font-size:13px;
199
}
150
</style>
200
</style>

+ 8 - 6
src/views/bridgesConsole/lineChart/LineChart.vue

106
        },
106
        },
107
        yAxis: {
107
        yAxis: {
108
          type: 'value',
108
          type: 'value',
109
          max: 8191,
110
          min: -8192
109
          max: 9000,
110
          min: -9000
111
        },
111
        },
112
        legend: {
112
        legend: {
113
          data: ['信号值']
113
          data: ['信号值']
143
          dataZoom: [
143
          dataZoom: [
144
            {
144
            {
145
              type: 'slider',
145
              type: 'slider',
146
              xAxisIndex: 0,
146
              show: true,
147
              xAxisIndex: [0],
147
              start: 0,
148
              start: 0,
148
              end: 100
149
              end: 100
149
            },
150
            },
150
            {
151
            {
151
              type: 'inside',
152
              type: 'inside',
152
              xAxisIndex: 0,
153
              xAxisIndex: [0],
153
              start: 0,
154
              start: 0,
154
              end: 100
155
              end: 100
155
            },
156
            },
156
            {
157
            {
157
              type: 'slider',
158
              type: 'slider',
158
              yAxisIndex: 0,
159
              show: true,
160
              yAxisIndex: [0],
159
              start: 0,
161
              start: 0,
160
              end: 100
162
              end: 100
161
            },
163
            },
162
            {
164
            {
163
              type: 'inside',
165
              type: 'inside',
164
              yAxisIndex: 0,
166
              yAxisIndex: [0],
165
              start: 0,
167
              start: 0,
166
              end: 100
168
              end: 100
167
            }
169
            }