Commit 6df5f7abf976b899aca9af4f8cd5292def3d70aa
1 parent
52c81885
1.
Showing
18 changed files
with
479 additions
and
396 deletions
src/main/java/com/bsth/controller/SectionController.java
| ... | ... | @@ -51,7 +51,7 @@ public class SectionController extends BaseController<Section, Integer> { |
| 51 | 51 | * |
| 52 | 52 | * @return int <sectionCode路段编码> |
| 53 | 53 | */ |
| 54 | - @RequestMapping(value="getSectionCode" , method = RequestMethod.GET) | |
| 54 | + @RequestMapping(value="getSectionCode", method = RequestMethod.GET) | |
| 55 | 55 | public long getSectionCode() { |
| 56 | 56 | return sectionRepository.findLatestSectionId() + 1; |
| 57 | 57 | } |
| ... | ... | @@ -61,12 +61,12 @@ public class SectionController extends BaseController<Section, Integer> { |
| 61 | 61 | * |
| 62 | 62 | * @return int <sectionCode路段编码> |
| 63 | 63 | */ |
| 64 | - @RequestMapping(value="doubleName" , method = RequestMethod.POST) | |
| 64 | + @RequestMapping(value="doubleName", method = RequestMethod.POST) | |
| 65 | 65 | public Map<String, Object> doubleName(@RequestParam Map<String, Object> map) { |
| 66 | 66 | return sectionService.doubleName(map); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - @RequestMapping(value="add" , method = RequestMethod.POST) | |
| 69 | + @RequestMapping(value="add", method = RequestMethod.POST) | |
| 70 | 70 | public Map<String, Object> add(Section section) { |
| 71 | 71 | Map<String, Object> result = new HashMap<>(); |
| 72 | 72 | try { |
| ... | ... | @@ -80,7 +80,7 @@ public class SectionController extends BaseController<Section, Integer> { |
| 80 | 80 | return result; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - @RequestMapping(value="modify" , method = RequestMethod.POST) | |
| 83 | + @RequestMapping(value="modify", method = RequestMethod.POST) | |
| 84 | 84 | public Map<String, Object> modify(Section section) { |
| 85 | 85 | Map<String, Object> result = new HashMap<>(); |
| 86 | 86 | try { |
| ... | ... | @@ -94,13 +94,36 @@ public class SectionController extends BaseController<Section, Integer> { |
| 94 | 94 | return result; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | + @RequestMapping(value="findDistinctSectionName", method = RequestMethod.GET) | |
| 98 | + public Map<String, Object> findDistinctSectionName() { | |
| 99 | + Map<String, Object> result = new HashMap<>(); | |
| 100 | + try { | |
| 101 | + result.put("data", sectionService.findDistinctSectionName()); | |
| 102 | + result.put("status", ResponseCode.SUCCESS); | |
| 103 | + } catch (Exception e) { | |
| 104 | + result.put("status", ResponseCode.ERROR); | |
| 105 | + log.error("", e); | |
| 106 | + } | |
| 107 | + | |
| 108 | + return result; | |
| 109 | + } | |
| 110 | + | |
| 97 | 111 | /** |
| 98 | - * 根据路段名模糊搜索路段信息 | |
| 112 | + * 根据路段名搜索路段信息 | |
| 99 | 113 | * @param sectionName |
| 100 | 114 | * @return 站点列表 |
| 101 | 115 | */ |
| 102 | 116 | @RequestMapping(value="findSectionByName" , method = RequestMethod.GET) |
| 103 | - public List<Section> findSectionByName(String sectionName) { | |
| 104 | - return sectionService.findSectionByName(sectionName); | |
| 117 | + public Map<String, Object> findSectionByName(String sectionName) { | |
| 118 | + Map<String, Object> result = new HashMap<>(); | |
| 119 | + try { | |
| 120 | + result.put("data", sectionService.findSectionByName(sectionName)); | |
| 121 | + result.put("status", ResponseCode.SUCCESS); | |
| 122 | + } catch (Exception e) { | |
| 123 | + result.put("status", ResponseCode.ERROR); | |
| 124 | + log.error("", e); | |
| 125 | + } | |
| 126 | + | |
| 127 | + return result; | |
| 105 | 128 | } |
| 106 | 129 | } | ... | ... |
src/main/java/com/bsth/controller/realcontrol/AdminUtilsController.java
| ... | ... | @@ -8,6 +8,7 @@ import java.util.*; |
| 8 | 8 | import com.bsth.common.Setting; |
| 9 | 9 | import com.bsth.data.BasicData; |
| 10 | 10 | import com.bsth.security.SsoConfig; |
| 11 | +import com.bsth.service.SectionService; | |
| 11 | 12 | import com.bsth.service.schedule.utils.SpringUtils; |
| 12 | 13 | import com.bsth.util.MailUtils; |
| 13 | 14 | import com.fasterxml.jackson.core.JsonProcessingException; |
| ... | ... | @@ -77,6 +78,9 @@ public class AdminUtilsController { |
| 77 | 78 | @Autowired |
| 78 | 79 | private SsoConfig ssoConfig; |
| 79 | 80 | |
| 81 | + @Autowired | |
| 82 | + private SectionService sectionService; | |
| 83 | + | |
| 80 | 84 | /** |
| 81 | 85 | * 出现重复班次的车辆 |
| 82 | 86 | * |
| ... | ... | @@ -369,4 +373,17 @@ public class AdminUtilsController { |
| 369 | 373 | |
| 370 | 374 | return "error"; |
| 371 | 375 | } |
| 376 | + | |
| 377 | + @RequestMapping("/section/translateWgs2Bd") | |
| 378 | + public String translateWgs2Bd() { | |
| 379 | + Map<String, Object> result = new HashMap<>(); | |
| 380 | + try { | |
| 381 | + sectionService.translateWgs2Bd(); | |
| 382 | + return "success"; | |
| 383 | + } catch (Exception e) { | |
| 384 | + e.printStackTrace(); | |
| 385 | + } | |
| 386 | + | |
| 387 | + return "error"; | |
| 388 | + } | |
| 372 | 389 | } |
| 373 | 390 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/service/SectionService.java
| ... | ... | @@ -37,9 +37,20 @@ public interface SectionService extends BaseService<Section, Integer> { |
| 37 | 37 | void modify(Section section); |
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | - * 根据路段名模糊检索路段信息 | |
| 40 | + * 获取所有不重名的道路名称 | |
| 41 | + * @return | |
| 42 | + */ | |
| 43 | + List<String> findDistinctSectionName(); | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * 根据路段名检索路段信息 | |
| 41 | 47 | * @param sectionName |
| 42 | 48 | * @return |
| 43 | 49 | */ |
| 44 | 50 | List<Section> findSectionByName(String sectionName); |
| 51 | + | |
| 52 | + /** | |
| 53 | + * 将路段的WGS坐标数据转换到百度坐标并保存 | |
| 54 | + */ | |
| 55 | + void translateWgs2Bd(); | |
| 45 | 56 | } | ... | ... |
src/main/java/com/bsth/service/impl/SectionServiceImpl.java
| ... | ... | @@ -14,12 +14,15 @@ import com.bsth.util.RoadCutDoubleName; |
| 14 | 14 | import org.geolatte.geom.LineString; |
| 15 | 15 | import org.geolatte.geom.codec.Wkt; |
| 16 | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| 17 | +import org.springframework.jdbc.core.BatchPreparedStatementSetter; | |
| 17 | 18 | import org.springframework.jdbc.core.BeanPropertyRowMapper; |
| 18 | 19 | import org.springframework.jdbc.core.JdbcTemplate; |
| 19 | 20 | import org.springframework.stereotype.Service; |
| 20 | 21 | import org.springframework.transaction.annotation.Transactional; |
| 21 | 22 | import org.springframework.util.StringUtils; |
| 22 | 23 | |
| 24 | +import java.sql.PreparedStatement; | |
| 25 | +import java.sql.SQLException; | |
| 23 | 26 | import java.text.SimpleDateFormat; |
| 24 | 27 | import java.util.*; |
| 25 | 28 | |
| ... | ... | @@ -204,11 +207,37 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem |
| 204 | 207 | } |
| 205 | 208 | |
| 206 | 209 | @Override |
| 210 | + public List<String> findDistinctSectionName() { | |
| 211 | + String query = "SELECT DISTINCT section_name FROM bsth_c_section WHERE id > 1000000"; | |
| 212 | + return jdbcTemplate.queryForList(query, String.class); | |
| 213 | + } | |
| 214 | + | |
| 215 | + @Override | |
| 207 | 216 | public List<Section> findSectionByName(String sectionName) { |
| 208 | - String query = "SELECT id,section_code,section_name,ST_AsText(bsection_vector) bsection_vector_wkt,ew_direction,sn_direction FROM bsth_c_section WHERE section_name LIKE CONCAT(?,'%')"; | |
| 217 | + String query = "SELECT id,section_code,section_name,croses_road,ST_AsText(bsection_vector) bsection_vector_wkt,ew_direction,sn_direction FROM bsth_c_section WHERE id > 1000000 AND section_name = ?"; | |
| 209 | 218 | return jdbcTemplate.query(query, new Object[]{ sectionName }, BeanPropertyRowMapper.newInstance(Section.class)); |
| 210 | 219 | } |
| 211 | 220 | |
| 221 | + @Override | |
| 222 | + public void translateWgs2Bd() { | |
| 223 | + String query = "SELECT id, ST_AsText(gsection_vector) gsection_vector_wkt FROM bsth_c_section"; | |
| 224 | + List<Section> sections = jdbcTemplate.query(query, BeanPropertyRowMapper.newInstance(Section.class)); | |
| 225 | + List<Section> sections1 = new ArrayList<>(); | |
| 226 | + SectionBatchPreparedStatementSetter preparedStatementSetter = new SectionBatchPreparedStatementSetter(); | |
| 227 | + preparedStatementSetter.setSections(sections1); | |
| 228 | + for (int i = 0;i < sections.size();i++) { | |
| 229 | + sections1.add(sections.get(i)); | |
| 230 | + if (i != 0 && i % 2000 == 0) { | |
| 231 | + jdbcTemplate.batchUpdate("UPDATE bsth_c_section SET bsection_vector = ST_GeomFromText(?) WHERE id = ?", preparedStatementSetter); | |
| 232 | + sections1.clear(); | |
| 233 | + } | |
| 234 | + } | |
| 235 | + if (sections1.size() > 0) { | |
| 236 | + jdbcTemplate.batchUpdate("UPDATE bsth_c_section SET bsection_vector = ST_GeomFromText(?) WHERE id = ?", preparedStatementSetter); | |
| 237 | + sections1.clear(); | |
| 238 | + } | |
| 239 | + } | |
| 240 | + | |
| 212 | 241 | /** 百度坐标转WGS坐标 */ |
| 213 | 242 | public Location FromBDPointToWGSPoint(String bLonx,String bLatx) { |
| 214 | 243 | |
| ... | ... | @@ -240,4 +269,29 @@ public class SectionServiceImpl extends BaseServiceImpl<Section, Integer> implem |
| 240 | 269 | section.setGsectionVector(wgs); |
| 241 | 270 | } |
| 242 | 271 | } |
| 272 | + | |
| 273 | + final static class SectionBatchPreparedStatementSetter implements BatchPreparedStatementSetter { | |
| 274 | + | |
| 275 | + private List<Section> sections; | |
| 276 | + | |
| 277 | + @Override | |
| 278 | + public void setValues(PreparedStatement ps, int i) throws SQLException { | |
| 279 | + Section section = sections.get(i); | |
| 280 | + ps.setString(1, GeoConverter.lineStringWgs2bd(section.getGsectionVectorWkt()).toString()); | |
| 281 | + ps.setInt(2, section.getId()); | |
| 282 | + } | |
| 283 | + | |
| 284 | + @Override | |
| 285 | + public int getBatchSize() { | |
| 286 | + return sections.size(); | |
| 287 | + } | |
| 288 | + | |
| 289 | + public List<Section> getSections() { | |
| 290 | + return sections; | |
| 291 | + } | |
| 292 | + | |
| 293 | + public void setSections(List<Section> sections) { | |
| 294 | + this.sections = sections; | |
| 295 | + } | |
| 296 | + } | |
| 243 | 297 | } |
| 244 | 298 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/section/css/positions.css
| 1 | -#sectionPbmap_basic{ | |
| 2 | - min-width: 100%; | |
| 3 | - width: calc(100% + 26px); | |
| 4 | - margin-top: -28px; | |
| 5 | - border: 2px solid #fdfdfd; | |
| 6 | - min-height: 1200px; | |
| 7 | - height:100%; | |
| 8 | - overflow: hidden; | |
| 9 | -} | |
| 10 | - | |
| 11 | -html,body{ | |
| 12 | - overflow:hidden; | |
| 13 | -} | |
| 14 | - | |
| 15 | -/* 隐藏百度地图logo */ | |
| 16 | -.anchorBL, | |
| 17 | -.anchorBL, | |
| 18 | -.amap-logo, | |
| 19 | -.amap-copyright{ | |
| 20 | - display: none; | |
| 21 | -} | |
| 22 | - | |
| 23 | - | |
| 24 | -.leftUtils{ | |
| 25 | - position: absolute; | |
| 26 | - padding-right: 100px; | |
| 27 | - width: 100%; | |
| 28 | - height: 40px; | |
| 29 | - z-index: 9999; | |
| 30 | - padding-top: 7px; | |
| 31 | - top: 20px; | |
| 32 | -} | |
| 33 | - | |
| 34 | -.BMap_pop div:nth-child(1) , | |
| 35 | -.BMap_pop div:nth-child(2) , | |
| 36 | -.BMap_pop div:nth-child(3) , | |
| 37 | -.BMap_pop div:nth-child(4) , | |
| 38 | -.BMap_pop div:nth-child(5) , | |
| 39 | -.BMap_pop div:nth-child(6) , | |
| 40 | -.BMap_pop div:nth-child(7) { | |
| 41 | - | |
| 42 | - border:0px solid rgb(255, 255, 255) !important; | |
| 43 | - background-color:#3B3F51 !important; | |
| 44 | - | |
| 45 | -} | |
| 46 | - | |
| 47 | -.BMap_pop div:nth-child(3){ | |
| 48 | - | |
| 49 | - width:23px !important; | |
| 50 | - | |
| 51 | -} | |
| 52 | - | |
| 53 | -.BMap_pop div:nth-child(7) { | |
| 54 | - | |
| 55 | - width:23px !important; | |
| 56 | - | |
| 57 | - height:24px !important; | |
| 58 | - | |
| 59 | -} | |
| 60 | - | |
| 61 | -.BMap_pop div:nth-child(5) { | |
| 62 | - | |
| 63 | - height:24px !important; | |
| 64 | - | |
| 65 | -} | |
| 66 | - | |
| 67 | -/* 图片以后在弄,先隐藏div */ | |
| 68 | -.BMap_pop div:nth-child(8) { | |
| 69 | - | |
| 70 | - height:0px !important; | |
| 71 | - /* background:url('/pages/base/stationroute/css/img/iw3-1.png') no-repeat !important; */ | |
| 72 | - /* background-image:url('/pages/base/stationroute/css/img/windowinfo_b.jpg') !important; */ | |
| 73 | - | |
| 74 | -} | |
| 75 | - | |
| 76 | -/* 图片以后在弄,先隐藏div */ | |
| 77 | -.BMap_pop img:nth-child(10) { | |
| 78 | - | |
| 79 | - display: none; | |
| 80 | - | |
| 81 | -} | |
| 82 | - | |
| 83 | -.BMap_pop { | |
| 84 | - | |
| 85 | - box-shadow: 0 12px 15px 0 rgba(204, 204, 204, 0.33),0 17px 50px 0 rgba(204, 204, 204, 0.33)!important; | |
| 86 | - | |
| 1 | +.map-container{ | |
| 2 | + min-width: 100%; | |
| 3 | + width: calc(100% + 26px); | |
| 4 | + margin-top: -28px; | |
| 5 | + border: 2px solid #fdfdfd; | |
| 6 | + min-height: 1200px; | |
| 7 | + height:100%; | |
| 8 | + overflow: hidden; | |
| 9 | +} | |
| 10 | + | |
| 11 | +html,body{ | |
| 12 | + overflow:hidden; | |
| 13 | +} | |
| 14 | + | |
| 15 | +/* 隐藏百度地图logo */ | |
| 16 | +.anchorBL, | |
| 17 | +.anchorBL, | |
| 18 | +.amap-logo, | |
| 19 | +.amap-copyright{ | |
| 20 | + display: none; | |
| 21 | +} | |
| 22 | + | |
| 23 | + | |
| 24 | +.leftUtils{ | |
| 25 | + position: absolute; | |
| 26 | + padding-right: 100px; | |
| 27 | + width: 100%; | |
| 28 | + height: 40px; | |
| 29 | + z-index: 9999; | |
| 30 | + padding-top: 7px; | |
| 31 | + top: 20px; | |
| 32 | +} | |
| 33 | + | |
| 34 | +.BMap_pop div:nth-child(1) , | |
| 35 | +.BMap_pop div:nth-child(2) , | |
| 36 | +.BMap_pop div:nth-child(3) , | |
| 37 | +.BMap_pop div:nth-child(4) , | |
| 38 | +.BMap_pop div:nth-child(5) , | |
| 39 | +.BMap_pop div:nth-child(6) , | |
| 40 | +.BMap_pop div:nth-child(7) { | |
| 41 | + | |
| 42 | + border:0px solid rgb(255, 255, 255) !important; | |
| 43 | + background-color:#3B3F51 !important; | |
| 44 | + | |
| 45 | +} | |
| 46 | + | |
| 47 | +.BMap_pop div:nth-child(3){ | |
| 48 | + | |
| 49 | + width:23px !important; | |
| 50 | + | |
| 51 | +} | |
| 52 | + | |
| 53 | +.BMap_pop div:nth-child(7) { | |
| 54 | + | |
| 55 | + width:23px !important; | |
| 56 | + | |
| 57 | + height:24px !important; | |
| 58 | + | |
| 59 | +} | |
| 60 | + | |
| 61 | +.BMap_pop div:nth-child(5) { | |
| 62 | + | |
| 63 | + height:24px !important; | |
| 64 | + | |
| 65 | +} | |
| 66 | + | |
| 67 | +/* 图片以后在弄,先隐藏div */ | |
| 68 | +.BMap_pop div:nth-child(8) { | |
| 69 | + | |
| 70 | + height:0px !important; | |
| 71 | + /* background:url('/pages/base/stationroute/css/img/iw3-1.png') no-repeat !important; */ | |
| 72 | + /* background-image:url('/pages/base/stationroute/css/img/windowinfo_b.jpg') !important; */ | |
| 73 | + | |
| 74 | +} | |
| 75 | + | |
| 76 | +/* 图片以后在弄,先隐藏div */ | |
| 77 | +.BMap_pop img:nth-child(10) { | |
| 78 | + | |
| 79 | + display: none; | |
| 80 | + | |
| 81 | +} | |
| 82 | + | |
| 83 | +.BMap_pop { | |
| 84 | + | |
| 85 | + box-shadow: 0 12px 15px 0 rgba(204, 204, 204, 0.33),0 17px 50px 0 rgba(204, 204, 204, 0.33)!important; | |
| 86 | + | |
| 87 | 87 | } |
| 88 | 88 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/section/editsection.html
| ... | ... | @@ -132,31 +132,16 @@ |
| 132 | 132 | </div> |
| 133 | 133 | </div> |
| 134 | 134 | </div> |
| 135 | -<script type="text/javascript"> | |
| 136 | -$('#edit_section_modal').on('modal.show', function(e, map_,ajaxd,section,fun){ | |
| 137 | - // 获取路段信息. | |
| 138 | - var Section = section.getEitdSection(); | |
| 135 | +<script> | |
| 136 | +$('#edit_section_modal').on('modal.show', function(e, operation, service, section){ | |
| 139 | 137 | // 设值表单字段值. |
| 140 | - fun.setSectionFormValue(Section); | |
| 141 | - // 路段路由ID. | |
| 142 | - var sectionId = Section.id; | |
| 138 | + operation.setSectionFormValue(section); | |
| 143 | 139 | // 显示mobal |
| 144 | 140 | $('#edit_section_modal').modal({show : true,backdrop: 'static',keyboard: false}); |
| 145 | 141 | // 当调用 hide 实例方法时触发 |
| 146 | 142 | $('#edit_section_modal').on('hide.bs.modal', function () { |
| 147 | - closeMobleSetClean(); | |
| 143 | + operation.refreshPolylineData(); | |
| 148 | 144 | }); |
| 149 | - function closeMobleSetClean() { | |
| 150 | - // 清除地图覆盖物 | |
| 151 | - map_.clearMarkAndOverlays(); | |
| 152 | - /** 设置修改路段集合对象为空 */ | |
| 153 | - section.setEitdSection({}); | |
| 154 | - $('.dropdown-toggle').removeClass('disabled'); | |
| 155 | - $('#eidt').removeClass('btn disabled'); | |
| 156 | - $('#eidt').attr("disabled",false); | |
| 157 | - /** 初始化路段信息 @return <id:路段路由ID> */ | |
| 158 | - fun.initSectionInfo(sectionId); | |
| 159 | - } | |
| 160 | 145 | // 编辑表单元素 |
| 161 | 146 | var form = $('#edit_section_form'); |
| 162 | 147 | // 获取错误提示元素 |
| ... | ... | @@ -168,33 +153,31 @@ $('#edit_section_modal').on('modal.show', function(e, map_,ajaxd,section,fun){ |
| 168 | 153 | }); |
| 169 | 154 | // 表单验证 |
| 170 | 155 | form.validate({ |
| 171 | - errorElement : 'span', | |
| 172 | - errorClass : 'help-block help-block-error', | |
| 173 | - focusInvalid : false, | |
| 174 | - rules : { | |
| 175 | - 'sectionName' : {required : true,maxlength:50}, | |
| 176 | - 'sectionCode': {required : true} | |
| 156 | + errorElement: 'span', | |
| 157 | + errorClass: 'help-block help-block-error', | |
| 158 | + focusInvalid: false, | |
| 159 | + rules: { | |
| 160 | + 'sectionName': {required: true,maxlength: 50}, | |
| 161 | + 'sectionCode': {required: true} | |
| 177 | 162 | }, |
| 178 | - invalidHandler : function(event, validator) { | |
| 163 | + invalidHandler: function(event, validator) { | |
| 179 | 164 | error.show(); |
| 180 | 165 | App.scrollTo(error, -200); |
| 181 | 166 | }, |
| 182 | - highlight : function(element) { | |
| 167 | + highlight: function(element) { | |
| 183 | 168 | $(element).closest('.form-group').addClass('has-error'); |
| 184 | 169 | }, |
| 185 | 170 | |
| 186 | - unhighlight : function(element) { | |
| 171 | + unhighlight: function(element) { | |
| 187 | 172 | $(element).closest('.form-group').removeClass('has-error'); |
| 188 | - | |
| 189 | 173 | }, |
| 190 | - success : function(label) { | |
| 174 | + success: function(label) { | |
| 191 | 175 | label.closest('.form-group').removeClass('has-error'); |
| 192 | - | |
| 193 | 176 | }, |
| 194 | - submitHandler : function(f) { | |
| 195 | - var params = form.serializeJSON(); | |
| 177 | + submitHandler: function(f) { | |
| 196 | 178 | error.hide(); |
| 197 | - ajaxd.sectionUpdate(params, function(result) { | |
| 179 | + var params = form.serializeJSON(); | |
| 180 | + service.sectionUpdate(params, function(result) { | |
| 198 | 181 | if (result.status == 'SUCCESS') { |
| 199 | 182 | // 弹出添加成功提示消息 |
| 200 | 183 | layer.msg('修改成功...'); | ... | ... |
src/main/resources/static/pages/base/section/js/section-list-table.js
| ... | ... | @@ -58,6 +58,14 @@ |
| 58 | 58 | $('tr.filter .filter-submit').on('click',function(){ |
| 59 | 59 | initSearch(); |
| 60 | 60 | }); |
| 61 | + $('#positionSections').on('click',function(){ | |
| 62 | + var sectionName = $('input[name=sectionName_like]').val(); | |
| 63 | + if (sectionName) { | |
| 64 | + window.location.href = 'position_sections.html?no=' + sectionName; | |
| 65 | + } else { | |
| 66 | + layer.msg('请输入路段名称'); | |
| 67 | + } | |
| 68 | + }); | |
| 61 | 69 | function initSearch() { |
| 62 | 70 | var params = getParams(); |
| 63 | 71 | page = 0; | ... | ... |
src/main/resources/static/pages/base/section/js/section-operation.js
0 → 100644
| 1 | +var SectionOperation = function () { | |
| 2 | + var map, type = 0, editSection; | |
| 3 | + var operation = { | |
| 4 | + initMap: function() { | |
| 5 | + var CENTER_POINT = {lng: 121.528733,lat: 31.237425}; | |
| 6 | + map = new BMap.Map('map_section'); | |
| 7 | + map.centerAndZoom(new BMap.Point(CENTER_POINT.lng, CENTER_POINT.lat), 15); | |
| 8 | + map.enableDragging(); | |
| 9 | + map.enableScrollWheelZoom(); | |
| 10 | + map.disableDoubleClickZoom(); | |
| 11 | + map.enableKeyboard(); | |
| 12 | + }, | |
| 13 | + initSection: function() { | |
| 14 | + operation.initMap(); | |
| 15 | + type = 0; | |
| 16 | + var sectionId = $.url().param('no'); | |
| 17 | + SectionService.getSectionById(sectionId,function(section) { | |
| 18 | + if (section) { | |
| 19 | + operation.drawSection(section); | |
| 20 | + } | |
| 21 | + }); | |
| 22 | + }, | |
| 23 | + initSections: function () { | |
| 24 | + operation.initMap(); | |
| 25 | + type = 1; | |
| 26 | + var sectionName = $.url().param('no'); | |
| 27 | + if (sectionName) { | |
| 28 | + SectionService.findSectionByName(sectionName, function (sections) { | |
| 29 | + sections.forEach(function(section) { | |
| 30 | + operation.drawSection(section); | |
| 31 | + }) | |
| 32 | + }) | |
| 33 | + } | |
| 34 | + }, | |
| 35 | + initEventBind: function () { | |
| 36 | + $('#backUp').on('click',function() { | |
| 37 | + loadPage('/pages/base/section/list.html'); | |
| 38 | + }); | |
| 39 | + }, | |
| 40 | + setSectionFormValue : function(section) { | |
| 41 | + $('#edit_section_form input,select,textarea').each(function(){ | |
| 42 | + if (this.name) { | |
| 43 | + $(this).val(section[this.name]); | |
| 44 | + } | |
| 45 | + }) | |
| 46 | + }, | |
| 47 | + recoverPolylineColor: function() { | |
| 48 | + var overlays = map.getOverlays(); | |
| 49 | + overlays.forEach(function (overlay) { | |
| 50 | + if (overlay.cdata && overlay.cdata.id) { | |
| 51 | + overlay.setStrokeColor('#5298ff'); | |
| 52 | + } | |
| 53 | + }); | |
| 54 | + }, | |
| 55 | + refreshPolylineData: function () { | |
| 56 | + if (!type) { | |
| 57 | + operation.initSection(); | |
| 58 | + } else { | |
| 59 | + operation.initSections(); | |
| 60 | + } | |
| 61 | + }, | |
| 62 | + drawSection : function(section) { | |
| 63 | + var bsectionVectorWkt = section.bsectionVectorWkt; | |
| 64 | + bsectionVectorWkt = bsectionVectorWkt.substring(11, bsectionVectorWkt.length - 1); | |
| 65 | + var coordinates = bsectionVectorWkt.split(','); | |
| 66 | + var centerPoint, points = new Array(); | |
| 67 | + var clen = coordinates.length, middle = Math.ceil(clen / 2); | |
| 68 | + for(var i = 0;i < clen;i++) { | |
| 69 | + var coordinate = coordinates[i].split(' '); | |
| 70 | + points.push(new BMap.Point(coordinate[0], coordinate[1])); | |
| 71 | + if (i == middle) { | |
| 72 | + centerPoint = new BMap.Point(coordinate[0], coordinate[1]) | |
| 73 | + } | |
| 74 | + } | |
| 75 | + var polyline = new BMap.Polyline(points, {strokeColor : "#5298ff",strokeWeight : 6,strokeOpacity :1,strokeStyle:'solid'}); | |
| 76 | + polyline.cdata = section; | |
| 77 | + map.addOverlay(polyline); | |
| 78 | + var opts = { | |
| 79 | + width: 200, | |
| 80 | + height: 350, | |
| 81 | + offset: new BMap.Size(0, 0), | |
| 82 | + title: '<h4 style="color:#FFFFFF">' + (section.sectionName ? section.sectionName : '') + ' 路段详情</h4>', | |
| 83 | + enableMessage: false, | |
| 84 | + enableCloseOnClick: true, | |
| 85 | + enableAutoPan: true | |
| 86 | + }; | |
| 87 | + var html = new Array(); | |
| 88 | + html.push('<HR style="border:1 dashed #987cb9" width="100%" color=#987cb9 SIZE=1>'); | |
| 89 | + html.push('<span style="color:#DDD;font-size: 15px;">路段名称:');html.push(section.sectionName);html.push('</span>'); | |
| 90 | + html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">路段编码:');html.push(section.sectionCode);html.push('</span>'); | |
| 91 | + html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">交叉路段:');html.push(section.crosesRoad);html.push('</span>'); | |
| 92 | + html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">东西向:');html.push((section.ewDirection === undefined ? '' : section.ewDirection == 0 ? '东->西' : '西->东'));html.push('</span>'); | |
| 93 | + html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">南北向:');html.push((section.snDirection === undefined ? '' : section.snDirection == 0 ? '南->北' : '北->南'));html.push('</span>'); | |
| 94 | + html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">路段限速:');html.push(section.speedLimit);html.push('</span>'); | |
| 95 | + html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">路段长度:');html.push(section.sectionDistance);html.push('</span>'); | |
| 96 | + html.push('<button class="info_win_btn" onclick="SectionOperation.editSection(');html.push(section.id);html.push(');">修改路段信息</button>'); | |
| 97 | + html.push('<button class="info_win_btn" onclick="SectionOperation.editPolyline(');html.push(section.id);html.push(');">移动路段位置</button>'); | |
| 98 | + | |
| 99 | + var infoWindow = new BMap.InfoWindow(html.join(''), opts); | |
| 100 | + var icon = new BMap.Icon('/pages/base/stationroute/css/img/blank.gif', new BMap.Size(20, 20)); | |
| 101 | + var marker = new BMap.Marker(centerPoint, {icon: icon}); | |
| 102 | + map.addOverlay(marker); | |
| 103 | + var panOpts = {noAnimation: true}; | |
| 104 | + map.panTo(centerPoint, panOpts); | |
| 105 | + map.panBy(0, -110, panOpts); | |
| 106 | + polyline.addEventListener('click', function(event) { | |
| 107 | + operation.recoverPolylineColor(); | |
| 108 | + var polyline = event.target, path = polyline.getPath(); | |
| 109 | + polyline.setStrokeColor('#FF0000'); | |
| 110 | + map.addOverlay(marker); | |
| 111 | + marker.setPosition(path[Math.ceil(path.length / 2)]); | |
| 112 | + marker.openInfoWindow(infoWindow); | |
| 113 | + }); | |
| 114 | + }, | |
| 115 | + editPolyline : function(sectionId) { | |
| 116 | + var overlays = map.getOverlays(); | |
| 117 | + overlays.forEach(function (overlay) { | |
| 118 | + if (overlay.cdata && overlay.cdata.id == sectionId) { | |
| 119 | + overlay.enableEditing(); | |
| 120 | + overlay.addEventListener('rightclick', operation.confirmPolyline); | |
| 121 | + layer.msg('拖动路段至相应位置,然后右击确定!'); | |
| 122 | + } | |
| 123 | + }); | |
| 124 | + }, | |
| 125 | + confirmPolyline: function (event) { | |
| 126 | + var polyline = event.target; | |
| 127 | + polyline.removeEventListener('rightclick', operation.confirmPolyline); | |
| 128 | + polyline.disableEditing(); | |
| 129 | + var points = polyline.getPath(), bsectionVectorWkt = new Array(); | |
| 130 | + for (var i = 0;i < points.length;i++) { | |
| 131 | + bsectionVectorWkt.push(points[i].lng + ' ' + points[i].lat); | |
| 132 | + } | |
| 133 | + SectionService.sectionUpdate({id: polyline.cdata.id, bsectionVectorWkt: 'LINESTRING(' + bsectionVectorWkt.join(',') + ')'}, function(result) { | |
| 134 | + if (result.status == 'SUCCESS') { | |
| 135 | + layer.msg('修改成功...'); | |
| 136 | + } else { | |
| 137 | + layer.msg('修改失败...'); | |
| 138 | + } | |
| 139 | + }); | |
| 140 | + }, | |
| 141 | + editSection: function(sectionId) { | |
| 142 | + layer.closeAll(); | |
| 143 | + var overlays = map.getOverlays(); | |
| 144 | + overlays.forEach(function (overlay) { | |
| 145 | + if (overlay.cdata && overlay.cdata.id == sectionId) { | |
| 146 | + overlay.disableEditing(); | |
| 147 | + var editPloyLineArray = overlay.getPath(); | |
| 148 | + editSection = overlay.cdata; | |
| 149 | + $.get('editsection.html', function(m){ | |
| 150 | + $(pjaxContainer).append(m); | |
| 151 | + $('#edit_section_modal').trigger('modal.show', [SectionOperation, SectionService, editSection]); | |
| 152 | + }); | |
| 153 | + } | |
| 154 | + }); | |
| 155 | + }, | |
| 156 | + clearMarkAndOverlays : function() { | |
| 157 | + map.clearOverlays(); | |
| 158 | + map.removeOverlay(); | |
| 159 | + } | |
| 160 | + } | |
| 161 | + | |
| 162 | + return operation; | |
| 163 | +}(); | |
| 0 | 164 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/section/js/section-positions-events.js deleted
100644 → 0
| 1 | -$(function(){ | |
| 2 | - // 监听返回按钮事件. | |
| 3 | - $('#backUp').on('click',function() { | |
| 4 | - // 返回list.html页面 | |
| 5 | - loadPage('/pages/base/section/list.html'); | |
| 6 | - }); | |
| 7 | - | |
| 8 | - // 监听编辑线路走向. | |
| 9 | - $('.dropdown-menu #eidt').on('click', function(){ | |
| 10 | - $('#eidt').attr("disabled",true); | |
| 11 | - $('#eidt').addClass('btn disabled'); | |
| 12 | - // 弹出添加失败提示消息,2秒关闭(如果不配置,默认是3秒) | |
| 13 | - var yindex = layer.msg('编辑完线路走向后,请双击线路走向区域保存',{ offset: '126px',shift: 0,time: 10000}); | |
| 14 | - SectionPWorldsBMap.editPolyUpline(); | |
| 15 | - }); | |
| 16 | -}); | |
| 17 | 0 | \ No newline at end of file |
src/main/resources/static/pages/base/section/js/section-positions-function.js deleted
100644 → 0
| 1 | -/** | |
| 2 | - * @description : TODO (路段信息定位positions.html页面方法函数的封装.) | |
| 3 | - * | |
| 4 | - * @author bsth@lq | |
| 5 | - * | |
| 6 | - * @version 1.0 | |
| 7 | - */ | |
| 8 | -var PositionsPublicFunctions = function () { | |
| 9 | - var PubFun = { | |
| 10 | - // 初始化路段信息与线路走向. | |
| 11 | - initSectionInfo : function(sectionId) { | |
| 12 | - GetAjaxData.getSectionById(sectionId,function(section) { | |
| 13 | - if(section) { | |
| 14 | - EditSectionObj.setEitdSection(section); | |
| 15 | - SectionPWorldsBMap.drawingUpline(section); | |
| 16 | - } | |
| 17 | - }); | |
| 18 | - }, | |
| 19 | - // 设值表单字段值. | |
| 20 | - setSectionFormValue : function(section) { | |
| 21 | - $('#edit_section_form input,select,textarea').each(function(){ | |
| 22 | - if (this.name) { | |
| 23 | - $(this).val(section[this.name]); | |
| 24 | - } | |
| 25 | - }) | |
| 26 | - } | |
| 27 | - } | |
| 28 | - return PubFun ; | |
| 29 | -}(); | |
| 30 | 0 | \ No newline at end of file |
src/main/resources/static/pages/base/section/js/section-positions-map.js deleted
100644 → 0
| 1 | -/** | |
| 2 | - * @description : (TODO) 百度地图 | |
| 3 | - * | |
| 4 | - * @author bsth@lq | |
| 5 | - * | |
| 6 | - * @version 1.0 | |
| 7 | - * | |
| 8 | - */ | |
| 9 | - | |
| 10 | -var SectionPWorldsBMap = function () { | |
| 11 | - // 定义地图对象、地图覆盖物、线性几何图形. | |
| 12 | - var mapValue = '',marker='', polyUpline=''; | |
| 13 | - var Bmap = { | |
| 14 | - // 初始化地图. | |
| 15 | - init : function() { | |
| 16 | - // 设置中心点 | |
| 17 | - var CENTER_POINT = {lng : 121.528733,lat : 31.237425}; | |
| 18 | - // 初始化百度地图 | |
| 19 | - mapValue = new BMap.Map('sectionPbmap_basic'); | |
| 20 | - //中心点和缩放级别 | |
| 21 | - mapValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15); | |
| 22 | - //启用地图拖拽事件,默认启用(可不写) | |
| 23 | - mapValue.enableDragging(); | |
| 24 | - //启用地图滚轮放大缩小 | |
| 25 | - mapValue.enableScrollWheelZoom(); | |
| 26 | - //禁用鼠标双击放大 | |
| 27 | - mapValue.disableDoubleClickZoom(); | |
| 28 | - //启用键盘上下左右键移动地图 | |
| 29 | - mapValue.enableKeyboard(); | |
| 30 | - return mapValue; | |
| 31 | - }, | |
| 32 | - // 绘制线路走向线性几何图形. | |
| 33 | - drawingUpline : function(section) { | |
| 34 | - var bsectionVectorWkt = section.bsectionVectorWkt; | |
| 35 | - var tempStr = bsectionVectorWkt.substring(11, bsectionVectorWkt.length - 1); | |
| 36 | - var lineArray = tempStr.split(','); | |
| 37 | - var polylineArray = []; | |
| 38 | - var lineaLen = lineArray.length | |
| 39 | - for(var i = 0;i<lineaLen;i++) { | |
| 40 | - polylineArray.push(new BMap.Point(lineArray[i].split(' ')[0],lineArray[i].split(' ')[1])); | |
| 41 | - } | |
| 42 | - var centerI = Math.ceil(lineaLen/2); | |
| 43 | - // 中心坐标点 | |
| 44 | - var point = new BMap.Point(lineArray[centerI].split(' ')[0],lineArray[centerI].split(' ')[1]); | |
| 45 | - // 创建线路走向 | |
| 46 | - polyUpline = new BMap.Polyline(polylineArray, {strokeColor : "#5298ff",strokeWeight : 6,strokeOpacity :1,strokeStyle:'solid'}); | |
| 47 | - polyUpline.cdata = section; | |
| 48 | - // 把折线添加到地图上 | |
| 49 | - mapValue.addOverlay(polyUpline); | |
| 50 | - // 信息窗口参数属性 | |
| 51 | - var opts = { | |
| 52 | - // 信息窗口宽度 | |
| 53 | - width : 200, | |
| 54 | - // 信息窗口高度 | |
| 55 | - height : 350, | |
| 56 | - // 信息窗位置偏移值。 | |
| 57 | - offset: new BMap.Size(0, 0), | |
| 58 | - //标题 | |
| 59 | - title : '<h4 style="color:#FFFFFF">' + section.sectionName + ' 路段详情</h4>', | |
| 60 | - //设置不允许信窗发送短息 | |
| 61 | - enableMessage : false, | |
| 62 | - //是否开启点击地图关闭信息窗口 | |
| 63 | - enableCloseOnClick : true, | |
| 64 | - // 是否开启信息窗口打开时地图自动移动(默认开启)。(自 1.1 新增) | |
| 65 | - enableAutoPan:true | |
| 66 | - }; | |
| 67 | - var html = new Array(); | |
| 68 | - html.push('<HR style="border:1 dashed #987cb9" width="100%" color=#987cb9 SIZE=1>'); | |
| 69 | - html.push('<span style="color:#DDD;font-size: 15px;">路段名称:');html.push(section.sectionName);html.push('</span>'); | |
| 70 | - html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">路段编码:');html.push(section.sectionCode);html.push('</span>'); | |
| 71 | - html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">交叉路段:');html.push(section.crosesRoad);html.push('</span>'); | |
| 72 | - html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">东西向:');html.push((section.ewDirection === undefined ? '' : section.ewDirection == 0 ? '东->西' : '西->东'));html.push('</span>'); | |
| 73 | - html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">南北向:');html.push((section.snDirection === undefined ? '' : section.snDirection == 0 ? '南->北' : '北->南'));html.push('</span>'); | |
| 74 | - html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">路段限速:');html.push(section.speedLimit);html.push('</span>'); | |
| 75 | - html.push('<span class="help-block" style="color:#DDD;font-size: 15px;">路段长度:');html.push(section.sectionDistance);html.push('</span>'); | |
| 76 | - html.push('<button class="info_win_btn" onclick="SectionPWorldsBMap.editSection(');html.push(section.id);html.push(');">修改路段信息</button>'); | |
| 77 | - html.push('<button class="info_win_btn" onclick="SectionPWorldsBMap.editPolyUpline(');html.push(section.id);html.push(');">移动路段位置</button>'); | |
| 78 | - // 创建信息窗口 | |
| 79 | - var infoWindow = new BMap.InfoWindow(html.join(''), opts); | |
| 80 | - // 自定义标注物图片 | |
| 81 | - var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/blank.gif',new BMap.Size(20, 20)); | |
| 82 | - // 创建点 | |
| 83 | - marker = new BMap.Marker(point, {icon : icon_target}); | |
| 84 | - // 把标注添物加到地图上 | |
| 85 | - mapValue.addOverlay(marker); | |
| 86 | - //开启信息窗口 | |
| 87 | - marker.openInfoWindow(infoWindow); | |
| 88 | - var PanOptions_ ={noAnimation :true}; | |
| 89 | - mapValue.reset(); | |
| 90 | - mapValue.panTo(point,PanOptions_); | |
| 91 | - mapValue.panBy(0,-110,PanOptions_); | |
| 92 | - mapValue.setZoom(14); | |
| 93 | - polyUpline.addEventListener("click", function(event) { | |
| 94 | - mapValue.addOverlay(marker); | |
| 95 | - marker.setPosition(event.target.getPath()[0]); | |
| 96 | - marker.openInfoWindow(infoWindow); | |
| 97 | - }); | |
| 98 | - }, | |
| 99 | - // 编辑线路走向几何线性图形. | |
| 100 | - editPolyUpline : function() { | |
| 101 | - polyUpline.disableMassClear(); | |
| 102 | - SectionPWorldsBMap.clearMarkAndOverlays(); | |
| 103 | - polyUpline.enableMassClear(); | |
| 104 | - polyUpline.enableEditing(); | |
| 105 | - polyUpline.addEventListener('rightclick', Bmap.confirmPolyline); | |
| 106 | - layer.msg('拖动路段至相应位置,然后右击确定!'); | |
| 107 | - }, | |
| 108 | - confirmPolyline: function (event) { | |
| 109 | - polyUpline.removeEventListener('rightclick', Bmap.confirmPolyline); | |
| 110 | - polyUpline.disableEditing(); | |
| 111 | - var points = event.target.getPath(), bsectionVectorWkt = new Array(); | |
| 112 | - for (var i = 0;i < points.length;i++) { | |
| 113 | - bsectionVectorWkt.push(points[i].lng + ' ' + points[i].lat); | |
| 114 | - } | |
| 115 | - GetAjaxData.sectionUpdate({id: event.target.cdata.id, bsectionVectorWkt: 'LINESTRING(' + bsectionVectorWkt.join(',') + ')'}, function(result) { | |
| 116 | - if (result.status == 'SUCCESS') { | |
| 117 | - // 弹出添加成功提示消息 | |
| 118 | - layer.msg('修改成功...'); | |
| 119 | - } else { | |
| 120 | - // 弹出添加失败提示消息 | |
| 121 | - layer.msg('修改失败...'); | |
| 122 | - } | |
| 123 | - }); | |
| 124 | - }, | |
| 125 | - editSection: function() { | |
| 126 | - // 关闭 | |
| 127 | - layer.closeAll(); | |
| 128 | - polyUpline.disableEditing(); | |
| 129 | - // 获取折线坐标集合 | |
| 130 | - var editPloyLineArray = polyUpline.getPath(); | |
| 131 | - EditSectionObj.setEitdBsectionVector(JSON.stringify(editPloyLineArray)); | |
| 132 | - polyUpline= ''; | |
| 133 | - // 加载修改路段弹出层mobal页面 | |
| 134 | - $.get('editsection.html', function(m){ | |
| 135 | - $(pjaxContainer).append(m); | |
| 136 | - $('#edit_section_modal').trigger('modal.show', [SectionPWorldsBMap,GetAjaxData,EditSectionObj,PositionsPublicFunctions]); | |
| 137 | - }); | |
| 138 | - }, | |
| 139 | - // 清楚地图覆盖物 | |
| 140 | - clearMarkAndOverlays : function() { | |
| 141 | - mapValue.clearOverlays(); | |
| 142 | - mapValue.removeOverlay(); | |
| 143 | - } | |
| 144 | - } | |
| 145 | - return Bmap; | |
| 146 | -}(); | |
| 147 | 0 | \ No newline at end of file |
src/main/resources/static/pages/base/section/js/section-positions-reload.js deleted
100644 → 0
| 1 | -/** | |
| 2 | - * | |
| 3 | - * @JSName : list.js(路段信息定位positions.html页面js) | |
| 4 | - * | |
| 5 | - * @Author : bsth@lq | |
| 6 | - * | |
| 7 | - * @Description : TODO(路段信息定位positions.html页面js) | |
| 8 | - * | |
| 9 | - * @Data : 2016年4月28日 上午9:21:17 | |
| 10 | - * | |
| 11 | - * @Version 公交调度系统BS版 0.1 | |
| 12 | - * | |
| 13 | - */ | |
| 14 | - | |
| 15 | -(function(){ | |
| 16 | - // 获取参数线路ID. | |
| 17 | - var id = $.url().param('no'); | |
| 18 | - // 关闭左侧栏. | |
| 19 | - if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();} | |
| 20 | - // 等候300毫秒执行. | |
| 21 | - setTimeout(function(){ | |
| 22 | - /** 初始化地图 @return <mapB:地图对象> */ | |
| 23 | - var mapB = SectionPWorldsBMap.init(); | |
| 24 | - /** 初始化路段信息 @return <id:路段路由ID> */ | |
| 25 | - PositionsPublicFunctions.initSectionInfo(id); | |
| 26 | - },300); | |
| 27 | -})(); | |
| 28 | 0 | \ No newline at end of file |
src/main/resources/static/pages/base/section/js/section-ajax-getdata.js renamed to src/main/resources/static/pages/base/section/js/section-service.js
| 1 | -/** | |
| 2 | - * @description : (TODO) GetAjaxData :封装ajax异步请求方法 | |
| 3 | - * | |
| 4 | - * @author bsth@lq | |
| 5 | - * | |
| 6 | - * @version 1.0 | |
| 7 | - */ | |
| 1 | +var SectionService = function(){ | |
| 2 | + return { | |
| 3 | + /** | |
| 4 | + * 根据ID查询路段信息 | |
| 5 | + * @param sectionId | |
| 6 | + * @param callback | |
| 7 | + */ | |
| 8 | + getSectionById: function(sectionId, callback){ | |
| 9 | + $get('/section/' + sectionId, {}, function(r) { | |
| 10 | + return callback && callback(r); | |
| 11 | + }); | |
| 12 | + }, | |
| 8 | 13 | |
| 9 | -var GetAjaxData = function(){ | |
| 10 | - var ajaxData = { | |
| 11 | - // 根据ID查询路段信息. | |
| 12 | - getSectionById: function(sectionId, callback){ | |
| 13 | - $get('/section/' + sectionId, {}, function(r) { | |
| 14 | - return callback && callback(r); | |
| 15 | - }); | |
| 16 | - }, | |
| 14 | + findUpSectionRouteCode: function(lineId,diraction,sectionRouteCode,callback) { | |
| 15 | + $get('/sectionroute/findUpSectionRouteCode',{lineId:lineId,direction:diraction,sectionRouteCode:sectionRouteCode},function(result) { | |
| 16 | + callback && callback(result); | |
| 17 | + }); | |
| 17 | 18 | |
| 18 | - findUpSectionRouteCode: function(lineId,diraction,sectionRouteCode,callback) { | |
| 19 | - $get('/sectionroute/findUpSectionRouteCode',{lineId:lineId,direction:diraction,sectionRouteCode:sectionRouteCode},function(result) { | |
| 20 | - callback && callback(result); | |
| 21 | - }); | |
| 19 | + }, | |
| 22 | 20 | |
| 23 | - }, | |
| 21 | + /** | |
| 22 | + * 获取所有不重名的道路名称 | |
| 23 | + * @param callback | |
| 24 | + */ | |
| 25 | + findDistinctSectionName: function(callback) { | |
| 26 | + $get('/section/findDistinctSectionName', {}, function(res) { | |
| 27 | + callback && callback(res.data); | |
| 28 | + }) | |
| 29 | + }, | |
| 24 | 30 | |
| 25 | - sectionUpdate: function(section, callback) { | |
| 26 | - $post('/section/modify', section, function(data) { | |
| 27 | - callback && callback(data); | |
| 28 | - }) | |
| 29 | - } | |
| 30 | - } | |
| 31 | - | |
| 32 | - return ajaxData; | |
| 33 | - | |
| 31 | + /** | |
| 32 | + * 根据名称获取所有路段 | |
| 33 | + * @param callback | |
| 34 | + */ | |
| 35 | + findSectionByName: function(sectionName, callback) { | |
| 36 | + $get('/section/findSectionByName', {sectionName: sectionName}, function(res) { | |
| 37 | + callback && callback(res.data); | |
| 38 | + }) | |
| 39 | + }, | |
| 40 | + | |
| 41 | + /** | |
| 42 | + * 更新路段信息 | |
| 43 | + * @param section | |
| 44 | + * @param callback | |
| 45 | + */ | |
| 46 | + sectionUpdate: function(section, callback) { | |
| 47 | + $post('/section/modify', section, function(data) { | |
| 48 | + callback && callback(data); | |
| 49 | + }) | |
| 50 | + } | |
| 51 | + } | |
| 34 | 52 | }(); |
| 35 | 53 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/section/list.html
| ... | ... | @@ -23,6 +23,7 @@ |
| 23 | 23 | <div class="actions"> |
| 24 | 24 | <div class="btn-group btn-group-devided" data-toggle="buttons"> |
| 25 | 25 | <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加路段</a> |
| 26 | + <a class="btn btn-circle blue" href="javascript:void(0)" data-pjax id="positionSections"><i class="fa fa-plus"></i> 定位完整道路</a> | |
| 26 | 27 | </div> |
| 27 | 28 | </div> |
| 28 | 29 | </div> |
| ... | ... | @@ -44,7 +45,7 @@ |
| 44 | 45 | <tr role="row" class="filter"> |
| 45 | 46 | <td></td> |
| 46 | 47 | <td> |
| 47 | - <input type="text" class="form-control form-filter input-sm" name="sectionName_like" /> | |
| 48 | + <input type="text" class="form-control form-filter input-sm" name="sectionName_like"/> | |
| 48 | 49 | </td> |
| 49 | 50 | <td> |
| 50 | 51 | <input type="text" class="form-control form-filter input-sm" name="sectionCode_like" /> |
| ... | ... | @@ -135,4 +136,5 @@ |
| 135 | 136 | </tr> |
| 136 | 137 | {{/if}} |
| 137 | 138 | </script> |
| 138 | -<script src="/pages/base/section/js/section-list-table.js"></script> | |
| 139 | 139 | \ No newline at end of file |
| 140 | +<script src="/pages/base/section/js/section-service.js"></script> | |
| 141 | +<script src="/pages/base/section/js/section-list-table.js"></script> | ... | ... |
src/main/resources/static/pages/base/section/position_sections.html
0 → 100644
| 1 | +<link href="/pages/base/section/css/positions.css" rel="stylesheet" type="text/css" /> | |
| 2 | +<style> | |
| 3 | + .info_win_btn { | |
| 4 | + background: #ff8355; | |
| 5 | + color: #fff; | |
| 6 | + font-size: 12px; | |
| 7 | + margin: 0 5px 3px 0; | |
| 8 | + border: 1px solid transparent; | |
| 9 | + } | |
| 10 | +</style> | |
| 11 | +<div id="map_section" class="map-container"></div> | |
| 12 | +<script src="/pages/base/section/js/positionsection.js"></script> | |
| 13 | +<script src="/pages/base/section/js/section-service.js"></script> | |
| 14 | +<script src="/pages/base/section/js/section-operation.js"></script> | |
| 15 | +<script> | |
| 16 | + (function(){ | |
| 17 | + setTimeout(function(){ | |
| 18 | + SectionOperation.initSections(); | |
| 19 | + }, 300); | |
| 20 | + })(); | |
| 21 | +</script> | |
| 0 | 22 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/section/positions.html
| ... | ... | @@ -8,32 +8,33 @@ |
| 8 | 8 | border: 1px solid transparent; |
| 9 | 9 | } |
| 10 | 10 | </style> |
| 11 | -<div id="sectionPbmap_basic"></div> | |
| 11 | +<div id="map_section" class="map-container"></div> | |
| 12 | 12 | <div class="leftUtils"> |
| 13 | 13 | <div class="btn-group" style="left: 100px;"> |
| 14 | 14 | <a class="btn btn-sm green-seagreen dropdown-toggle" style="width: 98px;" href="javascript:;" data-toggle="dropdown" aria-expanded="false"> 操作工具 |
| 15 | 15 | <i class="fa fa-angle-down"></i> |
| 16 | 16 | </a> |
| 17 | 17 | <ul class="dropdown-menu pull-right" style="min-width:100px"> |
| 18 | - <li> | |
| 18 | + <!--<li> | |
| 19 | 19 | <a href="javascript:;" id = "eidt"><i class="fa fa-pencil"></i> 修改 </a> |
| 20 | - </li> | |
| 20 | + </li>--> | |
| 21 | 21 | <li> |
| 22 | 22 | <a href="javascript:;" id = "backUp"> <i class="fa fa-reply"></i> 返回 </a> |
| 23 | 23 | </li> |
| 24 | - | |
| 24 | + | |
| 25 | 25 | </ul> |
| 26 | 26 | </div> |
| 27 | 27 | </div> |
| 28 | -<!-- 编辑路段对象类 --> | |
| 29 | 28 | <script src="/pages/base/section/js/positionsection.js"></script> |
| 30 | -<!-- ajax异步请求类 --> | |
| 31 | -<script src="/pages/base/section/js/section-ajax-getdata.js"></script> | |
| 32 | -<!-- 函数方法类 --> | |
| 33 | -<script src="/pages/base/section/js/section-positions-function.js"></script> | |
| 34 | -<!-- 地图类 --> | |
| 35 | -<script src="/pages/base/section/js/section-positions-map.js"></script> | |
| 36 | -<!-- 事件类 --> | |
| 37 | -<script src="/pages/base/section/js/section-positions-events.js"></script> | |
| 38 | -<!-- reload类 --> | |
| 39 | -<script src="/pages/base/section/js/section-positions-reload.js"></script> | |
| 40 | 29 | \ No newline at end of file |
| 30 | +<script src="/pages/base/section/js/section-service.js"></script> | |
| 31 | +<script src="/pages/base/section/js/section-operation.js"></script> | |
| 32 | +<script> | |
| 33 | + (function(){ | |
| 34 | + // 关闭左侧栏. | |
| 35 | + if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();} | |
| 36 | + setTimeout(function(){ | |
| 37 | + SectionOperation.initSection(); | |
| 38 | + SectionOperation.initEventBind(); | |
| 39 | + }, 300); | |
| 40 | + })(); | |
| 41 | +</script> | |
| 41 | 42 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/stationroute/js/stationroute-ajax-getdata.js
| ... | ... | @@ -211,8 +211,8 @@ var GetAjaxData = function(){ |
| 211 | 211 | }, |
| 212 | 212 | |
| 213 | 213 | findSectionByName: function(sectionName, cb) { |
| 214 | - $get('/section/findSectionByName', {sectionName: sectionName}, function(sections) { | |
| 215 | - cb && cb(sections); | |
| 214 | + $get('/section/findSectionByName', {sectionName: sectionName}, function(res) { | |
| 215 | + cb && cb(res.data); | |
| 216 | 216 | }); |
| 217 | 217 | }, |
| 218 | 218 | ... | ... |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-map.js
| ... | ... | @@ -659,7 +659,7 @@ window.WorldsBMap = function () { |
| 659 | 659 | mapBValue.addOverlay(polyline); |
| 660 | 660 | overlays.push(polyline); |
| 661 | 661 | polyline.addEventListener('click', function (event) { |
| 662 | - alert(11) | |
| 662 | + alert(event.target.section.id) | |
| 663 | 663 | }); |
| 664 | 664 | polyline.addEventListener('rightclick', Bmap.confirmCenterPointHandler); |
| 665 | 665 | } | ... | ... |