10646c94
Andy
add
|
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
|
/**
* Created by mac on 17/11/27.
*/
//setDist(sysComm.cityId);
var height = document.documentElement.clientHeight - 150;
$('#main-wrap').height(height)
var guideLevel=['零','一','二','三','四','五','六','七'];
//回车事件
$(function(){
$(document).keydown(function (event) {
if (event.keyCode == 13) {
$("#ser-button").click();
}
});
//输入框提示
// searchOption.ini();
});
/*搜索*/
$('#ser-button').on('click', function () {
commonClass.setPopupVisible(false);
var req = getQueryParam();
req.flag=0;//0-查询按钮触发,1-页码触发,-1后一页,-2 前一页
queryGuideByCondition(req);
//songcxa
$(".cancelBtn").css("display", "block");
});
/*
@ songcxa
@ 搜索功能
*/
var searchOption = {
ini: function () {
var searchBox = $('#ser-input');
/*
@ inputID输入框id
@ popID提示框id
@ queryOption(url、queryParames请求参数post、itemsSelectCallback提示框选择事件)
*/
var option = {
url: dataUrl.util.listGuideScreenByAreaCodes(),
async: false,
queryParames: function () {
return getQueryParam();
},
itemsSelectCallback: function (ev) {
searchBox.val(ev);
}
};
commonClass.popupObject("ser-input", "ser-resPanel", option);
},
}
//获取停车场信息
getParkingLotGeo();
function getParkingLotGeo () {
var parkLot = fn.getParkLot();
var plnos = [];
$.each(parkLot, function (index, item) {
plnos.push(item.code);
})
plNos = [];
var req = {
sysCode: sysComm.sysCode,
plNos: plnos,
}
var opt = {
method: 'post',
url: dataUrl.util.queryParkingLotGeoByPlNos(),
async: false,
data: JSON.stringify(req),
success: function (res) {
if (res.code == '8888') {
//获取数据成功
var data = res.data;
if(data.length > 0){
firstPark = data[0];
}
if(data.length > 1){
firstPark = data[1];
}
setCityInfo();
map = new BMap.Map('allmap', {enableMapClick: false});
//第1步:设置地图中心点,当前城市
point = new BMap.Point(sysComm.point_lng, sysComm.point_lat);
//第2步:初始化地图,设置中心点坐标和地图级别。
map.centerAndZoom(point, 13);
map.setCurrentCity(sysComm.cityName); // 设置地图显示的城市 此项是必须设置的
//第3步:启用滚轮放大缩小
map.enableScrollWheelZoom(true);
/*map.addEventListener("click", function () {
colseInfoWindow();
});*/
//加载地图上的诱导屏
getGuideMapInfo();
//默认全部
$("#ser-button").click();
}
}
}
sysAjax(opt);
}
function setDist(cityId) {
$(".select").empty();
cityId+='';
var allDist = [];
var distArray = cityData.dist[cityId];
var html='';
$.each(distArray,function (index,item) {
allDist.push(item.id);
html+="<li data-value='"+item.id+"'>"+item.areaName+"</li>"
});
$(".select").html("<p data-value="+allDist+">全部</p><ul style=' overflow-y: auto;'><li data-value="+allDist+" class='Selected'>全部</li>"+html+"</ul>");
selectOptionFun();
}
//设置中心城市信息
function setCityInfo(){
sysComm.cityId = firstPark.plCityId;
sysComm.cityName = firstPark.plCityName;
sysComm.provId = firstPark.plProvinceId;
sysComm.point_lng = firstPark.lonId;
sysComm.point_lat = firstPark.latId;
setDist(sysComm.cityId);
$(".cityName").text(sysComm.cityName);
}
$(function(){
$(".select p").click(function(e){
$(".select1").removeClass('open');
$(".select").toggleClass('open');
e.stopPropagation();
});
$(".content .select ul li").click(function(e){
var _this=$(this);
$(".select > p").text(_this.text());
$(".select > p").attr('data-value',_this.attr('data-value'));
_this.addClass("Selected").siblings().removeClass("Selected");
$(".select").removeClass("open");
e.stopPropagation();
});
$(document).on('click',function(){
$(".select").removeClass("open");
});
$(".select1 p").click(function(e){
$(".select").removeClass('open');
$(".select1").toggleClass('open');
e.stopPropagation();
});
$(".content .select1 ul li").click(function(e){
var _this=$(this);
$(".select1 > p").text(_this.text());
$(".select1 > p").attr('data-value',_this.attr('data-value'));
_this.addClass("Selected").siblings().removeClass("Selected");
$(".select1").removeClass("open");
e.stopPropagation();
});
$(document).on('click',function(){
$(".select1").removeClass("open");
});
});
function selectOptionFun(){
$(".select p").click(function(e){
$(".select1").removeClass('open');
$(".select").toggleClass('open');
e.stopPropagation();
});
$(".content .select ul li").click(function(e){
var _this=$(this);
$(".select > p").text(_this.text());
$(".select > p").attr('data-value',_this.attr('data-value'));
_this.addClass("Selected").siblings().removeClass("Selected");
$(".select").removeClass("open");
e.stopPropagation();
});
$(document).on('click',function(){
$(".select").removeClass("open");
});
$(".select1 p").click(function(e){
$(".select").removeClass('open');
$(".select1").toggleClass('open');
e.stopPropagation();
});
$(".content .select1 ul li").click(function(e){
var _this=$(this);
$(".select1 > p").text(_this.text());
$(".select1 > p").attr('data-value',_this.attr('data-value'));
_this.addClass("Selected").siblings().removeClass("Selected");
$(".select1").removeClass("open");
e.stopPropagation();
});
$(document).on('click',function(){
$(".select1").removeClass("open");
});
}
function getQueryParam(){
var serVal = $.trim($('#ser-input').val());
var countryIds = $(".select .Selected").attr('data-value');
var levels = $(".select1 .Selected").attr('data-value');
var countryId = [];
var level = [];
if (countryIds) {
countryId = countryIds.split(',');
}
if(levels){
level = levels.split(',');
}
if (levels.length > 0 || serVal != '') {
$("#guidance-level").hide();
$(".ser-result-wrap").addClass("ser-result-wrap-noTop");
}
else {
$(".ser-result-wrap").removeClass("ser-result-wrap-noTop");
$("#guidance-level").show();
}
var req = {
queryStr: serVal,
parkNameOrAddress:serVal,
areaCodes: countryId,
dataState:1,
levels: level,
baseRequest: {
pageNum: 1,
pageSize: 10
},
flag:0,
curPage:0,
index:0,
selector:null
}
return req;
}
//根据条件分页查询诱导屏
function queryGuideByCondition(req){
clearGuideScreen();
map.centerAndZoom(point, 13);
var opt = {
method: "post",
data: JSON.stringify(req),
url: dataUrl.util.listGuideScreenByAreaCodes(),
success: function (res, xhr, status) {
console.log(res)
//清空内容
$('#guide_result').empty();
if (res.code == '8888') {
var pageCount = res.data.pages == undefined || null == res.data.pages ? 0 : res.data.pages;
createHtml(res.data);
var flag = req.flag;
//icon_load(pageCount);
if(flag==0){//查询
icon_load(pageCount);
}
else if(flag==1){//页码
num_click(pageCount,req.curPage,req.selector);
}
else if(flag==-1){//下一页
pageDown_click(pageCount,req.curPage,req.index);
}
else if(flag==-2){//上一页
pageUp_click(pageCount,req.curPage,req.index);
}
}
}
}
sysAjax(opt);
//加载诱导屏数量
var cond = {
queryStr: req.queryStr,
areaCodes: req.areaCodes,
dataState:1,
levels: req.levels
};
var tempOpt = {
method: "post",
data: JSON.stringify(cond),
url: dataUrl.util.statisticsGuideScreenLevelByAreaCodes(),
success: function (data) {
if (data.code == '8888') {
$("#guidance-level_1").text(0);
$("#guidance-level_2").text(0);
$("#guidance-level_3").text(0);
$.each(data.data, function (index, domEle) {
$('#guidance-level_' + domEle.level).text(domEle.num);
});
}
}
}
sysAjax(tempOpt);
//加载地图marker
getGuideMapInfo();
//查询所有的,不分页
if(req.flag == 0){
req.baseRequest.pageNum = 1;
req.baseRequest.pageSize = 0;
var opt = {
method: "post",
data: JSON.stringify(req),
url: dataUrl.util.listGuideScreenByAreaCodes(),
success: function (res, xhr, status) {
if (res.code == '8888') {
var datas = (res.data.dataList)==null?[]:(res.data.dataList);
var guideDataTemp = [];
$.each(guideData, function (index, item) {
$.each(datas, function(_index,_item) {
if(_item.guideNo == item.guideNo){
guideDataTemp.push(item);
}
});
});
drawMarker(guideDataTemp);
}
}
}
sysAjax(opt);
}
}
$(function(){
$(".select p").click(function(e){
$(".select1").removeClass('open');
$(".select").toggleClass('open');
e.stopPropagation();
});
$(".content .select ul li").click(function(e){
var _this=$(this);
$(".select > p").text(_this.text());
$(".select > p").attr('data-value',_this.attr('data-value'));
_this.addClass("Selected").siblings().removeClass("Selected");
$(".select").removeClass("open");
e.stopPropagation();
});
$(document).on('click',function(){
$(".select").removeClass("open");
});
$(".select1 p").click(function(e){
$(".select").removeClass('open');
$(".select1").toggleClass('open');
e.stopPropagation();
});
$(".content .select1 ul li").click(function(e){
var _this=$(this);
$(".select1 > p").text(_this.text());
$(".select1 > p").attr('data-value',_this.attr('data-value'));
_this.addClass("Selected").siblings().removeClass("Selected");
$(".select1").removeClass("open");
e.stopPropagation();
});
$(document).on('click',function(){
$(".select1").removeClass("open");
});
});
/*function createHtml(){
var html = '';
for(var i=0;i<10;i++){
html+='<li>'+
'<div class="float-left ser-result-l">'+
'<div>1.创业路南口</div>'+
'<div>停车场数:5</div>'+
'<div>空闲车位总数:50000</div>'+
'<div>诱导级别:一级</div>'+
'</div>'+
'<div class="img-wrap float-right" style="background: #f00"></div>'+
'</li>';
}
$('#result').empty().html(html);
};*/
function createHtml(data){
if(data.dataList==null||data.dataList.length<1){
$('#guide_result').empty().text('没有搜索到匹配内容');
$('#pageGro').hide();
$('#ser-wrap').show();
return;
}
var html = '';
var list = data.dataList == undefined || data.dataList == null ? [] : data.dataList;
var i = 1;
$.each(list, function (index, item) {
var guideName = item.guideName;
var guideNo = item.guideNo;
var parkingNum = item.parkingNum;
if(parkingNum==null){
parkingNum = 0;
}
var freeBerthNum = item.freeBerthNum;
var level = item.level;
var picturePath = item.picturePath;
var x = item.lonId;
var y = item.latId;
//html+='<li data-value='+guideNo+' x-value='+x+' y-value='+y+'>'+
// '<div class="float-left ser-result-l ">'+
// '<div data-value='+guideName+'>'+(i++)+'.'+guideName+'</div>'+
// '<div>停车场数:'+parkingNum+'</div>'+
// '<div>空闲车位总数:'+freeBerthNum+'</div>'+
// '<div>诱导级别:'+guideLevel[level]+'级</div>'+
// '</div>'+
// '<div class="img-wrap float-right" style="">'+'<img src="' + picturePath + '">'+'</div>'+
// '</li>';
//new
var no = "<a href='javascript:void(0)' class='indexNo indexNo-" + (index + 1) + "'></a>";
html+='<li data-value='+guideNo+' x-value='+x+' y-value='+y+'>'+
'<div class="indexLi indexLi-' + (index + 1) + ' float-left ser-result-l ">' +
'<div class="indexRow" data-value=' + guideName + '>' + no + '<span title=' + guideName + '>' + commonClass.cutString(guideName, 14) + '</span></div>' +
'<div>停车场数:'+parkingNum+'</div>'+
'<div>空闲车位总数:'+freeBerthNum+'</div>'+
'<div>诱导级别:<span>' + guideLevel[level] + '级</span></div>' +
'<div title="' + item.address + '">地址 : ' + commonClass.cutString(item.address,15) + '</div>' +
'</div>'+
'</li>';
/*if (level==1){
html+='<div class="img-wrap float-right" style="">'+'<img src="../../assets/pages/scripts/operMonFile/img/guideico_level1.jpg">'+'</div>';
}else if(level==2){
html+='<div class="img-wrap float-right" style="">'+'<img src="../../assets/pages/scripts/operMonFile/img/guideico_level2.jpg">'+'</div>';
}else {
html+='<div class="img-wrap float-right" style="">'+'<img src="../../assets/pages/scripts/operMonFile/img/guideico_level3.jpg">'+'</div>';
}*/
});
$('#guide_result').empty().html(html);
$('#ser-wrap').show();
$('#pageGro').show();
//滚动
$('#guide_result').animate({
scrollTop: $('#guide_result').offset().top-1000
}, 150);
$('#guide_result').empty().html(html);
$('#ser-wrap').show();
$('#pageGro').show();
};
//点击分页按钮触发
$(document).on("click","#pageGro li",function(){
var pageNum = parseInt($(this).html());//获取当前页数
var selector = $(this);
var req = getQueryParam();
req.baseRequest.pageNum = pageNum;
req.curPage = pageNum;
req.selector = selector;
req.flag = 1;
queryGuideByCondition(req);
});
//点击上一页触发
$(document).on("click","#pageGro .pageUp",function(){
var pageNum = parseInt($("#pageGro li.on").html());//获取当前页
var index = $("#pageGro ul li.on").index();//获取index
var req = getQueryParam();
req.baseRequest.pageNum = pageNum-1;
req.curPage = pageNum;
req.index = index;
req.flag = -2;
queryGuideByCondition(req);
});
//点击下一页触发
$(document).on("click","#pageGro .pageDown",function(){
var pageNum = parseInt($("#pageGro li.on").html());//获取当前页
var index = $("#pageGro ul li.on").index();//获取index
var req = getQueryParam();
req.baseRequest.pageNum = pageNum+1;
req.curPage = pageNum;
req.index = index;
req.flag = -1;
queryGuideByCondition(req);
});
//地图
//地图
var clear_flag = false;
var map; //Map实例
//后台传过来
// var currentLat = 118.922316;
// var currentLon = 42.25953;
//第4步:向地图中添加缩放控件
var ctrlNav = new window.BMap.NavigationControl({
// 靠右上角位置
anchor: BMAP_ANCHOR_TOP_RIGHT,
// LARGE类型
type: BMAP_NAVIGATION_CONTROL_ZOOM,
//偏离值
offset: new BMap.Size(55, 80)
});
// map.addControl(ctrlNav);
//第5步:检测浏览器兼容
function checkhHtml5() {
if (typeof(Worker) === "undefined") {
if (navigator.userAgent.indexOf("MSIE 9.0") <= 0) {
alert("定制个性地图示例:IE9以下不兼容,推荐使用百度浏览器、chrome、firefox、safari、IE10");
}
}
}
checkhHtml5();
//诱导屏 渲染
guideData=[];
//getGuideMapInfo();
function drawMarker(guideDatas) {
//清除以前的点位
map.clearOverlays();
//第7步:绘制点
var marker = [];
var newpoiX = null;//坐标
var newpoiY = null;
var guideNo = null;//编号
var popLevel = null;//诱导级别
var popRule = null;//空闲车位
for (var i = 0; i < guideDatas.length; i++) {
newpoiX = guideDatas[i].pointX;
newpoiY = guideDatas[i].pointY;
guideNo = guideDatas[i].guideNo;
popLevel = guideDatas[i].level;
popRule = guideDatas[i].rule;
// console.log(popLevel);
var point = new BMap.Point(newpoiX, newpoiY);
// addMarker(point)
var newRule = popRule;
if (popLevel == 1) {
var myIcon = new BMap.Icon("../../assets/pages/scripts/operMonFile/img/guidance_1.png",
new BMap.Size(32,24), {
offset: new BMap.Size(0, 24),
textColor: '#fff'
});
marker[i] = new BMap.Marker(point, {icon: myIcon});
map.addOverlay(marker[i]);
} else if (popLevel==2) {
var myIcon2 = new BMap.Icon("../../assets/pages/scripts/operMonFile/img/guidance_2.png",
new BMap.Size(32,24), {
offset: new BMap.Size(0, 24),
textColor: '#fff'
});
marker[i] = new BMap.Marker(point, {icon: myIcon2});
map.addOverlay(marker[i]);
} else if (popLevel==3) {
var myIcon3 = new BMap.Icon("../../assets/pages/scripts/operMonFile/img/guidance_3.png",
new BMap.Size(32,24), {
offset: new BMap.Size(0, 24),
textColor: '#fff'
});
marker[i] = new BMap.Marker(point, {icon: myIcon3});
map.addOverlay(marker[i]);
}
marker[i].popLevel = guideDatas[i].level;
marker[i].guideNo = guideDatas[i].guideNo;
marker[i].newpoiX = guideDatas[i].pointX;
marker[i].newpoiY = guideDatas[i].pointY;
marker[i].rule = guideDatas[i].rule;
marker[i].addEventListener("click", function (n) {
var newpoiY = n.target.newpoiY;
var guideNo = n.target.guideNo;
var newpoiX = n.target.newpoiX;
var popLevel = Number(n.target.popLevel);
var rule=n.target.rule;
map.clearOverlays();
addInfoWindow(guideNo, popLevel, newpoiX, newpoiY)
});
};
removeCluster(marker);
}
// 获取位置
function theLocation(x, y, guideNo) {
// map.clearOverlays();
var new_point = new BMap.Point(x, y);
map.panTo(new_point);
map.centerAndZoom(new_point, 16);
addInfoWindow(guideNo, null, x, y);
}
//点击左侧列表显示相应诱导icon
$(document).on('click', '#guide_result >li', function () {
//$(this).addClass('clickActive').siblings('li').removeClass('clickActive');
var x = $(this).attr("x-value");
var y = $(this).attr("y-value");
var guideNo = $(this).attr("data-value");
theLocation(x, y, guideNo);
var guideDataTemp = [];
$.each(guideData, function (index, item) {
if(guideNo == item.guideNo){
guideDataTemp.push(item);
}
});
drawMarker(guideDataTemp);
});
//三个级别诱导弹窗
function addInfoWindow(guideNo, popLevel, newpoiX, newpoiY) {
var guideNO = guideNo;
var level = Number(popLevel);
var point = new BMap.Point(newpoiX, newpoiY);
var req = {
guideNo: guideNO,
sysCode: sysComm.sysCode
};
var opt = {
data: JSON.stringify(req),
url: dataUrl.util.getGuideScreenInfo(),
method: "POST",
success: function (res, status, xhr) {
var data = res.data;
if (res.code === "8888") {
level = data.level;
var showPic = data.showPic;
if(showPic!=undefined && showPic==true){
alertFirstLevelGuideInfo(data, point);
}else{
if (1 == level) {
alertFirstLevelGuideInfo(data, point);
} else if (2 == level) {
alertSecondLevelGuideInfo(data, point);
} else if (3 == level) {
alertThridLevelGuideInfo(data, point);
} else {
console.log("未知的诱导屏等级 level=" + level);
}
}
} else {
console.log("服务请求报错:code=" + res.code + "errMsg=" + res.msg + "-" + res.errMsg);
}
}
}
sysAjax(opt);
$('.BMapLabel').empty();
}
function removeCluster(marker) {
if(clear_flag){
markerClusterer.clearMarkers(); //此步骤需要
}
markerClusterer = new BMapLib.MarkerClusterer(map,
{
markers:marker,
styles : [{
url: '../../assets/pages/scripts/operMonFile/img/map/guidescreen.png',
size: new BMap.Size(53, 52),
textColor: '#fff',
fontSize:'18px'
}],
});
markerClusterer.setMaxZoom(13);
clear_flag = true;
// window.Bmap.tmpMarkerClusterer = markerClusterer;
}
//map.addEventListener("click", function () {
// colseInfoWindow()
//});
function colseInfoWindow() {
$(".pop-common").css("display", "none");
}
//获取地图上诱导屏的信息
function getGuideMapInfo() {
var cond = getQueryParam();
cond.baseRequest.pageSize=300;
var tempOpt = {
method: "post",
data: JSON.stringify(cond),
url: dataUrl.util.listGuideScreenByAreaCodes(),
success: function (data) {
if (data.code == '8888') {
guidanceMapInfo(data.data.dataList);
}
else {
console.log("服务请求报错:code=" + data.code + "errMsg=" + data.msg + "-" + data.errMsg);
}
}
}
sysAjax(tempOpt);
}
//将诱导屏位置数据放入List中
function guidanceMapInfo(data) {
//map.clearOverlays();
guideData = [];
// console.log(data)
if(data!=null){
$.each(data, function (index, domEle) {
var freeBerthNum = domEle.freeBerthNum;
var berthNum = domEle.berthNum;
if (freeBerthNum == null) {
freeBerthNum = 0;
}
if (berthNum == null || berthNum == 0) {
freeBerthNum = 0;
berthNum = 1;
}
guideData.push({
'guideNo': domEle.guideNo, 'pointX': domEle.lonId, 'pointY': domEle.latId,
'level': domEle.level, 'rule': freeBerthNum / berthNum
});
});
}
//console.log("地图上的数据" + JSON.stringify(guideData));
//加载地图位置气泡
drawMarker(guideData);
};
//弹出一级诱导信息
function alertFirstLevelGuideInfo(data, point) {
console.log(data)
clearGuideScreen();
$("#guidance1-pop").empty();
var guideHtml = '';
if(undefined == data.filePaths ||null == data.filePaths){
guideHtml+='<div class="guipop_close pos-abs ITD-cursor-pointer"></div><img src="../../assets/pages/scripts/operMonFile/img/guide_first_img_error.png" alt="">';
var myLabel1 = new BMap.Label("<div class='pop-common'>" + guideHtml + "</div>", {
offset: new BMap.Size(-380, -250), //label的偏移量,为了让label的中心显示在点上
position: point
});
myLabel1.setStyle({
color: "#F0F0F0",
fontSize: "12px",
//height: "220px",
// width: "350px",
padding: "5px",
whiteSpace: "normal",
//fontFamily: "微软雅黑",
zIndex: "1000",
backgroundColor: "rgba(0, 0, 0, 0)",
border: "0px"
});
map.addOverlay(myLabel1, point);
map.panTo(point);
}else{
if(data.filePaths.length>1){
guideHtml+='<div class="guipop_close pos-abs ITD-cursor-pointer"></div><div class="pos-abs guiico_left ITD-cursor-pointer" id="guiico_left"></div><img id="guilevel_img" src="" alt=""><div class="pos-abs guiico_right ITD-cursor-pointer" id="guiico_right"></div>';
var myLabel1 = new BMap.Label("<div class='pop-common'>" + guideHtml + "</div>", {
offset: new BMap.Size(-380, -250), //label的偏移量,为了让label的中心显示在点上
position: point
});
myLabel1.setStyle({
color: "#F0F0F0",
fontSize: "12px",
//height: "220px",
// width: "350px",
padding: "5px",
whiteSpace: "normal",
//fontFamily: "微软雅黑",
zIndex: "1000",
backgroundColor: "rgba(0, 0, 0, 0)",
border: "0px"
});
map.addOverlay(myLabel1, point);
map.panTo(point);
var obt1 = document.getElementById("guiico_left");
var obt2 = document.getElementById("guiico_right");
var oImg = document.getElementById("guilevel_img");
var index = 0;
function funTab() {
oImg.src = data.filePaths[index];
}
funTab();
obt1.onclick = prevImg;
obt2.onclick = nextImg;
function nextImg() {
// $('.pop-common').css('display','block');
index++;
if(index > data.filePaths.length - 1) {
index = 0;
}
funTab();
};
function prevImg() {
index--;
if(index < 0) {
index = data.filePaths.length - 1;//那么下标修改为最大下标 这样就可以循环显示图片
}
funTab();//显示图片和文字信息
};
var timers;
timers=setInterval(function() {
index++;
if(index > data.filePaths.length - 1) {
index = 0;
}
funTab();
},3000);
//给文档绑定一个按键事件, 来响应键盘的按键
document.onkeydown = function(event) {
//兼容主流浏览器的写法 获取按键事件
var e = event || window.event || arguments.callee.caller.arguments[0];
if(e && e.keyCode == 37) { // 按 左方向键 (37 是←方向键码值)
prevImg();//这里是方法调用 ,方法名后要加括号, 立刻调用方法
}
if(e && e.keyCode == 39) { // 按 右方向键(39 是→方向键码值)
nextImg();//这里是方法调用 ,方法名后要加括号, 立刻调用方法
}
};
}else {
guideHtml+='<div class="guipop_close pos-abs ITD-cursor-pointer"></div><img src="'+data.filePaths[0]+'" alt="">';
var myLabel1 = new BMap.Label("<div class='pop-common'>" + guideHtml + "</div>", {
offset: new BMap.Size(-380, -250), //label的偏移量,为了让label的中心显示在点上
position: point
});
myLabel1.setStyle({
color: "#F0F0F0",
fontSize: "12px",
//height: "220px",
// width: "350px",
padding: "5px",
whiteSpace: "normal",
//fontFamily: "微软雅黑",
zIndex: "1000",
backgroundColor: "rgba(0, 0, 0, 0)",
border: "0px"
});
map.addOverlay(myLabel1, point);
map.panTo(point);
}
}
}
//弹出二级诱导信息
function alertSecondLevelGuideInfo(data, point) {
clearGuideScreen();
$("#guidance2-pop").empty();
var guideInfos = data.guideInfos;
var guideHtml = '<div class="guidance2-pop pop-common" id="guidance2-pop">' +
'<div class="guidance2-poptopbar"></div><div class="pop-bottomcontent"><ul class="pop-bottomUl">';
if (null != guideInfos) {
$.each(guideInfos, function (index, item) {
guideHtml += '<li class="bottom-style"><div id=" " class="bot-tit">' + item.plName + '</div><div class="bot-right">';
if (item.guidePoint == 1) {
guideHtml += '<div id=" " class="left-icon"></div>'
} else if (item.guidePoint == 2) {
guideHtml += '<div id=" " class="right-icon"></div>'
} else if (item.guidePoint == 3) {
guideHtml += '<div id=" " class="around-icon"></div>'
} else if (item.guidePoint == 4) {
guideHtml += '<div id=" " class="run-icon"></div>'
}
guideHtml += '<div class="height20"></div>' +
'<div id=" " class="bot-num space-firstnum fontgreen">' + item.freeNum + '</div> </div></li>';
})
}
guideHtml += '</ul></div></div>';
var myLabel2 = new BMap.Label(guideHtml, {
offset: new BMap.Size(20, -180), //label的偏移量,为了让label的中心显示在点上
position: point
});
myLabel2.setStyle({
color: "#F0F0F0",
fontSize: "12px",
//height: "220px",
// width: "350px",
padding: "5px",
whiteSpace: "normal",
//fontFamily: "微软雅黑",
zIndex: "1000",
backgroundColor: "rgba(0, 0, 0, 0)",
border: "0px"
});
map.addOverlay(myLabel2, point);
map.panTo(point);
}
//弹出三级诱导信息
function alertThridLevelGuideInfo(data, point) {
clearGuideScreen();
$("#guidance3-pop").empty();
//是否有限高提示
var highLimitStatus = data.highLimitStatus;
//是否有急转弯提示
var sharpTurnStatus = data.sharpTurnStatus;
//是否有楼层指示
var floorStatus = data.floorStatus;
//时间制式
var timeSystem = data.timeSystem + '';
var guideHtml = '<div class="guidance3-pop pop-common" id="guidance3-pop"><div class="guidance3-poptopbar ITD-common-fontsize14 ITD-common-color060 ITD-hidden-nowrap">'+data.plName+'</div>' +
'<div class="guidance3-mid">' +
'<div class="guidance3-plies float-left"><span id="upper-case" class="upper-case">' + (data.floor == null ? '--' : data.floor ) + '</span>层</div>' +
'<div class="plies-tit float-left">空闲</div>' +
'<div class="plies-Num float-left fontgreen">' + (data.freeNum == null ? '0' : data.freeNum ) + '</div>' +
'</div> ';
//判断是否有楼层限高
/*if (highLimitStatus == 1) {
guideHtml += '<div class="maxheight-2m"><span class="maxheight-tit">' + data.highLimitNum + '</span></div>'
}*/
//判断时间营业时间,
if (null != timeSystem) {
if (timeSystem.length > 6) {
guideHtml += '<div class="time-hour"><div class="time-num1">' + timeSystem + '</div></div>'
} else {
guideHtml += '<div class="time-24h"></div></div>'
}
}
/*if (sharpTurnStatus == 1) {
guideHtml += '<div class="now-turn"></div>'
}*/
// $("#guidance3-pop").html(guideHtml);
var myLabel3 = new BMap.Label(guideHtml, {
offset: new BMap.Size(20, -180), //label的偏移量,为了让label的中心显示在点上
position: point
});
myLabel3.setStyle({
color: "#F0F0F0",
fontSize: "12px",
//height: "220px",
// width: "350px",
padding: "5px",
whiteSpace: "normal",
zIndex: "1000",
backgroundColor: "rgba(0, 0, 0, 0)",
border: "0px"
});
map.addOverlay(myLabel3, point);
map.panTo(point);
}
//清除弹出的诱导屏
function clearGuideScreen(){
$("#guidance1-pop").hide();
$("#guidance2-pop").hide();
$("#guidance3-pop").hide();
}
//关闭 弹窗 按钮事件
documentBindFunc.on('click','.guipop_close',function () {
colseInfoWindow();
});
var flag = true;
$('#main-left').on('click',function () {
if(flag){
$('#main-wrap').animate({'right':'-328px'});
$(this).addClass('click_right');
flag = false;
}else{
$('#main-wrap').animate({'right':'18px'});
$(this).removeClass('click_right');
flag = true;
}
});
|