timetable.html 14.5 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 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459
<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>行车时刻表统计表</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_time">
						<span class="item-label" style="width: 80px;">公司: </span>
						<select class="form-control" name="company" id="gsdmTime" style="width: 140px;"></select>
					</div> 
					<div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv_time">
						<span class="item-label" style="width: 80px;">分公司: </span>
						<select class="form-control" name="subCompany" id="fgsdmTime" style="width: 140px;"></select>
					</div>
					<div style="display: inline-block;">
                        <span class="item-label" style="width: 80px;">线路: </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;">时刻表: </span>
                        <select class="form-control" name="ttinfo" id="ttinfo" style="width: 180px;"></select>
                    </div>
                    <div class="form-group">
                        <input class="btn btn-default" type="button" id="query" value="查询"/>
<!--                         <input class="btn btn-default" type="button" id="export" value="导出"/> -->
                    </div>
				</form>
			</div>
			<div class="portlet-body">
				<div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
					<label id="xlxq"></label>
					<table class="table table-bordered table-hover table-checkable" style="margin-bottom:5px" id="formsTime1">
						<thead>
							<tr>
								<th colspan="10">行车时刻表统计表</th>
							</tr>
							<tr>
								<td  align="center">配车</td>
								<td colspan="6" align="center">全日班次</td>
								<td colspan="3" align="center">计划里程</td>
							</tr>
							<tr>
								<td rowspan="2"  style="text-align:center;vertical-align:middle;">合计</td>
								<td rowspan="2"  style="text-align:center;vertical-align:middle;">全程   班次</td>
								<td rowspan="2" style="text-align:center;vertical-align:middle;">区间   班次</td>
								<td colspan="2" align="center">6:31-8:30</td>
								<td colspan="2" align="center">16:01-18:00</td>
								<td rowspan="2" style="text-align:center;vertical-align:middle;">总里程</td>
								<td rowspan="2" style="text-align:center;vertical-align:middle;">营业里程</td>
								<td rowspan="2" style="text-align:center;vertical-align:middle;">空驶里程</td>
							</tr>
							<tr>
								<td >全程</td>
								<td >区间</td>
								<td >全程</td>
								<td >区间</td>
							</tr>
						</thead>
						
						<tbody class="tbody_time_1">
							
						</tbody>
					</table>
					
					<div class="portlet-body">
						<div class="row">
							<div class="col-md-4" id="divTime2">
								<table  class="table table-bordered table-hover table-checkable pre-scrollable"  id="formsTime2">
									<tr>
										<td colspan="2"> 营运车时  (计划班次的营运时间/公里)</td>
									</tr>
									<tr>
										<td colspan="2">营业里程/营运时间(小时)</td>
									
									</tr>
									<tr>
										<td align="center" width="50%">
											营运时间(时:分)
										</td>
										<td align="center">
											营运车速
										</td>
									</tr>
									<tbody class="tbody_time_2">
									
									</tbody>
								</table>
							
							</div>
							
							<div class="col-md-8" id="divTime3" >
									<table class="table table-bordered table-checkable" id="formsTime3">
										<tr>
											<td colspan="8">站点配车</td>
										</tr>
										<tr>
											<td colspan="4" align="center">6:31—8:30</td>
											<td colspan="4" align="center">16:01—18:00</td>
										</tr>
										<tr>
											<td width="18%">全程站名</td>
											<td>配车</td>
											<td width="18%">区间站名</td>
											<td>配车</td>
											<td width="18%">全程站名</td>
											<td>配车</td>
											<td width="18%">区间站名</td>
											<td>配车</td>
										</tr>
										<tbody class="tbody_time_3">
										
										</tbody>
									</table>
							</div>
							
						</div>
					</div>
					<div class="portlet-body">
						<div class="row">
							<div class="col-md-6" >
								<table  class="table table-bordered table-checkable" id="formsTime4">
									<tr>
										<td colspan="6">调度形式</td>
									</tr>
									<tr>
										<td colspan="3" align="center">上行向(<span id="skb_sxzd"></span>)站</td>
										<td colspan="3" align="center">下行向(<span id="skb_xxzd"></span>)站</td>
									</tr>
									<tr>
										<td width="22%">起讫站</td>
										<td width="20%">起讫时间</td>
										<td width="8%">班次</td>
										<td width="22%">起讫站</td>
										<td width="20%">起讫时间</td>
										<td width="8%">班次</td>
									</tr>
									<tbody class="tbody_time_4">
									
									</tbody>
								</table>
							</div>
							<div class="col-md-6" >
								<table  class="table table-bordered table-checkable" id="formsTime5">
									<tr>
										<td colspan="8">全日分组行驶时间(区间除外)</td>
									</tr>
									<tr>
										<td width="20%" rowspan="2" style="text-align:center;vertical-align:middle;">分组   时间</td>
										<td width="19%" colspan="2" style="text-align:center;vertical-align:middle;">计划行驶(分)</td>
										<td width="19%" colspan="2" style="text-align:center;vertical-align:middle;">停站时间</td>
										<td width="14%" rowspan="2" style="text-align:center;vertical-align:middle;">周转时间</td>
										<td width="14%" rowspan="2" style="text-align:center;vertical-align:middle;">车距区间</td>
										<td width="14%" rowspan="2" style="text-align:center;vertical-align:middle;">平均车距</td>
									</tr>
									<tr>
										<td>上行</td>
										<td style="text-align:center;">下行</td>
										<td>上行</td>
										<td style="text-align:center;">下行</td>
									</tr>
									<tbody class="tbody_time_5">
									
									</tbody>
								</table>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<script>
	$(function(){
		// 关闭左侧栏
		if (!$('body').hasClass('page-sidebar-closed'))
			$('.menu-toggler.sidebar-toggler').click();
		
		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_time").css('display','none');
				}else if(obj.length ==1){
					 $("#gsdmDiv_time").css('display','none');
					if(obj[0].children.length == 1  || obj[0].children.length ==0)
						$('#fgsdmDiv_time').css('display','none');
				}
				$('#gsdmTime').html(options);
				updateCompany();
			});
		})
		$("#gsdmTime").on("change",updateCompany);
		function updateCompany(){
			var company = $('#gsdmTime').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>';
					}
				}
			}
			$('#fgsdmTime').html(options);
		}
		


		var tempData = {};
		$.get('/report/lineList',function(xlList){
			var data = [];
			$.get('/user/companyData', function(result){
				for(var i = 0; i < result.length; i++){
					var companyCode = result[i].companyCode;
					var children = result[i].children;
					for(var j = 0; j < children.length; j++){
						var code = children[j].code;
						for(var k=0;k < xlList.length;k++ ){
							if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){
								data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
								tempData[xlList[k]["xlbm"]] = companyCode+":"+code;
							}
						}
					}
				}
				initPinYinSelect2('#line',data,'');
				line = data[0].id;
				updateTtinfo();
			});
		});
		
		$("#line").on("change", function(){
			if($("#line").val() == " "){
				$("#gsdmTime").attr("disabled", false);
				$("#fgsdmTime").attr("disabled", false);
			} else {
				var temp = tempData[$("#line").val()].split(":");
				$("#gsdmTime").val(temp[0]);
				updateCompany();
				$("#fgsdmTime").val(temp[1]);
				$("#gsdmTime").attr("disabled", true);
				$("#fgsdmTime").attr("disabled", true);
			}
		});
		
		
		var flag = 0;
		function updateTtinfo(){
			if(flag == 1)
				return;
			flag = 1;
			var treeData = [];
			var params = {};
			params['line'] = line;
			$get('/report/getTtinfo', params, function(result){
				treeData = createTreeData(result);
				var options = '<option value="">请选择...</option>';
				$.each(treeData, function(i, g){
					options += '<option value="'+g.id+'">'+g.name+'</option>';
				});
				$('#ttinfo').html(options)/* .select2() */;
				flag = 0;
			});
		}
		
		/**
		 * 将模块List 转换为树结构
		 * @param arr
		 * @returns {Array}
		 */
		function createTreeData(arr){
			var treeData = [];
			var len = arr.length;
			for(var i = 0; i < len; i ++){
				var pId = arr[i].pId;
				arr[i].text = arr[i].name;
				if(!pId){
					treeData.push(arr[i]);
				}

				for(var j = 0; j < len; j ++){
					if(pId == arr[j].id){
						if(!arr[j].children)
							arr[j].children = [];
						arr[j].children.push(arr[i]);
						break;
					}
				}
			}
			return treeData;
		}
		
		$("#line").on("change", function(){
			line = $("#line").val();
			updateTtinfo();
		})
		
		var line = $("#line").val();
		
		//查询
		$("#query").on('click',function(){
			line = $("#line").val();
			var xlName = $("#select2-line-container").html();
			var ttinfo = $("#ttinfo").val();
			if(line==null || line ==""){
				layer.msg('请选择线路.');
			}else if(ttinfo==null|| ttinfo==""){
				layer.msg('请选择时刻表.');
			}else{
				 $get('/report/tbodyTime1',{line:line,ttinfo:ttinfo},function(result){
					var tbodyTime1 = template('tbodyTime1',{map:result});
					$('#formsTime1 .tbody_time_1').html(tbodyTime1);
				}); 
				 $.get('/report/tbodyTime2',{line:line,ttinfo:ttinfo},function(result){
					var tbodyTime2 = template('tbodyTime2',{map:result});
					$('#formsTime2 .tbody_time_2').html(tbodyTime2);
				});
				$.get('/report/tbodyTime3',{line:line,ttinfo:ttinfo},function(result){
					var tbodyTime3 = template('tbodyTime3',{list:result});
					$('#formsTime3 .tbody_time_3').html(tbodyTime3);
					var divTime3 = window.document.getElementById('formsTime3');
					var divTime2 = window.document.getElementById('formsTime2');
					 divTime2.style.height=divTime3.offsetHeight+"px";
				});
				
				$.get('/report/tbodyTime4',{line:line,ttinfo:ttinfo},function(result){
					$("#skb_sxzd").html(result[0].sxqdz);
					$("#skb_xxzd").html(result[0].xxqdz);
					var tbodyTime4 = template('tbodyTime4',{list:result});
					$('#formsTime4 .tbody_time_4').html(tbodyTime4);
				});
				 $.get('/report/tbodyTime5',{line:line,ttinfo:ttinfo},function(result){
					var tbodyTime5 = template('tbodyTime5',{list:result});
					$('#formsTime5 .tbody_time_5').html(tbodyTime5);
				});  
			}
			
			
		});
	});
</script>
<script type="text/html" id="tbodyTime1">
	<tr>
		<td>{{map.pcs}}</td>
		<td>{{map.qcbc}}</td>
		<td>{{map.qjbc}}</td>
		<td>{{map.zqcbc}}</td>
		<td>{{map.zqjbc}}</td>
		<td>{{map.wqcbc}}</td>
		<td>{{map.wqjbc}}</td>
		<td>{{map.zlc}}</td>
		<td>{{map.yylc}}</td>
		<td>{{map.kslc}}</td>
	</tr>
</script>

<script type="text/html" id="tbodyTime2">
	<tr>
		<td align="center">{{map.yysj}}</td>
		<td align="center">{{map.yycs}}</td>
	</tr>
</script>

<script type="text/html" id="tbodyTime3">
{{each list as result i}}
	<tr>
		<td align="center">{{result.zqcZm}}</td>
		<td align="center">{{result.zqcCls}}</td>
		<td align="center">{{result.zqjZm}}</td>
		<td align="center">{{result.zqjCls}}</td>
		<td align="center">{{result.wqcZm}}</td>
		<td align="center">{{result.wqcCls}}</td>
		<td align="center">{{result.wqjZm}}</td>
		<td align="center">{{result.wqjCls}}</td>
	</tr>
{{/each}}
{{if list.length == 0}}
		<tr>
			<td colspan="8"><h6 class="muted">没有找到相关数据</h6></td>
		</tr>
	{{/if}}
</script>




<script type="text/html" id="tbodyTime4">
{{each list as result i}}
	
	<tr>
		<td align="center">{{result.sxqdz}}</td>
		<td align="center">{{result.sxfcsj}}</td>
		<td align="center">{{result.sxbc}}</td>
		<td align="center">{{result.xxqdz}}</td>
		<td align="center">{{result.xxfcsj}}</td>
        <td align="center">{{result.xxbc}}</td>
	</tr>
{{/each}}
{{if list.length == 0}}
		<tr>
			<td colspan="5"><h6 class="muted">没有找到相关数据</h6></td>
		</tr>
	{{/if}}
</script>

<script type="text/html" id="tbodyTime5">
{{each list as result i}}
	<tr>
		<td align="center">{{result.sjd}}</td>
		<td align="center">{{result.sxsj}}</td>
		<td align="center">{{result.xxsj}}</td>
		<td align="center">{{result.sxtssj}}</td>
		<td align="center">{{result.xxtssj}}</td>
		<td align="center">{{result.fqsj}}</td>
		<td align="center">{{result.cjqj}}</td>
		<td align="center">{{result.pjcj}}</td>
	</tr>
{{/each}}
{{if list.length == 0}}
		<tr>
			<td colspan="8"><h6 class="muted">没有找到相关数据</h6></td>
		</tr>
	{{/if}}
</script>