Commit 3086b197d53f533e74965a30aed74f881efcba88
1 parent
fa9e32d3
LGF 添加导出功能
Showing
10 changed files
with
234 additions
and
43 deletions
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -635,7 +635,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 635 | 635 | |
| 636 | 636 | } |
| 637 | 637 | |
| 638 | - List<Object[]> list = scheduleRealInfoRepository.historyMessage(line,d,t, code); | |
| 638 | + List<Object[]> list = scheduleRealInfoRepository.historyMessage(line, d, t, code); | |
| 639 | 639 | for(Object[] obj:list){ |
| 640 | 640 | if(obj != null){ |
| 641 | 641 | obj[3] = sdf.format(new Date(Long.parseLong(obj[3].toString()))); |
| ... | ... | @@ -671,7 +671,35 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 671 | 671 | e.printStackTrace(); |
| 672 | 672 | } |
| 673 | 673 | } |
| 674 | - | |
| 674 | + | |
| 675 | + if(type != null && type.length() != 0 && type.equals("export_msg")){ | |
| 676 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 677 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 678 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 679 | + Map<String,Object> m = new HashMap<String, Object>(); | |
| 680 | + ReportUtils ee = new ReportUtils(); | |
| 681 | + List<Map<String, Object>> newList = new ArrayList<Map<String, Object>>(); | |
| 682 | + for(int i = 0; i < list.size(); i++){ | |
| 683 | + Map<String, Object> map = new HashMap<String, Object>(); | |
| 684 | + Object[] obj = list.get(i); | |
| 685 | + map.put("num", i + 1); | |
| 686 | + map.put("line", obj[4]); | |
| 687 | + map.put("clZbh", obj[0]); | |
| 688 | + map.put("sender", obj[1]); | |
| 689 | + map.put("date", obj[3]); | |
| 690 | + map.put("text", obj[2]); | |
| 691 | + newList.add(map); | |
| 692 | + } | |
| 693 | + try { | |
| 694 | + listI.add(newList.iterator()); | |
| 695 | + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; | |
| 696 | + ee.excelReplace(listI, new Object[] { m }, path+"mould\\message.xls", | |
| 697 | + path+"export\\调度消息分析" + sdfSimple.format(sdfMonth.parse(date)) + ".xls"); | |
| 698 | + } catch (Exception e) { | |
| 699 | + // TODO: handle exception | |
| 700 | + e.printStackTrace(); | |
| 701 | + } | |
| 702 | + } | |
| 675 | 703 | return list; |
| 676 | 704 | } |
| 677 | 705 | |
| ... | ... | @@ -1314,17 +1342,47 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1314 | 1342 | List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); |
| 1315 | 1343 | Map<String,Object> m = new HashMap<String, Object>(); |
| 1316 | 1344 | ReportUtils ee = new ReportUtils(); |
| 1317 | - m.put("startDate", startDate); | |
| 1318 | - m.put("endDate", endDate); | |
| 1345 | + m.put("dates", startDate + " 至 " + endDate); | |
| 1346 | + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>(); | |
| 1347 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 1348 | + for(ScheduleRealInfo schedule : list){ | |
| 1349 | + Map<String, Object> tempMap = new HashMap<String, Object>(); | |
| 1350 | + tempMap.put("xlName", schedule.getXlName()!=null?schedule.getXlName():""); | |
| 1351 | + tempMap.put("lpName", schedule.getLpName()!=null?schedule.getLpName():""); | |
| 1352 | + tempMap.put("clZbh", schedule.getClZbh()!=null?schedule.getClZbh():""); | |
| 1353 | + tempMap.put("jName", schedule.getjName()!=null?schedule.getjName():""); | |
| 1354 | + tempMap.put("sName", schedule.getsName()!=null?schedule.getsName():""); | |
| 1355 | + tempMap.put("fcsj", schedule.getFcsj()!=null?schedule.getFcsj():""); | |
| 1356 | + tempMap.put("fcsjActual", schedule.getFcsjActual()!=null?schedule.getFcsjActual():""); | |
| 1357 | + tempMap.put("zdsj", schedule.getZdsj()!=null?schedule.getZdsj():""); | |
| 1358 | + tempMap.put("zdsjActual", schedule.getZdsjActual()!=null?schedule.getZdsjActual():""); | |
| 1359 | + if(schedule.getUpdateBy() != null){ | |
| 1360 | + if(schedule.getUpdateBy().getName() != null) | |
| 1361 | + tempMap.put("userName", schedule.getUpdateBy().getName()); | |
| 1362 | + else | |
| 1363 | + tempMap.put("userName", ""); | |
| 1364 | + } else { | |
| 1365 | + tempMap.put("userName", ""); | |
| 1366 | + } | |
| 1367 | + if(schedule.getUpdateDate() != null){ | |
| 1368 | + tempMap.put("updateDate", sdf.format(schedule.getUpdateDate())); | |
| 1369 | + } else { | |
| 1370 | + tempMap.put("updateDate", ""); | |
| 1371 | + } | |
| 1372 | + tempMap.put("remarks", schedule.getRemarks()!=null?schedule.getRemarks():""); | |
| 1373 | + tempList.add(tempMap); | |
| 1374 | + } | |
| 1319 | 1375 | try { |
| 1320 | - listI.add(list.iterator()); | |
| 1376 | + listI.add(tempList.iterator()); | |
| 1321 | 1377 | String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; |
| 1322 | 1378 | ee.excelReplace(listI, new Object[] { m }, path+"mould\\correctForm.xls", |
| 1323 | - path+"export\\" + URLEncoder.encode("修正报表", "UTF-8") + sdfSimple.format(sdfMonth.parse(startDate)) + "-" + sdfSimple.format(sdfMonth.parse(endDate)) + ".xls"); | |
| 1379 | + path+"export\\修正报表" + sdfSimple.format(sdfMonth.parse(startDate)) + "-" + sdfSimple.format(sdfMonth.parse(endDate)) + ".xls"); | |
| 1324 | 1380 | } catch (Exception e) { |
| 1325 | 1381 | // TODO: handle exception |
| 1326 | 1382 | e.printStackTrace(); |
| 1327 | 1383 | } |
| 1384 | + Map<String, Object> map = tempList.get(tempList.size() - 1); | |
| 1385 | + System.out.println("tempMap:" + map); | |
| 1328 | 1386 | } |
| 1329 | 1387 | |
| 1330 | 1388 | return list; | ... | ... |
src/main/java/com/bsth/service/schedule/PeopleCarPlanServiceImpl.java
| ... | ... | @@ -17,6 +17,7 @@ import java.util.List; |
| 17 | 17 | import java.util.Map; |
| 18 | 18 | import java.util.Set; |
| 19 | 19 | |
| 20 | +import org.drools.compiler.lang.DRL5Expressions.type_return; | |
| 20 | 21 | import org.springframework.beans.factory.annotation.Autowired; |
| 21 | 22 | import org.springframework.jdbc.core.JdbcTemplate; |
| 22 | 23 | import org.springframework.jdbc.core.RowMapper; |
| ... | ... | @@ -1012,6 +1013,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 1012 | 1013 | String line = map.get("line").toString(); |
| 1013 | 1014 | String date = map.get("date").toString(); |
| 1014 | 1015 | String code = map.get("code").toString(); |
| 1016 | + String type = map.get("type").toString(); | |
| 1015 | 1017 | |
| 1016 | 1018 | if(date.length() == 0) |
| 1017 | 1019 | date = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); |
| ... | ... | @@ -1042,8 +1044,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 1042 | 1044 | if(company.length() != 0){ |
| 1043 | 1045 | sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'"; |
| 1044 | 1046 | } |
| 1045 | - sql += " order by fcsj"; | |
| 1046 | - | |
| 1047 | + sql += " order by xl_name, fcsj"; | |
| 1048 | + | |
| 1047 | 1049 | list = jdbcTemplate.query(sql, |
| 1048 | 1050 | new RowMapper<Map<String, Object>>(){ |
| 1049 | 1051 | @Override |
| ... | ... | @@ -1072,8 +1074,13 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 1072 | 1074 | e.printStackTrace(); |
| 1073 | 1075 | } |
| 1074 | 1076 | |
| 1077 | + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>(); | |
| 1078 | + List<String> keyList = new ArrayList<String>(); | |
| 1075 | 1079 | for(Map<String, Object> m : list){ |
| 1076 | 1080 | String key = m.get("line") + "/" + m.get("clZbh") + "/" + m.get("jGh") + "/" + m.get("jName"); |
| 1081 | + if(!keyList.contains(m.get("line").toString())){ | |
| 1082 | + keyList.add(m.get("line").toString()); | |
| 1083 | + } | |
| 1077 | 1084 | if(!keyMap.containsKey(key)) |
| 1078 | 1085 | keyMap.put(key, new ArrayList<Map<String, Object>>()); |
| 1079 | 1086 | keyMap.get(key).add(m); |
| ... | ... | @@ -1120,7 +1127,58 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 1120 | 1127 | tempMap.put("sjf", sjf); |
| 1121 | 1128 | tempMap.put("wqr", wqr); |
| 1122 | 1129 | tempMap.put("workList", keyMap.get(key)); |
| 1123 | - resList.add(tempMap); | |
| 1130 | + tempList.add(tempMap); | |
| 1131 | + } | |
| 1132 | + | |
| 1133 | + for(String key : keyList){ | |
| 1134 | + for(Map<String, Object> m : tempList){ | |
| 1135 | + if(key.equals(m.get("line").toString())){ | |
| 1136 | + resList.add(m); | |
| 1137 | + } | |
| 1138 | + } | |
| 1139 | + } | |
| 1140 | + | |
| 1141 | + if(type.equals("export")){ | |
| 1142 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 1143 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 1144 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 1145 | + Map<String,Object> m = new HashMap<String, Object>(); | |
| 1146 | + ReportUtils ee = new ReportUtils(); | |
| 1147 | + try { | |
| 1148 | + listI.add(resList.iterator()); | |
| 1149 | + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; | |
| 1150 | + ee.excelReplace(listI, new Object[] { m }, path+"mould\\commandState.xls", | |
| 1151 | + path+"export\\指令状态分析" + sdfSimple.format(sdfMonth.parse(date)) + ".xls"); | |
| 1152 | + } catch (Exception e) { | |
| 1153 | + // TODO: handle exception | |
| 1154 | + e.printStackTrace(); | |
| 1155 | + } | |
| 1156 | + } | |
| 1157 | + | |
| 1158 | + if(type.equals("export1")){ | |
| 1159 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 1160 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 1161 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 1162 | + Map<String,Object> m = new HashMap<String, Object>(); | |
| 1163 | + ReportUtils ee = new ReportUtils(); | |
| 1164 | + String jsy = map.get("jsy").toString(); | |
| 1165 | + try { | |
| 1166 | + for(Map<String, Object> map1 : resList){ | |
| 1167 | + if(jsy.equals(map1.get("jsy").toString())){ | |
| 1168 | + List<Map<String, Object>> temp = (List<Map<String, Object>>)map1.get("workList"); | |
| 1169 | + listI.add(temp.iterator()); | |
| 1170 | + m.put("detail", "日期:" + map1.get("date") + " 公司:" + map1.get("company") | |
| 1171 | + + " 分公司:" + map1.get("subCompany") + " 线路:" + map1.get("line") | |
| 1172 | + + " 车辆:" + map1.get("clZbh") + " 人员:" + map1.get("jsy")); | |
| 1173 | + } | |
| 1174 | + } | |
| 1175 | + String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; | |
| 1176 | + ee.excelReplace(listI, new Object[] { m }, path+"mould\\commandState1.xls", | |
| 1177 | + path+"export\\指令状态明细" + sdfSimple.format(sdfMonth.parse(date)) + ".xls"); | |
| 1178 | + } catch (Exception e) { | |
| 1179 | + // TODO: handle exception | |
| 1180 | + e.printStackTrace(); | |
| 1181 | + } | |
| 1124 | 1182 | } |
| 1125 | 1183 | |
| 1126 | 1184 | return resList; | ... | ... |
src/main/resources/static/pages/forms/mould/commandState.xls
0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/commandState1.xls
0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/correctForm.xls
0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/message.xls
0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/statement/commandState.html
| ... | ... | @@ -50,7 +50,7 @@ |
| 50 | 50 | </div> |
| 51 | 51 | <div class="form-group" style="margin-left: 9px"> |
| 52 | 52 | <input class="btn btn-default" type="button" id="query" value="筛选"/> |
| 53 | -<!-- <input class="btn btn-default" type="button" id="export" value="导出"/> --> | |
| 53 | + <input class="btn btn-default" type="button" id="export" value="导出"/> | |
| 54 | 54 | </div> |
| 55 | 55 | </form> |
| 56 | 56 | </div> |
| ... | ... | @@ -74,16 +74,23 @@ |
| 74 | 74 | |
| 75 | 75 | </tbody> |
| 76 | 76 | </table> |
| 77 | + <div id="box"> </div> | |
| 77 | 78 | <div id="works_hidden" class="hidden"> |
| 78 | 79 | <span class="item-label" style="width: 80px;margin-left: 20px;">明细: </span> |
| 79 | 80 | <span class="item-label" style="width: 80px;margin-left: 60px;">日期 </span> |
| 80 | 81 | <span class="item-label" style="width: 80px;" id="date1"></span> |
| 82 | + <span class="item-label" style="width: 80px;margin-left: 60px;">公司 </span> | |
| 83 | + <span class="item-label" style="width: 80px;" id="company2"></span> | |
| 84 | + <span class="item-label" style="width: 80px;margin-left: 60px;">分公司 </span> | |
| 85 | + <span class="item-label" style="width: 80px;" id="subCompany2"></span> | |
| 81 | 86 | <span class="item-label" style="width: 80px;margin-left: 60px;">线路 </span> |
| 82 | 87 | <span class="item-label" style="width: 80px;" id="line1"></span> |
| 83 | 88 | <span class="item-label" style="width: 80px;margin-left: 60px;">车辆 </span> |
| 84 | 89 | <span class="item-label" style="width: 80px;" id="clZbh1"></span> |
| 85 | 90 | <span class="item-label" style="width: 80px;margin-left: 60px;">人员 </span> |
| 86 | 91 | <span class="item-label" style="width: 80px;" id="jsy1"></span> |
| 92 | + <span class="item-label" style="width: 80px;margin-left: 60px;"></span> | |
| 93 | + <input class="btn btn-default" type="button" id="export1" value="导出当前明细"/> | |
| 87 | 94 | </div> |
| 88 | 95 | <table class="table table-bordered table-hover table-checkable" id="works"> |
| 89 | 96 | <thead> |
| ... | ... | @@ -112,6 +119,7 @@ |
| 112 | 119 | |
| 113 | 120 | <script> |
| 114 | 121 | $(function(){ |
| 122 | + $('#export').attr('disabled', "true"); | |
| 115 | 123 | var list; |
| 116 | 124 | |
| 117 | 125 | // 关闭左侧栏 |
| ... | ... | @@ -136,7 +144,7 @@ |
| 136 | 144 | $.get('/basic/lineCode2Name',function(result){ |
| 137 | 145 | var data=[]; |
| 138 | 146 | |
| 139 | - data.push({id: "", text: "全部线路"}); | |
| 147 | + data.push({id: " ", text: "全部线路"}); | |
| 140 | 148 | for(var code in result){ |
| 141 | 149 | data.push({id: code, text: result[code]}); |
| 142 | 150 | } |
| ... | ... | @@ -217,16 +225,26 @@ |
| 217 | 225 | |
| 218 | 226 | $("#query").on("click",jsDoQuery); |
| 219 | 227 | |
| 228 | + var line = ""; | |
| 229 | + var date = $("#date").val(); | |
| 230 | + var code = $("#code").val(); | |
| 231 | + var company = $("#company").val(); | |
| 232 | + var subCompany = $("#subCompany").val(); | |
| 220 | 233 | function jsDoQuery(pagination){ |
| 221 | 234 | var params = {}; |
| 222 | - var line = $("#line").val(); | |
| 223 | - if(line = " ") | |
| 235 | + line = $("#line").val(); | |
| 236 | + if(line == " ") | |
| 224 | 237 | line = ""; |
| 238 | + date = $("#date").val(); | |
| 239 | + code = $("#code").val(); | |
| 240 | + company = $("#company").val(); | |
| 241 | + subCompany = $("#subCompany").val(); | |
| 225 | 242 | params['line'] = line; |
| 226 | - params['date'] = $("#date").val(); | |
| 227 | - params['code'] = $("#code").val(); | |
| 228 | - params['company'] = $("#company").val(); | |
| 229 | - params['subCompany'] = $("#subCompany").val(); | |
| 243 | + params['date'] = date; | |
| 244 | + params['code'] = code; | |
| 245 | + params['type'] = "query"; | |
| 246 | + params['company'] = company; | |
| 247 | + params['subCompany'] = subCompany; | |
| 230 | 248 | $("#forms .hidden").removeClass("hidden"); |
| 231 | 249 | $get('/pcpc/commandState', params, function(result){ |
| 232 | 250 | // 把数据填充到模版中 |
| ... | ... | @@ -235,29 +253,69 @@ |
| 235 | 253 | // 把渲染好的模版html文本追加到表格中 |
| 236 | 254 | $('#forms tbody').html(tbodyHtml); |
| 237 | 255 | |
| 256 | + if(result.length == 0){ | |
| 257 | + $('#export').attr('disabled', "true"); | |
| 258 | + } else { | |
| 259 | + $("#export").removeAttr("disabled"); | |
| 260 | + } | |
| 261 | + | |
| 262 | + $("#works_hidden").removeClass("hidden"); | |
| 263 | + $("#works .hidden").removeClass("hidden"); | |
| 264 | + $("#works_hidden").addClass("hidden"); | |
| 265 | + $("#works").addClass("hidden"); | |
| 266 | + | |
| 238 | 267 | }); |
| 239 | 268 | } |
| 240 | 269 | |
| 241 | 270 | $("#export").on("click",function(){ |
| 242 | - $('#forms').tableExport({ type: 'excel', escape: 'false',filename:'(2016-02-29_2016-03-06)'}); | |
| 271 | + var params = {}; | |
| 272 | + params['line'] = line; | |
| 273 | + params['date'] = date; | |
| 274 | + params['code'] = code; | |
| 275 | + params['type'] = "export"; | |
| 276 | + params['company'] = company; | |
| 277 | + params['subCompany'] = subCompany; | |
| 278 | + $get('/pcpc/commandState', params, function(result){ | |
| 279 | + window.open("/downloadFile/download?fileName=指令状态分析"+moment(date).format("YYYYMMDD")); | |
| 280 | + }); | |
| 243 | 281 | }); |
| 244 | 282 | |
| 283 | + var jsy = ""; | |
| 245 | 284 | $("#forms tbody").on("click","a",function(){ |
| 246 | - var jsy = $(this).html(); | |
| 285 | + jsy = $(this).html(); | |
| 247 | 286 | $.each(list, function(i, g){ |
| 248 | 287 | if(jsy == g.jsy){ |
| 249 | 288 | $("#date1").html(g.date); |
| 250 | 289 | $("#line1").html(g.line); |
| 251 | 290 | $("#clZbh1").html(g.clZbh); |
| 252 | 291 | $("#jsy1").html(g.jsy); |
| 292 | + $("#company2").html(g.company); | |
| 293 | + $("subCompany2").html(g.subCompany); | |
| 253 | 294 | $("#works_hidden").removeClass("hidden"); |
| 254 | - $("#works .hidden").removeClass("hidden"); | |
| 295 | + $("#works").removeClass("hidden"); | |
| 255 | 296 | // 把数据填充到模版中 |
| 256 | 297 | var tbodyHtml = template('list_workList',{list:g.workList}); |
| 257 | 298 | // 把渲染好的模版html文本追加到表格中 |
| 258 | 299 | $('#works tbody').html(tbodyHtml); |
| 259 | 300 | } |
| 260 | 301 | }); |
| 302 | + | |
| 303 | + $("html,body").animate({scrollTop:$("#box").offset().top},1000); | |
| 304 | + | |
| 305 | + }); | |
| 306 | + | |
| 307 | + $("#export1").on("click",function(){ | |
| 308 | + var params = {}; | |
| 309 | + params['jsy'] = jsy; | |
| 310 | + params['line'] = line; | |
| 311 | + params['date'] = date; | |
| 312 | + params['code'] = code; | |
| 313 | + params['type'] = "export1"; | |
| 314 | + params['company'] = company; | |
| 315 | + params['subCompany'] = subCompany; | |
| 316 | + $get('/pcpc/commandState', params, function(result){ | |
| 317 | + window.open("/downloadFile/download?fileName=指令状态明细"+moment(date).format("YYYYMMDD")); | |
| 318 | + }); | |
| 261 | 319 | }); |
| 262 | 320 | |
| 263 | 321 | ... | ... |
src/main/resources/static/pages/forms/statement/correctForm.html
| ... | ... | @@ -49,7 +49,7 @@ |
| 49 | 49 | </div> |
| 50 | 50 | <div class="form-group"> |
| 51 | 51 | <input class="btn btn-default" type="button" id="query" value="筛选"/> |
| 52 | -<!-- <input class="btn btn-default" type="button" id="export" value="导出"/> --> | |
| 52 | + <input class="btn btn-default" type="button" id="export" value="导出"/> | |
| 53 | 53 | </div> |
| 54 | 54 | </form> |
| 55 | 55 | </div> | ... | ... |
src/main/resources/static/pages/forms/statement/historyMessage.html
| ... | ... | @@ -139,7 +139,7 @@ |
| 139 | 139 | code = $("#code").val(); |
| 140 | 140 | var type = "query"; |
| 141 | 141 | $(".hidden").removeClass("hidden"); |
| 142 | - $get('/realSchedule/historyMessage',{line:line,date:date,code:code},function(result){ | |
| 142 | + $get('/realSchedule/historyMessage',{line:line,date:date,code:code,type:type},function(result){ | |
| 143 | 143 | // 把数据填充到模版中 |
| 144 | 144 | var tbodyHtml = template('list_history',{list:result}); |
| 145 | 145 | // 把渲染好的模版html文本追加到表格中 | ... | ... |
src/main/resources/static/pages/report/message/message.html
| ... | ... | @@ -41,7 +41,7 @@ |
| 41 | 41 | </div> |
| 42 | 42 | <div class="form-group" style="display: inline-block;margin-left: 15px;"> |
| 43 | 43 | <input class="btn btn-default" type="button" id="query" value="查询"/> |
| 44 | -<!-- <input class="btn btn-default" type="button" id="export" value="导出"/> --> | |
| 44 | + <input class="btn btn-default" type="button" id="export" value="导出"/> | |
| 45 | 45 | <input class="btn btn-default" type="button" id="print" value="打印"/> |
| 46 | 46 | <!-- <input class="btn btn-default" type="button" id="exportMore" value="批量导出"/> --> |
| 47 | 47 | </div> |
| ... | ... | @@ -73,7 +73,7 @@ |
| 73 | 73 | <tr class="hidden"> |
| 74 | 74 | <th>序号</th> |
| 75 | 75 | <th>线路</th> |
| 76 | - <th>路牌</th> | |
| 76 | +<!-- <th>路牌</th> --> | |
| 77 | 77 | <th>运营车辆</th> |
| 78 | 78 | <th>发送人</th> |
| 79 | 79 | <th>发送时间</th> |
| ... | ... | @@ -93,7 +93,11 @@ |
| 93 | 93 | </div> |
| 94 | 94 | |
| 95 | 95 | <script> |
| 96 | - $(function(){ | |
| 96 | + $(function(){ | |
| 97 | + $('#print').attr('disabled', "true"); | |
| 98 | + $('#export').attr('disabled', "true"); | |
| 99 | + $('#printArea').hide(); | |
| 100 | + | |
| 97 | 101 | // 关闭左侧栏 |
| 98 | 102 | if (!$('body').hasClass('page-sidebar-closed')) |
| 99 | 103 | $('.menu-toggler.sidebar-toggler').click(); |
| ... | ... | @@ -106,11 +110,11 @@ |
| 106 | 110 | var year = d.getFullYear(); |
| 107 | 111 | var month = d.getMonth() + 1; |
| 108 | 112 | var day = d.getDate(); |
| 109 | - if(month > 9){ | |
| 110 | - $("#date").val(year + "-" + month + "-" + day); | |
| 111 | - } else { | |
| 112 | - $("#date").val(year + "-0" + month + "-" + day); | |
| 113 | - } | |
| 113 | + if(month < 9) | |
| 114 | + month = "0" + month; | |
| 115 | + if(day < 9) | |
| 116 | + day = "0" + day; | |
| 117 | + $("#date").val(year + "-" + month + "-" + day); | |
| 114 | 118 | |
| 115 | 119 | $.get('/basic/lineCode2Name',function(result){ |
| 116 | 120 | var data=[]; |
| ... | ... | @@ -161,17 +165,23 @@ |
| 161 | 165 | } |
| 162 | 166 | }); |
| 163 | 167 | |
| 164 | - var date = ''; | |
| 168 | + var date = ''; | |
| 169 | + var line = $("#line").val(); | |
| 165 | 170 | $("#query").on("click",function(){ |
| 166 | - var line = $("#line").val(); | |
| 171 | + line = $("#line").val(); | |
| 167 | 172 | date = $("#date").val(); |
| 168 | - var code=$("#code").val(); | |
| 173 | + var code = $("#code").val(); | |
| 169 | 174 | $(".hidden").removeClass("hidden"); |
| 170 | 175 | $get('/report/historyMessageCount',{line:line,date:date,code:code},function(result){ |
| 171 | 176 | // 把数据填充到模版中 |
| 172 | 177 | var tbodyHtml = template('list_msg_info',{list:result}); |
| 173 | 178 | // 把渲染好的模版html文本追加到表格中 |
| 174 | - $('#info_msg tbody').html(tbodyHtml); | |
| 179 | + $('#info_msg tbody').html(tbodyHtml); | |
| 180 | + | |
| 181 | + $('#print').attr('disabled', "true"); | |
| 182 | + $('#export').attr('disabled', "true"); | |
| 183 | + $('#printArea').hide(); | |
| 184 | + | |
| 175 | 185 | }); |
| 176 | 186 | }); |
| 177 | 187 | |
| ... | ... | @@ -185,21 +195,28 @@ |
| 185 | 195 | params[index] = $(this).text(); |
| 186 | 196 | }); |
| 187 | 197 | jName = params[1]; |
| 188 | - var line = $("#line").val(); | |
| 198 | + line = $("#line").val(); | |
| 189 | 199 | date = $("#date").val(); |
| 190 | - $get('/realSchedule/historyMessage',{line:line,date:date,code:jName},function(result){ | |
| 200 | + $get('/realSchedule/historyMessage',{line:line,date:date,code:jName,type:"query"},function(result){ | |
| 191 | 201 | var list_history_msg = template('list_history_msg',{list:result}); |
| 192 | 202 | // 把渲染好的模版html文本追加到表格中 |
| 193 | - $('#forms tbody').html(list_history_msg); | |
| 203 | + $('#forms tbody').html(list_history_msg); | |
| 204 | + | |
| 205 | + if(result.length == 0){ | |
| 206 | + $('#export').attr('disabled', "true"); | |
| 207 | + $('#print').attr('disabled', "true"); | |
| 208 | + } else { | |
| 209 | + $("#export").removeAttr("disabled"); | |
| 210 | + $("#print").removeAttr("disabled"); | |
| 211 | + } | |
| 212 | + $('#printArea').show(); | |
| 213 | + | |
| 194 | 214 | }); |
| 195 | 215 | }); |
| 196 | 216 | |
| 197 | 217 | $("#export").on("click",function(){ |
| 198 | - if(params.length < 1){ | |
| 199 | - return; | |
| 200 | - } | |
| 201 | - $post('/realSchedule/exportWaybill',{jName:jName,clZbh:params[1],lpName:params[2],date:date},function(result){ | |
| 202 | - window.open("/downloadFile/download?fileName="+jName); | |
| 218 | + $get('/realSchedule/historyMessage',{line:line,date:date,code:jName,type:"export_msg"},function(result){ | |
| 219 | + window.open("/downloadFile/download?fileName=调度消息分析"+moment(date).format("YYYYMMDD")); | |
| 203 | 220 | }); |
| 204 | 221 | }); |
| 205 | 222 | |
| ... | ... | @@ -236,7 +253,7 @@ |
| 236 | 253 | <tr> |
| 237 | 254 | <td>{{i+1}}</td> |
| 238 | 255 | <td>{{obj[4]}}</td> |
| 239 | - <td>{{obj[6]}}</td> | |
| 256 | + <!--<td>{{obj[6]}}</td>--> | |
| 240 | 257 | <td>{{obj[0]}}</td> |
| 241 | 258 | <td>{{obj[1]}}</td> |
| 242 | 259 | <td>{{obj[3]}}</td> | ... | ... |