speedingList.html
9.01 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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
<div class="page-head">
<div class="page-title">
<h1>超速异常</h1>
</div>
</div>
<ul class="page-breadcrumb breadcrumb">
<li><a href="/pages/home.html" data-pjax>主页</a> <i class="fa fa-circle"></i></li>
<li><span class="active">异常查看</span> <i class="fa fa-circle"></i></li>
<li><span class="active">超速异常</span></li>
</ul>
<div class="row">
<div class="col-md-12">
<!-- Begin: life time stats -->
<div class="portlet light portlet-fit portlet-datatable bordered">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-times-circle"></i> <span
class="caption-subject font-dark sbold uppercase">超速异常数据表</span>
</div>
<div class="actions">
<!-- <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加用户</a> -->
<!-- <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> ɾ���û�</button> -->
<!-- <div class="btn-group">
<a class="btn red btn-outline btn-circle" href="javascript:;"
data-toggle="dropdown"> <i class="fa fa-share"></i> <span
class="hidden-xs"> 系统工具</span> <i class="fa fa-angle-down"></i>
</a>
<ul class="dropdown-menu pull-right" id="datatable_ajax_tools">
<li><a href="javascript:;" data-action="0"
class="tool-action"> <i class="fa fa-print"></i>打印
</a></li>
<li><a href="javascript:;" data-action="1"
class="tool-action"> <i class="fa fa-copy"></i> 复制
</a></li>
<li><a href="javascript:;" data-action="3"
class="tool-action"> <i class="fa fa-file-excel-o"></i>
导出Excel
</a></li>
<li class="divider"></li>
<li><a href="javascript:;" data-action="5"
class="tool-action"> <i class="fa fa-refresh"></i> 刷新数据
</a></li>
</ul>
</div> -->
</div>
</div>
<div class="portlet-body">
<div class="table-container" style="margin-top: 10px">
<table
class="table table-striped table-bordered table-hover table-checkable"
id="datatable_speeding">
<thead>
<tr role="row" class="heading">
<th width="3%">#</th>
<th width="15%">线路</th>
<th width="13%">内部编码</th>
<th width="100">经度</th>
<th width="11%">纬度</th>
<th width="10%">上下行</th>
<th width="18%">时间</th>
<th width="18%">操作</th>
</tr>
<tr role="row" class="filter">
<td></td>
<td>
<!-- <input type="text" class="form-control form-filter input-sm" name="userName_like"> -->
<select class="form-control" name="line" id="line" style="width: 180px;"></select>
</td>
<td>
<input type="text" class="form-control form-filter input-sm" name="nbbm">
</td>
<td>
</td>
<td></td>
<td>
<select class="form-control form-filter " name="updown">
<option value="">请选择...</option>
<option value="0">上行</option>
<option value="1">下行</option>
<option value="-1">无效</option>
</select>
</td>
<td></td>
<td>
<button class="btn btn-sm green btn-outline filter-submit margin-bottom" >
<i class="fa fa-search"></i> 搜索</button>
<button class="btn btn-sm red btn-outline filter-cancel">
<i class="fa fa-times"></i> 重置</button>
</td>
</tr>
</thead>
<tbody></tbody>
</table>
<div style="text-align: right;">
<ul id="pagination" class="pagination"></ul>
</div>
</div>
</div>
</div>
</div>
</div>
<script id="speeding_list_temp" type="text/html">
{{each list as obj i}}
<tr>
<td style="vertical-align: middle;">
<input type="checkbox" class="group-checkable icheck" data-id="{{obj.id}}">
</td>
<td>
{{obj.lineName}}
</td>
<td>
{{obj.vehicle}}
</td>
<td>
{{obj.lon}}
</td>
<td>
{{obj.lat}}
</td>
<td>
{{if obj.upDown==0}}
上行
{{else if obj.upDown==1}}
下行
{{else}}
无效
{{/if}}
</td>
<td>
{{obj.timestampDate}}
</td>
<td>
</td>
</tr>
{{/each}}
{{if list.length == 0}}
<tr>
<td colspan=8><h6 class="muted">没有找到相关数据</h6></td>
</tr>
{{/if}}
</script>
<script>
$(function(){
var page = 0, initPagination;
var icheckOptions = {
checkboxClass: 'icheckbox_flat-blue',
increaseArea: '20%'
}
jsDoQuery(null,true);
//重置
$('tr.filter .filter-cancel').on('click', function(){
$('tr.filter input, select').val('').change();
jsDoQuery(null, true);
});
//提交
$('tr.filter .filter-submit').on('click', function(){
var cells = $('tr.filter')[0].cells
,params = {}
,name;
$.each(cells, function(i, cell){
var items = $('input,select', cell);
for(var j = 0, item; item = items[j++];){
name = $(item).attr('name');
if(name){
params[name] = $(item).val();
}
}
});
page = 0;
jsDoQuery(params, true);
});
/*
* 获取数据 p: 要提交的参数, pagination: 是否重新分页
*/
function jsDoQuery(p, pagination){
var params = {};
if(p)
params = p;
//更新时间排序
params['order'] = 'lastLoginDate';
params['page'] = page;
var i = layer.load(2);
$get('/speeding/pagequery' ,params, function(data){
// $.each(data.content, function(i, obj) {
// obj.lastLoginDate = moment(obj.lastLoginDate).format("YYYY-MM-DD HH:mm:ss");
// });
var bodyHtm = template('speeding_list_temp', {list: data.dataList});
$('#datatable_speeding tbody').html(bodyHtm)
.find('.icheck').iCheck(icheckOptions)
.on('ifChanged', iCheckChange);
if(pagination && data.dataList.length > 0){
//重新分页
initPagination = true;
showPagination(data);
}
layer.close(i);
});
}
function iCheckChange(){
var tr = $(this).parents('tr');
if(this.checked)
tr.addClass('row-active');
else
tr.removeClass('row-active');
if($('#datatable_resource input.icheck:checked').length == 1)
$('#removeButton').removeAttr('disabled');
else
$('#removeButton').attr('disabled', 'disabled');
}
function showPagination(data){
//分页
$('#pagination').jqPaginator({
totalPages: data.totalPage,
visiblePages: 6,
currentPage: page + 1,
first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>',
next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>',
last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>',
page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
onPageChange: function (num, type) {
if(initPagination){
initPagination = false;
return;
}
page = num - 1;
jsDoQuery(null, false);
}
});
}
//删除
$('#removeButton').on('click', function(){
if($(this).attr('disabled'))
return;
var id = $('#datatable_resource input.icheck:checked').data('id');
removeConfirm('确定要删除选中的数据?', '/resource/' + id ,function(){
$('tr.filter .filter-submit').click();
});
});
//搜索线路
$('#line').select2({
ajax: {
url: '/realSchedule/findLine',
type: 'post',
dataType: 'json',
delay: 150,
data: function(params){
return{line: params.term};
},
processResults: function (data) {
return {
results: data
};
},
cache: true
},
templateResult: function(repo){
if (repo.loading) return repo.text;
var h = '<span>'+repo.text+'</span>';
return h;
},
escapeMarkup: function (markup) { return markup; },
minimumInputLength: 1,
templateSelection: function(repo){
return repo.text;
},
language: {
noResults: function(){
return '<span style="color:red;font-size: 12px;">没有搜索到线路!</span>';
},
inputTooShort : function(e) {
return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入线路搜索线路</span>';
},
searching : function() {
return '<span style="color:gray;font-size: 12px;"> 正在搜索线路...</span>';
}
}
});
});
//改变状态
function changeEnabled(id,enabled){
debugger
$get('/user/changeEnabled',{id:id,enabled:enabled},function(result){
jsDoQuery(null, true);
})
}
</script>