Commit 72fd6f2d37f596648e8f6793ba4c9ea1df7d479f
1 parent
c838f1d2
update...
Showing
10 changed files
with
346 additions
and
40 deletions
src/main/java/com/bsth/controller/geo_data/GeoDataController.java
| @@ -35,4 +35,9 @@ public class GeoDataController { | @@ -35,4 +35,9 @@ public class GeoDataController { | ||
| 35 | public Map<String, Object> updateBufferInfo(GeoStation station){ | 35 | public Map<String, Object> updateBufferInfo(GeoStation station){ |
| 36 | return geoDataService.updateBufferInfo(station); | 36 | return geoDataService.updateBufferInfo(station); |
| 37 | } | 37 | } |
| 38 | + | ||
| 39 | + @RequestMapping(value = "updateStationName",method = RequestMethod.POST) | ||
| 40 | + public Map<String, Object> updateStationName(@RequestParam Map<String, Object> map){ | ||
| 41 | + return geoDataService.updateStationName(map); | ||
| 42 | + } | ||
| 38 | } | 43 | } |
src/main/java/com/bsth/data/gpsdata_v2/utils/GpsDataRecovery.java
| @@ -84,7 +84,7 @@ public class GpsDataRecovery implements ApplicationContextAware { | @@ -84,7 +84,7 @@ public class GpsDataRecovery implements ApplicationContextAware { | ||
| 84 | Calendar calendar = Calendar.getInstance(); | 84 | Calendar calendar = Calendar.getInstance(); |
| 85 | int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR); | 85 | int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR); |
| 86 | 86 | ||
| 87 | - String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE,SERVER_TS from bsth_c_gps_info where days_year=329"; //+ dayOfYear; | 87 | + String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE,SERVER_TS from bsth_c_gps_info where days_year=346"; //+ dayOfYear; |
| 88 | JdbcTemplate jdbcTemplate = new JdbcTemplate(DBUtils_MS.getDataSource()); | 88 | JdbcTemplate jdbcTemplate = new JdbcTemplate(DBUtils_MS.getDataSource()); |
| 89 | 89 | ||
| 90 | List<GpsEntity> list = | 90 | List<GpsEntity> list = |
src/main/java/com/bsth/data/schedule/late_adjust/LateAdjustHandle.java
| @@ -171,7 +171,7 @@ public class LateAdjustHandle implements ApplicationContextAware{ | @@ -171,7 +171,7 @@ public class LateAdjustHandle implements ApplicationContextAware{ | ||
| 171 | } | 171 | } |
| 172 | }catch (Exception e){ | 172 | }catch (Exception e){ |
| 173 | e.printStackTrace(); | 173 | e.printStackTrace(); |
| 174 | - logger.error("", e); | 174 | + logger.error("late2 car arrive", e); |
| 175 | } | 175 | } |
| 176 | } | 176 | } |
| 177 | 177 |
src/main/java/com/bsth/service/geo_data/GeoDataService.java
| @@ -16,4 +16,6 @@ public interface GeoDataService { | @@ -16,4 +16,6 @@ public interface GeoDataService { | ||
| 16 | Map<String, Object> findGeoRoad(String lineCode); | 16 | Map<String, Object> findGeoRoad(String lineCode); |
| 17 | 17 | ||
| 18 | Map<String,Object> updateBufferInfo(GeoStation station); | 18 | Map<String,Object> updateBufferInfo(GeoStation station); |
| 19 | + | ||
| 20 | + Map<String,Object> updateStationName(Map<String, Object> map); | ||
| 19 | } | 21 | } |
src/main/java/com/bsth/service/geo_data/impl/GeoDataServiceImpl.java
| @@ -11,7 +11,11 @@ import org.slf4j.LoggerFactory; | @@ -11,7 +11,11 @@ import org.slf4j.LoggerFactory; | ||
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.jdbc.core.BeanPropertyRowMapper; | 12 | import org.springframework.jdbc.core.BeanPropertyRowMapper; |
| 13 | import org.springframework.jdbc.core.JdbcTemplate; | 13 | import org.springframework.jdbc.core.JdbcTemplate; |
| 14 | +import org.springframework.jdbc.datasource.DataSourceTransactionManager; | ||
| 14 | import org.springframework.stereotype.Service; | 15 | import org.springframework.stereotype.Service; |
| 16 | +import org.springframework.transaction.TransactionDefinition; | ||
| 17 | +import org.springframework.transaction.TransactionStatus; | ||
| 18 | +import org.springframework.transaction.support.DefaultTransactionDefinition; | ||
| 15 | 19 | ||
| 16 | import java.util.ArrayList; | 20 | import java.util.ArrayList; |
| 17 | import java.util.HashMap; | 21 | import java.util.HashMap; |
| @@ -109,14 +113,7 @@ public class GeoDataServiceImpl implements GeoDataService { | @@ -109,14 +113,7 @@ public class GeoDataServiceImpl implements GeoDataService { | ||
| 109 | 113 | ||
| 110 | //从数据库里重新查询对象 | 114 | //从数据库里重新查询对象 |
| 111 | if(rsCount > 0){ | 115 | if(rsCount > 0){ |
| 112 | - sql = "SELECT t1.*, t2.g_lonx,g_laty,ST_AsText (g_polygon_grid) AS g_polygon_grid,radius,shapes_type FROM (SELECT id,station_name,station_route_code,line_code,station_code,station_mark,versions,directions FROM bsth_c_ls_stationroute WHERE id="+station.getId()+" AND destroy = 0) t1 LEFT JOIN bsth_c_station t2 ON t1.station_code = t2.station_cod"; | ||
| 113 | - List<GeoStation> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoStation.class)); | ||
| 114 | - | ||
| 115 | - for(GeoStation s : list){ | ||
| 116 | - if(s.getShapesType().equals("d")) | ||
| 117 | - s.setBdCoords(multiWgsToBd(s.getgPolygonGrid(), 9, 3)); | ||
| 118 | - } | ||
| 119 | - rs.put("station", list.get(0)); | 116 | + rs.put("station", findOne(station.getId())); |
| 120 | rs.put("status", ResponseCode.SUCCESS); | 117 | rs.put("status", ResponseCode.SUCCESS); |
| 121 | } | 118 | } |
| 122 | 119 | ||
| @@ -128,6 +125,62 @@ public class GeoDataServiceImpl implements GeoDataService { | @@ -128,6 +125,62 @@ public class GeoDataServiceImpl implements GeoDataService { | ||
| 128 | return rs; | 125 | return rs; |
| 129 | } | 126 | } |
| 130 | 127 | ||
| 128 | + /** | ||
| 129 | + * 修改站点路由和站点名称 | ||
| 130 | + * @param map | ||
| 131 | + * @return | ||
| 132 | + */ | ||
| 133 | + @Override | ||
| 134 | + public Map<String, Object> updateStationName(Map<String, Object> map) { | ||
| 135 | + Map<String, Object> rs = new HashMap<>(); | ||
| 136 | + | ||
| 137 | + //编程式事务 | ||
| 138 | + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource()); | ||
| 139 | + DefaultTransactionDefinition def = new DefaultTransactionDefinition(); | ||
| 140 | + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); | ||
| 141 | + TransactionStatus status = tran.getTransaction(def); | ||
| 142 | + try{ | ||
| 143 | + | ||
| 144 | + int id = Integer.parseInt(map.get("id").toString()); | ||
| 145 | + String name = map.get("stationName").toString(); | ||
| 146 | + String code = map.get("stationCode").toString(); | ||
| 147 | + //String lineCode = map.get("lineCode").toString(); | ||
| 148 | + //String stationMark = map.get("stationMark").toString(); | ||
| 149 | + | ||
| 150 | + //更新历史站点路由 | ||
| 151 | + jdbcTemplate.update("update bsth_c_ls_stationroute set station_name=? where id=?", name, id); | ||
| 152 | + //更新站点 | ||
| 153 | + jdbcTemplate.update("update bsth_c_station set station_name=? where station_cod=?", name, code); | ||
| 154 | + | ||
| 155 | + tran.commit(status); | ||
| 156 | + | ||
| 157 | + rs.put("station", findOne(id)); | ||
| 158 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 159 | + }catch (Exception e){ | ||
| 160 | + tran.rollback(status); | ||
| 161 | + logger.error("", e); | ||
| 162 | + rs.put("status", ResponseCode.ERROR); | ||
| 163 | + rs.put("msg", "服务器出现异常"); | ||
| 164 | + } | ||
| 165 | + return rs; | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | + | ||
| 169 | + /** | ||
| 170 | + * 根据路由ID 获取站点 | ||
| 171 | + * @param id | ||
| 172 | + * @return | ||
| 173 | + */ | ||
| 174 | + private GeoStation findOne(int id){ | ||
| 175 | + String sql = "SELECT t1.*, t2.g_lonx,g_laty,ST_AsText (g_polygon_grid) AS g_polygon_grid,radius,shapes_type FROM (SELECT id,station_name,station_route_code,line_code,station_code,station_mark,versions,directions FROM bsth_c_ls_stationroute WHERE id="+id+" AND destroy = 0) t1 LEFT JOIN bsth_c_station t2 ON t1.station_code = t2.station_cod"; | ||
| 176 | + List<GeoStation> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoStation.class)); | ||
| 177 | + | ||
| 178 | + GeoStation s = list.get(0); | ||
| 179 | + if(s.getShapesType().equals("d")) | ||
| 180 | + s.setBdCoords(multiWgsToBd(s.getgPolygonGrid(), 9, 3)); | ||
| 181 | + | ||
| 182 | + return s; | ||
| 183 | + } | ||
| 131 | 184 | ||
| 132 | private String bdPolygon2Wgs(String bdPolygon){ | 185 | private String bdPolygon2Wgs(String bdPolygon){ |
| 133 | StringBuilder wgsPolygon = new StringBuilder(); | 186 | StringBuilder wgsPolygon = new StringBuilder(); |
src/main/resources/static/pages/base/geo_data_edit/css/mian.css
| @@ -134,7 +134,7 @@ div#map_wrap{ | @@ -134,7 +134,7 @@ div#map_wrap{ | ||
| 134 | width: calc(100% - 38px); | 134 | width: calc(100% - 38px); |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | -.station_route>ul.uk-list>li:nth-child(n+2), .uk-list>li>ul { | 137 | +.up_down_route_list ul.uk-list>li:nth-child(n+2), .uk-list>li>ul { |
| 138 | margin-top: 0; | 138 | margin-top: 0; |
| 139 | } | 139 | } |
| 140 | 140 | ||
| @@ -297,7 +297,7 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root { | @@ -297,7 +297,7 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root { | ||
| 297 | .buffer_edit_panel{ | 297 | .buffer_edit_panel{ |
| 298 | position: absolute; | 298 | position: absolute; |
| 299 | top: 5px; | 299 | top: 5px; |
| 300 | - width: 360px; | 300 | + width: 390px; |
| 301 | height: 120px; | 301 | height: 120px; |
| 302 | background: #ffffff; | 302 | background: #ffffff; |
| 303 | left: calc(50% - 170px); | 303 | left: calc(50% - 170px); |
| @@ -306,7 +306,7 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root { | @@ -306,7 +306,7 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root { | ||
| 306 | display: none; | 306 | display: none; |
| 307 | } | 307 | } |
| 308 | .buffer_edit_body{ | 308 | .buffer_edit_body{ |
| 309 | - padding: 5px; | 309 | + padding: 5px 0 0 15px; |
| 310 | } | 310 | } |
| 311 | 311 | ||
| 312 | .buffer_edit_body>.name{ | 312 | .buffer_edit_body>.name{ |
| @@ -316,7 +316,7 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root { | @@ -316,7 +316,7 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root { | ||
| 316 | } | 316 | } |
| 317 | 317 | ||
| 318 | .buffer_edit_body .ct_row .uk-inline{ | 318 | .buffer_edit_body .ct_row .uk-inline{ |
| 319 | - width: 167px; | 319 | + width: 175px; |
| 320 | height: 30px; | 320 | height: 30px; |
| 321 | margin-right: 7px; | 321 | margin-right: 7px; |
| 322 | } | 322 | } |
| @@ -420,4 +420,63 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root { | @@ -420,4 +420,63 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root { | ||
| 420 | 420 | ||
| 421 | .shapes_type.st_d .draw_polygon_switch>a{ | 421 | .shapes_type.st_d .draw_polygon_switch>a{ |
| 422 | color: red; | 422 | color: red; |
| 423 | +} | ||
| 424 | + | ||
| 425 | +.ul_li_input{ | ||
| 426 | + display: inline-block; | ||
| 427 | + padding: 4px 0; | ||
| 428 | + width: calc(100% - 53px); | ||
| 429 | + background: #f7f7f7; | ||
| 430 | +} | ||
| 431 | + | ||
| 432 | +.ul_li_input input{ | ||
| 433 | + width: 140px; | ||
| 434 | + height: 28px; | ||
| 435 | + margin-left: 5px; | ||
| 436 | +} | ||
| 437 | + | ||
| 438 | +.save_icon_btn{ | ||
| 439 | + color: #2121d1; | ||
| 440 | + margin-right: 4px; | ||
| 441 | +} | ||
| 442 | + | ||
| 443 | +.ul_li_input .uk-icon:hover{ | ||
| 444 | + background: #dfdfdf; | ||
| 445 | +} | ||
| 446 | + | ||
| 447 | +.station_li_transient .ct_route_badge{ | ||
| 448 | + background: #ddcd3f; | ||
| 449 | + vertical-align: middle; | ||
| 450 | +} | ||
| 451 | + | ||
| 452 | +.station_li_transient .search_point_icon_btn{ | ||
| 453 | + color: #FF9800; | ||
| 454 | + margin-right: 5px; | ||
| 455 | +} | ||
| 456 | + | ||
| 457 | +.station_route ._edit_name .ct_route_badge{ | ||
| 458 | + vertical-align: middle; | ||
| 459 | +} | ||
| 460 | + | ||
| 461 | +.add_station_search_point_wrap{ | ||
| 462 | + width: 390px; | ||
| 463 | + height: 140px; | ||
| 464 | + position: absolute; | ||
| 465 | + top: 10px; | ||
| 466 | + left: calc(50% - 200px); | ||
| 467 | + z-index: 999; | ||
| 468 | + background: #ffface; | ||
| 469 | + box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48); | ||
| 470 | +} | ||
| 471 | + | ||
| 472 | +.add_station_search_point_wrap ._title { | ||
| 473 | + text-align: center; | ||
| 474 | + font-size: 17px; | ||
| 475 | + color: #2b2b2b; | ||
| 476 | + padding: 2px 0 0 0; | ||
| 477 | + font-weight: 600; | ||
| 478 | +} | ||
| 479 | + | ||
| 480 | +.add_station_search_point_wrap .buffer_edit_body .ct_row { | ||
| 481 | + margin-top: 8px; | ||
| 423 | } | 482 | } |
| 424 | \ No newline at end of file | 483 | \ No newline at end of file |
src/main/resources/static/pages/base/geo_data_edit/fragments/f_station_route.html
| @@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
| 4 | {{each list as s i}} | 4 | {{each list as s i}} |
| 5 | <li class="station_li_{{s.stationCode}}"> | 5 | <li class="station_li_{{s.stationCode}}"> |
| 6 | <div class="ct_route_badge_wrap"> | 6 | <div class="ct_route_badge_wrap"> |
| 7 | - <span class="uk-badge ct_route_badge {{if s.stationMark=='B'}}start{{else if s.stationMark=='E'}}end{{/if}} {{if shapesType=='d'}}polygon{{/if}}"> | 7 | + <span class="uk-badge ct_route_badge {{if s.stationMark=='B'}}start{{else if s.stationMark=='E'}}end{{/if}} {{if s.shapesType=='d'}}polygon{{/if}}"> |
| 8 | {{if s.stationMark=='B'}}起点站{{else if s.stationMark=='E'}}终点站{{else}}{{i + 1}}{{/if}}</span> | 8 | {{if s.stationMark=='B'}}起点站{{else if s.stationMark=='E'}}终点站{{else}}{{i + 1}}{{/if}}</span> |
| 9 | </div> | 9 | </div> |
| 10 | <a data-code="{{s.stationCode}}" data-updown="{{s.directions}}">{{s.stationName}}</a> | 10 | <a data-code="{{s.stationCode}}" data-updown="{{s.directions}}">{{s.stationName}}</a> |
| @@ -13,6 +13,16 @@ | @@ -13,6 +13,16 @@ | ||
| 13 | </ul> | 13 | </ul> |
| 14 | </script> | 14 | </script> |
| 15 | 15 | ||
| 16 | + <script id="geo_d_e_station_route_one-temp" type="text/html"> | ||
| 17 | + <li class="station_li_{{stationCode}}"> | ||
| 18 | + <div class="ct_route_badge_wrap"> | ||
| 19 | + <span class="uk-badge ct_route_badge {{if stationMark=='B'}}start{{else if stationMark=='E'}}end{{/if}} {{if shapesType=='d'}}polygon{{/if}}"> | ||
| 20 | + {{if stationMark=='B'}}起点站{{else if stationMark=='E'}}终点站{{else}}{{index}}{{/if}}</span> | ||
| 21 | + </div> | ||
| 22 | + <a class="uk-animation-shake" data-code="{{stationCode}}" data-updown="{{directions}}">{{stationName}}</a> | ||
| 23 | + </li> | ||
| 24 | + </script> | ||
| 25 | + | ||
| 16 | 26 | ||
| 17 | <script id="geo_d_e_station_info_win-temp" type="text/html"> | 27 | <script id="geo_d_e_station_info_win-temp" type="text/html"> |
| 18 | <ul class="uk-list station_info_win"> | 28 | <ul class="uk-list station_info_win"> |
| @@ -90,4 +100,74 @@ | @@ -90,4 +100,74 @@ | ||
| 90 | </div> | 100 | </div> |
| 91 | </div> | 101 | </div> |
| 92 | </script> | 102 | </script> |
| 103 | + | ||
| 104 | + <script id="geo_d_e_edit_name_panel-temp" type="text/html"> | ||
| 105 | + <div class="ul_li_input"> | ||
| 106 | + <form> | ||
| 107 | + <input type="hidden" value="{{id}}" name="id"> | ||
| 108 | + <input type="hidden" value="{{stationCode}}" name="stationCode"> | ||
| 109 | + <input type="hidden" value="{{lineCode}}" name="lineCode"> | ||
| 110 | + <input type="hidden" value="{{stationMark}}" name="stationMark"> | ||
| 111 | + <input class="uk-input" autocomplete="off" value="{{stationName}}" name="stationName"> | ||
| 112 | + <span uk-icon="icon: check" title="确定" uk-tooltip class="save_icon_btn"></span> | ||
| 113 | + <span uk-icon="icon: close" title="取消" uk-tooltip class="cancel_icon_btn"></span> | ||
| 114 | + </form> | ||
| 115 | + </div> | ||
| 116 | + </script> | ||
| 117 | + | ||
| 118 | + <script id="geo_d_e_add_station_panel-temp" type="text/html"> | ||
| 119 | + <li class="station_li_transient"> | ||
| 120 | + <div class="ct_route_badge_wrap"> | ||
| 121 | + <span class="uk-badge ct_route_badge ">?</span> | ||
| 122 | + </div> | ||
| 123 | + <div class="ul_li_input"> | ||
| 124 | + <form> | ||
| 125 | + <input class="uk-input" value="" autocomplete="off" placeholder="输入站点名称" name="stationName"> | ||
| 126 | + <span uk-icon="icon: location;ratio:.8" title="选择一个坐标位置" uk-tooltip class="search_point_icon_btn"></span> | ||
| 127 | + <span uk-icon="icon: close" title="取消" uk-tooltip class="cancel_icon_btn"></span> | ||
| 128 | + </form> | ||
| 129 | + </div> | ||
| 130 | + </li> | ||
| 131 | + </script> | ||
| 132 | + | ||
| 133 | + <script id="geo_d_e_add_search_point_panel-temp" type="text/html"> | ||
| 134 | + <div class="add_station_search_point_wrap uk-animation-slide-top-small"> | ||
| 135 | + <div class="_title">为 {{name}} 选择一个坐标位置</div> | ||
| 136 | + <div class="buffer_edit_body"> | ||
| 137 | + <form> | ||
| 138 | + <div class="ct_row"> | ||
| 139 | + <div class="uk-inline"> | ||
| 140 | + <span class="uk-form-icon uk-form-icon-flip" >经度</span> | ||
| 141 | + <input class="uk-input" name="gLaty" type="text" readonly> | ||
| 142 | + </div> | ||
| 143 | + <div class="uk-inline"> | ||
| 144 | + <span class="uk-form-icon uk-form-icon-flip" >纬度</span> | ||
| 145 | + <input class="uk-input" name="gLonx" type="text" readonly> | ||
| 146 | + </div> | ||
| 147 | + </div> | ||
| 148 | + <div class="ct_row shapes_type "> | ||
| 149 | + <div class="uk-inline" > | ||
| 150 | + <select name="shapesType" class="uk-select"> | ||
| 151 | + <option value="r" >圆形</option> | ||
| 152 | + <option value="d" >多边形</option> | ||
| 153 | + </select> | ||
| 154 | + <span class="draw_polygon_switch" data-type="1"><a>暂停绘制</a></span> | ||
| 155 | + </div> | ||
| 156 | + <div class="uk-inline"> | ||
| 157 | + <span class="uk-form-icon uk-form-icon-flip" >半径</span> | ||
| 158 | + <input class="uk-input" name="radius" type="text" > | ||
| 159 | + </div> | ||
| 160 | + <div class="uk-inline btns"> | ||
| 161 | + <button class="uk-button uk-button-primary submit">确定</button> | ||
| 162 | + <button class="uk-button uk-button-default cancel">取消</button> | ||
| 163 | + </div> | ||
| 164 | + </div> | ||
| 165 | + <div class="ct_row" style="color: #5e5d5d;font-size: 12px;"> | ||
| 166 | + <span uk-icon="icon: question;ratio:.7;" style="vertical-align: top;margin-top: 2px;"></span> | ||
| 167 | + 双击地图拾取坐标点位 | ||
| 168 | + </div> | ||
| 169 | + </form> | ||
| 170 | + </div> | ||
| 171 | + </div> | ||
| 172 | + </script> | ||
| 93 | </div> | 173 | </div> |
| 94 | \ No newline at end of file | 174 | \ No newline at end of file |
src/main/resources/static/pages/base/geo_data_edit/js/map.js
| @@ -307,8 +307,8 @@ var gb_ct_map = function () { | @@ -307,8 +307,8 @@ var gb_ct_map = function () { | ||
| 307 | 307 | ||
| 308 | var exitEditBufferStatus = function (s) { | 308 | var exitEditBufferStatus = function (s) { |
| 309 | map_status = 0; | 309 | map_status = 0; |
| 310 | - enabledOtherElem(); | ||
| 311 | - gb_station_route.hideEditPanel(); | 310 | + //enabledOtherElem(); |
| 311 | + //gb_station_route.hideEditPanel(); | ||
| 312 | 312 | ||
| 313 | clearOtherOverlay(); | 313 | clearOtherOverlay(); |
| 314 | reSetDragMarker();//关闭marker 拖拽 | 314 | reSetDragMarker();//关闭marker 拖拽 |
| @@ -340,6 +340,7 @@ var gb_ct_map = function () { | @@ -340,6 +340,7 @@ var gb_ct_map = function () { | ||
| 340 | if(s.shapesType=='r'){ | 340 | if(s.shapesType=='r'){ |
| 341 | //lineupdate | 341 | //lineupdate |
| 342 | bElem.addEventListener('lineupdate', function (e) { | 342 | bElem.addEventListener('lineupdate', function (e) { |
| 343 | + //console.log('lineupdatelineupdate 1111', e); | ||
| 343 | gb_station_route.reWriteEditPanel(e.target); | 344 | gb_station_route.reWriteEditPanel(e.target); |
| 344 | }); | 345 | }); |
| 345 | } | 346 | } |
| @@ -393,10 +394,6 @@ var gb_ct_map = function () { | @@ -393,10 +394,6 @@ var gb_ct_map = function () { | ||
| 393 | $('.main_left_panel_m_layer').show(); | 394 | $('.main_left_panel_m_layer').show(); |
| 394 | }; | 395 | }; |
| 395 | 396 | ||
| 396 | - var enabledOtherElem = function () { | ||
| 397 | - $('.main_left_panel_m_layer').hide(); | ||
| 398 | - }; | ||
| 399 | - | ||
| 400 | var openBufferOverlay = function (m) { | 397 | var openBufferOverlay = function (m) { |
| 401 | var elem; | 398 | var elem; |
| 402 | var data = m.ct_data; | 399 | var data = m.ct_data; |
| @@ -466,6 +463,11 @@ var gb_ct_map = function () { | @@ -466,6 +463,11 @@ var gb_ct_map = function () { | ||
| 466 | } | 463 | } |
| 467 | else if(v == 'r'){ | 464 | else if(v == 'r'){ |
| 468 | updateDragRadius(80); | 465 | updateDragRadius(80); |
| 466 | + | ||
| 467 | + //圆形编辑事件 reWriteEditPanel | ||
| 468 | + editCircle.addEventListener('lineupdate', function (e) { | ||
| 469 | + gb_station_route.reWriteEditPanel(e.target); | ||
| 470 | + }); | ||
| 469 | /*map.removeOverlay(editCircle); | 471 | /*map.removeOverlay(editCircle); |
| 470 | map.removeOverlay(editPolygon); | 472 | map.removeOverlay(editPolygon); |
| 471 | 473 | ||
| @@ -527,6 +529,29 @@ var gb_ct_map = function () { | @@ -527,6 +529,29 @@ var gb_ct_map = function () { | ||
| 527 | //obj = null; | 529 | //obj = null; |
| 528 | } | 530 | } |
| 529 | }; | 531 | }; |
| 532 | + | ||
| 533 | + var closeInfoWin = function () { | ||
| 534 | + map.closeInfoWindow(); | ||
| 535 | + }; | ||
| 536 | + | ||
| 537 | + /** | ||
| 538 | + * 为新增的站点选择一个位置 | ||
| 539 | + */ | ||
| 540 | + var showAddPointPanel = function (name) { | ||
| 541 | + map_status = 1; | ||
| 542 | + var spp = gb_station_route.getTemps()['geo_d_e_add_search_point_panel-temp']({name: name}); | ||
| 543 | + $('body').append(spp); | ||
| 544 | + | ||
| 545 | + //按名称定位地图位置 | ||
| 546 | + var local = new BMap.LocalSearch(map, { | ||
| 547 | + renderOptions:{map: map}, | ||
| 548 | + onMarkersSet: function (pos) { | ||
| 549 | + console.log('onMarkersSet', pos); | ||
| 550 | + } | ||
| 551 | + }); | ||
| 552 | + local.search(name + "-公交车站"); | ||
| 553 | + }; | ||
| 554 | + | ||
| 530 | res_load_ep.emitLater('load_map'); | 555 | res_load_ep.emitLater('load_map'); |
| 531 | return { | 556 | return { |
| 532 | _render: _render, | 557 | _render: _render, |
| @@ -542,6 +567,11 @@ var gb_ct_map = function () { | @@ -542,6 +567,11 @@ var gb_ct_map = function () { | ||
| 542 | getDrawPolygon: function () { | 567 | getDrawPolygon: function () { |
| 543 | return editPolygon; | 568 | return editPolygon; |
| 544 | }, | 569 | }, |
| 545 | - updateDragRadius: updateDragRadius | 570 | + updateDragRadius: updateDragRadius, |
| 571 | + closeInfoWin: closeInfoWin, | ||
| 572 | + showAddPointPanel: showAddPointPanel, | ||
| 573 | + resetMapStatus: function () { | ||
| 574 | + map_status = 0; | ||
| 575 | + } | ||
| 546 | }; | 576 | }; |
| 547 | }(); | 577 | }(); |
| 548 | \ No newline at end of file | 578 | \ No newline at end of file |
src/main/resources/static/pages/base/geo_data_edit/js/station_route.js
| @@ -77,23 +77,73 @@ var gb_station_route = function () { | @@ -77,23 +77,73 @@ var gb_station_route = function () { | ||
| 77 | return null; | 77 | return null; |
| 78 | }; | 78 | }; |
| 79 | 79 | ||
| 80 | + /** | ||
| 81 | + * 编辑站点名称 | ||
| 82 | + * @param station | ||
| 83 | + */ | ||
| 84 | + var station_edit_name = function (station) { | ||
| 85 | + var cellWrap = getStationLI(station); | ||
| 86 | + $('a[data-code]', cellWrap).hide(); | ||
| 87 | + | ||
| 88 | + cellWrap.append(temps['geo_d_e_edit_name_panel-temp'](station)).addClass('_edit_name'); | ||
| 89 | + //焦点 | ||
| 90 | + $('input[name=stationName]', cellWrap).focus(); | ||
| 91 | + //取消 | ||
| 92 | + $('.cancel_icon_btn', cellWrap).on('click', function () { | ||
| 93 | + $('.ul_li_input', cellWrap).remove(); | ||
| 94 | + $('a[data-code]', cellWrap).show(); | ||
| 95 | + }); | ||
| 96 | + }; | ||
| 97 | + | ||
| 98 | + var getStationLI = function (s) { | ||
| 99 | + return $('.up_down_route_list>li:eq('+s.directions+')>.station_route .station_li_' + s.stationCode); | ||
| 100 | + }; | ||
| 101 | + | ||
| 102 | + var insert_station_before = function (station) { | ||
| 103 | + //在之前插入站点 | ||
| 104 | + var cell = getStationLI(station); | ||
| 105 | + | ||
| 106 | + var addCell = $(temps['geo_d_e_add_station_panel-temp'](station)); | ||
| 107 | + cell.before(addCell); | ||
| 108 | + | ||
| 109 | + gb_ct_map.closeInfoWin(); | ||
| 110 | + //焦点 | ||
| 111 | + var $nameInput = $('input[name=stationName]', addCell); | ||
| 112 | + $nameInput.focus(); | ||
| 113 | + //取消 | ||
| 114 | + $('.cancel_icon_btn', addCell).on('click', function () { | ||
| 115 | + addCell.remove(); | ||
| 116 | + }); | ||
| 117 | + | ||
| 118 | + //选择地图位置 | ||
| 119 | + $('.search_point_icon_btn', addCell).on('click', function () { | ||
| 120 | + var name = $nameInput.val(); | ||
| 121 | + if(!name) | ||
| 122 | + return UIkit.notification("你必须输入站点名称!", {status: 'danger',pos: 'bottom-left'}); | ||
| 123 | + | ||
| 124 | + $('.main_left_panel_m_layer').show(); | ||
| 125 | + gb_ct_map.showAddPointPanel(name); | ||
| 126 | + }); | ||
| 127 | + }; | ||
| 128 | + | ||
| 80 | var realEditStation; | 129 | var realEditStation; |
| 81 | var callbackHandler = { | 130 | var callbackHandler = { |
| 82 | edit_buffer: function (station) { | 131 | edit_buffer: function (station) { |
| 83 | - //编辑缓冲区 | ||
| 84 | - realEditStation = station; | ||
| 85 | gb_ct_map.editStationBuffer(station); | 132 | gb_ct_map.editStationBuffer(station); |
| 86 | - } | 133 | + }, |
| 134 | + edit_name: station_edit_name, | ||
| 135 | + insert_before: insert_station_before | ||
| 87 | }; | 136 | }; |
| 88 | 137 | ||
| 89 | $.contextMenu({ | 138 | $.contextMenu({ |
| 90 | - selector: '._route_info_wrap .up_down_route_list .station_route>ul>li', | 139 | + selector: '._route_info_wrap .up_down_route_list .station_route>ul>li>a[data-code]', |
| 91 | className: 'station-route-ct-menu', | 140 | className: 'station-route-ct-menu', |
| 92 | callback: function (key, options) { | 141 | callback: function (key, options) { |
| 93 | - var aLink = options.$trigger.find('a[data-code]'); | 142 | + var aLink = options.$trigger; |
| 94 | var code = aLink.data('code'), | 143 | var code = aLink.data('code'), |
| 95 | updown = aLink.data('updown'); | 144 | updown = aLink.data('updown'); |
| 96 | var station = getStation(code, updown); | 145 | var station = getStation(code, updown); |
| 146 | + realEditStation = station; | ||
| 97 | callbackHandler[key] && callbackHandler[key](station); | 147 | callbackHandler[key] && callbackHandler[key](station); |
| 98 | }, | 148 | }, |
| 99 | items: { | 149 | items: { |
| @@ -101,14 +151,17 @@ var gb_station_route = function () { | @@ -101,14 +151,17 @@ var gb_station_route = function () { | ||
| 101 | name: '编辑缓冲区' | 151 | name: '编辑缓冲区' |
| 102 | }, | 152 | }, |
| 103 | 'sep1': '---------', | 153 | 'sep1': '---------', |
| 104 | - 'edit': { | ||
| 105 | - name: '编辑基础信息' | 154 | + 'edit_name': { |
| 155 | + name: '修改站点名称' | ||
| 106 | }, | 156 | }, |
| 107 | 'insert_before': { | 157 | 'insert_before': { |
| 108 | - name: '新增站点(前)' | 158 | + name: '新增站点(之前)' |
| 109 | }, | 159 | }, |
| 110 | 'insert_after': { | 160 | 'insert_after': { |
| 111 | - name: '新增站点(后)' | 161 | + name: '新增站点(之后)' |
| 162 | + }, | ||
| 163 | + 'destroy': { | ||
| 164 | + name: '撤销站点' | ||
| 112 | } | 165 | } |
| 113 | } | 166 | } |
| 114 | }); | 167 | }); |
| @@ -119,10 +172,6 @@ var gb_station_route = function () { | @@ -119,10 +172,6 @@ var gb_station_route = function () { | ||
| 119 | $('.buffer_edit_panel').show(); | 172 | $('.buffer_edit_panel').show(); |
| 120 | }; | 173 | }; |
| 121 | 174 | ||
| 122 | - var hideEditPanel = function () { | ||
| 123 | - $('.buffer_edit_panel').remove(); | ||
| 124 | - }; | ||
| 125 | - | ||
| 126 | var edPanelRunFlag; | 175 | var edPanelRunFlag; |
| 127 | var ecObj; | 176 | var ecObj; |
| 128 | var reWriteEditPanel = function (ec, isPolygon) { | 177 | var reWriteEditPanel = function (ec, isPolygon) { |
| @@ -157,8 +206,22 @@ var gb_station_route = function () { | @@ -157,8 +206,22 @@ var gb_station_route = function () { | ||
| 157 | break; | 206 | break; |
| 158 | } | 207 | } |
| 159 | } | 208 | } |
| 209 | + | ||
| 210 | + //替换 | ||
| 211 | + var sCell = $(temps['geo_d_e_station_route_one-temp'](s)); | ||
| 212 | + $('a.uk-animation-shake', sCell).on('webkitAnimationEnd', function () { | ||
| 213 | + $(this).removeClass('uk-animation-shake'); | ||
| 214 | + }); | ||
| 215 | + getStationLI(s).replaceWith(sCell); | ||
| 160 | }; | 216 | }; |
| 161 | 217 | ||
| 218 | + //取消按钮 | ||
| 219 | + $(document).on('click','.buffer_edit_body button.cancel', function (e) { | ||
| 220 | + $('.main_left_panel_m_layer').hide(); | ||
| 221 | + $(this).parents('.buffer_edit_body').parent().remove(); | ||
| 222 | + gb_ct_map.resetMapStatus(); | ||
| 223 | + }); | ||
| 224 | + | ||
| 162 | 225 | ||
| 163 | var $editWrap = '.buffer_edit_panel>.buffer_edit_body'; | 226 | var $editWrap = '.buffer_edit_panel>.buffer_edit_body'; |
| 164 | /** | 227 | /** |
| @@ -230,7 +293,6 @@ var gb_station_route = function () { | @@ -230,7 +293,6 @@ var gb_station_route = function () { | ||
| 230 | $(drawPolygonSwitch).data('type', 2).find('a').text('重新绘制'); | 293 | $(drawPolygonSwitch).data('type', 2).find('a').text('重新绘制'); |
| 231 | }; | 294 | }; |
| 232 | 295 | ||
| 233 | - | ||
| 234 | res_load_ep.emitLater('load_station_route'); | 296 | res_load_ep.emitLater('load_station_route'); |
| 235 | return { | 297 | return { |
| 236 | init: init, | 298 | init: init, |
| @@ -243,7 +305,6 @@ var gb_station_route = function () { | @@ -243,7 +305,6 @@ var gb_station_route = function () { | ||
| 243 | clearFocus: clearFocus, | 305 | clearFocus: clearFocus, |
| 244 | focus: focus, | 306 | focus: focus, |
| 245 | showEditPanel: showEditPanel, | 307 | showEditPanel: showEditPanel, |
| 246 | - hideEditPanel: hideEditPanel, | ||
| 247 | reWriteEditPanel: reWriteEditPanel, | 308 | reWriteEditPanel: reWriteEditPanel, |
| 248 | update: update, | 309 | update: update, |
| 249 | drawEnd: drawEnd, | 310 | drawEnd: drawEnd, |
src/main/resources/static/pages/base/geo_data_edit/js/submit.js
| @@ -27,7 +27,7 @@ var gb_data_submit = function () { | @@ -27,7 +27,7 @@ var gb_data_submit = function () { | ||
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | //gb_ct_map.removeDragMarkerEvent(); | 29 | //gb_ct_map.removeDragMarkerEvent(); |
| 30 | - show_run_text('正在提交缓冲区信息'); | 30 | + show_run_text('正在提交缓冲区信息...'); |
| 31 | gb_common.$post('/_geo_data/updateBufferInfo', data, function (rs) { | 31 | gb_common.$post('/_geo_data/updateBufferInfo', data, function (rs) { |
| 32 | hide_run_text(); | 32 | hide_run_text(); |
| 33 | UIkit.notification("提交成功!", {status: 'success'}); | 33 | UIkit.notification("提交成功!", {status: 'success'}); |
| @@ -38,12 +38,28 @@ var gb_data_submit = function () { | @@ -38,12 +38,28 @@ var gb_data_submit = function () { | ||
| 38 | //退出编辑模式 | 38 | //退出编辑模式 |
| 39 | gb_ct_map.exitEditBufferStatus(rs.station); | 39 | gb_ct_map.exitEditBufferStatus(rs.station); |
| 40 | }); | 40 | }); |
| 41 | - }, function () { | ||
| 42 | - console.log('Rejected.') | ||
| 43 | }); | 41 | }); |
| 44 | return false; | 42 | return false; |
| 45 | }); | 43 | }); |
| 46 | 44 | ||
| 45 | + /** | ||
| 46 | + * 修改名称提交 | ||
| 47 | + */ | ||
| 48 | + $(document).on('click', '.up_down_route_list .station_route .ul_li_input .save_icon_btn', function (e) { | ||
| 49 | + var f = $(this).parents('form'); | ||
| 50 | + var data = f.serializeJSON(); | ||
| 51 | + | ||
| 52 | + UIkit.modal.confirm('确定将站点名称修改为【'+data.stationName+'】?').then(function() { | ||
| 53 | + show_run_text('正在保存...'); | ||
| 54 | + | ||
| 55 | + gb_common.$post('/_geo_data/updateStationName', data, function (rs) { | ||
| 56 | + hide_run_text(); | ||
| 57 | + UIkit.notification("修改成功!", {status: 'success'}); | ||
| 58 | + gb_station_route.update(rs.station); | ||
| 59 | + }); | ||
| 60 | + }); | ||
| 61 | + }); | ||
| 62 | + | ||
| 47 | var show_run_text = function (t) { | 63 | var show_run_text = function (t) { |
| 48 | $('.text', $loadPanel).text(t); | 64 | $('.text', $loadPanel).text(t); |
| 49 | $loadPanel.show(); | 65 | $loadPanel.show(); |