Commit 5b22d60cff62a98baf56f6bb0b310ad7cfd4074c

Authored by youxiw2000
1 parent 18b48aa8

1

src/main/java/com/bsth/service/impl/StationServiceImpl.java
@@ -909,8 +909,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem @@ -909,8 +909,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem
909 if (map.get("status") == null || Integer.parseInt(map.get("status").toString()) == 1) { 909 if (map.get("status") == null || Integer.parseInt(map.get("status").toString()) == 1) {
910 StationRoute arg0 = new StationRoute(); 910 StationRoute arg0 = new StationRoute();
911 // 距离 911 // 距离
912 - Double distances = map.get("distances").equals("") ? 0.0d  
913 - : Double.parseDouble(map.get("distances").toString()); 912 + Double distances = map.get("distances").equals("") ? 0.0d : Double.parseDouble(map.get("distances").toString());
914 // 时间 913 // 时间
915 Double toTime = map.get("toTime").equals("") ? 0.0d : Double.parseDouble(map.get("toTime").toString()); 914 Double toTime = map.get("toTime").equals("") ? 0.0d : Double.parseDouble(map.get("toTime").toString());
916 // 站点路由名称 915 // 站点路由名称
@@ -920,8 +919,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem @@ -920,8 +919,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem
920 // 线路信息 919 // 线路信息
921 Line resultLine = lineRepository.findById(line).get(); 920 Line resultLine = lineRepository.findById(line).get();
922 // 站点路由序号 921 // 站点路由序号
923 - String stationRouteCodeStr = map.get("stationRouteCode").equals("") ? ""  
924 - : map.get("stationRouteCode").toString(); 922 + String stationRouteCodeStr = map.get("stationRouteCode").equals("") ? "" : map.get("stationRouteCode").toString();
925 // 站点类型 923 // 站点类型
926 String stationMark = map.get("stationMark").equals("") ? "" : map.get("stationMark").toString(); 924 String stationMark = map.get("stationMark").equals("") ? "" : map.get("stationMark").toString();
927 Integer stationRouteCode = null; 925 Integer stationRouteCode = null;
@@ -973,8 +971,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem @@ -973,8 +971,7 @@ public class StationServiceImpl extends BaseServiceImpl<Station, Integer> implem
973 // 线路信息 971 // 线路信息
974 Line resultLine = lineRepository.findById(line).get(); 972 Line resultLine = lineRepository.findById(line).get();
975 // 站点路由序号 973 // 站点路由序号
976 - String stationRouteCodeStr = map.get("stationRouteCode").equals("") ? ""  
977 - : map.get("stationRouteCode").toString(); 974 + String stationRouteCodeStr = map.get("stationRouteCode").equals("") ? "" : map.get("stationRouteCode").toString();
978 // 站点类型 975 // 站点类型
979 String stationMark = map.get("stationMark").equals("") ? "" : map.get("stationMark").toString(); 976 String stationMark = map.get("stationMark").equals("") ? "" : map.get("stationMark").toString();
980 Integer stationRouteCode = null; 977 Integer stationRouteCode = null;
src/main/resources/static/pages/base/stationroute/add.html
1 -<!-- 新增站点 -->  
2 -<div class="modal fade" id="add_station_mobal" role="basic" aria-hidden="true">  
3 - <div class="modal-dialog">  
4 - <div class="modal-content">  
5 - <div class="modal-header">  
6 - <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>  
7 - <h4 class="modal-title">新增站点</h4>  
8 - </div>  
9 - <div class="modal-body">  
10 - <form class="form-horizontal" role="form" id="add_station_form" action="/module" method="post">  
11 - <div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button>  
12 - 您的输入有误,请检查下面的输入项  
13 - </div>  
14 - <!-- 线路ID -->  
15 - <input type="hidden" name="lineId" id="lineIdInput" value="" />  
16 - <input type="hidden" name="bPolygonGrid" id="bPolygonGridInput" value="" />  
17 - <input type="hidden" name="gPolygonGrid" id="gPolygonGridInput" value="" />  
18 - <input type="hidden" name="gJwpoints" id="gJwpointsInput">  
19 - <input type="hidden" name="dbType" id="dbTypeInput" value="b"/>  
20 - <input type="hidden" name="x" id="xInput" value=""/>  
21 - <input type="hidden" name="y" id="yInput" value=""/>  
22 - <!-- 站点名称 -->  
23 - <div class="form-body">  
24 - <div class="form-group">  
25 - <label class="control-label col-md-3">  
26 - <span class="required"> * </span> 站点名称&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:  
27 - </label>  
28 - <div class="col-md-6">  
29 - <input type="text" class="form-control" name="zdmc" id="zdmcInput" placeholder="站点名称" readonly="readonly">  
30 - </div>  
31 - </div>  
32 - </div>  
33 - <!-- 站点路由名称 -->  
34 - <div class="form-body">  
35 - <div class="form-group">  
36 - <label class="control-label col-md-3">  
37 - <span class="required"> * </span> 站点路由名称:  
38 - </label>  
39 - <div class="col-md-6">  
40 - <input type="text" class="form-control" name="stationName" id="stationNameInput" placeholder="站点路由名称">  
41 - </div>  
42 - </div>  
43 - </div>  
44 - <!-- 站点编码 -->  
45 - <div class="form-body">  
46 - <div class="form-group">  
47 - <label class="control-label col-md-3">  
48 - <span class="required"> * </span>站点编码&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:  
49 - </label>  
50 - <div class="col-md-6">  
51 - <input type="text" class="form-control" name="stationCod" id="stationCodInput" readonly="readonly">  
52 - </div>  
53 - </div>  
54 - </div>  
55 - <!-- 行业编码 -->  
56 - <div class="form-body">  
57 - <div class="form-group">  
58 - <label class="control-label col-md-3">  
59 - 行业编码&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:  
60 - </label>  
61 - <div class="col-md-6">  
62 - <input type="text" class="form-control" name="industryCode" id="industryCodeInput" placeholder="行业编码">  
63 - </div>  
64 - </div>  
65 - </div>  
66 - <!-- 站点方向 -->  
67 - <div class="form-body">  
68 - <div class="form-group">  
69 - <label class="control-label col-md-3">  
70 - <span class="required"> * </span>站点方向&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:  
71 - </label>  
72 - <div class="col-md-6">  
73 - <select name="directions" class="form-control" id="stationdirSelect">  
74 - <option value="">-- 请选择站点类型 --</option>  
75 - <option value="0">上行</option>  
76 - <option value="1">下行</option>  
77 - </select>  
78 - </div>  
79 - </div>  
80 - </div>  
81 -  
82 - <!-- 站点序号 -->  
83 - <div class="form-body">  
84 - <div class="form-group">  
85 - <label class="control-label col-md-3">  
86 - <span class="required"> * </span>站点序号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:  
87 - </label>  
88 - <div class="col-md-6">  
89 - <select name="stationRouteCode" class="form-control" id="stationrouteSelect" style="width:100%"></select>  
90 - <span class="help-block">说明:选择的站点将作为本站序号的参考,成为选择站点的下一站。 </span>  
91 - </div>  
92 - </div>  
93 - </div>  
94 -  
95 - <!-- 站点类型 -->  
96 - <div class="form-body">  
97 - <div class="form-group">  
98 - <label class="control-label col-md-3">  
99 - <span class="required"> * </span>站点类型&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:  
100 - </label>  
101 - <div class="col-md-6">  
102 - <select name="stationMark" class="form-control" id="stationMarkSelect">  
103 - <option value="">-- 请选择站点类型 --</option>  
104 - <option value="B">起点站</option>  
105 - <option value="Z">中途站</option>  
106 - <option value="E">终点站</option>  
107 - <option value="T">停车场</option>  
108 - </select>  
109 - </div>  
110 - </div>  
111 - </div>  
112 - <!-- 中心位置坐标点 -->  
113 - <div class="form-body">  
114 - <div class="form-group">  
115 - <label class="col-md-3 control-label"><span class="required"> * </span>经纬度坐标点:</label>  
116 - <div class="col-md-6">  
117 - <input type="text" class="form-control" name="bJwpoints" id="bJwpointsInput">  
118 - </div>  
119 - </div>  
120 - </div>  
121 - <!-- 几何图形类型 -->  
122 - <div class="form-body">  
123 - <div class="form-group">  
124 - <label class="col-md-3 control-label"><span class="required"> * </span>几何图形类型:</label>  
125 - <div class="col-md-6">  
126 - <input type="text" class="form-control" name="shapesType" id="shapesTypeSelect" placeholder="几何图形类型" readonly="readonly">  
127 - </div>  
128 - </div>  
129 - </div>  
130 - <!-- 圆形半径 -->  
131 - <div class="form-body" id="radiusGroup">  
132 - <div class="form-group">  
133 - <label class="col-md-3 control-label"><span class="required"> * </span>圆形半径&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>  
134 - <div class="col-md-6">  
135 - <input type="text" class="form-control" name="radius" id="radiusInput" placeholder="圆形半径">  
136 - </div>  
137 - </div>  
138 - </div>  
139 - <!-- 是否撤销 -->  
140 - <div class="form-body">  
141 - <div class="form-group">  
142 - <label class="col-md-3 control-label"><span class="required"> * </span>是否撤销&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>  
143 - <div class="col-md-6">  
144 - <select name="destroy" class="form-control" id="destroySelect">  
145 - <option value="">-- 请选择撤销类型 --</option>  
146 - <option value="0">否</option>  
147 - <option value="1">是</option>  
148 - </select>  
149 - </div>  
150 - </div>  
151 - </div>  
152 -  
153 - <!-- 道路编码-->  
154 - <div class="form-body">  
155 - <div class="form-group">  
156 - <label class="control-label col-md-3">道路编码&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>  
157 - <div class="col-md-6">  
158 - <input type="text" class="form-control" name="roadCoding" id="roadCodingCodInput">  
159 - </div>  
160 - </div>  
161 - </div>  
162 - <!-- 到站时间 -->  
163 - <div class="form-body">  
164 - <div class="form-group">  
165 - <label class="col-md-3 control-label">到站时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>  
166 - <div class="col-md-6">  
167 - <input type="text" class="form-control" name="toTime" id="toTimeInput" >  
168 - <span class="help-block">单位:分钟(min)</span>  
169 - </div>  
170 - </div>  
171 - </div>  
172 - <!-- 到站距离 -->  
173 - <div class="form-body">  
174 - <div class="form-group">  
175 - <label class="col-md-3 control-label">到站距离&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>  
176 - <div class="col-md-6">  
177 - <input type="text" class="form-control" name="distances" id="distancesInput" >  
178 - <span class="help-block">单位:公里(km)</span>  
179 - </div>  
180 - </div>  
181 - </div>  
182 - <!-- 版本号 -->  
183 - <div class="form-body">  
184 - <div class="form-group">  
185 - <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>  
186 - <div class="col-md-6">  
187 - <input type="text" class="form-control" name="versions" id='versionsInput' Readonly>  
188 - </div>  
189 - </div>  
190 - </div>  
191 -  
192 - <!-- 描述/说明 -->  
193 - <div class="form-group">  
194 - <label class="control-label col-md-3"> 描述/说明&nbsp;&nbsp;&nbsp;&nbsp;: </label>  
195 - <div class="col-md-6">  
196 - <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="描述/说明"></textarea>  
197 - </div>  
198 - </div>  
199 - </form>  
200 - </div>  
201 - <div class="modal-footer">  
202 - <button type="button" class="btn default" data-dismiss="modal" id="addMobalHiden">取消</button>  
203 - <button type="button" class="btn btn-primary" id="addStationButton">提交数据</button>  
204 - </div>  
205 - </div>  
206 - </div>  
207 -</div>  
208 -<script type="text/javascript">  
209 -$('#add_station_mobal').on('AddStationMobal.show', function(e, addMap,ajaxd,staobj,lineObj,fun){  
210 - var Station = staobj.getAddStation();  
211 - var Line = lineObj.getLineObj();  
212 - // 延迟加载  
213 - setTimeout(function(){  
214 - // 显示mobal  
215 - $('#add_station_mobal').modal({show : true,backdrop: 'static', keyboard: false});  
216 - },200);  
217 - // 当调用 hide 实例方法时触发  
218 - $('#add_station_mobal').on('hide.bs.modal', function () {  
219 - closeMobleSetClean();  
220 - });  
221 - // 当模态框对用户可见时触发(将等待 CSS 过渡效果完成)。  
222 - $('#add_station_mobal').on('show.bs.modal', function () {  
223 - // 获取站点编码元素,添加站点编码值  
224 - ajaxd.getStationCode(function(stationCode) {  
225 - // 线路ID.  
226 - $('#lineIdInput').val(Line.id);  
227 - // 获取站点名称元素设值.  
228 - $('#zdmcInput').val(Station.stationNamebootbox);  
229 - // 获取站点路由名称元素设值.  
230 - $('#stationNameInput').val(Station.stationNamebootbox);  
231 - // 站点编码.  
232 - $('#stationCodInput').val(stationCode).attr('Readonly','Readonly');  
233 - // 获取方向元素,并添加值.  
234 - $('#stationdirSelect').val(Station.dir).attr('Readonly','Readonly');  
235 - // 百度地图经纬度坐标中心点.  
236 - $('#bJwpointsInput').val(Station.bJwpoints).attr('Readonly','Readonly');  
237 - // 百度坐标点图形集合.  
238 - $('#bPolygonGridInput').val(Station.bPolygonGrid);  
239 - // 获取图形类型元素,并添加值  
240 - if(Station.shapesType=='r')  
241 - $('#shapesTypeSelect').val('圆形');  
242 - else if(Station.shapesType=='d') {  
243 - $('#radiusGroup').hide();  
244 - $('#shapesTypeSelect').val('多边形');  
245 - }  
246 - // 获取圆形半径元素,并添加值  
247 - $('#radiusInput').val(Station.radius);  
248 - // 是否撤销  
249 - $('#destroySelect').val(0);  
250 - // 版本号  
251 -  
252 - $('#versionsInput').val($("#versions").val());  
253 -  
254 - var initzdlyP = {'line.id_eq':Line.id,'destroy_eq':0,'directions_eq':Station.dir,"versions_eq":$("#versions").val()};  
255 - initSelect(initzdlyP);  
256 - });  
257 - });  
258 - // 站点序号值改变事件  
259 - $('#stationrouteSelect').on('change',function() {  
260 - var stationRValue = $('#stationrouteSelect').val();  
261 - if(stationRValue=='请选择...') {  
262 - $('#stationMarkSelect').val('B');  
263 - }else {  
264 - var tempStr = stationRValue.split('_');  
265 - if(tempStr[1] == 'E') {  
266 - $('#stationMarkSelect').val('E');  
267 - }else {  
268 - $('#stationMarkSelect').val('Z');  
269 - }  
270 - }  
271 - });  
272 - // 获取表单元素  
273 - var form = $('#add_station_form');  
274 - // 获取错误提示信息元素  
275 - var error = $('.alert-danger', form);  
276 - //提交  
277 - $('#addStationButton').on('click', function() {  
278 - // 表单提交  
279 - form.submit();  
280 - });  
281 - // 表单验证  
282 - form.validate({  
283 - errorElement : 'span',  
284 - errorClass : 'help-block help-block-error',  
285 - focusInvalid : true,  
286 - rules : {  
287 - 'stationName' : {required : true,maxlength : 50,},// 站点名称 必填项  
288 - 'stationCod': {required : true,},// 站点编码 必填项 必须输入合法的数字(负数,小数)。  
289 - 'directions' : {required : true,dirIs : true},// 站点方向 必填项 必填项  
290 - 'stationRouteCode' : {isStart : true},// 站点序号  
291 - 'stationMark' : {required : true,},// 站点类型 必填项.  
292 - 'bJwpoints' : {required : true,},// 经纬度坐标点 必填项.  
293 - 'shapesType' : {required : true,},// 几何图形类型 必填项.  
294 - 'radius' : {required : true,},// 几何图形类型 必填项.  
295 - 'destroy' : {required : true,},// 是否撤销 必填项.  
296 - 'toTime' : {number : true},// 到站时间 必须输入合法的数字(负数,小数)。  
297 - 'distances' : {number : true},// 到站距离 必须输入合法的数字(负数,小数)。  
298 - 'descriptions' : {maxlength: 150}// 描述与说明 // 描述与说明  
299 -  
300 - },  
301 - invalidHandler : function(event, validator) {  
302 - error.show();  
303 - App.scrollTo(error, -200);  
304 - },  
305 - highlight : function(element) {  
306 - $(element).closest('.form-group').addClass('has-error');  
307 - },  
308 - unhighlight : function(element) {  
309 - $(element).closest('.form-group').removeClass('has-error');  
310 - },  
311 - success : function(label) {  
312 - label.closest('.form-group').removeClass('has-error');  
313 - },  
314 - submitHandler : function(f) {  
315 - var params = form.serializeJSON();  
316 - error.hide();  
317 - if(params.shapesType=='圆形')  
318 - params.shapesType='r';  
319 - else if(params.shapesType=='多边形')  
320 - params.shapesType='d';  
321 - if(params.stationRouteCode=='请选择...')  
322 - params.stationRouteCode='';  
323 -  
324 - params.status = $($("#versions").find("option:selected")[0]).attr("status");  
325 - // 保存  
326 - ajaxd.stationSave(params,function(data) {  
327 - if(data.status=='SUCCESS') {  
328 - // 弹出添加成功提示消息  
329 - layer.msg('添加成功...');  
330 - }else {  
331 - // 弹出添加失败提示消息  
332 - layer.msg('添加失败...');  
333 - }  
334 - var id =Line.id;  
335 - var dir = params.directions  
336 - // 刷行左边树  
337 - fun.resjtreeDate(id,dir,$("#versions").val());  
338 - closeMobleSetClean();  
339 - // 隐藏moble  
340 - hideMoble();  
341 - });  
342 - }  
343 - });  
344 - function initSelect(p){  
345 - ajaxd.getzdlyInfo(p,function(array) {  
346 - // 定义路段路由长度、渲染拼音检索下拉框格式数据.  
347 - var len_ = array.length,paramsD = new Array();  
348 - if(len_>0) {  
349 - paramsD.push({'id':'请选择...','text':'请选择...'});  
350 - // 遍历.  
351 - $.each(array, function(i, g){  
352 - // 判断.  
353 - if(g.name!='' || g.name != null) {  
354 - // 添加拼音检索下拉框格式数据数组.  
355 - paramsD.push({'id':g.stationRouteCode + '_' + g.stationMark + '_' + g.directions,  
356 - 'text':g.stationName + ' (' + g.stationRouteCode + ')' + ' --' + fun.dirdmToName(g.directions)});  
357 - }  
358 - });  
359 - $('#stationrouteSelect').empty();  
360 - // 初始化上一个路段拼音检索下拉框.  
361 - initPinYinSelect2($('#stationrouteSelect'),paramsD,function(selector) {  
362 - });  
363 - }  
364 - });  
365 - }  
366 - function closeMobleSetClean() {  
367 - // 清除地图覆盖物  
368 - addMap.clearMarkAndOverlays();  
369 - /** 设置新增站点集合对象为空 */  
370 - staobj.setAddStation({});  
371 - var add_direction_v = $('#stationdirSelect').val();  
372 - var version = $("#versions").val();  
373 - PublicFunctions.resjtreeDate(Line.id,add_direction_v,version);  
374 - //ajaxd.getSectionRouteInfo(Line.id,add_direction_v,version,function(data) {  
375 - // fun.linePanlThree(Line.id,data,add_direction_v,version);  
376 - //});  
377 - fun.editMapStatusRemove();  
378 - }  
379 - function hideMoble() {  
380 - // 隐藏mobal  
381 - $('#add_station_mobal').modal('hide');  
382 - }  
383 - // 当站点类型为中途站或者终点站时,上一站点为必填项!  
384 - $.validator.addMethod("isStart", function(value,element) {  
385 - var tel = false;  
386 - var stationMarkV = $('#stationMarkSelect').val();  
387 - var stationrouteSelectV = $('#stationrouteSelect').val();  
388 - if(stationMarkV =='B'){  
389 - tel = true;  
390 - return tel;  
391 - }else if(stationMarkV =='Z' || stationMarkV =='E'){  
392 - if(stationrouteSelectV!='' && stationrouteSelectV!='请选择...' && stationrouteSelectV!=null){  
393 - tel = true;  
394 - return tel;  
395 - }  
396 - }  
397 - return tel;  
398 - }, '当站点类型为中途站或者终点站时,上一站点为必填项!');  
399 - // 方向  
400 - $.validator.addMethod("dirIs", function(value,element) {  
401 - var tel = true;  
402 - var stationMarkV = $('#stationdirSelect').val();  
403 - if(stationMarkV!=Station.dir){  
404 - tel = false;  
405 - }  
406 - return tel;  
407 - }, '方向必须一致!');  
408 -}); 1 +<!-- 新增站点 -->
  2 +<div class="modal fade" id="add_station_mobal" role="basic" aria-hidden="true">
  3 + <div class="modal-dialog">
  4 + <div class="modal-content">
  5 + <div class="modal-header">
  6 + <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
  7 + <h4 class="modal-title">新增站点</h4>
  8 + </div>
  9 + <div class="modal-body">
  10 + <form class="form-horizontal" role="form" id="add_station_form" action="/module" method="post">
  11 + <div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button>
  12 + 您的输入有误,请检查下面的输入项
  13 + </div>
  14 + <!-- 线路ID -->
  15 + <input type="hidden" name="lineId" id="lineIdInput" value="" />
  16 + <input type="hidden" name="bPolygonGrid" id="bPolygonGridInput" value="" />
  17 + <input type="hidden" name="gPolygonGrid" id="gPolygonGridInput" value="" />
  18 + <input type="hidden" name="gJwpoints" id="gJwpointsInput">
  19 + <input type="hidden" name="dbType" id="dbTypeInput" value="b"/>
  20 + <input type="hidden" name="x" id="xInput" value=""/>
  21 + <input type="hidden" name="y" id="yInput" value=""/>
  22 + <!-- 站点名称 -->
  23 + <div class="form-body">
  24 + <div class="form-group">
  25 + <label class="control-label col-md-3">
  26 + <span class="required"> * </span> 站点名称&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  27 + </label>
  28 + <div class="col-md-6">
  29 + <input type="text" class="form-control" name="zdmc" id="zdmcInput" placeholder="站点名称" readonly="readonly">
  30 + </div>
  31 + </div>
  32 + </div>
  33 + <!-- 站点路由名称 -->
  34 + <div class="form-body">
  35 + <div class="form-group">
  36 + <label class="control-label col-md-3">
  37 + <span class="required"> * </span> 站点路由名称:
  38 + </label>
  39 + <div class="col-md-6">
  40 + <input type="text" class="form-control" name="stationName" id="stationNameInput" placeholder="站点路由名称">
  41 + </div>
  42 + </div>
  43 + </div>
  44 + <!-- 站点编码 -->
  45 + <div class="form-body">
  46 + <div class="form-group">
  47 + <label class="control-label col-md-3">
  48 + <span class="required"> * </span>站点编码&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  49 + </label>
  50 + <div class="col-md-6">
  51 + <input type="text" class="form-control" name="stationCod" id="stationCodInput" readonly="readonly">
  52 + </div>
  53 + </div>
  54 + </div>
  55 + <!-- 行业编码 -->
  56 + <div class="form-body">
  57 + <div class="form-group">
  58 + <label class="control-label col-md-3">
  59 + 行业编码&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  60 + </label>
  61 + <div class="col-md-6">
  62 + <input type="text" class="form-control" name="industryCode" id="industryCodeInput" placeholder="行业编码">
  63 + </div>
  64 + </div>
  65 + </div>
  66 + <!-- 站点方向 -->
  67 + <div class="form-body">
  68 + <div class="form-group">
  69 + <label class="control-label col-md-3">
  70 + <span class="required"> * </span>站点方向&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  71 + </label>
  72 + <div class="col-md-6">
  73 + <select name="directions" class="form-control" id="stationdirSelect">
  74 + <option value="">-- 请选择站点类型 --</option>
  75 + <option value="0">上行</option>
  76 + <option value="1">下行</option>
  77 + </select>
  78 + </div>
  79 + </div>
  80 + </div>
  81 +
  82 + <!-- 站点序号 -->
  83 + <div class="form-body">
  84 + <div class="form-group">
  85 + <label class="control-label col-md-3">
  86 + <span class="required"> * </span>站点序号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  87 + </label>
  88 + <div class="col-md-6">
  89 + <select name="stationRouteCode" class="form-control" id="stationrouteSelect" style="width:100%"></select>
  90 + <span class="help-block">说明:选择的站点将作为本站序号的参考,成为选择站点的下一站。 </span>
  91 + </div>
  92 + </div>
  93 + </div>
  94 +
  95 + <!-- 站点类型 -->
  96 + <div class="form-body">
  97 + <div class="form-group">
  98 + <label class="control-label col-md-3">
  99 + <span class="required"> * </span>站点类型&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  100 + </label>
  101 + <div class="col-md-6">
  102 + <select name="stationMark" class="form-control" id="stationMarkSelect">
  103 + <option value="">-- 请选择站点类型 --</option>
  104 + <option value="B">起点站</option>
  105 + <option value="Z">中途站</option>
  106 + <option value="E">终点站</option>
  107 + <option value="T">停车场</option>
  108 + </select>
  109 + </div>
  110 + </div>
  111 + </div>
  112 + <!-- 中心位置坐标点 -->
  113 + <div class="form-body">
  114 + <div class="form-group">
  115 + <label class="col-md-3 control-label"><span class="required"> * </span>经纬度坐标点:</label>
  116 + <div class="col-md-6">
  117 + <input type="text" class="form-control" name="bJwpoints" id="bJwpointsInput">
  118 + </div>
  119 + </div>
  120 + </div>
  121 + <!-- 几何图形类型 -->
  122 + <div class="form-body">
  123 + <div class="form-group">
  124 + <label class="col-md-3 control-label"><span class="required"> * </span>几何图形类型:</label>
  125 + <div class="col-md-6">
  126 + <input type="text" class="form-control" name="shapesType" id="shapesTypeSelect" placeholder="几何图形类型" readonly="readonly">
  127 + </div>
  128 + </div>
  129 + </div>
  130 + <!-- 圆形半径 -->
  131 + <div class="form-body" id="radiusGroup">
  132 + <div class="form-group">
  133 + <label class="col-md-3 control-label"><span class="required"> * </span>圆形半径&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  134 + <div class="col-md-6">
  135 + <input type="text" class="form-control" name="radius" id="radiusInput" placeholder="圆形半径">
  136 + </div>
  137 + </div>
  138 + </div>
  139 + <!-- 是否撤销 -->
  140 + <div class="form-body">
  141 + <div class="form-group">
  142 + <label class="col-md-3 control-label"><span class="required"> * </span>是否撤销&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  143 + <div class="col-md-6">
  144 + <select name="destroy" class="form-control" id="destroySelect">
  145 + <option value="">-- 请选择撤销类型 --</option>
  146 + <option value="0">否</option>
  147 + <option value="1">是</option>
  148 + </select>
  149 + </div>
  150 + </div>
  151 + </div>
  152 +
  153 + <!-- 道路编码-->
  154 + <div class="form-body">
  155 + <div class="form-group">
  156 + <label class="control-label col-md-3">道路编码&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  157 + <div class="col-md-6">
  158 + <input type="text" class="form-control" name="roadCoding" id="roadCodingCodInput">
  159 + </div>
  160 + </div>
  161 + </div>
  162 + <!-- 到站时间 -->
  163 + <div class="form-body">
  164 + <div class="form-group">
  165 + <label class="col-md-3 control-label">到站时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  166 + <div class="col-md-6">
  167 + <input type="text" class="form-control" name="toTime" id="toTimeInput" >
  168 + <span class="help-block">单位:分钟(min)</span>
  169 + </div>
  170 + </div>
  171 + </div>
  172 + <!-- 到站距离 -->
  173 + <div class="form-body">
  174 + <div class="form-group">
  175 + <label class="col-md-3 control-label">到站距离&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  176 + <div class="col-md-6">
  177 + <input type="text" class="form-control" name="distances" id="distancesInput" >
  178 + <span class="help-block">单位:公里(km)</span>
  179 + </div>
  180 + </div>
  181 + </div>
  182 + <!-- 版本号 -->
  183 + <div class="form-body">
  184 + <div class="form-group">
  185 + <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  186 + <div class="col-md-6">
  187 + <input type="text" class="form-control" name="versions" id='versionsInput' Readonly>
  188 + </div>
  189 + </div>
  190 + </div>
  191 +
  192 + <!-- 描述/说明 -->
  193 + <div class="form-group">
  194 + <label class="control-label col-md-3"> 描述/说明&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  195 + <div class="col-md-6">
  196 + <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="描述/说明"></textarea>
  197 + </div>
  198 + </div>
  199 + </form>
  200 + </div>
  201 + <div class="modal-footer">
  202 + <button type="button" class="btn default" data-dismiss="modal" id="addMobalHiden">取消</button>
  203 + <button type="button" class="btn btn-primary" id="addStationButton">提交数据</button>
  204 + </div>
  205 + </div>
  206 + </div>
  207 +</div>
  208 +<script type="text/javascript">
  209 +$('#add_station_mobal').on('AddStationMobal.show', function(e, addMap,ajaxd,staobj,lineObj,fun){
  210 + var Station = staobj.getAddStation();
  211 + var Line = lineObj.getLineObj();
  212 + // 延迟加载
  213 + setTimeout(function(){
  214 + // 显示mobal
  215 + $('#add_station_mobal').modal({show : true,backdrop: 'static', keyboard: false});
  216 + },200);
  217 + // 当调用 hide 实例方法时触发
  218 + $('#add_station_mobal').on('hide.bs.modal', function () {
  219 + closeMobleSetClean();
  220 + });
  221 + // 当模态框对用户可见时触发(将等待 CSS 过渡效果完成)。
  222 + $('#add_station_mobal').on('show.bs.modal', function () {
  223 + // 获取站点编码元素,添加站点编码值
  224 + ajaxd.getStationCode(function(stationCode) {
  225 + // 线路ID.
  226 + $('#lineIdInput').val(Line.id);
  227 + // 获取站点名称元素设值.
  228 + $('#zdmcInput').val(Station.stationNamebootbox);
  229 + // 获取站点路由名称元素设值.
  230 + $('#stationNameInput').val(Station.stationNamebootbox);
  231 + // 站点编码.
  232 + $('#stationCodInput').val(stationCode).attr('Readonly','Readonly');
  233 + // 获取方向元素,并添加值.
  234 + $('#stationdirSelect').val(Station.dir).attr('Readonly','Readonly');
  235 + // 百度地图经纬度坐标中心点.
  236 + $('#bJwpointsInput').val(Station.bJwpoints).attr('Readonly','Readonly');
  237 + // 百度坐标点图形集合.
  238 + $('#bPolygonGridInput').val(Station.bPolygonGrid);
  239 + // 获取图形类型元素,并添加值
  240 + if(Station.shapesType=='r')
  241 + $('#shapesTypeSelect').val('圆形');
  242 + else if(Station.shapesType=='d') {
  243 + $('#radiusGroup').hide();
  244 + $('#shapesTypeSelect').val('多边形');
  245 + }
  246 + // 获取圆形半径元素,并添加值
  247 + $('#radiusInput').val(Station.radius);
  248 + // 是否撤销
  249 + $('#destroySelect').val(0);
  250 + // 版本号
  251 +
  252 + $('#versionsInput').val($("#versions").val());
  253 +
  254 + var initzdlyP = {'line.id_eq':Line.id,'destroy_eq':0,'directions_eq':Station.dir,"versions_eq":$("#versions").val()};
  255 + initSelect(initzdlyP);
  256 + });
  257 + });
  258 + // 站点序号值改变事件
  259 + $('#stationrouteSelect').on('change',function() {
  260 + var stationRValue = $('#stationrouteSelect').val();
  261 + if(stationRValue=='请选择...') {
  262 + $('#stationMarkSelect').val('B');
  263 + }else {
  264 + var tempStr = stationRValue.split('_');
  265 + if(tempStr[1] == 'E') {
  266 + $('#stationMarkSelect').val('E');
  267 + }else {
  268 + $('#stationMarkSelect').val('Z');
  269 + }
  270 + }
  271 + });
  272 + // 获取表单元素
  273 + var form = $('#add_station_form');
  274 + // 获取错误提示信息元素
  275 + var error = $('.alert-danger', form);
  276 + //提交
  277 + $('#addStationButton').on('click', function() {
  278 + // 表单提交
  279 + form.submit();
  280 + });
  281 + // 表单验证
  282 + form.validate({
  283 + errorElement : 'span',
  284 + errorClass : 'help-block help-block-error',
  285 + focusInvalid : true,
  286 + rules : {
  287 + 'stationName' : {required : true,maxlength : 50,},// 站点名称 必填项
  288 + 'stationCod': {required : true,},// 站点编码 必填项 必须输入合法的数字(负数,小数)。
  289 + 'directions' : {required : true,dirIs : true},// 站点方向 必填项 必填项
  290 + 'stationRouteCode' : {isStart : true},// 站点序号
  291 + 'stationMark' : {required : true,},// 站点类型 必填项.
  292 + 'bJwpoints' : {required : true,},// 经纬度坐标点 必填项.
  293 + 'shapesType' : {required : true,},// 几何图形类型 必填项.
  294 + 'radius' : {required : true,},// 几何图形类型 必填项.
  295 + 'destroy' : {required : true,},// 是否撤销 必填项.
  296 + 'toTime' : {number : true},// 到站时间 必须输入合法的数字(负数,小数)。
  297 + 'distances' : {number : true},// 到站距离 必须输入合法的数字(负数,小数)。
  298 + 'descriptions' : {maxlength: 150}// 描述与说明 // 描述与说明
  299 +
  300 + },
  301 + invalidHandler : function(event, validator) {
  302 + error.show();
  303 + App.scrollTo(error, -200);
  304 + },
  305 + highlight : function(element) {
  306 + $(element).closest('.form-group').addClass('has-error');
  307 + },
  308 + unhighlight : function(element) {
  309 + $(element).closest('.form-group').removeClass('has-error');
  310 + },
  311 + success : function(label) {
  312 + label.closest('.form-group').removeClass('has-error');
  313 + },
  314 + submitHandler : function(f) {
  315 + var params = form.serializeJSON();
  316 + error.hide();
  317 + if(params.shapesType=='圆形')
  318 + params.shapesType='r';
  319 + else if(params.shapesType=='多边形')
  320 + params.shapesType='d';
  321 + if(params.stationRouteCode=='请选择...')
  322 + params.stationRouteCode='';
  323 +
  324 + params.status = $($("#versions").find("option:selected")[0]).attr("status");
  325 + // 保存
  326 + ajaxd.stationSave(params,function(data) {
  327 + if(data.status=='SUCCESS') {
  328 + // 弹出添加成功提示消息
  329 + layer.msg('添加成功...');
  330 + }else {
  331 + // 弹出添加失败提示消息
  332 + layer.msg('添加失败...');
  333 + }
  334 + var id =Line.id;
  335 + var dir = params.directions
  336 + // 刷行左边树
  337 + fun.resjtreeDate(id,dir,$("#versions").val());
  338 + closeMobleSetClean();
  339 + // 隐藏moble
  340 + hideMoble();
  341 + });
  342 + }
  343 + });
  344 + function initSelect(p){
  345 + ajaxd.getzdlyInfo(p,function(array) {
  346 + // 定义路段路由长度、渲染拼音检索下拉框格式数据.
  347 + var len_ = array.length,paramsD = new Array();
  348 + if(len_>0) {
  349 + paramsD.push({'id':'请选择...','text':'请选择...'});
  350 + // 遍历.
  351 + $.each(array, function(i, g){
  352 + // 判断.
  353 + if(g.name!='' || g.name != null) {
  354 + // 添加拼音检索下拉框格式数据数组.
  355 + paramsD.push({'id':g.stationRouteCode + '_' + g.stationMark + '_' + g.directions,
  356 + 'text':g.stationName + ' (' + g.stationRouteCode + ')' + ' --' + fun.dirdmToName(g.directions)});
  357 + }
  358 + });
  359 + $('#stationrouteSelect').empty();
  360 + // 初始化上一个路段拼音检索下拉框.
  361 + initPinYinSelect2($('#stationrouteSelect'),paramsD,function(selector) {
  362 + });
  363 + }
  364 + });
  365 + }
  366 + function closeMobleSetClean() {
  367 + // 清除地图覆盖物
  368 + addMap.clearMarkAndOverlays();
  369 + /** 设置新增站点集合对象为空 */
  370 + staobj.setAddStation({});
  371 + var add_direction_v = $('#stationdirSelect').val();
  372 + var version = $("#versions").val();
  373 + fun.resjtreeDate(Line.id,add_direction_v,version);
  374 + //ajaxd.getSectionRouteInfo(Line.id,add_direction_v,version,function(data) {
  375 + // fun.linePanlThree(Line.id,data,add_direction_v,version);
  376 + //});
  377 + fun.editMapStatusRemove();
  378 + }
  379 + function hideMoble() {
  380 + // 隐藏mobal
  381 + $('#add_station_mobal').modal('hide');
  382 + }
  383 + // 当站点类型为中途站或者终点站时,上一站点为必填项!
  384 + $.validator.addMethod("isStart", function(value,element) {
  385 + var tel = false;
  386 + var stationMarkV = $('#stationMarkSelect').val();
  387 + var stationrouteSelectV = $('#stationrouteSelect').val();
  388 + if(stationMarkV =='B'){
  389 + tel = true;
  390 + return tel;
  391 + }else if(stationMarkV =='Z' || stationMarkV =='E'){
  392 + if(stationrouteSelectV!='' && stationrouteSelectV!='请选择...' && stationrouteSelectV!=null){
  393 + tel = true;
  394 + return tel;
  395 + }
  396 + }
  397 + return tel;
  398 + }, '当站点类型为中途站或者终点站时,上一站点为必填项!');
  399 + // 方向
  400 + $.validator.addMethod("dirIs", function(value,element) {
  401 + var tel = true;
  402 + var stationMarkV = $('#stationdirSelect').val();
  403 + if(stationMarkV!=Station.dir){
  404 + tel = false;
  405 + }
  406 + return tel;
  407 + }, '方向必须一致!');
  408 +});
409 </script> 409 </script>
410 \ No newline at end of file 410 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/addstationstemplate.html
1 -<!-- 手动添加站点 -->  
2 -<div class="modal fade" id="add_station_template_mobal" tabindex="-1" role="basic" aria-hidden="true">  
3 -  
4 - <div class="modal-dialog">  
5 -  
6 - <div class="modal-content">  
7 -  
8 - <div class="modal-header">  
9 - <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>  
10 - <h4 class="modal-title">手动添加站点</h4>  
11 - </div>  
12 -  
13 - <div class="modal-body">  
14 -  
15 - <form class="form-horizontal" role="form" id="save_station_template_form" action="/module" method="post">  
16 -  
17 - <div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button>  
18 - 您的输入有误,请检查下面的输入项  
19 - </div>  
20 -  
21 - <!-- 站点名称 -->  
22 - <div class="form-body">  
23 -  
24 - <div class="form-group">  
25 - <label class="control-label col-md-3">  
26 - <span class="required"> * </span> 站点名称:  
27 - </label>  
28 - <div class="col-md-9">  
29 - <textarea class="form-control" rows="12" name="stations" id="stationsInput" placeholder="站点名称"></textarea>  
30 - </div>  
31 - </div>  
32 -  
33 - </div>  
34 -  
35 - <div class="form-group">  
36 - <label class="col-md-3 control-label">坐标系类型:</label>  
37 - <div class="col-md-9">  
38 - <div class="icheck-list">  
39 - <label>  
40 - <input type="radio" class="icheck" name="baseRes" value='No'> 暂无坐标系  
41 - </label>  
42 - <label>  
43 - <input type="radio" class="icheck" name="baseRes" value='GCJ02' > 火星坐标系  
44 - </label>  
45 - <label >  
46 - <input type="radio" class="icheck" name="baseRes" value='BD09'> 百度坐标系  
47 - </label>  
48 - <label >  
49 - <input type="radio" class="icheck" name="baseRes" value='WGS84' checked> WGS84坐标系  
50 - </label>  
51 - </div>  
52 - </div>  
53 - </div>  
54 - <!-- 版本号 -->  
55 - <div class="form-body">  
56 - <div class="form-group">  
57 - <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>  
58 - <div class="col-md-6">  
59 - <input type="text" class="form-control" name="versions" id='versionsInput' Readonly>  
60 - </div>  
61 - </div>  
62 - </div>  
63 - <div class="form-group">  
64 - <div class="alert alert-info font-blue-chambray" style="background-color: #2C3E50">  
65 - <h5 class="block"><span class="help-block" style="color:#1bbc9b;"> * 手动添加站点规划说明: </span></h5>  
66 - <p>  
67 - <span class="help-block" style="color:#1bbc9b;">  
68 - &nbsp;请在文本域中按站点顺序依次输入站点名称(如果已有站点GPS坐标(坐标点也用【Tab】键隔开),请将坐标跟在站点名称后面用【Tab】键隔开),每输入完一个站名时请按回车键【Enter】换行.  
69 - 例如:<br><br>  
70 - 浦东大道金桥路 121.496612 31.238960<br>  
71 - 浦东大道居家桥路 121.496618 31.238957<br>  
72 - 浦东大道德平路 121.496622 31.238948<br>  
73 - </span>  
74 - </p>  
75 - </div>  
76 - </div>  
77 - </form>  
78 - </div>  
79 - <div class="modal-footer">  
80 - <button type="button" class="btn default" data-dismiss="modal" id="addMobalHiden">取消</button>  
81 - <button type="button" class="btn btn-primary" id="templateSaveData">提交数据</button>  
82 - </div>  
83 - </div>  
84 - </div>  
85 -</div>  
86 -<script type="text/javascript">  
87 -  
88 -$('#add_station_template_mobal').on('AddStationTempMobal.show', function(e,map,ajaxd,dir,line,fun){  
89 -  
90 -  
91 -  
92 - // 延迟加载显示mobal  
93 - setTimeout(function(){$('#add_station_template_mobal').modal({show : true,backdrop: 'static', keyboard: false});},200);  
94 -  
95 - // 获取表单元素  
96 - var form = $('#save_station_template_form');  
97 -  
98 - $('#versionsInput').val($("#versions").val());  
99 -  
100 - // 获取错误提示信息元素  
101 - var error = $('.alert-danger', form);  
102 -  
103 - // 提交数据点击事件  
104 - $('.modal-footer #templateSaveData').on('click',function() {  
105 -  
106 - // 表单提交  
107 - form.submit();  
108 -  
109 - });  
110 -  
111 - // 表单验证  
112 - form.validate({  
113 -  
114 - errorElement : 'span',  
115 -  
116 - errorClass : 'help-block help-block-error',  
117 -  
118 - focusInvalid : false,  
119 -  
120 - rules : {  
121 -  
122 - 'stations' : {  
123 -  
124 - required : true,  
125 -  
126 - }  
127 -  
128 - },  
129 -  
130 - invalidHandler : function(event, validator) {  
131 -  
132 - error.show();  
133 -  
134 - App.scrollTo(error, -200);  
135 -  
136 - },  
137 -  
138 - highlight : function(element) {  
139 -  
140 - $(element).closest('.form-group').addClass('has-error');  
141 -  
142 - },  
143 -  
144 - unhighlight : function(element) {  
145 -  
146 - $(element).closest('.form-group').removeClass('has-error');  
147 -  
148 - },  
149 -  
150 - success : function(label) {  
151 -  
152 - label.closest('.form-group').removeClass('has-error');  
153 -  
154 - },  
155 -  
156 - submitHandler : function(f) {  
157 - // 隐藏手动规划弹出层  
158 - $('#add_station_template_mobal').modal('hide');  
159 - var directionData = dir;  
160 - // 定义线路名称  
161 - var lineNameV = $('.portlet-title .caption').text();  
162 - var dirStr = '';  
163 - // 上行  
164 - if(directionData==0){  
165 - dirStr = '上行路段';  
166 - // 隐藏上行规划  
167 - $('#upToolsMobal').hide();  
168 - // 下行  
169 - }else if(directionData==1){  
170 - dirStr = '下行路段';  
171 - // 隐藏上行规划  
172 - $('#downToolsMobal').hide();  
173 - }  
174 - // 弹出正在加载层  
175 - var i = layer.load(0,{offset:['200px', '280px']});  
176 - // 表单序列化  
177 - var paramsForm = form.serializeJSON();  
178 - var baseResValue = paramsForm.baseRes;  
179 - // 站点名称字符串切割  
180 - var array = paramsForm.stations.split('\r\n');  
181 - var arrayFormat = inputStationValueFormat(array);  
182 - // 根据站点名称获取百度坐标  
183 - map.stationsNameToPoints(arrayFormat,function(resultJson) {  
184 - // 根据坐标点获取两点之间的时间与距离  
185 - map.getDistanceAndDuration(resultJson,function(stationdataList) {  
186 - // 设置第一个站的距离  
187 - stationdataList[0].distance = '';  
188 - // 设置第一个站的时间  
189 - stationdataList[0].duration = '';  
190 - // 定义站点信息JSON字符串  
191 - var stationJSON = JSON.stringify(stationdataList);  
192 - var addLine = line.getLineObj();  
193 - // 参数集合  
194 - var params = {};  
195 - params.baseRes = baseResValue;  
196 - // 站点信息JSON字符串  
197 - params.stationJSON = stationJSON;  
198 - // 线路ID  
199 - params.lineId = addLine.id;  
200 - // 方向  
201 - params.directions = directionData;  
202 - // 原始坐标类型  
203 - params.dbType = 'b';  
204 - // 圆形半径  
205 - params.radius = '100';  
206 - // 限速  
207 - params.speedLimit = '60';  
208 - // 图形类型(r:圆形;p:多边形)  
209 - params.shapesType = 'r';  
210 - // destroy:是否撤销  
211 - params.destroy = '0';  
212 - // versions:版本号  
213 - params.versions = '1';  
214 - map.lineInfoPanl(lineNameV,directionData,function(BusLine){  
215 - // 如果线路信息不为空  
216 - if(BusLine){  
217 - // 获取公交线几何对象, 仅当结果自动添加到地图上时有效  
218 - var Polygon = BusLine.getPolyline();  
219 - // 返回多边型的点数组(自1.2新增)  
220 - var polyGonArray = Polygon.getPath();  
221 - var jsonArray = [{sectionName:lineNameV+dirStr,points:polyGonArray}];  
222 - // 定义路段信息字符串  
223 - var sectionJSON = JSON.stringify(jsonArray);  
224 - // 路段信息JSON字符串  
225 - // if(sectionJSON != null && sectionJSON != "") {  
226 - params.sectionJSON = sectionJSON;  
227 - addSave(params,addLine.id,directionData);  
228 - /* } else {  
229 - layer.msg('百度地图上没有此线路的相应路段,请更换方式规划!!!');  
230 - } */  
231 - }else {  
232 - // 根据坐标点获取两点之间的折线路段  
233 - map.getSectionListPlonly(stationdataList,function(sectiondata) {  
234 - // 定义路段信息字符串  
235 - var sectionJSON = JSON.stringify(sectiondata);  
236 - // 路段信息JSON字符串  
237 - //if(sectionJSON != null && sectionJSON != "") {  
238 - params.sectionJSON = sectionJSON;  
239 - addSave(params,addLine.id,directionData);  
240 - /* } else {  
241 - layer.msg('无法生成路段,请重试!');  
242 - return;  
243 - } */  
244 - });  
245 - }  
246 - });  
247 -  
248 - });  
249 -  
250 - });  
251 -  
252 - }  
253 -  
254 - });  
255 -  
256 - function inputStationValueFormat(paramsStationsArray) {  
257 - var stationList = [];  
258 - var len = paramsStationsArray.length;  
259 - for(var k =0;k<len;k++) {  
260 - if(paramsStationsArray[k]=="")  
261 - continue;  
262 - var tempStr = paramsStationsArray[k].split('\t');  
263 - if(tempStr.length<2){  
264 - stationList.push({name:paramsStationsArray[k]+"公交车站",wgs:{x:'',y:''}});  
265 - }else {  
266 - stationList.push({name:tempStr[0]+"公交车站",wgs:{x:tempStr[1], y:tempStr[2]}});  
267 - }  
268 - }  
269 - return stationList;  
270 - }  
271 -  
272 - function addSave(params,lineid,directionData) {  
273 -  
274 -  
275 - var version = $("#versions").val();  
276 - params.versions = version;  
277 - // 保存  
278 - ajaxd.manualSave(params,function(rd) {  
279 - // 关闭弹出层  
280 - layer.closeAll();  
281 - if(rd.status='SUCCESS') {  
282 - layer.msg('保存成功!');  
283 - var stationD = rd.stationData,isNullStr = '';  
284 - for(var t = 0 ;t<stationD.length;t++) {  
285 - if(stationD[t].potion.lat =='' || stationD[t].potion.lat ==null ||  
286 - stationD[t].potion.lng =='' || stationD[t].potion.lng ==null)  
287 - isNullStr = isNullStr + stationD[t].name + ' , ';  
288 - }  
289 - if(isNullStr!='') {  
290 - layer.open({  
291 - title: '提示',  
292 - content:'【' + isNullStr + '】' + '地址系统无法解析!,请手动调整位置!'  
293 - });  
294 - }  
295 - }else {  
296 - layer.msg('保存失败!');  
297 - }  
298 - // 清除地图覆盖物  
299 - map.clearMarkAndOverlays();  
300 - // 刷新树  
301 - fun.resjtreeDate(lineid,directionData,version);  
302 -  
303 -  
304 - //PublicFunctions.resjtreeDate(lineid,directionData,version);  
305 - // 查询上行路段信息  
306 - //ajaxd.getSectionRouteInfo(lineid,directionData,version,function(data) {  
307 - // // 在地图上画出线路走向  
308 - // fun.linePanlThree(lineid,data,directionData,version);  
309 - //});  
310 - });  
311 - }  
312 -}); 1 +<!-- 手动添加站点 -->
  2 +<div class="modal fade" id="add_station_template_mobal" tabindex="-1" role="basic" aria-hidden="true">
  3 +
  4 + <div class="modal-dialog">
  5 +
  6 + <div class="modal-content">
  7 +
  8 + <div class="modal-header">
  9 + <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
  10 + <h4 class="modal-title">手动添加站点</h4>
  11 + </div>
  12 +
  13 + <div class="modal-body">
  14 +
  15 + <form class="form-horizontal" role="form" id="save_station_template_form" action="/module" method="post">
  16 +
  17 + <div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button>
  18 + 您的输入有误,请检查下面的输入项
  19 + </div>
  20 +
  21 + <!-- 站点名称 -->
  22 + <div class="form-body">
  23 +
  24 + <div class="form-group">
  25 + <label class="control-label col-md-3">
  26 + <span class="required"> * </span> 站点名称:
  27 + </label>
  28 + <div class="col-md-9">
  29 + <textarea class="form-control" rows="12" name="stations" id="stationsInput" placeholder="站点名称"></textarea>
  30 + </div>
  31 + </div>
  32 +
  33 + </div>
  34 +
  35 + <div class="form-group">
  36 + <label class="col-md-3 control-label">坐标系类型:</label>
  37 + <div class="col-md-9">
  38 + <div class="icheck-list">
  39 + <label>
  40 + <input type="radio" class="icheck" name="baseRes" value='No'> 暂无坐标系
  41 + </label>
  42 + <label>
  43 + <input type="radio" class="icheck" name="baseRes" value='GCJ02' > 火星坐标系
  44 + </label>
  45 + <label >
  46 + <input type="radio" class="icheck" name="baseRes" value='BD09'> 百度坐标系
  47 + </label>
  48 + <label >
  49 + <input type="radio" class="icheck" name="baseRes" value='WGS84' checked> WGS84坐标系
  50 + </label>
  51 + </div>
  52 + </div>
  53 + </div>
  54 + <!-- 版本号 -->
  55 + <div class="form-body">
  56 + <div class="form-group">
  57 + <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  58 + <div class="col-md-6">
  59 + <input type="text" class="form-control" name="versions" id='versionsInput' Readonly>
  60 + </div>
  61 + </div>
  62 + </div>
  63 + <div class="form-group">
  64 + <div class="alert alert-info font-blue-chambray" style="background-color: #2C3E50">
  65 + <h5 class="block"><span class="help-block" style="color:#1bbc9b;"> * 手动添加站点规划说明: </span></h5>
  66 + <p>
  67 + <span class="help-block" style="color:#1bbc9b;">
  68 + &nbsp;请在文本域中按站点顺序依次输入站点名称(如果已有站点GPS坐标(坐标点也用【Tab】键隔开),请将坐标跟在站点名称后面用【Tab】键隔开),每输入完一个站名时请按回车键【Enter】换行.
  69 + 例如:<br><br>
  70 + 浦东大道金桥路 121.496612 31.238960<br>
  71 + 浦东大道居家桥路 121.496618 31.238957<br>
  72 + 浦东大道德平路 121.496622 31.238948<br>
  73 + </span>
  74 + </p>
  75 + </div>
  76 + </div>
  77 + </form>
  78 + </div>
  79 + <div class="modal-footer">
  80 + <button type="button" class="btn default" data-dismiss="modal" id="addMobalHiden">取消</button>
  81 + <button type="button" class="btn btn-primary" id="templateSaveData">提交数据</button>
  82 + </div>
  83 + </div>
  84 + </div>
  85 +</div>
  86 +<script type="text/javascript">
  87 +
  88 +$('#add_station_template_mobal').on('AddStationTempMobal.show', function(e,map,ajaxd,dir,line,fun){
  89 +
  90 +
  91 +
  92 + // 延迟加载显示mobal
  93 + setTimeout(function(){$('#add_station_template_mobal').modal({show : true,backdrop: 'static', keyboard: false});},200);
  94 +
  95 + // 获取表单元素
  96 + var form = $('#save_station_template_form');
  97 +
  98 + $('#versionsInput').val($("#versions").val());
  99 +
  100 + // 获取错误提示信息元素
  101 + var error = $('.alert-danger', form);
  102 +
  103 + // 提交数据点击事件
  104 + $('.modal-footer #templateSaveData').on('click',function() {
  105 +
  106 + // 表单提交
  107 + form.submit();
  108 +
  109 + });
  110 +
  111 + // 表单验证
  112 + form.validate({
  113 +
  114 + errorElement : 'span',
  115 +
  116 + errorClass : 'help-block help-block-error',
  117 +
  118 + focusInvalid : false,
  119 +
  120 + rules : {
  121 +
  122 + 'stations' : {
  123 +
  124 + required : true,
  125 +
  126 + }
  127 +
  128 + },
  129 +
  130 + invalidHandler : function(event, validator) {
  131 +
  132 + error.show();
  133 +
  134 + App.scrollTo(error, -200);
  135 +
  136 + },
  137 +
  138 + highlight : function(element) {
  139 +
  140 + $(element).closest('.form-group').addClass('has-error');
  141 +
  142 + },
  143 +
  144 + unhighlight : function(element) {
  145 +
  146 + $(element).closest('.form-group').removeClass('has-error');
  147 +
  148 + },
  149 +
  150 + success : function(label) {
  151 +
  152 + label.closest('.form-group').removeClass('has-error');
  153 +
  154 + },
  155 +
  156 + submitHandler : function(f) {
  157 + // 隐藏手动规划弹出层
  158 + $('#add_station_template_mobal').modal('hide');
  159 + var directionData = dir;
  160 + // 定义线路名称
  161 + var lineNameV = $('.portlet-title .caption').text();
  162 + var dirStr = '';
  163 + // 上行
  164 + if(directionData==0){
  165 + dirStr = '上行路段';
  166 + // 隐藏上行规划
  167 + $('#upToolsMobal').hide();
  168 + // 下行
  169 + }else if(directionData==1){
  170 + dirStr = '下行路段';
  171 + // 隐藏上行规划
  172 + $('#downToolsMobal').hide();
  173 + }
  174 + // 弹出正在加载层
  175 + var i = layer.load(0,{offset:['200px', '280px']});
  176 + // 表单序列化
  177 + var paramsForm = form.serializeJSON();
  178 + var baseResValue = paramsForm.baseRes;
  179 + // 站点名称字符串切割
  180 + var array = paramsForm.stations.split('\r\n');
  181 + var arrayFormat = inputStationValueFormat(array);
  182 + // 根据站点名称获取百度坐标
  183 + map.stationsNameToPoints(arrayFormat,function(resultJson) {
  184 + // 根据坐标点获取两点之间的时间与距离
  185 + map.getDistanceAndDuration(resultJson,function(stationdataList) {
  186 + // 设置第一个站的距离
  187 + stationdataList[0].distance = '';
  188 + // 设置第一个站的时间
  189 + stationdataList[0].duration = '';
  190 + // 定义站点信息JSON字符串
  191 + var stationJSON = JSON.stringify(stationdataList);
  192 + var addLine = line.getLineObj();
  193 + // 参数集合
  194 + var params = {};
  195 + params.baseRes = baseResValue;
  196 + // 站点信息JSON字符串
  197 + params.stationJSON = stationJSON;
  198 + // 线路ID
  199 + params.lineId = addLine.id;
  200 + // 方向
  201 + params.directions = directionData;
  202 + // 原始坐标类型
  203 + params.dbType = 'b';
  204 + // 圆形半径
  205 + params.radius = '100';
  206 + // 限速
  207 + params.speedLimit = '60';
  208 + // 图形类型(r:圆形;p:多边形)
  209 + params.shapesType = 'r';
  210 + // destroy:是否撤销
  211 + params.destroy = '0';
  212 + // versions:版本号
  213 + params.versions = '1';
  214 + map.lineInfoPanl(lineNameV,directionData,function(BusLine){
  215 + // 如果线路信息不为空
  216 + if(BusLine && BusLine.getPolyline().length > 0){
  217 + // 获取公交线几何对象, 仅当结果自动添加到地图上时有效
  218 + var Polygon = BusLine.getPolyline();
  219 + // 返回多边型的点数组(自1.2新增)
  220 + var polyGonArray = Polygon.getPath();
  221 + var jsonArray = [{sectionName:lineNameV+dirStr,points:polyGonArray}];
  222 + // 定义路段信息字符串
  223 + var sectionJSON = JSON.stringify(jsonArray);
  224 + // 路段信息JSON字符串
  225 + // if(sectionJSON != null && sectionJSON != "") {
  226 + params.sectionJSON = sectionJSON;
  227 + addSave(params,addLine.id,directionData);
  228 + /* } else {
  229 + layer.msg('百度地图上没有此线路的相应路段,请更换方式规划!!!');
  230 + } */
  231 + }else {
  232 + // 根据坐标点获取两点之间的折线路段
  233 + map.getSectionListPlonly(stationdataList,function(sectiondata) {
  234 + // 定义路段信息字符串
  235 + var sectionJSON = JSON.stringify(sectiondata);
  236 + // 路段信息JSON字符串
  237 + //if(sectionJSON != null && sectionJSON != "") {
  238 + params.sectionJSON = sectionJSON;
  239 + addSave(params,addLine.id,directionData);
  240 + /* } else {
  241 + layer.msg('无法生成路段,请重试!');
  242 + return;
  243 + } */
  244 + });
  245 + }
  246 + });
  247 +
  248 + });
  249 +
  250 + });
  251 +
  252 + }
  253 +
  254 + });
  255 +
  256 + function inputStationValueFormat(paramsStationsArray) {
  257 + var stationList = [];
  258 + var len = paramsStationsArray.length;
  259 + for(var k =0;k<len;k++) {
  260 + if(paramsStationsArray[k]=="")
  261 + continue;
  262 + var tempStr = paramsStationsArray[k].split('\t');
  263 + if(tempStr.length<2){
  264 + stationList.push({name:paramsStationsArray[k]+"公交车站",wgs:{x:'',y:''}});
  265 + }else {
  266 + stationList.push({name:tempStr[0]+"公交车站",wgs:{x:tempStr[1], y:tempStr[2]}});
  267 + }
  268 + }
  269 + return stationList;
  270 + }
  271 +
  272 + function addSave(params,lineid,directionData) {
  273 +
  274 +
  275 + var version = $("#versions").val();
  276 + params.versions = version;
  277 + // 保存
  278 + ajaxd.manualSave(params,function(rd) {
  279 + // 关闭弹出层
  280 + layer.closeAll();
  281 + if(rd.status='SUCCESS') {
  282 + layer.msg('保存成功!');
  283 + var stationD = rd.stationData,isNullStr = '';
  284 + for(var t = 0 ;t<stationD.length;t++) {
  285 + if(stationD[t].potion.lat =='' || stationD[t].potion.lat ==null ||
  286 + stationD[t].potion.lng =='' || stationD[t].potion.lng ==null)
  287 + isNullStr = isNullStr + stationD[t].name + ' , ';
  288 + }
  289 + if(isNullStr!='') {
  290 + layer.open({
  291 + title: '提示',
  292 + content:'【' + isNullStr + '】' + '地址系统无法解析!,请手动调整位置!'
  293 + });
  294 + }
  295 + }else {
  296 + layer.msg('保存失败!');
  297 + }
  298 + // 清除地图覆盖物
  299 + map.clearMarkAndOverlays();
  300 + // 刷新树
  301 + fun.resjtreeDate(lineid,directionData,version);
  302 +
  303 +
  304 + //PublicFunctions.resjtreeDate(lineid,directionData,version);
  305 + // 查询上行路段信息
  306 + //ajaxd.getSectionRouteInfo(lineid,directionData,version,function(data) {
  307 + // // 在地图上画出线路走向
  308 + // fun.linePanlThree(lineid,data,directionData,version);
  309 + //});
  310 + });
  311 + }
  312 +});
313 </script> 313 </script>
314 \ No newline at end of file 314 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/js/stationroute-list-function.js
1 -/**  
2 - * 函数  
3 - *  
4 - * - - - - - - - 》 getCurrSelNode : 获取选中树节点数据函数  
5 - *  
6 - * - - - - - - - 》 resjtreeDate : 刷新树函数函数  
7 - *  
8 - * - - - - - - - 》 setFormInputValue : 新增站点参数集合赋值函数  
9 - *  
10 - * - - - - - - - 》 editSetStationParmas : 编辑站点参数集合赋值函数  
11 - *  
12 - * - - - - - - - 》 editSeteditStationParmasValue:编辑站点范围图形参数集合赋值函数  
13 - *  
14 - * - - - - - - - 》 lineNameIsHaveInterval : 系统规划时修正线路名称  
15 - *  
16 - * - - - - - - - 》 systemLineStation:系统规划保存函数  
17 - *  
18 - * - - - - - - - 》 stationRevoke :撤销站点  
19 - *  
20 - * - - - - - - - 》 editLinePlan :编辑线路走向  
21 - *  
22 - * - - - - - - - 》 setFormValue :编辑站点设置表单元素值  
23 - *  
24 - * - - - - - - - 》 eachSectionList:路段折线百度坐标转WGS坐标  
25 - */  
26 -  
27 -var PublicFunctions = function () {  
28 - var PubFun = {  
29 - /** 初始化线路标题与ID */  
30 - setTiteText : function(lineId) {  
31 - // 根据线路ID获取线路名称  
32 - GetAjaxData.getIdLineName(lineId,function(data) {  
33 - // 定义线路名称  
34 - var lineNameV = data.name;  
35 - $('.portlet-title .caption').text(lineNameV);  
36 - });  
37 - },  
38 - /** @param direction 方向 @return array */  
39 - getCurrSelNode : function(direction){  
40 - // 定义Obj  
41 - var array = [];  
42 - try {  
43 - // 上行  
44 - if(direction=='0'){  
45 - // 获取上行选中节点  
46 - array = $.jstree.reference("#station_Up_tree").get_selected(true);  
47 - // 下行  
48 - }else if(direction=='1'){  
49 - // 获取下行选中节点  
50 - array = $.jstree.reference("#station_Down_tree").get_selected(true);  
51 - }  
52 - } catch (e) {  
53 - console.log(e);  
54 - }  
55 - // 返回Obj  
56 - return array;  
57 - },  
58 - /** @param id:线路ID ;directionData:方向 */  
59 - resjtreeDate : function(id,directionData,version){  
60 -  
61 - if(!version){  
62 - version = $("#versions").val();  
63 - }  
64 -  
65 - // 获取树数据  
66 - GetAjaxData.getStation(id,directionData,version,function(treeDateJson) {  
67 - // 获取数据长度  
68 - var len = treeDateJson[0].children[0].children.length;  
69 - // 上行  
70 - if(directionData==0){  
71 - // 长度大于零  
72 - if(len>0) {  
73 - // 隐藏上行规划  
74 - $('#upToolsMobal').hide();  
75 - // 显示树  
76 - $('#uptreeMobal').show();  
77 - // 刷新树  
78 - StationTreeData.upreloadeTree(treeDateJson);  
79 - }else {  
80 - if ($($("#versions").find("option:selected")[0]).attr("status") > 0) {  
81 - // 显示上行规划  
82 - $('#upToolsMobal').show();  
83 - }else{  
84 - $('#upToolsMobal').hide();  
85 -  
86 - }  
87 - // 隐藏上行树  
88 - $('#uptreeMobal').hide();  
89 - }  
90 -  
91 - // 下行  
92 - }else if(directionData==1){  
93 - // 如果长度大于  
94 - if(len>0) {  
95 - // 隐藏下行规划  
96 - $('#downToolsMobal').hide();  
97 - // 显示下行树  
98 - $('#DowntreeMobal').show();  
99 - // 跟新树  
100 - StationTreeData.dwonreloadeTree(treeDateJson);  
101 - }else {  
102 - if ($($("#versions").find("option:selected")[0]).attr("status") > 0) {  
103 - // 显示下行规划  
104 - $('#downToolsMobal').show();  
105 - }else{  
106 - $('#downToolsMobal').hide();  
107 - }  
108 - // 隐藏下行树  
109 - $('#DowntreeMobal').hide();  
110 - }  
111 - }  
112 -  
113 - PublicFunctions.linePanlThree(id,treeDateJson,directionData,version,function (polyline_center) {  
114 - var map = WorldsBMap.getmapBValue();  
115 - map.panTo(polyline_center);  
116 - });  
117 - });  
118 - },  
119 -  
120 - /** 修正线路名称 @param:<directionUpValue:方向(0:上行;1:下行)> */  
121 - lineNameIsHaveInterval : function(directionData) {  
122 - // 定义线路名称  
123 - var lineNameV = $('.portlet-title .caption').text();  
124 - // 线路名称是否为区间线路  
125 - if(lineNameV.indexOf('区间')>0){  
126 - // 截去区间  
127 - var lineNameNew = lineNameV.replace('区间','');  
128 - // 是否继续弹出层  
129 - layer.confirm('系统无法生成该线路【'+lineNameV+'】的站点与路段!自动修改为如下线路名称【'+lineNameNew+'】生成', {  
130 - btn : [ '确认提示并提交', '取消' ]  
131 - }, function(index) {  
132 - // 关闭弹出层  
133 - layer.close(index);  
134 - // 线路名称去掉区间  
135 - lineNameV = lineNameNew;  
136 - /** 保存 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行)> */  
137 - PublicFunctions.systemLineStation(lineNameV,directionData);  
138 - },function(){  
139 - // 关闭弹出层  
140 - layer.closeAll();  
141 - // 上行  
142 - if(directionData==0){  
143 - // 显示上行规划  
144 - $('#upToolsMobal').show();  
145 - // 下行  
146 - }else if(directionData==1){  
147 - // 显示下行规划  
148 - $('#downToolsMobal').show();  
149 - }  
150 - });  
151 -  
152 - // 线路名称是否为定班线路  
153 - }else if(lineNameV.indexOf('定班')>0){  
154 - // 截去定班  
155 - var lineNameNew = lineNameV.replace('定班','');  
156 - // 是否继续弹出层  
157 - layer.confirm('系统无法生成该线路【'+lineNameV+'】的站点与路段!自动修改为如下线路名称【'+lineNameNew+'】生成', {  
158 - btn : [ '确认提示并提交', '取消' ]  
159 - }, function(index) {  
160 - // 关闭弹出层  
161 - layer.close(index);  
162 - // 线路名称去掉区间  
163 - lineNameV = lineNameNew;  
164 - /** 保存 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行)> */  
165 - PublicFunctions.systemLineStation(lineNameV,directionData);  
166 - },function(){  
167 - // 关闭弹出层  
168 - layer.closeAll();  
169 - // 上行  
170 - if(directionData==0){  
171 - // 显示上行规划  
172 - $('#upToolsMobal').show();  
173 - // 下行  
174 - }else if(directionData==1){  
175 - // 显示下行规划  
176 - $('#downToolsMobal').show();  
177 - }  
178 - });  
179 - }else {  
180 - /** 直接保存 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行)> */  
181 - PublicFunctions.systemLineStation(lineNameV,directionData);  
182 - }  
183 -  
184 - },  
185 -  
186 - /** 直接保存 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行)> */  
187 - systemLineStation : function(lineNameV,directionData) {  
188 - /** 从百度地图获取线路信息 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行);callback>*/  
189 - WorldsBMap.lineInfoPanl(lineNameV,directionData,function(BusLine){  
190 - // 如果线路信息不为空  
191 - if(BusLine) {  
192 - // 获取公交线几何对象, 仅当结果自动添加到地图上时有效  
193 - var Polygon = BusLine.getPolyline();  
194 - // 返回多边型的点数组(自1.2新增)  
195 - var polyGonArray = Polygon.getPath();  
196 - // 获取公交站点个数(自 1.2 新增)  
197 - var stationNumber = BusLine.getNumBusStations();  
198 - // 定义线路信息集合  
199 - var stationInfo = [];  
200 - // 遍历  
201 - for(var k = 0 ; k < stationNumber; k++) {  
202 - // 定义线路信息集合  
203 - var tempM = {};  
204 - // 添加站点名称  
205 - tempM.name = BusLine.getBusStation(k).name;  
206 - // 添加站点坐标  
207 - tempM.potion = BusLine.getBusStation(k).position;  
208 - tempM.wgs = {x:'',y:''};  
209 - // 添加  
210 - stationInfo.push(tempM);  
211 - }  
212 - // 获取站点之间的距离与时间  
213 - WorldsBMap.getDistanceAndDuration(stationInfo,function(json) {  
214 - // 设置第一个站的距离  
215 - json[0].distance = '';  
216 - // 设置第一个站的时间  
217 - json[0].duration = '';  
218 - // 定义站点信息JSON字符串  
219 - var stationJSON = JSON.stringify(json);  
220 - // 定义路段信息字符串  
221 - var sectionJSON = JSON.stringify(polyGonArray);  
222 - // 参数集合  
223 - var params = {};  
224 - // 站点信息JSON字符串  
225 - params.stationJSON = stationJSON;  
226 - var addLine = LineObj.getLineObj();  
227 - // 线路ID  
228 - params.lineId = addLine.id;  
229 - // 方向  
230 - params.directions = directionData;  
231 - // 原始坐标类型  
232 - params.dbType = 'b';  
233 - // 圆形半径  
234 - params.radius = '100';  
235 - // 图形类型(r:圆形;p:多边形)  
236 - params.shapesType = 'r';  
237 - // destroy:是否撤销  
238 - params.destroy = '0';  
239 -  
240 - // 路段信息JSON字符串  
241 - params.sectionJSON = sectionJSON;  
242 - // 限速  
243 - params.speedLimit = '60';  
244 - params.baseRes = 'No';  
245 - // 获取版本号后提交添加  
246 - $.get('/lineVersions/findByLineId',{'lineId':addLine.id},function(lineVersions){  
247 - $.each(lineVersions,function(){  
248 - if (this.status == 1) {  
249 - // versions:版本号  
250 - params.versions = this.versions;  
251 - // 保存  
252 - GetAjaxData.collectionSave(params,function(rd) {  
253 - if(rd.status='SUCCESS') {  
254 - // 关闭弹出层  
255 - layer.closeAll();  
256 - layer.msg('保存成功!');  
257 - }else {  
258 - // 保存失败  
259 - layer.msg('保存失败!');  
260 - }  
261 - // 刷新树  
262 - PublicFunctions.resjtreeDate(addLine.id,directionData,$("#versions").val());  
263 - /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */  
264 -// GetAjaxData.getSectionRouteInfo(addLine.id,directionData,function(data) {  
265 -// /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */  
266 -// PublicFunctions.linePanlThree(addLine.id,data,directionData);  
267 -// });  
268 - });  
269 - }  
270 - })  
271 - });  
272 - });  
273 - // 关闭弹出层  
274 - layer.closeAll();  
275 - // 上行  
276 - if(directionData==0){  
277 - $('#stationDown').removeClass('active');  
278 - $('#stationDown').removeClass('in');  
279 - $('#stationDown').addClass('fade');  
280 - $('#stationUp').addClass('active in');  
281 - $('#downLine').parent().removeClass('active');  
282 - $('#upLine').parent().addClass('active');  
283 - // 下行  
284 - }else if(directionData==1){  
285 - $('#stationUp').removeClass('active');  
286 - $('#stationUp').removeClass('in');  
287 - $('#stationUp').addClass('fade');  
288 - $('#stationDown').addClass('active in');  
289 - $('#upLine').parent().removeClass('active');  
290 - $('#downLine').parent().addClass('active');  
291 - }  
292 - } else {  
293 - layer.msg('百度地图中没有此线路,无法系统规划!');  
294 - setTimeout(function() {  
295 - // 关闭弹出层  
296 - layer.closeAll();  
297 - // 上行  
298 - if(directionData==0){  
299 - // 显示上行规划  
300 - $('#upToolsMobal').show();  
301 - // 下行  
302 - }else if(directionData==1){  
303 - // 显示下行规划  
304 - $('#downToolsMobal').show();  
305 - }  
306 - }, 3000);  
307 - }  
308 - });  
309 - },  
310 -  
311 - /** @param directionV_ :方向 */  
312 - stationRevoke : function(directionV_) {  
313 - // 获取树选中节点对象  
314 - var obj = PublicFunctions.getCurrSelNode(directionV_);  
315 - // 是否选中,选中节点是否为站点  
316 - if(obj.length == 0 || obj[0].original.chaildredType !='station'){  
317 - // 弹出提示层  
318 - layer.msg('请先选择要删除的站点!');  
319 - return;  
320 - }  
321 - // 弹出是否撤销提示框  
322 - layer.confirm('你确定要撤销【'+obj[0].text+'】站点吗?', {btn : [ '确定撤销','返回' ],icon: 3, title:'提示' }, function(index){  
323 -  
324 - debugger;  
325 - // 站点路由ID  
326 - var stationRouteId = obj[0].original.stationRouteId;  
327 -  
328 - var Line = LineObj.getLineObj();  
329 -  
330 - clonsole.log(Line);  
331 -  
332 - // 撤销参数集合  
333 - var params = {stationRouteId:stationRouteId,destroy:'1',status:Line.status};  
334 - // 方向  
335 - var stationRouteDirections = obj[0].original.stationRouteDirections;  
336 - // 撤销  
337 - GetAjaxData.stationRouteIsDestroy(params,function(result) {  
338 - // 关闭弹出框  
339 - layer.close(index);  
340 - if(result.status=='SUCCESS'){  
341 - layer.msg('撤销'+(directionV_==0?"上行":"下行")+'站点【'+obj[0].text+'】成功!');  
342 - }else{  
343 - layer.msg('撤销'+(directionV_==0?"上行":"下行")+'站点【'+obj[0].text+'】失败!');  
344 - }  
345 - WorldsBMap.clearMarkAndOverlays();  
346 -  
347 - var ver = $("#versions").val();  
348 -  
349 - // 刷行左边树  
350 - PublicFunctions.resjtreeDate(Line.id,stationRouteDirections,ver);  
351 - /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */  
352 -// GetAjaxData.getSectionRouteInfo(Line.id,stationRouteDirections,ver,function(data) {  
353 -// /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */  
354 -// PublicFunctions.linePanlThree(Line.id,data,stationRouteDirections);  
355 -// });  
356 - });  
357 - });  
358 - },  
359 -  
360 - /** @param direction_ :方向 */  
361 - editLinePlan : function(direction_) {  
362 - var sel = PublicFunctions.getCurrSelNode(direction_);  
363 - if(sel.length==0 || sel[0].original.chaildredType !='section'){  
364 - if(direction_=='0') {  
365 - layer.msg('请先选中要编辑的上行路段!');  
366 - }else if(direction_=='1') {  
367 - layer.msg('请先选中要编辑的下行路段!');  
368 - }  
369 - return;  
370 - }  
371 - $('#downLine').addClass('btn disabled');  
372 - $('.btn-circle').addClass('disabled');  
373 - $('#upLine').addClass('btn disabled');  
374 - var editSectionV = sel[0].original;  
375 - EditSectionObj.setEitdSection(editSectionV);  
376 - // 弹出添加失败提示消息,2秒关闭(如果不配置,默认是3秒)  
377 - var yindex = layer.msg('编辑完线路走向后,请双击线路走向区域保存',{ offset: '126px',shift: 0,time: 10000});  
378 - WorldsBMap.editPolyUpline();  
379 - },  
380 -  
381 - setFormValue : function(editStationParmas) {  
382 - // 站点ID  
383 - $('#stationIdInput').val(editStationParmas.stationId);  
384 - // 站点路由ID  
385 - $('#stationRouteIdInput').val(editStationParmas.stationRouteId);  
386 - // 站点路由线路Id  
387 - $('#stationRouteLineInput').val(editStationParmas.stationRouteLine);  
388 - // 线路编码  
389 - $('#lineCodeInput').val(editStationParmas.stationRouteLIneCode);  
390 - // 行业标准  
391 - $('#industryCodeInput').val(editStationParmas.industryCode);  
392 - // 百度坐标点图形集合  
393 - $('#bPolygonGridInput').val(editStationParmas.stationBPolygonGrid);  
394 - // 获取站点名称元素设值  
395 - $('#zdmcInput').val(editStationParmas.stationStationName);  
396 - // 获取站点路由名称元素设值  
397 - $('#stationNameInput').val(editStationParmas.stationStationName);  
398 - // 获取站点编码元素设值  
399 - $('#stationCodInput').val(editStationParmas.stationCode);  
400 - // 获取站点类型元素设值  
401 - // $('#stationMarkSelect').val(editStationParmas.stationRouteStationMark);  
402 - // 获取站点方向元素设值  
403 - $('#stationdirSelect').val(editStationParmas.stationRoutedirections);  
404 - // 获取站点道路编码元素设值  
405 - $('#roadCodingCodInput').val(editStationParmas.stationRoadCoding);  
406 - // 百度地图经纬度坐标中心点  
407 - $('#bJwpointsInput').val(editStationParmas.stationJwpoints);  
408 - if(editStationParmas.stationShapesType=='r') {  
409 - // 获取图形类型元素,并添加值  
410 - $('#shapesTypeSelect').val('圆形');  
411 - }else if(editStationParmas.stationShapesType=='d'){  
412 - $('#radiusGroup').hide();  
413 - $('#shapesTypeSelect').val('多边形');  
414 - }  
415 - // 获取半径元素,并添加值  
416 - $('#radiusInput').val(editStationParmas.stationRadius);  
417 - // 是否撤销  
418 - $('#destroySelect').val(editStationParmas.stationDestroy);  
419 - // 到站时间  
420 - $('#toTimeInput').val(editStationParmas.stationRouteToTime);  
421 - // 到站距离  
422 - $('#distancesInput').val(editStationParmas.stationRouteDistances);  
423 - // 线路版本号  
424 - $('#versionsInput').val(editStationParmas.stationRouteVersions);  
425 - // 描述/说明  
426 - $('#descriptionsTextarea').val(editStationParmas.sttationDescriptions);  
427 - },  
428 -  
429 - setSectionFormValue : function(Section) {  
430 - $('#isRoadeSpeedInput').val(Section.isRoadeSpeed);  
431 - // 路段ID  
432 - $('#sectionIdInput').val(Section.sectionId);  
433 - // 路段路由ID  
434 - $('#sectionRouteIdInput').val(Section.sectionrouteId);  
435 - // 线路ID  
436 - $('#sectionRouteLineInput').val(Section.sectionrouteLine);  
437 - // 线路编码  
438 - $('#lineCodeInput').val(Section.sectionrouteLineCode);  
439 - // 折线坐标集合  
440 - $('#bsectionVectorInput').val(Section.sectionBsectionVector);  
441 - // 路段名称  
442 - $('#sectionNameInput').val(Section.sectionName);  
443 - // 路段编码  
444 - $('#sectionCodeInput').val(Section.sectionCode);  
445 - // 路段序号  
446 - $('#sectionrouteCodeSelect').val(Section.sectionrouteCode);  
447 - // 路段方向  
448 - $('#directionsSection').val(Section.sectionrouteDirections);  
449 - // 道路编码  
450 - $('#roadCodingCodInput').val(Section.sectionRoadCoding);  
451 - // 道路限速  
452 - $('#speedLimitInput').val(Section.sectionSpeedLimet);  
453 - // 路段长度  
454 - $('#sectionDistanceInput').val(Section.sectionDistance);  
455 - // 时长  
456 - $('#sectionTimeInput').val(Section.sectionTime);  
457 - // 版本号  
458 - $('#versionsInput').val(Section.versions);  
459 - },  
460 -  
461 - /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */  
462 - linePanlThree : function(lineId,data,direction,version,callback) {  
463 - /** 获取站点路由信息 @param:<Line.id:线路Id;0:上行> @return:<resultdata:站点路由数据> */  
464 - var polyline_center;  
465 - GetAjaxData.getStationRoutePoint(lineId,direction,version,function(resultdata) {  
466 - WorldsBMap.clearMarkAndOverlays();  
467 - // 如果站点路由数据不为空  
468 - if(resultdata.length>0) {  
469 -// var ceter_index = Math.round(resultdata.length / 2);  
470 - var ceterPointsStr = resultdata[0].stationJwpoints;  
471 - var ceterPointsArray = ceterPointsStr.split(' ');  
472 - polyline_center = new BMap.Point(ceterPointsArray[0],ceterPointsArray[1]);  
473 - // 遍历站点路由数据  
474 - for(var s = 0 ; s<resultdata.length;s++) {  
475 - WorldsBMap.drawingUpStationPoint(resultdata[s], s+1);  
476 - }  
477 - }  
478 - data = data[0].children[1];  
479 - // 路段数据长度  
480 - var dataLen = data.children.length;  
481 - // 如果大于零  
482 - if(dataLen>0) {  
483 - WorldsBMap.drawingUpline01(data.children);  
484 - // WorldsBMap.drawingUpline01(polyline_center,data);  
485 - }  
486 - callback && callback(polyline_center);  
487 - });  
488 - },  
489 - /** 加载树 @param:<lineId:线路ID;direction:方向(0:上行;1:下行)> */  
490 - TreeUpOrDown : function(lineId,direction,version) {  
491 -  
492 - /** 获取树结果数据 @param:<lineId:线路ID;direction:方向;callback:回调函数> */  
493 - GetAjaxData.getStation(lineId,direction,version,function(treeDateJson) {  
494 - // 获取返回数据长度  
495 - var len = treeDateJson[0].children[0].children.length;  
496 - // 上行  
497 - if(direction == 0) {  
498 - /** 初始化上行树 @param:<treeDateJson:树数据结构> */  
499 - StationTreeData.upInit(treeDateJson);  
500 - if(len>0) {  
501 - $('#upToolsMobal').hide();  
502 - $('#uptreeMobal').show();  
503 - }else {  
504 - $('#upToolsMobal').show();  
505 - $('#uptreeMobal').hide();  
506 - }  
507 -  
508 - PublicFunctions.linePanlThree(lineId,treeDateJson,direction,version,function (polyline_center) {  
509 - var map = WorldsBMap.getmapBValue();  
510 - map.panTo(polyline_center);  
511 - });  
512 -  
513 - // 下行  
514 - }else if(direction ==1) {  
515 - /** 出事画下行树 @param:<treeDateJson:树数据结构> */  
516 - StationTreeData.downInit(treeDateJson);  
517 - if(len>0) {  
518 - $('#downToolsMobal').hide();  
519 - $('#DowntreeMobal').show();  
520 - }else {  
521 - $('#downToolsMobal').show();  
522 - $('#DowntreeMobal').hide();  
523 - }  
524 - }  
525 - });  
526 - },  
527 - isHaveStationName : function(data) {  
528 - if(data.length>0) {  
529 - layer.confirm('系统已存在【'+ data[0].stationName +'】该站点位置名称,请选择【系统引用】或者更改站点名称进行新增!', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){  
530 - layer.close(index);  
531 - });  
532 - return false;  
533 - }else {  
534 - return true;  
535 - }  
536 - },  
537 - // 地图处于编辑状态  
538 - editMapStatus : function (dir) {  
539 - WorldsBMap.setMap_status(1);  
540 - // 有方向就显示退出编辑模式按钮  
541 - if(dir!=null && dir!='null'){  
542 - WorldsBMap.setDir(dir);  
543 - $('#esc_edit_div').show();  
544 - }  
545 - $('.protlet-box-layer').show();  
546 - },  
547 - // 地图处于编辑状态  
548 - editMapStatusRemove : function () {  
549 - WorldsBMap.setMap_status(0);  
550 - $('.protlet-box-layer').hide();  
551 - $('#esc_edit_div').hide();  
552 - // 退出绘画模式  
553 - WorldsBMap.exitDrawStatus();  
554 - },  
555 - // 选项鎖死解除  
556 - editAChangeCssRemoveDisabled : function() {  
557 - $('#downLine').removeClass('btn disabled');  
558 - $('.btn-circle').removeClass('disabled');  
559 - $('#upLine').removeClass('btn disabled');  
560 - },  
561 - // 方向代码转名称.  
562 - dirdmToName : function(value){  
563 - var srStr = '';  
564 - if(value=='0')  
565 - srStr = '上行';  
566 - else if(value=='1')  
567 - srStr = '下行';  
568 - return srStr;  
569 - },  
570 - }  
571 - return PubFun ; 1 +/**
  2 + * 函数
  3 + *
  4 + * - - - - - - - 》 getCurrSelNode : 获取选中树节点数据函数
  5 + *
  6 + * - - - - - - - 》 resjtreeDate : 刷新树函数函数
  7 + *
  8 + * - - - - - - - 》 setFormInputValue : 新增站点参数集合赋值函数
  9 + *
  10 + * - - - - - - - 》 editSetStationParmas : 编辑站点参数集合赋值函数
  11 + *
  12 + * - - - - - - - 》 editSeteditStationParmasValue:编辑站点范围图形参数集合赋值函数
  13 + *
  14 + * - - - - - - - 》 lineNameIsHaveInterval : 系统规划时修正线路名称
  15 + *
  16 + * - - - - - - - 》 systemLineStation:系统规划保存函数
  17 + *
  18 + * - - - - - - - 》 stationRevoke :撤销站点
  19 + *
  20 + * - - - - - - - 》 editLinePlan :编辑线路走向
  21 + *
  22 + * - - - - - - - 》 setFormValue :编辑站点设置表单元素值
  23 + *
  24 + * - - - - - - - 》 eachSectionList:路段折线百度坐标转WGS坐标
  25 + */
  26 +
  27 +var PublicFunctions = function () {
  28 + var PubFun = {
  29 + /** 初始化线路标题与ID */
  30 + setTiteText : function(lineId) {
  31 + // 根据线路ID获取线路名称
  32 + GetAjaxData.getIdLineName(lineId,function(data) {
  33 + // 定义线路名称
  34 + var lineNameV = data.name;
  35 + $('.portlet-title .caption').text(lineNameV);
  36 + });
  37 + },
  38 + /** @param direction 方向 @return array */
  39 + getCurrSelNode : function(direction){
  40 + // 定义Obj
  41 + var array = [];
  42 + try {
  43 + // 上行
  44 + if(direction=='0'){
  45 + // 获取上行选中节点
  46 + array = $.jstree.reference("#station_Up_tree").get_selected(true);
  47 + // 下行
  48 + }else if(direction=='1'){
  49 + // 获取下行选中节点
  50 + array = $.jstree.reference("#station_Down_tree").get_selected(true);
  51 + }
  52 + } catch (e) {
  53 + console.log(e);
  54 + }
  55 + // 返回Obj
  56 + return array;
  57 + },
  58 + /** @param id:线路ID ;directionData:方向 */
  59 + resjtreeDate : function(id,directionData,version){
  60 +
  61 + if(!version){
  62 + version = $("#versions").val();
  63 + }
  64 +
  65 + // 获取树数据
  66 + GetAjaxData.getStation(id,directionData,version,function(treeDateJson) {
  67 + // 获取数据长度
  68 + var len = treeDateJson[0].children[0].children.length;
  69 + // 上行
  70 + if(directionData==0){
  71 + // 长度大于零
  72 + if(len>0) {
  73 + // 隐藏上行规划
  74 + $('#upToolsMobal').hide();
  75 + // 显示树
  76 + $('#uptreeMobal').show();
  77 + // 刷新树
  78 + StationTreeData.upreloadeTree(treeDateJson);
  79 + }else {
  80 + if ($($("#versions").find("option:selected")[0]).attr("status") > 0) {
  81 + // 显示上行规划
  82 + $('#upToolsMobal').show();
  83 + }else{
  84 + $('#upToolsMobal').hide();
  85 +
  86 + }
  87 + // 隐藏上行树
  88 + $('#uptreeMobal').hide();
  89 + }
  90 +
  91 + // 下行
  92 + }else if(directionData==1){
  93 + // 如果长度大于
  94 + if(len>0) {
  95 + // 隐藏下行规划
  96 + $('#downToolsMobal').hide();
  97 + // 显示下行树
  98 + $('#DowntreeMobal').show();
  99 + // 跟新树
  100 + StationTreeData.dwonreloadeTree(treeDateJson);
  101 + }else {
  102 + if ($($("#versions").find("option:selected")[0]).attr("status") > 0) {
  103 + // 显示下行规划
  104 + $('#downToolsMobal').show();
  105 + }else{
  106 + $('#downToolsMobal').hide();
  107 + }
  108 + // 隐藏下行树
  109 + $('#DowntreeMobal').hide();
  110 + }
  111 + }
  112 +
  113 + PublicFunctions.linePanlThree(id,treeDateJson,directionData,version,function (polyline_center) {
  114 + var map = WorldsBMap.getmapBValue();
  115 + map.panTo(polyline_center);
  116 + });
  117 + });
  118 + },
  119 +
  120 + /** 修正线路名称 @param:<directionUpValue:方向(0:上行;1:下行)> */
  121 + lineNameIsHaveInterval : function(directionData) {
  122 + // 定义线路名称
  123 + var lineNameV = $('.portlet-title .caption').text();
  124 + // 线路名称是否为区间线路
  125 + if(lineNameV.indexOf('区间')>0){
  126 + // 截去区间
  127 + var lineNameNew = lineNameV.replace('区间','');
  128 + // 是否继续弹出层
  129 + layer.confirm('系统无法生成该线路【'+lineNameV+'】的站点与路段!自动修改为如下线路名称【'+lineNameNew+'】生成', {
  130 + btn : [ '确认提示并提交', '取消' ]
  131 + }, function(index) {
  132 + // 关闭弹出层
  133 + layer.close(index);
  134 + // 线路名称去掉区间
  135 + lineNameV = lineNameNew;
  136 + /** 保存 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行)> */
  137 + PublicFunctions.systemLineStation(lineNameV,directionData);
  138 + },function(){
  139 + // 关闭弹出层
  140 + layer.closeAll();
  141 + // 上行
  142 + if(directionData==0){
  143 + // 显示上行规划
  144 + $('#upToolsMobal').show();
  145 + // 下行
  146 + }else if(directionData==1){
  147 + // 显示下行规划
  148 + $('#downToolsMobal').show();
  149 + }
  150 + });
  151 +
  152 + // 线路名称是否为定班线路
  153 + }else if(lineNameV.indexOf('定班')>0){
  154 + // 截去定班
  155 + var lineNameNew = lineNameV.replace('定班','');
  156 + // 是否继续弹出层
  157 + layer.confirm('系统无法生成该线路【'+lineNameV+'】的站点与路段!自动修改为如下线路名称【'+lineNameNew+'】生成', {
  158 + btn : [ '确认提示并提交', '取消' ]
  159 + }, function(index) {
  160 + // 关闭弹出层
  161 + layer.close(index);
  162 + // 线路名称去掉区间
  163 + lineNameV = lineNameNew;
  164 + /** 保存 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行)> */
  165 + PublicFunctions.systemLineStation(lineNameV,directionData);
  166 + },function(){
  167 + // 关闭弹出层
  168 + layer.closeAll();
  169 + // 上行
  170 + if(directionData==0){
  171 + // 显示上行规划
  172 + $('#upToolsMobal').show();
  173 + // 下行
  174 + }else if(directionData==1){
  175 + // 显示下行规划
  176 + $('#downToolsMobal').show();
  177 + }
  178 + });
  179 + }else {
  180 + /** 直接保存 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行)> */
  181 + PublicFunctions.systemLineStation(lineNameV,directionData);
  182 + }
  183 +
  184 + },
  185 +
  186 + /** 直接保存 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行)> */
  187 + systemLineStation : function(lineNameV,directionData) {
  188 + /** 从百度地图获取线路信息 @param:<lineNameV:线路名称;directionData:方向(0:上行;1:下行);callback>*/
  189 + WorldsBMap.lineInfoPanl(lineNameV,directionData,function(BusLine){
  190 + // 如果线路信息不为空
  191 + if(BusLine && BusLine.getPolyline().length > 0) {
  192 + // 获取公交线几何对象, 仅当结果自动添加到地图上时有效
  193 + var Polygon = BusLine.getPolyline();
  194 + // 返回多边型的点数组(自1.2新增)
  195 + var polyGonArray = Polygon.getPath();
  196 + // 获取公交站点个数(自 1.2 新增)
  197 + var stationNumber = BusLine.getNumBusStations();
  198 + // 定义线路信息集合
  199 + var stationInfo = [];
  200 + // 遍历
  201 + for(var k = 0 ; k < stationNumber; k++) {
  202 + // 定义线路信息集合
  203 + var tempM = {};
  204 + // 添加站点名称
  205 + tempM.name = BusLine.getBusStation(k).name;
  206 + // 添加站点坐标
  207 + tempM.potion = BusLine.getBusStation(k).position;
  208 + tempM.wgs = {x:'',y:''};
  209 + // 添加
  210 + stationInfo.push(tempM);
  211 + }
  212 + // 获取站点之间的距离与时间
  213 + WorldsBMap.getDistanceAndDuration(stationInfo,function(json) {
  214 + // 设置第一个站的距离
  215 + json[0].distance = '';
  216 + // 设置第一个站的时间
  217 + json[0].duration = '';
  218 + // 定义站点信息JSON字符串
  219 + var stationJSON = JSON.stringify(json);
  220 + // 定义路段信息字符串
  221 + var sectionJSON = JSON.stringify(polyGonArray);
  222 + // 参数集合
  223 + var params = {};
  224 + // 站点信息JSON字符串
  225 + params.stationJSON = stationJSON;
  226 + var addLine = LineObj.getLineObj();
  227 + // 线路ID
  228 + params.lineId = addLine.id;
  229 + // 方向
  230 + params.directions = directionData;
  231 + // 原始坐标类型
  232 + params.dbType = 'b';
  233 + // 圆形半径
  234 + params.radius = '100';
  235 + // 图形类型(r:圆形;p:多边形)
  236 + params.shapesType = 'r';
  237 + // destroy:是否撤销
  238 + params.destroy = '0';
  239 +
  240 + // 路段信息JSON字符串
  241 + params.sectionJSON = sectionJSON;
  242 + // 限速
  243 + params.speedLimit = '60';
  244 + params.baseRes = 'No';
  245 + // 获取版本号后提交添加
  246 + $.get('/lineVersions/findByLineId',{'lineId':addLine.id},function(lineVersions){
  247 + $.each(lineVersions,function(){
  248 + if (this.status == 1) {
  249 + // versions:版本号
  250 + params.versions = this.versions;
  251 + // 保存
  252 + GetAjaxData.collectionSave(params,function(rd) {
  253 + if(rd.status='SUCCESS') {
  254 + // 关闭弹出层
  255 + layer.closeAll();
  256 + layer.msg('保存成功!');
  257 + }else {
  258 + // 保存失败
  259 + layer.msg('保存失败!');
  260 + }
  261 + // 刷新树
  262 + PublicFunctions.resjtreeDate(addLine.id,directionData,$("#versions").val());
  263 + /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */
  264 +// GetAjaxData.getSectionRouteInfo(addLine.id,directionData,function(data) {
  265 +// /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */
  266 +// PublicFunctions.linePanlThree(addLine.id,data,directionData);
  267 +// });
  268 + });
  269 + }
  270 + })
  271 + });
  272 + });
  273 + // 关闭弹出层
  274 + layer.closeAll();
  275 + // 上行
  276 + if(directionData==0){
  277 + $('#stationDown').removeClass('active');
  278 + $('#stationDown').removeClass('in');
  279 + $('#stationDown').addClass('fade');
  280 + $('#stationUp').addClass('active in');
  281 + $('#downLine').parent().removeClass('active');
  282 + $('#upLine').parent().addClass('active');
  283 + // 下行
  284 + }else if(directionData==1){
  285 + $('#stationUp').removeClass('active');
  286 + $('#stationUp').removeClass('in');
  287 + $('#stationUp').addClass('fade');
  288 + $('#stationDown').addClass('active in');
  289 + $('#upLine').parent().removeClass('active');
  290 + $('#downLine').parent().addClass('active');
  291 + }
  292 + } else {
  293 + layer.msg('百度地图中没有此线路,无法系统规划!');
  294 + setTimeout(function() {
  295 + // 关闭弹出层
  296 + layer.closeAll();
  297 + // 上行
  298 + if(directionData==0){
  299 + // 显示上行规划
  300 + $('#upToolsMobal').show();
  301 + // 下行
  302 + }else if(directionData==1){
  303 + // 显示下行规划
  304 + $('#downToolsMobal').show();
  305 + }
  306 + }, 3000);
  307 + }
  308 + });
  309 + },
  310 +
  311 + /** @param directionV_ :方向 */
  312 + stationRevoke : function(directionV_) {
  313 + // 获取树选中节点对象
  314 + var obj = PublicFunctions.getCurrSelNode(directionV_);
  315 + // 是否选中,选中节点是否为站点
  316 + if(obj.length == 0 || obj[0].original.chaildredType !='station'){
  317 + // 弹出提示层
  318 + layer.msg('请先选择要删除的站点!');
  319 + return;
  320 + }
  321 + // 弹出是否撤销提示框
  322 + layer.confirm('你确定要撤销【'+obj[0].text+'】站点吗?', {btn : [ '确定撤销','返回' ],icon: 3, title:'提示' }, function(index){
  323 +
  324 + debugger;
  325 + // 站点路由ID
  326 + var stationRouteId = obj[0].original.stationRouteId;
  327 +
  328 + var Line = LineObj.getLineObj();
  329 +
  330 + clonsole.log(Line);
  331 +
  332 + // 撤销参数集合
  333 + var params = {stationRouteId:stationRouteId,destroy:'1',status:Line.status};
  334 + // 方向
  335 + var stationRouteDirections = obj[0].original.stationRouteDirections;
  336 + // 撤销
  337 + GetAjaxData.stationRouteIsDestroy(params,function(result) {
  338 + // 关闭弹出框
  339 + layer.close(index);
  340 + if(result.status=='SUCCESS'){
  341 + layer.msg('撤销'+(directionV_==0?"上行":"下行")+'站点【'+obj[0].text+'】成功!');
  342 + }else{
  343 + layer.msg('撤销'+(directionV_==0?"上行":"下行")+'站点【'+obj[0].text+'】失败!');
  344 + }
  345 + WorldsBMap.clearMarkAndOverlays();
  346 +
  347 + var ver = $("#versions").val();
  348 +
  349 + // 刷行左边树
  350 + PublicFunctions.resjtreeDate(Line.id,stationRouteDirections,ver);
  351 + /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */
  352 +// GetAjaxData.getSectionRouteInfo(Line.id,stationRouteDirections,ver,function(data) {
  353 +// /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */
  354 +// PublicFunctions.linePanlThree(Line.id,data,stationRouteDirections);
  355 +// });
  356 + });
  357 + });
  358 + },
  359 +
  360 + /** @param direction_ :方向 */
  361 + editLinePlan : function(direction_) {
  362 + var sel = PublicFunctions.getCurrSelNode(direction_);
  363 + if(sel.length==0 || sel[0].original.chaildredType !='section'){
  364 + if(direction_=='0') {
  365 + layer.msg('请先选中要编辑的上行路段!');
  366 + }else if(direction_=='1') {
  367 + layer.msg('请先选中要编辑的下行路段!');
  368 + }
  369 + return;
  370 + }
  371 + $('#downLine').addClass('btn disabled');
  372 + $('.btn-circle').addClass('disabled');
  373 + $('#upLine').addClass('btn disabled');
  374 + var editSectionV = sel[0].original;
  375 + EditSectionObj.setEitdSection(editSectionV);
  376 + // 弹出添加失败提示消息,2秒关闭(如果不配置,默认是3秒)
  377 + var yindex = layer.msg('编辑完线路走向后,请双击线路走向区域保存',{ offset: '126px',shift: 0,time: 10000});
  378 + WorldsBMap.editPolyUpline();
  379 + },
  380 +
  381 + setFormValue : function(editStationParmas) {
  382 + // 站点ID
  383 + $('#stationIdInput').val(editStationParmas.stationId);
  384 + // 站点路由ID
  385 + $('#stationRouteIdInput').val(editStationParmas.stationRouteId);
  386 + // 站点路由线路Id
  387 + $('#stationRouteLineInput').val(editStationParmas.stationRouteLine);
  388 + // 线路编码
  389 + $('#lineCodeInput').val(editStationParmas.stationRouteLIneCode);
  390 + // 行业标准
  391 + $('#industryCodeInput').val(editStationParmas.industryCode);
  392 + // 百度坐标点图形集合
  393 + $('#bPolygonGridInput').val(editStationParmas.stationBPolygonGrid);
  394 + // 获取站点名称元素设值
  395 + $('#zdmcInput').val(editStationParmas.stationStationName);
  396 + // 获取站点路由名称元素设值
  397 + $('#stationNameInput').val(editStationParmas.stationStationName);
  398 + // 获取站点编码元素设值
  399 + $('#stationCodInput').val(editStationParmas.stationCode);
  400 + // 获取站点类型元素设值
  401 + // $('#stationMarkSelect').val(editStationParmas.stationRouteStationMark);
  402 + // 获取站点方向元素设值
  403 + $('#stationdirSelect').val(editStationParmas.stationRoutedirections);
  404 + // 获取站点道路编码元素设值
  405 + $('#roadCodingCodInput').val(editStationParmas.stationRoadCoding);
  406 + // 百度地图经纬度坐标中心点
  407 + $('#bJwpointsInput').val(editStationParmas.stationJwpoints);
  408 + if(editStationParmas.stationShapesType=='r') {
  409 + // 获取图形类型元素,并添加值
  410 + $('#shapesTypeSelect').val('圆形');
  411 + }else if(editStationParmas.stationShapesType=='d'){
  412 + $('#radiusGroup').hide();
  413 + $('#shapesTypeSelect').val('多边形');
  414 + }
  415 + // 获取半径元素,并添加值
  416 + $('#radiusInput').val(editStationParmas.stationRadius);
  417 + // 是否撤销
  418 + $('#destroySelect').val(editStationParmas.stationDestroy);
  419 + // 到站时间
  420 + $('#toTimeInput').val(editStationParmas.stationRouteToTime);
  421 + // 到站距离
  422 + $('#distancesInput').val(editStationParmas.stationRouteDistances);
  423 + // 线路版本号
  424 + $('#versionsInput').val(editStationParmas.stationRouteVersions);
  425 + // 描述/说明
  426 + $('#descriptionsTextarea').val(editStationParmas.sttationDescriptions);
  427 + },
  428 +
  429 + setSectionFormValue : function(Section) {
  430 + $('#isRoadeSpeedInput').val(Section.isRoadeSpeed);
  431 + // 路段ID
  432 + $('#sectionIdInput').val(Section.sectionId);
  433 + // 路段路由ID
  434 + $('#sectionRouteIdInput').val(Section.sectionrouteId);
  435 + // 线路ID
  436 + $('#sectionRouteLineInput').val(Section.sectionrouteLine);
  437 + // 线路编码
  438 + $('#lineCodeInput').val(Section.sectionrouteLineCode);
  439 + // 折线坐标集合
  440 + $('#bsectionVectorInput').val(Section.sectionBsectionVector);
  441 + // 路段名称
  442 + $('#sectionNameInput').val(Section.sectionName);
  443 + // 路段编码
  444 + $('#sectionCodeInput').val(Section.sectionCode);
  445 + // 路段序号
  446 + $('#sectionrouteCodeSelect').val(Section.sectionrouteCode);
  447 + // 路段方向
  448 + $('#directionsSection').val(Section.sectionrouteDirections);
  449 + // 道路编码
  450 + $('#roadCodingCodInput').val(Section.sectionRoadCoding);
  451 + // 道路限速
  452 + $('#speedLimitInput').val(Section.sectionSpeedLimet);
  453 + // 路段长度
  454 + $('#sectionDistanceInput').val(Section.sectionDistance);
  455 + // 时长
  456 + $('#sectionTimeInput').val(Section.sectionTime);
  457 + // 版本号
  458 + $('#versionsInput').val(Section.versions);
  459 + },
  460 +
  461 + /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */
  462 + linePanlThree : function(lineId,data,direction,version,callback) {
  463 + /** 获取站点路由信息 @param:<Line.id:线路Id;0:上行> @return:<resultdata:站点路由数据> */
  464 + var polyline_center;
  465 + GetAjaxData.getStationRoutePoint(lineId,direction,version,function(resultdata) {
  466 + WorldsBMap.clearMarkAndOverlays();
  467 + // 如果站点路由数据不为空
  468 + if(resultdata.length>0) {
  469 +// var ceter_index = Math.round(resultdata.length / 2);
  470 + var ceterPointsStr = resultdata[0].stationJwpoints;
  471 + var ceterPointsArray = ceterPointsStr.split(' ');
  472 + polyline_center = new BMap.Point(ceterPointsArray[0],ceterPointsArray[1]);
  473 + // 遍历站点路由数据
  474 + for(var s = 0 ; s<resultdata.length;s++) {
  475 + WorldsBMap.drawingUpStationPoint(resultdata[s], s+1);
  476 + }
  477 + }
  478 + data = data[0].children[1];
  479 + // 路段数据长度
  480 + var dataLen = data.children.length;
  481 + // 如果大于零
  482 + if(dataLen>0) {
  483 + WorldsBMap.drawingUpline01(data.children);
  484 + // WorldsBMap.drawingUpline01(polyline_center,data);
  485 + }
  486 + callback && callback(polyline_center);
  487 + });
  488 + },
  489 + /** 加载树 @param:<lineId:线路ID;direction:方向(0:上行;1:下行)> */
  490 + TreeUpOrDown : function(lineId,direction,version) {
  491 +
  492 + /** 获取树结果数据 @param:<lineId:线路ID;direction:方向;callback:回调函数> */
  493 + GetAjaxData.getStation(lineId,direction,version,function(treeDateJson) {
  494 + // 获取返回数据长度
  495 + var len = treeDateJson[0].children[0].children.length;
  496 + // 上行
  497 + if(direction == 0) {
  498 + /** 初始化上行树 @param:<treeDateJson:树数据结构> */
  499 + StationTreeData.upInit(treeDateJson);
  500 + if(len>0) {
  501 + $('#upToolsMobal').hide();
  502 + $('#uptreeMobal').show();
  503 + }else {
  504 + $('#upToolsMobal').show();
  505 + $('#uptreeMobal').hide();
  506 + }
  507 +
  508 + PublicFunctions.linePanlThree(lineId,treeDateJson,direction,version,function (polyline_center) {
  509 + var map = WorldsBMap.getmapBValue();
  510 + map.panTo(polyline_center);
  511 + });
  512 +
  513 + // 下行
  514 + }else if(direction ==1) {
  515 + /** 出事画下行树 @param:<treeDateJson:树数据结构> */
  516 + StationTreeData.downInit(treeDateJson);
  517 + if(len>0) {
  518 + $('#downToolsMobal').hide();
  519 + $('#DowntreeMobal').show();
  520 + }else {
  521 + $('#downToolsMobal').show();
  522 + $('#DowntreeMobal').hide();
  523 + }
  524 + }
  525 + });
  526 + },
  527 + isHaveStationName : function(data) {
  528 + if(data.length>0) {
  529 + layer.confirm('系统已存在【'+ data[0].stationName +'】该站点位置名称,请选择【系统引用】或者更改站点名称进行新增!', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){
  530 + layer.close(index);
  531 + });
  532 + return false;
  533 + }else {
  534 + return true;
  535 + }
  536 + },
  537 + // 地图处于编辑状态
  538 + editMapStatus : function (dir) {
  539 + WorldsBMap.setMap_status(1);
  540 + // 有方向就显示退出编辑模式按钮
  541 + if(dir!=null && dir!='null'){
  542 + WorldsBMap.setDir(dir);
  543 + $('#esc_edit_div').show();
  544 + }
  545 + $('.protlet-box-layer').show();
  546 + },
  547 + // 地图处于编辑状态
  548 + editMapStatusRemove : function () {
  549 + WorldsBMap.setMap_status(0);
  550 + $('.protlet-box-layer').hide();
  551 + $('#esc_edit_div').hide();
  552 + // 退出绘画模式
  553 + WorldsBMap.exitDrawStatus();
  554 + },
  555 + // 选项鎖死解除
  556 + editAChangeCssRemoveDisabled : function() {
  557 + $('#downLine').removeClass('btn disabled');
  558 + $('.btn-circle').removeClass('disabled');
  559 + $('#upLine').removeClass('btn disabled');
  560 + },
  561 + // 方向代码转名称.
  562 + dirdmToName : function(value){
  563 + var srStr = '';
  564 + if(value=='0')
  565 + srStr = '上行';
  566 + else if(value=='1')
  567 + srStr = '下行';
  568 + return srStr;
  569 + },
  570 + }
  571 + return PubFun ;
572 }(); 572 }();
573 \ No newline at end of file 573 \ No newline at end of file