recover_stationroute.html
6.95 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
<!-- 编辑路段 -->
<div class="modal fade" id="recover_station_modal" role="basic"
aria-hidden="true">
<div style="margin:5% auto">
<div class="modal-content">
<div class="col-md-12">
<div class="portlet light porttlet-fit bordered">
<div class="portlet-title">
<div class="tipso-animation">
</div>
<div class="caption">
<i class="fa fa-info-circle font-dark"></i>
<span class="caption-subject font-dark sbold uppercase">站点信息</span>
</div>
<div class="actions">
<div class="btn-group btn-group-devided" data-toggle="buttons">
<button type="button" class="btn btn-primary" id="batchDeleteStationButton">批量恢复站点</button>
<button type="button" class="btn default" data-dismiss="modal">取消</button>
</div>
</div>
</div>
<div class="portlet-body">
<div class="table-container" style="margin-top: 10px">
<from class="form-horizontal" role="form" id="batch_delete_station_form">
<table class="table table-striped table-bordered table-hover table-checkable" id="stationroute_datatable">
<thead>
<tr role="row" class="heading">
<th width="2%"><input type="checkbox" name="checkItems"
id="stationCheckItems"></input></th>
<th width="2%">序号</th>
<th width="5%">站点路由编号</th>
<th width="5%">线路编号</th>
<th width="8%">线路名称</th>
<th width="5%">线路方向</th>
<th width="8%">站点路由名称</th>
<th width="4%">站点编码</th>
<th width="4%">站点序号</th>
<th width="4%">站点类型</th>
<th width="6%">站点距离(km)</th>
<th width="6%">站点时长(min)</th>
<th width="4%">版本号</th>
</tr>
</thead>
<tbody></tbody>
</table>
</from>
<div class="actions">
<div style="text-align: right">
<ul id="pagination" class="pagination"></ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/html" id="stationroute_datatable_template">
{{each list as obj i }}
<tr>
<td style="vertical-align: middle;">
<input type="checkbox" class="group-checkable icheck" name="items" value="{{obj.id}}" id="{{obj.id}}" >
</td>
<td style="vertical-align: middle;">
{{(list.page*10)+(i+1)}}
</td>
<td style="vertical-align: middle;">
{{obj.id}}
</td>
<td>
{{obj.lineCode}}
</td>
<td>
{{obj.line.name}}
</td>
<td>
{{if obj.directions == '0'}}
上行
{{else if obj.directions == '1'}}
下行
{{/if}}
</td>
<td>
{{obj.stationName}}
</td>
<td>
{{obj.stationCode}}
</td>
<td>
{{obj.stationRouteCode}}
</td>
<td>
{{if obj.stationMark == 'B'}}
起始站
{{else if obj.stationMark == 'Z'}}
中途站
{{else if obj.stationMark== 'E'}}
终点站
{{/if}}
</td>
<td>
{{obj.distances}}
</td>
<td>
{{obj.toTime}}
</td>
<td>
{{obj.versions}}
</td>
</tr>
{{/each}}
{{if list.length == 0}}
<tr>
<td colspan=13><h6 class="muted">没有找到相关数据</h6></td>
</tr>
{{/if}}
</script>
<script type="text/javascript">
$('#recover_station_modal').on('modal.show',function(event) {
var properties = RoutesOperation.getProperties();
layer.closeAll();
// 显示mobal
$('#recover_station_modal').modal({
show : true,
backdrop : 'static',
keyboard : false
});
// 提交数据按钮事件
$('#batchDeleteStationButton').on('click', function() {
let checked = $("[name=items]:checked");
let ids = new Array();
checked.each(function() {
ids.push($(this).val());
});
if (ids.length > 0) {
let params = {};
params.ids = ids;
params.status = properties.status;
$.post('/api/lsstationroute/batchRecover',params,function(res) {
if (res.status == 'SUCCESS') {
layer.msg('恢复成功...');
} else {
layer.msg('恢复失败...');
}
initSearch();
// 刷新左边树
RoutesOperation.resjtreeDate(properties.lineId, properties.directions, properties.versions);
});
} else {
layer.msg('请选择要恢复的站点!!!');
}
});
/** 全选框 */
$('#stationCheckItems').on('click', function() {
$('input[name=items]').prop('checked', $(this).prop("checked"));
});
/** 页面加载完显示数据 */
window.onload = initSearch();
/**
* @description : (TODO) 页面加载事件
*
*/
var page = 0;
function initSearch() {
var params = new getParams();
page = 0;
loadTableDate(params, true);
}
function getParams() {
var params = {};
params['line.id_eq'] = properties.lineId;
params.directions_eq = properties.directions;
params.versions_eq = properties.versions;
params.destroy_eq = 1;
return params;
}
/**
* @description : (TODO) 表格数据分页加载事件
*
* ------@param : 查询参数
*
* ------@isPon : 是否重新分页
*
*/
function loadTableDate(param, isPon) {
// 初始化全选按钮
$('#stationCheckItems').prop('checked', false);
// 搜索参数
var params = {};
if (param)
params = param;
// 排序(按方向与序号)
params['order'] = 'directions,stationRouteCode';
// 排序方向.
params['direction'] = 'ASC,ASC';
// 记录当前页数
params['page'] = page;
// 弹出正在加载层
var i = layer.load(2);
// 异步请求获取表格数据
$.get('/api/lsstationroute/findPageByParams', params, function(result) {
// 添加序号
if (!result.content) {
result.content = new Array();
}
result.content.page = page;
// 把数据填充到模版中
var tbodyHtml = template('stationroute_datatable_template',{list : result.content});
// 把渲染好的模版html文本追加到表格中
$('#stationroute_datatable tbody').html(tbodyHtml);
// 是重新分页且返回数据长度大于0
if (isPon && result.content.length > 0) {
// 重新分页
initPag = true;
// 分页栏
showPagination(result);
}
// 关闭弹出加载层
layer.close(i);
});
}
/**
* @description : (TODO) 分页栏组件
*
*/
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;
}
var pData = getParams();
page = num - 1;
loadTableDate(pData, false);
}
});
}
});
</script>