Commit b690e4c14dc4fb09c0919a0a800014cd5364098b

Authored by 王通
1 parent 7ab6aed4

1.线路路由编辑部分修改

Showing 27 changed files with 3050 additions and 1058 deletions

Too many changes to show.

To preserve performance only 27 of 36 files are displayed.

src/main/java/com/bsth/controller/InoutCarparkController.java
@@ -46,10 +46,18 @@ public class InoutCarparkController extends BaseController<LsInoutSectionRoute, @@ -46,10 +46,18 @@ public class InoutCarparkController extends BaseController<LsInoutSectionRoute,
46 * @return map<SUCCESS:成功;ERROR:异常> 46 * @return map<SUCCESS:成功;ERROR:异常>
47 */ 47 */
48 @RequestMapping(value="sectionSave" , method = RequestMethod.POST) 48 @RequestMapping(value="sectionSave" , method = RequestMethod.POST)
49 - public Map<String, Object> sectionSave(@RequestParam Map<String, Object> map) {  
50 - map.put("createBy", "");  
51 - map.put("updateBy", "");  
52 - return inoutCarparkService.sectionSave(map); 49 + public Map<String, Object> sectionSave(LsInoutSectionRoute sectionRoute) {
  50 + Map<String, Object> result = new HashMap<>();
  51 + try {
  52 + inoutCarparkService.add(sectionRoute);
  53 + result.put("status", ResponseCode.SUCCESS);
  54 + } catch (Exception e) {
  55 + result.put("status", ResponseCode.ERROR);
  56 + result.put("msg", e.getMessage());
  57 + logger.error("", e);
  58 + }
  59 +
  60 + return result;
53 } 61 }
54 62
55 /** 63 /**
@@ -60,16 +68,18 @@ public class InoutCarparkController extends BaseController&lt;LsInoutSectionRoute, @@ -60,16 +68,18 @@ public class InoutCarparkController extends BaseController&lt;LsInoutSectionRoute,
60 * @return Map<String, Object> <SUCCESS ; ERROR> 68 * @return Map<String, Object> <SUCCESS ; ERROR>
61 */ 69 */
62 @RequestMapping(value="sectionUpdate" , method = RequestMethod.POST) 70 @RequestMapping(value="sectionUpdate" , method = RequestMethod.POST)
63 - public Map<String, Object> sectionUpdate(@RequestParam Map<String, Object> map) {  
64 -  
65 - map.put("updateBy", "");  
66 -  
67 - map.put("createBy", "");  
68 -  
69 - map.put("createDate", "");  
70 -  
71 - return inoutCarparkService.sectionUpdate(map); 71 + public Map<String, Object> sectionUpdate(LsInoutSectionRoute sectionRoute) {
  72 + Map<String, Object> result = new HashMap<>();
  73 + try {
  74 + inoutCarparkService.modify(sectionRoute);
  75 + result.put("status", ResponseCode.SUCCESS);
  76 + } catch (Exception e) {
  77 + result.put("status", ResponseCode.ERROR);
  78 + result.put("msg", e.getMessage());
  79 + logger.error("", e);
  80 + }
72 81
  82 + return result;
73 } 83 }
74 84
75 /** 85 /**
src/main/java/com/bsth/entity/LsInoutSectionRoute.java
1 package com.bsth.entity; 1 package com.bsth.entity;
2 2
  3 +import org.hibernate.annotations.DynamicUpdate;
  4 +
3 import javax.persistence.*; 5 import javax.persistence.*;
4 import java.util.Date; 6 import java.util.Date;
5 7
@@ -18,6 +20,7 @@ import java.util.Date; @@ -18,6 +20,7 @@ import java.util.Date;
18 20
19 @Entity 21 @Entity
20 @Table(name = "bsth_c_ls_inout_sectionroute") 22 @Table(name = "bsth_c_ls_inout_sectionroute")
  23 +@DynamicUpdate
21 public class LsInoutSectionRoute { 24 public class LsInoutSectionRoute {
22 25
23 @Id 26 @Id
src/main/java/com/bsth/entity/Section.java
@@ -3,6 +3,7 @@ package com.bsth.entity; @@ -3,6 +3,7 @@ package com.bsth.entity;
3 import com.fasterxml.jackson.annotation.JsonIgnore; 3 import com.fasterxml.jackson.annotation.JsonIgnore;
4 import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
5 import org.geolatte.geom.LineString; 5 import org.geolatte.geom.LineString;
  6 +import org.hibernate.annotations.DynamicUpdate;
6 import org.hibernate.annotations.Formula; 7 import org.hibernate.annotations.Formula;
7 8
8 import java.util.Date; 9 import java.util.Date;
@@ -26,6 +27,7 @@ import javax.persistence.*; @@ -26,6 +27,7 @@ import javax.persistence.*;
26 @Entity 27 @Entity
27 @Table(name = "bsth_c_section") 28 @Table(name = "bsth_c_section")
28 @JsonIgnoreProperties(ignoreUnknown = true) 29 @JsonIgnoreProperties(ignoreUnknown = true)
  30 +@DynamicUpdate
29 public class Section{ 31 public class Section{
30 32
31 @Id 33 @Id
src/main/java/com/bsth/repository/LineVersionsRepository.java
@@ -71,7 +71,7 @@ public interface LineVersionsRepository extends BaseRepository&lt;LineVersions, Int @@ -71,7 +71,7 @@ public interface LineVersionsRepository extends BaseRepository&lt;LineVersions, Int
71 /** 71 /**
72 * 查询线路最大线路版本 72 * 查询线路最大线路版本
73 */ 73 */
74 - @Query(value = "select lv2 from LineVersions lv2 where lv2.line.id =?1") 74 + @Query(value = "select lv2 from LineVersions lv2 where lv2.line.id = ?1 order by lv2.versions")
75 public List<LineVersions> findAllHistroyLineVersionsById(int lineId); 75 public List<LineVersions> findAllHistroyLineVersionsById(int lineId);
76 76
77 77
src/main/java/com/bsth/repository/LsInoutSectionRouteRepository.java
@@ -29,7 +29,7 @@ public interface LsInoutSectionRouteRepository extends BaseRepository&lt;LsInoutSec @@ -29,7 +29,7 @@ public interface LsInoutSectionRouteRepository extends BaseRepository&lt;LsInoutSec
29 /** 29 /**
30 * 查询待更新线路的路段路由 30 * 查询待更新线路的路段路由
31 */ 31 */
32 - @Query(value = "SELECT sr FROM LsInoutSectionRoute sr where sr.line.id =?1 and sr.versions=?2 and sr.start=?3 and sr.end=?4 and sr.destroy=0") 32 + @Query(value = "SELECT sr FROM LsInoutSectionRoute sr where sr.line.id =?1 and sr.versions=?2 and sr.start=?3 and sr.end=?4 and sr.destroy=0 order by sr.sectionrouteCode")
33 List<LsInoutSectionRoute> getRouteByStartEnd(int lineId, int version, String start, String end); 33 List<LsInoutSectionRoute> getRouteByStartEnd(int lineId, int version, String start, String end);
34 34
35 /** 35 /**
@@ -45,13 +45,30 @@ public interface LsInoutSectionRouteRepository extends BaseRepository&lt;LsInoutSec @@ -45,13 +45,30 @@ public interface LsInoutSectionRouteRepository extends BaseRepository&lt;LsInoutSec
45 public void sectionUpdSectionRouteCode(String lineCode, int version, String start, String end, Integer sectionrouteCode); 45 public void sectionUpdSectionRouteCode(String lineCode, int version, String start, String end, Integer sectionrouteCode);
46 46
47 /** 47 /**
48 - * 撤销线路某版本进出场 48 + * 在站点路由更新时(站点路由可能改变路由编号,如起点、改变上一站点)
  49 + * 将当前路由编号及以后的编号批量递增10
  50 + * @param sectionRoute
  51 + */
  52 + @Modifying
  53 + @Query(value="UPDATE bsth_c_ls_inout_sectionroute set sectionroute_code = (sectionroute_code + 10) where line = :#{#sectionRoute.line.id} and destroy = 0 and versions = :#{#sectionRoute.versions} and directions = :#{#sectionRoute.directions} and sectionroute_code >= :#{#sectionRoute.sectionrouteCode}", nativeQuery=true)
  54 + void updateSectiouRouteCode(LsInoutSectionRoute sectionRoute);
  55 +
  56 + /**
  57 + * 撤销线路版本下某个方向进出场整个路由组
49 * @param lineCode 58 * @param lineCode
50 * @param version 59 * @param version
51 * @param start 60 * @param start
52 * @param end 61 * @param end
53 */ 62 */
54 @Modifying 63 @Modifying
55 - @Query(value="UPDATE bsth_c_ls_inout_sectionroute set destroy = 1 where line_code = ?1 and versions = ?2 and start = ?3 and end = ?4", nativeQuery=true)  
56 - public void destroy(String lineCode, int version, String start, String end); 64 + @Query(value="UPDATE bsth_c_ls_inout_sectionroute set destroy = 1 where id = ?1 and versions = ?2 and start = ?3 and end = ?4", nativeQuery=true)
  65 + void destroy(String lineCode, int version, String start, String end);
  66 +
  67 + /**
  68 + * 按ID撤销进出场路由组中一个路由
  69 + * @param id
  70 + */
  71 + @Modifying
  72 + @Query(value="UPDATE bsth_c_ls_inout_sectionroute set destroy = 1 where id = ?1", nativeQuery=true)
  73 + void destroy(Integer id);
57 } 74 }
src/main/java/com/bsth/service/InoutCarparkService.java
1 package com.bsth.service; 1 package com.bsth.service;
2 2
  3 +import com.bsth.entity.LsInoutSectionRoute;
3 import com.fasterxml.jackson.core.JsonProcessingException; 4 import com.fasterxml.jackson.core.JsonProcessingException;
4 5
5 import java.util.Map; 6 import java.util.Map;
@@ -10,9 +11,13 @@ public interface InoutCarparkService { @@ -10,9 +11,13 @@ public interface InoutCarparkService {
10 11
11 Map<String, Object> getRouteByStartEnd(int lineId, int version, String start, String end); 12 Map<String, Object> getRouteByStartEnd(int lineId, int version, String start, String end);
12 13
13 - Map<String, Object> sectionSave(Map<String, Object> map); 14 + /**
  15 + * 添加进出场路段和路由
  16 + * @param sectionRoute
  17 + */
  18 + void add(LsInoutSectionRoute sectionRoute);
14 19
15 - Map<String, Object> sectionUpdate(Map<String, Object> map); 20 + void modify(LsInoutSectionRoute sectionRoute);
16 21
17 Map<String, Object> destroy(Map<String, Object> map); 22 Map<String, Object> destroy(Map<String, Object> map);
18 23
src/main/java/com/bsth/service/impl/InoutCarparkServiceImpl.java
@@ -10,6 +10,7 @@ import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; @@ -10,6 +10,7 @@ import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
10 import com.bsth.service.InoutCarparkService; 10 import com.bsth.service.InoutCarparkService;
11 import com.bsth.service.gps.GpsService; 11 import com.bsth.service.gps.GpsService;
12 import com.bsth.util.CoordinateConverter; 12 import com.bsth.util.CoordinateConverter;
  13 +import com.bsth.util.CustomBeanUtils;
13 import com.fasterxml.jackson.core.JsonProcessingException; 14 import com.fasterxml.jackson.core.JsonProcessingException;
14 import com.fasterxml.jackson.databind.ObjectMapper; 15 import com.fasterxml.jackson.databind.ObjectMapper;
15 import org.joda.time.DateTime; 16 import org.joda.time.DateTime;
@@ -54,6 +55,9 @@ public class InoutCarparkServiceImpl extends BaseServiceImpl&lt;LsInoutSectionRoute @@ -54,6 +55,9 @@ public class InoutCarparkServiceImpl extends BaseServiceImpl&lt;LsInoutSectionRoute
54 @Autowired 55 @Autowired
55 private GpsService gpsService; 56 private GpsService gpsService;
56 57
  58 + @Autowired
  59 + private LineVersionsRepository lineVersionsRepository;
  60 +
57 @Override 61 @Override
58 public Map<String, Object> getStartEndByLine(int lineId, int version) { 62 public Map<String, Object> getStartEndByLine(int lineId, int version) {
59 Map<String, Object> result = new HashMap<>(), data = new HashMap<>(); 63 Map<String, Object> result = new HashMap<>(), data = new HashMap<>();
@@ -108,129 +112,30 @@ public class InoutCarparkServiceImpl extends BaseServiceImpl&lt;LsInoutSectionRoute @@ -108,129 +112,30 @@ public class InoutCarparkServiceImpl extends BaseServiceImpl&lt;LsInoutSectionRoute
108 } 112 }
109 113
110 /** 114 /**
111 - * 新增路段信息  
112 - *  
113 - * @param map:<bsectionVector:折线百度坐标集合;dbType:圆坐标类型;descriptions:描述与说明;destroy:是否撤销;directions:方向;lineId:线路ID  
114 - *  
115 - * lineCode :线路编码;roadCoding:道路编码;sectionCode:路段编码;sectionDistance:路段长度;sectionName:路段名称;sectionTime:路段时长;  
116 - *  
117 - * sectionrouteCode:路段序号;speedLimit:路段限速>  
118 - *  
119 - * @return map<SUCCESS:成功;ERROR:异常> 115 + * 添加进出场路段和路由
120 */ 116 */
121 @Override 117 @Override
122 @Transactional 118 @Transactional
123 - public Map<String, Object> sectionSave(Map<String, Object> map) {  
124 - Map<String, Object> resultMap = new HashMap<String, Object>();  
125 - try {  
126 - // 线路ID.  
127 - Integer lineId = map.get("lineId").equals("") ? null : Integer.valueOf(map.get("lineId").toString());  
128 - // 线路编码.  
129 - String lineCode = map.get("lineCode").equals("") ? "" : map.get("lineCode").toString();  
130 - // 路段名称.  
131 - String sectionName = map.get("sectionName").equals("") ? "" : map.get("sectionName").toString();  
132 - // 路段编码.  
133 - String sectionCode = map.get("sectionCode").equals("") ? "" : map.get("sectionCode").toString();  
134 - // 道路编码.  
135 - String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString();  
136 - // 原始坐标类型.  
137 - String dbType = map.get("dbType").equals("") ? "" :map.get("dbType").toString();  
138 - // 路段几何图形坐标.  
139 - String sectionJSON = map.get("bsectionVector").equals("") ? "" : map.get("bsectionVector").toString();  
140 - // 路段序号  
141 - String sectionrouteCode = map.get("sectionrouteCode").equals("") ? "" : map.get("sectionrouteCode").toString();  
142 - // 路段时长.  
143 - Double sectionTime = map.get("sectionTime").equals("") ? 0.0d : Double.valueOf(map.get("sectionTime").toString());  
144 - // 路段距离.  
145 - Double sectionDistance = map.get("sectionDistance").equals("") ? 0.0d : Double.valueOf(map.get("sectionDistance").toString());  
146 - // 路段限速.  
147 - Double speedLimit = map.get("speedLimit").equals("") ? 0.0d : Double.valueOf(map.get("speedLimit").toString());  
148 - // 版本.  
149 - Integer versions = map.get("versions").equals("") ? 1 : Integer.valueOf(map.get("versions").toString());  
150 - // 是否撤销.  
151 - Integer destroy = map.get("destroy").equals("") ? 0 : Integer.valueOf(map.get("destroy").toString());  
152 - // 路段方向.  
153 - Integer directions = map.get("directions").equals("") ? 0 : Integer.valueOf(map.get("directions").toString());  
154 - // 描述与说明.  
155 - String descriptions = map.get("descriptions").equals("")? "" : map.get("descriptions").toString();  
156 - // 起始  
157 - String start = map.get("start").equals("")? "" : map.get("start").toString();  
158 - // 结束  
159 - String end = map.get("end").equals("")? "" : map.get("end").toString();  
160 - // 原始线状图形坐标集合  
161 - String sectionsBpoints = "";  
162 - // WGS线状图形坐标集合  
163 - String sectionsWJPpoints = "";  
164 - if(!sectionJSON.equals("")) {  
165 - // 转换成JSON数组  
166 - JSONArray sectionsArray = JSONArray.parseArray(sectionJSON);  
167 - // 遍历  
168 - for(int s = 0 ;s<sectionsArray.size();s++) {  
169 - String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString();  
170 - String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString();  
171 - String WGSLngStr = "";  
172 - String WGSLatStr = "";  
173 - CoordinateConverter.Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr);  
174 - WGSLngStr = String.valueOf(resultPoint.getLng());  
175 - WGSLatStr = String.valueOf(resultPoint.getLat());  
176 - if(s==0) {  
177 - sectionsBpoints = pointsLngStr + " " + pointsLatStr;  
178 - sectionsWJPpoints = WGSLngStr + " " + WGSLatStr;  
179 - }else {  
180 - sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr;  
181 - sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr;  
182 - }  
183 - }  
184 - }  
185 - // WGS坐标点集合  
186 - String gsectionVector = "LINESTRING(" + sectionsWJPpoints +")";  
187 - // 原坐标点集合  
188 - String bsectionVector = "LINESTRING(" + sectionsBpoints + ")";  
189 - String crosesRoad="";  
190 - String endNode ="";  
191 - String startNode="";  
192 - String middleNode="";  
193 - String sectionType="";  
194 - String csectionVector=null;  
195 - Integer id = Integer.valueOf(sectionCode);  
196 - sectionRepository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, gsectionVector, bsectionVector, sectionType, csectionVector, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, versions, id);  
197 - Section section = sectionRepository.findById(id).get();  
198 -  
199 - Line line = lineRepository.findById(lineId).get();  
200 -  
201 -  
202 - if (map.get("status") == null || Integer.parseInt(map.get("status").toString()) != 0) {  
203 -  
204 - LsInoutSectionRoute sectionRoute = new LsInoutSectionRoute();  
205 - Integer routeCode = null;  
206 - if(!sectionrouteCode.equals("")){  
207 - String sectionrouteCodeArray[] = sectionrouteCode.split("_");  
208 - routeCode = Integer.valueOf(sectionrouteCodeArray[0])+1;  
209 - }else {  
210 - routeCode = 1;  
211 - }  
212 - lsInoutSectionRouteRepository.sectionUpdSectionRouteCode(lineCode, versions, start, end, routeCode);  
213 - sectionRoute.setSectionrouteCode(routeCode);  
214 - sectionRoute.setLineCode(lineCode);  
215 - sectionRoute.setSection(section);  
216 - sectionRoute.setSectionCode(sectionCode);  
217 - sectionRoute.setDirections(directions);  
218 - sectionRoute.setDescriptions(descriptions);  
219 - sectionRoute.setDestroy(destroy);  
220 - sectionRoute.setVersions(versions);  
221 - sectionRoute.setLine(line);  
222 - sectionRoute.setStart(start);  
223 - sectionRoute.setEnd(end);  
224 - lsInoutSectionRouteRepository.save(sectionRoute);  
225 - } 119 + public void add(LsInoutSectionRoute sectionRoute) {
  120 + Section section = sectionRoute.getSection();
  121 + Line line = lineRepository.findById(sectionRoute.getLine().getId()).get();
  122 + Integer version = lineVersionsRepository.findCurrentVersion(line.getId());
  123 + boolean isPresent = sectionRepository.findById(section.getId()).isPresent();
  124 + sectionRoute.setLineCode(line.getLineCode());
  125 + if (sectionRoute.getVersions() < version) {
  126 + throw new IllegalArgumentException("历史版本不可变更");
  127 + }
226 128
  129 + // 路段坐标信息
  130 + if (!isPresent) {
  131 + SectionServiceImpl.centerLine(section);
  132 + }
227 133
228 - resultMap.put("status", ResponseCode.SUCCESS);  
229 - } catch (Exception e) {  
230 - resultMap.put("status", ResponseCode.ERROR);  
231 - logger.error("save erro.", e); 134 + lsInoutSectionRouteRepository.updateSectiouRouteCode(sectionRoute);
  135 + if (!isPresent) {
  136 + sectionRepository.save(section);
232 } 137 }
233 - return resultMap; 138 + lsInoutSectionRouteRepository.save(sectionRoute);
234 } 139 }
235 140
236 /** 百度坐标转WGS坐标 */ 141 /** 百度坐标转WGS坐标 */
@@ -250,155 +155,35 @@ public class InoutCarparkServiceImpl extends BaseServiceImpl&lt;LsInoutSectionRoute @@ -250,155 +155,35 @@ public class InoutCarparkServiceImpl extends BaseServiceImpl&lt;LsInoutSectionRoute
250 155
251 } 156 }
252 157
253 - /**  
254 - * @Description :TODO(编辑线路走向)  
255 - *  
256 - * @param map <sectionId:路段ID; sectionJSON:路段信息>  
257 - *  
258 - * @return Map<String, Object> <SUCCESS ; ERROR>  
259 - */ 158 + @Transactional(rollbackFor = RuntimeException.class)
260 @Override 159 @Override
261 - @Transactional  
262 - public Map<String, Object> sectionUpdate(Map<String, Object> map) {  
263 - Map<String, Object> resultMap = new HashMap<String, Object>();  
264 - try {  
265 - String bsectionVector = map.get("bsectionVector").equals("") ? "" :map.get("bsectionVector").toString();  
266 - // 原始线状图形坐标集合  
267 - String sectionsBpoints = "";  
268 - // WGS线状图形坐标集合  
269 - String sectionsWJPpoints = "";  
270 - if(!bsectionVector.equals("")) {  
271 - // 转换成JSON数组  
272 - JSONArray sectionsArray = JSONArray.parseArray(bsectionVector);  
273 - // 遍历  
274 - for(int s = 0 ;s<sectionsArray.size();s++) {  
275 - String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString();  
276 - String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString();  
277 - /** to WGS坐标 */  
278 - CoordinateConverter.Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr);  
279 - String WGSLngStr = String.valueOf(resultPoint.getLng());  
280 - String WGSLatStr = String.valueOf(resultPoint.getLat());  
281 - if(s==0) {  
282 - sectionsBpoints = pointsLngStr + " " + pointsLatStr;  
283 - sectionsWJPpoints = WGSLngStr + " " + WGSLatStr;  
284 - }else {  
285 - sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr;  
286 - sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr;  
287 - }  
288 - }  
289 - }  
290 - // 原坐标类型  
291 - String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString();  
292 - // 说明  
293 - String descriptions = "";  
294 - // 是否撤销  
295 - Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString());  
296 - // 方向  
297 - Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString());  
298 - // 线路ID  
299 - Integer sectionRouteLine = map.get("sectionRouteLine").equals("") ? null : Integer.parseInt(map.get("sectionRouteLine").toString());  
300 - // 道路编码  
301 - String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString();  
302 - // 路段编码  
303 - String sectionCode = map.get("sectionCode").equals("") ? "" : map.get("sectionCode").toString();  
304 - // 路段长度  
305 - Double sectionDistance = map.get("sectionDistance").equals("") ? null : Double.valueOf(map.get("sectionDistance").toString());  
306 - // 路段ID  
307 - Integer sectionId = map.get("sectionId").equals("") ? 0 : Integer.parseInt(map.get("sectionId").toString());  
308 - // 路段名称  
309 - String sectionName = map.get("sectionName").equals("") ? "" : map.get("sectionName").toString();  
310 - // 路段路由Id  
311 - Long sectionRouteId = map.get("sectionRouteId").equals("") ? null : Long.valueOf(map.get("sectionRouteId").toString());  
312 - // 线路编码  
313 - String lineCode =map.get("lineCode").equals("") ? "" : map.get("lineCode").toString();  
314 - // 路段时长  
315 - Double sectionTime = map.get("sectionTime").equals("") ? null : Double.valueOf(map.get("sectionTime").toString());  
316 - // 路段路由  
317 - Integer sectionrouteCode = "".equals(map.get("sectionrouteCode")) ? null : Integer.valueOf(map.get("sectionrouteCode").toString());  
318 - // 限速  
319 - Double speedLimit = map.get("speedLimit").equals("") ? null : Double.valueOf(map.get("speedLimit").toString());  
320 - // 版本  
321 - Integer version = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString());  
322 - // 起始  
323 - String start = map.get("start").equals("")? "" : map.get("start").toString();  
324 - // 结束  
325 - String end = map.get("end").equals("")? "" : map.get("end").toString();  
326 - // WGS坐标点集合  
327 - String gsectionVector = null;  
328 - if(!sectionsWJPpoints.equals("")) {  
329 - gsectionVector = "LINESTRING(" + sectionsWJPpoints +")";  
330 - }  
331 - // 原坐标点集合  
332 - String bsectionVectorS = null;  
333 - if(!sectionsBpoints.equals("")) {  
334 - bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")";  
335 - }  
336 - Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString());  
337 - String createDate = map.get("createDate").equals("") ? null : map.get("createDate").toString();  
338 - Integer updateBy = map.get("updateBy").equals("") ?null : Integer.valueOf(map.get("updateBy").toString());  
339 - SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss");  
340 - Date date = new Date();  
341 - // 修改日期  
342 - String updateDate = formatter.format(date);  
343 - String crosesRoad="";  
344 - String endNode="";  
345 - String startNode="";  
346 - String middleNode="";  
347 - String sectionType="";  
348 - // 更新  
349 - sectionRepository.sectionUpdate(sectionId, gsectionVector, bsectionVectorS, sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, sectionType, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, version, createBy, createDate, updateBy, updateDate);  
350 -  
351 - Line line = lineRepository.findById(sectionRouteLine).get();  
352 - Section section = sectionRepository.findById(sectionId).get(); 160 + public void modify(LsInoutSectionRoute sectionRoute) {
  161 + Section section = sectionRoute.getSection();
  162 + LsInoutSectionRoute sectionRoute1 = lsInoutSectionRouteRepository.findById(sectionRoute.getId()).get();
  163 + Section section1 = sectionRepository.findById(section.getId()).get();
  164 + Integer version = lineVersionsRepository.findCurrentVersion(sectionRoute1.getLine().getId());
  165 + if (sectionRoute1.getVersions() < version) {
  166 + throw new IllegalArgumentException("历史版本不可变更");
  167 + }
353 168
354 - if(map.get("status") == null || Integer.parseInt(map.get("status").toString()) != 0) { 169 + SectionServiceImpl.centerLine(section);
355 170
356 - LsInoutSectionRoute resultS = lsInoutSectionRouteRepository.findById(sectionRouteId).get();  
357 - int old_code = resultS.getSectionrouteCode();  
358 - // 是否修改路段序号标记  
359 - boolean type = false;  
360 - if(sectionrouteCode!=null) {  
361 - if(++sectionrouteCode == old_code) {  
362 - type = true;  
363 - }  
364 - // 默认是最前面路段  
365 - }else {  
366 - sectionrouteCode = 1;  
367 - }  
368 - if(!type)  
369 - lsInoutSectionRouteRepository.sectionUpdSectionRouteCode(lineCode, version, start, end,sectionrouteCode);  
370 - LsInoutSectionRoute route = new LsInoutSectionRoute();  
371 - route.setId(sectionRouteId);  
372 - route.setSectionrouteCode(sectionrouteCode);  
373 - route.setLineCode(lineCode);  
374 - route.setSectionCode(sectionCode);  
375 - route.setDirections(directions);  
376 - route.setVersions(version);  
377 - route.setDestroy(destroy);  
378 - route.setCreateBy(createBy);  
379 - route.setUpdateBy(updateBy);  
380 - route.setSection(section);  
381 - route.setLine(line);  
382 - route.setStart(start);  
383 - route.setEnd(end);  
384 - lsInoutSectionRouteRepository.save(route);  
385 - }  
386 - resultMap.put("status", ResponseCode.SUCCESS);  
387 - } catch (Exception e) {  
388 - resultMap.put("status", ResponseCode.ERROR);  
389 - logger.error("save erro.", e);  
390 - }  
391 - return resultMap; 171 + lsInoutSectionRouteRepository.updateSectiouRouteCode(sectionRoute);
  172 + CustomBeanUtils.copyPropertiesIgnoredNull(sectionRoute, sectionRoute1);
  173 + CustomBeanUtils.copyPropertiesIgnoredNull(section, section1);
  174 + sectionRepository.save(section1);
  175 + lsInoutSectionRouteRepository.save(sectionRoute1);
392 } 176 }
393 177
394 @Override 178 @Override
  179 + @Transactional
395 public Map<String, Object> destroy(Map<String, Object> map) { 180 public Map<String, Object> destroy(Map<String, Object> map) {
396 Map<String, Object> resultMap = new HashMap<String, Object>(); 181 Map<String, Object> resultMap = new HashMap<String, Object>();
397 try { 182 try {
398 - long id = Long.parseLong(map.get("id").toString()); 183 + Integer id = Integer.valueOf(map.get("id").toString());
399 184
400 if(map.get("status") == null || Integer.parseInt(map.get("status").toString()) != 0) { 185 if(map.get("status") == null || Integer.parseInt(map.get("status").toString()) != 0) {
401 - lsInoutSectionRouteRepository.deleteById(id); 186 + lsInoutSectionRouteRepository.destroy(id);
402 } 187 }
403 resultMap.put("status", ResponseCode.SUCCESS); 188 resultMap.put("status", ResponseCode.SUCCESS);
404 } catch (Exception e) { 189 } catch (Exception e) {
@@ -409,8 +194,9 @@ public class InoutCarparkServiceImpl extends BaseServiceImpl&lt;LsInoutSectionRoute @@ -409,8 +194,9 @@ public class InoutCarparkServiceImpl extends BaseServiceImpl&lt;LsInoutSectionRoute
409 } 194 }
410 195
411 @Override 196 @Override
412 - @Transactional  
413 - public void pathPlaningByHistory(long schId, int versions) throws JsonProcessingException { 197 + @Transactional(rollbackFor = RuntimeException.class)
  198 + public void pathPlaningByHistory(long schId, int versions) {
  199 + LsInoutSectionRoute sectionRoute = new LsInoutSectionRoute();
414 ScheduleRealInfo scheduleRealInfo = scheduleRealInfoRepository.findById(schId).get(); 200 ScheduleRealInfo scheduleRealInfo = scheduleRealInfoRepository.findById(schId).get();
415 DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm"); 201 DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm");
416 DateTime start = formatter.parseDateTime(scheduleRealInfo.getRealExecDate() + scheduleRealInfo.getFcsjActual()); 202 DateTime start = formatter.parseDateTime(scheduleRealInfo.getRealExecDate() + scheduleRealInfo.getFcsjActual());
@@ -420,37 +206,39 @@ public class InoutCarparkServiceImpl extends BaseServiceImpl&lt;LsInoutSectionRoute @@ -420,37 +206,39 @@ public class InoutCarparkServiceImpl extends BaseServiceImpl&lt;LsInoutSectionRoute
420 } 206 }
421 Map<String, Object> map = gpsService.history(new String[]{ scheduleRealInfo.getClZbh() }, start.getMillis() / 1000 - 20, end.getMillis() / 1000 + 20); 207 Map<String, Object> map = gpsService.history(new String[]{ scheduleRealInfo.getClZbh() }, start.getMillis() / 1000 - 20, end.getMillis() / 1000 + 20);
422 List<Map<String, Object>> list = (List<Map<String, Object>>)map.get("list"); 208 List<Map<String, Object>> list = (List<Map<String, Object>>)map.get("list");
423 - List<Map<String, Object>> bsectionVector = new ArrayList<>(); 209 + StringBuilder sb = new StringBuilder("LINESTRING(");
424 for (Map<String, Object> m : list) { 210 for (Map<String, Object> m : list) {
425 Map<String, Object> m1 = new HashMap<>(); 211 Map<String, Object> m1 = new HashMap<>();
426 Float lng = (Float)m.get("lon"), lat = (Float)m.get("lat"); 212 Float lng = (Float)m.get("lon"), lat = (Float)m.get("lat");
427 if (lng == 0 || lat == 0) { 213 if (lng == 0 || lat == 0) {
428 continue; 214 continue;
429 } 215 }
430 - m1.put("lng", m.get("bd_lon"));  
431 - m1.put("lat", m.get("bd_lat"));  
432 - bsectionVector.add(m1); 216 + sb.append(lng).append(" ").append(lat).append(",");
433 } 217 }
434 - map.clear();  
435 - map.put("lineId", scheduleRealInfo.getXlBm());  
436 - map.put("lineCode", scheduleRealInfo.getXlBm());  
437 - map.put("sectionName", scheduleRealInfo.getQdzName() + "-" + scheduleRealInfo.getZdzName());  
438 - map.put("sectionCode", sectionRepository.findLatestSectionId() + 1);  
439 - map.put("roadCoding", "");  
440 - map.put("dbType", "b");  
441 - map.put("sectionrouteCode", "1");  
442 - map.put("sectionTime", "");  
443 - map.put("sectionDistance", "");  
444 - map.put("speedLimit", "60");  
445 - map.put("versions", versions);  
446 - map.put("destroy", 0);  
447 - map.put("directions", 3);  
448 - map.put("descriptions", "");  
449 - map.put("start", scheduleRealInfo.getQdzName());  
450 - map.put("end", scheduleRealInfo.getZdzName());  
451 - map.put("bsectionVector", new ObjectMapper().writeValueAsString(bsectionVector)); 218 + sb.deleteCharAt(sb.length() - 1).append(")");
  219 +
  220 + Integer sectionId = sectionRepository.findLatestSectionId() + 1;
  221 + Line line = new Line();Section section = new Section();
  222 + sectionRoute.setLine(line);
  223 + sectionRoute.setSection(section);
  224 + line.setId(Integer.parseInt(scheduleRealInfo.getXlBm()));
  225 + line.setLineCode(scheduleRealInfo.getXlBm());
  226 + section.setId(sectionId);
  227 + section.setSectionCode(sectionId.toString());
  228 + section.setSectionName(scheduleRealInfo.getQdzName() + "-" + scheduleRealInfo.getZdzName());
  229 + section.setBsectionVectorWkt(sb.toString());
  230 + section.setSectionTime(0.);
  231 + section.setSectionDistance(0.);
  232 + section.setSpeedLimit(60.);
  233 + sectionRoute.setSectionCode(sectionId.toString());
  234 + sectionRoute.setSectionrouteCode(1);
  235 + sectionRoute.setStart(scheduleRealInfo.getQdzName());
  236 + sectionRoute.setEnd(scheduleRealInfo.getZdzName());
  237 + sectionRoute.setDirections(3);
  238 + sectionRoute.setDestroy(0);
  239 + sectionRoute.setVersions(versions);
452 240
453 lsInoutSectionRouteRepository.destroy(scheduleRealInfo.getXlBm(), versions, scheduleRealInfo.getQdzName(), scheduleRealInfo.getZdzName()); 241 lsInoutSectionRouteRepository.destroy(scheduleRealInfo.getXlBm(), versions, scheduleRealInfo.getQdzName(), scheduleRealInfo.getZdzName());
454 - sectionSave(map); 242 + add(sectionRoute);
455 } 243 }
456 } 244 }
src/main/java/com/bsth/service/impl/SectionServiceImpl.java
@@ -187,6 +187,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem @@ -187,6 +187,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
187 } 187 }
188 resultMap.put("status", ResponseCode.SUCCESS); 188 resultMap.put("status", ResponseCode.SUCCESS);
189 } catch (Exception e) { 189 } catch (Exception e) {
  190 + logger.error("doubleName()", e);
190 resultMap.put("status", ResponseCode.ERROR); 191 resultMap.put("status", ResponseCode.ERROR);
191 } 192 }
192 return resultMap; 193 return resultMap;
src/main/resources/static/index.html
@@ -680,6 +680,6 @@ @@ -680,6 +680,6 @@
680 <script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script> 680 <script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script>
681 <!-- RSA加密 --> 681 <!-- RSA加密 -->
682 <script src="/assets/plugins/jsencrypt.min.js"></script> 682 <script src="/assets/plugins/jsencrypt.min.js"></script>
683 - 683 +<script src="/assets/js/eventproxy.js"></script>
684 </body> 684 </body>
685 </html> 685 </html>
686 \ No newline at end of file 686 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/add_routes_template.html
@@ -102,8 +102,8 @@ @@ -102,8 +102,8 @@
102 <script src="/assets/js/CoordinateConverter.js"></script> 102 <script src="/assets/js/CoordinateConverter.js"></script>
103 103
104 <script type="text/javascript"> 104 <script type="text/javascript">
105 -$('#add_routes_template_modal').on('modal.show', function(e,_WorldsBMap,_GetAjaxData,_LineObj,_PublicFunctions){  
106 - var line = _LineObj.getLineObj(); 105 +$('#add_routes_template_modal').on('modal.show', function(event){
  106 + var properties = RoutesOperation.getProperties();
107 // 延迟加载显示mobal 107 // 延迟加载显示mobal
108 setTimeout(function(){$('#add_routes_template_modal').modal({show: true, backdrop: 'static', keyboard: false});},200); 108 setTimeout(function(){$('#add_routes_template_modal').modal({show: true, backdrop: 'static', keyboard: false});},200);
109 // 获取表单元素 109 // 获取表单元素
@@ -200,8 +200,6 @@ $(&#39;#add_routes_template_modal&#39;).on(&#39;modal.show&#39;, function(e,_WorldsBMap,_GetAjax @@ -200,8 +200,6 @@ $(&#39;#add_routes_template_modal&#39;).on(&#39;modal.show&#39;, function(e,_WorldsBMap,_GetAjax
200 $('#add_routes_template_modal').modal('hide'); 200 $('#add_routes_template_modal').modal('hide');
201 // 定义线路名称 201 // 定义线路名称
202 let lineName = $('.portlet-title .caption').text(); 202 let lineName = $('.portlet-title .caption').text();
203 - // 路线方向  
204 - let directionData = $("input[name='dirCheck']:checked").val();  
205 /** 203 /**
206 * 添加类型0(txt)/1(xml) 204 * 添加类型0(txt)/1(xml)
207 * txt方式路段需要30个点取一个 205 * txt方式路段需要30个点取一个
@@ -235,22 +233,22 @@ $(&#39;#add_routes_template_modal&#39;).on(&#39;modal.show&#39;, function(e,_WorldsBMap,_GetAjax @@ -235,22 +233,22 @@ $(&#39;#add_routes_template_modal&#39;).on(&#39;modal.show&#39;, function(e,_WorldsBMap,_GetAjax
235 let sectionListFinal = []; 233 let sectionListFinal = [];
236 sectionListFinal.push({sectionrouteCode: 100, section: {sectionName: lineName, bsectionVectorWkt: locations2LinestringWkt(sectionList)}}); 234 sectionListFinal.push({sectionrouteCode: 100, section: {sectionName: lineName, bsectionVectorWkt: locations2LinestringWkt(sectionList)}});
237 // 根据站点名称获取百度坐标 235 // 根据站点名称获取百度坐标
238 - _WorldsBMap.stationsPointsToLibraryPoint(stationList,function(resultJson) { 236 + RoutesOperation.stationsPointsToLibraryPoint(stationList,function(resultJson) {
239 // 根据坐标点获取两点之间的时间与距离 237 // 根据坐标点获取两点之间的时间与距离
240 - _WorldsBMap.getDistanceAndDuration(resultJson,function(stationdataList) { 238 + RoutesOperation.getDistanceAndDuration(resultJson,function(stationDataList) {
241 // 参数集合 239 // 参数集合
242 - let params = {lineId: line.id, directions: directionData, versions: $('#versions').val(), stationRoutes: stationdataList, sectionRoutes: sectionListFinal}; 240 + let params = {lineId: properties.lineId, directions: properties.directions, versions: properties.versions, stationRoutes: stationDataList, sectionRoutes: sectionListFinal};
243 if (!params.versions) { 241 if (!params.versions) {
244 params.versions = '1'; 242 params.versions = '1';
245 } 243 }
246 - _GetAjaxData.manualSave(params, function(res) { 244 + RoutesService.manualSave(params, function(res) {
247 // 关闭弹出层 245 // 关闭弹出层
248 layer.closeAll(); 246 layer.closeAll();
249 if (res.status == 'SUCCESS') { 247 if (res.status == 'SUCCESS') {
250 // 清除地图覆盖物 248 // 清除地图覆盖物
251 - _WorldsBMap.clearMarkAndOverlays(); 249 + RoutesOperation.clearMarkAndOverlays();
252 // 查询路段信息 250 // 查询路段信息
253 - _PublicFunctions.resjtreeDate(params.lineId, params.directions, params.versions); 251 + RoutesOperation.resjtreeDate(params.lineId, params.directions, params.versions);
254 252
255 $('#route_show').removeClass('hidden'); 253 $('#route_show').removeClass('hidden');
256 $('#generationRoute_div').addClass('hidden'); 254 $('#generationRoute_div').addClass('hidden');
src/main/resources/static/pages/base/stationroute/add_stationroute_step1.html
@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 </div> 10 </div>
11 <div class="modal-body"> 11 <div class="modal-body">
12 <form class="form-horizontal" action="/" method="post" id="formBootbox" role="form"> 12 <form class="form-horizontal" action="/" method="post" id="formBootbox" role="form">
13 - <div class="alert alert-danger display-hide" id="requiredname"> 13 + <div class="alert alert-danger display-hide" id="error">
14 <button class="close" data-close="alert"></button> 14 <button class="close" data-close="alert"></button>
15 站点名称为必填项 15 站点名称为必填项
16 </div> 16 </div>
@@ -45,7 +45,8 @@ @@ -45,7 +45,8 @@
45 </div> 45 </div>
46 </div> 46 </div>
47 <script type="text/javascript"> 47 <script type="text/javascript">
48 -$('#add_stationroute_step1_modal').on('modal.show', function(e,_WorldsBMap,DrawingManagerObj,GetAjaxData,AddStationObj,LineObj,PublicFunctions){ 48 +$('#add_stationroute_step1_modal').on('modal.show', function(event){
  49 + var addStationRoute = RoutesOperation.getAddStationRoute();
49 // 加载显示mobal 50 // 加载显示mobal
50 $('#add_stationroute_step1_modal').modal({show: true, backdrop: 'static', keyboard: false}); 51 $('#add_stationroute_step1_modal').modal({show: true, backdrop: 'static', keyboard: false});
51 setTimeout(function(){ 52 setTimeout(function(){
@@ -71,7 +72,7 @@ $(&#39;#add_stationroute_step1_modal&#39;).on(&#39;modal.show&#39;, function(e,_WorldsBMap,Drawi @@ -71,7 +72,7 @@ $(&#39;#add_stationroute_step1_modal&#39;).on(&#39;modal.show&#39;, function(e,_WorldsBMap,Drawi
71 // 获取表单元素 72 // 获取表单元素
72 var form = $('#formBootbox'); 73 var form = $('#formBootbox');
73 // 错误提示元素 74 // 错误提示元素
74 - var requiredname = $('#requiredname', form); 75 + var error = $('#error', form);
75 // 下一步点击事件 76 // 下一步点击事件
76 $('#addSelectnextButton').on('click', function() { 77 $('#addSelectnextButton').on('click', function() {
77 // 表单提交 78 // 表单提交
@@ -86,8 +87,8 @@ $(&#39;#add_stationroute_step1_modal&#39;).on(&#39;modal.show&#39;, function(e,_WorldsBMap,Drawi @@ -86,8 +87,8 @@ $(&#39;#add_stationroute_step1_modal&#39;).on(&#39;modal.show&#39;, function(e,_WorldsBMap,Drawi
86 'stationName' : {required: true, maxlength: 50} 87 'stationName' : {required: true, maxlength: 50}
87 }, 88 },
88 invalidHandler : function(event, validator) { 89 invalidHandler : function(event, validator) {
89 - requiredname.show();  
90 - App.scrollTo(requiredname, -200); 90 + error.show();
  91 + App.scrollTo(error, -200);
91 }, 92 },
92 highlight : function(element) { 93 highlight : function(element) {
93 $(element).closest('.form-group').addClass('has-error'); 94 $(element).closest('.form-group').addClass('has-error');
@@ -99,16 +100,12 @@ $(&#39;#add_stationroute_step1_modal&#39;).on(&#39;modal.show&#39;, function(e,_WorldsBMap,Drawi @@ -99,16 +100,12 @@ $(&#39;#add_stationroute_step1_modal&#39;).on(&#39;modal.show&#39;, function(e,_WorldsBMap,Drawi
99 label.closest('.form-group').removeClass('has-error'); 100 label.closest('.form-group').removeClass('has-error');
100 }, 101 },
101 submitHandler : function(f) { 102 submitHandler : function(f) {
102 - // 隐藏错误提示  
103 - requiredname.hide();  
104 - //$('#addSelectnextButton').attr('disabled', true); 103 + error.hide();
105 $('#add_stationroute_step1_modal').modal('hide'); 104 $('#add_stationroute_step1_modal').modal('hide');
106 - // 表单序列化  
107 let params = form.serializeJSON(); 105 let params = form.serializeJSON();
108 - /** 设置新增站点对象站点名称属性值 @param:<stationName:站点名称)> */  
109 - AddStationObj.setAddStationName(params.stationName);  
110 - AddStationObj.setAddStationShapesType(params.type == '0' ? 'r' : 'd');  
111 - _WorldsBMap.localtionPoint(params.stationName); 106 + addStationRoute.stationName = params.stationName;
  107 + addStationRoute.shapedType = (params.type == '0' ? 'r' : 'd');
  108 + RoutesOperation.localtionPoint(params.stationName);
112 } 109 }
113 }); 110 });
114 }); 111 });
src/main/resources/static/pages/base/stationroute/add_stationroute_step2.html
@@ -131,7 +131,7 @@ @@ -131,7 +131,7 @@
131 <div class="form-group"> 131 <div class="form-group">
132 <label class="col-md-3 control-label"><span class="required"> * </span>几何图形类型:</label> 132 <label class="col-md-3 control-label"><span class="required"> * </span>几何图形类型:</label>
133 <div class="col-md-6"> 133 <div class="col-md-6">
134 - <input type="text" class="form-control" name="shapedType" id="shapesTypeSelect" placeholder="几何图形类型" readonly="readonly"> 134 + <input type="text" class="form-control" name="shapedType" id="shapedTypeSelect" placeholder="几何图形类型" readonly="readonly">
135 </div> 135 </div>
136 </div> 136 </div>
137 </div> 137 </div>
@@ -214,26 +214,23 @@ @@ -214,26 +214,23 @@
214 </div> 214 </div>
215 </div> 215 </div>
216 <script type="text/javascript"> 216 <script type="text/javascript">
217 -$('#add_stationroute_step2_modal').on('modal.show', function(e, _WorldsBMap,_GetAjaxData,_AddStationObj,_LineObj,_PublicFunctions){  
218 - var Station = _AddStationObj.getAddStation();  
219 - var Line = _LineObj.getLineObj();  
220 - // 延迟加载 217 +$('#add_stationroute_step2_modal').on('modal.show', function(event){
  218 + var addStationRoute = RoutesOperation.getAddStationRoute();
  219 + var properties = RoutesOperation.getProperties();
221 setTimeout(function(){ 220 setTimeout(function(){
222 // 显示mobal 221 // 显示mobal
223 $('#add_stationroute_step2_modal').modal({show : true, backdrop: 'static', keyboard: false}); 222 $('#add_stationroute_step2_modal').modal({show : true, backdrop: 'static', keyboard: false});
224 }, 200); 223 }, 200);
225 - // 当调用 hide 实例方法时触发  
226 $('#add_stationroute_step2_modal').on('hide.bs.modal', function () { 224 $('#add_stationroute_step2_modal').on('hide.bs.modal', function () {
227 closeMobleSetClean(); 225 closeMobleSetClean();
228 }); 226 });
229 - // 当模态框对用户可见时触发(将等待 CSS 过渡效果完成)。  
230 $('#add_stationroute_step2_modal').on('show.bs.modal', function () { 227 $('#add_stationroute_step2_modal').on('show.bs.modal', function () {
231 // 获取站点编码元素,添加站点编码值 228 // 获取站点编码元素,添加站点编码值
232 - _GetAjaxData.getStationCode(function(stationCode) {  
233 - var stationId = Station.id ? Station.id : stationCode, stationCode = Station.stationCode ? Station.stationCode : stationCode;  
234 - var stationName = Station.stationName ? Station.stationName : Station.stationNamebootbox;  
235 - var station = {id: stationId, stationCode: stationCode, stationName: stationName, centerPointWkt: Station.bJwpoints, shapedType: Station.shapesType};  
236 - var params = {station: station, line: Line, stationCode: stationCode, stationName: station.stationName, directions: Station.dir, bufferPolygonWkt: Station.bPolygonGrid, versions: $("#versions").val()}; 229 + RoutesService.getStationCode(function(stationCode) {
  230 + var stationId = addStationRoute.id ? addStationRoute.id : stationCode, stationCode = addStationRoute.stationCode ? addStationRoute.stationCode : stationCode;
  231 + var stationName = addStationRoute.stationName;
  232 + var station = {id: stationId, stationCode: stationCode, stationName: stationName, centerPointWkt: addStationRoute.centerPointWkt};
  233 + var params = {station: station, line: {id: properties.lineId}, stationCode: stationCode, stationName: stationName, directions: properties.directions, shapedType: addStationRoute.shapedType, bufferPolygonWkt: addStationRoute.bufferPolygonWkt, versions: properties.versions};
237 $('input').each(function () { 234 $('input').each(function () {
238 var name = $(this).attr('name'), value = eval('params.' + name); 235 var name = $(this).attr('name'), value = eval('params.' + name);
239 if (value) { 236 if (value) {
@@ -241,12 +238,11 @@ $(&#39;#add_stationroute_step2_modal&#39;).on(&#39;modal.show&#39;, function(e, _WorldsBMap,_Get @@ -241,12 +238,11 @@ $(&#39;#add_stationroute_step2_modal&#39;).on(&#39;modal.show&#39;, function(e, _WorldsBMap,_Get
241 } 238 }
242 }); 239 });
243 $('#stationdirSelect').val(params.directions); 240 $('#stationdirSelect').val(params.directions);
244 - // 获取图形类型元素,并添加值  
245 - if (params.station.shapedType == 'r') {  
246 - $('#shapesTypeSelect').val('圆形');  
247 - } else if (params.station.shapedType == 'd') { 241 + if (params.shapedType == 'r') {
  242 + $('#shapedTypeSelect').val('圆形');
  243 + } else if (params.shapedType == 'd') {
248 $('#radiusGroup').hide(); 244 $('#radiusGroup').hide();
249 - $('#shapesTypeSelect').val('多边形'); 245 + $('#shapedTypeSelect').val('多边形');
250 } 246 }
251 247
252 var initzdlyP = {'line.id_eq': params.line.id, 'destroy_eq': 0, 'directions_eq': params.directions, "versions_eq": params.versions}; 248 var initzdlyP = {'line.id_eq': params.line.id, 'destroy_eq': 0, 'directions_eq': params.directions, "versions_eq": params.versions};
@@ -287,8 +283,7 @@ $(&#39;#add_stationroute_step2_modal&#39;).on(&#39;modal.show&#39;, function(e, _WorldsBMap,_Get @@ -287,8 +283,7 @@ $(&#39;#add_stationroute_step2_modal&#39;).on(&#39;modal.show&#39;, function(e, _WorldsBMap,_Get
287 'directions' : {required : true,dirIs : true},// 站点方向 必填项 必填项 283 'directions' : {required : true,dirIs : true},// 站点方向 必填项 必填项
288 'stationRouteCode' : {isStart : true},// 站点序号 284 'stationRouteCode' : {isStart : true},// 站点序号
289 'stationMark' : {required : true,},// 站点类型 必填项. 285 'stationMark' : {required : true,},// 站点类型 必填项.
290 - 'bJwpoints' : {required : true,},// 经纬度坐标点 必填项.  
291 - 'shapesType' : {required : true,},// 几何图形类型 必填项. 286 + 'shapedType' : {required : true,},// 几何图形类型 必填项.
292 'radius' : {required : true,},// 几何图形类型 必填项. 287 'radius' : {required : true,},// 几何图形类型 必填项.
293 'destroy' : {required : true,},// 是否撤销 必填项. 288 'destroy' : {required : true,},// 是否撤销 必填项.
294 'toTime' : {number : true},// 到站时间 必须输入合法的数字(负数,小数)。 289 'toTime' : {number : true},// 到站时间 必须输入合法的数字(负数,小数)。
@@ -313,36 +308,28 @@ $(&#39;#add_stationroute_step2_modal&#39;).on(&#39;modal.show&#39;, function(e, _WorldsBMap,_Get @@ -313,36 +308,28 @@ $(&#39;#add_stationroute_step2_modal&#39;).on(&#39;modal.show&#39;, function(e, _WorldsBMap,_Get
313 var params = form.serializeJSON(); 308 var params = form.serializeJSON();
314 error.hide(); 309 error.hide();
315 params['station.centerPointWkt'] = 'POINT(' + params['station.centerPointWkt'] + ')'; 310 params['station.centerPointWkt'] = 'POINT(' + params['station.centerPointWkt'] + ')';
316 - params.bufferPolygonWkt = 'POLYGON((' + params.bufferPolygonWkt + '))'; 311 + params.bufferPolygonWkt = params.bufferPolygonWkt ? 'POLYGON((' + params.bufferPolygonWkt + '))' : '';
317 params.shapedType = params.shapedType == '圆形' ? 'r' : 'd'; 312 params.shapedType = params.shapedType == '圆形' ? 'r' : 'd';
318 if (params.stationRouteCode == '请选择...' && params.stationMark == 'B') { 313 if (params.stationRouteCode == '请选择...' && params.stationMark == 'B') {
319 params.stationRouteCode = '100'; 314 params.stationRouteCode = '100';
320 } else { 315 } else {
321 params.stationRouteCode = parseInt(params.stationRouteCode) + 1; 316 params.stationRouteCode = parseInt(params.stationRouteCode) + 1;
322 } 317 }
  318 + params.status = properties.status;
323 319
324 - params.status = $($("#versions").find("option:selected")[0]).attr("status");  
325 - // 保存  
326 - _GetAjaxData.addStationRoute(params,function(data) { 320 + RoutesService.addStationRoute(params, function(data) {
327 if(data.status=='SUCCESS') { 321 if(data.status=='SUCCESS') {
328 - // 弹出添加成功提示消息  
329 layer.msg('添加成功...'); 322 layer.msg('添加成功...');
330 - }else {  
331 - // 弹出添加失败提示消息 323 + } else {
332 layer.msg('添加失败...'); 324 layer.msg('添加失败...');
333 } 325 }
334 - var id =Line.id;  
335 - var dir = params.directions  
336 - // 刷行左边树  
337 - _PublicFunctions.resjtreeDate(id,dir,$("#versions").val());  
338 - closeMobleSetClean();  
339 - // 隐藏moble  
340 - hideMoble(); 326 + RoutesOperation.resjtreeDate(properties.lineId, properties.directions, properties.versions);
  327 + $('#add_stationroute_step2_modal').modal('hide');
341 }); 328 });
342 } 329 }
343 }); 330 });
344 function initSelect(p){ 331 function initSelect(p){
345 - _GetAjaxData.getzdlyInfo(p,function(array) { 332 + RoutesService.getzdlyInfo(p, function(array) {
346 // 定义路段路由长度、渲染拼音检索下拉框格式数据. 333 // 定义路段路由长度、渲染拼音检索下拉框格式数据.
347 var len_ = array.length,paramsD = new Array(); 334 var len_ = array.length,paramsD = new Array();
348 if(len_>0) { 335 if(len_>0) {
@@ -352,33 +339,23 @@ $(&#39;#add_stationroute_step2_modal&#39;).on(&#39;modal.show&#39;, function(e, _WorldsBMap,_Get @@ -352,33 +339,23 @@ $(&#39;#add_stationroute_step2_modal&#39;).on(&#39;modal.show&#39;, function(e, _WorldsBMap,_Get
352 // 判断. 339 // 判断.
353 if(g.name!='' || g.name != null) { 340 if(g.name!='' || g.name != null) {
354 // 添加拼音检索下拉框格式数据数组. 341 // 添加拼音检索下拉框格式数据数组.
355 - paramsD.push({'id':g.stationRouteCode, 'text':g.stationName + ' (' + g.stationRouteCode + ')' + ' --' + _PublicFunctions.dirdmToName(g.directions)}); 342 + paramsD.push({'id':g.stationRouteCode, 'text':g.stationName + ' (' + g.stationRouteCode + ')' + ' --' + RoutesOperation.dirdmToName(g.directions)});
356 } 343 }
357 }); 344 });
358 $('#stationrouteSelect').empty(); 345 $('#stationrouteSelect').empty();
359 // 初始化上一个路段拼音检索下拉框. 346 // 初始化上一个路段拼音检索下拉框.
360 - initPinYinSelect2($('#stationrouteSelect'),paramsD,function(selector) { 347 + initPinYinSelect2($('#stationrouteSelect'), paramsD, function(selector) {
361 }); 348 });
362 } 349 }
363 }); 350 });
364 } 351 }
  352 +
365 function closeMobleSetClean() { 353 function closeMobleSetClean() {
366 - // 清除地图覆盖物  
367 - _WorldsBMap.clearMarkAndOverlays();  
368 - /** 设置新增站点集合对象为空 */  
369 - _AddStationObj.setAddStation({});  
370 - var add_direction_v = $('#stationdirSelect').val();  
371 - var version = $("#versions").val();  
372 - PublicFunctions.resjtreeDate(Line.id,add_direction_v,version);  
373 - //_GetAjaxData.getSectionRouteInfo(Line.id,add_direction_v,version,function(data) {  
374 - // _PublicFunctions.linePanlThree(Line.id,data,add_direction_v,version);  
375 - //});  
376 - _PublicFunctions.editMapStatusRemove();  
377 - }  
378 - function hideMoble() {  
379 - // 隐藏mobal  
380 - $('#add_stationroute_step2_modal').modal('hide'); 354 + RoutesOperation.clearMarkAndOverlays();
  355 + RoutesOperation.resjtreeDate(properties.lineId, properties.directions, properties.versions);
  356 + RoutesOperation.editMapStatusRemove();
381 } 357 }
  358 +
382 // 当站点类型为中途站或者终点站时,上一站点为必填项! 359 // 当站点类型为中途站或者终点站时,上一站点为必填项!
383 $.validator.addMethod("isStart", function(value,element) { 360 $.validator.addMethod("isStart", function(value,element) {
384 var tel = false; 361 var tel = false;
@@ -395,11 +372,12 @@ $(&#39;#add_stationroute_step2_modal&#39;).on(&#39;modal.show&#39;, function(e, _WorldsBMap,_Get @@ -395,11 +372,12 @@ $(&#39;#add_stationroute_step2_modal&#39;).on(&#39;modal.show&#39;, function(e, _WorldsBMap,_Get
395 } 372 }
396 return tel; 373 return tel;
397 }, '当站点类型为中途站或者终点站时,上一站点为必填项!'); 374 }, '当站点类型为中途站或者终点站时,上一站点为必填项!');
  375 +
398 // 方向 376 // 方向
399 $.validator.addMethod("dirIs", function(value,element) { 377 $.validator.addMethod("dirIs", function(value,element) {
400 var tel = true; 378 var tel = true;
401 var stationMarkV = $('#stationdirSelect').val(); 379 var stationMarkV = $('#stationdirSelect').val();
402 - if(stationMarkV!=Station.dir){ 380 + if(stationMarkV != addStationRoute.directions){
403 tel = false; 381 tel = false;
404 } 382 }
405 return tel; 383 return tel;
src/main/resources/static/pages/base/stationroute/destroy_routes.html
1 <!-- 批量撤销选项 --> 1 <!-- 批量撤销选项 -->
2 -<div class="modal fade" id="delete_select_mobal" tabindex="-1" 2 +<div class="modal fade" id="delete_select_modal" tabindex="-1"
3 role="basic" aria-hidden="true"> 3 role="basic" aria-hidden="true">
4 <div class="modal-dialog"> 4 <div class="modal-dialog">
5 <div class="modal-content"> 5 <div class="modal-content">
@@ -37,43 +37,32 @@ @@ -37,43 +37,32 @@
37 </div> 37 </div>
38 </div> 38 </div>
39 <script type="text/javascript"> 39 <script type="text/javascript">
40 - $('#delete_select_mobal').on('deleteSelectMobal.show',function(e,ajaxd,line,fun,delBatch) {  
41 - // 加载显示mobal  
42 - $('#delete_select_mobal').modal({ 40 + $('#delete_select_modal').on('modal.show',function(event) {
  41 + $('#delete_select_modal').modal({
43 show : true, 42 show : true,
44 backdrop : 'static', 43 backdrop : 'static',
45 keyboard : false 44 keyboard : false
46 }); 45 });
47 - // 获取表单元素  
48 var form = $('#formBootbox'); 46 var form = $('#formBootbox');
49 - // 下一步点击事件  
50 $('#deleteSelectnextButton').on('click', function() { 47 $('#deleteSelectnextButton').on('click', function() {
51 - // 获取撤销类型  
52 deleteOptions = $("input[name='deleteOptions']:checked").val(); 48 deleteOptions = $("input[name='deleteOptions']:checked").val();
53 - // 表单提交  
54 form.submit(); 49 form.submit();
55 }); 50 });
56 - // 表单验证  
57 form.validate({ 51 form.validate({
58 - // 表单序列化  
59 submitHandler : function(f) { 52 submitHandler : function(f) {
60 - // 批量删除站点 (deleteOptions:0)  
61 if(deleteOptions == 0) { 53 if(deleteOptions == 0) {
62 - // 隐藏选项mobal  
63 - $('#delete_select_mobal').modal('hide');  
64 - // 加载destroy_stationroute页面 54 + // 撤销站点路由
  55 + $('#delete_select_modal').modal('hide');
65 $.get('destroy_stationroute.html', function(m){ 56 $.get('destroy_stationroute.html', function(m){
66 $(pjaxContainer).append(m); 57 $(pjaxContainer).append(m);
67 - $('#delete_station_mobal').trigger('deleteStationMobal.show', [ajaxd,line,fun,delBatch]); 58 + $('#delete_station_modal').trigger('modal.show');
68 }); 59 });
69 - // 批量删除路段(deleteOptions:1)  
70 } else if(deleteOptions == 1) { 60 } else if(deleteOptions == 1) {
71 - // 隐藏选项mobal  
72 - $('#delete_select_mobal').modal('hide');  
73 - // 加载destroy_sectionroute页面 61 + // 撤销路段路由
  62 + $('#delete_select_modal').modal('hide');
74 $.get('destroy_sectionroute.html', function(m){ 63 $.get('destroy_sectionroute.html', function(m){
75 $(pjaxContainer).append(m); 64 $(pjaxContainer).append(m);
76 - $('#delete_section_mobal').trigger('deleteSectionMobal.show', [ajaxd,line,fun,delBatch]); 65 + $('#delete_section_modal').trigger('modal.show');
77 }); 66 });
78 } 67 }
79 68
src/main/resources/static/pages/base/stationroute/destroy_sectionroute.html
1 <!-- 编辑路段 --> 1 <!-- 编辑路段 -->
2 -<div class="modal fade" id="delete_section_mobal" role="basic" 2 +<div class="modal fade" id="delete_section_modal" role="basic"
3 aria-hidden="true"> 3 aria-hidden="true">
4 <div style="margin:5% auto"> 4 <div style="margin:5% auto">
5 <div class="modal-content"> 5 <div class="modal-content">
@@ -117,10 +117,11 @@ @@ -117,10 +117,11 @@
117 {{/if}} 117 {{/if}}
118 </script> 118 </script>
119 <script type="text/javascript"> 119 <script type="text/javascript">
120 -$('#delete_section_mobal').on('deleteSectionMobal.show',function(e, ajaxd, line, fun, delBatch) { 120 +$('#delete_section_modal').on('modal.show',function(event) {
  121 + var properties = RoutesOperation.getProperties();
121 layer.closeAll(); 122 layer.closeAll();
122 // 显示mobal 123 // 显示mobal
123 - $('#delete_section_mobal').modal({ 124 + $('#delete_section_modal').modal({
124 show : true, 125 show : true,
125 backdrop : 'static', 126 backdrop : 'static',
126 keyboard : false 127 keyboard : false
@@ -132,30 +133,18 @@ $(&#39;#delete_section_mobal&#39;).on(&#39;deleteSectionMobal.show&#39;,function(e, ajaxd, line, @@ -132,30 +133,18 @@ $(&#39;#delete_section_mobal&#39;).on(&#39;deleteSectionMobal.show&#39;,function(e, ajaxd, line,
132 checked.each(function() { 133 checked.each(function() {
133 ids.push($(this).val()); 134 ids.push($(this).val());
134 }); 135 });
135 - if (ids != "" && ids != null && ids != undefined) { 136 + if (ids.length > 0) {
136 var params = {}; 137 var params = {};
137 params.ids = ids; 138 params.ids = ids;
138 - params.status = $($("#versions").find("option:selected")[0]).attr("status");  
139 - $.post('/api/lssectionroute/batchDestroy', params, function(resuntDate) {  
140 - if (resuntDate.status == 'SUCCESS') {  
141 - // 弹出添加成功提示消息 139 + params.status = properties.status;
  140 + $.post('/api/lssectionroute/batchDestroy', params, function(res) {
  141 + if (res.status == 'SUCCESS') {
142 layer.msg('撤销成功...'); 142 layer.msg('撤销成功...');
143 - /** 通知更新缓存区 */  
144 - //$.post('http://192.168.168.171:8800/transport_server/basic/refresh',function(rs) {console.log(rs)})  
145 } else { 143 } else {
146 - // 弹出添加失败提示消息  
147 layer.msg('撤销失败...'); 144 layer.msg('撤销失败...');
148 } 145 }
149 initSearch(); 146 initSearch();
150 - // 刷新左边树  
151 - fun.resjtreeDate(line.id,delBatch.dir,$("#versions").val());  
152 -  
153 - //var version = $("#versions").val();  
154 - /** 查询路段信息 @param:<Line.id:线路Id;delBatch.dir:方向> @return:data:路段数据 */  
155 - //ajaxd.getSectionRouteInfo(line.id,delBatch.dir,version,function(data) {  
156 - /** 在地图上画出线路走向 @param:<Line.id:线路Id;delBatch.dir:方向;data:路段数据> */  
157 - // fun.linePanlThree(line.id,data,delBatch.dir,version);  
158 - //}); 147 + RoutesOperation.resjtreeDate(properties.lineId, properties.directions, properties.versions);
159 }); 148 });
160 } else { 149 } else {
161 layer.msg('请选择要删除的路段!!!'); 150 layer.msg('请选择要删除的路段!!!');
@@ -183,8 +172,8 @@ $(&#39;#delete_section_mobal&#39;).on(&#39;deleteSectionMobal.show&#39;,function(e, ajaxd, line, @@ -183,8 +172,8 @@ $(&#39;#delete_section_mobal&#39;).on(&#39;deleteSectionMobal.show&#39;,function(e, ajaxd, line,
183 function getParams() { 172 function getParams() {
184 // 搜索参数集合 173 // 搜索参数集合
185 var params = {}; 174 var params = {};
186 - params['line.id_eq'] = line.id;  
187 - params.directions_eq = delBatch.dir; 175 + params['line.id_eq'] = properties.lineId;
  176 + params.directions_eq = properties.directions;
188 params.destroy_eq = 0; 177 params.destroy_eq = 0;
189 178
190 return params; 179 return params;
@@ -211,7 +200,7 @@ $(&#39;#delete_section_mobal&#39;).on(&#39;deleteSectionMobal.show&#39;,function(e, ajaxd, line, @@ -211,7 +200,7 @@ $(&#39;#delete_section_mobal&#39;).on(&#39;deleteSectionMobal.show&#39;,function(e, ajaxd, line,
211 // 记录当前页数 200 // 记录当前页数
212 params['page'] = page; 201 params['page'] = page;
213 202
214 - params.versions_eq = $("#versions").val(); 203 + params.versions_eq = properties.versions;
215 204
216 // 弹出正在加载层 205 // 弹出正在加载层
217 var i = layer.load(2); 206 var i = layer.load(2);
src/main/resources/static/pages/base/stationroute/destroy_stationroute.html
1 <!-- 编辑路段 --> 1 <!-- 编辑路段 -->
2 -<div class="modal fade" id="delete_station_mobal" role="basic" 2 +<div class="modal fade" id="delete_station_modal" role="basic"
3 aria-hidden="true"> 3 aria-hidden="true">
4 <div style="margin:5% auto"> 4 <div style="margin:5% auto">
5 <div class="modal-content"> 5 <div class="modal-content">
@@ -118,10 +118,11 @@ @@ -118,10 +118,11 @@
118 {{/if}} 118 {{/if}}
119 </script> 119 </script>
120 <script type="text/javascript"> 120 <script type="text/javascript">
121 -$('#delete_station_mobal').on('deleteStationMobal.show',function(e, ajaxd, line, fun, delBatch) { 121 +$('#delete_station_modal').on('modal.show',function(event) {
  122 + var properties = RoutesOperation.getProperties();
122 layer.closeAll(); 123 layer.closeAll();
123 // 显示mobal 124 // 显示mobal
124 - $('#delete_station_mobal').modal({ 125 + $('#delete_station_modal').modal({
125 show : true, 126 show : true,
126 backdrop : 'static', 127 backdrop : 'static',
127 keyboard : false 128 keyboard : false
@@ -133,29 +134,19 @@ $(&#39;#delete_station_mobal&#39;).on(&#39;deleteStationMobal.show&#39;,function(e, ajaxd, line, @@ -133,29 +134,19 @@ $(&#39;#delete_station_mobal&#39;).on(&#39;deleteStationMobal.show&#39;,function(e, ajaxd, line,
133 checked.each(function() { 134 checked.each(function() {
134 ids.push($(this).val()); 135 ids.push($(this).val());
135 }); 136 });
136 - if (ids != "" && ids != null && ids != undefined) { 137 + if (ids.length > 0) {
137 let params = {}; 138 let params = {};
138 params.ids = ids; 139 params.ids = ids;
139 - params.status = $($("#versions").find("option:selected")[0]).attr("status");  
140 - $.post('/api/lsstationroute/batchDestroy',params,function(resuntDate) {  
141 - if (resuntDate.status == 'SUCCESS') {  
142 - // 弹出添加成功提示消息 140 + params.status = properties.status;
  141 + $.post('/api/lsstationroute/batchDestroy',params,function(res) {
  142 + if (res.status == 'SUCCESS') {
143 layer.msg('撤销成功...'); 143 layer.msg('撤销成功...');
144 - /** 通知更新缓存区 */  
145 - //$.post('http://192.168.168.171:8800/transport_server/basic/refresh',function(rs) {console.log(rs)})  
146 } else { 144 } else {
147 - // 弹出添加失败提示消息  
148 layer.msg('撤销失败...'); 145 layer.msg('撤销失败...');
149 } 146 }
150 initSearch(); 147 initSearch();
151 // 刷新左边树 148 // 刷新左边树
152 - fun.resjtreeDate(line.id,delBatch.dir,$("#versions").val());  
153 - /** 查询路段信息 @param:<Line.id:线路Id;delBatch.dir:方向> @return:data:路段数据 */  
154 - var version = $("#versions").val();  
155 - //ajaxd.getSectionRouteInfo(line.id,delBatch.dir,version,function(data) {  
156 - /** 在地图上画出线路走向 @param:<Line.id:线路Id;delBatch.dir:方向;data:路段数据> */  
157 - // fun.linePanlThree(line.id,data,delBatch.dir,version);  
158 - //}); 149 + RoutesOperation.resjtreeDate(properties.lineId, properties.directions, properties.versions);
159 }); 150 });
160 } else { 151 } else {
161 layer.msg('请选择要删除的站点!!!'); 152 layer.msg('请选择要删除的站点!!!');
@@ -182,8 +173,8 @@ $(&#39;#delete_station_mobal&#39;).on(&#39;deleteStationMobal.show&#39;,function(e, ajaxd, line, @@ -182,8 +173,8 @@ $(&#39;#delete_station_mobal&#39;).on(&#39;deleteStationMobal.show&#39;,function(e, ajaxd, line,
182 } 173 }
183 function getParams() { 174 function getParams() {
184 var params = {}; 175 var params = {};
185 - params['line.id_eq'] = line.id;  
186 - params.directions_eq = delBatch.dir; 176 + params['line.id_eq'] = properties.lineId;
  177 + params.directions_eq = properties.directions;
187 params.destroy_eq = 0; 178 params.destroy_eq = 0;
188 179
189 return params; 180 return params;
@@ -210,7 +201,7 @@ $(&#39;#delete_station_mobal&#39;).on(&#39;deleteStationMobal.show&#39;,function(e, ajaxd, line, @@ -210,7 +201,7 @@ $(&#39;#delete_station_mobal&#39;).on(&#39;deleteStationMobal.show&#39;,function(e, ajaxd, line,
210 // 记录当前页数 201 // 记录当前页数
211 params['page'] = page; 202 params['page'] = page;
212 203
213 - params.versions_eq = $("#versions").val(); 204 + params.versions_eq = properties.versions;
214 // 弹出正在加载层 205 // 弹出正在加载层
215 var i = layer.load(2); 206 var i = layer.load(2);
216 // 异步请求获取表格数据 207 // 异步请求获取表格数据
src/main/resources/static/pages/base/stationroute/doublename_road.html
1 -<!-- 生成双路名路段路段 -->  
2 -<div class="modal fade" id="doublename_road_mobal" role="basic" aria-hidden="true" style="margin-top:10%">  
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="edit_section__form" action="/module" method="post">  
11 - <div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button>  
12 - 请选择上一路段!  
13 - </div>  
14 - <input type="hidden" name="versions" id="versionsInput">  
15 - <input type="hidden" name="directions" id="directionsSection">  
16 - <input type="hidden" name="lineId" id="lineId">  
17 - <input type="hidden" name="lineCode" id="lineCodeInput">  
18 - <input type="hidden" name="bsectionVector" id="bsectionVectorInput" />  
19 - <input type="hidden" name="dbType" id="dbTypeInput" value="b"/>  
20 - <!-- 路段序号 -->  
21 - <div class="form-body">  
22 - <div class="form-group">  
23 - <label class="control-label col-md-3">  
24 - 上一路段:  
25 - </label>  
26 - <div class="col-md-8">  
27 - <select name="sectionrouteCode" id="sectionrouteCodeSelect"></select>  
28 - <span class="help-block">说明:选择的路段将作为本站序号的参考,成为选择路段的下一个路段。 </span>  
29 - </div>  
30 - </div>  
31 - </div>  
32 - </form>  
33 - </div>  
34 - <div class="modal-footer">  
35 - <button type="button" class="btn btn-primary" id="editSectionButton">提交数据</button>  
36 - <button type="button" class="btn default" data-dismiss="modal">取消</button>  
37 - </div>  
38 - </div>  
39 - </div>  
40 -</div>  
41 -<script type="text/javascript">  
42 -  
43 - $('#doublename_road_mobal').on('doubleNameRoadMobal_show', function(e,params,map_,ajaxd,fun){  
44 - // 方向  
45 - var dir = params.directions;  
46 - var lineId = params.lineId;  
47 - var version = $("#versions").val();  
48 -  
49 - console.log(version);  
50 -  
51 - // 获取路段号元素,并添加下拉属性值  
52 - ajaxd.getStation(lineId,dir,version,function(treeData) {  
53 - var array = treeData[0].children[1].children,paramsD =new Array();  
54 - paramsD.push({'id':'启始路段(默认在所有路段的前面)','text':'启始路段(默认在所有路段的前面)'});  
55 - // 记录最后一个路段  
56 - var endRoad = 0;  
57 - // 遍历.  
58 - $.each(array, function(i, g){  
59 - // 判断.  
60 - if(g.sectionName!='' || g.sectionName != null) {  
61 - var ptions_v = g.sectionrouteCode;  
62 - if(endRoad < ptions_v)  
63 - endRoad = ptions_v;  
64 - // 添加拼音检索下拉框格式数据数组.  
65 - paramsD.push({'id':ptions_v,  
66 - 'text':g.sectionName + '(' + ptions_v + ')' + ' --' + fun.dirdmToName(g.sectionrouteDirections)});  
67 - }  
68 - });  
69 - // 初始化上一个路段拼音检索下拉框.  
70 - initPinYinSelect2($('#sectionrouteCodeSelect'),paramsD,function(selector) {  
71 - if(endRoad != 0)  
72 - $('#sectionrouteCodeSelect').select2('val',endRoad);  
73 - else  
74 - $('#sectionrouteCodeSelect').select2('val','启始路段(默认在所有路段的前面)');  
75 - });  
76 - });  
77 - // 显示mobal  
78 - $('#doublename_road_mobal').modal({show : true,backdrop: 'static',keyboard: false});  
79 - // 当调用 hide 实例方法时触发  
80 - $('#doublename_road_mobal').on('hide.bs.modal', function () {  
81 - closeMobleSetClean();  
82 - });  
83 - function closeMobleSetClean() {  
84 - // 清除地图覆盖物  
85 - // map_.clearMarkAndOverlays();  
86 - fun.resjtreeDate(lineId,dir,$("#versions").val());  
87 - fun.editAChangeCssRemoveDisabled();  
88 - // var version = $("#versions").val();  
89 - //ajaxd.getSectionRouteInfo(lineId,dir,version,function(data) {  
90 - // fun.linePanlThree(lineId,data,dir,version);  
91 - //});  
92 - }  
93 - // 编辑表单元素  
94 - var form = $('#edit_section__form');  
95 - // 获取错误提示元素  
96 - var error = $('.alert-danger', form);  
97 - // 提交数据按钮事件  
98 - $('#editSectionButton').on('click', function() {  
99 - // 表单提交  
100 - form.submit();  
101 - });  
102 - // 表单验证  
103 - form.validate({  
104 - errorElement : 'span',  
105 - errorClass : 'help-block help-block-error',  
106 - focusInvalid : false,  
107 - /* rules : {  
108 - 'sectionrouteCode': {required : true}// 路由序号 必填项  
109 - },*/  
110 - invalidHandler : function(event, validator) {  
111 - error.show();  
112 - App.scrollTo(error, -200);  
113 - },  
114 - highlight : function(element) {  
115 - $(element).closest('.form-group').addClass('has-error');  
116 - },  
117 - unhighlight : function(element) {  
118 - $(element).closest('.form-group').removeClass('has-error');  
119 - },  
120 - success : function(label) {  
121 - label.closest('.form-group').removeClass('has-error');  
122 - },  
123 - submitHandler : function(f) {  
124 - var data = form.serializeJSON();  
125 - if(data.sectionrouteCode=='启始路段(默认在所有路段的前面)') {  
126 - params.sectionrouteCode = '';  
127 - } else {  
128 - params.sectionrouteCode = data.sectionrouteCode;  
129 - }  
130 - // 获取版本  
131 - //$.get("/lineVersions/findCurrentVersion", {"lineId" : lineId}, function (versions) {  
132 - //params.versions = versions;  
133 - params.versions = $("#versions").val();  
134 - // 生成路段  
135 - $.post('/section/doubleName',params,function (resuntDate) {  
136 - if(resuntDate.status=='SUCCESS') {  
137 - // 弹出添加成功提示消息  
138 - layer.msg('生成成功...');  
139 - } else if (resuntDate.status=='Failure') {  
140 - layer.msg('抱歉,您选取的路段基于高德地图的数据无法生成双路段!');  
141 - } else {  
142 - // 弹出添加失败提示消息  
143 - layer.msg('生成失败...');  
144 - }  
145 - $('#doublename_road_mobal').modal('hide');  
146 - var dir = params.directions;  
147 - // 刷行左边树  
148 - fun.resjtreeDate(lineId,dir,$("#versions").val());  
149 - closeMobleSetClean();  
150 - });  
151 - //});  
152 -  
153 - }  
154 - });  
155 - }); 1 +<!-- 生成双路名路段路段 -->
  2 +<div class="modal fade" id="doublename_road_modal" role="basic" aria-hidden="true" style="margin-top:10%">
  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="edit_section__form" action="/module" method="post">
  11 + <div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button>
  12 + 请选择上一路段!
  13 + </div>
  14 + <input type="hidden" name="versions" id="versionsInput">
  15 + <input type="hidden" name="directions" id="directionsSection">
  16 + <input type="hidden" name="lineId" id="lineId">
  17 + <input type="hidden" name="lineCode" id="lineCodeInput">
  18 + <input type="hidden" name="bsectionVector" id="bsectionVectorInput" />
  19 + <input type="hidden" name="dbType" id="dbTypeInput" value="b"/>
  20 + <!-- 路段序号 -->
  21 + <div class="form-body">
  22 + <div class="form-group">
  23 + <label class="control-label col-md-3">
  24 + 上一路段:
  25 + </label>
  26 + <div class="col-md-8">
  27 + <select name="sectionrouteCode" id="sectionrouteCodeSelect"></select>
  28 + <span class="help-block">说明:选择的路段将作为本站序号的参考,成为选择路段的下一个路段。 </span>
  29 + </div>
  30 + </div>
  31 + </div>
  32 + </form>
  33 + </div>
  34 + <div class="modal-footer">
  35 + <button type="button" class="btn btn-primary" id="editSectionButton">提交数据</button>
  36 + <button type="button" class="btn default" data-dismiss="modal">取消</button>
  37 + </div>
  38 + </div>
  39 + </div>
  40 +</div>
  41 +<script type="text/javascript">
  42 + $('#doublename_road_modal').on('modal.show', function(event, params){
  43 + var properties = RoutesOperation.getProperties();
  44 + RoutesService.getStation(properties.lineId, properties.directions, properties.versions, function(routes) {
  45 + var array = routes.sectionRoutes, paramsD = new Array();
  46 + paramsD.push({'id':'启始路段(默认在所有路段的前面)','text':'启始路段(默认在所有路段的前面)'});
  47 + var endRoad = 0;
  48 + $.each(array, function(i, item){
  49 + var sectionName = item.section.sectionName;
  50 + if(sectionName != '' || sectionName != null) {
  51 + var sectionrouteCode = item.sectionrouteCode;
  52 + if(endRoad < sectionrouteCode)
  53 + endRoad = sectionrouteCode;
  54 + paramsD.push({'id': sectionrouteCode, 'text': sectionName + '(' + sectionrouteCode + ')' + ' --' + RoutesOperation.dirdmToName(item.directions)});
  55 + }
  56 + });
  57 + initPinYinSelect2($('#sectionrouteCodeSelect'),paramsD,function(selector) {
  58 + if(endRoad != 0)
  59 + $('#sectionrouteCodeSelect').select2('val',endRoad);
  60 + else
  61 + $('#sectionrouteCodeSelect').select2('val','启始路段(默认在所有路段的前面)');
  62 + });
  63 + });
  64 + $('#doublename_road_modal').modal({show : true,backdrop: 'static',keyboard: false});
  65 + $('#doublename_road_modal').on('hide.bs.modal', function () {
  66 + closeMobleSetClean();
  67 + });
  68 + function closeMobleSetClean() {
  69 + RoutesOperation.resjtreeDate(properties.lineId, properties.directions, properties.versions);
  70 + RoutesOperation.editAChangeCssRemoveDisabled();
  71 + }
  72 + var form = $('#edit_section__form');
  73 + var error = $('.alert-danger', form);
  74 + $('#editSectionButton').on('click', function() {
  75 + form.submit();
  76 + });
  77 + form.validate({
  78 + errorElement : 'span',
  79 + errorClass : 'help-block help-block-error',
  80 + focusInvalid : false,
  81 + invalidHandler : function(event, validator) {
  82 + error.show();
  83 + App.scrollTo(error, -200);
  84 + },
  85 + highlight : function(element) {
  86 + $(element).closest('.form-group').addClass('has-error');
  87 + },
  88 + unhighlight : function(element) {
  89 + $(element).closest('.form-group').removeClass('has-error');
  90 + },
  91 + success : function(label) {
  92 + label.closest('.form-group').removeClass('has-error');
  93 + },
  94 + submitHandler : function(f) {
  95 + var data = form.serializeJSON();
  96 + if(data.sectionrouteCode=='启始路段(默认在所有路段的前面)') {
  97 + params.sectionrouteCode = '';
  98 + } else {
  99 + params.sectionrouteCode = data.sectionrouteCode;
  100 + }
  101 + params.versions = properties.versions;
  102 + $.post('/section/doubleName', params, function (res) {
  103 + if(res.status == 'SUCCESS') {
  104 + layer.msg('生成成功...');
  105 + } else if (res.status == 'Failure') {
  106 + layer.msg('抱歉,您选取的路段基于高德地图的数据无法生成双路段!');
  107 + } else {
  108 + layer.msg('生成失败...');
  109 + }
  110 + $('#doublename_road_modal').modal('hide');
  111 + RoutesOperation.resjtreeDate(properties.lineId, properties.directions, properties.versions);
  112 + closeMobleSetClean();
  113 + });
  114 + }
  115 + });
  116 + });
156 </script> 117 </script>
157 \ No newline at end of file 118 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/edit_sectionroute.html
@@ -55,59 +55,49 @@ @@ -55,59 +55,49 @@
55 </div> 55 </div>
56 <script type="text/javascript"> 56 <script type="text/javascript">
57 57
58 -$('#edit_sectionroute_modal').on('modal.show', function(e, map_,ajaxd,p,fun){  
59 - var Section = p.data;  
60 - fun.setSectionFormValue(Section);  
61 - // 方向  
62 - var dir = Section.directions;  
63 - var lineId = Section.line.id;  
64 - var version = Section.versions;  
65 - // 获取路段号元素,并添加下拉属性值  
66 - ajaxd.getStation(lineId, dir, version, function(routes) { 58 +$('#edit_sectionroute_modal').on('modal.show', function(e, polyline){
  59 + var properties = RoutesOperation.getProperties();
  60 + var sectionRoute = polyline.data;
  61 + RoutesOperation.setSectionFormValue(sectionRoute);
  62 + RoutesService.getStation(properties.lineId, properties.directions, properties.versions, function(routes) {
67 var array = routes.sectionRoutes, paramsD =new Array(); 63 var array = routes.sectionRoutes, paramsD =new Array();
68 - var eq_scetionRouteCode = Section.sectionrouteCode; 64 + var eq_scetionRouteCode = sectionRoute.sectionrouteCode;
  65 + var previous = '请选择...', last;
69 paramsD.push({'id':'请选择...','text':'将此路段设置位第一个路段'}); 66 paramsD.push({'id':'请选择...','text':'将此路段设置位第一个路段'});
70 - // 遍历.  
71 $.each(array, function(i, g){ 67 $.each(array, function(i, g){
72 - // 判断.  
73 - if(g.section.sectionName!='' || g.section.sectionName != null) { 68 + if (g.section.sectionName) {
74 var ptions_v = g.sectionrouteCode; 69 var ptions_v = g.sectionrouteCode;
75 - if(eq_scetionRouteCode != ptions_v){ 70 + if (eq_scetionRouteCode != ptions_v) {
76 // 添加拼音检索下拉框格式数据数组. 71 // 添加拼音检索下拉框格式数据数组.
77 - paramsD.push({'id':ptions_v,  
78 - 'text':g.section.sectionName + '(' + ptions_v + ')' + ' --' + fun.dirdmToName(g.directions)}); 72 + paramsD.push({'id':ptions_v, 'text':g.section.sectionName + '(' + ptions_v + ')' + ' --' + RoutesOperation.dirdmToName(g.directions)});
  73 + last = ptions_v;
  74 + } else {
  75 + previous = last;
79 } 76 }
80 } 77 }
81 }); 78 });
82 - // 初始化上一个路段拼音检索下拉框.  
83 - initPinYinSelect2($('#sectionrouteCodeSelect'),paramsD,function(selector) {  
84 - $('#sectionDirSelect').val('');// 设值方向.  
85 - ajaxd.findUpSectionRouteCode(lineId, dir, eq_scetionRouteCode, version, function(str) {  
86 - if (str.length > 0) {  
87 - var upStationRouteCode = str[0].sectionrouteCode;  
88 - $('#sectionrouteCodeSelect').select2('val',upStationRouteCode);  
89 - } else {  
90 - $('#sectionrouteCodeSelect').select2('val','请选择...');  
91 - }  
92 - }); 79 + $('#sectionrouteCodeSelect').empty();
  80 + initPinYinSelect2($('#sectionrouteCodeSelect'), paramsD, function(selector) {
  81 + if (paramsD.length > 0) {
  82 + $('#sectionrouteCodeSelect').select2('val', previous);
  83 + } else {
  84 + $('#sectionrouteCodeSelect').select2('val', '请选择...');
  85 + }
93 }); 86 });
94 }); 87 });
95 // 显示mobal 88 // 显示mobal
96 - $('#edit_sectionroute_modal').modal({show : true,backdrop: 'static',keyboard: false});// 89 + $('#edit_sectionroute_modal').modal({show: true, backdrop: 'static', keyboard: false});
97 // 当调用 hide 实例方法时触发 90 // 当调用 hide 实例方法时触发
98 $('#edit_sectionroute_modal').on('hide.bs.modal', function () { 91 $('#edit_sectionroute_modal').on('hide.bs.modal', function () {
99 closeMobleSetClean(); 92 closeMobleSetClean();
100 }); 93 });
101 function closeMobleSetClean() { 94 function closeMobleSetClean() {
102 // 清除地图覆盖物 95 // 清除地图覆盖物
103 - map_.clearMarkAndOverlays();  
104 - fun.resjtreeDate(lineId,dir,$("#versions").val());  
105 - fun.editAChangeCssRemoveDisabled();  
106 - //ajaxd.getSectionRouteInfo(lineId,dir,$("#versions").val(),function(data) {  
107 - // fun.linePanlThree(lineId,data,dir);  
108 - //}); 96 + RoutesOperation.clearMarkAndOverlays();
  97 + RoutesOperation.resjtreeDate(properties.lineId, properties.directions, properties.versions);
  98 + RoutesOperation.editAChangeCssRemoveDisabled();
109 setTimeout(function () { 99 setTimeout(function () {
110 - map_.openSectionInfoWin(p); 100 + RoutesOperation.openSectionInfoWin(polyline);
111 },1000); 101 },1000);
112 } 102 }
113 // 编辑表单元素 103 // 编辑表单元素
@@ -125,7 +115,7 @@ $(&#39;#edit_sectionroute_modal&#39;).on(&#39;modal.show&#39;, function(e, map_,ajaxd,p,fun){ @@ -125,7 +115,7 @@ $(&#39;#edit_sectionroute_modal&#39;).on(&#39;modal.show&#39;, function(e, map_,ajaxd,p,fun){
125 errorClass : 'help-block help-block-error', 115 errorClass : 'help-block help-block-error',
126 focusInvalid : false, 116 focusInvalid : false,
127 rules : { 117 rules : {
128 - 'sectionName' : {required : true,maxlength:50} 118 + 'sectionName' : {required : true, maxlength:50}
129 }, 119 },
130 invalidHandler : function(event, validator) { 120 invalidHandler : function(event, validator) {
131 error.show(); 121 error.show();
@@ -152,17 +142,13 @@ $(&#39;#edit_sectionroute_modal&#39;).on(&#39;modal.show&#39;, function(e, map_,ajaxd,p,fun){ @@ -152,17 +142,13 @@ $(&#39;#edit_sectionroute_modal&#39;).on(&#39;modal.show&#39;, function(e, map_,ajaxd,p,fun){
152 } else { 142 } else {
153 params.sectionrouteCode = parseInt(params.sectionrouteCode) + 1; 143 params.sectionrouteCode = parseInt(params.sectionrouteCode) + 1;
154 } 144 }
155 - ajaxd.sectionUpdate(params,function(resuntDate) {  
156 - if(resuntDate.status=='SUCCESS') {  
157 - // 弹出添加成功提示消息 145 + RoutesService.sectionUpdate(params,function(res) {
  146 + if(res.status == 'SUCCESS') {
158 layer.msg('修改成功...'); 147 layer.msg('修改成功...');
159 }else { 148 }else {
160 - // 弹出添加失败提示消息  
161 layer.msg('修改失败...'); 149 layer.msg('修改失败...');
162 } 150 }
163 $('#edit_sectionroute_modal').modal('hide'); 151 $('#edit_sectionroute_modal').modal('hide');
164 - var dir = params.directions  
165 - closeMobleSetClean();  
166 }); 152 });
167 } 153 }
168 }); 154 });
src/main/resources/static/pages/base/stationroute/edit_stationroute_step1.html
@@ -10,14 +10,14 @@ @@ -10,14 +10,14 @@
10 </div> 10 </div>
11 <div class="modal-body"> 11 <div class="modal-body">
12 <form class="form-horizontal" action="/" method="post" id="edit_select" role="form"> 12 <form class="form-horizontal" action="/" method="post" id="edit_select" role="form">
13 - <div class="alert alert-danger display-hide" id="editSelectrequired"> 13 + <div class="alert alert-danger display-hide" id="error">
14 <button class="close" data-close="alert"></button> 14 <button class="close" data-close="alert"></button>
15 站点名称为必填项 15 站点名称为必填项
16 </div> 16 </div>
17 <div class="form-group" id="formRequ"> 17 <div class="form-group" id="formRequ">
18 <label class="col-md-3 control-label"><span class="required"> * </span>站点名称:</label> 18 <label class="col-md-3 control-label"><span class="required"> * </span>站点名称:</label>
19 <div class="col-md-9" id="errorInfo"> 19 <div class="col-md-9" id="errorInfo">
20 - <input type="text" class="form-control input-medium" id="stationNamebootbox" name="stationNamebootbox"> 20 + <input type="text" class="form-control input-medium" id="stationName" name="stationName">
21 </div> 21 </div>
22 </div> 22 </div>
23 <div class="form-group"> 23 <div class="form-group">
@@ -47,8 +47,9 @@ @@ -47,8 +47,9 @@
47 </div> 47 </div>
48 <script type="text/javascript"> 48 <script type="text/javascript">
49 49
50 -$('#edit_stationroute_step1_modal').on('modal.show', function(e, _WorldsBMap,_DrawingManagerObj,_GetAjaxData,_EditStationObj,_LineObj,_PublicFunctions,Station){  
51 - // 显示选择修改方式弹出层 50 +$('#edit_stationroute_step1_modal').on('modal.show', function(event){
  51 + var editStationRoute = RoutesOperation.getEditStationRoute();
  52 + $('#stationName').val(editStationRoute.stationName);
52 $('#edit_stationroute_step1_modal').modal({show: true,backdrop: 'static',keyboard: false}); 53 $('#edit_stationroute_step1_modal').modal({show: true,backdrop: 'static',keyboard: false});
53 setTimeout(function(){ 54 setTimeout(function(){
54 var offsetY = $('.modal-dialog').offset().top-3 , 55 var offsetY = $('.modal-dialog').offset().top-3 ,
@@ -69,15 +70,10 @@ $(&#39;#edit_stationroute_step1_modal&#39;).on(&#39;modal.show&#39;, function(e, _WorldsBMap,_Dr @@ -69,15 +70,10 @@ $(&#39;#edit_stationroute_step1_modal&#39;).on(&#39;modal.show&#39;, function(e, _WorldsBMap,_Dr
69 $('.tipso-animation').tipso('show'); 70 $('.tipso-animation').tipso('show');
70 setTimeout(function(){$('.tipso-animation').tipso('hide');},4000); 71 setTimeout(function(){$('.tipso-animation').tipso('hide');},4000);
71 },500); 72 },500);
72 - // 获取站点名称元素并赋值  
73 - $('#stationNamebootbox').val(Station.stationName);  
74 - // 获取表单元素 73 +
75 var form = $('#edit_select'); 74 var form = $('#edit_select');
76 - // 获取错误提示元素  
77 - var editSelectrequired = $('#editSelectrequired', form);  
78 - // 下一步操作事件 75 + var error = $('#error', form);
79 $('#editselectStationNextButton').on('click', function() { 76 $('#editselectStationNextButton').on('click', function() {
80 - // 表单提交  
81 form.submit(); 77 form.submit();
82 }); 78 });
83 //form 表单验证 79 //form 表单验证
@@ -86,11 +82,11 @@ $(&#39;#edit_stationroute_step1_modal&#39;).on(&#39;modal.show&#39;, function(e, _WorldsBMap,_Dr @@ -86,11 +82,11 @@ $(&#39;#edit_stationroute_step1_modal&#39;).on(&#39;modal.show&#39;, function(e, _WorldsBMap,_Dr
86 errorClass : 'help-block help-block-error', 82 errorClass : 'help-block help-block-error',
87 focusInvalid : false, 83 focusInvalid : false,
88 rules : { 84 rules : {
89 - 'stationNamebootbox' : {required : true,maxlength : 50} 85 + 'stationName' : {required : true, maxlength : 50}
90 }, 86 },
91 invalidHandler : function(event, validator) { 87 invalidHandler : function(event, validator) {
92 - editSelectrequired.show();  
93 - App.scrollTo(editSelectrequired, -200); 88 + error.show();
  89 + App.scrollTo(error, -200);
94 }, 90 },
95 highlight : function(element) { 91 highlight : function(element) {
96 $(element).closest('.form-group').addClass('has-error'); 92 $(element).closest('.form-group').addClass('has-error');
@@ -105,32 +101,24 @@ $(&#39;#edit_stationroute_step1_modal&#39;).on(&#39;modal.show&#39;, function(e, _WorldsBMap,_Dr @@ -105,32 +101,24 @@ $(&#39;#edit_stationroute_step1_modal&#39;).on(&#39;modal.show&#39;, function(e, _WorldsBMap,_Dr
105 // 隐藏弹出层 101 // 隐藏弹出层
106 $('#edit_stationroute_step1_modal').modal('hide'); 102 $('#edit_stationroute_step1_modal').modal('hide');
107 103
108 - // 表单序列  
109 var params = form.serializeJSON(); 104 var params = form.serializeJSON();
110 - // 站点名称  
111 - var editStationName = params.stationNamebootbox; 105 + var stationName = params.stationName;
  106 + editStationRoute.stationName = stationName;
112 // TODO(点击查询位置后绘画效果失败,待修改) 107 // TODO(点击查询位置后绘画效果失败,待修改)
113 if (params.editselect == 0) { 108 if (params.editselect == 0) {
114 - _EditStationObj.setEditStation(Station);  
115 - _EditStationObj.setEditStationName(editStationName);  
116 - _WorldsBMap.getmapBValue().closeInfoWindow();  
117 - _DrawingManagerObj.openDrawingManager(); 109 + RoutesOperation.getBaiduMap().closeInfoWindow();
  110 + RoutesOperation.openDrawingManager();
118 } else if (params.editselect == 1) { 111 } else if (params.editselect == 1) {
119 - Station.shapedType = 'r';  
120 - Station.bufferPolygonWkt = null;  
121 - Station.radius = 80;  
122 - _EditStationObj.setEditStation(Station);  
123 - _EditStationObj.setEditStationName(editStationName);  
124 - _WorldsBMap.editShapes(_EditStationObj); 112 + editStationRoute.shapedType = 'r';
  113 + editStationRoute.bufferPolygonWkt = null;
  114 + editStationRoute.radius = 80;
  115 + RoutesOperation.editShapes(editStationRoute);
125 } else if (params.editselect == 2){ 116 } else if (params.editselect == 2){
126 - _EditStationObj.setEditStation(Station);  
127 - _EditStationObj.setEditStationName(editStationName);  
128 - _WorldsBMap.clearMark();  
129 - // 弹出添加失败提示消息,2秒关闭(如果不配置,默认是3秒) 117 + RoutesOperation.clearMark();
130 layer.msg('编辑完图形后,请双击图形区域保存', {offset: '126px', shift: 0, time: 3000}); 118 layer.msg('编辑完图形后,请双击图形区域保存', {offset: '126px', shift: 0, time: 3000});
131 - _WorldsBMap.editShapes(_EditStationObj); 119 + RoutesOperation.editShapes(editStationRoute);
132 } 120 }
133 - _PublicFunctions.editMapStatus(_EditStationObj.getEditStation().directions); 121 + RoutesOperation.editMapStatus(editStationRoute.directions);
134 } 122 }
135 }); 123 });
136 }) 124 })
src/main/resources/static/pages/base/stationroute/edit_stationroute_step2.html
@@ -110,7 +110,7 @@ @@ -110,7 +110,7 @@
110 <div class="form-group"> 110 <div class="form-group">
111 <label class="col-md-3 control-label"><span class="required"> * </span>几何图形类型:</label> 111 <label class="col-md-3 control-label"><span class="required"> * </span>几何图形类型:</label>
112 <div class="col-md-6"> 112 <div class="col-md-6">
113 - <input type="text" class="form-control" name="shapedType" id="shapesTypeSelect" placeholder="几何图形类型" readonly="readonly" /> 113 + <input type="text" class="form-control" name="shapedType" id="shapedTypeSelect" placeholder="几何图形类型" readonly="readonly" />
114 </div> 114 </div>
115 </div> 115 </div>
116 </div> 116 </div>
@@ -184,12 +184,12 @@ @@ -184,12 +184,12 @@
184 </div> 184 </div>
185 </div> 185 </div>
186 <script type="text/javascript"> 186 <script type="text/javascript">
187 -$('#edit_stationroute_step2_modal').on('modal.show', function(e, _WorldsBMap,_GetAjaxData,_EditStationObj,_LineObj,_PublicFunctions){ 187 +$('#edit_stationroute_step2_modal').on('modal.show', function(event){
188 layer.closeAll(); 188 layer.closeAll();
189 - var stationRoute = _EditStationObj.getEditStation();  
190 - var line = _LineObj.getLineObj();  
191 - _PublicFunctions.setFormValue(stationRoute);  
192 - var initzdlyP = {'lineCode_eq': stationRoute.lineCode, 'destroy_eq': 0, 'directions_eq': stationRoute.directions, 'versions_eq': stationRoute.versions}; 189 + var editStationRoute = RoutesOperation.getEditStationRoute();
  190 + var properties = RoutesOperation.getProperties();
  191 + RoutesOperation.setFormValue(editStationRoute);
  192 + var initzdlyP = {'lineCode_eq': editStationRoute.lineCode, 'destroy_eq': 0, 'directions_eq': editStationRoute.directions, 'versions_eq': editStationRoute.versions};
193 initSelect(initzdlyP); 193 initSelect(initzdlyP);
194 // 显示mobal 194 // 显示mobal
195 $('#edit_stationroute_step2_modal').modal({show: true, backdrop: 'static', keyboard: false}); 195 $('#edit_stationroute_step2_modal').modal({show: true, backdrop: 'static', keyboard: false});
@@ -197,24 +197,17 @@ $(&#39;#edit_stationroute_step2_modal&#39;).on(&#39;modal.show&#39;, function(e, _WorldsBMap,_Ge @@ -197,24 +197,17 @@ $(&#39;#edit_stationroute_step2_modal&#39;).on(&#39;modal.show&#39;, function(e, _WorldsBMap,_Ge
197 $('#edit_stationroute_step2_modal').on('hide.bs.modal', function () { 197 $('#edit_stationroute_step2_modal').on('hide.bs.modal', function () {
198 closeMobleSetClean(); 198 closeMobleSetClean();
199 }); 199 });
200 - $('#statusInput').val(line.status); 200 + $('#statusInput').val(properties.status);
201 function closeMobleSetClean() { 201 function closeMobleSetClean() {
202 // 清除地图覆盖物 202 // 清除地图覆盖物
203 - _WorldsBMap.clearMarkAndOverlays();  
204 - var version = $("#versions").val();  
205 - /** 设置新增站点集合对象为空 */  
206 - _EditStationObj.setEditStation({});  
207 -  
208 - var add_direction_v = $('#stationdirSelect').val();  
209 - _PublicFunctions.resjtreeDate(line.id,add_direction_v,version);  
210 - _PublicFunctions.editAChangeCssRemoveDisabled();  
211 - //console.log(_WorldsBMap.getStationArray());  
212 - _PublicFunctions.editMapStatusRemove(); 203 + RoutesOperation.clearMarkAndOverlays();
  204 + RoutesOperation.resjtreeDate(properties.lineId, properties.directions, properties.versions);
  205 + RoutesOperation.editAChangeCssRemoveDisabled();
  206 + RoutesOperation.editMapStatusRemove();
213 setTimeout(function () { 207 setTimeout(function () {
214 - var stationArray = _WorldsBMap.getStationArray();  
215 - console.log(_WorldsBMap.getStationArray());  
216 - _WorldsBMap.openStationRouteInfoWin(stationArray[stationRoute.id]);  
217 - },1000); 208 + var stationArray = RoutesOperation.getStationArray();
  209 + RoutesOperation.openStationRouteInfoWin(stationArray[editStationRoute.id]);
  210 + }, 1000);
218 } 211 }
219 // 编辑表单元素 212 // 编辑表单元素
220 var form = $('#edit_stationroute_form'); 213 var form = $('#edit_stationroute_form');
@@ -236,7 +229,7 @@ $(&#39;#edit_stationroute_step2_modal&#39;).on(&#39;modal.show&#39;, function(e, _WorldsBMap,_Ge @@ -236,7 +229,7 @@ $(&#39;#edit_stationroute_step2_modal&#39;).on(&#39;modal.show&#39;, function(e, _WorldsBMap,_Ge
236 'directions' : {required : true,dirIs : true},// 站点方向 必填项 必填项 229 'directions' : {required : true,dirIs : true},// 站点方向 必填项 必填项
237 'stationRouteCode' : {isStart : true},// 站点序号 230 'stationRouteCode' : {isStart : true},// 站点序号
238 'stationMark' : {required : true},// 站点类型 必填项 231 'stationMark' : {required : true},// 站点类型 必填项
239 - 'shapesType' : {required : true},// 几何图形类型 必填项 232 + 'shapedType' : {required : true},// 几何图形类型 必填项
240 'radius' : {required : true,number : true},// 圆形半径 必填项 233 'radius' : {required : true,number : true},// 圆形半径 必填项
241 'destroy' : {required : true},// 是否撤销 必填项 234 'destroy' : {required : true},// 是否撤销 必填项
242 'toTime' : {number : true},// 到站时间 必须输入合法的数字(负数,小数)。 235 'toTime' : {number : true},// 到站时间 必须输入合法的数字(负数,小数)。
@@ -272,18 +265,14 @@ $(&#39;#edit_stationroute_step2_modal&#39;).on(&#39;modal.show&#39;, function(e, _WorldsBMap,_Ge @@ -272,18 +265,14 @@ $(&#39;#edit_stationroute_step2_modal&#39;).on(&#39;modal.show&#39;, function(e, _WorldsBMap,_Ge
272 params.bufferPolygonWkt = "POLYGON((" + params.bufferPolygonWkt + "))"; 265 params.bufferPolygonWkt = "POLYGON((" + params.bufferPolygonWkt + "))";
273 } 266 }
274 // 保存 267 // 保存
275 - _GetAjaxData.modifyStationRoute(params, function(data) { 268 + RoutesService.modifyStationRoute(params, function(data) {
276 if (data.status == 'SUCCESS') { 269 if (data.status == 'SUCCESS') {
277 layer.msg('修改成功...'); 270 layer.msg('修改成功...');
278 } else { 271 } else {
279 layer.msg('修改失败...'); 272 layer.msg('修改失败...');
280 } 273 }
281 $('#edit_stationroute_step2_modal').modal('hide'); 274 $('#edit_stationroute_step2_modal').modal('hide');
282 - var id = line.id;  
283 - var dir = params.directions  
284 - // 刷行左边树  
285 - _PublicFunctions.resjtreeDate(id, dir, $("#versions").val());  
286 - //closeMobleSetClean(); 275 + RoutesOperation.resjtreeDate(properties.lineId, properties.directions, properties.versions);
287 }); 276 });
288 } 277 }
289 }); 278 });
@@ -305,27 +294,23 @@ $(&#39;#edit_stationroute_step2_modal&#39;).on(&#39;modal.show&#39;, function(e, _WorldsBMap,_Ge @@ -305,27 +294,23 @@ $(&#39;#edit_stationroute_step2_modal&#39;).on(&#39;modal.show&#39;, function(e, _WorldsBMap,_Ge
305 var prevObj = {'id':'-1','text':'请选择...'}; 294 var prevObj = {'id':'-1','text':'请选择...'};
306 var obj = {'id':'-1','text':'请选择...'}; 295 var obj = {'id':'-1','text':'请选择...'};
307 296
308 - _GetAjaxData.getzdlyInfo(p,function(array) { 297 + RoutesService.getzdlyInfo(p, function(array) {
309 // 定义路段路由长度、渲染拼音检索下拉框格式数据. 298 // 定义路段路由长度、渲染拼音检索下拉框格式数据.
310 - var len_ = array.length,paramsD = new Array(); 299 + var len_ = array.length, paramsD = new Array();
311 if(len_>0) { 300 if(len_>0) {
312 paramsD.push({'id':'-1','text':'请选择...'}); 301 paramsD.push({'id':'-1','text':'请选择...'});
313 // 遍历. 302 // 遍历.
314 $.each(array, function(i, g){ 303 $.each(array, function(i, g){
315 - // 判断.  
316 - if(g.name!='' || g.name != null) {  
317 - if(g.stationRouteCode != stationRoute.stationRouteCode) {  
318 - // 添加拼音检索下拉框格式数据数组.  
319 - if(stationRoute.stationMark=='E' && i == (len_-2)){  
320 - obj = {'id':g.stationRouteCode + '_' + 'E' + '_' + g.directions,  
321 - 'text':g.stationName + ' (' + g.stationRouteCode + ')' + ' --' + _PublicFunctions.dirdmToName(g.directions)}; 304 + if(g.stationName) {
  305 + if (g.stationRouteCode != editStationRoute.stationRouteCode) {
  306 + if (editStationRoute.stationMark == 'E' && i == (len_ - 2)){
  307 + obj = {'id':g.stationRouteCode + '_' + 'E' + '_' + g.directions, 'text':g.stationName + ' (' + g.stationRouteCode + ')' + ' --' + RoutesOperation.dirdmToName(g.directions)};
322 paramsD.push(obj); 308 paramsD.push(obj);
323 - }else {  
324 - obj = {'id':g.stationRouteCode + '_' + g.stationMark + '_' + g.directions,  
325 - 'text':g.stationName + ' (' + g.stationRouteCode + ')' + ' --' + _PublicFunctions.dirdmToName(g.directions)}; 309 + } else {
  310 + obj = {'id':g.stationRouteCode + '_' + g.stationMark + '_' + g.directions, 'text':g.stationName + ' (' + g.stationRouteCode + ')' + ' --' + RoutesOperation.dirdmToName(g.directions)};
326 paramsD.push(obj); 311 paramsD.push(obj);
327 } 312 }
328 - }else{ 313 + } else {
329 prevObj = obj ; 314 prevObj = obj ;
330 } 315 }
331 } 316 }
@@ -334,7 +319,7 @@ $(&#39;#edit_stationroute_step2_modal&#39;).on(&#39;modal.show&#39;, function(e, _WorldsBMap,_Ge @@ -334,7 +319,7 @@ $(&#39;#edit_stationroute_step2_modal&#39;).on(&#39;modal.show&#39;, function(e, _WorldsBMap,_Ge
334 // 初始化上一个路段拼音检索下拉框. 319 // 初始化上一个路段拼音检索下拉框.
335 initPinYinSelect2($('#stationrouteSelect'),paramsD,function(selector) { 320 initPinYinSelect2($('#stationrouteSelect'),paramsD,function(selector) {
336 $('#stationrouteSelect').val(prevObj.id).select2(); 321 $('#stationrouteSelect').val(prevObj.id).select2();
337 - $('#stationMarkSelect').val(stationRoute.stationMark); 322 + $('#stationMarkSelect').val(editStationRoute.stationMark);
338 }); 323 });
339 324
340 } 325 }
src/main/resources/static/pages/base/stationroute/editsection_inout.html
1 <!-- 编辑路段 --> 1 <!-- 编辑路段 -->
2 -<div class="modal fade" id="edit_section_mobal" role="basic" aria-hidden="true"> 2 +<div class="modal fade" id="edit_section_modal" role="basic" aria-hidden="true">
3 <div class="modal-dialog"> 3 <div class="modal-dialog">
4 <div class="modal-content"> 4 <div class="modal-content">
5 <div class="modal-header"> 5 <div class="modal-header">
@@ -12,20 +12,12 @@ @@ -12,20 +12,12 @@
12 您的输入有误,请检查下面的输入项 12 您的输入有误,请检查下面的输入项
13 </div> 13 </div>
14 <!-- 线路ID --> 14 <!-- 线路ID -->
15 - <input type="hidden" name="sectionId" id="section.id">  
16 - <input type="hidden" name="sectionRouteId" id="id">  
17 - <input type="hidden" name="sectionCode" id="section.sectionCode">  
18 - <input type="hidden" name="sectionRouteLine" id="lineId">  
19 - <input type="hidden" name="lineCode" id="lineCode">  
20 - <input type="hidden" name="bsectionVector" id="bsectionVector" />  
21 - <input type="hidden" name="csectionVector" id="csectionVector" value=""/>  
22 - <input type="hidden" name="dbType" id="dbType" value="b"/>  
23 - <input type="hidden" name="directions" id="dir">  
24 - <input type="hidden" name="speedLimit" id="speedLimit" >  
25 - <input type="hidden" name="roadCoding" id="roadCoding"/>  
26 - <input type="hidden" name="versions" id="versions"/>  
27 - <input type="hidden" name="start" id="start"/>  
28 - <input type="hidden" name="end" id="end"/> 15 + <input type="hidden" name="id" />
  16 + <input type="hidden" name="line.id" />
  17 + <input type="hidden" name="section.id" />
  18 + <input type="hidden" name="section.bsectionVectorWkt" />
  19 + <input type="hidden" name="directions" />
  20 + <input type="hidden" name="versions" />
29 <!-- 路段名称 --> 21 <!-- 路段名称 -->
30 <div class="form-body"> 22 <div class="form-body">
31 <div class="form-group"> 23 <div class="form-group">
@@ -33,7 +25,7 @@ @@ -33,7 +25,7 @@
33 <span class="required"> * </span> 路段名称: 25 <span class="required"> * </span> 路段名称:
34 </label> 26 </label>
35 <div class="col-md-6"> 27 <div class="col-md-6">
36 - <input type="text" class="form-control" name="sectionName" id="sectionName" placeholder="路段名称"> 28 + <input type="text" class="form-control" name="section.sectionName" placeholder="路段名称">
37 </div> 29 </div>
38 </div> 30 </div>
39 </div> 31 </div>
@@ -59,59 +51,56 @@ @@ -59,59 +51,56 @@
59 </div> 51 </div>
60 </div> 52 </div>
61 <script type="text/javascript"> 53 <script type="text/javascript">
62 -debugger;  
63 -$('#edit_section_mobal').on('editSectionMobal_show', function(e, map_,ajaxd,p,fun){  
64 - function setSectionFormValue(section) { 54 +$('#edit_section_modal').on('modal.show', function(e, currentSection){
  55 + function setSectionFormValue(sectionRoute) {
65 $('#edit_section_form input').each(function() { 56 $('#edit_section_form input').each(function() {
66 - $(this).val(eval('section.' + this.name)); 57 + $(this).val(eval('sectionRoute.' + this.name));
67 }); 58 });
68 } 59 }
69 - var section = p.data;  
70 - var lineId = section.lineCode, version = section.versions, start = section.start, end = section.end;  
71 - setSectionFormValue(section); 60 + var sectionRoute = currentSection.data;
  61 + var lineId = sectionRoute.lineCode, version = sectionRoute.versions, start = sectionRoute.start, end = sectionRoute.end;
  62 + setSectionFormValue(sectionRoute);
72 // 获取路段号元素,并添加下拉属性值 63 // 获取路段号元素,并添加下拉属性值
73 - ajaxd.getRouteByStartEnd(lineId,version,start, end,function(result) { 64 + RoutesService.getRouteByStartEnd(lineId,version,start, end,function(result) {
74 var routes = result.data.routes,paramsD =new Array(); 65 var routes = result.data.routes,paramsD =new Array();
75 - var eq_scetionRouteCode = section.sectionrouteCode; 66 + var eq_scetionRouteCode = sectionRoute.sectionrouteCode;
  67 + var previous = '请选择...', last;
76 paramsD.push({'id':'请选择...','text':'将此路段设置位第一个路段'}); 68 paramsD.push({'id':'请选择...','text':'将此路段设置位第一个路段'});
77 // 遍历 69 // 遍历
78 $.each(routes, function(i, g){ 70 $.each(routes, function(i, g){
79 // 判断. 71 // 判断.
80 if(g.section.sectionName) { 72 if(g.section.sectionName) {
81 var ptions_v = g.sectionrouteCode; 73 var ptions_v = g.sectionrouteCode;
82 - if(eq_scetionRouteCode != ptions_v) {  
83 - // 添加拼音检索下拉框格式数据数组.  
84 - paramsD.push({'id':ptions_v,  
85 - 'text':g.section.sectionName + '(' + ptions_v + ')'}); 74 + if (eq_scetionRouteCode != ptions_v) {
  75 + paramsD.push({'id':ptions_v, 'text':g.section.sectionName + '(' + ptions_v + ')'});
  76 + last = ptions_v;
  77 + } else {
  78 + previous = last;
86 } 79 }
87 } 80 }
88 }); 81 });
89 // 初始化上一个路段拼音检索下拉框. 82 // 初始化上一个路段拼音检索下拉框.
90 initPinYinSelect2($('#sectionrouteCode'),paramsD,function(selector) { 83 initPinYinSelect2($('#sectionrouteCode'),paramsD,function(selector) {
91 if(paramsD.length > 0) { 84 if(paramsD.length > 0) {
92 - var upStationRouteCode = paramsD[paramsD.length - 1].sectionrouteCode;  
93 - $('#sectionrouteCode').select2('val',upStationRouteCode); 85 + $('#sectionrouteCode').select2('val', previous);
94 }else { 86 }else {
95 $('#sectionrouteCode').select2('val','请选择...'); 87 $('#sectionrouteCode').select2('val','请选择...');
96 } 88 }
97 }); 89 });
98 }); 90 });
99 // 显示mobal 91 // 显示mobal
100 - $('#edit_section_mobal').modal({show : true,backdrop: 'static',keyboard: false});// 92 + $('#edit_section_modal').modal({show : true,backdrop: 'static',keyboard: false});//
101 // 当调用 hide 实例方法时触发 93 // 当调用 hide 实例方法时触发
102 - $('#edit_section_mobal').on('hide.bs.modal', function () { 94 + $('#edit_section_modal').on('hide.bs.modal', function () {
103 closeMobleSetClean(); 95 closeMobleSetClean();
104 }); 96 });
105 function closeMobleSetClean() { 97 function closeMobleSetClean() {
106 // 清除地图覆盖物 98 // 清除地图覆盖物
107 - map_.clearMarkAndOverlays(); 99 + RoutesOperation.clearMarkAndOverlays();
108 $('#inoutSearch').click(); 100 $('#inoutSearch').click();
109 - fun.editAChangeCssRemoveDisabled();  
110 - //ajaxd.getSectionRouteInfo(lineId,dir,$("#versions").val(),function(data) {  
111 - // fun.linePanlThree(lineId,data,dir);  
112 - //}); 101 + RoutesOperation.editAChangeCssRemoveDisabled();
113 setTimeout(function () { 102 setTimeout(function () {
114 - map_.openSectionInfoWin_inout(p); 103 + RoutesOperation.openSectionInfoWin_inout(currentSection);
115 },1000); 104 },1000);
116 } 105 }
117 // 编辑表单元素 106 // 编辑表单元素
@@ -129,7 +118,7 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,p,fu @@ -129,7 +118,7 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,p,fu
129 errorClass : 'help-block help-block-error', 118 errorClass : 'help-block help-block-error',
130 focusInvalid : false, 119 focusInvalid : false,
131 rules : { 120 rules : {
132 - 'sectionName' : {required : true,maxlength:50} 121 + 'sectionName' : {required : true, maxlength: 50}
133 }, 122 },
134 invalidHandler : function(event, validator) { 123 invalidHandler : function(event, validator) {
135 error.show(); 124 error.show();
@@ -146,29 +135,26 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,p,fu @@ -146,29 +135,26 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,p,fu
146 }, 135 },
147 submitHandler : function(f) { 136 submitHandler : function(f) {
148 // 获取折线坐标集合 137 // 获取折线坐标集合
149 - var editPloyLineArray = p.getPath(); 138 + var editPloyLineArray = currentSection.getPath();
150 // 折线坐标集合 139 // 折线坐标集合
151 $('#bsectionVector').val(JSON.stringify(editPloyLineArray)); 140 $('#bsectionVector').val(JSON.stringify(editPloyLineArray));
152 var params = form.serializeJSON(); 141 var params = form.serializeJSON();
153 - params.destroy=0;  
154 - params.sectionDistance=0;  
155 - params.sectionTime=0;  
156 - params.status=$($("#versions").find("option:selected")[0]).attr("status"); 142 + params.destroy = 0;
  143 + params.sectionDistance = 0;
  144 + params.sectionTime = 0;
157 error.hide(); 145 error.hide();
158 - debugger  
159 - if(params.sectionrouteCode=='请选择...')  
160 - params.sectionrouteCode='';  
161 - ajaxd.inoutSectionUpdate(params,function(resuntDate) {  
162 - if(resuntDate.status=='SUCCESS') {  
163 - // 弹出添加成功提示消息 146 + if(params.sectionrouteCode == '请选择...') {
  147 + params.sectionrouteCode = 100;
  148 + } else {
  149 + params.sectionrouteCode = parseInt(params.sectionrouteCode) + 1;
  150 + }
  151 + RoutesService.inoutSectionUpdate(params,function(res) {
  152 + if(res.status == 'SUCCESS') {
164 layer.msg('修改成功...'); 153 layer.msg('修改成功...');
165 }else { 154 }else {
166 - // 弹出添加失败提示消息  
167 layer.msg('修改失败...'); 155 layer.msg('修改失败...');
168 } 156 }
169 - $('#edit_section_mobal').modal('hide');  
170 - var dir = params.directions  
171 - closeMobleSetClean(); 157 + $('#edit_section_modal').modal('hide');
172 }); 158 });
173 } 159 }
174 }); 160 });
src/main/resources/static/pages/base/stationroute/js/addstationobj.js deleted 100644 → 0
1 -var AddStationObj = function () {  
2 -  
3 - /** 定义新增站点对象 */  
4 - var station={};  
5 -  
6 - var stationObj = {  
7 - /** 获取新增站点集合对象 @return:<station:新增站点对象> */  
8 - getAddStation : function() {  
9 - return station;  
10 - },  
11 -  
12 - /** 设置新增站点集合对象为空 */  
13 - setAddStation : function(s) {  
14 - station = s;  
15 - },  
16 -  
17 - /** 设置新增站点集合对象方向属性值 @param:<dir:方向(0:上行;1:下行)> */  
18 - setAddStationDiraction : function(dir) {  
19 - station.dir = dir;  
20 - },  
21 -  
22 - /** 设置新增站点集合对象站点名称属性值 @param:<stationName:站点名称) */  
23 - setAddStationName : function(stationName) {  
24 - station.stationNamebootbox = stationName;  
25 - },  
26 -  
27 - /** 设置新增站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */  
28 - setAddStationJwpoints : function(bJwpoints) {  
29 - station.bJwpoints = bJwpoints;  
30 - },  
31 -  
32 - /** 设置新增站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */  
33 - setAddStationShapesType : function(shapesType) {  
34 - station.shapesType = shapesType;  
35 - },  
36 -  
37 - /** 设置新增站点集合对象圆形半径属性值 @param:<radius:圆形半径) */  
38 - setAddStationRadius : function(radius) {  
39 - station.radius = radius;  
40 - },  
41 -  
42 - /** 设置新增站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */  
43 - setBPolygonGrid : function(bPolygonGrid) {  
44 - station.bPolygonGrid = bPolygonGrid;  
45 - },  
46 -  
47 - /**  
48 - * 设置物理站点信息  
49 - * @param station  
50 - */  
51 - setPhysicalStation: function(physical) {  
52 - station.id = physical.id;  
53 - station.stationCode = physical.stationCode;  
54 - station.stationName = physical.stationName;  
55 - },  
56 -  
57 - /**  
58 - * 重置物理站点信息  
59 - */  
60 - resetPhysicalStation: function() {  
61 - delete station.id;  
62 - delete station.stationCode;  
63 - delete station.stationName;  
64 - }  
65 - }  
66 -  
67 - return stationObj;  
68 -}();  
69 \ No newline at end of file 0 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/js/deletebatch.js deleted 100644 → 0
1 -var DeleteBatchObj = function(){  
2 -  
3 - /** 定义修改线路对象 */  
4 -  
5 - var deleteBatchObj = {  
6 - /** 获取批量撤销对象 @return:<Batch:批量撤销对象> */  
7 - getDeleteBatch : function() {  
8 - return deleteBatchObj;  
9 - },  
10 -  
11 - /** 设置批量撤销的线路方向 @param:<dir:方向(0:上行;1:下行)> */  
12 - setDeteleBatchDiraction : function(dir) {  
13 -  
14 - deleteBatchObj.dir = dir;  
15 - },  
16 - }  
17 -  
18 - return deleteBatchObj;  
19 -}();  
src/main/resources/static/pages/base/stationroute/js/drawingManager.js deleted 100644 → 0
1 -var DrawingManagerObj = function () {  
2 -  
3 - // 创建鼠标绘制管理类  
4 - var drawingManager = '';  
5 -  
6 - var draMangerObj = {  
7 -  
8 - /** 初始化绘制工具类 */  
9 - init : function(map, styleOptions) {  
10 - drawingManager = new BMapLib.DrawingManager(map, {  
11 - //是否开启绘制模式  
12 - isOpen : false,  
13 - //是否显示工具栏  
14 - enableDrawingTool : false,  
15 - drawingToolOptions : {  
16 - //位置  
17 - anchor : BMAP_ANCHOR_TOP_RIGHT,  
18 - //偏离值  
19 - offset : new BMap.Size(5, 5),  
20 - //工具栏缩放比例  
21 - scale : 0.8  
22 - },  
23 - //线的样式  
24 - polygonOptions : styleOptions  
25 - });  
26 -  
27 - // 添加绘画完成事件  
28 - drawingManager.addEventListener('polygoncomplete', function(polygon) {  
29 - drawingManager.close();  
30 - var points = polygon.getPath();  
31 - if (points.length < 3) {  
32 - // 弹出提示消息  
33 - layer.msg('坐标点不能小于三个,请点击"退出编辑"后重新修改');  
34 - WorldsBMap.getmapBValue().removeOverlay(polygon);  
35 -  
36 - return false;  
37 - } else {  
38 - var bufferPolygonWkt = new Array();  
39 - for(var i = 0;i < points.length;i++) {  
40 - bufferPolygonWkt.push(points[i].lng + ' ' + points[i].lat)  
41 - }  
42 - bufferPolygonWkt.push(points[0].lng + ' ' + points[0].lat)  
43 - var add = AddStationObj.getAddStation(), edit = EditStationObj.getEditStation();  
44 - if(!$.isEmptyObject(add)){  
45 - /** 设置新增站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */  
46 - AddStationObj.setAddStationShapesType('d');  
47 - /** 设置新增站点集合对象圆形半径属性值 @param:<radius:圆形半径) */  
48 - AddStationObj.setAddStationRadius('');  
49 - /** 设置新增站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */  
50 - AddStationObj.setBPolygonGrid(bufferPolygonWkt.join(','));  
51 - $.get('add_stationroute_step2.html', function(m){  
52 - $(pjaxContainer).append(m);  
53 - $('#add_stationroute_step2_modal').trigger('modal.show', [WorldsBMap,GetAjaxData,AddStationObj,LineObj,PublicFunctions]);  
54 - });  
55 - }  
56 -  
57 - if(!$.isEmptyObject(edit)){  
58 - /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */  
59 - EditStationObj.setEditStationShapesType('d');  
60 - /** 设置修改站点集合对象圆形半径属性值 @param:<radius:圆形半径) */  
61 - EditStationObj.setEditStationRadius('');  
62 - /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */  
63 - EditStationObj.setEitdBPolygonGrid(bufferPolygonWkt.join(','));  
64 -  
65 - // 加载编辑页面  
66 - $.get('edit_stationroute_step2.html', function(m){  
67 - $(pjaxContainer).append(m);  
68 - $('#edit_stationroute_step2_modal').trigger('modal.show', [WorldsBMap,GetAjaxData,EditStationObj,LineObj,PublicFunctions]);  
69 - });  
70 - }  
71 - }  
72 - });  
73 -  
74 - return drawingManager;  
75 - },  
76 -  
77 - openDrawingManager : function() {  
78 - // 打开鼠标绘画工具  
79 - drawingManager.open();  
80 - // 设置属性  
81 - drawingManager.setDrawingMode(BMAP_DRAWING_POLYGON);  
82 - },  
83 -  
84 - closeDrawingManager : function() {  
85 - drawingManager.close();  
86 - }  
87 - }  
88 -  
89 - return draMangerObj;  
90 -}();  
91 \ No newline at end of file 0 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/js/editsection.js deleted 100644 → 0
1 -var EditSectionObj = function () {  
2 -  
3 - /** 定义修改路段对象 */  
4 - var Section={};  
5 -  
6 - var SectionObj = {  
7 -  
8 - /** 获取修改路段集合对象 @return:<Section:修改路段对象> */  
9 - getEitdSection : function() {  
10 - return Section;  
11 - },  
12 -  
13 - /** 设置修改路段集合对象为空 */  
14 - setEitdSection : function(sc) {  
15 -  
16 - Section = sc;  
17 - },  
18 -  
19 -  
20 - /** 设置修改路段集合对象折线百度坐标集合属性值 @param:<bsectionVector:折线百度坐标集合) */  
21 - setEitdBsectionVector : function(bsectionVector) {  
22 -  
23 - Section.sectionBsectionVector = bsectionVector;  
24 - }  
25 - }  
26 -  
27 - return SectionObj;  
28 -  
29 -}();  
src/main/resources/static/pages/base/stationroute/js/editstationobj.js deleted 100644 → 0
1 -var EditStationObj = function () {  
2 -  
3 - /** 定义修改站点对象 */  
4 - var station = {};  
5 -  
6 - var stationObj = {  
7 -  
8 - /** 获取修改站点集合对象 @return:<station:修改站点对象> */  
9 - getEditStation : function() {  
10 - return station;  
11 - },  
12 -  
13 - /** 设置修改站点集合对象为空 */  
14 - setEditStation : function(s) {  
15 - station = s;  
16 - },  
17 -  
18 - /** 设置修改站点集合对象站点名称属性值 @param:<stationName:站点名称) */  
19 - setEditStationName : function(stationName) {  
20 - station.stationName = stationName;  
21 - },  
22 -  
23 - /** 设置修改站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */  
24 - setEditStationJwpoints : function(centerPointWkt) {  
25 - station.centerPointWkt = centerPointWkt;  
26 - },  
27 -  
28 - /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */  
29 - setEditStationShapesType : function(shapedType) {  
30 - station.shapedType = shapedType;  
31 - },  
32 -  
33 - /** 设置修改站点集合对象圆形半径属性值 @param:<radius:圆形半径) */  
34 - setEditStationRadius : function(radius) {  
35 - station.radius = radius;  
36 - },  
37 -  
38 - /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */  
39 - setEitdBPolygonGrid : function(bufferPolygonWkt) {  
40 - station.bufferPolygonWkt = bufferPolygonWkt;  
41 - }  
42 - }  
43 -  
44 - return stationObj;  
45 -}();  
src/main/resources/static/pages/base/stationroute/js/line.js deleted 100644 → 0
1 -/**  
2 - * 线路类  
3 - *  
4 - */  
5 -  
6 -var LineObj = function () {  
7 -  
8 - /** 定义线路对象 */  
9 -  
10 - var line={  
11 -  
12 - };  
13 -  
14 - var lineObj = {  
15 -  
16 - /** 初始化线路对象属性值 */  
17 - init : function(id) {  
18 -  
19 - // 线路Id  
20 - line.id = id;  
21 -  
22 - return line;  
23 - },  
24 -  
25 - /** 获取线路对象 @return:<line:线路对象> */  
26 - getLineObj : function() {  
27 -  
28 - return line;  
29 - },  
30 -  
31 - setStatus:function(s){  
32 - line.status = s;  
33 - }  
34 -  
35 - }  
36 -  
37 -  
38 - return lineObj;  
39 -  
40 -}();  
41 \ No newline at end of file 0 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/js/routes-operation.js 0 → 100644
  1 +var RoutesOperation = (function () {
  2 + var lineId, versions, directions = 0, status;
  3 + // 百度地图对象
  4 + var baiduMap;
  5 + // 进出场路段编辑时当前选中的路段
  6 + var currentSection = {};
  7 + var addStationRoute = {}, editStationRoute = {};
  8 + // 进出场中名称和场站信息的映射
  9 + var name2Point = {};
  10 + var stationMarkers = {};
  11 + var stationDrawingManager, sectionDrawingManager;
  12 + var map_status = 0;
  13 + var sectionArray = {}, stationArray = {};
  14 + // 新增站点时添加的覆盖物, 站点点击和双击的setTimeout值
  15 + var overlays = new Array(), setTimeoutId;
  16 + // 信息窗口打开状态的路段
  17 + var road_win_show_p;
  18 + // 被编辑的路段
  19 + var editPolyline;
  20 + var styleOptions = {
  21 + strokeColor : "blue",
  22 + fillColor : "blue",
  23 + strokeWeight : 3,
  24 + strokeOpacity : 0.8,
  25 + fillOpacity : 0.6,
  26 + strokeStyle : 'solid'
  27 + };
  28 + var lineStyle = {
  29 + strokeColor: "blue",
  30 + strokeWeight: 2,
  31 + strokeOpacity: 0.7
  32 + }
  33 + var operation = {
  34 + getAddStationRoute: function () {
  35 + return addStationRoute;
  36 + },
  37 + getEditStationRoute: function () {
  38 + return editStationRoute;
  39 + },
  40 + getCurrentSection: function () {
  41 + return currentSection;
  42 + },
  43 + getProperties: function () {
  44 + return {
  45 + lineId: lineId,
  46 + versions: versions,
  47 + directions: directions,
  48 + status: status
  49 + }
  50 + },
  51 + getBaiduMap: function () {
  52 + return baiduMap;
  53 + },
  54 + getStationArray: function () {
  55 + return stationArray;
  56 + },
  57 + setStationArray : function (s) {
  58 + stationArray = s;
  59 + },
  60 + setMap_status : function (i) {
  61 + map_status = i;
  62 + },
  63 + /***************************************************reload*******************************************************/
  64 + initPage: function () {
  65 + if (!$('body').hasClass('page-sidebar-closed')) {
  66 + $('.menu-toggler.sidebar-toggler').click();
  67 + }
  68 + lineId = $.url().param('no');
  69 + if (!lineId) {
  70 + this.illegalParamHandle();
  71 + return;
  72 + }
  73 + RoutesService.getAllLineVersions(lineId, function(lineVersions) {
  74 + $('#versions option').remove();
  75 + for (var i = 0;i < lineVersions.length;i++) {
  76 + var lineVersion = lineVersions[i], selected = false;
  77 + if (lineVersion.status == 1 || i == lineVersions.length - 1) {
  78 + operation.TreeUpOrDown(lineId, '0', lineVersion.versions);
  79 + operation.TreeUpOrDown(lineId, '1', lineVersion.versions);
  80 + status = lineVersion.status;
  81 + versions = lineVersion.versions;
  82 + selected = true;
  83 + }
  84 + $('#versions').append('<option value=' + lineVersion.versions + ' status=' + lineVersion.status + (selected ? ' selected' : '') + '>' + lineVersion.name + ' (' + lineVersion.versions + ')' + '</option>');
  85 + }
  86 + operation.setTiteText(lineId);
  87 + operation.registerEvents();
  88 + });
  89 + },
  90 + illegalParamHandle: function () {
  91 + layer.confirm('【ID缺失,请点击返回,重新进行操作】', {
  92 + btn : [ '返回' ],
  93 + icon : 3,
  94 + title : '提示'
  95 + }, function(index) {
  96 + layer.close(index);
  97 + loadPage('/pages/base/line/list.html');
  98 + });
  99 + },
  100 + registerEvents: function() {
  101 + $('#esc_edit_div').on('click', function() {
  102 + var index = layer.open({
  103 + title: '退出提示',
  104 + content: '退出编辑模式后,当前没有保存的所有操作将被还原,确定要退出吗!',
  105 + btn: [ '确定', '取消' ],
  106 + yes: function(index) {
  107 + operation.resjtreeDate(lineId, directions, versions);
  108 + operation.editMapStatusRemove();
  109 + layer.msg("已退出编辑模式!");
  110 + layer.close(index);
  111 + },
  112 + btn2: function() {
  113 + layer.closeAll(index);
  114 + layer.msg("您没有退出编辑模式,请继续完成您未完成的操作!")
  115 + }
  116 + });
  117 + })
  118 +
  119 + $("#versions").on('change', function() {
  120 + versions = $(this).val();
  121 + status = $($(this).find("option:selected")[0]).prop("status");
  122 + $('#upLine').click();
  123 +
  124 + if (status > 0) {
  125 + $(".table-toolbar").show();
  126 + } else {
  127 + $(".table-toolbar").hide();
  128 + }
  129 + })
  130 +
  131 + $('.green-seagreen dropdown-toggle').click(function() {
  132 + $('.dropdown-menu').css("display", "block");
  133 + });
  134 +
  135 + // 系统规划上行站点点击事件
  136 + $('.upSystem').on('click',function() {
  137 + $('#upToolsMobal').hide();
  138 + layer.load(0,{offset:['200px', '280px']});
  139 + operation.lineNameIsHaveInterval(0);
  140 + });
  141 +
  142 + $('.gpsRoute').on('click',function() {
  143 + // 加载其它规划选择弹出层modal页面
  144 + $.get('add_routes_template.html', function(m){
  145 + $(pjaxContainer).append(m);
  146 + $('#add_routes_template_modal').trigger('modal.show');
  147 + });
  148 + });
  149 +
  150 + // 上行站点新增事件
  151 + $('.module_tools #addUpStation').on('click', function() {
  152 + operation.addStationInit();
  153 + addStationRoute.directions = 0;
  154 + $.get('add_stationroute_step1.html', function(m){
  155 + $(pjaxContainer).append(m);
  156 + $('#add_stationroute_step1_modal').trigger('modal.show');
  157 + });
  158 + });
  159 +
  160 + // 修改上行站点modal页面 @已弃用
  161 + /*$('.module_tools #editUpStation').on('click', function(){
  162 + var sel = PublicFunctions.getCurrSelNode(0);
  163 + if(sel.length == 0 || sel[0].original.chaildredType != 'station'){
  164 + layer.msg('请先选择要编辑的上行站点!');
  165 + return;
  166 + }
  167 + $.get('edit_select.html', function(m){
  168 + $(pjaxContainer).append(m);
  169 + $('#edit_select_mobal').trigger('editSelectMobal_show', [WorldsBMap,DrawingManagerObj,GetAjaxData,EditStationObj,LineObj,PublicFunctions,directionUpValue]);
  170 + });
  171 + });*/
  172 +
  173 + // 撤销上行站点 @已弃用
  174 + /*$('.module_tools #deleteUpStation').on('click', function() {
  175 + PublicFunctions.stationRevoke(0);
  176 + });*/
  177 +
  178 + // 上行批量撤销事件
  179 + $('.module_tools #batchUpDelete').on('click', function() {
  180 + $.get('destroy_routes.html', function(m){
  181 + $(pjaxContainer).append(m);
  182 + $('#delete_select_modal').trigger('modal.show');
  183 + });
  184 + });
  185 +
  186 + // 交换上下行站点和路段路由
  187 + $('.retweet').on('click', function() {
  188 + layer.confirm('您是否确定将【上、下】行站点和路段进行对换!', {
  189 + btn : [ '确认提示并提交', '取消' ]
  190 + },function () {
  191 + layer.closeAll();
  192 + var index = layer.load(1, {
  193 + shade: [0.1, '#fff']
  194 + });
  195 + $post('/api/lsstationroute/exchangeDirection', {lineId: lineId, version: versions}, function(data) {
  196 + layer.close(index);
  197 + if (data.status == 'SUCCESS') {
  198 + layer.msg('操作成功...');
  199 + } else {
  200 + layer.msg('操作成功...');
  201 + }
  202 + operation.clearMarkAndOverlays();
  203 + $('#upLine').click();
  204 + });
  205 + });
  206 + });
  207 +
  208 + $('#wrenchUpDis').on('click',function() {
  209 + RoutesService.getStation(lineId, directions, versions, function(routes) {
  210 + $.get('tzzj.html', function(m){
  211 + $(pjaxContainer).append(m);
  212 + $('#tzzj_mobal').trigger('modal.show', [routes.stationRoutes]);
  213 + });
  214 + });
  215 + })
  216 +
  217 + $('#wrenchDownDis').on('click',function() {
  218 + RoutesService.getStation(lineId, directions, versions, function(routes) {
  219 + $.get('tzzj.html', function(m){
  220 + $(pjaxContainer).append(m);
  221 + $('#tzzj_mobal').trigger('modal.show', [routes.stationRoutes]);
  222 + });
  223 + });
  224 + });
  225 +
  226 + $('#quoteDown').on('click',function() {
  227 + var index = layer.load(1, {
  228 + shade: [0.1,'#fff']
  229 + });
  230 + var params = {lineId: lineId, version: versions, direction: 0, otherDirection: 1};
  231 + quote(params, index);
  232 + });
  233 +
  234 + $('#quoteUp').on('click',function() {
  235 + var index = layer.load(1, {
  236 + shade: [0.1,'#fff']
  237 + });
  238 + var params = {lineId: lineId, version: versions, direction: 1, otherDirection: 0};
  239 + quote(params, index);
  240 + });
  241 +
  242 + function quote(params, index) {
  243 + $post('/api/lssectionroute/quoteOtherSide', params, function(data) {
  244 + layer.close(index);
  245 + if(data.status == 'SUCCESS') {
  246 + layer.msg('操作成功...');
  247 + } else {
  248 + layer.msg('操作失败...');
  249 + }
  250 + operation.clearMarkAndOverlays();
  251 + operation.resjtreeDate(lineId, directions, versions);
  252 + });
  253 + }
  254 +
  255 + // 编辑线路上行走向 @弃用
  256 + /*$('.module_tools #editUplineTrend').on('click', function() {
  257 + operation.editLinePlan(directionUpValue);
  258 + });*/
  259 +
  260 + // 线路上行
  261 + $('#leftUpOrDown #upLine').on('click', function(){
  262 + directions = 0;
  263 + operation.resjtreeDate(lineId, directions, versions);
  264 + });
  265 +
  266 + // 系统规划下行站点
  267 + $('.downSystem').on('click',function() {
  268 + $('#downToolsMobal').hide();
  269 + layer.load(0,{offset:['200px', '280px']});
  270 + operation.lineNameIsHaveInterval(1);
  271 + });
  272 +
  273 + // 下行站点新增事件
  274 + $('.module_tools #addDownStation').on('click', function() {
  275 + operation.addStationInit();
  276 + addStationRoute.directions = 1;
  277 + $.get('add_stationroute_step1.html', function(m){
  278 + $(pjaxContainer).append(m);
  279 + $('#add_stationroute_step1_modal').trigger('modal.show');
  280 + });
  281 + });
  282 +
  283 + // 修改下行站点mobal页面 @弃用
  284 + /*$('.module_tools #editDownStation').on('click', function(){
  285 + var sel = PublicFunctions.getCurrSelNode(directionDownValue);
  286 + if(sel.length==0 || sel[0].original.chaildredType !='station'){
  287 + layer.msg('请先选择要编辑的下行站点!');
  288 + return;
  289 + }
  290 + $.get('edit_select.html', function(m){
  291 + $(pjaxContainer).append(m);
  292 + $('#edit_select_mobal').trigger('editSelectMobal_show', [WorldsBMap,DrawingManagerObj,GetAjaxData,EditStationObj,LineObj,PublicFunctions,directionDownValue]);
  293 + });
  294 + });*/
  295 +
  296 + // 撤销下行站点 @弃用
  297 + /*$('.module_tools #deleteDownStation').on('click', function() {
  298 + PublicFunctions.stationRevoke(directionDownValue);
  299 + });*/
  300 +
  301 + // 下行批量撤销事件
  302 + $('.module_tools #batchDownDelete').on('click', function() {
  303 + $.get('destroy_routes.html', function(m){
  304 + $(pjaxContainer).append(m);
  305 + $('#delete_select_modal').trigger('modal.show');
  306 + });
  307 + });
  308 +
  309 + // 编辑线路下行走向 @弃用
  310 + /*$('.module_tools #editDownlineTrend').on('click', function() {
  311 + PublicFunctions.editLinePlan(directionDownValue);
  312 + });*/
  313 +
  314 + // 线路下行
  315 + $('#leftUpOrDown #downLine').on('click', function(){
  316 + directions = 1;
  317 + operation.resjtreeDate(lineId, directions, versions);
  318 + });
  319 +
  320 + // 生成行单 @弃用
  321 + /*$('.module_tools #createUsingSingle').on('click', function() {
  322 + var lineIdEvents = LineObj.getLineObj();
  323 + var params = {lineId:lineIdEvents.id};
  324 + GetAjaxData.createUsingSingle(params,function(data) {
  325 + if(data.status=='SUCCESS') {
  326 + // 弹出生成成功提示消息
  327 + layer.msg('生成成功...');
  328 + }else {
  329 + // 弹出生成失败提示消息
  330 + layer.msg('生成失败...');
  331 + }
  332 + });
  333 + });*/
  334 +
  335 + $('#scrllmouseEvent').on('mousemove',function() {
  336 + $('.defeat-scroll').css('overflow','auto');
  337 + }).on('mouseleave',function() {
  338 + $('.defeat-scroll').css('overflow','hidden');
  339 + });
  340 +
  341 + // 进出场规划
  342 + $('#leftUpOrDown #inoutLine').on('click', function(){
  343 + directions = 3
  344 + operation.resjtreeDate(lineId, directions, versions);
  345 + });
  346 +
  347 + // 环线首末站编码处理
  348 + $('#circularRouteHandle').on('click', function() {
  349 + RoutesService.circularRouteHandle(lineId, versions, function() {
  350 + layer.msg('操作成功');
  351 + operation.resjtreeDate(lineId, directions, versions);
  352 + })
  353 + })
  354 + },
  355 +
  356 + /***************************************************map*******************************************************/
  357 + initMap: function () {
  358 + baiduMap = new BMap.Map('routes_list_map_container' , {enableMapClick: false});
  359 + baiduMap.centerAndZoom(new BMap.Point(121.528733, 31.237425), 14);
  360 + baiduMap.enableDragging();
  361 + baiduMap.enableScrollWheelZoom();
  362 + baiduMap.disableDoubleClickZoom();
  363 + baiduMap.enableKeyboard();
  364 + },
  365 + /**
  366 + * 打开站点路由信息窗口
  367 + * @param stationRoute
  368 + */
  369 + openStationRouteInfoWin : function (stationRoute) {
  370 + if (stationRoute) {
  371 + var shapes = stationRoute.shapedType;
  372 + var centerPointWkt = stationRoute.station.centerPointWkt;
  373 + centerPointWkt = centerPointWkt.substring(6, centerPointWkt.length - 1);
  374 + var coordinates = centerPointWkt.split(' ');
  375 + var point = new BMap.Point(coordinates[0], coordinates[1]);
  376 + var width = operation.strGetLength(stationRoute.stationName) * 11;
  377 + var opts = {
  378 + width: (width < 240 ? 240 : width),
  379 + offset: new BMap.Size(10,-20),
  380 + enableMessage: false,
  381 + enableCloseOnClick: false,
  382 + enableAutoPan: false
  383 + };
  384 +
  385 + var stationMark = '';
  386 + if (stationRoute.stationMark == 'B') {
  387 + stationMark = '起点站';
  388 + } else if (stationRoute.stationMark == 'Z') {
  389 + stationMark = '中途站';
  390 + } else if (stationRoute.stationMark == 'E') {
  391 + stationMark = '终点站';
  392 + }
  393 + var htm = '<span style="color: #ff8355;font-size: 20px; overflow: hidden; white-space: nowrap; text-overflow:ellipsis;display: -webkit-box; -webkit-box-orient: vertical;">' + stationRoute.stationName + '</span>' +
  394 + '<span class="help-block" >站点编码:' + stationRoute.stationCode + '</span>' +
  395 + '<span class="help-block" >行业编号:' + (stationRoute.industryCode == null ? "":stationRoute.industryCode)+ '</span>' +
  396 + '<span class="help-block" >站点序号:' + stationRoute.stationRouteCode + '</span>' +
  397 + '<span class="help-block" >站点类型:' + stationMark + '</span>' +
  398 + '<span class="help-block" >经度:&nbsp&nbsp' + coordinates[0] + '</span>' +
  399 + '<span class="help-block" >纬度:&nbsp&nbsp' + coordinates[1] + '</span>' +
  400 + '<span class="help-block" >到站时间:' + stationRoute.toTime + '&nbsp;分钟</span>' +
  401 + '<span class="help-block" >到站距离:' + stationRoute.distances + '&nbsp;公里</span>' +
  402 + '<span class="help-block" >缓冲区形状:' + (shapes == 'r' ? '圆形' : '多边形') + '</span>' +
  403 + (shapes=="r" ? ("<span class='help-block' >半径&nbsp&nbsp:" + stationRoute.radius + "</span>") : " ")+
  404 + '<span class="help-block" >版本号&nbsp&nbsp:' + stationRoute.versions + '</span>';
  405 +
  406 + if(status > 0){
  407 + htm += '<div>' +
  408 + '<button class="info_win_btn" id="editStation" onclick="RoutesOperation.editStation(' + stationRoute.id+','+stationRoute.directions + ')">修改</button>' +
  409 + '<button class="info_win_btn" onclick="RoutesOperation.destroyStation('+ stationRoute.id + ','+stationRoute.line.id+','+stationRoute.directions+')">撤销</button>' +
  410 + '<button class="info_win_btn" id="addBetweenStationRoad" onclick="RoutesOperation.addBetweenStationRoad(' + stationRoute.id + ')">添加站点间路段</button>' +
  411 + '</div>';
  412 + }
  413 + // 创建信息窗口
  414 + var infoWindow = new BMap.InfoWindow(htm, opts);
  415 + setTimeout(function () {
  416 + //开启信息窗口
  417 + baiduMap.openInfoWindow(infoWindow, point);
  418 + }, 100);
  419 + // 将地图的中心点更改为给定的点。
  420 + baiduMap.panTo(point);
  421 + }
  422 + },
  423 +
  424 + /**
  425 + * 打开站点信息窗口
  426 + * @param station
  427 + */
  428 + openStationInfoWin: function(station) {
  429 + if (station) {
  430 + var centerPointWkt = station.centerPointWkt;
  431 + centerPointWkt = centerPointWkt.substring(6, centerPointWkt.length - 1);
  432 + var coordinates = centerPointWkt.split(' ');
  433 + var centerPoint = new BMap.Point(coordinates[0], coordinates[1]);
  434 + var width = operation.strGetLength(station.stationName) * 11;
  435 + var opts = {
  436 + width: (width < 240 ? 240 : width),
  437 + offset: new BMap.Size(10,-20),
  438 + enableMessage: false,
  439 + enableCloseOnClick: false,
  440 + enableAutoPan: false
  441 + };
  442 +
  443 + var html = new Array();
  444 + html.push('<span style="color: #ff8355;font-size: 20px; overflow: hidden; white-space: nowrap; text-overflow:ellipsis;display: -webkit-box; -webkit-box-orient: vertical;">' + station.stationName + '</span>');
  445 + html.push('<span class="help-block" >站点编号:' + (station.stationCode ? station.stationCode : '')+ '</span>');
  446 + html.push('<span class="help-block" >途经线路:' + (station.passLines ? station.passLines : '') + '</span>');
  447 +
  448 + var infoWindow = new BMap.InfoWindow(html.join(''), opts);
  449 + setTimeout(function () {
  450 + baiduMap.openInfoWindow(infoWindow, centerPoint);
  451 + }, 100);
  452 + baiduMap.panTo(centerPoint);
  453 + }
  454 + },
  455 +
  456 + /**
  457 + * 根据地理名称获取百度经纬度坐标
  458 + */
  459 + localSearchFromAdreesToPoint: function (Address, callback) {
  460 + var localSearch = new BMap.LocalSearch(baiduMap);
  461 + localSearch.setSearchCompleteCallback(function (searchResult) {
  462 + var resultPoints = '';
  463 + if (searchResult) {
  464 + // 返回索引指定的结果。索引0表示第1条结果
  465 + var poi = searchResult.getPoi(0);
  466 + if (poi) {
  467 + //获取经度和纬度
  468 + resultPoints = poi.point.lng + ' ' + poi.point.lat;
  469 + callback && callback(resultPoints);
  470 + } else {
  471 + callback && callback(false);
  472 + }
  473 + } else {
  474 + callback && callback(false);
  475 + }
  476 + });
  477 + localSearch.search(Address);
  478 + },
  479 +
  480 + /**
  481 + * 站级缓冲区编辑
  482 + */
  483 + editShapes: function (stationRoute) {
  484 + // 关闭信息窗口
  485 + baiduMap.closeInfoWindow();
  486 + var shapedType = editStationRoute.shapedType;
  487 + //setDragMarker(stationMarkers[editStationRoute.id]);
  488 +
  489 + var centerPointWkt = editStationRoute.station.centerPointWkt;
  490 + centerPointWkt = centerPointWkt.substring(6, centerPointWkt.length - 1);
  491 + var coordinates = centerPointWkt.split(' ');
  492 + var center = new BMap.Point(coordinates[0], coordinates[1]);
  493 + if (shapedType == 'r') {
  494 + var circle = new BMap.Circle(center, editStationRoute.radius, lineStyle);
  495 + baiduMap.centerAndZoom(center, 18);
  496 + baiduMap.addOverlay(circle);
  497 + circle.enableEditing();
  498 + circle.addEventListener('dblclick', function () {
  499 + editStationRoute.centerPointWkt = circle.getCenter().lng + ' ' + circle.getCenter().lat;
  500 + editStationRoute.shapedType = 'r';
  501 + editStationRoute.radius = Math.round(circle.getRadius());
  502 + // 加载编辑页面
  503 + $.get('edit_stationroute_step2.html', function (m) {
  504 + $(pjaxContainer).append(m);
  505 + $('#edit_stationroute_step2_modal').trigger('modal.show');
  506 + });
  507 + });
  508 + } else if (shapedType == 'd') {
  509 + var bufferPolygonWkt = editStationRoute.bufferPolygonWkt;
  510 + bufferPolygonWkt = bufferPolygonWkt.substring(9, bufferPolygonWkt.length - 2);
  511 + var points = bufferPolygonWkt.split(',');
  512 + var polygonPoints = new Array();
  513 + for (var i = 0; i < points.length; i++) {
  514 + var coordinates = points[i].split(' ');
  515 + polygonPoints.push(new BMap.Point(coordinates[0], coordinates[1]));
  516 + }
  517 + var polygon = new BMap.Polygon(polygonPoints, lineStyle);
  518 + baiduMap.centerAndZoom(center, 18);
  519 + baiduMap.addOverlay(polygon);
  520 + polygon.enableEditing();
  521 + polygon.addEventListener('dblclick', function (e) {
  522 + var bufferPolygonWkt = new Array(), points = polygon.getPath();
  523 + for(var i = 0;i < points.length;i++) {
  524 + bufferPolygonWkt.push(points[i].lng + ' ' + points[i].lat)
  525 + }
  526 + bufferPolygonWkt.push(points[0].lng + ' ' + points[0].lat)
  527 + editStationRoute.centerPointWkt = center.lng + ' ' + center.lat;
  528 + editStationRoute.shapedType = 'd';
  529 + editStationRoute.radius = 0;
  530 + editStationRoute.bufferPolygonWkt = bufferPolygonWkt.join(',');
  531 + $.get('edit_stationroute_step2.html', function (m) {
  532 + $(pjaxContainer).append(m);
  533 + $('#edit_stationroute_step2_modal').trigger('modal.show');
  534 + });
  535 + });
  536 + }
  537 + },
  538 +
  539 + /**
  540 + * 画路段走向
  541 + */
  542 + drawingUpline01: function (sectionRoutes) {
  543 + if (sectionRoutes) {
  544 + sectionArray = [];
  545 + for (var d = 0; d < sectionRoutes.length; d++) {
  546 + var data = sectionRoutes[d];
  547 + var polylineArray = [];
  548 + var sectionBsectionVectorStr = data.section.bsectionVectorWkt;
  549 + if (sectionBsectionVectorStr == null)
  550 + continue;
  551 + var tempStr = sectionBsectionVectorStr.substring(11, sectionBsectionVectorStr.length - 1);
  552 + var lineArray = tempStr.split(',');
  553 + for (var i = 0; i < lineArray.length; i++) {
  554 + polylineArray.push(new BMap.Point(lineArray[i].split(' ')[0], lineArray[i].split(' ')[1]));
  555 + }
  556 + var polyUpline01 = 'polyline' + '_' + data.id;
  557 + polyUpline01 = new BMap.Polyline(polylineArray, {
  558 + strokeColor: "red",
  559 + strokeWeight: 6,
  560 + strokeOpacity: 0.7
  561 + });
  562 + polyUpline01.data = data;
  563 + polyUpline01.ct_source = '1';
  564 + baiduMap.addOverlay(polyUpline01);
  565 + polyUpline01.addEventListener('mousemove', function (e) {
  566 + if (this != editPolyline)
  567 + this.setStrokeColor("#20bd26");
  568 + });
  569 + polyUpline01.addEventListener('mouseout', function (e) {
  570 + if (this != editPolyline && this != road_win_show_p)
  571 + this.setStrokeColor("red");
  572 + });
  573 + polyUpline01.addEventListener('onclick', function (e) {
  574 + if (map_status != 1)
  575 + operation.openSectionInfoWin(this);
  576 + });
  577 + sectionArray.push(polyUpline01);
  578 + }
  579 + }
  580 + },
  581 +
  582 + /**
  583 + * 在地图上画点 @param:<point_center:中心坐标点>
  584 + */
  585 + drawingUpStationPoint: function (stationRoute, seq, isView) {
  586 + var centerPointWkt = stationRoute.station.centerPointWkt;
  587 + centerPointWkt = centerPointWkt.substring(6, centerPointWkt.length - 1);
  588 + var coordinates = centerPointWkt.split(' ');
  589 + var stationName = stationRoute.stationName;
  590 + var center = new BMap.Point(coordinates[0], coordinates[1]);
  591 + var html2 = '<div style="position: absolute; margin: 0pt; padding: 0pt; width: 160px; height: 26px; left: -10px; top: -35px; overflow: hidden;">'
  592 + + '<img class="rm3_image" style="border:none;left:0px; top:0px; position:absolute;" src="/pages/base/stationroute/css/img/back160.png">'
  593 + + '</div>'
  594 + + '<label class=" BMapLabel" unselectable="on" style="position: absolute; -moz-user-select: none; display: inline; cursor: inherit; border: 0px none; padding: 2px 1px 1px; white-space: nowrap; font: 12px arial,simsun; z-index: 80; color: rgb(255, 102, 0); left: 15px; top: -35px;"><span style="float: left; color: #fdfdfd; margin-left: -22px; font-size: 6px;">' + seq + '</span>' + stationName + '</label>';
  595 +
  596 + var myRichMarker1 = new BMapLib.RichMarker(html2, center, {
  597 + "title": stationName,
  598 + "anchor": new BMap.Size(-10, 8),
  599 + "enableDragging": true
  600 + });
  601 + myRichMarker1.disableDragging();
  602 + myRichMarker1.ct_source = '1';
  603 + baiduMap.addOverlay(myRichMarker1);
  604 + myRichMarker1.addEventListener('click', function () {
  605 + if(map_status != 1 && !isView)
  606 + operation.openStationRouteInfoWin(stationRoute);
  607 + });
  608 + stationArray[stationRoute.id] = stationRoute;
  609 + stationMarkers[stationRoute.id] = myRichMarker1;
  610 + },
  611 +
  612 + /**
  613 + * 站点名称获取百度坐标(手动规划)
  614 + * @param arra
  615 + * @param callback
  616 + */
  617 + stationsNameToPoints: function (arra, callback) {
  618 + // 获取长度
  619 + var len = arra.length;
  620 + var stationList = [];
  621 + (function () {
  622 + if (!arguments.callee.count) {
  623 + arguments.callee.count = 0;
  624 + }
  625 + arguments.callee.count++;
  626 + var index = parseInt(arguments.callee.count) - 1;
  627 + if (index >= len) {
  628 + callback && callback(stationList);
  629 + return;
  630 + }
  631 + var f = arguments.callee;
  632 + if (arra[index].name != '') {
  633 + var localSearch = new BMap.LocalSearch(baiduMap);
  634 + localSearch.search(arra[index].name);
  635 + localSearch.setSearchCompleteCallback(function (searchResult) {
  636 + var poi = searchResult.getPoi(0);
  637 + if (poi) {
  638 + stationList.push({
  639 + name: arra[index].name.replace('公交车站', ''),
  640 + wgs: arra[index].wgs,
  641 + potion: {lng: poi.point.lng, lat: poi.point.lat}
  642 + });
  643 + } else {
  644 + stationList.push({
  645 + name: arra[index].name.replace('公交车站', ''),
  646 + wgs: arra[index].wgs,
  647 + potion: {lng: arra[index].wgs.x, lat: arra[index].wgs.y}
  648 + });
  649 + }
  650 + f();
  651 + });
  652 + } else {
  653 + f();
  654 + }
  655 + })();
  656 + },
  657 +
  658 + /**
  659 + * 根据坐标点获取两点之间的时间与距离(手动规划)
  660 + * @param stationList
  661 + * @param cb
  662 + */
  663 + getDistanceAndTotime: function (stationList, cb) {
  664 + stationList[0].distance = '';
  665 + stationList[0].duration = '';
  666 + // var sectionList = [];
  667 + // 获取长度
  668 + var len = stationList.length;
  669 + (function () {
  670 + if (!arguments.callee.count) {
  671 + arguments.callee.count = 0;
  672 + }
  673 + arguments.callee.count++;
  674 + var index = parseInt(arguments.callee.count) - 1;
  675 + if (index >= len - 1) {
  676 + // cb && cb(stationList,sectionList);
  677 + cb && cb(stationList);
  678 + return;
  679 + }
  680 + var f = arguments.callee;
  681 + var poiOne = new BMap.Point(stationList[index].potion.lng, stationList[index].potion.lat);
  682 + var poiTwo = new BMap.Point(stationList[index + 1].potion.lng, stationList[index + 1].potion.lat);
  683 + var transit = new BMap.TransitRoute(baiduMap, {
  684 + renderOptions: {map: baiduMap},
  685 + onSearchComplete: searchComplete
  686 + });
  687 +
  688 + transit.search(poiOne, poiTwo);
  689 + function searchComplete(results) {
  690 + var plan = results.getPlan(0);
  691 + if (transit.getStatus() != BMAP_STATUS_SUCCESS) {
  692 + stationList[index + 1].distance = '';
  693 + stationList[index + 1].duration = '';
  694 + } else {
  695 + stationList[index + 1].distance = plan.getDistance(true);
  696 + stationList[index + 1].duration = plan.getDuration(true);
  697 + }
  698 + f();
  699 + }
  700 + })();
  701 + },
  702 +
  703 + /**
  704 + * 根据坐标点获取两点之间的折线路段(手动规划)
  705 + * @param stationsPoint
  706 + * @param cb
  707 + */
  708 + getSectionListPlonly: function (stationsPoint, cb) {
  709 + var len = stationsPoint.length;
  710 + var sectionList = [];
  711 + (function () {
  712 + if (!arguments.callee.count) {
  713 + arguments.callee.count = 0;
  714 + }
  715 + arguments.callee.count++;
  716 + var index = parseInt(arguments.callee.count) - 1;
  717 + if (index >= len - 1) {
  718 + cb && cb(sectionList);
  719 + return;
  720 + }
  721 + var f = arguments.callee;
  722 + var poiOne = new BMap.Point(stationsPoint[index].potion.lng, stationsPoint[index].potion.lat);
  723 + var poiTwo = new BMap.Point(stationsPoint[index + 1].potion.lng, stationsPoint[index + 1].potion.lat);
  724 + /* var transit = new BMap.TransitRoute(mapB, {renderOptions: {map: mapB},onPolylinesSet: searchPolylinesSet});*/
  725 + var transit = new BMap.DrivingRoute(baiduMap, {
  726 + renderOptions: {map: baiduMap},
  727 + onPolylinesSet: searchPolylinesSet
  728 + });
  729 + function searchPolylinesSet(results) {
  730 + if (transit.getStatus() != BMAP_STATUS_SUCCESS) {
  731 + } else {
  732 + var sectionArrayList = [];
  733 + for (i = 0; i < results.length; i++) {
  734 + // console.log(results[i].getPolyline().getPath());
  735 + sectionArrayList = sectionArrayList.concat(results[i].getPolyline().getPath());
  736 + }
  737 + var sectionName = stationsPoint[index].name + '至' + stationsPoint[index + 1].name;
  738 + sectionList.push({sectionName: sectionName, points: sectionArrayList});
  739 + }
  740 + f();
  741 + }
  742 + transit.search(poiOne, poiTwo);
  743 + })();
  744 + },
  745 +
  746 + /**
  747 + * 定位站点 按名称检索出的站点
  748 + * @param stationName
  749 + * @param cb
  750 + */
  751 + localtionPoint: function (stationName, cb) {
  752 + baiduMap.closeInfoWindow();
  753 + RoutesService.findStationByName(stationName, function (stations) {
  754 + var marker;
  755 + if (stations.length > 0) {
  756 + var points = new Array();
  757 + for (var i = 0;i < stations.length;i++) {
  758 + var station = stations[i];
  759 + var centerPointWkt = station.centerPointWkt;
  760 + centerPointWkt = centerPointWkt.substring(6, centerPointWkt.length - 1);
  761 + var stationName = station.stationName;
  762 + var coordinates = centerPointWkt.split(' ');
  763 + var centerPoint = new BMap.Point(coordinates[0], coordinates[1]);
  764 + points.push(centerPoint);
  765 + var stationMarker = new BMap.Marker(centerPoint, {
  766 + title: stationName,
  767 + icon: new BMap.Icon('/pages/base/stationroute/css/img/back160.png', new BMap.Size(160, 26)),
  768 + offset: new BMap.Size(60, -16),
  769 + enableDragging: false
  770 + });
  771 + var label = new BMap.Label(stationName, {offset: new BMap.Size(25, 0)});
  772 + label.setStyle({border: '0px'});
  773 + stationMarker.setLabel(label);
  774 + stationMarker.ct_source = '1';
  775 + stationMarker.station = station;
  776 + baiduMap.addOverlay(stationMarker);
  777 + overlays.push(stationMarker);
  778 + stationMarker.addEventListener('click', function (event) {
  779 + event.domEvent.stopPropagation();
  780 + if (setTimeoutId) {
  781 + clearTimeout(setTimeoutId);
  782 + }
  783 + setTimeoutId = setTimeout(function(){
  784 + operation.openStationInfoWin(event.target.station);
  785 + }, 200);
  786 + });
  787 + stationMarker.addEventListener('rightclick', operation.confirmCenterPointHandler);
  788 + }
  789 + var center = new BMap.Polyline(points).getBounds().getCenter();
  790 + baiduMap.panTo(center);
  791 + }
  792 +
  793 + baiduMap.removeEventListener('click', operation.pickCenterPointHandler);
  794 + baiduMap.addEventListener('click', operation.pickCenterPointHandler);
  795 + cb && cb(marker);
  796 + });
  797 + },
  798 +
  799 + /**
  800 + *
  801 + * @param sectionName
  802 + * @param callback
  803 + */
  804 + localtionRoad: function (sectionName, callback) {
  805 + // 关闭信息窗口
  806 + baiduMap.closeInfoWindow();
  807 + RoutesService.findSectionByName(sectionName, function (sections) {
  808 + var marker;
  809 + if (sections.length > 0) {
  810 + var points = new Array();
  811 + for (var i = 0;i < sections.length;i++) {
  812 + var section = sections[i];
  813 + var bsectionVectorWkt = section.bsectionVectorWkt;
  814 + bsectionVectorWkt = bsectionVectorWkt.substring(11, bsectionVectorWkt.length - 1);
  815 + var sectionName = section.sectionName;
  816 + var polyline = operation.wkt2Polyline(bsectionVectorWkt);
  817 + polyline.section = section;
  818 + baiduMap.addOverlay(polyline);
  819 + overlays.push(polyline);
  820 + polyline.addEventListener('click', function (event) {
  821 + alert(event.target.section.id)
  822 + });
  823 + polyline.addEventListener('rightclick', operation.confirmCenterPointHandler);
  824 + }
  825 + var center = polyline.getBounds().getCenter();
  826 + baiduMap.panTo(center);
  827 + }
  828 + });
  829 + },
  830 +
  831 + /**
  832 + * wkt转百度Polyline
  833 + * @param wkt
  834 + * @returns {*}
  835 + */
  836 + wkt2Polyline: function (wkt) {
  837 + var points = new Array(), pointWkts = wkt.split(',');
  838 + for (var i = 0;i < pointWkts.length;i++) {
  839 + var coordinates = pointWkts[i].split(' ');
  840 + points.push(new BMap.Point(coordinates[0], coordinates[1]));
  841 + }
  842 +
  843 + return new BMap.Polyline(points)
  844 + },
  845 +
  846 + /**
  847 + * 百度Polyline转wkt
  848 + * @param wkt
  849 + * @returns {*}
  850 + */
  851 + polyline2Wkt: function (polyline) {
  852 + var points = polyline.getPath(), arr = new Array();
  853 + for (var i = 0;i < points.length;i++) {
  854 + arr.push(points[i].lng + ' ' + points[i].lat);
  855 + }
  856 +
  857 + return 'LINESTRING(' + arr.join(',') + ')';
  858 + },
  859 +
  860 + /**
  861 + * 左键选取站点处理
  862 + * @param e
  863 + */
  864 + pickCenterPointHandler: function(e) {
  865 + baiduMap.removeEventListener('click', operation.pickCenterPointHandler);
  866 + var marker = new BMap.Marker(e.point, {enableDragging: true});
  867 + overlays.push(marker);
  868 + baiduMap.panTo(e.point);
  869 + baiduMap.addOverlay(marker);
  870 + marker.addEventListener('rightclick', operation.confirmCenterPointHandler);
  871 + marker.setAnimation(BMAP_ANIMATION_BOUNCE);
  872 + },
  873 +
  874 + /**
  875 + * 系统规划抓去数据 @param lineNameValue:线路名称;i:方向
  876 + */
  877 + getBmapStationNames: function (lineName, i, cb) {
  878 + var busline = new BMap.BusLineSearch(baiduMap, {
  879 + onGetBusListComplete: function (busListResult) {
  880 + if (busListResult) {
  881 + var first = busListResult.getBusListItem(i);
  882 + busline.getBusLine(first);
  883 + }
  884 + },
  885 + onGetBusLineComplete: function (busLine) {
  886 + if (busLine) {
  887 + cb && cb(busLine);
  888 + }
  889 + }
  890 + });
  891 + busline.getBusList(lineName);
  892 + },
  893 + /**
  894 + * 编辑站点路由
  895 + * @param stationRouteId
  896 + */
  897 + editStation: function (stationRouteId) {
  898 + jQuery.extend(true, editStationRoute, stationArray[stationRouteId]);
  899 + $.get('edit_stationroute_step1.html', function (m) {
  900 + $(pjaxContainer).append(m);
  901 + $('#edit_stationroute_step1_modal').trigger('modal.show');
  902 + });
  903 + },
  904 +
  905 + /**
  906 + * 站间添加路段
  907 + * @param stationRouteId
  908 + */
  909 + addBetweenStationRoad: function (stationRouteId) {
  910 + var version = $("#versions").val();
  911 + // 关闭信息窗口
  912 + baiduMap.closeInfoWindow();
  913 + // 查询下一个站点
  914 + $.get("/api/lsstationroute/findCurrentAndNext", {id: stationRouteId}, function(stationRoutes) {
  915 + if (stationRoutes.length < 2) {
  916 + layer.msg("您选择的站点后没有站点了,不能生成站点间路段!");
  917 + } else {
  918 + var startStationRoute = stationRoutes[0], endStationRoute = stationRoutes[1];
  919 + var startWkt = startStationRoute.station.centerPointWkt, endWkt = endStationRoute.station.centerPointWkt;
  920 + var startCoordinates = startWkt.substring(6, startWkt.length - 1).split(" "), endCoordinates = endWkt.substring(6, endWkt.length - 1).split(" ")
  921 + var sectionList = [];
  922 + var startPoint = new BMap.Point(startCoordinates[0], startCoordinates[1]);
  923 + var endPoint = new BMap.Point(endCoordinates[0], endCoordinates[1]);
  924 + // 路径规划保存按钮
  925 + var label = new BMap.Label("保存路段", {
  926 + offset: new BMap.Size(13, -53)
  927 + });
  928 + label.setStyle({
  929 + color: '#fff',
  930 + background: "url(/pages/base/stationroute/css/img/bg.png)",
  931 + border: '0px solid',
  932 + textAlign: "center",
  933 + height: "28px",
  934 + lineHeight: "26px",
  935 + width: "80px",
  936 + maxWidth: "none"
  937 + });
  938 + label.addEventListener('click', function () {
  939 + var params = {};
  940 + params.lineId = startStationRoute.line.id;
  941 + params.lineCode = startStationRoute.lineCode;
  942 + params.directions = startStationRoute.directions;
  943 + params.stationRouteBegin = startStationRoute.stationName;
  944 + params.stationRouteFinish = endStationRoute.stationName;
  945 + layer.confirm('确定保存', {
  946 + btn : [ '路段调整好了','继续调整','退出'], icon: 3, title:'提示'
  947 + ,btn3: function(index, layero){
  948 + operation.resjtreeDate(params.lineId,params.directions);
  949 + operation.editAChangeCssRemoveDisabled();
  950 + operation.editMapStatusRemove();
  951 + }
  952 + }, function(index, layero){
  953 + layer.close(index);
  954 + params.route = $("#routePlanning").val();
  955 + $.get('doublename_road.html', function (m) {
  956 + $(pjaxContainer).append(m);
  957 + $('#doublename_road_modal').trigger('modal.show', [params]);
  958 + });
  959 + operation.editMapStatusRemove();
  960 + });
  961 + });
  962 + // 路径规划
  963 + var transit = new BMap.DrivingRoute(baiduMap, {
  964 + renderOptions: {
  965 + map: baiduMap,
  966 + enableDragging: true
  967 + },
  968 + onPolylinesSet: searchPolylinesSet
  969 + });
  970 +
  971 + function searchPolylinesSet(results) {
  972 + if (transit.getStatus() == BMAP_STATUS_SUCCESS) {
  973 + var sectionArrayList = [];
  974 + for (i = 0; i < results.length; i++) {
  975 + sectionArrayList = sectionArrayList.concat(results[i].getPolyline().getPath());
  976 + }
  977 + sectionList = sectionArrayList;//JSON.stringify()
  978 + $("#routePlanning").val(JSON.stringify(sectionArrayList));
  979 + var pointMap = new Map();
  980 + pointMap = sectionArrayList[sectionArrayList.length - 1];
  981 + var pointLabel = new BMap.Point(pointMap.lng, pointMap.lat);
  982 + label.enableMassClear();
  983 + label.setPosition(pointLabel);
  984 + baiduMap.addOverlay(label);
  985 + }
  986 + }
  987 + transit.search(startPoint, endPoint);
  988 + transit.disableAutoViewport();
  989 + // 地图编辑状态
  990 + operation.editMapStatus(endStationRoute.directions);
  991 + }
  992 + });
  993 + },
  994 +
  995 + /**
  996 + * 关闭modal时的清理
  997 + * @param station
  998 + */
  999 + closeMobleSetClean: function(station) {
  1000 + var dir = station.directions;
  1001 + var lineId = station.lineId;
  1002 +
  1003 + operation.clearMarkAndOverlays();
  1004 + // 刷新左边树
  1005 + operation.resjtreeDate(lineId,dir,$("#versions").val());
  1006 +
  1007 + // 退出编辑状态
  1008 + operation.editMapStatusRemove();
  1009 + },
  1010 +
  1011 + /**
  1012 + * 定位路段
  1013 + * @param sectionRouteId
  1014 + */
  1015 + focusSection: function(sectionRouteId) {
  1016 + for (var i = 0, p; p = sectionArray[i++];) {
  1017 + if (p.data.id == sectionRouteId) {
  1018 + switch (p.data.directions) {
  1019 + case 3:
  1020 + operation.openSectionInfoWin_inout(p);
  1021 + break;
  1022 + default:
  1023 + operation.openSectionInfoWin(p);
  1024 + break;
  1025 + }
  1026 +
  1027 + }
  1028 + }
  1029 + },
  1030 +
  1031 + /**
  1032 + * 路段编辑
  1033 + * @param sectionRouteId
  1034 + * @param dir
  1035 + */
  1036 + editSection : function(sectionRouteId, dir) {
  1037 + layer.confirm('进入编辑状态', {
  1038 + btn : [ '确定','返回' ], icon: 3, title:'提示'
  1039 + }, function() {
  1040 + operation.editMapStatus(dir);
  1041 + layer.msg('双击保存路段');
  1042 + var polyline;
  1043 + for (var i = 0; polyline = sectionArray[i++];) {
  1044 + if (polyline.data.id == sectionRouteId) {
  1045 + baiduMap.closeInfoWindow();//关闭infoWindow
  1046 + polyline.enableEditing();
  1047 + polyline.setStrokeColor('blue');
  1048 + break;
  1049 + }
  1050 + }
  1051 + // 路段中间点为中心
  1052 + var sectionRoute = polyline.data;
  1053 + var sectionStr = sectionRoute.section.bsectionVectorWkt.substring(11, sectionRoute.section.bsectionVectorWkt.length - 1);
  1054 + // 分割折线坐标字符串
  1055 + var lineArray = sectionStr.split(',');
  1056 + var sectionPointArray = [];
  1057 + for (var i = 0; i < lineArray.length; i++) {
  1058 + sectionPointArray.push(new BMap.Point(lineArray[i].split(' ')[0], lineArray[i].split(' ')[1]));
  1059 + }
  1060 + // 计算中间点
  1061 + var index = parseInt(sectionPointArray.length / 2);
  1062 + var centerPoint = sectionPointArray[index];
  1063 + baiduMap.centerAndZoom(centerPoint, 17);
  1064 + polyline.addEventListener('dblclick', function () {
  1065 + operation.editMapStatusRemove();
  1066 + $.get('edit_sectionroute.html', function(m){
  1067 + $('body').append(m);
  1068 + $('#edit_sectionroute_modal').trigger('modal.show', [polyline]);
  1069 + });
  1070 + });
  1071 + });
  1072 + },
  1073 +
  1074 + /**
  1075 + * 添加第一个路段
  1076 + * @param section
  1077 + */
  1078 + addSection: function(section) {
  1079 + operation.editMapStatus();
  1080 + // 把数据填充到模版中
  1081 + var addSectionHTML = template('add_draw_polyline-temp');
  1082 + $('body .mian-portlet-body').append(addSectionHTML);
  1083 + //暂停和开始绘制
  1084 + $('.draw_polyline_switch>a').on('click', function () {
  1085 + var t = $(this).text();
  1086 + if(t=='暂停绘制'){
  1087 + operation.exitDrawStatus();
  1088 + $(this).text('开始绘制');
  1089 + }
  1090 + else{
  1091 + operation.openDrawStatus();
  1092 + $(this).text('暂停绘制');
  1093 + }
  1094 + });
  1095 + // 开启绘制事件
  1096 + operation.showAddSectionPanel();
  1097 +
  1098 + //取消
  1099 + $('#addSectionCancelBtn').on('click', function () {
  1100 + $('.main_left_panel_m_layer').hide();
  1101 + $(this).parents('.buffer_edit_body').parent().remove();
  1102 + operation.exitDrawStatus();
  1103 + operation.editMapStatusRemove();
  1104 + });
  1105 +
  1106 + //确定
  1107 + $('#addSectionSbmintBtn').on('click', function () {
  1108 + var btn = this;
  1109 + $('#addSectionSbmintBtn').addClass("disabled");
  1110 + var sectionName = $('#sectionNameInput').val();
  1111 + var bsectionVector = $('#bsectionVectorInput').val();
  1112 + var params = {};
  1113 + if(sectionName && bsectionVector) {
  1114 + operation.exitDrawStatus();
  1115 + RoutesService.getSectionCode(function(sectionCode) {
  1116 + var sectionRoute = {};
  1117 + sectionRoute['line.id'] = lineId;
  1118 + sectionRoute.sectionCode = sectionCode;
  1119 + sectionRoute.roadCoding = '';
  1120 + sectionRoute.sectionrouteCode = 100;
  1121 + sectionRoute.sectionTime = 0;
  1122 + sectionRoute.sectionDistance = 0;
  1123 + sectionRoute.speedLimit = 60;
  1124 + sectionRoute.versions = versions;
  1125 + sectionRoute.destroy = 0;
  1126 + sectionRoute.directions = directions;
  1127 + sectionRoute.status = status;
  1128 + sectionRoute.start = section.start;
  1129 + sectionRoute.end = section.end;
  1130 + sectionRoute['section.id'] = sectionCode;
  1131 + sectionRoute['section.sectionCode'] = sectionCode;
  1132 + sectionRoute['section.sectionName'] = sectionName;
  1133 + sectionRoute['section.bsectionVectorWkt'] = bsectionVector;
  1134 +
  1135 + if (directions == 3) {
  1136 + RoutesService.inoutSectionSave(sectionRoute, function (result) {
  1137 + if(result.status =="SUCCESS"){
  1138 + $('.main_left_panel_m_layer').hide();
  1139 + $(btn).parents('.buffer_edit_body').parent().remove();
  1140 + operation.editMapStatusRemove();
  1141 + $('#inoutSearch').click();
  1142 + operation.editAChangeCssRemoveDisabled();
  1143 + layer.msg("添加成功!");
  1144 + } else if(result.status == "ERROR") {
  1145 + layer.msg("添加失败!");
  1146 + }
  1147 + });
  1148 + } else {
  1149 + RoutesService.sectionSave(sectionRoute, function (result) {
  1150 + if(result.status =="SUCCESS"){
  1151 + $('.main_left_panel_m_layer').hide();
  1152 + $(btn).parents('.buffer_edit_body').parent().remove();
  1153 + operation.editMapStatusRemove();
  1154 + $(directions == 0 ? '#upLine' : '#downLine').click();
  1155 + operation.editAChangeCssRemoveDisabled();
  1156 + layer.msg("添加成功!");
  1157 + } else if(result.status == "ERROR") {
  1158 + layer.msg("添加失败!");
  1159 + }
  1160 + });
  1161 + }
  1162 + });
  1163 + } else if(!sectionName){
  1164 + layer.msg('请填写路段名字!');
  1165 + } else if(!bsectionVector){
  1166 + layer.msg('请先绘制路段!');
  1167 + }
  1168 + setTimeout(function () {
  1169 + $("#addSectionSbmintBtn").removeClass("disabled");
  1170 + },1000);
  1171 + });
  1172 + },
  1173 +
  1174 + /**
  1175 + * 已有路段后添加路段
  1176 + * @param sectionRouteId
  1177 + */
  1178 + addSectionAfter: function(sectionRouteId) {
  1179 + /*$.get('add_sectionroute_step1.html', function(m){
  1180 + $(pjaxContainer).append(m);
  1181 + $('#add_sectionroute_step1_modal').trigger('modal.show', [WorldsBMap,DrawingManagerObj,RoutesService,AddStationObj,LineObj,operation]);
  1182 + });*/
  1183 + var lastSectionRoute;
  1184 + // 关闭信息窗口
  1185 + baiduMap.closeInfoWindow();
  1186 + operation.editMapStatus();
  1187 + // 把数据填充到模版中
  1188 + var addSectionHTML = template('add_draw_polyline-temp',{ 'id': sectionRouteId});
  1189 + $('body .mian-portlet-body').append(addSectionHTML);
  1190 + //暂停和开始绘制
  1191 + $('.draw_polyline_switch>a').on('click', function () {
  1192 + var t = $(this).text();
  1193 + if(t=='暂停绘制'){
  1194 + operation.exitDrawStatus();
  1195 + $(this).text('开始绘制');
  1196 + } else {
  1197 + operation.openDrawStatus();
  1198 + $(this).text('暂停绘制');
  1199 + }
  1200 + });
  1201 +
  1202 + //取消
  1203 + $('#addSectionCancelBtn').on('click', function () {
  1204 + $('.main_left_panel_m_layer').hide();
  1205 + $(this).parents('.buffer_edit_body').parent().remove();
  1206 + operation.exitDrawStatus();
  1207 + operation.editMapStatusRemove();
  1208 + });
  1209 + RoutesService.getSectionRouteInfoById(sectionRouteId, function(data) {
  1210 + operation.showAddSectionPanel(data);
  1211 + lastSectionRoute = data;
  1212 + });
  1213 +
  1214 + //确定
  1215 + $('#addSectionSbmintBtn').on('click', function () {
  1216 + var btn = this;
  1217 + $('#addSectionSbmintBtn').addClass("disabled");
  1218 + var sectionName = $('#sectionNameInput').val();
  1219 + var bsectionVectorWkt = $('#bsectionVectorInput').val();
  1220 + var params = {};
  1221 + if(sectionName && bsectionVectorWkt) {
  1222 + operation.exitDrawStatus();
  1223 + RoutesService.getSectionCode(function(sectionCode) {
  1224 + params = {'section.id': sectionCode, 'section.sectionCode': sectionCode, 'section.sectionName': sectionName, 'section.bsectionVectorWkt': bsectionVectorWkt, 'section.speedLimit': 0, 'section.distance': 0, 'line.id': lastSectionRoute.line.id, sectionCode: sectionCode, lineCode: lastSectionRoute.lineCode, roadCoding: '', sectionrouteCode: parseInt(lastSectionRoute.sectionrouteCode) + 1, versions: lastSectionRoute.versions, destroy: 0, directions: lastSectionRoute.directions};
  1225 +
  1226 + RoutesService.sectionSave(params, function (result) {
  1227 + if(result.status =="SUCCESS"){
  1228 + $('.main_left_panel_m_layer').hide();
  1229 + $(btn).parents('.buffer_edit_body').parent().remove();
  1230 + operation.editMapStatusRemove();
  1231 + operation.resjtreeDate(lastSectionRoute.line.id, lastSectionRoute.directions, $("#versions").val());
  1232 + operation.editAChangeCssRemoveDisabled();
  1233 + layer.msg("添加成功!");
  1234 + } else if(result.status =="ERROR") {
  1235 + layer.msg("添加失败!");
  1236 + }
  1237 + });
  1238 + });
  1239 + } else if(!sectionName){
  1240 + layer.msg('请填写路段名字!');
  1241 + } else if(!bsectionVector)
  1242 + layer.msg('请先绘制路段!');
  1243 + setTimeout(function () {
  1244 + $("#addSectionSbmintBtn").removeClass("disabled");
  1245 + },1000);
  1246 + });
  1247 + },
  1248 +
  1249 + /**
  1250 + * 撤销站点
  1251 + * @param stationRouteId
  1252 + * @param lineId
  1253 + * @param dir
  1254 + */
  1255 + destroyStation: function(stationRouteId, lineId, dir) {
  1256 + layer.confirm('你确定要撤销此站点吗?', {
  1257 + btn : [ '撤销','返回' ], icon: 3, title:'提示'
  1258 + }, function(){
  1259 + $.post('/api/lsstationroute/destroy', {id: stationRouteId}, function(res) {
  1260 + if (res.status == 'SUCCESS') {
  1261 + // 弹出添加成功提示消息
  1262 + layer.msg('撤销成功!');
  1263 + } else {
  1264 + // 弹出添加失败提示消息
  1265 + layer.msg('撤销失败!');
  1266 + }
  1267 + // 刷新左边树
  1268 + var version = $("#verions").val();
  1269 + operation.resjtreeDate(lineId, dir, version);
  1270 + });
  1271 + });
  1272 + },
  1273 +
  1274 + /**
  1275 + * 撤销路段
  1276 + * @param sectionRouteId
  1277 + * @param lineId
  1278 + * @param dir
  1279 + */
  1280 + destroySection: function(sectionRouteId,lineId,dir) {
  1281 + layer.confirm('你确定要撤销此路段吗?', {
  1282 + btn : [ '撤销','返回' ], icon: 3, title:'提示'
  1283 + }, function(){
  1284 + $.post('/api/lssectionroute/destroy',{id: sectionRouteId},function(res) {
  1285 + if (res.status == 'SUCCESS') {
  1286 + // 弹出添加成功提示消息
  1287 + layer.msg('撤销成功!');
  1288 + } else {
  1289 + // 弹出添加失败提示消息
  1290 + layer.msg('撤销失败!');
  1291 + }
  1292 + // 刷新左边树
  1293 + var version = $("#verions").val();
  1294 + operation.resjtreeDate(lineId, dir, version);
  1295 + });
  1296 + });
  1297 + },
  1298 + /**
  1299 + * 打开路段信息窗口
  1300 + * @param p
  1301 + */
  1302 + openSectionInfoWin: function(p) {
  1303 + var sectionRoute = p.data;
  1304 + var dir = sectionRoute.directions;
  1305 + var width = operation.strGetLength(sectionRoute.section.sectionName) * 10;
  1306 + // 信息窗口参数属性
  1307 + var opts = {
  1308 + width: (width < 200 ? 200 : width),
  1309 + height: 150,
  1310 + enableMessage: false,
  1311 + enableCloseOnClick: false,
  1312 + enableAutoPan: false
  1313 + };
  1314 + var htm = '<span style="color: #ff8355;font-size: 18px;">' + sectionRoute.section.sectionName + '</span>' +
  1315 + '<span class="help-block" >路段编码:' + sectionRoute.sectionCode + '</span>' +
  1316 + '<span class="help-block" >路段序号:' + sectionRoute.sectionrouteCode + '</span>' +
  1317 + '<span class="help-block" >版本号&nbsp&nbsp:' + sectionRoute.versions + '</span>' +
  1318 + '<div >';
  1319 +
  1320 + if($($("#versions").find("option:selected")[0]).attr("status") > 0){
  1321 + htm += '<button class="info_win_btn" id="editStation" onclick="RoutesOperation.editSection(' + sectionRoute.id +','+dir+ ')">修改</button>' +
  1322 + '<button class="info_win_btn" id="addBetweenStationRoad" onclick="RoutesOperation.destroySection('+ sectionRoute.id + ','+sectionRoute.line.id+','+sectionRoute.directions+')">撤销</button>' +
  1323 + '<button class="info_win_btn" id="addSectionAfter" onclick="RoutesOperation.addSectionAfter('+sectionRoute.id+')">添加路段(之后)</button>' +
  1324 + '</div>';
  1325 + }
  1326 +
  1327 + var infoWindow_target = new BMap.InfoWindow(htm, opts);
  1328 + var sectionStr = sectionRoute.section.bsectionVectorWkt.substring(11, sectionRoute.section.bsectionVectorWkt.length - 1);
  1329 + var lineArray = sectionStr.split(',');
  1330 + var sectionArray = [];
  1331 + for (var i = 0; i < lineArray.length; i++) {
  1332 + sectionArray.push(new BMap.Point(lineArray[i].split(' ')[0], lineArray[i].split(' ')[1]));
  1333 + }
  1334 + var index = parseInt(sectionArray.length / 2);
  1335 + var centerPoint = sectionArray[index];
  1336 + infoWindow_target.addEventListener('close', function (e) {
  1337 + p.setStrokeColor("red");
  1338 + road_win_show_p = null;
  1339 + });
  1340 + infoWindow_target.addEventListener('open', function (e) {
  1341 + p.setStrokeColor("#20bd26");
  1342 + road_win_show_p = p;
  1343 + });
  1344 + baiduMap.openInfoWindow(infoWindow_target, centerPoint);
  1345 + baiduMap.panTo(centerPoint);
  1346 + },
  1347 + /**
  1348 + * 绘制新增路段
  1349 + * @param section
  1350 + */
  1351 + showAddSectionPanel : function (section) {
  1352 + var point;
  1353 + if(section){
  1354 + var sectionBsectionVectorStr = section.section.bsectionVectorWkt;
  1355 + var line = sectionBsectionVectorStr.substring(11, sectionBsectionVectorStr.length - 1),
  1356 + points = line.split(','),
  1357 + pointStr = points[points.length-1].split(' ');
  1358 +
  1359 + point = new BMap.Point(pointStr[0], pointStr[1]);
  1360 + }
  1361 +
  1362 + baiduMap.centerAndZoom(point, 18);
  1363 +
  1364 + sectionDrawingManager = new BMapLib.DrawingManager(baiduMap, {
  1365 + polylineOptions: styleOptions
  1366 + });
  1367 +
  1368 + sectionDrawingManager.open();
  1369 + sectionDrawingManager.setDrawingMode('polyline');
  1370 +
  1371 + //绘制完成
  1372 + sectionDrawingManager.addEventListener('polylinecomplete', function (e) {
  1373 + sectionDrawingManager.close();
  1374 + var polyline = new BMap.Polyline(e.getPath(), {strokeWeight: 7, strokeColor: 'blue', strokeOpacity: 0.7});
  1375 + baiduMap.removeOverlay(e);
  1376 + baiduMap.addOverlay(polyline);
  1377 + polyline.enableEditing();
  1378 + editPolyline = polyline;
  1379 +
  1380 + $('#bsectionVectorInput').val(operation.points2Wkt(e.getPath()));
  1381 + });
  1382 + },
  1383 + /**
  1384 + * 点转wkt
  1385 + * @param points
  1386 + * @returns {string}
  1387 + */
  1388 + points2Wkt: function (points) {
  1389 + var wkt = new Array();
  1390 + for (var i = 0;i < points.length;i++) {
  1391 + wkt.push(points[i].lng + ' ' + points[i].lat);
  1392 + }
  1393 +
  1394 + return 'LINESTRING(' + wkt.join(',') + ')';
  1395 + },
  1396 + /**
  1397 + * 退出图形编辑
  1398 + */
  1399 + exitDrawStatus : function () {
  1400 + if (sectionDrawingManager) {
  1401 + $('#bsectionVectorInput').val("");
  1402 + operation.clearOtherOverlay();
  1403 + sectionDrawingManager.close();
  1404 + }
  1405 + },
  1406 + /**
  1407 + * 打开图形编辑
  1408 + */
  1409 + openDrawStatus : function () {
  1410 + if (sectionDrawingManager) {
  1411 + $('#bsectionVectorInput').val("");
  1412 + operation.clearOtherOverlay();
  1413 + sectionDrawingManager.open();
  1414 + }
  1415 + },
  1416 + /**
  1417 + * 清除覆盖物
  1418 + */
  1419 + clearOtherOverlay : function () {
  1420 + var all = baiduMap.getOverlays();
  1421 + for (var i = 0, obj; obj = all[i++];) {
  1422 + if (obj.ct_source && obj.ct_source == '1')
  1423 + continue;
  1424 + baiduMap.removeOverlay(obj);
  1425 + }
  1426 + },
  1427 +
  1428 + /**
  1429 + * 清除覆盖物
  1430 + */
  1431 + clearMarkAndOverlays: function () {
  1432 + // 清楚地图覆盖物
  1433 + baiduMap.clearOverlays();
  1434 + baiduMap.removeOverlay();
  1435 + sectionArray = [];
  1436 + },
  1437 + clearMark: function () {
  1438 + // 清楚地图覆盖物
  1439 + baiduMap.removeOverlay();
  1440 + },
  1441 + /**
  1442 + * 计算字符串长度
  1443 + * @param str
  1444 + * @returns {*}
  1445 + */
  1446 + strGetLength: function (str) {
  1447 + return str.replace(/[\u0391-\uFFE5]/g, "aa").length; //先把中文替换成两个字节的英文,在计算长度
  1448 + },
  1449 + /**
  1450 + * 根据坐标匹配库中的站点
  1451 + * @param stations
  1452 + * @param callback
  1453 + */
  1454 + stationsPointsToLibraryPoint : function(stations, callback) {
  1455 + $.ajax('/station/matchStation', {
  1456 + method: 'POST',
  1457 + data: JSON.stringify(stations),
  1458 + contentType: 'application/json',
  1459 + success: function (res) {
  1460 + callback && callback(res.data);
  1461 + return;
  1462 + }
  1463 + });
  1464 + },
  1465 + /** 获取距离与时间 @param <points:坐标点集合> */
  1466 + getDistanceAndDuration : function(stations,callback){
  1467 + var stationRoutes = new Array();
  1468 + stations.forEach(function (item) {
  1469 + var stationRoute = { stationName: item.stationName, station: item };
  1470 + item.distance = 0;
  1471 + item.duration = 0;
  1472 + stationRoutes.push(stationRoute);
  1473 + });
  1474 + callback(stationRoutes);
  1475 + },
  1476 +
  1477 + /**
  1478 + * 画圆
  1479 + * point(lng,lat) 中心点
  1480 + * radius 半径(m)
  1481 + * isMark 是否加站名
  1482 + */
  1483 + drawCircle: function (point, radius, stationName, isMark) {
  1484 + var center = new BMap.Point(point.lng, point.lat);
  1485 + var circle = new BMap.Circle(center, radius ,{strokeColor:"blue", strokeWeight:2, strokeOpacity:0.5});
  1486 + baiduMap.addOverlay(circle);
  1487 + if (isMark) {
  1488 + var html = '<div style="position: absolute; margin: 0pt; padding: 0pt; width: 160px; height: 26px; left: -3px; top: -30px; overflow: hidden;">'
  1489 + + '<img class="rm3_image" style="border:none;left:0px; top:0px; position:absolute;" src="/pages/base/stationroute/css/img/back160.png">'
  1490 + + '</div>'
  1491 + + '<label class=" BMapLabel" unselectable="on" style="position: absolute; -moz-user-select: none; display: inline; cursor: inherit; border: 0px none; padding: 2px 1px 1px; white-space: nowrap; font: 12px arial,simsun; z-index: 80; color: rgb(255, 102, 0); left: 20px; top: -30px;">' + stationName + '</label>';
  1492 +
  1493 + var myRichMarker = new BMapLib.RichMarker(html, center, {
  1494 + "title": stationName,
  1495 + "anchor": new BMap.Size(-10, 8),
  1496 + "enableDragging": true
  1497 + });
  1498 + myRichMarker.disableDragging();
  1499 + myRichMarker.ct_source = '1';
  1500 + baiduMap.addOverlay(myRichMarker);
  1501 + }
  1502 + },
  1503 +
  1504 + /**
  1505 + * 画多边形
  1506 + * points 点数组
  1507 + */
  1508 + drawPolygon: function (points, stationName, isMark) {
  1509 + var bdPoints = new Array(), i = 0, point;
  1510 + for (i = 0;i < points.length;i++) {
  1511 + point = points[i].split(' ');
  1512 + bdPoints.push(new BMap.Point(point[0], point[1]));
  1513 + }
  1514 + var polygon = new BMap.Polygon(bdPoints), center = bdPoints[0];
  1515 + baiduMap.addOverlay(polygon);
  1516 + if (isMark) {
  1517 + var html = '<div style="position: absolute; margin: 0pt; padding: 0pt; width: 160px; height: 26px; left: -3px; top: -30px; overflow: hidden;">'
  1518 + + '<img class="rm3_image" style="border:none;left:0px; top:0px; position:absolute;" src="/pages/base/stationroute/css/img/back160.png">'
  1519 + + '</div>'
  1520 + + '<label class=" BMapLabel" unselectable="on" style="position: absolute; -moz-user-select: none; display: inline; cursor: inherit; border: 0px none; padding: 2px 1px 1px; white-space: nowrap; font: 12px arial,simsun; z-index: 80; color: rgb(255, 102, 0); left: 20px; top: -30px;">' + stationName + '</label>';
  1521 +
  1522 + var myRichMarker = new BMapLib.RichMarker(html, center, {
  1523 + "title": stationName,
  1524 + "anchor": new BMap.Size(-10, 8),
  1525 + "enableDragging": true
  1526 + });
  1527 + myRichMarker.disableDragging();
  1528 + myRichMarker.ct_source = '1';
  1529 + baiduMap.addOverlay(myRichMarker);
  1530 + }
  1531 + },
  1532 +
  1533 + /**
  1534 + * 画线
  1535 + * @param points
  1536 + * @param data
  1537 + * @param start
  1538 + * @param end
  1539 + */
  1540 + drawPolyLine: function (points, data, start, end) {
  1541 + var bdPoints = new Array(), i = 0, point, polyline;
  1542 + for (i = 0;i < points.length;i++) {
  1543 + point = points[i].split(' ');
  1544 + bdPoints.push(new BMap.Point(point[0], point[1]));
  1545 + }
  1546 + // 创建线路走向
  1547 + polyline = new BMap.Polyline(bdPoints, {
  1548 + strokeColor: 'red',
  1549 + strokeWeight: 6,
  1550 + strokeOpacity: 0.7
  1551 + });
  1552 +
  1553 + polyline.data = data;
  1554 + polyline.start = start;
  1555 + polyline.end = end;
  1556 + polyline.ct_source = '1';
  1557 + // 把折线添加到地图上
  1558 + baiduMap.addOverlay(polyline);
  1559 + // 聚焦事件
  1560 + polyline.addEventListener('mousemove', function (e) {
  1561 + if (this != editPolyline)
  1562 + this.setStrokeColor("#20bd26");
  1563 + });
  1564 + // 失去焦点
  1565 + polyline.addEventListener('mouseout', function (e) {
  1566 + if (this != editPolyline && this != road_win_show_p)
  1567 + this.setStrokeColor("red");
  1568 + });
  1569 + // 添加单击事件
  1570 + polyline.addEventListener('onclick', function (e) {
  1571 + // 打开信息窗口
  1572 + if (map_status != 1)
  1573 + operation.openSectionInfoWin_inout(this);
  1574 + });
  1575 + // 添加右击事件
  1576 + polyline.addEventListener('rightclick', function (e) {
  1577 + if (currentSection.enableEditing) {
  1578 + this.disableEditing();
  1579 + operation.saveSection_inout(this);
  1580 + }
  1581 + });
  1582 + sectionArray.push(polyline);
  1583 + },
  1584 +
  1585 + /**
  1586 + * 打开进出场路段信息窗口
  1587 + * @param p
  1588 + */
  1589 + openSectionInfoWin_inout: function(p) {
  1590 + var sectionRoute = p.data;
  1591 + var dir = sectionRoute.directions;
  1592 + var width = operation.strGetLength(sectionRoute.section.sectionName) * 10;
  1593 + var opts = {
  1594 + width: (width < 200 ? 200 : width),
  1595 + height: 150,
  1596 + enableMessage: false,
  1597 + enableCloseOnClick: false,
  1598 + enableAutoPan: false
  1599 + };
  1600 + var htm = '<span style="color: #ff8355;font-size: 18px;">' + sectionRoute.section.sectionName + '</span>' +
  1601 + '<span class="help-block" >路段编码:' + sectionRoute.sectionCode + '</span>' +
  1602 + '<span class="help-block" >路段序号:' + sectionRoute.sectionrouteCode + '</span>' +
  1603 + '<span class="help-block" >版本号&nbsp&nbsp:' + sectionRoute.versions + '</span>' +
  1604 + '<div >';
  1605 +
  1606 + if($($("#versions").find("option:selected")[0]).attr("status") > 0){
  1607 + htm += '<button class="info_win_btn" id="editStation" onclick="RoutesOperation.editSection_inout(' + sectionRoute.id +','+dir+ ')">修改</button>' +
  1608 + '<button class="info_win_btn" id="addBetweenStationRoad" onclick="RoutesOperation.destroySection_inout('+ sectionRoute.id + ','+sectionRoute.line.id+','+sectionRoute.directions+')">撤销</button>' +
  1609 + '<button class="info_win_btn" id="addSectionAfter" onclick="RoutesOperation.addSectionAfter_inout('+sectionRoute.id+')">添加路段(之后)</button>' +
  1610 + '</div>';
  1611 + }
  1612 +
  1613 + var infoWindow_target = new BMap.InfoWindow(htm, opts);
  1614 + var sectionStr = sectionRoute.section.bsectionVectorWkt.substring(11, sectionRoute.section.bsectionVectorWkt.length - 1);
  1615 + var lineArray = sectionStr.split(',');
  1616 + var sectionArray = [];
  1617 + for (var i = 0; i < lineArray.length; i++) {
  1618 + sectionArray.push(new BMap.Point(lineArray[i].split(' ')[0], lineArray[i].split(' ')[1]));
  1619 + }
  1620 + var index = parseInt(sectionArray.length / 2);
  1621 + var centerPoint = sectionArray[index];
  1622 + infoWindow_target.addEventListener('close', function (e) {
  1623 + p.setStrokeColor("red");
  1624 + road_win_show_p = null;
  1625 + });
  1626 + infoWindow_target.addEventListener('open', function (e) {
  1627 + p.setStrokeColor("#20bd26");
  1628 + road_win_show_p = p;
  1629 + });
  1630 + baiduMap.openInfoWindow(infoWindow_target, centerPoint);
  1631 + baiduMap.panTo(centerPoint);
  1632 + },
  1633 +
  1634 + /**
  1635 + * 进出场路段设置为编辑状态
  1636 + */
  1637 + editSection_inout: function(sectionRouteId) {
  1638 + layer.confirm('进入编辑状态', {
  1639 + btn : [ '确定','返回' ], icon: 3, title:'提示'
  1640 + }, function() {
  1641 + operation.editMapStatus(dir);
  1642 + layer.msg('双击保存路段');
  1643 + var p;
  1644 + for (var i = 0; p = sectionArray[i++];) {
  1645 + if (p.data.id == sectionRouteId) {
  1646 + baiduMap.closeInfoWindow();//关闭infoWindow
  1647 + p.enableEditing();
  1648 + p.setStrokeColor('blue');
  1649 + editPolyline = p;
  1650 + break;
  1651 + }
  1652 + }
  1653 + var sectionRoute = p.data;
  1654 + var sectionStr = sectionRoute.section.bsectionVectorWkt.substring(11, sectionRoute.section.bsectionVectorWkt.length - 1);
  1655 + var lineArray = sectionStr.split(',');
  1656 + var sectionPointArray = [];
  1657 + for (var i = 0; i < lineArray.length; i++) {
  1658 + sectionPointArray.push(new BMap.Point(lineArray[i].split(' ')[0], lineArray[i].split(' ')[1]));
  1659 + }
  1660 + var index = parseInt(sectionPointArray.length / 2);
  1661 + var centerPoint = sectionPointArray[index];
  1662 + baiduMap.centerAndZoom(centerPoint, 17);
  1663 + p.addEventListener('dblclick', function (event) {
  1664 + var polyline = event.target;
  1665 + polyline.data.section.bsectionVectorWkt = operation.polyline2Wkt(polyline)
  1666 + operation.editMapStatusRemove();
  1667 + $.get('editsection_inout.html', function(m){
  1668 + $('body').append(m);
  1669 + $('#edit_section_modal').trigger('modal.show', [polyline]);
  1670 + });
  1671 + });
  1672 + });
  1673 + },
  1674 +
  1675 + /**
  1676 + * 撤销进出场路段
  1677 + * @param sectionRouteId
  1678 + */
  1679 + destroySection_inout : function(sectionRouteId) {
  1680 + layer.confirm('你确定要撤销此路段吗?', {
  1681 + btn : [ '撤销','返回' ], icon: 3, title:'提示'
  1682 + }, function(){
  1683 + var status = $($("#versions").find("option:selected")[0]).attr("status");
  1684 + $.post('/inout/destroy',{'id': sectionRouteId, status:status},function(res) {
  1685 + if (res.status == 'SUCCESS') {
  1686 + layer.msg('撤销成功!');
  1687 + } else {
  1688 + layer.msg('撤销失败!');
  1689 + }
  1690 + // 刷新左边树
  1691 + $('#inoutSearch').click();
  1692 + });
  1693 + });
  1694 + },
  1695 +
  1696 + /**
  1697 + * 进出场 在已有路段后添加路段
  1698 + * @param sectionRouteId
  1699 + */
  1700 + addSectionAfter_inout : function(sectionRouteId) {
  1701 + //order = after before;
  1702 + var beforeSection;
  1703 + // 关闭信息窗口
  1704 + baiduMap.closeInfoWindow();
  1705 + operation.editMapStatus();
  1706 + // 把数据填充到模版中
  1707 + var addSectionHTML = template('add_draw_polyline-temp',{ 'id': sectionRouteId});
  1708 + $('body .mian-portlet-body').append(addSectionHTML);
  1709 + //暂停和开始绘制
  1710 + $('.draw_polyline_switch>a').on('click', function () {
  1711 + var t = $(this).text();
  1712 + if(t=='暂停绘制'){
  1713 + operation.exitDrawStatus();
  1714 + $(this).text('开始绘制');
  1715 + }
  1716 + else{
  1717 + operation.openDrawStatus();
  1718 + $(this).text('暂停绘制');
  1719 + }
  1720 + });
  1721 +
  1722 + //取消
  1723 + $('#addSectionCancelBtn').on('click', function () {
  1724 + $('.main_left_panel_m_layer').hide();
  1725 + $(this).parents('.buffer_edit_body').parent().remove();
  1726 + operation.exitDrawStatus();
  1727 + operation.editMapStatusRemove();
  1728 + });
  1729 + RoutesService.getRouteInfoById(sectionRouteId, function(data){
  1730 + beforeSection = data;
  1731 + beforeSection.sectionBsectionVector = beforeSection.section.bsectionVectorWkt;
  1732 + operation.showAddSectionPanel(beforeSection);
  1733 + });
  1734 +
  1735 + //确定
  1736 + $('#addSectionSbmintBtn').on('click', function () {
  1737 + var btn = this;
  1738 + $('#addSectionSbmintBtn').addClass("disabled");
  1739 + var sectionName = $('#sectionNameInput').val();
  1740 + var bsectionVector = $('#bsectionVectorInput').val();
  1741 + var sectionRoute = {};
  1742 + if(sectionName && bsectionVector) {
  1743 + operation.exitDrawStatus();
  1744 + RoutesService.getSectionCode(function(sectionCode) {
  1745 + sectionRoute['line.id'] = lineId;
  1746 + sectionRoute.sectionCode = sectionCode;
  1747 + sectionRoute.roadCoding = '';
  1748 + sectionRoute.sectionrouteCode = beforeSection.sectionrouteCode + 1;
  1749 + sectionRoute.sectionTime = 0;
  1750 + sectionRoute.sectionDistance = 0;
  1751 + sectionRoute.speedLimit = 60;
  1752 + sectionRoute.versions = versions;
  1753 + sectionRoute.destroy = 0;
  1754 + sectionRoute.directions = directions;
  1755 + sectionRoute.status = status;
  1756 + sectionRoute.start = beforeSection.start;
  1757 + sectionRoute.end = beforeSection.end;
  1758 + sectionRoute['section.id'] = sectionCode;
  1759 + sectionRoute['section.sectionCode'] = sectionCode;
  1760 + sectionRoute['section.sectionName'] = sectionName;
  1761 + sectionRoute['section.bsectionVectorWkt'] = bsectionVector;
  1762 + sectionRoute.status = status;
  1763 +
  1764 + RoutesService.inoutSectionSave(sectionRoute, function (result) {
  1765 + if(result.status == "SUCCESS"){
  1766 + $('.main_left_panel_m_layer').hide();
  1767 + $(btn).parents('.buffer_edit_body').parent().remove();
  1768 + operation.editMapStatusRemove();
  1769 + $('#inoutSearch').click();
  1770 + operation.editAChangeCssRemoveDisabled();
  1771 + layer.msg("添加成功!");
  1772 + } else if(result.status == "ERROR") {
  1773 + layer.msg("添加失败!");
  1774 + }
  1775 + });
  1776 + });
  1777 + } else if(!sectionName){
  1778 + layer.msg('请填写路段名字!');
  1779 + } else if(!bsectionVector)
  1780 + layer.msg('请先绘制路段!');
  1781 + setTimeout(function () {
  1782 + $("#addSectionSbmintBtn").removeClass("disabled");
  1783 + },1000);
  1784 + });
  1785 + },
  1786 + /**
  1787 + * 保存进出场路段
  1788 + */
  1789 + saveSection_inout: function () {
  1790 + $.get('editsection_inout.html', function(m){
  1791 + $('body').append(m);
  1792 + $('#edit_section_modal').trigger('modal.show', [currentSection]);
  1793 + });
  1794 + },
  1795 + /**
  1796 + * 添加站点时marker右键事件监听
  1797 + * 确认站点中心点
  1798 + */
  1799 + confirmCenterPointHandler: function (event) {
  1800 + // 清除覆盖物
  1801 + baiduMap.closeInfoWindow();
  1802 + baiduMap.clearOverlays();
  1803 + baiduMap.removeEventListener('click', operation.pickCenterPointHandler);
  1804 +
  1805 + var marker = event.target;
  1806 + var position = marker.getPosition(), station = marker.station;
  1807 + marker.disableDragging();
  1808 + baiduMap.addOverlay(marker);
  1809 + if (station) {
  1810 + var label = new BMap.Label(station.stationName, {offset: new BMap.Size(25, 0)});
  1811 + label.setStyle({border: '0px'});
  1812 + marker.setLabel(label);
  1813 + addStationRoute.id = station.id;
  1814 + addStationRoute.stationCode = station.stationCode;
  1815 + addStationRoute.stationName = station.stationName;
  1816 + layer.msg('已选定站点!');
  1817 + } else {
  1818 + delete addStationRoute.id;
  1819 + delete addStationRoute.stationCode;
  1820 + addStationRoute.centerPointWkt = position.lng + ' ' + position.lat;
  1821 + layer.msg('已确定中心点!');
  1822 + }
  1823 + marker.removeEventListener('rightclick', operation.confirmCenterPointHandler);
  1824 + if (addStationRoute.shapedType === 'd') {
  1825 + operation.openDrawingManager();
  1826 + operation.editMapStatus(directions);
  1827 + layer.msg('请点击选择多边形区域');
  1828 + } else {
  1829 + marker.addEventListener('dblclick', operation.formCenterPointHandler);
  1830 + layer.msg('请双击中心点图标进行下一步操作');
  1831 + }
  1832 + },
  1833 + /**
  1834 + * 确认中心点之后 填写附加字段
  1835 + */
  1836 + formCenterPointHandler: function () {
  1837 + if (setTimeoutId) {
  1838 + clearTimeout(setTimeoutId);
  1839 + }
  1840 + $.get('add_stationroute_step2.html', function(m){
  1841 + $(pjaxContainer).append(m);
  1842 + $('#add_stationroute_step2_modal').trigger('modal.show');
  1843 + });
  1844 + },
  1845 + /**
  1846 + * 添加站点前初始化
  1847 + */
  1848 + addStationInit: function () {
  1849 + addStationRoute = {};
  1850 + for (var i = 0;i < overlays.length;i++) {
  1851 + baiduMap.removeOverlay(overlays[i]);
  1852 + }
  1853 + overlays = new Array();
  1854 + },
  1855 +
  1856 + /***************************************************function*******************************************************/
  1857 + /** 初始化线路标题与ID */
  1858 + setTiteText : function(lineId) {
  1859 + // 根据线路ID获取线路名称
  1860 + RoutesService.getIdLineName(lineId,function(data) {
  1861 + // 定义线路名称
  1862 + var lineNameV = data.name;
  1863 + $('.portlet-title .caption').text(lineNameV);
  1864 + });
  1865 + },
  1866 + /** @param direction 方向 @return array */
  1867 + getCurrSelNode : function(direction){
  1868 + // 定义Obj
  1869 + var array = [];
  1870 + try {
  1871 + // 上行
  1872 + if(direction=='0'){
  1873 + // 获取上行选中节点
  1874 + array = $.jstree.reference("#station_Up_tree").get_selected(true);
  1875 + // 下行
  1876 + }else if(direction=='1'){
  1877 + // 获取下行选中节点
  1878 + array = $.jstree.reference("#station_Down_tree").get_selected(true);
  1879 + }
  1880 + } catch (e) {
  1881 + console.log(e);
  1882 + }
  1883 + // 返回Obj
  1884 + return array;
  1885 + },
  1886 + startOrEndPoint: function(points, carpark) {
  1887 + var harr = new Array, i = 0;
  1888 + for (i = 0;i < points.length;i++) {
  1889 + harr.push('<option value="', points[i].stationName, '_station">', points[i].stationName, '</option>');
  1890 + points[i].bdPoint = points[i].station.bJwpoints;
  1891 + points[i].bdPoints = points[i].station.bdPolygon;
  1892 + points[i].shapesType = points[i].station.shapesType;
  1893 + points[i].radius = points[i].station.radius;
  1894 + name2Point[points[i].stationName + '_station'] = points[i];
  1895 + }
  1896 + harr.push('<option value="', carpark.parkName, '_park">', carpark.parkName, '</option>');
  1897 + carpark.bdPoint = carpark.bCenterPoint;
  1898 + carpark.bdPoints = carpark.bParkPoint;
  1899 + carpark.stationName = carpark.parkName;
  1900 + name2Point[carpark.parkName + '_park'] = carpark;
  1901 +
  1902 + return harr.join('');
  1903 + },
  1904 + /** @param id:线路ID ;directionData:方向 */
  1905 + resjtreeDate : function(id, direction, version){
  1906 + if(!version){
  1907 + version = $("#versions").val();
  1908 + }
  1909 +
  1910 + var status = $($("#versions").find("option:selected")[0]).attr("status");
  1911 + if (direction == 3) {
  1912 + // 隐藏上行规划
  1913 + $('#upToolsMobal').hide();
  1914 + // 隐藏上行树
  1915 + $('#uptreeMobal').hide();
  1916 + // 隐藏下行规划
  1917 + $('#downToolsMobal').hide();
  1918 + // 隐藏下行树
  1919 + $('#DowntreeMobal').hide();
  1920 + //
  1921 + $('#InoutCarparktreeMobal .table-toolbar').hide();
  1922 +
  1923 + RoutesService.getStartEndByLine(id, version, function (result) {
  1924 + if (result.data) {
  1925 + $('#InoutCarparktreeMobal').show();
  1926 + var formHtml = template('inout-carpark-search-form');
  1927 + $('.inout-search').html(formHtml);
  1928 +
  1929 + $('#startPoint').html(operation.startOrEndPoint(result.data.start, result.data.carpark));
  1930 + $('#endPoint').html(operation.startOrEndPoint(result.data.end, result.data.carpark));
  1931 + $('#startPoint').on('change', function () {
  1932 + $('#InoutCarparktreeMobal .table-toolbar').hide();
  1933 + });
  1934 + $('#endPoint').on('change', function () {
  1935 + $('#InoutCarparktreeMobal .table-toolbar').hide();
  1936 + });
  1937 + $('#inoutSearch').on('click', function () {
  1938 + var start = $('#startPoint').val().split('_'), end = $('#endPoint').val().split('_');
  1939 + if (start[1] == end[1]) {
  1940 + layer.msg('进出场的站点不可能同时为站点或停车场');
  1941 + return;
  1942 + }
  1943 +
  1944 + $('#inout_carpark_tree').show();
  1945 + $('#InoutCarparktreeMobal .table-toolbar').show();
  1946 +
  1947 + RoutesService.getRouteByStartEnd(id, version, start[0], end[0], (result1) => {
  1948 + var routes = result1.data.routes, rootNode;
  1949 + operation.clearMarkAndOverlays();
  1950 + var startPoint = name2Point[start.join('_')], endPoint = name2Point[end.join('_')], point, points;
  1951 + if (startPoint.shapesType === 'r') {
  1952 + point = startPoint.bdPoint.split(' ');
  1953 + operation.drawCircle({lng : point[0], lat : point[1]}, startPoint.radius, startPoint.stationName, true);
  1954 + } else if (startPoint.shapesType === 'd') {
  1955 + points = startPoint.bdPoints;
  1956 + points = points.replace('POLYGON ((', '').replace('POLYGON((', '').replaceAll(', ', ',').replace('))', '');
  1957 + points = points.split(',')
  1958 + operation.drawPolygon(points, startPoint.stationName, true);
  1959 + }
  1960 +
  1961 + if (endPoint.shapesType === 'r') {
  1962 + point = endPoint.bdPoint.split(' ');
  1963 + operation.drawCircle({lng : point[0], lat : point[1]}, endPoint.radius, endPoint.stationName, true);
  1964 + } else if (endPoint.shapesType === 'd') {
  1965 + points = endPoint.bdPoints;
  1966 + points = points.replace('POLYGON ((', '').replace('POLYGON((', '').replaceAll(', ', ',').replace('))', '');
  1967 + points = points.split(',')
  1968 + operation.drawPolygon(points, endPoint.stationName, true);
  1969 + }
  1970 +
  1971 + rootNode = {id: -1, pId: null, name: '路段', text: '路段', icon: null, groupType: 2, container : 'pjax-container', enable : true};
  1972 + if (routes.length > 0) {
  1973 + for (var i = 0,route;i < routes.length;i++) {
  1974 + route = routes[i];
  1975 + points = route.section.bsectionVectorWkt.replace('LINESTRING(', '').replace(')', '');
  1976 + points = points.split(',');
  1977 + operation.drawPolyLine(points, route, start[0], end[0]);
  1978 + }
  1979 + rootNode.children = operation.formatSectionRoutes(routes, '-1');
  1980 + } else {
  1981 + rootNode.children = [{id: 0, pId: -1, name: '添加路段', text: '添加路段', lineId: id, lineCode: id, versions: version, dir: 3, start: start[0], end: end[0], icon: null, groupType: 3, enable : true, type: 'addSection', sectionBsectionVector: 'LINESTRING(' + startPoint.bdPoint + ')'}];
  1982 + }
  1983 + operation.inoutInit([rootNode]);
  1984 + operation.inoutreloadeTree([rootNode]);
  1985 + });
  1986 + });
  1987 + } else {
  1988 + layer.msg(result.msg);
  1989 + }
  1990 + });
  1991 + } else {
  1992 + $('#InoutCarparktreeMobal').hide();
  1993 + $('#inout_carpark_tree').hide();
  1994 + }
  1995 +
  1996 + // 获取树数据
  1997 + RoutesService.getStation(id, direction, version, function(routes) {
  1998 + // 获取数据长度
  1999 + var len = routes.stationRoutes.length;
  2000 + // 上行
  2001 + if(direction == 0){
  2002 + // 长度大于零
  2003 + if (len > 0) {
  2004 + // 隐藏上行规划
  2005 + $('#upToolsMobal').hide();
  2006 + // 显示树
  2007 + $('#uptreeMobal').show();
  2008 + // 刷新树
  2009 + operation.reloadUp(routes);
  2010 + } else {
  2011 + if (status > 0) {
  2012 + // 显示上行规划
  2013 + $('#upToolsMobal').show();
  2014 + } else {
  2015 + $('#upToolsMobal').hide();
  2016 + }
  2017 + // 隐藏上行树
  2018 + $('#uptreeMobal').hide();
  2019 + }
  2020 + } else if (direction == 1) {
  2021 + // 如果长度大于
  2022 + if(len > 0) {
  2023 + // 隐藏下行规划
  2024 + $('#downToolsMobal').hide();
  2025 + // 显示下行树
  2026 + $('#DowntreeMobal').show();
  2027 + // 跟新树
  2028 + operation.reloadDown(routes);
  2029 + } else {
  2030 + if (status > 0) {
  2031 + // 显示下行规划
  2032 + $('#downToolsMobal').show();
  2033 + } else {
  2034 + $('#downToolsMobal').hide();
  2035 + }
  2036 + // 隐藏下行树
  2037 + $('#DowntreeMobal').hide();
  2038 + }
  2039 + }
  2040 +
  2041 + operation.linePanlThree(id, routes, direction, version, function (center) {
  2042 + baiduMap.panTo(center);
  2043 + });
  2044 + });
  2045 + },
  2046 +
  2047 + /** 修正线路名称 @param:<directionUpValue:方向(0:上行;1:下行)> */
  2048 + lineNameIsHaveInterval : function(direction) {
  2049 + var lineName = $('.portlet-title .caption').text();
  2050 + if (lineName.indexOf('区间') > 0 || lineName.indexOf('定班') > 0) {
  2051 + lineName = lineName.replace('区间','').replace('定班', '');
  2052 + layer.confirm('系统无法生成该线路【'+lineName+'】的站点与路段!自动修改为如下线路名称【' + lineName + '】生成', {
  2053 + btn : [ '确认提示并提交', '取消' ]
  2054 + }, function(index) {
  2055 + layer.close(index);
  2056 + operation.systemLineStation(lineName,direction);
  2057 + },function(){
  2058 + layer.closeAll();
  2059 + if(direction==0){
  2060 + // 显示上行规划
  2061 + $('#upToolsMobal').show();
  2062 + }else if(direction==1){
  2063 + // 显示下行规划
  2064 + $('#downToolsMobal').show();
  2065 + }
  2066 + });
  2067 + } else {
  2068 + operation.systemLineStation(lineName,direction);
  2069 + }
  2070 + },
  2071 +
  2072 + locations2LinestringWkt: function (locations) {
  2073 + var wkt = new Array();
  2074 + wkt.push('LINESTRING(')
  2075 + for (var i = 0,len = locations.length;i < len;i++) {
  2076 + wkt.push(locations[i].lng);
  2077 + wkt.push(' ');
  2078 + wkt.push(locations[i].lat);
  2079 + if (i != len - 1) { wkt.push(','); }
  2080 + }
  2081 + wkt.push(')');
  2082 +
  2083 + return wkt.join('');
  2084 + },
  2085 +
  2086 + systemLineStation: function(lineName, direction) {
  2087 + operation.getBmapStationNames(lineName, direction,function(busLine){
  2088 + // 如果线路信息不为空
  2089 + if(busLine && busLine.getNumBusStations()) {
  2090 + var sectionRoutes = new Array(), stations = new Array();
  2091 + sectionRoutes.push({sectionrouteCode: 100, section: {sectionName: lineName, bsectionVectorWkt: operation.locations2LinestringWkt(busLine.getPath())}})
  2092 + var stationNumber = busLine.getNumBusStations();
  2093 + // 遍历
  2094 + for(var i = 0 ; i < stationNumber; i++) {
  2095 + var station = busLine.getBusStation(i), station1 = {stationName: station.name, centerPointWkt: 'POINT(' + station.position.lng + ' ' + station.position.lat + ')'};
  2096 + stations.push(station1);
  2097 + }
  2098 + // 获取站点之间的距离与时间
  2099 + operation.getDistanceAndDuration(stations,function(stationRoutes) {
  2100 + // 参数集合
  2101 + var params = {lineId: lineId, directions: direction, versions: versions, stationRoutes: stationRoutes, sectionRoutes: sectionRoutes};
  2102 + if (!params.versions) {
  2103 + params.versions = '1';
  2104 + }
  2105 + RoutesService.collectionSave(params,function(rd) {
  2106 + // 关闭弹出层
  2107 + layer.closeAll();
  2108 + if (rd.status == 'SUCCESS') {
  2109 + layer.msg('保存成功!');
  2110 + } else {
  2111 + layer.msg('保存失败!');
  2112 + }
  2113 + // 刷新树
  2114 + operation.resjtreeDate(lineId, direction, versions);
  2115 + });
  2116 + });
  2117 + } else {
  2118 + layer.msg('百度地图中没有此线路,无法系统规划!');
  2119 + setTimeout(function() {
  2120 + // 关闭弹出层
  2121 + layer.closeAll();
  2122 + // 上行
  2123 + if(direction==0){
  2124 + // 显示上行规划
  2125 + $('#upToolsMobal').show();
  2126 + // 下行
  2127 + }else if(direction==1){
  2128 + // 显示下行规划
  2129 + $('#downToolsMobal').show();
  2130 + }
  2131 + }, 3000);
  2132 + }
  2133 + });
  2134 + },
  2135 +
  2136 + // @弃用
  2137 + /*stationRevoke : function(directionV_) {
  2138 + // 获取树选中节点对象
  2139 + var obj = operation.getCurrSelNode(directionV_);
  2140 + // 是否选中,选中节点是否为站点
  2141 + if(obj.length == 0 || obj[0].original.chaildredType !='station'){
  2142 + // 弹出提示层
  2143 + layer.msg('请先选择要删除的站点!');
  2144 + return;
  2145 + }
  2146 + // 弹出是否撤销提示框
  2147 + layer.confirm('你确定要撤销【'+obj[0].text+'】站点吗?', {btn : [ '确定撤销','返回' ],icon: 3, title:'提示' }, function(index){
  2148 +
  2149 +
  2150 + // 站点路由ID
  2151 + var stationRouteId = obj[0].original.stationRouteId;
  2152 +
  2153 + var Line = LineObj.getLineObj();
  2154 +
  2155 + clonsole.log(Line);
  2156 +
  2157 + // 撤销参数集合
  2158 + var params = {stationRouteId:stationRouteId,destroy:'1',status:Line.status};
  2159 + // 方向
  2160 + var stationRouteDirections = obj[0].original.stationRouteDirections;
  2161 + // 撤销
  2162 + RoutesService.stationRouteIsDestroy(params,function(result) {
  2163 + // 关闭弹出框
  2164 + layer.close(index);
  2165 + if(result.status=='SUCCESS'){
  2166 + layer.msg('撤销'+(directionV_==0?"上行":"下行")+'站点【'+obj[0].text+'】成功!');
  2167 + }else{
  2168 + layer.msg('撤销'+(directionV_==0?"上行":"下行")+'站点【'+obj[0].text+'】失败!');
  2169 + }
  2170 + WorldsBMap.clearMarkAndOverlays();
  2171 +
  2172 + var ver = $("#versions").val();
  2173 +
  2174 + operation.resjtreeDate(Line.id,stationRouteDirections,ver);
  2175 + });
  2176 + });
  2177 + },*/
  2178 +
  2179 + // @弃用
  2180 + /*editLinePlan : function(direction_) {
  2181 + var sel = operation.getCurrSelNode(direction_);
  2182 + if(sel.length==0 || sel[0].original.chaildredType !='section'){
  2183 + if(direction_=='0') {
  2184 + layer.msg('请先选中要编辑的上行路段!');
  2185 + }else if(direction_=='1') {
  2186 + layer.msg('请先选中要编辑的下行路段!');
  2187 + }
  2188 + return;
  2189 + }
  2190 + $('#downLine').addClass('btn disabled');
  2191 + $('.btn-circle').addClass('disabled');
  2192 + $('#upLine').addClass('btn disabled');
  2193 + var editSectionV = sel[0].original;
  2194 + EditSectionObj.setEitdSection(editSectionV);
  2195 + // 弹出添加失败提示消息,2秒关闭(如果不配置,默认是3秒)
  2196 + var yindex = layer.msg('编辑完线路走向后,请双击线路走向区域保存',{ offset: '126px',shift: 0,time: 10000});
  2197 + WorldsBMap.editPolyUpline();
  2198 + },*/
  2199 +
  2200 + setFormValue : function(editStationRoute) {
  2201 + $('#edit_stationroute_form input,select,textarea').each(function () {
  2202 + if (this.name) {
  2203 + $(this).val(eval('editStationRoute.' + this.name));
  2204 + if ('shapedType' === this.name) {
  2205 + $(this).val(editStationRoute.shapedType == 'r' ? '圆形' : '多边形')
  2206 + }
  2207 + if ('radius' === this.name) {
  2208 + $(this).val(editStationRoute.radius ? editStationRoute.radius : 80);
  2209 + }
  2210 + }
  2211 + })
  2212 + },
  2213 +
  2214 + setSectionFormValue : function(sectionRoute) {
  2215 + $('#edit_sectionroute_form input').each(function() {
  2216 + if (this.name) {
  2217 + $(this).val(eval('sectionRoute.' + this.name));
  2218 + }
  2219 + });
  2220 + },
  2221 +
  2222 + /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */
  2223 + linePanlThree : function(lineId, routes, direction, version, callback) {
  2224 + operation.clearMarkAndOverlays();
  2225 + var i = 0, center;
  2226 + if (routes.stationRoutes.length > 0) {
  2227 + var centerPointWkt = routes.stationRoutes[0].station.centerPointWkt;
  2228 + centerPointWkt = centerPointWkt.substring(6, centerPointWkt.length - 1);
  2229 + var coordinates = centerPointWkt.split(' ');
  2230 + center = new BMap.Point(coordinates[0], coordinates[1]);
  2231 + for (;i < routes.stationRoutes.length;i++) {
  2232 + operation.drawingUpStationPoint(routes.stationRoutes[i], i + 1);
  2233 + }
  2234 + }
  2235 + if (routes.sectionRoutes.length > 0) {
  2236 + operation.drawingUpline01(routes.sectionRoutes);
  2237 + }
  2238 +
  2239 + callback && center && callback(center);
  2240 + },
  2241 +
  2242 + /** 加载树 @param:<lineId:线路ID;direction:方向(0:上行;1:下行)> */
  2243 + TreeUpOrDown : function(lineId,direction,version) {
  2244 + /** 获取树结果数据 @param:<lineId:线路ID;direction:方向;callback:回调函数> */
  2245 + RoutesService.getStation(lineId,direction,version,function(result) {
  2246 + var len = result.stationRoutes.length;
  2247 + if(direction == 0) {
  2248 + operation.upInit(result);
  2249 + if(len>0) {
  2250 + $('#upToolsMobal').hide();
  2251 + $('#uptreeMobal').show();
  2252 + }else {
  2253 + $('#upToolsMobal').show();
  2254 + $('#uptreeMobal').hide();
  2255 + }
  2256 +
  2257 + operation.linePanlThree(lineId, result, direction, version, function (center) {
  2258 + baiduMap.panTo(center);
  2259 + });
  2260 + }else if(direction ==1) {
  2261 + operation.downInit(result);
  2262 + if(len>0) {
  2263 + $('#downToolsMobal').hide();
  2264 + $('#DowntreeMobal').show();
  2265 + }else {
  2266 + $('#downToolsMobal').show();
  2267 + $('#DowntreeMobal').hide();
  2268 + }
  2269 + }
  2270 + });
  2271 + },
  2272 +
  2273 + isHaveStationName : function(data) {
  2274 + if(data.length>0) {
  2275 + layer.confirm('系统已存在【'+ data[0].stationName +'】该站点位置名称,请选择【系统引用】或者更改站点名称进行新增!', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){
  2276 + layer.close(index);
  2277 + });
  2278 + return false;
  2279 + }else {
  2280 + return true;
  2281 + }
  2282 + },
  2283 +
  2284 + // 地图处于编辑状态
  2285 + editMapStatus : function (dir) {
  2286 + operation.setMap_status(1);
  2287 + // 有方向就显示退出编辑模式按钮
  2288 + if (dir != null && dir != 'null') {
  2289 + $('#esc_edit_div').show();
  2290 + }
  2291 + $('.protlet-box-layer').show();
  2292 + },
  2293 +
  2294 + // 地图处于编辑状态
  2295 + editMapStatusRemove : function () {
  2296 + operation.setMap_status(0);
  2297 + $('.protlet-box-layer').hide();
  2298 + $('#esc_edit_div').hide();
  2299 + // 退出绘画模式
  2300 + operation.exitDrawStatus();
  2301 + },
  2302 +
  2303 + // 选项鎖死解除
  2304 + editAChangeCssRemoveDisabled : function() {
  2305 + $('#downLine').removeClass('btn disabled');
  2306 + $('.btn-circle').removeClass('disabled');
  2307 + $('#upLine').removeClass('btn disabled');
  2308 + },
  2309 +
  2310 + // 方向代码转名称.
  2311 + dirdmToName : function(value){
  2312 + var srStr = '';
  2313 + if(value=='0')
  2314 + srStr = '上行';
  2315 + else if(value=='1')
  2316 + srStr = '下行';
  2317 + return srStr;
  2318 + },
  2319 +
  2320 + /***************************************************drawingmanager*******************************************************/
  2321 + initStationDrawingManager: function() {
  2322 + stationDrawingManager = new BMapLib.DrawingManager(baiduMap, {
  2323 + //是否开启绘制模式
  2324 + isOpen : false,
  2325 + //是否显示工具栏
  2326 + enableDrawingTool : false,
  2327 + drawingToolOptions : {
  2328 + //位置
  2329 + anchor : BMAP_ANCHOR_TOP_RIGHT,
  2330 + //偏离值
  2331 + offset : new BMap.Size(5, 5),
  2332 + //工具栏缩放比例
  2333 + scale : 0.8
  2334 + },
  2335 + //线的样式
  2336 + polygonOptions : styleOptions
  2337 + });
  2338 +
  2339 + // 添加绘画完成事件
  2340 + stationDrawingManager.addEventListener('polygoncomplete', function(polygon) {
  2341 + stationDrawingManager.close();
  2342 + var points = polygon.getPath();
  2343 + if (points.length < 3) {
  2344 + layer.msg('坐标点不能小于三个,请点击"退出编辑"后重新修改');
  2345 + baiduMap.removeOverlay(polygon);
  2346 +
  2347 + return false;
  2348 + } else {
  2349 + var bufferPolygonWkt = new Array();
  2350 + for(var i = 0;i < points.length;i++) {
  2351 + bufferPolygonWkt.push(points[i].lng + ' ' + points[i].lat)
  2352 + }
  2353 + bufferPolygonWkt.push(points[0].lng + ' ' + points[0].lat)
  2354 + if(!$.isEmptyObject(addStationRoute)){
  2355 + addStationRoute.shapedType = 'd';
  2356 + addStationRoute.radius = 0;
  2357 + addStationRoute.bufferPolygonWkt = bufferPolygonWkt.join(',');
  2358 +
  2359 + $.get('add_stationroute_step2.html', function (m) {
  2360 + $(pjaxContainer).append(m);
  2361 + $('#add_stationroute_step2_modal').trigger('modal.show');
  2362 + });
  2363 + }
  2364 +
  2365 + if(!$.isEmptyObject(editStationRoute)){
  2366 + editStationRoute.shapedType = 'd';
  2367 + editStationRoute.radius = 0;
  2368 + editStationRoute.bufferPolygonWkt = bufferPolygonWkt.join(',');
  2369 +
  2370 + $.get('edit_stationroute_step2.html', function(m){
  2371 + $(pjaxContainer).append(m);
  2372 + $('#edit_stationroute_step2_modal').trigger('modal.show');
  2373 + });
  2374 + }
  2375 + }
  2376 + });
  2377 +
  2378 + return stationDrawingManager;
  2379 + },
  2380 +
  2381 + openDrawingManager : function() {
  2382 + stationDrawingManager.open();
  2383 + stationDrawingManager.setDrawingMode(BMAP_DRAWING_POLYGON);
  2384 + },
  2385 +
  2386 + closeDrawingManager : function() {
  2387 + stationDrawingManager.close();
  2388 + },
  2389 +
  2390 + /***************************************************treedata*******************************************************/
  2391 + TreeOnclickEvent: function (nodes) {
  2392 + if(nodes == null || nodes.length < 1) {
  2393 + return;
  2394 + }
  2395 +
  2396 + var original = nodes[0].original, type = original.type;
  2397 +
  2398 + if (type == "section") {
  2399 + operation.focusSection(original.cdata.id);
  2400 + } else if(type == "station") {
  2401 + operation.openStationRouteInfoWin(original.cdata);
  2402 + } else if(type == "addSection") {
  2403 + operation.addSection(original);
  2404 + }
  2405 + },
  2406 + format: function(routes) {
  2407 + var sectionRoutes = operation.formatSectionRoutes(routes.sectionRoutes, 'section-routes');
  2408 + if (sectionRoutes.length == 0) {
  2409 + sectionRoutes = [{id: 0, pId: -1, name: '添加路段', text: '添加路段', groupType: 3, enable : true, type: 'addSection'}];
  2410 + }
  2411 + return {
  2412 + groupType: 1,
  2413 + enable: true,
  2414 + name: '站点与路段',
  2415 + id: 'root',
  2416 + text: '站点与路段',
  2417 + children: [{
  2418 + groupType: 2,
  2419 + enable: true,
  2420 + name: '站点',
  2421 + id: 'station-routes',
  2422 + pid: 'root',
  2423 + text: '站点',
  2424 + children: operation.formatStationRoutes(routes.stationRoutes, 'station-routes')
  2425 + }, {
  2426 + groupType: 2,
  2427 + enable: true,
  2428 + name: '路段',
  2429 + id: 'section-routes',
  2430 + pid: 'root',
  2431 + text: '路段',
  2432 + children: sectionRoutes
  2433 + }]};
  2434 + },
  2435 + formatStationRoutes: function(stationRoutes, pid) {
  2436 + var result = new Array(), i = 0;
  2437 + for (;i < stationRoutes.length;i++) {
  2438 + var stationRoute = stationRoutes[i];
  2439 + result.push({
  2440 + groupType: 3,
  2441 + enable: true,
  2442 + id: stationRoute.id,
  2443 + pid: pid,
  2444 + text: stationRoute.stationName,
  2445 + type: 'station',
  2446 + cdata: stationRoute
  2447 + })
  2448 + }
  2449 +
  2450 + return result;
  2451 + },
  2452 + formatSectionRoutes: function(sectionRoutes, pid) {
  2453 + var result = new Array(), i = 0;
  2454 + for (;i < sectionRoutes.length;i++) {
  2455 + var sectionRoute = sectionRoutes[i];
  2456 + result.push({
  2457 + groupType: 3,
  2458 + enable: true,
  2459 + id: sectionRoute.id,
  2460 + pid: pid,
  2461 + text: sectionRoute.section.sectionName,
  2462 + type: 'section',
  2463 + cdata: sectionRoute
  2464 + })
  2465 + }
  2466 +
  2467 + return result;
  2468 + },
  2469 + upInit: function(routes) {
  2470 + if(routes) {
  2471 + $('#station_Up_tree').on('loaded.jstree', function(e, data){
  2472 + $.jstree.reference("#station_Up_tree").open_all();
  2473 + }).jstree({
  2474 + 'core' : {
  2475 + 'themes' : {
  2476 + 'responsive': false
  2477 + },
  2478 + 'data': operation.format(routes),
  2479 + 'multiple':false
  2480 + },
  2481 + 'types' : {
  2482 + "default" : {
  2483 + "icon" : false
  2484 + },
  2485 + 'enable_true' : {
  2486 + "icon" : 'fa fa-check icon-lg'
  2487 + },
  2488 + 'enable_false' : {
  2489 + 'icon' : 'fa fa-close icon-lg'
  2490 + },
  2491 + 'group':{
  2492 + 'icon' : 'fa fa-object-group icon-lg'
  2493 + }
  2494 + },
  2495 + 'plugins': ['types']
  2496 + }).bind('click.jstree', function(event) {
  2497 + var nodes = $.jstree.reference("#station_Up_tree").get_selected(true);
  2498 + operation.TreeOnclickEvent(nodes);
  2499 + });
  2500 + }
  2501 + },
  2502 + downInit: function(routes) {
  2503 + if(routes) {
  2504 + $('#station_Down_tree').on('loaded.jstree', function(e, data){
  2505 + $.jstree.reference("#station_Down_tree").open_all();
  2506 + }).jstree({
  2507 + 'core' : {
  2508 + 'themes' : {
  2509 + 'responsive': false
  2510 + },
  2511 + 'data': this.format(routes),
  2512 + 'multiple':false
  2513 + },
  2514 + 'types' : {
  2515 + "default" : {
  2516 + "icon" : false
  2517 + },
  2518 + 'enable_true' : {
  2519 + "icon" : 'fa fa-check icon-lg'
  2520 + },
  2521 + 'enable_false' : {
  2522 + 'icon' : 'fa fa-close icon-lg'
  2523 + },
  2524 + 'group':{
  2525 + 'icon' : 'fa fa-object-group icon-lg'
  2526 + }
  2527 + },
  2528 + 'plugins': ['types']
  2529 + }).bind('click.jstree', function(event) {
  2530 + var treeOjb = $.jstree.reference("#station_Down_tree").get_selected(true);
  2531 + operation.TreeOnclickEvent(treeOjb);
  2532 + });
  2533 + }
  2534 + },
  2535 + inoutInit : function(treeDateJson) {
  2536 + if(treeDateJson) {
  2537 + $('#inout_carpark_tree').on('loaded.jstree', function(e, data){
  2538 + $.jstree.reference("#inout_carpark_tree").open_all();
  2539 + }).jstree({
  2540 + 'core' : {
  2541 + 'themes' : {
  2542 + 'responsive': false
  2543 + },
  2544 + 'data': treeDateJson,
  2545 + 'multiple':false
  2546 + },
  2547 + 'types' : {
  2548 + "default" : {
  2549 + "icon" : false
  2550 + },
  2551 + 'enable_true' : {
  2552 + "icon" : 'fa fa-check icon-lg'
  2553 + },
  2554 + 'enable_false' : {
  2555 + 'icon' : 'fa fa-close icon-lg'
  2556 + },
  2557 + 'group':{
  2558 + 'icon' : 'fa fa-object-group icon-lg'
  2559 + }
  2560 + },
  2561 + 'plugins': ['types']
  2562 + }).bind('click.jstree', function(event) {
  2563 + var treeOjb = $.jstree.reference("#inout_carpark_tree").get_selected(true);
  2564 + operation.TreeOnclickEvent(treeOjb);
  2565 + });
  2566 + }
  2567 + },
  2568 + reloadUp : function (routes) {
  2569 + // 获取上行树
  2570 + var tree = $.jstree.reference('#station_Up_tree');
  2571 + // 赋值数据
  2572 + tree.settings.core.data = this.format(routes);
  2573 + // 刷新上行树
  2574 + tree.refresh();
  2575 + // 展开树
  2576 + setTimeout(function () {
  2577 + tree.open_all();
  2578 + },500);
  2579 + },
  2580 + reloadDown : function (routes) {
  2581 + // 获取下行树
  2582 + var tree = $.jstree.reference('#station_Down_tree');
  2583 + // 赋值数据
  2584 + tree.settings.core.data = this.format(routes);
  2585 + // 刷行下行树
  2586 + tree.refresh();
  2587 + // 展开树
  2588 + setTimeout(function () {
  2589 + tree.open_all();
  2590 + },500);
  2591 + },
  2592 + inoutreloadeTree : function (treeDateJson) {
  2593 + // 获取下行树
  2594 + var tree = $.jstree.reference('#inout_carpark_tree');
  2595 + // 赋值数据
  2596 + tree.settings.core.data = treeDateJson;
  2597 + // 刷行下行树
  2598 + tree.refresh();
  2599 + // 展开树
  2600 + setTimeout(function () {
  2601 + tree.open_all();
  2602 + },500);
  2603 + }
  2604 + }
  2605 +
  2606 + return operation;
  2607 +})()
  2608 +
  2609 +proxy.emit('routes-operation-loaded');