819527061@qq.com
2024-01-15 53463931c4bd9ac826f268844e76d2bc40baa2cc
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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>唐山市烟草专卖局卷烟零售配送指挥调度平台</title>
<link href="css/index.css" rel="stylesheet" type="text/css">
<link href="css/public.css" rel="stylesheet" type="text/css">
<script src="js/jquery-1.11.1.min.js"></script> 
<script type="text/javascript" src="https://api.map.baidu.com/api?v=3.0&ak=H1RLDFX3oib78k9N9ocaB1Ac"></script>
<!-- <script type="text/javascript" src="https://api.map.baidu.com/api?v=1.0&services=true"></script> -->
<style type="text/css">
body, html {
    width: 100%;
    height: 100%;
    margin: 0;
    font-family: "微软雅黑";
}
.BMap_cpyCtrl {
    display: none;
}
.anchorBL {
    display: none;
}
 
table {font-family: verdana,arial,sans-serif;font-size:11px;color:#333333;border-width: 1px;border-color: #333;border-collapse: collapse;margin-left:10px;}
 
table th {border-width: 1px;padding: 8px;border-style: solid;border-color: #333;}
 
table td {border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;}
</style>
</head>
 
<body oncontextmenu=self.event.returnValue=false onselectstart="return false">
<div class="top">
  <div class="title">唐山市烟草专卖局卷烟零售配送指挥调度平台</div>
  <div class="nav"><a class="active" href="index.html">实时调度</a><a href="aqgl.html">安全管理</a><a href="psfx.html">配送分析</a><a href="zhfx.html">综合分析</a><a href="yhdz.html">一户多证</a></div>
</div>
<div class="Main"> 
  <!--顶部数据栏-->
  <div class="data">
    <div class="block">
      <div class="l-t"></div>
      <div class="l-b"></div>
      <div class="r-t"></div>
      <div class="r-b"></div>
      <div class="main1">
        <div><img src="images/icon_cl.png">
          <dl>
            <dt>车辆数 :</dt>
            <dd id="car">82</dd>
          </dl>
        </div>
        <div><img src="images/icon_jsy.png">
          <dl>
            <dt>驾驶员 :</dt>
            <dd id="user">82</dd>
          </dl>
        </div>
        <div><img src="images/icon_psy.png">
          <dl>
            <dt>配送员 :</dt>
            <dd id="user2">82</dd>
          </dl>
        </div>
      </div>
    </div>
    <div class="block">
      <div class="l-t"></div>
      <div class="l-b"></div>
      <div class="r-t"></div>
      <div class="r-b"></div>
      <div class="main2">
        <div><img src="images/icon_zyz.png">
          <dl>
            <dt>转运站 :</dt>
            <dd>3</dd>
          </dl>
        </div>
        <div><img src="images/icon_pqs.png">
          <dl>
            <dt>片区数 :</dt>
            <dd id="area">14</dd>
          </dl>
        </div>
        <div><img src="images/icon_shs.png">
          <dl>
            <dt>商户数 :</dt>
            <dd id="customer">500</dd>
          </dl>
        </div>
      </div>
    </div>
    <div class="block">
      <div class="l-t"></div>
      <div class="l-b"></div>
      <div class="r-t"></div>
      <div class="r-b"></div>
      <div class="main3">
        <div><img src="images/icon_cxcs.png">
          <dl>
            <dt>出车次数</dt>
            <dd id="out">100</dd>
          </dl>
        </div>
        <div><img src="images/icon_xslc.png">
          <dl>
            <dt>行驶里程</dt>
            <dd id="driving">20</dd>
          </dl>
        </div>
        <div><img src="images/icon_shbs.png">
          <dl>
            <dt>送货条数</dt>
            <dd id="num">1000</dd>
          </dl>
        </div>
        <div><img src="images/icon_dzqscs.png">
          <dl>
            <dt>电子签收次数</dt>
            <dd id="status">100</dd>
          </dl>
        </div>
      </div>
    </div>
    <div class="block">
      <div class="l-t"></div>
      <div class="l-b"></div>
      <div class="r-t"></div>
      <div class="r-b"></div>
      <div class="main4">
        <div><img src="images/icon_tzggts.png">
          <dl>
            <dt>通知公告条数</dt>
            <dd id="notice">500</dd>
          </dl>
        </div>
        <div><img src="images/icon_spjkcs.png">
          <dl>
          <!-- 视频监控次数 -->
            <dt>明日配送段数</dt>
            <dd id="video">1500</dd>
          </dl>
        </div>
        <div><img src="images/icon_ychjcs.png">
          <dl>
            <dt>远程呼叫次数</dt>
            <dd id="call">200</dd>
          </dl>
        </div>
        <div><img src="images/icon_sgyhpc.png">
          <dl>
            <dt>事故隐患排查</dt>
            <dd id="paiCha">50</dd>
          </dl>
        </div>
      </div>
    </div>
    <div class="block">
      <div class="l-t"></div>
      <div class="l-b"></div>
      <div class="r-t"></div>
      <div class="r-b"></div>
      <div class="main5">
        <div><img src="images/icon_xcxdlcs.png">
          <dl>
            <dt>小程序登录次数</dt>
            <dd id="wx">20</dd>
          </dl>
        </div>
        <div><img src="images/icon_xcxsyl.png">
          <dl>
            <dt>小程序使用率</dt>
            <dd id="wxRate">90%</dd>
          </dl>
        </div>
        <div><img src="images/icon_hdcs.png">
          <dl>
            <dt>互动次数</dt>
            <dd id="like">300</dd>
          </dl>
        </div>
        <div><img src="images/icon_hdl.png">
          <dl>
            <dt>互动率</dt>
            <dd id="likeRate">50%</dd>
          </dl>
        </div>
      </div>
    </div>
  </div>
  <div class="content"> 
    <!--今日配送任务-->
    <div class="task"> 
      <div class="l-t"></div>
      <div class="l-b"></div>
      <div class="r-t"></div>
      <div class="r-b"></div>
      <div class="title"><img src="images/icon_title.png"><span>今日配送任务</span>
          <input type="date" style="width:129px;" id="sendTime" onchange="timeChange()"></input>
      </div>
      <ul class="scroll_css" id="content1">
      </ul>
    </div>
    <div class="center"> 
      <!--中间数据栏-->
      <div class="c_data">
        <div class="block">
          <div class="l-t"></div>
          <div class="l-b"></div>
          <div class="r-t"></div>
          <div class="r-b"></div>
          <img src="images/icon_pscl.png">
          <div class="title">配送车辆</div>
          <dl onclick='table1()'>
            <dt>出发 :</dt>
            <dd id="outCar">2</dd>
          </dl>
          <dl onclick='taKanList()'>
            <dt>待踏勘 :</dt>
            <dd id="taKan">2</dd>
          </dl>
        </div>
        <div class="block">
          <div class="l-t"></div>
          <div class="l-b"></div>
          <div class="r-t"></div>
          <div class="r-b"></div>
          <img src="images/icon_pswd.png">
          <div class="title">配送网点</div>
          <dl onclick='table2()'>
            <dt>未送达 :</dt>
            <dd id="status0">2000</dd>
          </dl>
          <dl onclick='table7()'>
            <dt>总计 :</dt>
            <dd id="sumOrder">5000</dd>
          </dl>
        </div>
        <div class="block">
          <div class="l-t"></div>
          <div class="l-b"></div>
          <div class="r-t"></div>
          <div class="r-b"></div>
          <img src="images/icon_tsyj.png">
          <div class="title">特殊预警</div>
          <dl onclick='table4()'>
            <dt>异常签收 :</dt>
            <dd id="status2">0</dd>
          </dl>
          <dl onclick='table5()'>
            <dt>危险开启 :</dt>
            <dd id="open">2</dd>
          </dl>
        </div>
        <div class="block">
          <div class="l-t"></div>
          <div class="l-b"></div>
          <div class="r-t"></div>
          <div class="r-b"></div>
          <img src="images/icon_jrxh.png">
          <div class="title">今日新户</div>
          <dl onclick='table3()'>
            <dt>已配送 :</dt>
            <dd id="status1">10</dd>
          </dl>
          <dl onclick='table6()'>
            <dt>新增 :</dt>
            <dd id="addCustomer">50</dd>
          </dl>
        </div>
      </div>
      <!--地图-->
      <div class="map">
        <div class="l-t"></div>
        <div class="l-b"></div>
        <div class="r-t"></div>
        <div class="r-b"></div>
        <div class="cmd"><img onclick="back2()" class="Back" src="images/icon_back.png"><img class="Full" src="images/icon_full.png"></div>
        <div class="Content" id="allMap"></div>
      </div>
      <script>
        $(document).ready(function(){
          $(".Full").click(function(){
            $(".map").toggleClass("FullMap");
          });
        });
      </script>
    </div>
    <!--事件日志-->
    <div class="journal">
      <div class="l-t"></div>
      <div class="l-b"></div>
      <div class="r-t"></div>
      <div class="r-b"></div>
      <div class="title"><img src="images/icon_title.png"><span>事件日志</span></div>
      <ul class="scroll_css" id="content2">
      </ul>
    </div>
  </div>
</div>
<!--设置滚动条样式--> 
<script src="http://www.jq22.com/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="js/jquery.nicescroll.js"></script> 
<script type="text/javascript">
            $('.scroll_css').niceScroll({
                cursorcolor: "#999",//#CC0071 光标颜色
                cursoropacitymax: 0.4, //改变不透明度非常光标处于活动状态(scrollabar“可见”状态),范围从1到0
                touchbehavior: false, //使光标拖动滚动像在台式电脑触摸设备
                cursorwidth: "0.25rem", //像素光标的宽度
                cursorborder: "0", //     游标边框css定义
                cursorborderradius: "5px",//以像素为光标边界半径
                autohidemode: true //是否隐藏滚动条
            });
            
        </script> 
<!--危险开启视频弹层 已隐藏,使用时设置为显示即可-->
<div class="pop" style="display:none;" id="videoPop">
  <div class="main">
    <div class="l-t"></div>
    <div class="l-b"></div>
    <div class="r-t"></div>
    <div class="r-b"></div>
    <div class="close"><img src="images/icon_close.png" style="background-color:black"></div>
    <div class="full"><img src="images/icon_full.png"></div>
    <div class="video">
        <iframe src='' id="iframe1" class="video"></iframe>
    </div>
  </div>
</div>
 
<div class="pop" style="display:none;" id="videoPop2">
  <div class="main">
    <div class="l-t"></div>
    <div class="l-b"></div>
    <div class="r-t"></div>
    <div class="r-b"></div>
    <div class="close"><img src="images/icon_close.png"></div>
    <div class="full"><img src="images/icon_full.png"></div>
    <div class="video" style="overflow:scroll;">
        <table border="1" id="taKanList" style="margin-top:10px;color:white;font-size:14px;">
        </table>
    </div>
  </div>
</div>
</body>
<script>
    $(document).ready(function(){
      $(".pop .close").click(function(){
        $(".pop").css({"display":"none"});
      });
      $(".full").click(function(){
        $(".pop .main").toggleClass("FullVideo");
      });
    });
    
    
 // 百度地图API功能
    var map = new BMap.Map('allMap');
    var mapStyle ={
        features: ["road","building","water","land"],//隐藏地图上的"poi",
        style : 'midnight',
    };
    map.setMapStyle(mapStyle);
    //map.addControl(new BMap.NavigationControl());//设置放大缩小的控件
    map.centerAndZoom(new BMap.Point(118.187167,39.636514), 12);
    map.enableScrollWheelZoom(true);
    
    var mapType1 = new BMap.MapTypeControl({mapTypes: [BMAP_NORMAL_MAP,BMAP_HYBRID_MAP]});
 
    var mapType2 = new BMap.MapTypeControl({anchor: BMAP_ANCHOR_TOP_LEFT});
    var overView = new BMap.OverviewMapControl();
    var overViewOpen = new BMap.OverviewMapControl({isOpen:true, anchor: BMAP_ANCHOR_BOTTOM_RIGHT});
 
    map.addControl(mapType1);          //2D图,卫星图
 
    //var urls = "http://111.63.178.115:9091/xboot/";  //连上地址
    var urls = "/xboot/";
    //var url2 = "http://localhost:9999/";
    //var urls = "http://127.0.0.1:9091/xboot/";
    var url2 = "http://111.63.178.115:9091/index.html#/";  //连上地址
    //var url2 = "http://192.168.0.102:9091/index.html#/";  //连上地址
 
    $(function(){
        var args = getArgs();
        console.log(args,'args---')
        if(args.token){
            sessionStorage.setItem("token",args.token);
        }else{
          //window.location.href="http://111.63.178.115:9091/index.html#/login"
          // window.location.href="http://111.63.178.115:9091/index.html#/login"
          // if(!sessionStorage.getItem("token")){
          //   window.location.href="http://111.63.178.115:9091/index.html#/login"
          // }
            // if(!sessionStorage.getItem("token")){
            //     window.location.href="http://111.63.178.115:9091/index.html#/login"
            // }else if(sessionStorage.getItem("token")!=tk){
            //     window.location.href="http://111.63.178.115:9091/index.html#/login"
            // }
        }
        
        getIndex();
        getTodayTask();
        getEventLog();
        
        getAllCar();
        getTodayTask2();
        
        window.setInterval(function() {
            getIndex();
            getTodayTask();
            getTodayTask2();
        },1000*60*14)
        
        
        window.setInterval(function() {
            getEventLog();
        },1000*60*5)
        
        start1();
    });
    
    function getArgs(){
        var qs = (location.search.length > 0 ? location.search.substring(1) : ""),
            args = {},
            items = qs.length ? qs.split("&") : [],
            item = null, name = null,
            value = null, i = 0,
            len = items.length;
 
        for (i = 0; i < len; i++) {
            item = items[i].split("=");
            name = decodeURIComponent(item[0]);
            value = decodeURIComponent(item[1]);
            if (name.length) {
                args[name] = value;
            }
        }
        return args;
    }
    
    function timeChange(){
        getTodayTask();
    }
    
    var time1 = null;
    function start1(){
        time1 = window.setInterval(function() {
            getAllCar();
        },1000*60*4)
    }
    
    function end1(){
        clearInterval(time1);
    }
    
    var myIcon = new BMap.Icon("/images/car.png", new BMap.Size(50, 25));
    var myIcon2 = new BMap.Icon("/images/mk2.png", new BMap.Size(31, 36));
    
    var mks = [];
    
    function getAllCar(){
        clearMk();
        $.ajax({
            type: "get",
            url: urls+"pcStatistic/getCars",
            dataType: "json",
            headers: {'accessToken':sessionStorage.getItem("token")},
            success: function (data) {
                if(data.code==200){
                    var result = data.result.data;
                    for(var i=0;i<result.length;i++){
                        let lng = result[i].longitude/360000.0;
                        let lat = result[i].latitude/360000.0;
                        let db = bd_encrypt(lng,lat);
                        lng = db.bd_lng;
                        lat = db.bd_lat
                        
                        let carNo = result[i].plateNo;
                        let carCode = result[i].vehicleIndexCode+""
                        let time2 = result[i].time.substring(5,16)
                        let speed = result[i].speed/100000
                        
                        // 创建Marker标注,使用小车图标
                        let pt = new BMap.Point(lng,lat);
                        let marker = new BMap.Marker(pt, {
                            icon: myIcon
                        });
                        
                        // 将标注添加到地图
                        map.addOverlay(marker);
                        
                        // 创建信息窗口
                        let opts2 = {width: 100,height: 90,title: '车辆信息'};
                        let infoWindow = new BMap.InfoWindow("数据时间:"+time2+"<br>车速:"+speed+"km/h<br> <button onclick=\"video('"+carCode+"')\">视频画面</button>  ", opts2);
                        //<button onclick=\"video('"+carCode+"')\">视频画面</button> <button onclick=\"hujiao('"+carCode+"')\">一键呼叫</button>
                        //<a class=\"aaa\" href=\"https://111.63.178.115:1443/portal\" target=\"_blank\" rel=\"noreferrer\">视频画面</a>
                        // 点标记添加点击事件
                        marker.addEventListener('click', function () {
                            map.openInfoWindow(infoWindow, pt); // 开启信息窗口
                        });
                        
                        let opts = {
                            position: pt, // 指定文本标注所在的地理位置
                            offset: new BMap.Size(-28, -34) // 设置文本偏移量
                        };
                        // 创建文本标注对象
                        let label = new BMap.Label(carNo, opts);
                        // 自定义文本标注样式
                        label.setStyle({
                            color: 'blue',
                            borderColor: '#ccc',
                            fontSize: '12px',
                            fontFamily: '微软雅黑'
                        });
                        map.addOverlay(label);
                    }
                }
            }
        });
    }
    
    function clearMk(){
        map.clearOverlays();
    }
    
    function back2(){
        map.clearOverlays();
        getAllCar();
        start1();
    }
    
    function getCustomer(carNo){
        $.ajax({
            type: "get",
            url: urls+"pcStatistic/getOrderStatus?carNo="+carNo,
            dataType: "json",
            success: function (data) {
                
                if(data.code==200){
                    end1();
                    clearMk()
                    //map.centerAndZoom(new BMap.Point(118.187167,39.636514), 13);
                    
                    var result = data.result;
                    for(var i=0;i<result.length;i++){
                        var lng = result[i].areaName;
                        var lat = result[i].areaSectionName;
                        if(!lng){
                            continue;
                        }
                        var customerName = result[i].customerName;
                        var userName = result[i].code;
                        var img = result[i].img;
                        var id = result[i].id;
                        var status = result[i].status;
                        var times
                        if(result[i].updateTime){
                            times = result[i].updateTime.substring(11,16);
                        }
                        
                        
                        if(status==0){
                            let pt = new BMap.Point(lng,lat);
                            let marker = new BMap.Marker(pt);
                            map.addOverlay(marker);
                            
                            let sContent = '<h4 style="margin:0 0 5px 0;">'+customerName+':配送中</h4>'
                            let infoWindow = new BMap.InfoWindow(sContent);
                            // marker添加点击事件
                            marker.addEventListener('click', function () {
                                map.openInfoWindow(infoWindow, pt);
                            });
                        }else if(status==1){
                            let pt = new BMap.Point(lng,lat);
                            let marker = new BMap.Marker(pt, {
                                icon: myIcon2
                            });
                            map.addOverlay(marker);
                            
                            let sContent = '<h4 style="margin:0 0 5px 0;">'+customerName+'</h4>'+
                            '<img style="float:right;margin:0 4px 22px" id="'+id+'" src="'+img+'" width="139" height="104"/>'+
                            '<div style="margin:0;line-height:1.5;font-size:13px;">'+times+'<br>'+userName+'<br>已签收</div></div>';
                            let infoWindow = new BMap.InfoWindow(sContent);
                            // marker添加点击事件
                            marker.addEventListener('click', function () {
                                map.openInfoWindow(infoWindow, pt);
                                // 图片加载完毕重绘infoWindow
                                document.getElementById(id).onload = function () {
                                    infoWindow.redraw(); // 防止在网速较慢时生成的信息框高度比图片总高度小,导致图片部分被隐藏
                                };
                            });
                        }else{
                            let pt = new BMap.Point(lng,lat);
                            let marker = new BMap.Marker(pt, {
                                icon: myIcon2
                            });
                            map.addOverlay(marker);
                            
                            let sContent = '<h4 style="margin:0 0 5px 0;">'+customerName+'</h4>'+
                            '<div style="margin:0;line-height:1.5;font-size:13px;">'+result[i].remarks+'</div></div>';
                            let infoWindow = new BMap.InfoWindow(sContent);
                            marker.addEventListener('click', function () {
                                map.openInfoWindow(infoWindow, pt);
                            });
                        }
                    }
                }
            }
        });
    }
    
    function taKanList(){
        $("#videoPop2").show();
        $('#taKanList').html("");
        $.ajax({
            type: "get",
            url: urls+"pcStatistic/getTaKanList",
            dataType: "json",
            success: function (data) {
                if(data.code==200){
                    var list = data.result;
                    $('#taKanList').append("<tr><th>商户名称</th><th>录入时间</th><th>状态</th></tr>");
                    for(var i=0;i<list.length;i++){
                        var c = list[i]
                        $('#taKanList').append("<tr><th>"+c.name+"</th><th>"+c.createTime+"</th><th>待踏勘</th></tr>");
                    }
                    
                }
            }
        });
    }
    
    function video(carId){
        //$("#videoPop").show();
        //$('#iframe1').attr("src","/haiKang3.html");
        //$('#iframe1').attr("src","https://111.63.178.115:1443/portal");
        window.open("https://111.63.178.115:1443/portal/cas/loginPage?service=https://111.63.178.115:1443/portal")
        //<a href="https://111.63.178.115:1443/portal" target="_blank" rel="noreferrer">视频画面</a>
    }
    
    function hujiao(carId){
        //alert(carId);
    }
    
    function getIndex(){
        $.ajax({
            type: "get",
            url: urls+"pcStatistic/getIndex1",
            dataType: "json",
            headers: {'accessToken':sessionStorage.getItem("token")},
            success: function (data) {
                if(data.code==200){
                    var result = data.result;
                    $('#call').html(result.call);
                    $('#car').html(result.car);
                    $('#taKan').html(result.taKan);
                    $('#customer').html(result.customer);
                    $('#dept').html(result.dept);
                    $('#area').html(result.area);
                    $('#driving').html(parseInt(result.driving/10000)+"万");
                    $('#like').html(result.like);
                    $('#likeRate').html(result.likeRate+"%");
                    $('#notice').html(result.notice);
                    $('#num').html(parseInt(result.num/10000)+"万");
                    $('#out').html(result.out);
                    $('#outCar').html(result.outCar);
                    $('#paiCha').html(result.paiCha);
                    $('#status').html(result.status);
                    $('#user').html(result.user);
                    $('#user2').html(result.user2);
                    //$('#video').html(result.video);
                    $('#wxRate').html((parseInt((result.wxRate/result.customer)*100)+1)+"%");
                    $('#wx').html(parseInt(result.wx/10000)+"万");
                    $('#addCustomer').html(result.addCustomer);
                    $('#open').html(result.open);
                }else if(data.code==401) {
                   //window.location.href="http://111.63.178.115:9091/index.html#/login"
                }
            }
        });
    }
    
    function getTodayTask(){
        $("#content1").html("");
        let sendTime = $("#sendTime").val();
        $.ajax({
            type: "get",
            url: urls+"pcStatistic/getTodayTask?sendTime="+sendTime,
            dataType: "json",
            headers: {'accessToken':sessionStorage.getItem("token")},
            success: function (data) {
                if(data.code==200){
                    var sum=0;
                    var status0=0;
                    var status1 = 0;
                    for(var i=0;i<data.result.length;i++){
                        var area = data.result[i];
                        var ids = i+"-"+area.carNo;
                        if(area.level!=0){
                            var rate = 0;
                            if(area.num!=0){
                                rate = parseInt(((area.num-area.level)/area.num)*100);
                            }
                            $("#content1").append('<li id="'+ids+'"><div class="info"><span>'+area.carNo+'</span><span>'+area.areaName+'</span><span>'+area.areaSectionName+'</span></div><div class="value">'+rate+'%</div></li>')
                        }else{
                            $("#content1").append('<li id="'+ids+'"><div class="info"><span>'+area.carNo+'</span><span>'+area.areaName+'</span><span>'+area.areaSectionName+'</span></div><div class="value"><img src="images/icon_100.png"></div></li>');
                        }
                        sum+=area.num;
                        status0+=area.level
                        status1+=area.seq
                        
                        $("#"+ids).click(function(e){
                            var car = e.currentTarget.id;
                            var carNo = car.split("-");
                            if(carNo[1]=='null'){
                                /* alert("暂无数据") */
                            }else{
                                getCustomer(carNo[1])
                            }
                        });
                    }
                    
                    $('#sumOrder').html(sum);
                    $('#status0').html(status0);
                    $('#status1').html(sum-status0);
                    $('#status2').html(sum-status0-status1);
                    
                    
                    $(".task ul li").click(function(){
                         $(".task ul li").removeClass("focus");
                        $(this).addClass("focus");
                    });
                }
            }
        });
    }
    
    function getTodayTask2(){
        let day1 = new Date();
        day1.setDate(day1.getDate() + 1);
        let sendTime = day1.format("yyyy-MM-dd");
        //alert(sendTime)
        $.ajax({
            type: "get",
            url: urls+"pcStatistic/getTodayTask?sendTime="+sendTime,
            dataType: "json",
            headers: {'accessToken':sessionStorage.getItem("token")},
            success: function (data) {
                if(data.code==200){
                    $('#video').html(data.result.length);
                }
            }
        });
    }
    
    function getEventLog(){
        $("#content2").html("");
        let sendTime = $("#sendTime").val();
        $.ajax({
            type: "get",
            url: urls+"pcStatistic/getEventLog?sendTime="+sendTime,
            dataType: "json",
            headers: {'accessToken':sessionStorage.getItem("token")},
            success: function (data) {
                if(data.code==200){
                    for(let i=0;i<data.result.length;i++){
                        let area = data.result[i];
                        let time = area.createTime.substring(11,16)
                        if(area.type==6){
                            $("#content2").append('<li><div class="info"><span>'+time+'</span><span>'+area.carNo+'</span></div><div class="value">配送成功</div></li>')
                        }else{
                            let content = "";
                            if(area.type==1){
                                content = '疲劳驾驶';
                            }else if(area.type==2){
                                content = '接打电话';
                            }else if(area.type==3){
                                content = '不系安全带';
                            }else if(area.type==4){
                                content = '开车抽烟';
                            }else if(area.type==5){
                                content = '车厢异常开启';
                            }else if(area.type==7){
                                content = '超速';
                            }
                            
                            if(area.type==5){
                                $("#content2").append('<li onclick="eventImg2(&apos;'+area.refId+'&apos;)" class="info"><div class="info"><span>'+time+'</span><span>'+area.carNo+'</span></div><div class="value">'+content+'</div></li>');
                            }else{
                                $("#content2").append('<li id="'+area.refId+'" class="info"><div class="info"><span>'+time+'</span><span>'+area.carNo+'</span></div><div class="value">'+content+'</div></li>');
                                $("#"+area.refId).click(function(e){
                                    let refId = e.currentTarget.id;
                                    eventImg(refId)
                                });
                            }
                        }
                    }
                }
            }
        });
    }
    
    function eventImg2(id){
        $("#videoPop").show();
        $('#iframe1').attr("src","/test.html?"+id);
    }
    
    function eventImg(id){
        $("#videoPop").show();
        $.ajax({
            type: "get",
            url: urls+"pcStatistic/getAlarmByCarId?alarmId="+id,
            dataType: "json",
            headers: {'accessToken':sessionStorage.getItem("token")},
            success: function (data) {
                if(data.code==200){
                    if(data.result.code=='0'){
                        if(data.result.data.length>0){
                            $('#iframe1').attr("src","/test.html?"+data.result.data[0].thumbUrl);
                        }else{
                            $('#iframe1').attr("src","/test.html");
                        }
                    }else{
                        $('#iframe1').attr("src","/test.html");
                    }
                    //$('#iframe1').attr("src","/test.html?http://111.63.178.115:9091/img/yancao.1888c013.png");
                }else{
                    $('#iframe1').attr("src","/test.html");
                }
            }
        });
    }
    
    function bd_encrypt(gg_lng, gg_lat) {
        var X_PI = Math.PI * 3000.0 / 180.0;
        var x = gg_lng, y = gg_lat;
        var z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * X_PI);
        var theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * X_PI);
        var bd_lng = z * Math.cos(theta) + 0.013;
        var bd_lat = z * Math.sin(theta) + 0.007;
        return {
            bd_lat: bd_lat,
            bd_lng: bd_lng
        };
    }
    
    function table1(){
        $("#videoPop").show();
        $('#iframe1').attr("src",url2+"table1");
    }
    function table2(){
        $("#videoPop").show();
        $('#iframe1').attr("src",url2+"table2");
    }
    function table3(){
        $("#videoPop").show();
        $('#iframe1').attr("src",url2+"table3");
    }
    function table4(){
        $("#videoPop").show();
        $('#iframe1').attr("src",url2+"table4");
    }
    function table5(){
        $("#videoPop").show();
        $('#iframe1').attr("src",url2+"table5");
    }
    function table6(){
        $("#videoPop").show();
        $('#iframe1').attr("src",url2+"table6");
    }
    function table7(){
        $("#videoPop").show();
        $('#iframe1').attr("src",url2+"table7");
    }
    
    Date.prototype.format = function (fmt) {
        var o = {
            "M+": this.getMonth() + 1, //月份
            "d+": this.getDate(), //日
            "h+": this.getHours(), //小时
            "m+": this.getMinutes(), //分
            "s+": this.getSeconds(), //秒
            "q+": Math.floor((this.getMonth() + 3) / 3), //季度
            "S": this.getMilliseconds() //毫秒
        };
        if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (var k in o)
            if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
        return fmt;
    }
  </script>
</html>