tzzj.html
4.52 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
<!-- 调整站距 -->
<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="tzbcAlert">
<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.stationRouteName}}
</td>
<td>
<input type="text" class="form-control form-filter input-sm" name="dis_{{obj.stationRouteId}}" value="{{obj.stationRouteDistances * 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('tzzjMobal.show', function(e,map,gd,dir,lineid,pf,rd){
setTimeout(function(){
// 加载延迟200毫秒显示mobal
$('#tzzj_mobal').modal({show : true,backdrop: 'static', keyboard: false});
},200);
// 当模态框对用户可见时触发(将等待 CSS 过渡效果完成)。
$('#tzzj_mobal').on('show.bs.modal', function () {
console.log(rd);
// 把数据填充到模版中
var tbodyHtml = template('tzzj_temp',{list:rd});
// 把渲染好的模版html文本追加到表格中
$('#datatable_bctz tbody').html(tbodyHtml);
});
// 获取表单元素
var form = $('#tzbcForm');
// 错误提示元素
var tzbcAlert = $('#tzbcAlert', form);
// 下一步点击事件
$('#tzbcnext').on('click', function() {
form.submit();// 表单提交
});
// 表单验证
form.validate({
errorElement : 'span',
errorClass : 'help-block help-block-error',
focusInvalid : false,
rules : {
},
invalidHandler : function(event, validator) {
tzbcAlert.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('/stationroute/upddis',params,function(data) {
// 隐藏错误提示
tzbcAlert.hide();
// 隐藏 reladplus_mobal 弹出层
$('#tzzj_mobal').modal('hide');
if(data.status=='SUCCESS') {
// 弹出添加成功提示消息
layer.msg('修改成功...');
map.clearMarkAndOverlays();
// 刷新左边树
pf.resjtreeDate(lineid,dir);
/** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */
gd.getSectionRouteInfo(lineid,dir,function(data) {
/** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */
pf.linePanlThree(lineid,data,dir);
});
}else {
// 弹出添加失败提示消息
layer.msg('修改失败...');
}
});
}
});
});
</script>