inoutstation.html 8.61 KB
<style type="text/css">
	.table-bordered {
	  border: 1px solid; }
	  .table-bordered > thead > tr > th,
	  .table-bordered > thead > tr > td,
	  .table-bordered > tbody > tr > th,
	  .table-bordered > tbody > tr > td,
	  .table-bordered > tfoot > tr > th,
	  .table-bordered > tfoot > tr > td {
	    border: 1px solid; }
	  .table-bordered > thead > tr > th,
	  .table-bordered > thead > tr > td {
	    border-bottom-width: 2px; }
	 
	 .table > tbody + tbody {
	   border-top: 1px solid; }
	   
	   #forms   tr> td >label{
	     word-break: keep-all;white-space:nowrap; 
	   }
</style>

<div class="page-head">
	<div class="page-title">
		<h1>站点停靠时间记录</h1>
	</div>
</div>

<div class="row">
	<div class="col-md-12">
		<div class="portlet light porttlet-fit bordered">
			<div class="portlet-title">
				<form class="form-inline" action="">
					<div>
					<!-- 	<div style="display: inline-block; margin-left: 33px;"
							id="gsdmDiv">
							<span class="item-label" style="width: 80px;">公司: </span> <select
								class="form-control" name="company" id="gsdm"
								style="width: 180px;"></select>
						</div>
						<div style="display: inline-block; margin-left: 24px;"
							id="fgsdmDiv">
							<span class="item-label" style="width: 80px;">分公司: </span> <select
								class="form-control" name="subCompany" id="fgsdm"
								style="width: 180px;"></select>
						</div> -->
						<div style="display: inline-block; margin-left: 15px;">
							<span class="item-label" style="width: 80px;">线路: </span> <select
								class="form-control sreach-zd" name="line" id="line"
								style="width: 180px;"></select>
						</div>
						<div style="display: inline-block; margin-left: 5px;">
							<span class="item-label" style="width: 80px;">时间: </span> <input
								class="form-control" type="text" id="date" style="width: 180px;" />
						</div>
						<div style="display: inline-block; margin-left: 5px;">
							<span class="item-label" style="width: 80px;">站点: </span> <select
								class="form-control" id="zdlx" class="sreach-zd">
								<option value="">请选择</option>
								<option value="0">上行</option>
								<option value="1">下行</option>
							</select>
						</div>
						<div style="display: inline-block; margin-left: 5px;">
							<span class="item-label" style="width: 80px;">赖站时间(秒): </span> <input
								class="form-control" type="text" id="lzsj" 
								onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"  
            onafterpaste="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').replace(/\./g,'').replace('$#$','.')"
								style="width: 80px;" />
						</div>
						<div style="display: inline-block; margin-left: 5px;">
						<input class="btn btn-default" type="button" id="query" value="查询" />
<!-- 						<input class="btn btn-default" type="button" id="export" value="导出" /> -->
					</div>
					</div>
					
				</form>
			</div>
			<div class="portlet-body" >
				<div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 506px;height: 400px">
					<table class="table table-bordered table-hover table-checkable" id="forms">
					        <tbody class="ludan_ll_1">
					        	
					        </tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
</div>

<script>
	$(function(){
		
		
		// 关闭左侧栏
		if (!$('body').hasClass('page-sidebar-closed'))
			$('.menu-toggler.sidebar-toggler').click();
		
		$("#date").datetimepicker({
			format : 'YYYY-MM-DD',
			locale : 'zh-cn'
		});
		
		
		
		 $.get('/basic/lineCode2Name',function(result){
			var data=[];
			
			for(var code in result){
				data.push({id: code, text: result[code]});
			}
			initPinYinSelect2('#line',data,'');
			
		}) 
		/* var fage=false;
		var obj = [];
		var xlList;
		$.get('/report/lineList',function(result){
			xlList=result;
			
			$.get('/user/companyData', function(result){
				obj = result;
				console.log(obj);
				var options = '';
				for(var i = 0; i < obj.length; i++){
					options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
				}
				
				if(obj.length ==0){
					 $("#gsdmDiv").css('display','none');
				}else if(obj.length ==1){
					 $("#gsdmDiv").css('display','none');
					if(obj[0].children.length == 1  || obj[0].children.length ==0)
						$('#fgsdmDiv').css('display','none');
				}
				$('#gsdm').html(options);
				
				updateCompany();
			});
		});

		$("#gsdm").on("change",updateCompany);
		function updateCompany(){
			var company = $('#gsdm').val();
			var options = '';
			for(var i = 0; i < obj.length; i++){
				if(obj[i].companyCode == company){
					var children = obj[i].children;
					for(var j = 0; j < children.length; j++){
						options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
					}
				}
			}
			$('#fgsdm').html(options);
			initXl();
			initCl();
		}
		
		
		 
	
		$("#fgsdm").on("change",initXl);
		function initXl(){
			var data=[];
			if(fage){
				$("#line").select2("destroy").html('');
			}
			var fgs=$('#fgsdm').val();
			var gs=$('#gsdm').val();
			for(var i=0;i<xlList.length;i++){
				if(gs!=""){
					if(fgs!=""){
						if(xlList[i]["fgsbm"]==fgs && xlList[i]["gsbm"]==gs){
							data.push({id: xlList[i]["xlbm"], text: xlList[i]["xlname"]});
						}
					}else{
						if(xlList[i]["gsbm"]==gs){
							data.push({id: xlList[i]["xlbm"], text: xlList[i]["xlname"]});
						}
					}
				}
			}
			initPinYinSelect2('#line',data,'');
			fage=true;
		}
		 */
		 
		$("#query").on("click",function(){
			var line = $("#line").val();
			var date = $("#date").val();
			var zdlx= $("#zdlx").val();
			var lzsj =$("#lzsj").val();
			if( line=="" || line==null){
				layer.msg("请选择线路");
			}else if(date ==null || date==""){
				layer.msg("请选择时间");
			}else if(zdlx=="" || zdlx==null){
				layer.msg("请选择方向");
			}else{
				$get('/report/queryStrinon',{line:line,zd:zdlx},function(result){
					$get('/report/queryInOutStrtion',{line:line,date:date,zd:zdlx,lzsj:lzsj},function(result2){
						console.log(result2);
					    /* getTime(result); */
						var ludan_ll_1 = template('ludan_ll_1',{list:result2,lists:result});
						// 把渲染好的模版html文本追加到表格中
						$('#forms .ludan_ll_1').html(ludan_ll_1);
					});
				});
			}
		});
		
		var params = new Array();
		var jName = '';
// 		$("#print").click(function(){
// 			$("#printArea").printArea();
// 		});
		
// 		$("#exportMore").on("click",function(){
// 			return;
// 			$post('/realSchedule/exportWaybillMore',{date:date},function(result){
// 				window.open("/downloadFile/download?fileName="+jName);
// 			});
// 		});
		
		function getTime(list){
            $.each(list, function(i, obj) {
                if(obj.zdsj != null && obj.zdsjActual != null ){
                    var zdsjActual = (obj.zdsjActual).split(":");
                    var zdsj = (obj.zdsj).split(":");
                    if(zdsjActual[0]*60+Number(zdsjActual[1]) > zdsj[0]*60+Number(zdsj[1])){
                        obj["slow"] = (zdsjActual[0]*60+Number(zdsjActual[1])) - (zdsj[0]*60+Number(zdsj[1]));
                    }
                    else if(zdsjActual[0]*60+Number(zdsjActual[1]) < zdsj[0]*60+Number(zdsj[1])){
                        obj["fast"] = (zdsj[0]*60+Number(zdsj[1])) - (zdsjActual[0]*60+Number(zdsjActual[1]));
                    }
                }
            }); 
		}

		
		
		
		
		$("#export").on("click",function(){
			var rq=$("#date").val();
			var line=$("#line").val();
			var nbbm=$("#nbbm").val();
			var fcsj=$("#fcsj_xx").val();
			var ddsj=$("#ddsj_xx").val();
			if(fcsj==""){
				layer.msg("没数据");
			}else{
				$get('/report/exportQueryListZdxx',{clzbh:nbbm,date:rq,line:line,fcsj:fcsj,ddsj:ddsj},function(result){
					window.open("/downloadFile/download?fileName=班次到离站");
				});
			}
			
		});
		
	});
	
</script>
<script type="text/html" id="ludan_ll_1">
	  {{each list as obj i}}

		<tr>
			<td>{{obj.bc}}</td>
			<td><label>{{obj.nbbm}}</label></td>
			{{each lists as o j}}
			  {{if i==0}}
				<td>
					<label>{{obj[(o.stationCode)+'in']}}
				    ({{obj[(o.stationCode)+'out']}})
					</label>
			  </td>
			{{else}}
				<td {{if obj[o.stationCode] =='y'}}style="color: red"{{/if}}>
					{{if obj[(o.stationCode)+'in']!=''}}
					<label>	I {{obj[(o.stationCode)+'in']}}</label>
					{{/if}}
				<br/>
					{{if obj[(o.stationCode)+'out']!=''}}
				      <label>  O {{obj[(o.stationCode)+'out']}}</label>
					{{/if}}
			  </td>
			{{/if}}
			{{/each}}

		</tr>
	{{/each}}
	{{if list.length == 0}}
		<tr>
			<td colspan="3"><h6 class="muted">没有找到相关数据</h6></td>
		</tr>
	{{/if}}
</script>