zengh
2022-05-16 63ad2c3598400370dd7da5534659fd7e768a0a4a
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
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
/*
 * @Description:
 * @Version: 1.0
 * @Author: yangsx
 * @Date: 2019-12-09 19:01:40
 * @LastEditors: yangsx
 * @LastEditTime: 2019-12-14 14:44:57
 */
define([
    "dojo",
    "dojo/_base/declare",
    "dojo/_base/lang",
    "base/BaseWidget",
    "dojo/text!widgets/supervisoryMap/template.html",
    "base/AppEvent",
    "base/ConfigData",
    "widgets/supervisoryMap/config",
    "dojo/dom",
    "dojo/dom-construct",
    "dojo/dom-attr",
    "dojo/dom-style",
    "dojo/on",
    "esri/layers/ArcGISDynamicMapServiceLayer",
    "esri/layers/ArcGISTiledMapServiceLayer",
    "esri/layers/FeatureLayer",
    "controls/tab/TabControl",
    "esri/dijit/SymbolStyler",
    "esri/styles/basic",
    "dojo/_base/array",
    "esri/InfoTemplate",
    "esri/tasks/query",
    "esri/tasks/QueryTask",
    "esri/Color",
    "esri/toolbars/edit",
    "esri/graphic",
    "esri/geometry/Point",
    "esri/geometry/Polyline",
    "esri/geometry/Polygon",
    "esri/geometry/Extent",
    "esri/tasks/FeatureSet",
    "esri/renderers/HeatmapRenderer",
    "esri/symbols/SimpleLineSymbol",
    "esri/symbols/SimpleFillSymbol",
    "esri/symbols/PictureMarkerSymbol",
    "esri/symbols/SimpleMarkerSymbol",
    "esri/SpatialReference",
    "esri/tasks/GeometryService",
    "esri/tasks/ProjectParameters",
    "esri/layers/GraphicsLayer",
    "esri/layers/LabelLayer",
    "esri/symbols/TextSymbol",
    "esri/renderers/SimpleRenderer",
    "esri/renderers/ClassBreaksRenderer",
    "esri/tasks/Geoprocessor",
    "esri/tasks/DataFile",
    "esri/geometry/webMercatorUtils",
    "esri/symbols/Font",
    "esri/geometry/ScreenPoint",
    "esri/layers/ImageParameters",
    "esri/geometry/geometryEngine",
    "esri/dijit/PopupTemplate",
    "widgets/supervisoryMap/FlareClusterLayer_v3",
    "dojo/domReady!"
], function(
    dojo,
    declare,
    lang,
    BaseWidget,
    template,
    AppEvent,
    ConfigData,
    config,
    dom,
    domConstruct,
    domAttr,
    domStyle,
    on,
    ArcGISDynamicMapServiceLayer,
    ArcGISTiledMapServiceLayer,
    FeatureLayer,
    TabControl,
    SymbolStyler,
    basic,
    arrayUtils,
    InfoTemplate,
    Query,
    QueryTask,
    Color,
    Edit,
    Graphic,
    Point,
    Polyline,
    Polygon,
    Extent,
    FeatureSet,
    HeatmapRenderer,
    SimpleLineSymbol,
    SimpleFillSymbol,
    PictureMarkerSymbol,
    SimpleMarkerSymbol,
    SpatialReference,
    GeometryService,
    ProjectParameters,
    GraphicsLayer,
    LabelLayer,
    TextSymbol,
    SimpleRenderer,
    ClassBreaksRenderer,
    Geoprocessor,
    DataFile,
    webMercatorUtils,
    Font,
    ScreenPoint,
    ImageParameters,
    geometryEngine,
    PopupTemplate,
    FlareClusterLayer
) {
    var Widget = declare([BaseWidget], {
        widgetName: "AlertSecurity",
        label: "地图模式",
        templateString: template,
        _map: null,
        objThis: null,
        _siteLayer: new GraphicsLayer(),
        layuiLayer: null,
        layuiLadate: null,
        tabIndex: 0,
        heatmapfeatureLayer: null, //liu热力图
        // 保留添加实体图层的变量
        addEntitys: null,
        entitysData: [],
 
        // 巡逻区域或者巡逻路线的描述
        routeOrRegionDescribe: null,
 
        // 用来记录巡逻区域或者巡逻路线的下标的
        patrolIndex: 0,
 
        // 拖拽
        isDown: false,
        x: 0,
        y: 0,
        offset: null,
        moveThis: null,
        // 电子围栏需要新增的Id
        newElectronicFenceId: null,
 
        // 新增路线时,派发人员,人员名称,以及人员id
        peopleRealName: null,
        pepleRealId: null,
 
        //存放聚合实体
        clusterLayer: null,
        //左侧控制栏
        entityData: [],
        analysisAddEntitys: null,
        //防抖
        onceTimeMethodS: null,
        onceTime: 300,
        // 警情缓存
        Pdata: null,
        // 警情图标缓存
        Pdatas: null,
        //业主缓存
        Ydata: null,
        // 业主图标缓存
        Ydatas: null,
        //设备缓存
        Sdata: null,
        // 设备图标缓存
        Sdatas: null,
 
        constructor: function(options, srcRefNode) {
            this._map = options.map;
            objThis = this;
 
            this.addEntitys = new GraphicsLayer({
                id: 'addEntitys'
            });
 
            // 添加点面线的图层
            this.addPolygonEntitys = new GraphicsLayer({
                id: 'addPolygonEntitys'
            });
            // 添加所有图层的地方
            this.entityPolygonAll = new GraphicsLayer({
                id: 'entityPolygonAll'
            });
 
 
            this._map.addLayer(this.addEntitys);
 
 
            this._map.addLayer(this.addPolygonEntitys);
            this._map.addLayer(this.entityPolygonAll);
            this.analysisAddEntitys = new GraphicsLayer({ id: 'analysisAddEntitys' });
            // this.addOneEntitys = new GraphicsLayer({ id: 'addOneEntitys' });
            // this.addTwoEntitys = new GraphicsLayer({ id: 'addTwoEntitys' });
            // this.addThreeEntitys = new GraphicsLayer({ id: 'addThreeEntitys' });
 
            this._map.addLayer(this.analysisAddEntitys);
            this._map.addLayer(this.addOneEntitys);
 
        },
        open: function() {
            var that = this;
            $.ajax({
                url: "/api/equipment/equipment/listAll",
                type: 'get',
                dataType: 'JSON',
                success: function(res) {
                    var datas = res.data;
                    // console.log(datas)
                    var heatmapRenderer = null;
                    that.entityData = [];
                    for (var i = 0; i < datas.length; i++) {
                        datas[i].x = Number(datas[i].jd);
                        datas[i].y = Number(datas[i].wd);
                        that.entityData.push({
                            lgtd: Number(datas[i].jd),
                            lttd: Number(datas[i].wd)
                        })
                    }
                    that.flareClusterLayer(datas);
                    // console.log(datas)
                    that.heatmapfeatureLayer = that.heatmFeaLayers();
                    that._map.addLayer(that.heatmapfeatureLayer);
                    // that.checkBoxSelect();//左侧控制热力图重复
                }
            })
            var that = this;
            var intTime = () => {
                var time = this.getTime();
                $("#tabcontainer").css("width", "360px");
                $('#mapcontentClass').addClass('client-max-map'); //追加样式
                AppEvent.dispatchAppEvent(AppEvent.APPLICATION_RESIZE, {});
 
                that.tabIndex = 0;
                $('.analysis-and-judgment-tab li:eq(0)').addClass('on').siblings().removeClass('on');
                $($('.analysis-container > div')[0]).stop().show().siblings().stop().hide();
 
                that.heatmapfeatureLayer = that.heatmFeaLayers();
 
                that._map.addLayer(that.heatmapfeatureLayer);
                $('#analysis_select_time_start').val(time.tomorrow);
                $('#analysis_select_time_end').val(time.current);
 
                layui.use('laydate', function() {
                    that.layuiLadate = layui.laydate;
                    //执行一个laydate实例 开始
                    that.layuiLadate.render({
                        elem: '#analysis_select_time_start', //指定元素
                        type: "datetime",
                        format: 'yyyy-MM-dd HH:mm',
                        trigger: 'click'
                    });
                    // 结束
                    that.layuiLadate.render({
                        elem: '#analysis_select_time_end', //指定元素
                        type: "datetime",
                        format: 'yyyy-MM-dd HH:mm',
                        trigger: 'click'
                    });
                });
                that.getArea($('#policeArea'));
                // that.getPoliceTableAnalysis($('.analysis-container-police').find('.tbody tbody'), time.tomorrow, time.current, '', '');
                that.clickHand();
 
            }
            intTime();
        },
        startup: function() {
            var mySelf = this;
            objThis._map.addLayer(objThis._siteLayer);
            var that = this;
            // console.log(mySelf.clusterLayer)
            that.getEquipmentTable($('.analysis-container-equipment').find('.tbody tbody'), '', 'once');
            // 顶部tab得切换事件
            $('.analysis-and-judgment-tab li').click(function() {
                // if (that.tabIndex == $(this).index()) return;
                // if ($(this).index() == 1) { return };
                // if ($(this).index() == 2) { return };
 
                //解决打开热力图 切换top获取不了数据问题 警情
                if ($('#policeHeatMap').prop('checked') == true) {
                    // console.log($('#policeHeatMap').prop('checked') == true)
                    $('#policeHeatMap').prop('checked', false);
                    that.checkBoxSelect($('#policeHeatMap'));
                } else
                //解决打开热力图 切换top获取不了数据问题 业主
                if ($('#ownerHeatMap').prop('checked') == true) {
                    // console.log($('#ownerHeatMap').prop('checked') == true)
                    $('#ownerHeatMap').prop('checked', false);
                    that.checkBoxSelect($('#ownerHeatMap'));
                } else
                //解决打开热力图 切换top获取不了数据问题 设备
                if ($('#equipmentHeatMap').prop('checked') == true) {
                    // console.log($('#equipmentHeatMap').prop('checked') == true)
                    $('#equipmentHeatMap').prop('checked', false);
                    that.checkBoxSelect($('#equipmentHeatMap'));
                }
 
 
                // console.log($('#policeHeatMap').prop('checked') == true)
                if (that.entitysData.length > 0) {
                    that.analysisAddEntitys.clear();
                    that.entitysData = [];
                }
 
                if (that.heatmapfeatureLayer.graphics.length > 0) {
                    that.heatmapfeatureLayer.clear();
                    that.heatmapfeatureLayer.setRenderer();
                    $('.analysis-category input').prop('checked', false);
                }
 
 
 
                $(this).addClass('on').siblings().removeClass('on');
                var ind = $(this).index();
                $($('.analysis-container > div')[ind]).stop().show().siblings().stop().hide();
                var overText = $('#policeCategory > div:eq(0)').text().trim() == '全部' ? '' : $('#policeCategory > div:eq(0)').text().trim();
                var levelText = $('#policeArea > div:eq(0)').text().trim() == '全部' ? '' : $('#policeArea > div:eq(0)').attr('areaid');
                if (ind == 1) {
                    that.getArea($('#policeArea'));
                    that.getPoliceTableAnalysis($($('.analysis-container > div')[ind]).find('.tbody tbody'),
                        $('#analysis_select_time_start').val() + ':00',
                        $('#analysis_select_time_end').val() + ':00', overText, levelText)
                } else if (ind == 2) {
                    that.getOwnerType($('#ownerCategory'));
                    that.getOwnerDj($('#ownerLevel'), '');
                    that.getOwnerTable($($('.analysis-container > div')[ind]).find('.tbody tbody'), '', '');
                } else if (ind == 0) {
                    that.getEquipmentTable($($('.analysis-container > div')[ind]).find('.tbody tbody'), '');
                }
 
                that.tabIndex = $(this).index();
            })
 
            // 时间查询
            $('#policeSelectTime').off('click').click(function() {
 
                var times = $(this).prevAll();
 
                layui.use('layer', function() {
 
                    var layer = layui.layer;
                    // 开始时间
                    var startTime = $(times[2]).val();
                    // 结束时间
                    var endTime = $(times[0]).val();
 
                    if (startTime == '') {
 
                        layer.msg('请选择开始时间!', {
                            icon: 5,
                            time: 2000 //2秒关闭(如果不配置,默认是3秒)
                        });
                        return;
 
                    } else {
 
                        if (endTime == '') {
                            layer.msg('请选择结束时间!', {
                                icon: 5,
                                time: 2000 //2秒关闭(如果不配置,默认是3秒)
                            });
                            return;
                        } else {
 
                            var text = $('#policeCategory div:eq(0)').text().trim();
 
                            var levelText = $('#policeArea > div:eq(0)').text().trim() == '全部' ? '' : $('#policeArea > div:eq(0)').attr('areaid');
                            that.getPoliceTableAnalysis($('.analysis-container-police').find('.tbody tbody'), startTime, endTime, text == '全部' ? '' : text, levelText);
 
                        }
 
                    }
 
                })
 
 
 
 
            })
 
            // 警情列表中的点击事件
            $('.analysis-container-police .analysis-table-content .tbody').off('click', 'tr').on('click', 'tr', function(event) {
                if ($('#policeHeatMap').prop('checked') == true) { // 点击关闭热力图
                    // console.log('relitu')
                    $('#policeHeatMap').click();
                }
                var id = $(this).attr('term-list');
                var b = mySelf.Pdata;
                for (var key in b) {
                    if (b[key].id == id) {
                        b = b[key];
                        break;
                    }
                }
                // console.log(b, id);
                event.stopPropagation();
                var winSize = [+window.innerHeight / 2 - 242 + 'px', +window.innerWidth - 380 + 'px'];
 
                if (b.jd == '' || b.wd == '') {
                    // console.log('无地图经纬度');
                    b.haveJW = '无地图经纬度';
                } else {
                    // console.log('有地图经纬度')
                    b.haveJW = '有地图经纬度';
                    // var lgtd = Number($(this).find('input').attr('lgtd'));
                    // var lttd = Number($(this).find('input').attr('lttd'));
                    var lgtd = Number(b.jd);
                    var lttd = Number(b.wd);
                    // console.log($(this).find('input').attr('lttd'));
                    var position = new esri.geometry.Point(lgtd, lttd, new esri.SpatialReference({ wkid: 4326 })); //根据输入坐标信息找地图上的点
                    that._map.centerAndZoom(position, 18); //缩放,10是缩放级别,可以自定义,数值越大缩放越大
                }
                //解决重复JSON.stringify将循环结构转换为JSON。有几率出错,err:TypeError: Converting circular structure to JSON
                //舍弃上面方法,原因是对象里面嵌入对象,造成不能转换成JSON,吧对象去掉就好,
                var as = b;
                var setdata = JSON.stringify(as);
                // console.log(setdata,'setdata')
                var intOpen = () => {
                    layui.use('layer', function() {
                        that.layuiLayer = layui.layer;
                        that.layuiLayer.config({
                            extend: 'myskin/FlareClusterLayer.css'
                        });
                        that.layuiLayer.close(that.layuiLayer.index);
                        that.layuiLayer.open({
                            title: '',
                            type: 2,
                            shadeClose: true,
                            shade: false,
                            skin: 'demo-class',
                            id: 'onelyTwo',
                            maxmin: false, //开启最大化最小化按钮
                            area: ['360px', '484px'],
                            // area: 'auto',
                            offset: winSize,
                            skin: 'flare',
                            isOutAnim: false,
                            closeBtn: 2, //关闭按钮,可通过配置1和2来展示,0关闭
                            content: ['./popup/html/SupervisoryMapPdata.html'],
                            resize: false,
                            scrollbar: false,
                            // tipsMore: true, //允许多个tipe
                            // content: num,
                            success: function(layero, index) { //成功后添加全局点击关闭
                                $("#layui-layer-iframe" + index).contents().find("#sidIput").val(setdata);
 
                            },
                        })
                    })
                }
                if (mySelf.onceTimeMethod == null) { //防抖.限制时间内点击次数,否则会造成不能正确销毁前一个弹窗
                    intOpen();
                    mySelf.onceTimeMethod = setTimeout(() => {
                        mySelf.onceTimeMethod = null;
                    }, mySelf.onceTime);
                } else {};
            })
            $('.analysis-container-police .analysis-table-content .tbody').off('click', '.location').on('click', '.location', function(event) {
                event.stopPropagation();
            })
            $('.analysis-container-police .analysis-table-content .tbody').off('click', '.location input').on('click', '.location input', function(event) {
                event.stopPropagation();
                var lgtd = Number($(this).attr('lgtd'));
                var lttd = Number($(this).attr('lttd'));
                var position = new esri.geometry.Point(lgtd, lttd, new esri.SpatialReference({ wkid: 4326 })); //根据输入坐标信息找地图上的点
                that._map.centerAndZoom(position, 18); //缩放,10是缩放级别,可以自定义,数值越大缩放越大
            })
 
            // 业主列表中的点击事件
            $('.analysis-container-owner .analysis-table-content .tbody').off('click', 'tr').on('click', 'tr', function(event) {
                if ($('#ownerHeatMap').prop('checked') == true) { // 点击关闭热力图
                    // console.log('relitu')
                    $('#ownerHeatMap').click();
                }
                var id = $(this).attr('term-list');
                var b = mySelf.Ydata;
                for (var key in b) {
                    if (b[key].id == id) {
                        b = b[key];
                        break;
                    }
                }
 
                event.stopPropagation();
                if (b.jd == '' || b.wd == '') {
                    // console.log('无地图经纬度');
                    b.haveJW = '无地图经纬度';
                } else {
                    // console.log('有地图经纬度')
                    b.haveJW = '有地图经纬度';
                    var lgtd = Number(b.jd);
                    var lttd = Number(b.wd);
                    // console.log($(this).find('input').attr('lttd'));
                    var position = new esri.geometry.Point(lgtd, lttd, new esri.SpatialReference({ wkid: 4326 })); //根据输入坐标信息找地图上的点
                    that._map.centerAndZoom(position, 18); //缩放,10是缩放级别,可以自定义,数值越大缩放越大
                }
 
 
 
                // console.log(b, id);
                var winSize = [+window.innerHeight / 2 - 242 + 'px', +window.innerWidth - 380 + 'px'];
                var as = b;
                var bs = {};
                for (let key in as) {
                    if (typeof as[key] != 'object') {
                        bs[key] = as[key]
                            // as = as[key].attributes;
                            // console.log('youduixang ')
                            // break;
                    }
                }
                var setdata = JSON.stringify(bs);
                // console.log(setdata,'setdata')
                var intOpen = () => {
                    layui.use('layer', function() {
                        that.layuiLayer = layui.layer;
                        that.layuiLayer.config({
                            extend: 'myskin/FlareClusterLayer.css'
                        });
                        that.layuiLayer.close(that.layuiLayer.index);
                        that.layuiLayer.open({
                            title: '',
                            type: 2,
                            shadeClose: true,
                            shade: false,
                            skin: 'demo-class',
                            id: 'onelyTwo',
                            maxmin: false, //开启最大化最小化按钮
                            area: ['360px', '484px'],
                            // area: 'auto',
                            offset: winSize,
                            skin: 'flare',
                            isOutAnim: false,
                            closeBtn: 2, //关闭按钮,可通过配置1和2来展示,0关闭
                            content: ['./popup/html/SupervisoryMapYdata.html'],
                            resize: false,
                            scrollbar: false,
                            // tipsMore: true, //允许多个tipe
                            // content: num,
                            success: function(layero, index) { //成功后添加全局点击关闭
                                $("#layui-layer-iframe" + index).contents().find("#sidIput").val(setdata);
 
                            },
                        })
                    })
                }
                if (mySelf.onceTimeMethod == null) { //防抖.限制时间内点击次数,否则会造成不能正确销毁前一个弹窗
                    intOpen();
                    mySelf.onceTimeMethod = setTimeout(() => {
                        mySelf.onceTimeMethod = null;
                    }, mySelf.onceTime);
                } else {};
 
            })
            $('.analysis-container-owner .analysis-table-content .tbody').off('click', '.location').on('click', '.location', function(event) {
                event.stopPropagation();
            })
            $('.analysis-container-owner .analysis-table-content .tbody').off('click', '.location input').on('click', '.location input', function(event) {
                event.stopPropagation();
                var lgtd = Number($(this).attr('lgtd'));
                var lttd = Number($(this).attr('lttd'));
                var position = new esri.geometry.Point(lgtd, lttd, new esri.SpatialReference({ wkid: 4326 })); //根据输入坐标信息找地图上的点
                that._map.centerAndZoom(position, 18); //缩放,10是缩放级别,可以自定义,数值越大缩放越大
            })
 
            // 设备列表中的点击事件
            $('.analysis-container-equipment .analysis-table-content .tbody').off('click', 'tr').on('click', 'tr', function(event) {
                    var id = $(this).attr('term-listid');
                    if ($('#equipmentHeatMap').prop('checked') == true) { // 点击关闭热力图
                        // console.log('relitu')
                        $('#equipmentHeatMap').click();
                    }
 
                    event.stopPropagation();
                    var lgtd = Number($(this).find('input').attr('lgtd'));
                    var lttd = Number($(this).find('input').attr('lttd'));
                    // console.log($(this).find('input').attr('lttd'));
                    var position = new esri.geometry.Point(lgtd, lttd, new esri.SpatialReference({ wkid: 4326 })); //根据输入坐标信息找地图上的点
                    that._map.centerAndZoom(position, 18); //缩放,10是缩放级别,可以自定义,数值越大缩放越大
 
 
                    var y = +window.innerHeight / 2 + 200;
                    var x = (+window.innerWidth - 360) / 2 + 360 + 70;
                    // document.elementFromPoint(x, y).click();
                    // console.log(x, y)
 
                    // var a = document.elementFromPoint(21, 122);
                    // console.log(a);
 
                    // console.log(that.clusterLayer, that._map, 6)
                    // console.log(id, 'id');
                    // console.log(that.clusterLayer);
                    var Tattributes = null,
                        ds = that.clusterLayer.allData;
                    for (var key in ds) {
                        if (ds[key].id == id) {
                            Tattributes = ds[key];
                        }
                    }
                    if (mySelf.onceTimeMethod == null) { //防抖.限制时间内点击次数,否则会造成不能正确销毁前一个弹窗
                        var evtdata = {};
                        evtdata = {
                            graphic: {
                                attributes: Tattributes,
                            },
                            screenX: x,
                            screenY: y,
                        }
                        that.clusterLayer._clickOpenOnclick(evtdata, '控制端', that.clusterLayer.indexs);
                        mySelf.onceTimeMethod = setTimeout(() => {
                            mySelf.onceTimeMethod = null;
                        }, mySelf.onceTime);
                    } else {};
 
 
                })
                // $('.analysis-container-equipment .analysis-table-content .tbody').off('click', '.location').on('click', '.location', function (event) {
                //   event.stopPropagation();
                // })
                // $('.analysis-container-equipment .analysis-table-content .tbody').off('click', '.location input').on('click', '.location input', function (event) {
                //   event.stopPropagation();
                //   var lgtd = Number($(this).attr('lgtd'));
                //   var lttd = Number($(this).attr('lttd'));
                //   var position = new esri.geometry.Point(lgtd, lttd, new esri.SpatialReference({ wkid: 4326 }));//根据输入坐标信息找地图上的点
                //   that._map.centerAndZoom(position, 18);//缩放,10是缩放级别,可以自定义,数值越大缩放越大
 
            //   var y = +window.innerHeight / 2 + 200;
            //   var x = (+window.innerWidth - 360) / 2 + 360 + 70;
            //   // document.elementFromPoint(x, y).click();
            //   // console.log(x, y)
 
            //   // var a = document.elementFromPoint(21, 122);
            //   // console.log(a);
 
            //   // console.log(that.clusterLayer, that._map, 6)
            //   // console.log(id, 'id');
            //   // console.log(that.clusterLayer.indexs);
            //   var Tattributes = null
            //     , ds = that.clusterLayer.allData;
            //   for (var key in ds) {
            //     if (ds[key].id == id) {
            //       Tattributes = ds[key];
            //     }
            //   }
            //   if (mySelf.onceTimeMethod == null) {//防抖.限制时间内点击次数,否则会造成不能正确销毁前一个弹窗
            //     var evtdata = {};
            //     evtdata = {
            //       graphic: {
            //         attributes: Tattributes,
            //       },
            //       screenX: x,
            //       screenY: y,
            //     }
            //     that.clusterLayer._clickOpenOnclick(evtdata, '控制端', that.clusterLayer.indexs);
            //     mySelf.onceTimeMethod = setTimeout(() => {
            //       mySelf.onceTimeMethod = null;
            //     }, mySelf.onceTime);
            //   } else {
            //   };
            // })
            // 警情列表中得热力图是否选中事件
            $('#policeHeatMap').click(function() {
                    that.checkBoxSelect(this);
                })
                // 业主信息列表中得热力图是否选中事件
            $('#ownerHeatMap').click(function() {
                    that.checkBoxSelect(this);
                })
                // 设备信息列表的热力图是否选中事件
            $('#equipmentHeatMap').click(function() {
                    that.checkBoxSelect(this);
                })
                // 警情信息中类别移入事件
            $('#policeCategory').mouseenter(function() {
                    if ($('#policeCategory .select-list').is(':hidden')) {
                        $('#policeCategory .select-list').stop().slideDown(0);
                    }
                })
                // 警情信息中得类别移出事件
            $('#policeCategory').mouseleave(function() {
                    if (!$('#policeCategory .select-list').is(':hidden')) {
                        $('#policeCategory .select-list').stop().slideUp(0);
                    }
                })
                // 警情信息中行政区移入事件
            $('#policeArea').mouseenter(function() {
                    if ($('#policeArea .select-list').is(':hidden')) {
                        $('#policeArea .select-list').stop().slideDown(0);
                    }
                })
                // 警情信息中得行政区移出事件
            $('#policeArea').mouseleave(function() {
                    if (!$('#policeArea .select-list').is(':hidden')) {
                        $('#policeArea .select-list').stop().slideUp(0);
                    }
                })
                // 业主信息中类别移入事件
            $('#ownerCategory').mouseenter(function() {
                    if ($('#ownerCategory .select-list').is(':hidden')) {
                        $('#ownerCategory .select-list').stop().slideDown(0);
                    }
                })
                // 业主信息中得类别移出事件
            $('#ownerCategory').mouseleave(function() {
                    if (!$('#ownerCategory .select-list').is(':hidden')) {
                        $('#ownerCategory .select-list').stop().slideUp(0);
                    }
                })
                // 业主信息中的等级移入事件
            $('#ownerLevel').mouseenter(function() {
                    if ($('#ownerLevel .select-list').is(':hidden')) {
                        $('#ownerLevel .select-list').stop().slideDown(0);
                    }
                })
                // 业主信息中的等级移出事件
            $('#ownerLevel').mouseleave(function() {
                    if (!$('#ownerLevel .select-list').is(':hidden')) {
                        $('#ownerLevel .select-list').stop().slideUp(0);
                    }
                })
                // 设备信息中类别移入事件
            $('#equipmentCategory').mouseenter(function() {
                    if ($('#equipmentCategory .select-list').is(':hidden')) {
                        $('#equipmentCategory .select-list').stop().slideDown(0);
                    }
                })
                // 设备信息中得类别移出事件
            $('#equipmentCategory').mouseleave(function() {
                    if (!$('#equipmentCategory .select-list').is(':hidden')) {
                        $('#equipmentCategory .select-list').stop().slideUp(0);
                    }
                })
                //  警情信息类,业主信息类,设备信息类别,具体项的点击事件
            $('.analysis-container > div .select-list').off('click', 'li').on('click', 'li', function(event) {
                // console.log(event.currentTarget.innerHTML,'innerhtml')
                var text = $(this).text().trim();
                // console.log(this,text,'text()')
                // console.log(that.tabIndex,'tabIndex')
 
 
                //解决打开热力图 切换top获取不了数据问题 警情
                if ($('#policeHeatMap').prop('checked') == true) {
                    // console.log($('#policeHeatMap').prop('checked') == true)
                    $('#policeHeatMap').prop('checked', false);
                    that.checkBoxSelect($('#policeHeatMap'));
                } else
                //解决打开热力图 切换top获取不了数据问题 业主
                if ($('#ownerHeatMap').prop('checked') == true) {
                    // console.log($('#ownerHeatMap').prop('checked') == true)
                    $('#ownerHeatMap').prop('checked', false);
                    that.checkBoxSelect($('#ownerHeatMap'));
                } else
                //解决打开热力图 切换top获取不了数据问题 设备
                if ($('#equipmentHeatMap').prop('checked') == true) {
                    // console.log($('#equipmentHeatMap').prop('checked') == true)
                    $('#equipmentHeatMap').prop('checked', false);
                    that.checkBoxSelect($('#equipmentHeatMap'));
                    var time = setTimeout(() => {
                        // $('#equipmentHeatMap').click(function () {
                        //   that.checkBoxSelect('#equipmentHeatMap');
                        // })();
                        $('#equipmentHeatMap').click();
                    }, 500);
                }
 
 
                $(this).parent().parent().prev().html(text + '<i></i>');
                $(this).parent().parent().stop().slideUp(0);
 
                if ($(this).attr('areaid')) {
                    $(this).parent().parent().prev().attr('areaid', $(this).attr('areaid'));
                } else if ($(this).attr('ownerid')) {
                    $(this).parent().parent().prev().attr('ownerid', $(this).attr('ownerid'));
                }
 
 
                if (that.tabIndex == 1) {
 
                    var levelText = $('#policeArea > div:eq(0)').text().trim() == '全部' ? '' : $('#policeArea > div:eq(0)').attr('areaid');
                    var overText = $('#policeCategory > div:eq(0)').text().trim() == '全部' ? '' : $('#policeCategory > div:eq(0)').text().trim();
 
                    if ($(this).attr('areaid')) {
                        that.getPoliceTableAnalysis($('.analysis-container-police').find('.tbody tbody'), $('#analysis_select_time_start').val(), $('#analysis_select_time_end').val(), overText, levelText);
                    } else {
                        that.getPoliceTableAnalysis($('.analysis-container-police').find('.tbody tbody'), $('#analysis_select_time_start').val(), $('#analysis_select_time_end').val(), overText, levelText);
                    }
 
 
                } else if (that.tabIndex == 2) {
                    that.getOwnerTable($('.analysis-container-owner').find('.tbody tbody'), text == '全部' ? '' : text);
                } else if (that.tabIndex == 0) {
                    that.getEquipmentTable($('.analysis-container-equipment').find('.tbody tbody'), text == '全部' ? '' : text);
                }
 
            })
        },
 
        getQueryStringByKey: function(key) {
            return (document.location.search.match(new RegExp("(?:^\\?|&)" + key + "=(.*?)(?=&|$)")) || ['', null])[1];
        },
 
        //左侧控制栏
 
 
        getArea: function(dom) {
            dom.children('.select-list').children('ul').empty();
            dom.children('.select-list').children('ul').append($("<li areaid='all'>全部</li>"));
            var that = this;
            $.ajax({
                url: '/api/blade-system/region/select?code=3601',
                type: 'GET',
                dataType: 'JSON',
                success: function(data) {
                    var res = data.data;
                    for (var i = 0; i < res.length; i++) {
                        dom.children('.select-list').children('ul').append($("<li areaid=" + res[i].code + ">" + res[i].name + "</li>"));
                    }
                }
            })
        },
        getPoliceTableAnalysis: function(dom, beginTime, endTime, waringType, addvcd) {
            dom.empty(); //警情信息
            var that = this;
            $.ajax({
                url: "/api/alarm/alarm/page?current=1&size=99999&waringType=&beginTime=" + beginTime + "&endTime=" + endTime + "&province=36&city=3601&district=" + addvcd,
                type: 'get',
                dataType: 'JSON',
                success: function(data) {
                    // var result = data.data.records;
                    var oldData = data.data.records
                    var result = oldData;
                    that.Pdata = oldData;
                    // console.log(that.Pdata);//警情筛选
                    var str = '';
                    that.entitysData = [];
                    that.analysisAddEntitys.clear();
                    for (var a, time, t, e, y, h, i = 0; i < result.length; i++) {
 
                        if (result[i].waringType == "紧急求救") {
                            result[i].waringType = "一键求助"
                        }
 
 
                        that.createEntitysAnalysis(that.analysisAddEntitys, that.entitysData, '警情信息', {
                                lgtd: result[i].jd,
                                lttd: result[i].wd,
                                id: result[i].id
                            }, result[i].jd, result[i].wd,
                            //  './images/police-situation.png'
                        );
 
                        t = result[i].alarmTime.substr(0, 10);
                        e = result[i].alarmTime.substr(11);
                        time = t + '&nbsp;' + e;
                        y = result[i].alarmTime.substr(5, 5);
                        h = result[i].alarmTime.substr(11, 5);
                        a = Number(i) + 1;
 
 
                        str += '<tr term-list=' + result[i].id + '>';
                        str += '<td>' + a + '</td>';
                        str += '<td title=' + result[i].waringType + '>' + result[i].waringType + '</td>';
                        str += '<td title=' + result[i].alarmPeople + '>' + result[i].alarmPeople + '</td>';
                        str += "<td><a href='javascript:;' title=" + time + ">" + y + ' ' + h + "</a></td>";
                        // str += "<td class='location' style='display: none'> <input type='button' value='定位'" + ' lgtd=' + result[i].jd + ' lttd=' + result[i].wd + "></td>";
                        if (result[i].jtype == 0) {
                            str += "<td class='location'> <input style='color:#fff;background-color:#F35B5B;width: 50px' type='button' value='未处理'" + ' lgtd=' + result[i].jd + ' lttd=' + result[i].wd + "></td>";
                        } else {
                            if (result[i].jtype == 1) {
                                str += "<td class='location'> <input style='color:#fff;background-color:rgb(18, 145, 230);width: 50px' type='button' value='处理中'" + ' lgtd=' + result[i].jd + ' lttd=' + result[i].wd + "></td>";
 
                            } else {
                                str += "<td class='location'> <input style='color:#fff;background-color:#32C1A2;width: 50px' type='button' value='已处理'" + ' lgtd=' + result[i].jd + ' lttd=' + result[i].wd + "></td>";
 
                            }
                        }
 
                        str += '</tr>';
                        dom.append(str);
                        str = '';
 
 
                    }
 
                    that.clearLayer(); //图标清除
                    that.entityData = [];
                    for (var i = 0; i < result.length; i++) {
                        result[i].x = Number(result[i].jd);
                        result[i].y = Number(result[i].wd);
                        that.entityData.push({
                            lgtd: Number(result[i].jd),
                            lttd: Number(result[i].wd)
                        })
                    }
                    // console.log(result);//警情
                    if (that.heatmapfeatureLayer.graphics.length > 0) { //热力图数据映射
                        that.heatmapfeatureLayer.clear();
                        that.heatmapfeatureLayer.setRenderer();
                        $('.analysis-category input').prop('checked', false);
                    };
                    that.flareClusterLayer(result); //图标渲染
                    that.Pdatas = result;
                    that.clusterLayer._setUserState('警情'); //切换聚合图标点击事件
 
                    for (var i = 0; i < 1000; i++) {
                        var dd = Math.random();
                        var cc = Math.random();
                    }
                }
            })
        },
        getOwnerType: function(dom) {
            dom.children('div:eq(0)').html("全部 <i></i>");
            dom.children('.select-list').children('ul').empty();
            dom.children('.select-list').children('ul').append($("<li ownerid='all'>全部</li>"));
            $.ajax({
                url: '/api/lx/lx/seleclx',
                type: 'GET',
                dataType: 'JSON',
                success: function(data) {
                    var res = data.data;
                    for (var i = 0; i < res.length; i++) {
                        dom.children('.select-list').children('ul').append($("<li ownerid=" + res[i].tnumber + ">" + res[i].types + "</li>"));
                    }
                }
            })
        },
        getOwnerDj: function(dom, tnumbers) {
            dom.children('div:eq(0)').html("全部 <i></i>");
            dom.children('.select-list').children('ul').empty();
            dom.children('.select-list').children('ul').append($("<li>全部</li>"));
            // $.ajax({
            //   url: '/api/dj/dj/selectName?tnumbers=' + tnumbers,
            //   type: 'GET',
            //   dataType: 'JSON',
            //   success: function (data) {
            //     var res = data.data;
            //     for (var i = 0; i < res.length; i++) {
            //       dom.children('.select-list').children('ul').append($("<li>" + res[i].dj + "</li>"));
            //     }
            //   }
            // })
        },
        // 获取业主信息列表
        getOwnerTable: function(dom, deviceType) {
            dom.empty();
            var that = this;
            $.ajax({
                // url: '/api/blade-system/tenant/page',
                // type: 'GET',
                url: '/api/blade-system/tenant/selectListTe',
                type: 'POST',
                dataType: 'JSON',
                success: function(data) {
                    // var result = data.data;
                    var oldData = data.data;
                    // console.log(deviceType)
                    var result = [];
                    that.Ydata = oldData;
 
                    if (deviceType == '') {
                        result = oldData;
                    } else if (deviceType == '医院') {
                        for (var key in oldData) {
                            // console.log(oldData[key]);
                            if (oldData[key].type == '0') {
                                result.push(oldData[key]);
                            }
                        }
                    } else if (deviceType == '学校') {
                        for (var key in oldData) {
                            // console.log(oldData[key]);
                            if (oldData[key].type == '1') {
                                result.push(oldData[key]);
                            }
                        }
                    } else if (deviceType == '小区') {
                        for (var key in oldData) {
                            // console.log(oldData[key]);
                            if (oldData[key].type == '2') {
                                result.push(oldData[key]);
                            }
                        }
                    }
 
 
 
                    that.clearLayer(); //图标清除
                    that.entityData = [];
                    for (var i = 0; i < result.length; i++) {
                        result[i].x = Number(result[i].jd);
                        result[i].y = Number(result[i].wd);
                        that.entityData.push({
                            lgtd: Number(result[i].jd),
                            lttd: Number(result[i].wd)
                        })
                    }
                    // console.log(result);//业主
                    if (that.heatmapfeatureLayer.graphics.length > 0) { //热力图数据映射
                        that.heatmapfeatureLayer.clear();
                        that.heatmapfeatureLayer.setRenderer();
                        $('.analysis-category input').prop('checked', false);
                    };
 
                    that.flareClusterLayer(result); //图标渲染
                    that.Ydatas = result;
                    that.clusterLayer._setUserState('业主'); //切换聚合图标点击事件
 
 
                    var str = '';
                    that.entitysData = [];
                    that.analysisAddEntitys.clear();
                    var createD = (id, a, name, dj, type) => {
                        str += "<tr term-list=" + id + ">";
                        str += '<td>' + a + '</td>';
                        str += '<td>' + name + '</td>';
                        str += '<td>' + dj + '</td>';
                        str += '<td>' + type + '</td>';
                        // str += "<td class='location' style='display: none'> <input type='button' value='定位'" + ' lgtd=' + result[i].jd + ' lttd=' + result[i].wd + "></td>";
                        str += '</tr>';
                        dom.append(str);
                        str = '';
                    }
                    for (var a, i = 0; i < result.length; i++) {
 
                        that.createEntitysAnalysis(that.analysisAddEntitys, that.entitysData, '业主信息', {
                                lgtd: result[i].jd,
                                lttd: result[i].wd,
                                id: result[i].id
                            }, result[i].jd, result[i].wd,
                            // './images/业主.png'
                        );
 
                        a = Number(i) + 1;
                        if (result[i].type === "0") {
                            createD(result[i].id, a, result[i].tenant_name, result[i].dj, '医院')
                        } else if (result[i].type === "1") {
                            createD(result[i].id, a, result[i].tenant_name, result[i].nature, '学校')
                        } else if (result[i].type === "2") {
                            createD(result[i].id, a, result[i].tenant_name, result[i].housetype, '小区')
                        } else {
                            createD(result[i].id, a, result[i].tenant_name, result[i].dj, '其他')
                        }
 
                    }
 
 
                    // console.log(that.Ydata);//业主筛选
                }
            })
        },
        // 获取设备信息列表
        getEquipmentTable: function(dom, deviceType, once) {
            dom.empty();
            var that = this;
            // console.log(that.clusterLayer)
            // console.log(dom, deviceType);
            // dom.append(deviceType);
            // var str = "<td class='locationb'> <input type='button' value='定位'" + ' lgtd=' + 114.9285 + ' lttd=' + 25.850693 + "></td>"
            // that.entitysData = [];
            // that.analysisAddEntitys.clear();
            // that.createEntitysAnalysis(that.analysisAddEntitys, that.entitysData, '设备信息', {
            //   lgtd: 114.9285,
            //   lttd: 25.850693,
            //   id: 5
            // }, 114.9285, 25.850693, './images/ceshi.png');
            // dom.append(str)
 
            $.ajax({
                url: '/api/equipment/equipment/listAll?deviceType=' + deviceType,
                type: 'GET',
                dataType: 'JSON',
                success: function(data) {
                    var oldData = data.data;
                    var result = [];
                    that.Sdata = oldData;
 
                    var str = '';
                    that.entitysData = [];
                    that.analysisAddEntitys.clear();
 
 
                    if (deviceType == '') {
                        result = oldData;
                    } else if (deviceType == '正常') {
                        for (var key in oldData) {
                            // console.log(oldData[key]);
                            if (oldData[key].dtype == '1') {
                                result.push(oldData[key]);
                            }
                        }
                    } else if (deviceType == '掉线') {
                        for (var key in oldData) {
                            // console.log(oldData[key]);
                            if (oldData[key].dtype == '0') {
                                result.push(oldData[key]);
                            }
                        }
                    } else if (deviceType == '预警') {
                        for (var key in oldData) {
                            console.log(oldData[key], 111);
                            if (oldData[key].dtype == 2) {
                                result.push(oldData[key]);
                            }
                        }
                    } else if (deviceType == '故障') {
                        for (var key in oldData) {
                            // console.log(oldData[key]);
                            if (oldData[key].dtype == 3) {
                                result.push(oldData[key]);
                            }
                        }
                    }
 
                    if (once != 'once') {
                        that.clearLayer(); //图标清除
                        that.entityData = [];
                        for (var i = 0; i < result.length; i++) {
                            result[i].x = Number(result[i].jd);
                            result[i].y = Number(result[i].wd);
                            that.entityData.push({
                                lgtd: Number(result[i].jd),
                                lttd: Number(result[i].wd)
                            })
                        }
                        // console.log(result);//设备筛选
                        if (that.heatmapfeatureLayer.graphics.length > 0) { //热力图数据映射
                            that.heatmapfeatureLayer.clear();
                            that.heatmapfeatureLayer.setRenderer();
                            $('.analysis-category input').prop('checked', false);
                        };
                        that.flareClusterLayer(result); //图标渲染
                        that.clusterLayer._setUserState('设备'); //切换聚合图标点击事件
 
                    }
                    that.Sdatas = result;
 
                    for (var a, i = 0; i < result.length; i++) {
                        that.createEntitysAnalysis(that.analysisAddEntitys, that.entitysData, '设备信息', {
                                lgtd: result[i].jd,
                                lttd: result[i].wd,
                                id: result[i].id
                            }, result[i].jd, result[i].wd,
                            // './images/ceshi.png'
                        );
                        var stares = '';
 
                        a = Number(i) + 1;
                        str += "<tr term-listid=" + result[i].id + ">";
                        str += '<td>' + a + '</td>';
                        str += '<td title=' + result[i].deviceName + '>' + result[i].deviceName + '</td>';
                        // str += '<td title=' + result[i].deviceType + '>' + result[i].deviceType + '</td>';
                        str += '<td>' + result[i].deviceNumber + '</td>';
                        // console.log(result[i].state);
 
 
                        if (result[i].dtype == '3') {
                            stares = '故障';
                            str += "<td class='location'> <input style='background-image:linear-gradient(to right, #F49966 , #F49966' type='button' value=" + stares + ' lgtd=' + result[i].jd + ' lttd=' + result[i].wd + "></td>";
                        } else if (result[i].dtype == '1') {
                            stares = '正常';
                            str += "<td class='location'> <input style='background-image:linear-gradient(to right, #32C1A2 , #32C1A2' type='button' value=" + stares + ' lgtd=' + result[i].jd + ' lttd=' + result[i].wd + "></td>";
                        } else if (result[i].dtype == '0') {
                            stares = '掉线';
                            str += "<td class='location'> <input style='background-image:linear-gradient(to right, #CDCDCD , #CDCDCD' type='button' value=" + stares + ' lgtd=' + result[i].jd + ' lttd=' + result[i].wd + "></td>";
                        } else if (result[i].dtype == '2') {
                            stares = '预警';
                            str += "<td class='location'> <input style='background-image:linear-gradient(to right, #F35B5B , #F35B5B' type='button' value=" + stares + ' lgtd=' + result[i].jd + ' lttd=' + result[i].wd + "></td>";
                        }
                        str += '</tr>';
                        dom.append(str);
                        str = '';
                    }
                }
            })
        },
        // 创建实体图层
        createEntitysAnalysis: function(entitys, entityContent, name, item, lgtd, lttd, outlineColors) {
 
            var symbol = new esri.symbol.PictureMarkerSymbol(outlineColors, 16, 16);
            symbol.name = name;
            var pt = new Point(lgtd, lttd, new SpatialReference({ wkid: 4326 }));
            pt.entityData = item;
            var graphic = new esri.Graphic(pt, symbol);
            entitys.add(graphic);
            var bbb = document.getElementsByTagName("image");
            // console.log(bbb);
            entityContent.push(item);
        },
        //左侧控制栏↑
 
 
        heatmFeaLayers: function() { // liu 热力图渲染器,加载热力图
 
            var layerDefinition = {
                "geometryType": "esriGeometryPoint",
                "fields": [{
                    "num": "num",
                    editable: true,
                    nullable: true,
                    "type": "esriFieldTypeInteger",
                    "alias": "数量"
                }]
            };
            var featureCollection = {
                layerDefinition: layerDefinition,
                featureSet: null
            };
            //创建 FeatureLayer 图层
            var featureLayer = new esri.layers.FeatureLayer(featureCollection, {
                mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,
                outFields: ["*"],
                opacity: .8
            });
            //设置渲染方式
 
            return featureLayer;
        },
 
        checkBoxSelect: function(self) { //选择热力图
            var that = this;
            var heatmapRenderer = null;
            // console.log(self);
            // // return
            // 选中
            if ($(self).prop('checked') == true) {
                that.clearLayer(); //图标清除
                // console.log($(self).attr('id'), 1);
                // if (1) {
                heatmapRenderer = new HeatmapRenderer({
                    colorStops: [
                        { ratio: 0.45, color: "rgba(000,000,255,0)" },
                        { ratio: 0.55, color: "rgb(000,255,255)" },
                        { ratio: 0.65, color: "rgb(000,255,000)" },
                        { ratio: 0.75, color: "rgb(234,126,15)" },
                        { ratio: 1.00, color: "rgb(255,000,000)" },
                    ],
                    blurRadius: 42,
                    maxPixelIntensity: 100,
                    minPixelIntensity: 0
                });
                this.heatmapfeatureLayer.setRenderer(heatmapRenderer);
                // 取消选中
                var point = null;
                for (var i = 0; i < that.entityData.length; i++) {
                    point = new esri.geometry.Point(this.entityData[i].lgtd, this.entityData[i].lttd, new esri.SpatialReference({ wkid: 4326 }));
                    this.heatmapfeatureLayer.add(new esri.Graphic(point));
                }
            } else {
                // console.log(self, 2);
                if ($(self).attr('class') == 'p') {
                    that.entityData = [];
                    for (var i = 0; i < this.Pdatas.length; i++) {
                        this.Pdatas[i].x = Number(this.Pdatas[i].jd);
                        this.Pdatas[i].y = Number(this.Pdatas[i].wd);
                        that.entityData.push({
                            lgtd: Number(this.Pdatas[i].jd),
                            lttd: Number(this.Pdatas[i].wd)
                        })
                    }
                    if (that.heatmapfeatureLayer.graphics.length > 0) { //热力图数据映射
                        that.heatmapfeatureLayer.clear();
                        that.heatmapfeatureLayer.setRenderer();
                        // $('.analysis-category input').prop('checked', false);
                    };
                    that.flareClusterLayer(this.Pdatas); //图标渲染
                } else if ($(self).attr('class') == 'Y') {
                    that.entityData = [];
                    for (var i = 0; i < this.Ydatas.length; i++) {
                        this.Ydatas[i].x = Number(this.Ydatas[i].jd);
                        this.Ydatas[i].y = Number(this.Ydatas[i].wd);
                        that.entityData.push({
                            lgtd: Number(this.Ydatas[i].jd),
                            lttd: Number(this.Ydatas[i].wd)
                        })
                    }
                    if (that.heatmapfeatureLayer.graphics.length > 0) { //热力图数据映射
                        that.heatmapfeatureLayer.clear();
                        that.heatmapfeatureLayer.setRenderer();
                        // $('.analysis-category input').prop('checked', false);
                    };
                    that.flareClusterLayer(this.Ydatas); //图标渲染
                } else if ($(self).attr('class') == 'S') {
                    that.entityData = [];
                    for (var i = 0; i < this.Sdatas.length; i++) {
                        this.Sdatas[i].x = Number(this.Sdatas[i].jd);
                        this.Sdatas[i].y = Number(this.Sdatas[i].wd);
                        that.entityData.push({
                            lgtd: Number(this.Sdatas[i].jd),
                            lttd: Number(this.Sdatas[i].wd)
                        })
                    }
                    if (that.heatmapfeatureLayer.graphics.length > 0) { //热力图数据映射
                        that.heatmapfeatureLayer.clear();
                        that.heatmapfeatureLayer.setRenderer();
                        // $('.analysis-category input').prop('checked', false);
                    };
                    that.flareClusterLayer(this.Sdatas); //图标渲染
                }
                this.heatmapfeatureLayer.clear();
                this.heatmapfeatureLayer.setRenderer();
            }
        },
 
        close: function() {
 
        },
        // 获取当前时间,以及昨天现在的时间
        getTime: function getTime() {
            var timestamp = Date.parse(new Date());
 
            // 当前时间
            var currentTime = new Date(timestamp);
            // 年
            var currentY = currentTime.getFullYear();
            // 月
            var currentM = currentTime.getMonth() + 1 < 10 ? '0' + (currentTime.getMonth() + 1) : currentTime.getMonth() + 1;
            // 日
            var currentD = currentTime.getDate() < 10 ? '0' + currentTime.getDate() : currentTime.getDate();
            // 时
            var currentH = currentTime.getHours() < 10 ? '0' + currentTime.getHours() : currentTime.getHours();
            // 分
            var currentDd = currentTime.getMinutes() < 10 ? '0' + currentTime.getMinutes() : currentTime.getMinutes();
            // 明天
            var tomorrowTime = new Date(timestamp - 60 * 60 * 24 * 1000);
            // 年
            var tomorrowY = tomorrowTime.getFullYear();
            // 月
            var tomorrowM = tomorrowTime.getMonth() + 1 < 10 ? '0' + (tomorrowTime.getMonth() + 1) : tomorrowTime.getMonth() + 1;
            // 日
            var tomorrowD = tomorrowTime.getDate() < 10 ? '0' + tomorrowTime.getDate() : tomorrowTime.getDate();
            // 时
            var tomorrowH = tomorrowTime.getHours() < 10 ? '0' + tomorrowTime.getHours() : tomorrowTime.getHours();
            // 分
            var tomorrowDd = tomorrowTime.getMinutes() < 10 ? '0' + tomorrowTime.getMinutes() : tomorrowTime.getMinutes();
            return {
                current: currentY + '-' + currentM + '-' + currentD + ' ' + currentH + ':' + currentDd,
                tomorrow: tomorrowY + '-' + tomorrowM + '-' + tomorrowD + ' ' + tomorrowH + ':' + tomorrowDd,
                month: currentM + currentD
            };
        },
 
        // 创建实体图层
        createEntitys: function(entitys, entityContent, name, item, lgtd, lttd, outlineColors) {
 
            var symbol = new esri.symbol.PictureMarkerSymbol(outlineColors, 33, 48);
            symbol.name = name;
            var pt = new Point(lgtd, lttd, new esri.SpatialReference({
                wkid: 4326
            }));
            pt.entityData = item;
            var graphic = new esri.Graphic(pt, symbol);
            entitys.add(graphic);
 
 
            entityContent.push(item);
        },
 
        addPoint: function(entitys, lgtd, lttd, img) {
            var symbol = new esri.symbol.PictureMarkerSymbol(img, 33, 48);
            var pt = new Point(lgtd, lttd, new SpatialReference({
                wkid: 4326
            }));
            var graphic = new esri.Graphic(pt, symbol);
            entitys.add(graphic);
        },
 
        addPoints: function(entitys, lgtd, lttd, img) {
            var symbol = new esri.symbol.PictureMarkerSymbol(img, 33, 48);
            var pt = new Point(lgtd, lttd, new SpatialReference({
                wkid: 4326
            }));
            var graphic = new esri.Graphic(pt, symbol);
            entitys.add(graphic);
        },
 
        clickHand: function(e) { //top点击事件,导航
            // console.log(e);
        },
 
 
        //聚合图层事件
        flareClusterLayer: function(datas, userState) { //top聚合事件,导航
 
            var that = this;
 
            var preClustered = false;
            var displaySingleFlaresAtCount = 20;
            var areaDisplayMode = "";
            // var allData = JSON.parse(DATA);
            // DataManager.setData(allData);
 
            //init the layer, more options are available and explained in the cluster layer constructor
            that.clusterLayer = new FlareClusterLayer({
                id: "flare-cluster-layer",
                spatialReference: new esri.SpatialReference({
                    "wkid": 4326
                }),
                subTypeFlareProperty: "facilityType",
                singleFlareTooltipProperty: "name",
                displaySubTypeFlares: true,
                displaySingleFlaresAtCount: displaySingleFlaresAtCount,
                flareShowMode: "mouse",
                preClustered: preClustered,
                clusterRatio: 120,
                clusterAreaDisplay: areaDisplayMode,
                clusteringBegin: function(e) {
                    // console.log("clustering begin");
                },
                clusteringComplete: function() {
                    console.log("clustering complete");
                }
            });
 
            //set up a class breaks renderer to render different symbols based on the cluster count. Use the required clusterCount property to break on.
            var defaultSym = new PictureMarkerSymbol("./images/jingbaored.png", 33, 48).setOffset(0, 1);
            var renderer = new ClassBreaksRenderer(defaultSym, "clusterCount");
            var xlSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 32, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new dojo.Color([200, 52, 59, 0.8]), 1), new dojo.Color([250, 65, 74, 0.8]));
            var lgSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 28, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new dojo.Color([41, 163, 41, 0.8]), 1), new dojo.Color([51, 204, 51, 0.8]));
            var mdSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 24, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new dojo.Color([82, 163, 204, 0.8]), 1), new dojo.Color([102, 204, 255, 0.8]));
            var smSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 52, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new dojo.Color([230, 184, 92, 0.8]), 1), new dojo.Color([255, 204, 102, 0.8]));
            renderer.addBreak(0, 19, smSymbol);
            renderer.addBreak(20, 150, mdSymbol);
            renderer.addBreak(151, 1000, lgSymbol);
            renderer.addBreak(1001, Infinity, xlSymbol);
 
            that.clusterLayer.setRenderer(renderer); //use standard setRenderer.
 
            //set up a popup template
            var template = new PopupTemplate({
                title: "{name}",
                fieldInfos: [{
                        fieldName: "facilityType",
                        label: "Facility Type",
                        visible: true
                    },
                    {
                        fieldName: "postcode",
                        label: "Post Code",
                        visible: true
                    },
                    {
                        fieldName: "isOpen",
                        label: "Opening Hours",
                        visible: true
                    }
                ]
            });
 
            //clusterLayer.infoTemplate = template;
            that._map.infoWindow.titleInBody = false;
 
            that._map.addLayer(that.clusterLayer);
 
            //var data = DataManager.getData();
            that.clusterLayer.addData(datas);
 
        },
        clearLayer: function() {
            var that = this;
            that._map.removeLayer(that.clusterLayer);
            that.clusterLayer = null;
        }
    });
    return Widget;
});