tzzj.html
3.86 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
<!-- 调整站距 -->
<div class="modal fade" id="tzzj_mobal" tabindex="-1" role="basic" aria-hidden="true">
<div class="modal-dialog">
<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">
<form class="form-horizontal" action="/" method="post" id="tzbcForm" role="form">
<!-- alert-danger 组件START -->
<div class="alert alert-danger display-hide" id="error">
<button class="close" data-close="alert"></button>
您的输入有误,请检查下面的输入项
</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_bctz">
<thead>
<tr role="row" class="heading">
<!--<th width="1%"></th>-->
<th width="33%">站点序号</th>
<th width="33%">站点路由</th>
<th width="33%">站距(米/单位)</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn default" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" id="tzbcnext">保存</button>
</div>
</div>
</div>
</div>
<script type="text/html" id="tzzj_temp">
{{each list as obj i }}
<tr role="row" class="filter">
<!--<td></td>-->
<td>
<!--<input type="text" readonly class="form-control form-filter input-sm" value="{{i+1}}">-->
{{i+1}}
</td>
<td>
<!-- <input type="text" readonly class="form-control form-filter input-sm" name="station_{{i+1}}" value="{{obj.name}}">-->
{{obj.stationName}}
</td>
<td>
<input type="text" class="form-control form-filter input-sm" name="dis_{{obj.id}}" value="{{obj.distances * 1000}}">
</td>
</tr>
{{/each}}
{{if list.length == 0}}
<tr>
<td colspan=4><h6 class="muted">没有找到相关数据</h6></td>
</tr>
{{/if}}
</script>
<script type="text/javascript">
$('#tzzj_mobal').on('modal.show', function(event, stationRoutes){
var properties = RoutesOperation.getProperties();
setTimeout(function(){
// 加载延迟200毫秒显示mobal
$('#tzzj_mobal').modal({show : true,backdrop: 'static', keyboard: false});
},200);
// 当模态框对用户可见时触发(将等待 CSS 过渡效果完成)。
$('#tzzj_mobal').on('show.bs.modal', function () {
var tbodyHtml = template('tzzj_temp', {list: stationRoutes});
$('#datatable_bctz tbody').html(tbodyHtml);
});
// 获取表单元素
var form = $('#tzbcForm');
// 错误提示元素
var error = $('#error', form);
// 下一步点击事件
$('#tzbcnext').on('click', function() {
form.submit();// 表单提交
});
// 表单验证
form.validate({
errorElement : 'span',
errorClass : 'help-block help-block-error',
focusInvalid : false,
rules : {
},
invalidHandler : function(event, validator) {
error.show();
App.scrollTo(reladplusname, -200);
},
highlight : function(element) {
$(element).closest('.form-group').addClass('has-error');
},
unhighlight : function(element) {
$(element).closest('.form-group').removeClass('has-error');
},
success : function(label) {
label.closest('.form-group').removeClass('has-error');
},
submitHandler : function(f) {
var params = form.serializeJSON();
$post('/api/lsstationroute/modifyDistance', params, function(data) {
error.hide();
$('#tzzj_mobal').modal('hide');
if(data.status=='SUCCESS') {
layer.msg('修改成功...');
RoutesOperation.clearMarkAndOverlays();
RoutesOperation.resjtreeDate(properties.lineId, properties.directions, properties.versions);
}else {
layer.msg('修改失败...');
}
});
}
});
});
</script>