index.vue
12.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
<template>
<div class="home_page">
<!-- 数据列表 开始 -->
<div class="static_list_box">
<!-- 总绑定数 开始 -->
<div class="cell_box">
<!-- 表头 开始 -->
<div class="head">
<span>总绑定数</span>
<el-tooltip class="item" effect="dark" placement="right-start">
<div slot="content">
<p>总绑定数:统计该账号权限下,车辆绑定总数</p>
<p>趋势图:统计该账号权限下,最近30天的日车辆绑定数趋势</p>
<p>今日绑定数:统计该账号权限下,今日车辆绑定数</p>
</div>
<i class="el-icon-question"></i>
</el-tooltip>
</div>
<!-- 表头 end -->
<!-- 数据 开始 -->
<div class="info_box">
<div class="title">{{staticInfo.allBindNumber}}</div>
<div id="bindChart" class="c_canvas"></div>
<div class="footer">
今日绑定数:{{staticInfo.bindNumForToday}}
</div>
</div>
<!-- 数据 end -->
</div>
<!-- 总绑定数 end -->
<!-- 总激活数 开始 -->
<div class="cell_box">
<!-- 表头 开始 -->
<div class="head">
<span>总激活数</span>
<el-tooltip class="item" effect="dark" placement="right-start">
<div slot="content">
<p>总激活数:统计该账号权限下,有线设备和无线设备的激活数之和;</p>
<p>趋势图:统计该账号权限下,最近30天的日激活数趋势;</p>
<p>今日激活数:统计该账号权限下,今日有线设备和无线设备的激活数之和;</p>
</div>
<i class="el-icon-question"></i>
</el-tooltip>
</div>
<!-- 表头 end -->
<!-- 数据 开始 -->
<div class="info_box">
<div class="title">{{staticInfo.allActiveNumber}}</div>
<div id="activedChart" class="c_canvas"></div>
<div class="footer">
今日激活数:{{staticInfo.activeNumForToday}}
</div>
</div>
<!-- 数据 end -->
</div>
<!-- 总激活数 end -->
<!-- 设备在线数 开始 -->
<div class="cell_box">
<!-- 表头 开始 -->
<div class="head">
<span>设备在线数</span>
<el-tooltip class="item" effect="dark" placement="right-start">
<div slot="content">
<p>在线数 = 有线设备在线数 + 无线设备在线数</p>
<p>有线设备在线数:</p>
<p>
统计该账号权限下,在统计当日所有设备在线率情况,
<span>3天内(72小时内)</span>连接服务器即认为在线;
</p>
<p>无线设备在线数:</p>
<p>
统计该账号权限下,在统计当日所有设备在线率情况,
<span>3天内(72小时内)</span>连接服务器即认为在线;
</p>
<p>在线率 = 在线数 / 总激活数;</p>
<p>在线率只保留整数,四舍五入</p>
</div>
<i class="el-icon-question"></i>
</el-tooltip>
</div>
<!-- 表头 end -->
<!-- 数据 开始 -->
<div class="info_box">
<div class="title">{{staticInfo.onlineNumber}}</div>
<div id="onlineChart" class="c_canvas"></div>
<div class="footer">
设备在线率:{{staticInfo.onlineRate}}%
</div>
</div>
<!-- 数据 end -->
</div>
<!-- 设备在线数 end -->
<!-- 设备离线数 开始 -->
<div class="cell_box">
<!-- 表头 开始 -->
<div class="head">
<span>设备离线数</span>
<el-tooltip class="item" effect="dark" placement="right-start">
<div slot="content">
<p>离线数 = 有线设备离线数 + 无线设备离线数</p>
<p>有线设备离线数:</p>
<p>
统计该账号权限下,在统计当日所有设备在线率情况,
<span>3天内(72小时内)</span>
无连接服务器即认为离线;
</p>
<p>无线设备离线数:</p>
<p>
统计该账号权限下,在统计当日所有设备在线率情况,
<span>3天内(72小时内)</span>
无连接服务器即认为离线;
</p>
<p>离线率 = 离线数 / 总激活数;</p>
<p>离线率只保留整数,四舍五入</p>
<p v-if="isZhongli && staticInfo.offlineSnNum>0">确认{{staticInfo.offlineSnNum}}台设备加入白名单,不予统计</p>
</div>
<i class="el-icon-question"></i>
</el-tooltip>
</div>
<!-- 表头 end -->
<!-- 数据 开始 -->
<div class="info_box">
<div class="title">{{staticInfo.offlineNumber}}</div>
<div id="offlineChart" class="c_canvas"></div>
<div class="footer">
设备离线率:{{staticInfo.offlineRate}}%
</div>
</div>
<!-- 数据 end -->
</div>
<!-- 设备离线数 end -->
</div>
<!-- 数据列表 end -->
<!-- 常规报警 开始 -->
<div class="alarm_box">
<div class="head">常规报警</div>
<div class="alarm_list">
<!-- 防拆报警 开始 -->
<div class="cell" @click="linkToPage('/trialRun#/alarmCenter/tamper')">
<div class="title">
<img src="@/assets/images/stopicon.png" />
<span>防拆报警</span>
</div>
<div class="num">{{alarmInfo.tearDownAlarmCount}}</div>
</div>
<!-- 防拆报警 end -->
<!-- 离线预警 开始 -->
<div class="cell" @click="linkToPage('/trialRun#/alarmCenter/offline')">
<div class="title">
<img src="@/assets/images/off-lineicon.png" />
<span>离线预警</span>
</div>
<div class="num">{{alarmInfo.offLineAlarmCount}}</div>
</div>
<!-- 离线预警 end -->
<!-- 大数据研判警情 开始 -->
<div class="cell" @click="linkToPage('/trialRun#/alarmCenter/hadoop')">
<div class="title">
<img src="@/assets/images/equipmenticon.png" />
<span>大数据研判警情</span>
</div>
<div class="num">{{alarmInfo.stuJudgeAlarmCount}}</div>
</div>
<!-- 大数据研判警情 end -->
</div>
</div>
<!-- 常规报警 end -->
<!-- 设备激活趋势 开始 -->
<div class="alarm_box device_box">
<div class="head">
<span>设备激活趋势</span>
<div>
<el-button-group>
<el-button v-for="(item,index) in links" :key="index" :type="active == item.id?'success':'default'" @click="linkEvent(item)" size="mini">{{item.name}}</el-button>
</el-button-group>
</div>
</div>
<div class="chart_box">
<div class="chart_wrapper" id="activedChartBox"></div>
</div>
</div>
<!-- 设备激活趋势 开始 -->
</div>
</template>
<script>
import {
GET_HOME_DEVICENUMBER,
GET_HOME_ALARMNUMBER,
GET_HOME_ACTIVEDEVICEINFO,
GET_HOME_AUTHUSERORG,
GET_HOME_NEWBINDDEVICEINFO,
} from "@/services/home";
//import chartConfig from "@/chart/chartConfig.js";
import * as echarts from "echarts";
export default {
data() {
return {
links: [
{ name: "今天", id: 1 },
{ name: "昨天", id: 2 },
{ name: "近7天", id: 10 },
{ name: "本月", id: 5 },
{ name: "上月", id: 6 },
{ name: "近30日", id: 11 },
],
active: 2,
staticInfo: {},
alarmInfo: {},
isZhongli: false,
};
},
mounted() {
this.getStatic();
this.getAlarm();
this.getActived(this.createActivedLineChart);
this.getActived(this.createAllActivedLineChart, 11);
this.getBindEchart();
//GET_HOME_AUTHUSERORG().then((res) => {});
this.getRoles();
},
methods: {
// 切换日期
linkEvent(row) {
this.active = row.id;
this.getActived(this.createActivedLineChart);
},
// 获取统计数据
getStatic() {
GET_HOME_DEVICENUMBER().then((res) => {
let obj = res.data || {};
this.staticInfo = obj;
// 在线率
let m = [];
m.push({ value: 100 - obj.onlineRate, name: "" });
m.push({ value: obj.onlineRate, name: "" });
this.createBindChart("onlineChart", m);
// 离线率
let n = [];
n.push({ value: 100 - obj.offlineRate, name: "" });
n.push({ value: obj.offlineRate, name: "" });
this.createBindChart("offlineChart", n);
});
},
// 获取警情统计
getAlarm() {
GET_HOME_ALARMNUMBER().then((res) => {
this.alarmInfo = res.data || {};
});
},
// 获取设备激活趋势
getActived(callBack, id) {
let oParams = {};
oParams.period = id || this.active;
console.log(oParams);
GET_HOME_ACTIVEDEVICEINFO(oParams).then((res) => {
console.log(res);
if (res.code != 200) {
return false;
}
let m = res.data || [];
callBack(m);
});
},
// 创建设备激活趋势折线图
createActivedLineChart(m) {
let xAxis = [];
let yAxis = [];
m.map((k) => {
xAxis.push(k.activeDate);
yAxis.push(k.activeNumber);
});
var aChart = echarts.init(document.getElementById("activedChartBox"));
aChart.setOption({
tooltip: {
trigger: "axis",
},
xAxis: {
type: "category",
boundaryGap: false,
data: xAxis,
axisLabel: {
rotate: 45,
},
},
yAxis: {
type: "value",
minInterval:1
},
series: [
{
symbol: "none",
smooth: true,
data: yAxis,
type: "line",
areaStyle: {},
},
],
});
},
// 创建环形图表
createBindChart(id, data) {
var aChart = echarts.init(document.getElementById(id));
aChart.setOption({
tooltip: {
show: true,
formatter:'{c0}%'
},
legendHoverLink: false,
color:['#c0c0c0', '#0096fa', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc'],
series: [
{
type: "pie",
radius: ["40%", "70%"],
labelLine: {
show: false,
},
data: data,
},
],
});
},
// 页面跳转
linkToPage(path) {
let row = { alarmStatus: 1 };
history.pushState(row, "", path);
},
// 获取总绑定数报表
getBindEchart() {
GET_HOME_NEWBINDDEVICEINFO().then((res) => {
let obj = res.data || [];
let xAxis = [];
let yAxis = [];
obj.map((k) => {
xAxis.push(k.bindDate);
yAxis.push(k.bindDeviceNumber);
});
this.createLineChart("bindChart", xAxis, yAxis);
});
},
// 创建折线图
createLineChart(id, xDate, yDate) {
var aChart = echarts.init(document.getElementById(id));
aChart.setOption({
tooltip: {
trigger: "axis",
},
xAxis: {
show: false,
type: "category",
boundaryGap: false,
data: xDate,
},
yAxis: {
show: false,
type: "value",
},
series: [
{
symbol: "none",
smooth: true,
data: yDate,
type: "line",
areaStyle: {},
},
],
});
},
// 总激活数,折线图
createAllActivedLineChart(m) {
let xAxis = [];
let yAxis = [];
m.map((k) => {
xAxis.push(k.activeDate);
yAxis.push(k.activeNumber);
});
this.createLineChart("activedChart", xAxis, yAxis);
},
// 获取角色属性(针对仲利)
getRoles() {
GET_HOME_AUTHUSERORG().then((res) => {
this.isZhongli = res.data;
});
},
},
};
</script>
<style lang="scss" scoped>
@import "@/styles/home.scss";
</style>