linepassengerflow.html 6.25 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; }
</style>

<div class="page-head">
	<div class="page-title">
		<h1>$$$$$${txt-995}</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 style="display: inline-block; margin-left: 33px;" id="gsdmDiv_line">
						<span class="item-label" style="width: 80px;">$$$$$${txt-3694}</span>
						<select class="form-control" name="company" id="gsdmLine" style="width: 140px;"></select>
					</div> 
					<div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv_line">
						<span class="item-label" style="width: 80px;">$$$$$${txt-3777}: </span>
						<select class="form-control" name="subCompany" id="fgsdmLine" style="width: 140px;"></select>
					</div> 
					<div style="display: inline-block;">
                        <span class="item-label" style="width: 80px;">$$$$$${txt-3815}: </span>
                        <select class="form-control" name="line" id="line" style="width: 180px;"></select>
                    </div>
                    <div style="display: inline-block;margin-left: 15px;">
                        <span class="item-label" style="width: 80px;">$$$$$${txt-4004}: </span>
                        <input class="form-control" type="text" id="date" style="width: 180px;"/>
                    </div>
                    <div class="form-group">
                        <input class="btn btn-default" type="button" id="query" value="$$$$$${txt-3890}"/>
                        <input class="btn btn-default" type="button" id="export" value="$$$$$${txt-4163}"/>
                    </div>
				</form>
			</div>
			<div class="portlet-body">
				<div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
					<table class="table table-bordered table-hover table-checkable" id="forms">
						<thead>
							<tr>
								<th>$$$$$${txt-3934}</th>
								<th>$$$$$${txt-2797}</th>
								<th>$$$$$${txt-2005}</th>
								<th>$$$$$${txt-2696}</th>
							</tr>
						</thead>
						<tbody>
							
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
</div>

<script>
	$(function(){
		 var reqCodeMap = {"0xA1": i18n('txt-1302'), "0xA2": i18n('txt-2535'), "0xA3": i18n('txt-2534'), "0xA5": i18n('txt-2533'), "0xA7": i18n('txt-2532'), "0x50": i18n('txt-2528'), "0x70": i18n('txt-2537'), "0x60": i18n('txt-2527'), "0x11": i18n('txt-2531'), "0x12" : i18n('txt-3853')};
		// 关闭左侧栏
		if (!$('body').hasClass('page-sidebar-closed'))
			$('.menu-toggler.sidebar-toggler').click();
		
		$("#date").datetimepicker({
			format : 'YYYY-MM-DD',
			locale : 'zh-cn'
		});
		
		var fage=false;
		var xlList;
		var obj = [];
		
		$.get('/report/lineList',function(result){
			xlList=result;
			$.get('/user/companyData', function(result){
				obj = result;
				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_line").css('display','none');
				}else if(obj.length ==1){
					 $("#gsdmDiv_line").css('display','none');
					if(obj[0].children.length == 1  || obj[0].children.length ==0)
						$('#fgsdmDiv_line').css('display','none');
				}
				$('#gsdmLine').html(options);
				updateCompany();
			});
		})
		$("#gsdmLine").on("change",updateCompany);
		function updateCompany(){
			var company = $('#gsdmLine').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>';
					}
				}
			}
			$('#fgsdmLine').html(options);
			initXl();
		}
		
		$("#fgsdmLine").on("change",initXl);
		function initXl(){
			var data=[];
			if(fage){
				$("#line").select2("destroy").html('');
			}
			var fgs=$('#fgsdmLine').val();
			var gs=$('#gsdmLine').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;
		}
		
		var line;
		var date;
		var gsdmLine;
		var fgsdmLine;
		$("#query").on("click",function(){
			var line = $("#line").val();
			var date = $("#date").val();
			var gsdmLine = $("#gsdmLine").val();
			var fgsdmLine = $("#fgsdmLine").val();
		    $post('/mcy_forms/linepasswengerflow',{ gsdmLine:gsdmLine,fgsdmLine:fgsdmLine,line:line,date:date,type:'query'},function(result){
				$.each(result, function(i, obj) {
					obj.requestType = reqCodeMap[obj.requestType];
                }); 
				// 把数据填充到模版中
				var tbodyHtml = template('list_linepasswengerflow',{list:result});
				// 把渲染好的模版html文本追加到表格中
				$('#forms tbody').html(tbodyHtml);
			});	
		}); 
		
		$("#export").on("click",function(){
			var line = $("#line").val();
			var date = $("#date").val();
			var gsdmLine = $("#gsdmLine").val();
			var fgsdmLine = $("#fgsdmLine").val();
			$post('/mcy_export/linepasswengerflowExport',{gsdmLine:gsdmLine,fgsdmLine:fgsdmLine,line:line,date:date,type:'export'},function(result){
				window.open("/downloadFile/download?fileName=$$$$$${txt-995}"+moment(date).format("YYYYMMDD"));
			});
		});
	});
</script>
<script type="text/html" id="list_linepasswengerflow">
	{{each list as obj i}}
		<tr>	
			<td>{{i+1}}</td>
            <td>{{obj.stationName}}</td>
			<td>  </td>
			<td>  </td>
		</tr>
	{{/each}}
	{{if list.length == 0}}
		<tr>
			<td colspan="6"><h6 class="muted">$$$$$${txt-750}</h6></td>
		</tr>
	{{/if}}
</script>