main.html
9.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
<div class="container-fluid page" id="real_gps_data_page">
<div class="card">
<div class="card-body" style="height: 100%">
<div class="top_form_card">
<form onsubmit="return false;">
<div class="row">
<div class="col-md-7" style="padding-right: 0;">
<div class="form-group">
<label class="bmd-label-floating">选择线路</label>
<div class="ct_auto_wrap line_autocompleter">
<input type="text" class="form-control">
</div>
</div>
</div>
<div class="col-md-3" style="padding: 0;">
<div class="form-group top_radio_wrap">
<div class="radio">
<label>
<input type="radio" name="upDownRadios" value=0 checked>
上行
</label>
<label>
<input type="radio" name="upDownRadios" value=1>
下行
</label>
</div>
</div>
</div>
<div class="col-md-2" style="padding-left: 0;">
<div class="form-group top_radio_wrap">
<div class="checkbox">
<label>
<input type="checkbox" name="mapCheckbox"> 地图
</label>
</div>
</div>
</div>
</div>
</form>
</div>
<div class="c_cont">
<div class="row">
<div class="svg_charts">
<svg></svg>
</div>
<div class="gps_tables">
<div class="table_wrap" style="height: 100%;">
<div class="table-responsive">
<table class="table table-hover" style="margin-bottom: 0;">
<thead class="">
<th>自编号</th>
<th>设备号</th>
<th>当前站点</th>
<th>越界</th>
<th>距离下站</th>
<th>下站时间</th>
<th>终点时间</th>
<th>任务</th>
</thead>
</table>
<div class="data_list" style="height: calc(100% - 50px);position: relative;">
<table class="table table-hover">
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<div class="map_wrap">
<div class="map_cont"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script id="real_gps_table_list-temp" type="text/html">
{{each list as gps i}}
<tr data-id="{{gps.deviceId}}">
<td>{{gps.nbbm}}</td>
<td>{{gps.deviceId}}</td>
<td>{{gps.inOut}}#{{gps.stationName}}</td>
<td>{{gps.overstepDistance}}</td>
<td>
{{if gps.release}}
{{gps.distance}}
{{/if}}
</td>
<td>
{{if gps.release}}
{{gps.secStr2==null?gps.secStr:gps.secStr2}}
{{/if}}
</td>
<td>{{gps.zdsj}}</td>
<td>
{{if gps.sch}}
{{gps.sch.dfsj}}#
{{if gps.sch.bcType=='normal'}}
全程
{{else if gps.sch.bcType=='out'}}
出场
{{else if gps.sch.bcType=='in'}}
进场
{{else if gps.sch.bcType=='region'}}
区间
{{else if gps.sch.bcType=='venting'}}
直放
{{else if gps.sch.bcType=='major'}}
放站
{{else if gps.sch.bcType=='ldks'}}
两点间空驶
{{/if}}
{{/if}}
</td>
</tr>
{{/each}}
</script>
<script id="gps_map_info_win-temp" type="text/html">
<div class="gps_info_win" style="width: 200px;">
<h4>{{nbbm}}</h4>
<h5>
{{if stationName!=null}}
{{stationName}} 站
{{else}}
未知站点
{{/if}}
</h5>
<p>设备号:{{deviceId}}</p>
<p>速度:{{speed}}</p>
<p>经度:{{lon}}</p>
<p>纬度:{{lat}}</p>
<p>距离下一站 {{distance}} 米</p>
<hr>
{{if secStr!=null}}
<a href="javascript:;">预计 {{secStr2==null?secStr:secStr2}} 分钟到达下一站</a>
{{/if}}
{{if zdsj!=null}}
<a href="javascript:;">预计 {{zdsj}} 分钟到达终点</a>
{{/if}}
<hr>
<a style="color: grey">{{timeStr}}</a>
</div>
</script>
<script src="/pages/geo_data/js/map_utils.js"></script>
<script src="/pages/geo_data/js/TransGPS.js"></script>
<script src="/pages/real/js/svg.js"></script>
<script src="/pages/real/js/map.js"></script>
<script>
(function () {
var wrap = '#real_gps_data_page';
var _lineCode;
var _upDown = 0;
var _stations;
//线路自动补全
$.get('/basic/lines', function (rs) {
var data = [], item;
for (var i = 0, len = rs.length; i < len; i++) {
item = rs[i];
data.push({
code: item.lineCode,
text: item.name,
others: [item.fullChars, item.camelChars]
});
}
gb_ct_autocompleter.build($('.line_autocompleter', wrap), data);
});
//线路选择事件
$('.line_autocompleter input', wrap).on('auto_change', function () {
_lineCode = $(this).data('val');
reLoad();
});
//切换上下行
$('[name=upDownRadios]', wrap).on('click', function () {
_upDown = parseInt($('input[name="upDownRadios"]:checked').val());
reLoad();
});
var reLoad = function () {
gb_real_gps_svg.showSvg(_lineCode, _upDown, function (rs) {
_stations = rs;
//定时刷新 gps
gb_real_gps_svg.start_gps();
if ($('.map_wrap', wrap).is(":visible"))
gb_real_gps_map.init(_lineCode, _upDown, _stations);
});
}
//显示地图
$('[name=mapCheckbox]', wrap).on('click', function () {
var $mm = $('.map_wrap', wrap)
, $that = $(this).attr('disabled', 'disabled');
if (this.checked) {
$mm.show().animateCss('fadeIn', function () {
$('.data_list', wrap).hide();
$mm.removeClass('fadeIn');
$that.removeAttr('disabled');
});
gb_real_gps_map.init(_lineCode, _upDown, _stations);
}
else {
$('.data_list', wrap).show();
$mm.animateCss('fadeOut', function () {
$mm.hide().removeClass('fadeOut').find('.map_cont').empty();
$that.removeAttr('disabled');
});
}
});
/**
* 表格点击
*/
$('.data_list', wrap).on('click', 'table tr', function () {
var device = $(this).data('id');
var rect = $('.svg_charts svg rect[_id=rct_' + device + ']', wrap);
if (rect.attr('y') == -100)
gb_utils.showNotification('', '模拟图上同站最多显示3个车子', 'warning');
if (rect.attr('y') == -300)
gb_utils.showNotification('', '车子不在线路上!!', 'warning');
var cont = $('.svg_charts', wrap);
cont.animate({
scrollTop: rect.offset().top - cont.offset().top + cont.scrollTop() - 5
});
rect.addClass('twinkle').one(animationEnd, function () {
$(this).removeClass('twinkle');
});
});
/**
* 点击rect
*/
$('.svg_charts svg').on('click', 'g.gps-wrap>rect', function () {
var device = $(this).attr('_id').split('_')[1];
gb_real_gps_map.focus(device);
});
})();
</script>