tzzj.html 4.63 KB
<!-- 调整站距 -->
<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();
			params.status = $($("#versions").find("option:selected")[0]).attr("status");
			$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,$("#versions").val());
					/** 查询上行路段信息 @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>