Commit 637544cfdbd74caca0997e2e61217bcf819e06b1

Authored by 潘钊
2 parents 18e1c843 983fdbff

Merge branch 'pudong' of http://222.66.0.204:8090/panzhaov5/bsth_control into pudong

src/main/java/com/bsth/controller/DownloadController.java
... ... @@ -19,9 +19,6 @@ import org.springframework.http.MediaType;
19 19 import org.springframework.http.ResponseEntity;
20 20 import org.springframework.stereotype.Component;
21 21 import org.springframework.web.bind.annotation.RequestMapping;
22   -
23   -import com.google.protobuf.UnknownFieldSet.Field;
24   -import com.mysql.fabric.Response;
25 22  
26 23 /**
27 24 * <一句话功能简述>
... ... @@ -55,11 +52,12 @@ public class DownloadController
55 52 headers, HttpStatus.CREATED);
56 53 }
57 54  
58   - @RequestMapping("download")
  55 + @RequestMapping("download")
59 56 public void download(HttpServletResponse response,String fileName)
60 57 throws IOException {
61 58 // String fileNames=URLDecoder.decode(fileName,"UTF-8");
62   - fileName =fileName + ".xls";
  59 + if(!fileName.contains(".xls"))
  60 + fileName =fileName + ".xls";
63 61 String moudelPath = this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileName;
64 62 File file = new File(moudelPath);// path是根据日志路径和文件名拼接出来的
65 63 // String filename = file.getName();// 获取日志文件名称
... ... @@ -82,6 +80,7 @@ public class DownloadController
82 80 public void downloadList(HttpServletResponse response,String fileName)
83 81 throws IOException {
84 82 // String fileNames=URLDecoder.decode(fileName,"UTF-8");
  83 + File files = new File(this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileName);//
85 84 fileName = fileName + ".zip";
86 85 String moudelPath = this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileName;
87 86 File file = new File(moudelPath);// path是根据日志路径和文件名拼接出来的
... ... @@ -99,7 +98,8 @@ public class DownloadController
99 98 os.flush();
100 99 os.close();
101 100 file.delete();
102   - }
  101 + deleteFiles(files);
  102 + }
103 103  
104 104  
105 105 @RequestMapping("downloadModel")
... ... @@ -125,4 +125,23 @@ public class DownloadController
125 125 }
126 126  
127 127  
  128 + /**
  129 + * 删除文件夹
  130 + * @param files
  131 + * @return
  132 + */
  133 + public Boolean deleteFiles(File files){
  134 + if (files.isDirectory()) {
  135 + String[] children = files.list();
  136 + //递归删除目录中的子目录下
  137 + for (int i=0; i<children.length; i++) {
  138 + boolean success = deleteFiles(new File(files, children[i]));
  139 + if (!success) {
  140 + return false;
  141 + }
  142 + }
  143 + }
  144 + //目录此时为空,可以删除
  145 + return files.delete();
  146 + }
128 147 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -4338,7 +4338,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4338 4338 return new ArrayList<Map<String, Object>>();
4339 4339 }
4340 4340  
4341   - public void exportWaybill_pl(List<ScheduleRealInfo> listpl,String date,String jName, String clZbh,String lpName) {
  4341 + public void exportWaybill_pl(List<ScheduleRealInfo> listpl,
  4342 + String date, String jName, String clZbh, String lpName) {
4342 4343 ReportUtils ee = new ReportUtils();
4343 4344 ReportRelatedUtils rru = new ReportRelatedUtils();
4344 4345 List<Iterator<?>> list = new ArrayList<Iterator<?>>();
... ... @@ -4361,7 +4362,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4361 4362 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
4362 4363 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
4363 4364 //计算里程和班次数,并放入Map里
4364   - Map<String, Object> map = this.MapById(scheduleRealInfos.get(0).getId());
  4365 + Map<String, Object> map = this.MapById(scheduleRealInfos.get(0).getId());
4365 4366  
4366 4367 map.put("jhlc",Arith.add(culateMieageService.culateJhgl(scheduleRealInfos),culateMieageService.culateJhJccgl(scheduleRealInfos)));
4367 4368 map.put("remMileage",culateMieageService.culateLbgl(scheduleRealInfos));
... ... @@ -4508,7 +4509,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4508 4509  
4509 4510  
4510 4511 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
4511   -
4512 4512 list.add(listMap.iterator());
4513 4513 String xls="";
4514 4514 if(map.get("type").toString().equals("0")){
... ... @@ -4516,15 +4516,16 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4516 4516 }else{
4517 4517 xls="waybill_minhang_dl.xls";
4518 4518 }
  4519 + map.put("sheetName", jName + "-" + clZbh + "-" + lpName);
4519 4520 ee.excelReplace(list, new Object[]{map}, path + "mould/"+xls,
4520 4521 path + "export/" + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls");
4521   -// return scheduleRealInfos;
4522 4522 }
4523 4523  
4524 4524 @Override
4525 4525 public Map<String, Object> exportWaybillMore(Map<String, Object> map) {
4526 4526 String date = map.get("date").toString();
4527 4527 String line = map.get("line").toString();
  4528 + ReportUtils ee = new ReportUtils();
4528 4529 List<List> lists = JSON.parseArray(map.get("strs").toString(), List.class);
4529 4530 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/export/";
4530 4531 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
... ... @@ -4534,16 +4535,19 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4534 4535 try {
4535 4536 while (true) {
4536 4537 String fileUrl = path + "行车路单" + sdfSimple.format(sdfMonth.parse(date));
4537   - file = new File(fileUrl + (num == 0 ? "/" : "(" + num + ")/"));
4538   - if (file.exists()) {
  4538 +// file = new File(fileUrl + (num == 0 ? "/" : "(" + num + ")/")); //新建文件夹
  4539 + file = new File(fileUrl + (num == 0 ? ".xls" : "(" + num + ").xls")); //新建excel文件
  4540 + if (file.exists()) { //判断是否已存在重名
4539 4541 num++;
4540 4542 } else {
4541 4543 break;
4542 4544 }
4543 4545 }
4544   - file.mkdirs();
  4546 +// file.mkdirs(); //创建
4545 4547 List<ScheduleRealInfo> lists_line=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date);
4546   - for (List<String> list : lists) {
  4548 +
  4549 + List<File> files = new ArrayList<File>();
  4550 + for (List<String> list : lists){
4547 4551 List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
4548 4552 String jName = list.get(0);
4549 4553 String clZbh = list.get(1);
... ... @@ -4558,26 +4562,37 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4558 4562 this.exportWaybill_pl(newList, date, jName, clZbh, lpName);
4559 4563 File temp = new File(path + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls");
4560 4564 String fileName = file.getName();
4561   - temp.renameTo(new File(path + fileName + "/" + temp.getName()));
4562   -
4563   - File[] listFiles = file.listFiles();
4564   - ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(path + file.getName() + ".zip")));
4565   -// zos.setEncoding("gbk");
4566   -// zos.putNextEntry(new ZipEntry(fileName + "/"));
4567   - for (int i = 0; i < listFiles.length; i++) {
4568   - zos.putNextEntry(new ZipEntry(fileName + "/" + listFiles[i].getName()));
4569   - BufferedInputStream bis = new BufferedInputStream(new FileInputStream(listFiles[i]));
4570   - BufferedOutputStream bos = new BufferedOutputStream(zos);
4571   - int bytesRead = 0;
4572   - for (byte[] buffer = new byte[BUF_SIZE]; ((bytesRead = bis.read(buffer, 0, BUF_SIZE)) != -1); ) {
4573   -// zos.write(buffer, 0, bytesRead);
4574   -// zos.flush();
4575   - bos.write(buffer, 0, bytesRead);
4576   - bos.flush();
4577   - }
4578   - }
4579   - zos.close();
4580   - }
  4565 + files.add(temp);
  4566 + }
  4567 + for(int i = 1; i < files.size(); i++){
  4568 + File file1 = files.get(0);
  4569 + File file2 = files.get(i);
  4570 + ee.copySheetByFile(file2, file1, 0, 145);
  4571 + }
  4572 + File newFile = files.get(0);
  4573 + newFile.renameTo(file);
  4574 +
  4575 +// temp.renameTo(new File(path + fileName + "/" + temp.getName()));
  4576 +// File[] listFiles = file.listFiles();
  4577 +// ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(path + file.getName() + ".zip")));
  4578 +//// zos.setEncoding("gbk");
  4579 +//// zos.putNextEntry(new ZipEntry(fileName + "/"));
  4580 +// for (int i = 0; i < listFiles.length; i++) {
  4581 +// zos.putNextEntry(new ZipEntry(fileName + "/" + listFiles[i].getName()));
  4582 +// BufferedInputStream bis = new BufferedInputStream(new FileInputStream(listFiles[i]));
  4583 +// BufferedOutputStream bos = new BufferedOutputStream(zos);
  4584 +// int bytesRead = 0;
  4585 +// for (byte[] buffer = new byte[BUF_SIZE]; ((bytesRead = bis.read(buffer, 0, BUF_SIZE)) != -1); ) {
  4586 +//// zos.write(buffer, 0, bytesRead);
  4587 +//// zos.flush();
  4588 +// bos.write(buffer, 0, bytesRead);
  4589 +// bos.flush();
  4590 +// }
  4591 +//// bos.close();
  4592 +// bis.close();
  4593 +// }
  4594 +// zos.close();
  4595 +// }
4581 4596  
4582 4597 } catch (Exception e) {
4583 4598 // TODO: handle exception
... ...
src/main/java/com/bsth/util/ReportUtils.java
... ... @@ -18,6 +18,7 @@ import org.apache.poi.hssf.usermodel.HSSFSheet;
18 18 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
19 19 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
20 20 import org.apache.poi.ss.usermodel.Cell;
  21 +import org.apache.poi.ss.util.CellRangeAddress;
21 22  
22 23 import com.bsth.entity.Line;
23 24 import com.bsth.entity.realcontrol.ScheduleRealInfo;
... ... @@ -114,6 +115,145 @@ public class ReportUtils {
114 115 }
115 116 }
116 117  
  118 + /**
  119 + * 将file1中的一页sheet复制到file2中
  120 + *
  121 + * @param file1
  122 + * 原sheet所在的excel文件
  123 + * @param file2
  124 + * 目标excel文件
  125 + * @param page
  126 + * 原excel中要被复制的sheet的位置(从0开始)
  127 + * @param rate
  128 + * 调整复制后的缩放倍率(列如:145,则为缩放145%)
  129 + */
  130 + public void copySheetByFile(File file1, File file2, int page, int rate) {
  131 + try {
  132 + // 把源文件放入流中
  133 + POIFSFileSystem fs1 = new POIFSFileSystem(new FileInputStream(file1));
  134 + HSSFWorkbook wb1 = new HSSFWorkbook(fs1);
  135 + HSSFSheet sheet = wb1.getSheetAt(page);
  136 + POIFSFileSystem fs2 = new POIFSFileSystem(new FileInputStream(file2));
  137 + HSSFWorkbook wb2 = new HSSFWorkbook(fs2);
  138 + HSSFSheet createSheet = wb2.createSheet(sheet.getSheetName());
  139 + HSSFCellStyle createCellStyle = wb2.createCellStyle();
  140 + HSSFRow row;
  141 +
  142 + createSheet.setZoom(rate, 100);
  143 + for(int i = 0; i < sheet.getRow(0).getPhysicalNumberOfCells(); i++){
  144 + createSheet.setColumnWidth(i, sheet.getColumnWidth(i));
  145 + }
  146 +
  147 + List<CellRangeAddress> mergedRegions = sheet.getMergedRegions();
  148 + for(int l = 0; l < mergedRegions.size(); l++){
  149 + //复制源表中的合并单元格
  150 + createSheet.addMergedRegion(mergedRegions.get(l));
  151 + }
  152 + int firstRow = sheet.getFirstRowNum();
  153 + int lastRow = sheet.getLastRowNum();
  154 + for(int k = firstRow; k <= lastRow; k++){
  155 + // 创建新建excel Sheet的行
  156 + HSSFRow rowCreat = createSheet.createRow(k);
  157 + // 取得源有excel Sheet的行
  158 + row = sheet.getRow(k);
  159 +// rowCreat.setHeight(row.getHeight()); //设置行高
  160 + // 单元格式样
  161 + int firstCell = row.getFirstCellNum();
  162 + int lastCell = row.getLastCellNum();
  163 + for (int j = firstCell; j < lastCell; j++) {
  164 + // 自动适应列宽 貌似不起作用
  165 +// createSheet.autoSizeColumn(j);
  166 +// System.out.println(row.getCell(j));
  167 + rowCreat.createCell(j);
  168 + String strVal = "";
  169 + if (row.getCell(j)==null) {
  170 +
  171 + } else {
  172 + strVal = row.getCell(j).getStringCellValue();
  173 + rowCreat.getCell(j).setCellValue(strVal);
  174 + copyCellStyle(wb1, row.getCell(j).getCellStyle(), createCellStyle);
  175 + createCellStyle.setBorderTop((short)1);
  176 + createCellStyle.setBorderLeft((short)1);
  177 + createCellStyle.setBorderRight((short)1);
  178 + createCellStyle.setBorderBottom((short)1);
  179 + rowCreat.getCell(j).setCellStyle(createCellStyle);
  180 + }
  181 + }
  182 + }
  183 +
  184 +// int firstRowNum = createSheet.getFirstRowNum();
  185 +// int lastRowNum = createSheet.getLastRowNum();
  186 +// int test = 0;
  187 +// for(int k = firstRowNum; k <= lastRowNum; k++){
  188 +// HSSFRow createRow = createSheet.getRow(k);
  189 +// int firstCellNum = createRow.getFirstCellNum();
  190 +// int lastCellNum = createRow.getLastCellNum();
  191 +// for(int i = firstCellNum; i < lastCellNum; i++){
  192 +// HSSFCell cell = createRow.getCell(i);
  193 +// cell.getCellStyle().setBorderTop(HSSFCellStyle.BORDER_THIN);
  194 +// cell.getCellStyle().setBorderLeft(HSSFCellStyle.BORDER_THIN);
  195 +// cell.getCellStyle().setBorderRight(HSSFCellStyle.BORDER_THIN);
  196 +// cell.getCellStyle().setBorderBottom(HSSFCellStyle.BORDER_THIN);
  197 +// test ++;
  198 +// }
  199 +// }
  200 +// System.out.println("test = " + test);
  201 +
  202 + FileOutputStream fileOut = new FileOutputStream(file2);
  203 + wb2.write(fileOut);
  204 + fileOut.close();
  205 + wb2.close();
  206 + wb1.close();
  207 + fs2.close();
  208 + fs1.close();
  209 + file1.delete();
  210 +// // 创建目标文件夹
  211 +// createFolder(targetPath);
  212 + // 输出文件
  213 + } catch (Exception e) {
  214 + e.printStackTrace();
  215 + }
  216 + }
  217 +
  218 + public void test(File file){
  219 + POIFSFileSystem fs;
  220 + try {
  221 + fs = new POIFSFileSystem(new FileInputStream(file));
  222 + HSSFWorkbook wb = new HSSFWorkbook(fs);
  223 + for(int j = 0; j < wb.getNumberOfSheets(); j++){
  224 + HSSFSheet sheet = wb.getSheetAt(j);
  225 + int firstRowNum = sheet.getFirstRowNum();
  226 + int lastRowNum = sheet.getLastRowNum();
  227 + int test = 0;
  228 + for(int k = firstRowNum; k <= lastRowNum; k++){
  229 + HSSFRow createRow = sheet.getRow(k);
  230 + int firstCellNum = createRow.getFirstCellNum();
  231 + int lastCellNum = createRow.getLastCellNum();
  232 + for(int i = firstCellNum; i < lastCellNum; i++){
  233 + HSSFCell cell = createRow.getCell(i);
  234 + HSSFCellStyle cellStyle = wb.createCellStyle();
  235 +
  236 + cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
  237 + cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
  238 + cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
  239 + cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
  240 + cell.setCellStyle(cellStyle);
  241 + test ++;
  242 + }
  243 + }
  244 + System.out.println("test = " + test);
  245 +
  246 + FileOutputStream fileOut = new FileOutputStream(file);
  247 + wb.write(fileOut);
  248 + fileOut.close();
  249 + }
  250 + } catch (Exception e) {
  251 + // TODO Auto-generated catch block
  252 + e.printStackTrace();
  253 + }
  254 +
  255 + }
  256 +
117 257 public String getCellValue(HSSFCell cell) {
118 258 int cellType = 0;
119 259 String result = "";
... ...
src/main/resources/static/pages/base/linecast/cast.html
... ... @@ -166,6 +166,33 @@ function getTreeData(cb){
166 166 });
167 167 }
168 168  
  169 +/**
  170 + * 将模块List 转换为树结构
  171 + * @param arr
  172 + * @returns {Array}
  173 + */
  174 +function createTreeData(arr){
  175 + var treeData = [];
  176 + var len = arr.length;
  177 + for(var i = 0; i < len; i ++){
  178 + var pId = arr[i].pId;
  179 + arr[i].text = arr[i].name;
  180 + if(!pId){
  181 + treeData.push(arr[i]);
  182 + }
  183 +
  184 + for(var j = 0; j < len; j ++){
  185 + if(pId == arr[j].id){
  186 + if(!arr[j].children)
  187 + arr[j].children = [];
  188 + arr[j].children.push(arr[i]);
  189 + break;
  190 + }
  191 + }
  192 + }
  193 + return treeData;
  194 +}
  195 +
169 196 function getModuleTreeData(userId){
170 197  
171 198  
... ...
src/main/resources/static/pages/forms/statement/busInterval.html
... ... @@ -412,6 +412,32 @@
412 412 });
413 413 }
414 414  
  415 + /**
  416 + * 将模块List 转换为树结构
  417 + * @param arr
  418 + * @returns {Array}
  419 + */
  420 + function createTreeData(arr){
  421 + var treeData = [];
  422 + var len = arr.length;
  423 + for(var i = 0; i < len; i ++){
  424 + var pId = arr[i].pId;
  425 + arr[i].text = arr[i].name;
  426 + if(!pId){
  427 + treeData.push(arr[i]);
  428 + }
  429 +
  430 + for(var j = 0; j < len; j ++){
  431 + if(pId == arr[j].id){
  432 + if(!arr[j].children)
  433 + arr[j].children = [];
  434 + arr[j].children.push(arr[i]);
  435 + break;
  436 + }
  437 + }
  438 + }
  439 + return treeData;
  440 + }
415 441  
416 442 function _w_table_rowspan(_w_table_id, _w_table_colnum){
417 443 _w_table_firsttd = "";
... ...
src/main/resources/static/pages/forms/statement/lbStatuAnaly.html
... ... @@ -438,6 +438,32 @@
438 438 });
439 439 }
440 440  
  441 + /**
  442 + * 将模块List 转换为树结构
  443 + * @param arr
  444 + * @returns {Array}
  445 + */
  446 + function createTreeData(arr){
  447 + var treeData = [];
  448 + var len = arr.length;
  449 + for(var i = 0; i < len; i ++){
  450 + var pId = arr[i].pId;
  451 + arr[i].text = arr[i].name;
  452 + if(!pId){
  453 + treeData.push(arr[i]);
  454 + }
  455 +
  456 + for(var j = 0; j < len; j ++){
  457 + if(pId == arr[j].id){
  458 + if(!arr[j].children)
  459 + arr[j].children = [];
  460 + arr[j].children.push(arr[i]);
  461 + break;
  462 + }
  463 + }
  464 + }
  465 + return treeData;
  466 + }
441 467  
442 468 function _w_table_rowspan(_w_table_id, _w_table_colnum){
443 469 _w_table_firsttd = "";
... ...
src/main/resources/static/pages/forms/statement/lineTimeAnaly.html
... ... @@ -478,6 +478,32 @@
478 478 });
479 479 }
480 480  
  481 + /**
  482 + * 将模块List 转换为树结构
  483 + * @param arr
  484 + * @returns {Array}
  485 + */
  486 + function createTreeData(arr){
  487 + var treeData = [];
  488 + var len = arr.length;
  489 + for(var i = 0; i < len; i ++){
  490 + var pId = arr[i].pId;
  491 + arr[i].text = arr[i].name;
  492 + if(!pId){
  493 + treeData.push(arr[i]);
  494 + }
  495 +
  496 + for(var j = 0; j < len; j ++){
  497 + if(pId == arr[j].id){
  498 + if(!arr[j].children)
  499 + arr[j].children = [];
  500 + arr[j].children.push(arr[i]);
  501 + break;
  502 + }
  503 + }
  504 + }
  505 + return treeData;
  506 + }
481 507  
482 508 });
483 509  
... ...
src/main/resources/static/pages/forms/statement/scheduleAnaly.html
... ... @@ -327,6 +327,32 @@
327 327 });
328 328 }
329 329  
  330 + /**
  331 + * 将模块List 转换为树结构
  332 + * @param arr
  333 + * @returns {Array}
  334 + */
  335 + function createTreeData(arr){
  336 + var treeData = [];
  337 + var len = arr.length;
  338 + for(var i = 0; i < len; i ++){
  339 + var pId = arr[i].pId;
  340 + arr[i].text = arr[i].name;
  341 + if(!pId){
  342 + treeData.push(arr[i]);
  343 + }
  344 +
  345 + for(var j = 0; j < len; j ++){
  346 + if(pId == arr[j].id){
  347 + if(!arr[j].children)
  348 + arr[j].children = [];
  349 + arr[j].children.push(arr[i]);
  350 + break;
  351 + }
  352 + }
  353 + }
  354 + return treeData;
  355 + }
330 356  
331 357 function showPagination(data){
332 358 //分页
... ...
src/main/resources/static/pages/forms/statement/scheduleAnaly_sum.html
... ... @@ -335,6 +335,33 @@
335 335 });
336 336 }
337 337  
  338 + /**
  339 + * 将模块List 转换为树结构
  340 + * @param arr
  341 + * @returns {Array}
  342 + */
  343 + function createTreeData(arr){
  344 + var treeData = [];
  345 + var len = arr.length;
  346 + for(var i = 0; i < len; i ++){
  347 + var pId = arr[i].pId;
  348 + arr[i].text = arr[i].name;
  349 + if(!pId){
  350 + treeData.push(arr[i]);
  351 + }
  352 +
  353 + for(var j = 0; j < len; j ++){
  354 + if(pId == arr[j].id){
  355 + if(!arr[j].children)
  356 + arr[j].children = [];
  357 + arr[j].children.push(arr[i]);
  358 + break;
  359 + }
  360 + }
  361 + }
  362 + return treeData;
  363 + }
  364 +
338 365 function initCl(){
339 366 $('#nbbm').select2({
340 367 placeholder: '搜索车辆...',
... ...
src/main/resources/static/pages/forms/statement/timeAndSpeed.html
... ... @@ -480,6 +480,33 @@
480 480 });
481 481 }
482 482  
  483 + /**
  484 + * 将模块List 转换为树结构
  485 + * @param arr
  486 + * @returns {Array}
  487 + */
  488 + function createTreeData(arr){
  489 + var treeData = [];
  490 + var len = arr.length;
  491 + for(var i = 0; i < len; i ++){
  492 + var pId = arr[i].pId;
  493 + arr[i].text = arr[i].name;
  494 + if(!pId){
  495 + treeData.push(arr[i]);
  496 + }
  497 +
  498 + for(var j = 0; j < len; j ++){
  499 + if(pId == arr[j].id){
  500 + if(!arr[j].children)
  501 + arr[j].children = [];
  502 + arr[j].children.push(arr[i]);
  503 + break;
  504 + }
  505 + }
  506 + }
  507 + return treeData;
  508 + }
  509 +
483 510 function _w_table_rowspan(_w_table_id, _w_table_colnum){
484 511 _w_table_firsttd = "";
485 512 _w_table_currenttd = "";
... ...
src/main/resources/static/pages/forms/statement/waybill.html
... ... @@ -359,7 +359,8 @@
359 359 });
360 360 });
361 361 $get('/realSchedule/exportWaybillMore',{date:date,line:line,strs:JSON.stringify(param)},function(result){
362   - window.open("/downloadFile/downloadList?fileName="+result.fileName);
  362 +// window.open("/downloadFile/downloadList?fileName="+result.fileName); //下载压缩包
  363 + window.open("/downloadFile/download?fileName="+result.fileName);
363 364 });
364 365 });
365 366  
... ...
src/main/resources/static/pages/permission/module/list.html
... ... @@ -192,4 +192,31 @@ function getTreeData(cb){
192 192 });
193 193 }
194 194  
  195 +/**
  196 + * 将模块List 转换为树结构
  197 + * @param arr
  198 + * @returns {Array}
  199 + */
  200 +function createTreeData(arr){
  201 + var treeData = [];
  202 + var len = arr.length;
  203 + for(var i = 0; i < len; i ++){
  204 + var pId = arr[i].pId;
  205 + arr[i].text = arr[i].name;
  206 + if(!pId){
  207 + treeData.push(arr[i]);
  208 + }
  209 +
  210 + for(var j = 0; j < len; j ++){
  211 + if(pId == arr[j].id){
  212 + if(!arr[j].children)
  213 + arr[j].children = [];
  214 + arr[j].children.push(arr[i]);
  215 + break;
  216 + }
  217 + }
  218 + }
  219 + return treeData;
  220 +}
  221 +
195 222 </script>
196 223 \ No newline at end of file
... ...
src/main/resources/static/pages/permission/resource/add.html
... ... @@ -169,5 +169,33 @@ $(function(){
169 169 cb && cb(treeData)
170 170 });
171 171 }
  172 +
  173 + /**
  174 + * 将模块List 转换为树结构
  175 + * @param arr
  176 + * @returns {Array}
  177 + */
  178 + function createTreeData(arr){
  179 + var treeData = [];
  180 + var len = arr.length;
  181 + for(var i = 0; i < len; i ++){
  182 + var pId = arr[i].pId;
  183 + arr[i].text = arr[i].name;
  184 + if(!pId){
  185 + treeData.push(arr[i]);
  186 + }
  187 +
  188 + for(var j = 0; j < len; j ++){
  189 + if(pId == arr[j].id){
  190 + if(!arr[j].children)
  191 + arr[j].children = [];
  192 + arr[j].children.push(arr[i]);
  193 + break;
  194 + }
  195 + }
  196 + }
  197 + return treeData;
  198 + }
  199 +
172 200 });
173 201 </script>
174 202 \ No newline at end of file
... ...
src/main/resources/static/pages/permission/resource/edit.html
... ... @@ -187,5 +187,33 @@ $(function(){
187 187 cb && cb(treeData)
188 188 });
189 189 }
  190 +
  191 + /**
  192 + * 将模块List 转换为树结构
  193 + * @param arr
  194 + * @returns {Array}
  195 + */
  196 + function createTreeData(arr){
  197 + var treeData = [];
  198 + var len = arr.length;
  199 + for(var i = 0; i < len; i ++){
  200 + var pId = arr[i].pId;
  201 + arr[i].text = arr[i].name;
  202 + if(!pId){
  203 + treeData.push(arr[i]);
  204 + }
  205 +
  206 + for(var j = 0; j < len; j ++){
  207 + if(pId == arr[j].id){
  208 + if(!arr[j].children)
  209 + arr[j].children = [];
  210 + arr[j].children.push(arr[i]);
  211 + break;
  212 + }
  213 + }
  214 + }
  215 + return treeData;
  216 + }
  217 +
190 218 });
191 219 </script>
192 220 \ No newline at end of file
... ...
src/main/resources/static/pages/permission/resource/list.html
... ... @@ -281,6 +281,33 @@ $(function(){
281 281 });
282 282 }
283 283  
  284 + /**
  285 + * 将模块List 转换为树结构
  286 + * @param arr
  287 + * @returns {Array}
  288 + */
  289 + function createTreeData(arr){
  290 + var treeData = [];
  291 + var len = arr.length;
  292 + for(var i = 0; i < len; i ++){
  293 + var pId = arr[i].pId;
  294 + arr[i].text = arr[i].name;
  295 + if(!pId){
  296 + treeData.push(arr[i]);
  297 + }
  298 +
  299 + for(var j = 0; j < len; j ++){
  300 + if(pId == arr[j].id){
  301 + if(!arr[j].children)
  302 + arr[j].children = [];
  303 + arr[j].children.push(arr[i]);
  304 + break;
  305 + }
  306 + }
  307 + }
  308 + return treeData;
  309 + }
  310 +
284 311 //删除
285 312 $('#removeButton').on('click', function(){
286 313 if($(this).attr('disabled'))
... ...
src/main/resources/static/pages/permission/role/settings.html
... ... @@ -215,5 +215,33 @@ $(function(){
215 215 cb && cb(treeData)
216 216 });
217 217 }
  218 +
  219 + /**
  220 + * 将模块List 转换为树结构
  221 + * @param arr
  222 + * @returns {Array}
  223 + */
  224 + function createTreeData(arr){
  225 + var treeData = [];
  226 + var len = arr.length;
  227 + for(var i = 0; i < len; i ++){
  228 + var pId = arr[i].pId;
  229 + arr[i].text = arr[i].name;
  230 + if(!pId){
  231 + treeData.push(arr[i]);
  232 + }
  233 +
  234 + for(var j = 0; j < len; j ++){
  235 + if(pId == arr[j].id){
  236 + if(!arr[j].children)
  237 + arr[j].children = [];
  238 + arr[j].children.push(arr[i]);
  239 + break;
  240 + }
  241 + }
  242 + }
  243 + return treeData;
  244 + }
  245 +
218 246 });
219 247 </script>
... ...
src/main/resources/static/pages/report/timetable/timetable.html
... ... @@ -298,6 +298,33 @@
298 298 });
299 299 }
300 300  
  301 + /**
  302 + * 将模块List 转换为树结构
  303 + * @param arr
  304 + * @returns {Array}
  305 + */
  306 + function createTreeData(arr){
  307 + var treeData = [];
  308 + var len = arr.length;
  309 + for(var i = 0; i < len; i ++){
  310 + var pId = arr[i].pId;
  311 + arr[i].text = arr[i].name;
  312 + if(!pId){
  313 + treeData.push(arr[i]);
  314 + }
  315 +
  316 + for(var j = 0; j < len; j ++){
  317 + if(pId == arr[j].id){
  318 + if(!arr[j].children)
  319 + arr[j].children = [];
  320 + arr[j].children.push(arr[i]);
  321 + break;
  322 + }
  323 + }
  324 + }
  325 + return treeData;
  326 + }
  327 +
301 328 $("#line").on("change", function(){
302 329 line = $("#line").val();
303 330 updateTtinfo();
... ...