Commit fd5ae6006dc590846dfbce96a4c7598529a366c2

Authored by 徐烜
2 parents 3a60aa26 1e9c5e44

Merge branch 'minhang' of http://222.66.0.204:8090//panzhaov5/bsth_control into minhang

Showing 39 changed files with 2240 additions and 657 deletions
src/main/java/com/bsth/controller/gps/GpsController.java
... ... @@ -108,4 +108,22 @@ public class GpsController {
108 108 public Map<String, Object> history_v2(@PathVariable("nbbm") String nbbm, @RequestParam long st, @RequestParam long et){
109 109 return gpsService.history_v2(nbbm, st, et);
110 110 }
  111 +
  112 + /**
  113 + * 安全驾驶数据 分页查询
  114 + * @param map
  115 + * @param page
  116 + * @param size
  117 + * @param order
  118 + * @param direction
  119 + * @return
  120 + */
  121 + @RequestMapping(value = "/safeDriv")
  122 + public Map<String, Object> safeDrivList(@RequestParam Map<String, Object> map,
  123 + @RequestParam(defaultValue = "0") int page,
  124 + @RequestParam(defaultValue = "15") int size,
  125 + @RequestParam(defaultValue = "timestamp") String order,
  126 + @RequestParam(defaultValue = "DESC") String direction){
  127 + return gpsService.safeDrivList(map , page, size, order, direction);
  128 + }
111 129 }
... ...
src/main/java/com/bsth/data/safe_driv/SafeDriv.java
... ... @@ -27,6 +27,8 @@ public class SafeDriv {
27 27 */
28 28 private String xlmc;
29 29  
  30 + private String xlbm;
  31 +
30 32 /**
31 33 * 车辆自编号
32 34 */
... ... @@ -127,4 +129,12 @@ public class SafeDriv {
127 129 public void setTs(Long ts) {
128 130 this.ts = ts;
129 131 }
  132 +
  133 + public String getXlbm() {
  134 + return xlbm;
  135 + }
  136 +
  137 + public void setXlbm(String xlbm) {
  138 + this.xlbm = xlbm;
  139 + }
130 140 }
... ...
src/main/java/com/bsth/data/safe_driv/SafeDrivCenter.java
1 1 package com.bsth.data.safe_driv;
2 2  
3   -import com.bsth.Application;
4 3 import com.bsth.websocket.handler.SendUtils;
5 4 import org.joda.time.format.DateTimeFormat;
6 5 import org.joda.time.format.DateTimeFormatter;
... ... @@ -15,7 +14,6 @@ import java.util.HashMap;
15 14 import java.util.HashSet;
16 15 import java.util.Map;
17 16 import java.util.Set;
18   -import java.util.concurrent.TimeUnit;
19 17  
20 18 /**
21 19 * 安全驾驶
... ... @@ -44,7 +42,6 @@ public class SafeDrivCenter implements CommandLineRunner,ApplicationContextAware
44 42 private static DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss.SSS");
45 43 public static void put(SafeDriv sd){
46 44 sd.setTs(fmt.parseMillis(sd.getStartime()));
47   - data.add(sd);
48 45  
49 46 if(sd.getYczltype().indexOf("A") == -1)
50 47 sd.setYczltype("A" + sd.getYczltype());
... ... @@ -53,15 +50,24 @@ public class SafeDrivCenter implements CommandLineRunner,ApplicationContextAware
53 50 if(old == null || sd.getTs() > old.getTs()){
54 51 //通知客户端
55 52 sendUtils.sendSafeDriv(sd);
  53 + data.add(sd);
  54 + safeMap.put(sd.getClzbh(), sd);
56 55 }
  56 + }
  57 +
  58 + public static Set<SafeDriv> findAll(){
  59 + return data;
  60 + }
57 61  
58   - safeMap.put(sd.getClzbh(), sd);
  62 + public static void clear(){
  63 + data = new HashSet<>();
  64 + safeMap = new HashMap<>();
59 65 }
60 66  
61 67 @Override
62 68 public void run(String... strings) throws Exception {
63 69 //定时加载安全驾驶数据
64   - Application.mainServices.scheduleWithFixedDelay(safeDrivDataLoadThread, 60, 5, TimeUnit.SECONDS);
  70 + //Application.mainServices.scheduleWithFixedDelay(safeDrivDataLoadThread, 60, 60, TimeUnit.SECONDS);
65 71 }
66 72  
67 73 @Override
... ...
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
... ... @@ -138,7 +138,7 @@ public class DayOfSchedule implements CommandLineRunner {
138 138 //dataRecovery();
139 139  
140 140 //翻班线程
141   - Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS);
  141 +// Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS);
142 142 //入库
143 143 // Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 30, TimeUnit.SECONDS);
144 144 //班次误点扫描
... ... @@ -384,9 +384,9 @@ public class DayOfSchedule implements CommandLineRunner {
384 384 }
385 385  
386 386 sch.setJhlcOrig(sch.getJhlc());
387   - //计划里程为0,设置NULL
388   - //if (sch.getJhlc() != null && sch.getJhlc() == 0)
389   - // sch.setJhlc(null);
  387 + //保留备注
  388 + if(StringUtils.isNotEmpty(sch.getRemark()))
  389 + sch.setRemarks(sch.getRemark());
390 390 }
391 391 } catch (Exception e) {
392 392 logger.error("", e);
... ...
src/main/java/com/bsth/data/schedule/thread/CalcOilThread.java
1 1 package com.bsth.data.schedule.thread;
2 2  
  3 +import com.bsth.data.safe_driv.SafeDrivCenter;
3 4 import com.bsth.service.oil.YlbService;
4 5 import org.slf4j.Logger;
5 6 import org.slf4j.LoggerFactory;
... ... @@ -24,6 +25,9 @@ public class CalcOilThread extends Thread{
24 25 logger.info("开始计算路单里程加注量....");
25 26 ylbService.obtainDsq();
26 27 logger.info("计算路单里程加注量结束!");
  28 +
  29 + //清除安全驾驶数据 先临时蹭这个线程
  30 + SafeDrivCenter.clear();
27 31 } catch(Exception e){
28 32 logger.error("计算路单里程加注量失败",e);
29 33 }
... ...
src/main/java/com/bsth/entity/realcontrol/ChildTaskPlan.java
... ... @@ -223,7 +223,7 @@ public class ChildTaskPlan {
223 223  
224 224 @Override
225 225 public int hashCode() {
226   - return ("" + this.getId() + this.getSchedule().getId()).hashCode();
  226 + return ("cTask" + this.getId() + this.getSchedule().getId()).hashCode();
227 227 }
228 228  
229 229 @Override
... ...
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
... ... @@ -145,6 +145,9 @@ public class ScheduleRealInfo {
145 145  
146 146 /** 备注*/
147 147 private String remarks;
  148 +
  149 + /** 原计划排班备注 */
  150 + private String remark;
148 151  
149 152 /**待发时间(格式 HH:mm) */
150 153 private String dfsj;
... ... @@ -168,7 +171,7 @@ public class ScheduleRealInfo {
168 171 private String qdzArrDatesj;
169 172  
170 173 /** 子任务 */
171   - @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
  174 + @OneToMany(fetch = FetchType.LAZY, mappedBy = "schedule")
172 175 private Set<ChildTaskPlan> cTasks = new HashSet<>();
173 176  
174 177 /** 关联的公司名称 */
... ... @@ -875,4 +878,12 @@ public class ScheduleRealInfo {
875 878 else
876 879 this.setLate(false);
877 880 }
  881 +
  882 + public String getRemark() {
  883 + return remark;
  884 + }
  885 +
  886 + public void setRemark(String remark) {
  887 + this.remark = remark;
  888 + }
878 889 }
... ...
src/main/java/com/bsth/service/gps/GpsService.java
... ... @@ -27,4 +27,6 @@ public interface GpsService {
27 27 List<GpsSpeed_DTO> speeds(String nbbm, long st, long et);
28 28  
29 29 List<GpsOutbound_DTO> outbounds(String nbbm, long st, long et);
  30 +
  31 + Map<String, Object> safeDrivList(Map<String, Object> map, int page, int size, String order, String direction);
30 32 }
... ...
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
... ... @@ -6,12 +6,17 @@ import com.bsth.data.arrival.ArrivalEntity;
6 6 import com.bsth.data.gpsdata.GpsEntity;
7 7 import com.bsth.data.gpsdata.GpsRealData;
8 8 import com.bsth.data.gpsdata.arrival.utils.GeoUtils;
  9 +import com.bsth.data.safe_driv.SafeDriv;
  10 +import com.bsth.data.safe_driv.SafeDrivCenter;
9 11 import com.bsth.data.schedule.DayOfSchedule;
10 12 import com.bsth.entity.realcontrol.ScheduleRealInfo;
11 13 import com.bsth.repository.CarParkRepository;
12 14 import com.bsth.repository.StationRepository;
13 15 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
14   -import com.bsth.service.gps.entity.*;
  16 +import com.bsth.service.gps.entity.GpsOutbound_DTO;
  17 +import com.bsth.service.gps.entity.GpsSpeed_DTO;
  18 +import com.bsth.service.gps.entity.HistoryGps_DTO;
  19 +import com.bsth.service.gps.entity.Road_DTO;
15 20 import com.bsth.util.DateUtils;
16 21 import com.bsth.util.TransGPS;
17 22 import com.bsth.util.TransGPS.Location;
... ... @@ -28,6 +33,7 @@ import java.lang.reflect.Field;
28 33 import java.sql.Connection;
29 34 import java.sql.PreparedStatement;
30 35 import java.sql.ResultSet;
  36 +import java.text.DecimalFormat;
31 37 import java.util.*;
32 38  
33 39 @Service
... ... @@ -353,17 +359,12 @@ public class GpsServiceImpl implements GpsService {
353 359 //过滤后的
354 360 List<GpsEntity> rs = new ArrayList<>();
355 361 Field[] fields = GpsEntity.class.getDeclaredFields();
356   - //排序字段
357   - Field orderField = null;
358 362 //参与过滤的字段
359 363 List<Field> fs = new ArrayList<>();
360 364 for (Field f : fields) {
361 365 f.setAccessible(true);
362 366 if (map.containsKey(f.getName()))
363 367 fs.add(f);
364   -
365   - if (f.getName().equals(order))
366   - orderField = f;
367 368 }
368 369 //过滤数据
369 370 for (GpsEntity gps : list) {
... ... @@ -371,9 +372,6 @@ public class GpsServiceImpl implements GpsService {
371 372 rs.add(gps);
372 373 }
373 374  
374   - //排序
375   -/* if (null != orderField)
376   - sortGpsList(orderField, rs);*/
377 375 //时间戳排序
378 376 Collections.sort(rs, new Comparator<GpsEntity>() {
379 377 @Override
... ... @@ -538,11 +536,25 @@ public class GpsServiceImpl implements GpsService {
538 536 List<GpsSpeed_DTO> speedList = speeds(nbbm, st, et);
539 537 //越界数据
540 538 List<GpsOutbound_DTO> outboundList = outbounds(nbbm, st, et);
  539 + //计算里程
  540 + List<HistoryGps_DTO> effList = new ArrayList<>();
  541 + for(HistoryGps_DTO gps : list){
  542 + if(gps.getLat() != 0 && gps.getLon() != 0)
  543 + effList.add(gps);
  544 + }
  545 + double sum = 0, dist;
  546 + for (int i = 0; i < effList.size() - 1; i++) {
  547 + dist = GeoUtils.getDistance(effList.get(i).getPoint(), effList.get(i + 1).getPoint());
  548 + //点位相同时,dist会NaN
  549 + if(String.valueOf(dist).matches("^[0.0-9.0]+$"))
  550 + sum += dist;
  551 + }
541 552  
542 553 rs.put("status", ResponseCode.SUCCESS);
543   - rs.put("list", removeDuplicate(list));
  554 + rs.put("list", removeDuplicate(effList));
544 555 rs.put("speedList", speedList);
545 556 rs.put("outboundList", outboundList);
  557 + rs.put("sumMileage", new DecimalFormat(".##").format(sum / 1000));
546 558 } catch (Exception e) {
547 559 logger.error("", e);
548 560 rs.put("status", ResponseCode.ERROR);
... ... @@ -571,10 +583,56 @@ public class GpsServiceImpl implements GpsService {
571 583 int weekYear = weekCal.get(Calendar.WEEK_OF_YEAR);
572 584 //设备号
573 585 String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm);
574   - String sql = "select vehicle,line,up_down,lon,lat,timestamp from bsth_c_outbound where weeks_year="+weekYear+" and vehicle=? and timestamp>? and timestamp<?";
  586 + String sql = "select vehicle,line,up_down,lon,lat,timestamp from bsth_c_outbound where weeks_year=" + weekYear + " and vehicle=? and timestamp>? and timestamp<?";
575 587 return GpsOutbound_DTO.create(new JdbcTemplate(DBUtils_MS.getDataSource()).queryForList(sql, deviceId, st, et));
576 588 }
577 589  
  590 + @Override
  591 + public Map<String, Object> safeDrivList(Map<String, Object> map, int page, int size, String order, String direction) {
  592 + Map<String, Object> rsMap = new HashMap<>();
  593 + try {
  594 + //全量
  595 + List<SafeDriv> list = new ArrayList<>(SafeDrivCenter.findAll());
  596 + //过滤后的
  597 + List<SafeDriv> rs = new ArrayList<>();
  598 + Field[] fields = SafeDriv.class.getDeclaredFields();
  599 + //参与过滤的字段
  600 + List<Field> fs = new ArrayList<>();
  601 + for (Field f : fields) {
  602 + f.setAccessible(true);
  603 + if (map.containsKey(f.getName()))
  604 + fs.add(f);
  605 + }
  606 + //过滤数据
  607 + for (SafeDriv sd : list) {
  608 + if (fieldEquals(fs, sd, map))
  609 + rs.add(sd);
  610 + }
  611 +
  612 + //时间戳排序
  613 + Collections.sort(rs, new Comparator<SafeDriv>() {
  614 + @Override
  615 + public int compare(SafeDriv o1, SafeDriv o2) {
  616 + return o2.getTs().intValue() - o1.getTs().intValue();
  617 + }
  618 + });
  619 +
  620 + //分页
  621 + int count = rs.size(), s = page * size, e = s + size;
  622 + if (e > count)
  623 + e = count;
  624 +
  625 + rsMap.put("list", rs.subList(s, e));
  626 + rsMap.put("totalPages", count % size == 0 ? count / size - 1 : count / size);
  627 + rsMap.put("page", page);
  628 + rsMap.put("status", ResponseCode.SUCCESS);
  629 + } catch (Exception e) {
  630 + logger.error("", e);
  631 + rsMap.put("status", ResponseCode.ERROR);
  632 + }
  633 + return rsMap;
  634 + }
  635 +
578 636 private void matchRoadToGps(HistoryGps_DTO gps, List<Road_DTO> roads) {
579 637 double min = -1, distance;
580 638 Road_DTO nearRoad = null;
... ...
src/main/java/com/bsth/service/gps/entity/HistoryGps_DTO.java
... ... @@ -29,8 +29,8 @@ public class HistoryGps_DTO {
29 29 return list;
30 30 }
31 31  
32   - private double gcj_lon;
33   - private double gcj_lat;
  32 + //private double gcj_lon;
  33 + //private double gcj_lat;
34 34  
35 35 private double bd_lon;
36 36 private double bd_lat;
... ... @@ -82,7 +82,7 @@ public class HistoryGps_DTO {
82 82 return (this.getDeviceId() + "_" + (inout_stop_info==null?this.getStopNo():inout_stop_info.getStopName()) + "_" + this.getTs() + "_" + this.getLon() + "_" + this.getLat());
83 83 }
84 84  
85   - public double getGcj_lon() {
  85 +/* public double getGcj_lon() {
86 86 return gcj_lon;
87 87 }
88 88  
... ... @@ -96,7 +96,7 @@ public class HistoryGps_DTO {
96 96  
97 97 public void setGcj_lat(double gcj_lat) {
98 98 this.gcj_lat = gcj_lat;
99   - }
  99 + }*/
100 100  
101 101 public double getBd_lon() {
102 102 return bd_lon;
... ...
src/main/java/com/bsth/service/realcontrol/impl/ChildTaskPlanServiceImpl.java
1 1 package com.bsth.service.realcontrol.impl;
2 2  
  3 +import com.bsth.common.ResponseCode;
3 4 import com.bsth.data.BasicData;
4   -import com.bsth.data.match.Arrival2Schedule;
5 5 import com.bsth.data.schedule.DayOfSchedule;
6 6 import com.bsth.entity.realcontrol.ChildTaskPlan;
7 7 import com.bsth.entity.realcontrol.ScheduleRealInfo;
... ... @@ -10,19 +10,19 @@ import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
10 10 import com.bsth.service.impl.BaseServiceImpl;
11 11 import com.bsth.service.realcontrol.ChildTaskPlanService;
12 12 import org.apache.commons.lang3.StringUtils;
  13 +import org.slf4j.Logger;
  14 +import org.slf4j.LoggerFactory;
13 15 import org.springframework.beans.factory.annotation.Autowired;
14 16 import org.springframework.jdbc.core.JdbcTemplate;
15 17 import org.springframework.stereotype.Service;
16 18  
17 19 import javax.transaction.Transactional;
  20 +import java.util.HashMap;
18 21 import java.util.Map;
19 22  
20 23 @Service
21 24 public class ChildTaskPlanServiceImpl extends BaseServiceImpl<ChildTaskPlan, Long> implements ChildTaskPlanService {
22 25  
23   - /*@Autowired
24   - ScheduleRealInfoServiceImpl scheduleRealInfoService;*/
25   -
26 26 @Autowired
27 27 ScheduleRealInfoRepository scheduleRealInfoRepository;
28 28  
... ... @@ -33,34 +33,41 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl&lt;ChildTaskPlan, Lon
33 33 DayOfSchedule dayOfSchedule;
34 34  
35 35 @Autowired
36   - Arrival2Schedule arrival2Schedule;
37   -
38   - @Autowired
39 36 JdbcTemplate jdbcTemplate;
40 37  
  38 + Logger logger = LoggerFactory.getLogger(this.getClass());
  39 +
41 40 @Transactional
42 41 @Override
43 42 public Map<String, Object> save(ChildTaskPlan t) {
44   - ScheduleRealInfo sch = dayOfSchedule.get(t.getSchedule().getId());
45   - Map<String, Object> rs;
46   - //保存起终点名称
47   - String prefix = sch.getXlBm() + "_" + sch.getXlDir() + "_";
48   -
49   - if(StringUtils.isEmpty(t.getStartStationName()))
50   - t.setStartStationName(BasicData.getStationNameByCode(t.getStartStation(), prefix));
51   -
52   - if(StringUtils.isEmpty(t.getEndStationName()))
53   - t.setEndStationName(BasicData.getStationNameByCode(t.getEndStation(), prefix));
54   - //先持久化子任务
55   - rs = super.save(t);
56   - //再关联主任务
57   - sch.getcTasks().add(t);
58   - dayOfSchedule.save(sch);
59   -
60   - rs.put("t", sch);
61 43  
62   - if (sch.getZdsjActual() == null)
63   - arrival2Schedule.removeExpect(sch.getClZbh());
  44 + Map<String, Object> rs = new HashMap();
  45 + try {
  46 + ScheduleRealInfo sch = dayOfSchedule.get(t.getSchedule().getId());
  47 + //保存起终点名称
  48 + String prefix = sch.getXlBm() + "_" + sch.getXlDir() + "_";
  49 + if(StringUtils.isEmpty(t.getStartStationName()))
  50 + t.setStartStationName(BasicData.getStationNameByCode(t.getStartStation(), prefix));
  51 +
  52 + if(StringUtils.isEmpty(t.getEndStationName()))
  53 + t.setEndStationName(BasicData.getStationNameByCode(t.getEndStation(), prefix));
  54 + //先持久化子任务
  55 + rs = super.save(t);
  56 + //关联主任务
  57 + System.out.println("schschsch: " + sch);
  58 + System.out.println("sch.getcTasks()sch.getcTasks(): " + sch.getcTasks());
  59 + sch.getcTasks().add(t);
  60 + dayOfSchedule.save(sch);
  61 + //直接持久化
  62 + //scheduleRealInfoRepository.save(sch);
  63 +
  64 + rs.put("status", ResponseCode.SUCCESS);
  65 + rs.put("t", sch);
  66 + }catch (Exception e){
  67 + logger.error("", e);
  68 + rs.put("status", ResponseCode.ERROR);
  69 + rs.put("msg", e.getMessage());
  70 + }
64 71 return rs;
65 72 }
66 73  
... ... @@ -69,16 +76,13 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl&lt;ChildTaskPlan, Lon
69 76 Map<String, Object> rs;
70 77  
71 78 ChildTaskPlan cPlan = childTaskPlanRepository.findOne(id);
72   - //解除和主任务关联
73   - ScheduleRealInfo sch = dayOfSchedule.get(cPlan.getSchedule().getId());
74   - sch.getcTasks().remove(cPlan);
75   - //删除关联表数据
76   - jdbcTemplate.execute("delete from bsth_c_s_sp_info_real_c_tasks where bsth_c_s_sp_info_real=" + sch.getId() + " and c_tasks=" + cPlan.getId());
77 79  
78 80 //删除子任务
79 81 rs = super.delete(id);
80   - dayOfSchedule.save(sch);
81   -
  82 + //dayOfSchedule.save(sch);
  83 + //解除和主任务关联
  84 + ScheduleRealInfo sch = dayOfSchedule.get(cPlan.getSchedule().getId());
  85 + sch.getcTasks().remove(cPlan);
82 86 rs.put("t", sch);
83 87 return rs;
84 88 }
... ...
src/main/resources/static/pages/base/timesmodel/countadd.html 0 → 100644
  1 +<!-- 统计数据 -->
  2 +<div class="modal fade" id="countadd_mobal" tabindex="-1" role="basic" aria-hidden="true">
  3 + <div class="modal-dialog" style="margin-left: 400px;">
  4 + <div class="modal-content" style="width: 700px;">
  5 + <div class="modal-header">
  6 + <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
  7 + <h4 class="modal-title">统计数据 </h4>
  8 + </div>
  9 + <div class="modal-body">
  10 + <div class="portlet-body">
  11 + <div class="table-container" style="margin-top: 10px">
  12 + <table class="table table-striped table-bordered table-hover table-checkable" id="datatable_countadd">
  13 + <thead>
  14 + <tr role="row" class="heading">
  15 + <th width="1%">序号</th>
  16 + <th width="45%">统计项目</th>
  17 + <th width="15%">统计数值</th>
  18 + </tr>
  19 + </thead>
  20 + <tbody></tbody>
  21 + </table>
  22 + </div>
  23 + </div>
  24 + </div>
  25 + <div class="modal-footer">
  26 + <button type="button" class="btn default" data-dismiss="modal">关闭</button>
  27 + </div>
  28 + </div>
  29 + </div>
  30 +</div>
  31 +<script type="text/html" id="countAdd_temp">
  32 +{{each list as obj i }}
  33 + <tr role="row" class="filter">
  34 + <td>{{i+1}}</td>
  35 + <td>
  36 + {{obj.name}}
  37 + </td>
  38 + <td style="vertical-align:middle; text-align:center;">
  39 + {{if obj.name == '综合评估'}}
  40 + <div id="star"></div>
  41 + {{else}}
  42 + {{obj.value}}
  43 + {{/if}}
  44 + </td>
  45 + </tr>
  46 +{{/each}}
  47 +{{if list.length == 0}}
  48 + <tr>
  49 + <td colspan=3><h6 class="muted">没有找到相关数据</h6></td>
  50 + </tr>
  51 +{{/if}}
  52 +</script>
  53 +<script type="text/javascript">
  54 +$('#countadd_mobal').on('countAddMobal.show', function(e,countDate){
  55 + // 加载延迟200毫秒显示mobal
  56 + setTimeout(function(){$('#countadd_mobal').modal({show : true,backdrop: 'static', keyboard: false});},200);
  57 + // 当模态框对用户可见时触发(将等待 CSS 过渡效果完成)。
  58 + $('#countadd_mobal').on('show.bs.modal', function () {
  59 + // 把数据填充到模版中
  60 + var tbodyHtml = template('countAdd_temp',{list:countDate});
  61 + // 把渲染好的模版html文本追加到表格中
  62 + $('#datatable_countadd tbody').html(tbodyHtml);
  63 + $('#star').raty({ readOnly: true,score: 4.5 });
  64 + });
  65 +});
  66 +</script>
0 67 \ No newline at end of file
... ...
src/main/resources/static/pages/base/timesmodel/gantt.html
... ... @@ -19,19 +19,15 @@
19 19  
20 20 <!-- row 组件START -->
21 21 <div class="row">
22   -
23 22 <!-- col-md-12 组件START -->
24 23 <div class="col-md-12">
25   -
26 24 <!-- portlet 组件START -->
27 25 <div class="portlet light porttlet-fit bordered">
28   -
29 26 <!-- portlet-title组件START -->
30 27 <div class="portlet-title">
31   -
32 28 <!-- caption 组件START -->
33 29 <div class="caption">
34   - <i class="fa fa-database font-dark"></i>
  30 + <i class="fa fa-bar-chart font-dark"></i>
35 31 <span class="caption-subject font-dark sbold uppercase">时刻表明细模型</span>
36 32 </div>
37 33 <!-- caption 组件END -->
... ... @@ -40,6 +36,9 @@
40 36 </div>
41 37 <!-- actions 组件START -->
42 38 <div class="actions">
  39 + <div class="btn-group btn-group-devided countbtn" data-toggle="buttons">
  40 + <a class="btn btn-circle blue countAdd" href="javascript:;" data-pjax><i class="fa fa-database"></i> 统计数据</a>
  41 + </div>
43 42 <div class="btn-group btn-group-devided checkbtn" data-toggle="buttons">
44 43 <a class="btn btn-circle blue checkAdd" href="javascript:;" data-pjax><i class="fa fa-check"></i> 保存数据</a>
45 44 </div>
... ... @@ -107,6 +106,7 @@
107 106 <!-- col-md-12 组件END -->
108 107 </div>
109 108 <!-- row 组件END -->
  109 +<script src="/pages/base/timesmodel/js/raty/lib/jquery.raty.js"></script>
110 110 <script src="/pages/base/timesmodel/js/ContextJS/js/context.js"></script>
111 111 <script src="/pages/base/timesmodel/js/base-fun.js"></script>
112 112 <script src="/pages/base/timesmodel/js/d3.relationshipgraph.js"></script>
... ...
src/main/resources/static/pages/base/timesmodel/js/d3.relationshipgraph.js
... ... @@ -201,7 +201,7 @@ $(&#39;.reladplus&#39;).on(&#39;click&#39;,function() {
201 201 /************************************************************************************************************************************************/
202 202  
203 203 /**
204   - * @description : (TODO) 均匀发车事件.
  204 + * @description : (TODO) 监听均匀发车事件.
205 205 *
206 206 * @stutas : OK.
207 207 *
... ... @@ -229,8 +229,9 @@ $(&#39;.updownread&#39;).on(&#39;click&#39;,function() {
229 229 /************************************************************************************************************************************************/
230 230  
231 231 /**
232   - * 调整班次点击事件
233   - *
  232 + * @description : (TODO) 调整班次点击事件
  233 + *
  234 + * @status OK.
234 235 ************************************************************************************************************************************************/
235 236 $('.aboutread').on('click',function() {
236 237 // 判断选择框是否存在.
... ... @@ -255,7 +256,7 @@ $(&#39;.aboutread&#39;).on(&#39;click&#39;,function() {
255 256 /************************************************************************************************************************************************/
256 257  
257 258 /**
258   - * @description : (TODO) 保存数据.
  259 + * @description : (TODO) 监听保存数据事件.
259 260 *
260 261 * @status OK.
261 262 ************************************************************************************************************************************************/
... ... @@ -282,6 +283,112 @@ $(&#39;.aboutread&#39;).on(&#39;click&#39;,function() {
282 283 /************************************************************************************************************************************************/
283 284  
284 285 /**
  286 + * @description : (TODO) 监听统计数据事件.
  287 + *
  288 + * @status OK.
  289 + ************************************************************************************************************************************************/
  290 + $('.countAdd').on('click',function() {
  291 + var list = $_GlobalGraph.getDataArray();
  292 + var countBc = 0,// 总班次
  293 + serviceBc = 0,// 营运班次
  294 + jcbc = 0, // 进场总班次.
  295 + ccbc = 0, // 出场总班次.
  296 + cfbc = 0,// 吃饭总班次.
  297 + zwlbbc = 0,// 早晚例保总班次.
  298 + countGs = 0.0,// 总工时
  299 + servicesj = 0,// 营运班次总时间
  300 + jcsj = 0.0,// 进场总时间.
  301 + ccsj = 0.0 // 出场总时间.
  302 + cfsj = 0.0, // 吃饭总时间.
  303 + zwlbsj = 0.0, // 早晚例保总时间.
  304 + ksBc = 0,// 空驶班次
  305 + serviceLc = 0.0 ,// 营运里程
  306 + ksLc = 0.0 ,// 空驶里程
  307 + avgTzjx = 0.0,// 平均停站间隙
  308 + gfServiceBc = 0,// 高峰营运班次
  309 + dgServiceBc = 0,// 低谷营运班次
  310 + gfAvgTzjx = 0.0,// 高峰平均停站间隙
  311 + dgAvgTzjx = 0.0;// 低谷平均停站间隙
  312 + for(var i = 0;i<list.length;i++) {
  313 + if(list[i].bcsj>0) {
  314 + countBc = countBc + 1;
  315 + countGs = countGs + list[i].STOPTIME + list[i].bcsj;
  316 + var nowDate = BaseFun.getDateTime(list[i].fcsj);
  317 + if((BaseFun.isgfsjd($_GlobalGraph.configuration.dataMap.zgfsjd[0].st,$_GlobalGraph.configuration.dataMap.zgfsjd[0].ed,nowDate) ||
  318 + BaseFun.isgfsjd($_GlobalGraph.configuration.dataMap.wgfsjd[0].st,$_GlobalGraph.configuration.dataMap.wgfsjd[0].ed,nowDate)) &&
  319 + (list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.normal ||
  320 + list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.region ||
  321 + list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.major)) {
  322 + gfServiceBc = gfServiceBc + 1;
  323 + gfAvgTzjx = gfAvgTzjx + list[i].STOPTIME;
  324 + } else if((!BaseFun.isgfsjd($_GlobalGraph.configuration.dataMap.zgfsjd[0].st,$_GlobalGraph.configuration.dataMap.zgfsjd[0].ed,nowDate) ||
  325 + !BaseFun.isgfsjd($_GlobalGraph.configuration.dataMap.wgfsjd[0].st,$_GlobalGraph.configuration.dataMap.wgfsjd[0].ed,nowDate)) &&
  326 + (list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.normal ||
  327 + list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.region ||
  328 + list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.major)){
  329 + dgServiceBc = dgServiceBc + 1;
  330 + dgAvgTzjx = dgAvgTzjx + list[i].STOPTIME;
  331 + }
  332 + if(list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.normal ||
  333 + list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.region ||
  334 + list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.major) {
  335 + serviceBc = serviceBc + 1;
  336 + serviceLc = serviceLc + list[i].jhlc;
  337 + servicesj = servicesj + list[i].bcsj;
  338 + avgTzjx = avgTzjx + list[i].STOPTIME;
  339 + }else if(list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.venting) {
  340 + ksBc = ksBc +1;
  341 + ksLc = ksLc + list[i].jhlc;
  342 + }else if(list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.in_) {
  343 + jcbc = jcbc +1;
  344 + jcsj = jcsj + list[i].bcsj;
  345 + }else if(list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.out) {
  346 + ccbc = ccbc +1;
  347 + ccsj = ccsj + list[i].bcsj;
  348 + }else if(list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.cf) {
  349 + cfbc = cfbc +1;
  350 + cfsj = cfsj + list[i].bcsj;
  351 + }else if(list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.bd ||
  352 + list[i].bcType == $_GlobalGraph.configuration.dataMap.bcTypeArr.lc ) {
  353 + zwlbbc = zwlbbc +1;
  354 + zwlbsj = zwlbsj + list[i].bcsj;
  355 + }
  356 + }
  357 + }
  358 + dgAvgTzjx = dgAvgTzjx/dgServiceBc;
  359 + gfAvgTzjx = gfAvgTzjx/gfServiceBc;
  360 + avgTzjx = avgTzjx/dgServiceBc;
  361 + var countDate = [{'name':'总班次(包括进出场、吃饭时间、早晚例保、营运且班次时间大于零的班次)','value':countBc},
  362 + {'name':'进场总班次(包括进场且班次时间大于零的班次)','value':jcbc},
  363 + {'name':'出场总班次(包括进场且班次时间大于零的班次)','value':ccbc},
  364 + {'name':'吃饭总班次(包括吃饭且班次时间大于零的班次)','value':cfbc},
  365 + {'name':'早晚例保总班次(包括早晚例保且时间大于零的班次)','value':zwlbbc},
  366 + {'name':'营运总班次(包括正常、区间、放大站且班次时间大于零班次)','value':serviceBc},
  367 + {'name':'进场总时间(包括进场班次且班次时间大于零)','value':parseFloat((jcsj/60).toFixed(2)) + ' 小时'},
  368 + {'name':'出场总时间(包括进场班次且班次时间大于零)','value':parseFloat((ccsj/60).toFixed(2)) + ' 小时'},
  369 + {'name':'吃饭总时间(包括吃饭班次且班次时间大于零)','value':parseFloat((cfsj/60).toFixed(2)) + ' 小时'},
  370 + {'name':'早晚例保总时间(包括早晚例保班次且时间大于零的)','value':parseFloat((zwlbsj/60).toFixed(2)) + ' 小时'},
  371 + {'name':'营运班次总时间(包括正常、区间、放大站且班次时间大于零)','value':parseFloat((servicesj/60).toFixed(2)) + ' 小时'},
  372 + {'name':'总工时(包括进出场、吃饭时间、早晚例保、营运班次时间)','value': parseFloat((countGs/60).toFixed(2)) + ' 小时'},
  373 + {'name':'空驶班次(包括直放班次)','value':ksBc},
  374 + {'name':'营运里程(包括正常、区间、放大站里程)','value':serviceLc + ' 公里'},
  375 + {'name':'空驶里程(包括直放里程)','value':ksLc + ' 公里'},
  376 + {'name':'平均停站时间(营运班次停站时间总和/营运总班次)','value':parseInt(avgTzjx) + ' 分钟' },
  377 + {'name':'高峰营运班次(包括早晚高峰时段的正常、区间、放大站班次)','value':gfServiceBc},
  378 + {'name':'低谷营运班次(包括低谷时段的正常、区间、放大站班次)','value':dgServiceBc},
  379 + {'name':'高峰平均停站间隙(高峰营运班次停站时间总和/高峰营运班次总和)','value':parseInt(gfAvgTzjx) + ' 分钟'},
  380 + {'name':'低谷平均停站间隙(低谷营运班次停站时间总和/低谷营运班次总和)','value':parseInt(dgAvgTzjx) + ' 分钟'},
  381 + {'name':'综合评估','value':3}];
  382 + // 弹出层mobal页面
  383 + $.get('/pages/base/timesmodel/countadd.html', function(m){
  384 + $(pjaxContainer).append(m);
  385 + // 规定被选元素要触发的事件。可以使自定义事件(使用 bind() 函数来附加),或者任何标准事件。
  386 + $('#countadd_mobal').trigger('countAddMobal.show',[countDate]);
  387 + });
  388 + });
  389 +/************************************************************************************************************************************************/
  390 +
  391 +/**
285 392 * @description : (TODO)获取路牌对应的班次数(这里的班次不包括早晚例保班次、吃饭时间)
286 393 *
287 394 * @params : [a1--班次数组;a2--路牌数组]
... ...
src/main/resources/static/pages/base/timesmodel/js/raty/lib/img/cancel-off.png 0 → 100644

649 Bytes

src/main/resources/static/pages/base/timesmodel/js/raty/lib/img/cancel-on.png 0 → 100644

715 Bytes

src/main/resources/static/pages/base/timesmodel/js/raty/lib/img/star-half.png 0 → 100644

667 Bytes

src/main/resources/static/pages/base/timesmodel/js/raty/lib/img/star-off.png 0 → 100644

652 Bytes

src/main/resources/static/pages/base/timesmodel/js/raty/lib/img/star-on.png 0 → 100644

631 Bytes

src/main/resources/static/pages/base/timesmodel/js/raty/lib/jquery.raty.js 0 → 100644
  1 +/*!
  2 + * jQuery Raty - A Star Rating Plugin
  3 + * ------------------------------------------------------------------
  4 + *
  5 + * jQuery Raty is a plugin that generates a customizable star rating.
  6 + *
  7 + * Licensed under The MIT License
  8 + *
  9 + * @version 2.5.2
  10 + * @since 2010.06.11
  11 + * @author Washington Botelho
  12 + * @documentation wbotelhos.com/raty
  13 + *
  14 + * ------------------------------------------------------------------
  15 + *
  16 + * <div id="star"></div>
  17 + *
  18 + * $('#star').raty();
  19 + *
  20 + */
  21 +
  22 +;(function($) {
  23 +
  24 + var methods = {
  25 + init: function(settings) {
  26 + return this.each(function() {
  27 + methods.destroy.call(this);
  28 +
  29 + this.opt = $.extend(true, {}, $.fn.raty.defaults, settings);
  30 +
  31 + var that = $(this),
  32 + inits = ['number', 'readOnly', 'score', 'scoreName'];
  33 +
  34 + methods._callback.call(this, inits);
  35 +
  36 + if (this.opt.precision) {
  37 + methods._adjustPrecision.call(this);
  38 + }
  39 +
  40 + this.opt.number = methods._between(this.opt.number, 0, this.opt.numberMax)
  41 +
  42 + this.opt.path = this.opt.path || '';
  43 +
  44 + if (this.opt.path && this.opt.path.slice(this.opt.path.length - 1, this.opt.path.length) !== '/') {
  45 + this.opt.path += '/';
  46 + }
  47 +
  48 + this.stars = methods._createStars.call(this);
  49 + this.score = methods._createScore.call(this);
  50 +
  51 + methods._apply.call(this, this.opt.score);
  52 +
  53 + var space = this.opt.space ? 4 : 0,
  54 + width = this.opt.width || (this.opt.number * this.opt.size + this.opt.number * space);
  55 +
  56 + if (this.opt.cancel) {
  57 + this.cancel = methods._createCancel.call(this);
  58 +
  59 + width += (this.opt.size + space);
  60 + }
  61 +
  62 + if (this.opt.readOnly) {
  63 + methods._lock.call(this);
  64 + } else {
  65 + that.css('cursor', 'pointer');
  66 + methods._binds.call(this);
  67 + }
  68 +
  69 + if (this.opt.width !== false) {
  70 + that.css('width', width);
  71 + }
  72 +
  73 + methods._target.call(this, this.opt.score);
  74 +
  75 + that.data({ 'settings': this.opt, 'raty': true });
  76 + });
  77 + }, _adjustPrecision: function() {
  78 + this.opt.targetType = 'score';
  79 + this.opt.half = true;
  80 + }, _apply: function(score) {
  81 + if (score && score > 0) {
  82 + score = methods._between(score, 0, this.opt.number);
  83 + this.score.val(score);
  84 + }
  85 +
  86 + methods._fill.call(this, score);
  87 +
  88 + if (score) {
  89 + methods._roundStars.call(this, score);
  90 + }
  91 + }, _between: function(value, min, max) {
  92 + return Math.min(Math.max(parseFloat(value), min), max);
  93 + }, _binds: function() {
  94 + if (this.cancel) {
  95 + methods._bindCancel.call(this);
  96 + }
  97 +
  98 + methods._bindClick.call(this);
  99 + methods._bindOut.call(this);
  100 + methods._bindOver.call(this);
  101 + }, _bindCancel: function() {
  102 + methods._bindClickCancel.call(this);
  103 + methods._bindOutCancel.call(this);
  104 + methods._bindOverCancel.call(this);
  105 + }, _bindClick: function() {
  106 + var self = this,
  107 + that = $(self);
  108 +
  109 + self.stars.on('click.raty', function(evt) {
  110 + self.score.val((self.opt.half || self.opt.precision) ? that.data('score') : this.alt);
  111 +
  112 + if (self.opt.click) {
  113 + self.opt.click.call(self, parseFloat(self.score.val()), evt);
  114 + }
  115 + });
  116 + }, _bindClickCancel: function() {
  117 + var self = this;
  118 +
  119 + self.cancel.on('click.raty', function(evt) {
  120 + self.score.removeAttr('value');
  121 +
  122 + if (self.opt.click) {
  123 + self.opt.click.call(self, null, evt);
  124 + }
  125 + });
  126 + }, _bindOut: function() {
  127 + var self = this;
  128 +
  129 + $(this).on('mouseleave.raty', function(evt) {
  130 + var score = parseFloat(self.score.val()) || undefined;
  131 +
  132 + methods._apply.call(self, score);
  133 + methods._target.call(self, score, evt);
  134 +
  135 + if (self.opt.mouseout) {
  136 + self.opt.mouseout.call(self, score, evt);
  137 + }
  138 + });
  139 + }, _bindOutCancel: function() {
  140 + var self = this;
  141 +
  142 + self.cancel.on('mouseleave.raty', function(evt) {
  143 + $(this).attr('src', self.opt.path + self.opt.cancelOff);
  144 +
  145 + if (self.opt.mouseout) {
  146 + self.opt.mouseout.call(self, self.score.val() || null, evt);
  147 + }
  148 + });
  149 + }, _bindOverCancel: function() {
  150 + var self = this;
  151 +
  152 + self.cancel.on('mouseover.raty', function(evt) {
  153 + $(this).attr('src', self.opt.path + self.opt.cancelOn);
  154 +
  155 + self.stars.attr('src', self.opt.path + self.opt.starOff);
  156 +
  157 + methods._target.call(self, null, evt);
  158 +
  159 + if (self.opt.mouseover) {
  160 + self.opt.mouseover.call(self, null);
  161 + }
  162 + });
  163 + }, _bindOver: function() {
  164 + var self = this,
  165 + that = $(self),
  166 + action = self.opt.half ? 'mousemove.raty' : 'mouseover.raty';
  167 +
  168 + self.stars.on(action, function(evt) {
  169 + var score = parseInt(this.alt, 10);
  170 +
  171 + if (self.opt.half) {
  172 + var position = parseFloat((evt.pageX - $(this).offset().left) / self.opt.size),
  173 + plus = (position > .5) ? 1 : .5;
  174 +
  175 + score = score - 1 + plus;
  176 +
  177 + methods._fill.call(self, score);
  178 +
  179 + if (self.opt.precision) {
  180 + score = score - plus + position;
  181 + }
  182 +
  183 + methods._roundStars.call(self, score);
  184 +
  185 + that.data('score', score);
  186 + } else {
  187 + methods._fill.call(self, score);
  188 + }
  189 +
  190 + methods._target.call(self, score, evt);
  191 +
  192 + if (self.opt.mouseover) {
  193 + self.opt.mouseover.call(self, score, evt);
  194 + }
  195 + });
  196 + }, _callback: function(options) {
  197 + for (i in options) {
  198 + if (typeof this.opt[options[i]] === 'function') {
  199 + this.opt[options[i]] = this.opt[options[i]].call(this);
  200 + }
  201 + }
  202 + }, _createCancel: function() {
  203 + var that = $(this),
  204 + icon = this.opt.path + this.opt.cancelOff,
  205 + cancel = $('<img />', { src: icon, alt: 'x', title: this.opt.cancelHint, 'class': 'raty-cancel' });
  206 +
  207 + if (this.opt.cancelPlace == 'left') {
  208 + that.prepend('&#160;').prepend(cancel);
  209 + } else {
  210 + that.append('&#160;').append(cancel);
  211 + }
  212 +
  213 + return cancel;
  214 + }, _createScore: function() {
  215 + return $('<input />', { type: 'hidden', name: this.opt.scoreName }).appendTo(this);
  216 + }, _createStars: function() {
  217 + var that = $(this);
  218 +
  219 + for (var i = 1; i <= this.opt.number; i++) {
  220 + var title = methods._getHint.call(this, i),
  221 + icon = (this.opt.score && this.opt.score >= i) ? 'starOn' : 'starOff';
  222 +
  223 + icon = this.opt.path + this.opt[icon];
  224 +
  225 + $('<img />', { src : icon, alt: i, title: title }).appendTo(this);
  226 +
  227 + if (this.opt.space) {
  228 + that.append((i < this.opt.number) ? '&#160;' : '');
  229 + }
  230 + }
  231 +
  232 + return that.children('img');
  233 + }, _error: function(message) {
  234 + $(this).html(message);
  235 +
  236 + $.error(message);
  237 + }, _fill: function(score) {
  238 + var self = this,
  239 + hash = 0;
  240 +
  241 + for (var i = 1; i <= self.stars.length; i++) {
  242 + var star = self.stars.eq(i - 1),
  243 + select = self.opt.single ? (i == score) : (i <= score);
  244 +
  245 + if (self.opt.iconRange && self.opt.iconRange.length > hash) {
  246 + var irange = self.opt.iconRange[hash],
  247 + on = irange.on || self.opt.starOn,
  248 + off = irange.off || self.opt.starOff,
  249 + icon = select ? on : off;
  250 +
  251 + if (i <= irange.range) {
  252 + star.attr('src', self.opt.path + icon);
  253 + }
  254 +
  255 + if (i == irange.range) {
  256 + hash++;
  257 + }
  258 + } else {
  259 + var icon = select ? 'starOn' : 'starOff';
  260 +
  261 + star.attr('src', this.opt.path + this.opt[icon]);
  262 + }
  263 + }
  264 + }, _getHint: function(score) {
  265 + var hint = this.opt.hints[score - 1];
  266 + return (hint === '') ? '' : (hint || score);
  267 + }, _lock: function() {
  268 + var score = parseInt(this.score.val(), 10), // TODO: 3.1 >> [['1'], ['2'], ['3', '.1', '.2']]
  269 + hint = score ? methods._getHint.call(this, score) : this.opt.noRatedMsg;
  270 +
  271 + $(this).data('readonly', true).css('cursor', '').attr('title', hint);
  272 +
  273 + this.score.attr('readonly', 'readonly');
  274 + this.stars.attr('title', hint);
  275 +
  276 + if (this.cancel) {
  277 + this.cancel.hide();
  278 + }
  279 + }, _roundStars: function(score) {
  280 + var rest = (score - Math.floor(score)).toFixed(2);
  281 +
  282 + if (rest > this.opt.round.down) {
  283 + var icon = 'starOn'; // Up: [x.76 .. x.99]
  284 +
  285 + if (this.opt.halfShow && rest < this.opt.round.up) { // Half: [x.26 .. x.75]
  286 + icon = 'starHalf';
  287 + } else if (rest < this.opt.round.full) { // Down: [x.00 .. x.5]
  288 + icon = 'starOff';
  289 + }
  290 +
  291 + this.stars.eq(Math.ceil(score) - 1).attr('src', this.opt.path + this.opt[icon]);
  292 + } // Full down: [x.00 .. x.25]
  293 + }, _target: function(score, evt) {
  294 + if (this.opt.target) {
  295 + var target = $(this.opt.target);
  296 +
  297 + if (target.length === 0) {
  298 + methods._error.call(this, 'Target selector invalid or missing!');
  299 + }
  300 +
  301 + if (this.opt.targetFormat.indexOf('{score}') < 0) {
  302 + methods._error.call(this, 'Template "{score}" missing!');
  303 + }
  304 +
  305 + var mouseover = evt && evt.type == 'mouseover';
  306 +
  307 + if (score === undefined) {
  308 + score = this.opt.targetText;
  309 + } else if (score === null) {
  310 + score = mouseover ? this.opt.cancelHint : this.opt.targetText;
  311 + } else {
  312 + if (this.opt.targetType == 'hint') {
  313 + score = methods._getHint.call(this, Math.ceil(score));
  314 + } else if (this.opt.precision) {
  315 + score = parseFloat(score).toFixed(1);
  316 + }
  317 +
  318 + if (!mouseover && !this.opt.targetKeep) {
  319 + score = this.opt.targetText;
  320 + }
  321 + }
  322 +
  323 + if (score) {
  324 + score = this.opt.targetFormat.toString().replace('{score}', score);
  325 + }
  326 +
  327 + if (target.is(':input')) {
  328 + target.val(score);
  329 + } else {
  330 + target.html(score);
  331 + }
  332 + }
  333 + }, _unlock: function() {
  334 + $(this).data('readonly', false).css('cursor', 'pointer').removeAttr('title');
  335 +
  336 + this.score.removeAttr('readonly', 'readonly');
  337 +
  338 + for (var i = 0; i < this.opt.number; i++) {
  339 + this.stars.eq(i).attr('title', methods._getHint.call(this, i + 1));
  340 + }
  341 +
  342 + if (this.cancel) {
  343 + this.cancel.css('display', '');
  344 + }
  345 + }, cancel: function(click) {
  346 + return this.each(function() {
  347 + if ($(this).data('readonly') !== true) {
  348 + methods[click ? 'click' : 'score'].call(this, null);
  349 + this.score.removeAttr('value');
  350 + }
  351 + });
  352 + }, click: function(score) {
  353 + return $(this).each(function() {
  354 + if ($(this).data('readonly') !== true) {
  355 + methods._apply.call(this, score);
  356 +
  357 + if (!this.opt.click) {
  358 + methods._error.call(this, 'You must add the "click: function(score, evt) { }" callback.');
  359 + }
  360 +
  361 + this.opt.click.call(this, score, { type: 'click' });
  362 +
  363 + methods._target.call(this, score);
  364 + }
  365 + });
  366 + }, destroy: function() {
  367 + return $(this).each(function() {
  368 + var that = $(this),
  369 + raw = that.data('raw');
  370 +
  371 + if (raw) {
  372 + that.off('.raty').empty().css({ cursor: raw.style.cursor, width: raw.style.width }).removeData('readonly');
  373 + } else {
  374 + that.data('raw', that.clone()[0]);
  375 + }
  376 + });
  377 + }, getScore: function() {
  378 + var score = [],
  379 + value ;
  380 +
  381 + $(this).each(function() {
  382 + value = this.score.val();
  383 +
  384 + score.push(value ? parseFloat(value) : undefined);
  385 + });
  386 +
  387 + return (score.length > 1) ? score : score[0];
  388 + }, readOnly: function(readonly) {
  389 + return this.each(function() {
  390 + var that = $(this);
  391 +
  392 + if (that.data('readonly') !== readonly) {
  393 + if (readonly) {
  394 + that.off('.raty').children('img').off('.raty');
  395 +
  396 + methods._lock.call(this);
  397 + } else {
  398 + methods._binds.call(this);
  399 + methods._unlock.call(this);
  400 + }
  401 +
  402 + that.data('readonly', readonly);
  403 + }
  404 + });
  405 + }, reload: function() {
  406 + return methods.set.call(this, {});
  407 + }, score: function() {
  408 + return arguments.length ? methods.setScore.apply(this, arguments) : methods.getScore.call(this);
  409 + }, set: function(settings) {
  410 + return this.each(function() {
  411 + var that = $(this),
  412 + actual = that.data('settings'),
  413 + news = $.extend({}, actual, settings);
  414 +
  415 + that.raty(news);
  416 + });
  417 + }, setScore: function(score) {
  418 + return $(this).each(function() {
  419 + if ($(this).data('readonly') !== true) {
  420 + methods._apply.call(this, score);
  421 + methods._target.call(this, score);
  422 + }
  423 + });
  424 + }
  425 + };
  426 +
  427 + $.fn.raty = function(method) {
  428 + if (methods[method]) {
  429 + return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
  430 + } else if (typeof method === 'object' || !method) {
  431 + return methods.init.apply(this, arguments);
  432 + } else {
  433 + $.error('Method ' + method + ' does not exist!');
  434 + }
  435 + };
  436 +
  437 + $.fn.raty.defaults = {
  438 + cancel : false,
  439 + cancelHint : 'Cancel this rating!',
  440 + cancelOff : 'cancel-off.png',
  441 + cancelOn : 'cancel-on.png',
  442 + cancelPlace : 'left',
  443 + click : undefined,
  444 + half : false,
  445 + halfShow : true,
  446 + hints : ['bad', 'poor', 'regular', 'good', 'gorgeous'],
  447 + iconRange : undefined,
  448 + mouseout : undefined,
  449 + mouseover : undefined,
  450 + noRatedMsg : 'Not rated yet!',
  451 + number : 5,
  452 + numberMax : 20,
  453 + path : 'js/raty/lib/img/',
  454 + precision : false,
  455 + readOnly : false,
  456 + round : { down: .25, full: .6, up: .76 },
  457 + score : undefined,
  458 + scoreName : 'score',
  459 + single : false,
  460 + size : 16,
  461 + space : true,
  462 + starHalf : 'star-half.png',
  463 + starOff : 'star-off.png',
  464 + starOn : 'star-on.png',
  465 + target : undefined,
  466 + targetFormat : '{score}',
  467 + targetKeep : false,
  468 + targetText : '',
  469 + targetType : 'hint',
  470 + width : undefined
  471 + };
  472 +
  473 +})(jQuery);
... ...
src/main/resources/static/pages/base/timesmodel/js/raty/lib/jquery.raty.min.js 0 → 100644
  1 +/*!
  2 + * jQuery Raty - A Star Rating Plugin
  3 + *
  4 + * Licensed under The MIT License
  5 + *
  6 + * @version 2.5.2
  7 + * @author Washington Botelho
  8 + * @documentation wbotelhos.com/raty
  9 + *
  10 + */
  11 +
  12 +;(function(b){var a={init:function(c){return this.each(function(){a.destroy.call(this);this.opt=b.extend(true,{},b.fn.raty.defaults,c);var e=b(this),g=["number","readOnly","score","scoreName"];a._callback.call(this,g);if(this.opt.precision){a._adjustPrecision.call(this);}this.opt.number=a._between(this.opt.number,0,this.opt.numberMax);this.opt.path=this.opt.path||"";if(this.opt.path&&this.opt.path.slice(this.opt.path.length-1,this.opt.path.length)!=="/"){this.opt.path+="/";}this.stars=a._createStars.call(this);this.score=a._createScore.call(this);a._apply.call(this,this.opt.score);var f=this.opt.space?4:0,d=this.opt.width||(this.opt.number*this.opt.size+this.opt.number*f);if(this.opt.cancel){this.cancel=a._createCancel.call(this);d+=(this.opt.size+f);}if(this.opt.readOnly){a._lock.call(this);}else{e.css("cursor","pointer");a._binds.call(this);}if(this.opt.width!==false){e.css("width",d);}a._target.call(this,this.opt.score);e.data({settings:this.opt,raty:true});});},_adjustPrecision:function(){this.opt.targetType="score";this.opt.half=true;},_apply:function(c){if(c&&c>0){c=a._between(c,0,this.opt.number);this.score.val(c);}a._fill.call(this,c);if(c){a._roundStars.call(this,c);}},_between:function(e,d,c){return Math.min(Math.max(parseFloat(e),d),c);},_binds:function(){if(this.cancel){a._bindCancel.call(this);}a._bindClick.call(this);a._bindOut.call(this);a._bindOver.call(this);},_bindCancel:function(){a._bindClickCancel.call(this);a._bindOutCancel.call(this);a._bindOverCancel.call(this);},_bindClick:function(){var c=this,d=b(c);c.stars.on("click.raty",function(e){c.score.val((c.opt.half||c.opt.precision)?d.data("score"):this.alt);if(c.opt.click){c.opt.click.call(c,parseFloat(c.score.val()),e);}});},_bindClickCancel:function(){var c=this;c.cancel.on("click.raty",function(d){c.score.removeAttr("value");if(c.opt.click){c.opt.click.call(c,null,d);}});},_bindOut:function(){var c=this;b(this).on("mouseleave.raty",function(d){var e=parseFloat(c.score.val())||undefined;a._apply.call(c,e);a._target.call(c,e,d);if(c.opt.mouseout){c.opt.mouseout.call(c,e,d);}});},_bindOutCancel:function(){var c=this;c.cancel.on("mouseleave.raty",function(d){b(this).attr("src",c.opt.path+c.opt.cancelOff);if(c.opt.mouseout){c.opt.mouseout.call(c,c.score.val()||null,d);}});},_bindOverCancel:function(){var c=this;c.cancel.on("mouseover.raty",function(d){b(this).attr("src",c.opt.path+c.opt.cancelOn);c.stars.attr("src",c.opt.path+c.opt.starOff);a._target.call(c,null,d);if(c.opt.mouseover){c.opt.mouseover.call(c,null);}});},_bindOver:function(){var c=this,d=b(c),e=c.opt.half?"mousemove.raty":"mouseover.raty";c.stars.on(e,function(g){var h=parseInt(this.alt,10);if(c.opt.half){var f=parseFloat((g.pageX-b(this).offset().left)/c.opt.size),j=(f>0.5)?1:0.5;h=h-1+j;a._fill.call(c,h);if(c.opt.precision){h=h-j+f;}a._roundStars.call(c,h);d.data("score",h);}else{a._fill.call(c,h);}a._target.call(c,h,g);if(c.opt.mouseover){c.opt.mouseover.call(c,h,g);}});},_callback:function(c){for(i in c){if(typeof this.opt[c[i]]==="function"){this.opt[c[i]]=this.opt[c[i]].call(this);}}},_createCancel:function(){var e=b(this),c=this.opt.path+this.opt.cancelOff,d=b("<img />",{src:c,alt:"x",title:this.opt.cancelHint,"class":"raty-cancel"});if(this.opt.cancelPlace=="left"){e.prepend("&#160;").prepend(d);}else{e.append("&#160;").append(d);}return d;},_createScore:function(){return b("<input />",{type:"hidden",name:this.opt.scoreName}).appendTo(this);},_createStars:function(){var e=b(this);for(var c=1;c<=this.opt.number;c++){var f=a._getHint.call(this,c),d=(this.opt.score&&this.opt.score>=c)?"starOn":"starOff";d=this.opt.path+this.opt[d];b("<img />",{src:d,alt:c,title:f}).appendTo(this);if(this.opt.space){e.append((c<this.opt.number)?"&#160;":"");}}return e.children("img");},_error:function(c){b(this).html(c);b.error(c);},_fill:function(d){var m=this,e=0;for(var f=1;f<=m.stars.length;f++){var g=m.stars.eq(f-1),l=m.opt.single?(f==d):(f<=d);if(m.opt.iconRange&&m.opt.iconRange.length>e){var j=m.opt.iconRange[e],h=j.on||m.opt.starOn,c=j.off||m.opt.starOff,k=l?h:c;if(f<=j.range){g.attr("src",m.opt.path+k);}if(f==j.range){e++;}}else{var k=l?"starOn":"starOff";g.attr("src",this.opt.path+this.opt[k]);}}},_getHint:function(d){var c=this.opt.hints[d-1];return(c==="")?"":(c||d);},_lock:function(){var d=parseInt(this.score.val(),10),c=d?a._getHint.call(this,d):this.opt.noRatedMsg;b(this).data("readonly",true).css("cursor","").attr("title",c);this.score.attr("readonly","readonly");this.stars.attr("title",c);if(this.cancel){this.cancel.hide();}},_roundStars:function(e){var d=(e-Math.floor(e)).toFixed(2);if(d>this.opt.round.down){var c="starOn";if(this.opt.halfShow&&d<this.opt.round.up){c="starHalf";}else{if(d<this.opt.round.full){c="starOff";}}this.stars.eq(Math.ceil(e)-1).attr("src",this.opt.path+this.opt[c]);}},_target:function(f,d){if(this.opt.target){var e=b(this.opt.target);if(e.length===0){a._error.call(this,"Target selector invalid or missing!");}if(this.opt.targetFormat.indexOf("{score}")<0){a._error.call(this,'Template "{score}" missing!');}var c=d&&d.type=="mouseover";if(f===undefined){f=this.opt.targetText;}else{if(f===null){f=c?this.opt.cancelHint:this.opt.targetText;}else{if(this.opt.targetType=="hint"){f=a._getHint.call(this,Math.ceil(f));}else{if(this.opt.precision){f=parseFloat(f).toFixed(1);}}if(!c&&!this.opt.targetKeep){f=this.opt.targetText;}}}if(f){f=this.opt.targetFormat.toString().replace("{score}",f);}if(e.is(":input")){e.val(f);}else{e.html(f);}}},_unlock:function(){b(this).data("readonly",false).css("cursor","pointer").removeAttr("title");this.score.removeAttr("readonly","readonly");for(var c=0;c<this.opt.number;c++){this.stars.eq(c).attr("title",a._getHint.call(this,c+1));}if(this.cancel){this.cancel.css("display","");}},cancel:function(c){return this.each(function(){if(b(this).data("readonly")!==true){a[c?"click":"score"].call(this,null);this.score.removeAttr("value");}});},click:function(c){return b(this).each(function(){if(b(this).data("readonly")!==true){a._apply.call(this,c);if(!this.opt.click){a._error.call(this,'You must add the "click: function(score, evt) { }" callback.');}this.opt.click.call(this,c,{type:"click"});a._target.call(this,c);}});},destroy:function(){return b(this).each(function(){var d=b(this),c=d.data("raw");if(c){d.off(".raty").empty().css({cursor:c.style.cursor,width:c.style.width}).removeData("readonly");}else{d.data("raw",d.clone()[0]);}});},getScore:function(){var d=[],c;b(this).each(function(){c=this.score.val();d.push(c?parseFloat(c):undefined);});return(d.length>1)?d:d[0];},readOnly:function(c){return this.each(function(){var d=b(this);if(d.data("readonly")!==c){if(c){d.off(".raty").children("img").off(".raty");a._lock.call(this);}else{a._binds.call(this);a._unlock.call(this);}d.data("readonly",c);}});},reload:function(){return a.set.call(this,{});},score:function(){return arguments.length?a.setScore.apply(this,arguments):a.getScore.call(this);},set:function(c){return this.each(function(){var e=b(this),f=e.data("settings"),d=b.extend({},f,c);e.raty(d);});},setScore:function(c){return b(this).each(function(){if(b(this).data("readonly")!==true){a._apply.call(this,c);a._target.call(this,c);}});}};b.fn.raty=function(c){if(a[c]){return a[c].apply(this,Array.prototype.slice.call(arguments,1));}else{if(typeof c==="object"||!c){return a.init.apply(this,arguments);}else{b.error("Method "+c+" does not exist!");}}};b.fn.raty.defaults={cancel:false,cancelHint:"Cancel this rating!",cancelOff:"cancel-off.png",cancelOn:"cancel-on.png",cancelPlace:"left",click:undefined,half:false,halfShow:true,hints:["bad","poor","regular","good","gorgeous"],iconRange:undefined,mouseout:undefined,mouseover:undefined,noRatedMsg:"Not rated yet!",number:5,numberMax:20,path:"",precision:false,readOnly:false,round:{down:0.25,full:0.6,up:0.76},score:undefined,scoreName:"score",single:false,size:16,space:true,starHalf:"star-half.png",starOff:"star-off.png",starOn:"star-on.png",target:undefined,targetFormat:"{score}",targetKeep:false,targetText:"",targetType:"hint",width:undefined};})(jQuery);
... ...
src/main/resources/static/real_control_v2/assets/plugins/uikit-2.27.1/components/lightbox.min.js 0 → 100644
  1 +/*! UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
  2 +!function(i){var t;window.UIkit&&(t=i(UIkit)),"function"==typeof define&&define.amd&&define("uikit-lightbox",["uikit"],function(){return t||i(UIkit)})}(function(i){"use strict";function t(t){if(e)return e.lightbox=t,e;e=i.$(['<div class="uk-modal">','<div class="uk-modal-dialog uk-modal-dialog-lightbox uk-slidenav-position" style="margin-left:auto;margin-right:auto;width:200px;height:200px;top:'+Math.abs(window.innerHeight/2-200)+'px;">','<a href="#" class="uk-modal-close uk-close uk-close-alt"></a>','<div class="uk-lightbox-content"></div>','<div class="uk-modal-spinner uk-hidden"></div>',"</div>","</div>"].join("")).appendTo("body"),e.dialog=e.find(".uk-modal-dialog:first"),e.content=e.find(".uk-lightbox-content:first"),e.loader=e.find(".uk-modal-spinner:first"),e.closer=e.find(".uk-close.uk-close-alt"),e.modal=i.modal(e,{modal:!1}),e.on("swipeRight swipeLeft",function(i){e.lightbox["swipeLeft"==i.type?"next":"previous"]()}).on("click","[data-lightbox-previous], [data-lightbox-next]",function(t){t.preventDefault(),e.lightbox[i.$(this).is("[data-lightbox-next]")?"next":"previous"]()}),e.on("hide.uk.modal",function(){e.content.html("")});var o={w:window.innerWidth,h:window.innerHeight};return i.$win.on("load resize orientationchange",i.Utils.debounce(function(){o.w!==window.innerWidth&&e.is(":visible")&&!i.Utils.isFullscreen()&&e.lightbox.fitSize(),o={w:window.innerWidth,h:window.innerHeight}},100)),e.lightbox=t,e}var e,o={};return i.component("lightbox",{defaults:{allowfullscreen:!0,duration:400,group:!1,keyboard:!0},index:0,items:!1,boot:function(){i.$html.on("click","[data-uk-lightbox]",function(t){t.preventDefault();var e=i.$(this);e.data("lightbox")||i.lightbox(e,i.Utils.options(e.attr("data-uk-lightbox"))),e.data("lightbox").show(e)}),i.$doc.on("keyup",function(i){if(e&&e.is(":visible")&&e.lightbox.options.keyboard)switch(i.preventDefault(),i.keyCode){case 37:e.lightbox.previous();break;case 39:e.lightbox.next()}})},init:function(){var t=[];if(this.index=0,this.siblings=[],this.element&&this.element.length){var e=this.options.group?i.$(['[data-uk-lightbox*="'+this.options.group+'"]',"[data-uk-lightbox*='"+this.options.group+"']"].join(",")):this.element;e.each(function(){var e=i.$(this);t.push({source:e.attr("href"),title:e.attr("data-title")||e.attr("title"),type:e.attr("data-lightbox-type")||"auto",link:e})}),this.index=e.index(this.element),this.siblings=t}else this.options.group&&this.options.group.length&&(this.siblings=this.options.group);this.trigger("lightbox-init",[this])},show:function(e){this.modal=t(this),this.modal.dialog.stop(),this.modal.content.stop();var o,n,s=this,h=i.$.Deferred();e=e||0,"object"==typeof e&&this.siblings.forEach(function(i,t){e[0]===i.link[0]&&(e=t)}),0>e?e=this.siblings.length-e:this.siblings[e]||(e=0),n=this.siblings[e],o={lightbox:s,source:n.source,type:n.type,index:e,promise:h,title:n.title,item:n,meta:{content:"",width:null,height:null}},this.index=e,this.modal.content.empty(),this.modal.is(":visible")||(this.modal.content.css({width:"",height:""}).empty(),this.modal.modal.show()),this.modal.loader.removeClass("uk-hidden"),h.promise().done(function(){s.data=o,s.fitSize(o)}).fail(function(){o.meta.content='<div class="uk-position-cover uk-flex uk-flex-middle uk-flex-center"><strong>Loading resource failed!</strong></div>',o.meta.width=400,o.meta.height=300,s.data=o,s.fitSize(o)}),s.trigger("showitem.uk.lightbox",[o])},fitSize:function(){var t=this,e=this.data,o=this.modal.dialog.outerWidth()-this.modal.dialog.width(),n=parseInt(this.modal.dialog.css("margin-top"),10),s=parseInt(this.modal.dialog.css("margin-bottom"),10),h=n+s,a=e.meta.content,l=t.options.duration;this.siblings.length>1&&(a=[a,'<a href="#" class="uk-slidenav uk-slidenav-contrast uk-slidenav-previous uk-hidden-touch" data-lightbox-previous></a>','<a href="#" class="uk-slidenav uk-slidenav-contrast uk-slidenav-next uk-hidden-touch" data-lightbox-next></a>'].join(""));var d,r,u=i.$("<div>&nbsp;</div>").css({opacity:0,position:"absolute",top:0,left:0,width:"100%","max-width":t.modal.dialog.css("max-width"),padding:t.modal.dialog.css("padding"),margin:t.modal.dialog.css("margin")}),c=e.meta.width,g=e.meta.height;u.appendTo("body").width(),d=u.width(),r=window.innerHeight-h,u.remove(),this.modal.dialog.find(".uk-modal-caption").remove(),e.title&&(this.modal.dialog.append('<div class="uk-modal-caption">'+e.title+"</div>"),r-=this.modal.dialog.find(".uk-modal-caption").outerHeight()),d<e.meta.width&&(g=Math.floor(g*(d/c)),c=d),g>r&&(g=Math.floor(r),c=Math.ceil(e.meta.width*(r/e.meta.height))),this.modal.content.css("opacity",0).width(c).html(a),"iframe"==e.type&&this.modal.content.find("iframe:first").height(g);var m=g+o,p=Math.floor(window.innerHeight/2-m/2)-h;0>p&&(p=0),this.modal.closer.addClass("uk-hidden"),t.modal.data("mwidth")==c&&t.modal.data("mheight")==g&&(l=0),this.modal.dialog.animate({width:c+o,height:g+o,top:p},l,"swing",function(){t.modal.loader.addClass("uk-hidden"),t.modal.content.css({width:""}).animate({opacity:1},function(){t.modal.closer.removeClass("uk-hidden")}),t.modal.data({mwidth:c,mheight:g})})},next:function(){this.show(this.siblings[this.index+1]?this.index+1:0)},previous:function(){this.show(this.siblings[this.index-1]?this.index-1:this.siblings.length-1)}}),i.plugin("lightbox","image",{init:function(i){i.on("showitem.uk.lightbox",function(i,t){if("image"==t.type||t.source&&t.source.match(/\.(jpg|jpeg|png|gif|svg)$/i)){var e=function(i,e,o){t.meta={content:'<img class="uk-responsive-width" width="'+e+'" height="'+o+'" src ="'+i+'">',width:e,height:o},t.type="image",t.promise.resolve()};if(o[t.source])e(t.source,o[t.source].width,o[t.source].height);else{var n=new Image;n.onerror=function(){t.promise.reject("Loading image failed")},n.onload=function(){o[t.source]={width:n.width,height:n.height},e(t.source,o[t.source].width,o[t.source].height)},n.src=t.source}}})}}),i.plugin("lightbox","youtube",{init:function(i){var t=/(\/\/.*?youtube\.[a-z]+)\/watch\?v=([^&]+)&?(.*)/,n=/youtu\.be\/(.*)/;i.on("showitem.uk.lightbox",function(i,s){var h,a,l=function(i,t,o){s.meta={content:'<iframe src="//www.youtube.com/embed/'+i+'" width="'+t+'" height="'+o+'" style="max-width:100%;"'+(e.lightbox.options.allowfullscreen?" allowfullscreen":"")+"></iframe>",width:t,height:o},s.type="iframe",s.promise.resolve()};if((a=s.source.match(t))&&(h=a[2]),(a=s.source.match(n))&&(h=a[1]),h){if(o[h])l(h,o[h].width,o[h].height);else{var d=new Image,r=!1;d.onerror=function(){o[h]={width:640,height:320},l(h,o[h].width,o[h].height)},d.onload=function(){120==d.width&&90==d.height?r?(o[h]={width:640,height:320},l(h,o[h].width,o[h].height)):(r=!0,d.src="//img.youtube.com/vi/"+h+"/0.jpg"):(o[h]={width:d.width,height:d.height},l(h,d.width,d.height))},d.src="//img.youtube.com/vi/"+h+"/maxresdefault.jpg"}i.stopImmediatePropagation()}})}}),i.plugin("lightbox","vimeo",{init:function(t){var n,s=/(\/\/.*?)vimeo\.[a-z]+\/([0-9]+).*?/;t.on("showitem.uk.lightbox",function(t,h){var a,l=function(i,t,o){h.meta={content:'<iframe src="//player.vimeo.com/video/'+i+'" width="'+t+'" height="'+o+'" style="width:100%;box-sizing:border-box;"'+(e.lightbox.options.allowfullscreen?" allowfullscreen":"")+"></iframe>",width:t,height:o},h.type="iframe",h.promise.resolve()};(n=h.source.match(s))&&(a=n[2],o[a]?l(a,o[a].width,o[a].height):i.$.ajax({type:"GET",url:"//vimeo.com/api/oembed.json?url="+encodeURI(h.source),jsonp:"callback",dataType:"jsonp",success:function(i){o[a]={width:i.width,height:i.height},l(a,o[a].width,o[a].height)}}),t.stopImmediatePropagation())})}}),i.plugin("lightbox","video",{init:function(t){t.on("showitem.uk.lightbox",function(t,e){var n=function(i,t,o){e.meta={content:'<video class="uk-responsive-width" src="'+i+'" width="'+t+'" height="'+o+'" controls></video>',width:t,height:o},e.type="video",e.promise.resolve()};if("video"==e.type||e.source.match(/\.(mp4|webm|ogv)$/i))if(o[e.source])n(e.source,o[e.source].width,o[e.source].height);else var s=i.$('<video style="position:fixed;visibility:hidden;top:-10000px;"></video>').attr("src",e.source).appendTo("body"),h=setInterval(function(){s[0].videoWidth&&(clearInterval(h),o[e.source]={width:s[0].videoWidth,height:s[0].videoHeight},n(e.source,o[e.source].width,o[e.source].height),s.remove())},20)})}}),UIkit.plugin("lightbox","iframe",{init:function(i){i.on("showitem.uk.lightbox",function(t,o){var n=function(i,t,n){o.meta={content:'<iframe class="uk-responsive-width" src="'+i+'" width="'+t+'" height="'+n+'"'+(e.lightbox.options.allowfullscreen?" allowfullscreen":"")+"></iframe>",width:t,height:n},o.type="iframe",o.promise.resolve()};("iframe"===o.type||o.source.match(/\.(html|php)$/))&&n(o.source,i.options.width||800,i.options.height||600)})}}),i.lightbox.create=function(t,e){if(t){var o,n=[];return t.forEach(function(t){n.push(i.$.extend({source:"",title:"",type:"auto",link:!1},"string"==typeof t?{source:t}:t))}),o=i.lightbox(i.$.extend({},e,{group:n}))}},i.lightbox});
0 3 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/assets/plugins/uikit-2.27.1/components/slidenav.gradient.min.css 0 → 100644
  1 +/*! UIkit 2.27.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
  2 +.uk-slidenav{display:inline-block;box-sizing:border-box;width:60px;height:60px;line-height:60px;color:rgba(50,50,50,.4);font-size:60px;text-align:center}.uk-slidenav:focus,.uk-slidenav:hover{outline:0;text-decoration:none;color:rgba(50,50,50,.7);cursor:pointer}.uk-slidenav:active{color:rgba(50,50,50,.9)}.uk-slidenav-previous:before{content:"\f104";font-family:FontAwesome}.uk-slidenav-next:before{content:"\f105";font-family:FontAwesome}.uk-slidenav-position{position:relative}.uk-slidenav-position .uk-slidenav{display:none;position:absolute;top:50%;z-index:1;margin-top:-30px}.uk-slidenav-position:hover .uk-slidenav{display:block}.uk-slidenav-position .uk-slidenav-previous{left:20px}.uk-slidenav-position .uk-slidenav-next{right:20px}.uk-slidenav-contrast{color:rgba(255,255,255,.5)}.uk-slidenav-contrast:focus,.uk-slidenav-contrast:hover{color:rgba(255,255,255,.7)}.uk-slidenav-contrast:active{color:rgba(255,255,255,.9)}
0 3 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/css/main.css
... ... @@ -930,18 +930,19 @@ option.oil_station_opt{
930 930 position: absolute;
931 931 right: 12px;
932 932 bottom: 12px;
  933 + z-index: 99;
933 934 }
934 935  
935 936 .safe_driv_pop{
936   - height: 45px;
937 937 background: #d44b4b;
938   - color: #f2f2f2;
939 938 font-size: 15px;
940 939 padding: 9px 10px 0;
941 940 border: 1px solid #f4f0f0;
942 941 border-radius: 5px;
943 942 cursor: pointer;
944 943 box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
  944 + transition: all .03s;
  945 + color: #f2f2f2;
945 946 }
946 947  
947 948 .safe_driv_pop:hover{
... ... @@ -949,15 +950,33 @@ option.oil_station_opt{
949 950 }
950 951  
951 952 .safe_driv_pop .title{
952   - font-weight: 600;
953 953 }
954 954  
955   -.safe_driv_pop i.uk-icon-times-circle{
  955 +/*.safe_driv_pop i.uk-icon-times-circle{
956 956 margin-right: 5px;
957   -}
  957 +}*/
958 958 .safe_driv_pop .desc{
959 959 display: block;
960 960 font-size: 12px;
961   - margin: 2px 0 0 20px;
962   - color: #e3e3e3;
963   -}
964 961 \ No newline at end of file
  962 + color: #ff9d9d;
  963 + text-align: right;
  964 + margin-right: 5px;
  965 +}
  966 +
  967 +/*.safe_driv_pop .detail_content{
  968 + display: none;
  969 +}
  970 +
  971 +.safe_driv_pop.open .detail_content{
  972 + display: block;
  973 + background: rgb(255, 255, 255);
  974 + height: 200px;
  975 + margin: 7px 0;
  976 + border-radius: 5px;
  977 + color: #000000;
  978 +}
  979 +
  980 +.safe_driv_pop.open .desc{
  981 + display: none;
  982 +}*/
  983 +/** 安全驾驶相关css结束 */
965 984 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/lj_zrw.html
... ... @@ -97,6 +97,8 @@
97 97 <span class="uk-badge uk-badge-danger">直放</span>
98 98 {{else if sch.bcType == "major"}}
99 99 <span class="uk-badge uk-badge-danger">放站</span>
  100 + {{else if sch.bcType == "region"}}
  101 + <span class="uk-badge">区间</span>
100 102 {{/if}}
101 103 {{if sch.sflj}}
102 104 <span class="uk-badge uk-badge-danger">临加</span>
... ...
src/main/resources/static/real_control_v2/fragments/line_schedule/sch_table.html
... ... @@ -72,6 +72,8 @@
72 72 <span class="uk-badge uk-badge-danger">直放</span>
73 73 {{else if sch.bcType == "major"}}
74 74 <span class="uk-badge uk-badge-danger">放站</span>
  75 + {{else if sch.bcType == "region"}}
  76 + <span class="uk-badge">区间</span>
75 77 {{/if}}
76 78 {{if sch.sflj}}
77 79 <span class="uk-badge uk-badge-danger">临加</span>
... ... @@ -119,6 +121,8 @@
119 121 <span class="uk-badge uk-badge-danger">直放</span>
120 122 {{else if bcType == "major"}}
121 123 <span class="uk-badge uk-badge-danger">放站</span>
  124 + {{else if bcType == "region"}}
  125 + <span class="uk-badge">区间</span>
122 126 {{/if}}
123 127 {{if sflj}}
124 128 <span class="uk-badge uk-badge-danger">临加</span>
... ...
src/main/resources/static/real_control_v2/fragments/north/nav/all_devices.html
1   -<div class="uk-modal" id="all-devices-modal">
  1 +<div class="uk-modal ct_move_modal" id="all-devices-modal">
2 2 <div class="uk-modal-dialog" style="width: 1100px;">
3 3 <a href="" class="uk-modal-close uk-close"></a>
4 4 <div class="uk-modal-header">
... ...
src/main/resources/static/real_control_v2/fragments/north/nav/safeDriving.html 0 → 100644
  1 +<div class="uk-modal ct_move_modal" id="safe_dring_list-modal" style="z-index: 99;">
  2 + <div class="uk-modal-dialog" style="width: 1100px;">
  3 + <a href="" class="uk-modal-close uk-close"></a>
  4 + <div class="uk-modal-header">
  5 + <h2>安全驾驶图像信息(当日)</h2></div>
  6 +
  7 + <div class="uk-panel uk-panel-box uk-panel-box-primary">
  8 + <form class="uk-form search-form">
  9 + <fieldset data-uk-margin>
  10 + <legend>
  11 + 数据检索
  12 + </legend>
  13 + <span class="horizontal-field">车辆</span>
  14 + <div class="uk-autocomplete uk-form autocomplete-cars" >
  15 + <input type="text" name="clzbh" placeholder="车辆自编号">
  16 + </div>
  17 + <span class="horizontal-field">异常类型</span>
  18 + <select name="yczltype">
  19 + <option value="">全部</option>
  20 + <option value="A1">手部离开方向盘</option>
  21 + <option value="A2">摄像头异常</option>
  22 + <option value="A3">未戴安全带</option>
  23 + <option value="A4">未戴袖章</option>
  24 + <option value="A5">眨眼/疲劳驾驶</option>
  25 + <option value="A6">打哈欠/打瞌睡</option>
  26 + <option value="A7">行驶中与人交谈</option>
  27 + </select>
  28 + <button class="uk-button">检索</button>
  29 + </fieldset>
  30 + </form>
  31 + </div>
  32 + <div style="height: 495px;margin:5px 0 -18px;">
  33 + <table class="ct-fixed-table uk-table uk-table-hover">
  34 + <thead>
  35 + <tr>
  36 + <th style="width: 12%;">线路</th>
  37 + <th style="width: 13%;">车辆自编号</th>
  38 + <th style="width: 13%;">设备</th>
  39 + <th style="width: 13%;">异常类型</th>
  40 + <th style="width: 17%;">时间</th>
  41 + <th style="width: 11%;">检查属性</th>
  42 + <th style="width: 11%;">图像</th>
  43 + <th>视频</th>
  44 + </tr>
  45 + </thead>
  46 + <tbody data-uk-observe>
  47 + </tbody>
  48 + </table>
  49 + </div>
  50 +
  51 + <div class="uk-modal-footer uk-text-right pagination-wrap">
  52 + </div>
  53 + </div>
  54 +
  55 + <script id="all-safe_dring-table-temp" type="text/html">
  56 + {{each array as sd i}}
  57 + <tr>
  58 + <td style="width: 14%;">{{sd.xlmc}}</td>
  59 + <td style="width: 14%;">{{sd.clzbh}}</td>
  60 + <td style="width: 13%;">{{sd.sbbh}}</td>
  61 + <td style="width: 13%;">{{sd.yczlText}}</td>
  62 + <td style="width: 10%;">{{sd.timeStr}}</td>
  63 + <td style="width: 10%;">
  64 + {{if sd.yczltype=='A1'}}
  65 + {{if sd.jctype==0}}
  66 + 双脱手
  67 + {{else if sd.jctype==1}}
  68 + 单脱手
  69 + {{/if}}
  70 + {{/if}}
  71 + </td>
  72 + <td style="width: 10%;">
  73 + <a class="image_link" href="{{sd.url}}.jpg" data-uk-lightbox="{group:'jpg_group1'}" title="{{sd.title}}">JPG</a>
  74 + </td>
  75 + <td>
  76 + <a class="image_link" href="{{sd.url}}.gif" data-uk-lightbox="{group:'gif_group2'}" title="{{sd.title}}">查看视频</a>
  77 + </td>
  78 + </tr>
  79 + {{/each}}
  80 + </script>
  81 +
  82 + <script>
  83 + (function() {
  84 + var modal = '#safe_dring_list-modal';
  85 + var form = $('.search-form', modal);
  86 + var page = 0;
  87 + var pageSize = 12;
  88 +
  89 + $(modal).on('init', function(e, data) {
  90 + e.stopPropagation();
  91 +
  92 + query();
  93 + });
  94 +
  95 + //sumit event
  96 + form.on('submit', function(e) {
  97 + e.preventDefault();
  98 + resetPagination = true;
  99 + page=0;
  100 + query();
  101 + });
  102 +
  103 + var query = function() {
  104 + scanFlag = false;
  105 + var data = form.serializeJSON();
  106 + data.page = page;
  107 + data.size = pageSize;
  108 +
  109 + gb_common.$get('/gps/safeDriv', data, function (rs) {
  110 + //数据转换
  111 + var code2Name=gb_data_basic.lineCode2NameAll(), url,stm, p;
  112 + $.each(rs.list, function(){
  113 + if(this.xlbm)
  114 + this.xlmc=code2Name[this.xlbm];
  115 + else
  116 + this.xlmc='';
  117 + stm = moment(this.ts);
  118 + this.timeStr = stm.format('YYYY-MM-DD HH:mm:ss');
  119 + this.yczlText= gb_safe_driv.safeCode[this.yczltype];
  120 + //拼接图片地址
  121 + p = (this.sbbh+'_'+this.yczltype+'_'+stm.format('YYYYMMDDHHmmss'));
  122 + url = stm.format('YYYYMMDD')+'/'+p+'/'+p;
  123 + this.url = gb_safe_driv.urlPath + url;
  124 + //title
  125 + this.title = this.clzbh+' '+stm.format('HH时mm分ss秒')+' '+this.yczlText;
  126 + });
  127 +
  128 + var bodyHtml = template('all-safe_dring-table-temp', {
  129 + array: rs.list
  130 + });
  131 + $('table tbody', modal).html(bodyHtml);
  132 + if (resetPagination)
  133 + pagination(rs.totalPages + 1, rs.page);
  134 +
  135 + //扫描图片是否存在
  136 + scanFlag = true;
  137 + scanImgIsExist();
  138 + });
  139 + };
  140 +
  141 + var scanFlag;
  142 + var scanImgIsExist = function () {
  143 + var array = $('table tbody a.image_link', modal);
  144 + var i = 0;
  145 + //匿名函数递归
  146 + (function () {
  147 + //计数
  148 + if(i >= array.length || !scanFlag){
  149 + console.log('扫描图片结束');
  150 + return;
  151 + }
  152 + var f = arguments.callee;
  153 + var $a = $(array[i]);
  154 + i ++;
  155 + var img = new Image();
  156 + img.onerror = function(){
  157 + $a.removeAttr('href').removeAttr('data-uk-lightbox').text('无').css('color', '#b8b8b8');
  158 + f();
  159 + };
  160 + img.onload = function(){
  161 + f();
  162 + };
  163 + img.src=$a.attr('href');
  164 + })();
  165 + };
  166 +
  167 + var resetPagination = true;
  168 + var pagination = function(pages, currentPage) {
  169 + var wrap = $('.pagination-wrap', modal).empty()
  170 + ,e = $('<ul class="uk-pagination"></ul>').appendTo(wrap);
  171 +
  172 + var pagination = UIkit.pagination(e, {
  173 + pages: pages,
  174 + currentPage: currentPage
  175 + });
  176 +
  177 + e.on('select.uk.pagination', function(e, pageIndex){
  178 + page = pageIndex;
  179 + query();
  180 + });
  181 +
  182 + resetPagination = false;
  183 + };
  184 + })();
  185 + </script>
  186 +</div>
... ...
src/main/resources/static/real_control_v2/js/data/json/north_toolbar.json
... ... @@ -267,6 +267,11 @@
267 267 "id": 3.4,
268 268 "text": "轨迹回放",
269 269 "event": "gps_play_back"
  270 + },
  271 + {
  272 + "id": 3.5,
  273 + "text": "安全驾驶(图像)",
  274 + "event": "safe_driving"
270 275 }
271 276 ]
272 277 },
... ...
src/main/resources/static/real_control_v2/js/modal_extend.js
1 1 //modal hide remove dom
2 2 $(document).on('hide.uk.modal', '.uk-modal', function () {
  3 + //放过灯箱
  4 + if($('.uk-modal-dialog', this).hasClass('uk-modal-dialog-lightbox')){
  5 + return;
  6 + }
3 7 $(this).remove();
4 8 });
5 9  
... ... @@ -7,10 +11,6 @@ $(document).on(&#39;show.uk.modal&#39;, &#39;.uk-modal.ct_move_modal&#39;, function () {
7 11 if($('.uk-modal-dialog', this).hasClass('uk-modal-dialog-blank'))
8 12 return;
9 13  
10   - /* //临时放过轨迹回放
11   - if($(this).attr('id')=='map-playback-modal')
12   - return;*/
13   -
14 14 //计算居中位置
15 15 var win = $('body');
16 16 var Y = (win.width() - $('.uk-modal-dialog', this).width()) / 2 - 10;
... ... @@ -55,7 +55,6 @@ var modal_move = function (m_header) {
55 55 var win = $('body');
56 56  
57 57 $(m_header).on('mousedown', function (e) {
58   - console.log('mousedown');
59 58 e.preventDefault();
60 59 _moveFlag = true;
61 60 _moveObj = $(this).parent();
... ...
src/main/resources/static/real_control_v2/js/north/toolbar.js
... ... @@ -188,6 +188,9 @@ var gb_northToolbar = (function () {
188 188 },
189 189 form_schedule_daily: function () {
190 190 gb_embed_form_hanlde.open_modal_form_fragment('/pages/forms/statement/scheduleDaily.html', '调度工作日报表');
  191 + },
  192 + safe_driving: function () {
  193 + open_modal('/real_control_v2/fragments/north/nav/safeDriving.html', {}, modal_opts);
191 194 }
192 195 };
193 196  
... ...
src/main/resources/static/real_control_v2/js/safe_driv/safeDriv.js
... ... @@ -13,32 +13,49 @@ var gb_safe_driv = (function () {
13 13 'A7': '与人交谈'
14 14 };
15 15  
  16 + var path = 'http://180.166.5.82:9988/CurrentSafeDriving/';
  17 +
16 18 var $wrap = $('.safe_driv_pop_wrap');
17 19 var max = 5;
18 20  
19 21 var pop = function (sd) {
20 22 //只有admin用户能收到
21 23 var user = gb_northToolbar.user();
22   - if(!user || user.userName.indexOf('admin') == -1)
  24 + if (!user || user.userName.indexOf('admin') == -1)
23 25 return;
24 26  
25   - var htmlStr = '<div class="safe_driv_pop uk-animation-slide-bottom">'+
26   - ' <span class="title"><i class="uk-icon-times-circle"></i>安全驾驶 '+moment(sd.ts).format('HH:mm')+'</span>'+
27   - ' <span class="text"> '+sd.clzbh+' 违规驾驶('+codes[sd.yczltype]+')</span><span class="desc">请至安全驾驶监管平台查看图像信息</span>'+
28   - '</div>';
29   -
  27 + //时间格式化
  28 + var stm = moment(sd.ts);
  29 + sd.timeStr = stm.format('HH时mm分ss秒');
  30 + //异常状态文本
  31 + sd.ycztText = codes[sd.yczltype];
  32 + //图片地址
  33 + var p = (sd.sbbh+'_'+sd.yczltype+'_'+stm.format('YYYYMMDDHHmmss'));
  34 + var url = stm.format('YYYYMMDD')+'/'+p+'/'+p;
  35 + sd.url = path + url + '.jpg';
  36 +
  37 + var htmlStr = template('safe_driv_item-temp', sd);
30 38 var items = $wrap.find('.safe_driv_pop'), len = items.length;
31   - if(len >= max)
32   - $wrap.find('.safe_driv_pop:lt('+(len - max)+')').remove();
  39 + if (len >= max)
  40 + $wrap.find('.safe_driv_pop:lt(' + (len - max) + ')').remove();
33 41  
34 42 $wrap.append(htmlStr);
35 43 };
36 44  
37 45 $wrap.on('click', '.safe_driv_pop', function () {
  46 + var title = $(this).data('title');
  47 + var url = $(this).data('url');
38 48 $(this).remove();
  49 + var lightbox = UIkit.lightbox.create([
  50 + {title: title, 'source': url}
  51 + ]);
  52 +
  53 + lightbox.show();
39 54 });
40 55  
41 56 return {
42   - pop: pop
  57 + pop: pop,
  58 + safeCode: codes,
  59 + urlPath: path
43 60 }
44 61 })();
45 62 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/main.html
... ... @@ -11,6 +11,7 @@
11 11 <link rel="stylesheet"
12 12 href="/real_control_v2/assets/plugins/uikit-2.27.1/components/autocomplete.gradient.min.css"/>
13 13 <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/accordion.gradient.min.css"/>
  14 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/slidenav.gradient.min.css"/>
14 15  
15 16 <!-- main style -->
16 17 <link rel="stylesheet" href="/real_control_v2/css/main.css"/>
... ... @@ -60,7 +61,6 @@
60 61 </div>
61 62 </div>
62 63  
63   -<div class="safe_driv_pop_wrap"></div>
64 64 <script>
65 65 delete window.exports;
66 66 delete window.module;
... ... @@ -123,6 +123,7 @@
123 123 <script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/autocomplete.min.js"></script>
124 124 <script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/accordion.min.js"></script>
125 125 <script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/timepicker.min.js"></script>
  126 +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/lightbox.min.js"></script>
126 127  
127 128 <!-- jquery contextMenu -->
128 129 <script src="/real_control_v2/assets/js/jquery.contextMenu.min.js"></script>
... ... @@ -185,8 +186,21 @@
185 186 <script src="/real_control_v2/js/forms/form_embed.js"></script>
186 187 <!-- 模态框扩展 -->
187 188 <script src="/real_control_v2/js/modal_extend.js"></script>
188   -<!-- 安全驾驶相关 -->
  189 +
  190 +<!-- #### 安全驾驶 start ### -->
  191 +<div class="safe_driv_pop_wrap" ></div>
  192 +<script id="safe_driv_item-temp" type="text/html">
  193 + <div class="safe_driv_pop uk-animation-slide-bottom" data-title="{{clzbh}} {{timeStr}} {{ycztText}}" data-url="{{url}}">
  194 + <div>
  195 + <span class="title">异常&nbsp;{{clzbh}}</span>
  196 + <span class="text"> {{timeStr}} 出现违规驾驶({{ycztText}})</span>
  197 + <span class="desc">--安全驾驶监管平台</span>
  198 + </div>
  199 + </div>
  200 +</script>
  201 +
189 202 <script src="/real_control_v2/js/safe_driv/safeDriv.js" ></script>
  203 +<!-- #### 安全驾驶 end ### -->
190 204 </body>
191 205  
192 206 </html>
... ...
src/main/resources/static/real_control_v2/mapmonitor/css/real.css
... ... @@ -818,8 +818,17 @@ input[type=checkbox].disabled{
818 818 height: 100%;
819 819 }
820 820  
  821 +.map-container.show_tools{
  822 + height: calc(100% - 63px);
  823 + margin-top: 63px;
  824 +}
  825 +
821 826 #map-playback2-modal .uk-modal-close{
822 827 z-index: 11;
  828 + background: #ff3333;
  829 + opacity: 1;
  830 + border-radius: 15px;
  831 + color: white;
823 832 }
824 833  
825 834 .map-wrap-tools .ct-progress-bar{
... ... @@ -828,6 +837,7 @@ input[type=checkbox].disabled{
828 837 width: 100%;
829 838 bottom: 0;
830 839 cursor: pointer;
  840 + overflow: hidden;
831 841 /*border-top: 5px solid white;*/
832 842 }
833 843  
... ... @@ -866,7 +876,7 @@ input[type=checkbox].disabled{
866 876 .map-wrap-tools .btns>.multi-items{
867 877 display: inline-block;
868 878 vertical-align: top;
869   - background: #e7e4e4;
  879 + background: #f1f1f1;
870 880 padding: 7px 15px;
871 881 margin: 12px 5px;
872 882 border-radius: 5px;
... ... @@ -899,4 +909,16 @@ input[type=checkbox].disabled{
899 909 font-size: 22px;
900 910 color: #8b8686;
901 911 margin-right: 10px;
  912 +}
  913 +
  914 +.play_back_form_shade{
  915 + background: rgb(196, 194, 194);
  916 + position: absolute;
  917 + width: 98%;
  918 + height: 205px;
  919 + left: 2%;
  920 + z-index: 99;
  921 + top: 0;
  922 + opacity: .2;
  923 + display: none;
902 924 }
903 925 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/mapmonitor/fragments/playback_v2/main.html
1   -<div class="uk-modal" id="map-playback2-modal">
2   - <div class="uk-modal-dialog uk-modal-dialog-blank">
3   - <button class="uk-modal-close uk-close" type="button"></button>
4   - <div class="uk-grid uk-flex-middle" data-uk-grid-margin>
5   - <div class="uk-width-medium-1-10 uk-height-viewport z-depth-viewport">
6   - <h5 style="color: #868484;text-indent: 5px;">
7   - 线路配车
8   - </h5>
9   - <div class="uk-accordion cc_info_accordion" data-uk-accordion data-uk-observe>
10   - </div>
11   -
12   - </div>
13   - <div class="uk-width-medium-2-10 uk-height-viewport z-depth-viewport ">
14   - <form class="uk-form uk-form-horizontal playBackForm">
15   - <div class="uk-grid">
16   - <div class="uk-width-1-1">
17   - <div class="uk-form-row">
18   - <label class="uk-form-label">车辆编码</label>
19   - <div class="uk-form-controls">
20   - <div class="uk-autocomplete uk-form autocomplete-nbbm">
21   - <input name="nbbm" required/>
22   - </div>
23   - </div>
24   - </div>
25   - </div>
26   - </div>
27   - <div class="uk-grid">
28   - <div class="uk-width-2-3">
29   - <div class="uk-form-row">
30   - <label class="uk-form-label">开始时间</label>
31   - <div class="uk-form-controls">
32   - <input name="sDate" type="date" required/>
33   - </div>
34   - </div>
35   - </div>
36   - <div class="uk-width-1-3" style="padding-left: 15px;">
37   - <div class="uk-form-row">
38   - <div class="uk-form-controls" style="margin-left: 0;">
39   - <input name="sTime" type="time" required/>
40   - </div>
41   - </div>
42   - </div>
43   - </div>
44   - <div class="uk-grid">
45   - <div class="uk-width-2-3">
46   - <div class="uk-form-row">
47   - <label class="uk-form-label">结束时间</label>
48   - <div class="uk-form-controls">
49   - <input name="eDate" type="date" required/>
50   - </div>
51   - </div>
52   - </div>
53   - <div class="uk-width-1-3" style="padding-left: 15px;">
54   - <div class="uk-form-row">
55   - <div class="uk-form-controls" style="margin-left: 0;">
56   - <input name="eTime" type="time" required/>
57   - </div>
58   - </div>
59   - </div>
60   - </div>
61   - <div class="uk-grid">
62   - <button class="uk-button uk-button-large uk-button-primary playBackButton" type="submit"><i
63   - class="uk-icon-search"> </i> 搜索轨迹
64   - </button>
65   - </div>
66   - </form>
67   - <!-- 异常警报 -->
68   - <div class="abnormal_table_wrap">
69   - <div class="abnormal_table_panel"
70   - style="height: calc(100% - 15px);margin-top: 15px;overflow: auto;">
71   - <div class="ct_table abnormal_table" style="height: calc(100% - 30px);">
72   - <div class="ct_table_head">
73   - <dl>
74   - <dt>异常状态</dt>
75   - <dt>开始时间</dt>
76   - <dt>结束时间</dt>
77   - <dt>图像</dt>
78   - </dl>
79   - </div>
80   - <div class="ct_table_body">
81   - </div>
82   - </div>
83   - </div>
84   - </div>
85   - <!-- 路段 和 到离站信息 -->
86   - <div class="uk-margin uk-grid other_info_table_wrap" data-uk-grid-margin>
87   - <div class="uk-width-medium-1-1" style="padding-left: 0;">
88   -
89   - <ul class="uk-tab" data-uk-tab="{connect:'#real_gps_info_tab_content'}"
90   - style="padding-left: 12px;">
91   - <li class="uk-active"><a>行车轨迹</a></li>
92   - <li><a>到离站信息</a></li>
93   - </ul>
94   -
95   - <ul id="real_gps_info_tab_content" class="uk-switcher uk-margin"
96   - style="height: calc(100% - 44px);margin-top: 7px;">
97   - <li class="uk-active" style="height: 100%;">
98   - <div class="road_table_wrap" style="height: 100%;overflow: auto;">
99   - <div class="ct_table gps-road-info"
100   - style="height: calc(100% - 30px);">
101   - <div class="ct_table_head">
102   - <dl>
103   - <dt>时间</dt>
104   - <dt>速度</dt>
105   - <dt>所在路段</dt>
106   - </dl>
107   - </div>
108   - <div class="ct_table_body">
109   - </div>
110   - </div>
111   - </div>
112   - </li>
113   - <!-- 到离站数据 -->
114   - <li style="height: 100%;">
115   - <div class="inout_table_wrap" style="height: 100%;overflow: auto;">
116   - <div class="ct_table" style="height: calc(100% - 30px);">
117   - <div class="ct_table_head">
118   - <dl>
119   - <dt>站点</dt>
120   - <dt>到站时间</dt>
121   - <dt>离站时间</dt>
122   - <dt>上客</dt>
123   - <dt>下客</dt>
124   - </dl>
125   - </div>
126   - <div class="ct_table_body">
127   - </div>
128   - </div>
129   - </div>
130   - </li>
131   - </ul>
132   -
133   - </div>
134   - </div>
135   - </div>
136   - <div class="uk-width-medium-7-10 uk-height-viewport map-wrap" style="padding-left: 0;position: relative;">
137   - <div class="map-wrap-tools uk-animation-slide-top">
138   - <div class="btns">
139   - <span class="ct_btn play_btn"></span>
140   - <span class="ct_btn clock">
141   - 08:20.10
142   - </span>
143   - <div class="multi-items">
144   - <form class="uk-form">
145   - <label>
146   - <input type="radio" name="playSpeed"> x1
147   - </label>
148   - <label>
149   - <input type="radio" name="playSpeed"> x5
150   - </label>
151   - <label>
152   - <input type="radio" name="playSpeed"> x10
153   - </label>
154   - <label>
155   - <input type="radio" name="playSpeed"> x20
156   - </label>
157   - </form>
158   - </div>
159   - <div class="multi-items">
160   - <form class="uk-form">
161   - <label>
162   - <input type="checkbox"> 站点
163   - </label>
164   - <label>
165   - <input type="checkbox"> 缓冲区
166   - </label>
167   - <label>
168   - <input type="checkbox"> 站点名称
169   - </label>
170   - <label>
171   - 停车场 <i class="uk-icon-angle-down"></i>
172   - </label>
173   - </form>
174   - </div>
175   - <span class="ct_btn text-panel">
176   - <span>约12.58公里,1258个GPS点</span><br>
177   - <a class="export-excel"><i class="uk-icon-file-excel-o"></i> 导出轨迹</a>
178   - </span>
179   - </div>
180   - <div class="ct-progress-bar" >
181   - <div class="scale"></div>
182   - </div>
183   - </div>
184   - <div class="map-container"></div>
185   - </div>
186   - </div>
187   - </div>
188   -
189   - <script id="cc_info_accordion_cont_temp" type="text/html">
190   - {{each ccInfo as cc i}}
191   - <h3 class="uk-accordion-title">{{cc.name}}</h3>
192   - <div class="uk-accordion-content">
193   - <ul class="uk-list">
194   - {{each cc.cars as c j}}
195   - <li>{{c}}</li>
196   - {{/each}}
197   - </ul>
198   - </div>
199   - {{/each}}
200   - </script>
201   -
202   - <script id="gps_road_info_cont_temp" type="text/html">
203   - {{each array as gps i}}
204   - <dl data-code="{{gps.road.road_CODE}}">
205   - <dd>{{gps.timeStr}}</dd>
206   - <dd>{{gps.speed}}</dd>
207   - <dd>{{gps.road.road_NAME}}</dd>
208   - </dl>
209   - {{/each}}
210   - </script>
211   -
212   - <script id="multi_inout_info_cont_temp" type="text/html">
213   - {{each list as item i}}
214   - <dl>
215   - <dd>{{item.stopName}}</dd>
216   - <dd>{{item.in_time_str}}</dd>
217   - <dd>{{item.out_time_str}}</dd>
218   - <dd></dd>
219   - <dd></dd>
220   - </dl>
221   - {{/each}}
222   - </script>
223   -
224   - <script id="abnormal_table_cont_temp" type="text/html">
225   - {{each array as item i}}
226   - <dl>
227   - <dd>
228   - {{if item.abnormalType == 'speed'}}
229   - 超速({{item.speed}})
230   - {{else if item.abnormalType == 'outbound'}}
231   - 越界
232   - {{/if}}
233   - </dd>
234   - <dd>{{item.st_str}}</dd>
235   - <dd>{{item.et_str}}</dd>
236   - <dd></dd>
237   - </dl>
238   - {{/each}}
239   - </script>
240   - <script>
241   - (function () {
242   - var modal = '#map-playback2-modal', gpsArray;
243   -
244   - $(modal).on('init', function (e, data) {
245   - try {
246   - //初始化地图
247   - map = new BMap.Map($('.map-container', modal)[0]);
248   - //中心点和缩放级别
249   - map.centerAndZoom(new BMap.Point(gb_map_consts.center_point.lng, gb_map_consts.center_point.lat), 16);
250   - map.enableScrollWheelZoom();
251   - } catch (e) {
252   - console.log(e);
253   - }
254   -
255   - //固定表头
256   - gb_ct_table.fixedHead($('.road_table_wrap', modal));
257   - gb_ct_table.fixedHead($('.inout_table_wrap', modal));
258   - gb_ct_table.fixedHead($('.abnormal_table_panel', modal));
259   - //线路配车
260   - ccInfo.init();
261   -
262   - //表单初始值
263   - searchForm.init(data);
264   - });
265   -
266   - /**
267   - * 线路配车相关
268   - */
269   - var ccInfo = (function () {
270   -
271   - function init() {
272   - $.get('/basic/ccInfo', function (rs) {
273   - var ccInfo = [], lines = gb_data_basic.codeToLine;
274   - for (var code in lines) {
275   - ccInfo.push({
276   - name: lines[code].name,
277   - cars: carSort(rs[code])
278   - });
279   - }
280   -
281   - var htmlStr = template('cc_info_accordion_cont_temp', {ccInfo: ccInfo});
282   - $('.cc_info_accordion', modal).html(htmlStr)
283   - .find('.uk-list li').on('click', itemClick);
284   - });
285   - }
286   -
287   - function carSort(list) {
288   - if (!list)
289   - return [];
290   - return list.sort();
291   - }
292   -
293   - function itemClick() {
294   - $(this).parent().find('li.active').removeClass('active');
295   - $(this).addClass('active');
296   - searchForm.setNbbm($(this).text());
297   - }
298   -
299   - return {
300   - init: init
301   - };
302   - })();
303   -
304   - /**
305   - * 搜索表单相关
306   - */
307   - var searchForm = (function () {
308   -
309   - var f = $('.playBackForm', modal);
310   -
311   - var init = function (data) {
312   - //设置初始值
313   - /*if (data.nbbm)
314   - $('[name=nbbm]', f).val(data.nbbm);
315   - var st = moment().subtract(2, 'hour');
316   - if (data.st)
317   - st = moment(data.st, 'YYYY-MM-DD HH:mm');
318   - $('[name=sDate]', f).val(st.format('YYYY-MM-DD'));
319   - $('[name=sTime]', f).val(st.format('HH:mm'));
320   - var et = moment();
321   - if (data.et)
322   - et = moment(data.et, 'YYYY-MM-DD HH:mm');
323   - $('[name=eDate]', f).val(et.format('YYYY-MM-DD'));
324   - $('[name=eTime]', f).val(et.format('HH:mm'));*/
325   -
326   -
327   - $('[name=nbbm]', f).val('W0A-018');
328   - $('[name=sDate]', f).val('2017-04-06');
329   - $('[name=sTime]', f).val('04:49');
330   -
331   - $('[name=eDate]', f).val('2017-04-06');
332   - $('[name=eTime]', f).val('09:49');
333   - //搜索事件
334   - $('button[type=submit]', f).on('click', search);
335   - };
336   -
337   - var setNbbm = function (v) {
338   - $('[name=nbbm]', f).val(v);
339   - };
340   -
341   - var ONE_DAY = 60 * 60 * 24;
342   - var MIN_SPACE = 60;
343   - var search = function (e) {
344   - e.stopPropagation();
345   - var data = f.serializeJSON();
346   -
347   - //校验时间间隔
348   - var fs = 'YYYY-MM-DDHH:mm';
349   - var st = parseInt(moment(data.sDate + data.sTime, fs).format('X'));
350   - var et = parseInt(moment(data.eDate + data.eTime, fs).format('X'));
351   -
352   - if (et < st)
353   - notify_err('结束时间不能小于开始时间');
354   - else if ((et - st) > ONE_DAY)
355   - notify_err('最大间隔24小时!');
356   - else if ((et - st) < MIN_SPACE)
357   - notify_err('最小间隔1分钟!');
358   - else {
359   - $.ajax({
360   - url: '/gps/history_v2/' + data.nbbm,
361   - traditional: true,
362   - data: {st: st, et: et},
363   - success: function (rs) {
364   - gpsArray = rs.list;
365   - if (!rs || rs.length == 0) {
366   - notify_err('没有搜索到轨迹数据!');
367   - return;
368   - }
369   -
370   - //排序
371   - gpsArray.sort(function (a, b) {
372   - return parseInt((a.ts - b.ts) + '' + (a.stop_no - b.stop_no));
373   - });
374   - //行车轨迹
375   - trailTableObj.showInitData(gpsArray);
376   - //到离站信息
377   - inOutStationTableObj.showInitData(gpsArray);
378   - //异常信息
379   - abnormalTableObj.showInitData(rs['outboundList'], rs['speedList']);
380   - //show 工具条
381   - mapTools.show();
382   - }
383   - });
384   - }
385   - return false;
386   - };
387   - return {
388   - init: init,
389   - setNbbm: setNbbm
390   - };
391   - })();
392   -
393   - /**
394   - * 行车轨迹表格
395   - */
396   - var trailTableObj = (function () {
397   -
398   - var showInitData = function (list) {
399   - var array = [];
400   - for (var i = 0, gps; gps = list[i++];) {
401   - //格式化时间
402   - gps.timeStr = moment(gps.timestamp).format('HH:mm.ss');
403   - try {
404   - if (i > 0 && array[array.length - 1].road.road_CODE == gps.road.road_CODE)
405   - array.pop();
406   - }
407   - catch (e) {
408   - }
409   -
410   - if (gps.road)
411   - array.push(gps);
412   - }
413   -
414   - var htmlStr = template('gps_road_info_cont_temp', {array: array});
415   - $('.gps-road-info .ct_table_body', modal).html(htmlStr);
416   - };
417   -
418   - return {
419   - showInitData: showInitData
420   - };
421   - })();
422   -
423   - /**
424   - * 到离站信息表格
425   - * @type {{}}
426   - */
427   - var inOutStationTableObj = (function () {
428   -
429   - var data, f, prev;
430   - var showInitData = function (list) {
431   - clear();
432   - data = [];
433   -
434   - $.each(list, function (i, gps) {
435   -
436   - prev = data[data.length - 1];
437   - if (gps['inout_stop'] == -1)
438   - return true;
439   -
440   - if (gps['inout_stop'] == 0) {
441   - //连续进站信号,取第一个
442   - if(prev && prev['out_ts'] == null
443   - && prev['stopName'] == gps['inout_stop_info'].stopName){
444   - return true;
445   - }
446   - data.push(createIn(gps));
447   - }
448   - else if (gps['inout_stop'] == 1) {
449   - f = matchOut(prev, gps);
450   - if(f)
451   - data.push(f);
452   - }
453   - });
454   -
455   - //格式化时间
456   - $.each(data, function () {
457   - if (this.in_ts)
458   - this.in_time_str = moment(this.in_ts).format('HH:mm.ss');
459   - if (this.out_ts)
460   - this.out_time_str = moment(this.out_ts).format('HH:mm.ss');
461   - });
462   -
463   - var htmlStr = template('multi_inout_info_cont_temp', {list: data});
464   - $('.inout_table_wrap .ct_table_body', modal).html(htmlStr);
465   - };
466   -
467   - var add = function (gps) {
468   -
469   - };
470   -
471   - var clear = function () {
472   -
473   - };
474   -
475   - var createIn = function (gps) {
476   - var info = gps['inout_stop_info'];
477   - return {
478   - in_ts: info.ts,
479   - stopNo: info.stopNo,
480   - stopName: info.stopName
481   - }
482   - };
483   -
484   -
485   - var matchOut = function (prevInfo, gps) {
486   - var oi = gps['inout_stop_info'];
487   - if(prevInfo && prevInfo.stopName == oi.stopName){
488   - prevInfo['out_ts'] = oi.ts;
489   - return null;
490   - }
491   - else {
492   - return {
493   - out_ts: oi.ts,
494   - stopNo: oi.stopNo,
495   - stopName: oi.stopName
496   - }
497   - }
498   - };
499   -
500   - return {
501   - showInitData: showInitData
502   - };
503   - })();
504   -
505   - /**
506   - * 异常信息表格
507   - * @type {{showInitData}}
508   - */
509   - var abnormalTableObj = (function () {
510   -
511   - var showInitData = function () {
512   - var array = [];
513   - for(var i = 0; i < arguments.length; i ++){
514   - array = array.concat(arguments[i]);
515   - }
516   - //格式化时间
517   - $.each(array, function () {
518   - if(this.st)
519   - this.st_str = moment(this.st).format('HH:mm.ss');
520   - if(this.et)
521   - this.et_str = moment(this.et).format('HH:mm.ss');
522   - });
523   -
524   - var htmlStr = template('abnormal_table_cont_temp', {array: array});
525   - $('.abnormal_table .ct_table_body', modal).html(htmlStr);
526   - };
527   -
528   - return {
529   - showInitData: showInitData
530   - }
531   - })();
532   -
533   - /**
534   - * 工具条相关
535   - */
536   - var mapTools = (function () {
537   -
538   - $('.map-wrap-tools .play_btn', modal).on('click', function () {
539   - if($(this).hasClass('play')){
540   - //暂停
541   - $(this).removeClass('play');
542   - }
543   - else {
544   - //播放
545   - $(this).addClass('play');
546   - }
547   - });
548   -
549   - var show = function () {
550   - $('.map-wrap-tools').show();
551   - };
552   -
553   - return {
554   - show: show
555   - }
556   - })();
557   - })();
558   - </script>
  1 +<div class="uk-modal" id="map-playback2-modal">
  2 + <div class="uk-modal-dialog uk-modal-dialog-blank">
  3 + <button class="uk-modal-close uk-close" type="button"></button>
  4 + <div class="uk-grid uk-flex-middle" data-uk-grid-margin>
  5 + <div class="uk-width-medium-1-10 uk-height-viewport z-depth-viewport">
  6 + <h5 style="color: #868484;text-indent: 5px;">
  7 + 线路配车
  8 + </h5>
  9 + <div class="uk-accordion cc_info_accordion" data-uk-accordion data-uk-observe>
  10 + </div>
  11 +
  12 + </div>
  13 + <div class="uk-width-medium-2-10 uk-height-viewport z-depth-viewport " style="position: relative;">
  14 + <div class="play_back_form_shade uk-animation-scale"></div>
  15 + <form class="uk-form uk-form-horizontal playBackForm">
  16 + <div class="uk-grid">
  17 + <div class="uk-width-1-1">
  18 + <div class="uk-form-row">
  19 + <label class="uk-form-label">车辆编码</label>
  20 + <div class="uk-form-controls">
  21 + <div class="uk-autocomplete uk-form autocomplete-nbbm">
  22 + <div class="uk-autocomplete uk-form autocomplete-nbbm">
  23 + <input name="nbbm" required/>
  24 + </div>
  25 + </div>
  26 + </div>
  27 + </div>
  28 + </div>
  29 + </div>
  30 + <div class="uk-grid">
  31 + <div class="uk-width-2-3">
  32 + <div class="uk-form-row">
  33 + <label class="uk-form-label">开始时间</label>
  34 + <div class="uk-form-controls">
  35 + <input name="sDate" type="date" required/>
  36 + </div>
  37 + </div>
  38 + </div>
  39 + <div class="uk-width-1-3" style="padding-left: 15px;">
  40 + <div class="uk-form-row">
  41 + <div class="uk-form-controls" style="margin-left: 0;">
  42 + <input name="sTime" type="time" required/>
  43 + </div>
  44 + </div>
  45 + </div>
  46 + </div>
  47 + <div class="uk-grid">
  48 + <div class="uk-width-2-3">
  49 + <div class="uk-form-row">
  50 + <label class="uk-form-label">结束时间</label>
  51 + <div class="uk-form-controls">
  52 + <input name="eDate" type="date" required/>
  53 + </div>
  54 + </div>
  55 + </div>
  56 + <div class="uk-width-1-3" style="padding-left: 15px;">
  57 + <div class="uk-form-row">
  58 + <div class="uk-form-controls" style="margin-left: 0;">
  59 + <input name="eTime" type="time" required/>
  60 + </div>
  61 + </div>
  62 + </div>
  63 + </div>
  64 + <div class="uk-grid">
  65 + <button class="uk-button uk-button-large uk-button-primary playBackButton" type="submit"><i
  66 + class="uk-icon-search"> </i> 搜索轨迹
  67 + </button>
  68 + </div>
  69 + </form>
  70 + <!-- 异常警报 -->
  71 + <div class="abnormal_table_wrap">
  72 + <div class="abnormal_table_panel"
  73 + style="height: calc(100% - 15px);margin-top: 15px;overflow: auto;">
  74 + <div class="ct_table abnormal_table" style="height: calc(100% - 30px);">
  75 + <div class="ct_table_head">
  76 + <dl>
  77 + <dt>异常状态</dt>
  78 + <dt>开始时间</dt>
  79 + <dt>结束时间</dt>
  80 + <dt>图像</dt>
  81 + </dl>
  82 + </div>
  83 + <div class="ct_table_body">
  84 + </div>
  85 + </div>
  86 + </div>
  87 + </div>
  88 + <!-- 路段 和 到离站信息 -->
  89 + <div class="uk-margin uk-grid other_info_table_wrap" data-uk-grid-margin>
  90 + <div class="uk-width-medium-1-1" style="padding-left: 0;">
  91 +
  92 + <ul class="uk-tab" data-uk-tab="{connect:'#real_gps_info_tab_content'}"
  93 + style="padding-left: 12px;">
  94 + <li class="uk-active"><a>行车轨迹</a></li>
  95 + <li><a>到离站信息</a></li>
  96 + </ul>
  97 +
  98 + <ul id="real_gps_info_tab_content" class="uk-switcher uk-margin"
  99 + style="height: calc(100% - 44px);margin-top: 7px;">
  100 + <li class="uk-active" style="height: 100%;">
  101 + <div class="road_table_wrap" style="height: 100%;overflow: auto;">
  102 + <div class="ct_table gps-road-info"
  103 + style="height: calc(100% - 30px);">
  104 + <div class="ct_table_head">
  105 + <dl>
  106 + <dt>时间</dt>
  107 + <dt>速度</dt>
  108 + <dt>所在路段</dt>
  109 + </dl>
  110 + </div>
  111 + <div class="ct_table_body">
  112 + </div>
  113 + </div>
  114 + </div>
  115 + </li>
  116 + <!-- 到离站数据 -->
  117 + <li style="height: 100%;">
  118 + <div class="inout_table_wrap" style="height: 100%;overflow: auto;">
  119 + <div class="ct_table" style="height: calc(100% - 30px);">
  120 + <div class="ct_table_head">
  121 + <dl>
  122 + <dt>站点</dt>
  123 + <dt>到站时间</dt>
  124 + <dt>离站时间</dt>
  125 + <dt>上客</dt>
  126 + <dt>下客</dt>
  127 + </dl>
  128 + </div>
  129 + <div class="ct_table_body">
  130 + </div>
  131 + </div>
  132 + </div>
  133 + </li>
  134 + </ul>
  135 +
  136 + </div>
  137 + </div>
  138 + </div>
  139 + <div class="uk-width-medium-7-10 uk-height-viewport map-wrap" style="padding-left: 0;position: relative;">
  140 + <div class="map-wrap-tools uk-animation-slide-top">
  141 + <div class="btns">
  142 + <span class="ct_btn play_btn"></span>
  143 + <span class="ct_btn clock"></span>
  144 + <div class="multi-items">
  145 + <form class="uk-form speed_form">
  146 + <label>
  147 + <input type="radio" name="playSpeed" value="1"> x1
  148 + </label>
  149 + <label>
  150 + <input type="radio" name="playSpeed" value="5"> x5
  151 + </label>
  152 + <label>
  153 + <input type="radio" name="playSpeed" value="10"> x10
  154 + </label>
  155 + <label>
  156 + <input type="radio" name="playSpeed" value="20"> x20
  157 + </label>
  158 + </form>
  159 + </div>
  160 + <div class="multi-items">
  161 + <form class="uk-form buffer_area_form">
  162 + <label>
  163 + <input type="checkbox" name="drawPoint"> 站点
  164 + </label>
  165 + <label>
  166 + <input type="checkbox" name="drawBuffArea"> 缓冲区
  167 + </label>
  168 + <label>
  169 + <input type="checkbox" name="stationName"> 站点名称
  170 + </label>
  171 + <label>
  172 + <a>停车场 <i class="uk-icon-angle-down"></i></a>
  173 + </label>
  174 + </form>
  175 + </div>
  176 + <span class="ct_btn text-panel">
  177 + <span>共约 <span class="sum_mileage"></span> 公里,<span class="count_point"></span> 个GPS点</span><br>
  178 + <a class="export-excel"><i class="uk-icon-file-excel-o"></i> 导出轨迹</a>
  179 + </span>
  180 + </div>
  181 + <div class="ct-progress-bar" >
  182 + <div class="scale"></div>
  183 + </div>
  184 + </div>
  185 + <div class="map-container"></div>
  186 + </div>
  187 + </div>
  188 + </div>
  189 +
  190 + <script id="cc_info_accordion_cont_temp" type="text/html">
  191 + {{each ccInfo as cc i}}
  192 + <h3 class="uk-accordion-title">{{cc.name}}</h3>
  193 + <div class="uk-accordion-content">
  194 + <ul class="uk-list">
  195 + {{each cc.cars as c j}}
  196 + <li>{{c}}</li>
  197 + {{/each}}
  198 + </ul>
  199 + </div>
  200 + {{/each}}
  201 + </script>
  202 +
  203 + <script id="gps_road_info_cont_temp" type="text/html">
  204 + {{each array as gps i}}
  205 + <dl data-code="{{gps.road.road_CODE}}">
  206 + <dd>{{gps.timeStr}}</dd>
  207 + <dd>{{gps.speed}}</dd>
  208 + <dd>{{gps.road.road_NAME}}</dd>
  209 + </dl>
  210 + {{/each}}
  211 + </script>
  212 +
  213 + <script id="multi_inout_info_cont_temp" type="text/html">
  214 + {{each list as item i}}
  215 + <dl data-id="{{item.id}}">
  216 + <dd>{{item.stopName}}</dd>
  217 + <dd>{{item.in_time_str}}</dd>
  218 + <dd>{{item.out_time_str}}</dd>
  219 + <dd></dd>
  220 + <dd></dd>
  221 + </dl>
  222 + {{/each}}
  223 + </script>
  224 +
  225 + <script id="inout_info_cont_temp" type="text/html">
  226 + <dl data-id="{{id}}">
  227 + <dd>{{stopName}}</dd>
  228 + <dd>{{in_time_str}}</dd>
  229 + <dd></dd>
  230 + <dd></dd>
  231 + <dd></dd>
  232 + </dl>
  233 + </script>
  234 +
  235 +
  236 + <script id="abnormal_table_cont_temp" type="text/html">
  237 + {{each array as item i}}
  238 + <dl>
  239 + <dd>
  240 + {{if item.abnormalType == 'speed'}}
  241 + 超速({{item.speed}})
  242 + {{else if item.abnormalType == 'outbound'}}
  243 + 越界
  244 + {{/if}}
  245 + </dd>
  246 + <dd>{{item.st_str}}</dd>
  247 + <dd>{{item.et_str}}</dd>
  248 + <dd></dd>
  249 + </dl>
  250 + {{/each}}
  251 + </script>
  252 + <script>
  253 + (function () {
  254 + var modal = '#map-playback2-modal', gpsArray;
  255 +
  256 + $(modal).on('init', function (e, data) {
  257 + //初始化地图
  258 + mapObj.initMap();
  259 +
  260 + //固定表头
  261 + gb_ct_table.fixedHead($('.road_table_wrap', modal));
  262 + gb_ct_table.fixedHead($('.inout_table_wrap', modal));
  263 + gb_ct_table.fixedHead($('.abnormal_table_panel', modal));
  264 + //线路配车
  265 + ccInfo.init();
  266 +
  267 + //表单初始值
  268 + searchForm.init(data);
  269 +
  270 + //车辆 autocomplete
  271 + $.get('/basic/cars', function (rs) {
  272 + gb_common.carAutocomplete($('.autocomplete-nbbm', modal), rs);
  273 + });
  274 + });
  275 +
  276 + /**
  277 + * 线路配车相关
  278 + */
  279 + var ccInfo = (function () {
  280 +
  281 + function init() {
  282 + $.get('/basic/ccInfo', function (rs) {
  283 + var ccInfo = [], lines = gb_data_basic.codeToLine;
  284 + for (var code in lines) {
  285 + ccInfo.push({
  286 + name: lines[code].name,
  287 + cars: carSort(rs[code])
  288 + });
  289 + }
  290 +
  291 + var htmlStr = template('cc_info_accordion_cont_temp', {ccInfo: ccInfo});
  292 + $('.cc_info_accordion', modal).html(htmlStr)
  293 + .find('.uk-list li').on('click', itemClick);
  294 + });
  295 + }
  296 +
  297 + function carSort(list) {
  298 + if (!list)
  299 + return [];
  300 + return list.sort();
  301 + }
  302 +
  303 + function itemClick() {
  304 + $(this).parent().find('li.active').removeClass('active');
  305 + $(this).addClass('active');
  306 + searchForm.setNbbm($(this).text());
  307 + }
  308 +
  309 + return {
  310 + init: init
  311 + };
  312 + })();
  313 +
  314 + /**
  315 + * 搜索表单相关
  316 + */
  317 + var searchForm = (function () {
  318 +
  319 + var f = $('.playBackForm', modal);
  320 +
  321 + var init = function (data) {
  322 + //设置初始值
  323 + /*if (data.nbbm)
  324 + $('[name=nbbm]', f).val(data.nbbm);
  325 + var st = moment().subtract(2, 'hour');
  326 + if (data.st)
  327 + st = moment(data.st, 'YYYY-MM-DD HH:mm');
  328 + $('[name=sDate]', f).val(st.format('YYYY-MM-DD'));
  329 + $('[name=sTime]', f).val(st.format('HH:mm'));
  330 + var et = moment();
  331 + if (data.et)
  332 + et = moment(data.et, 'YYYY-MM-DD HH:mm');
  333 + $('[name=eDate]', f).val(et.format('YYYY-MM-DD'));
  334 + $('[name=eTime]', f).val(et.format('HH:mm'));*/
  335 +
  336 +
  337 + $('[name=nbbm]', f).val('W0A-018');
  338 + $('[name=sDate]', f).val('2017-04-06');
  339 + $('[name=sTime]', f).val('04:49');
  340 +
  341 + $('[name=eDate]', f).val('2017-04-06');
  342 + $('[name=eTime]', f).val('09:49');
  343 + //搜索事件
  344 + $('button[type=submit]', f).on('click', search);
  345 + };
  346 +
  347 + var setNbbm = function (v) {
  348 + $('[name=nbbm]', f).val(v);
  349 + };
  350 +
  351 + var ONE_DAY = 60 * 60 * 24;
  352 + var MIN_SPACE = 60;
  353 + var search = function (e) {
  354 + e.stopPropagation();
  355 + var data = f.serializeJSON();
  356 +
  357 + //校验时间间隔
  358 + var fs = 'YYYY-MM-DDHH:mm';
  359 + var st = parseInt(moment(data.sDate + data.sTime, fs).format('X'));
  360 + var et = parseInt(moment(data.eDate + data.eTime, fs).format('X'));
  361 +
  362 + if (et < st)
  363 + notify_err('结束时间不能小于开始时间');
  364 + else if ((et - st) > ONE_DAY)
  365 + notify_err('最大间隔24小时!');
  366 + else if ((et - st) < MIN_SPACE)
  367 + notify_err('最小间隔1分钟!');
  368 + else {
  369 + show_wait_modal('搜索数据...');
  370 + $.ajax({
  371 + url: '/gps/history_v2/' + data.nbbm,
  372 + traditional: true,
  373 + data: {st: st, et: et},
  374 + success: function (rs) {
  375 + hide_wait_modal();
  376 + //重置相关对象
  377 + playObj.reset();
  378 + mapObj.reset();
  379 +
  380 + gpsArray = rs.list;
  381 + if (!gpsArray || gpsArray.length == 0) {
  382 + notify_err('没有搜索到轨迹数据!');
  383 + return;
  384 + }
  385 +
  386 + //排序
  387 + gpsArray.sort(function (a, b) {
  388 + return parseInt((a.ts - b.ts) + '' + (a.stop_no - b.stop_no));
  389 + });
  390 + //行车轨迹
  391 + trailTableObj.showInitData(gpsArray);
  392 + //到离站信息
  393 + inOutStationTableObj.showInitData(gpsArray);
  394 + //异常信息
  395 + abnormalTableObj.showInitData(rs['outboundList'], rs['speedList']);
  396 + //show 工具条
  397 + mapTools.show(rs);
  398 + //地图
  399 + mapObj.initData(rs);
  400 + //play 对象
  401 + playObj.init(rs);
  402 + //设置导出文件名称
  403 + mapTools.setExcelName();
  404 + }
  405 + });
  406 + }
  407 + return false;
  408 + };
  409 +
  410 + //遮罩
  411 + var shade = $('.play_back_form_shade', modal);
  412 + var showShade = function () {
  413 + shade.show();
  414 + };
  415 + var hideShade = function () {
  416 + shade.hide();
  417 + };
  418 +
  419 + return {
  420 + init: init,
  421 + setNbbm: setNbbm,
  422 + showShade: showShade,
  423 + hideShade: hideShade
  424 + };
  425 + })();
  426 +
  427 + /**
  428 + * 行车轨迹表格
  429 + */
  430 + var trailTableObj = (function () {
  431 +
  432 + var $tbody = $('.gps-road-info .ct_table_body', modal);
  433 + var $wrap = $('.road_table_wrap', modal);
  434 + var initFlag, gpsArray;
  435 + var showInitData = function (list) {
  436 + var array = [];
  437 + for (var i = 0, gps; gps = list[i++];) {
  438 + //格式化时间
  439 + gps.timeStr = moment(gps.timestamp).format('HH:mm.ss');
  440 + try {
  441 + if (i > 0 && array[array.length - 1].road.road_CODE == gps.road.road_CODE)
  442 + array.pop();
  443 + }
  444 + catch (e) {
  445 + }
  446 +
  447 + if (gps.road)
  448 + array.push(gps);
  449 + }
  450 +
  451 + var htmlStr = template('gps_road_info_cont_temp', {array: array});
  452 + $tbody.html(htmlStr);
  453 + initFlag = true;
  454 + gpsArray = list;
  455 + };
  456 +
  457 + var prev;
  458 + var add = function (gps, i) {
  459 + if(i == 0)
  460 + return;
  461 + if(initFlag){
  462 + //清理初始化的数据
  463 + $tbody.html('');
  464 + initFlag = false;
  465 + }
  466 + if (!gps.road)
  467 + return;
  468 + var code = gps.road.road_CODE;
  469 + if (!prev || code != prev.road.road_CODE) {
  470 + $tbody.append(template('gps_road_info_cont_temp', {array: [gps]}));
  471 + }
  472 + else{
  473 + var dds = $tbody.find('dl[data-code=' + code + ']').last().find('dd');
  474 + $(dds[0]).text(gps.timeStr);
  475 + $(dds[1]).text(gps.speed);
  476 + }
  477 + prev = gps;
  478 + $wrap.scrollTop($wrap[0].scrollHeight);
  479 + };
  480 +
  481 + return {
  482 + showInitData: showInitData,
  483 + add : add,
  484 + gpsArray : function () {
  485 + return gpsArray;
  486 + }
  487 + };
  488 + })();
  489 +
  490 + /**
  491 + * 到离站信息表格
  492 + * @type {{}}
  493 + */
  494 + var inOutStationTableObj = (function () {
  495 +
  496 + var data, f, prev, initFlag;
  497 + var $wrap = $('.inout_table_wrap', modal);
  498 + var $tbody = $('.ct_table_body', $wrap);
  499 + var showInitData = function (list) {
  500 + clear();
  501 + data = [];
  502 + $.each(list, function (i, gps) {
  503 + prev = data[data.length - 1];
  504 + if (gps['inout_stop'] == -1)
  505 + return true;
  506 + if (gps['inout_stop'] == 0 && gps['inout_stop_info']) {
  507 + //连续进站信号,取第一个
  508 + if(prev && prev['out_ts'] == null
  509 + && prev['stopName'] == gps['inout_stop_info'].stopName){
  510 + return true;
  511 + }
  512 + data.push(createIn(gps));
  513 + }
  514 + else if (gps['inout_stop'] == 1) {
  515 + f = matchOut(prev, gps);
  516 + if(f)
  517 + data.push(f);
  518 + }
  519 + });
  520 + //格式化时间
  521 + $.each(data, function (i) {
  522 + if (this.in_ts)
  523 + this.in_time_str = moment(this.in_ts).format('HH:mm.ss');
  524 + if (this.out_ts)
  525 + this.out_time_str = moment(this.out_ts).format('HH:mm.ss');
  526 + //id
  527 + this.id = 'in_out_' + i;
  528 + });
  529 + var htmlStr = template('multi_inout_info_cont_temp', {list: data});
  530 + $tbody.html(htmlStr);
  531 + initFlag = true;
  532 + len = data.length;
  533 + };
  534 +
  535 + var inoutIndex=0, len, item;
  536 + var add = function (gps, i) {
  537 + if(i == 0)
  538 + return;
  539 + if(initFlag)
  540 + clear();
  541 +
  542 + var $dl;
  543 + for(j = inoutIndex; j < len; j++){
  544 + item = data[j];
  545 + $dl = $tbody.find('dl[data-id='+item.id+']');
  546 + if(gps.ts >= item.in_ts && $dl.length==0){
  547 + $tbody.append(template('inout_info_cont_temp', item));
  548 + inoutIndex = j;
  549 + }
  550 +
  551 + if(gps.ts >= item.out_ts){
  552 + var dds = $dl.find('dd');
  553 + if($dl.length==0)
  554 + $tbody.append(template('inout_info_cont_temp', item));
  555 + else
  556 + $(dds[2]).text(item.out_time_str);
  557 + inoutIndex = j;
  558 + }
  559 + else {
  560 + break;
  561 + }
  562 + }
  563 + $wrap.scrollTop($wrap[0].scrollHeight);
  564 + };
  565 +
  566 + var clear = function () {
  567 + $tbody.html('');
  568 + initFlag = false;
  569 + };
  570 +
  571 + var createIn = function (gps) {
  572 + var info = gps['inout_stop_info'];
  573 + return {in_ts: info.ts, stopNo: info.stopNo, stopName: info.stopName}
  574 + };
  575 +
  576 + var matchOut = function (prevInfo, gps) {
  577 + var oi = gps['inout_stop_info'];
  578 + if(prevInfo && prevInfo.stopName == oi.stopName){
  579 + prevInfo['out_ts'] = oi.ts;
  580 + return null;
  581 + }
  582 + else {
  583 + return {out_ts: oi.ts,stopNo: oi.stopNo,stopName: oi.stopName}
  584 + }
  585 + };
  586 +
  587 + return {
  588 + showInitData: showInitData,
  589 + add: add
  590 + };
  591 + })();
  592 +
  593 + /**
  594 + * 异常信息表格
  595 + * @type {{showInitData}}
  596 + */
  597 + var abnormalTableObj = (function () {
  598 +
  599 + var showInitData = function () {
  600 + var array = [];
  601 + for(var i = 0; i < arguments.length; i ++){
  602 + array = array.concat(arguments[i]);
  603 + }
  604 + //格式化时间
  605 + $.each(array, function () {
  606 + if(this.st)
  607 + this.st_str = moment(this.st).format('HH:mm.ss');
  608 + if(this.et)
  609 + this.et_str = moment(this.et).format('HH:mm.ss');
  610 + });
  611 +
  612 + //排序
  613 + array.sort(function (a, b) {
  614 + return a.st - b.st;
  615 + });
  616 +
  617 + var htmlStr = template('abnormal_table_cont_temp', {array: array});
  618 + $('.abnormal_table .ct_table_body', modal).html(htmlStr);
  619 + };
  620 +
  621 + return {
  622 + showInitData: showInitData
  623 + }
  624 + })();
  625 +
  626 + /**
  627 + * 工具条相关
  628 + */
  629 + var mapTools = (function () {
  630 +
  631 + $('.map-wrap-tools .play_btn', modal).on('click', function () {
  632 + if($(this).hasClass('play')){
  633 + //暂停
  634 + $(this).removeClass('play');
  635 + playObj.pause();
  636 + searchForm.hideShade();
  637 + }
  638 + else {
  639 + //播放
  640 + $(this).addClass('play');
  641 + playObj.play();
  642 + playObj.fixedToCenter();
  643 + searchForm.showShade();
  644 + }
  645 + });
  646 +
  647 + //播放速度
  648 + $('.speed_form input[name=playSpeed]', modal).on('click', function () {
  649 + playObj.setConf('playSpeed', $(this).val());
  650 + });
  651 +
  652 + //空间数据
  653 + $('.buffer_area_form input[type=checkbox]', modal).on('click', function () {
  654 + playObj.setConf($(this).attr('name'), $(this)[0].checked);
  655 + mapObj.refreshOverlay();
  656 + });
  657 +
  658 + //进度条
  659 + var step, $scale = $('.ct-progress-bar .scale', modal);
  660 + var upProgressBar = function (i) {
  661 + $scale.css('width', step * (i + 1));
  662 + };
  663 +
  664 + //导出
  665 + $('.export-excel', modal).on('click', function () {
  666 + var base64Str = gb_map_play_back.listToExcel(trailTableObj.gpsArray());
  667 + $(this).attr('href', base64Str);
  668 + });
  669 +
  670 + var setExcelName = function () {
  671 + var f = $('.playBackForm', modal);
  672 + var fileName = ($('[name=nbbm]', f).val() + '轨迹数据' + $('[name=sDate]', f).val() + $('[name=sTime]', f).val() + '至' + $('[name=eDate]', f).val() + $('[name=eTime]', f).val() + '.xls').replace(new RegExp(/-/g),'').replace(new RegExp(/:/g),'');
  673 + $('.export-excel', modal).attr('download', fileName);
  674 + };
  675 +
  676 + var gpsArray;
  677 + var show = function (rs) {
  678 + $('.map-wrap-tools').show();
  679 + $('.map-container', modal).addClass('show_tools');
  680 + //总里程
  681 + $('.text-panel .sum_mileage', modal).text(rs.sumMileage);
  682 +
  683 + var size = rs.list.length;
  684 + $('.text-panel .count_point', modal).text(size);
  685 + step = $('.ct-progress-bar', modal).width() / size;
  686 +
  687 + //console.log('stepstep', step);
  688 + };
  689 +
  690 + return {
  691 + show: show,
  692 + upProgressBar: upProgressBar,
  693 + setExcelName: setExcelName
  694 + }
  695 + })();
  696 +
  697 + /**
  698 + * 地图相关
  699 + */
  700 + var mapObj = (function () {
  701 + var map;
  702 + var initMap = function () {
  703 + //初始化地图
  704 + map = new BMap.Map($('.map-container', modal)[0]);
  705 + //中心点和缩放级别
  706 + map.centerAndZoom(new BMap.Point(gb_map_consts.center_point.lng, gb_map_consts.center_point.lat), 16);
  707 + map.enableScrollWheelZoom();
  708 + }
  709 +
  710 + var storage = window.localStorage;
  711 + var routes;//路段
  712 + var stations;//站点
  713 + var parks;//停车场
  714 +
  715 + var initData = function (rs) {
  716 + var gpsArray = rs.list;
  717 + if(!gpsArray || gpsArray.length==0)
  718 + return;
  719 + var lineCode = gpsArray[0].lineId;
  720 + //从地图模块获取站点数据
  721 + stations = gb_map_spatial_data.getStationArray(lineCode);
  722 + //从地图模块获取停车场数据
  723 + parks = gb_map_spatial_data.carparkArray();
  724 + //从localStorage 获取路段
  725 + routes = JSON.parse(storage.getItem(lineCode + '_route'));
  726 + routes = [routes.up_bd, routes.down_bd];
  727 + };
  728 +
  729 +
  730 + /**
  731 + * 更新车辆位置
  732 + */
  733 + var gpsMarker;
  734 + var updateCar = function (gps) {
  735 + if(!gpsMarker){
  736 + gpsMarker = new BMap.Marker(new BMap.Point(gps.bd_lon, gps.bd_lat));
  737 + var width = gb_map_imap.calcGpsMarkerWidth(gps.nbbm);
  738 + gpsMarker.setIcon(new BMap.Icon(gb_map_imap.createCarIconRotation(gps, width), new BMap.Size(width, 75)));
  739 + gpsMarker.disableMassClear();//禁止marker被清除
  740 + gpsMarker.setTop(true);
  741 + map.addOverlay(gpsMarker);
  742 + //居中
  743 + map.panTo(gpsMarker.getPosition());
  744 + }
  745 + else{
  746 + gpsMarker.setPosition(new BMap.Point(gps.bd_lon, gps.bd_lat));
  747 + var width = gb_map_imap.calcGpsMarkerWidth(gps.nbbm);
  748 + gpsMarker.setIcon(new BMap.Icon(gb_map_imap.createCarIconRotation(gps, width), new BMap.Size(width, 75)));
  749 + }
  750 +
  751 + //更新路段底图
  752 + if(gps.upDown!=roadUpdown){
  753 + switchPolyline(gps.upDown);
  754 + //清除轨迹线
  755 + trailArray = [];
  756 + }
  757 + };
  758 +
  759 + /**
  760 + * 绘制轨迹线
  761 + */
  762 + var trailArray=[], trailPolyline;
  763 + var updateTrailLine = function () {
  764 + trailArray.push(gpsMarker.getPosition());
  765 + if(!trailPolyline){
  766 + trailPolyline = new BMap.Polyline(trailArray, {strokeWeight: 3, strokeColor: '#000000'});
  767 + trailPolyline.disableMassClear();//禁止trailPolyline被清除
  768 + map.addOverlay(trailPolyline);
  769 + }
  770 + else{
  771 + trailPolyline.setPath(trailArray);
  772 + }
  773 + };
  774 +
  775 + /**
  776 + * 绘制路段底图(包括站点)
  777 + */
  778 + var roadUpdown=-1;
  779 + var switchPolyline = function (upDown) {
  780 + if(typeof(upDown) == "undefined")
  781 + upDown = roadUpdown;
  782 +
  783 + map.clearOverlays();
  784 + //路段
  785 + drawRoadPolyline(upDown);
  786 + //站点
  787 + if(playObj.getConf().drawPoint)
  788 + drawStationPoint(upDown);
  789 + //缓冲区
  790 + if(playObj.getConf().drawBuffArea)
  791 + drawStationBfArea(upDown);
  792 + //站点名称
  793 + if(playObj.getConf().stationName)
  794 + drawStationName(upDown);
  795 + roadUpdown = upDown;
  796 + };
  797 +
  798 + /**
  799 + * 根据走向绘制路段
  800 + */
  801 + var drawRoadPolyline = function (upDown) {
  802 + var colour = gb_map_config.getConfig().section.color;
  803 + var plConfig = {strokeWeight: 12, strokeColor: upDown?colour.down:colour.up, strokeOpacity: .4}, pos;
  804 + $.each(routes[upDown], function (i, item) {
  805 + pos = [];
  806 + $.each(item.split(','), function () {
  807 + temps = this.split(' ');
  808 + pos.push(new BMap.Point(temps[0], temps[1]));
  809 + });
  810 + map.addOverlay(new BMap.Polyline(pos, plConfig));
  811 + });
  812 + };
  813 +
  814 + /**
  815 + * 根据走向绘制站点点位
  816 + */
  817 + var drawStationPoint = function (upDown) {
  818 + var array = stations[upDown], psm;
  819 + $.each(array, function () {
  820 + //坐标转换
  821 + var coord = TransGPS.wgsToBD(this.lat, this.lon);
  822 + this.bd_lat = coord.lat;
  823 + this.bd_lon = coord.lng;
  824 + psm = new BMap.Marker(new BMap.Point(this.bd_lon, this.bd_lat));
  825 + psm.setTitle(this.stationName);
  826 + map.addOverlay(psm);
  827 + psm.setIcon(new BMap.Icon(gb_map_imap.createStationPointIcon(), new BMap.Size(12, 12)));
  828 + });
  829 + };
  830 +
  831 + /**
  832 + * 为站点绘制缓冲区
  833 + */
  834 + var drawStationBfArea = function (upDown) {
  835 + var array = stations[upDown];
  836 + $.each(array, function () {
  837 + if(this.shapesType=='r')
  838 + drawCircle(new BMap.Point(this.bd_lon, this.bd_lat), this.radius);
  839 + else if(this.shapesType=='d')
  840 + drawPolygon(this);
  841 + });
  842 + };
  843 +
  844 + /**
  845 + * 绘制站点名称
  846 + */
  847 + var drawStationName = function (upDown) {
  848 + var style = {backgroundColor: "rgba(255, 255, 255, 0.69)",color : "black", borderColor: "black", fontSize : "12px", height : "16px", lineHeight : "16px", fontFamily:"微软雅黑"}
  849 + var array = stations[upDown];
  850 + $.each(array, function () {
  851 + var width = this.stationName.length * 12;
  852 + var label = new BMap.Label(this.stationName, {
  853 + position:new BMap.Point(this.bd_lon, this.bd_lat),
  854 + offset: new BMap.Size(-(width / 2), -27)
  855 + });
  856 + label.setStyle(style);
  857 + map.addOverlay(label);
  858 + });
  859 + };
  860 + var drawCircle = function (point, radius) {
  861 + var circle = new BMap.Circle(point, radius);
  862 + circle.setStrokeColor('#000000');
  863 + circle.setStrokeWeight(1);
  864 + map.addOverlay(circle);
  865 + };
  866 +
  867 + var drawPolygon = function () {
  868 +
  869 + };
  870 +
  871 + /**
  872 + * 重置
  873 + */
  874 + var reset = function () {
  875 + if(trailPolyline)
  876 + trailPolyline.enableMassClear();
  877 + if(gpsMarker)
  878 + gpsMarker.enableMassClear();
  879 + map.clearOverlays();
  880 + roadUpdown = -1;
  881 + trailArray=[];
  882 + trailPolyline = null;
  883 + gpsMarker = null;
  884 + };
  885 +
  886 + /**
  887 + * 居中车辆,超出边界时
  888 + */
  889 + var toCenterByBounds = function () {
  890 + var markerIsVisible = BMapLib.GeoUtils.isPointInRect(gpsMarker.getPosition(),map.getBounds());
  891 + if(!markerIsVisible)
  892 + map.panTo(gpsMarker.getPosition());
  893 + };
  894 + return {
  895 + initData: initData,
  896 + updateCar: updateCar,
  897 + initMap: initMap,
  898 + updateTrailLine: updateTrailLine,
  899 + refreshOverlay: switchPolyline,
  900 + toCenterByBounds: toCenterByBounds,
  901 + reset: reset
  902 + }
  903 + })();
  904 +
  905 + /**
  906 + * 播放相关
  907 + * @type {{}}
  908 + */
  909 + var playObj = (function () {
  910 + var conf = {
  911 + playSpeed: 1,//播放速度
  912 + drawPoint: 1,//绘制站点
  913 + drawBuffArea: 1 ,//缓冲区
  914 + stationName: 0, //站点名称
  915 + carPark: [] //停车场
  916 + };
  917 +
  918 + var gpsArray;//gps点位集合
  919 + var init = function (rs) {
  920 + gpsArray = rs.list;
  921 + if(!gpsArray || gpsArray.length==0)
  922 + return;
  923 +
  924 + len = gpsArray.length;
  925 + //渲染配置信息
  926 + renderConfig();
  927 + //播放第一个点
  928 + run();
  929 + };
  930 +
  931 + var renderConfig = function () {
  932 + $('.speed_form [name=playSpeed][value='+conf.playSpeed+']', modal)[0].checked = true;
  933 + $('.buffer_area_form input[type=checkbox]', modal).each(function () {
  934 + var name = $(this).attr('name');
  935 + $(this)[0].checked = conf[name];
  936 + });
  937 + };
  938 +
  939 + /**
  940 + * 播放函数
  941 + */
  942 + var runTimer; //播放定时器
  943 + var toCenterTimer;//居中定时器
  944 + var index = 0; //gps下标
  945 + var play = function () {
  946 + if(!run())
  947 + runTimer = setTimeout(play, 1000 / conf.playSpeed);
  948 + };
  949 +
  950 + /**
  951 + * 定时居中
  952 + */
  953 + var fixedToCenter = function () {
  954 + toCenterTimer = setInterval(function () {
  955 + mapObj.toCenterByBounds();
  956 + }, 500);
  957 + };
  958 +
  959 + var pause = function () {
  960 + clearInterval(runTimer);
  961 + runTimer = null;
  962 + clearInterval(toCenterTimer);
  963 + toCenterTimer = null;
  964 + };
  965 +
  966 + var clock = $('.ct_btn.clock', modal), gps, len;
  967 + var run = function () {
  968 + if(index == len){
  969 + $('.map-wrap-tools .play_btn', modal).removeClass('play');
  970 + pause();
  971 + notify_succ('本次轨迹回放已结束!');
  972 + searchForm.hideShade();
  973 + return true;
  974 + }
  975 + gps = gpsArray[index];
  976 + //更新GPS点位
  977 + mapObj.updateCar(gps);
  978 + //绘制轨迹线
  979 + mapObj.updateTrailLine();
  980 + //时间文本
  981 + clock.text(gps.timeStr);
  982 + //输出行车轨迹
  983 + trailTableObj.add(gps, index);
  984 + //输出到离站信息
  985 + inOutStationTableObj.add(gps, index);
  986 + //进度条
  987 + mapTools.upProgressBar(index);
  988 + index ++;
  989 + };
  990 +
  991 + /**
  992 + * 重置
  993 + */
  994 + var reset = function () {
  995 + index = 0;
  996 + gpsArray = null;
  997 + pause();
  998 + };
  999 + return {
  1000 + init: init,
  1001 + getConf: function () {
  1002 + return conf;
  1003 + },
  1004 + setConf: function (k, v) {
  1005 + conf[k] = v;
  1006 + },
  1007 + play: play,
  1008 + fixedToCenter: fixedToCenter,
  1009 + pause: pause,
  1010 + reset: reset
  1011 + }
  1012 + })();
  1013 + })();
  1014 + </script>
559 1015 </div>
560 1016 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/mapmonitor/js/gps_tree.js
... ... @@ -203,7 +203,6 @@ var gb_map_gps_tree = (function () {
203 203 if(this.nbbm.indexOf(v) != -1){
204 204 rs.push({
205 205 value: this.nbbm,
206   - lineName: '青浦1路',
207 206 stationName: this.stationName?this.stationName:'',
208 207 dateStr: this.dateStr
209 208 });
... ...
src/main/resources/static/real_control_v2/mapmonitor/js/map/iMap.js
... ... @@ -34,6 +34,7 @@ var gb_map_imap = (function () {
34 34 busIcon: '/real_control_v2/assets/imgs/bus1-R.png',
35 35 _color: color,
36 36 createCarIconRotation: createCarIconRotation,
  37 + createStationPointIcon: createStationPointIcon,
37 38 createStationIcon: createStationIcon,
38 39 call: function (f, opts) {
39 40 var instance = maps[currentMap].instance;
... ... @@ -86,7 +87,7 @@ var gb_map_imap = (function () {
86 87  
87 88  
88 89 //绘制车辆icon 带角度标示
89   - function createCarIconRotation(gps, w) {
  90 +/* function createCarIconRotation(gps, w) {
90 91 if (!w)
91 92 w = 70;
92 93  
... ... @@ -119,6 +120,81 @@ var gb_map_imap = (function () {
119 120 ctx.restore();
120 121  
121 122 return canvas.toDataURL();
  123 + }*/
  124 +
  125 + function createCarIconRotation(gps, w) {
  126 + if (!w)
  127 + w = 70;
  128 +
  129 + var canvas = $('<canvas></canvas>')[0];
  130 + canvas.width = w;
  131 + canvas.height = 64;
  132 + var ctx = canvas.getContext('2d');
  133 +
  134 + var colours = color(gps);
  135 +
  136 + ctx.roundRect(0, 0, w, 19, 4).stroke();
  137 + ctx.fillStyle = colours.bgColor;
  138 + ctx.fill();
  139 + //文字
  140 + ctx.font = "14px arial";
  141 + ctx.fillStyle = "#fff";
  142 + ctx.fillText(gps.nbbm, 2, 14);
  143 +
  144 + //角度图标
  145 + //var img = new Image();
  146 + //img.src = rotationIcon(colours.bgColor);
  147 + ctx.save();
  148 + ctx.translate(canvas.width / 2, canvas.height / 2);
  149 + ctx.rotate(gps.direction * Math.PI / 180);
  150 + //ctx.drawImage(img, -img.width / 2, -img.width / 2);
  151 + /**
  152 + * 绘制角度图标
  153 + */
  154 + ctx.beginPath();
  155 + ctx.strokeStyle = colours.bgColor;
  156 + var circle = {
  157 + x: 0, //圆心的x轴坐标值
  158 + y: 0, //圆心的y轴坐标值
  159 + r: 12 //圆的半径
  160 + };
  161 + var d = 12.5;
  162 + //绘制圆形
  163 + ctx.arc(circle.x, circle.y, circle.r, 0, Math.PI * 2, true);
  164 + //按照指定的路径绘制弧线
  165 + ctx.stroke();
  166 + ctx.fillStyle = "#ffffff";
  167 + ctx.fill();
  168 + //下方矩形
  169 + ctx.beginPath();
  170 + ctx.fillStyle = colours.bgColor;
  171 + ctx.fillRect(5 - d, 16 - d, 15, 4);
  172 + ctx.rect(5 - d, 11 - d, 7.5, 8);
  173 + ctx.rect(12.5 - d, 11 - d, 7.5, 8);
  174 + ctx.strokeStyle = colours.bgColor;
  175 + ctx.stroke();
  176 + //上方三角形
  177 + ctx.beginPath();
  178 + ctx.fillStyle = "#111111";
  179 + ctx.moveTo(12.5 - d, 3 - d);
  180 + ctx.lineTo(6.5 - d, 7.5 - d);
  181 + ctx.lineTo(18.5 - d, 7.5 - d);
  182 + ctx.closePath();
  183 + ctx.fill();
  184 +
  185 + ctx.restore();
  186 + return canvas.toDataURL();
  187 + }
  188 +
  189 + //绘制站点点位icon
  190 + function createStationPointIcon() {
  191 + var canvas = $('<canvas></canvas>')[0];
  192 + var ctx = canvas.getContext('2d');
  193 + ctx.beginPath();
  194 + ctx.arc(6,6,6,0,2*Math.PI);
  195 + ctx.fillStyle = '#000000';
  196 + ctx.fill();
  197 + return canvas.toDataURL();
122 198 }
123 199  
124 200  
... ... @@ -136,7 +212,7 @@ var gb_map_imap = (function () {
136 212 y: 12.5, //圆心的y轴坐标值
137 213 r: 12 //圆的半径
138 214 };
139   - //以canvas中的坐标点(100,100)为圆心,绘制一个半径为50px的圆形
  215 + //绘制圆形
140 216 ctx.arc(circle.x, circle.y, circle.r, 0, Math.PI * 2, true);
141 217 //按照指定的路径绘制弧线
142 218 ctx.stroke();
... ...
src/main/resources/static/real_control_v2/mapmonitor/js/playback.js
... ... @@ -29,7 +29,7 @@ var gb_map_play_back = (function () {
29 29 ' <table border="1">' +
30 30 ' <tr><th>序号</th><th>车辆</th><th>所在道路</th><th>经度</th><th>纬度</th><th>时间</th><th>速度</th></tr>' +
31 31 ' {{each list as gps i}}' +
32   - ' <tr><td>{{i+1}}</td><td>{{gps.nbbm}}</td><td>{{gps.road.ROAD_NAME}}</td><td>{{gps.bd_lon}}</td><td>{{gps.bd_lat}}</td><td>{{gps.timeStr2}}</td><td>{{gps.speed}}</td></tr>' +
  32 + ' <tr><td>{{i+1}}</td><td>{{gps.nbbm}}</td><td>{{gps.road.road_NAME}}</td><td>{{gps.bd_lon}}</td><td>{{gps.bd_lat}}</td><td>{{gps.timeStr}}</td><td>{{gps.speed}}</td></tr>' +
33 33 ' {{/each}}' +
34 34 ' </table>' +
35 35 ' </body>' +
... ...
src/main/resources/static/real_control_v2/mapmonitor/js/spatial_data.js
... ... @@ -328,6 +328,12 @@ var gb_map_spatial_data = (function () {
328 328 refresh: refresh,
329 329 init: init,
330 330 getCheckedStation:getCheckedStation,
331   - gteCheckedCarpark: gteCheckedCarpark
  331 + gteCheckedCarpark: gteCheckedCarpark,
  332 + getStationArray: function (lineCode) {
  333 + return lineStationArr[lineCode];
  334 + },
  335 + carparkArray: function () {
  336 + return carparkArr;
  337 + }
332 338 };
333 339 })();
334 340 \ No newline at end of file
... ...