Commit 46b88679c6e5bdc44d3fa32350f075402e535ea7
1 parent
50f5e720
update...
Showing
5 changed files
with
583 additions
and
489 deletions
src/main/java/com/bsth/controller/realcontrol/PageForwardingController.java
0 → 100644
| 1 | +package com.bsth.controller.realcontrol; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.sys.SysUser; | ||
| 4 | +import com.bsth.security.util.SecurityUtils; | ||
| 5 | +import org.springframework.stereotype.Controller; | ||
| 6 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 7 | +import org.springframework.web.servlet.ModelAndView; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 线调登入页面转发 | ||
| 11 | + * Created by panzhao on 2017/1/21. | ||
| 12 | + */ | ||
| 13 | +@Controller | ||
| 14 | +@RequestMapping("real_control") | ||
| 15 | +public class PageForwardingController { | ||
| 16 | + | ||
| 17 | + @RequestMapping("/v2") | ||
| 18 | + public ModelAndView v2(){ | ||
| 19 | + ModelAndView mv = new ModelAndView(); | ||
| 20 | + SysUser user = SecurityUtils.getCurrentUser(); | ||
| 21 | + | ||
| 22 | + //班次管理员 | ||
| 23 | + if(user.getUserName().equals("bcgly")){ | ||
| 24 | + mv.setViewName("/real_control_v2/sch_manage/sch_imitate.html"); | ||
| 25 | + } | ||
| 26 | + //正常线调主页 | ||
| 27 | + else | ||
| 28 | + mv.setViewName("/real_control_v2/main.html"); | ||
| 29 | + return mv; | ||
| 30 | + } | ||
| 31 | +} |
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
| @@ -9,6 +9,7 @@ import com.bsth.data.schedule.DayOfSchedule; | @@ -9,6 +9,7 @@ import com.bsth.data.schedule.DayOfSchedule; | ||
| 9 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 9 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 10 | import com.bsth.repository.CarParkRepository; | 10 | import com.bsth.repository.CarParkRepository; |
| 11 | import com.bsth.repository.StationRepository; | 11 | import com.bsth.repository.StationRepository; |
| 12 | +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | ||
| 12 | import com.bsth.util.DateUtils; | 13 | import com.bsth.util.DateUtils; |
| 13 | import com.bsth.util.TransGPS; | 14 | import com.bsth.util.TransGPS; |
| 14 | import com.bsth.util.TransGPS.Location; | 15 | import com.bsth.util.TransGPS.Location; |
| @@ -52,6 +53,9 @@ public class GpsServiceImpl implements GpsService { | @@ -52,6 +53,9 @@ public class GpsServiceImpl implements GpsService { | ||
| 52 | @Autowired | 53 | @Autowired |
| 53 | DayOfSchedule dayOfSchedule; | 54 | DayOfSchedule dayOfSchedule; |
| 54 | 55 | ||
| 56 | + @Autowired | ||
| 57 | + ScheduleRealInfoRepository scheduleRealInfoRepository; | ||
| 58 | + | ||
| 55 | // 历史gps查询 | 59 | // 历史gps查询 |
| 56 | @Override | 60 | @Override |
| 57 | public List<Map<String, Object>> history(String device, Long startTime, Long endTime, int directions) { | 61 | public List<Map<String, Object>> history(String device, Long startTime, Long endTime, int directions) { |
| @@ -434,15 +438,37 @@ public class GpsServiceImpl implements GpsService { | @@ -434,15 +438,37 @@ public class GpsServiceImpl implements GpsService { | ||
| 434 | return rs; | 438 | return rs; |
| 435 | } | 439 | } |
| 436 | 440 | ||
| 437 | - String sql = "select * from bsth_gps_template where line_id='" + sch.getXlBm() + "' and updown=" + sch.getXlDir(); | 441 | + if(sch.isReissue()){ |
| 442 | + rs.put("status", ResponseCode.ERROR); | ||
| 443 | + rs.put("msg", "你不能重复这个操作"); | ||
| 444 | + return rs; | ||
| 445 | + } | ||
| 446 | + | ||
| 447 | + String sql = "select * from bsth_gps_template where line_id='" + sch.getXlBm() + "' and up_down=" + sch.getXlDir(); | ||
| 438 | List<Map<String, Object>> list = jdbcTemplate.queryForList(sql); | 448 | List<Map<String, Object>> list = jdbcTemplate.queryForList(sql); |
| 439 | 449 | ||
| 440 | if(list.size() == 0){ | 450 | if(list.size() == 0){ |
| 441 | rs.put("status", ResponseCode.ERROR); | 451 | rs.put("status", ResponseCode.ERROR); |
| 442 | - rs.put("msg", "缺少模板数据!!!"); | 452 | + rs.put("msg", "缺少模板数据,请联系系统管理员!!"); |
| 443 | return rs; | 453 | return rs; |
| 444 | } | 454 | } |
| 455 | + //排序 | ||
| 456 | + Collections.sort(list, new Comparator<Map<String, Object>>() { | ||
| 457 | + @Override | ||
| 458 | + public int compare(Map<String, Object> o1, Map<String, Object> o2) { | ||
| 459 | + return (int) (Long.parseLong(o1.get("ts").toString()) - Long.parseLong(o2.get("ts").toString())); | ||
| 460 | + } | ||
| 461 | + }); | ||
| 445 | Map<String, Object> fs = list.get(0); | 462 | Map<String, Object> fs = list.get(0); |
| 463 | + //替换设备号和时间 | ||
| 464 | + int diff = (int) (sch.getDfsjT() - Long.parseLong(fs.get("ts").toString()) - 1000 * 70); | ||
| 465 | + | ||
| 466 | + String deviceId = BasicData.deviceId2NbbmMap.inverse().get(sch.getClZbh()); | ||
| 467 | + for(Map<String, Object> map : list){ | ||
| 468 | + map.put("device_id", deviceId); | ||
| 469 | + map.put("ts", Long.parseLong(map.get("ts").toString()) + diff); | ||
| 470 | + } | ||
| 471 | + | ||
| 446 | String sqlBefore = "insert into bsth_c_template(" | 472 | String sqlBefore = "insert into bsth_c_template(" |
| 447 | ,sqlValues = " values("; | 473 | ,sqlValues = " values("; |
| 448 | 474 | ||
| @@ -469,7 +495,12 @@ public class GpsServiceImpl implements GpsService { | @@ -469,7 +495,12 @@ public class GpsServiceImpl implements GpsService { | ||
| 469 | } | 495 | } |
| 470 | ps.executeBatch(); | 496 | ps.executeBatch(); |
| 471 | conn.commit(); | 497 | conn.commit(); |
| 472 | - ps.clearBatch(); | 498 | + |
| 499 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 500 | + | ||
| 501 | + //标记班次 | ||
| 502 | + sch.setReissue(true); | ||
| 503 | + scheduleRealInfoRepository.save(sch); | ||
| 473 | 504 | ||
| 474 | rs.put("status", ResponseCode.SUCCESS); | 505 | rs.put("status", ResponseCode.SUCCESS); |
| 475 | } catch (Exception e) { | 506 | } catch (Exception e) { |
src/main/resources/static/pages/control/lineallot/allot.html
| 1 | <style> | 1 | <style> |
| 2 | -.line-select{ | ||
| 3 | - border: 1px solid #ddd; | ||
| 4 | - height: 350px; | ||
| 5 | - margin-top: 15px; | ||
| 6 | - box-shadow: 0 2px 5px 0 rgba(221, 221, 221, 0.24), 0 2px 10px 0 rgba(221, 221, 221, 0.24); | ||
| 7 | -} | ||
| 8 | - | ||
| 9 | -.line-select.selected{ | ||
| 10 | - height: 190px; | ||
| 11 | -} | ||
| 12 | - | ||
| 13 | -.line-select .company{ | ||
| 14 | - font-family: 仿宋; | ||
| 15 | - font-weight: 600; | ||
| 16 | -} | ||
| 17 | - | ||
| 18 | -.line-select .line{ | ||
| 19 | - display: inline-block; | ||
| 20 | - padding: 8px; | ||
| 21 | - min-width: 85px; | ||
| 22 | - text-align: center; | ||
| 23 | - border: 1px solid #C1C1C1; | ||
| 24 | - color: #666; | ||
| 25 | - border-radius: 5px !important; | ||
| 26 | - margin: 5px; | ||
| 27 | -} | ||
| 28 | - | ||
| 29 | -.line-select .line.active{ | ||
| 30 | - color: white; | ||
| 31 | - background: #32C5D2; | ||
| 32 | - border: 1px solid #32C5D2; | ||
| 33 | -} | ||
| 34 | - | ||
| 35 | -.line-select-cont{ | ||
| 36 | - text-align: left; | ||
| 37 | - overflow: auto; | ||
| 38 | - height: 270px; | ||
| 39 | - padding-right: 0px; | ||
| 40 | -} | ||
| 41 | - | ||
| 42 | -.line-select-cont .slimScrollBar{ | ||
| 43 | - background: rgb(50, 197, 210) !important; | ||
| 44 | - border-radius: 5px !important; | ||
| 45 | -} | ||
| 46 | - | ||
| 47 | -.line-select .search-input{ | ||
| 48 | - margin: 25px 0 5px 0; | ||
| 49 | - padding-left: 0; | ||
| 50 | -} | ||
| 51 | - | ||
| 52 | -.line-select .search-input .input-icon-lg{ | ||
| 53 | - box-shadow: 0 2px 5px 0 rgba(194, 202, 216, 0.49), 0 2px 10px 0 rgba(194, 202, 216, 0.49) !important; | ||
| 54 | -} | ||
| 55 | - | ||
| 56 | -.line-select .fa-search{ | ||
| 57 | - color: #32c5d2 !important; | ||
| 58 | -} | ||
| 59 | - | ||
| 60 | -.line-select .fa-plus-circle{ | ||
| 61 | - cursor: pointer; | ||
| 62 | - transform: rotate(43deg); | ||
| 63 | -} | ||
| 64 | - | ||
| 65 | -.line-select .fa-plus-circle:hover{ | ||
| 66 | - color: #A9A9A9; | ||
| 67 | -} | ||
| 68 | - | ||
| 69 | -.selected .line{ | ||
| 70 | - display: inline-block !important; | ||
| 71 | -} | ||
| 72 | -.load-text{ | ||
| 73 | - position: absolute; | ||
| 74 | - top: 50%; | ||
| 75 | - left: 50%; | ||
| 76 | - transform: translate(-50%); | ||
| 77 | - font-size: 14px; | ||
| 78 | - font-family: 仿宋; | ||
| 79 | -} | ||
| 80 | - | ||
| 81 | -/* .selected a{ | ||
| 82 | - position: absolute; | ||
| 83 | - bottom: 20px; | ||
| 84 | -} | ||
| 85 | -.selected a.btn{ | ||
| 86 | - bottom: 10px; | ||
| 87 | -} */ | ||
| 88 | - | ||
| 89 | -.lb_panel{ | ||
| 90 | - position: absolute; | ||
| 91 | - bottom: 20px; | ||
| 92 | -} | ||
| 93 | - | ||
| 94 | -.lb_panel a{ | ||
| 95 | - margin-right: 5px; | ||
| 96 | -} | ||
| 97 | - | ||
| 98 | -.gotoControl.red{ | ||
| 99 | - background: #ec7b7b; | ||
| 100 | - border-color: #ec7b7b; | ||
| 101 | -} | ||
| 102 | - | ||
| 103 | -.gotoControl.red:hover{ | ||
| 104 | - background: #d96262; | ||
| 105 | - border-color: #d96262; | ||
| 106 | -} | ||
| 107 | - | ||
| 108 | -#resetBtn,#historyBtn{ | ||
| 109 | - vertical-align: bottom; | ||
| 110 | - display: inline-block; | ||
| 111 | - margin-bottom: 3px; | ||
| 112 | -} | ||
| 113 | - | ||
| 114 | -/** 闵行没有分公司,直接隐藏 */ | ||
| 115 | -.company,.sub-company{ | ||
| 116 | - display: none !important; | ||
| 117 | -} | 2 | + .line-select { |
| 3 | + border: 1px solid #ddd; | ||
| 4 | + height: 350px; | ||
| 5 | + margin-top: 15px; | ||
| 6 | + box-shadow: 0 2px 5px 0 rgba(221, 221, 221, 0.24), 0 2px 10px 0 rgba(221, 221, 221, 0.24); | ||
| 7 | + } | ||
| 8 | + | ||
| 9 | + .line-select.selected { | ||
| 10 | + height: 190px; | ||
| 11 | + } | ||
| 12 | + | ||
| 13 | + .line-select .company { | ||
| 14 | + font-family: 仿宋; | ||
| 15 | + font-weight: 600; | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + .line-select .line { | ||
| 19 | + display: inline-block; | ||
| 20 | + padding: 8px; | ||
| 21 | + min-width: 85px; | ||
| 22 | + text-align: center; | ||
| 23 | + border: 1px solid #C1C1C1; | ||
| 24 | + color: #666; | ||
| 25 | + border-radius: 5px !important; | ||
| 26 | + margin: 5px; | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + .line-select .line.active { | ||
| 30 | + color: white; | ||
| 31 | + background: #32C5D2; | ||
| 32 | + border: 1px solid #32C5D2; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + .line-select-cont { | ||
| 36 | + text-align: left; | ||
| 37 | + overflow: auto; | ||
| 38 | + height: 270px; | ||
| 39 | + padding-right: 0px; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + .line-select-cont .slimScrollBar { | ||
| 43 | + background: rgb(50, 197, 210) !important; | ||
| 44 | + border-radius: 5px !important; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + .line-select .search-input { | ||
| 48 | + margin: 25px 0 5px 0; | ||
| 49 | + padding-left: 0; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + .line-select .search-input .input-icon-lg { | ||
| 53 | + box-shadow: 0 2px 5px 0 rgba(194, 202, 216, 0.49), 0 2px 10px 0 rgba(194, 202, 216, 0.49) !important; | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + .line-select .fa-search { | ||
| 57 | + color: #32c5d2 !important; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + .line-select .fa-plus-circle { | ||
| 61 | + cursor: pointer; | ||
| 62 | + transform: rotate(43deg); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + .line-select .fa-plus-circle:hover { | ||
| 66 | + color: #A9A9A9; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + .selected .line { | ||
| 70 | + display: inline-block !important; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + .load-text { | ||
| 74 | + position: absolute; | ||
| 75 | + top: 50%; | ||
| 76 | + left: 50%; | ||
| 77 | + transform: translate(-50%); | ||
| 78 | + font-size: 14px; | ||
| 79 | + font-family: 仿宋; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + /* .selected a{ | ||
| 83 | + position: absolute; | ||
| 84 | + bottom: 20px; | ||
| 85 | + } | ||
| 86 | + .selected a.btn{ | ||
| 87 | + bottom: 10px; | ||
| 88 | + } */ | ||
| 89 | + | ||
| 90 | + .lb_panel { | ||
| 91 | + position: absolute; | ||
| 92 | + bottom: 20px; | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + .lb_panel a { | ||
| 96 | + margin-right: 5px; | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + .gotoControl.red { | ||
| 100 | + background: #ec7b7b; | ||
| 101 | + border-color: #ec7b7b; | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + .gotoControl.red:hover { | ||
| 105 | + background: #d96262; | ||
| 106 | + border-color: #d96262; | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + #resetBtn, #historyBtn { | ||
| 110 | + vertical-align: bottom; | ||
| 111 | + display: inline-block; | ||
| 112 | + margin-bottom: 3px; | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + /** 闵行没有分公司,直接隐藏 */ | ||
| 116 | + .company, .sub-company { | ||
| 117 | + display: none !important; | ||
| 118 | + } | ||
| 118 | </style> | 119 | </style> |
| 119 | 120 | ||
| 120 | <div class="page-head"> | 121 | <div class="page-head"> |
| 121 | - <div class="page-title"> | ||
| 122 | - <h1>线路分配</h1> | ||
| 123 | - </div> | 122 | + <div class="page-title"> |
| 123 | + <h1>线路分配</h1> | ||
| 124 | + </div> | ||
| 124 | </div> | 125 | </div> |
| 125 | 126 | ||
| 126 | <ul class="page-breadcrumb breadcrumb"> | 127 | <ul class="page-breadcrumb breadcrumb"> |
| 127 | - <li><a href="/pages/home.html" data-pjax>首页</a> <i | ||
| 128 | - class="fa fa-circle"></i></li> | ||
| 129 | - <li><span class="active">线路调度管理</span> <i class="fa fa-circle"></i></li> | ||
| 130 | - <li><span class="active">线路分配</span></li> | 128 | + <li><a href="/pages/home.html" data-pjax>首页</a> <i |
| 129 | + class="fa fa-circle"></i></li> | ||
| 130 | + <li><span class="active">线路调度管理</span> <i class="fa fa-circle"></i></li> | ||
| 131 | + <li><span class="active">线路分配</span></li> | ||
| 131 | </ul> | 132 | </ul> |
| 132 | 133 | ||
| 133 | <div class="portlet light bordered"> | 134 | <div class="portlet light bordered"> |
| 134 | - <div class="portlet-title"> | ||
| 135 | - <div class="caption"> | ||
| 136 | - <i class="icon-social-dribbble font-green"></i> <span | ||
| 137 | - class="caption-subject font-green bold uppercase">选择线路</span> | ||
| 138 | - </div> | ||
| 139 | - </div> | ||
| 140 | - <div class="portlet-body"> | ||
| 141 | - <div class="row" style="margin-bottom: 30px;"> | ||
| 142 | - <div class="col-md-8 col-sm-12 col-md-offset-2" style="text-align: center;"> | ||
| 143 | - <div class="col-md-12 line-select" > | ||
| 144 | - <div class="col-md-12 search-input" > | ||
| 145 | - <div class="col-md-6" style="padding-left: 0;"> | ||
| 146 | - <div class="input-icon input-icon-lg right" > | ||
| 147 | - <i class="fa fa-search"></i> | ||
| 148 | - <input type="text" id="searchLineInput" class="form-control input-lg" placeholder="搜索线路"> </div> | ||
| 149 | - </div> | ||
| 150 | - </div> | ||
| 151 | - <div class="line-select-cont col-md-12" > | ||
| 152 | - <div class="line-select-body" style="margin-top: 20px;"> | ||
| 153 | - <span class="load-text">加载中...</span> | ||
| 154 | - </div> | ||
| 155 | - </div> | 135 | + <div class="portlet-title"> |
| 136 | + <div class="caption"> | ||
| 137 | + <i class="icon-social-dribbble font-green"></i> <span | ||
| 138 | + class="caption-subject font-green bold uppercase">选择线路</span> | ||
| 139 | + </div> | ||
| 140 | + </div> | ||
| 141 | + <div class="portlet-body"> | ||
| 142 | + <div class="row" style="margin-bottom: 30px;"> | ||
| 143 | + <div class="col-md-8 col-sm-12 col-md-offset-2" style="text-align: center;"> | ||
| 144 | + <div class="col-md-12 line-select"> | ||
| 145 | + <div class="col-md-12 search-input"> | ||
| 146 | + <div class="col-md-6" style="padding-left: 0;"> | ||
| 147 | + <div class="input-icon input-icon-lg right"> | ||
| 148 | + <i class="fa fa-search"></i> | ||
| 149 | + <input type="text" id="searchLineInput" class="form-control input-lg" | ||
| 150 | + placeholder="搜索线路"></div> | ||
| 151 | + </div> | ||
| 152 | + </div> | ||
| 153 | + <div class="line-select-cont col-md-12"> | ||
| 154 | + <div class="line-select-body" style="margin-top: 20px;"> | ||
| 155 | + <span class="load-text">加载中...</span> | ||
| 156 | + </div> | ||
| 157 | + </div> | ||
| 156 | </div> | 158 | </div> |
| 157 | - | 159 | + |
| 158 | <div class="col-md-12 line-select selected" style="text-align: left;"> | 160 | <div class="col-md-12 line-select selected" style="text-align: left;"> |
| 159 | - <h5 style="font-family: 仿宋; display: block;">已选中线路</h5> | ||
| 160 | - <div class="selected-body"></div> | ||
| 161 | - | ||
| 162 | - <div class="lb_panel"> | ||
| 163 | - <a href="javascript:;" class="btn btn-lg blue gotoControl red" data-status=1> | ||
| 164 | - <i class="fa fa-power-off"></i> 主调模式 </a> | ||
| 165 | - | ||
| 166 | - <a href="javascript:;" id="monitor" class="btn btn-lg grey gotoControl" data-status=0> | ||
| 167 | - <i class="fa fa-tv"></i> 监控模式 </a> | ||
| 168 | - | ||
| 169 | - <a href="javascript:;" id="resetBtn" style="left: 120px;color: #3598DC;"> | ||
| 170 | - <i class="fa fa-history"></i> 重置</a> | ||
| 171 | - | ||
| 172 | - <a href="javascript:;" id="historyBtn" style="left: 180px;color: #f36a5a;"> | ||
| 173 | - <i class="fa fa-history"></i> 历史纪录 </a> | ||
| 174 | - </div> | 161 | + <h5 style="font-family: 仿宋; display: block;">已选中线路</h5> |
| 162 | + <div class="selected-body"></div> | ||
| 163 | + | ||
| 164 | + <div class="lb_panel"> | ||
| 165 | + <a href="javascript:;" class="btn btn-lg blue gotoControl red" data-status=1> | ||
| 166 | + <i class="fa fa-power-off"></i> 主调模式 </a> | ||
| 167 | + | ||
| 168 | + <a href="javascript:;" id="monitor" class="btn btn-lg grey gotoControl" data-status=0> | ||
| 169 | + <i class="fa fa-tv"></i> 监控模式 </a> | ||
| 170 | + | ||
| 171 | + <a href="javascript:;" id="resetBtn" style="left: 120px;color: #3598DC;"> | ||
| 172 | + <i class="fa fa-history"></i> 重置</a> | ||
| 173 | + | ||
| 174 | + <a href="javascript:;" id="historyBtn" style="left: 180px;color: #f36a5a;"> | ||
| 175 | + <i class="fa fa-history"></i> 历史纪录 </a> | ||
| 176 | + </div> | ||
| 175 | </div> | 177 | </div> |
| 176 | - </div> | ||
| 177 | - </div> | ||
| 178 | - </div> | 178 | + </div> |
| 179 | + </div> | ||
| 180 | + </div> | ||
| 179 | </div> | 181 | </div> |
| 180 | 182 | ||
| 181 | <div class="clone_line"> | 183 | <div class="clone_line"> |
| 182 | </div> | 184 | </div> |
| 183 | 185 | ||
| 184 | <script id="line_select_cont_temp" type="text/html"> | 186 | <script id="line_select_cont_temp" type="text/html"> |
| 185 | -{{each data as obj company}} | ||
| 186 | - <h3 class="company" >{{company}}</h3> | ||
| 187 | - {{each data[company] as subObj subCompany}} | ||
| 188 | - <h5 class="sub-company" style="font-family: 仿宋;">{{company}}_{{subCompany}}</h5> | ||
| 189 | - {{each data[company][subCompany] as line i}} | ||
| 190 | - <div class="line" name="line_{{line.lineCode}}" data-id={{line.lineCode}}>{{line.name}}</div> | ||
| 191 | - {{/each}} | ||
| 192 | - {{/each}} | ||
| 193 | -{{/each}} | 187 | + {{each data as obj company}} |
| 188 | + <h3 class="company">{{company}}</h3> | ||
| 189 | + {{each data[company] as subObj subCompany}} | ||
| 190 | + <h5 class="sub-company" style="font-family: 仿宋;">{{company}}_{{subCompany}}</h5> | ||
| 191 | + {{each data[company][subCompany] as line i}} | ||
| 192 | + <div class="line" name="line_{{line.lineCode}}" data-id={{line.lineCode}}>{{line.name}}</div> | ||
| 193 | + {{/each}} | ||
| 194 | + {{/each}} | ||
| 195 | + {{/each}} | ||
| 194 | </script> | 196 | </script> |
| 195 | <script src="/assets/js/eventproxy.js"></script> | 197 | <script src="/assets/js/eventproxy.js"></script> |
| 196 | <script> | 198 | <script> |
| 197 | -$(function(){ | ||
| 198 | - //大写字母映射 | ||
| 199 | - var camelChars = {}; | ||
| 200 | - //全拼映射 | ||
| 201 | - var fullChars = {}; | ||
| 202 | - //中文映射 | ||
| 203 | - var zhChars = {}; | ||
| 204 | - //合并所有映射 | ||
| 205 | - var allChars = {}; | ||
| 206 | - | ||
| 207 | - //线路编码映射 | ||
| 208 | - var lineIdMap = {}; | ||
| 209 | - | ||
| 210 | - //线路编码和名称对照 (写入localStorage,线调用) | ||
| 211 | - var lineIds = {}; | ||
| 212 | - | ||
| 213 | - var storage = window.localStorage; | ||
| 214 | - | ||
| 215 | - $get('/line/all', {destroy_eq:0}, function(allLine){ | ||
| 216 | - $('#searchLineInput').focus(); | ||
| 217 | - //按公司分组 | ||
| 218 | - var companyJson = groupData(allLine, 'company'); | ||
| 219 | - //按分公司分组 | ||
| 220 | - for(var company in companyJson){ | ||
| 221 | - companyJson[company] = groupData(companyJson[company], 'brancheCompany'); | ||
| 222 | - } | ||
| 223 | - | ||
| 224 | - var htmlStr = template('line_select_cont_temp', {data: companyJson}); | ||
| 225 | - $('.line-select-body').html(htmlStr) | ||
| 226 | - .slimscroll({//滚动条 | ||
| 227 | - height: '270px' | ||
| 228 | - }); | ||
| 229 | - | ||
| 230 | - //替换公司编码 | ||
| 231 | -/* var gsmap = {}; | ||
| 232 | - $get('/business/all', null, function(array){ | ||
| 233 | - $.each(array, function(i, gs){ | ||
| 234 | - var k = gs.upCode + '_' + gs.businessCode; | ||
| 235 | - if(gs.upCode === '88'){ | ||
| 236 | - k = gs.businessCode; | ||
| 237 | - } | ||
| 238 | - gsmap[k] = gs.businessName; | ||
| 239 | - }); | ||
| 240 | - | ||
| 241 | - $.each($('.company,.sub-company'), function(j , e){ | ||
| 242 | - var k = $(e).text(); | ||
| 243 | - gsmap[k] && $(e).text(gsmap[k]); | ||
| 244 | - }) | ||
| 245 | - }); */ | ||
| 246 | - | ||
| 247 | - //映射 | ||
| 248 | - $.each(allLine, function(s, line){ | ||
| 249 | - camelChars[pinyin.getCamelChars(line.name)] = line.lineCode; | ||
| 250 | - fullChars[pinyin.getFullChars(line.name).toUpperCase()] = line.lineCode; | ||
| 251 | - zhChars[line.name] = line.lineCode; | ||
| 252 | - lineIdMap[line.lineCode] = line; | ||
| 253 | - | ||
| 254 | - lineIds[line.lineCode] = line.name; | ||
| 255 | - }); | ||
| 256 | - //合并映射 | ||
| 257 | - $.extend(allChars, camelChars, fullChars, zhChars); | ||
| 258 | - | ||
| 259 | - //线路选中事件 | ||
| 260 | - $('.line-select-body .line').on('click', function(){ | ||
| 261 | - if($(this).hasClass('active')){ | ||
| 262 | - $(this).removeClass('active'); | ||
| 263 | - $('.selected-body .line[name='+$(this).attr('name')+']').remove(); | ||
| 264 | - } | ||
| 265 | - else{ | ||
| 266 | - $(this).addClass('active'); | ||
| 267 | - $('.selected-body').append($(this).clone()); | ||
| 268 | - } | ||
| 269 | - }); | ||
| 270 | - | ||
| 271 | - storage.setItem('lineIds', JSON.stringify(lineIds)); | ||
| 272 | - }); | ||
| 273 | - | ||
| 274 | - //搜索框事件 | ||
| 275 | - $('#searchLineInput').on('keyup', filterLines); | ||
| 276 | - | ||
| 277 | - $('.line-select .input-icon i').on('click', function(){ | ||
| 278 | - if($(this).hasClass('fa-plus-circle')){ | ||
| 279 | - $('#searchLineInput').val(''); | ||
| 280 | - filterLines(); | ||
| 281 | - } | ||
| 282 | - }); | ||
| 283 | - | ||
| 284 | - $('.selected-body').on('click', '.line', function(){ | ||
| 285 | - $('.line-select-body .line[name='+$(this).attr('name')+']').removeClass('active'); | ||
| 286 | - $(this).remove(); | ||
| 287 | - }); | ||
| 288 | - | ||
| 289 | - //确定 | ||
| 290 | - $('.gotoControl').on('click', function(){ | ||
| 291 | - $.get('/user/currentUser', function (user) { | ||
| 292 | - //进入班次管理界面 | ||
| 293 | - if(user.userName == 'bcgly') | ||
| 294 | - window.location.href="/real_control_v2/sch_manage/sch_imitate.html"; | ||
| 295 | - else{ | ||
| 296 | - var lines = $('.selected-body .line'); | ||
| 297 | - if(lines.length == 0){ | ||
| 298 | - layer.alert('你还没有选择线路!',{icon: 3}); | ||
| 299 | - return; | ||
| 300 | - } | ||
| 301 | - | ||
| 302 | - showLoad('更新缓存信息...'); | ||
| 303 | - //将选择的线路写入localstorage | ||
| 304 | - var lsData = []; | ||
| 305 | - $.each(lines, function(i, e){ | ||
| 306 | - lsData.push(lineIdMap[$(e).data('id')]); | ||
| 307 | - }); | ||
| 308 | - storage.setItem('lineControlItems', JSON.stringify(lsData)); | ||
| 309 | - | ||
| 310 | - var operationMode = $(this).data('status'); | ||
| 311 | - //监控模式还是主调模式 | ||
| 312 | - storage.setItem('operationMode', operationMode); | ||
| 313 | - | ||
| 314 | - var ep = new EventProxy(); | ||
| 315 | - //缓存车辆自编号和设备号对照 | ||
| 316 | - cacheCar2DeviceId(function(){ | ||
| 317 | - delayEmit(ep, 'cacheRoute'); | ||
| 318 | - }); | ||
| 319 | - | ||
| 320 | - //缓存线路路由 | ||
| 321 | - ep.tail('cacheRoute', function(){ | ||
| 322 | - cacheRoute(lsData, function(cacheData){ | ||
| 323 | - delayEmit(ep, 'checkLineConfig'); | ||
| 324 | - }); | ||
| 325 | - }); | ||
| 326 | - | ||
| 327 | - //检查线路配置信息 | ||
| 328 | - ep.tail('checkLineConfig', function(){ | ||
| 329 | - checkLineConfig(lsData, function(rs){ | ||
| 330 | - if(rs.status == 0) | ||
| 331 | - delayEmit(ep, 'gotoControl', rs); | ||
| 332 | - else if(rs.status == 1) | ||
| 333 | - delayEmit(ep, 'initLineConfig', rs); | ||
| 334 | - }); | ||
| 335 | - }); | ||
| 336 | - | ||
| 337 | - //初始化没有 线路配置信息 的线路 | ||
| 338 | - ep.tail('initLineConfig',function(rs){ | ||
| 339 | - initLineConfig(rs.not, function(){ | ||
| 340 | - delayEmit(ep, 'gotoControl', rs); | ||
| 341 | - }); | ||
| 342 | - }); | ||
| 343 | - | ||
| 344 | - //进入线调 | ||
| 345 | - ep.tail('gotoControl', function(){ | ||
| 346 | - //alert('进入线调'); | ||
| 347 | - layer.closeAll(); | ||
| 348 | - //loadPage('/pages/control/line/index.html'); | ||
| 349 | - window.location.href="/real_control_v2/main.html"; | ||
| 350 | - }); | ||
| 351 | - } | ||
| 352 | - }); | ||
| 353 | - }); | ||
| 354 | - | ||
| 355 | - function checkLineConfig(lsData, cb){ | ||
| 356 | - showLoad('检查线路配置信息...'); | ||
| 357 | - var lineCodeArray = []; | ||
| 358 | - $.each(lsData, function(){ | ||
| 359 | - lineCodeArray.push(this.lineCode); | ||
| 360 | - }); | ||
| 361 | - | ||
| 362 | - $.ajax({ | ||
| 363 | - url: '/lineConfig/check', | ||
| 364 | - traditional: true, | ||
| 365 | - data: {codeArray: lineCodeArray}, | ||
| 366 | - method: 'POST', | ||
| 367 | - success: cb | ||
| 368 | - }); | ||
| 369 | - } | ||
| 370 | - | ||
| 371 | - function initLineConfig(arr, cb){ | ||
| 372 | - var i = 0; | ||
| 373 | - (function(){ | ||
| 374 | - if(i >= arr.length){ | ||
| 375 | - cb && cb(); | ||
| 376 | - return; | ||
| 377 | - } | ||
| 378 | - var f = arguments.callee | ||
| 379 | - ,lineCode = arr[i]; | ||
| 380 | - | ||
| 381 | - showLoad('初始化'+lineIds[lineCode]+'配置信息...'); | ||
| 382 | - $.post('/lineConfig/init/' + lineCode, function(rs){ | ||
| 383 | - if(rs == 1){ | ||
| 384 | - i ++; | ||
| 385 | - f(); | ||
| 386 | - } | ||
| 387 | - }); | ||
| 388 | - })(); | ||
| 389 | - } | ||
| 390 | - | ||
| 391 | - function cacheCar2DeviceId(cb){ | ||
| 392 | - //showLoad('缓存基础对照信息...'); | ||
| 393 | - $.get('/gps/Car2DeviceId', function(rs){ | ||
| 394 | - storage.setItem('car2DeviceId', JSON.stringify(rs)); | ||
| 395 | - cb && cb(); | ||
| 396 | - }); | ||
| 397 | - } | ||
| 398 | - | ||
| 399 | - function cacheRoute(lsData, cb){ | ||
| 400 | - //showLoad('缓存线路路由信息...'); | ||
| 401 | - var i = 0, cacheData = {}; | ||
| 402 | - (function(){ | ||
| 403 | - if(i >= lsData.length){ | ||
| 404 | - //写入localStorage | ||
| 405 | - for(var lineCode in cacheData) | ||
| 406 | - storage.setItem(lineCode + '_route', JSON.stringify(cacheData[lineCode])); | ||
| 407 | - | ||
| 408 | - cb && cb(); | ||
| 409 | - return; | ||
| 410 | - } | ||
| 411 | - var f = arguments.callee | ||
| 412 | - ,item = lsData[i]; | ||
| 413 | - | ||
| 414 | - $.get('/realMap/findRouteByLine', {lineCode: item.lineCode}, function(rs){ | ||
| 415 | - //$.get('/realSchedule/findRouteByLine', {lineCode: item.lineCode}, function(rs){ | ||
| 416 | - if(rs && rs.lineId){ | ||
| 417 | - cacheData[item.lineCode] = rs; | ||
| 418 | - i ++; | ||
| 419 | - f(); | ||
| 420 | - } | ||
| 421 | - }); | ||
| 422 | - })(); | ||
| 423 | - } | ||
| 424 | - | ||
| 425 | - //历史纪录 | ||
| 426 | - $('#historyBtn').on('click', function(){ | ||
| 427 | - var lineControlItems = window.localStorage.getItem('lineControlItems'); | ||
| 428 | - if(!lineControlItems){ | ||
| 429 | - layer.alert('没有在当前电脑找到历史纪录!',{icon: 3}); | ||
| 430 | - return; | ||
| 431 | - } | ||
| 432 | - else{ | ||
| 433 | - var array = JSON.parse(lineControlItems); | ||
| 434 | - clear(); | ||
| 435 | - $.each(array, function(i, line){ | ||
| 436 | - $('.line-select-body .line[name=line_'+line.lineCode+']').click(); | ||
| 437 | - }); | ||
| 438 | - } | ||
| 439 | - }); | ||
| 440 | - | ||
| 441 | - //重置 | ||
| 442 | - $('#resetBtn').on('click', clear); | ||
| 443 | - | ||
| 444 | - function clear(){ | ||
| 445 | - $('.line-select-body .line.active').removeClass('active'); | ||
| 446 | - $('.selected-body .line').remove(); | ||
| 447 | - | ||
| 448 | - $('.line-select .input-icon i.fa-plus-circle').click(); | ||
| 449 | - filterLines(); | ||
| 450 | - } | ||
| 451 | - | ||
| 452 | - function filterLines(){ | ||
| 453 | - var t = $('#searchLineInput').val().toUpperCase() | ||
| 454 | - ,es = [] | ||
| 455 | - ,bs = $('.line-select-body .line, .line-select-body .company, .line-select-body .sub-company') | ||
| 456 | - ,icon = $('.line-select .input-icon i'); | ||
| 457 | - | ||
| 458 | - if(!t){ | ||
| 459 | - bs.show(); | ||
| 460 | - icon.removeClass('fa-plus-circle').addClass('fa-search'); | ||
| 461 | - return; | ||
| 462 | - } | ||
| 463 | - else | ||
| 464 | - icon.removeClass('fa-search').addClass('fa-plus-circle'); | ||
| 465 | - | ||
| 466 | - for(var c in allChars){ | ||
| 467 | - if(c.indexOf(t) != -1) | ||
| 468 | - es.push('.line-select-body .line[name=line_' + allChars[c] + ']'); | ||
| 469 | - } | ||
| 470 | - | ||
| 471 | - bs.hide(); | ||
| 472 | - $.each(es, function(i, e){ | ||
| 473 | - $(e).show(); | ||
| 474 | - }); | ||
| 475 | - } | ||
| 476 | - | ||
| 477 | - function groupData(array, g){ | ||
| 478 | - var groups = {}, key; | ||
| 479 | - | ||
| 480 | - $.each(array, function(i, item){ | ||
| 481 | - key = item[g]; | ||
| 482 | - if(!groups[key]) | ||
| 483 | - groups[key] = []; | ||
| 484 | - | ||
| 485 | - groups[key].push(item); | ||
| 486 | - }); | ||
| 487 | - | ||
| 488 | - return groups; | ||
| 489 | - } | ||
| 490 | - | ||
| 491 | - function showLoad(text){ | ||
| 492 | - layer.msg(text, {icon: 16, time: 0, shade: 0.3}); | ||
| 493 | - } | ||
| 494 | - | ||
| 495 | - function delayEmit(ep, t, p){ | ||
| 496 | - setTimeout(function(){ | ||
| 497 | - ep.emit(t, p); | ||
| 498 | - }, 300); | ||
| 499 | - } | ||
| 500 | -}); | 199 | + $(function () { |
| 200 | + //大写字母映射 | ||
| 201 | + var camelChars = {}; | ||
| 202 | + //全拼映射 | ||
| 203 | + var fullChars = {}; | ||
| 204 | + //中文映射 | ||
| 205 | + var zhChars = {}; | ||
| 206 | + //合并所有映射 | ||
| 207 | + var allChars = {}; | ||
| 208 | + | ||
| 209 | + //线路编码映射 | ||
| 210 | + var lineIdMap = {}; | ||
| 211 | + | ||
| 212 | + //线路编码和名称对照 (写入localStorage,线调用) | ||
| 213 | + var lineIds = {}; | ||
| 214 | + | ||
| 215 | + var storage = window.localStorage; | ||
| 216 | + | ||
| 217 | + $get('/line/all', {destroy_eq: 0}, function (allLine) { | ||
| 218 | + $('#searchLineInput').focus(); | ||
| 219 | + //按公司分组 | ||
| 220 | + var companyJson = groupData(allLine, 'company'); | ||
| 221 | + //按分公司分组 | ||
| 222 | + for (var company in companyJson) { | ||
| 223 | + companyJson[company] = groupData(companyJson[company], 'brancheCompany'); | ||
| 224 | + } | ||
| 225 | + | ||
| 226 | + var htmlStr = template('line_select_cont_temp', {data: companyJson}); | ||
| 227 | + $('.line-select-body').html(htmlStr) | ||
| 228 | + .slimscroll({//滚动条 | ||
| 229 | + height: '270px' | ||
| 230 | + }); | ||
| 231 | + | ||
| 232 | + //替换公司编码 | ||
| 233 | + /* var gsmap = {}; | ||
| 234 | + $get('/business/all', null, function(array){ | ||
| 235 | + $.each(array, function(i, gs){ | ||
| 236 | + var k = gs.upCode + '_' + gs.businessCode; | ||
| 237 | + if(gs.upCode === '88'){ | ||
| 238 | + k = gs.businessCode; | ||
| 239 | + } | ||
| 240 | + gsmap[k] = gs.businessName; | ||
| 241 | + }); | ||
| 242 | + | ||
| 243 | + $.each($('.company,.sub-company'), function(j , e){ | ||
| 244 | + var k = $(e).text(); | ||
| 245 | + gsmap[k] && $(e).text(gsmap[k]); | ||
| 246 | + }) | ||
| 247 | + }); */ | ||
| 248 | + | ||
| 249 | + //映射 | ||
| 250 | + $.each(allLine, function (s, line) { | ||
| 251 | + camelChars[pinyin.getCamelChars(line.name)] = line.lineCode; | ||
| 252 | + fullChars[pinyin.getFullChars(line.name).toUpperCase()] = line.lineCode; | ||
| 253 | + zhChars[line.name] = line.lineCode; | ||
| 254 | + lineIdMap[line.lineCode] = line; | ||
| 255 | + | ||
| 256 | + lineIds[line.lineCode] = line.name; | ||
| 257 | + }); | ||
| 258 | + //合并映射 | ||
| 259 | + $.extend(allChars, camelChars, fullChars, zhChars); | ||
| 260 | + | ||
| 261 | + //线路选中事件 | ||
| 262 | + $('.line-select-body .line').on('click', function () { | ||
| 263 | + if ($(this).hasClass('active')) { | ||
| 264 | + $(this).removeClass('active'); | ||
| 265 | + $('.selected-body .line[name=' + $(this).attr('name') + ']').remove(); | ||
| 266 | + } | ||
| 267 | + else { | ||
| 268 | + $(this).addClass('active'); | ||
| 269 | + $('.selected-body').append($(this).clone()); | ||
| 270 | + } | ||
| 271 | + }); | ||
| 272 | + | ||
| 273 | + storage.setItem('lineIds', JSON.stringify(lineIds)); | ||
| 274 | + }); | ||
| 275 | + | ||
| 276 | + //搜索框事件 | ||
| 277 | + $('#searchLineInput').on('keyup', filterLines); | ||
| 278 | + | ||
| 279 | + $('.line-select .input-icon i').on('click', function () { | ||
| 280 | + if ($(this).hasClass('fa-plus-circle')) { | ||
| 281 | + $('#searchLineInput').val(''); | ||
| 282 | + filterLines(); | ||
| 283 | + } | ||
| 284 | + }); | ||
| 285 | + | ||
| 286 | + $('.selected-body').on('click', '.line', function () { | ||
| 287 | + $('.line-select-body .line[name=' + $(this).attr('name') + ']').removeClass('active'); | ||
| 288 | + $(this).remove(); | ||
| 289 | + }); | ||
| 290 | + | ||
| 291 | + //确定 | ||
| 292 | + $('.gotoControl').on('click', function () { | ||
| 293 | + var lines = $('.selected-body .line'); | ||
| 294 | + if (lines.length == 0) { | ||
| 295 | + layer.alert('你还没有选择线路!', {icon: 3}); | ||
| 296 | + return; | ||
| 297 | + } | ||
| 298 | + | ||
| 299 | + showLoad('更新缓存信息...'); | ||
| 300 | + //将选择的线路写入localstorage | ||
| 301 | + var lsData = []; | ||
| 302 | + $.each(lines, function (i, e) { | ||
| 303 | + lsData.push(lineIdMap[$(e).data('id')]); | ||
| 304 | + }); | ||
| 305 | + storage.setItem('lineControlItems', JSON.stringify(lsData)); | ||
| 306 | + | ||
| 307 | + var operationMode = $(this).data('status'); | ||
| 308 | + //监控模式还是主调模式 | ||
| 309 | + storage.setItem('operationMode', operationMode); | ||
| 310 | + | ||
| 311 | + var ep = new EventProxy(); | ||
| 312 | + //缓存车辆自编号和设备号对照 | ||
| 313 | + cacheCar2DeviceId(function () { | ||
| 314 | + delayEmit(ep, 'cacheRoute'); | ||
| 315 | + }); | ||
| 316 | + | ||
| 317 | + //缓存线路路由 | ||
| 318 | + ep.tail('cacheRoute', function () { | ||
| 319 | + cacheRoute(lsData, function (cacheData) { | ||
| 320 | + delayEmit(ep, 'checkLineConfig'); | ||
| 321 | + }); | ||
| 322 | + }); | ||
| 323 | + | ||
| 324 | + //检查线路配置信息 | ||
| 325 | + ep.tail('checkLineConfig', function () { | ||
| 326 | + checkLineConfig(lsData, function (rs) { | ||
| 327 | + if (rs.status == 0) | ||
| 328 | + delayEmit(ep, 'gotoControl', rs); | ||
| 329 | + else if (rs.status == 1) | ||
| 330 | + delayEmit(ep, 'initLineConfig', rs); | ||
| 331 | + }); | ||
| 332 | + }); | ||
| 333 | + | ||
| 334 | + //初始化没有 线路配置信息 的线路 | ||
| 335 | + ep.tail('initLineConfig', function (rs) { | ||
| 336 | + initLineConfig(rs.not, function () { | ||
| 337 | + delayEmit(ep, 'gotoControl', rs); | ||
| 338 | + }); | ||
| 339 | + }); | ||
| 340 | + | ||
| 341 | + //进入线调 | ||
| 342 | + ep.tail('gotoControl', function () { | ||
| 343 | + //alert('进入线调'); | ||
| 344 | + layer.closeAll(); | ||
| 345 | + //loadPage('/pages/control/line/index.html'); | ||
| 346 | + window.location.href = "/real_control/v2"; | ||
| 347 | + }); | ||
| 348 | + }); | ||
| 349 | + | ||
| 350 | + function checkLineConfig(lsData, cb) { | ||
| 351 | + showLoad('检查线路配置信息...'); | ||
| 352 | + var lineCodeArray = []; | ||
| 353 | + $.each(lsData, function () { | ||
| 354 | + lineCodeArray.push(this.lineCode); | ||
| 355 | + }); | ||
| 356 | + | ||
| 357 | + $.ajax({ | ||
| 358 | + url: '/lineConfig/check', | ||
| 359 | + traditional: true, | ||
| 360 | + data: {codeArray: lineCodeArray}, | ||
| 361 | + method: 'POST', | ||
| 362 | + success: cb | ||
| 363 | + }); | ||
| 364 | + } | ||
| 365 | + | ||
| 366 | + function initLineConfig(arr, cb) { | ||
| 367 | + var i = 0; | ||
| 368 | + (function () { | ||
| 369 | + if (i >= arr.length) { | ||
| 370 | + cb && cb(); | ||
| 371 | + return; | ||
| 372 | + } | ||
| 373 | + var f = arguments.callee | ||
| 374 | + , lineCode = arr[i]; | ||
| 375 | + | ||
| 376 | + showLoad('初始化' + lineIds[lineCode] + '配置信息...'); | ||
| 377 | + $.post('/lineConfig/init/' + lineCode, function (rs) { | ||
| 378 | + if (rs == 1) { | ||
| 379 | + i++; | ||
| 380 | + f(); | ||
| 381 | + } | ||
| 382 | + }); | ||
| 383 | + })(); | ||
| 384 | + } | ||
| 385 | + | ||
| 386 | + function cacheCar2DeviceId(cb) { | ||
| 387 | + //showLoad('缓存基础对照信息...'); | ||
| 388 | + $.get('/gps/Car2DeviceId', function (rs) { | ||
| 389 | + storage.setItem('car2DeviceId', JSON.stringify(rs)); | ||
| 390 | + cb && cb(); | ||
| 391 | + }); | ||
| 392 | + } | ||
| 393 | + | ||
| 394 | + function cacheRoute(lsData, cb) { | ||
| 395 | + //showLoad('缓存线路路由信息...'); | ||
| 396 | + var i = 0, cacheData = {}; | ||
| 397 | + (function () { | ||
| 398 | + if (i >= lsData.length) { | ||
| 399 | + //写入localStorage | ||
| 400 | + for (var lineCode in cacheData) | ||
| 401 | + storage.setItem(lineCode + '_route', JSON.stringify(cacheData[lineCode])); | ||
| 402 | + | ||
| 403 | + cb && cb(); | ||
| 404 | + return; | ||
| 405 | + } | ||
| 406 | + var f = arguments.callee | ||
| 407 | + , item = lsData[i]; | ||
| 408 | + | ||
| 409 | + $.get('/realMap/findRouteByLine', {lineCode: item.lineCode}, function (rs) { | ||
| 410 | + //$.get('/realSchedule/findRouteByLine', {lineCode: item.lineCode}, function(rs){ | ||
| 411 | + if (rs && rs.lineId) { | ||
| 412 | + cacheData[item.lineCode] = rs; | ||
| 413 | + i++; | ||
| 414 | + f(); | ||
| 415 | + } | ||
| 416 | + }); | ||
| 417 | + })(); | ||
| 418 | + } | ||
| 419 | + | ||
| 420 | + //历史纪录 | ||
| 421 | + $('#historyBtn').on('click', function () { | ||
| 422 | + var lineControlItems = window.localStorage.getItem('lineControlItems'); | ||
| 423 | + if (!lineControlItems) { | ||
| 424 | + layer.alert('没有在当前电脑找到历史纪录!', {icon: 3}); | ||
| 425 | + return; | ||
| 426 | + } | ||
| 427 | + else { | ||
| 428 | + var array = JSON.parse(lineControlItems); | ||
| 429 | + clear(); | ||
| 430 | + $.each(array, function (i, line) { | ||
| 431 | + $('.line-select-body .line[name=line_' + line.lineCode + ']').click(); | ||
| 432 | + }); | ||
| 433 | + } | ||
| 434 | + }); | ||
| 435 | + | ||
| 436 | + //重置 | ||
| 437 | + $('#resetBtn').on('click', clear); | ||
| 438 | + | ||
| 439 | + function clear() { | ||
| 440 | + $('.line-select-body .line.active').removeClass('active'); | ||
| 441 | + $('.selected-body .line').remove(); | ||
| 442 | + | ||
| 443 | + $('.line-select .input-icon i.fa-plus-circle').click(); | ||
| 444 | + filterLines(); | ||
| 445 | + } | ||
| 446 | + | ||
| 447 | + function filterLines() { | ||
| 448 | + var t = $('#searchLineInput').val().toUpperCase() | ||
| 449 | + , es = [] | ||
| 450 | + , bs = $('.line-select-body .line, .line-select-body .company, .line-select-body .sub-company') | ||
| 451 | + , icon = $('.line-select .input-icon i'); | ||
| 452 | + | ||
| 453 | + if (!t) { | ||
| 454 | + bs.show(); | ||
| 455 | + icon.removeClass('fa-plus-circle').addClass('fa-search'); | ||
| 456 | + return; | ||
| 457 | + } | ||
| 458 | + else | ||
| 459 | + icon.removeClass('fa-search').addClass('fa-plus-circle'); | ||
| 460 | + | ||
| 461 | + for (var c in allChars) { | ||
| 462 | + if (c.indexOf(t) != -1) | ||
| 463 | + es.push('.line-select-body .line[name=line_' + allChars[c] + ']'); | ||
| 464 | + } | ||
| 465 | + | ||
| 466 | + bs.hide(); | ||
| 467 | + $.each(es, function (i, e) { | ||
| 468 | + $(e).show(); | ||
| 469 | + }); | ||
| 470 | + } | ||
| 471 | + | ||
| 472 | + function groupData(array, g) { | ||
| 473 | + var groups = {}, key; | ||
| 474 | + | ||
| 475 | + $.each(array, function (i, item) { | ||
| 476 | + key = item[g]; | ||
| 477 | + if (!groups[key]) | ||
| 478 | + groups[key] = []; | ||
| 479 | + | ||
| 480 | + groups[key].push(item); | ||
| 481 | + }); | ||
| 482 | + | ||
| 483 | + return groups; | ||
| 484 | + } | ||
| 485 | + | ||
| 486 | + function showLoad(text) { | ||
| 487 | + layer.msg(text, {icon: 16, time: 0, shade: 0.3}); | ||
| 488 | + } | ||
| 489 | + | ||
| 490 | + function delayEmit(ep, t, p) { | ||
| 491 | + setTimeout(function () { | ||
| 492 | + ep.emit(t, p); | ||
| 493 | + }, 300); | ||
| 494 | + } | ||
| 495 | + }); | ||
| 501 | </script> | 496 | </script> |
| 502 | \ No newline at end of file | 497 | \ No newline at end of file |
src/main/resources/static/real_control_v2/js/main.js
| @@ -142,7 +142,7 @@ var enable_submit_btn = function (form) { | @@ -142,7 +142,7 @@ var enable_submit_btn = function (form) { | ||
| 142 | if (subBtn) { | 142 | if (subBtn) { |
| 143 | subBtn.removeClass('disabled').removeAttr('disabled'); | 143 | subBtn.removeClass('disabled').removeAttr('disabled'); |
| 144 | } | 144 | } |
| 145 | -} | 145 | +}; |
| 146 | 146 | ||
| 147 | var disabled_submit_btn = function (form) { | 147 | var disabled_submit_btn = function (form) { |
| 148 | var subBtn = $('button[type=submit]', form); | 148 | var subBtn = $('button[type=submit]', form); |
src/main/resources/static/real_control_v2/sch_manage/sch_imitate.html
| @@ -151,6 +151,10 @@ | @@ -151,6 +151,10 @@ | ||
| 151 | padding: 2px 5px; | 151 | padding: 2px 5px; |
| 152 | border-radius: 3px; | 152 | border-radius: 3px; |
| 153 | } | 153 | } |
| 154 | + .sch-lock-icon{ | ||
| 155 | + color: red; | ||
| 156 | + font-size: 18px; | ||
| 157 | + } | ||
| 154 | </style> | 158 | </style> |
| 155 | </head> | 159 | </head> |
| 156 | 160 | ||
| @@ -277,11 +281,15 @@ | @@ -277,11 +281,15 @@ | ||
| 277 | tl-yzx | 281 | tl-yzx |
| 278 | {{else if sch.status==1}} | 282 | {{else if sch.status==1}} |
| 279 | tl-zzzx | 283 | tl-zzzx |
| 280 | - {{/if}}"> | 284 | + {{/if}}{{if reissue}}tl-reissue-success{{/if}}"> |
| 281 | {{sch.fcsjActual}} | 285 | {{sch.fcsjActual}} |
| 282 | - | ||
| 283 | </td> | 286 | </td> |
| 284 | - <td>{{sch.remarks}}</td> | 287 | + <td> |
| 288 | + {{if sch.reissue}} | ||
| 289 | + <i class="uk-icon-lock sch-lock-icon" ></i> | ||
| 290 | + {{/if}} | ||
| 291 | + {{sch.remarks}} | ||
| 292 | + </td> | ||
| 285 | </tr> | 293 | </tr> |
| 286 | {{/each}} | 294 | {{/each}} |
| 287 | </script> | 295 | </script> |
| @@ -347,9 +355,9 @@ | @@ -347,9 +355,9 @@ | ||
| 347 | $.each(list, function () { | 355 | $.each(list, function () { |
| 348 | schArray[this.id] = this; | 356 | schArray[this.id] = this; |
| 349 | }); | 357 | }); |
| 350 | - var geoupData = gb_common.groupBy(list.sort(function (a, b) { | ||
| 351 | - return a.dfsj.localeCompare(b.dfsj); | ||
| 352 | - }), 'xlDir'); | 358 | + //计算起点应到时间 |
| 359 | + calcYDSDDate(list); | ||
| 360 | + var geoupData = gb_common.groupBy(list.sort(schSort), 'xlDir'); | ||
| 353 | //上行 | 361 | //上行 |
| 354 | var htmlStr = template('sch-imitate-list-temp', {list: geoupData[0]}); | 362 | var htmlStr = template('sch-imitate-list-temp', {list: geoupData[0]}); |
| 355 | $('.table-wrap.up table tbody').html(htmlStr); | 363 | $('.table-wrap.up table tbody').html(htmlStr); |
| @@ -363,10 +371,17 @@ | @@ -363,10 +371,17 @@ | ||
| 363 | //模拟轨迹 | 371 | //模拟轨迹 |
| 364 | var gps_imitate = function (schId) { | 372 | var gps_imitate = function (schId) { |
| 365 | var sch = schArray[schId]; | 373 | var sch = schArray[schId]; |
| 374 | + if(sch.reissue){ | ||
| 375 | + UIkit.notify("<i class='uk-icon-times'></i> 你不能对一个班次重复操作!", { | ||
| 376 | + status: 'danger' | ||
| 377 | + }); | ||
| 378 | + return; | ||
| 379 | + } | ||
| 366 | alt_confirm('确定班次信息? ' + sch.xlName + '、起点 ' + sch.qdzName + ' , 终点 ' + sch.zdzName + ' 、待发 ' + sch.dfsj, function () { | 380 | alt_confirm('确定班次信息? ' + sch.xlName + '、起点 ' + sch.qdzName + ' , 终点 ' + sch.zdzName + ' 、待发 ' + sch.dfsj, function () { |
| 367 | $('.shade-loading').show(); | 381 | $('.shade-loading').show(); |
| 368 | gb_common.$post('/gps/gpsCompletion', {schId: schId}, function (rs) { | 382 | gb_common.$post('/gps/gpsCompletion', {schId: schId}, function (rs) { |
| 369 | - | 383 | + $('.shade-loading').hide(); |
| 384 | + $('.search-form').trigger('submit'); | ||
| 370 | }); | 385 | }); |
| 371 | }, '我确定是这个班次'); | 386 | }, '我确定是这个班次'); |
| 372 | }; | 387 | }; |
| @@ -402,6 +417,28 @@ | @@ -402,6 +417,28 @@ | ||
| 402 | , center: true | 417 | , center: true |
| 403 | }); | 418 | }); |
| 404 | }; | 419 | }; |
| 420 | + | ||
| 421 | + | ||
| 422 | + /* 计算应到实到时间 */ | ||
| 423 | + var calcYDSDDate = function (list) { | ||
| 424 | + var clGroupData = gb_common.groupBy(list, 'clZbh'), array, len; | ||
| 425 | + for(var nbbm in clGroupData){ | ||
| 426 | + array = clGroupData[nbbm]; | ||
| 427 | + array.sort(schSort); | ||
| 428 | + | ||
| 429 | + len = array.length - 1; | ||
| 430 | + for(var i = 0; i < len; i ++){ | ||
| 431 | + if(array[i].zdzName == array[i + 1].qdzName){ | ||
| 432 | + array[i + 1].qdzArrDateJH = array[i].zdsj; | ||
| 433 | + array[i + 1].qdzArrDateSJ = array[i].zdsjActual; | ||
| 434 | + } | ||
| 435 | + } | ||
| 436 | + } | ||
| 437 | + }; | ||
| 438 | + | ||
| 439 | + var schSort = function (a, b) { | ||
| 440 | + return a.dfsj.localeCompare(b.dfsj); | ||
| 441 | + } | ||
| 405 | })(); | 442 | })(); |
| 406 | </script> | 443 | </script> |
| 407 | </body> | 444 | </body> |