Commit f646656c2aebf58be3b7b5ebc5f88ef180a447b7

Authored by 廖磊
1 parent 5fb980d4

大间隔统计

src/main/java/com/bsth/controller/report/ReportController.java
... ... @@ -269,9 +269,11 @@ public class ReportController {
269 269  
270 270 @RequestMapping(value="/countBusMileage")
271 271 public List<Map<String,Object>> countBusMileage(@RequestParam Map<String, Object> map){
272   -
273 272 return service.countByBusList(map);
274 273 }
275 274  
276   -
  275 + @RequestMapping(value="/countDjg")
  276 + public List<Map<String, Object>> countDjg(@RequestParam Map<String, Object> map){
  277 + return service.countDjg(map);
  278 + }
277 279 }
... ...
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
... ... @@ -147,16 +147,20 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
147 147 List<ScheduleRealInfo> scheduleByDateAndLineQp(String line,String date);
148 148  
149 149 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  150 + @Query(value="select DISTINCT s from ScheduleRealInfo s where gsBm like %?1% and fgsBm like %?2% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?3 and s.bcType not in ('in','out','ldks') order by s.xlDir,s.realExecDate,s.dfsj, (s.lpName+1)")
  151 + List<ScheduleRealInfo> scheduleByDateAndLineByGs(String gsdm,String fgsdm,String date);
  152 +
  153 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
150 154 @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.xlDir,s.realExecDate,s.dfsj, (s.lpName+1)")
151 155 List<ScheduleRealInfo> scheduleByDateAndLineQp2(String line,String date);
152 156  
153 157 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
154   - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.bcType not in ('in','out') order by s.xlBm,s.adjustExps,s.fcsj")
  158 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.bcType not in ('in','out','ldks') order by s.xlBm,s.adjustExps,s.fcsj")
155 159 List<ScheduleRealInfo> scheduleByDateAndLine2(String line,String date);
156 160  
157 161 //按月统计
158 162 @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
159   - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m') = ?2 and s.bcType not in ('in','out') order by s.xlBm")
  163 + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m') = ?2 and s.bcType not in ('in','out','ldks') order by s.xlBm")
160 164 List<ScheduleRealInfo> scheduleByDateAndLine3(String line,String date);
161 165  
162 166 //按照时间段统计
... ...
src/main/java/com/bsth/service/report/ReportService.java
... ... @@ -46,4 +46,6 @@ public interface ReportService {
46 46 List<Map<String, Object>> countByList(Map<String, Object> map);
47 47  
48 48 List<Map<String, Object>> countByBusList(Map<String, Object> map);
  49 +
  50 + List<Map<String, Object>> countDjg(Map<String, Object> map);
49 51 }
... ...
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
... ... @@ -8,15 +8,19 @@ import com.bsth.entity.oil.Dlb;
8 8 import com.bsth.entity.oil.Ylb;
9 9 import com.bsth.entity.realcontrol.ChildTaskPlan;
10 10 import com.bsth.entity.realcontrol.ScheduleRealInfo;
  11 +import com.bsth.entity.sys.Interval;
11 12 import com.bsth.repository.LineRepository;
12 13 import com.bsth.repository.StationRouteRepository;
13 14 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
14 15 import com.bsth.service.report.CulateMileageService;
15 16 import com.bsth.service.report.ReportService;
16 17 import com.bsth.util.Arith;
  18 +import com.bsth.util.ComparableChild;
17 19 import com.bsth.util.ComparableJob;
18 20 import com.bsth.util.ReportUtils;
19 21 import com.bsth.util.db.DBUtils_MS;
  22 +import com.google.protobuf.StringValue;
  23 +
20 24 import org.apache.commons.lang.StringUtils;
21 25 import org.slf4j.Logger;
22 26 import org.slf4j.LoggerFactory;
... ... @@ -57,6 +61,7 @@ public class ReportServiceImpl implements ReportService{
57 61 LineRepository lineRepository;
58 62 @Autowired
59 63 StationRouteRepository stationRouteRepository;
  64 +
60 65 @Override
61 66 public List<ScheduleRealInfo> queryListBczx(String line, String date,String clzbh) {
62 67 // TODO Auto-generated method stub
... ... @@ -2221,5 +2226,244 @@ public class ReportServiceImpl implements ReportService{
2221 2226 }
2222 2227 return lMap;
2223 2228 }
  2229 + @Override
  2230 + public List<Map<String, Object>> countDjg(Map<String, Object> map) {
  2231 + // TODO Auto-generated method stub
  2232 + List<Map<String, Object>> lMap=new ArrayList<Map<String,Object>>();
  2233 + String line=map.get("line").toString().trim();
  2234 + String date=map.get("date").toString();
  2235 + String gsbm=map.get("gsbm").toString();
  2236 + String fgsbm=map.get("fgsbm").toString();
  2237 + List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>();
  2238 + if(line.equals("")){
  2239 + list=scheduleRealInfoRepository.scheduleByDateAndLineByGs(gsbm, fgsbm, date);
  2240 +
  2241 + }else{
  2242 + list=scheduleRealInfoRepository.scheduleByDateAndLine2(line, date);
  2243 + }
  2244 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
  2245 +// Collections.sort(listInfo,new ComparableAcuals());
  2246 + //查询所有线路
  2247 + String xlSql="select line_code,spac_grade from bsth_c_line ";
  2248 + if(line.equals("")){
  2249 + xlSql +=" where company ='"+gsbm+"'";
  2250 + }else{
  2251 + xlSql +=" where line_code ='"+line+"'";
  2252 + }
  2253 +
  2254 + List<Map<String, Object>> xlList=jdbcTemplate.query(xlSql, new RowMapper<Map<String, Object>>() {
  2255 + @Override
  2256 + public Map<String, Object> mapRow(ResultSet arg0, int arg1) throws SQLException {
  2257 + Map<String, Object> map=new HashMap<String,Object>();
  2258 + map.put("line",arg0.getString("line_code"));
  2259 + map.put("grade", arg0.getString("spac_grade"));
  2260 + return map;
  2261 + }
  2262 + });
  2263 + //查询大间隔时间
  2264 + String djgSql="select * from bsth_c_interval";
  2265 + List<Interval> djgList=jdbcTemplate.query(djgSql, new RowMapper<Interval>() {
  2266 + @Override
  2267 + public Interval mapRow(ResultSet arg0, int arg1) throws SQLException {
  2268 + Interval m=new Interval();
  2269 + m.setLevel(arg0.getString("level"));
  2270 + m.setPeak(arg0.getInt("peak"));
  2271 + m.setTrough(arg0.getInt("trough"));
  2272 + return m;
  2273 + }
  2274 + });
  2275 +
  2276 +
  2277 + for (int i = 0; i < xlList.size(); i++) {
  2278 + String lineCode=xlList.get(i).get("line").toString();
  2279 + String grade =xlList.get(i).get("grade").toString();
  2280 + int peak=0;
  2281 + int trough=0;
  2282 + for (int j = 0; j < djgList.size(); j++) {
  2283 + Interval il=djgList.get(j);
  2284 + if(il.getLevel().equals(grade)){
  2285 + peak=il.getPeak();
  2286 + trough=il.getTrough();
  2287 + continue;
  2288 + }
  2289 + }
  2290 + List<ScheduleRealInfo> list_=new ArrayList<ScheduleRealInfo>();
  2291 + List<ScheduleRealInfo> listInfo=new ArrayList<ScheduleRealInfo>();
  2292 + for (int j = 0; j < list.size(); j++) {
  2293 + ScheduleRealInfo sinfo=list.get(j);
  2294 + try {
  2295 + if(sinfo.getXlBm().equals(lineCode)){
  2296 + list_.add(sinfo);
  2297 + ScheduleRealInfo s=checkBc(sinfo);
  2298 + String fcsj=s.getFcsjActual()==null?"":s.getFcsjActual();
  2299 + if(!fcsj.equals("")){
  2300 + Long fcsjAcual = sdf.parse(s.getRealExecDate() + " " + s.getFcsjActual()).getTime();
  2301 + s.setFcsjActualTime(fcsjAcual);
  2302 + s.setFcsjActual(fcsj);
  2303 + listInfo.add(s);
  2304 + }
  2305 +
  2306 + }
  2307 + } catch (ParseException e) {
  2308 + // TODO Auto-generated catch block
  2309 + e.printStackTrace();
  2310 + }
  2311 + }
  2312 + if(listInfo.size()>0){
  2313 + int sjbcs=culateService.culateSjbc(list_, "")+culateService.culateLjbc(list_, "");
  2314 + Map<String, Object> m=listDjg(gsbm,fgsbm,lineCode,sjbcs,peak,trough,listInfo,grade);
  2315 + lMap.add(m);
  2316 + }
  2317 +
  2318 + }
  2319 + return lMap;
  2320 + }
2224 2321  
  2322 + public ScheduleRealInfo checkBc(ScheduleRealInfo s){
  2323 + //如果班次有子任务 且 子任务中有属于营运的。把该子任务的发车时间设置成班次的发车时间
  2324 + String fcsj=s.getFcsjActual()==null?"":s.getFcsjActual();
  2325 + if(fcsj.equals("")){
  2326 + Set<ChildTaskPlan> childTaskPlans = s.getcTasks();
  2327 + if(!childTaskPlans.isEmpty()){
  2328 + List<ChildTaskPlan> listit=new ArrayList<ChildTaskPlan>(childTaskPlans);
  2329 + Collections.sort(listit, new ComparableChild());
  2330 + for (int i = 0; i < listit.size(); i++) {
  2331 + ChildTaskPlan c=listit.get(i);
  2332 + if(!c.isDestroy()){
  2333 + if(c.getMileageType().equals("service")){
  2334 + s.setFcsjActual(c.getStartDate());
  2335 + break;
  2336 + }
  2337 +
  2338 + }
  2339 + }
  2340 + }
  2341 + }
  2342 + return s;
  2343 + }
  2344 +
  2345 + public Map<String, Object> listDjg(String gsdm,String fgsdm,String line,int sjbcs,int peak,int trough,List<ScheduleRealInfo> listInfo,String grade){
  2346 + DecimalFormat df = new DecimalFormat("#0.00");
  2347 + Collections.sort(listInfo,new ComparableAcuals());
  2348 + List<ScheduleRealInfo> listInfo0=new ArrayList<ScheduleRealInfo>();
  2349 + List<ScheduleRealInfo> listInfo1=new ArrayList<ScheduleRealInfo>();
  2350 + for (int i = 0; i < listInfo.size(); i++) {
  2351 + ScheduleRealInfo s=listInfo.get(i);
  2352 + if(s.getXlDir().equals("0")){
  2353 + listInfo0.add(s);
  2354 + }else{
  2355 + listInfo0.add(s);
  2356 + }
  2357 +
  2358 + }
  2359 + Map<String, Object> map=new HashMap<String, Object>();
  2360 + map.put("line", line);
  2361 + map.put("xlName", BasicData.lineCode2NameMap.get(line));
  2362 + map.put("fgsname", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  2363 + map.put("bcs", sjbcs);
  2364 + map.put("djgde", grade);
  2365 + int djgcs=0;
  2366 + List<Map<String, Object>> mapList=new ArrayList<Map<String, Object>>();
  2367 + for (int i = 0; i < listInfo0.size(); i++) {
  2368 + ScheduleRealInfo s=listInfo.get(i);
  2369 + Long fcsjTime=s.getFcsjActualTime();
  2370 + String time=s.getFcsjActual();
  2371 + String[] fcsjStr = time.split(":");
  2372 + long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]);
  2373 + if(i<listInfo.size()-1){
  2374 + Long djg=0l;
  2375 + Long fscjNext=listInfo.get(i+1).getFcsjActualTime();
  2376 + if((fcsj>=zgf1&&fcsj<=zgf2)||(fcsj>=wgf1&&fcsj<=wgf2)){
  2377 + djg = (long) (peak*60*1000);
  2378 + if(fscjNext-fcsjTime>djg){
  2379 + djgcs ++;
  2380 + Map<String, Object> m=new HashMap<String,Object>();
  2381 + m.put("xlName", BasicData.lineCode2NameMap.get(line));
  2382 + m.put("fgsname", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  2383 + m.put("djgde", grade);
  2384 + m.put("qJh", s.getFcsj());
  2385 + m.put("qSj", time);
  2386 + m.put("hJh", listInfo.get(i+1).getFcsj());
  2387 + m.put("hSj", listInfo.get(i+1).getFcsjActual());
  2388 + mapList.add(m);
  2389 + }
  2390 + }else{
  2391 + djg = (long) (trough*60*1000);
  2392 + if(fscjNext-fcsjTime>djg){
  2393 + djgcs ++;
  2394 + Map<String, Object> m=new HashMap<String,Object>();
  2395 + m.put("xlName", BasicData.lineCode2NameMap.get(line));
  2396 + m.put("fgsname", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  2397 + m.put("djgde", grade);
  2398 + m.put("qJh", s.getFcsj());
  2399 + m.put("qSj", time);
  2400 + m.put("hJh", listInfo.get(i+1).getFcsj());
  2401 + m.put("hSj", listInfo.get(i+1).getFcsjActual());
  2402 + mapList.add(m);
  2403 + }
  2404 + }
  2405 + }
  2406 + }
  2407 +
  2408 + for (int i = 0; i < listInfo1.size(); i++) {
  2409 + ScheduleRealInfo s=listInfo.get(i);
  2410 + Long fcsjTime=s.getFcsjActualTime();
  2411 + String time=s.getFcsjActual();
  2412 + String[] fcsjStr = time.split(":");
  2413 + long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]);
  2414 + if(i<listInfo.size()-1){
  2415 + Long djg=0l;
  2416 + Long fscjNext=listInfo.get(i+1).getFcsjActualTime();
  2417 + if((fcsj>=zgf1&&fcsj<=zgf2)||(fcsj>=wgf1&&fcsj<=wgf2)){
  2418 + djg = (long) (peak*60*1000);
  2419 + if(fscjNext-fcsjTime>djg){
  2420 + djgcs ++;
  2421 + Map<String, Object> m=new HashMap<String,Object>();
  2422 + m.put("xlName", BasicData.lineCode2NameMap.get(line));
  2423 + m.put("fgsname", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  2424 + m.put("djgde", grade);
  2425 + m.put("qJh", s.getFcsj());
  2426 + m.put("qSj", time);
  2427 + m.put("hJh", listInfo.get(i+1).getFcsj());
  2428 + m.put("hSj", listInfo.get(i+1).getFcsjActual());
  2429 + mapList.add(m);
  2430 + }
  2431 + }else{
  2432 + djg = (long) (trough*60*1000);
  2433 + if(fscjNext-fcsjTime>djg){
  2434 + djgcs ++;
  2435 + Map<String, Object> m=new HashMap<String,Object>();
  2436 + m.put("xlName", BasicData.lineCode2NameMap.get(line));
  2437 + m.put("fgsname", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  2438 + m.put("djgde", grade);
  2439 + m.put("qJh", s.getFcsj());
  2440 + m.put("qSj", time);
  2441 + m.put("hJh", listInfo.get(i+1).getFcsj());
  2442 + m.put("hSj", listInfo.get(i+1).getFcsjActual());
  2443 + mapList.add(m);
  2444 + }
  2445 + }
  2446 + }
  2447 + }
  2448 + double fsl=0.0;
  2449 + if(sjbcs>0){
  2450 + fsl=Arith.div(djgcs,sjbcs, 2)*100;
  2451 + }
  2452 +
  2453 + map.put("djgcs", djgcs);
  2454 + map.put("fsl", df.format(fsl)+"%");
  2455 + map.put("djgxx", mapList);
  2456 + return map;
  2457 + }
  2458 +
  2459 +}
  2460 +
  2461 +class ComparableAcuals implements Comparator<ScheduleRealInfo>{
  2462 +
  2463 + @Override
  2464 + public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) {
  2465 + // TODO Auto-generated method stub
  2466 + return o1.getFcsjActualTime().compareTo(o2.getFcsjActualTime());
  2467 + }
  2468 +
2225 2469 }
... ...
src/main/resources/static/pages/report/countInterval/countInterval.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 class="form-inline" action="">
  30 + <div style="display: inline-block;margin-left: 28px; " id="gsdmDiv">
  31 + <span class="item-label" style="width: 80px;">公司: </span>
  32 + <select class="form-control" name="company" id="gsdm" style="width: 180px;"></select>
  33 + </div>
  34 + <div style="display: inline-block; margin-left: 29px;" id="fgsdmDiv">
  35 + <span class="item-label" style="width: 80px;">分公司: </span>
  36 + <select class="form-control" name="subCompany" id="fgsdm" style="width: 180px;"></select>
  37 + </div>
  38 + <div style="display: inline-block;">
  39 + <span class="item-label" style="width: 80px;">线路: </span>
  40 + <select class="form-control" name="line" id="line" style="width: 180px;"></select>
  41 + </div>
  42 + <div style="display: inline-block;margin-left: 15px;">
  43 + <span class="item-label" style="width: 80px;">时间: </span>
  44 + <input class="form-control" type="text" id="date" style="width: 180px;"/>
  45 + </div>
  46 + <div class="form-group" style="display: inline-block;margin-left: 15px;">
  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="row" class="col-md-12">
  54 + <div class="col-md-5">
  55 + <div id="left_table" style="margin-top: 10px;overflow:auto;height: 860px">
  56 + <table class="table table-bordered table-hover table-checkable pre-scrollable" id="info_inter">
  57 + <thead>
  58 + <tr class="hidden">
  59 + <th>分公司</th>
  60 + <th>线路</th>
  61 + <th>等级</th>
  62 + <th>班次数</th>
  63 + <th>发生次数</th>
  64 + <th>发生率</th>
  65 + </tr>
  66 + </thead>
  67 + <tbody>
  68 +
  69 + </tbody>
  70 + </table>
  71 + </div>
  72 + </div>
  73 + <div class="col-md-7" id="printArea">
  74 + <div class="table-container" id="table" style="margin-top: 10px;overflow:auto;">
  75 + <table class="table table-bordered table-hover table-checkable" id="forms">
  76 + <thead class="hidden">
  77 + <tr >
  78 + <th rowspan="2">分公司</th>
  79 + <th rowspan="2">线路</th>
  80 + <th rowspan="2">大间隔等级</th>
  81 + <th colspan="4">发生大间隔班次</th>
  82 + </tr>
  83 + <tr>
  84 + <th>计发</th>
  85 + <th>实发</th>
  86 + <th>计发</th>
  87 + <th>实发</th>
  88 + </tr>
  89 + </thead>
  90 + <tbody>
  91 +
  92 + </tbody>
  93 + </table>
  94 + </div>
  95 + </div>
  96 + </div>
  97 + </div>
  98 + </div>
  99 + </div>
  100 +</div>
  101 +
  102 +<script>
  103 + $(function(){
  104 + // 关闭左侧栏
  105 + if (!$('body').hasClass('page-sidebar-closed'))
  106 + $('.menu-toggler.sidebar-toggler').click();
  107 +
  108 + $("#date").datetimepicker({
  109 + format : 'YYYY-MM-DD',
  110 + locale : 'zh-cn'
  111 + });
  112 +
  113 +
  114 + var d = new Date();
  115 + var year = d.getFullYear();
  116 + var month = d.getMonth() + 1;
  117 + var day = d.getDate();
  118 + if(month < 9)
  119 + month = "0" + month;
  120 + if(day < 9)
  121 + day = "0" + day;
  122 + $("#date").val(year + "-" + month + "-" + day);
  123 + var fage=false;
  124 + var obj = [];
  125 + var xlList;
  126 + $.get('/report/lineList',function(result){
  127 + xlList=result;
  128 + $.get('/user/companyData', function(result){
  129 + obj = result;
  130 + var options = '';
  131 + for(var i = 0; i < obj.length; i++){
  132 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  133 + }
  134 +
  135 + if(obj.length ==0){
  136 + $("#gsdmDiv").css('display','none');
  137 + }else if(obj.length ==1){
  138 + $("#gsdmDiv").css('display','none');
  139 + if(obj[0].children.length == 1 || obj[0].children.length ==0)
  140 + $('#fgsdmDiv').css('display','none');
  141 + }
  142 + $('#gsdm').html(options);
  143 + updateCompany();
  144 + });
  145 + })
  146 + $("#gsdm").on("change",updateCompany);
  147 + function updateCompany(){
  148 + var company = $('#gsdm').val();
  149 + var options = '';
  150 + for(var i = 0; i < obj.length; i++){
  151 + if(obj[i].companyCode == company){
  152 + var children = obj[i].children;
  153 + for(var j = 0; j < children.length; j++){
  154 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  155 + }
  156 + }
  157 + }
  158 + $('#fgsdm').html(options);
  159 + }
  160 +
  161 +
  162 + var tempData = {};
  163 + $.get('/report/lineList',function(xlList){
  164 + var data = [];
  165 + data.push({id: " ", text: "全部线路"});
  166 + $.get('/user/companyData', function(result){
  167 + for(var i = 0; i < result.length; i++){
  168 + var companyCode = result[i].companyCode;
  169 + var children = result[i].children;
  170 + for(var j = 0; j < children.length; j++){
  171 + var code = children[j].code;
  172 + for(var k=0;k < xlList.length;k++ ){
  173 + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){
  174 + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
  175 + tempData[xlList[k]["xlbm"]] = companyCode+":"+code;
  176 + }
  177 + }
  178 + }
  179 + }
  180 + initPinYinSelect2('#line',data,'');
  181 +
  182 + });
  183 + });
  184 +
  185 + $("#line").on("change", function(){
  186 + if($("#line").val() == " "){
  187 + $("#gsdm").attr("disabled", false);
  188 + $("#fgsdm").attr("disabled", false);
  189 + } else {
  190 + var temp = tempData[$("#line").val()].split(":");
  191 + $("#gsdm").val(temp[0]);
  192 + updateCompany();
  193 + $("#fgsdm").val(temp[1]);
  194 + $("#gsdm").attr("disabled", true);
  195 + $("#fgsdm").attr("disabled", true);
  196 + }
  197 + });
  198 +
  199 + var date = '';
  200 + var gsbm="";
  201 + var fgsbm="";
  202 + var listRe=null;
  203 + var line = $("#line").val();
  204 + $("#query").on("click",function(){
  205 + if($("#date").val() == null || $("#date").val().trim().length == 0){
  206 + layer.msg("请选择时间!");
  207 + return;
  208 + }
  209 +// $("#left_table").height($(window).height()-100);
  210 + line = $("#line").val();
  211 + date = $("#date").val();
  212 + gsbm =$("#gsdm").val();
  213 + fgsbm=$("#fgsdm").val();
  214 + $(".hidden").removeClass("hidden");
  215 + $get('/report/countDjg',{line:line,date:date,gsbm:gsbm,fgsbm:fgsbm},function(result){
  216 + listRe=result;
  217 + // 把数据填充到模版中
  218 + var tbodyHtml = template('list_inter_info',{list:result});
  219 + // 把渲染好的模版html文本追加到表格中
  220 + $('#info_inter tbody').html(tbodyHtml);
  221 +
  222 + $('.btn-intervalList').on('click', showIntervalList);
  223 +
  224 +
  225 + });
  226 + });
  227 +
  228 + function showIntervalList(){
  229 +
  230 + $("#info_inter tbody tr td button").css('background-color', 'blue');
  231 + $(this).css('background-color', '#99CCFF');
  232 + var line_ = $(this).data('id');
  233 + var listXx;
  234 + $.each(listRe, function (i, obj) {
  235 + if(obj.line==line_){
  236 + listXx=obj.djgxx;
  237 + }
  238 + });
  239 +// if(listXx.length>0){
  240 + $(".hidden").removeClass("hidden");
  241 + var interList = template('list_inter_info_xx',{list:listXx});
  242 + $('#forms tbody').html(interList);
  243 + $("html,body").animate({scrollTop:$("#forms_1").offset().top},1000);
  244 +// }
  245 +
  246 + }
  247 +
  248 + /* $("#export").on("click",function(){
  249 + $get('/realSchedule/historyMessage',{line:line,date:date,code:jName,type:"export_msg"},function(result){
  250 + window.open("/downloadFile/download?fileName=调度消息分析"+moment(date).format("YYYYMMDD"));
  251 + });
  252 + }); */
  253 +
  254 +
  255 +
  256 + });
  257 +</script>
  258 +<script type="text/html" id="list_inter_info">
  259 + {{each list as obj i}}
  260 + <tr>
  261 + <td width="20%">{{obj.fgsname}}</td>
  262 + <td width="20%">{{obj.xlName}}</td>
  263 + <td width="15%">{{obj.djgde}}</td>
  264 + <td width="15%">{{obj.bcs}}</td>
  265 + <td width="15%"><button type="button" class="btn btn-sm blue btn-intervalList"
  266 + data-id="{{obj.line}}">{{obj.djgcs}}</button></td>
  267 + <td width="15%" >{{obj.fsl}}</td>
  268 + </tr>
  269 + {{/each}}
  270 + {{if list.length == 0}}
  271 + <tr>
  272 + <td colspan="6"><h6 class="muted">没有找到相关数据</h6></td>
  273 + </tr>
  274 + {{/if}}
  275 +</script>
  276 +
  277 +<script type="text/html" id="list_inter_info_xx">
  278 + {{each list as obj i}}
  279 + <tr>
  280 + <td width="20%">{{obj.fgsname}}</td>
  281 + <td width="20%">{{obj.xlName}}</td>
  282 + <td width="10%">{{obj.djgde}}</td>
  283 + <td width="10%">{{obj.qJh}}</td>
  284 + <td width="10%">{{obj.qSj}}</td>
  285 + <td width="10%">{{obj.hJh}}</td>
  286 + <td width="10%">{{obj.hSj}}</td>
  287 + </tr>
  288 + {{/each}}
  289 + {{if list.length == 0}}
  290 + <tr>
  291 + <td colspan="7"><h6 class="muted">没有找到相关数据</h6></td>
  292 + </tr>
  293 + {{/if}}
  294 +</script>
  295 +
... ...