geodynamiczzl.js
40.1 KB
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
//设置最早时间-早于这个时间之前数据库内无数据,查询会报错
var initDate = new Date("2017/11/01 00:00:00");
//导出功能
window.downloadFile = function (sUrl) {
//iOS devices do not support downloading. We have to inform user about this.
if (/(iP)/g.test(navigator.userAgent)) {
alert('Your device does not support files downloading. Please try again in desktop browser.');
return false;
}
//If in Chrome or Safari - download via virtual link click
if (window.downloadFile.isChrome || window.downloadFile.isSafari) {
//Creating new link node.
var link = document.createElement('a');
link.href = sUrl;
if (link.download !== undefined) {
//Set HTML5 download attribute. This will prevent file from opening if supported.
var fileName = sUrl.substring(sUrl.lastIndexOf('/') + 1, sUrl.length);
link.download = fileName;
}
//Dispatching click event.
if (document.createEvent) {
var e = document.createEvent('MouseEvents');
e.initEvent('click', true, true);
link.dispatchEvent(e);
return true;
}
}
// Force file download (whether supported by server).
if (sUrl.indexOf('?') === -1) {
sUrl += '?download';
}
window.open(sUrl, '_self');
return true;
}
window.downloadFile.isChrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
window.downloadFile.isSafari = navigator.userAgent.toLowerCase().indexOf('safari') > -1;
//查询按钮
$(document).on('click', '#zzl-qerBtn', function() {
var dateValue = $("#zzl-daterange-btn input").val();
var dates=dateValue.split(" - ");
var beginTime = dates[0]+" 00:00:00";
beginTime = new Date(beginTime.replace(new RegExp(/-/gm) ,"/"));
if(beginTime<initDate){
swal({title:"提示",text:"2017年11月1日之前无数据 !",type:"warning",timer:3000,allowOutsideClick:true});
return;
}
parkTurnOverAjax();
factoryTurnOverAjax();
zzlfun.zzlcreateTableData();
});
//停车周转次数
var parkTurnOver = ['所有次数','0次','1次','2-5次','5-10次','10-20次','20-50次','50次以上'];
var turnOverTimes = [[null,null],[0,0],[1,1],[2,5],[5,10],[10,20],[20,50],[50,2147483647]];
var secondAreas = ["所有时长","0-10s","10-30s","30s-1min","1-3min","3-5min", "5-30min","30min-1h","1-2h", "2-5h","5-10h","10h 以上"];
//定义泊位区间缓存区
var berthRangeCache = {};
//查询全部停车场周转次数统计
function parkTurnOverAjax(){
var plNos = JSON.parse($("#zzl-parkIds").val());
if(plNos.length<1){
plNos.push("-1X");
}
var plBlockIds = JSON.parse($("#zzl-plAreaBlockIds").val());
var dates = $('#zzl-daterange-btn input').val();
var date = dates.split(' - ');
var beginTime = date[0] +" 00:00:00";
var endTime = date[1] +" 23:59:59";
var req = {
sysCode: sysComm.sysCode,
plBlockIds: plBlockIds,
plNos: plNos,
beginTime: new Date(beginTime.replace(new RegExp(/-/gm) ,"/")),
endTime: new Date(endTime.replace(new RegExp(/-/gm) ,"/")),
};
var opt = {
method: 'post',
url: dataUrl.util.queryEqpRoundForAllPark(),
data: JSON.stringify(req),
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function(res) {
console.log("图11:",res);
if(res.code == '8888') {
var data = res.data;
zzlfun.zzlDrawTurnOver(data);
}
else{
return;
}
}
};
sysAjax(opt);
}
//查询地磁厂商周转次数
function factoryTurnOverAjax(){
var plNos = JSON.parse($("#zzl-parkIds").val());
if(plNos.length<1){
plNos.push("-1X");
}
var plBlockIds = JSON.parse($("#zzl-plAreaBlockIds").val());
var dates = $('#zzl-daterange-btn input').val();
var date = dates.split(' - ');
var beginTime = date[0] +" 00:00:00";
var endTime = date[1] +" 23:59:59";
var req = {
sysCode: sysComm.sysCode,
plBlockIds: plBlockIds,
plNos: plNos,
beginTime: new Date(beginTime.replace(new RegExp(/-/gm) ,"/")),
endTime: new Date(endTime.replace(new RegExp(/-/gm) ,"/")),
};
var opt = {
method: 'post',
url: dataUrl.util.queryEqpRoundByBlockIds(),
data: JSON.stringify(req),
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function(res) {
console.log("图12:",res);
if(res.code == '8888') {
var data = res.data;
zzlfun.zzlDrawFactoryTurnOver(data);
}
else{
return;
}
}
};
sysAjax(opt);
}
//绑定停车场的change事件
$(document).on('change', '#parkIds1', function () {
zzlfun.parkSelectChange();
});
var zzlfun= {
init:function () {
//办事处初始化
//停车场初始化
zzlfun.initParkBlock();
//块下拉框变化,停车场下拉框变化
zzlfun.queryBlockChange();
//commSelect.area_Pl_LinkedSelect($('#zzl-plAreaBlockIds'),$('#zzl-parkIds'));
//日历插件
$('#zzl-daterange-btn input').val(moment().subtract('days', 1).format('YYYY-MM-DD') + ' - ' + moment().subtract('days',1).format('YYYY-MM-DD'));
$('#zzl-daterange-btn input').daterangepicker({
startDate: moment().subtract('days', 1),
endDate: moment().subtract('days', 1),
opens: 'left', //日期选择框的弹出位置
// dateLimit : {
// days : 365
// }, //起止时间的最大间隔
locale: {
applyLabel: '确定',
cancelLabel: '取消',
customRangeLabel: '自定义',
daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
monthNames: ['一月', '二月', '三月', '四月', '五月', '六月',
'七月', '八月', '九月', '十月', '十一月', '十二月'
],
},
ranges: {
'昨天': [moment().subtract('days', 1), moment().subtract('days', 1)],
'最近一周': [moment().subtract('days', 7), moment().subtract('days', 1)],
'最近一个月': [moment().subtract('months', 1), moment().subtract('days', 1)],
'最近三个月': [moment().subtract('months', 3), moment().subtract('days', 1)],
},
maxDate: moment().subtract('days', 1), //最大时间
},
function (start, end) {
$('#zzl-daterange-btn input').val(start.format('YYYY-MM-DD ') + ' - ' + end.format('YYYY-MM-DD '));
//alert(start.format('YYYYMMDD') + " " + end.format('YYYYMMDD'));
}
);
//全部停车场周转次数统计
parkTurnOverAjax();
//办事处echarts
//zzlfun.zzlDrawFactoryTurnOver();
factoryTurnOverAjax();
//默认单个停车场 周转次数 table
zzlfun.zzlcreateTableData();
},
exportEqpInOutParkAllStatisticExcel:function(){
//校验日期
var dateValue = $("#zzl-daterange-btn input").val();
var dates=dateValue.split(" - ");
var beginTime = dates[0]+" 00:00:00";
beginTime = new Date(beginTime.replace(new RegExp(/-/gm) ,"/"));
if(beginTime<initDate){
swal({title:"提示",text:"2017年11月1日之前无数据 !",type:"warning",timer:3000,allowOutsideClick:true});
return;
}
var plBlockIds = JSON.parse($("#zzl-plAreaBlockIds").val());
var plnos = $("#zzl-parkIds").val();
var plNos = new Array();
if(plnos==null||plnos==''){
plNos.push("-1X");
}
else{
plNos = JSON.parse(plnos);
}
var dates = $('#zzl-daterange-btn input').val();
var date = dates.split(' - ');
var beginTime = date[0] +" 00:00:00";
var endTime = date[1] +" 23:59:59";
var url = dataUrl.util.exportEqpInOutParkStatisticExcel() + '?plNos=' + plNos + '&plBlockIds=' + plBlockIds + '&beginTime=' + beginTime + '&endTime=' + endTime +'&sysCode='+sysComm.sysCode;
window.downloadFile(url);
},
//查询并过滤没有地磁的办事处
getParkBlockFilter:function(datas){
var data = [];
var blockIdsFilter = [];
var blockIds = [];
$.each(datas, function(index,item) {
blockIds.push(item.code);
});
var req = {
sysCode:sysComm.sysCode,
areaBlockIds:blockIds
};
var opt = {
async: false,
data: JSON.stringify(req),
method: "POST",
url: dataUrl.util.getBlockIdListByBlockIds(),
success: function (res) {
if (res.code == '8888') {
blockIdsFilter = res.data;
$.each(datas, function(index,item) {
$.each(blockIdsFilter, function(_index,_item) {
if(item.code == _item){
data.push(item);
}
});
});
}
}
}
sysAjax(opt);
return data;
},
//停车区域-块
initParkBlock: function () {
var datas = fn.getParkBlock();
var data = zzlfun.getParkBlockFilter(datas);
var html = '';
var htmls = '';
var blockIds = [-1];
for (var i = 0; i < data.length; i++) {
blockIds.push(data[i].code);
html += "<option value='[\"" + data[i].code + "\"]'>" + data[i].name + "</option>";
}
var blockIdsStr = JSON.stringify(blockIds);
htmls = '<option value=' + blockIdsStr + ' selected>所有办事处</option>' + html;
$("#zzl-plAreaBlockIds").empty();
$("#zzl-plAreaBlockIds").append(htmls);
$('#zzl-plAreaBlockIds').selectpicker('render');
//加载下拉框
zzlfun.initParkSelect();
},
//根据块信息查询停车场信息
initParkSelect:function(){
//停车场下拉框
var data = zzlfun.getParkingLotMsg();
var htmls = '';
var html = '';
var plNos = [];
for (var i = 0; i < data.length; i++) {
plNos.push(data[i].plNo);
html += "<option value='[\"" + data[i].plNo + "\"]'>" + data[i].plName + "</option>";
}
var plnosStr = JSON.stringify(plNos);
htmls = '<option value=' + plnosStr + ' selected>所有停车场</option>' + html;
$("#zzl-parkIds").empty();
$("#zzl-parkIds").append(htmls);
$('#zzl-parkIds').selectpicker('refresh');
$("#parkIds1").empty();
$("#parkIds1").append(htmls);
$('#parkIds1').selectpicker('refresh');
},
getParkingLotMsg:function(){
var plAreaBlockIds;
plAreaBlockIds = JSON.parse($("#zzl-plAreaBlockIds").val());
var parkLot = "";
var req = {
sysCode:sysComm.sysCode,
areaBlockIds: plAreaBlockIds
};
var opt = {
async: false,
data:JSON.stringify(req),
method: "POST",
//contentType:"application/x-www-form-urlencoded; charset=UTF-8",
url: dataUrl.util.getParkListByBlockIds(),
success: function (res) {
if (res.code == '8888') {
parkLot = JSON.stringify(res.data);
}
}
}
sysAjax(opt);
return JSON.parse(parkLot);
},
//块改变查询停车场
queryBlockChange:function(){
$("#zzl-plAreaBlockIds").change(function(){
zzlfun.initParkSelect();
});
},
//停车场下拉框change
parkSelectChange: function () {
var plNos = JSON.parse($("#parkIds1").val());
if (plNos.length > 1) {
//选择的全部
//设置空数组即可
zzlfun.setBerthRange([]);
} else {
//先初始化
zzlfun.setBerthRange([]);
//选择的单个停车场
var plNo = plNos[0];
var rows = berthRangeCache[plNo];
if (undefined != rows && null != rows && rows.length != 0) {
zzlfun.setBerthRange(rows);
} else {
zzlfun.getBerthRange(plNos);
}
}
},
//根据停车场编码获取泊位区间
getBerthRange: function (plNos) {
if(plNos.length<1){
return;
}
var req = {
baseRequest: {
pageNum: 1,
pageSize: 0
},
sysCode: sysComm.sysCode,
plNos: plNos
};
var opt = {
method: 'post',
url: dataUrl.util.queryTpPRegionAreaForPage(),
data: JSON.stringify(req),
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function (res) {
if (res.code == '8888') {
var plNo = plNos[0];
//设置缓存
berthRangeCache[plNo] = res.data.rows;
zzlfun.setBerthRange(res.data.rows);
}
}
};
sysAjax(opt);
},
//设置泊位区间
setBerthRange: function (datas) {
$('#regionArea').empty();
var html = '';
$.each(datas, function (index, item) {
html += "<option value='[\"" + item.parkAreaCode + "\"]'>" + item.parkAreaName + "</option>";
});
html = '<option value="[]" selected>所有泊位区间</option>' + html;
$('#regionArea').append(html)
$('#regionArea').selectpicker('refresh');
},
//详细-停车场下拉框初始化
initParkIdsSelect:function(){
var plno = $("#zzl-parkIds").val();
$("#parkIds1").selectpicker('val',plno);
},
//详细-分布区间初始化
initSecondArea:function(name){
var html;
$.each(secondAreas,function(index,item){
html+='<option value=' + index + ' selected>'+item+'</option>';
});
$("#secondArea").empty();
$("#secondArea").append(html);
$("#secondArea").selectpicker('refresh');
if(name == null || name == undefined){
return;
}
$("#secondArea").selectpicker('val',secondAreas.indexOf(name));
},
/*获取查询参数*/
getQueryParam: function() {
var plBlockIds = JSON.parse($("#zzl-plAreaBlockIds").val());
var plNos = [];
var plnos = $("#zzl-parkIds").val();
if(plnos==null||plnos==''){
plNos.push("-1X");
}
else{
plNos = JSON.parse(plnos);
}
var dates = $('#zzl-daterange-btn input').val();
var date = dates.split(' - ');
var beginTime = date[0] +" 00:00:00";
var endTime = date[1] +" 23:59:59";
var req = {
sysCode: sysComm.sysCode,
plBlockIds: plBlockIds,
plNos: plNos,
beginTime: new Date(beginTime.replace(new RegExp(/-/gm) ,"/")),
endTime: new Date(endTime.replace(new RegExp(/-/gm) ,"/")),
};
return req;
},
//查询全部停车场周转次数统计
zzlDrawTurnOver:function (data) {
var datas = [{value:0, name:'所有次数'},{value:0, name:'0次'},{value:0, name:'1次'},{value:0, name:'2-5次'},{value:0, name:'5-10次'},
{value:0, name:'10-20次'},{value:0, name:'20-50次'},{value:0, name:'50次以上'}];
if(data != undefined && data != null){
datas[1].value = data.normalNum0;
datas[1].name = parkTurnOver[1];
datas[2].value = data.normalNum1;
datas[2].name = parkTurnOver[2];
datas[3].value = data.normalNum2;
datas[3].name = parkTurnOver[3];
datas[4].value = data.normalNum3;
datas[4].name = parkTurnOver[4];
datas[5].value = data.normalNum4;
datas[5].name = parkTurnOver[5];
datas[6].value = data.normalNum5;
datas[6].name = parkTurnOver[6];
datas[7].value = data.normalNum6;
datas[7].name = parkTurnOver[7];
datas.splice(0,1);
}
var parlAllchart = echarts.init(document.getElementById('zzl-parkAll-chart'));
// 指定图表的配置项和数据
var topleftoption = {
color:['#1e95cd','#5fe98f','#fdc94d','#50c0f5','#5ed8a6','#2bb97f','#50c0f5','#fd714b','#a5dff3'],
tooltip: {
trigger: 'item',
formatter: "{a} <br/>{b}: {c} ({d}%)"
},
legend: {
orient: 'vertical',
right:'8%',
top:'5%',
selectedMode:false,
hoverAnimation: false,
textStyle: {
color: 'rgba(0,0,0,0.5)',
fontSize:'12px',
fontFamily:'微软雅黑'
},
itemWidth:16,
itemHeight:10,
// data:parkTurnOver
data:['全部','0次','1次','2-5次','5-10次','10-20次','20-50次','50次以上']
},
series: [
{
name:'全部停车场',
type:'pie',
radius: ['60%', '70%'],
center:['30%', '50%'],
avoidLabelOverlap: false,
hoverAnimation:false,
label: {
normal: {
show: false,
position: 'center'
},
emphasis: {
show: false,
textStyle: {
fontSize: '12',
fontWeight: 'bold'
}
}
},
labelLine: {
normal: {
show: false
}
},
data:datas/*[{value:335, name:'全部'},
{value:310, name:'0次'},
{value:234, name:'1次'},
{value:135, name:'2-5次'},
{value:35, name:'5-10次'},
{value:15, name:'10-20次'},
{value:135, name:'20-50次'},
{value:548, name:'50次以上'}
]*/
}
]
};
parlAllchart.setOption(topleftoption,true);
// parlAllchart.dispatchAction({
// type: 'downplay',
// seriesIndex: 0,
// dataIndex: 0
// });
// parlAllchart.dispatchAction({
// type: 'highlight',
// seriesIndex: 0,
// dataIndex: 0
// });
},
//街道办事处 echarts
zzlDrawFactoryTurnOver:function (data) {
var factoryNames = new Array();
var factoryTurnOverXDatas = new Array();
$.each(parkTurnOver, function(index,item) {
factoryTurnOverXDatas.push(item);
});
factoryTurnOverXDatas.splice(0,1);
var datas = new Array();
var obj = new Object();
var value = new Array();
if(data.length>0){
$.each(data, function(index,item) {
value = [];
obj = new Object();
factoryNames.push(item.factoryName);
obj.name = item.factoryName;
obj.type = 'line';
value.push(item.normalNum0);
value.push(item.normalNum1);
value.push(item.normalNum2);
value.push(item.normalNum3);
value.push(item.normalNum4);
value.push(item.normalNum5);
value.push(item.normalNum6);
obj.data = value;
datas.push(obj);
});
}else {
console.log(data);
value = [];
obj = new Object();
obj.name = '无厂商';
obj.type = 'line';
value.push(0);
value.push(0);
value.push(0);
value.push(0);
value.push(0);
value.push(0);
value.push(0);
obj.data = value;
datas.push(obj);
}
var lineecharts = echarts.init(document.getElementById('zzl-topright-echarts'));
var lineoption = {
color:['#1e95cd','#5fe98f','#fdc94d','#50c0f5','#5ed8a6','#2bb97f','#50c0f5','#fd714b','#a5dff3'],
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c}'
},
legend: {
itemHeight:10,
right: '10',
top:'0',
data: factoryNames
//data: ['大华','华赛','烽火']
},
xAxis: {
type: 'category',
axisLabel: {
interval:0,
show: true,
textStyle: {
color: 'rgba(0,0,0,0.5)',
fontSize:'12px',
fontFamily:'微软雅黑'
}
},
axisTick: {
show: false,
},
splitLine:{
lineStyle:{
color:'rgba(0,0,0,0.1)',
}
},
axisLine: {
show: true,
lineStyle: {
color: 'rgba(0,0,0,0.1)',
// width: 1,//这里是为了突出显示加上的
}
},
data: factoryTurnOverXDatas
//data: ['0次','1次','2-5次','5-10次','10-20次','20-50次','50次以上']
},
grid: {
top: '13%',
left: '1%',
right: '3%',
bottom: '2%',
containLabel: true
},
yAxis: {
type: 'value',
axisLabel: {
show: true,
textStyle: {
color: 'rgba(0,0,0,0.5)',
fontSize:'12px',
fontFamily:'微软雅黑'
}
},
axisTick: {
show: false,
},
splitLine:{
lineStyle:{
color:'rgba(0,0,0,0.1)',
}
},
axisLine: {
show: true,
lineStyle: {
color: 'rgba(0,0,0,0.1)',
// width: 1,//这里是为了突出显示加上的
}
},
},
series: datas
};
lineecharts.setOption(lineoption,true);
lineecharts.resize();
},
//默认生成表格数据
zzlcreateTableData: function() {
$('#zzlrecordtable').bootstrapTable('destroy').bootstrapTable({
striped: true, //表格显示条纹
pagination: true, //启动分页
pageNumber: 1, //当前第几页
// showColumns: true,
pageSize: 10, //每页显示的记录数
pageList: [10, 15, 20], //记录数可选列表
sidePagination: 'server', //表示服务端分页
queryParamsType: 'limit',
method: 'POST', //请求方法
// fixedColumns:true,
// fixedNumber:1,
// leftFixedColumns: true,
// leftFixedNumber: 2,
// selectItemName: 'personCustName',
paginationPreText: '<',
paginationNextText: '>',
ajax: zzltableLoadRequest, //自定义ajax加载数据
uniqueId: 'id',
columns: [
{
field: 'plName',
title: '<span class="information-icon"> </span>车场名称',
width: '10%',
visible: true,
align: 'left',
formatter: commonObj.replacenull
},
{
field: 'normalNum0',
title: '<span class="business-icon"> </span>0次',
width: '10%',
align: 'left',
formatter: commonObj.replacenull
},
{
field: 'normalNum1',
title: '<span class="business-icon"> </span>1次',
width: '10%',
align: 'left',
formatter: commonObj.replacenull
},
{
field: 'normalNum2',
title: '<span class="business-icon"> </span>2-5次',
width: '10%',
align: 'left',
formatter: commonObj.replacenull
},
{
field: 'normalNum3',
title: '<span class="business-icon"> </span>5-10次',
width: '10%',
align: 'left',
formatter: commonObj.replacenull
},
{
field: 'normalNum4',
title: '<span class="business-icon"> </span>10-20次',
width: '10%',
align: 'left',
formatter: commonObj.replacenull
},
{
field: 'normalNum5',
title: '<span class="business-icon"> </span>20-50次',
width: '10%',
align: 'left',
formatter: commonObj.replacenull
},
{
field: 'normalNum6',
title: '<span class="business-icon"> </span>50次以上',
width: '10%',
align: 'left',
formatter: commonObj.replacenull
},
]
});
},
//详细-次数初始化
initTurnOverTimes:function(){
var html;
$.each(parkTurnOver,function(index,item){
html+='<option value=' + index + ' selected>'+item+'</option>';
});
$("#zzl-number").empty();
$("#zzl-number").append(html);
$("#zzl-number").selectpicker('refresh');
$("#zzl-number").selectpicker('val',0);
},
//初始化周转次数详细弹窗
loadTurnOverDetailTable:function (){
//初始化停车场
var plno = $('#zzl-parkIds').val();
$('#parkIds1').selectpicker('val',plno);
//zzlfun.initParkSelect();
//初始化日期选择
//zzlfun.initSelectDates();
//初始化次数
zzlfun.initTurnOverTimes();
//初始化泊位区间
zzlfun.setBerthRange([]);
//加载数据
zzlfun.zzlcreateTurnoverData();
},
isOnlineFormatter:function(value){
if(value==null){
return "";
}
else if(value == "0"){
return "在线";
}
else if(value == "1"){
return "离线";
}
else{
return "故障";
}
},
//单个停车场周转次数
zzlcreateTurnoverData: function() {
$('#turnoveroentab').bootstrapTable('destroy').bootstrapTable({
striped: true, //表格显示条纹
pagination: true, //启动分页
pageNumber: 1, //当前第几页
// showColumns: true,
pageSize: 10, //每页显示的记录数
pageList: [10, 15, 20], //记录数可选列表
sidePagination: 'server', //表示服务端分页
queryParamsType: 'limit',
method: 'POST', //请求方法
// fixedColumns:true,
// fixedNumber:1,
// leftFixedColumns: true,
// leftFixedNumber: 2,
// selectItemName: 'personCustName',
paginationPreText: '<',
paginationNextText: '>',
ajax: zzltableDetailLoadRequest, //自定义ajax加载数据
uniqueId: 'id',
columns: [
{
field: 'plAreaBlockName',
title: '街道办事处',
width: '10%',
visible: true,
align: 'left'
},
{
field: 'plName',
title: '车场名称',
width: '10%',
align: 'left',
},
{
field: 'parkAreaName',
title: '泊位区间',
width: '10%',
align: 'left',
},
{
field: 'berthNo',
title: '泊位编号',
width: '10%',
align: 'left',
},
{
field: 'eqpNo',
title: '地磁编号',
width: '10%',
align: 'left',
},
{
field: 'factoryName',
title: '传感器厂商',
width: '10%',
align: 'left',
},
{
field: 'eqpIsOnline',
title: '地磁状态',
width: '15%',
align: 'left',
formatter:zzlfun.isOnlineFormatter
},
{
field: 'num',
title: '周转次数',
width: '10%',
align: 'left',
}
]
});
},
};
zzlfun.init();
//导出
var InterValObj; //timer变量,控制时间
var count = 8; //间隔函数,1秒执行
var curCount;//当前剩余秒数
function sendMessage() {
curCount = count;
//设置button效果,开始计时
$("#exportPark").attr("disabled", "true");
$(".ITD-export-btn").css("width", "138px");
$("#exportPark").val(curCount + "秒后可再次导出");
InterValObj = window.setInterval(SetRemainTime, 1000); //启动计时器,1秒执行一次
}
//timer处理函数
function SetRemainTime() {
if (curCount == 0) {
window.clearInterval(InterValObj);//停止计时器
$("#exportPark").removeAttr("disabled");//启用按钮
$(".ITD-export-btn").css("width", "72px");
$("#exportPark").val("导出");
}
else {
curCount--;
$("#exportPark").val(curCount + "秒后可再次导出");
}
}
//导出excle
documentBindFunc.on('click','#exportPark',function (){
//获取table所有行数据
var parkLot = $("#zzlrecordtable").bootstrapTable('getData');
//获取table总条数
var numTotal = $("#zzlrecordtable").bootstrapTable('getOptions').totalRows;
//提示 无数据不导出
if(parkLot.length<1){
$('.ITD-alertmodel-contentmsg').text('无数据可导出!');
$('#ITD-tipsmodel').modal('show');
setTimeout(function () {
$('.ITD-alertmodel-contentmsg').text('');
$('#ITD-tipsmodel').modal('hide');
},3000);
return false;
}
//超1万条 缩短查询范围
if(numTotal>10000){
$('.ITD-alertmodel-contentmsg').text('数据量过大,请缩小查询范围!');
$('#ITD-tipsmodel').modal('show');
setTimeout(function () {
$('.ITD-alertmodel-contentmsg').text('');
$('#ITD-tipsmodel').modal('hide');
},3000);
return false;
}
//执行倒计时函数
sendMessage();
//导出函数
zzlfun.exportEqpInOutParkAllStatisticExcel();
});
// 全部停车场详情 弹窗
documentBindFunc.on('click','#openparkAll',function () {
var dateValue = $("#zzl-daterange-btn input").val();
var dates=dateValue.split(" - ");
var beginTime = dates[0]+" 00:00:00";
beginTime = new Date(beginTime.replace(new RegExp(/-/gm) ,"/"));
if(beginTime<initDate){
swal({title:"提示",text:"2017年11月1日之前无数据 !",type:"warning",timer:3000,allowOutsideClick:true});
return;
}
//初始化
var html = $('#parkIds1').html();
$('#parkIds1').empty();
$('#parkIds1').html(html);
$('#parkIds1').selectpicker('refresh');
$('#regionArea').selectpicker('refresh');
$('#zzl-number').selectpicker('refresh');
//日历插件 daterangeedit-btn
$('#daterangeedit-btn input').val(moment().subtract('days', 0).format('YYYY-MM-DD') + ' - ' + moment().subtract('days', 0).format('YYYY-MM-DD'));
$('#daterangeedit-btn').daterangepicker({
// startDate: moment().subtract('days', 1),
endDate: moment().subtract('days', 0),
opens: 'right', //日期选择框的弹出位置
// dateLimit : {
// days : 365
// }, //起止时间的最大间隔
locale: {
applyLabel: '确定',
cancelLabel: '取消',
customRangeLabel: '自定义',
daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
monthNames: ['一月', '二月', '三月', '四月', '五月', '六月',
'七月', '八月', '九月', '十月', '十一月', '十二月'
],
},
ranges: {
'昨天': [moment().subtract('days', 1), moment().subtract('days', 1)],
'最近一周': [moment().subtract('days', 7), moment().subtract('days', 1)],
'最近一个月': [moment().subtract('months', 1), moment().subtract('days', 1)],
'最近三个月': [moment().subtract('months', 3), moment().subtract('days', 1)],
},
maxDate: moment().subtract('days', 0), //最大时间
},
function (start, end) {
$('#daterangeedit-btn input').val(start.format('YYYY-MM-DD ') + ' - ' + end.format('YYYY-MM-DD '));
//alert(start.format('YYYYMMDD') + " " + end.format('YYYYMMDD'));
}
);
var dateStr = $("#zzl-daterange-btn input").val();
$("#daterangeedit-btn input").val(dateStr);
zzlfun.loadTurnOverDetailTable();
$('#zzldetailParkmodel').modal('show');
})
documentBindFunc.on('click','#queryBtnedit',function () {
var dateValue = $("#daterangeedit-btn input").val();
var dates=dateValue.split(" - ");
var beginTime = dates[0]+" 00:00:00";
beginTime = new Date(beginTime.replace(new RegExp(/-/gm) ,"/"));
if(beginTime<initDate){
$('#error_title').text('2017年11月1日之前无数据 !');
$('#errormodel').modal('show');
setTimeout(function () {
$('#errormodel').modal('hide');
},2000);
return;
}
zzlfun.zzlcreateTurnoverData();
})
// 办事处详情 弹窗
documentBindFunc.on('click','#openbscAll',function () {
var dateValue = $("#zzl-daterange-btn input").val();
var dates=dateValue.split(" - ");
var beginTime = dates[0]+" 00:00:00";
beginTime = new Date(beginTime.replace(new RegExp(/-/gm) ,"/"));
if(beginTime<initDate){
swal({title:"提示",text:"2017年11月1日之前无数据 !",type:"warning",timer:3000,allowOutsideClick:true});
return;
}
//初始化
var html = $('#parkIds1').html();
$('#parkIds1').empty();
$('#parkIds1').html(html);
$('#parkIds1').selectpicker('refresh');
$('#regionArea').selectpicker('refresh');
$('#zzl-number').selectpicker('refresh');
//日历插件 daterangeedit-btn
$('#daterangeedit-btn input').val(moment().subtract('days', 0).format('YYYY-MM-DD') + ' - ' + moment().subtract('days', 0).format('YYYY-MM-DD'));
$('#daterangeedit-btn').daterangepicker({
// startDate: moment().subtract('days', 1),
endDate: moment().subtract('days',0),
opens: 'right', //日期选择框的弹出位置
// dateLimit : {
// days : 365
// }, //起止时间的最大间隔
locale: {
applyLabel: '确定',
cancelLabel: '取消',
customRangeLabel: '自定义',
daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
monthNames: ['一月', '二月', '三月', '四月', '五月', '六月',
'七月', '八月', '九月', '十月', '十一月', '十二月'
],
},
ranges: {
'昨天': [moment().subtract('days', 1), moment().subtract('days', 1)],
'最近一周': [moment().subtract('days', 7), moment().subtract('days', 1)],
'最近一个月': [moment().subtract('months', 1), moment().subtract('days', 1)],
'最近三个月': [moment().subtract('months', 3), moment().subtract('days', 1)],
},
maxDate: moment().subtract('days', 0), //最大时间
},
function (start, end) {
$('#daterangeedit-btn input').val(start.format('YYYY-MM-DD ') + ' - ' + end.format('YYYY-MM-DD '));
//alert(start.format('YYYYMMDD') + " " + end.format('YYYYMMDD'));
}
);
var dateStr = $("#zzl-daterange-btn input").val();
$("#daterangeedit-btn input").val(dateStr);
zzlfun.loadTurnOverDetailTable();
$('#zzldetailParkmodel').modal('show');
})
/**
* 自定义table AJAX请求
* @param {Object} params
*/
function zzltableLoadRequest(params) {
var req = zzlfun.getQueryParam();
//设置请求参数
var pageNum = (params.data.offset / params.data.limit) + 1;
//条件查询
req.baseRequest = {
pageNum: pageNum,
pageSize: params.data.limit
};
req.sysCode = sysComm.sysCode;
var opt = {
method: 'post',
url: dataUrl.util.queryEqpInOutParkList(),
data: JSON.stringify(req),
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function(res) {
console.log("图13:",res);
if(res.code == '8888') {
params.success(res.data);
}
else{
}
}
};
sysAjax(opt);
}
/* 自定义table AJAX请求
* 单个停车场周转次数 table
* @param {Object} params
*/
function zzltableDetailLoadRequest(params) {
var plAreaBlockIds = JSON.parse($("#zzl-plAreaBlockIds").val());
var plNos = JSON.parse($("#parkIds1").val());
if(plNos.length<1){
plNos.push("-1X");
}
//泊位区间
var parkAreaCodes = JSON.parse($("#regionArea").val());
var times = $("#zzl-number").val();
var roundNumB = turnOverTimes[times][0];
var roundNumE = turnOverTimes[times][1];
var dateValue = $("#daterangeedit-btn input").val();
var dates=dateValue.split(" - ");
var beginTime = dates[0]+" 00:00:00";
var endTime = dates[1]+" 23:59:59";
var req= {
sysCode:sysComm.sysCode,
plBlockIds: plAreaBlockIds,
plNos: plNos,
parkAreaCodes:parkAreaCodes,
roundNumB: roundNumB,
roundNumE:roundNumE,
beginTime: new Date(beginTime.replace(new RegExp(/-/gm) ,"/")),
endTime: new Date(endTime.replace(new RegExp(/-/gm) ,"/")),
};
//设置请求参数
var pageNum = (params.data.offset / params.data.limit) + 1;
//条件查询
req.baseRequest = {
pageNum: pageNum,
pageSize: params.data.limit
};
req.sysCode = sysComm.sysCode;
var opt = {
method: 'post',
url: dataUrl.util.queryEqpInOutRoundList(),
data: JSON.stringify(req),
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function(res) {
console.log("图14:",res);
if(res.code == '8888') {
params.success(res.data);
}
else{
}
}
};
sysAjax(opt);
}