赣州市洪水风险预警系统二维版本
xiebin
2023-02-24 ec1a74625890ff771fc5e46e39a15deaf618b479
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
define([
    "dojo",
    "dojo/_base/declare",
    "dojo/_base/lang",
    "base/BaseWidget",
    "dojo/text!widgets/attributeQuery/template.html",
    "widgets/attributeQuery/config",
    "base/AppEvent",
    "base/ConfigData",
    "iframe/jcyj/js/dataShow.js",
    "dojo/dom",
    "dojo/dom-construct",
    "dojo/dom-attr",
    "dojo/dom-style",
    "dojo/on",
    "esri/layers/FeatureLayer",
    "controls/tab/TabControl",
    "esri/dijit/SymbolStyler",
    "esri/styles/basic",
    "dojo/_base/array",
    "esri/tasks/PrintTemplate",
    "esri/tasks/query",
    "esri/tasks/QueryTask",
    "esri/InfoTemplate",
    "esri/dijit/HorizontalSlider",
    "esri/toolbars/draw",
    "esri/graphic",
    "esri/symbols/SimpleFillSymbol",
    "esri/symbols/SimpleMarkerSymbol",
    "esri/symbols/SimpleLineSymbol",
    "esri/symbols/CartographicLineSymbol",
    "esri/Color",
    "esri/geometry/Point",
    "esri/layers/GraphicsLayer",
    "esri/SpatialReference",
    "esri/tasks/GeometryService",
    "esri/symbols/PictureMarkerSymbol",
    "esri/tasks/ProjectParameters",
    "esri/graphicsUtils",
    "esri/tasks/IdentifyTask",
    "esri/tasks/IdentifyParameters",
    "dojo/domReady!"
], function (dojo,
             declare,
             lang,
             BaseWidget,
             template,
             config,
             AppEvent,
             ConfigData,
             dataShow,
             dom,
             domConstruct,
             domAttr,
             domStyle,
             on,
             FeatureLayer,
             TabControl,
             SymbolStyler,
             basic,
             arrayUtils,
             PrintTemplate,
             Query,
             QueryTask,
             InfoTemplate,
             HorizontalSlider,
             draw,
             Graphic,
             SimpleFillSymbol,
             SimpleMarkerSymbol,
             SimpleLineSymbol,
             CartographicLineSymbol,
             Color,
             Point,
             GraphicsLayer,
             SpatialReference,
             GeometryService,
             PictureMarkerSymbol,
             ProjectParameters,
             graphicsUtils,
             IdentifyTask,
             IdentifyParameters) {
    var Widget = declare([BaseWidget], {
        widgetName: "attributeQueryWidget",
        label: "属性查询",
        templateString: template,
        _map: null,
        _tabControl: null,
        _styler: null,
        _selectLayer: null,
        _printer: null,
        _openprinturl: null,
        StatisticalResultWidgetObj: null,
        _queryGraphic: null,
        _feildName: null,
        RECORDS_PER_PAGE: 10, //每页显示数量
        objectid: [],
        _graphicslayer_attribute: null,
        _graphicslayer_draw: null,
        _graphicslayer_locationQuery: null,
        displayField_name: null,
        query_param: null,
        queryTask: null,
        _layui: null,
        mapQuery_URL: null,//当前查询图层URL
        mapQuery_layerName: null,//当前查询图层名
        _geometryservice: new GeometryService(ConfigData.geometryServiceUrl),
        constructor: function (options, srcRefNode) {
            this._map = options.map;
            attributeObj = this;
            //初始化layui弹窗
            layui.use('layer', function () {
                attributeObj._layui = layui.layer;
            });
        },
        postCreate: function () {
            //创建地图查询工具条
            $("#mainMapWidget").append(config.searchDom);
            //绑定地图浏览工具条各种事件
            $('#mapLayers').click(function () {//高级选项按钮点击事件
                $("#showLayers").slideToggle("fast");
            });
 
            function oneclick() {
                //注册全局点击事件--点击鼠标隐藏高级选项界面
                $(window).one('click', function (e) {
                    var isshow = true;
                    var dom = $(e.target);
                    for (var i = 0; i < 6; i++) {
                        if (dom.parent().is('.searchDiv') || dom.parent().is('#mapQuery_tree')) {
                            isshow = false;
                            break;
                        }
                        if (dom.is(body)) break;
                        dom = dom.parent();
                    }
                    if (isshow) {
                        $("#showLayers").slideUp("fast");
                        return;
                    }
                    oneclick();
                });
            }
 
            $("#showLayers").mouseenter(oneclick);//高级选项界面隐藏
            $(".selected-layer-container input").click(function () {
                $(".tree-container").slideDown('fast');
            });
            $(".selected-layer-container input").blur(function () {
                $(".tree-container").slideUp('fast');
            });
            $(".tree-container").mouseenter(function () {
                $(".selected-layer-container input").unbind("blur");
            });
            $(".tree-container").mouseleave(function () {
                $(".selected-layer-container input").focus();
                $(".selected-layer-container input").blur(function () {
                    $(".tree-container").slideUp('fast');
                });
            });
            // $('.tree-container').mouseenter(function () {
            //     $(this).slideUp('fast');
            // });
            $("#searchMap").click(function () {//开始查询按钮点击事件
                isQuery = true;
                if (attributeObj.mapQuery_URL == null) {
                    alert("请选择查询的图层");
                    return;
                }
                showFun('attributeQueryWidget');
                _AppEvent.dispatchAppEvent("Start_Query", true);
            });
            $("#mapQueryInput").keyup(function (e) {//输入框回车事件
                if (e.keyCode == 13) {
                    isQuery = true;
                    if (attributeObj.mapQuery_URL == null) {
                        alert("请选择查询的图层");
                        return;
                    }
                    _AppEvent.dispatchAppEvent("Start_Query", true);
                }
            }).click(function () {
                $(this).focus();
            }).mouseleave(function () {
                // $(this).blur();
            });
            $('.advanced-tab-container li').click(function () {//查询高级选项tab标签点击事件
                if (!$(this).hasClass('on-tab-selected')) {
                    $('.on-tab-selected').removeClass('on-tab-selected');
                    var tabName = $(this).attr('class').slice(0, -4);
                    $(this).addClass('on-tab-selected');
                    console.log(tabName);
                    $('.on-selected').removeClass('on-selected');
                    $('.' + tabName).addClass('on-selected');
                }
            });
            //↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓初始化--地图查询的目录树--并对目录树添加点击事件↓↓↓↓↓↓↓↓↓↓↓↓↓
            // $.ajax({
            //     type: "get",
            //     url: getNativePath() + "resources/queryResourcesTree.do?soId=bbb7001c67c442540167c4a2a604000b",
            //     data: {
            //         "limit": 10000
            //     },
            //     dataType: "json",
            //     async: true,
            //     success: function (result) {
            //         var _ztreeObj = [];
            //         var resultObj = result.data;
            //         for (var i = 0; i < resultObj.length; i++) {
            //             var searchCatalog = {};
            //             searchCatalog.id = resultObj[i].resourcesId;
            //             searchCatalog.pId = resultObj[i].resourcesPid;
            //             searchCatalog.name = resultObj[i].resourcesName;
            //             searchCatalog.Datatime = resultObj[i].resourcesData;
            //             searchCatalog.Url = resultObj[i].resourcesUrl;
            //             _ztreeObj.push(searchCatalog);
            //         }
 
            //         for (var x in _ztreeObj) {
            //             if (_ztreeObj[x].pId == 0) {
            //                 _ztreeObj[x].nocheck = true;
            //             }
            //         }
            //         var setting2 = {
            //             check: {
            //                 enable: true,
            //                 chkStyle: "radio",
            //                 radioType: "all"
            //             },
            //             data: {
            //                 simpleData: {
            //                     enable: true
            //                 }
            //             },
            //             callback: {
            //                 onCheck: attributeObj.MapQuery_TreeOnCheck,
            //                 beforeClick: attributeObj._beforeClick
            //             }
            //         };
            //         var ztree = $.fn.zTree.init($("#mapQuery_tree"), setting2, _ztreeObj);
            //         //默认勾选湿地公园
            //         var nodes = ztree.getNodesByParamFuzzy("name", "湿地公园", null);
            //         for (var nodesKey in nodes) {
            //             if (!nodes[nodesKey].isParent) {
            //                 var node = nodes[nodesKey];
            //                 ztree.checkNode(node, true, true, true);
            //                 break;
            //             }
            //         }
            //     },
            //     error: function (e) {
            //         console.log(e);
            //         alert("请求失败");
            //     }
            // });
        },
        //地图查询目录树选择事件
        MapQuery_TreeOnCheck: function (event, treeId, treeNode) {
            //改变输入框中的提示文字--填充图层名
            $("#mapQueryInput").attr('placeholder', '搜索:' + treeNode.name + ',请输入搜索关键字或坐标:[x,y]');
            $(".selected-layer-container input").val(treeNode.name);
            //将选中节点的url存入全局变量并调用属性筛选框构造
            attributeObj.mapQuery_URL = treeNode.Url;
            attributeObj.mapQuery_layerName = treeNode.name;
            attributeObj._selectlayer(treeNode.Url);
        },
        _beforeClick: function (treeId, treeNode) {
            if (!treeNode.path && treeNode.isParent) {
                var treeObj = $.fn.zTree.getZTreeObj(treeId);
                treeObj.expandNode(treeNode, !treeNode.open, false, true, true);
            }
            return treeNode.path && !treeNode.isParent;
        },
        startup: function () {
            attributeObj.treecheck = [];
            //高级选项中,区域选择tab标签点击事件
            $("#selectScope1").unbind("click").click(function () {//行政区
                if (!$(this).hasClass("selectTab")) {
                    $("#selectScope2").removeClass("selectTab");
                    $(this).addClass("selectTab");
                    $('#drawTools').slideUp("fast");
                    $('#seek1').slideDown("fast");
                }
            });
            $("#selectScope2").unbind("click").click(function () {//自定义
                if (!$(this).hasClass("selectTab")) {
                    $("#selectScope1").removeClass("selectTab");
                    $(this).addClass("selectTab");
                    $('#seek1').slideUp("fast");
                    $('#drawTools').slideDown("fast");
                }
            });
            //选择市区触发事件--查询对应的县区
            on(dom.byId("city"), "change", function () {
                $('#county').empty().append("<option selected=\"selected\">县区/全市</option>");
                attributeObj._countyQuery("city", "county");
            });
 
            //注册绘制事件
            attributeObj._drawGraphics();
            attributeObj._graphicslayer_attribute = new GraphicsLayer({
                id: "_attribute"
            });
            attributeObj._graphicslayer_draw = new GraphicsLayer({
                id: "_draw"
            });
            attributeObj._graphicslayer_locationQuery = new GraphicsLayer({
                id: "_location"
            });
            attributeObj._map.addLayers([attributeObj._graphicslayer_draw, attributeObj._graphicslayer_attribute, attributeObj._graphicslayer_locationQuery]);
            AppEvent.addAppEventListener("Start_Query", lang.hitch(this, function (evt) {
                if (evt) {
                    if ($('#mapQueryInput').val().substring(0, 1) === '[' && $('#mapQueryInput').val().substr(-1, 1)) {//位置查询
                        attributeObj._filledCoordinates();
                    } else {//属性查询
                        $("#bg").show();
                        attributeObj.queryTask = new QueryTask(attributeObj.mapQuery_URL);
                        //开始查询
                        if ($('#selectScope1 ').hasClass("selectTab")) {
                            attributeObj._areaQuery(false, "city", "county");
                        } else {
                            attributeObj._attributeQuery();
                        }
                    }
                }
            }));
            AppEvent.addAppEventListener(AppEvent.APPLICATION_CLEAR, lang.hitch(this, function () {
                attributeObj._graphicslayer_attribute.clear();
                attributeObj._graphicslayer_draw.clear();
                attributeObj._queryGraphic = null;
                attributeObj._layui.closeAll();
                attributeObj.objectid = [];
                attributeObj._graphicslayer_locationQuery.clear();
                attributeObj._map.infoWindow.hide();
            }));
            this.inherited(arguments);
        },
        open: function () {
            this.inherited(arguments);
        },
        //给字段选择框添加候选属性
        _selectlayer: function (selectUrl) {
            if (!selectUrl) return;
            var selectlayer = new FeatureLayer(selectUrl);
            //所选图层初始化完成回调
            selectlayer.on("load", function () {
                $('#layer_feilds').empty(); //清空现有属性字段列表
                attributeObj.displayField_name = selectlayer.displayField;
                var str = '', firstr = '';
                for (var i = 0; i < selectlayer.fields.length; i++) {
                    var regs = new RegExp("[\\u4E00-\\u9FFF]+", "g");
                    var ali = selectlayer.fields[i].alias;
                    var fieldsType = '';
                    if (regs.test(ali) && ali.toLowerCase().indexOf("object") == -1 && ali.toLowerCase().indexOf("shape") == -1 && ali.indexOf("area") == -1 && ali.indexOf("AREA") == -1 && ali.indexOf("Area") == -1 && ali.indexOf("FID") == -1) {
                        switch (selectlayer.fields[i].type) {
                            case "esriFieldTypeInteger":
                                fieldsType = 'esriFieldTypeInteger';
                                $('#layer_feilds').append("<div class='code-box-table-short' > <label name='" + selectlayer.fields[i].name + "'>" + selectlayer.fields[i].alias + "</label> <input type='text'> <span></span> <input type='text'> </div>");
                                break;
                            case "esriFieldTypeDouble":
                                fieldsType = 'esriFieldTypeDouble';
                                $('#layer_feilds').append("<div class='code-box-table-short' > <label name='" + selectlayer.fields[i].name + "'>" + selectlayer.fields[i].alias + "</label> <input type='text'> <span></span> <input type='text'> </div>");
                                break;
                            case "esriFieldTypeSmallInteger":
                                fieldsType = 'esriFieldTypeSmallInteger';
                                $('#layer_feilds').append("<div class='code-box-table-short' > <label name='" + selectlayer.fields[i].name + "'>" + selectlayer.fields[i].alias + "</label> <input type='text'> <span></span> <input type='text'> </div>");
                                break;
                            case "esriFieldTypeString":
                                fieldsType = 'esriFieldTypeString';
                                $('#layer_feilds').append("<div class='code-box-table-long' > <label name='" + selectlayer.fields[i].name + "'>" + selectlayer.fields[i].alias + "</label><input type='text'></div>");
                                break;
                            default:
                                break;
                        }
                        if (selectlayer.fields[i].name != attributeObj.displayField_name)
                            str += '<option name=\" ' + selectlayer.fields[i].name + '\"fieldsType="' + fieldsType + '\">' + selectlayer.fields[i].alias + '</option>';
                        else
                            firstr += '<option name=\" ' + selectlayer.fields[i].name + '\"fieldsType="' + fieldsType + '\">' + selectlayer.fields[i].alias + '</option>';
                    }
                }
                firstr += str;
                $('#search-fields').html(firstr);
            });
        },
        _filledField: function () {
            //获取属性字段条件框所填写的值
            var querySQL = "";
            for (var i = 0; i < $('#layer_feilds')[0].children.length; i++) {
                if ($('#layer_feilds')[0].children[i].children.length > 2) {
                    if ($($('#layer_feilds')[0].children[i].children[1]).val() != "") {
                        if (querySQL.length == 0) {
                            querySQL += $($('#layer_feilds')[0].children[i].children[0]).attr("name") + " >= " + $($('#layer_feilds')[0].children[i].children[1]).val();
                        } else {
                            querySQL += " and " + $($('#layer_feilds')[0].children[i].children[0]).attr("name") + " >= " + $($('#layer_feilds')[0].children[i].children[1]).val();
                        }
                    }
                    if ($($('#layer_feilds')[0].children[i].children[3]).val() != "") {
                        if (querySQL.length == 0) {
                            querySQL += $($('#layer_feilds')[0].children[i].children[0]).attr("name") + " <= " + $($('#layer_feilds')[0].children[i].children[3]).val();
                        } else {
                            querySQL += " and " + $($('#layer_feilds')[0].children[i].children[0]).attr("name") + " <= " + $($('#layer_feilds')[0].children[i].children[3]).val();
                        }
                    }
                } else {
                    if ($($('#layer_feilds')[0].children[i].children[1]).val() != "") {
                        if (querySQL.length == 0) {
                            querySQL += $($('#layer_feilds')[0].children[i].children[0]).attr("name") + " like '%" + $($('#layer_feilds')[0].children[i].children[1]).val() + "%'";
                        } else {
                            querySQL += " and " + $($('#layer_feilds')[0].children[i].children[0]).attr("name") + " like '%" + $($('#layer_feilds')[0].children[i].children[1]).val() + "%'";
                        }
                    }
                }
            }
            return querySQL;
        },
        _drawGraphics: function () { //自定义绘制图形
            //添加点样式
            var markerSymbol = new SimpleMarkerSymbol();
            //markerSymbol.setPath("M16,4.938c-7.732,0-14,4.701-14,10.5c0,1.981,0.741,3.833,2.016,5.414L2,25.272l5.613-1.44c2.339,1.316,5.237,2.106,8.387,2.106c7.732,0,14-4.701,14-10.5S23.732,4.938,16,4.938zM16.868,21.375h-1.969v-1.889h1.969V21.375zM16.772,18.094h-1.777l-0.176-8.083h2.113L16.772,18.094z");
            markerSymbol.setColor(new Color("#00FFFF"));
 
            // 添加线样式
            var lineSymbol = new CartographicLineSymbol(
                CartographicLineSymbol.STYLE_SOLID,
                new Color([255, 0, 0]), 10,
                CartographicLineSymbol.CAP_ROUND,
                CartographicLineSymbol.JOIN_MITER, 5
            );
 
            // 添加面样式
            var fillSymbol = new SimpleFillSymbol(
                SimpleFillSymbol.STYLE_SOLID,
                new SimpleLineSymbol(
                    SimpleLineSymbol.STYLE_SOLID,
                    new Color('#fb003b'),
                    1
                ),
                new Color([0, 0, 0, 0.15])
            );
 
            //定义绘制工具初始化函数
            var tb = new draw(attributeObj._map);
            tb.on("draw-end", function (evt) {//定义绘制结束回调函数--添加绘制图形至地图GraphicLayer图层中
                //deactivate the toolbar and clear existing graphics
                tb.deactivate();
                $('.drawTools-active').removeClass('drawTools-active');
                attributeObj._map.enableMapNavigation();
 
                // 选择绘制的形状
                var symbol;
                if (evt.geometry.type === "point" || evt.geometry.type === "multipoint") {
                    symbol = markerSymbol;
                } else if (evt.geometry.type === "line" || evt.geometry.type === "polyline") {
                    symbol = lineSymbol;
                } else {
                    symbol = fillSymbol;
                }
                attributeObj._queryGraphic = evt.geometry;
                attributeObj._graphicslayer_draw.add(new Graphic(evt.geometry, symbol));
            });
 
            // 绘制按钮点击事件,获取需要绘制的形状
            on(dom.byId("drawTools"), "click", function (evt) {
                if (evt.target.id === "drawTools") {
                    return;
                }
                if (evt.target.id === "clearAll") { //清除按钮清除事件
                    attributeObj._graphicslayer_draw.clear();
                    attributeObj._queryGraphic = null;
                    tb.deactivate();
                    $('.drawTools-active').removeClass('drawTools-active');
                    attributeObj._map.enableMapNavigation();
                    return;
                }
                $('.drawTools-active').removeClass('drawTools-active');
                $(evt.target).addClass('drawTools-active');
                attributeObj._graphicslayer_draw.clear();
                attributeObj._queryGraphic = null;
                var tool = evt.target.id.toLowerCase();
                attributeObj._map.disableMapNavigation();
                tb.activate(tool);
            });
        },
        //COUNTY查询--在县区选择栏中动态添加所包含的县区
        _countyQuery: function (city, county) {
            var city_selected = city;
            var count_selected = county;
            var Url = ConfigData.areaQueryURL + "/2";
            var queryTask = new QueryTask(Url);
            var query = new Query();
            query.returnGeometry = false;
            query.outFields = [
                "COUNTY"
            ];
            var queryParam;
            if ($('#' + city_selected + ' option:selected').text() != "市/全省") {
                queryParam = "CITY like '%" + $('#' + city_selected + ' option:selected').text() + "%'";
            }
            if (queryParam == null) {
                return;
            }
            query.where = queryParam;
            queryTask.execute(query, function (results) {
                var optionVal = results.features;
                for (var i in optionVal) {
                    $('#' + count_selected).append("<option>" + optionVal[i].attributes["COUNTY"] + "</option>");
                }
            });
        },
        //行政区查询
        _areaQuery: function (queryLocation, city, county) {
            var querylocation = queryLocation;
            var city_selected = city;
            var count_selected = county;
            var queryParam;
            var URL;
            if ($('#' + city_selected + ' option:selected').text() != "市/全省") {
                queryParam = "CITY like '%" + $('#' + city_selected + ' option:selected').text() + "%'";
                URL = ConfigData.areaQueryURL + "/1";
            }
            if ($('#' + count_selected + ' option:selected').text() != "县区/全市") {
                queryParam += "and COUNTY like '%" + $('#' + count_selected + ' option:selected').text() + "%'";
                URL = ConfigData.areaQueryURL + "/2";
            }
            //如果查询参数为空则直接查询全省范围内的数据
            if (queryParam == null) {
                attributeObj._attributeQuery();
                return;
            }
            var queryTask = new QueryTask(URL);
            var query = new Query();
            query.returnGeometry = true;
            query.where = queryParam;
            queryTask.execute(query, function (results) {
                var resultsFeatures = results.features;
                if (resultsFeatures.length > 0) {
                    if (!querylocation) { //行政区查询执行---输出指定行政区并进行属性查询
                        //获取几何中心,并定位
                        var resultGeometry = resultsFeatures[0].geometry;
                        // var cPoint;
                        var taxLotExtent = resultGeometry.getExtent();
                        attributeObj._map.setExtent(taxLotExtent);
                        attributeObj._queryGraphic = resultGeometry;
                        attributeObj._attributeQuery();
                    } else { //定位查询执行---在地图中描绘出所查询行政区,并定位至该范围
                        var str = "";
                        attributeObj._graphicslayer_locationQuery.fields = results.fields;
                        attributeObj._graphicslayer_locationQuery.displayField = results.displayFieldName;
                        attributeObj._graphicslayer_locationQuery.clear();
                        var color = Color.fromHex("#9af6f0");
                        var symbol = new SimpleFillSymbol();
                        symbol.setOutline(new SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new Color(color), 5));
                        symbol.setColor(new Color([0, 0, 0, 0.1]));
                        if (resultsFeatures.length > 0) {
                            var template = new InfoTemplate();
                            template.setTitle(attributeObj._getGraphicTitle);
                            template.setContent(attributeObj._getTextContent);
                            var featureAttributes = resultsFeatures[0].attributes;
                            var resultGeometry = resultsFeatures[0].geometry;
                            var adad = new Graphic(resultGeometry, symbol, featureAttributes, template);
                            attributeObj._graphicslayer_locationQuery.add(adad);
                            //获取几何范围,并定位
                            var cPoint;
                            var taxLotExtent = resultGeometry.getExtent();
                            // cPoint = taxLotExtent.getCenter();
                            attributeObj._map.setExtent(taxLotExtent);
                        }
                        $("#bg").hide();
                    }
                }
            }, function (error) {
                $("#bg").hide();
                console.log(error);
                alert(error.message);
            });
        },
        _attributeQuery: function () {
            //查询按钮点击回调函数--执行查询,获取满足条件的要素OBJECTID
            attributeObj._feildName = attributeObj._filledField();
            var query_text = $('#mapQueryInput').val();
            attributeObj.objectid = [];
            var query = new Query();
            query.returnGeometry = false;
            query.outFields = [
                "*"
            ];
            if (attributeObj._queryGraphic != null) {
                query.geometry = attributeObj._queryGraphic;
            }
            if (attributeObj._feildName == null || attributeObj._feildName == "") {
                if ($.trim(query_text) == "") {
                    query.where = "1=1";
                } else {
                    switch ($('#search-fields option:selected').attr('fieldsType')) {
                        case "esriFieldTypeInteger":
                        case "esriFieldTypeSmallInteger":
                        case "esriFieldTypeDouble":
                            if (isNaN($.trim(query_text))) {
                                $('#bg').hide();
                                attributeObj._layui.msg('请输入数字', {icon: 2, offset: ['50%', '50%']});
                                return;
                            }
                            query.where = $('#search-fields option:selected').attr('name') + " = " + $.trim(query_text);
                            break;
                        case "esriFieldTypeString":
                        default:
                            query.where = $('#search-fields option:selected').attr('name') + " like '%" + $.trim(query_text) + "%'";
                            break;
                    }
                }
            } else {
                switch ($('#search-fields option:selected').attr('fieldsType')) {
                    case "esriFieldTypeInteger":
                    case "esriFieldTypeSmallInteger":
                    case "esriFieldTypeDouble":
                        if (isNaN($.trim(query_text))) {
                            $('#bg').hide();
                            attributeObj._layui.msg('请输入数字', {icon: 2, offset: ['50%', '50%']});
                            return;
                        }
                        attributeObj._feildName += " and " + attributeObj.displayField_name + " = " + $.trim(query_text);
                        break;
                    case "esriFieldTypeString":
                        attributeObj._feildName += " and " + attributeObj.displayField_name + " like '%" + $.trim(query_text) + "%'";
                    default:
                        attributeObj._feildName += " and " + attributeObj.displayField_name + " like '%" + $.trim(query_text) + "%'";
                        break;
                }
                query.where = attributeObj._feildName;
            }
            attributeObj.query_param = query;
            attributeObj.queryTask.execute(query, function (results) {
                //执行查询回调函数--获取满足条件的要素OBJECTID,并对查询结果进行分页展示
                var resultCount = results.features.length;
                for (var i = 0; i < resultCount; i++) {
                    attributeObj.objectid[i] = results.features[i].attributes.OBJECTID;
                }
                attributeObj._layui.closeAll('page');
                setTimeout(function () {//延时执行等待上一个弹窗完全关闭
                    attributeObj._query_count();
                }, 300);
            }, function (error) {
                attributeObj._layui.closeAll('page');
                $("#bg").hide();
                console.log(error);
                alert(error.message);
            });
        },
        //查询满足条件的结果的总个数
        _query_count: function () {
            attributeObj.queryTask.executeForCount(attributeObj.query_param, function (result_count) {
                if (result_count > 0) {
                    if ($('#module-side-container').is(':visible')) {
                        var offset = ['97px', '420px'];
                    } else {
                        var offset = ['97px', '370px'];
                    }
                    //打开查询结果弹窗
                    attributeObj._layui.open({
                        type: 1,
                        maxmin: true,
                        title: '查询结果',
                        content: '<div id="result-container" style="overflow:hidden;"></div>',
                        area: ['300px', '470px'],
                        offset: offset,
                        scrollbar: false,
                        shade: 0,
                        success: function (layero, index) {
                            //创建查询结果DOM
                            var resultContainer = domConstruct.create('div', {
                                id: 'attributeQueryResult'
                            }, "result-container");
                            var statisticalUl = domConstruct.create('ul', {
                                id: 'statistical_ul'
                            }, resultContainer);
                            var countSpan = domConstruct.create('span', {
                                id: 'count_ul',
                                innerHTML: "总数量:" + result_count + "(个)"
                            }, statisticalUl);
                            var clearSpan = domConstruct.create('span', {
                                id: 'attr_return',
                                class: 'clearResult',
                                innerHTML: "清除结果"
                            }, statisticalUl);
                            //绑定清除结果按钮点击事件
                            on(clearSpan, 'click', function () {
                                //清空图层,关闭地图弹窗和结果弹窗
                                attributeObj._graphicslayer_attribute.clear();
                                attributeObj._graphicslayer_draw.clear();
                                attributeObj._map.infoWindow.hide();
                                attributeObj._queryGraphic = null;
                                attributeObj.objectid = [];
                                attributeObj._layui.closeAll('page');
                            });
                            //执行分页查询结果详情
                            attributeObj._query_fenye(1, resultContainer);
                        },
                        cancel: function (index, layero) {
                            // if (confirm('操作将清空查询结果,请确认关闭')) { //只有当点击confirm框的确定时,该层才会关闭
                            //清空图层,关闭地图弹窗和结果弹窗
                            attributeObj._graphicslayer_attribute.clear();
                            attributeObj._graphicslayer_draw.clear();
                            attributeObj._map.infoWindow.hide();
                            attributeObj._queryGraphic = null;
                            attributeObj.objectid = [];
                            attributeObj._layui.close(index);
                            // }
                            // return false;
                        },
                        min: function (layero) {//最小化回调
                            $('#result-container').hide();
                            $(layero).css('height', 'auto');
                            var top = $(body).height() - 43;
                            $(layero).css('height', 'auto');
                            $(layero).css('top', top + 'px');
                            setTimeout(function () {
                                (function (layero) {
                                    var left = $(body).width() - 180;
                                    $(layero).css('left', left + 'px');
                                })(layero)
                            }, 10);
                        },
                        restore: function (layero) {//还原回调
                            $('#result-container').show();
                            $(layero).css('height', '470px');
                            $(layero).css('top', offset[0]);
                            $(layero).css('left', offset[1]);
                        }
                    });
                } else {
                    attributeObj._map.infoWindow.hide();
                    attributeObj._graphicslayer_attribute.clear();
                    attributeObj._layui.closeAll('page');//关闭当前弹出的页面层
                    $("#bg").hide();
                    attributeObj._layui.msg('未查询到相应结果', {icon: 5, offset: ['50%', '50%']});
                }
            }, function (error) {
                $("#bg").hide();
                console.log(error);
                alert(error.message);
            });
        },
        //根据查询结果进行分页查询--并输出详细信息
        _query_fenye: function (pageindexs, dom) {
            $("#bg").show();
            var startIndex = 0;
            startIndex = (parseInt(pageindexs) - 1) * attributeObj.RECORDS_PER_PAGE;
            var endIndex = 0;
            endIndex = startIndex + attributeObj.RECORDS_PER_PAGE;
            if (endIndex <= attributeObj.objectid.length) {
                endIndex = endIndex;
            } else {
                endIndex = attributeObj.objectid.length;
            }
            var ids;
            ids = attributeObj.objectid.slice(startIndex, endIndex);
            var query = new Query();
            query.returnGeometry = true;
            query.objectIds = ids;
            query.outSpatialReference = attributeObj._map.spatialReference;
            query.outFields = ["*"];
            attributeObj.queryTask.execute(query, function (results) {
                var resultsFeatures = results.features;
                var displayFields = results.displayFieldName;
 
                // 销毁上一次的结果列表
                domConstruct.destroy("content_ul");
                //创建查询结果详情DOM
                if (dom) {
                    var contentUl = domConstruct.create('ul', {
                        id: 'content_ul'
                    }, dom);
                } else {
                    var contentUl = domConstruct.create('ul', {
                        id: 'content_ul'
                    }, 'attributeQueryResult');
                }
                //清空上次查询的详情
                attributeObj._graphicslayer_attribute.clear();
                attributeObj._queryGraphic = null;
                attributeObj._map.infoWindow.hide();
                //设定结果图层相关属性
                attributeObj._graphicslayer_attribute.fields = results.fields;
                attributeObj._graphicslayer_attribute.displayField = displayFields;
                var treeObj = $.fn.zTree.getZTreeObj("mapQuery_tree");
                var nodes = treeObj.getCheckedNodes(); //状态改变的节点
                attributeObj._graphicslayer_attribute.name = nodes[0].name;
 
                //初始化结果样式
                var color = Color.fromRgb("rgba(246,9,9,0.6)");
                var symbol;
                switch (results.geometryType) {
                    case "esriGeometryPoint":
                        symbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 10,
                            new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([0, 255, 255, 0.6]), 1),
                            new Color([255, 0, 0, 0.6]));
                        break;
                    case "esriGeometryPolyline":
                        symbol = new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255, 0, 0, 0.6]), 2);
                        break;
                    default:
                        symbol = new SimpleFillSymbol();
                        symbol.setOutline(new SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new Color([0, 255, 255, 0.6]), 1));
                        break;
                }
                symbol.setColor(new Color(color));
 
                //遍历查询结果,构造结果列表并将结果绘制到地图上
                for (var i = 0; i < resultsFeatures.length; i++) {
                    if (attributeObj._graphicslayer_attribute.name.indexOf("城") != -1 && attributeObj._graphicslayer_attribute.name.indexOf("湿") != -1) {
                        var li = domConstruct.create("li", {
                            innerHTML: "<span class='num'>" + (((pageindexs - 1) * attributeObj.RECORDS_PER_PAGE) + (i + 1)) + ".</span>" +
                            "<span class='displayFields'>" + resultsFeatures[i].attributes[displayFields] + "第" + resultsFeatures[i].attributes["WETLAND_NO"] + "号湿地斑块</span>",
                            style: "cursor: pointer"
                        }, contentUl);
                    } else {
                        var displayStr = resultsFeatures[i].attributes[displayFields];
                        if (displayStr==null||displayStr==''||displayStr==' '){//如果为空或者null就用图层名替代
                            displayStr =  $('.selected-layer-container input').val();
                        }
                        var li = domConstruct.create("li", {
                            innerHTML: "<span class='num'>" + (((pageindexs - 1) * attributeObj.RECORDS_PER_PAGE) + (i + 1)) + ".</span>" +
                            "<span class='displayFields'>" + displayStr + "</span>",
                            style: "cursor: pointer"
                        }, contentUl);
                    }
                    //构造矢量要素并添加到图层上
                    var template = new InfoTemplate();
                    template.setTitle(attributeObj._getGraphicTitle);
                    template.setContent(attributeObj._getTextContent);
                    var featureAttributes = resultsFeatures[i].attributes;
                    var adad = new Graphic(resultsFeatures[i].geometry, symbol, featureAttributes, template);
                    attributeObj._graphicslayer_attribute.add(adad);
                    //给结果列表添加点击事件
                    on(li, "click", lang.hitch(adad, function (evt) {
                        var cPoint;
                        switch (this.geometry.type) {
                            case "point":
                                cPoint = new Point(this.geometry.x, this.geometry.y, attributeObj._map.spatialReference); // 实例化一个点
                                break;
                            default:
                                var taxLotExtent = this.geometry.getExtent();
                                cPoint = taxLotExtent.getCenter();
                                break;
                        }
                        attributeObj._map.infoWindow.setTitle(this.getTitle());
                        attributeObj._map.infoWindow.setContent(this.getContent());
                        attributeObj._map.infoWindow.show(cPoint);
                        attributeObj._map.centerAndZoom(cPoint, 10);
                    }));
                }
                //生成翻页按钮DOM
                var pageDom = domConstruct.create('div', {
                    class: 'page'
                }, contentUl);
                if (pageindexs == 1) {
                    var previousDom = domConstruct.create('input', {
                        type: 'button',
                        value: '上一页'
                    }, pageDom);
                } else {
                    var previousDom = domConstruct.create('input', {
                        type: 'button',
                        id: 'LOOKTG',
                        value: '上一页',
                        style: 'cursor: pointer;'
                    }, pageDom);
                    on(previousDom, 'click', lang.hitch(pageindexs, function (evt) {
                        attributeObj._query_fenye(parseInt(this) - 1);
                    }));
                }
                var pageSpan = domConstruct.create('span', {
                    style: 'margin: 0px 5px;',
                    innerHTML: pageindexs + "/" + Math.ceil(attributeObj.objectid.length / attributeObj.RECORDS_PER_PAGE)
                }, pageDom);
                if (pageindexs == Math.ceil(attributeObj.objectid.length / attributeObj.RECORDS_PER_PAGE)) {
                    var nextDom = domConstruct.create('input', {
                        type: 'button',
                        value: '下一页'
                    }, pageDom);
                } else {
                    var nextDom = domConstruct.create('input', {
                        type: 'button',
                        id: 'next',
                        value: '下一页',
                        style: 'cursor: pointer;'
                    }, pageDom);
                    on(nextDom, 'click', lang.hitch(pageindexs, function (evt) {
                        attributeObj._query_fenye(parseInt(this) + 1);
                    }));
                }
                //获取当前所有查询结果的最大范围,并定位到此范围。
                if (resultsFeatures.length > 1) {
                    var featureExtent = graphicsUtils.graphicsExtent(resultsFeatures);
                    attributeObj._map.setExtent(featureExtent);
                } else {
                    if (results.geometryType == "esriGeometryPoint") {
                        attributeObj._map.centerAndZoom(resultsFeatures[0].geometry, 8);
                    } else {
                        attributeObj._map.setExtent(resultsFeatures[0].geometry.getExtent());
                    }
                }
                if ($("#statistical_ul p").length < 1) {
                    //统计前10000个满足条件的结果的总面积
                    for (var statisticsKey in config.statistics) {// 遍历得到当前图层的总面积统计字段
                        if (attributeObj.mapQuery_layerName.indexOf(statisticsKey) != -1) {
                            var statisticalField = config.statistics[statisticsKey].itemFields[1];
                        }
                    }
                    attributeObj.query_param.outFields = [statisticalField];
                    attributeObj.queryTask.execute(attributeObj.query_param, function (area_results) {
                        if (area_results.features.length > 0) {
                            var areaSum = 0;
                            for (var i in area_results.features) {
                                areaSum += area_results.features[i].attributes[statisticalField];
                            }
                            if (area_results.features.length > 9999) {
                                var txt = "前10000个查询结果总面积为" + areaSum.toFixed(2) + "公顷";
                            } else {
                                var txt = "查询结果总面积为" + areaSum.toFixed(2) + "公顷";
                            }
                            domConstruct.create('p', {
                                style: 'color: #9a9a9a;margin-top: 5px;',
                                innerHTML: txt
                            }, 'statistical_ul');
                        }
                    }, function (e) {
                        console.log(e);
                    });
                }
                $("#bg").hide();
            }, function (error) {
                $("#bg").hide();
                console.log(error);
                alert(error.message);
            });
        },
        //定位查询--判断坐标格式并生成位置点
        _filledCoordinates: function () {
            attributeObj._layui.closeAll('page');
            $("#bg").show();
            //获取所填写的坐标
            var _graphic;
            var Coordinates = $('#mapQueryInput').val().substring(1, $('#mapQueryInput').val().length - 1);
            if ((Coordinates == "") || (Coordinates.indexOf(",") <= -1)) {
                attributeObj._layui.msg('请输入规范的坐标', {icon: 2, offset: ['50%', '50%']});
                return;
            }
            var long_lat = Coordinates.split(",");
            if (long_lat.length < 2 || long_lat.length > 2) {
                attributeObj._layui.msg('请输入规范的坐标', {icon: 2, offset: ['50%', '50%']});
                return;
            }
            var long = long_lat[0];
            var lat = long_lat[1];
            if (isNaN(lat) || isNaN(long)) {
                attributeObj._layui.msg('请输入规范的坐标', {icon: 2, offset: ['50%', '50%']});
                return;
            }
            var mm = long.toString();
            var nn = mm.split(".");
            var yy = nn[0];
            attributeObj._graphicslayer_locationQuery.clear(); //添加新坐标点前先清空现有坐标点
            if (yy.length >= 8) {//投影坐标
                var zz = yy.substring(2, yy.length);
                long = zz + "." + nn[1];
                long = parseFloat(long);
                //转换坐标系至CGCS2000
                var poin = new Point(parseFloat(long), parseFloat(lat), new SpatialReference(4548));
                var projectParameters = new ProjectParameters();
                projectParameters.geometries = [poin];
                projectParameters.outSR = new SpatialReference(4490);
                attributeObj._geometryservice.project(projectParameters, function (result) {
                    var symbol = new PictureMarkerSymbol({
                        "url": "images/sign2.png",
                        "height": 30,
                        "width": 15,
                        "yoffset": 15
                    });
                    _graphic = new Graphic(result[0], symbol);
                    attributeObj._graphicslayer_locationQuery.add(_graphic); //添加坐标点
                    attributeObj._map.centerAndZoom(result[0], 10); //定位至该坐标点
                    attributeObj.locationQuery(_graphic);//开始定位查询
                });
            } else {//地理坐标
                if ((long > 180 && lat < 90) || (long < 180 && lat > 90) || isNaN(lat) || isNaN(long)) {
                    attributeObj._layui.msg('请输入规范的坐标', {icon: 2, offset: ['50%', '50%']});
                    return;
                }
                var point = new Point(parseFloat(long), parseFloat(lat), new SpatialReference(4490)); // 实例化一个点
                var symbol = new PictureMarkerSymbol({
                    "url": "images/sign2.png",
                    "height": 30,
                    "width": 15,
                    "yoffset": 15
                });
                _graphic = new Graphic(point, symbol);
                attributeObj._graphicslayer_locationQuery.add(_graphic); //添加坐标点
                attributeObj._map.centerAndZoom(point, 15); //定位至该坐标点
                setTimeout(function () {
                    attributeObj.locationQuery(_graphic);//开始定位查询
                }, 1000);
            }
        },
        //定位查询--多图层查询
        locationQuery: function (graphic) {
            var identifyTask = new IdentifyTask(ConfigData.areaQueryURL.replace(/JIANGXI_BORDER/, 'ZHSD'));
            var identifyParameters = new IdentifyParameters();
            identifyParameters.layerIds = [0, 1, 2, 3, 4, 5, 6];//查所有图层
            identifyParameters.layerOption = IdentifyParameters.LAYER_OPTION_ALL;
            identifyParameters.returnGeometry = true;
            identifyParameters.tolerance = 3;
            identifyParameters.mapExtent = attributeObj._map.extent;
            identifyParameters.geometry = graphic.geometry;
            identifyTask.execute(identifyParameters, function (e) {
                var result_count = e.length;
                var resultsFeatures = e;
                if (result_count > 0) {
                    //清空上次查询的详情
                    attributeObj._graphicslayer_attribute.clear();
                    attributeObj._map.infoWindow.hide();
                    if ($('#module-side-container').is(':visible')) {
                        var offset = ['97px', '420px'];
                    } else {
                        var offset = ['97px', '370px'];
                    }
                    //打开查询结果弹窗
                    attributeObj._layui.open({
                        type: 1,
                        maxmin: true,
                        title: '查询结果',
                        content: '<div id="result-container" style="overflow:hidden;"></div>',
                        area: ['300px', '470px'],
                        offset: offset,
                        scrollbar: true,
                        shade: 0,
                        success: function (layero, index) {
                            //创建查询结果DOM
                            var resultContainer = domConstruct.create('div', {
                                id: 'attributeQueryResult'
                            }, "result-container");
                            var statisticalUl = domConstruct.create('ul', {
                                id: 'statistical_ul'
                            }, resultContainer);
                            var countSpan = domConstruct.create('span', {
                                id: 'count_ul',
                                innerHTML: "总数量:" + result_count + "(个)"
                            }, statisticalUl);
                            var clearSpan = domConstruct.create('span', {
                                id: 'attr_return',
                                class: 'clearResult',
                                innerHTML: "清除结果"
                            }, statisticalUl);
                            //绑定清除结果按钮点击事件
                            on(clearSpan, 'click', function () {
                                //清空图层,关闭地图弹窗和结果弹窗
                                attributeObj._graphicslayer_locationQuery.clear();
                                attributeObj._graphicslayer_attribute.clear();
                                attributeObj._map.infoWindow.hide();
                                attributeObj._layui.closeAll('page');
                            });
                            // 销毁上一次的结果列表
                            domConstruct.destroy("content_ul");
                            //创建查询结果详情DOM
                            if (statisticalUl) {
                                var contentUl = domConstruct.create('ul', {
                                    id: 'content_ul',
                                    style: 'height:368px;overflow:auto'
                                }, statisticalUl);
                            } else {
                                var contentUl = domConstruct.create('ul', {
                                    id: 'content_ul',
                                    style: 'height:368px;overflow:auto'
                                }, 'attributeQueryResult');
                            }
                            //遍历查询结果,构造结果列表并将结果绘制到地图上
                            for (var i = 0; i < resultsFeatures.length; i++) {
                                //初始化结果样式
                                var color = Color.fromRgb("rgba(246,9,9,0.6)");
                                var symbol;
                                switch (resultsFeatures[i].geometryType) {
                                    case "esriGeometryPoint":
                                        symbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 10,
                                            new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([0, 255, 255, 0.6]), 1),
                                            new Color([255, 0, 0, 0.6]));
                                        break;
                                    case "esriGeometryPolyline":
                                        symbol = new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255, 0, 0, 0.6]), 2);
                                        break;
                                    default:
                                        symbol = new SimpleFillSymbol();
                                        symbol.setOutline(new SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new Color([0, 255, 255, 0.6]), 1));
                                        break;
                                }
                                symbol.setColor(new Color(color));
                                if (resultsFeatures[i].layerName.indexOf("城") != -1 && resultsFeatures[i].layerName.indexOf("湿") != -1) {
                                    var listName = resultsFeatures[i].value + "第" + resultsFeatures[i].feature.attributes["湿地斑块序号"] + "号湿地斑块";
                                } else {
                                    var listName = resultsFeatures[i].value;
                                }
                                var li = domConstruct.create("li", {
                                    innerHTML: "<span class='num'>" + (i + 1) + ".</span><span class='displayFields'>" + resultsFeatures[i].layerName + ':' + listName + "</span>",
                                    style: "cursor: pointer"
                                }, contentUl);
                                //构造矢量要素并添加到图层上
                                var template = new InfoTemplate();
                                template.setTitle(listName != ' ' ? listName : resultsFeatures[i].layerName);
                                template.setContent(attributeObj._locationGetTextContent);
                                var adad = resultsFeatures[i].feature;
                                adad.symbol = symbol;
                                adad.infoTemplate = template;
                                attributeObj._graphicslayer_attribute.add(adad);
                                //给结果列表添加点击事件
                                on(li, "click", lang.hitch(adad, function (evt) {
                                    var cPoint;
                                    switch (this.geometry.type) {
                                        case "point":
                                            cPoint = new Point(this.geometry.x, this.geometry.y, attributeObj._map.spatialReference); // 实例化一个点
                                            break;
                                        default:
                                            var taxLotExtent = this.geometry.getExtent();
                                            cPoint = taxLotExtent.getCenter();
                                            break;
                                    }
                                    attributeObj._map.infoWindow.setTitle(this.getTitle());
                                    attributeObj._map.infoWindow.setContent(this.getContent());
                                    attributeObj._map.infoWindow.show(cPoint);
                                    attributeObj._map.centerAndZoom(cPoint, 10);
                                }));
                            }
                            $("#bg").hide();
                        },
                        cancel: function (index, layero) {
                            // if (confirm('操作将清空查询结果,请确认关闭')) { //只有当点击confirm框的确定时,该层才会关闭
                            //清空图层,关闭地图弹窗和结果弹窗
                            attributeObj._graphicslayer_attribute.clear();
                            attributeObj._graphicslayer_locationQuery.clear();
                            attributeObj._map.infoWindow.hide();
                            attributeObj._layui.close(index);
                        },
                        min: function (layero) {//最小化回调
                            $('#result-container').hide();
                            $(layero).css('height', 'auto');
                            var top = $(body).height() - 43;
                            $(layero).css('height', 'auto');
                            $(layero).css('top', top + 'px');
                            setTimeout(function () {
                                (function (layero) {
                                    var left = $(body).width() - 180;
                                    $(layero).css('left', left + 'px');
                                })(layero)
                            }, 10);
                        },
                        restore: function (layero) {//还原回调
                            $('#result-container').show();
                            $(layero).css('height', '470px');
                            $(layero).css('top', '145px');
                            $(layero).css('left', '64%');
                        }
                    });
                } else {
                    attributeObj._map.infoWindow.hide();
                    attributeObj._graphicslayer_attribute.clear();
                    attributeObj._layui.closeAll('page');//关闭当前弹出的页面层
                    $("#bg").hide();
                    attributeObj._layui.msg('当前位置未查询到湿地斑块', {icon: 5, offset: ['50%', '50%']});
                }
            }, function (e) {
                $("#bg").hide();
                console.log(e);
            });
        },
        _getGraphicTitle: function (graphic) {
            var layer = graphic.getLayer();
            if (layer.name.indexOf("城") != -1 && layer.name.indexOf("湿") != -1) {
                var title = graphic.attributes[layer.displayField] + "第" + graphic.attributes["WETLAND_ON"] + "号湿地斑块";
            } else {
                var title = graphic.attributes[layer.displayField] || layer.name;
            }
            return title;
        },
        _getTextContent: function (graphic) {
            var content = "";
            content += "<div class='con'>";
            var layer = graphic.getLayer();
            for (var a = 0; a < layer.fields.length; a++) {
                var ming = layer.fields[a].name;
                var ali = layer.fields[a].alias;
                if (ali != "OBJECTID" && graphic.attributes[ming] != null) {
                    var regs = new RegExp("[\\u4E00-\\u9FFF]+", "g");
                    if (regs.test(ali) && ali.toLowerCase().indexOf("object") == -1 && ali.toLowerCase().indexOf("shape") == -1 &&
                        ali.indexOf("area") == -1 && ali.indexOf("AREA") == -1 && ali.indexOf("Area") == -1 && ali.indexOf("FID") == -1) {
                        content += "<div>" + layer.fields[a].alias + ":<b>" + graphic.attributes[ming] + "</b></div>";
                    }
                }
            }
            //判断特定图层,显示图片、全景、视频
            content += "</div>";
            $('.actionList').children('a:first').nextAll().remove(); //清除“缩放至”之后的所有元素
            return content;
        },
        _locationGetTextContent: function (graphic) {
            var content = "";
            content += "<div class='con'>";
            for (var a in graphic.attributes) {
                if (graphic.attributes[a] != null && graphic.attributes[a] != undefined) {
                    var regs = new RegExp("[\\u4E00-\\u9FFF]+", "g");
                    if (regs.test(a)) {
                        content += "<div>" + a + ":<b>" + graphic.attributes[a] + "</b></div>";
                    }
                }
            }
            //判断特定图层,显示图片、全景、视频
            content += "</div>";
            $('.actionList').children('a:first').nextAll().remove(); //清除“缩放至”之后的所有元素
            return content;
        }
    });
    return Widget;
});