paramadd.html
50 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
<!-- 统计数据 -->
<style>
.form-control:focus {
border-color: #53ced9;
}
.tagsDiv {
border: 1px solid #c2cad8;
margin-left: 15px;
padding: 4px 15px 4px 15px;
width: 50%;
}
</style>
<div class="modal fade" id="paramadd_mobal" tabindex="-1" role="basic" aria-hidden="true">
<div class="modal-dialog" style="margin-left: 100px;">
<div class="modal-content" style="width: 1000px;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
<h4 class="modal-title">参数数据 </h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="param_form" action="/" method="POST" novalidate="novalidate">
<div class="form-body">
<div class="alert alert-danger display-hide">
<button class="close" data-close="alert"></button>
您的输入有误,请检查下面的输入项
</div>
<div class="alert alert-success display-none">
<button class="close" data-dismiss="alert"></button>
验证成功!
</div>
</div>
<div class="tab-pane" id="ptab">
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn default" data-dismiss="modal" id="paramcancel">
<span class="paramcancelSpan">取消</span>
</button>
<button type="button" class="btn btn-primary" id="paramnext">
<span class="paramnextSpan">确定</span>
</button>
</div>
</div>
</div>
</div>
<script type="text/html" id = "paramAdd_temp">
<div class="form-group">
<div class="col-md-6">
<label class="control-label col-md-5">
<span class="required"> * </span> 上行首班时间 :
</label>
<div class="col-md-5">
<input type="text" class="form-control" name="startStationFirstTime" value="{{map.startStationFirstTime}}" id="startStationFirstTime_id"
placeholder="请输入起始站首班时间">
</div>
</div>
<div class="col-md-6">
<label class="control-label col-md-5">
<span class="required"> * </span> 上行末班时间 :
</label>
<div class="col-md-5">
<input type="text" class="form-control" name="startStationEndTime" value="{{map.startStationEndTime}}" id="startStationEndTime_id"
placeholder="请输入起始站末班时间">
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-6">
<label class="control-label col-md-5">
<span class="required"> * </span> 下行首班时间 :
</label>
<div class="col-md-5">
<input type="text" class="form-control" name="endStationFirstTime" value="{{map.endStationFirstTime}}" id="endStationFirstTime_id"
placeholder="请输入终点站首班时间">
</div>
</div>
<div class="col-md-6">
<label class="control-label col-md-5">
<span class="required"> * </span> 下行末班时间 :
</label>
<div class="col-md-5">
<input type="text" class="form-control" name="endStationEndTime" value="{{map.endStationEndTime}}" id="endStationEndTime_id"
placeholder="请输入终点站末班时间">
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-6">
<label class="control-label col-md-5">
<span class="required"> * </span> 早高峰开始时间 :
</label>
<div class="col-md-5">
<input type="text" class="form-control" name="earlyStartTime" value="{{map.earlyStartTime}}" id="earlyStartTime_id"
placeholder="请输入早高峰开始时间">
</div>
</div>
<div class="col-md-6">
<label class="control-label col-md-5">
<span class="required"> * </span> 早高峰结束时间 :
</label>
<div class="col-md-5">
<input type="text" class="form-control" name="earlyEndTime" value="{{map.earlyEndTime}}" id="earlyEndTime_id"
placeholder="请输入早高峰结束时间">
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-6">
<label class="control-label col-md-5">
<span class="required"> * </span> 晚高峰开始时间 :
</label>
<div class="col-md-5">
<input type="text" class="form-control" name="lateStartTime" value="{{map.lateStartTime}}" id="lateStartTime_id"
placeholder="请输入晚高峰开始时间">
</div>
</div>
<div class="col-md-6">
<label class="control-label col-md-5">
<span class="required"> * </span> 晚高峰结束时间 :
</label>
<div class="col-md-5">
<input type="text" class="form-control" name="lateEndTime" value="{{map.lateEndTime}}" id="lateEndTime_id"
placeholder="请输入晚高峰结束时间">
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-6">
<label class="control-label col-md-5">上行进场时间 :
</label>
<div class="col-md-5">
<input type="text" class="form-control" name="upInTimer" value="{{map.upInTimer}}" id="upInTimer_id"
placeholder="请输入上行进场时间">
</div>
</div>
<div class="col-md-6">
<label class="control-label col-md-5">上行出场时间 :
</label>
<div class="col-md-5">
<input type="text" class="form-control" name="upOutTimer" value="{{map.upOutTimer}}" id="upOutTimer_id"
placeholder="请输入上行出场时间">
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-6">
<label class="control-label col-md-5">下行进场时间 :
</label>
<div class="col-md-5">
<input type="text" class="form-control" name="downInTimer" value="{{map.downInTimer}}" id="downInTimer_id"
placeholder="请输入下行进场时间">
</div>
</div>
<div class="col-md-6">
<label class="control-label col-md-5">下行出场时间 :
</label>
<div class="col-md-5">
<input type="text" class="form-control" name="downOutTimer" value="{{map.downOutTimer}}" id="downOutTimer_id"
placeholder="请输入下行出场时间">
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-6">
<label class="control-label col-md-5">早高峰上行时间 :</label>
<div class="col-md-5">
<input type="text" class="form-control" name="earlyUpTime" value="{{map.earlyUpTime == null ? map.upTravelTime : map.earlyUpTime}}" id="earlyUpTime_id"
placeholder="请输入早高峰上行时间">
</div>
</div>
<div class="col-md-6">
<label class="control-label col-md-5">早高峰下行时间 :</label>
<div class="col-md-5">
<input type="text" class="form-control" name="earlyDownTime" value="{{map.earlyDownTime== null ? map.downTravelTime :map.earlyDownTime}}" id="earlyDownTime_id"
placeholder="请输入早高峰下行时间">
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-6">
<label class="control-label col-md-5">晚高峰上行时间 :</label>
<div class="col-md-5">
<input type="text" class="form-control" name="lateUpTime" value="{{map.lateUpTime == null ? map.upTravelTime :map.lateUpTime }}" id="lateUpTime_id"
placeholder="请输入晚高峰上行时间">
</div>
</div>
<div class="col-md-6">
<label class="control-label col-md-5">晚高峰下行时间 :</label>
<div class="col-md-5">
<input type="text" class="form-control" name="lateDownTime" value="{{map.lateDownTime== null ? map.downTravelTime :map.lateDownTime }}" id="lateDownTime_id"
placeholder="请输入晚高峰下行时间">
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-6">
<label class="control-label col-md-5">低谷上行时间 :</label>
<div class="col-md-5">
<input type="text" class="form-control" name="troughUpTime" value="{{map.troughUpTime == null ? map.upTravelTime :map.troughUpTime}}" id="troughUpTime_id"
placeholder="请输入低谷上行时间">
</div>
</div>
<div class="col-md-6">
<label class="control-label col-md-5">低谷下行时间 :</label>
<div class="col-md-5">
<input type="text" class="form-control" name="troughDownTime" value="{{map.troughDownTime == null ? map.downTravelTime :map.troughDownTime }}" id="troughDownTime_id"
placeholder="请输入低谷下行时间">
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-6">
<label class="control-label col-md-5">
<span class="required"> * </span> 线路规划类型 :
</label>
<div class="col-md-5">
<select name="linePlayType" class="form-control" id="linePlayType_id">
<option value="">-- 请选择线路类型 --</option>
<option value="0">双向</option>
<option value="1">环线</option>
</select>
</div>
</div>
<div class="col-md-6">
<label class="control-label col-md-5">吃饭地点 :</label>
<div class="col-md-5">
<select type="text" class="form-control" name="cfdd" id="cfdd_id">
<option value="">请选择...</option>
<option value="0">{{map.startStationName}}</option>
<option value="1">{{map.endStationName}}</option>
<option value="allYes">起终点站都可以</option>
</select>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-6">
<label class="control-label col-md-5">早晚例行保养 :</label>
<div class="col-md-5">
<input type="text" class="form-control" name="lb" value="{{map.lb}}" id="lb_id"
placeholder="请输入早晚例行保养">
</div>
</div>
<div class="col-md-6">
<label class="control-label col-md-5">停车场 :</label>
<div class="col-md-5">
<select name="carPark" class="form-control" id="carPark_id" style="width:100%"></select>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-6">
<label class="control-label col-md-5">工作餐午餐时间 :</label>
<div class="col-md-5">
<input type="text" class="form-control" name="workeLunch" value="{{map.workeLunch}}" id="workeLunch_id"
placeholder="请输入工作餐午餐时间">
</div>
</div>
<div class="col-md-6">
<label class="control-label col-md-5">工作餐晚餐时间 :</label>
<div class="col-md-5">
<input type="text" class="form-control" name="workeDinner" value="{{map.workeDinner}}" id="workeDinner_id"
placeholder="请输入工作餐晚餐时间">
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-6">
<label class="control-label col-md-5"><span class="required"> * </span>早高峰发车间隔 :</label>
<div class="col-md-3" style="padding-right: 0px;">
<input type="text" class="form-control" name="zgffcjxmin" value="{{map.zgffcjxmin}}" id="zgffcjxmin_id"
placeholder="最小间隔">
</div>
<div class="col-md-1" style="padding-top: 10px; font-size: 85%;">至</div>
<div class="col-md-3" style="padding-left: 0px;">
<input type="text" class="form-control" name="zgffcjxmax" value="{{map.zgffcjxmax}}" id="zgffcjxmax_id"
placeholder="最大间隔">
</div>
</div>
<div class="col-md-6">
<label class="control-label col-md-5"><span class="required"> * </span>晚高峰发车间隔 :</label>
<div class="col-md-3" style="padding-right: 0px;">
<input type="text" class="form-control" name="wffcjxmin" value="{{map.wffcjxmin}}" id="wffcjxmin_id"
placeholder="最小间隔">
</div>
<div class="col-md-1" style="padding-top: 10px; font-size: 85%;">至</div>
<div class="col-md-3" style="padding-left: 0px;">
<input type="text" class="form-control" name="wffcjxmax" value="{{map.wffcjxmax}}" id="wffcjxmax_id"
placeholder="最大间隔">
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-6">
<label class="control-label col-md-5"><span class="required"> * </span>低谷发车间隔 :</label>
<div class="col-md-3" style="padding-right: 0px;">
<input type="text" class="form-control" name="dgfcjxmin" value="{{map.dgfcjxmin}}" id="dgfcjxmin_id"
placeholder="最小间隔">
</div>
<div class="col-md-1" style="padding-top: 10px; font-size: 85%;">至</div>
<div class="col-md-3" style="padding-left: 0px;">
<input type="text" class="form-control" name="dgfcjxmax" value="{{map.dgfcjxmax}}" id="dgfcjxmax_id"
placeholder="最大间隔">
</div>
</div>
<div class="col-md-6">
<label class="control-label col-md-5"><span class="required"> * </span>建议加班路牌数 :</label>
<div class="col-md-5">
<input type="text" class="form-control" name="jbclcount" value="{{map.jbclcount}}" id="jbclcount_id"
placeholder="为0表示是周末时刻表">
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-6">
<label class="control-label col-md-5"><span class="required"> * </span>停站类型 :</label>
<div class="col-md-5 tagsDiv">
<div class="row" style="margin-left: 15px;">
<input type="text" value="{{map.stt}}" name="stt" id="stoptype_tagsinput" style="display: none;">
</div>
<div class="row" style="margin-top: 10px;">
<label class="control-label col-md-4">停站类型:</label>
<div class="col-md-8">
<select name="stopType" class="form-control" id="stopType_id">
<option value="">-- 请选择停站类型 --</option>
<option value="0">主站停站</option>
<option value="1">双向停站</option>
</select>
</div>
</div>
<div class="row" style="margin-top: 10px;">
<label class="control-label col-md-4">主站:</label>
<div class="col-md-8">
<select name="masterStop" class="form-control" id="masterStop_id">
<option value="">请选择...</option>
<option value="0">{{map.startStationName}}</option>
<option value="1">{{map.endStationName}}</option>
</select>
</div>
</div>
<div class="row" style="margin-top: 10px;margin-left: 116px;">
<a href="javascript:" class="btn red" id="stoptype_tagsinput_add">添加</a>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-5">
<span class="required"> * </span> 建议高峰配车数 :</label>
<div class="col-md-5">
<input type="text" class="form-control" placeholder="车辆数" name="gfjypcs"
id="gfjypcsInput" min="1" value="{{map.gfjypcs}}">
</div>
</div>
<div class="form-group">
<label class="control-label col-md-5">
<span class="required"> * </span> 生成策略 :
</label>
<div class="col-md-5">
<select name="strategy" class="form-control" id="strategy_id">
<option value="AdjustTripS1" selected>AdjustTripS1</option>
<option value="AdjustTripS2" disabled>AdjustTripS2</option>
<option value="AdjustTripS3">AdjustTripS3</option>
<option value="AdjustTripS4">AdjustTripS4</option>
</select>
</div>
</div>
</div>
</div>
<!-- 隐藏字段-时间 -->
<input type="hidden" name="skbName" value="{{map.skbName}}" id="skbName_id"/>
<input type="hidden" name="skbmc" value="{{map.skbmc}}" id="skbmc_id"/>
<input type="hidden" name="xlmc" value="{{map.xlmc}}" id="xlmc_id"/>
<input type="hidden" name="lineName" value="{{map.lineName}}" id="lineName_id"/>
<input type="hidden" name="lineVersion" value="{{map.lineVersion}}" id="lineVersion_id"/>
<!-- 上下行行驶时间 -->
<input type="hidden" name="upTravelTime" value="{{map.upTravelTime}}" id="upTravelTime_id"/>
<input type="hidden" name="downTravelTime" value="{{map.downTravelTime}}" id="downTravelTime_id"/>
<!-- 隐藏字段-里程 -->
<!-- 上下行行驶里程 -->
<input type="hidden" name="upMileage" value="{{map.upMileage}}" id="upMileage_id"/>
<input type="hidden" name="downMileage" value="{{map.downMileage}}" id="downMileage_id"/>
<!-- 上下行进场出场里程 -->
<input type="hidden" name="upInMileage" value="{{map.upInMileage}}" id="upInMileage_id"/>
<input type="hidden" name="downInMileage" value="{{map.downInMileage}}" id="downInMileage_id"/>
<input type="hidden" name="upOutMileage" value="{{map.upOutMileage}}" id="upOutMileage_id"/>
<input type="hidden" name="downOutMileage" value="{{map.downOutMileage}}" id="downOutMileage_id"/>
</script>
<script type="text/javascript">
$('#paramadd_mobal').on('paramAddMobal.show', function(e, mainFun, mainFun2_2, oSchedule_v2_2){
var _mainFun = mainFun;
var _mainFun_v2_2 = Main_v2_2;
var _oSchedule_v2_2 = InternalScheduleObj_v2_2;
// 加载延迟200毫秒显示mobal
setTimeout(function(){$('#paramadd_mobal').modal({show : true,backdrop: 'static', keyboard: false});},200);
var param = JSON.parse(window.localStorage.Gantt_AgursData);
// 获取表单元素
var form = $('#param_form');
// 错误提示元素
var paramAlert = $('.alert-danger', form);
// 确定事件点击
$('#paramnext').on('click', function() {
$("#paramcancel").addClass("disabled");
$("#paramnext").addClass("disabled");
$(".paramnextSpan").html("正在生成...");
setTimeout(function() {
form.submit();// 表单提交
}, 500);
// $("#paramnext").removeClass("disabled");
// $("#paramnext").html("确定");
});
// 表单验证
form.validate({
errorElement : 'span',
errorClass : 'help-block help-block-error',
focusInvalid : false,
rules: {
'skbName' : {required : true,},// 时刻表名称,必填项.
'lineName' : {required : true,},// 线路名称,必填项.
'lineVersion': {required: true}, // 站点路由版本,必填项,
'startStationFirstTime' : {required : true}, // 起始站首班时间,必填项.
'startStationEndTime' : {required : true}, // 起始站末班时间 ,必填项.
'endStationFirstTime' : {required : true}, // 终点站首班时间 ,必填项.
'endStationEndTime' : {required : true}, // 终点站末班时间,必填项.
'earlyStartTime' : {required : true},// 早高峰开始时间,必填项 .
'earlyEndTime' : {required : true},// 早高峰结束时间,必填项 .
'lateStartTime' : {required : true},// 晚高峰开始时间,必填项 .
'lateEndTime' : {required : true},// 晚高峰结束时间,必填项.
'upInTimer' : {number : true},// 上行进场时间,必须为数字.
'upOutTimer' : {number : true},// 上行出场时间,必须为数字.
'downInTimer' : {number : true},// 下行进场时间,必须为数字.
'downOutTimer' : {number : true},// 下行出场时间,必须为数字.
'earlyUpTime' : {number : true},// 早高峰上行时间,必须为数字.
'earlyDownTime' : {number : true},// 早高峰下行时间,必须为数字.
'lateUpTime' : {number : true},// 晚高峰上行时间,必须为数字.
'lateDownTime' : {number : true},// 晚高峰下行时间,必须为数字.
'troughUpTime' : {number : true},// 低谷上行时间,必须为数字.
'troughDownTime' : {number : true},// 低谷下行时间,必须为数字.
'linePlayType' : {required : true},// 线路规划类型,必填项
'lb' : {number : true},// 早晚例行保养,必须为数字.
'workeLunch' : {number : true},// 工作餐午餐时间,必须为数字.
'workeDinner' : {number : true},// 工作餐晚餐时间,必须为数字.
'zgffcjxmin' : {required : true,number : true,digits: true},// 早高峰最小发车间隔.
'zgffcjxmax' : {required : true,number : true,digits: true},// 早高峰最大发车间隔.
'wffcjxmin' : {required : true,number : true,digits: true},// 晚高峰最小发车间隔.
'wffcjxmax' : {required : true,number : true,digits: true},// 晚高峰最大发车间隔.
'dgfcjxmin' : {required : true,number : true,digits: true},// 低谷最小发车间隔.
'dgfcjxmax' : {required : true,number : true,digits: true},// 低谷最大发车间隔.
'jbclcount': {required : true,number : true,digits: true}, // 建议加班车数
'upTravelTime' : {required : true,number : true},// 上行行驶时间,必填项、必须为整数.
'downTravelTime' : {required : true,number : true},// 下行行驶时间,必填项、必须为整数.
'upMileage' : {required : true,number : true},// 上行行驶里程,必填项、必须为整数.
'downMileage' : {required : true,number : true},// 下行行驶里程,必填项、必须为整数.
'upInMileage' : {number : true},// 上行进场里程,必须为数字.
'upOutMileage' : {number : true},// 上行出场里程,必须为数字.
'downInMileage' : {number : true},// 下行进场里程,必须为数字.
'downOutMileage' : {number : true}, // 下行出场里程,必须为数字.
'strategy' : {required : true} // 生成策略标识
// TODO
},
invalidHandler : function(event, validator) {
paramAlert.show();
App.scrollTo(paramAlert, -200);
},
highlight : function(element) {
$(element).closest('.form-group').addClass('has-error');
},
unhighlight : function(element) {
$(element).closest('.form-group').removeClass('has-error');
},
success : function(label) {
label.closest('.form-group').removeClass('has-error');
},
submitHandler : function(f) {
// 1、 获取表单内容,并序列化
var fp = form.serializeJSON();
console.log(fp);
// 2、重新刷新表单数据
var ganttMap = JSON.parse(window.localStorage.Gantt_AgursData);
var key;
for (key in fp) {
if (ganttMap[key]) {
if (ganttMap[key] != fp[key]) {
ganttMap[key] = fp[key];
}
} else {
ganttMap[key] = fp[key];
}
}
window.localStorage.setItem("Gantt_AgursData",JSON.stringify(ganttMap));
// TODO
var pp = getParamObjAndDataMap();
var paramObj = pp[0];
var dataMap = pp[1];
var csMap = getCSMap(paramObj);
// console.log(graph);
var data;
if (ganttMap.baseRes == "2") { // v2版本
data = _mainFun.BXPplaceClassesTime03(paramObj, csMap.maxCar);
_mainFun.exportDataConfig(data.aInternalLpObj);
/* } else if (ganttMap.baseRes == "3") { // v2_2版本*/
} else { // v2_2版本
csMap = getCSMap_v2(paramObj);
data = _mainFun_v2_2.BXPplaceClassesTime03(paramObj, csMap.maxCar);
}
echartsDrawGTT.init(data.json,true,true);
if (ganttMap.baseRes == "3" || ganttMap.baseRes == "1") {
// 导入导出设置
// _mainFun_v2_2.exportExcelConfig($_GlobalGraph.getDataArray);
var _dfun = function() {
// fix,从新的甘特图中获取数据
var _keyIndex = echartsDrawGTT.get_keyIndex();
var historyData = echartsDrawGTT.getHistoryData();
var _data = $.extend(true, [], data, historyData[_keyIndex]);
var _i;
var _j;
var _gObj;
var _rtnBcArray = [];
for (_i = 0; _i < _data.length; _i++) {
_gObj = _data[_i].value;
_rtnBcArray.push({
lpName : _gObj[0],
fcsj: moment(_gObj[1]).format("HH:mm"),
ARRIVALTIME: moment(_gObj[2]).format("HH:mm"),
bcsj: _gObj[3] / 60000,
lpNo: _gObj[4],
lpType: _gObj[5],
bcType: _gObj[6],
fcno: _gObj[7],
xlDir: (_gObj[8] == 0 ? "relationshipGraph-up" : "relationshipGraph-down"),
jhlc: _gObj[9],
tcc: _gObj[10],
ttinfo: _gObj[11],
xl: _gObj[12],
qdz: _gObj[13],
zdz: _gObj[14],
STOPTIME: _gObj[15],
isfb: _gObj[16]
});
}
console.log("重组前数据=" + _data);
console.log("重组后数据=" + _rtnBcArray);
return _rtnBcArray;
};
Main_v2_2.exportExcelConfig(_dfun);
}
// var data = obj.getDataArray();
// // 2、 调整路牌对应的班次总数
// updFormParams(params,data);
// 删除图形.
// $('svg.svg-chart').remove();
// // 重新创建图形.
// var graph = d3.select('#ganttSvg').relationshipGraph(getGraphArgus(csMap, dataMap, data));
// // 根据数据重新渲染图形.
// graph.data(data.json);
// // 记录早操.并保存历史班次数据
// graph.addHistory();
// 隐藏错误提示
paramAlert.hide();
// 隐藏 reladplus_mobal 弹出层
$('#paramadd_mobal').modal('hide');
layer.msg('成功!');
}
});
// 当模态框对用户可见时触发(将等待 CSS 过渡效果完成)。
$('#paramadd_mobal').on('show.bs.modal', function () {
// TODO
// 把数据填充到模版中
// var tbodyHtml = template('countAdd_temp',{list:countDate});
// // 把渲染好的模版html文本追加到表格中
// $('#datatable_countadd tbody').html(tbodyHtml);
var htmldata = template('paramAdd_temp', {map : param});
$('#ptab').html(htmldata);
// 线路规划类型
$('#linePlayType_id').val(param.linePlayType);
// 策略类型
$('#strategy_id').val(param.strategy || "AdjustTripS1");
// 吃饭地点
$get('/stationroute/all', {
'line.id_eq': param.lineName.split('_')[0],
'destroy_eq': 0,
'versions_eq': param.lineVersion},
function(result) {
var opt = [];
opt.push('<option value="">请选择...</option>');
$.each(result, function(i, d) {
if (d.stationMark == 'B' && d.directions == 0) {
opt.push("<option value='0'>" + d.stationName + "</option>");
} else if (d.stationMark == 'E' && d.directions == 0) {
opt.push("<option value='1'>" + d.stationName + "</option>");
}
});
initTagsinput(opt.join(","));
opt.push("<option value='allYes'>起终点站都可以</option>");
$('#cfdd_id').html(opt.join(""));
$('#cfdd_id').val(param.cfdd);
}
);
// 停车场
$get('/carpark/all',null, function(cd) {
var opt = [];
opt.push('<option value="">请选择...</option><optgroup label="停车场">');
var $_len = cd.length;
if($_len > 0) {
$.each(cd, function(i, d){
opt.push('<option value="'+d.parkCode+'">'+d.parkName+'</option>');
});
}
opt.push('</optgroup>');
$('#carPark_id').html(opt.join(",")).select2();
$('#carPark_id').select2("val", param.carPark);
});
// 上下行首末班日期控件
$('#startStationFirstTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
$('#startStationEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
$('#endStationFirstTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
$('#endStationEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
// 早高峰晚高峰日期控件
$('#earlyStartTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
$('#earlyEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
$('#lateStartTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
$('#lateEndTime_id').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
});
//--------------------- 其他方法 ------------------------//
function initTagsinput(htmlStr) {
$('#masterStop_id').html(htmlStr);
var elt = $('#stoptype_tagsinput');
var value = elt.val();
var stoptype = value.split("/")[0];
var masterstop = value.split("/")[1];
$('#stopType_id').val(stoptype);
$('#masterStop_id').val(masterstop);
elt.tagsinput({
tagClass: function(item) {
return 'label label-danger label-important';
},
itemValue: 'value',
itemText: 'text'
});
$('#stoptype_tagsinput').on('beforeItemAdd', function(event) {
// TODO:这里可以做一些逻辑判定
});
$('#stoptype_tagsinput_add').on('click', function(){
var stoptype = $("#stopType_id").val();
var masterstop = $("#masterStop_id").val();
var masterstop_text = $("#masterStop_id option:selected").text();
if (stoptype && stoptype != "") {
if (stoptype == "0" && masterstop && masterstop != "") {
elt.tagsinput('add', {
"value": stoptype + '/' + masterstop,
"text": "主站停站" + "/" + masterstop_text
});
} else {
elt.tagsinput('add', {
"value": 1,
"text": "双向停站"
});
}
}
});
if (stoptype && stoptype != "") {
elt.tagsinput('add', {
"value": stoptype + '/' + masterstop,
"text":
$("#stopType_id option:selected").text() + "/" +
$("#masterStop_id option:selected").text()
});
}
}
function getMinDate(d1,d2) {
// 1、定义返回字符串.
var str = '';
// 2、判断时间大小.
if(strToTime(d1)>strToTime(d2))
str = d2;
else
str = d1;
// 3、返回最小时间(字符串).
return str;
}
function strToTime(t) {
var d = new Date();
if(t) {
var _str = t.split(':');
d.setHours(parseInt(_str[0]));
d.setMinutes(parseInt(_str[1]));
}
return d;
}
function getMaxDate(d1,d2) {
// 1、定义返回时间字符串.
var str = '';
// 2、判断时间大小.
if(strToTime(d1)>strToTime(d2))
str = d1;
else
str = d2;
// 3、返回一个最大时间(字符串).
return str;
}
function getEndDate(date) {
var lastEndDate = Date.now();
if (date) {
var str = date.replace(/-/g,"/");
lastEndDate = new Date(str);
}
// Wed Oct 26 2016 00:00:00 GMT+0800 (中国标准时间)
return lastEndDate;
}
function formatPairing(v1,v2) {
v1 = v1 == '' ? 0 : parseInt(v1);
v2 = v2 == ''? 0 : parseInt(v2) ;
return [v1,v2];
}
function qzdz(zd1,zd2) {
return [zd1,zd2];
}
function formatksjssj(gp) {
return [{'kssj':gp.startStationFirstTime,'jssj':gp.startStationEndTime},{'kssj':gp.endStationFirstTime,'jssj':gp.endStationEndTime}];
}
function getsd(st,ed) {
return [{'st':st,'ed':ed}];
}
function getDateTime(time) {
var dateTime = new Date();
var timeArr;
if(time !=null && time !='' && typeof(time) !='undefined') {
timeArr = time.split(':');
dateTime.setHours(parseInt(timeArr[0]));
dateTime.setMinutes(parseInt(timeArr[1]));
}
return dateTime;
}
function getYAxisCarArray(len) {
var array = new Array();
if(len>0) {
for(var y = 0; y<len; y++) {
array.push({lp:null,lpNo:y+1, parent :y+1, lpName:y+1,lpType:'普通路牌'});//添加一个路牌对象
};
}
return array;
}
function getylp(arr) {
var ra = new Array(),name = new Array();
for(var i = 0 ; i<arr.length;i++) {
ra.push(arr[i].lpNo);
name.push(arr[i].lpName);
}
return {'lpNoA':ra,'lpNameA':name,};
}
function getParamObjAndDataMap() {
var map = JSON.parse(window.localStorage.Gantt_AgursData);
// seMap
var seMap = {'s': map.linePlayType == '1' ? map.startStationFirstTime : getMinDate(map.startStationFirstTime,map.endStationFirstTime),
'e': map.linePlayType == '1' ? map.startStationEndTime : getMaxDate(map.startStationEndTime,map.endStationEndTime)};
// dirA
var dirA = ['relationshipGraph-up', 'relationshipGraph-down'];
// bcTypeArr
var bcTypeArr = {
'bd': 'bd', 'out': 'out', 'normal': 'normal', 'cf': 'cf', 'in_': 'in', 'lc': 'lc',
'major': 'major', 'venting': 'venting', 'region': 'region'
};
// seDate
var newDate = new Date();
var kssj = d3.time.hour.offset(getEndDate(
newDate.getFullYear()+ "-" +
(newDate.getMonth()+1) + "-" +
newDate.getDate() + ' ' +
seMap.s.split(':')[0] + ':00'),-1);
var year = '' , month = '',dt = '';
if(newDate.getDate()+1>31)
dt = '01';
else
dt = newDate.getDate()+1;
if(newDate.getMonth()+1>12)
month = '01';
else if(newDate.getDate()+1>31)
month = newDate.getMonth()+2;
else
month = newDate.getMonth()+1;
if(newDate.getMonth()+1>12)
year = newDate.getFullYear()+1;
else
year = newDate.getFullYear();
var jssj = getEndDate(year + '-' + month + '-' + dt + ' ' + '00:00');
seDate = {'kssj' : kssj, 'jssj' : jssj};
// dataMap
var dataMap = {'jcsjArr' : formatPairing(map.upInTimer,map.downInTimer),// 进场里程。[下标0代表上;下标1代表下]
'ccsjArr' : formatPairing(map.upOutTimer,map.downOutTimer),// 出场时间。[下标0代表上;下标1代表下]
'jclcArr' : formatPairing(map.upInMileage,map.downInMileage),// 进场里程。[下标0代表上;下标1代表下]
'cclcArr' : formatPairing(map.upOutMileage,map.downOutMileage),// 出场里程。[下标0代表上;下标1代表下]
'pcxssjArr' : formatPairing(map.upTravelTime,map.downTravelTime),// 平常行驶时间。[下标0代表上;下标1代表下]
'gfxxsjArr' : formatPairing(map.lateUpTime=='' ? map.upTravelTime : map.lateUpTime,
map.lateDownTime=='' ? map.downTravelTime : map.lateDownTime),// 高峰行驶时间。[下标0代表上;下标1代表下]
'dgxxsjArr' : formatPairing(map.troughUpTime=='' ? map.upTravelTime : map.troughUpTime,
map.troughDownTime=='' ? map.downTravelTime : map.troughDownTime),// 低谷行驶时间。[下标0代表上;下标1代表下]
'pcxslcArr' : formatPairing(map.upMileage,map.downMileage),// 行驶里程。[下标0代表上;下标1代表下]
'qdzArr' : qzdz(map.up_s.split('_')[0],map.down_s.split('_')[0]),// 起始站。[下标0代表上;下标1代表下]
'zdzArr':qzdz(map.up_s.split('_')[1],map.down_s.split('_')[1]),// 终点站。[下标0代表上;下标1代表下]
'zwcArr' : formatPairing(map.workeLunch,map.workeDinner),// 午晚餐时间。[下标0代表午;下标1代表晚]
'smbcsjArr' : formatksjssj(map), // 起终点站首末班车时间.[下标0代表起始站的首末班车时间;下标1代表终点站的首末班车时间]
'zgfsjd' : getsd(getDateTime(map.earlyStartTime),
getDateTime(map.earlyEndTime)), // 早高峰时间段
'wgfsjd' : getsd(getDateTime(map.lateStartTime),
getDateTime(map.lateEndTime)),// 晚高峰时间段
'gfzjsjd' : getsd(getDateTime(map.earlyEndTime),
getDateTime(map.lateStartTime)),//高峰之间时间段.
'wgfzhsjd' : getsd(getDateTime(map.lateEndTime),
getDateTime(seMap.e)),// 晚高峰之后时间段
'zgfzqsjd': getsd(getDateTime(seMap.s),
getDateTime(map.earlyStartTime)),//早高峰之前时间段.
'dira' : dirA,// 方向集合 [下标0代表上;下标1代表下]
'bcTypeArr' : bcTypeArr,// 班次类型
'lbsj' : map.lb=='' ? 0:parseInt(map.lb),// 例保时间.
// 'minztjx' : parseInt(gatps.mixstopTime), // 最小停站时间.
// 'ztjxA' : BaseFun.formatPairing(gatps.upStopTime,gatps.downStopTime), // 停站时间.
// 'maxztjx' : parseInt(gatps.maxstopTime), // 最大停站时间.
'gftzsj': formatPairing(map.gfupStopTime,map.gfdownStopTime),// 高峰停站时间.
'dgtzsj' : formatPairing(map.dgupStopTime,map.dgdownStopTime),// 低谷停站时间.
'dgmaxtzsj' : parseInt(map.dgmaxtzsj),// 低谷最大停站时间.
'dgmaxfcjx' : parseInt(map.dgmaxfcjx),// 低谷最大发车间隙.
'map' : map,
'zzsj':map.zzsj,// 周转时间.
};
var _paramObj = _mainFun.getFactory().createParameterObj(map, dataMap);
if (!_paramObj.isTwoWayStop()) { // 主站停站使用v2_2版本
map.clzs = InternalScheduleObj_v2_2.calcuClzx(_paramObj);
} else {
map.clzs = _paramObj.calcuClzx();
}
return [_paramObj, dataMap];
}
function getCSMap(parmObj) {
var map = JSON.parse(window.localStorage.Gantt_AgursData);
return {'gattA':null,
'fcjx': {'gffcjx': Math.round(parmObj.calcuPeakZzsj()/parmObj.calcuClzx()) ,
'dgfcjx': Math.round(parmObj.calcuTroughZzsj()/parmObj.calcuClzx()),
'dgmaxfcjx' : parseInt(map.dgmaxfcjx)},
'maxCar':getYAxisCarArray(parseInt(parmObj.calcuClzx()))};
}
function getCSMap_v2(parmObj) {
var map = JSON.parse(window.localStorage.Gantt_AgursData);
return {'gattA':null,
'fcjx': {'gffcjx': Math.round(parmObj.calcuPeakZzsj()/parmObj.calcuClzx()) ,
'dgfcjx': Math.round(parmObj.calcuTroughZzsj()/parmObj.calcuClzx()),
'dgmaxfcjx' : parseInt(map.dgmaxfcjx)},
'maxCar':getYAxisCarArray(_oSchedule_v2_2.calcuClzx(parmObj))};
}
function getGraphArgus(CSMap, dataMap, data) {
// TODO
var map = JSON.parse(window.localStorage.Gantt_AgursData);
var sxsj = parseInt(map.upTravelTime);// 上行时间.
// seMap
var seMap = {'s': map.linePlayType == '1' ? map.startStationFirstTime : getMinDate(map.startStationFirstTime,map.endStationFirstTime),
'e': map.linePlayType == '1' ? map.startStationEndTime : getMaxDate(map.startStationEndTime,map.endStationEndTime)};
// seDate
var newDate = new Date();
var kssj = d3.time.hour.offset(getEndDate(
newDate.getFullYear()+ "-" +
(newDate.getMonth()+1) + "-" +
newDate.getDate() + ' ' +
seMap.s.split(':')[0] + ':00'),-1);
var year = '' , month = '',dt = '';
if(newDate.getDate()+1>31)
dt = '01';
else
dt = newDate.getDate()+1;
if(newDate.getMonth()+1>12)
month = '01';
else if(newDate.getDate()+1>31)
month = newDate.getMonth()+2;
else
month = newDate.getMonth()+1;
if(newDate.getMonth()+1>12)
year = newDate.getFullYear()+1;
else
year = newDate.getFullYear();
var jssj = getEndDate(year + '-' + month + '-' + dt + ' ' + '00:00');
seDate = {'kssj' : kssj, 'jssj' : jssj};
var bs = sxsj > 40 ? 4 : 2;
var MULTIPLE = Math.round(105/sxsj) >3 ? Math.round(90/sxsj) : Math.round(90/sxsj) *bs;
var VALUEKEYNAME = 'Worldwide Gross' ,
DXHOURS = 24,MINUTE = 60,WIDTH = DXHOURS*MINUTE,MARGINLEFT = 380,HEIGHT = CSMap.maxCar.length*60 + 240,
MARGINBOTTOM = 240,OFFSETX = 90,OFFSETY = 180,OFFSETUPY = 120,OFFSETDOWNY = 60,
STARTDATETIME = seDate.kssj ,ENDDATETIME = seDate.jssj ,TASKTYPES =CSMap.maxCar ,TICKFORMAT ='%H:%M' ,SHOWTOOLTIPS = true;
var dx_time = seDate.jssj.getTime() - seDate.kssj.getTime() ;
// 计算出相差天数
var days=Math.floor(dx_time/(24*3600*1000));
// 计算出小时数
var leave1=dx_time%(24*3600*1000); //计算天数后剩余的毫秒数
var hours=Math.floor(leave1/(3600*1000));
DXHOURS = days*24+hours;
WIDTH = DXHOURS*MINUTE*MULTIPLE;
// debugger;
var lpsplitA = getylp(CSMap.maxCar);
var sxsj = parseInt(map.upTravelTime);// 上行时间.
var xxsj = parseInt(map.downTravelTime);// 下行时间.
var stopAraay = [{
'sxsj':sxsj,// 上行时间.
'xxsj':xxsj,// 下行时间.
'zzsj':map.zzsj,// 周转时间.
'wcsj':parseInt(map.workeLunch),// 午餐时间.
'wcsj':parseInt(map.workeDinner),// 晚餐时间.
'zgfsxsj':map.earlyUpTime==''? sxsj : parseInt(map.earlyUpTime),// 早高峰上行行驶时间.
'zgfxxsj':map.earlyDownTime=='' ? xxsj : parseInt(map.earlyDownTime),// 早高峰下行行驶时间.
'wgfsxsj':map.lateUpTime=='' ? sxsj : parseInt(map.lateUpTime),// 晚高峰上行行驶时间.
'wgfxxsj':map.lateDownTime== '' ? xxsj: parseInt(map.lateDownTime),// 晚高峰下行行驶时间.
'sxjcsj':map.upInTimer == '' ? 0 : parseInt(map.upInTimer),// 上行进场时间.
'sxccsj':map.upOutTimer == '' ? 0 : parseInt(map.upOutTimer),// 上行出场时间.
'xxjcsj':map.downInTimer =='' ? 0 : parseInt(map.downInTimer),// 下行进场时间.
'xxccsj':map.downOutTimer =='' ? 0 : parseInt(map.downOutTimer),// 下行进场时间.
'sxjclc':map.upInMileage==''? 0 : parseInt(map.upInMileage),// 上行进场里程.
'sxcclc':map.upOutMileage==''? 0:parseInt(map.upOutMileage),// 上行出场里程.
'xxjclc':map.downInMileage==''? 0 : parseInt(map.downInMileage),// 下行进场里程.
'xxcclc':map.downOutMileage==''?0:parseInt(map.downOutMileage),// 下行出场里程.
'lbsj': map.lb==''? 0 : parseInt(map.lb) // 例保时间.
}];
var args = {
'valueKeyName': VALUEKEYNAME,
'hours' : DXHOURS,
'dxHours' : 24 - DXHOURS,
'multiple': MULTIPLE,
'width':WIDTH,
'widtMargin':MARGINLEFT,
'height':HEIGHT,
'heightMargin':MARGINBOTTOM,
'offsetX':OFFSETX,
'offsetY':OFFSETY,
'downDy':OFFSETDOWNY,
'upDy':OFFSETUPY,
'timeDomainStart' :STARTDATETIME,
'timeDomainEnd' : ENDDATETIME,
'startStr':'' + STARTDATETIME,
'endStr': '' +ENDDATETIME,
'taskTypes': TASKTYPES,
'lpNoA':lpsplitA.lpNoA,
'lpNameA':lpsplitA.lpNameA,
'tickFormat': TICKFORMAT,
'stopAraay' : stopAraay,
'dataMap':dataMap,
'showTooltips': SHOWTOOLTIPS,
'bxrcgs':data.bxrcgs
};
return args;
}
});
</script>