waybill.html 13.1 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
<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;">
						<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>
						<input class="form-control" type="text" id="date" style="width: 180px;"/>
					</div>
					<div class="form-group" style="display: inline-block;margin-left: 15px;">
						<input class="btn btn-default" type="button" id="query" value="查询"/>
						<input class="btn btn-default" type="button" id="export" value="导出"/>
						<input class="btn btn-default" type="button" id="print" value="打印"/>
						<input class="btn btn-default" type="button" id="exportMore" value="批量导出"/>
					</div>
				</form>
			</div>
			<div class="portlet-body">
				<div class="row">
					<div class="col-md-3">
						<div class="" style="margin-top: 10px;overflow:auto;height: 860px">
							<table class="table table-bordered table-hover table-checkable pre-scrollable" id="info">
								<thead>
									<tr class="hidden">
										<th>人员</th>
										<th>自编号</th>
										<th>路牌</th>
									</tr>
								</thead>
								<tbody>
									
								</tbody>
							</table>
						</div>
					</div>
					<div class="col-md-9"  id="printArea">
						<div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
							<table class="table table-bordered table-checkable" id="forms">
								<tbody class="ludan_1">
									
								</tbody>
						        <tbody class="ludan_2">
						        	
						        </tbody>
						        <tbody class="ludan_3">
						        	
						        </tbody>
						        <tbody class="ludan_4">
						        	
						        </tbody>
							</table>
						</div>
					</div>
				</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'
		});
		
		$('#line').select2({
			ajax: {
				url: '/realSchedule/findLine',
				type: 'post',
				dataType: 'json',
				delay: 150,
				data: function(params){
					return{line: params.term};
				},
			    processResults: function (data) {
			      return {
			        results: data
			      };
			    },
				cache: true
			},
			templateResult: function(repo){
				if (repo.loading) return repo.text;
				var h = '<span>'+repo.text+'</span>';
				return h;
			},
			escapeMarkup: function (markup) { return markup; },
			minimumInputLength: 1,
			templateSelection: function(repo){
				return repo.text;
			},
			language: {
		       noResults: function(){
		           return '<span style="color:red;font-size: 12px;">没有搜索到线路!</span>';
		       },
		       inputTooShort : function(e) {
					return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入线路搜索线路</span>';
			   },
		       searching : function() {
					return '<span style="color:gray;font-size: 12px;"> 正在搜索线路...</span>';
			   }
			}
		});
		
		var date = '';
		$("#query").on("click",function(){
			var line = $("#line").val();
			date = $("#date").val();
			$(".hidden").removeClass("hidden");
			$get('/realSchedule/queryUserInfo',{line:line,date:date},function(result){
				// 把数据填充到模版中
				var tbodyHtml = template('list_info',{list:result});
				// 把渲染好的模版html文本追加到表格中
				$('#info tbody').html(tbodyHtml);
			});
		});
		
		var params = new Array();
		var jName = '';
		$("#info tbody").on("click","tr",function(){
			if($(this).children().size() < 2){
				return;
			}
			
			$(this).children().each(function(index){
				params[index] = $(this).text();
			});
			console.log(params);
			jName = params[0].split("\\")[0];
			var id = $("#"+params[1]).val();
			$get('/realSchedule/'+id,null,function(result){
				console.log(result);
			    result.scheduleDate = moment(result.scheduleDate).format("YYYY/MM/DD");
				var ludan_1 = template('ludan_1',result);
				//var ludan_4 = template('ludan_4',result);
				// 把渲染好的模版html文本追加到表格中
				$('#forms .ludan_1').html(ludan_1);
				//$('#forms .ludan_4').html(ludan_4);
			});
			$post('/realSchedule/queryListWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date},function(result){
			    getTime(result);
				var ludan_2 = template('ludan_2',{list:result});
				// 把渲染好的模版html文本追加到表格中
				$('#forms .ludan_2').html(ludan_2);
			});
			$post('/realSchedule/findKMBC',{jName:jName,clZbh:params[1],lpName:params[2],date:date},function(result){
			    var ludan_3 = template('ludan_3',result);
			    $('#forms .ludan_3').html(ludan_3);
			});
			
		});
		
		$("#export").on("click",function(){
			if(params.length < 1){
				return;
			}
			$post('/realSchedule/exportWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date},function(result){
				window.open("/downloadFile/download?fileName="+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]));
                    }
                }
            }); 
		}
	});
</script>
<script type="text/html" id="list_info">
	{{each list as obj i}}
		<tr>
			<td width="45%">{{obj[4]}}\{{obj[1]}}</td>
			<td width="32%">{{obj[2]}}</td>
			<td width="23%">{{obj[3]}}<input type="hidden" id="{{obj[2]}}" value="{{obj[0]}}"></td>
		</tr>
	{{/each}}
	{{if list.length == 0}}
		<tr>
			<td colspan="3"><h6 class="muted">没有找到相关数据</h6></td>
		</tr>
	{{/if}}
</script>
<script type="text/html" id="ludan_1">
	  <tr>
          <td colspan="14">行车路单</td>
      </tr>
      <tr>
          <td colspan="14">路别:{{xlName}}   路牌:{{lpName}}   车号:{{clZbh}}   出场时间:{{fcsjActual}}   到达站名:{{zdzName}}   当班调派:&nbsp;   日期:{{scheduleDate}}</td>
      </tr>
      <tr>
          <td colspan="2">出场存油 &nbsp;</td>
          <td colspan="2">加注油量 &nbsp;</td>
          <td colspan="2">进场存油 &nbsp;</td>
          <td colspan="4">加注机油 &nbsp;</td>
          <td colspan="4">本日耗油 &nbsp;</td>
      </tr>
      <tr>
          <td rowspan="2">调度章</td>
          <td colspan="1">&nbsp;</td>
          <td rowspan="2">早班</td>
          <td colspan="1">&nbsp;</td>
          <td rowspan="2">夜班</td>
          <td colspan="1">&nbsp;</td>
          <td rowspan="2" colspan="2">交叉</td>
          <td colspan="2">&nbsp;</td>
          <td rowspan="2">其他</td>
          <td colspan="1">&nbsp;</td>
          <td colspan="1">&nbsp;</td>
          <td colspan="1">&nbsp;</td>
      </tr>
      <tr>
          <td colspan="1">&nbsp;</td>
          <td colspan="1">&nbsp;</td>
          <td colspan="1">&nbsp;</td>
          <td colspan="2">&nbsp;</td>
          <td colspan="1">&nbsp;</td>
          <td colspan="1">&nbsp;</td>
          <td colspan="1">&nbsp;</td>
      </tr>
      <tr>
          <td rowspan="2">车次</td>
          <td colspan="2">工号</td>
          <td rowspan="2">公里耗油</td>
          <td colspan="2">起讫站</td>
          <td colspan="4">时间</td>
          <td colspan="2">误点</td>
          <td rowspan="2" width="66px">里程(公里)计划</td>
          <td rowspan="2">备注</td>
      </tr>
      <tr>
          <td colspan="1" width="60px">&nbsp;</td>
          <td colspan="1" width="60px">&nbsp;</td>
          <td colspan="1">起点</td>
          <td colspan="1">终点</td>
          <td colspan="1">计发</td>
          <td colspan="1">实发</td>
          <td colspan="1">应到</td>
          <td colspan="1">实到</td>
          <td colspan="1"></td>
          <td colspan="1"></td>
      </tr>
</script>
<script type="text/html" id="ludan_2">
	{{each list as obj i}}
		<tr>
			<td>{{i+1}}</td>
			<td>{{obj.jName}}</td>
			<td>{{obj.sName}}</td>
			<td>&nbsp;</td>
			<td>{{obj.qdzName}}</td>
			<td>{{obj.zdzName}}</td>
			<td>{{obj.fcsj}}</td>
			<td>{{obj.fcsjActual}}</td>
			<td>{{obj.zdsj}}</td>
			<td>{{obj.zdsjActual}}</td>
			<td>{{obj.fast}}</td>
			<td>{{obj.slow}}</td>
			<td>{{obj.jhlc}}</td>
			<td>{{obj.remarks}}</td>
		</tr>
	{{/each}}
	{{if list.length == 0}}
		<tr>
			<td colspan="14"><h6 class="muted">没有找到相关数据</h6></td>
		</tr>
	{{/if}}
</script>
<script type="text/html" id="ludan_3">
	<tr>
		<td colspan="2">计划公里</td>
		<td>{{jhlc}}</td>
		<td colspan="2">烂班公里</td>
		<td>{{remMileage}}</td>
		<td colspan="2">临加公里</td>
		<td>{{addMileage}}</td>
		<td colspan="2">营运公里</td>
		<td colspan="3">{{yygl}}</td>
	</tr>
	<tr>
		<td colspan="2">空驶公里</td>
		<td>{{ksgl}}</td>
		<td colspan="2">总公里</td>
		<td>{{realMileage}}</td>
		<td colspan="2">计划班次</td>
		<td>{{jhbc}}</td>
		<td colspan="2">烂班班次</td>
		<td colspan="3">{{cjbc}}</td>
	</tr>
	<tr>
		<td colspan="2">增加班次</td>
		<td>{{ljbc}}</td>
		<td colspan="2">实际班次</td>
		<td>{{sjbc}}</td>
		<td colspan="2"></td>
		<td></td>
		<td colspan="2"></td>
		<td colspan="3"></td>
	</tr>
</script>
<script type="text/html" id="ludan_4">
		<tr>
	    <td colspan="12">认真做好终点项目的例保保修工作,杜绝机械火警事故!</td>
	    <td>轮胎</td>
	    <td>&nbsp;</td>
	</tr>
	<tr>
	    <td colspan="3">重点例保项目</td>
	    <td>1</td>
	    <td>2</td>
	    <td>3</td>
	    <td colspan="3">重点例保项目</td>
	    <td>1</td>
	    <td>2</td>
	    <td>3</td>
	    <td>灭火机</td>
	    <td>&nbsp;</td>
	</tr>
	<tr>
	    <td colspan="3">各类制动</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td colspan="3">各类灯光</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td colspan="2">出场路码表里程</td>
	</tr>
	<tr>
	    <td colspan="3">方向机</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td colspan="3">各类仪表</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td colspan="2" rowspan="2">&nbsp;</td>
	</tr>
	<tr>
	    <td colspan="3">欠压报警器</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td colspan="3">各类皮带</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	</tr>
	<tr>
	    <td colspan="3">发动机清洁及响声</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td colspan="3">油箱及托架</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td colspan="2">出场路码表里程</td>
	</tr>
	<tr>
	    <td colspan="3">地盘响声</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td colspan="3">轮胎、半轴螺栓螺母</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td colspan="2" rowspan="3">&nbsp;</td>
	</tr>
	<tr>
	    <td colspan="3">化油器及油路</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td colspan="3">油、电、水、气</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	</tr>
	<tr>
	    <td colspan="3">进排歧管及排气管</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td colspan="3">内外车身及附件</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	    <td>&nbsp;</td>
	</tr>
	<tr>
	    <td colspan="14">1 首次出场,2 复使中途,3 某次进场。√正常,ⓧ报修,×尚未报修</td>
	</tr>
</script>