station_tabledate.html
8 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
307
<!-- 新增站点选择系统引用 -->
<div class="modal fade" id="station_tableDate_mobal" tabindex="-1" role="basic" aria-hidden="true">
<div class="modal-dialog" style="width:800px;">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
<h4 class="modal-title">系统引用</h4>
</div>
<div class="modal-body">
<div class="portlet-body">
<div class="table-container" style="margin-top: 10px">
<table class="table table-striped table-bordered table-hover table-checkable" id="station_select_tabledate">
<thead>
<tr role="row" class="heading">
<th width="3%">#</th>
<th width="15%">站点名称</th>
<th width="17%">站点编码</th>
<th width="12%">经纬度</th>
<th width="12%">图形类型</th>
<th width="30%">操作</th>
</tr>
<tr role="row" class="filter">
<td></td>
<td>
<input type="text" class="form-control form-filter input-sm" id="stationName_eq" name="stationName_eq">
</td>
<td>
<input type="text" class="form-control form-filter input-sm" id="stationCod_like" name="stationCod_like">
</td>
<td>
</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 class="modal-footer">
<button type="button" class="btn default" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" id="stationTabledatenextButton">确定</button>
</div>
</div>
</div>
</div>
<script type="text/html" id="station_tabledate_temp">
{{each list as obj i }}
<tr>
<td style="vertical-align: middle;">
<input type="checkbox" class="group-checkable icheck" data-id="{{obj.id}}" data-stationName="{{obj.stationName}}" data-stationCod="{{obj.stationCod}}">
</td>
<td>
{{obj.stationName}}
</td>
<td>
{{obj.stationCod}}
</td>
<td>
{{obj.bJwpoints}}
</td>
<td>
{{obj.shapesType}}
</td>
<td>
</td>
</tr>
{{/each}}
{{if list.length == 0}}
<tr>
<td colspan=8><h6 class="muted">没有找到相关数据</h6></td>
</tr>
{{/if}}
</script>
<script type="text/javascript">
$(function(){
// 延迟加载
setTimeout(function(){
$('#station_tableDate_mobal').modal({
show : true,
width : 'auto',
backdrop: 'static',
keyboard: false
});
},200);
// 选择确定事件
$('#stationTabledatenextButton').on('click',function() {
// 获取选中行元素
var arrChk = $("input[type='checkbox']:checked");
if(arrChk.length==0) {
// 弹出框 (0:感叹号;1:对号;2:错号;3:问号;4:锁;5:苦脸;6:笑脸)
layer.confirm('【请选择一行...】', {btn : [ '确定' ],icon: 0, title:'温馨提示'}, function(index) {
// 关闭提示框
layer.close(index);
});
}else if(arrChk.length>1){
// 弹出框 (0:感叹号;1:对号;2:错号;3:问号;4:锁;5:苦脸;6:笑脸)
layer.confirm('【请只选择一行...】', {btn : [ '确定' ],icon: 0, title:'温馨提示'}, function(index) {
// 关闭提示框
layer.close(index);
});
}else {
var stationId = arrChk.data('id');
$post('/stationroute/systemQuote',{lineId:id,stationId:stationId},function() {
});
console.log();
}
});
var stationNamebootbox = $('#stationNamebootbox').val();
$('#stationName_eq').val(stationNamebootbox);
/**
* -----page : 当前页
*
* -----initPag :
*
*/
var page = 0,initPag;
// 选择框
var icheckOptions = {
checkboxClass: 'icheckbox_flat-blue',
increaseArea: '20%'
};
// 表格数据分页加载
loadTableDate({stationName_eq:stationNamebootbox},true);
/**
* 重置按钮事件
*
*/
$('tr.filter .filter-cancel').on('click',function(){
// 清空搜索框值
$('tr.filter input,select').val('').change();
// 重新加载表格数据
loadTableDate(null,true);
});
/**
* 搜索按钮事件
*
*/
$('tr.filter .filter-submit').on('click',function(){
// cells 集合返回表格中所有(列)单元格的一个数组
var cells = $('tr.filter')[0].cells;
// 搜索参数集合
var params = {};
// 搜索字段名称
var name;
// 遍历cells数组
$.each(cells, function(i, cell){
// 获取第i列的input或者select集合
var items = $('input,select', cell);
// 遍历items集合
for(var j = 0, item; item = items[j++];){
// 获取字段名称
name = $(item).attr('name');
if(name){
// 赋取相对应的值
params[name] = $(item).val();
}
}
});
page = 0;
loadTableDate(params,true);
});
/**
* 表格数据分页加载事件
*
* ------@param : 查询参数
*
* ------@isPon : 是否重新分页
*
*/
function loadTableDate(param,isPon){
// 搜索参数
var params = {};
if(param)
params = param;
// 排序(按更新时间)
params['order'] = 'id';
// 记录当前页数
params['page'] = page;
// 弹出正在加载层
var i = layer.load(2);
// 异步请求获取表格数据
$.get('/station',params,function(result){
console.log(result);
// 把数据填充到模版中
var tbodyHtml = template('station_tabledate_temp',{list:result.content});
// 把渲染好的模版html文本追加到表格中
$('#station_select_tabledate tbody').html(tbodyHtml);
// 制定复选框
$('#station_select_tabledate tbody').find('.icheck').iCheck(icheckOptions);
// 复选框改变事件
$('#station_select_tabledate tbody').find('.icheck').on('ifChanged', iCheckChange);
// 是重新分页且返回数据长度大于0
if(isPon && result.content.length > 0){
// 重新分页
initPag = true;
// 分页栏
showPagination(result);
}
// 关闭弹出加载层
layer.close(i);
});
}
/**
* 复选框组件
*
*/
function iCheckChange(){
// 获取当前的父节点tr
var tr = $(this).parents('tr');
// 判断当前是否选中
if(this.checked)
// 选中,则增添父节点tr的样式
tr.addClass('row-active');
else
// 未选中,则删除父节点tr的样式
tr.removeClass('row-active');
}
/**
* 分页栏组件
*
*/
function showPagination(data){
// 分页组件
$('#pagination').jqPaginator({
// 总页数
totalPages: data.totalPages,
// 中间显示页数
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(initPag){
initPag = false;
return;
}
page = num - 1;
loadTableDate(null, false);
}
});
}
});
</script>