-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalarm.html
484 lines (439 loc) · 17 KB
/
alarm.html
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
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.6 -->
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
<!-- daterange picker -->
<link rel="stylesheet" href="plugins/daterangepicker/daterangepicker.css">
<!-- bootstrap datepicker -->
<link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
<!-- iCheck for checkboxes and radio inputs -->
<link rel="stylesheet" href="plugins/iCheck/all.css">
<!-- Bootstrap Color Picker -->
<link rel="stylesheet" href="plugins/colorpicker/bootstrap-colorpicker.min.css">
<!-- Bootstrap time Picker -->
<link rel="stylesheet" href="plugins/timepicker/bootstrap-timepicker.min.css">
<!-- Select2 -->
<link rel="stylesheet" href="plugins/select2/select2.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="dist/css/AdminLTE.min.css">
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
<!-- DataTables -->
<link rel="stylesheet" href="plugins/datatables/dataTables.bootstrap.css">
<link rel="stylesheet" type="text/css" href="common/css/bootstrap-datetimepicker.min.css" />
<link rel="stylesheet" type="text/css" href="common/css/style.css" />
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<header class="main-header">
<!-- Logo -->
<a href="index.html" class="logo">
<!-- mini logo for sidebar mini 50x50 pixels -->
<!--<span class="logo-mini"><b>智慧院线云平台</b></span>-->
<!-- logo for regular state and mobile devices -->
<span class="logo-lg"><b>合利能智慧供热云平台</b></span>
</a>
<!-- Header Navbar: style can be found in header.less -->
<nav class="navbar navbar-static-top">
<!-- Sidebar toggle button-->
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
<span class="sr-only">Toggle navigation</span>
</a>
<!-- Navbar Right Menu -->
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<!-- Control Sidebar Toggle Button -->
<li>
<a href="#"><span class="header-time"></span></a>
</li>
<li>
<a href="#"><span class="header-tem">0</span>℃</a>
</li>
<li>
<a href="#"><span class="header-btn">退出</span></a>
</li>
</ul>
</div>
</nav>
</header>
<!-- Left side column. contains the logo and sidebar -->
<aside class="main-sidebar">
<!-- sidebar: style can be found in sidebar.less -->
<section class="sidebar">
<!-- Sidebar user panel -->
<div class="user-panel">
<!--<div class="pull-left image">
<img src="dist/img/user2-160x160.jpg" class="img-circle" alt="User Image">
</div>-->
<div class="info">
<p></p>
<a href="#"><i class="fa fa-circle text-green"></i> 在线</a>
</div>
</div>
<!-- sidebar menu: : style can be found in sidebar.less -->
<ul class="sidebar-menu">
<!--<li class="header">MAIN NAVIGATION</li>-->
<li class="treeview">
<a href="index.html">
<i class="fa fa-home"></i> <span>总布局图</span>
</a>
</li>
<li class="treeview">
<a href="#">
<i class="fa fa-files-o"></i>
<span>分布局图</span>
<span class="pull-right-container">
<i class="fa fa-angle-left pull-right"></i>
</span>
</a>
<ul class="treeview-menu">
<li><a href="area2.html"><i class="fa fa-circle-o"></i>精图小区</a></li>
<li><a href="area1.html"><i class="fa fa-circle-o"></i>金宸国际公寓</a></li>
<li><a href="area.html"><i class="fa fa-circle-o"></i>农光里中社区</a></li>
</ul>
</li>
<li class="active treeview" auth="1">
<a href="alarm.html">
<i class="fa fa-table"></i>
<span>设备报警</span>
</a>
</li>
</ul>
</section>
<!-- /.sidebar -->
</aside>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper" style="min-height: auto;">
<!-- Main content -->
<section class="content">
<!-- SELECT2 EXAMPLE -->
<div class="box box-default">
<div class="box-header with-border">
<div class="col-md-3">
<div class="form-group">
<label>开始时间:</label>
<div class="input-group date">
<div class="input-group-addon">
<i class="fa fa-calendar"></i>
</div>
<input type="text" class="form-control pull-right" id="start">
</div>
<!-- /.input group -->
</div>
<!-- /.form group -->
</div>
<div class="col-md-3">
<div class="form-group">
<label>结束时间:</label>
<div class="input-group date">
<div class="input-group-addon">
<i class="fa fa-calendar"></i>
</div>
<input type="text" class="form-control pull-right" id="end">
</div>
<!-- /.input group -->
</div>
<!-- /.form group -->
</div>
<!--<div class="col-md-3">
<div class="form-group">
<label>设备列表:</label>
<select class="form-control select2" id="devid" style="width: 100%;">
<option value="109" type="2">全部</option>
</select>
</div>
</div>-->
<div class="col-md-3">
<div class="form-group">
<label class="la">数据</label>
<button type="button" class="btn btn-success margin-5" id="alarm_btn">查询</button>
<!--<button type="button" class="btn btn-success margin-5" id="historylist_btn">分析</button>
<button type="button" class="btn btn-success margin-5" id="out_btn">导出</button>-->
<!-- /.input group -->
</div>
<!-- /.form group -->
</div>
</div>
<!-- /.box-header -->
<div class="box-body" style="padding: 10px 15px;">
<table id="example1" class="table table-bordered table-striped" style="width: 100%;">
<thead>
<tr>
<th>编号</th>
<th>设备名称</th>
<th>设备ID</th>
<th>停止时间</th>
<th>恢复时间</th>
<th>报警信息</th>
</tr>
</thead>
</table>
<div id="fenxi" style="display: none;">
<div class="row">
<div class="col-md-12">
此时间段内没有设备报警信息。
</div>
</div>
</div>
</div>
<!-- /.box -->
</section>
<!-- /.content -->
<section>
</section>
</div>
<!-- /.content-wrapper -->
<footer class="main-footer">
<strong>蔚蓝数据 Azure City (Beijing) Technologies Inc.</strong>
</footer>
</div>
<!-- ./wrapper -->
<!-- jQuery 2.2.3 -->
<script src="plugins/jQuery/jquery-2.2.3.min.js"></script>
<!-- Bootstrap 3.3.6 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- Select2 -->
<script src="plugins/select2/select2.full.min.js"></script>
<!-- InputMask -->
<script src="plugins/input-mask/jquery.inputmask.js"></script>
<script src="plugins/input-mask/jquery.inputmask.date.extensions.js"></script>
<script src="plugins/input-mask/jquery.inputmask.extensions.js"></script>
<!--datatables-->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- date-range-picker -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.11.2/moment.min.js"></script>
<script src="plugins/daterangepicker/daterangepicker.js"></script>
<!-- bootstrap datepicker -->
<!--<script src="plugins/datepicker/bootstrap-datepicker.js"></script>-->
<script src="common/js/bootstrap-datetimepicker.min.js" charset="UTF-8"></script>
<script src="common/js/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<!-- bootstrap color picker -->
<script src="plugins/colorpicker/bootstrap-colorpicker.min.js"></script>
<!-- bootstrap time picker -->
<script src="plugins/timepicker/bootstrap-timepicker.min.js"></script>
<!-- SlimScroll 1.3.0 -->
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- iCheck 1.0.1 -->
<script src="plugins/iCheck/icheck.min.js"></script>
<!-- FastClick -->
<script src="plugins/fastclick/fastclick.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<script type="text/javascript" src="http://echarts.baidu.com/gallery/vendors/echarts/echarts-all-3.js"></script>
<script src="common/js/shine.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="dist/js/demo.js"></script>
<script src="common/js/jquery.cookie.js" type="text/javascript"></script>
<script src="common/js/common.js" charset="UTF-8"></script>
<!-- Page script -->
<script>
var second = new Date().getTime();
//var _startTime = formatDateTime(new Date(second-(10*24*60*60*1000)));
var now = formatDateTime(new Date());
//动态设置最终时间
var theDate = new Date();
var _hour = theDate.getHours();
var _minute = theDate.getMinutes();
var _second = theDate.getSeconds();
var _year = theDate.getFullYear();
var _month = theDate.getMonth();
var _date = theDate.getDate();
if(_hour < 10) {
_hour = "0" + _hour
}
if(_minute < 10) {
_minute = "0" + _minute
}
if(_second < 10) {
_second = "0" + _second
}
_month = _month +1;
if(_month < 10) {
_month = "0" + _month;
}
if(_date < 10) {
_date = "0" + _date
}
var _startTimeY = "%22" + _year + "-01-01%2000:00:00%22";
var _startTimeM = "%22" + _year + "-" + _month + "-01%2000:00:00%22";
var _startTimeD = "%22" + _year + "-" + _month + "-" + _date + "%2000:00:00%22";
//var _endTime = _year + "-" + _month + "-" + _date + "%20" + _hour + ":" + _minute + ":" + _second ;
var _end = _year + "-" + _month + "-" + _date;
$(function() {
var id = GetQueryString("id");
$("#devid option[value='" + id + "']").attr("selected", "selected");
//滚动条
// $('#example1').slimScroll({
// width: 'auto', //可滚动区域宽度
// height: '476px', //可滚动区域高度
// size: '10px', //组件宽度
// });
//Date picker
$('#start').datetimepicker({
autoclose: true,
format: 'yyyy-mm-dd',
todayHighlight: true,
language: 'zh-CN',
minView: 2
});
$('#start').val(_end);
$('#end').datetimepicker({
autoclose: true,
format: 'yyyy-mm-dd',
todayHighlight: true,
language: 'zh-CN',
minView: 2
});
$('#end').val(_end);
var _startTime = $("#start").val();
_startTime = _startTime + " 00:00:00";
var _endTime = $("#end").val();
_endTime = _endTime + " 23:59:59";
alarmlist(_startTime, _endTime);
//数据按钮
$("#alarm_btn").click(function() {
var _startTime = $("#start").val();
_startTime = _startTime + " 00:00:00";
var _endTime = $("#end").val();
_endTime = _endTime + " 23:59:59";
var _devid = $("#devid").val();
var _devname = $("#devid").find("option:selected").text();
var _type = $("#devid").find("option:selected").attr("type");
if(_startTime == "" || _endTime == "") {
alert('开始日期或结束日期不能为空!');
return;
}
if(_endTime < _startTime) {
alert('结束日期不能小于开始日期!');
return;
}
// console.log(_devid, _startTime, _endTime, _devname);
$("#fenxi").hide();
$("#example1_wrapper").show();
alarmlist(_startTime, _endTime);
})
});
//报警列表
function alarmlist(startdate, enddate) {
$.ajax({
//要用post方式
type: "post",
//方法所在页面和方法名
url:'http://123.57.162.77:8083/WlcsInterface/ queryPoliceById?params={%22id%22:109,%22type%22:2,%22startTime%22:%22'+ startdate +'%22,%22endTime%22:%22'+ enddate +'%22,%22errData%22:%222%22}',
dataType: "jsonp",
jsonp: "jsonpCallback",
success: function(data) {
console.log(data);
if(data.data) {
$("#fenxi").hide();
$("#example1_wrapper").show();
$("#example1").show();
var datas = data.data.reverse();
//console.log(datas);
var a = [];
for(var i = 0; i < datas.length; i++) {
a[i] = {
'num': i+1,
'name': datas[i].devidName,
'id': datas[i].deviceId,
// 'settem': datas[i].setValue,
// 'alarmtem': datas[i].errorValue,
'alarmtime': datas[i].errorTime,
'recoverytime': datas[i].recoveryTime,
'alarminfo': datas[i].errorData
}
}
$('#example1').DataTable({
"paging": true, //是否显示分页,默认为true
"lengthChange": false, //是否显示数据显示条数,默认为true,当数据小于每页的条数时也不显示
"searching": false, //是否显示搜索,默认为true
"ordering": false, //是否显示列的排序,默认为true
"info": true, //是否显示表的信息,默认为true
"autoWidth": true, //是否启动计算列宽
"scrollX": true,
//"retrieve":true,
"destroy": true,
"language": {
lengthMenu: '<select class="form-control input-xsmall">' + '<option value="1">1</option>' + '<option value="10">10</option>' + '<option value="20">20</option>' + '<option value="30">30</option>' + '<option value="40">40</option>' + '<option value="50">50</option>' + '</select>条记录', //左上角的分页大小显示。
search: '<span class="label label-success">搜索:</span>', //右上角的搜索文本,可以写html标签
paginate: { //分页的样式内容。
previous: "上一页",
next: "下一页",
first: "第一页",
last: "最后"
},
zeroRecords: "没有内容", //table tbody内容为空时,tbody的内容。
//下面三者构成了总体的左下角的内容。
info: "总共_PAGES_ 页_TOTAL_ 条,显示第_START_ 到第 _END_ ", //,筛选之后得到 _TOTAL_ 条,初始_MAX_ 条 ,左下角的信息显示,大写的词为关键字。
infoEmpty: "0条记录", //筛选为空时左下角的显示。
infoFiltered: "" //筛选之后的左下角筛选提示,
},
"data": a,
"columns": [
{"data": "num"},
{"data": "name"},
{"data": "id"},
// {"data": "settem"},
// {"data": "alarmtem"},
{"data": "alarmtime"},
{"data": "recoverytime"},
{"data": "alarminfo"}
]
});
//$.fn.dataTable().fnReloadAjax();
} else {
$("#fenxi").show();
$("#example1_wrapper").hide();
$("#example1").hide();
}
},
error: function(err) {
console.log('系统连接错误,请重试!');
}
});
}
function formatDateTime(theDate) {
var _hour = theDate.getHours();
var _minute = theDate.getMinutes();
var _second = theDate.getSeconds();
var _year = theDate.getFullYear()
var _month = theDate.getMonth();
var _date = theDate.getDate();
if(_hour < 10) {
_hour = "0" + _hour;
}
if(_minute < 10) {
_minute = "0" + _minute;
}
if(_second < 10) {
_second = "0" + _second;
}
_month = _month +1;
if(_month < 10) {
_month = "0" + _month;
}
if(_date < 10) {
_date = "0" + _date;
}
return _year + "-" + _month + "-" + _date + " " + _hour + ":" + _minute + ":" + _second;
}
</script>
</body>
</html>