deletestation.html
8.4 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
<!-- 编辑路段 -->
<div class="modal fade" id="delete_station_mobal" 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">Station List</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">Cancel</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="datatable_station_detele">
<thead>
<tr role="row" class="heading">
<th width="2%"><input type="checkbox" name="checkItems"
id="stationCheckItems"></input></th>
<th width="2%">Serial number</th>
<th width="5%">站点路由编号</th>
<th width="5%">Line code</th>
<th width="8%">Line name</th>
<th width="5%">Direction</th>
<th width="8%">Station name</th>
<th width="4%">Station code</th>
<th width="4%">Station seq</th>
<th width="4%">Station type</th>
<th width="6%">Station distance(km)</th>
<th width="6%">Station duration(min)</th>
<th width="4%">Version</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="stationInfo_list_table_temp_detele">
{{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'}}
Starting station
{{else if obj.stationMark == 'Z'}}
Intermediate station
{{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">No data</h6></td>
</tr>
{{/if}}
</script>
<script type="text/javascript">
$('#delete_station_mobal').on('deleteStationMobal.show',function(e, ajaxd, line, fun, delBatch) {
layer.closeAll();
// 显示mobal
$('#delete_station_mobal').modal({
show : true,
backdrop : 'static',
keyboard : false
});
// 编辑表单元素
var form = $('#batch_delete_station_form');
// 提交数据按钮事件
$('#batchDeleteStationButton').on('click', function() {
var checked = $("[name=items]:checked");
var ids = "";
checked.each(function() {
ids = ids + "," + $(this).val();
//ids.push($(this).val());
});
if (ids != "" && ids != null && ids != undefined) {
console.log("ids:" + ids);
ids = ids.substr(1, ids.length - 1);
var params = {};
params.ids = ids;
params.status = $($("#versions").find("option:selected")[0]).attr("status");
$.post('/stationroute/batchDestroy',params,function(resuntDate) {
if (resuntDate.status == 'SUCCESS') {
// 弹出添加成功提示消息
layer.msg('Operation success...');
/** 通知更新缓存区 */
//$.post('http://192.168.168.171:8800/transport_server/basic/refresh',function(rs) {console.log(rs)})
} else {
// 弹出添加失败提示消息
layer.msg('Operation failed...');
}
initSearch();
// 刷新左边树
fun.resjtreeDate(line.id,delBatch.dir,$("#versions").val());
/** 查询路段信息 @param:<Line.id:线路Id;delBatch.dir:方向> @return:data:路段数据 */
var version = $("#versions").val();
//ajaxd.getSectionRouteInfo(line.id,delBatch.dir,version,function(data) {
/** 在地图上画出线路走向 @param:<Line.id:线路Id;delBatch.dir:方向;data:路段数据> */
// fun.linePanlThree(line.id,data,delBatch.dir,version);
//});
});
} else {
layer.msg('请选择要删除的站点!!!');
}
});
/** 全选框 */
document.getElementById('stationCheckItems').onclick = function() {
// 获取所有的复选框
var checkElements = document.getElementsByName('items');
if (this.checked) {
for ( var i = 0; i < checkElements.length; i++) {
var checkElement = checkElements[i];
checkElement.checked = "checked";
}
} else {
for ( var i = 0; i < checkElements.length; i++) {
var checkElement = checkElements[i];
checkElement.checked = null;
}
}
}
/** 页面加载完显示数据 */
window.onload = initSearch();
/**
* @description : (TODO) 页面加载事件
*
*/
function initSearch() {
var params = new getParams();
page = 0;
loadTableDate(params, true);
}
function getLineCode(id) {
var lineCode;
$.ajax({
url: "/line/findById", //请求地址
type: "Get",
async:false,
//请求方式
data: { id : id}, //请求参数
success: function (result) {
lineCode = result.lineCode;
}
});
return lineCode;
}
function getParams() {
// 搜索参数集合
params = {};
params.lineCode_eq = getLineCode(line.id);
params.directions_eq = delBatch.dir;
params.destroy_eq = "0"; //默认查没有撤销的站点
return params;
}
/**
* @description : (TODO) 表格数据分页加载事件
*
* ------@param : 查询参数
*
* ------@isPon : 是否重新分页
*
*/
function loadTableDate(param, isPon) {
// 初始化全选按钮
document.getElementById('stationCheckItems').checked = null;
// 搜索参数
var params = {};
if (param)
params = param;
// 排序(按方向与序号)
params['order'] = 'directions,stationRouteCode';
// 排序方向.
params['direction'] = 'ASC,ASC';
// 记录当前页数
params['page'] = page;
params.version = $("#versions").val();
// 弹出正在加载层
var i = layer.load(2);
// 异步请求获取表格数据
$.get('/stationroute/allls',params,function(result) {
// 添加序号
result.content.page = page;
// 把数据填充到模版中
var tbodyHtml = template('stationInfo_list_table_temp_detele',{list : result.content});
// 把渲染好的模版html文本追加到表格中
$('#datatable_station_detele 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,
// 当前页
urrentPage : page + 1,
first : '<li class="first"><a href="javascript:void(0);">First<\/a><\/li>',
prev : '<li class="prev"><a href="javascript:void(0);">Previous<\/a><\/li>',
next : '<li class="next"><a href="javascript:void(0);">Next<\/a><\/li>',
last : '<li class="last"><a href="javascript:void(0);">Last<\/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>