Commit aed236fdd56c68c0d65892b9e61cb3bb30c7d5fe

Authored by 王通
2 parents 9f94a361 b690e4c1

1.合并浦交线路路由编辑部分修改

Showing 36 changed files with 3761 additions and 4042 deletions
src/main/java/com/bsth/controller/InoutCarparkController.java 0 → 100644
  1 +package com.bsth.controller;
  2 +
  3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.entity.LsInoutSectionRoute;
  5 +import com.bsth.service.InoutCarparkService;
  6 +import org.slf4j.Logger;
  7 +import org.slf4j.LoggerFactory;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.util.StringUtils;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestMethod;
  12 +import org.springframework.web.bind.annotation.RequestParam;
  13 +import org.springframework.web.bind.annotation.RestController;
  14 +
  15 +import java.util.HashMap;
  16 +import java.util.Map;
  17 +
  18 +@RestController
  19 +@RequestMapping("inout")
  20 +public class InoutCarparkController extends BaseController<LsInoutSectionRoute, Long>{
  21 +
  22 + private final static Logger logger = LoggerFactory.getLogger(InoutCarparkController.class);
  23 +
  24 + @Autowired
  25 + InoutCarparkService inoutCarparkService;
  26 +
  27 + @RequestMapping(value = "/getStartEndByLine", method = RequestMethod.GET)
  28 + public Map<String, Object> getStartEndByLine(@RequestParam("lineId")int lineId, @RequestParam("version")int version) {
  29 + return inoutCarparkService.getStartEndByLine(lineId, version);
  30 + }
  31 +
  32 + @RequestMapping(value = "/getRouteByStartEnd", method = RequestMethod.GET)
  33 + public Map<String, Object> getRouteByStartEnd(@RequestParam("lineId")int lineId, @RequestParam("version")int version, @RequestParam("start")String start, @RequestParam("end")String end) {
  34 + return inoutCarparkService.getRouteByStartEnd(lineId, version, start, end);
  35 + }
  36 +
  37 + /**
  38 + * 新增路段信息
  39 + *
  40 + * @param map:<bsectionVector:折线百度坐标集合;dbType:圆坐标类型;descriptions:描述与说明;destroy:是否撤销;directions:方向;lineId:线路ID
  41 + *
  42 + * lineCode :线路编码;roadCoding:道路编码;sectionCode:路段编码;sectionDistance:路段长度;sectionName:路段名称;sectionTime:路段时长;
  43 + *
  44 + * sectionrouteCode:路段序号;speedLimit:路段限速>
  45 + *
  46 + * @return map<SUCCESS:成功;ERROR:异常>
  47 + */
  48 + @RequestMapping(value="sectionSave" , method = RequestMethod.POST)
  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;
  61 + }
  62 +
  63 + /**
  64 + * @Description :TODO(编辑线路走向)
  65 + *
  66 + * @param map <sectionId:路段ID; sectionJSON:路段信息>
  67 + *
  68 + * @return Map<String, Object> <SUCCESS ; ERROR>
  69 + */
  70 + @RequestMapping(value="sectionUpdate" , method = RequestMethod.POST)
  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 + }
  81 +
  82 + return result;
  83 + }
  84 +
  85 + /**
  86 + * @param id //路段路由id
  87 + * @Description: TODO(撤销路段)
  88 + */
  89 + @RequestMapping(value = "/destroy", method = RequestMethod.POST)
  90 + public Map<String, Object> destroy(@RequestParam Map<String, Object> map) {
  91 + return inoutCarparkService.destroy(map);
  92 + }
  93 +
  94 + /**
  95 + * 从历史轨迹做进场路径规划
  96 + * @Description: TODO(撤销路段)
  97 + */
  98 + @RequestMapping(value = "/pathPlaningByHistory", method = RequestMethod.POST)
  99 + public Map<String, Object> pathPlaningByHistory(@RequestParam Map<String, Object> map){
  100 + Map<String, Object> result = new HashMap<>();
  101 + result.put("status", ResponseCode.SUCCESS);
  102 + try {
  103 + String schId = (String)map.get("schId"), version = (String)map.get("version");
  104 + if (StringUtils.isEmpty(schId) || StringUtils.isEmpty(version)) {
  105 + throw new RuntimeException("无效的参数");
  106 + }
  107 + inoutCarparkService.pathPlaningByHistory(Long.parseLong(schId), Integer.parseInt(version));
  108 + } catch (Exception e) {
  109 + result.put("status", ResponseCode.ERROR);
  110 + logger.error("路径规划异常", e);
  111 + }
  112 +
  113 + return result;
  114 + }
  115 +}
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 0 → 100644
  1 +package com.bsth.service;
  2 +
  3 +import com.bsth.entity.LsInoutSectionRoute;
  4 +import com.fasterxml.jackson.core.JsonProcessingException;
  5 +
  6 +import java.util.Map;
  7 +
  8 +public interface InoutCarparkService {
  9 +
  10 + Map<String, Object> getStartEndByLine(int lineId, int version);
  11 +
  12 + Map<String, Object> getRouteByStartEnd(int lineId, int version, String start, String end);
  13 +
  14 + /**
  15 + * 添加进出场路段和路由
  16 + * @param sectionRoute
  17 + */
  18 + void add(LsInoutSectionRoute sectionRoute);
  19 +
  20 + void modify(LsInoutSectionRoute sectionRoute);
  21 +
  22 + Map<String, Object> destroy(Map<String, Object> map);
  23 +
  24 + void pathPlaningByHistory(long schId, int versions) throws JsonProcessingException;
  25 +}
src/main/java/com/bsth/service/impl/InoutCarparkServiceImpl.java 0 → 100644
  1 +package com.bsth.service.impl;
  2 +
  3 +import com.alibaba.fastjson.JSONArray;
  4 +import com.bsth.common.ResponseCode;
  5 +import com.bsth.data.BasicData;
  6 +import com.bsth.entity.*;
  7 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  8 +import com.bsth.repository.*;
  9 +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
  10 +import com.bsth.service.InoutCarparkService;
  11 +import com.bsth.service.gps.GpsService;
  12 +import com.bsth.util.CoordinateConverter;
  13 +import com.bsth.util.CustomBeanUtils;
  14 +import com.fasterxml.jackson.core.JsonProcessingException;
  15 +import com.fasterxml.jackson.databind.ObjectMapper;
  16 +import org.joda.time.DateTime;
  17 +import org.joda.time.format.DateTimeFormat;
  18 +import org.joda.time.format.DateTimeFormatter;
  19 +import org.slf4j.Logger;
  20 +import org.slf4j.LoggerFactory;
  21 +import org.springframework.beans.factory.annotation.Autowired;
  22 +import org.springframework.stereotype.Service;
  23 +import org.springframework.transaction.annotation.Transactional;
  24 +
  25 +import javax.persistence.EntityManager;
  26 +import java.text.SimpleDateFormat;
  27 +import java.util.*;
  28 +
  29 +/**
  30 + * @author Hill
  31 + */
  32 +@Service
  33 +public class InoutCarparkServiceImpl extends BaseServiceImpl<LsInoutSectionRoute, Long> implements InoutCarparkService {
  34 +
  35 + private final static Logger logger = LoggerFactory.getLogger(InoutCarparkServiceImpl.class);
  36 +
  37 + @Autowired
  38 + private LsStationRouteRepository lsStationRouteRepository;
  39 +
  40 + @Autowired
  41 + private CarParkRepository carParkRepository;
  42 +
  43 + @Autowired
  44 + private LsInoutSectionRouteRepository lsInoutSectionRouteRepository;
  45 +
  46 + @Autowired
  47 + private SectionRepository sectionRepository;
  48 +
  49 + @Autowired
  50 + LineRepository lineRepository;
  51 +
  52 + @Autowired
  53 + private ScheduleRealInfoRepository scheduleRealInfoRepository;
  54 +
  55 + @Autowired
  56 + private GpsService gpsService;
  57 +
  58 + @Autowired
  59 + private LineVersionsRepository lineVersionsRepository;
  60 +
  61 + @Override
  62 + public Map<String, Object> getStartEndByLine(int lineId, int version) {
  63 + Map<String, Object> result = new HashMap<>(), data = new HashMap<>();
  64 + result.put("code", 0);
  65 + result.put("msg", "");
  66 + result.put("data", data);
  67 +
  68 + List<LsStationRoute> upRoutes = lsStationRouteRepository.findByLineVersion(lineId, version, 0), downRoutes = lsStationRouteRepository.findByLineVersion(lineId, version, 1);
  69 + CarPark carPark = carParkRepository.findByLineId(lineId);
  70 + if (carPark == null) {
  71 + result.put("code", 500);
  72 + result.put("msg", "线路标准信息中无相应的停车场信息");
  73 +
  74 + return result;
  75 + }
  76 + if (upRoutes.size() < 2) {
  77 + result.put("code", 500);
  78 + result.put("msg", "线路上行站级少于2");
  79 +
  80 + return result;
  81 + }
  82 + LsStationRoute upFirst = upRoutes.get(0), upLast = upRoutes.get(upRoutes.size() - 1);
  83 + LsStationRoute downFirst = downRoutes.get(0), downLast = downRoutes.get(downRoutes.size() - 1);
  84 + // 环线或双环线只需提取一个起点站
  85 + if (upFirst.getStationCode().equals(upLast.getStationCode())) {
  86 + data.put("start", new LsStationRoute[]{ upFirst });
  87 + data.put("end", new LsStationRoute[]{ upFirst });
  88 + } else {
  89 + if (downRoutes.size() < 2) {
  90 + result.put("code", 500);
  91 + result.put("msg", "非环线线路下行站级少于2");
  92 +
  93 + return result;
  94 + }
  95 + data.put("start", new LsStationRoute[]{ upFirst, downFirst });
  96 + data.put("end", new LsStationRoute[]{ upLast, downLast });
  97 + }
  98 + data.put("carpark", carPark);
  99 +
  100 + return result;
  101 + }
  102 +
  103 + @Override
  104 + public Map<String, Object> getRouteByStartEnd(int lineId, int version, String start, String end) {
  105 + Map<String, Object> result = new HashMap<>(), data = new HashMap<>();
  106 + result.put("code", 0);
  107 + result.put("msg", "");
  108 + result.put("data", data);
  109 + data.put("routes", lsInoutSectionRouteRepository.getRouteByStartEnd(lineId, version, start, end));
  110 +
  111 + return result;
  112 + }
  113 +
  114 + /**
  115 + * 添加进出场路段和路由
  116 + */
  117 + @Override
  118 + @Transactional
  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 + }
  128 +
  129 + // 路段坐标信息
  130 + if (!isPresent) {
  131 + SectionServiceImpl.centerLine(section);
  132 + }
  133 +
  134 + lsInoutSectionRouteRepository.updateSectiouRouteCode(sectionRoute);
  135 + if (!isPresent) {
  136 + sectionRepository.save(section);
  137 + }
  138 + lsInoutSectionRouteRepository.save(sectionRoute);
  139 + }
  140 +
  141 + /** 百度坐标转WGS坐标 */
  142 + public CoordinateConverter.Location FromBDPointToWGSPoint(String bLonx, String bLatx) {
  143 +
  144 + double lng = Double.parseDouble(bLonx);
  145 +
  146 + double lat = Double.parseDouble(bLatx);
  147 +
  148 + CoordinateConverter.Location bdLoc = CoordinateConverter.LocationMake(lng, lat);
  149 +
  150 + CoordinateConverter.Location location = CoordinateConverter.bd_decrypt(bdLoc);
  151 +
  152 + CoordinateConverter.Location WGSPoint = CoordinateConverter.transformFromGCJToWGS(location);
  153 +
  154 + return WGSPoint;
  155 +
  156 + }
  157 +
  158 + @Transactional(rollbackFor = RuntimeException.class)
  159 + @Override
  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 + }
  168 +
  169 + SectionServiceImpl.centerLine(section);
  170 +
  171 + lsInoutSectionRouteRepository.updateSectiouRouteCode(sectionRoute);
  172 + CustomBeanUtils.copyPropertiesIgnoredNull(sectionRoute, sectionRoute1);
  173 + CustomBeanUtils.copyPropertiesIgnoredNull(section, section1);
  174 + sectionRepository.save(section1);
  175 + lsInoutSectionRouteRepository.save(sectionRoute1);
  176 + }
  177 +
  178 + @Override
  179 + @Transactional
  180 + public Map<String, Object> destroy(Map<String, Object> map) {
  181 + Map<String, Object> resultMap = new HashMap<String, Object>();
  182 + try {
  183 + Integer id = Integer.valueOf(map.get("id").toString());
  184 +
  185 + if(map.get("status") == null || Integer.parseInt(map.get("status").toString()) != 0) {
  186 + lsInoutSectionRouteRepository.destroy(id);
  187 + }
  188 + resultMap.put("status", ResponseCode.SUCCESS);
  189 + } catch (Exception e) {
  190 + resultMap.put("status", ResponseCode.ERROR);
  191 + logger.error("destroy erro.", e);
  192 + }
  193 + return resultMap;
  194 + }
  195 +
  196 + @Override
  197 + @Transactional(rollbackFor = RuntimeException.class)
  198 + public void pathPlaningByHistory(long schId, int versions) {
  199 + LsInoutSectionRoute sectionRoute = new LsInoutSectionRoute();
  200 + ScheduleRealInfo scheduleRealInfo = scheduleRealInfoRepository.findById(schId).get();
  201 + DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm");
  202 + DateTime start = formatter.parseDateTime(scheduleRealInfo.getRealExecDate() + scheduleRealInfo.getFcsjActual());
  203 + DateTime end = formatter.parseDateTime(scheduleRealInfo.getRealExecDate() + scheduleRealInfo.getZdsjActual());
  204 + if (start.isAfter(end)) {
  205 + end = end.plusDays(1);
  206 + }
  207 + Map<String, Object> map = gpsService.history(new String[]{ scheduleRealInfo.getClZbh() }, start.getMillis() / 1000 - 20, end.getMillis() / 1000 + 20);
  208 + List<Map<String, Object>> list = (List<Map<String, Object>>)map.get("list");
  209 + StringBuilder sb = new StringBuilder("LINESTRING(");
  210 + for (Map<String, Object> m : list) {
  211 + Map<String, Object> m1 = new HashMap<>();
  212 + Float lng = (Float)m.get("lon"), lat = (Float)m.get("lat");
  213 + if (lng == 0 || lat == 0) {
  214 + continue;
  215 + }
  216 + sb.append(lng).append(" ").append(lat).append(",");
  217 + }
  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);
  240 +
  241 + lsInoutSectionRouteRepository.destroy(scheduleRealInfo.getXlBm(), versions, scheduleRealInfo.getQdzName(), scheduleRealInfo.getZdzName());
  242 + add(sectionRoute);
  243 + }
  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
@@ -658,6 +658,6 @@ @@ -658,6 +658,6 @@
658 <script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script> 658 <script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script>
659 <!-- RSA加密 --> 659 <!-- RSA加密 -->
660 <script src="/assets/plugins/jsencrypt.min.js"></script> 660 <script src="/assets/plugins/jsencrypt.min.js"></script>
661 - 661 +<script src="/assets/js/eventproxy.js"></script>
662 </body> 662 </body>
663 </html> 663 </html>
664 \ No newline at end of file 664 \ 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');
src/main/resources/static/pages/base/stationroute/js/routes-service.js 0 → 100644
  1 +var RoutesService = (function(){
  2 +
  3 + var service = {
  4 + /**
  5 + * 系统规划保存
  6 + * @param params
  7 + * @param cb
  8 + */
  9 + collectionSave: function (params, cb) {
  10 + $.ajax('/api/lsstationroute/addRoutes', {
  11 + method: 'POST',
  12 + data: JSON.stringify(params),
  13 + contentType: 'application/json',
  14 + success: function (res) {
  15 + cb && cb(res);
  16 + }
  17 + });
  18 + },
  19 +
  20 + /**
  21 + * 获取站点和路段路由信息
  22 + * @param id_
  23 + * @param dir_
  24 + * @param version
  25 + * @param callback
  26 + */
  27 + getStation: function(id_,dir_,version,callback) {
  28 + $get('/stationroute/findStations', {'line.id_eq': id_ , 'directions_eq': dir_, 'versions_eq': version}, function(result) {
  29 + callback && callback(result);
  30 + });
  31 + },
  32 +
  33 + /**
  34 + * 获取站点路由信息
  35 + * @param params
  36 + * @param callback
  37 + */
  38 + getzdlyInfo: function(params,callback) {
  39 + $get('/api/lsstationroute/findAllByParams', params, function(result) {
  40 + callback && callback(result);
  41 + });
  42 + },
  43 +
  44 + /**
  45 + * 按线路和方向查询所有站点的信息 用于调整上一站
  46 + * @param id_
  47 + * @param dir_
  48 + * @param version
  49 + * @param callback
  50 + */
  51 + getStationRoutePoint: function(id_,dir_,version,callback) {
  52 + $get('/stationroute/getStationRouteList',{'line.id_eq': id_, directions_eq: dir_, versions_eq:version},function(result) {
  53 + callback && callback(result);
  54 + });
  55 + },
  56 +
  57 + /**
  58 + * 查询是否有已存在站点名称
  59 + * @param stationName
  60 + * @param callback
  61 + */
  62 + getLikeStationName: function (stationName,callback) {
  63 + $get('/station/all', {stationName_eq: stationName}, function(array){
  64 + callback && callback(array);
  65 + });
  66 + },
  67 +
  68 + /**
  69 + * 获取最新站点ID
  70 + * @param callback
  71 + */
  72 + getStationCode: function(callback) {
  73 + $get('/station/findStationCode',null,function(stationCode) {
  74 + if(stationCode>0) {
  75 + callback && callback(stationCode);
  76 + }
  77 + });
  78 + },
  79 +
  80 + /**
  81 + * 获取最新路段ID
  82 + * @param callback
  83 + */
  84 + getSectionCode: function(callback) {
  85 + $get('/section/getSectionCode',null,function(sectionCode) {
  86 + callback && callback(sectionCode);
  87 + });
  88 + },
  89 +
  90 + /**
  91 + * 获取所有线路版本信息
  92 + * @param lineId
  93 + * @param callback
  94 + */
  95 + getAllLineVersions:function(lineId,callback){
  96 + $get('/lineVersions/findAllHistroyLineVersionsById',{lineId:lineId},function(result) {
  97 + callback && callback(result);
  98 + });
  99 + },
  100 +
  101 + /**
  102 + *
  103 + * @param lineId
  104 + * @param direction
  105 + * @param stationRouteCode
  106 + * @param callback
  107 + */
  108 + findUpStationRouteCode : function(lineId, direction, stationRouteCode, callback) {
  109 + $get('/stationroute/findUpStationRouteCode',{lineId: lineId, direction: direction, stationRouteCode: stationRouteCode},function(result) {
  110 + callback && callback(result);
  111 + });
  112 + },
  113 +
  114 + /**
  115 + *
  116 + * @param lineId
  117 + * @param diraction
  118 + * @param sectionRouteCode
  119 + * @param version
  120 + * @param callback
  121 + */
  122 + findUpSectionRouteCode : function(lineId,diraction,sectionRouteCode,version,callback) {
  123 + $get('/sectionroute/findUpSectionRouteCode',{lineId:lineId,direction:diraction,sectionRouteCode:sectionRouteCode,versions:version},function(result) {
  124 + callback && callback(result);
  125 + });
  126 + },
  127 +
  128 + /**
  129 + * 新增站点路由
  130 + * @param stationRoute
  131 + * @param callback
  132 + */
  133 + addStationRoute : function(stationRoute, callback) {
  134 + $post('/api/lsstationroute/add', stationRoute, function(data) {
  135 + callback && callback(data);
  136 + });
  137 + },
  138 +
  139 + /**
  140 + * 站点路由更新
  141 + * @param stationRoute
  142 + * @param callback
  143 + */
  144 + modifyStationRoute : function(stationRoute, callback) {
  145 + $post('/api/lsstationroute/modify', stationRoute, function(data) {
  146 + callback && callback(data);
  147 + });
  148 + },
  149 +
  150 + /**
  151 + * 撤销站点
  152 + * @param stationRoute
  153 + * @param callback
  154 + */
  155 + stationRouteIsDestroy : function(stationRoute,callback) {
  156 + $post('/stationroute/stationRouteIsDestroy',stationRoute,function(data) {
  157 + callback && callback(data);
  158 + })
  159 +
  160 + },
  161 +
  162 + /**
  163 + * 编辑线路走向保存
  164 + * @param section
  165 + * @param callback
  166 + */
  167 + sectionUpdate:function(section, callback) {
  168 + $post('/api/lssectionroute/modify', section, function(data) {
  169 + callback && callback(data);
  170 + })
  171 + },
  172 +
  173 + /**
  174 + * 生成线路走向
  175 + * @param section
  176 + * @param callback
  177 + */
  178 + sectionSave:function(section, callback){
  179 + $post('/api/lssectionroute/add',section,function(data) {
  180 + callback && callback(data);
  181 + })
  182 + },
  183 +
  184 + /**
  185 + * 获取线路名称
  186 + * @param id
  187 + * @param callback
  188 + */
  189 + getIdLineName : function (id,callback) {
  190 + $get('/line/' + id ,null, function(result){
  191 + callback && callback(result);
  192 + });
  193 + },
  194 +
  195 + /**
  196 + * 查询站点信息
  197 + * @param lineId
  198 + * @param direction
  199 + * @param callback
  200 + */
  201 + getStationRouteInfo : function(lineId,direction,callback) {
  202 + $get('/stationroute/all',{'line.id_eq' : lineId , 'directions_eq' : direction},function(resultdata) {
  203 + callback && callback(resultdata);
  204 + });
  205 + },
  206 +
  207 + /**
  208 + * 查询路段信息
  209 + * @param lineId
  210 + * @param direction
  211 + * @param version
  212 + * @param callback
  213 + */
  214 + getSectionRouteInfo : function(lineId, direction, version, callback) {
  215 + $get('/api/lssectionroute/findAll',{'line.id_eq': lineId , 'directions_eq': direction, 'versions_eq': version, 'destroy_eq': 0},function(sectionRoutes) {
  216 + callback && callback(sectionRoutes);
  217 + });
  218 + },
  219 +
  220 + /**
  221 + * 根据ID查询路段信息
  222 + * @param sectionRouteId
  223 + * @param callback
  224 + */
  225 + getSectionRouteInfoById : function(sectionRouteId, callback){
  226 + $get('/api/lssectionroute/' + sectionRouteId, {}, function(r) {
  227 + return callback && callback(r);
  228 + });
  229 + },
  230 +
  231 + /**
  232 + * 手动规划线路保存
  233 + * @param params
  234 + * @param cb
  235 + */
  236 + manualSave : function(params, cb) {
  237 + $.ajax('/api/lsstationroute/addRoutes', {
  238 + method: 'POST',
  239 + data: JSON.stringify(params),
  240 + contentType: 'application/json',
  241 + success: function (res) {
  242 + cb && cb(res);
  243 + }
  244 + });
  245 + },
  246 +
  247 + /**
  248 + * 编辑线路走向保存
  249 + * @param section
  250 + * @param callback
  251 + */
  252 + inoutSectionUpdate:function(section,callback) {
  253 + $post('/inout/sectionUpdate',section,function(data) {
  254 + callback && callback(data);
  255 + })
  256 + },
  257 +
  258 + /**
  259 + * 生成线路走向
  260 + * @param section
  261 + * @param callback
  262 + */
  263 + inoutSectionSave:function(section,callback){
  264 + $post('/inout/sectionSave',section,function(data) {
  265 + callback && callback(data);
  266 + })
  267 + },
  268 +
  269 + /**
  270 + * 根据线路查找进出场的起终点信息
  271 + * @param lineId
  272 + * @param version
  273 + * @param cb
  274 + */
  275 + getStartEndByLine: function (lineId, version, cb) {
  276 + $get('/inout/getStartEndByLine', {lineId : lineId, version : version}, function (r) {
  277 + return cb && cb(r);
  278 + });
  279 + },
  280 +
  281 + /**
  282 + * 根据起终点查找对应的路段信息
  283 + * @param lineId
  284 + * @param version
  285 + * @param start
  286 + * @param end
  287 + * @param cb
  288 + */
  289 + getRouteByStartEnd: function (lineId, version, start, end, cb) {
  290 + $get('/inout/getRouteByStartEnd', {lineId : lineId, version : version, start : start, end : end}, function (r) {
  291 + return cb && cb(r);
  292 + });
  293 + },
  294 +
  295 + /**
  296 + * 根据ID查询路段信息
  297 + * @param sectionRouteId
  298 + * @param callback
  299 + */
  300 + getRouteInfoById : function(sectionRouteId,callback){
  301 + $get('/inout/' + sectionRouteId,{},function(r) {
  302 + return callback && callback(r);
  303 + });
  304 + },
  305 +
  306 + /**
  307 + *
  308 + * @param stationName
  309 + * @param cb
  310 + */
  311 + findStationByName: function(stationName, cb) {
  312 + $get('/station/findStationByName', {stationName: stationName}, function(stations) {
  313 + cb && cb(stations);
  314 + });
  315 + },
  316 +
  317 + /**
  318 + *
  319 + * @param sectionName
  320 + * @param cb
  321 + */
  322 + findSectionByName: function(sectionName, cb) {
  323 + $get('/section/findSectionByName', {sectionName: sectionName}, function(res) {
  324 + cb && cb(res.data);
  325 + });
  326 + },
  327 +
  328 + /**
  329 + *
  330 + * @param lineId
  331 + * @param version
  332 + * @param callback
  333 + */
  334 + circularRouteHandle: function (lineId, version, callback) {
  335 + $post('/api/lsstationroute/circularRouteHandle', {lineId: lineId, version: version}, function() {
  336 + callback && callback();
  337 + });
  338 + }
  339 + };
  340 +
  341 + return service;
  342 +})();
  343 +
  344 +proxy.emit('routes-service-loaded');
0 \ No newline at end of file 345 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/js/stationroute-ajax-getdata.js deleted 100644 → 0
1 -/**  
2 - * GetAjaxData :ajax异步请求  
3 - *  
4 - * - - - - - -》 collectionSave :系统规划保存请求  
5 - *  
6 - * - - - - - -》 getStation :树数据获取  
7 - *  
8 - * - - - - - -》 getStationRoutePoint :查询线路某方向下所有站点的中心百度坐标  
9 - *  
10 - * - - - - - -》 getLikeStationName :查询是否有已存在站点名称  
11 - *  
12 - * - - - - - -》 getStationCode:查询站点编码  
13 - *  
14 - * - - - - - -》 addStationRoute:新增站点保存  
15 - *  
16 - * - - - - - -》 modifyStationRoute:站点更新  
17 - *  
18 - * - - - - - -》 stationRouteIsDestroy:撤销站点  
19 - *  
20 - * - - - - - -》 sectionUpdate : 编辑线路走向保存  
21 - *  
22 - * - - - - - -》 sectionSave : 生成线路走向  
23 - *  
24 - * - - - - - -》 getIdLineName:获取线路名称  
25 - *  
26 - * - - - - - -》 getSectionRouteInfo:查询路段信息  
27 - */  
28 -  
29 -var GetAjaxData = function(){  
30 -  
31 - var ajaxData = {  
32 - // 系统规划保存请求  
33 - collectionSave : function (params, cb) {  
34 - $.ajax('/api/lsstationroute/addRoutes', {  
35 - method: 'POST',  
36 - data: JSON.stringify(params),  
37 - contentType: 'application/json',  
38 - success: function (res) {  
39 - cb && cb(res);  
40 - }  
41 - });  
42 - },  
43 -  
44 - // 树数据获取  
45 - getStation : function(id_,dir_,version,callback) {  
46 - $get('/stationroute/findStations', {'line.id_eq': id_ , 'directions_eq': dir_, 'versions_eq': version}, function(result) {  
47 - callback && callback(result);  
48 - });  
49 - },  
50 - getzdlyInfo : function(params,callback) {  
51 - $get('/api/lsstationroute/findAllByParams',params,function(result) {  
52 - callback && callback(result);  
53 - });  
54 - },  
55 - // 查询线路某方向下所有站点的中心百度坐标  
56 - getStationRoutePoint : function(id_,dir_,version,callback) {  
57 - $get('/stationroute/getStationRouteList',{'line.id_eq': id_, directions_eq: dir_, versions_eq:version},function(result) {  
58 - callback && callback(result);  
59 - });  
60 - },  
61 -  
62 - // 查询是否有已存在站点名称  
63 - getLikeStationName : function (stationName,callback) {  
64 - $get('/station/all', {stationName_eq: stationName}, function(array){  
65 - callback && callback(array);  
66 - });  
67 - },  
68 -  
69 - // 查询站点编码  
70 - getStationCode : function(callback) {  
71 - $get('/station/findStationCode',null,function(stationCode) {  
72 - if(stationCode>0) {  
73 - callback && callback(stationCode);  
74 - }  
75 - });  
76 - },  
77 - // 查询路段编码  
78 - getSectionCode : function(callback) {  
79 - $get('/section/getSectionCode',null,function(sectionCode) {  
80 - callback && callback(sectionCode);  
81 - });  
82 - },  
83 - getAllLineVersions:function(lineId,callback){  
84 - $get('/lineVersions/findAllHistroyLineVersionsById',{lineId:lineId},function(result) {  
85 - callback && callback(result);  
86 - });  
87 - },  
88 - findUpStationRouteCode : function(lineId, direction, stationRouteCode, callback) {  
89 - $get('/stationroute/findUpStationRouteCode',{lineId: lineId, direction: direction, stationRouteCode: stationRouteCode},function(result) {  
90 - callback && callback(result);  
91 - });  
92 - },  
93 - findUpSectionRouteCode : function(lineId,diraction,sectionRouteCode,version,callback) {  
94 - $get('/sectionroute/findUpSectionRouteCode',{lineId:lineId,direction:diraction,sectionRouteCode:sectionRouteCode,versions:version},function(result) {  
95 - callback && callback(result);  
96 - });  
97 - },  
98 - // 新增站点路由  
99 - addStationRoute : function(stationRoute, callback) {  
100 - $post('/api/lsstationroute/add', stationRoute, function(data) {  
101 - callback && callback(data);  
102 - });  
103 - },  
104 - // 站点路由更新  
105 - modifyStationRoute : function(stationRoute, callback) {  
106 - $post('/api/lsstationroute/modify', stationRoute, function(data) {  
107 - callback && callback(data);  
108 - });  
109 - },  
110 -  
111 - // 撤销站点  
112 - stationRouteIsDestroy : function(stationRoute,callback) {  
113 - $post('/stationroute/stationRouteIsDestroy',stationRoute,function(data) {  
114 - callback && callback(data);  
115 - })  
116 -  
117 - },  
118 -  
119 - // 编辑线路走向保存  
120 - sectionUpdate:function(section, callback) {  
121 - $post('/api/lssectionroute/modify', section, function(data) {  
122 - callback && callback(data);  
123 - })  
124 - },  
125 -  
126 - // 生成线路走向  
127 - sectionSave:function(section, callback){  
128 - $post('/api/lssectionroute/add',section,function(data) {  
129 - callback && callback(data);  
130 - })  
131 - },  
132 -  
133 - // 获取线路名称  
134 - getIdLineName : function (id,callback) {  
135 - $get('/line/' + id ,null, function(result){  
136 - callback && callback(result);  
137 - });  
138 - },  
139 -  
140 - // 查询站点信息  
141 - getStationRouteInfo : function(lineId,direction,callback) {  
142 - $get('/stationroute/all',{'line.id_eq' : lineId , 'directions_eq' : direction},function(resultdata) {  
143 - callback && callback(resultdata);  
144 - });  
145 - },  
146 -  
147 - // 查询路段信息  
148 - getSectionRouteInfo : function(lineId, direction, version, callback) {  
149 - $get('/api/lssectionroute/findAll',{'line.id_eq': lineId , 'directions_eq': direction, 'versions_eq': version, 'destroy_eq': 0},function(sectionRoutes) {  
150 - callback && callback(sectionRoutes);  
151 - });  
152 - },  
153 - // 根据ID查询路段信息.  
154 - getSectionRouteInfoById : function(sectionRouteId, callback){  
155 - $get('/api/lssectionroute/' + sectionRouteId, {}, function(r) {  
156 - return callback && callback(r);  
157 - });  
158 - },  
159 -  
160 - // 手动规划线路保存  
161 - manualSave : function(params, cb) {  
162 - $.ajax('/api/lsstationroute/addRoutes', {  
163 - method: 'POST',  
164 - data: JSON.stringify(params),  
165 - contentType: 'application/json',  
166 - success: function (res) {  
167 - cb && cb(res);  
168 - }  
169 - });  
170 - },  
171 -  
172 - // 编辑线路走向保存  
173 - inoutSectionUpdate:function(section,callback) {  
174 - $post('/inout/sectionUpdate',section,function(data) {  
175 - callback && callback(data);  
176 - })  
177 - },  
178 -  
179 - // 生成线路走向  
180 - inoutSectionSave:function(section,callback){  
181 - $post('/inout/sectionSave',section,function(data) {  
182 - callback && callback(data);  
183 - })  
184 - },  
185 -  
186 - // 根据线路查找进出场的起终点信息  
187 - getStartEndByLine: function (lineId, version, cb) {  
188 - $get('/inout/getStartEndByLine', {lineId : lineId, version : version}, function (r) {  
189 - return cb && cb(r);  
190 - });  
191 - },  
192 -  
193 - // 根据起终点查找对应的路段信息  
194 - getRouteByStartEnd: function (lineId, version, start, end, cb) {  
195 - $get('/inout/getRouteByStartEnd', {lineId : lineId, version : version, start : start, end : end}, function (r) {  
196 - return cb && cb(r);  
197 - });  
198 - },  
199 -  
200 - // 根据ID查询路段信息.  
201 - getRouteInfoById : function(sectionRouteId,callback){  
202 - $get('/inout/' + sectionRouteId,{},function(r) {  
203 - return callback && callback(r);  
204 - });  
205 - },  
206 -  
207 - findStationByName: function(stationName, cb) {  
208 - $get('/station/findStationByName', {stationName: stationName}, function(stations) {  
209 - cb && cb(stations);  
210 - });  
211 - },  
212 -  
213 - findSectionByName: function(sectionName, cb) {  
214 - $get('/section/findSectionByName', {sectionName: sectionName}, function(res) {  
215 - cb && cb(res.data);  
216 - });  
217 - },  
218 -  
219 - circularRouteHandle: function (lineId, version, callback) {  
220 - $post('/api/lsstationroute/circularRouteHandle', {lineId: lineId, version: version}, function() {  
221 - callback && callback();  
222 - });  
223 - }  
224 - };  
225 - return ajaxData;  
226 -  
227 -}();  
228 \ No newline at end of file 0 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/js/stationroute-list-events.js deleted 100644 → 0
1 -$(function(){  
2 -  
3 - // 上行方向(0:上行;1:下行)  
4 - var directionUpValue = $('#stationUp').data('direction');  
5 -  
6 - // 下行方向 (0:上行;1:下行)  
7 - var directionDownValue = $('.downSystem').data('direction');  
8 -  
9 - // 系统规划上行站点点击事件  
10 - $('.upSystem').on('click',function() {  
11 - // 隐藏上行规划  
12 - $('#upToolsMobal').hide();  
13 - // 弹出正在加载层  
14 - var i = layer.load(0,{offset:['200px', '280px']});  
15 - /** 修正线路名称 @param:<directionUpValue:方向(上行)> */  
16 - PublicFunctions.lineNameIsHaveInterval(directionUpValue);  
17 -  
18 - });  
19 -  
20 - $('.gpsRoute').on('click',function() {  
21 - // 加载其它规划选择弹出层modal页面  
22 - $.get('add_routes_template.html', function(m){  
23 - $(pjaxContainer).append(m);  
24 - $('#add_routes_template_modal').trigger('modal.show', [WorldsBMap,GetAjaxData,LineObj,PublicFunctions]);  
25 - });  
26 - });  
27 -  
28 - // 上行站点新增事件  
29 - $('.module_tools #addUpStation').on('click', function() {  
30 - /** 设置新增站点对象方向属性值 @param:<directionUpValue:方向(0:上行;1:下行)> */  
31 - AddStationObj.setAddStationDiraction(directionUpValue);  
32 - WorldsBMap.addStationInit();  
33 - // 加载选择新增方式mobal  
34 - $.get('add_stationroute_step1.html', function(m){  
35 - $(pjaxContainer).append(m);  
36 - $('#add_stationroute_step1_modal').trigger('modal.show', [WorldsBMap,DrawingManagerObj,GetAjaxData,AddStationObj,LineObj,PublicFunctions]);  
37 - });  
38 - });  
39 -  
40 - // 修改上行站点mobal页面  
41 - $('.module_tools #editUpStation').on('click', function(){  
42 - var sel = PublicFunctions.getCurrSelNode(directionUpValue);  
43 - if(sel.length==0 || sel[0].original.chaildredType !='station'){  
44 - layer.msg('请先选择要编辑的上行站点!');  
45 - return;  
46 - }  
47 - $.get('edit_select.html', function(m){  
48 - $(pjaxContainer).append(m);  
49 - $('#edit_select_mobal').trigger('editSelectMobal_show', [WorldsBMap,DrawingManagerObj,GetAjaxData,EditStationObj,LineObj,PublicFunctions,directionUpValue]);  
50 - });  
51 - });  
52 -  
53 - // 撤销上行站点  
54 - $('.module_tools #deleteUpStation').on('click', function() {  
55 - PublicFunctions.stationRevoke(directionUpValue);  
56 - });  
57 -  
58 - // 上行批量撤销事件  
59 - $('.module_tools #batchUpDelete').on('click', function() {  
60 - var Line = LineObj.getLineObj();  
61 - /** 设置批量删除的线路方向 @param:<directionUpValue:方向(0:上行;1:下行)> */  
62 - DeleteBatchObj.setDeteleBatchDiraction(directionUpValue);  
63 - // 加载选择新增方式mobal  
64 - $.get('destroy_routes.html', function(m){  
65 - $(pjaxContainer).append(m);  
66 - $('#delete_select_mobal').trigger('deleteSelectMobal.show',[GetAjaxData,Line,PublicFunctions,DeleteBatchObj]);  
67 - });  
68 - });  
69 -  
70 - // 切换上下行.  
71 - $('.retweet').on('click',function() {  
72 - layer.confirm('您是否确定将【上、下】行站点和路段进行对换!', {  
73 - btn : [ '确认提示并提交', '取消' ]  
74 - },function () {  
75 - // 关闭所有提示弹出层.  
76 - layer.closeAll();  
77 - // 弹出提示层.  
78 - var index = layer.load(1, {  
79 - shade: [0.1,'#fff'] // 透明度的白色背景  
80 - });  
81 - var Line = LineObj.getLineObj();  
82 - $post('/api/lsstationroute/exchangeDirection', {lineId: Line.id, version: $('#versions').val()}, function(data) {  
83 - layer.close(index);  
84 - if(data.status=='SUCCESS') {  
85 - // 弹出操作成功提示消息  
86 - layer.msg('操作成功...');  
87 - }else {  
88 - // 弹出操作失败提示消息  
89 - layer.msg('操作成功...');  
90 - }  
91 - WorldsBMap.clearMarkAndOverlays();  
92 - $('#stationDown').removeClass('active');  
93 - $('#stationDown').removeClass('in');  
94 - $('#stationDown').addClass('fade');  
95 - $('#stationUp').addClass('active in');  
96 - $('#downLine').parent().removeClass('active');  
97 - $('#upLine').parent().addClass('active');  
98 - // 刷新左边树  
99 - PublicFunctions.resjtreeDate(Line.id,0,$("#versions").val());  
100 - /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */  
101 -// GetAjaxData.getSectionRouteInfo(Line.id,0,function(data) {  
102 -// /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */  
103 -// PublicFunctions.linePanlThree(Line.id,data,0);  
104 -// });  
105 - });  
106 - });  
107 - });  
108 -  
109 - $('#wrenchUpDis').on('click',function() {  
110 - var Line = LineObj.getLineObj();  
111 - GetAjaxData.getStation(Line.id,directionUpValue,$("#versions").val(),function(rd) {  
112 - // 加载其它规划选择弹出层mobal页面  
113 - $.get('tzzj.html', function(m){  
114 - $(pjaxContainer).append(m);  
115 - $('#tzzj_mobal').trigger('tzzjMobal.show', [WorldsBMap,GetAjaxData,0,Line.id,PublicFunctions,rd[0].children[0].children]);  
116 - });  
117 - });  
118 - })  
119 -  
120 - $('#wrenchDownDis').on('click',function() {  
121 - var Line = LineObj.getLineObj();  
122 - GetAjaxData.getStation(Line.id,directionDownValue,$("#versions").val(),function(rd) {  
123 - // 加载其它规划选择弹出层mobal页面  
124 - $.get('tzzj.html', function(m){  
125 - $(pjaxContainer).append(m);  
126 - $('#tzzj_mobal').trigger('tzzjMobal.show', [WorldsBMap,GetAjaxData,1,Line.id,PublicFunctions,rd[0].children[0].children]);  
127 - });  
128 - });  
129 - });  
130 -  
131 - $('#quoteDown').on('click',function() {  
132 - // 弹出提示层.  
133 - var index = layer.load(1, {  
134 - shade: [0.1,'#fff'] // 透明度的白色背景  
135 - });  
136 - var Line = LineObj.getLineObj();  
137 - var params = {lineId: Line.id, version: $('#versions').val(), direction: 0, otherDirection: 1};  
138 - quote(params,index);  
139 - });  
140 -  
141 - $('#quoteUp').on('click',function() {  
142 - // 弹出提示层.  
143 - var index = layer.load(1, {  
144 - shade: [0.1,'#fff'] // 透明度的白色背景  
145 - });  
146 - var Line = LineObj.getLineObj();  
147 - console.log($($("#versions").find("option:selected")[0]).attr("status"));  
148 - var params = {lineId: Line.id, version: $('#versions').val(), direction: 1, otherDirection: 0};  
149 - quote(params,index);  
150 - });  
151 -  
152 - function quote(params,index) {  
153 - $post('/api/lssectionroute/quoteOtherSide', params, function(data) {  
154 - layer.close(index);  
155 - if(data.status=='SUCCESS') {  
156 - // 弹出操作成功提示消息  
157 - layer.msg('操作成功...');  
158 - }else {  
159 - // 弹出操作失败提示消息  
160 - layer.msg('操作成功...');  
161 - }  
162 - WorldsBMap.clearMarkAndOverlays();  
163 -  
164 - var dir = params.direction;  
165 - if(dir == 0){  
166 - dir = 1;  
167 - }else{  
168 - dir = 0;  
169 - }  
170 - // 刷新左边树  
171 - PublicFunctions.resjtreeDate(params.lineId,dir,$("#versions").val());  
172 - /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */  
173 -// GetAjaxData.getSectionRouteInfo(params.lineId,params.dir,function(data) {  
174 -// /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */  
175 -// PublicFunctions.linePanlThree(params.lineId,data,params.dir);  
176 -// });  
177 - });  
178 - }  
179 - // 编辑线路上行走向  
180 - $('.module_tools #editUplineTrend').on('click', function() {PublicFunctions.editLinePlan(directionUpValue);});  
181 -  
182 - // 线路上行  
183 - $('#leftUpOrDown #upLine').on('click', function(){  
184 - var lineIdEvents = LineObj.getLineObj();  
185 -  
186 - var val = $("#versions").val();  
187 -  
188 - /** 初始化上行树 @param:<Line.id:线路Id;0:上行> */  
189 - PublicFunctions.resjtreeDate(lineIdEvents.id,'0',val);  
190 - WorldsBMap.setStatus(lineIdEvents.id, val, 0);  
191 - });  
192 -  
193 - // 系统规划下行站点  
194 - $('.downSystem').on('click',function() {  
195 - // 隐藏下行规划  
196 - $('#downToolsMobal').hide();  
197 - // 弹出正在加载层  
198 - var i = layer.load(0,{offset:['200px', '280px']});  
199 - /** 修正线路名称 @param:<directionUpValue:方向(上行)> */  
200 - PublicFunctions.lineNameIsHaveInterval(directionDownValue);  
201 - });  
202 -  
203 - // 下行站点新增事件  
204 - $('.module_tools #addDownStation').on('click', function() {  
205 - /** 设置新增站点对象方向属性值 @param:<directionUpValue:方向(0:上行;1:下行)> */  
206 - AddStationObj.setAddStationDiraction(directionDownValue);  
207 - WorldsBMap.addStationInit();  
208 - // 加载选择新增方式mobal  
209 - $.get('add_stationroute_step1.html', function(m){  
210 - $(pjaxContainer).append(m);  
211 - $('#add_stationroute_step1_modal').trigger('modal.show', [WorldsBMap,DrawingManagerObj,GetAjaxData,AddStationObj,LineObj,PublicFunctions]);  
212 - });  
213 - });  
214 -  
215 - // 修改下行站点mobal页面  
216 - $('.module_tools #editDownStation').on('click', function(){  
217 - var sel = PublicFunctions.getCurrSelNode(directionDownValue);  
218 - if(sel.length==0 || sel[0].original.chaildredType !='station'){  
219 - layer.msg('请先选择要编辑的下行站点!');  
220 - return;  
221 - }  
222 - $.get('edit_select.html', function(m){  
223 - $(pjaxContainer).append(m);  
224 - $('#edit_select_mobal').trigger('editSelectMobal_show', [WorldsBMap,DrawingManagerObj,GetAjaxData,EditStationObj,LineObj,PublicFunctions,directionDownValue]);  
225 - });  
226 - });  
227 -  
228 - // 撤销下行站点  
229 - $('.module_tools #deleteDownStation').on('click', function() {  
230 - PublicFunctions.stationRevoke(directionDownValue);  
231 - });  
232 -  
233 - // 下行批量撤销事件  
234 - $('.module_tools #batchDownDelete').on('click', function() {  
235 - var Line = LineObj.getLineObj();  
236 - /** 设置批量删除的线路方向 @param:<directionDownValue:方向(0:上行;1:下行)> */  
237 - DeleteBatchObj.setDeteleBatchDiraction(directionDownValue);  
238 - // 加载选择新增方式mobal  
239 - $.get('destroy_routes.html', function(m){  
240 - $(pjaxContainer).append(m);  
241 - $('#delete_select_mobal').trigger('deleteSelectMobal.show',[GetAjaxData,Line,PublicFunctions,DeleteBatchObj]);  
242 - });  
243 - });  
244 -  
245 - // 编辑线路下行走向  
246 - $('.module_tools #editDownlineTrend').on('click', function() {  
247 - PublicFunctions.editLinePlan(directionDownValue);  
248 - });  
249 -  
250 - // 线路下行  
251 - $('#leftUpOrDown #downLine').on('click', function(){  
252 - var lineIdEvents = LineObj.getLineObj();  
253 -  
254 -  
255 - var val = $("#versions").val();  
256 - /** 初始化下行树 @param:<Line.id:线路Id;1:下行> */  
257 - PublicFunctions.resjtreeDate(lineIdEvents.id,'1',val);  
258 - WorldsBMap.setStatus(lineIdEvents.id, val, 0);  
259 - });  
260 -  
261 - // 生成行单  
262 - $('.module_tools #createUsingSingle').on('click', function() {  
263 - var lineIdEvents = LineObj.getLineObj();  
264 - var params = {lineId:lineIdEvents.id};  
265 - GetAjaxData.createUsingSingle(params,function(data) {  
266 - if(data.status=='SUCCESS') {  
267 - // 弹出生成成功提示消息  
268 - layer.msg('生成成功...');  
269 - }else {  
270 - // 弹出生成失败提示消息  
271 - layer.msg('生成失败...');  
272 - }  
273 - });  
274 - });  
275 - $('#scrllmouseEvent').on('mousemove',function() {  
276 - $('.defeat-scroll').css('overflow','auto');  
277 - }).on('mouseleave',function() {  
278 - $('.defeat-scroll').css('overflow','hidden');  
279 - });  
280 -  
281 - // 进出场规划  
282 - $('#leftUpOrDown #inoutLine').on('click', function(){  
283 - var lineIdEvents = LineObj.getLineObj();  
284 -  
285 - var val = $("#versions").val();  
286 -  
287 - /** 初始化上行树 @param:<Line.id:线路Id;0:上行> */  
288 - PublicFunctions.resjtreeDate(lineIdEvents.id,'3',val);  
289 - });  
290 -  
291 - $('#circularRouteHandle').on('click', function() {  
292 - var line = LineObj.getLineObj(), version = $("#versions").val();  
293 - GetAjaxData.circularRouteHandle(line.id, version, function() {  
294 - layer.msg('操作成功');  
295 - PublicFunctions.resjtreeDate(line.id, '0', version);  
296 - })  
297 - })  
298 -});  
299 \ No newline at end of file 0 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/js/stationroute-list-function.js deleted 100644 → 0
1 -/**  
2 - * 函数  
3 - *  
4 - * - - - - - - - 》 getCurrSelNode : 获取选中树节点数据函数  
5 - *  
6 - * - - - - - - - 》 resjtreeDate : 刷新树函数函数  
7 - *  
8 - * - - - - - - - 》 setFormInputValue : 新增站点参数集合赋值函数  
9 - *  
10 - * - - - - - - - 》 editSetStationParmas : 编辑站点参数集合赋值函数  
11 - *  
12 - * - - - - - - - 》 editSeteditStationParmasValue:编辑站点范围图形参数集合赋值函数  
13 - *  
14 - * - - - - - - - 》 lineNameIsHaveInterval : 系统规划时修正线路名称  
15 - *  
16 - * - - - - - - - 》 systemLineStation:系统规划保存函数  
17 - *  
18 - * - - - - - - - 》 stationRevoke :撤销站点  
19 - *  
20 - * - - - - - - - 》 editLinePlan :编辑线路走向  
21 - *  
22 - * - - - - - - - 》 setFormValue :编辑站点设置表单元素值  
23 - *  
24 - * - - - - - - - 》 eachSectionList:路段折线百度坐标转WGS坐标  
25 - */  
26 -  
27 -var PublicFunctions = function () {  
28 - var mapData = {};  
29 - var PubFun = {  
30 - /** 初始化线路标题与ID */  
31 - setTiteText : function(lineId) {  
32 - // 根据线路ID获取线路名称  
33 - GetAjaxData.getIdLineName(lineId,function(data) {  
34 - // 定义线路名称  
35 - var lineNameV = data.name;  
36 - $('.portlet-title .caption').text(lineNameV);  
37 - });  
38 - },  
39 - /** @param direction 方向 @return array */  
40 - getCurrSelNode : function(direction){  
41 - // 定义Obj  
42 - var array = [];  
43 - try {  
44 - // 上行  
45 - if(direction=='0'){  
46 - // 获取上行选中节点  
47 - array = $.jstree.reference("#station_Up_tree").get_selected(true);  
48 - // 下行  
49 - }else if(direction=='1'){  
50 - // 获取下行选中节点  
51 - array = $.jstree.reference("#station_Down_tree").get_selected(true);  
52 - }  
53 - } catch (e) {  
54 - console.log(e);  
55 - }  
56 - // 返回Obj  
57 - return array;  
58 - },  
59 - startOrEndPoint: function(points, carpark) {  
60 - var harr = new Array, i = 0;  
61 - for (i = 0;i < points.length;i++) {  
62 - harr.push('<option value="', points[i].stationName, '_station">', points[i].stationName, '</option>');  
63 - points[i].bdPoint = points[i].station.bJwpoints;  
64 - points[i].bdPoints = points[i].station.bdPolygon;  
65 - points[i].shapesType = points[i].station.shapesType;  
66 - points[i].radius = points[i].station.radius;  
67 - mapData[points[i].stationName + '_station'] = points[i];  
68 - }  
69 - harr.push('<option value="', carpark.parkName, '_park">', carpark.parkName, '</option>');  
70 - carpark.bdPoint = carpark.bCenterPoint;  
71 - carpark.bdPoints = carpark.bParkPoint;  
72 - carpark.stationName = carpark.parkName;  
73 - mapData[carpark.parkName + '_park'] = carpark;  
74 -  
75 - return harr.join('');  
76 - },  
77 - /** @param id:线路ID ;directionData:方向 */  
78 - resjtreeDate : function(id, direction, version){  
79 - if(!version){  
80 - version = $("#versions").val();  
81 - }  
82 -  
83 - var status = $($("#versions").find("option:selected")[0]).attr("status");  
84 - if (direction == 3) {  
85 - // 隐藏上行规划  
86 - $('#upToolsMobal').hide();  
87 - // 隐藏上行树  
88 - $('#uptreeMobal').hide();  
89 - // 隐藏下行规划  
90 - $('#downToolsMobal').hide();  
91 - // 隐藏下行树  
92 - $('#DowntreeMobal').hide();  
93 - //  
94 - $('#InoutCarparktreeMobal .table-toolbar').hide();  
95 -  
96 - GetAjaxData.getStartEndByLine(id, version, function (result) {  
97 - if (result.data) {  
98 - $('#InoutCarparktreeMobal').show();  
99 - var formHtml = template('inout-carpark-search-form');  
100 - $('.inout-search').html(formHtml);  
101 -  
102 - $('#startPoint').html(PubFun.startOrEndPoint(result.data.start, result.data.carpark));  
103 - $('#endPoint').html(PubFun.startOrEndPoint(result.data.end, result.data.carpark));  
104 - $('#startPoint').on('change', function () {  
105 - $('#InoutCarparktreeMobal .table-toolbar').hide();  
106 - });  
107 - $('#endPoint').on('change', function () {  
108 - $('#InoutCarparktreeMobal .table-toolbar').hide();  
109 - });  
110 - $('#inoutSearch').on('click', function () {  
111 - var start = $('#startPoint').val().split('_'), end = $('#endPoint').val().split('_');  
112 - if (start[1] == end[1]) {  
113 - layer.msg('进出场的站点不可能同时为站点或停车场');  
114 - return;  
115 - }  
116 -  
117 - $('#inout_carpark_tree').show();  
118 - $('#InoutCarparktreeMobal .table-toolbar').show();  
119 -  
120 - GetAjaxData.getRouteByStartEnd(id, version, start[0], end[0], (result1) => {  
121 - var routes = result1.data.routes, rootNode;  
122 - WorldsBMap.clearMarkAndOverlays();  
123 - var startPoint = mapData[start.join('_')], endPoint = mapData[end.join('_')], point, points;  
124 - if (startPoint.shapesType === 'r') {  
125 - point = startPoint.bdPoint.split(' ');  
126 - WorldsBMap.drawCircle({lng : point[0], lat : point[1]}, startPoint.radius, startPoint.stationName, true);  
127 - } else if (startPoint.shapesType === 'd') {  
128 - points = startPoint.bdPoints;  
129 - points = points.replace('POLYGON ((', '').replace('POLYGON((', '').replaceAll(', ', ',').replace('))', '');  
130 - points = points.split(',')  
131 - WorldsBMap.drawPolygon(points, startPoint.stationName, true);  
132 - }  
133 -  
134 - if (endPoint.shapesType === 'r') {  
135 - point = endPoint.bdPoint.split(' ');  
136 - WorldsBMap.drawCircle({lng : point[0], lat : point[1]}, endPoint.radius, endPoint.stationName, true);  
137 - } else if (endPoint.shapesType === 'd') {  
138 - points = endPoint.bdPoints;  
139 - points = points.replace('POLYGON ((', '').replace('POLYGON((', '').replaceAll(', ', ',').replace('))', '');  
140 - points = points.split(',')  
141 - WorldsBMap.drawPolygon(points, endPoint.stationName, true);  
142 - }  
143 -  
144 - rootNode = {id: -1, pId: null, name: '路段', text: '路段', icon: null, groupType: 2, container : 'pjax-container', enable : true, children: routes};  
145 - if (routes.length > 0) {  
146 - for (var i = 0,route;i < routes.length;i++) {  
147 - route = routes[i];  
148 - route.pId = 1;  
149 - route.name = route.section.sectionName;  
150 - route.text = route.section.sectionName;  
151 - route.icon = null;  
152 - route.groupType = 3;  
153 - route.chaildredType = 'section';  
154 - route.enable = true;  
155 - route.lineId = id;  
156 - route.lineCode = id;  
157 - route.versions = version;  
158 - route.dir = 3;  
159 - route.start = start[0];  
160 - route.end = end[0];  
161 - points = route.section.bsectionVectorWkt.replace('LINESTRING(', '').replace(')', '');  
162 - points = points.split(',');  
163 - WorldsBMap.drawPolyLine(points, route, start[0], end[0]);  
164 - }  
165 - } else {  
166 - 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, container : 'pjax-container', enable : true, chaildredType: status > 0 ? 'addSection' : '', sectionBsectionVector: 'LINESTRING(' + startPoint.bdPoint + ')'}];  
167 - }  
168 - StationTreeData.inoutInit([rootNode]);  
169 - StationTreeData.inoutreloadeTree([rootNode]);  
170 - });  
171 - });  
172 - } else {  
173 - layer.msg(result.msg);  
174 - }  
175 - });  
176 - } else {  
177 - $('#InoutCarparktreeMobal').hide();  
178 - $('#inout_carpark_tree').hide();  
179 - }  
180 -  
181 - // 获取树数据  
182 - GetAjaxData.getStation(id, direction, version, function(routes) {  
183 - // 获取数据长度  
184 - var len = routes.stationRoutes.length;  
185 - // 上行  
186 - if(direction == 0){  
187 - // 长度大于零  
188 - if (len > 0) {  
189 - // 隐藏上行规划  
190 - $('#upToolsMobal').hide();  
191 - // 显示树  
192 - $('#uptreeMobal').show();  
193 - // 刷新树  
194 - StationTreeData.reloadUp(routes);  
195 - } else {  
196 - if (status > 0) {  
197 - // 显示上行规划  
198 - $('#upToolsMobal').show();  
199 - } else {  
200 - $('#upToolsMobal').hide();  
201 - }  
202 - // 隐藏上行树  
203 - $('#uptreeMobal').hide();  
204 - }  
205 - } else if (direction == 1) {  
206 - // 如果长度大于  
207 - if(len > 0) {  
208 - // 隐藏下行规划  
209 - $('#downToolsMobal').hide();  
210 - // 显示下行树  
211 - $('#DowntreeMobal').show();  
212 - // 跟新树  
213 - StationTreeData.reloadDown(routes);  
214 - } else {  
215 - if (status > 0) {  
216 - // 显示下行规划  
217 - $('#downToolsMobal').show();  
218 - } else {  
219 - $('#downToolsMobal').hide();  
220 - }  
221 - // 隐藏下行树  
222 - $('#DowntreeMobal').hide();  
223 - }  
224 - }  
225 -  
226 - PublicFunctions.linePanlThree(id, routes, direction, version, function (center) {  
227 - var map = WorldsBMap.getmapBValue();  
228 - map.panTo(center);  
229 - });  
230 - });  
231 - },  
232 -  
233 - /** 修正线路名称 @param:<directionUpValue:方向(0:上行;1:下行)> */  
234 - lineNameIsHaveInterval : function(direction) {  
235 - var lineName = $('.portlet-title .caption').text();  
236 - if (lineName.indexOf('区间') > 0 || lineName.indexOf('定班') > 0) {  
237 - lineName = lineName.replace('区间','').replace('定班', '');  
238 - layer.confirm('系统无法生成该线路【'+lineName+'】的站点与路段!自动修改为如下线路名称【' + lineName + '】生成', {  
239 - btn : [ '确认提示并提交', '取消' ]  
240 - }, function(index) {  
241 - layer.close(index);  
242 - PublicFunctions.systemLineStation(lineName,direction);  
243 - },function(){  
244 - layer.closeAll();  
245 - if(direction==0){  
246 - // 显示上行规划  
247 - $('#upToolsMobal').show();  
248 - }else if(direction==1){  
249 - // 显示下行规划  
250 - $('#downToolsMobal').show();  
251 - }  
252 - });  
253 - } else {  
254 - PublicFunctions.systemLineStation(lineName,direction);  
255 - }  
256 - },  
257 -  
258 - locations2LinestringWkt: function (locations) {  
259 - var wkt = new Array();  
260 - wkt.push('LINESTRING(')  
261 - for (var i = 0,len = locations.length;i < len;i++) {  
262 - wkt.push(locations[i].lng);  
263 - wkt.push(' ');  
264 - wkt.push(locations[i].lat);  
265 - if (i != len - 1) { wkt.push(','); }  
266 - }  
267 - wkt.push(')');  
268 -  
269 - return wkt.join('');  
270 - },  
271 -  
272 - systemLineStation: function(lineName, direction) {  
273 - WorldsBMap.getBmapStationNames(lineName, direction,function(busLine){  
274 - // 如果线路信息不为空  
275 - if(busLine && busLine.getNumBusStations()) {  
276 - var line = LineObj.getLineObj();  
277 - var sectionRoutes = new Array(), stations = new Array();  
278 - sectionRoutes.push({sectionrouteCode: 100, section: {sectionName: lineName, bsectionVectorWkt: PubFun.locations2LinestringWkt(busLine.getPath())}})  
279 - var stationNumber = busLine.getNumBusStations();  
280 - // 遍历  
281 - for(var i = 0 ; i < stationNumber; i++) {  
282 - var station = busLine.getBusStation(i), station1 = {stationName: station.name, centerPointWkt: 'POINT(' + station.position.lng + ' ' + station.position.lat + ')'};  
283 - stations.push(station1);  
284 - }  
285 - // 获取站点之间的距离与时间  
286 - WorldsBMap.getDistanceAndDuration(stations,function(stationRoutes) {  
287 - // 参数集合  
288 - var params = {lineId: line.id, directions: direction, versions: $('#versions').val(), stationRoutes: stationRoutes, sectionRoutes: sectionRoutes};  
289 - if (!params.versions) {  
290 - params.versions = '1';  
291 - }  
292 - GetAjaxData.collectionSave(params,function(rd) {  
293 - // 关闭弹出层  
294 - layer.closeAll();  
295 - if (rd.status == 'SUCCESS') {  
296 - layer.msg('保存成功!');  
297 - } else {  
298 - layer.msg('保存失败!');  
299 - }  
300 - // 刷新树  
301 - PublicFunctions.resjtreeDate(line.id, direction, params.versions);  
302 - });  
303 - });  
304 - /*// 关闭弹出层  
305 - layer.closeAll();  
306 - // 上行  
307 - if(direction==0){  
308 - $('#stationDown').removeClass('active');  
309 - $('#stationDown').removeClass('in');  
310 - $('#stationDown').addClass('fade');  
311 - $('#stationUp').addClass('active in');  
312 - $('#downLine').parent().removeClass('active');  
313 - $('#upLine').parent().addClass('active');  
314 - // 下行  
315 - }else if(direction==1){  
316 - $('#stationUp').removeClass('active');  
317 - $('#stationUp').removeClass('in');  
318 - $('#stationUp').addClass('fade');  
319 - $('#stationDown').addClass('active in');  
320 - $('#upLine').parent().removeClass('active');  
321 - $('#downLine').parent().addClass('active');  
322 - }*/  
323 - } else {  
324 - layer.msg('百度地图中没有此线路,无法系统规划!');  
325 - setTimeout(function() {  
326 - // 关闭弹出层  
327 - layer.closeAll();  
328 - // 上行  
329 - if(direction==0){  
330 - // 显示上行规划  
331 - $('#upToolsMobal').show();  
332 - // 下行  
333 - }else if(direction==1){  
334 - // 显示下行规划  
335 - $('#downToolsMobal').show();  
336 - }  
337 - }, 3000);  
338 - }  
339 - });  
340 - },  
341 -  
342 - /** @param directionV_ :方向 */  
343 - stationRevoke : function(directionV_) {  
344 - // 获取树选中节点对象  
345 - var obj = PublicFunctions.getCurrSelNode(directionV_);  
346 - // 是否选中,选中节点是否为站点  
347 - if(obj.length == 0 || obj[0].original.chaildredType !='station'){  
348 - // 弹出提示层  
349 - layer.msg('请先选择要删除的站点!');  
350 - return;  
351 - }  
352 - // 弹出是否撤销提示框  
353 - layer.confirm('你确定要撤销【'+obj[0].text+'】站点吗?', {btn : [ '确定撤销','返回' ],icon: 3, title:'提示' }, function(index){  
354 -  
355 - debugger;  
356 - // 站点路由ID  
357 - var stationRouteId = obj[0].original.stationRouteId;  
358 -  
359 - var Line = LineObj.getLineObj();  
360 -  
361 - clonsole.log(Line);  
362 -  
363 - // 撤销参数集合  
364 - var params = {stationRouteId:stationRouteId,destroy:'1',status:Line.status};  
365 - // 方向  
366 - var stationRouteDirections = obj[0].original.stationRouteDirections;  
367 - // 撤销  
368 - GetAjaxData.stationRouteIsDestroy(params,function(result) {  
369 - // 关闭弹出框  
370 - layer.close(index);  
371 - if(result.status=='SUCCESS'){  
372 - layer.msg('撤销'+(directionV_==0?"上行":"下行")+'站点【'+obj[0].text+'】成功!');  
373 - }else{  
374 - layer.msg('撤销'+(directionV_==0?"上行":"下行")+'站点【'+obj[0].text+'】失败!');  
375 - }  
376 - WorldsBMap.clearMarkAndOverlays();  
377 -  
378 - var ver = $("#versions").val();  
379 -  
380 - // 刷行左边树  
381 - PublicFunctions.resjtreeDate(Line.id,stationRouteDirections,ver);  
382 - /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */  
383 -// GetAjaxData.getSectionRouteInfo(Line.id,stationRouteDirections,ver,function(data) {  
384 -// /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */  
385 -// PublicFunctions.linePanlThree(Line.id,data,stationRouteDirections);  
386 -// });  
387 - });  
388 - });  
389 - },  
390 -  
391 - /** @param direction_ :方向 */  
392 - editLinePlan : function(direction_) {  
393 - var sel = PublicFunctions.getCurrSelNode(direction_);  
394 - if(sel.length==0 || sel[0].original.chaildredType !='section'){  
395 - if(direction_=='0') {  
396 - layer.msg('请先选中要编辑的上行路段!');  
397 - }else if(direction_=='1') {  
398 - layer.msg('请先选中要编辑的下行路段!');  
399 - }  
400 - return;  
401 - }  
402 - $('#downLine').addClass('btn disabled');  
403 - $('.btn-circle').addClass('disabled');  
404 - $('#upLine').addClass('btn disabled');  
405 - var editSectionV = sel[0].original;  
406 - EditSectionObj.setEitdSection(editSectionV);  
407 - // 弹出添加失败提示消息,2秒关闭(如果不配置,默认是3秒)  
408 - var yindex = layer.msg('编辑完线路走向后,请双击线路走向区域保存',{ offset: '126px',shift: 0,time: 10000});  
409 - WorldsBMap.editPolyUpline();  
410 - },  
411 -  
412 - setFormValue : function(editStationRoute) {  
413 - $('#edit_stationroute_form input,select,textarea').each(function () {  
414 - if (this.name) {  
415 - $(this).val(eval('editStationRoute.' + this.name));  
416 - if ('shapedType' === this.name) {  
417 - $(this).val(editStationRoute.shapedType == 'r' ? '圆形' : '多边形')  
418 - }  
419 - if ('radius' === this.name) {  
420 - $(this).val(editStationRoute.radius ? editStationRoute.radius : 80);  
421 - }  
422 - }  
423 - })  
424 - },  
425 -  
426 - setSectionFormValue : function(sectionRoute) {  
427 - $('#edit_sectionroute_form input').each(function() {  
428 - if (this.name) {  
429 - $(this).val(eval('sectionRoute.' + this.name));  
430 - }  
431 - });  
432 - },  
433 -  
434 - /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */  
435 - linePanlThree : function(lineId, routes, direction, version, callback) {  
436 - WorldsBMap.clearMarkAndOverlays();  
437 - var i = 0, center;  
438 - if (routes.stationRoutes.length > 0) {  
439 - var centerPointWkt = routes.stationRoutes[0].station.centerPointWkt;  
440 - centerPointWkt = centerPointWkt.substring(6, centerPointWkt.length - 1);  
441 - var coordinates = centerPointWkt.split(' ');  
442 - center = new BMap.Point(coordinates[0], coordinates[1]);  
443 - for (;i < routes.stationRoutes.length;i++) {  
444 - WorldsBMap.drawingUpStationPoint(routes.stationRoutes[i], i + 1);  
445 - }  
446 - }  
447 - if (routes.sectionRoutes.length > 0) {  
448 - WorldsBMap.drawingUpline01(routes.sectionRoutes);  
449 - }  
450 -  
451 - callback && center && callback(center);  
452 - },  
453 - /** 加载树 @param:<lineId:线路ID;direction:方向(0:上行;1:下行)> */  
454 - TreeUpOrDown : function(lineId,direction,version) {  
455 - /** 获取树结果数据 @param:<lineId:线路ID;direction:方向;callback:回调函数> */  
456 - GetAjaxData.getStation(lineId,direction,version,function(result) {  
457 - // 获取返回数据长度  
458 - var len = result.stationRoutes.length;  
459 - // 上行  
460 - if(direction == 0) {  
461 - /** 初始化上行树 @param:<treeDateJson:树数据结构> */  
462 - StationTreeData.upInit(result);  
463 - if(len>0) {  
464 - $('#upToolsMobal').hide();  
465 - $('#uptreeMobal').show();  
466 - }else {  
467 - $('#upToolsMobal').show();  
468 - $('#uptreeMobal').hide();  
469 - }  
470 -  
471 - PublicFunctions.linePanlThree(lineId, result, direction, version, function (center) {  
472 - var map = WorldsBMap.getmapBValue();  
473 - map.panTo(center);  
474 - });  
475 -  
476 - // 下行  
477 - }else if(direction ==1) {  
478 - /** 出事画下行树 @param:<treeDateJson:树数据结构> */  
479 - StationTreeData.downInit(result);  
480 - if(len>0) {  
481 - $('#downToolsMobal').hide();  
482 - $('#DowntreeMobal').show();  
483 - }else {  
484 - $('#downToolsMobal').show();  
485 - $('#DowntreeMobal').hide();  
486 - }  
487 - }  
488 - });  
489 - },  
490 - isHaveStationName : function(data) {  
491 - if(data.length>0) {  
492 - layer.confirm('系统已存在【'+ data[0].stationName +'】该站点位置名称,请选择【系统引用】或者更改站点名称进行新增!', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){  
493 - layer.close(index);  
494 - });  
495 - return false;  
496 - }else {  
497 - return true;  
498 - }  
499 - },  
500 - // 地图处于编辑状态  
501 - editMapStatus : function (dir) {  
502 - WorldsBMap.setMap_status(1);  
503 - // 有方向就显示退出编辑模式按钮  
504 - if (dir != null && dir != 'null') {  
505 - WorldsBMap.setDir(dir);  
506 - $('#esc_edit_div').show();  
507 - }  
508 - $('.protlet-box-layer').show();  
509 - },  
510 - // 地图处于编辑状态  
511 - editMapStatusRemove : function () {  
512 - WorldsBMap.setMap_status(0);  
513 - $('.protlet-box-layer').hide();  
514 - $('#esc_edit_div').hide();  
515 - // 退出绘画模式  
516 - WorldsBMap.exitDrawStatus();  
517 - },  
518 - // 选项鎖死解除  
519 - editAChangeCssRemoveDisabled : function() {  
520 - $('#downLine').removeClass('btn disabled');  
521 - $('.btn-circle').removeClass('disabled');  
522 - $('#upLine').removeClass('btn disabled');  
523 - },  
524 - // 方向代码转名称.  
525 - dirdmToName : function(value){  
526 - var srStr = '';  
527 - if(value=='0')  
528 - srStr = '上行';  
529 - else if(value=='1')  
530 - srStr = '下行';  
531 - return srStr;  
532 - },  
533 - }  
534 - return PubFun ;  
535 -}();  
536 \ No newline at end of file 0 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/js/stationroute-list-map.js deleted 100644 → 0
1 -/**  
2 - * 百度地图  
3 - *  
4 - * - - - - - -》init:地图初始化  
5 - *  
6 - * - - - - - -》lineInfoPanl:从百度地图抓去站点与路段数据  
7 - *  
8 - * - - - - - -》getDistanceAndDuration:获取距离与时间  
9 - *  
10 - * - - - - - -》pointsPolygon:地图画多边行  
11 - *  
12 - * - - - - - -》pointsCircle:画圆  
13 - *  
14 - * - - - - - -》localSearchFromAdreesToPoint:根据地理名称获取百度经纬度坐标  
15 - *  
16 - * - - - - - -》drawingUpline:在地图上画出上行线路走向  
17 - *  
18 - * - - - - - -》stationsNameToPoints:站点名称获取百度坐标(手动规划)  
19 - *  
20 - * - - - - - -》getDistanceAndTotime:根据坐标点获取两点之间的时间与距离(手动规划)  
21 - *  
22 - * - - - - - -》getSectionListPlonly:根据坐标点获取两点之间的折线路段(手动规划)  
23 - */  
24 -  
25 -window.WorldsBMap = function () {  
26 -  
27 - /** WorldsBMap 全局变量定义 mapBValue:地图对象; road_win_show_p:信息窗口打开状态的路段,  
28 - * sectionArray: 路段集合,stationArray: 站点集合  
29 - * map_status:地图编辑状态,drawingManager:绘画工具, topOverlay:置顶视图*/  
30 - var mapBValue = '', iseditStatus = false, road_win_show_p = '', editPolyline = '', matchStation = '',dir = 0, versions, lineId,  
31 - sectionArray = [], stationArray = new Map(),  
32 - map_status = 0,drawingManager,topOverlay;  
33 -  
34 - var currentSection = {};  
35 -  
36 - var setTimeoutId;  
37 -  
38 - var overlays = new Array();  
39 -  
40 - /**  
41 - * 编辑缓冲区  
42 - * stationMarkers: 站点图标集合  
43 - */  
44 - var editCircle, editPolygon, dragMarker, stationMarkers = new Map(),centerPoint;  
45 -  
46 - var styleOptions = {  
47 - strokeColor:"blue", //边线颜色。  
48 - fillColor:"blue", //填充颜色。当参数为空时,圆形将没有填充效果。  
49 - strokeWeight: 6, //边线的宽度,以像素为单位。  
50 - strokeOpacity: 0.7, //边线透明度,取值范围0 - 1。  
51 - fillOpacity: 0.6, //填充的透明度,取值范围0 - 1。  
52 - strokeStyle: 'solid' //边线的样式,solid或dashed。  
53 - };  
54 -  
55 - // 覆盖物置顶  
56 - var setTop = function(overlay) {  
57 - if (topOverlay)  
58 - topOverlay.setTop(false);  
59 - overlay.setTop(true);  
60 - topOverlay = overlay;  
61 - };  
62 -  
63 - var setDragMarker = function (marker) {  
64 - marker.enableDragging();  
65 - dragMarker = marker;  
66 - dragMarker._old_point = dragMarker._position;  
67 - centerPoint = dragMarker._position;  
68 - //监听拖拽事件 dragging  
69 - dragMarker.addEventListener('dragging', dragMarkerDragEvent);  
70 - };  
71 -  
72 - var dragMarkerDragEvent = function (e) {  
73 - if (editPolygon) {  
74 - // 中心点是否超出多边形  
75 - // if (!BMapLib.GeoUtils.isPointInPolygon(e.target._position, editPolygon)) {  
76 - // dragMarker.setPosition(dragMarker._old_point);//还原位置  
77 - // }  
78 - centerPoint = e.target._position;  
79 - }  
80 - else if (editCircle) {  
81 - editCircle.disableEditing();  
82 - //缓冲区跟随点位运动  
83 - editCircle.setCenter(e.target._position);  
84 - editCircle.enableEditing();  
85 - centerPoint = e.target._position;  
86 - }  
87 - };  
88 -  
89 - var Bmap = {  
90 -  
91 - init: function () {  
92 - // 设置中心点,  
93 - var CENTER_POINT = {lng: 121.528733, lat: 31.237425};  
94 - // 百度API Key  
95 - var bdKey = 'IGGrr4UjwIYzatoCRFKEL8sT';  
96 - // 初始化百度地图  
97 - mapBValue = new BMap.Map("routes_list_map_container" , {enableMapClick: false});  
98 - //中心点和缩放级别  
99 - mapBValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng, CENTER_POINT.lat), 14);  
100 - //启用地图拖拽事件,默认启用(可不写)  
101 - mapBValue.enableDragging();  
102 - //启用地图滚轮放大缩小  
103 - mapBValue.enableScrollWheelZoom();  
104 - //禁用鼠标双击放大  
105 - mapBValue.disableDoubleClickZoom();  
106 - //启用键盘上下左右键移动地图  
107 - mapBValue.enableKeyboard();  
108 - return mapBValue;  
109 - },  
110 -  
111 - /** 获取地图对象 @return 地图对象map */  
112 - getmapBValue: function () {  
113 - return mapBValue;  
114 - },  
115 - getDir:function(){  
116 - return dir;  
117 - },  
118 - setDir:function (val) {  
119 - dir = val;  
120 - },  
121 - setVersions: function (val) {  
122 - versions = val;  
123 - },  
124 - setLineId: function (val) {  
125 - lineId = val;  
126 - },  
127 - setStatus: function(_lineId, _versions, _dir) {  
128 - lineId = _lineId;  
129 - versions = _versions;  
130 - dir = _dir;  
131 - },  
132 - setMap_status : function (i) {  
133 - map_status = i;  
134 - },  
135 - getIsEditStatus: function () {  
136 - return iseditStatus;  
137 - },  
138 - setIsEditStatus: function (v) {  
139 - iseditStatus = v;  
140 - },  
141 - getStationArray: function () {  
142 - return stationArray;  
143 - },  
144 - setStationArray : function (s) {  
145 - stationArray = s;  
146 - },  
147 - /*initDrawingManager: function (map, styleOptions) {  
148 - },*/  
149 - getDrawingManagerObj: function () {  
150 - return drawingManagerInitV;  
151 - },  
152 -  
153 - // 打开站点路由信息窗口  
154 - openStationRouteInfoWin : function (stationRoute) {  
155 - // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增)  
156 - if (stationRoute) {  
157 - // 站点形状  
158 - var shapes = stationRoute.stationShapesType;  
159 - // 获取中心坐标点字符串分割  
160 - var centerPointWkt = stationRoute.station.centerPointWkt;  
161 - centerPointWkt = centerPointWkt.substring(6, centerPointWkt.length - 1);  
162 - var coordinates = centerPointWkt.split(' ');  
163 - // 中心坐标点  
164 - var point = new BMap.Point(coordinates[0], coordinates[1]);  
165 - var width = WorldsBMap.strGetLength(stationRoute.stationName) * 11;  
166 - // 信息窗口参数属性  
167 - var opts = {  
168 - // 信息窗口宽度  
169 - width: (width < 240 ? 240 : width),  
170 - // 信息窗口高度  
171 - // height: shapes=="r" ?380:350,  
172 - // 信息窗位置偏移值。  
173 - offset: new BMap.Size(10,-20),  
174 - //设置不允许信窗发送短息  
175 - enableMessage: false,  
176 - //是否开启点击地图关闭信息窗口  
177 - enableCloseOnClick: false,  
178 - // 是否开启信息窗口打开时地图自动移动(默认开启)。(自 1.1 新增)  
179 - enableAutoPan: false  
180 - };  
181 -  
182 - var stationMark = '';  
183 - if (stationRoute.stationMark == 'B') {  
184 - stationMark = '起点站';  
185 - } else if (stationRoute.stationMark == 'Z') {  
186 - stationMark = '中途站';  
187 - } else if (stationRoute.stationMark == 'E') {  
188 - stationMark = '终点站';  
189 - }  
190 - 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>' +  
191 - '<span class="help-block" >站点编码:' + stationRoute.stationCode + '</span>' +  
192 - '<span class="help-block" >行业编号:' + (stationRoute.industryCode == null ? "":stationRoute.industryCode)+ '</span>' +  
193 - '<span class="help-block" >站点序号:' + stationRoute.stationRouteCode + '</span>' +  
194 - '<span class="help-block" >站点类型:' + stationMark + '</span>' +  
195 - '<span class="help-block" >经度:&nbsp&nbsp' + coordinates[0] + '</span>' +  
196 - '<span class="help-block" >纬度:&nbsp&nbsp' + coordinates[1] + '</span>' +  
197 - '<span class="help-block" >到站时间:' + stationRoute.toTime + '&nbsp;分钟</span>' +  
198 - '<span class="help-block" >到站距离:' + stationRoute.distances + '&nbsp;公里</span>' +  
199 - '<span class="help-block" >缓冲区形状:' + (shapes == 'r' ? '圆形' : '多边形') + '</span>' +  
200 - (shapes=="r" ? ("<span class='help-block' >半径&nbsp&nbsp:" + stationRoute.radius + "</span>") : " ")+  
201 - '<span class="help-block" >版本号&nbsp&nbsp:' + stationRoute.versions + '</span>';  
202 -  
203 - if($($("#versions").find("option:selected")[0]).attr("status") > 0){  
204 - htm += '<div>' +  
205 - '<button class="info_win_btn" id="editStation" onclick="WorldsBMap.editStation(' + stationRoute.id+','+stationRoute.directions + ')">修改</button>' +  
206 - '<button class="info_win_btn" onclick="WorldsBMap.destroyStation('+ stationRoute.id + ','+stationRoute.line.id+','+stationRoute.directions+')">撤销</button>' +  
207 - '<button class="info_win_btn" id="addBetweenStationRoad" onclick="WorldsBMap.addBetweenStationRoad(' + stationRoute.id + ')">添加站点间路段</button>' +  
208 - '</div>';  
209 - }  
210 - // 创建信息窗口  
211 - var infoWindow_target = new BMap.InfoWindow(htm, opts);  
212 - setTimeout(function () {  
213 - //开启信息窗口  
214 - mapBValue.openInfoWindow(infoWindow_target, point);  
215 - }, 100);  
216 - // 将地图的中心点更改为给定的点。  
217 - mapBValue.panTo(point);  
218 - }  
219 - },  
220 -  
221 - /**  
222 - * 打开站点信息窗口  
223 - * @param station  
224 - */  
225 - openStationInfoWin: function(station) {  
226 - if (station) {  
227 - var centerPointWkt = station.centerPointWkt;  
228 - centerPointWkt = centerPointWkt.substring(6, centerPointWkt.length - 1);  
229 - var coordinates = centerPointWkt.split(' ');  
230 - var centerPoint = new BMap.Point(coordinates[0], coordinates[1]);  
231 - var width = WorldsBMap.strGetLength(station.stationName) * 11;  
232 - // 信息窗口参数属性  
233 - var opts = {  
234 - // 信息窗口宽度  
235 - width: (width < 240 ? 240 : width),  
236 - // 信息窗口高度  
237 - // height: shapes=="r" ?380:350,  
238 - // 信息窗位置偏移值。  
239 - offset: new BMap.Size(10,-20),  
240 - //设置不允许信窗发送短息  
241 - enableMessage: false,  
242 - //是否开启点击地图关闭信息窗口  
243 - enableCloseOnClick: false,  
244 - // 是否开启信息窗口打开时地图自动移动(默认开启)。(自 1.1 新增)  
245 - enableAutoPan: false  
246 - };  
247 -  
248 - var html = new Array();  
249 - 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>');  
250 - html.push('<span class="help-block" >站点编号:' + (station.stationCode ? station.stationCode : '')+ '</span>');  
251 - html.push('<span class="help-block" >途经线路:' + (station.passLines ? station.passLines : '') + '</span>');  
252 -  
253 - // 创建信息窗口  
254 - var infoWindow = new BMap.InfoWindow(html.join(''), opts);  
255 - setTimeout(function () {  
256 - //开启信息窗口  
257 - mapBValue.openInfoWindow(infoWindow, centerPoint);  
258 - }, 100);  
259 - mapBValue.panTo(centerPoint);  
260 - }  
261 - },  
262 -  
263 - // 根据地理名称获取百度经纬度坐标  
264 - localSearchFromAdreesToPoint: function (Address, callback) {  
265 - // 创建一个搜索类实例  
266 - var localSearch = new BMap.LocalSearch(mapBValue);  
267 - // 检索完成后的回调函数。  
268 - localSearch.setSearchCompleteCallback(function (searchResult) {  
269 - var resultPoints = '';  
270 - if (searchResult) {  
271 - // 返回索引指定的结果。索引0表示第1条结果  
272 - var poi = searchResult.getPoi(0);  
273 - if (poi) {  
274 - //获取经度和纬度  
275 - resultPoints = poi.point.lng + ' ' + poi.point.lat;  
276 - callback && callback(resultPoints);  
277 - } else {  
278 - callback && callback(false);  
279 - }  
280 - } else {  
281 - callback && callback(false);  
282 - }  
283 - });  
284 - // 根据检索词发起检索。  
285 - localSearch.search(Address);  
286 - },  
287 -  
288 - // 站点编辑  
289 - editShapes: function (obj) {  
290 - // 关闭信息窗口  
291 - mapBValue.closeInfoWindow();  
292 - var stationRoute = obj.getEditStation();  
293 - var shapedType = stationRoute.shapedType;  
294 - setDragMarker(stationMarkers[stationRoute.id]);  
295 -  
296 - // 获取中心坐标点字符串分割  
297 - var centerPointWkt = stationRoute.station.centerPointWkt;  
298 - centerPointWkt = centerPointWkt.substring(6, centerPointWkt.length - 1);  
299 - var coordinates = centerPointWkt.split(' ');  
300 - // 中心坐标点  
301 - var center = new BMap.Point(coordinates[0], coordinates[1]);  
302 -  
303 - // 编辑圆  
304 - if (shapedType == 'r') {  
305 - //创建圆  
306 - var circle = new BMap.Circle(center, stationRoute.radius, {  
307 - strokeColor: "blue",  
308 - strokeWeight: 2,  
309 - strokeOpacity: 0.7  
310 - });  
311 - mapBValue.centerAndZoom(center, 18);  
312 - editCircle = circle;  
313 - // 允许覆盖物在map.clearOverlays方法中被清除  
314 - // circle.enableMassClear();  
315 - // 百度地图添加覆盖物圆  
316 - mapBValue.addOverlay(circle);  
317 - // 开启编辑功能  
318 - circle.enableEditing();  
319 - // 编辑圆监听事件  
320 - circle.addEventListener('dblclick', function () {  
321 - // 返回圆形的半径,单位为米。  
322 - var newRadius = circle.getRadius();  
323 - // 返回圆形的中心点坐标。  
324 - var newCenter = circle.getCenter().lng + ' ' + circle.getCenter().lat;  
325 - // var centre_points = [{potion: {lng: circle.getCenter().lng, lat: circle.getCenter().lat}}];  
326 - /** 设置修改站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */  
327 - EditStationObj.setEditStationJwpoints(newCenter);  
328 - /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */  
329 - EditStationObj.setEditStationShapesType('r');  
330 - /** 设置修改站点集合对象圆形半径属性值 @param:<radius:圆形半径) */  
331 - EditStationObj.setEditStationRadius(Math.round(newRadius));  
332 - /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */  
333 - EditStationObj.setEitdBPolygonGrid('');  
334 - // 清除正在编辑的站点  
335 - editCircle = null;  
336 - // 加载编辑页面  
337 - $.get('edit_stationroute_step2.html', function (m) {  
338 - $(pjaxContainer).append(m);  
339 - $('#edit_stationroute_step2_modal').trigger('modal.show', [WorldsBMap, GetAjaxData, EditStationObj, LineObj, PublicFunctions]);  
340 - });  
341 - });  
342 - // 编辑多边行  
343 - } else if (shapedType == 'd') {  
344 - // 获取多边形坐标字符串  
345 - var bufferPolygonWkt = stationRoute.bufferPolygonWkt;  
346 - bufferPolygonWkt = bufferPolygonWkt.substring(9, bufferPolygonWkt.length - 2);  
347 - var points = bufferPolygonWkt.split(',');  
348 - var polygonPoints = new Array();  
349 - for (var i = 0; i < points.length; i++) {  
350 - var coordinates = points[i].split(' ');  
351 - polygonPoints.push(new BMap.Point(coordinates[0], coordinates[1]));  
352 - }  
353 - // 画多边形  
354 - var polygon = new BMap.Polygon(polygonPoints, {  
355 - // 线条显色  
356 - strokeColor: "blue",  
357 - // 边线的宽度,以像素为单位。  
358 - strokeWeight: 2,  
359 - // 边线透明度,取值范围0 - 1。  
360 - strokeOpacity: 0.7  
361 - });  
362 - mapBValue.centerAndZoom(center, 18);  
363 - // 增加地图覆盖物多边形  
364 - mapBValue.addOverlay(polygon);  
365 - // 开启编辑功能(自 1.1 新增)  
366 - polygon.enableEditing();  
367 - //禁止覆盖物在map.clearOverlays方法中被清除  
368 - // polygon.disableMassClear();  
369 - // 添加多边形编辑事件  
370 - polygon.addEventListener('dblclick', function (e) {  
371 - var bufferPolygonWkt = new Array(), points = polygon.getPath();  
372 - for(var i = 0;i < points.length;i++) {  
373 - bufferPolygonWkt.push(points[i].lng + ' ' + points[i].lat)  
374 - }  
375 - bufferPolygonWkt.push(points[0].lng + ' ' + points[0].lat)  
376 - // 多边形中心点  
377 - /** 设置修改站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) centerPoint可拖动点 */  
378 - EditStationObj.setEditStationJwpoints(center.lng + ' ' + center.lat);  
379 - /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */  
380 - EditStationObj.setEditStationShapesType('d');  
381 - /** 设置修改站点集合对象圆形半径属性值 @param:<radius:圆形半径) */  
382 - EditStationObj.setEditStationRadius('');  
383 - /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */  
384 - EditStationObj.setEitdBPolygonGrid(bufferPolygonWkt.join(','));  
385 - $.get('edit_stationroute_step2.html', function (m) {  
386 - $(pjaxContainer).append(m);  
387 - $('#edit_stationroute_step2_modal').trigger('modal.show', [WorldsBMap, GetAjaxData, EditStationObj, LineObj, PublicFunctions]);  
388 - });  
389 - });  
390 - }  
391 - },  
392 -  
393 - // 画路段走向  
394 - drawingUpline01: function (sectionRoutes) {  
395 - if (sectionRoutes) {  
396 - // 编辑路段数据  
397 - sectionArray = [];  
398 - for (var d = 0; d < sectionRoutes.length; d++) {  
399 - var data = sectionRoutes[d];  
400 - // 地图折线坐标点集合  
401 - var polylineArray = [];  
402 - // 获取路段折线坐标字符串  
403 - var sectionBsectionVectorStr = data.section.bsectionVectorWkt;  
404 - if (sectionBsectionVectorStr == null)  
405 - continue;  
406 - // 切割段折线坐标字符串  
407 - var tempStr = sectionBsectionVectorStr.substring(11, sectionBsectionVectorStr.length - 1);  
408 - // 分割折线坐标字符串  
409 - var lineArray = tempStr.split(',');  
410 - for (var i = 0; i < lineArray.length; i++) {  
411 - polylineArray.push(new BMap.Point(lineArray[i].split(' ')[0], lineArray[i].split(' ')[1]));  
412 - }  
413 - var polyUpline01 = 'polyline' + '_' + data.id;  
414 - // 创建线路走向  
415 - polyUpline01 = new BMap.Polyline(polylineArray, {  
416 - strokeColor: "red",  
417 - strokeWeight: 6,  
418 - strokeOpacity: 0.7  
419 - });  
420 - polyUpline01.data = data;  
421 - polyUpline01.ct_source = '1';  
422 - // 把折线添加到地图上  
423 - mapBValue.addOverlay(polyUpline01);  
424 - // 聚焦事件  
425 - polyUpline01.addEventListener('mousemove', function (e) {  
426 - if (this != editPolyline)  
427 - this.setStrokeColor("#20bd26");  
428 - });  
429 - // 失去焦点  
430 - polyUpline01.addEventListener('mouseout', function (e) {  
431 - if (this != editPolyline && this != road_win_show_p)  
432 - this.setStrokeColor("red");  
433 - });  
434 - // 添加单击事件  
435 - polyUpline01.addEventListener('onclick', function (e) {  
436 - // 打开信息窗口  
437 - if (map_status != 1)  
438 - WorldsBMap.openSectionInfoWin(this);  
439 - });  
440 - sectionArray.push(polyUpline01);  
441 - }  
442 - // mapBValue.setCenter(polyline_center);  
443 - // mapBValue.panTo(polyline_center);  
444 - // mapBValue.setZoom(14);  
445 - // 禁止覆盖物在map.clearOverlays方法中被清除。(自 1.1 新增)  
446 - // polyUpline01.disableMassClear();  
447 - }  
448 - },  
449 -  
450 - /** 在地图上画点 @param:<point_center:中心坐标点> */  
451 - drawingUpStationPoint: function (stationRoute, seq, isView) {  
452 - // 中心点坐标字符串  
453 - var centerPointWkt = stationRoute.station.centerPointWkt;  
454 - centerPointWkt = centerPointWkt.substring(6, centerPointWkt.length - 1);  
455 - var coordinates = centerPointWkt.split(' ');  
456 - var stationName = stationRoute.stationName;  
457 - // 设置中心点  
458 - var center = new BMap.Point(coordinates[0], coordinates[1]);  
459 - var html2 = '<div style="position: absolute; margin: 0pt; padding: 0pt; width: 160px; height: 26px; left: -10px; top: -35px; overflow: hidden;">'  
460 - + '<img class="rm3_image" style="border:none;left:0px; top:0px; position:absolute;" src="/pages/base/stationroute/css/img/back160.png">'  
461 - + '</div>'  
462 - + '<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>';  
463 -  
464 - var myRichMarker1 = new BMapLib.RichMarker(html2, center, {  
465 - "title": stationName,  
466 - "anchor": new BMap.Size(-10, 8),  
467 - "enableDragging": true  
468 - });  
469 - myRichMarker1.disableDragging();  
470 - myRichMarker1.ct_source = '1';  
471 - mapBValue.addOverlay(myRichMarker1);  
472 - myRichMarker1.addEventListener('click', function () {  
473 - if(map_status != 1 && !isView)  
474 - WorldsBMap.openStationRouteInfoWin(stationRoute);  
475 - });  
476 - stationArray[stationRoute.id] = stationRoute;  
477 - stationMarkers[stationRoute.id] = myRichMarker1;  
478 - },  
479 -  
480 - // 站点名称获取百度坐标(手动规划)  
481 - stationsNameToPoints: function (arra, callback) {  
482 - // 获取长度  
483 - var len = arra.length;  
484 - var stationList = [];  
485 - (function () {  
486 - if (!arguments.callee.count) {  
487 - arguments.callee.count = 0;  
488 - }  
489 - arguments.callee.count++;  
490 - var index = parseInt(arguments.callee.count) - 1;  
491 - if (index >= len) {  
492 - callback && callback(stationList);  
493 - return;  
494 - }  
495 - var f = arguments.callee;  
496 - if (arra[index].name != '') {  
497 - var localSearch = new BMap.LocalSearch(mapBValue);  
498 - localSearch.search(arra[index].name);  
499 - localSearch.setSearchCompleteCallback(function (searchResult) {  
500 - var poi = searchResult.getPoi(0);  
501 - if (poi) {  
502 - stationList.push({  
503 - name: arra[index].name.replace('公交车站', ''),  
504 - wgs: arra[index].wgs,  
505 - potion: {lng: poi.point.lng, lat: poi.point.lat}  
506 - });  
507 - } else {  
508 - stationList.push({  
509 - name: arra[index].name.replace('公交车站', ''),  
510 - wgs: arra[index].wgs,  
511 - potion: {lng: arra[index].wgs.x, lat: arra[index].wgs.y}  
512 - });  
513 - }  
514 - f();  
515 - });  
516 - } else {  
517 - f();  
518 - }  
519 - })();  
520 - },  
521 -  
522 - // 根据坐标点获取两点之间的时间与距离(手动规划)  
523 - getDistanceAndTotime: function (stationList, cb) {  
524 - stationList[0].distance = '';  
525 - stationList[0].duration = '';  
526 - // var sectionList = [];  
527 - // 获取长度  
528 - var len = stationList.length;  
529 - (function () {  
530 - if (!arguments.callee.count) {  
531 - arguments.callee.count = 0;  
532 - }  
533 - arguments.callee.count++;  
534 - var index = parseInt(arguments.callee.count) - 1;  
535 - if (index >= len - 1) {  
536 - // cb && cb(stationList,sectionList);  
537 - cb && cb(stationList);  
538 - return;  
539 - }  
540 - var f = arguments.callee;  
541 - var poiOne = new BMap.Point(stationList[index].potion.lng, stationList[index].potion.lat);  
542 - var poiTwo = new BMap.Point(stationList[index + 1].potion.lng, stationList[index + 1].potion.lat);  
543 - var transit = new BMap.TransitRoute(mapBValue, {  
544 - renderOptions: {map: mapBValue},  
545 - onSearchComplete: searchComplete  
546 - });  
547 -  
548 - transit.search(poiOne, poiTwo);  
549 - function searchComplete(results) {  
550 - var plan = results.getPlan(0);  
551 - if (transit.getStatus() != BMAP_STATUS_SUCCESS) {  
552 - stationList[index + 1].distance = '';  
553 - stationList[index + 1].duration = '';  
554 - // sectionList.push({sectionName:stationList[index].name+stationList[index+1].name,points:''});  
555 - } else {  
556 - stationList[index + 1].distance = plan.getDistance(true);  
557 - stationList[index + 1].duration = plan.getDuration(true);  
558 - // var line = plan.getRoute(0);  
559 - // sectionList.push({sectionName:stationList[index].name+stationList[index+1].name,points:line.getPath()});  
560 - }  
561 - f();  
562 - }  
563 - })();  
564 - },  
565 -  
566 - // 根据坐标点获取两点之间的折线路段(手动规划)  
567 - getSectionListPlonly: function (stationsPoint, cb) {  
568 - var len = stationsPoint.length;  
569 - var sectionList = [];  
570 - (function () {  
571 - if (!arguments.callee.count) {  
572 - arguments.callee.count = 0;  
573 - }  
574 - arguments.callee.count++;  
575 - var index = parseInt(arguments.callee.count) - 1;  
576 - if (index >= len - 1) {  
577 - cb && cb(sectionList);  
578 - return;  
579 - }  
580 - var f = arguments.callee;  
581 - var poiOne = new BMap.Point(stationsPoint[index].potion.lng, stationsPoint[index].potion.lat);  
582 - var poiTwo = new BMap.Point(stationsPoint[index + 1].potion.lng, stationsPoint[index + 1].potion.lat);  
583 - /* var transit = new BMap.TransitRoute(mapB, {renderOptions: {map: mapB},onPolylinesSet: searchPolylinesSet});*/  
584 - var transit = new BMap.DrivingRoute(mapBValue, {  
585 - renderOptions: {map: mapBValue},  
586 - onPolylinesSet: searchPolylinesSet  
587 - });  
588 - function searchPolylinesSet(results) {  
589 - if (transit.getStatus() != BMAP_STATUS_SUCCESS) {  
590 - } else {  
591 - var sectionArrayList = [];  
592 - for (i = 0; i < results.length; i++) {  
593 - // console.log(results[i].getPolyline().getPath());  
594 - sectionArrayList = sectionArrayList.concat(results[i].getPolyline().getPath());  
595 - }  
596 - var sectionName = stationsPoint[index].name + '至' + stationsPoint[index + 1].name;  
597 - sectionList.push({sectionName: sectionName, points: sectionArrayList});  
598 - }  
599 - f();  
600 - }  
601 - transit.search(poiOne, poiTwo);  
602 - })();  
603 - },  
604 -  
605 - localtionPoint: function (stationName, cb) {  
606 - // 关闭信息窗口  
607 - mapBValue.closeInfoWindow();  
608 - GetAjaxData.findStationByName(stationName, function (stations) {  
609 - var marker;  
610 - if (stations.length > 0) {  
611 - var points = new Array();  
612 - for (var i = 0;i < stations.length;i++) {  
613 - var station = stations[i];  
614 - var centerPointWkt = station.centerPointWkt;  
615 - centerPointWkt = centerPointWkt.substring(6, centerPointWkt.length - 1);  
616 - var stationName = station.stationName;  
617 - var coordinates = centerPointWkt.split(' ');  
618 - var centerPoint = new BMap.Point(coordinates[0], coordinates[1]);  
619 - points.push(centerPoint);  
620 - var stationMarker = new BMap.Marker(centerPoint, {  
621 - title: stationName,  
622 - icon: new BMap.Icon('/pages/base/stationroute/css/img/back160.png', new BMap.Size(160, 26)),  
623 - offset: new BMap.Size(60, -16),  
624 - enableDragging: false  
625 - });  
626 - var label = new BMap.Label(stationName, {offset: new BMap.Size(25, 0)});  
627 - label.setStyle({border: '0px'});  
628 - stationMarker.setLabel(label);  
629 - stationMarker.ct_source = '1';  
630 - stationMarker.station = station;  
631 - mapBValue.addOverlay(stationMarker);  
632 - overlays.push(stationMarker);  
633 - stationMarker.addEventListener('click', function (event) {  
634 - event.domEvent.stopPropagation();  
635 - if (setTimeoutId) {  
636 - clearTimeout(setTimeoutId);  
637 - }  
638 - setTimeoutId = setTimeout(function(){  
639 - WorldsBMap.openStationInfoWin(event.target.station);  
640 - }, 200);  
641 - });  
642 - stationMarker.addEventListener('rightclick', Bmap.confirmCenterPointHandler);  
643 - }  
644 - var center = new BMap.Polyline(points).getBounds().getCenter();  
645 - mapBValue.panTo(center);  
646 - }  
647 -  
648 - mapBValue.removeEventListener('click', Bmap.pickCenterPointHandler);  
649 - mapBValue.addEventListener('click', Bmap.pickCenterPointHandler);  
650 - cb && cb(marker);  
651 - });  
652 - },  
653 -  
654 - localtionRoad: function (sectionName, callback) {  
655 - // 关闭信息窗口  
656 - mapBValue.closeInfoWindow();  
657 - GetAjaxData.findSectionByName(sectionName, function (sections) {  
658 - var marker;  
659 - if (sections.length > 0) {  
660 - var points = new Array();  
661 - for (var i = 0;i < sections.length;i++) {  
662 - var section = sections[i];  
663 - var bsectionVectorWkt = section.bsectionVectorWkt;  
664 - bsectionVectorWkt = bsectionVectorWkt.substring(11, bsectionVectorWkt.length - 1);  
665 - var sectionName = section.sectionName;  
666 - var polyline = WorldsBMap.wkt2Polyline(bsectionVectorWkt);  
667 - polyline.section = section;  
668 - mapBValue.addOverlay(polyline);  
669 - overlays.push(polyline);  
670 - polyline.addEventListener('click', function (event) {  
671 - alert(event.target.section.id)  
672 - });  
673 - polyline.addEventListener('rightclick', Bmap.confirmCenterPointHandler);  
674 - }  
675 - var center = polyline.getBounds().getCenter();  
676 - mapBValue.panTo(center);  
677 - }  
678 - });  
679 - },  
680 -  
681 - wkt2Polyline: function (wkt) {  
682 - var points = new Array(), pointWkts = wkt.split(',');  
683 - for (var i = 0;i < pointWkts.length;i++) {  
684 - var coordinates = pointWkts[i].split(' ');  
685 - points.push(new BMap.Point(coordinates[0], coordinates[1]));  
686 - }  
687 -  
688 - return new BMap.Polyline(points)  
689 - },  
690 -  
691 - pickCenterPointHandler: function(e) {  
692 - mapBValue.removeEventListener('click', Bmap.pickCenterPointHandler);  
693 - var marker = new BMap.Marker(e.point, {enableDragging: true});  
694 - overlays.push(marker);  
695 - mapBValue.panTo(e.point);  
696 - mapBValue.addOverlay(marker);  
697 - marker.addEventListener('rightclick', Bmap.confirmCenterPointHandler);  
698 - marker.setAnimation(BMAP_ANIMATION_BOUNCE);  
699 - },  
700 -  
701 - /** 系统规划抓去数据 @param lineNameValue:线路名称;i:方向*/  
702 - getBmapStationNames: function (lineName, i, cb) {  
703 - var busline = new BMap.BusLineSearch(mapBValue, {  
704 - onGetBusListComplete: function (busListResult) {  
705 - if (busListResult) {  
706 - var first = busListResult.getBusListItem(i);  
707 - busline.getBusLine(first);  
708 - }  
709 - },  
710 - onGetBusLineComplete: function (busLine) {  
711 - if (busLine) {  
712 - cb && cb(busLine);  
713 - }  
714 - }  
715 - });  
716 - busline.getBusList(lineName);  
717 - },  
718 - // 修改站点  
719 - editStation: function (stationRouteId) {  
720 - $.get('edit_stationroute_step1.html', function (m) {  
721 - $(pjaxContainer).append(m);  
722 - $('#edit_stationroute_step1_modal').trigger('modal.show', [WorldsBMap, DrawingManagerObj, GetAjaxData, EditStationObj, LineObj, PublicFunctions, stationArray[stationRouteId]]);  
723 - });  
724 - },  
725 - addBetweenStationRoad: function (stationRouteId) {  
726 - var version = $("#versions").val();  
727 - // 关闭信息窗口  
728 - mapBValue.closeInfoWindow();  
729 - // 查询下一个站点  
730 - $.get("/api/lsstationroute/findCurrentAndNext", {id: stationRouteId}, function(stationRoutes) {  
731 - if (stationRoutes.length < 2) {  
732 - layer.msg("您选择的站点后没有站点了,不能生成站点间路段!");  
733 - } else {  
734 - var startStationRoute = stationRoutes[0], endStationRoute = stationRoutes[1];  
735 - var startWkt = startStationRoute.station.centerPointWkt, endWkt = endStationRoute.station.centerPointWkt;  
736 - var startCoordinates = startWkt.substring(6, startWkt.length - 1).split(" "), endCoordinates = endWkt.substring(6, endWkt.length - 1).split(" ")  
737 - var sectionList = [];  
738 - var startPoint = new BMap.Point(startCoordinates[0], startCoordinates[1]);  
739 - var endPoint = new BMap.Point(endCoordinates[0], endCoordinates[1]);  
740 - // 路径规划保存按钮  
741 - var label = new BMap.Label("保存路段", {  
742 - offset: new BMap.Size(13, -53)  
743 - });  
744 - label.setStyle({  
745 - color: '#fff',  
746 - background: "url(/pages/base/stationroute/css/img/bg.png)",  
747 - border: '0px solid',  
748 - textAlign: "center",  
749 - height: "28px",  
750 - lineHeight: "26px",  
751 - width: "80px",  
752 - maxWidth: "none"  
753 - });  
754 - label.addEventListener('click', function () {  
755 - var params = {};  
756 - params.lineId = startStationRoute.line.id;  
757 - params.lineCode = startStationRoute.lineCode;  
758 - params.directions = startStationRoute.directions;  
759 - params.stationRouteBegin = startStationRoute.stationName;  
760 - params.stationRouteFinish = endStationRoute.stationName;  
761 - layer.confirm('确定保存', {  
762 - btn : [ '路段调整好了','继续调整','退出'], icon: 3, title:'提示'  
763 - ,btn3: function(index, layero){  
764 - PublicFunctions.resjtreeDate(params.lineId,params.directions);  
765 - PublicFunctions.editAChangeCssRemoveDisabled();  
766 - PublicFunctions.editMapStatusRemove();  
767 - }  
768 - }, function(index, layero){  
769 - layer.close(index);  
770 - params.route = $("#routePlanning").val();  
771 - $.get('doublename_road.html', function (m) {  
772 - $(pjaxContainer).append(m);  
773 - $('#doublename_road_mobal').trigger('doubleNameRoadMobal_show', [params, WorldsBMap, GetAjaxData, PublicFunctions]);  
774 - });  
775 - PublicFunctions.editMapStatusRemove();  
776 - });  
777 - });  
778 - // 路径规划  
779 - var transit = new BMap.DrivingRoute(mapBValue, {  
780 - renderOptions: {  
781 - map: mapBValue,  
782 - enableDragging: true  
783 - },  
784 - onPolylinesSet: searchPolylinesSet  
785 - });  
786 -  
787 - function searchPolylinesSet(results) {  
788 - if (transit.getStatus() == BMAP_STATUS_SUCCESS) {  
789 - var sectionArrayList = [];  
790 - for (i = 0; i < results.length; i++) {  
791 - sectionArrayList = sectionArrayList.concat(results[i].getPolyline().getPath());  
792 - }  
793 - sectionList = sectionArrayList;//JSON.stringify()  
794 - $("#routePlanning").val(JSON.stringify(sectionArrayList));  
795 - var pointMap = new Map();  
796 - pointMap = sectionArrayList[sectionArrayList.length - 1];  
797 - var pointLabel = new BMap.Point(pointMap.lng, pointMap.lat);  
798 - label.enableMassClear();  
799 - label.setPosition(pointLabel);  
800 - mapBValue.addOverlay(label);  
801 - }  
802 - }  
803 - transit.search(startPoint, endPoint);  
804 - transit.disableAutoViewport();  
805 - // 地图编辑状态  
806 - PublicFunctions.editMapStatus(endStationRoute.directions);  
807 - }  
808 - });  
809 - },  
810 - // 清楚覆盖物,定位站点  
811 - closeMobleSetClean: function(station) {  
812 - var dir = station.directions;  
813 - var lineId = station.lineId; // map.clearMarkAndOverlays();  
814 -  
815 - Bmap.clearMarkAndOverlays();  
816 - // 刷新左边树  
817 - PublicFunctions.resjtreeDate(lineId,dir,$("#versions").val());  
818 - /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */  
819 -// GetAjaxData.getSectionRouteInfo(lineId,dir,function(data1) {  
820 -// /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */  
821 -// PublicFunctions.linePanlThree(lineId,data1,dir);  
822 -// });  
823 -  
824 - // 退出编辑状态  
825 - PublicFunctions.editMapStatusRemove();  
826 - },  
827 - // 定位路段  
828 - focusSection: function(sectionRouteId) {  
829 - for (var i = 0, p; p = sectionArray[i++];) {  
830 - if (p.data.id == sectionRouteId) {  
831 - switch (p.data.dir) {  
832 - case 3:  
833 - WorldsBMap.openSectionInfoWin_inout(p);  
834 - break;  
835 - default:  
836 - WorldsBMap.openSectionInfoWin(p);  
837 - break;  
838 - }  
839 -  
840 - }  
841 - }  
842 - },  
843 - // 路段编辑  
844 - editSection : function(sectionRouteId, dir) {  
845 - layer.confirm('进入编辑状态', {  
846 - btn : [ '确定','返回' ], icon: 3, title:'提示'  
847 - }, function() {  
848 - PublicFunctions.editMapStatus(dir);  
849 - layer.msg('双击保存路段');  
850 - var p;  
851 - for (var i = 0; p = sectionArray[i++];) {  
852 - if (p.data.id == sectionRouteId) {  
853 - mapBValue.closeInfoWindow();//关闭infoWindow  
854 - p.enableEditing();  
855 - p.setStrokeColor('blue');  
856 - editPolyline = p;  
857 - break;  
858 - }  
859 - }  
860 - // 路段中间点为中心  
861 - var section = p.data;  
862 - var sectionStr = section.section.bsectionVectorWkt.substring(11, section.section.bsectionVectorWkt.length - 1);  
863 - // 分割折线坐标字符串  
864 - var lineArray = sectionStr.split(',');  
865 - var sectionPointArray = [];  
866 - for (var i = 0; i < lineArray.length; i++) {  
867 - sectionPointArray.push(new BMap.Point(lineArray[i].split(' ')[0], lineArray[i].split(' ')[1]));  
868 - }  
869 - // 计算中间点  
870 - var index = parseInt(sectionPointArray.length / 2);  
871 - var centerPoint = sectionPointArray[index];  
872 - mapBValue.centerAndZoom(centerPoint, 17);  
873 - // var c = p.ia[Math.floor(p.ia.length/2)];  
874 - // mapBValue.centerAndZoom(new BMap.Point(c.lng, c.lat), 18);  
875 - p.addEventListener('dblclick', function () {  
876 - /** 设置修改路段集合对象为空 */  
877 - editPolyline = '';  
878 - PublicFunctions.editMapStatusRemove();  
879 - $.get('edit_sectionroute.html', function(m){  
880 - $('body').append(m);  
881 - $('#edit_sectionroute_modal').trigger('modal.show', [WorldsBMap,GetAjaxData,p,PublicFunctions]);  
882 - });  
883 - });  
884 - });  
885 - },  
886 - // 添加第一个路段  
887 - addSection : function(stecion) {  
888 - PublicFunctions.editMapStatus();  
889 - // 把数据填充到模版中  
890 - var addSectionHTML = template('add_draw_polyline-temp');  
891 - $('body .mian-portlet-body').append(addSectionHTML);  
892 - //暂停和开始绘制  
893 - $('.draw_polyline_switch>a').on('click', function () {  
894 - var t = $(this).text();  
895 - if(t=='暂停绘制'){  
896 - WorldsBMap.exitDrawStatus();  
897 - $(this).text('开始绘制');  
898 - }  
899 - else{  
900 - WorldsBMap.openDrawStatus();  
901 - $(this).text('暂停绘制');  
902 - }  
903 - });  
904 - // 开启绘制事件  
905 - WorldsBMap.showAddSectionPanel(stecion);  
906 -  
907 - //取消  
908 - $('#addSectionCancelBtn').on('click', function () {  
909 - $('.main_left_panel_m_layer').hide();  
910 - $(this).parents('.buffer_edit_body').parent().remove();  
911 - WorldsBMap.exitDrawStatus();  
912 - PublicFunctions.editMapStatusRemove();  
913 - });  
914 -  
915 - //确定  
916 - $('#addSectionSbmintBtn').on('click', function () {  
917 - var btn = this;  
918 - $('#addSectionSbmintBtn').addClass("disabled");  
919 - var sectionName = $('#sectionNameInput').val();  
920 - var bsectionVector = $('#bsectionVectorInput').val();  
921 - if(sectionName && bsectionVector) {  
922 - WorldsBMap.exitDrawStatus();  
923 - GetAjaxData.getSectionCode(function(sectionCode) {  
924 - var status = $($("#versions").find("option:selected")[0]).attr("status");  
925 - var sectionRoute = {};  
926 - sectionRoute.line = lineId;  
927 - sectionRoute.sectionCode = sectionCode;  
928 - sectionRoute.roadCoding = '';  
929 - sectionRoute.sectionrouteCode = 1;  
930 - sectionRoute.sectionTime = 0;  
931 - sectionRoute.sectionDistance = 0;  
932 - sectionRoute.speedLimit = 60;  
933 - sectionRoute.versions = versions;  
934 - sectionRoute.destroy = 0;  
935 - sectionRoute.directions = dir;  
936 - sectionRoute.status = status;  
937 - sectionRoute['section.id'] = sectionCode;  
938 - sectionRoute['section.sectionCode'] = sectionCode;  
939 - sectionRoute['section.sectionName'] = sectionName;  
940 - sectionRoute['section.bsectionVectorWkt'] = bsectionVector;  
941 -  
942 - GetAjaxData.sectionSave(sectionRoute, function (result) {  
943 - if(result.status == "SUCCESS"){  
944 - $('.main_left_panel_m_layer').hide();  
945 - $(btn).parents('.buffer_edit_body').parent().remove();  
946 - PublicFunctions.editMapStatusRemove();  
947 - PublicFunctions.resjtreeDate(lineId, dir, versions);  
948 - PublicFunctions.editAChangeCssRemoveDisabled();  
949 - layer.msg("添加成功!");  
950 - } else if(result.status =="ERROR") {  
951 - layer.msg("添加失败!");  
952 - }  
953 - });  
954 - });  
955 - } else if(!sectionName){  
956 - layer.msg('请填写路段名字!');  
957 - } else if(!bsectionVector){  
958 - layer.msg('请先绘制路段!');  
959 - }  
960 - setTimeout(function () {  
961 - $("#addSectionSbmintBtn").removeClass("disabled");  
962 - },1000);  
963 - });  
964 - },  
965 - // 添加在路段之后  
966 - addSectionAfter : function(sectionRouteId) {  
967 - /*$.get('add_sectionroute_step1.html', function(m){  
968 - $(pjaxContainer).append(m);  
969 - $('#add_sectionroute_step1_modal').trigger('modal.show', [WorldsBMap,DrawingManagerObj,GetAjaxData,AddStationObj,LineObj,PublicFunctions]);  
970 - });*/  
971 - var lastSectionRoute;  
972 - // 关闭信息窗口  
973 - mapBValue.closeInfoWindow();  
974 - PublicFunctions.editMapStatus();  
975 - // 把数据填充到模版中  
976 - var addSectionHTML = template('add_draw_polyline-temp',{ 'id': sectionRouteId});  
977 - $('body .mian-portlet-body').append(addSectionHTML);  
978 - //暂停和开始绘制  
979 - $('.draw_polyline_switch>a').on('click', function () {  
980 - var t = $(this).text();  
981 - if(t=='暂停绘制'){  
982 - WorldsBMap.exitDrawStatus();  
983 - $(this).text('开始绘制');  
984 - } else {  
985 - WorldsBMap.openDrawStatus();  
986 - $(this).text('暂停绘制');  
987 - }  
988 - });  
989 -  
990 - //取消  
991 - $('#addSectionCancelBtn').on('click', function () {  
992 - $('.main_left_panel_m_layer').hide();  
993 - $(this).parents('.buffer_edit_body').parent().remove();  
994 - WorldsBMap.exitDrawStatus();  
995 - PublicFunctions.editMapStatusRemove();  
996 - });  
997 - GetAjaxData.getSectionRouteInfoById(sectionRouteId, function(data) {  
998 - WorldsBMap.showAddSectionPanel(data);  
999 - lastSectionRoute = data;  
1000 - });  
1001 -  
1002 - //确定  
1003 - $('#addSectionSbmintBtn').on('click', function () {  
1004 - var btn = this;  
1005 - $('#addSectionSbmintBtn').addClass("disabled");  
1006 - var sectionName = $('#sectionNameInput').val();  
1007 - var bsectionVectorWkt = $('#bsectionVectorInput').val();  
1008 - var params = {};  
1009 - if(sectionName && bsectionVectorWkt) {  
1010 - WorldsBMap.exitDrawStatus();  
1011 - GetAjaxData.getSectionCode(function(sectionCode) {  
1012 - 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};  
1013 -  
1014 - GetAjaxData.sectionSave(params, function (result) {  
1015 - if(result.status =="SUCCESS"){  
1016 - $('.main_left_panel_m_layer').hide();  
1017 - $(btn).parents('.buffer_edit_body').parent().remove();  
1018 - PublicFunctions.editMapStatusRemove();  
1019 - PublicFunctions.resjtreeDate(lastSectionRoute.line.id, lastSectionRoute.directions, $("#versions").val());  
1020 - PublicFunctions.editAChangeCssRemoveDisabled();  
1021 - layer.msg("添加成功!");  
1022 - } else if(result.status =="ERROR") {  
1023 - layer.msg("添加失败!");  
1024 - }  
1025 - });  
1026 - });  
1027 - } else if(!sectionName){  
1028 - layer.msg('请填写路段名字!');  
1029 - } else if(!bsectionVector)  
1030 - layer.msg('请先绘制路段!');  
1031 - setTimeout(function () {  
1032 - $("#addSectionSbmintBtn").removeClass("disabled");  
1033 - },1000);  
1034 - });  
1035 - },  
1036 - // 撤销站点  
1037 - destroyStation : function(stationRouteId, lineId, dir) {  
1038 - layer.confirm('你确定要撤销此站点吗?', {  
1039 - btn : [ '撤销','返回' ], icon: 3, title:'提示'  
1040 - }, function(){  
1041 - $.post('/api/lsstationroute/destroy', {id: stationRouteId}, function(res) {  
1042 - if (res.status == 'SUCCESS') {  
1043 - // 弹出添加成功提示消息  
1044 - layer.msg('撤销成功!');  
1045 - } else {  
1046 - // 弹出添加失败提示消息  
1047 - layer.msg('撤销失败!');  
1048 - }  
1049 - // 刷新左边树  
1050 - var version = $("#verions").val();  
1051 - PublicFunctions.resjtreeDate(lineId, dir, version);  
1052 - });  
1053 - });  
1054 - },  
1055 - // 撤销路段  
1056 - destroySection : function(sectionRouteId,lineId,dir) {  
1057 - layer.confirm('你确定要撤销此路段吗?', {  
1058 - btn : [ '撤销','返回' ], icon: 3, title:'提示'  
1059 - }, function(){  
1060 - $.post('/api/lssectionroute/destroy',{id: sectionRouteId},function(res) {  
1061 - if (res.status == 'SUCCESS') {  
1062 - // 弹出添加成功提示消息  
1063 - layer.msg('撤销成功!');  
1064 - } else {  
1065 - // 弹出添加失败提示消息  
1066 - layer.msg('撤销失败!');  
1067 - }  
1068 - // 刷新左边树  
1069 - var version = $("#verions").val();  
1070 - PublicFunctions.resjtreeDate(lineId, dir, version);  
1071 - });  
1072 - });  
1073 - },  
1074 - // 打开路段信息窗口  
1075 - openSectionInfoWin : function(p) {  
1076 - var sectionRoute = p.data;  
1077 - var dir = sectionRoute.directions;  
1078 - var width = WorldsBMap.strGetLength(sectionRoute.section.sectionName) * 10;  
1079 - // 信息窗口参数属性  
1080 - var opts = {  
1081 - // 信息窗口宽度  
1082 - width: (width < 200 ? 200 : width),  
1083 - // 信息窗口高度  
1084 - height: 150,  
1085 - //设置不允许信窗发送短息  
1086 - enableMessage: false,  
1087 - //是否开启点击地图关闭信息窗口  
1088 - enableCloseOnClick: false,  
1089 - // 是否开启信息窗口打开时地图自动移动(默认开启)。(自 1.1 新增)  
1090 - enableAutoPan: false  
1091 - };  
1092 - var htm = '<span style="color: #ff8355;font-size: 18px;">' + sectionRoute.section.sectionName + '</span>' +  
1093 - '<span class="help-block" >路段编码:' + sectionRoute.sectionCode + '</span>' +  
1094 - '<span class="help-block" >路段序号:' + sectionRoute.sectionrouteCode + '</span>' +  
1095 - '<span class="help-block" >版本号&nbsp&nbsp:' + sectionRoute.versions + '</span>' +  
1096 - '<div >';  
1097 -  
1098 - if($($("#versions").find("option:selected")[0]).attr("status") > 0){  
1099 - htm += '<button class="info_win_btn" id="editStation" onclick="WorldsBMap.editSection(' + sectionRoute.id +','+dir+ ')">修改</button>' +  
1100 - '<button class="info_win_btn" id="addBetweenStationRoad" onclick="WorldsBMap.destroySection('+ sectionRoute.id + ','+sectionRoute.line.id+','+sectionRoute.directions+')">撤销</button>' +  
1101 - '<button class="info_win_btn" id="addSectionAfter" onclick="WorldsBMap.addSectionAfter('+sectionRoute.id+')">添加路段(之后)</button>' +  
1102 - '</div>';  
1103 - }  
1104 -  
1105 - // 创建信息窗口  
1106 - var infoWindow_target = new BMap.InfoWindow(htm, opts);  
1107 - // 切割段折线坐标字符串  
1108 - var sectionStr = sectionRoute.section.bsectionVectorWkt.substring(11, sectionRoute.section.bsectionVectorWkt.length - 1);  
1109 - // 分割折线坐标字符串  
1110 - var lineArray = sectionStr.split(',');  
1111 - var sectionArray = [];  
1112 - for (var i = 0; i < lineArray.length; i++) {  
1113 - sectionArray.push(new BMap.Point(lineArray[i].split(' ')[0], lineArray[i].split(' ')[1]));  
1114 - }  
1115 - // 计算中间点  
1116 - var index = parseInt(sectionArray.length / 2);  
1117 - var centerPoint = sectionArray[index];  
1118 - //close event  
1119 - infoWindow_target.addEventListener('close', function (e) {  
1120 - p.setStrokeColor("red");  
1121 - road_win_show_p = null;  
1122 - });  
1123 - //open event  
1124 - infoWindow_target.addEventListener('open', function (e) {  
1125 - p.setStrokeColor("#20bd26");  
1126 - road_win_show_p = p;  
1127 - });  
1128 - //开启信息窗口  
1129 - mapBValue.openInfoWindow(infoWindow_target, centerPoint);  
1130 - mapBValue.panTo(centerPoint);  
1131 - },  
1132 - /**  
1133 - * 绘制新增路段  
1134 - * @param section  
1135 - */  
1136 - showAddSectionPanel : function (section) {  
1137 - var point;  
1138 - if(section){  
1139 - var sectionBsectionVectorStr = section.section.bsectionVectorWkt;  
1140 - var line = sectionBsectionVectorStr.substring(11, sectionBsectionVectorStr.length - 1),  
1141 - points = line.split(','),  
1142 - pointStr = points[points.length-1].split(' ');  
1143 -  
1144 - point = new BMap.Point(pointStr[0], pointStr[1]);  
1145 - }  
1146 -  
1147 - mapBValue.centerAndZoom(point, 18);  
1148 -  
1149 - //开启鼠标绘制  
1150 - drawingManager = new BMapLib.DrawingManager(mapBValue, {  
1151 - polylineOptions: styleOptions  
1152 - });  
1153 -  
1154 - drawingManager.open();  
1155 - //drawingManager.enableCalculate();  
1156 - drawingManager.setDrawingMode('polyline');  
1157 -  
1158 - //绘制完成  
1159 - drawingManager.addEventListener('polylinecomplete', function (e) {  
1160 - drawingManager.close();  
1161 - var polyline = new BMap.Polyline(e.getPath(), {strokeWeight: 7, strokeColor: 'blue', strokeOpacity: 0.7});  
1162 - mapBValue.removeOverlay(e);  
1163 - mapBValue.addOverlay(polyline);  
1164 - polyline.enableEditing();  
1165 - editPolyline = polyline;  
1166 -  
1167 - $('#bsectionVectorInput').val(Bmap.points2Wkt(e.getPath()));  
1168 - });  
1169 - },  
1170 - points2Wkt: function (points) {  
1171 - var wkt = new Array();  
1172 - for (var i = 0;i < points.length;i++) {  
1173 - wkt.push(points[i].lng + ' ' + points[i].lat);  
1174 - }  
1175 -  
1176 - return 'LINESTRING(' + wkt.join(',') + ')';  
1177 - },  
1178 - exitDrawStatus : function () {  
1179 - if (drawingManager) {  
1180 - $('#bsectionVectorInput').val("");  
1181 - WorldsBMap.clearOtherOverlay();  
1182 - drawingManager.close();  
1183 - }  
1184 - },  
1185 - openDrawStatus : function () {  
1186 - if (drawingManager) {  
1187 - $('#bsectionVectorInput').val("");  
1188 - WorldsBMap.clearOtherOverlay();  
1189 - drawingManager.open();  
1190 - }  
1191 - },  
1192 - /** 清楚无需要的覆盖物(非站点/路段数据源)*/  
1193 - clearOtherOverlay : function () {  
1194 - var all = mapBValue.getOverlays();  
1195 - for (var i = 0, obj; obj = all[i++];) {  
1196 - if (obj.ct_source && obj.ct_source == '1')  
1197 - continue;  
1198 - mapBValue.removeOverlay(obj);  
1199 - }  
1200 - },  
1201 - clearMarkAndOverlays: function () {  
1202 - // 清楚地图覆盖物  
1203 - mapBValue.clearOverlays();  
1204 - mapBValue.removeOverlay();  
1205 - sectionArray = [];  
1206 - },  
1207 - clearMark: function () {  
1208 - // 清楚地图覆盖物  
1209 - mapBValue.removeOverlay();  
1210 - },  
1211 - strGetLength: function (str) {  
1212 - return str.replace(/[\u0391-\uFFE5]/g, "aa").length; //先把中文替换成两个字节的英文,在计算长度  
1213 - },  
1214 - stationsPointsToLibraryPoint : function(stations, callback) {  
1215 - $.ajax('/station/matchStation', {  
1216 - method: 'POST',  
1217 - data: JSON.stringify(stations),  
1218 - contentType: 'application/json',  
1219 - success: function (res) {  
1220 - callback && callback(res.data);  
1221 - return;  
1222 - }  
1223 - });  
1224 - },  
1225 - /** 获取距离与时间 @param <points:坐标点集合> */  
1226 - getDistanceAndDuration : function(stations,callback){  
1227 - var stationRoutes = new Array();  
1228 - stations.forEach(function (item) {  
1229 - var stationRoute = { stationName: item.stationName, station: item };  
1230 - item.distance = 0;  
1231 - item.duration = 0;  
1232 - stationRoutes.push(stationRoute);  
1233 - });  
1234 - callback(stationRoutes);  
1235 - },  
1236 -  
1237 - /**  
1238 - * 画圆  
1239 - * point(lng,lat) 中心点  
1240 - * radius 半径(m)  
1241 - * isMark 是否加站名  
1242 - */  
1243 - drawCircle: function (point, radius, stationName, isMark) {  
1244 - var center = new BMap.Point(point.lng, point.lat);  
1245 - var circle = new BMap.Circle(center, radius ,{strokeColor:"blue", strokeWeight:2, strokeOpacity:0.5});  
1246 - mapBValue.addOverlay(circle);  
1247 - if (isMark) {  
1248 - var html = '<div style="position: absolute; margin: 0pt; padding: 0pt; width: 160px; height: 26px; left: -3px; top: -30px; overflow: hidden;">'  
1249 - + '<img class="rm3_image" style="border:none;left:0px; top:0px; position:absolute;" src="/pages/base/stationroute/css/img/back160.png">'  
1250 - + '</div>'  
1251 - + '<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>';  
1252 -  
1253 - var myRichMarker = new BMapLib.RichMarker(html, center, {  
1254 - "title": stationName,  
1255 - "anchor": new BMap.Size(-10, 8),  
1256 - "enableDragging": true  
1257 - });  
1258 - myRichMarker.disableDragging();  
1259 - myRichMarker.ct_source = '1';  
1260 - mapBValue.addOverlay(myRichMarker);  
1261 - }  
1262 - },  
1263 -  
1264 - /**  
1265 - * 画多边形  
1266 - * points 点数组  
1267 - */  
1268 - drawPolygon: function (points, stationName, isMark) {  
1269 - var bdPoints = new Array(), i = 0, point;  
1270 - for (i = 0;i < points.length;i++) {  
1271 - point = points[i].split(' ');  
1272 - bdPoints.push(new BMap.Point(point[0], point[1]));  
1273 - }  
1274 - var polygon = new BMap.Polygon(bdPoints), center = bdPoints[0];  
1275 - mapBValue.addOverlay(polygon);  
1276 - if (isMark) {  
1277 - var html = '<div style="position: absolute; margin: 0pt; padding: 0pt; width: 160px; height: 26px; left: -3px; top: -30px; overflow: hidden;">'  
1278 - + '<img class="rm3_image" style="border:none;left:0px; top:0px; position:absolute;" src="/pages/base/stationroute/css/img/back160.png">'  
1279 - + '</div>'  
1280 - + '<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>';  
1281 -  
1282 - var myRichMarker = new BMapLib.RichMarker(html, center, {  
1283 - "title": stationName,  
1284 - "anchor": new BMap.Size(-10, 8),  
1285 - "enableDragging": true  
1286 - });  
1287 - myRichMarker.disableDragging();  
1288 - myRichMarker.ct_source = '1';  
1289 - mapBValue.addOverlay(myRichMarker);  
1290 - }  
1291 - },  
1292 -  
1293 - drawPolyLine: function (points, data, start, end) {  
1294 - var bdPoints = new Array(), i = 0, point, polyline;  
1295 - for (i = 0;i < points.length;i++) {  
1296 - point = points[i].split(' ');  
1297 - bdPoints.push(new BMap.Point(point[0], point[1]));  
1298 - }  
1299 - // 创建线路走向  
1300 - polyline = new BMap.Polyline(bdPoints, {  
1301 - strokeColor: 'red',  
1302 - strokeWeight: 6,  
1303 - strokeOpacity: 0.7  
1304 - });  
1305 -  
1306 - polyline.data = data;  
1307 - polyline.start = start;  
1308 - polyline.end = end;  
1309 - polyline.ct_source = '1';  
1310 - // 把折线添加到地图上  
1311 - mapBValue.addOverlay(polyline);  
1312 - // 聚焦事件  
1313 - polyline.addEventListener('mousemove', function (e) {  
1314 - if (this != editPolyline)  
1315 - this.setStrokeColor("#20bd26");  
1316 - });  
1317 - // 失去焦点  
1318 - polyline.addEventListener('mouseout', function (e) {  
1319 - if (this != editPolyline && this != road_win_show_p)  
1320 - this.setStrokeColor("red");  
1321 - });  
1322 - // 添加单击事件  
1323 - polyline.addEventListener('onclick', function (e) {  
1324 - // 打开信息窗口  
1325 - if (map_status != 1)  
1326 - WorldsBMap.openSectionInfoWin_inout(this);  
1327 - });  
1328 - // 添加右击事件  
1329 - polyline.addEventListener('rightclick', function (e) {  
1330 - if (currentSection.enableEditing) {  
1331 - this.disableEditing();  
1332 - WorldsBMap.saveSection_inout(this);  
1333 - }  
1334 - });  
1335 - sectionArray.push(polyline);  
1336 - },  
1337 -  
1338 - // 打开路段信息窗口  
1339 - openSectionInfoWin_inout: function(p) {  
1340 - var sectionRoute = p.data;  
1341 - var dir = sectionRoute.directions;  
1342 - var width = WorldsBMap.strGetLength(sectionRoute.section.sectionName) * 10;  
1343 - // 信息窗口参数属性  
1344 - var opts = {  
1345 - // 信息窗口宽度  
1346 - width: (width < 200 ? 200 : width),  
1347 - // 信息窗口高度  
1348 - height: 150,  
1349 - //设置不允许信窗发送短息  
1350 - enableMessage: false,  
1351 - //是否开启点击地图关闭信息窗口  
1352 - enableCloseOnClick: false,  
1353 - // 是否开启信息窗口打开时地图自动移动(默认开启)。(自 1.1 新增)  
1354 - enableAutoPan: false  
1355 - };  
1356 - var htm = '<span style="color: #ff8355;font-size: 18px;">' + sectionRoute.section.sectionName + '</span>' +  
1357 - '<span class="help-block" >路段编码:' + sectionRoute.sectionCode + '</span>' +  
1358 - '<span class="help-block" >路段序号:' + sectionRoute.sectionrouteCode + '</span>' +  
1359 - '<span class="help-block" >版本号&nbsp&nbsp:' + sectionRoute.versions + '</span>' +  
1360 - '<div >';  
1361 -  
1362 - if($($("#versions").find("option:selected")[0]).attr("status") > 0){  
1363 - htm += '<button class="info_win_btn" id="editStation" onclick="WorldsBMap.editSection_inout(' + sectionRoute.id +','+dir+ ')">修改</button>' +  
1364 - '<button class="info_win_btn" id="addBetweenStationRoad" onclick="WorldsBMap.destroySection_inout('+ sectionRoute.id + ','+sectionRoute.line.id+','+sectionRoute.directions+')">撤销</button>' +  
1365 - '<button class="info_win_btn" id="addSectionAfter" onclick="WorldsBMap.addSectionAfter_inout('+sectionRoute.id+')">添加路段(之后)</button>' +  
1366 - '</div>';  
1367 - }  
1368 -  
1369 - // 创建信息窗口  
1370 - var infoWindow_target = new BMap.InfoWindow(htm, opts);  
1371 - // 切割段折线坐标字符串  
1372 - var sectionStr = section.section.bsectionVectorWkt.substring(11, section.section.bsectionVectorWkt.length - 1);  
1373 - // 分割折线坐标字符串  
1374 - var lineArray = sectionStr.split(',');  
1375 - var sectionArray = [];  
1376 - for (var i = 0; i < lineArray.length; i++) {  
1377 - sectionArray.push(new BMap.Point(lineArray[i].split(' ')[0], lineArray[i].split(' ')[1]));  
1378 - }  
1379 - // 计算中间点  
1380 - var index = parseInt(sectionArray.length / 2);  
1381 - var centerPoint = sectionArray[index];  
1382 - //close event  
1383 - infoWindow_target.addEventListener('close', function (e) {  
1384 - p.setStrokeColor("red");  
1385 - road_win_show_p = null;  
1386 - });  
1387 - //open event  
1388 - infoWindow_target.addEventListener('open', function (e) {  
1389 - p.setStrokeColor("#20bd26");  
1390 - road_win_show_p = p;  
1391 - });  
1392 - //开启信息窗口  
1393 - mapBValue.openInfoWindow(infoWindow_target, centerPoint);  
1394 - mapBValue.panTo(centerPoint);  
1395 - },  
1396 -  
1397 - /**  
1398 - * 进出场路段设置为编辑状态  
1399 - */  
1400 - editSection_inout: function(sectionRouteId) {  
1401 - layer.confirm('进入编辑状态', {  
1402 - btn : [ '确定','返回' ], icon: 3, title:'提示'  
1403 - }, function() {  
1404 - PublicFunctions.editMapStatus(dir);  
1405 - layer.msg('双击保存路段');  
1406 - var p;  
1407 - for (var i = 0; p = sectionArray[i++];) {  
1408 - if (p.data.id == sectionRouteId) {  
1409 - mapBValue.closeInfoWindow();//关闭infoWindow  
1410 - p.enableEditing();  
1411 - p.setStrokeColor('blue');  
1412 - editPolyline = p;  
1413 - break;  
1414 - }  
1415 - }  
1416 - // 路段中间点为中心  
1417 - var section = p.data;  
1418 - var sectionStr = section.section.bsectionVectorWkt.substring(11, section.section.bsectionVectorWkt.length - 1);  
1419 - // 分割折线坐标字符串  
1420 - var lineArray = sectionStr.split(',');  
1421 - var sectionPointArray = [];  
1422 - for (var i = 0; i < lineArray.length; i++) {  
1423 - sectionPointArray.push(new BMap.Point(lineArray[i].split(' ')[0], lineArray[i].split(' ')[1]));  
1424 - }  
1425 - // 计算中间点  
1426 - var index = parseInt(sectionPointArray.length / 2);  
1427 - var centerPoint = sectionPointArray[index];  
1428 - mapBValue.centerAndZoom(centerPoint, 17);  
1429 - // var c = p.ia[Math.floor(p.ia.length/2)];  
1430 - // mapBValue.centerAndZoom(new BMap.Point(c.lng, c.lat), 18);  
1431 - p.addEventListener('dblclick', function () {  
1432 - /** 设置修改路段集合对象为空 */  
1433 - editPolyline = '';  
1434 - PublicFunctions.editMapStatusRemove();  
1435 - $.get('editsection_inout.html', function(m){  
1436 - $('body').append(m);  
1437 - $('#edit_section_mobal').trigger('editSectionMobal_show', [WorldsBMap,GetAjaxData,p,PublicFunctions]);  
1438 - });  
1439 - });  
1440 - });  
1441 - },  
1442 -  
1443 - // 撤销路段  
1444 - destroySection_inout : function(sectionRouteId) {  
1445 - layer.confirm('你确定要撤销此路段吗?', {  
1446 - btn : [ '撤销','返回' ], icon: 3, title:'提示'  
1447 - }, function(){  
1448 - var status = $($("#versions").find("option:selected")[0]).attr("status");  
1449 - $.post('/inout/destroy',{'id': sectionRouteId,status:status},function(resuntDate) {  
1450 - if (resuntDate.status == 'SUCCESS') {  
1451 - // 弹出添加成功提示消息  
1452 - layer.msg('撤销成功!');  
1453 - } else {  
1454 - // 弹出添加失败提示消息  
1455 - layer.msg('撤销失败!');  
1456 - }  
1457 - // 刷新左边树  
1458 - $('#inoutSearch').click();  
1459 - /** 查询路段信息 @param:<Line.id:线路Id;delBatch.dir:方向> @return:data:路段数据 */  
1460 -// GetAjaxData.getSectionRouteInfo(lineId,dir,function(data) {  
1461 -// /** 在地图上画出线路走向 @param:<Line.id:线路Id;delBatch.dir:方向;data:路段数据> */  
1462 -// PublicFunctions.linePanlThree(lineId,data,dir);  
1463 -// });  
1464 - });  
1465 - });  
1466 - },  
1467 -  
1468 - // 添加在路段之后  
1469 - addSectionAfter_inout : function(sectionRouteId) {  
1470 - //order = after before;  
1471 - var beforeSection;  
1472 - // 关闭信息窗口  
1473 - mapBValue.closeInfoWindow();  
1474 - PublicFunctions.editMapStatus();  
1475 - // 把数据填充到模版中  
1476 - var addSectionHTML = template('add_draw_polyline-temp',{ 'id': sectionRouteId});  
1477 - $('body .mian-portlet-body').append(addSectionHTML);  
1478 - //暂停和开始绘制  
1479 - $('.draw_polyline_switch>a').on('click', function () {  
1480 - var t = $(this).text();  
1481 - if(t=='暂停绘制'){  
1482 - WorldsBMap.exitDrawStatus();  
1483 - $(this).text('开始绘制');  
1484 - }  
1485 - else{  
1486 - WorldsBMap.openDrawStatus();  
1487 - $(this).text('暂停绘制');  
1488 - }  
1489 - });  
1490 -  
1491 - //取消  
1492 - $('#addSectionCancelBtn').on('click', function () {  
1493 - $('.main_left_panel_m_layer').hide();  
1494 - $(this).parents('.buffer_edit_body').parent().remove();  
1495 - WorldsBMap.exitDrawStatus();  
1496 - PublicFunctions.editMapStatusRemove();  
1497 - });  
1498 - GetAjaxData.getRouteInfoById(sectionRouteId, function(data){  
1499 - beforeSection = data;  
1500 - beforeSection.sectionBsectionVector = beforeSection.section.bsectionVectorWkt;  
1501 - WorldsBMap.showAddSectionPanel(beforeSection);  
1502 - });  
1503 -  
1504 - //确定  
1505 - $('#addSectionSbmintBtn').on('click', function () {  
1506 - var btn = this;  
1507 - $('#addSectionSbmintBtn').addClass("disabled");  
1508 - var sectionName = $('#sectionNameInput').val();  
1509 - var bsectionVector = $('#bsectionVectorInput').val();  
1510 - var params = {};  
1511 - if(sectionName && bsectionVector) {  
1512 - WorldsBMap.exitDrawStatus();  
1513 - GetAjaxData.getSectionCode(function(sectionCode) {  
1514 - params.lineId = beforeSection.line.id;  
1515 - params.lineCode = beforeSection.lineCode;  
1516 - params.sectionCode = sectionCode;// 设值路段编码.  
1517 - params.sectionName = sectionName;  
1518 - params.roadCoding = '';  
1519 - params.dbType = 'b';  
1520 - params.bsectionVector = bsectionVector;  
1521 - params.sectionrouteCode = beforeSection.sectionrouteCode+"_0";  
1522 - params.sectionTime = 0;  
1523 - params.sectionDistance = 60;  
1524 - params.speedLimit = 0;  
1525 - params.versions = beforeSection.versions;  
1526 - params.destroy = 0;  
1527 - params.directions = beforeSection.directions;  
1528 - params.descriptions = '';  
1529 - params.start = beforeSection.start;  
1530 - params.end = beforeSection.end;  
1531 - params.status=$($("#versions").find("option:selected")[0]).attr("status");  
1532 -  
1533 - GetAjaxData.inoutSectionSave(params, function (result) {  
1534 - if(result.status =="SUCCESS"){  
1535 - $('.main_left_panel_m_layer').hide();  
1536 - $(btn).parents('.buffer_edit_body').parent().remove();  
1537 - PublicFunctions.editMapStatusRemove();  
1538 - $('#inoutSearch').click();  
1539 - PublicFunctions.editAChangeCssRemoveDisabled();  
1540 -// GetAjaxData.getSectionRouteInfo(lineId,dir,function(data) {  
1541 -// PublicFunctions.linePanlThree(lineId,data,dir);  
1542 -// });  
1543 - layer.msg("添加成功!");  
1544 - } else if(result.status =="ERROR") {  
1545 - layer.msg("添加失败!");  
1546 - }  
1547 - });  
1548 - });  
1549 - } else if(!sectionName){  
1550 - layer.msg('请填写路段名字!');  
1551 - } else if(!bsectionVector)  
1552 - layer.msg('请先绘制路段!');  
1553 - setTimeout(function () {  
1554 - $("#addSectionSbmintBtn").removeClass("disabled");  
1555 - },1000);  
1556 - });  
1557 - },  
1558 - /**  
1559 - * 保存进出场路段  
1560 - */  
1561 - saveSection_inout: function () {  
1562 - $.get('editsection_inout.html', function(m){  
1563 - $('body').append(m);  
1564 - $('#edit_section_mobal').trigger('editSectionMobal_show', [WorldsBMap,GetAjaxData,currentSection,PublicFunctions]);  
1565 - });  
1566 - },  
1567 - /**  
1568 - * 添加站点时marker右键事件监听  
1569 - * 确认站点中心点  
1570 - */  
1571 - confirmCenterPointHandler: function (event) {  
1572 - // 清除覆盖物  
1573 - mapBValue.closeInfoWindow();  
1574 - mapBValue.clearOverlays();  
1575 - mapBValue.removeEventListener('click', Bmap.pickCenterPointHandler);  
1576 -  
1577 - var marker = event.target;  
1578 - var position = marker.getPosition(), station = marker.station;  
1579 - marker.disableDragging();  
1580 - mapBValue.addOverlay(marker);  
1581 - if (marker.station) {  
1582 - var label = new BMap.Label(station.stationName, {offset: new BMap.Size(25, 0)});  
1583 - label.setStyle({border: '0px'});  
1584 - marker.setLabel(label);  
1585 - AddStationObj.setPhysicalStation(station);  
1586 - layer.msg('已选定站点!');  
1587 - } else {  
1588 - /** 设置新增站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */  
1589 - AddStationObj.resetPhysicalStation();  
1590 - AddStationObj.setAddStationJwpoints(position.lng + " " + position.lat);  
1591 - layer.msg('已确定中心点!');  
1592 - }  
1593 - marker.removeEventListener('rightclick', Bmap.confirmCenterPointHandler);  
1594 - if (AddStationObj.getAddStation().shapesType === 'd') {  
1595 - // 打开绘制工具  
1596 - DrawingManagerObj.openDrawingManager();  
1597 - PublicFunctions.editMapStatus(AddStationObj.getAddStation().dir);  
1598 - layer.msg('请点击选择多边形区域');  
1599 - } else {  
1600 - marker.addEventListener('dblclick', Bmap.formCenterPointHandler);  
1601 - layer.msg('请双击中心点图标进行下一步操作');  
1602 - }  
1603 - },  
1604 - /**  
1605 - * 确认中心点之后 填写附加字段  
1606 - */  
1607 - formCenterPointHandler: function () {  
1608 - if (setTimeoutId) {  
1609 - clearTimeout(setTimeoutId);  
1610 - }  
1611 - $.get('add_stationroute_step2.html', function(m){  
1612 - $(pjaxContainer).append(m);  
1613 - $('#add_stationroute_step2_modal').trigger('modal.show', [Bmap,GetAjaxData,AddStationObj,LineObj,PublicFunctions]);  
1614 - });  
1615 - },  
1616 - addStationInit: function () {  
1617 - for (var i = 0;i < overlays.length;i++) {  
1618 - mapBValue.removeOverlay(overlays[i]);  
1619 - }  
1620 - overlays = new Array();  
1621 - }  
1622 - };  
1623 -  
1624 - return Bmap;  
1625 -}();  
1626 \ No newline at end of file 0 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/js/stationroute-list-reload.js deleted 100644 → 0
1 -/**  
2 - * reload事件  
3 - *  
4 - *  
5 - */  
6 -$(function() {  
7 - // 关闭左侧栏  
8 - if (!$('body').hasClass('page-sidebar-closed')) {  
9 - $('.menu-toggler.sidebar-toggler').click();  
10 - }  
11 - // 获取参数线路ID  
12 - var idAndDir = $.url().param('no');  
13 - var param = idAndDir.split(",");  
14 - var dir = 0, id;  
15 - if (param.length == 1) {  
16 - id = param[0];  
17 - } else {  
18 - id = param[0];  
19 - dir = param[1];  
20 - }  
21 - if (dir == 1) {  
22 - $('#stationUp').removeClass('active');  
23 - $('#stationUp').removeClass('in');  
24 - $('#stationUp').addClass('fade');  
25 - $('#stationDown').addClass('active in');  
26 - $('#upLine').parent().removeClass('active');  
27 - $('#downLine').parent().addClass('active');  
28 - }  
29 - // 如果线路ID不为空  
30 - if (id) {  
31 - var styleOptions = {  
32 - strokeColor : "blue",// 边线颜色。  
33 - fillColor : "blue",// 填充颜色。当参数为空时,圆形将没有填充效果。  
34 - strokeWeight : 3,// 边线的宽度,以像素为单位。  
35 - strokeOpacity : 0.8,// 边线透明度,取值范围0 - 1。  
36 - fillOpacity : 0.6,// 填充的透明度,取值范围0 - 1。  
37 - strokeStyle : 'solid' // 边线的样式,solid或dashed。  
38 - };  
39 -  
40 - // 等候500毫秒执行  
41 - setTimeout(function() {  
42 -  
43 - /**  
44 - * 初始化线路对象,这里只初始化线路Id属性  
45 - *  
46 - * @param:<id:线路ID>  
47 - * @return:Line  
48 - */  
49 - var Line = LineObj.init(id);  
50 -  
51 - WorldsBMap.setLineId(Line.id);  
52 - $("#versions").change(  
53 - function() {  
54 - var val = $(this).val();  
55 -  
56 - WorldsBMap.setStatus(Line.id, val, 0);  
57 - /**  
58 - * 初始化上行树  
59 - *  
60 - * @param:<Line.id:线路Id;0:上行>  
61 - */  
62 - PublicFunctions.resjtreeDate(Line.id, '0', val);  
63 -  
64 -  
65 - LineObj.setStatus($($("#versions").find("option:selected")[0]).attr("status"));  
66 - /**  
67 - * 初始化下行树  
68 - *  
69 - * @param:<Line.id:线路Id;1:下行>  
70 - */  
71 - // PublicFunctions.resjtreeDate(Line.id,'1',val);  
72 - $('#stationDown').removeClass('active');  
73 - $('#stationDown').removeClass('in');  
74 - $('#stationDown').addClass('fade');  
75 - $('#inoutCarpark').removeClass('active');  
76 - $('#inoutCarpark').removeClass('in');  
77 - $('#inoutCarpark').addClass('fade');  
78 - $('#stationUp').addClass('active in');  
79 - $('#downLine').parent().removeClass('active');  
80 - $('#inoutLine').parent().removeClass('active');  
81 - $('#upLine').parent().addClass('active');  
82 -  
83 - if ($($("#versions").find("option:selected")[0]).attr("status") > 0) {  
84 - $(".table-toolbar").show();  
85 - } else {  
86 - $(".table-toolbar").hide();  
87 - }  
88 -  
89 - });  
90 -  
91 - /**  
92 - * 初始化线路标题  
93 - *  
94 - * @param:<Line.id:线路ID>  
95 - */  
96 - PublicFunctions.setTiteText(Line.id);  
97 -  
98 - /**  
99 - * 初始化地图对象map  
100 - *  
101 - * @return:Map对象  
102 - */  
103 - var map_ = WorldsBMap.init();  
104 -  
105 - /**  
106 - * 初始化绘图工具类  
107 - *  
108 - * @param:<map_:map对象;styleOptions:绘图样式对象>  
109 - * @return:DrawingManager对象  
110 - */  
111 - DrawingManagerObj.init(map_, styleOptions);  
112 -  
113 - GetAjaxData.getAllLineVersions(Line.id, function(data) {  
114 - $("#versions option").remove();  
115 - var reqData = false;  
116 - for (var i = 0; i < data.length; i++) {  
117 - var ver = data[i];  
118 - if (ver.status == 1) {  
119 - PublicFunctions.TreeUpOrDown(Line.id, '0', ver.versions);  
120 - PublicFunctions.TreeUpOrDown(Line.id, '1', ver.versions);  
121 - reqData = true;  
122 -  
123 - var option = "<option value=" + ver.versions + " status=" + ver.status + " selected>" + ver.name + " (" + ver.versions + ")" + "</option>"  
124 - $("#versions").append(option);  
125 - LineObj.setStatus(ver.status);  
126 - continue;  
127 - }  
128 - var option = "<option value=" + ver.versions + " status=" + ver.status + ">" + ver.name + " (" + ver.versions + ")" + "</option>"  
129 - $("#versions").append(option);  
130 - }  
131 -  
132 - if (!reqData) {  
133 - for (var i = 0; i < data.length; i++) {  
134 - if (ver.status == 2) {  
135 - PublicFunctions.TreeUpOrDown(Line.id, '0', ver.versions);  
136 - PublicFunctions.TreeUpOrDown(Line.id, '1', ver.versions);  
137 - LineObj.setStatus(ver.status);  
138 - break;  
139 - }  
140 - }  
141 - }  
142 - });  
143 -  
144 - $('#esc_edit_div').on('click', function() {  
145 - var index = layer.open({  
146 - title: '退出提示',  
147 - content: '退出编辑模式后,当前没有保存的所有操作将被还原,确定要退出吗!',  
148 - btn: [ '确定', '取消' ],  
149 - yes: function(index) {  
150 - var dir = WorldsBMap.getDir();  
151 -  
152 - PublicFunctions.resjtreeDate(Line.id, dir, $("#versions").val());  
153 - PublicFunctions.editMapStatusRemove();  
154 - layer.msg("已退出编辑模式!");  
155 - layer.close(index);  
156 - },  
157 - btn2: function() {  
158 - layer.closeAll(index); // 关闭当前窗口  
159 - layer.msg("您没有退出编辑模式,请继续完成您未完成的操作!")  
160 - }  
161 - });  
162 - });  
163 - }, 500);  
164 -  
165 - } else {  
166 - // 缺少ID  
167 - layer.confirm('【ID缺失,请点击返回,重新进行操作】', {  
168 - btn : [ '返回' ],  
169 - icon : 3,  
170 - title : '提示'  
171 - }, function(index) {  
172 -  
173 - // 关闭提示弹出层  
174 - layer.close(index);  
175 -  
176 - // 返回线路list页面  
177 - loadPage('/pages/base/line/list.html');  
178 -  
179 - });  
180 -  
181 - }  
182 - $('.green-seagreen dropdown-toggle').click(function() {  
183 - $('.dropdown-menu').css("display", "block");  
184 - });  
185 -});  
186 \ No newline at end of file 0 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/js/stationroute-list-treedata.js deleted 100644 → 0
1 -/**  
2 - *  
3 - * 左边树Obj : StationTreeData  
4 - *  
5 - * - - - - - - 》 upInit : 初始化上行树  
6 - *  
7 - * - - - - - - 》 downInit : 初始化下行树  
8 - *  
9 - * - - - - - - 》 reloadUp : 刷行上行树  
10 - *  
11 - * - - - - - - 》 reloadDown : 刷行下行树  
12 - */  
13 -  
14 -var StationTreeData = function(){  
15 -  
16 - function parmasObj() {  
17 -  
18 - AddStationObj.setAddStation({});  
19 -  
20 - EditStationObj.setEditStation({});  
21 -  
22 - EditSectionObj.setEitdSection({});  
23 -  
24 - }  
25 -  
26 - function TreeOnclickEvent(nodes) {  
27 - if(nodes == null || nodes.length < 1) {  
28 - return;  
29 - }  
30 -  
31 - var original = nodes[0].original, type = original.type;  
32 -  
33 - if (type == "section") {  
34 - WorldsBMap.focusSection(original.cdata.id);  
35 - } else if(type == "station") {  
36 - WorldsBMap.openStationRouteInfoWin(original.cdata);  
37 - } else if(type == "addSection") {  
38 - WorldsBMap.addSection(original.cdata);  
39 - }  
40 - }  
41 - var stationTree = {  
42 - format: function(routes) {  
43 - var sectionRoutes = this.formatSectionRoutes(routes.sectionRoutes, 'section-routes');  
44 - if (sectionRoutes.length == 0) {  
45 - sectionRoutes = [{id: 0, pId: -1, name: '添加路段', text: '添加路段', groupType: 3, enable : true, type: 'addSection'}];  
46 - }  
47 - return {  
48 - groupType: 1,  
49 - enable: true,  
50 - name: '站点与路段',  
51 - id: 'root',  
52 - text: '站点与路段',  
53 - children: [{  
54 - groupType: 2,  
55 - enable: true,  
56 - name: '站点',  
57 - id: 'station-routes',  
58 - pid: 'root',  
59 - text: '站点',  
60 - children: this.formatStationRoutes(routes.stationRoutes, 'station-routes')  
61 - }, {  
62 - groupType: 2,  
63 - enable: true,  
64 - name: '路段',  
65 - id: 'section-routes',  
66 - pid: 'root',  
67 - text: '路段',  
68 - children: sectionRoutes  
69 - }]};  
70 - },  
71 - formatStationRoutes: function(stationRoutes, pid) {  
72 - var result = new Array(), i = 0;  
73 - for (;i < stationRoutes.length;i++) {  
74 - var stationRoute = stationRoutes[i];  
75 - result.push({  
76 - groupType: 3,  
77 - enable: true,  
78 - id: stationRoute.id,  
79 - pid: pid,  
80 - text: stationRoute.stationName,  
81 - type: 'station',  
82 - cdata: stationRoute  
83 - })  
84 - }  
85 -  
86 - return result;  
87 - },  
88 - formatSectionRoutes: function(sectionRoutes, pid) {  
89 - var result = new Array(), i = 0;  
90 - for (;i < sectionRoutes.length;i++) {  
91 - var sectionRoute = sectionRoutes[i];  
92 - result.push({  
93 - groupType: 3,  
94 - enable: true,  
95 - id: sectionRoute.id,  
96 - pid: pid,  
97 - text: sectionRoute.section.sectionName,  
98 - type: 'section',  
99 - cdata: sectionRoute  
100 - })  
101 - }  
102 -  
103 - return result;  
104 - },  
105 - upInit : function(routes) {  
106 - // 如果不为空  
107 - if(routes) {  
108 - // 加载树load事件  
109 - $('#station_Up_tree').on('loaded.jstree', function(e, data){  
110 - // 展开树  
111 - $.jstree.reference("#station_Up_tree").open_all();  
112 - }).jstree({  
113 - 'core' : {  
114 - 'themes' : {  
115 - 'responsive': false  
116 - },  
117 -  
118 - 'data': this.format(routes),  
119 -  
120 - 'multiple':false  
121 -  
122 - },  
123 -  
124 - 'types' : {  
125 -  
126 - "default" : {  
127 -  
128 - "icon" : false  
129 -  
130 - },  
131 -  
132 - 'enable_true' : {  
133 -  
134 - "icon" : 'fa fa-check icon-lg'  
135 -  
136 - },  
137 -  
138 - 'enable_false' : {  
139 -  
140 - 'icon' : 'fa fa-close icon-lg'  
141 -  
142 - },  
143 -  
144 - 'group':{  
145 -  
146 - 'icon' : 'fa fa-object-group icon-lg'  
147 -  
148 - }  
149 - },  
150 -  
151 - 'plugins': ['types']  
152 -  
153 - // 树节点单击事件  
154 - }).bind('click.jstree', function(event) {  
155 - // 获取上行选中树节点  
156 - var nodes = $.jstree.reference("#station_Up_tree").get_selected(true);  
157 - TreeOnclickEvent(nodes);  
158 - });  
159 - }  
160 - },  
161 - downInit : function(routes) {  
162 - // 如果不为空  
163 - if(routes) {  
164 - // 树初始化load事件  
165 - $('#station_Down_tree').on('loaded.jstree', function(e, data){  
166 - // 展开树  
167 - $.jstree.reference("#station_Down_tree").open_all();  
168 - }).jstree({  
169 - 'core' : {  
170 - 'themes' : {  
171 -  
172 - 'responsive': false  
173 -  
174 - },  
175 -  
176 - 'data': this.format(routes),  
177 -  
178 - 'multiple':false  
179 -  
180 - },  
181 -  
182 - 'types' : {  
183 -  
184 - "default" : {  
185 -  
186 - "icon" : false  
187 -  
188 - },  
189 -  
190 - 'enable_true' : {  
191 -  
192 - "icon" : 'fa fa-check icon-lg'  
193 -  
194 - },  
195 -  
196 - 'enable_false' : {  
197 -  
198 - 'icon' : 'fa fa-close icon-lg'  
199 -  
200 - },  
201 -  
202 - 'group':{  
203 -  
204 - 'icon' : 'fa fa-object-group icon-lg'  
205 -  
206 - }  
207 - },  
208 - 'plugins': ['types']  
209 - // 树节点单击事件  
210 - }).bind('click.jstree', function(event) {  
211 - // 获取下行选中树节点  
212 - var treeOjb = $.jstree.reference("#station_Down_tree").get_selected(true);  
213 - TreeOnclickEvent(treeOjb);  
214 - });  
215 - }  
216 - },  
217 - inoutInit : function(treeDateJson) {  
218 - // 如果不为空  
219 - if(treeDateJson) {  
220 - // 树初始化load事件  
221 - $('#inout_carpark_tree').on('loaded.jstree', function(e, data){  
222 - // 展开树  
223 - $.jstree.reference("#inout_carpark_tree").open_all();  
224 - }).jstree({  
225 - 'core' : {  
226 - 'themes' : {  
227 - 'responsive': false  
228 - },  
229 - 'data': treeDateJson,  
230 - 'multiple':false  
231 - },  
232 - 'types' : {  
233 - "default" : {  
234 - "icon" : false  
235 - },  
236 - 'enable_true' : {  
237 - "icon" : 'fa fa-check icon-lg'  
238 - },  
239 - 'enable_false' : {  
240 - 'icon' : 'fa fa-close icon-lg'  
241 - },  
242 - 'group':{  
243 - 'icon' : 'fa fa-object-group icon-lg'  
244 - }  
245 - },  
246 - 'plugins': ['types']  
247 - // 树节点单击事件  
248 - }).bind('click.jstree', function(event) {  
249 - // 获取下行选中树节点  
250 - var treeOjb = $.jstree.reference("#inout_carpark_tree").get_selected(true);  
251 - TreeOnclickEvent(treeOjb);  
252 - });  
253 - }  
254 - },  
255 - reloadUp : function (routes) {  
256 - // 获取上行树  
257 - var tree = $.jstree.reference('#station_Up_tree');  
258 - // 赋值数据  
259 - tree.settings.core.data = this.format(routes);  
260 - // 刷新上行树  
261 - tree.refresh();  
262 - // 展开树  
263 - setTimeout(function () {  
264 - tree.open_all();  
265 - },500);  
266 - },  
267 - reloadDown : function (routes) {  
268 - // 获取下行树  
269 - var tree = $.jstree.reference('#station_Down_tree');  
270 - // 赋值数据  
271 - tree.settings.core.data = this.format(routes);  
272 - // 刷行下行树  
273 - tree.refresh();  
274 - // 展开树  
275 - setTimeout(function () {  
276 - tree.open_all();  
277 - },500);  
278 - },  
279 - inoutreloadeTree : function (treeDateJson) {  
280 - // 获取下行树  
281 - var tree = $.jstree.reference('#inout_carpark_tree');  
282 - // 赋值数据  
283 - tree.settings.core.data = treeDateJson;  
284 - // 刷行下行树  
285 - tree.refresh();  
286 - // 展开树  
287 - setTimeout(function () {  
288 - tree.open_all();  
289 - },500);  
290 - }  
291 - }  
292 -  
293 - return stationTree;  
294 -  
295 -}();  
296 \ No newline at end of file 0 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/list.html
@@ -308,30 +308,9 @@ @@ -308,30 +308,9 @@
308 </div> 308 </div>
309 </div> 309 </div>
310 </div> 310 </div>
311 -<!-- 线路类 -->  
312 -<script src="/pages/base/stationroute/js/line.js"></script>  
313 -<!-- 新增站点对象类 -->  
314 -<script src="/pages/base/stationroute/js/addstationobj.js"></script>  
315 -<!-- 修改站点对象类 -->  
316 -<script src="/pages/base/stationroute/js/editstationobj.js"></script>  
317 -<!-- 修改路段对象类 -->  
318 -<script src="/pages/base/stationroute/js/editsection.js"></script>  
319 -<!-- 批量撤销对象类 -->  
320 -<script src="/pages/base/stationroute/js/deletebatch.js"></script>  
321 -<!-- 绘图类 -->  
322 -<script src="/pages/base/stationroute/js/drawingManager.js"></script>  
323 -<!-- 地图类 -->  
324 -<script src="/pages/base/stationroute/js/stationroute-list-map.js"></script>  
325 -<!-- 函数与方法 -->  
326 -<script src="/pages/base/stationroute/js/stationroute-list-function.js"></script>  
327 -<!-- ajax请求类 -->  
328 -<script src="/pages/base/stationroute/js/stationroute-ajax-getdata.js"></script>  
329 -<!-- 树对类 -->  
330 -<script src="/pages/base/stationroute/js/stationroute-list-treedata.js"></script>  
331 -<!-- reload事件 -->  
332 -<script src="/pages/base/stationroute/js/stationroute-list-reload.js"></script>  
333 -<!-- 事件监听 -->  
334 -<script src="/pages/base/stationroute/js/stationroute-list-events.js"></script> 311 +<script src="/pages/base/stationroute/js/routes-operation.js"></script>
  312 +<script src="/pages/base/stationroute/js/routes-service.js"></script>
  313 +
335 314
336 <script id="add_draw_polyline-temp" type="text/html"> 315 <script id="add_draw_polyline-temp" type="text/html">
337 <div class="add_road_search_point_wrap "> 316 <div class="add_road_search_point_wrap ">
@@ -387,79 +366,80 @@ @@ -387,79 +366,80 @@
387 </div> 366 </div>
388 </div> 367 </div>
389 </script> 368 </script>
390 -  
391 <script type="text/javascript"> 369 <script type="text/javascript">
392 - setTimeout(function () {  
393 - // 百度地图API功能  
394 - function G(id) {  
395 - return document.getElementById(id);  
396 - }  
397 -  
398 - var myMap = WorldsBMap.getmapBValue(); 370 + var proxy = EventProxy.create('routes-operation-loaded', 'routes-service-loaded', function() {
  371 + RoutesOperation.initPage();
  372 + RoutesOperation.initMap();
  373 + RoutesOperation.initStationDrawingManager();
399 374
400 - var ac = new BMap.Autocomplete({"input": "searchInput" ,"location": myMap}); 375 + // 百度地图API功能
  376 + function G(id) {
  377 + return document.getElementById(id);
  378 + }
  379 + var baiduMap = RoutesOperation.getBaiduMap();
  380 + var ac = new BMap.Autocomplete({"input": "searchInput" ,"location": baiduMap});
401 381
402 - ac.addEventListener("onhighlight", function(e) { //鼠标放在下拉列表上的事件  
403 - var str = "";  
404 - var _value = e.fromitem.value;  
405 - var value = "";  
406 - if (e.fromitem.index > -1) {  
407 - value = _value.province + _value.city + _value.district + _value.street + _value.business;  
408 - }  
409 - str = "FromItem<br />index = " + e.fromitem.index + "<br />value = " + value; 382 + ac.addEventListener("onhighlight", function(e) { //鼠标放在下拉列表上的事件
  383 + var str = "";
  384 + var _value = e.fromitem.value;
  385 + var value = "";
  386 + if (e.fromitem.index > -1) {
  387 + value = _value.province + _value.city + _value.district + _value.street + _value.business;
  388 + }
  389 + str = "FromItem<br />index = " + e.fromitem.index + "<br />value = " + value;
410 390
411 - value = "";  
412 - if (e.toitem.index > -1) {  
413 - _value = e.toitem.value;  
414 - value = _value.province + _value.city + _value.district + _value.street + _value.business;  
415 - }  
416 - str += "<br />ToItem<br />index = " + e.toitem.index + "<br />value = " + value;  
417 - G("searchResultPanel").innerHTML = str;  
418 - }); 391 + value = "";
  392 + if (e.toitem.index > -1) {
  393 + _value = e.toitem.value;
  394 + value = _value.province + _value.city + _value.district + _value.street + _value.business;
  395 + }
  396 + str += "<br />ToItem<br />index = " + e.toitem.index + "<br />value = " + value;
  397 + G("searchResultPanel").innerHTML = str;
  398 + });
419 399
420 - var myValue;  
421 - ac.addEventListener("onconfirm", function(e) { //鼠标点击下拉列表后的事件  
422 - var _value = e.item.value;  
423 - myValue = _value.province + _value.city + _value.district + _value.street + _value.business;  
424 - G("searchResultPanel").innerHTML ="onconfirm<br />index = " + e.item.index + "<br />myValue = " + myValue; 400 + var myValue;
  401 + ac.addEventListener("onconfirm", function(e) { //鼠标点击下拉列表后的事件
  402 + var _value = e.item.value;
  403 + myValue = _value.province + _value.city + _value.district + _value.street + _value.business;
  404 + G("searchResultPanel").innerHTML ="onconfirm<br />index = " + e.item.index + "<br />myValue = " + myValue;
425 405
426 - setPlace();  
427 - }); 406 + setPlace();
  407 + });
428 408
429 - function setPlace(){  
430 - // myMap.clearOverlays(); //清除地图上所有覆盖物  
431 - var local = new BMap.LocalSearch(myMap, { //智能搜索  
432 - onSearchComplete: myFun  
433 - });  
434 - function myFun(){  
435 - var pp = local.getResults().getPoi(0) == undefined? null:local.getResults().getPoi(0).point;  
436 - if(pp) {  
437 - myMap.centerAndZoom(pp, 20);  
438 - myMap.addOverlay(new BMap.Marker(pp)); //添加标注  
439 - } else {  
440 - layer.msg('找不到您输入的位置!')  
441 - }  
442 - }  
443 - local.search(myValue);  
444 - }  
445 - $("#searchInput").on('input propertychange change', function () {  
446 - if($("#searchInput").val() != null && $("#searchInput").val() != "")  
447 - $('.search_panel .clear').removeClass('hide');  
448 - else {  
449 - // WorldsBMap.clearOtherOverlay();  
450 - $('.search_panel .clear').addClass('hide');  
451 - }  
452 - }); 409 + function setPlace(){
  410 + // myMap.clearOverlays(); //清除地图上所有覆盖物
  411 + var local = new BMap.LocalSearch(myMap, { //智能搜索
  412 + onSearchComplete: myFun
  413 + });
  414 + function myFun(){
  415 + var pp = local.getResults().getPoi(0) == undefined? null:local.getResults().getPoi(0).point;
  416 + if(pp) {
  417 + myMap.centerAndZoom(pp, 20);
  418 + myMap.addOverlay(new BMap.Marker(pp)); //添加标注
  419 + } else {
  420 + layer.msg('找不到您输入的位置!')
  421 + }
  422 + }
  423 + local.search(myValue);
  424 + }
  425 + $("#searchInput").on('input propertychange change', function () {
  426 + if($("#searchInput").val() != null && $("#searchInput").val() != "")
  427 + $('.search_panel .clear').removeClass('hide');
  428 + else {
  429 + // WorldsBMap.clearOtherOverlay();
  430 + $('.search_panel .clear').addClass('hide');
  431 + }
  432 + });
453 433
454 - $('.search_panel .clear').on('click',function () {  
455 - // WorldsBMap.clearOtherOverlay();  
456 - $("#searchInput").val('');  
457 - $("#searchInput").change();  
458 - });  
459 - $('.search_panel .search_button').on('click',function () {  
460 - myValue = $("#searchInput").val();  
461 - setPlace();  
462 - }); 434 + $('.search_panel .clear').on('click',function () {
  435 + // WorldsBMap.clearOtherOverlay();
  436 + $("#searchInput").val('');
  437 + $("#searchInput").change();
  438 + });
  439 + $('.search_panel .search_button').on('click',function () {
  440 + myValue = $("#searchInput").val();
  441 + setPlace();
  442 + });
463 443
464 $('#historyGps').on('click', function() { 444 $('#historyGps').on('click', function() {
465 $.get('/pages/base/stationroute/list_template.html', function (content) { 445 $.get('/pages/base/stationroute/list_template.html', function (content) {
@@ -476,5 +456,5 @@ @@ -476,5 +456,5 @@
476 }); 456 });
477 }); 457 });
478 }); 458 });
479 - },1000); 459 + });
480 </script> 460 </script>
481 \ No newline at end of file 461 \ No newline at end of file
src/main/resources/static/pages/base/stationroute/tzzj.html
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 <div class="modal-body"> 9 <div class="modal-body">
10 <form class="form-horizontal" action="/" method="post" id="tzbcForm" role="form"> 10 <form class="form-horizontal" action="/" method="post" id="tzbcForm" role="form">
11 <!-- alert-danger 组件START --> 11 <!-- alert-danger 组件START -->
12 - <div class="alert alert-danger display-hide" id="tzbcAlert"> 12 + <div class="alert alert-danger display-hide" id="error">
13 <button class="close" data-close="alert"></button> 13 <button class="close" data-close="alert"></button>
14 您的输入有误,请检查下面的输入项 14 您的输入有误,请检查下面的输入项
15 </div> 15 </div>
@@ -47,10 +47,10 @@ @@ -47,10 +47,10 @@
47 </td> 47 </td>
48 <td> 48 <td>
49 <!-- <input type="text" readonly class="form-control form-filter input-sm" name="station_{{i+1}}" value="{{obj.name}}">--> 49 <!-- <input type="text" readonly class="form-control form-filter input-sm" name="station_{{i+1}}" value="{{obj.name}}">-->
50 - {{obj.stationRouteName}} 50 + {{obj.stationName}}
51 </td> 51 </td>
52 <td> 52 <td>
53 - <input type="text" class="form-control form-filter input-sm" name="dis_{{obj.stationRouteId}}" value="{{obj.stationRouteDistances * 1000}}"> 53 + <input type="text" class="form-control form-filter input-sm" name="dis_{{obj.id}}" value="{{obj.distances * 1000}}">
54 </td> 54 </td>
55 </tr> 55 </tr>
56 {{/each}} 56 {{/each}}
@@ -61,23 +61,21 @@ @@ -61,23 +61,21 @@
61 {{/if}} 61 {{/if}}
62 </script> 62 </script>
63 <script type="text/javascript"> 63 <script type="text/javascript">
64 -$('#tzzj_mobal').on('tzzjMobal.show', function(e,map,gd,dir,lineid,pf,rd){ 64 +$('#tzzj_mobal').on('modal.show', function(event, stationRoutes){
  65 + var properties = RoutesOperation.getProperties();
65 setTimeout(function(){ 66 setTimeout(function(){
66 // 加载延迟200毫秒显示mobal 67 // 加载延迟200毫秒显示mobal
67 $('#tzzj_mobal').modal({show : true,backdrop: 'static', keyboard: false}); 68 $('#tzzj_mobal').modal({show : true,backdrop: 'static', keyboard: false});
68 },200); 69 },200);
69 // 当模态框对用户可见时触发(将等待 CSS 过渡效果完成)。 70 // 当模态框对用户可见时触发(将等待 CSS 过渡效果完成)。
70 $('#tzzj_mobal').on('show.bs.modal', function () { 71 $('#tzzj_mobal').on('show.bs.modal', function () {
71 - console.log(rd);  
72 - // 把数据填充到模版中  
73 - var tbodyHtml = template('tzzj_temp',{list:rd});  
74 - // 把渲染好的模版html文本追加到表格中 72 + var tbodyHtml = template('tzzj_temp', {list: stationRoutes});
75 $('#datatable_bctz tbody').html(tbodyHtml); 73 $('#datatable_bctz tbody').html(tbodyHtml);
76 }); 74 });
77 // 获取表单元素 75 // 获取表单元素
78 var form = $('#tzbcForm'); 76 var form = $('#tzbcForm');
79 // 错误提示元素 77 // 错误提示元素
80 - var tzbcAlert = $('#tzbcAlert', form); 78 + var error = $('#error', form);
81 // 下一步点击事件 79 // 下一步点击事件
82 $('#tzbcnext').on('click', function() { 80 $('#tzbcnext').on('click', function() {
83 form.submit();// 表单提交 81 form.submit();// 表单提交
@@ -90,7 +88,7 @@ $(&#39;#tzzj_mobal&#39;).on(&#39;tzzjMobal.show&#39;, function(e,map,gd,dir,lineid,pf,rd){ @@ -90,7 +88,7 @@ $(&#39;#tzzj_mobal&#39;).on(&#39;tzzjMobal.show&#39;, function(e,map,gd,dir,lineid,pf,rd){
90 rules : { 88 rules : {
91 }, 89 },
92 invalidHandler : function(event, validator) { 90 invalidHandler : function(event, validator) {
93 - tzbcAlert.show(); 91 + error.show();
94 App.scrollTo(reladplusname, -200); 92 App.scrollTo(reladplusname, -200);
95 }, 93 },
96 highlight : function(element) { 94 highlight : function(element) {
@@ -103,26 +101,15 @@ $(&#39;#tzzj_mobal&#39;).on(&#39;tzzjMobal.show&#39;, function(e,map,gd,dir,lineid,pf,rd){ @@ -103,26 +101,15 @@ $(&#39;#tzzj_mobal&#39;).on(&#39;tzzjMobal.show&#39;, function(e,map,gd,dir,lineid,pf,rd){
103 label.closest('.form-group').removeClass('has-error'); 101 label.closest('.form-group').removeClass('has-error');
104 }, 102 },
105 submitHandler : function(f) { 103 submitHandler : function(f) {
106 - // 获取表单内容,并序列化  
107 var params = form.serializeJSON(); 104 var params = form.serializeJSON();
108 $post('/api/lsstationroute/modifyDistance', params, function(data) { 105 $post('/api/lsstationroute/modifyDistance', params, function(data) {
109 - // 隐藏错误提示  
110 - tzbcAlert.hide();  
111 - // 隐藏 reladplus_mobal 弹出层 106 + error.hide();
112 $('#tzzj_mobal').modal('hide'); 107 $('#tzzj_mobal').modal('hide');
113 if(data.status=='SUCCESS') { 108 if(data.status=='SUCCESS') {
114 - // 弹出添加成功提示消息  
115 layer.msg('修改成功...'); 109 layer.msg('修改成功...');
116 - map.clearMarkAndOverlays();  
117 - // 刷新左边树  
118 - pf.resjtreeDate(lineid,dir,$("#versions").val());  
119 - /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */  
120 - //gd.getSectionRouteInfo(lineid,dir,function(data) {  
121 - // /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */  
122 - // pf.linePanlThree(lineid,data,dir);  
123 - //}); 110 + RoutesOperation.clearMarkAndOverlays();
  111 + RoutesOperation.resjtreeDate(properties.lineId, properties.directions, properties.versions);
124 }else { 112 }else {
125 - // 弹出添加失败提示消息  
126 layer.msg('修改失败...'); 113 layer.msg('修改失败...');
127 } 114 }
128 }); 115 });