工业级运维app手机api
fengxiang
2017-09-21 6af76482cc57d2c59a44a2fe0ffec903987b7944
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
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
<!DOCTYPE html>
<html lang="en">
 
<head>
 
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
 
    <title>大屏系统后台任务数据</title>
 
    <!-- Bootstrap Core CSS -->
    <link rel="stylesheet" type="text/css" href="../vendor/bootstrap/css/bootstrap.min.css">
 
    <!-- MetisMenu CSS -->
    <link href="../vendor/metisMenu/metisMenu.min.css" rel="stylesheet">
 
    <!-- Custom CSS -->
    <link href="../dist/css/sb-admin-2.css" rel="stylesheet">
 
    <!-- Morris Charts CSS -->
    <link href="../vendor/morrisjs/morris.css" rel="stylesheet">
 
    <!-- Custom Fonts -->
    <link rel="stylesheet" type="text/css" href="../vendor/font-awesome/css/font-awesome.min.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/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
 
    <style type="text/css">
 
        .timeicon
        {
            background:url(../img/p.png) center right no-repeat;
        }
 
 
        button {
            height: 32px;
        }
 
 
    </style>
 
    <link rel="stylesheet" href="../ladda/dist/ladda-themeless.min.css">
    <link rel="stylesheet" href="../ladda/dist/ladda.css">
    <link rel="stylesheet" href="../ladda/css/prism.css">
 
</head>
 
<body>
    <div id="wrapper">
        <!-- Navigation -->
        <nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
            <div class="navbar-header">
                <button  class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="index.html">大屏系统后台任务数据</a>
            </div>
            <!-- /.navbar-header -->
 
            <ul class="nav navbar-top-links navbar-right">
                <li class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                        <i class="fa fa-user fa-fw"></i> <i class="fa fa-caret-down"></i>
                    </a>
                    <ul class="dropdown-menu dropdown-user">
                        <li><a href="#"><i class="fa fa-user fa-fw"></i> User Profile</a>
                        </li>
                        <li><a href="#"><i class="fa fa-gear fa-fw"></i> Settings</a>
                        </li>
                        <li class="divider"></li>
                        <li><a href="login.html"><i class="fa fa-sign-out fa-fw"></i> Logout</a>
                        </li>
                    </ul>
                    <!-- /.dropdown-user -->
                </li>
                <!-- /.dropdown -->
            </ul>
            <!-- /.navbar-top-links -->
 
            <div class="navbar-default sidebar" role="navigation">
                <div class="sidebar-nav navbar-collapse">
                    <ul class="nav" id="side-menu">
                        <li class="sidebar-search">
                            <div class="input-group custom-search-form">
                                <input type="text" class="form-control" placeholder="Search...">
                                <span class="input-group-btn">
                                <button class="btn btn-default" >
                                    <i class="fa fa-search"></i>
                                </button>
                            </span>
                            </div>
                            <!-- /input-group -->
                        </li>
                        <li>
                            <a href="index.html"><i class="fa fa-dashboard fa-fw"></i> 概况</a>
                        </li>
                        <li>
                            <a href="#"><i class="fa fa-bar-chart-o fa-fw"></i> 报表<span class="fa arrow"></span></a>
                            <ul class="nav nav-second-level">
                                <li>
                                    <a href="flot.html">系统设备</a>
                                </li>
                                <li>
<!--
                                    <a href="morris.html">Morris.js Charts</a>
-->
                                </li>
                            </ul>
                            <!-- /.nav-second-level -->
                        </li>
 
                        <li>
                            <a href="tables.html"><i class="fa fa-table fa-fw"></i> 表格<span class="fa arrow"></span></a>
                            <ul class="nav nav-second-level">
                                <li>
                                    <a href="alluser.html">所有用户</a>
                                </li>
                                <li>
                                    <a href="allequ.html">所有设备</a>
                                </li>
                                <li>
                                    <a href="allnotice.html">通知用户</a>
                                </li>
                                <li>
                                    <a href="allalarm.html">报警设备</a>
                                </li>
 
                            </ul>
                            <!-- /.nav-second-level -->
 
 
                        </li>
 
                    </ul>
                </div>
                <!-- /.sidebar-collapse -->
            </div>
            <!-- /.navbar-static-side -->
        </nav>
 
        <div id="page-wrapper">
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header">报表</h1>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            系统报警数据
                        </div>
                        <!-- /.panel-heading -->
                        <div class="panel-body">
                            <div id="toolbar"   >
                                <input id="stime"  class="timeicon"  type="text" style="display: inline-block; position: relative;height:32px;border:1px solid #cfcfcf;border-radius:4px;padding-top:0px"placeholder="&nbsp;&nbsp;&nbsp;起始时间" readonly >
                                </input>
                                --
                                <input id="etime"  class="timeicon"  type="text" style="display:inline-block;position: relative;height:32px;border:1px solid #cfcfcf;border-radius:4px;padding-top:0px"placeholder="&nbsp;&nbsp;&nbsp;结束时间" readonly>
                                </input>
 
                                <div class="btn-group btn-group-sm" >
                                    <button id="search_system_alarm"     class="btn btn-primary ladda-button" data-style="expand-right" data-color="blue" data-size="xs" >查询</button>
                                </div>
 
                            </div>
 
                            <div>
                                <div style="height:500px;margin-left:-90px;width: auto " id="system_alarm"></div>
                            </div>
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-12 -->
                <br>&nbsp;
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            设备报警数据
                        </div>
                        <!-- /.panel-heading -->
                        <div class="panel-body">
                            <div id="toolbarequ"   >
                                <input id="stimeequ"  class="timeicon"  type="text" style="display: inline-block; position: relative;height:32px;border:1px solid #cfcfcf;border-radius:4px;padding-top:0px"placeholder="&nbsp;&nbsp;&nbsp;起始时间" readonly >
                            </input>
                                --
                                <input id="etimeequ"  class="timeicon"  type="text" style="display:inline-block;position: relative;height:32px;border:1px solid #cfcfcf;border-radius:4px;padding-top:0px"placeholder="&nbsp;&nbsp;&nbsp;结束时间" readonly>
                                 </input>
 
                                <div   class="btn-group btn-group-sm" >
                                    <button     class="btn btn-default"><span id="equlistselect">选择设备</span></button>
                                    <button    class="btn btn-default dropdown-toggle"
                                            data-toggle="dropdown">
                                        <span class="caret"></span>
                                        <span class="sr-only">切换下拉菜单</span>
                                    </button>
                                    <ul  id="equlists" class="dropdown-menu" role="menu">
<!--
                                        <li name="abc"><a  href ="javascript:void(0)">设备一</a></li>
-->
                                    </ul>
                                </div>
 
                                <div class="btn-group btn-group-sm" >
                                    <button id="searchequ"     class="btn btn-default ladda-button" data-style="expand-right" data-color="blue" data-size="xs" >查询</button>
                                </div>
 
 
 
                            </div>
 
                            <div>
                                <div  style="height:500px;margin-left:-90px;width: auto " id="equalarm"></div>
                                <div  id="equalarm_tip" style="position:absolute;left: 600px;top:280px;">请输入查询条件进行查询</div>
                            </div>
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-6 -->
                <br>&nbsp;
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                           设备传感器历史数据
                        </div>
                        <!-- /.panel-heading -->
                        <div class="panel-body">
 
                            <div id="toolbarhistory"   >
                                <input id="stimehistory" class="timeicon"   type="text" style="display: inline-block; position: relative;height:32px;border:1px solid #cfcfcf;border-radius:4px;padding-top:0px"placeholder="&nbsp;&nbsp;&nbsp;起始时间" readonly >
                                </input>
                                --
                                <input id="etimehistory"  class="timeicon"  type="text" style="display:inline-block;position: relative;height:32px;border:1px solid #cfcfcf;border-radius:4px;padding-top:0px"placeholder="&nbsp;&nbsp;&nbsp;结束时间" readonly>
                               </input>
 
                                <div class="btn-group btn-group-sm" >
                                <button  id="equlisthistoryselect"   class="btn btn-default">选择设备</button>
                                <button  class="btn btn-default dropdown-toggle"
                                        data-toggle="dropdown">
                                    <span   class="caret"></span>
                                    <span class="sr-only">切换下拉菜单</span>
                                </button>
                                <ul id="equlisthistory" class="dropdown-menu" role="menu">
                                    <!--
                                          <li name="abc"><a  href ="javascript:void(0)">设备一</a></li>
  -->
                                </ul>
                            </div>
 
                                <div  class="btn-group btn-group-sm" >
                                    <button  id="sensorselect"   class="btn btn-default">选择传感器</button>
                                    <button  class="btn btn-default dropdown-toggle"
                                            data-toggle="dropdown">
                                        <span class="caret"></span>
                                        <span class="sr-only">切换下拉菜单</span>
                                    </button>
                                    <ul  id="sensor" class="dropdown-menu" role="menu">
                                        <!--<li name="abc"><a  href ="javascript:void(0)">设备一</a></li>
-->
                                    </ul>
                                </div>
 
                                <div class="btn-group btn-group-sm" >
                                    <button id="searchhistory"  class="btn btn-default ladda-button" data-style="expand-right" data-color="blue" data-size="xs" >查询</button>
                                </div>
                            </div>
 
                            <div >
                                <div  id="equhistory" style="height: 500px;margin-left:-90px;width: auto "></div>
                                <div  id="equhistory_tip" style="position:absolute;left: 600px;top:280px;">请输入查询条件进行查询</div>
 
                            </div>
 
 
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-6 -->
                <div class="col-lg-6">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            待定xxxxxxxx
                        </div>
                        <!-- /.panel-heading -->
                        <div class="panel-body">
                            <div class="flot-chart">
                                <div class="flot-chart-content" id="flot-line-chart-moving"></div>
                            </div>
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-6 -->
                <div class="col-lg-6">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            待定xxxxxxxx
                        </div>
                        <!-- /.panel-heading -->
                        <div class="panel-body">
                            <div class="flot-chart">
                                <div class="flot-chart-content" id="flot-bar-chart"></div>
                            </div>
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-6 -->
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            待定xxxxxxxx
                        </div>
                        <!-- /.panel-heading -->
                       <!-- <div class="panel-body">
                            <p>Flot is a pure JavaScript plotting library for jQuery, with a focus on simple usage, attractive looks, and interactive features. In SB Admin, we are using the most recent version of Flot along with a few plugins to enhance the user experience. The Flot plugins being used are the tooltip plugin for hoverable tooltips, and the resize plugin for fully responsive charts. The documentation for Flot Charts is available on their website, <a target="_blank" href="http://www.flotcharts.org/">http://www.flotcharts.org/</a>.</p>
                            <a target="_blank" class="btn btn-default btn-lg btn-block" href="http://www.baidu.com">View Flot Charts Documentation</a>
                        </div>-->
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-6 -->
            </div>
            <!-- /.row -->
 
            <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                                &times;
                            </button>
                            <h4 class="modal-title" id="myModalLabel">
                                提示
                            </h4>
                        </div>
                        <div class="modal-body">
                            请填写完整的查询条件
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                            </button>
                        </div>
                    </div>
                </div>
            </div>
 
        </div>
        <!-- /#page-wrapper -->
 
    </div>
    <!-- /#wrapper -->
 
    <!-- jQuery -->
    <script src="../vendor/jquery/jquery.min.js"></script>
 
    <!-- Bootstrap Core JavaScript -->
    <script src="../vendor/bootstrap/js/bootstrap.min.js"></script>
 
    <!-- Metis Menu Plugin JavaScript -->
    <script src="../vendor/metisMenu/metisMenu.min.js"></script>
 
    <!-- Flot Charts JavaScript -->
    <script src="../vendor/flot/excanvas.min.js"></script>
    <script src="../vendor/flot/jquery.flot.js"></script>
    <script src="../vendor/flot/jquery.flot.pie.js"></script>
    <script src="../vendor/flot/jquery.flot.resize.js"></script>
    <script src="../vendor/flot/jquery.flot.time.js"></script>
    <script src="../vendor/flot-tooltip/jquery.flot.tooltip.min.js"></script>
<!--
    <script src="../data/flot-data.js"></script>
-->
 
    <!-- Custom Theme JavaScript -->
    <script src="../dist/js/sb-admin-2.js"></script>
 
 
    <!--time-->
    <link rel="stylesheet" type="text/css" href="../date/jedate/skin/jedate.css">
    <script src="../date/jedate/jquery.jedate.min.js"></script>
 
    <script src="../echarts/echarts.common.min.js"></script>
 
    <script src="../ladda/dist/spin.min.js"></script>
    <script src="../ladda/dist/ladda.js"></script>
 
 
 
    <script>
 
        Ladda.bind('#search_system_alarm');
        Ladda.bind('#searchequ');
        Ladda.bind('#searchhistory');
 
        $(function (){
        // 系统报警数据初始化
        var systemalarmChart = echarts.init(document.getElementById('system_alarm'));
        optionsystemalarmChart = {
            /*  title: {
             text: '未来一周气温变化',
             subtext: '纯属虚构'
             },*/
            tooltip: {
                trigger: 'axis',
                formatter: function(params)
                {
 
 
                    var string=null;
                    var level=params[0].value;
                    if(level==1){
                        string=":三级"
                    }else if(level==2){
                        string=":二级"
                    }else if(level==3){
                        string=":一级"
                    }
                    return   params[0].name+'<br><span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color:#c23531"></span>'+params[0].seriesName+string;
                }
            },
            legend: {
                /* data:['最高气温']*/
            },
            toolbox: {
                show: true,
                feature: {
                    magicType: {type: ['line', 'bar']},
                },
                right:160
            },
            xAxis:  {
                type: 'category',
                boundaryGap: true,
                data: []
            },
            yAxis: {
                type: 'value',
                max:4,
                axisLabel: {
                    formatter: function (value, index) {
                        var date = new Date(value);
                        var texts = [];
                        if (index === 2) {
                            texts.push('三级');
                        }
                        if (index === 4) {
                            texts.push('二级');
                        }
                        if(index==6){
                            texts.push('一级');
                        }
                        return texts;
                    }
                }
                ,
                splitNumber:6
            },
            series: [
                {
                    name:'警报级别',
                    type:'bar',
                    itemStyle : {
                    /*    normal : {
                            lineStyle:{
                                color:'#00FF00'
                            }
                        }*/
                    },
                    data:[]
                }
            ]
        };
        $.ajax({
            type:'GET',
            url:'/alarmtime',/*复用,与首页报表用的同一请求*/
            dataType:'json',
            async:false,
            cache:false,
            success:function(data){
                optionsystemalarmChart.xAxis.data=data.xtime;
                optionsystemalarmChart.series[0].data=data.yvalue;
                systemalarmChart.setOption(optionsystemalarmChart);
            }
        });
 
 
        // 设备报警数据初始化
        var Equalarm = echarts.init(document.getElementById('equalarm'));
        optionEqualarm = {
            tooltip: {
                trigger: 'axis',
                formatter: function(params)
                {
                    var  val=  params[0].name;
                    var  s= val.split("_");
 
                    var string=null;
                    var level=params[0].value;
                    if(level==1){
                        string=":三级"
                    }else if(level==2){
                        string=":二级"
                    }else if(level==3){
                        string=":一级"
                    }
                    return   s[0]+'<br><span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color:#c23531"></span>'+params[0].seriesName+string+
                        '<br><span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color:#c23531"></span>'+s[1];
                }
            },
            legend: {
            },
            toolbox: {
                show: true,
                feature: {
                },
                right:160
            },
            xAxis:  {
                type: 'category',
                boundaryGap: true,
                data: [],
                axisLabel:{
                    formatter:function(val) {
                      var s  =val.split("_");
                        return s[0];
                    }
                }
            },
            yAxis: {
                type: 'value',
                max:4,
                axisLabel: {
                    formatter: function (value, index) {
                        var date = new Date(value);
                        var texts = [];
                        if (index === 2) {
                            texts.push('三级');
                        }
                        if (index === 4) {
                            texts.push('二级');
                        }
                        if(index==6){
                            texts.push('一级');
                        }
                        return texts;
                    }
                }
                ,
                splitNumber:6
            },
            series: [
                {
                    name:'警报级别',
                    type:'line',
                    itemStyle : {
                    },
                    data:[]
                }
            ]
        };
        Equalarm.setOption(optionEqualarm);
        /*设备列表初始化,传感器历史数据报表也一起初始化*/
        $.ajax({
            type:'GET',
            url:'/equlist',
            dataType:'json',
            async:false,
            cache:false,
            success:function(data){
                $("#equlists").html("");
                for(var i=0;i<data.length;i++){
                    $("#equlists").append('<li name="'+data[i].mac+'"><a  href ="javascript:void(0)">'+data[i].name+'</a></li>');
                }
 
                $("#equlisthistory").html("");
                for(var i=0;i<data.length;i++){
                    $("#equlisthistory").append('<li name="'+data[i].mac+'"><a  href ="javascript:void(0)">'+data[i].name+'</a></li>');
                }
 
            }
        });
 
 
        // 传感器历史数据
        var Equhistory = echarts.init(document.getElementById('equhistory'));
        optionhistory = {
            tooltip: {
                trigger: 'axis'
                /*,
                formatter: function(params)
                {
                    var string=null;
                    var level=params[0].value;
                    if(level==1){
                        string=":三级"
                    }else if(level==2){
                        string=":二级"
                    }else if(level==3){
                        string=":一级"
                    }
                    return   params[0].name+'<br>'+params[0].seriesName+string;
                }
                */
            },
            legend: {
            },
            toolbox: {
                show: true,
                feature: {
                },
                right:160
            },
            xAxis:  {
                type: 'category',
                boundaryGap: true,
                data: []
            },
            yAxis: {
                type: 'value',
                axisLabel: {
                    formatter:''
                }
            },
            series: [
                {
                    name:'',
                    type:'line',
                    itemStyle : {
                           normal : {
                         color:'#2a6cff',
                         lineStyle:{
                         color:'#2a6cff'
                         }
                         }
                    },
                    data:[]
                }
            ]
        };
        Equhistory.setOption(optionhistory);
 
 
        /*系统报警数据日期*/
        var start = {
            format: 'YYYY-MM-DD hh:mm:ss',
            minDate: '2016-06-16 23:59:59',
            ishmsVal: false,
            maxDate: $.nowDate({
                DD: 0
            }),
            choosefun: function(elem, val, date) {
                end.minDate = date; //开始日选好后,重置结束日的最小日期
                endDates();
            }
        };
        var end = {
            format: 'YYYY-MM-DD hh:mm:ss',
            minDate: $.nowDate({
                DD: 0
            }),
            maxDate: $.nowDate({
                DD: 0
            }),
            choosefun: function(elem, val, date) {
                start.maxDate = date; //将结束日的初始值设定为开始日的最大日期
            }
        };
        //日期联动
        function endDates() {
            //将结束日期的事件改成 false 即可
            end.trigger = false;
            $("#etime").jeDate(end);
        }
        $('#stime').jeDate(start);
        $('#etime').jeDate(end);
        /*设备报警数据日期*/
        var startequ = {
            format: 'YYYY-MM-DD hh:mm:ss',
            minDate: '2016-06-16 23:59:59',
            ishmsVal: false,
            maxDate: $.nowDate({
                DD: 0
            }),
            choosefun: function(elem, val, date) {
                endequ.minDate = date; //开始日选好后,重置结束日的最小日期
                endDatesequ();
            }
        };
        var endequ = {
            format: 'YYYY-MM-DD hh:mm:ss',
            minDate: $.nowDate({
                DD: 0
            }),
            maxDate: $.nowDate({
                DD: 0
            }),
            choosefun: function(elem, val, date) {
                startequ.maxDate = date; //将结束日的初始值设定为开始日的最大日期
            }
        };
        //日期联动
        function endDatesequ() {
            //将结束日期的事件改成 false 即可
            endequ.trigger = false;
            $("#etimeequ").jeDate(endequ);
        }
        $('#stimeequ').jeDate(startequ);
        $('#etimeequ').jeDate(endequ);
        /*设备传感器历史数据日期*/
        var starthistory = {
            format: 'YYYY-MM-DD hh:mm:ss',
            minDate: '2016-06-16 23:59:59',
            ishmsVal: false,
            maxDate: $.nowDate({
                DD: 0
            }),
            choosefun: function(elem, val, date) {
                endhistory.minDate = date; //开始日选好后,重置结束日的最小日期
                endDateshistory();
            }
        };
        var endhistory = {
            format: 'YYYY-MM-DD hh:mm:ss',
            minDate: $.nowDate({
                DD: 0
            }),
            maxDate: $.nowDate({
                DD: 0
            }),
            choosefun: function(elem, val, date) {
                starthistory.maxDate = date; //将结束日的初始值设定为开始日的最大日期
            }
        };
        //日期联动
        function endDateshistory() {
            endhistory.trigger = false;
            $("#etimehistory").jeDate(endhistory);
        }
        $('#stimehistory').jeDate(starthistory);
        $('#etimehistory').jeDate(endhistory);
 
 
 
        /*系统报警数据查询事件*/
        $('#search_system_alarm').bind("click",function () {
            var stime= $('#stime').val();
            var etime= $('#etime').val();
            if(stime==""||etime==""){
                Ladda.stopAll();
                $('#myModal').modal('show');
                return;
            }
            var data={stime:stime,etime:etime};
            $.ajax({
                type:'POST',
                url:'/alarmtimequery',
                contentType: "application/json;charset=UTF-8",
                data:JSON.stringify(data),
                dataType:'json',
                async:false,
                cache:false,
                success:function(data){
                    optionsystemalarmChart.xAxis.data=data.xtime;
                    optionsystemalarmChart.series[0].data=data.yvalue;
                    optionsystemalarmChart.series[0].type='bar';
                    optionsystemalarmChart.xAxis.boundaryGap=true;
                    systemalarmChart.setOption(optionsystemalarmChart);
                    Ladda.stopAll();
 
                }
            });
        })
 
 
 
         /*设备报警下拉框事件*/
            var equalarm_mac=null;
        $('#equlists li').bind('click', function(){
             var text =$(this).text();
             var s =$("#equlistselect").text(text);
             equalarm_mac=$(this).attr("name")
        });
 
        /*设备报警查询事件*/
        $('#searchequ').bind("click",function () {
            var stime= $('#stimeequ').val();
            var etime= $('#etimeequ').val();
            if(stime==""||etime==""||equalarm_mac==null){
                Ladda.stopAll();
                $('#myModal').modal('show');
                return;
            }
            var data={stime:stime,etime:etime,mac:equalarm_mac};
            $.ajax({
                type:'POST',
                url:'/equalarms',
                contentType: "application/json;charset=UTF-8",
                data:JSON.stringify(data),
                dataType:'json',
                async:true,
                cache:false,
                success:function(data){
                    var count=data.yvalue.length;
                    optionEqualarm.xAxis.data=data.xtime;
                    optionEqualarm.series[0].data=data.yvalue;
                    optionEqualarm.xAxis.boundaryGap=false;
                    Equalarm.setOption(optionEqualarm);
                    if(count==0){
                        $("#equalarm_tip").html("没有查询到相关的数据");
                    }else {
                        $("#equalarm_tip").html("");
                    }
                    Ladda.stopAll();
                }
            });
 
        })
 
 
            /*传感器历史记录下拉框事件*/
            var equhistory_mac=null;
            var equhistory_sensor=null;
            $('#equlisthistory li').bind('click', function(){
                var text =$(this).text();
                var s =$("#equlisthistoryselect").text(text);
                equhistory_mac=$(this).attr("name")
                /*根据mac联动传感器*/
                $.ajax({
                    type:'GET',
                    url:'/equsensor',
                    dataType:'json',
                    data:{mac:equhistory_mac},
                    async:false,
                    cache:false,
                    success:function(data){
                       /*动态生成二级下拉框的传感器*/
                       $("#sensor").html("");
                       $("#sensorselect").text("选择传感器");
                        for(var i=0;i<data.length;i++){
                            $("#sensor").append('<li><a  href ="javascript:void(0)">'+data[i].sensor+'</a></li>');
                        }
                    }
                });
                /*二级下拉框事件,先生成,再绑定*/
                $('#sensor li').bind('click', function(){
                    var text =$(this).text();
                    equhistory_sensor=text;
                    var s =$("#sensorselect").text(text);
                });
            });
 
            /*传感器历史查询记录*/
            $('#searchhistory').bind("click",function () {
            var stime= $('#stimehistory').val();
            var etime= $('#etimehistory').val();
 
                if(stime==""||etime==""||equhistory_mac==null||equhistory_sensor==null){
                    Ladda.stopAll();
                    $('#myModal').modal('show');
                    return;
                }
                /*查询历史记录*/
                var data={stime:stime,etime:etime,mac:equhistory_mac,sensor:equhistory_sensor}
                $.ajax({
                    type:'POST',
                    url:'/sensorhistory',
                    contentType: "application/json;charset=UTF-8",
                    data:JSON.stringify(data),
                    dataType:'json',
                    async:true,
                    cache:false,
                    success:function(data){
                        var count=data.yvalue.length;
                        optionhistory.xAxis.data=data.xtime;
                        optionhistory.series[0].data=data.yvalue;
                        optionhistory.series[0].name=data.sensor;
                        optionhistory.yAxis.axisLabel.formatter='{value}'+data.units;
                        optionhistory.xAxis.boundaryGap=false;
                        Equhistory.setOption(optionhistory);
                        if(count==0){
                            $("#equhistory_tip").html("没有查询到相关的数据");
                        }else {
                            $("#equhistory_tip").html("");
                        }
                        Ladda.stopAll();
                    }
                });
        })
        })
 
    </script>
 
 
</body>
 
</html>