Commit d7b32888f3d76a010395626269b27f9ffcfe1ddf

Authored by 娄高锋
1 parent 4d063484

update

src/main/java/com/bsth/controller/schedule/PeopleCarPlanController.java
... ... @@ -33,6 +33,11 @@ public class PeopleCarPlanController {
33 33 public Map<String, Object> scheduleAnaly(@RequestParam Map<String, Object> map){
34 34 return peopleCarPlanService.scheduleAnaly(map);
35 35 }
  36 +
  37 + @RequestMapping(value="/scheduleAnaly_sum", method = RequestMethod.GET)
  38 + public Map<String, Object> scheduleAnaly_sum(@RequestParam Map<String, Object> map){
  39 + return peopleCarPlanService.scheduleAnaly_sum(map);
  40 + }
36 41  
37 42 @RequestMapping(value="/getModel", method = RequestMethod.GET)
38 43 public List<Map<String,Object>> getModel(@RequestParam Map<String, Object> map){
... ... @@ -44,6 +49,11 @@ public class PeopleCarPlanController {
44 49 return peopleCarPlanService.firstAndLastBus(map);
45 50 }
46 51  
  52 + @RequestMapping(value="/firstAndLastBus_sum", method = RequestMethod.GET)
  53 + public List<Map<String,Object>> firstAndLastBus_sum(@RequestParam Map<String, Object> map){
  54 + return peopleCarPlanService.firstAndLastBus_sum(map);
  55 + }
  56 +
47 57 @RequestMapping(value="/commandState", method = RequestMethod.GET)
48 58 public List<Map<String,Object>> commandState(@RequestParam Map<String, Object> map){
49 59 return peopleCarPlanService.commandState(map);
... ...
src/main/java/com/bsth/service/schedule/PeopleCarPlanService.java
... ... @@ -11,9 +11,13 @@ public interface PeopleCarPlanService {
11 11  
12 12 Map<String, Object> scheduleAnaly(Map<String, Object> map);
13 13  
  14 + Map<String, Object> scheduleAnaly_sum(Map<String, Object> map);
  15 +
14 16 List<Map<String, Object>> getModel(Map<String, Object> map);
15 17  
16 18 List<Map<String, Object>> firstAndLastBus(Map<String, Object> map);
17 19  
  20 + List<Map<String, Object>> firstAndLastBus_sum(Map<String, Object> map);
  21 +
18 22 List<Map<String, Object>> commandState(Map<String, Object> map);
19 23 }
... ...
src/main/java/com/bsth/service/schedule/PeopleCarPlanServiceImpl.java renamed to src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
1   -package com.bsth.service.schedule;
  1 +package com.bsth.service.schedule.impl;
2 2  
3 3 import java.math.BigDecimal;
4 4 import java.net.URLEncoder;
... ... @@ -26,6 +26,7 @@ import org.springframework.stereotype.Service;
26 26 import com.bsth.entity.realcontrol.ScheduleRealInfo;
27 27 import com.bsth.entity.schedule.SchedulePlanInfo;
28 28 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
  29 +import com.bsth.service.schedule.PeopleCarPlanService;
29 30 import com.bsth.util.ReportUtils;
30 31  
31 32 @Service
... ... @@ -1297,6 +1298,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1297 1298  
1298 1299 @Override
1299 1300 public List<Map<String, Object>> firstAndLastBus_sum(Map<String, Object> map) {
  1301 + NumberFormat nf = NumberFormat.getNumberInstance();
  1302 + nf.setMinimumFractionDigits(2);
1300 1303 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
1301 1304 Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>();
1302 1305  
... ... @@ -1351,101 +1354,67 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1351 1354 }
1352 1355 }
1353 1356  
  1357 + int jhbc = 0;
  1358 + int sjbc = 0;
  1359 +
1354 1360 if(longList0.size() != 0){
1355 1361 Collections.sort(longList0);
1356 1362 ScheduleRealInfo shouban0 = temp0.get(longList0.get(0));
1357 1363 ScheduleRealInfo moban0 = temp0.get(longList0.get(longList0.size() - 1));
1358   - tempMap.put("qdzFirst0", shouban0.getQdzName());
1359   - tempMap.put("jhfcFirst0", shouban0.getFcsj());
1360   - tempMap.put("qdzLast0", moban0.getQdzName());
1361   - tempMap.put("jhfcLast0", moban0.getFcsj());
1362 1364 if(shouban0.getFcsjActual() != null){
  1365 + jhbc++;
1363 1366 String[] split = shouban0.getFcsjActual().split(":");
1364 1367 long min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]);
1365 1368 long delay = shouban0.getFcsjT() - min;
1366   - tempMap.put("sjfcFirst0", shouban0.getFcsjActual());
1367   - if(delay > 0)
1368   - tempMap.put("delayFirst0", "+" + delay);
1369   - else
1370   - tempMap.put("delayFirst0", delay);
1371   - } else {
1372   - tempMap.put("sjfcFirst0", "/");
1373   - tempMap.put("delayFirst0", "/");
  1369 + if(delay >= -3 && delay <= 1){
  1370 + sjbc++;
  1371 + }
1374 1372 }
  1373 +
1375 1374 if(moban0.getFcsjActual() != null){
  1375 + jhbc++;
1376 1376 String[] split = moban0.getFcsjActual().split(":");
1377 1377 long min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]);
1378 1378 long delay = moban0.getFcsjT() - min;
1379   - tempMap.put("sjfcLast0", moban0.getFcsjActual());
1380   - if(delay > 0)
1381   - tempMap.put("delayLast0", "+" + delay);
1382   - else
1383   - tempMap.put("delayLast0", delay);
1384   - } else {
1385   - tempMap.put("sjfcLast0", "/");
1386   - tempMap.put("delayLast0", "/");
  1379 + if(delay >= -3 && delay <= 1){
  1380 + sjbc++;
  1381 + }
1387 1382 }
1388   - }else{
1389   - tempMap.put("qdzFirst0", "--");
1390   - tempMap.put("jhfcFirst0", "/");
1391   - tempMap.put("qdzLast0", "--");
1392   - tempMap.put("jhfcLast0", "/");
1393   - tempMap.put("sjfcFirst0", "/");
1394   - tempMap.put("delayFirst0", "/");
1395   - tempMap.put("sjfcLast0", "/");
1396   - tempMap.put("delayLast0", "/");
1397 1383 }
1398 1384  
1399 1385 if(longList1.size() != 0){
1400 1386 Collections.sort(longList1);
1401 1387 ScheduleRealInfo shouban1 = temp1.get(longList1.get(0));
1402 1388 ScheduleRealInfo moban1 = temp1.get(longList1.get(longList1.size() - 1));
1403   - tempMap.put("qdzFirst1", shouban1.getQdzName());
1404   - tempMap.put("jhfcFirst1", shouban1.getFcsj());
1405   - tempMap.put("qdzLast1", moban1.getQdzName());
1406   - tempMap.put("jhfcLast1", moban1.getFcsj());
1407 1389 if(shouban1.getFcsjActual() != null){
  1390 + jhbc++;
1408 1391 String[] split = shouban1.getFcsjActual().split(":");
1409 1392 long min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]);
1410 1393 long delay = shouban1.getFcsjT() - min;
1411   - tempMap.put("sjfcFirst1", shouban1.getFcsjActual());
1412   - if(delay > 0)
1413   - tempMap.put("delayFirst1", "+" + delay);
1414   - else
1415   - tempMap.put("delayFirst1", delay);
1416   - } else {
1417   - tempMap.put("sjfcFirst1", "/");
1418   - tempMap.put("delayFirst1", "/");
  1394 + if(delay >= -3 && delay <= 1){
  1395 + sjbc++;
  1396 + }
1419 1397 }
1420 1398 if(moban1.getFcsjActual() != null){
  1399 + jhbc++;
1421 1400 String[] split = moban1.getFcsjActual().split(":");
1422 1401 long min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]);
1423 1402 long delay = moban1.getFcsjT() - min;
1424   - tempMap.put("sjfcLast1", moban1.getFcsjActual());
1425   - if(delay > 0)
1426   - tempMap.put("delayLast1", "+" + delay);
1427   - else
1428   - tempMap.put("delayLast1", delay);
1429   - } else {
1430   - tempMap.put("sjfcLast1", "/");
1431   - tempMap.put("delayLast1", "/");
  1403 + if(delay >= -3 && delay <= 1){
  1404 + sjbc++;
  1405 + }
1432 1406 }
1433   - }else{
1434   - tempMap.put("qdzFirst1", "--");
1435   - tempMap.put("jhfcFirst1", "/");
1436   - tempMap.put("qdzLast1", "--");
1437   - tempMap.put("jhfcLast1", "/");
1438   - tempMap.put("sjfcFirst1", "/");
1439   - tempMap.put("delayFirst1", "/");
1440   - tempMap.put("sjfcLast1", "/");
1441   - tempMap.put("delayLast1", "/");
1442 1407 }
1443 1408  
  1409 + tempMap.put("jhbc", jhbc);
  1410 + tempMap.put("sjbc", sjbc);
  1411 + tempMap.put("zdl", nf.format((float) sjbc / jhbc *100) + "%");
1444 1412 tempMap.put("date", date);
1445 1413 tempMap.put("company", companyName);
1446 1414 tempMap.put("subCompany", subCompanyName);
1447 1415 tempMap.put("line", key);
1448 1416 resList.add(tempMap);
  1417 + System.out.println(tempMap);
1449 1418 }
1450 1419  
1451 1420 if(type.equals("export")){
... ...
src/main/resources/static/pages/forms/mould/scheduleAnaly_sum.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/statement/firstAndLastBus.html
... ... @@ -64,6 +64,7 @@
64 64 <th colspan="4">下行末发</th>
65 65 </tr>
66 66 <tr class="hidden">
  67 + <th style="display: none;"></th>
67 68 <th>站点</th>
68 69 <th>计发</th>
69 70 <th>实发</th>
... ...
src/main/resources/static/pages/forms/statement/firstAndLastBus_sum.html 0 → 100644
  1 +<style type="text/css">
  2 + .table-bordered {
  3 + border: 1px solid; }
  4 + .table-bordered > thead > tr > th,
  5 + .table-bordered > thead > tr > td,
  6 + .table-bordered > tbody > tr > th,
  7 + .table-bordered > tbody > tr > td,
  8 + .table-bordered > tfoot > tr > th,
  9 + .table-bordered > tfoot > tr > td {
  10 + border: 1px solid; }
  11 + .table-bordered > thead > tr > th,
  12 + .table-bordered > thead > tr > td {
  13 + border-bottom-width: 2px; }
  14 +
  15 + .table > tbody + tbody {
  16 + border-top: 1px solid; }
  17 +</style>
  18 +
  19 +<div class="page-head">
  20 + <div class="page-title">
  21 + <h1>线路首末班准点率</h1>
  22 + </div>
  23 +</div>
  24 +
  25 +<div class="row">
  26 + <div class="col-md-12">
  27 + <div class="portlet light porttlet-fit bordered">
  28 + <div class="portlet-title">
  29 + <form id="history" class="form-inline" action="">
  30 + <div style="display: inline-block;margin-left: 10px;" id="company1">
  31 + <span class="item-label" style="width: 80px;">公司: </span>
  32 + <select class="form-control" name="company" id="company" style="width: 160px;"></select>
  33 + </div>
  34 + <div style="display: inline-block;margin-left: 10px;" id="subCompany1">
  35 + <span class="item-label" style="width: 80px;">分公司: </span>
  36 + <select class="form-control" name="subCompany" id="subCompany" style="width: 160px;"></select>
  37 + </div>
  38 + <div style="display: inline-block;margin-left: 10px;">
  39 + <span class="item-label" style="width: 80px;">线路: </span>
  40 + <select class="form-control" name="line" id="line" style="width: 160px;"></select>
  41 + </div>
  42 + <div style="display: inline-block;margin-left: 10px;">
  43 + <span class="item-label" style="width: 80px;">时间: </span>
  44 + <input class="form-control" type="text" id="date" style="width: 160px;"/>
  45 + </div>
  46 + <div class="form-group">
  47 + <input class="btn btn-default" type="button" id="query" value="筛选"/>
  48 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  49 + </div>
  50 + </form>
  51 + </div>
  52 + <div class="portlet-body">
  53 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  54 + <table class="table table-bordered table-hover table-checkable" id="forms">
  55 + <thead>
  56 + <tr class="hidden">
  57 + <th>日期</th>
  58 + <th>公司</th>
  59 + <th>分公司</th>
  60 + <th>线路</th>
  61 + <th>计划首末班次数</th>
  62 + <th>实际准点首末班次数</th>
  63 + <th>首末班准点率</th>
  64 + </tr>
  65 + </thead>
  66 + <tbody>
  67 +
  68 + </tbody>
  69 + </table>
  70 + <div style="text-align: right;">
  71 + <ul id="pagination" class="pagination"></ul>
  72 + </div>
  73 + </div>
  74 + </div>
  75 + </div>
  76 + </div>
  77 +</div>
  78 +
  79 +<script>
  80 + $(function(){
  81 + $('#export').attr('disabled', "true");
  82 +
  83 + // 关闭左侧栏
  84 + if (!$('body').hasClass('page-sidebar-closed'))
  85 + $('.menu-toggler.sidebar-toggler').click();
  86 +
  87 + $("#date").datetimepicker({
  88 + format : 'YYYY-MM-DD',
  89 + locale : 'zh-cn'
  90 + });
  91 +
  92 + var d = new Date();
  93 + var year = d.getFullYear();
  94 + var month = d.getMonth() + 1;
  95 + var day = d.getDate();
  96 + if(month < 10)
  97 + month = "0" + month;
  98 + if(day < 10)
  99 + day = "0" + day;
  100 + $("#date").val(year + "-" + month + "-" + day);
  101 +
  102 + var fage=false;
  103 + var xlList;
  104 + var obj = [];
  105 +
  106 + $.get('/report/lineList',function(result){
  107 + xlList=result;
  108 + $.get('/user/companyData', function(result){
  109 + obj = result;
  110 + var options = '';
  111 + for(var i = 0; i < obj.length; i++){
  112 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  113 + }
  114 +
  115 + if(obj.length ==0){
  116 + $("#company1").css('display','none');
  117 + }else if(obj.length ==1){
  118 + $("#company1").css('display','none');
  119 + if(obj[0].children.length == 1 || obj[0].children.length ==0)
  120 + $('#subCompany1').css('display','none');
  121 + }
  122 + $('#company').html(options);
  123 + updateCompany();
  124 + });
  125 + })
  126 + $("#company").on("change",updateCompany);
  127 + function updateCompany(){
  128 + var company = $('#company').val();
  129 + var options = '';
  130 + for(var i = 0; i < obj.length; i++){
  131 + if(obj[i].companyCode == company){
  132 + var children = obj[i].children;
  133 + for(var j = 0; j < children.length; j++){
  134 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  135 + }
  136 + }
  137 + }
  138 + $('#subCompany').html(options);
  139 + initXl();
  140 + }
  141 +
  142 + $("#subCompany").on("change",initXl);
  143 + function initXl(){
  144 + var data=[];
  145 + if(fage){
  146 + $("#line").select2("destroy").html('');
  147 + }
  148 + var fgs=$('#subCompany').val();
  149 + var gs=$('#company').val();
  150 + data.push({id: " ", text: "全部线路"});
  151 + for(var i=0;i<xlList.length;i++){
  152 + if(gs!=""){
  153 + if(fgs!=""){
  154 + if(xlList[i]["fgsbm"]==fgs && xlList[i]["gsbm"]==gs){
  155 + data.push({id: xlList[i]["xlbm"], text: xlList[i]["xlname"]});
  156 + }
  157 + }else{
  158 + if(xlList[i]["gsbm"]==gs){
  159 + data.push({id: xlList[i]["xlbm"], text: xlList[i]["xlname"]});
  160 + }
  161 + }
  162 + }
  163 + }
  164 + initPinYinSelect2('#line',data,'');
  165 + fage=true;
  166 + }
  167 +
  168 +
  169 + $("#query").on("click",jsDoQuery);
  170 +
  171 + var company = $("#company").val();
  172 + var subCompany = $("#subCompany").val();
  173 + var line = $("#line").val();
  174 + var date = $("#date").val();
  175 + function jsDoQuery(pagination){
  176 + if($("#date").val() == null || $("#date").val().trim().length == 0){
  177 + layer.msg("请选择时间!");
  178 + return;
  179 + }
  180 + var params = {};
  181 + company = $("#company").val();
  182 + subCompany = $("#subCompany").val();
  183 + line = $("#line").val();
  184 + date = $("#date").val();
  185 + if(line == " ")
  186 + line = "";
  187 + params['company'] = company;
  188 + params['subCompany'] = subCompany;
  189 + params['line'] = line;
  190 + params['line'] = line;
  191 + params['date'] = date;
  192 + params['type'] = "query";
  193 + $(".hidden").removeClass("hidden");
  194 + $get('/pcpc/firstAndLastBus_sum', params, function(result){
  195 + // 把数据填充到模版中
  196 + var tbodyHtml = template('list_firstAndLastBus',{list:result});
  197 + // 把渲染好的模版html文本追加到表格中
  198 + $('#forms tbody').html(tbodyHtml);
  199 +
  200 + if(result.length == 0)
  201 + $("#export").attr('disabled',"true");
  202 + else
  203 + $("#export").removeAttr("disabled");
  204 + });
  205 + }
  206 +
  207 + $("#export").on("click",function(){
  208 + var params = {};
  209 + params['company'] = company;
  210 + params['subCompany'] = subCompany;
  211 + params['line'] = line;
  212 + params['line'] = line;
  213 + params['date'] = date;
  214 + params['type'] = "export";
  215 + $get('/pcpc/firstAndLastBus', params, function(result){
  216 + window.open("/downloadFile/download?fileName=线路首末班"+moment(date).format("YYYYMMDD"));
  217 + });
  218 + });
  219 +
  220 +
  221 + });
  222 +
  223 +</script>
  224 +<script type="text/html" id="list_firstAndLastBus">
  225 + {{each list as obj i}}
  226 + <tr>
  227 + <td>{{obj.date}}</td>
  228 + <td>{{obj.company}}</td>
  229 + <td>{{obj.subCompany}}</td>
  230 + <td>{{obj.line}}</td>
  231 + <td>{{obj.jhbc}}</td>
  232 + <td>{{obj.sjbc}}</td>
  233 + <td>{{obj.zdl}}</td>
  234 + </tr>
  235 + {{/each}}
  236 + {{if list.length == 0}}
  237 + <tr>
  238 + <td colspan="20"><h6 class="muted">没有找到相关数据</h6></td>
  239 + </tr>
  240 + {{/if}}
  241 +</script>
0 242 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/statement/scheduleAnaly_sum.html 0 → 100644
  1 +<style type="text/css">
  2 + .table-bordered {
  3 + border: 1px solid; }
  4 + .table-bordered > thead > tr > th,
  5 + .table-bordered > thead > tr > td,
  6 + .table-bordered > tbody > tr > th,
  7 + .table-bordered > tbody > tr > td,
  8 + .table-bordered > tfoot > tr > th,
  9 + .table-bordered > tfoot > tr > td {
  10 + border: 1px solid; }
  11 + .table-bordered > thead > tr > th,
  12 + .table-bordered > thead > tr > td {
  13 + border-bottom-width: 2px; }
  14 +
  15 + .table > tbody + tbody {
  16 + border-top: 1px solid; }
  17 +</style>
  18 +
  19 +<div class="page-head">
  20 + <div class="page-title">
  21 + <h1>时刻表分析</h1>
  22 + </div>
  23 +</div>
  24 +
  25 +<div class="row">
  26 + <div class="col-md-12">
  27 + <div class="portlet light porttlet-fit bordered">
  28 + <div class="portlet-title">
  29 + <form id="history" class="form-inline" action="">
  30 + <div style="display: inline-block;margin-left: 38px;" id="company1">
  31 + <span class="item-label" style="width: 80px;">公司: </span>
  32 + <select class="form-control" name="company" id="company" style="width: 160px;"></select>
  33 + </div>
  34 + <div style="display: inline-block;margin-left: 24px;" id="subCompany1">
  35 + <span class="item-label" style="width: 80px;">分公司: </span>
  36 + <select class="form-control" name="subCompany" id="subCompany" style="width: 160px;"></select>
  37 + </div>
  38 + <div style="display: inline-block;margin-left: 15px;">
  39 + <span class="item-label" style="width: 80px;">线路: </span>
  40 + <select class="form-control" name="line" id="line" style="width: 160px;"></select>
  41 + </div>
  42 + <div style="margin-top: 10px"></div>
  43 + <div style="display: inline-block;margin-left: 10px;">
  44 + <span class="item-label" style="width: 80px;">开始时间: </span>
  45 + <input class="form-control" type="text" id="startDate" style="width: 160px;"/>
  46 + </div>
  47 + <div style="display: inline-block;margin-left: 10px;">
  48 + <span class="item-label" style="width: 80px;">结束时间: </span>
  49 + <input class="form-control" type="text" id="endDate" style="width: 160px;"/>
  50 + </div>
  51 + <div style="display: inline-block;margin-left: 15px;">
  52 + <span class="item-label" style="width: 80px;">车辆: </span>
  53 + <select class="form-control" id="nbbm" style="width: 160px;"></select>
  54 + </div>
  55 +<!-- <div style="display: inline-block;margin-left: 10px;"> -->
  56 +<!-- <span class="item-label" style="width: 80px;">模板类型: </span> -->
  57 +<!-- <select class="form-control" name="model" id="model" style="width: 160px;"> -->
  58 +<!-- <option value="">请选择...</option> -->
  59 +<!-- </select> -->
  60 +<!-- </div> -->
  61 + <div class="form-group">
  62 + <input class="btn btn-default" type="button" id="query" value="筛选"/>
  63 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  64 + </div>
  65 + </form>
  66 + </div>
  67 + <div class="portlet-body">
  68 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  69 + <table class="table table-bordered table-hover table-checkable" id="forms">
  70 + <thead>
  71 + <tr class="hidden">
  72 + <th style="display: none;"></th>
  73 + <th>时间段</th>
  74 + <th>上行班次</th>
  75 + <th>下行班次</th>
  76 + <th>上行平均运送</th>
  77 + <th>下行平均运送</th>
  78 + <th>平均运送</th>
  79 + </tr>
  80 + </thead>
  81 + <tbody>
  82 +
  83 + </tbody>
  84 + </table>
  85 + <div style="text-align: right;">
  86 + <ul id="pagination" class="pagination"></ul>
  87 + </div>
  88 + </div>
  89 + </div>
  90 + </div>
  91 + </div>
  92 +</div>
  93 +
  94 +<script>
  95 + $(function(){
  96 + var page = 0, initPagination;
  97 + $('#export').attr('disabled', "true");
  98 +
  99 + // 关闭左侧栏
  100 + if (!$('body').hasClass('page-sidebar-closed'))
  101 + $('.menu-toggler.sidebar-toggler').click();
  102 +
  103 + $("#startDate").datetimepicker({
  104 + format : 'YYYY-MM-DD',
  105 + locale : 'zh-cn'
  106 + });
  107 +
  108 + $("#endDate").datetimepicker({
  109 + format : 'YYYY-MM-DD',
  110 + locale : 'zh-cn'
  111 + });
  112 +
  113 + var d = new Date();
  114 + var year = d.getFullYear();
  115 + var month = d.getMonth() + 1;
  116 + var day = d.getDate();
  117 + if(month < 10)
  118 + month = "0" + month;
  119 + if(day < 10)
  120 + day = "0" + day;
  121 + $("#startDate").val(year + "-" + month + "-" + day);
  122 + $("#endDate").val(year + "-" + month + "-" + day);
  123 +
  124 + var fage=false;
  125 + var xlList;
  126 + var obj = [];
  127 +
  128 + $.get('/report/lineList',function(result){
  129 + xlList=result;
  130 + $.get('/user/companyData', function(result){
  131 + obj = result;
  132 + var options = '';
  133 + for(var i = 0; i < obj.length; i++){
  134 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  135 + }
  136 +
  137 + if(obj.length ==0){
  138 + $("#company1").css('display','none');
  139 + }else if(obj.length ==1){
  140 + $("#company1").css('display','none');
  141 + if(obj[0].children.length == 1 || obj[0].children.length ==0)
  142 + $('#subCompany1').css('display','none');
  143 + }
  144 + $('#company').html(options);
  145 + updateCompany();
  146 + });
  147 + })
  148 + $("#company").on("change",updateCompany);
  149 + function updateCompany(){
  150 + var company = $('#company').val();
  151 + var options = '';
  152 + for(var i = 0; i < obj.length; i++){
  153 + if(obj[i].companyCode == company){
  154 + var children = obj[i].children;
  155 + for(var j = 0; j < children.length; j++){
  156 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  157 + }
  158 + }
  159 + }
  160 + $('#subCompany').html(options);
  161 + initXl();
  162 + }
  163 +
  164 + $("#subCompany").on("change",initXl);
  165 + function initXl(){
  166 + var data=[];
  167 + if(fage){
  168 + $("#line").select2("destroy").html('');
  169 + }
  170 + var fgs=$('#subCompany').val();
  171 + var gs=$('#company').val();
  172 + for(var i=0;i<xlList.length;i++){
  173 + if(gs!=""){
  174 + if(fgs!=""){
  175 + if(xlList[i]["fgsbm"]==fgs && xlList[i]["gsbm"]==gs){
  176 + data.push({id: xlList[i]["xlbm"], text: xlList[i]["xlname"]});
  177 + }
  178 + }else{
  179 + if(xlList[i]["gsbm"]==gs){
  180 + data.push({id: xlList[i]["xlbm"], text: xlList[i]["xlname"]});
  181 + }
  182 + }
  183 + }
  184 + }
  185 + initPinYinSelect2('#line',data,'');
  186 + line = data[0].id;
  187 + updateModel();
  188 + initCl();
  189 +
  190 + fage=true;
  191 + }
  192 +
  193 +
  194 + $("#query").on("click", function(){
  195 + page = 0;
  196 + jsDoQuery(true);
  197 + });
  198 +
  199 + var line = $("#line").val();
  200 + var startDate = $("#startDate").val();
  201 + var endDate = $("#endDate").val();
  202 + var model = $("#model").val();
  203 + var nbbm = "";
  204 + var company = $("#company").val();
  205 + var subCompany = $("#subCompany").val();
  206 + function jsDoQuery(pagination){
  207 + if($("#startDate").val() == null || $("#startDate").val().trim().length == 0){
  208 + layer.msg("请选择时间范围!");
  209 + return;
  210 + }
  211 + if($("#endDate").val() == null || $("#endDate").val().trim().length == 0){
  212 + layer.msg("请选择时间范围!");
  213 + return;
  214 + }
  215 + var params = {};
  216 +// line = $("#line").val();
  217 + startDate = $("#startDate").val();
  218 + endDate = $("#endDate").val();
  219 +// model = $("#model").val();
  220 + nbbm = $("#nbbm").val()!=null?$("#nbbm").val():"";
  221 + company = $("#company").val();
  222 + subCompany = $("#subCompany").val();
  223 + params['page'] = page;
  224 + params['line'] = line;
  225 + params['startDate'] = startDate;
  226 + params['endDate'] = endDate;
  227 +// params['model'] = model;
  228 + params['company'] = company;
  229 + params['subCompany'] = subCompany;
  230 + params['nbbm'] = nbbm;
  231 + params['type'] = "query";
  232 + $(".hidden").removeClass("hidden");
  233 + $get('/pcpc/scheduleAnaly_sum', params, function(result){
  234 + // 把数据填充到模版中
  235 + var tbodyHtml = template('list_scheduleAnaly',{list:result.dataList});
  236 + // 把渲染好的模版html文本追加到表格中
  237 + $('#forms tbody').html(tbodyHtml);
  238 +
  239 + if(result.dataList.length == 0)
  240 + $("#export").attr('disabled',"true");
  241 + else
  242 + $("#export").removeAttr("disabled");
  243 +
  244 + });
  245 + }
  246 +
  247 + $("#export").on("click",function(){
  248 + if($("#startDate").val() == null || $("#startDate").val().trim().length == 0){
  249 + layer.msg("请选择时间范围!");
  250 + return;
  251 + }
  252 + if($("#endDate").val() == null || $("#endDate").val().trim().length == 0){
  253 + layer.msg("请选择时间范围!");
  254 + return;
  255 + }
  256 + var params = {};
  257 + params['page'] = page;
  258 + params['line'] = line;
  259 + params['startDate'] = startDate;
  260 + params['endDate'] = endDate;
  261 +// params['model'] = model;
  262 + params['company'] = company;
  263 + params['subCompany'] = subCompany;
  264 + params['nbbm'] = nbbm;
  265 + params['type'] = "export";
  266 + $get('/pcpc/scheduleAnaly_sum', params, function(result){
  267 + window.open("/downloadFile/download?fileName=时刻表分析(汇总)"+moment(startDate).format("YYYYMMDD")+"-"+moment(endDate).format("YYYYMMDD"));
  268 + });
  269 + });
  270 +
  271 +
  272 + $("#line").on("change", function(){
  273 + line = $("#line").val();
  274 + if(line == " ")
  275 + line = "";
  276 + updateModel();
  277 + });
  278 + $('#startDate').on("blur", function(){
  279 + startDate = $("#startDate").val();
  280 + endDate = $("#endDate").val();
  281 + updateModel();
  282 + });
  283 + $('#endDate').on("blur", function(){
  284 + startDate = $("#startDate").val();
  285 + endDate = $("#endDate").val();
  286 + updateModel();
  287 + });
  288 +
  289 + var flag = 0;
  290 + function updateModel(){
  291 + if(flag == 1)
  292 + return;
  293 + flag = 1;
  294 + var treeData = [];
  295 + var params = {};
  296 + params['line'] = line;
  297 + params['startDate'] = startDate;
  298 + params['endDate'] = endDate;
  299 + $get('/pcpc/getModel', params, function(result){
  300 + treeData = createTreeData(result);
  301 + var options = '<option value="">请选择...</option>';
  302 + var size = 0;
  303 + $.each(treeData, function(i, g){
  304 + options += '<option value="'+g.id+'">'+g.name+'</option>';
  305 + size++;
  306 + });
  307 + $('#model').html(options)/* .select2() */;
  308 + flag = 0;
  309 + });
  310 + }
  311 +
  312 + function initCl(){
  313 + $('#nbbm').select2({
  314 + placeholder: '搜索车辆...',
  315 + ajax: {
  316 + url: '/report/carList',
  317 + dataType: 'json',
  318 + delay: 150,
  319 + data: function(params){
  320 + return{nbbm: params.term,
  321 + gsbm:$('#gsdm').val(),
  322 + fgsbm:$('#fgsdm').val(),
  323 + xlbm:$('#line').val()};
  324 + },
  325 + processResults: function (data) {
  326 + return {
  327 + results: data
  328 + };
  329 + },
  330 + cache: true
  331 + },
  332 + templateResult: function(repo){
  333 + if (repo.loading) return repo.text;
  334 + var h = '<span>'+repo.text+'</span>';
  335 + h += (repo.lineName?'&nbsp;<span class="select2-desc">'+repo.lineName+'</span>':'');
  336 + return h;
  337 + },
  338 + escapeMarkup: function (markup) { return markup; },
  339 + minimumInputLength: 1,
  340 + templateSelection: function(repo){
  341 + return repo.text;
  342 + },
  343 + language: {
  344 + noResults: function(){
  345 + return '<span style="color:red;font-size: 12px;">没有搜索到车辆!</span>';
  346 + },
  347 + inputTooShort : function(e) {
  348 + return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入自编号搜索车辆</span>';
  349 + },
  350 + searching : function() {
  351 + return '<span style="color:gray;font-size: 12px;"> 正在搜索车辆...</span>';
  352 + }
  353 + }
  354 + });
  355 + };
  356 +
  357 +
  358 + });
  359 +
  360 +</script>
  361 +<script type="text/html" id="list_scheduleAnaly">
  362 + {{each list as obj i}}
  363 + <tr>
  364 + <th style="display: none;"></th>
  365 + <td>{{obj.time}}</td>
  366 + <td>{{obj.upbc}}</td>
  367 + <td>{{obj.dnbc}}</td>
  368 + <td>{{obj.upys}}</td>
  369 + <td>{{obj.dnys}}</td>
  370 + <td>{{obj.pjys}}</td>
  371 + </tr>
  372 + {{/each}}
  373 + {{if list.length == 0}}
  374 + <tr>
  375 + <td colspan="6"><h6 class="muted">没有找到相关数据</h6></td>
  376 + </tr>
  377 + {{/if}}
  378 +</script>
0 379 \ No newline at end of file
... ...