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