Commit 7eaee32900284a43672ffddf340088c1c6eddaa2

Authored by 潘钊
1 parent 01cc9e07

update

src/main/java/com/bsth/data/BasicData.java
@@ -308,9 +308,9 @@ public class BasicData implements CommandLineRunner { @@ -308,9 +308,9 @@ public class BasicData implements CommandLineRunner {
308 if (StringUtils.isEmpty(jobCode)) 308 if (StringUtils.isEmpty(jobCode))
309 continue; 309 continue;
310 310
311 - if (jobCode.indexOf("-") != -1) { 311 + /*if (jobCode.indexOf("-") != -1) {
312 jobCode = jobCode.split("-")[1]; 312 jobCode = jobCode.split("-")[1];
313 - } 313 + }*/
314 if (p.getPosts() != null) { 314 if (p.getPosts() != null) {
315 if (p.getPosts().equals("1")) 315 if (p.getPosts().equals("1"))
316 jsyTempMap.put(jobCode, p); 316 jsyTempMap.put(jobCode, p);
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
1 package com.bsth.service.realcontrol.impl; 1 package com.bsth.service.realcontrol.impl;
2 2
3 -import java.text.DecimalFormat;  
4 -import java.text.ParseException;  
5 -import java.text.SimpleDateFormat;  
6 -import java.util.ArrayList;  
7 -import java.util.Collection;  
8 -import java.util.Collections;  
9 -import java.util.Date;  
10 -import java.util.HashMap;  
11 -import java.util.HashSet;  
12 -import java.util.Iterator;  
13 -import java.util.List;  
14 -import java.util.Map;  
15 -import java.util.Set;  
16 -  
17 -import com.bsth.entity.realcontrol.LineConfig;  
18 -import org.apache.commons.lang3.StringUtils;  
19 -import org.joda.time.format.DateTimeFormat;  
20 -import org.joda.time.format.DateTimeFormatter;  
21 -import org.slf4j.Logger;  
22 -import org.slf4j.LoggerFactory;  
23 -import org.springframework.beans.factory.annotation.Autowired;  
24 -import org.springframework.stereotype.Service;  
25 -  
26 import com.alibaba.fastjson.JSONArray; 3 import com.alibaba.fastjson.JSONArray;
27 import com.alibaba.fastjson.JSONObject; 4 import com.alibaba.fastjson.JSONObject;
28 import com.bsth.common.ResponseCode; 5 import com.bsth.common.ResponseCode;
@@ -39,6 +16,7 @@ import com.bsth.entity.Cars; @@ -39,6 +16,7 @@ import com.bsth.entity.Cars;
39 import com.bsth.entity.Line; 16 import com.bsth.entity.Line;
40 import com.bsth.entity.Personnel; 17 import com.bsth.entity.Personnel;
41 import com.bsth.entity.realcontrol.ChildTaskPlan; 18 import com.bsth.entity.realcontrol.ChildTaskPlan;
  19 +import com.bsth.entity.realcontrol.LineConfig;
42 import com.bsth.entity.realcontrol.ScheduleRealInfo; 20 import com.bsth.entity.realcontrol.ScheduleRealInfo;
43 import com.bsth.entity.schedule.CarConfigInfo; 21 import com.bsth.entity.schedule.CarConfigInfo;
44 import com.bsth.entity.schedule.EmployeeConfigInfo; 22 import com.bsth.entity.schedule.EmployeeConfigInfo;
@@ -54,17 +32,25 @@ import com.bsth.security.util.SecurityUtils; @@ -54,17 +32,25 @@ import com.bsth.security.util.SecurityUtils;
54 import com.bsth.service.SectionRouteService; 32 import com.bsth.service.SectionRouteService;
55 import com.bsth.service.impl.BaseServiceImpl; 33 import com.bsth.service.impl.BaseServiceImpl;
56 import com.bsth.service.realcontrol.ScheduleRealInfoService; 34 import com.bsth.service.realcontrol.ScheduleRealInfoService;
57 -import com.bsth.util.DateUtils;  
58 -import com.bsth.util.ReportRelatedUtils;  
59 -import com.bsth.util.ReportUtils;  
60 -import com.bsth.util.TimeUtils;  
61 -import com.bsth.util.TransGPS; 35 +import com.bsth.util.*;
62 import com.bsth.util.TransGPS.Location; 36 import com.bsth.util.TransGPS.Location;
63 import com.bsth.websocket.handler.SendUtils; 37 import com.bsth.websocket.handler.SendUtils;
64 import com.google.common.base.Splitter; 38 import com.google.common.base.Splitter;
65 import com.google.common.collect.ArrayListMultimap; 39 import com.google.common.collect.ArrayListMultimap;
66 import com.google.common.collect.Lists; 40 import com.google.common.collect.Lists;
67 import com.google.common.collect.Multimap; 41 import com.google.common.collect.Multimap;
  42 +import org.apache.commons.lang3.StringUtils;
  43 +import org.joda.time.format.DateTimeFormat;
  44 +import org.joda.time.format.DateTimeFormatter;
  45 +import org.slf4j.Logger;
  46 +import org.slf4j.LoggerFactory;
  47 +import org.springframework.beans.factory.annotation.Autowired;
  48 +import org.springframework.stereotype.Service;
  49 +
  50 +import java.text.DecimalFormat;
  51 +import java.text.ParseException;
  52 +import java.text.SimpleDateFormat;
  53 +import java.util.*;
68 54
69 @Service 55 @Service
70 public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInfo, Long> 56 public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInfo, Long>
@@ -289,6 +275,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -289,6 +275,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
289 rs.put("msg", "驾驶员工号不能为空!"); 275 rs.put("msg", "驾驶员工号不能为空!");
290 return rs; 276 return rs;
291 } 277 }
  278 + //截取工号
  279 + if(t.getsGh().indexOf("-") != -1){
  280 + t.setsGh(t.getsGh().split("-")[1]);
  281 + }
292 282
293 t.setScheduleDateStr(schDate); 283 t.setScheduleDateStr(schDate);
294 t.setScheduleDate(sdfyyyyMMdd.parse(schDate)); 284 t.setScheduleDate(sdfyyyyMMdd.parse(schDate));
@@ -454,12 +444,16 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -454,12 +444,16 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
454 444
455 @Override 445 @Override
456 public void adjustDriver(ScheduleRealInfo schedule, String driver, String driverName) { 446 public void adjustDriver(ScheduleRealInfo schedule, String driver, String driverName) {
  447 + if(driver.indexOf("-") != -1)
  448 + driver = driver.split("-")[1];
457 schedule.setjGh(driver); 449 schedule.setjGh(driver);
458 schedule.setjName(driverName); 450 schedule.setjName(driverName);
459 } 451 }
460 452
461 @Override 453 @Override
462 public void adjustConductor(ScheduleRealInfo schedule, String conductor, String conductorName) { 454 public void adjustConductor(ScheduleRealInfo schedule, String conductor, String conductorName) {
  455 + if(conductor.indexOf("-") != -1)
  456 + conductor = conductor.split("-")[1];
463 schedule.setsGh(conductor); 457 schedule.setsGh(conductor);
464 schedule.setsName(conductorName); 458 schedule.setsName(conductorName);
465 } 459 }
src/main/resources/static/real_control_v2/css/line_schedule.css
@@ -101,11 +101,11 @@ @@ -101,11 +101,11 @@
101 } 101 }
102 102
103 .line-schedule-table dl dt:nth-of-type(5), .line-schedule-table dl dd:nth-of-type(5) { 103 .line-schedule-table dl dt:nth-of-type(5), .line-schedule-table dl dd:nth-of-type(5) {
104 - width: 11%; 104 + width: 10%;
105 } 105 }
106 106
107 .line-schedule-table dl dt:nth-of-type(6), .line-schedule-table dl dd:nth-of-type(6) { 107 .line-schedule-table dl dt:nth-of-type(6), .line-schedule-table dl dd:nth-of-type(6) {
108 - width: calc(15% + 8px); 108 + width: calc(13% + 18px);
109 /*color: #676767;*/ 109 /*color: #676767;*/
110 } 110 }
111 111
@@ -114,7 +114,7 @@ @@ -114,7 +114,7 @@
114 } 114 }
115 115
116 .line-schedule-table dl dt:nth-of-type(8), .line-schedule-table dl dd:nth-of-type(8) { 116 .line-schedule-table dl dt:nth-of-type(8), .line-schedule-table dl dd:nth-of-type(8) {
117 - width: calc(48% - 228px); 117 + width: calc(51% - 238px);
118 } 118 }
119 119
120 .line-schedule-table dl dt:nth-of-type(9), .line-schedule-table dl dd:nth-of-type(9) { 120 .line-schedule-table dl dt:nth-of-type(9), .line-schedule-table dl dd:nth-of-type(9) {
@@ -253,7 +253,7 @@ span.fcsj-diff { @@ -253,7 +253,7 @@ span.fcsj-diff {
253 } 253 }
254 254
255 .tl-wd{ 255 .tl-wd{
256 - background: #e2e2a0; 256 + background: #caca4f;
257 } 257 }
258 258
259 .tl-xxsd{ 259 .tl-xxsd{
src/main/resources/static/real_control_v2/css/north.css
1 .north { 1 .north {
2 - background: linear-gradient(to right ,#595959, #7b7b7b,#595959);  
3 height: 120px; 2 height: 120px;
4 position: relative; 3 position: relative;
5 transition: all .3s ease; 4 transition: all .3s ease;
@@ -9,6 +8,10 @@ @@ -9,6 +8,10 @@
9 background: linear-gradient(to right, #082F4A, #125688, #0a3f64); 8 background: linear-gradient(to right, #082F4A, #125688, #0a3f64);
10 } 9 }
11 10
  11 +.north.monitor{
  12 + background: linear-gradient(to right ,#595959, #7b7b7b,#595959);
  13 +}
  14 +
12 .north.scok-colse { 15 .north.scok-colse {
13 background: linear-gradient(to right, #924040, #ce6262, #924040) !important; 16 background: linear-gradient(to right, #924040, #ce6262, #924040) !important;
14 } 17 }
src/main/resources/static/real_control_v2/js/common.js
@@ -150,6 +150,7 @@ var gb_common = (function() { @@ -150,6 +150,7 @@ var gb_common = (function() {
150 'type': 'device', 150 'type': 'device',
151 'device': this.deviceId 151 'device': this.deviceId
152 }, 152 },
  153 + 'data': {lineId: this.lineId, upDown: this.upDown},
153 'icon': 'uk-icon-bus' 154 'icon': 'uk-icon-bus'
154 }); 155 });
155 }); 156 });
@@ -157,7 +158,7 @@ var gb_common = (function() { @@ -157,7 +158,7 @@ var gb_common = (function() {
157 } 158 }
158 159
159 return treeData; 160 return treeData;
160 - } 161 + };
161 162
162 var lineAutocomplete = function(element) { 163 var lineAutocomplete = function(element) {
163 //construction data 164 //construction data
src/main/resources/static/real_control_v2/js/data/data_basic.js
@@ -51,6 +51,8 @@ var gb_data_basic = (function () { @@ -51,6 +51,8 @@ var gb_data_basic = (function () {
51 var data=[],name; 51 var data=[],name;
52 for(var jobCode in rs){ 52 for(var jobCode in rs){
53 name=rs[jobCode]; 53 name=rs[jobCode];
  54 + /*if(jobCode.indexOf("-")!=-1)
  55 + jobCode=jobCode.split('-')[1];*/
54 data.push({ 56 data.push({
55 value: jobCode+'/'+name, 57 value: jobCode+'/'+name,
56 fullChars: pinyin.getFullChars(name).toUpperCase(), 58 fullChars: pinyin.getFullChars(name).toUpperCase(),
src/main/resources/static/real_control_v2/js/data/data_gps.js
@@ -38,7 +38,9 @@ var gb_data_gps = (function() { @@ -38,7 +38,9 @@ var gb_data_gps = (function() {
38 upArr.push(this); 38 upArr.push(this);
39 } else 39 } else
40 addArr.push(this); 40 addArr.push(this);
41 - 41 + //起终点 拼接方向标识
  42 + if(this.sEPoint)
  43 + this.stopNo=this.stopNo+'_'+this.upDown;
42 realData[this.deviceId] = this; 44 realData[this.deviceId] = this;
43 }); 45 });
44 46
src/main/resources/static/real_control_v2/js/line_schedule/sch_table.js
@@ -77,7 +77,7 @@ var gb_schedule_table = (function() { @@ -77,7 +77,7 @@ var gb_schedule_table = (function() {
77 content: { 77 content: {
78 text: function(e) { 78 text: function(e) {
79 var lineCode=$(e.target).parents('li.line_schedule').data('id') 79 var lineCode=$(e.target).parents('li.line_schedule').data('id')
80 - ,id=$(e.target).parent().data('id') 80 + ,id=$(e.target).parents('dl').data('id')
81 ,sch=line2Schedule[lineCode][id]; 81 ,sch=line2Schedule[lineCode][id];
82 return temps['sfsj_sch-detail-temp'](sch); 82 return temps['sfsj_sch-detail-temp'](sch);
83 } 83 }
src/main/resources/static/real_control_v2/js/utils/svg_chart.js
@@ -223,13 +223,11 @@ var gb_svg_chart = (function() { @@ -223,13 +223,11 @@ var gb_svg_chart = (function() {
223 var svgs = $('.line-chart[data-code=' + lineCode + ']'), 223 var svgs = $('.line-chart[data-code=' + lineCode + ']'),
224 data = gb_data_gps.gpsByLineCode(lineCode); 224 data = gb_data_gps.gpsByLineCode(lineCode);
225 225
226 - var list=[];  
227 - //过滤数据,起终点站附加 方向标识 226 + var list=[];
  227 + //过滤无站点字段的数据
228 $.each(data, function(){ 228 $.each(data, function(){
229 if(!this.stopNo || this.stopNo=='') 229 if(!this.stopNo || this.stopNo=='')
230 return true; 230 return true;
231 - if(this.sEPoint)  
232 - this.stopNo=this.stopNo+'_'+this.upDown;  
233 list.push(this); 231 list.push(this);
234 }); 232 });
235 233
@@ -241,9 +239,7 @@ var gb_svg_chart = (function() { @@ -241,9 +239,7 @@ var gb_svg_chart = (function() {
241 marker_clusterer(this, lineCode); 239 marker_clusterer(this, lineCode);
242 }); 240 });
243 241
244 -  
245 - //marker_clusterer(lineCode);  
246 - } 242 + };
247 243
248 var draw_gps = function(svg, data) { 244 var draw_gps = function(svg, data) {
249 //remove merge_hide class 245 //remove merge_hide class
src/main/resources/static/real_control_v2/js/utils/svg_chart_tooltip.js
1 /* 线路模拟图 tooltip */ 1 /* 线路模拟图 tooltip */
2 2
3 -var gb_svg_tooltip = (function() { 3 +var gb_svg_tooltip = (function () {
4 4
5 var temps; 5 var temps;
6 - $.get('/real_control_v2/fragments/home/tooltip.html', function(dom) { 6 + $.get('/real_control_v2/fragments/home/tooltip.html', function (dom) {
7 temps = gb_common.compileTempByDom(dom); 7 temps = gb_common.compileTempByDom(dom);
8 }); 8 });
9 9
10 // normal gps tooltip 10 // normal gps tooltip
11 - $(document).on('mouseenter', 'svg .gps-wrap rect', function() { 11 + $(document).on('mouseenter', 'svg .gps-wrap rect', function () {
12 var rect = $(this); 12 var rect = $(this);
13 - if(rect.attr('aria-describedby'))  
14 - return; 13 + if (rect.attr('aria-describedby'))
  14 + return;
15 var gps = gb_data_gps.findOne($(this).attr('_id').split('_')[1]); 15 var gps = gb_data_gps.findOne($(this).attr('_id').split('_')[1]);
16 $(this).qtip({ 16 $(this).qtip({
17 show: { 17 show: {
@@ -19,7 +19,7 @@ var gb_svg_tooltip = (function() { @@ -19,7 +19,7 @@ var gb_svg_tooltip = (function() {
19 delay: 300 19 delay: 300
20 }, 20 },
21 content: { 21 content: {
22 - text: function() { 22 + text: function () {
23 return temps['tooltip_gps_temp'](gps); 23 return temps['tooltip_gps_temp'](gps);
24 } 24 }
25 }, 25 },
@@ -35,13 +35,13 @@ var gb_svg_tooltip = (function() { @@ -35,13 +35,13 @@ var gb_svg_tooltip = (function() {
35 delay: 300 35 delay: 300
36 }, 36 },
37 events: { 37 events: {
38 - hidden: function(event, api) { 38 + hidden: function (event, api) {
39 rect.dblclick(null); 39 rect.dblclick(null);
40 rect.removeAttr('fiexd-tip'); 40 rect.removeAttr('fiexd-tip');
41 //destroy dom 41 //destroy dom
42 $(this).qtip('destroy', true); 42 $(this).qtip('destroy', true);
43 }, 43 },
44 - visible: function() { 44 + visible: function () {
45 show_baidu_map($('.tip_map_wrap', this)[0], gps); 45 show_baidu_map($('.tip_map_wrap', this)[0], gps);
46 rect.dblclick(fiexdTip); 46 rect.dblclick(fiexdTip);
47 } 47 }
@@ -50,24 +50,24 @@ var gb_svg_tooltip = (function() { @@ -50,24 +50,24 @@ var gb_svg_tooltip = (function() {
50 }); 50 });
51 51
52 //multiple gps tooltip 52 //multiple gps tooltip
53 - $(document).on('mouseenter', 'svg .merge-item rect', function() { 53 + $(document).on('mouseenter', 'svg .merge-item rect', function () {
54 var rect = $(this); 54 var rect = $(this);
55 - if(rect.attr('aria-describedby'))  
56 - return;  
57 - // var gps = gb_data_gps.findOne($(this).attr('_id').split('_')[1]); 55 + if (rect.attr('aria-describedby'))
  56 + return;
  57 + // var gps = gb_data_gps.findOne($(this).attr('_id').split('_')[1]);
58 //获取聚合的gps 58 //获取聚合的gps
59 - var lineCode=$(this).parents('svg').data('code')  
60 - ,stop=$(this).parent().attr('_id').substr(7)//merger_  
61 - ,gpsArray=searchByStop(gb_data_gps.gpsByLineCode(lineCode), stop); 59 + var lineCode = $(this).parents('svg').data('code')
  60 + , stop = $(this).parent().attr('_id').substr(7)//merger_
  61 + , gpsArray = searchByStop(gb_data_gps.gpsByLineCode(lineCode), stop);
62 62
63 - console.log('stop...',stop); 63 + // console.log('stop...',stop);
64 $(this).qtip({ 64 $(this).qtip({
65 show: { 65 show: {
66 ready: true, 66 ready: true,
67 delay: 300 67 delay: 300
68 }, 68 },
69 content: { 69 content: {
70 - text: function() { 70 + text: function () {
71 return temps['tooltip_multi_gps_temp']({list: gpsArray}); 71 return temps['tooltip_multi_gps_temp']({list: gpsArray});
72 } 72 }
73 }, 73 },
@@ -83,12 +83,12 @@ var gb_svg_tooltip = (function() { @@ -83,12 +83,12 @@ var gb_svg_tooltip = (function() {
83 delay: 300 83 delay: 300
84 }, 84 },
85 events: { 85 events: {
86 - hidden: function(event, api) { 86 + hidden: function (event, api) {
87 //rect.dblclick(null); 87 //rect.dblclick(null);
88 //destroy dom 88 //destroy dom
89 $(this).qtip('destroy', true); 89 $(this).qtip('destroy', true);
90 }, 90 },
91 - visible: function() { 91 + visible: function () {
92 show_baidu_map($('.tip_map_wrap', this)[0], gpsArray); 92 show_baidu_map($('.tip_map_wrap', this)[0], gpsArray);
93 //rect.dblclick(fiexdTip); 93 //rect.dblclick(fiexdTip);
94 } 94 }
@@ -97,7 +97,7 @@ var gb_svg_tooltip = (function() { @@ -97,7 +97,7 @@ var gb_svg_tooltip = (function() {
97 }); 97 });
98 98
99 //dblclick 99 //dblclick
100 - var fiexdTip = function() { 100 + var fiexdTip = function () {
101 var tipId = $(this).attr('aria-describedby'); 101 var tipId = $(this).attr('aria-describedby');
102 if (tipId) { 102 if (tipId) {
103 var api = $('#' + tipId).qtip('api'); 103 var api = $('#' + tipId).qtip('api');
@@ -114,59 +114,59 @@ var gb_svg_tooltip = (function() { @@ -114,59 +114,59 @@ var gb_svg_tooltip = (function() {
114 114
115 var carIcon = '/assets/img/bus1.png'; 115 var carIcon = '/assets/img/bus1.png';
116 //,normalIcon = '/assets/img/Marker_32px_583000_easyicon.net.png'; 116 //,normalIcon = '/assets/img/Marker_32px_583000_easyicon.net.png';
117 - var show_baidu_map = function(elem, list) {  
118 - if(!window.BMap) 117 + var show_baidu_map = function (elem, list) {
  118 + if (!window.BMap)
119 return; 119 return;
120 120
121 - if(!isArray(list))  
122 - list=[list]; 121 + if (!isArray(list))
  122 + list = [list];
123 //init map 123 //init map
124 var map = new BMap.Map(elem); 124 var map = new BMap.Map(elem);
125 map.setMapStyle({ 125 map.setMapStyle({
126 - style: 'googlelite' 126 + style: 'googlelite'
127 }); 127 });
128 map.enableScrollWheelZoom(true); 128 map.enableScrollWheelZoom(true);
129 //gps marker 129 //gps marker
130 - var coord,point;  
131 - $.each(list, function(i){  
132 - coord = TransGPS.wgsToBD(this.lat, this.lon);  
133 - point = new BMap.Point(coord.lng, coord.lat);  
134 -  
135 - var marker = new BMap.Marker(point),  
136 - icon = new BMap.Icon(carIcon, new BMap.Size(25, 25));  
137 - marker.setIcon(icon);  
138 - marker.setRotation(this.direction);  
139 - marker.setTop(true);  
140 - map.addOverlay(marker);  
141 -  
142 - if(i>=list.length-1)  
143 - map.centerAndZoom(point, 15); 130 + var coord, point;
  131 + $.each(list, function (i) {
  132 + coord = TransGPS.wgsToBD(this.lat, this.lon);
  133 + point = new BMap.Point(coord.lng, coord.lat);
  134 +
  135 + var marker = new BMap.Marker(point),
  136 + icon = new BMap.Icon(carIcon, new BMap.Size(25, 25));
  137 + marker.setIcon(icon);
  138 + marker.setRotation(this.direction);
  139 + marker.setTop(true);
  140 + map.addOverlay(marker);
  141 +
  142 + if (i >= list.length - 1)
  143 + map.centerAndZoom(point, 15);
144 }); 144 });
145 //draw line routes 145 //draw line routes
146 gb_svg_map_util.drawLine(map, list[0]); 146 gb_svg_map_util.drawLine(map, list[0]);
147 } 147 }
148 148
149 - function searchByStop(list, stop){  
150 - var rs = [];  
151 - $.each(list, function(){  
152 - if(this.stopNo==stop)  
153 - rs.push(this);  
154 - });  
155 - return rs; 149 + function searchByStop(list, stop) {
  150 + var rs = [];
  151 + $.each(list, function () {
  152 + if (this.stopNo == stop)
  153 + rs.push(this);
  154 + });
  155 + return rs;
156 } 156 }
157 157
158 - function updateFixedTip(es){  
159 - $.each(es, function(){  
160 - if(!$(this).attr('fiexd-tip'))  
161 - return true; 158 + function updateFixedTip(es) {
  159 + $.each(es, function () {
  160 + if (!$(this).attr('fiexd-tip'))
  161 + return true;
162 162
163 - var qtip=$('#'+$(this).attr('aria-describedby')); 163 + var qtip = $('#' + $(this).attr('aria-describedby'));
164 164
165 165
166 - }); 166 + });
167 } 167 }
168 168
169 return { 169 return {
170 - update: updateFixedTip 170 + update: updateFixedTip
171 }; 171 };
172 })(); 172 })();
src/main/resources/static/real_control_v2/mapmonitor/css/real.css
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 background: red; 9 background: red;
10 color: white; 10 color: white;
11 padding: 7px; 11 padding: 7px;
12 - left: calc(50% - 150px); 12 + left: calc(50% - 250px);
13 border-radius: 5px; 13 border-radius: 5px;
14 font-size: 20px; 14 font-size: 20px;
15 cursor: pointer; 15 cursor: pointer;
@@ -42,7 +42,7 @@ @@ -42,7 +42,7 @@
42 /**/ 42 /**/
43 .real_bottom_panel{ 43 .real_bottom_panel{
44 position: absolute !important; 44 position: absolute !important;
45 - height: 180px; 45 + height: 18px;
46 width: 100%; 46 width: 100%;
47 width: calc(100% - 342px); 47 width: calc(100% - 342px);
48 bottom: 2px !important; 48 bottom: 2px !important;
src/main/resources/static/real_control_v2/mapmonitor/fragments/map_config.html 0 → 100644
  1 +<div>
  2 + <script id="map-config-form-temp" type="text/html">
  3 + <form class="uk-form uk-form-stacked">
  4 + <div class="uk-form-row">
  5 + <span class="uk-form-label">图层</span>
  6 + <div class="uk-form-controls">
  7 + <label><input type="radio" name="map_type" {{if map_type=='baidu'}}checked{{/if}}> 百度</label>
  8 + <label><input type="radio" name="map_type" {{if map_type=='gaode'}}checked{{/if}}> 高德</label>
  9 + <label><input type="checkbox" name="map_type" {{if traffic}}checked{{/if}}> 实时路况</label>
  10 + </div>
  11 + </div>
  12 +
  13 + <div class="uk-form-row">
  14 + <span class="uk-form-label">空间数据</span>
  15 + <div class="uk-form-controls">
  16 + <label><input type="checkbox" {{if spatialData.station}}checked{{/if}}> 站点</label>
  17 + <label><input type="checkbox" {{if spatialData.electronicFence}}checked{{/if}}> 电子围栏</label>
  18 + <label><input type="checkbox" {{if spatialData.carPark}}checked{{/if}}> 停车场</label>
  19 + </div>
  20 + </div>
  21 +
  22 + <div class="uk-form-row">
  23 + <span class="uk-form-label">异常警报输出</span>
  24 + <div class="uk-form-controls">
  25 + <label><input type="checkbox" {{if abnormalPrint.speeding}}checked{{/if}}> 超速</label>
  26 + <label><input type="checkbox" {{if abnormalPrint.outBounds}}checked{{/if}}> 越界</label>
  27 + <label><input type="checkbox" {{if abnormalPrint.largeMargin}}checked{{/if}}> 大间隔</label>
  28 + </div>
  29 + </div>
  30 +
  31 + <div class="uk-form-row">
  32 + <span class="uk-form-label">车辆图标</span>
  33 + <div class="uk-form-controls">
  34 + <label><input type="checkbox" {{if carIcon.angle}}checked{{/if}}> 标示角度</label>
  35 + <label><input type="checkbox" {{if carIcon.converge}}checked{{/if}}> 聚合</label>
  36 + </div>
  37 + </div>
  38 +
  39 + <div class="uk-form-row">
  40 + <span class="uk-form-label">车辆颜色</span>
  41 + <div class="uk-form-controls">
  42 + <div class="color_block">
  43 + 上行
  44 + <div class="sp-placeholder">
  45 + <div class="sp-placeholder-color" style="background: {{carIcon.color.up}}"></div>
  46 + </div>
  47 + </div>
  48 +
  49 + <div class="color_block">
  50 + 下行
  51 + <div class="sp-placeholder">
  52 + <div class="sp-placeholder-color" style="background: {{carIcon.color.down}}"></div>
  53 + </div>
  54 + </div>
  55 +
  56 + <div class="color_block">
  57 + 非营运
  58 + <div class="sp-placeholder">
  59 + <div class="sp-placeholder-color" style="background: {{carIcon.color.nonOperation}}"></div>
  60 + </div>
  61 + </div>
  62 + </div>
  63 + </div>
  64 +
  65 + <div class="uk-form-row">
  66 + <span class="uk-form-label">路段颜色</span>
  67 + <div class="uk-form-controls">
  68 + <div class="color_block">
  69 + 上行
  70 + <div class="sp-placeholder">
  71 + <div class="sp-placeholder-color" style="background: {{section.color.up}}"></div>
  72 + </div>
  73 + </div>
  74 +
  75 + <div class="color_block">
  76 + 下行
  77 + <div class="sp-placeholder">
  78 + <div class="sp-placeholder-color" style="background: {{section.color.down}}"></div>
  79 + </div>
  80 + </div>
  81 + </div>
  82 + </div>
  83 +
  84 + <br>
  85 + </form>
  86 + </script>
  87 +</div>
src/main/resources/static/real_control_v2/mapmonitor/fragments/map_infowindow.html 0 → 100644
  1 +<div>
  2 + <script id="map-win-gps-detail-temp" type="text/html">
  3 + <div class="gps_info_win">
  4 + <h5 style="color:#0E6AF9;">
  5 + {{if stationName!=null}}
  6 + {{stationName}}
  7 + {{else}}
  8 + 未知站点
  9 + {{/if}}
  10 + </h5>
  11 + <h4 style="margin: 5px 0 5px 0;">
  12 + <span style="color: #0E6AF9;">{{nbbm}}</span>
  13 + </h4>
  14 + <p>
  15 + 营运状态:{{if state==0}}营运{{else}}非营运{{/if}}
  16 + </p>
  17 + <p>
  18 + 走向:{{if upDown==0}}上行{{else if upDown==1}}下行{{else}}未知走向{{/if}}
  19 + </p>
  20 + <p>速度:{{speed}}</p>
  21 + <p>经度:{{lon}}</p>
  22 + <p>纬度:{{lat}}</p>
  23 +
  24 + <!--<p style="color: gray;">{{fromNow}} 更新</p>-->
  25 + <hr>
  26 + <p>
  27 + {{if currSch!=null}}
  28 + 路牌:{{currSch.lpName}}
  29 + {{/if}}
  30 + </p>
  31 + <p class="banci-info">
  32 + {{if currSch!=null}}开往 {{currSch.zdzName}}{{/if}}
  33 + </p>
  34 + <p class="banci-info">
  35 + {{if nextSch!=null}}
  36 + 下一班{{nextSch.qdzName}} {{nextSch.fcsj}} 发车
  37 + {{/if}}
  38 + </p>
  39 + <a href="javascript:lineGroup.toPlayBack('{{nbbm}}', '{{lineId}}')" class="link_to_pback"
  40 + style="color:#006600;font-size:12px;">轨迹回放</a>
  41 + </div>
  42 + </script>
  43 +</div>
src/main/resources/static/real_control_v2/mapmonitor/js/config.js
@@ -22,9 +22,9 @@ var gb_map_config=(function () { @@ -22,9 +22,9 @@ var gb_map_config=(function () {
22 angle: false, 22 angle: false,
23 converge: false, 23 converge: false,
24 color: { 24 color: {
25 - up: 'blue',  
26 - down: 'red',  
27 - nonOperation: 'grey' 25 + up: 'rgba(94, 150, 210, 1)',
  26 + down: 'rgba(201, 33, 33, 1)',
  27 + nonOperation: 'rgba(136, 133, 133, 1)'
28 } 28 }
29 }, 29 },
30 section:{ 30 section:{
@@ -34,4 +34,42 @@ var gb_map_config=(function () { @@ -34,4 +34,42 @@ var gb_map_config=(function () {
34 } 34 }
35 } 35 }
36 }; 36 };
  37 +
  38 + var temps;
  39 +
  40 + var init = function () {
  41 + $.get('/real_control_v2/mapmonitor/fragments/map_config.html', function (dom) {
  42 + temps = gb_common.compileTempByDom(dom, {compress: true});
  43 +
  44 + //渲染表单
  45 + var formHtml=temps['map-config-form-temp'](defaultConfig);
  46 + $('.map_config_wrap').html(formHtml);
  47 +
  48 + //颜色选择器
  49 + $('.map_config_wrap .color_block').each(function () {
  50 + var c=$('.sp-placeholder-color',this).css('background-color');
  51 + var that=this;
  52 + $(this).spectrum({
  53 + color: c,
  54 + showInput: true,
  55 + chooseText: "确定",
  56 + cancelText: "取消",
  57 + preferredFormat: "rgb",
  58 + showAlpha: true,
  59 + change: function (color) {
  60 + $('.sp-placeholder-color',that).css('background-color', color);
  61 + }
  62 + });
  63 + });
  64 +
  65 +
  66 + });
  67 + }
  68 +
  69 + return {
  70 + getConfig: function () {
  71 + return defaultConfig;
  72 + },
  73 + init: init
  74 + }
37 })(); 75 })();
38 \ No newline at end of file 76 \ No newline at end of file
src/main/resources/static/real_control_v2/mapmonitor/js/gps_tree.js 0 → 100644
  1 +var gb_map_gps_tree = (function () {
  2 +
  3 +
  4 + var treeObj;
  5 +
  6 + var jstreeChanged = function (e, node, event) {
  7 + gb_map_overlay_mge.refresh();
  8 + };
  9 +
  10 + var init = function (cb) {
  11 + //设备树
  12 + var treeData = gb_common.get_device_tree_data();
  13 + treeObj = $('.real_right_gps_panel .gps_tree_list')
  14 + //节点初始化完成
  15 + .on('ready.jstree', function () {
  16 + treeObj.jstree(true).open_all();
  17 + //删掉tree node a标签的 href值(避免鼠标悬停浏览器出现状态条)
  18 + $('.gps_tree_list .jstree-container-ul a.jstree-anchor').removeAttr('href');
  19 + })
  20 + //state插件 状态恢复完成
  21 + .on('state_ready.jstree', function () {
  22 + //绑定checkbox状态切换事件
  23 + treeObj.on('check_node.jstree uncheck_node.jstree', jstreeChanged);
  24 + cb && cb();
  25 + })
  26 + .on('activate_node.jstree', function (e, n) {
  27 + var node = n.node;
  28 + if(node.a_attr && node.a_attr.type=='device'){
  29 + var device = node.a_attr.device;
  30 + gb_map_overlay_mge._focus(device);
  31 + }
  32 + })
  33 + .jstree({
  34 + 'core': {
  35 + 'data': treeData
  36 + },
  37 + 'checkbox': {
  38 + 'keep_selected_style': false,
  39 + 'whole_node': false,
  40 + 'tie_selection': false
  41 + },
  42 + 'contextmenu': {
  43 + 'items': {
  44 + '轨迹回放': {
  45 + 'label': '轨迹回放',
  46 + 'action': function (data) {
  47 + console.log('action', data);
  48 + }
  49 + },
  50 + '发送指令': {
  51 + 'label': '发送指令',
  52 + 'action': function (data) {
  53 + console.log('action', data);
  54 + }
  55 + }
  56 + }
  57 + },
  58 + 'plugins': ['checkbox', 'contextmenu', 'state']
  59 + });
  60 + };
  61 +
  62 + return {
  63 + init: init,
  64 + getChecked: function () {
  65 + return treeObj.jstree(true).get_checked(true);
  66 + }
  67 + };
  68 +})();
0 \ No newline at end of file 69 \ No newline at end of file
src/main/resources/static/real_control_v2/mapmonitor/js/map/iMap.js
1 -/** 各地图平台通用接口定义 */  
2 -var gb_map_imap = (function(){  
3 -  
4 - var storage = window.localStorage;  
5 - // 地图DOM容器  
6 - var mapContainer = $('#mapContainer');  
7 - var maps = {};  
8 - //尝试从 localStorage 里获取默认的地图类型  
9 - var currentMap = storage.getItem('real_map');  
10 - var mapProxy = {  
11 - //添加一个地图实例  
12 - addMap: function(name, text, instance){  
13 - maps[name] = {name: name, text: text, instance: instance};  
14 -  
15 - if(!currentMap)  
16 - currentMap = name;  
17 - return mapProxy;  
18 - },  
19 - changeDefault: function(mapName){  
20 - if(mapName == currentMap)  
21 - return;  
22 - if(maps[mapName]){  
23 - //原地图 destroy  
24 - var oldMap = maps[currentMap].instance;  
25 - oldMap.destroy && oldMap.destroy();  
26 - $(gb_map_consts.mapContainer).html('');  
27 - //解除实时路况按钮点击事件  
28 - $(gb_map_consts.trafficBtn).unbind('click');  
29 -  
30 - //新地图 INIT  
31 - var text = maps[mapName].text;  
32 - //layer.msg('正在切换到' + text + '...', {icon : 16,shade : [ 0.6, '#393D49' ],time : 0});  
33 - var newMap = maps[mapName].instance;  
34 - newMap.init();  
35 - setText(text);  
36 -  
37 - currentMap = mapName;  
38 - //收拢线路  
39 - $('.mapRightWrap .collapse.in').collapse('hide');  
40 - }else  
41 - alertErr('不存在的地图实例' + mapName);  
42 - },  
43 - createCarIcon: createCarIcon,  
44 - call: function(f, opts){  
45 - if(f == 'init')  
46 - setText(maps[currentMap].text);  
47 -  
48 - var instance = maps[currentMap].instance;  
49 - if(instance[f])  
50 - instance[f](opts);  
51 - else  
52 - alertErr('当前地图实例不支持操作:' + f);  
53 - return mapProxy;  
54 - }  
55 - }  
56 -  
57 - //绘制车辆icon  
58 - function createCarIcon(gps, w){  
59 - var canvas = $('<canvas></canvas>')[0];  
60 - var ctx = canvas.getContext('2d');  
61 -  
62 - var colours = color(gps);  
63 -  
64 - ctx.shadowOffsetX = 5; // 阴影Y轴偏移  
65 - ctx.shadowOffsetY = 5; // 阴影X轴偏移  
66 - ctx.shadowBlur = 1; // 模糊尺寸  
67 - ctx.shadowColor = colours.shadow; // 颜色  
68 -  
69 - //绘制背景  
70 - if(!w)  
71 - w = 70;  
72 -  
73 - ctx.roundRect(0, 0, w, 25, 5).stroke();  
74 - ctx.fillStyle=colours.bgColor;  
75 - ctx.fill();  
76 - //文字  
77 - ctx.font="14px arial";  
78 - ctx.fillStyle = "#fff";  
79 - ctx.fillText(gps.nbbm, 8, 18);  
80 -  
81 - return canvas.toDataURL();  
82 - }  
83 -  
84 - function color(g){  
85 - var colours = {};  
86 - switch (g.state) {  
87 - case 0:  
88 - if(g.upDown == 0){  
89 - //营运上行  
90 - colours['bgColor'] = 'rgba(94, 150, 210, 1)';  
91 - colours['shadow'] = 'rgba(94, 150, 210, 0.3)';  
92 - }  
93 - else if(g.upDown == 1){  
94 - //营运下行  
95 - colours['bgColor'] = 'rgba(201, 33, 33, 1)';  
96 - colours['shadow'] = 'rgba(201, 33, 33, 0.3)';  
97 - }  
98 - else{  
99 - //未知走向  
100 - colours['bgColor'] = 'rgba(0, 0, 0, 1)';  
101 - colours['shadow'] = 'rgba(0, 0, 0, 0.3)';  
102 - }  
103 - break;  
104 -  
105 - default:  
106 - //非营运  
107 - colours['bgColor'] = 'rgba(136, 133, 133, 1)';  
108 - colours['shadow'] = 'rgba(136, 133, 133, 0.3)';  
109 - break;  
110 - }  
111 -  
112 - return colours;  
113 - }  
114 -  
115 - function alertErr(text){  
116 - notify_err('map -'+text);  
117 - }  
118 -  
119 - function setText(text) {  
120 - $('#curr_map_name').text(text);  
121 - }  
122 -  
123 - //文件载入完毕  
124 - mapmonitor_load_ep.emitLater('load_iMap');  
125 - return mapProxy; 1 +/** 地图 api 代理 */
  2 +var gb_map_imap = (function () {
  3 +
  4 + var storage = window.localStorage;
  5 + // 地图DOM容器
  6 + var mapContainer = $('#mapContainer');
  7 + var maps = {};
  8 + //尝试从 localStorage 里获取默认的地图类型
  9 + var currentMap = storage.getItem('real_map');
  10 + var mapProxy = {
  11 + //添加一个地图实例
  12 + addMap: function (name, text, instance) {
  13 + maps[name] = {name: name, text: text, instance: instance};
  14 +
  15 + if (!currentMap)
  16 + currentMap = name;
  17 + return mapProxy;
  18 + },
  19 + changeDefault: function (mapName) {
  20 + if (mapName == currentMap)
  21 + return;
  22 + if (maps[mapName]) {
  23 + //原地图 destroy
  24 + var oldMap = maps[currentMap].instance;
  25 + oldMap.destroy && oldMap.destroy();
  26 + $(gb_map_consts.mapContainer).html('');
  27 + //解除实时路况按钮点击事件
  28 + $(gb_map_consts.trafficBtn).unbind('click');
  29 +
  30 + //新地图 INIT
  31 + var text = maps[mapName].text;
  32 + //layer.msg('正在切换到' + text + '...', {icon : 16,shade : [ 0.6, '#393D49' ],time : 0});
  33 + var newMap = maps[mapName].instance;
  34 + newMap.init();
  35 + setText(text);
  36 +
  37 + currentMap = mapName;
  38 + //收拢线路
  39 + $('.mapRightWrap .collapse.in').collapse('hide');
  40 + } else
  41 + alertErr('不存在的地图实例' + mapName);
  42 + },
  43 + createCarIcon: createCarIcon,
  44 + call: function (f, opts) {
  45 + if (f == 'init')
  46 + setText(maps[currentMap].text);
  47 +
  48 + var instance = maps[currentMap].instance;
  49 + if (instance[f])
  50 + instance[f](opts);
  51 + else
  52 + alertErr('当前地图实例不支持操作:' + f);
  53 + return mapProxy;
  54 + }
  55 + }
  56 +
  57 + //绘制车辆icon
  58 + function createCarIcon(gps, w) {
  59 + var canvas = $('<canvas></canvas>')[0];
  60 + var ctx = canvas.getContext('2d');
  61 +
  62 + var colours = color(gps);
  63 +
  64 + ctx.shadowOffsetX = 5; // 阴影Y轴偏移
  65 + ctx.shadowOffsetY = 5; // 阴影X轴偏移
  66 + ctx.shadowBlur = 1; // 模糊尺寸
  67 + ctx.shadowColor = colours.shadow; // 颜色
  68 +
  69 + //绘制背景
  70 + if (!w)
  71 + w = 70;
  72 +
  73 + ctx.roundRect(0, 0, w, 25, 5).stroke();
  74 + ctx.fillStyle = colours.bgColor;
  75 + ctx.fill();
  76 + //文字
  77 + ctx.font = "14px arial";
  78 + ctx.fillStyle = "#fff";
  79 + ctx.fillText(gps.nbbm, 8, 18);
  80 +
  81 + return canvas.toDataURL();
  82 + }
  83 +
  84 + function color(g) {
  85 + var colours = {};
  86 + switch (g.state) {
  87 + case 0:
  88 + if (g.upDown == 0) {
  89 + //营运上行
  90 + colours['bgColor'] = 'rgba(94, 150, 210, 1)';
  91 + colours['shadow'] = 'rgba(94, 150, 210, 0.3)';
  92 + }
  93 + else if (g.upDown == 1) {
  94 + //营运下行
  95 + colours['bgColor'] = 'rgba(201, 33, 33, 1)';
  96 + colours['shadow'] = 'rgba(201, 33, 33, 0.3)';
  97 + }
  98 + else {
  99 + //未知走向
  100 + colours['bgColor'] = 'rgba(0, 0, 0, 1)';
  101 + colours['shadow'] = 'rgba(0, 0, 0, 0.3)';
  102 + }
  103 + break;
  104 +
  105 + default:
  106 + //非营运
  107 + colours['bgColor'] = 'rgba(136, 133, 133, 1)';
  108 + colours['shadow'] = 'rgba(136, 133, 133, 0.3)';
  109 + break;
  110 + }
  111 +
  112 + return colours;
  113 + }
  114 +
  115 + function alertErr(text) {
  116 + notify_err('map -' + text);
  117 + }
  118 +
  119 + function setText(text) {
  120 + $('#curr_map_name').text(text);
  121 + }
  122 +
  123 + //文件载入完毕
  124 + mapmonitor_load_ep.emitLater('load_iMap');
  125 + return mapProxy;
126 })(); 126 })();
src/main/resources/static/real_control_v2/mapmonitor/js/map/platform/baidu.js
@@ -58,36 +58,43 @@ var gb_map_baidu = (function(){ @@ -58,36 +58,43 @@ var gb_map_baidu = (function(){
58 map.clearOverlays(); 58 map.clearOverlays();
59 }, 59 },
60 //画线路图层 60 //画线路图层
61 - drawLine: function(opts){  
62 - if(polylines[opts.key]){  
63 - //centerToPolyline(polylines[opts.key]); 61 + drawLine: function(opt){
  62 + if(polylines[opt.id])
64 return; 63 return;
65 - }  
66 - var plconfg={strokeWeight:6, strokeOpacity:0.5};  
67 - var pos = [], tempArray;  
68 - var route;  
69 - var polyline;  
70 - //上行  
71 - if(opts.updown==0){  
72 - route=opts.route.up;  
73 - plconfg.strokeColor="blue";  
74 - }  
75 - else if(opts.updown==1){  
76 - route=opts.route.down;  
77 - plconfg.strokeColor="red";  
78 - } 64 +
  65 + var pos = [], temps;
  66 + var route = opt.upDown==0?opt.route.up:opt.route.down;
  67 +
79 $.each(route.split(','), function(){ 68 $.each(route.split(','), function(){
80 - tempArray = this.split(' ');  
81 - pos.push(new BMap.Point(tempArray[0], tempArray[1])); 69 + temps = this.split(' ');
  70 + pos.push(new BMap.Point(temps[0], temps[1]));
82 }); 71 });
83 72
84 - polyline = new BMap.Polyline(pos, plconfg);  
85 - polylines[opts.key]=polyline; 73 + var polyline = new BMap.Polyline(pos, opt.style);
  74 + //根据ID保存映射
  75 + polylines[opt.id]=polyline;
  76 + if(opt.hide)
  77 + polyline.hide();
86 map.addOverlay(polyline); 78 map.addOverlay(polyline);
87 -  
88 - console.log('centerToPolyline...');  
89 - centerToPolyline(polyline); 79 + //居中
  80 + //centerToPolyline(polyline);
90 }, 81 },
  82 + //根据id 显示polyline
  83 + refreshPolyline: function (opt) {
  84 + var idx = opt.idx;
  85 + for(var id in polylines){
  86 + if(idx.indexOf(id) != -1)
  87 + polylines[id].show();
  88 + else
  89 + polylines[id].hide();
  90 + }
  91 + },
  92 + //定位到线路中间点
  93 + centerToLine: function (opt) {
  94 + var pos=polylines[opt.id].getPath();
  95 + console.log('定位到中心,,,', pos[parseInt(pos.length / 2)]);
  96 + map.setCenter(pos[parseInt(pos.length / 2)]);
  97 + }/*,
91 removeLine: function(opts){ 98 removeLine: function(opts){
92 var polyline=polylines[opts.key]; 99 var polyline=polylines[opts.key];
93 if(polyline){ 100 if(polyline){
@@ -95,36 +102,41 @@ var gb_map_baidu = (function(){ @@ -95,36 +102,41 @@ var gb_map_baidu = (function(){
95 polylines[opts.key]=null; 102 polylines[opts.key]=null;
96 delete polylines[opts.key]; 103 delete polylines[opts.key];
97 } 104 }
98 - }, 105 + }*/,
99 //绘制GPS信号 106 //绘制GPS信号
100 drawRealGpsMarker: function(opts){ 107 drawRealGpsMarker: function(opts){
101 var gpsArray = opts.gpsList; 108 var gpsArray = opts.gpsList;
102 var marker, coord; 109 var marker, coord;
103 $.each(gpsArray, function(i, gps){ 110 $.each(gpsArray, function(i, gps){
104 - if(opts.coordTransform){  
105 - //坐标转换  
106 - coord = TransGPS.wgsToBD(gps.lat, gps.lon);  
107 - gps.bd_lat = coord.lat;  
108 - gps.bd_lon = coord.lng;  
109 - }  
110 -  
111 111
112 marker = realMarkers[gps.deviceId]; 112 marker = realMarkers[gps.deviceId];
113 - if(marker){  
114 - if(gps.timestamp == marker.gpsData.timestamp)  
115 - return;  
116 - else  
117 - moveMarker(marker, gps);//移动marker  
118 - } 113 + if(marker && gps.timestamp == marker.gpsData.timestamp)
  114 + return;
119 else{ 115 else{
120 - //创建marker  
121 - marker = createBDMarkerByGps(gps);  
122 - map.addOverlay(marker);  
123 - //设备号和marker映射  
124 - realMarkers[gps.deviceId] = marker; 116 + //转换坐标
  117 + transCoord(gps);
  118 +
  119 + if(marker)
  120 + moveMarker(marker, gps);//移动marker
  121 + else {
  122 + //创建marker
  123 + marker = createBDMarkerByGps(gps);
  124 + map.addOverlay(marker);
  125 + //设备号和marker映射
  126 + realMarkers[gps.deviceId] = marker;
  127 + }
125 } 128 }
126 }); 129 });
127 }, 130 },
  131 + showGpsMarker:function (opt) {
  132 + var chs = opt.chs;
  133 + for(var device in realMarkers){
  134 + if(chs[device])
  135 + realMarkers[device].show();
  136 + else
  137 + realMarkers[device].hide();
  138 + }
  139 + },
128 removeGps: function(opts){ 140 removeGps: function(opts){
129 var deviceArr = opts.deviceArr; 141 var deviceArr = opts.deviceArr;
130 $.each(deviceArr, function(){ 142 $.each(deviceArr, function(){
@@ -184,6 +196,12 @@ var gb_map_baidu = (function(){ @@ -184,6 +196,12 @@ var gb_map_baidu = (function(){
184 } 196 }
185 }; 197 };
186 198
  199 + function transCoord(gps) {
  200 + var coord = TransGPS.wgsToBD(gps.lat, gps.lon);
  201 + gps.bd_lat = coord.lat;
  202 + gps.bd_lon = coord.lng;
  203 + }
  204 +
187 var bd_gps_info_win_opts = { 205 var bd_gps_info_win_opts = {
188 width : 190, 206 width : 190,
189 height: 255, 207 height: 255,
@@ -257,14 +275,14 @@ var gb_map_baidu = (function(){ @@ -257,14 +275,14 @@ var gb_map_baidu = (function(){
257 function bdOpenWindow(marker){ 275 function bdOpenWindow(marker){
258 marker.gpsData.fromNow = moment(marker.gpsData.timestamp).fromNow(); 276 marker.gpsData.fromNow = moment(marker.gpsData.timestamp).fromNow();
259 277
260 - marker.infoWindow.setContent(template('map_gps_info_win_temp', marker.gpsData)); 278 + marker.infoWindow.setContent(gb_map_overlay_mge.map_gps_win_temp(marker.gpsData));
261 map.openInfoWindow(marker.infoWindow, marker.point); 279 map.openInfoWindow(marker.infoWindow, marker.point);
262 } 280 }
263 281
264 - function centerToPolyline(polyline){ 282 +/* function centerToPolyline(polyline){
265 var pos=polyline.getPath(); 283 var pos=polyline.getPath();
266 map.panTo(pos[parseInt(pos.length / 2)]); 284 map.panTo(pos[parseInt(pos.length / 2)]);
267 - } 285 + }*/
268 286
269 //文件载入完毕 287 //文件载入完毕
270 mapmonitor_load_ep.emitLater('load_baidu'); 288 mapmonitor_load_ep.emitLater('load_baidu');
src/main/resources/static/real_control_v2/mapmonitor/js/map_overlay_manager.js
1 -var gb_map_overlay_mge=(function () { 1 +var gb_map_overlay_mge = (function () {
2 2
  3 + var storage = window.localStorage;
3 4
4 - var gpsRefresh=function(addArr, upArr, upDownChange) {  
5 - //console.log('1111111', addArr, upArr, upDownChange); 5 + var temps;
  6 + $.get('/real_control_v2/mapmonitor/fragments/map_infowindow.html', function (dom) {
  7 + temps = gb_common.compileTempByDom(dom, {compress: true});
  8 + });
  9 +
  10 + var gpsRefresh = function (addArr, upArr, upDownChange) {
6 var all = addArr.concat(upArr).concat(upDownChange); 11 var all = addArr.concat(upArr).concat(upDownChange);
7 gpsRefreshAll(all); 12 gpsRefreshAll(all);
8 13
9 }; 14 };
10 15
11 - var gpsRefreshAll=function (all) {  
12 - gb_map_imap.call('drawRealGpsMarker', {gpsList: all, coordTransform: true}); 16 + var gpsRefreshAll = function (allList) {
  17 + gb_map_imap.call('drawRealGpsMarker', {gpsList: allList});
  18 + };
  19 +
  20 + var deviceFilter = function (node) {
  21 + return node.a_attr && node.a_attr.type=='device';
  22 + };
  23 +
  24 + //绘制线路走向
  25 + var drawAllSection=function () {
  26 + //绘制线路走向
  27 + var lines=JSON.parse(storage.getItem('lineControlItems'));
  28 + $.each(lines, function () {
  29 + //从storage里获取路由数据
  30 + var lineCode=this.lineCode;
  31 + var route = JSON.parse(storage.getItem(lineCode + '_route'));
  32 + //上行
  33 + gb_map_imap.call('drawLine', {
  34 + route: route,
  35 + style: {strokeWeight:6, strokeColor: 'blue'},
  36 + id: lineCode+'_0',
  37 + upDown: 0,
  38 + hide: true
  39 + });
  40 + //下行
  41 + gb_map_imap.call('drawLine', {
  42 + route: route,
  43 + style: {strokeWeight:6, strokeColor: 'red'},
  44 + id: lineCode+'_1',
  45 + upDown: 1,
  46 + hide: true
  47 + });
  48 +
  49 + });
  50 + };
  51 +
  52 + //根据选中项显示路段
  53 + var showSection = function (chs) {
  54 + var idx = {};
  55 + $.each(chs, function () {
  56 + idx[this.data.lineId+'_'+this.data.upDown]=1;
  57 + });
  58 +
  59 + gb_map_imap.call('refreshPolyline', {idx: gb_common.get_keys(idx)});
13 }; 60 };
14 61
15 - if(gb_data_gps){  
16 - //如果是嵌入线调,注册GPS刷新事件 62 + var init = function () {
  63 +
  64 + drawAllSection();
  65 + //初始绘制
  66 + gpsRefreshAll(gb_common.get_vals(gb_data_gps.allGps));
  67 +
  68 + showOverlayByChecks();
  69 + //显示路段
  70 + showSection(gb_map_gps_tree.getChecked().filter(deviceFilter));
  71 + //注册GPS刷新事件
17 gb_data_gps.registerCallback(gpsRefresh); 72 gb_data_gps.registerCallback(gpsRefresh);
18 - } 73 + };
  74 +
  75 +
  76 + var showOverlayByChecks = function () {
  77 + var chs = gb_map_gps_tree.getChecked().filter(deviceFilter),chsMap={};
  78 + $.each(chs, function () {
  79 + chsMap[this.a_attr.device]=true;
  80 + });
  81 +
  82 + gb_map_imap.call('showGpsMarker', {chs: chsMap});
19 83
20 - return {}; 84 + //路段
  85 + showSection(chs);
  86 +
  87 + };
  88 +
  89 + var _focus = function (deviceId) {
  90 + gb_map_imap.call('goToMarker', {deviceId: deviceId});
  91 + //打开信息窗口
  92 + gb_map_imap.call('openWindow',{deviceId: deviceId});
  93 + };
  94 + return {
  95 + init: init,
  96 + refresh: showOverlayByChecks,
  97 + _focus: _focus,
  98 + map_gps_win_temp: function (data) {
  99 + return temps['map-win-gps-detail-temp'](data);
  100 + }
  101 + };
21 })(); 102 })();
22 \ No newline at end of file 103 \ No newline at end of file
src/main/resources/static/real_control_v2/mapmonitor/js/real.js
@@ -5,56 +5,18 @@ var mapmonitor_load_ep = EventProxy.create(&#39;load_iMap&#39;, &#39;load_baidu&#39;, &#39;load_gaod @@ -5,56 +5,18 @@ var mapmonitor_load_ep = EventProxy.create(&#39;load_iMap&#39;, &#39;load_baidu&#39;, &#39;load_gaod
5 .addMap('gaode', '高德地图', gb_map_gaode) 5 .addMap('gaode', '高德地图', gb_map_gaode)
6 .call('init'); 6 .call('init');
7 7
8 - //设备树  
9 - var treeData = gb_common.get_device_tree_data();  
10 - _tree = $('.real_right_gps_panel .gps_tree_list')  
11 - .on('loaded.jstree', function () {  
12 - _tree.jstree(true).open_all();  
13 - //删掉tree node a标签的 href值(不然鼠标悬停浏览器会出现状态条)  
14 - $('.gps_tree_list .jstree-container-ul a.jstree-anchor').removeAttr('href');  
15 - })  
16 - .jstree({  
17 - 'core': {  
18 - 'data': treeData  
19 - },  
20 - 'checkbox': {  
21 - 'keep_selected_style': false,  
22 - 'whole_node': false,  
23 - 'tie_selection': false  
24 - },  
25 - 'contextmenu':{  
26 - 'items': {  
27 - '轨迹回放':{  
28 - 'label': '轨迹回放',  
29 - 'action': function (data) {  
30 - console.log('action', data);  
31 - }  
32 - },  
33 - '发送指令':{  
34 - 'label': '发送指令',  
35 - 'action': function (data) {  
36 - console.log('action', data);  
37 - }  
38 - }  
39 - }  
40 - },  
41 - 'plugins': ['checkbox', 'contextmenu', 'state']  
42 - }); 8 + //init config form
  9 + gb_map_config.init();
  10 +
  11 + //init tree
  12 + gb_map_gps_tree.init(gb_map_overlay_mge.init);
43 13
44 $(".real_bottom_panel").resizable({ 14 $(".real_bottom_panel").resizable({
45 handles: { 15 handles: {
46 'n': '.real_bottom_panel #handle' 16 'n': '.real_bottom_panel #handle'
47 }, 17 },
48 maxHeight: 650, 18 maxHeight: 650,
49 - minHeight: 70  
50 - });  
51 -  
52 - $(".color_block").spectrum({  
53 - color: "#f00",  
54 - showInput: true,  
55 - chooseText: "确定",  
56 - cancelText: "取消",  
57 - preferredFormat: "hex" 19 + minHeight: 18
58 }); 20 });
59 }); 21 });
60 22
@@ -63,9 +25,7 @@ var gb_map_consts = { @@ -63,9 +25,7 @@ var gb_map_consts = {
63 center_point: { 25 center_point: {
64 lng: 121.544336, 26 lng: 121.544336,
65 lat: 31.221315 27 lat: 31.221315
66 - },  
67 - allGps: {},  
68 - trafficBtn: '' //实时路况按钮 28 + }
69 }; 29 };
70 30
71 //Canvas 带圆角的矩形 31 //Canvas 带圆角的矩形
src/main/resources/static/real_control_v2/mapmonitor/real.html
1 <link href="/assets/css/TrafficControl.css" rel="stylesheet"/> 1 <link href="/assets/css/TrafficControl.css" rel="stylesheet"/>
2 <link rel="stylesheet" href="/real_control_v2/assets/plugins/jquery.ui/themes/base/all.css"/> 2 <link rel="stylesheet" href="/real_control_v2/assets/plugins/jquery.ui/themes/base/all.css"/>
3 <link rel="stylesheet" href="/real_control_v2/assets/plugins/spectrum/spectrum.css"/> 3 <link rel="stylesheet" href="/real_control_v2/assets/plugins/spectrum/spectrum.css"/>
4 -  
5 <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/form-advanced.gradient.min.css"/> 4 <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/form-advanced.gradient.min.css"/>
6 <link rel="stylesheet" href="/real_control_v2/mapmonitor/css/real.css"/> 5 <link rel="stylesheet" href="/real_control_v2/mapmonitor/css/real.css"/>
7 6
8 <div class="map-system-msg"> 7 <div class="map-system-msg">
9 - <a class="z-depth-2" href="/pages/mapmonitor/alone/wrap.html" target="_blank">当前地图模块正在维护升级,点这里打开原版地图。</a> 8 + <a class="z-depth-2" href="/pages/mapmonitor/alone/wrap.html" target="_blank"><i style="transform: rotate(90deg);" class="uk-icon-hand-pointer-o"></i> 当前地图模块正在维护升级中,请点这里打开原版地图。</a>
10 </div> 9 </div>
11 10
12 <div id="real_map_container"></div> 11 <div id="real_map_container"></div>
@@ -26,104 +25,22 @@ @@ -26,104 +25,22 @@
26 <div class="real_bl_cont"> 25 <div class="real_bl_cont">
27 26
28 </div> 27 </div>
29 - <div class="real_br_cont">  
30 - <form class="uk-form uk-form-stacked">  
31 - <div class="uk-form-row">  
32 - <span class="uk-form-label">图层</span>  
33 - <div class="uk-form-controls">  
34 - <label><input type="radio" name="map_type" checked> 百度</label>  
35 - <label><input type="radio" name="map_type"> 高德</label>  
36 - <label><input type="checkbox" name="map_type"> 实时路况</label>  
37 - </div>  
38 - </div>  
39 -  
40 - <div class="uk-form-row">  
41 - <span class="uk-form-label">空间数据</span>  
42 - <div class="uk-form-controls">  
43 - <label><input type="checkbox" checked> 站点</label>  
44 - <label><input type="checkbox" > 电子围栏</label>  
45 - <label><input type="checkbox" > 停车场</label>  
46 - </div>  
47 - </div>  
48 -  
49 - <div class="uk-form-row">  
50 - <span class="uk-form-label">异常警报输出</span>  
51 - <div class="uk-form-controls">  
52 - <label><input type="checkbox" checked> 超速</label>  
53 - <label><input type="checkbox" checked> 越界</label>  
54 - <label><input type="checkbox" > 大间隔</label>  
55 - </div>  
56 - </div>  
57 -  
58 - <div class="uk-form-row">  
59 - <span class="uk-form-label">车辆图标</span>  
60 - <div class="uk-form-controls">  
61 - <label><input type="checkbox" > 标示角度</label>  
62 - <label><input type="checkbox" > 聚合</label>  
63 - </div>  
64 - </div>  
65 -  
66 - <div class="uk-form-row">  
67 - <span class="uk-form-label">车辆颜色</span>  
68 - <div class="uk-form-controls">  
69 - <div class="color_block">  
70 - 上行  
71 - <div class="sp-placeholder">  
72 - <div class="sp-placeholder-color" ></div>  
73 - </div>  
74 - </div>  
75 -  
76 - <div class="color_block">  
77 - 下行  
78 - <div class="sp-placeholder">  
79 - <div class="sp-placeholder-color" ></div>  
80 - </div>  
81 - </div>  
82 -  
83 - <div class="color_block">  
84 - 非营运  
85 - <div class="sp-placeholder">  
86 - <div class="sp-placeholder-color" ></div>  
87 - </div>  
88 - </div>  
89 - </div>  
90 - </div>  
91 -  
92 - <div class="uk-form-row">  
93 - <span class="uk-form-label">路段颜色</span>  
94 - <div class="uk-form-controls">  
95 - <div class="color_block">  
96 - 上行  
97 - <div class="sp-placeholder">  
98 - <div class="sp-placeholder-color" ></div>  
99 - </div>  
100 - </div>  
101 -  
102 - <div class="color_block">  
103 - 下行  
104 - <div class="sp-placeholder">  
105 - <div class="sp-placeholder-color" ></div>  
106 - </div>  
107 - </div>  
108 - </div>  
109 - </div>  
110 -  
111 - <br>  
112 - </form> 28 + <div class="real_br_cont map_config_wrap">
113 </div> 29 </div>
114 </div> 30 </div>
115 31
  32 +
  33 +<script src="/real_control_v2/mapmonitor/js/config.js"></script>
  34 +<script src="/real_control_v2/mapmonitor/js/gps_tree.js"></script>
116 <script src="/real_control_v2/mapmonitor/js/map_overlay_manager.js"></script> 35 <script src="/real_control_v2/mapmonitor/js/map_overlay_manager.js"></script>
117 <script src="/real_control_v2/mapmonitor/js/real.js"></script> 36 <script src="/real_control_v2/mapmonitor/js/real.js"></script>
118 <script src="/real_control_v2/mapmonitor/js/map/iMap.js"></script> 37 <script src="/real_control_v2/mapmonitor/js/map/iMap.js"></script>
119 <script src="/real_control_v2/mapmonitor/js/map/platform/baidu.js"></script> 38 <script src="/real_control_v2/mapmonitor/js/map/platform/baidu.js"></script>
120 <script src="/real_control_v2/mapmonitor/js/map/platform/gaode.js"></script> 39 <script src="/real_control_v2/mapmonitor/js/map/platform/gaode.js"></script>
121 -  
122 <!-- jquery ui --> 40 <!-- jquery ui -->
123 <script src="/real_control_v2/assets/plugins/jquery.ui/core.js"></script> 41 <script src="/real_control_v2/assets/plugins/jquery.ui/core.js"></script>
124 <script src="/real_control_v2/assets/plugins/jquery.ui/widget.js"></script> 42 <script src="/real_control_v2/assets/plugins/jquery.ui/widget.js"></script>
125 <script src="/real_control_v2/assets/plugins/jquery.ui/mouse.js"></script> 43 <script src="/real_control_v2/assets/plugins/jquery.ui/mouse.js"></script>
126 <script src="/real_control_v2/assets/plugins/jquery.ui/resizable.js"></script> 44 <script src="/real_control_v2/assets/plugins/jquery.ui/resizable.js"></script>
127 -  
128 - 45 +<!-- 颜色选择器 -->
129 <script src="/real_control_v2/assets/plugins/spectrum/spectrum.js"></script> 46 <script src="/real_control_v2/assets/plugins/spectrum/spectrum.js"></script>
130 \ No newline at end of file 47 \ No newline at end of file