add.html
31.3 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
<<<<<<< HEAD
<!-- 新增站点 -->
<div class="modal fade" id="add_station_mobal" role="basic" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<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" role="form" id="add_station_form" action="/module" method="post">
<div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button>
您的输入有误,请检查下面的输入项
</div>
<!-- 线路ID -->
<input type="hidden" name="lineId" id="lineIdInput" value="" />
<input type="hidden" name="bPolygonGrid" id="bPolygonGridInput" value="" />
<input type="hidden" name="gPolygonGrid" id="gPolygonGridInput" value="" />
<input type="hidden" name="gJwpoints" id="gJwpointsInput">
<input type="hidden" name="dbType" id="dbTypeInput" value="b"/>
<input type="hidden" name="x" id="xInput" value=""/>
<input type="hidden" name="y" id="yInput" value=""/>
<!-- 站点名称 -->
<div class="form-body">
<div class="form-group">
<label class="control-label col-md-3">
<span class="required"> * </span> 站点名称 :
</label>
<div class="col-md-6">
<input type="text" class="form-control" name="zdmc" id="zdmcInput" placeholder="站点名称" readonly="readonly">
</div>
</div>
</div>
<!-- 站点路由名称 -->
<div class="form-body">
<div class="form-group">
<label class="control-label col-md-3">
<span class="required"> * </span> 站点路由名称:
</label>
<div class="col-md-6">
<input type="text" class="form-control" name="stationName" id="stationNameInput" placeholder="站点路由名称">
</div>
</div>
</div>
<!-- 站点编码 -->
<div class="form-body">
<div class="form-group">
<label class="control-label col-md-3">
<span class="required"> * </span>站点编码 :
</label>
<div class="col-md-6">
<input type="text" class="form-control" name="stationCod" id="stationCodInput" readonly="readonly">
</div>
</div>
</div>
<!-- 行业编码 -->
<div class="form-body">
<div class="form-group">
<label class="control-label col-md-3">
行业编码 :
</label>
<div class="col-md-6">
<input type="text" class="form-control" name="industryCode" id="industryCodeInput" placeholder="行业编码">
</div>
</div>
</div>
<!-- 站点方向 -->
<div class="form-body">
<div class="form-group">
<label class="control-label col-md-3">
<span class="required"> * </span>站点方向 :
</label>
<div class="col-md-6">
<select name="directions" class="form-control" id="stationdirSelect">
<option value="">-- 请选择站点类型 --</option>
<option value="0">上行</option>
<option value="1">下行</option>
</select>
</div>
</div>
</div>
<!-- 站点序号 -->
<div class="form-body">
<div class="form-group">
<label class="control-label col-md-3">
<span class="required"> * </span>站点序号 :
</label>
<div class="col-md-6">
<select name="stationRouteCode" class="form-control" id="stationrouteSelect" style="width:100%"></select>
<span class="help-block">说明:选择的站点将作为本站序号的参考,成为选择站点的下一站。 </span>
</div>
</div>
</div>
<!-- 站点类型 -->
<div class="form-body">
<div class="form-group">
<label class="control-label col-md-3">
<span class="required"> * </span>站点类型 :
</label>
<div class="col-md-6">
<select name="stationMark" class="form-control" id="stationMarkSelect">
<option value="">-- 请选择站点类型 --</option>
<option value="B">起点站</option>
<option value="Z">中途站</option>
<option value="E">终点站</option>
<option value="T">停车场</option>
</select>
</div>
</div>
</div>
<!-- 中心位置坐标点 -->
<div class="form-body">
<div class="form-group">
<label class="col-md-3 control-label"><span class="required"> * </span>经纬度坐标点:</label>
<div class="col-md-6">
<input type="text" class="form-control" name="bJwpoints" id="bJwpointsInput">
</div>
</div>
</div>
<!-- 几何图形类型 -->
<div class="form-body">
<div class="form-group">
<label class="col-md-3 control-label"><span class="required"> * </span>几何图形类型:</label>
<div class="col-md-6">
<input type="text" class="form-control" name="shapesType" id="shapesTypeSelect" placeholder="几何图形类型" readonly="readonly">
</div>
</div>
</div>
<!-- 圆形半径 -->
<div class="form-body" id="radiusGroup">
<div class="form-group">
<label class="col-md-3 control-label"><span class="required"> * </span>圆形半径 :</label>
<div class="col-md-6">
<input type="text" class="form-control" name="radius" id="radiusInput" placeholder="圆形半径">
</div>
</div>
</div>
<!-- 是否撤销 -->
<div class="form-body">
<div class="form-group">
<label class="col-md-3 control-label"><span class="required"> * </span>是否撤销 :</label>
<div class="col-md-6">
<select name="destroy" class="form-control" id="destroySelect">
<option value="">-- 请选择撤销类型 --</option>
<option value="0">否</option>
<option value="1">是</option>
</select>
</div>
</div>
</div>
<!-- 道路编码-->
<div class="form-body">
<div class="form-group">
<label class="control-label col-md-3">道路编码 :</label>
<div class="col-md-6">
<input type="text" class="form-control" name="roadCoding" id="roadCodingCodInput">
</div>
</div>
</div>
<!-- 到站时间 -->
<div class="form-body">
<div class="form-group">
<label class="col-md-3 control-label">到站时间 :</label>
<div class="col-md-6">
<input type="text" class="form-control" name="toTime" id="toTimeInput" >
<span class="help-block">单位:分钟(min)</span>
</div>
</div>
</div>
<!-- 到站距离 -->
<div class="form-body">
<div class="form-group">
<label class="col-md-3 control-label">到站距离 :</label>
<div class="col-md-6">
<input type="text" class="form-control" name="distances" id="distancesInput" >
<span class="help-block">单位:公里(km)</span>
</div>
</div>
</div>
<!-- 版本号 -->
<div class="form-body">
<div class="form-group">
<label class="col-md-3 control-label">版本号 :</label>
<div class="col-md-6">
<input type="text" class="form-control" name="versions" id='versionsInput' Readonly>
</div>
</div>
</div>
<!-- 描述/说明 -->
<div class="form-group">
<label class="control-label col-md-3"> 描述/说明 : </label>
<div class="col-md-6">
<textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="描述/说明"></textarea>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn default" data-dismiss="modal" id="addMobalHiden">取消</button>
<button type="button" class="btn btn-primary" id="addStationButton">提交数据</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$('#add_station_mobal').on('AddStationMobal.show', function(e, addMap,ajaxd,staobj,lineObj,fun){
var Station = staobj.getAddStation();
var Line = lineObj.getLineObj();
// 延迟加载
setTimeout(function(){
// 显示mobal
$('#add_station_mobal').modal({show : true,backdrop: 'static', keyboard: false});
},200);
// 当调用 hide 实例方法时触发
$('#add_station_mobal').on('hide.bs.modal', function () {
closeMobleSetClean();
});
// 当模态框对用户可见时触发(将等待 CSS 过渡效果完成)。
$('#add_station_mobal').on('show.bs.modal', function () {
// 获取站点编码元素,添加站点编码值
ajaxd.getStationCode(function(stationCode) {
// 线路ID.
$('#lineIdInput').val(Line.id);
// 获取站点名称元素设值.
$('#zdmcInput').val(Station.stationNamebootbox);
// 获取站点路由名称元素设值.
$('#stationNameInput').val(Station.stationNamebootbox);
// 站点编码.
$('#stationCodInput').val(stationCode).attr('Readonly','Readonly');
// 获取方向元素,并添加值.
$('#stationdirSelect').val(Station.dir).attr('Readonly','Readonly');
// 百度地图经纬度坐标中心点.
$('#bJwpointsInput').val(Station.bJwpoints).attr('Readonly','Readonly');
// 百度坐标点图形集合.
$('#bPolygonGridInput').val(Station.bPolygonGrid);
// 获取图形类型元素,并添加值
if(Station.shapesType=='r')
$('#shapesTypeSelect').val('圆形');
else if(Station.shapesType=='d') {
$('#radiusGroup').hide();
$('#shapesTypeSelect').val('多边形');
}
// 获取圆形半径元素,并添加值
$('#radiusInput').val(Station.radius);
// 是否撤销
$('#destroySelect').val(0);
// 版本号
$.get('/lineVersions/findCurrentVersion',{'lineId':Line.id},function(versions){
$('#versionsInput').val(versions);
});
var initzdlyP = {'line.id_eq':Line.id,'destroy_eq':0,'directions_eq':Station.dir};
initSelect(initzdlyP);
});
});
// 站点序号值改变事件
$('#stationrouteSelect').on('change',function() {
var stationRValue = $('#stationrouteSelect').val();
if(stationRValue=='请选择...') {
$('#stationMarkSelect').val('B');
}else {
var tempStr = stationRValue.split('_');
if(tempStr[1] == 'E') {
$('#stationMarkSelect').val('E');
}else {
$('#stationMarkSelect').val('Z');
}
}
});
// 获取表单元素
var form = $('#add_station_form');
// 获取错误提示信息元素
var error = $('.alert-danger', form);
//提交
$('#addStationButton').on('click', function() {
// 表单提交
form.submit();
});
// 表单验证
form.validate({
errorElement : 'span',
errorClass : 'help-block help-block-error',
focusInvalid : true,
rules : {
'stationName' : {required : true,maxlength : 50,},// 站点名称 必填项
'stationCod': {required : true,},// 站点编码 必填项 必须输入合法的数字(负数,小数)。
'directions' : {required : true,dirIs : true},// 站点方向 必填项 必填项
'stationRouteCode' : {isStart : true},// 站点序号
'stationMark' : {required : true,},// 站点类型 必填项.
'bJwpoints' : {required : true,},// 经纬度坐标点 必填项.
'shapesType' : {required : true,},// 几何图形类型 必填项.
'radius' : {required : true,},// 几何图形类型 必填项.
'destroy' : {required : true,},// 是否撤销 必填项.
'toTime' : {number : true},// 到站时间 必须输入合法的数字(负数,小数)。
'distances' : {number : true},// 到站距离 必须输入合法的数字(负数,小数)。
'descriptions' : {maxlength: 150}// 描述与说明 // 描述与说明
},
invalidHandler : function(event, validator) {
error.show();
App.scrollTo(error, -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) {
var params = form.serializeJSON();
error.hide();
if(params.shapesType=='圆形')
params.shapesType='r';
else if(params.shapesType=='多边形')
params.shapesType='d';
if(params.stationRouteCode=='请选择...')
params.stationRouteCode='';
// 保存
ajaxd.stationSave(params,function(data) {
if(data.status=='SUCCESS') {
// 弹出添加成功提示消息
layer.msg('添加成功...');
}else {
// 弹出添加失败提示消息
layer.msg('添加失败...');
}
var id =Line.id;
var dir = params.directions
// 刷行左边树
fun.resjtreeDate(id,dir);
closeMobleSetClean();
// 隐藏moble
hideMoble();
});
}
});
function initSelect(p){
ajaxd.getzdlyInfo(p,function(array) {
// 定义路段路由长度、渲染拼音检索下拉框格式数据.
var len_ = array.length,paramsD = new Array();
if(len_>0) {
paramsD.push({'id':'请选择...','text':'请选择...'});
// 遍历.
$.each(array, function(i, g){
// 判断.
if(g.name!='' || g.name != null) {
// 添加拼音检索下拉框格式数据数组.
paramsD.push({'id':g.stationRouteCode + '_' + g.stationMark + '_' + g.directions,
'text':g.stationName + ' (' + g.stationRouteCode + ')' + ' --' + fun.dirdmToName(g.directions)});
}
});
$('#stationrouteSelect').empty();
// 初始化上一个路段拼音检索下拉框.
initPinYinSelect2($('#stationrouteSelect'),paramsD,function(selector) {
});
}
});
}
function closeMobleSetClean() {
// 清除地图覆盖物
addMap.clearMarkAndOverlays();
/** 设置新增站点集合对象为空 */
staobj.setAddStation({});
var add_direction_v = $('#stationdirSelect').val();
ajaxd.getSectionRouteInfo(Line.id,add_direction_v,function(data) {
fun.linePanlThree(Line.id,data,add_direction_v);
});
fun.editMapStatusRemove();
}
function hideMoble() {
// 隐藏mobal
$('#add_station_mobal').modal('hide');
}
// 当站点类型为中途站或者终点站时,上一站点为必填项!
$.validator.addMethod("isStart", function(value,element) {
var tel = false;
var stationMarkV = $('#stationMarkSelect').val();
var stationrouteSelectV = $('#stationrouteSelect').val();
if(stationMarkV =='B'){
tel = true;
return tel;
}else if(stationMarkV =='Z' || stationMarkV =='E'){
if(stationrouteSelectV!='' && stationrouteSelectV!='请选择...' && stationrouteSelectV!=null){
tel = true;
return tel;
}
}
return tel;
}, '当站点类型为中途站或者终点站时,上一站点为必填项!');
// 方向
$.validator.addMethod("dirIs", function(value,element) {
var tel = true;
var stationMarkV = $('#stationdirSelect').val();
if(stationMarkV!=Station.dir){
tel = false;
}
return tel;
}, '方向必须一致!');
});
=======
<!-- 新增站点 -->
<div class="modal fade" id="add_station_mobal" role="basic" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<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" role="form" id="add_station_form" action="/module" method="post">
<div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button>
您的输入有误,请检查下面的输入项
</div>
<!-- 线路ID -->
<input type="hidden" name="lineId" id="lineIdInput" value="" />
<input type="hidden" name="bPolygonGrid" id="bPolygonGridInput" value="" />
<input type="hidden" name="gPolygonGrid" id="gPolygonGridInput" value="" />
<input type="hidden" name="gJwpoints" id="gJwpointsInput">
<input type="hidden" name="dbType" id="dbTypeInput" value="b"/>
<input type="hidden" name="x" id="xInput" value=""/>
<input type="hidden" name="y" id="yInput" value=""/>
<!-- 站点名称 -->
<div class="form-body">
<div class="form-group">
<label class="control-label col-md-3">
<span class="required"> * </span> 站点名称 :
</label>
<div class="col-md-6">
<input type="text" class="form-control" name="zdmc" id="zdmcInput" placeholder="站点名称" readonly="readonly">
</div>
</div>
</div>
<!-- 站点路由名称 -->
<div class="form-body">
<div class="form-group">
<label class="control-label col-md-3">
<span class="required"> * </span> 站点路由名称:
</label>
<div class="col-md-6">
<input type="text" class="form-control" name="stationName" id="stationNameInput" placeholder="站点路由名称">
</div>
</div>
</div>
<!-- 站点编码 -->
<div class="form-body">
<div class="form-group">
<label class="control-label col-md-3">
<span class="required"> * </span>站点编码 :
</label>
<div class="col-md-6">
<input type="text" class="form-control" name="stationCod" id="stationCodInput" readonly="readonly">
</div>
</div>
</div>
<!-- 行业编码 -->
<div class="form-body">
<div class="form-group">
<label class="control-label col-md-3">
行业编码 :
</label>
<div class="col-md-6">
<input type="text" class="form-control" name="industryCode" id="industryCodeInput" placeholder="行业编码">
</div>
</div>
</div>
<!-- 站点方向 -->
<div class="form-body">
<div class="form-group">
<label class="control-label col-md-3">
<span class="required"> * </span>站点方向 :
</label>
<div class="col-md-6">
<select name="directions" class="form-control" id="stationdirSelect">
<option value="">-- 请选择站点类型 --</option>
<option value="0">上行</option>
<option value="1">下行</option>
</select>
</div>
</div>
</div>
<!-- 站点序号 -->
<div class="form-body">
<div class="form-group">
<label class="control-label col-md-3">
<span class="required"> * </span>站点序号 :
</label>
<div class="col-md-6">
<select name="stationRouteCode" class="form-control" id="stationrouteSelect" style="width:100%"></select>
<span class="help-block">说明:选择的站点将作为本站序号的参考,成为选择站点的下一站。 </span>
</div>
</div>
</div>
<!-- 站点类型 -->
<div class="form-body">
<div class="form-group">
<label class="control-label col-md-3">
<span class="required"> * </span>站点类型 :
</label>
<div class="col-md-6">
<select name="stationMark" class="form-control" id="stationMarkSelect">
<option value="">-- 请选择站点类型 --</option>
<option value="B">起点站</option>
<option value="Z">中途站</option>
<option value="E">终点站</option>
<option value="T">停车场</option>
</select>
</div>
</div>
</div>
<!-- 中心位置坐标点 -->
<div class="form-body">
<div class="form-group">
<label class="col-md-3 control-label"><span class="required"> * </span>经纬度坐标点:</label>
<div class="col-md-6">
<input type="text" class="form-control" name="bJwpoints" id="bJwpointsInput">
</div>
</div>
</div>
<!-- 几何图形类型 -->
<div class="form-body">
<div class="form-group">
<label class="col-md-3 control-label"><span class="required"> * </span>几何图形类型:</label>
<div class="col-md-6">
<input type="text" class="form-control" name="shapesType" id="shapesTypeSelect" placeholder="几何图形类型" readonly="readonly">
</div>
</div>
</div>
<!-- 圆形半径 -->
<div class="form-body" id="radiusGroup">
<div class="form-group">
<label class="col-md-3 control-label"><span class="required"> * </span>圆形半径 :</label>
<div class="col-md-6">
<input type="text" class="form-control" name="radius" id="radiusInput" placeholder="圆形半径">
</div>
</div>
</div>
<!-- 是否撤销 -->
<div class="form-body">
<div class="form-group">
<label class="col-md-3 control-label"><span class="required"> * </span>是否撤销 :</label>
<div class="col-md-6">
<select name="destroy" class="form-control" id="destroySelect">
<option value="">-- 请选择撤销类型 --</option>
<option value="0">否</option>
<option value="1">是</option>
</select>
</div>
</div>
</div>
<!-- 道路编码-->
<div class="form-body">
<div class="form-group">
<label class="control-label col-md-3">道路编码 :</label>
<div class="col-md-6">
<input type="text" class="form-control" name="roadCoding" id="roadCodingCodInput">
</div>
</div>
</div>
<!-- 到站时间 -->
<div class="form-body">
<div class="form-group">
<label class="col-md-3 control-label">到站时间 :</label>
<div class="col-md-6">
<input type="text" class="form-control" name="toTime" id="toTimeInput" >
<span class="help-block">单位:分钟(min)</span>
</div>
</div>
</div>
<!-- 到站距离 -->
<div class="form-body">
<div class="form-group">
<label class="col-md-3 control-label">到站距离 :</label>
<div class="col-md-6">
<input type="text" class="form-control" name="distances" id="distancesInput" >
<span class="help-block">单位:公里(km)</span>
</div>
</div>
</div>
<!-- 版本号 -->
<div class="form-body">
<div class="form-group">
<label class="col-md-3 control-label">版本号 :</label>
<div class="col-md-6">
<input type="text" class="form-control" name="versions" id='versionsInput' Readonly>
</div>
</div>
</div>
<!-- 描述/说明 -->
<div class="form-group">
<label class="control-label col-md-3"> 描述/说明 : </label>
<div class="col-md-6">
<textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="描述/说明"></textarea>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn default" data-dismiss="modal" id="addMobalHiden">取消</button>
<button type="button" class="btn btn-primary" id="addStationButton">提交数据</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$('#add_station_mobal').on('AddStationMobal.show', function(e, addMap,ajaxd,staobj,lineObj,fun){
var Station = staobj.getAddStation();
var Line = lineObj.getLineObj();
// 延迟加载
setTimeout(function(){
// 显示mobal
$('#add_station_mobal').modal({show : true,backdrop: 'static', keyboard: false});
},200);
// 当调用 hide 实例方法时触发
$('#add_station_mobal').on('hide.bs.modal', function () {
closeMobleSetClean();
});
// 当模态框对用户可见时触发(将等待 CSS 过渡效果完成)。
$('#add_station_mobal').on('show.bs.modal', function () {
// 获取站点编码元素,添加站点编码值
ajaxd.getStationCode(function(stationCode) {
// 线路ID.
$('#lineIdInput').val(Line.id);
// 获取站点名称元素设值.
$('#zdmcInput').val(Station.stationNamebootbox);
// 获取站点路由名称元素设值.
$('#stationNameInput').val(Station.stationNamebootbox);
// 站点编码.
$('#stationCodInput').val(stationCode).attr('Readonly','Readonly');
// 获取方向元素,并添加值.
$('#stationdirSelect').val(Station.dir).attr('Readonly','Readonly');
// 百度地图经纬度坐标中心点.
$('#bJwpointsInput').val(Station.bJwpoints).attr('Readonly','Readonly');
// 百度坐标点图形集合.
$('#bPolygonGridInput').val(Station.bPolygonGrid);
// 获取图形类型元素,并添加值
if(Station.shapesType=='r')
$('#shapesTypeSelect').val('圆形');
else if(Station.shapesType=='d') {
$('#radiusGroup').hide();
$('#shapesTypeSelect').val('多边形');
}
// 获取圆形半径元素,并添加值
$('#radiusInput').val(Station.radius);
// 是否撤销
$('#destroySelect').val(0);
// 版本号
$('#versionsInput').val($("#versions").val());
var initzdlyP = {'line.id_eq':Line.id,'destroy_eq':0,'directions_eq':Station.dir,"versions_eq":$("#versions").val()};
initSelect(initzdlyP);
});
});
// 站点序号值改变事件
$('#stationrouteSelect').on('change',function() {
var stationRValue = $('#stationrouteSelect').val();
if(stationRValue=='请选择...') {
$('#stationMarkSelect').val('B');
}else {
var tempStr = stationRValue.split('_');
if(tempStr[1] == 'E') {
$('#stationMarkSelect').val('E');
}else {
$('#stationMarkSelect').val('Z');
}
}
});
// 获取表单元素
var form = $('#add_station_form');
// 获取错误提示信息元素
var error = $('.alert-danger', form);
//提交
$('#addStationButton').on('click', function() {
// 表单提交
form.submit();
});
// 表单验证
form.validate({
errorElement : 'span',
errorClass : 'help-block help-block-error',
focusInvalid : true,
rules : {
'stationName' : {required : true,maxlength : 50,},// 站点名称 必填项
'stationCod': {required : true,},// 站点编码 必填项 必须输入合法的数字(负数,小数)。
'directions' : {required : true,dirIs : true},// 站点方向 必填项 必填项
'stationRouteCode' : {isStart : true},// 站点序号
'stationMark' : {required : true,},// 站点类型 必填项.
'bJwpoints' : {required : true,},// 经纬度坐标点 必填项.
'shapesType' : {required : true,},// 几何图形类型 必填项.
'radius' : {required : true,},// 几何图形类型 必填项.
'destroy' : {required : true,},// 是否撤销 必填项.
'toTime' : {number : true},// 到站时间 必须输入合法的数字(负数,小数)。
'distances' : {number : true},// 到站距离 必须输入合法的数字(负数,小数)。
'descriptions' : {maxlength: 150}// 描述与说明 // 描述与说明
},
invalidHandler : function(event, validator) {
error.show();
App.scrollTo(error, -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) {
var params = form.serializeJSON();
error.hide();
if(params.shapesType=='圆形')
params.shapesType='r';
else if(params.shapesType=='多边形')
params.shapesType='d';
if(params.stationRouteCode=='请选择...')
params.stationRouteCode='';
params.status = $($("#versions").find("option:selected")[0]).attr("status");
// 保存
ajaxd.stationSave(params,function(data) {
if(data.status=='SUCCESS') {
// 弹出添加成功提示消息
layer.msg('添加成功...');
}else {
// 弹出添加失败提示消息
layer.msg('添加失败...');
}
var id =Line.id;
var dir = params.directions
// 刷行左边树
fun.resjtreeDate(id,dir,$("#versions").val());
closeMobleSetClean();
// 隐藏moble
hideMoble();
});
}
});
function initSelect(p){
ajaxd.getzdlyInfo(p,function(array) {
// 定义路段路由长度、渲染拼音检索下拉框格式数据.
var len_ = array.length,paramsD = new Array();
if(len_>0) {
paramsD.push({'id':'请选择...','text':'请选择...'});
// 遍历.
$.each(array, function(i, g){
// 判断.
if(g.name!='' || g.name != null) {
// 添加拼音检索下拉框格式数据数组.
paramsD.push({'id':g.stationRouteCode + '_' + g.stationMark + '_' + g.directions,
'text':g.stationName + ' (' + g.stationRouteCode + ')' + ' --' + fun.dirdmToName(g.directions)});
}
});
$('#stationrouteSelect').empty();
// 初始化上一个路段拼音检索下拉框.
initPinYinSelect2($('#stationrouteSelect'),paramsD,function(selector) {
});
}
});
}
function closeMobleSetClean() {
// 清除地图覆盖物
addMap.clearMarkAndOverlays();
/** 设置新增站点集合对象为空 */
staobj.setAddStation({});
var add_direction_v = $('#stationdirSelect').val();
var version = $("#versions").val();
fun.resjtreeDate(Line.id,add_direction_v,version);
//ajaxd.getSectionRouteInfo(Line.id,add_direction_v,version,function(data) {
// fun.linePanlThree(Line.id,data,add_direction_v,version);
//});
fun.editMapStatusRemove();
}
function hideMoble() {
// 隐藏mobal
$('#add_station_mobal').modal('hide');
}
// 当站点类型为中途站或者终点站时,上一站点为必填项!
$.validator.addMethod("isStart", function(value,element) {
var tel = false;
var stationMarkV = $('#stationMarkSelect').val();
var stationrouteSelectV = $('#stationrouteSelect').val();
if(stationMarkV =='B'){
tel = true;
return tel;
}else if(stationMarkV =='Z' || stationMarkV =='E'){
if(stationrouteSelectV!='' && stationrouteSelectV!='请选择...' && stationrouteSelectV!=null){
tel = true;
return tel;
}
}
return tel;
}, '当站点类型为中途站或者终点站时,上一站点为必填项!');
// 方向
$.validator.addMethod("dirIs", function(value,element) {
var tel = true;
var stationMarkV = $('#stationdirSelect').val();
if(stationMarkV!=Station.dir){
tel = false;
}
return tel;
}, '方向必须一致!');
});
>>>>>>> 6cafe1acab4252c1fd171e0669654f317bf0fd4a
</script>