Commit dbe5d3c8f4c88b084a72a36705521bffdf343720

Authored by fxy
1 parent 90516b34

fxy

src/main/java/com/bsth/controller/DownloadController.java 0 → 100644
  1 +package com.bsth.controller;
  2 +
  3 +import java.io.File;
  4 +import java.io.IOException;
  5 +
  6 +import org.apache.commons.io.FileUtils;
  7 +import org.springframework.context.annotation.Scope;
  8 +import org.springframework.http.HttpHeaders;
  9 +import org.springframework.http.HttpStatus;
  10 +import org.springframework.http.MediaType;
  11 +import org.springframework.http.ResponseEntity;
  12 +import org.springframework.stereotype.Component;
  13 +import org.springframework.web.bind.annotation.RequestMapping;
  14 +
  15 +/**
  16 + * <一句话功能简述>
  17 + * <功能详细描述>
  18 + *
  19 + * @author Administrator
  20 + * @version [版本号, 2014年3月7日]
  21 + * @see [相关类/方法]
  22 + * @since [产品/模块版本]
  23 + */
  24 +@Component
  25 +@Scope("prototype")
  26 +@RequestMapping("/downloadFile")
  27 +public class DownloadController
  28 +{
  29 +
  30 + @RequestMapping("download")
  31 + public ResponseEntity<byte[]> download(String jName,String lpName) throws IOException {
  32 + String fileName = jName+lpName+".xls";
  33 + String path="D:\\export\\target\\"+jName+".xls";
  34 + File file=new File(path);
  35 + HttpHeaders headers = new HttpHeaders();
  36 + String realFileName=new String(fileName.getBytes("UTF-8"),"iso-8859-1");//为了解决中文名称乱码问题
  37 + headers.setContentDispositionFormData("attachment", realFileName);
  38 + headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
  39 + return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),
  40 + headers, HttpStatus.CREATED);
  41 + }
  42 +}
... ...
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
... ... @@ -129,4 +129,23 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
129 129 public Map<String, Object> adjust(@RequestParam Long id, @RequestParam String nbbm, @RequestParam String jsy, @RequestParam String spy){
130 130 return scheduleRealInfoService.adjust(id, nbbm, jsy, spy);
131 131 }
  132 +
  133 + @RequestMapping(value="/queryUserInfo")
  134 + public List<ScheduleRealInfo> queryUserInfo(@RequestParam String line,@RequestParam String date){
  135 + return scheduleRealInfoService.queryUserInfo(line, date);
  136 + }
  137 +
  138 + @RequestMapping(value="/exportWaybill")
  139 + public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName){
  140 + return scheduleRealInfoService.exportWaybill(jName, clZbh,lpName);
  141 + }
  142 + @RequestMapping(value="/dailyInfo")
  143 + public List<Map<String,Object>> dailyInfo(@RequestParam String line,@RequestParam String date){
  144 + return scheduleRealInfoService.dailyInfo(line, date);
  145 + }
  146 +
  147 + @RequestMapping(value="/historyMessage")
  148 + public List<ScheduleRealInfo> historyMessage(@RequestParam String line,@RequestParam String date,@RequestParam String code){
  149 + return scheduleRealInfoService.historyMessage(line, date,code);
  150 + }
132 151 }
... ...
src/main/java/com/bsth/entity/search/PredicatesBuilder.java
... ... @@ -2,6 +2,9 @@ package com.bsth.entity.search;
2 2  
3 3 import java.text.NumberFormat;
4 4 import java.text.ParseException;
  5 +import java.text.SimpleDateFormat;
  6 +import java.util.Date;
  7 +
5 8 import javax.persistence.criteria.CriteriaBuilder;
6 9 import javax.persistence.criteria.Path;
7 10 import javax.persistence.criteria.Predicate;
... ... @@ -107,4 +110,15 @@ public class PredicatesBuilder {
107 110 public static Predicate ist(CriteriaBuilder cb,Path<Boolean> expression, Object object){
108 111 return cb.isTrue(expression);
109 112 }
  113 +
  114 + public static Predicate date(CriteriaBuilder cb,Path<?> expression, Object object){
  115 + Date time = null;
  116 + try {
  117 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  118 + time = sdf.parse(object.toString());
  119 + } catch (Exception e) {
  120 + e.printStackTrace();
  121 + }
  122 + return cb.equal(expression, time);
  123 + }
110 124 }
... ...
src/main/java/com/bsth/entity/search/SearchOperator.java
... ... @@ -25,5 +25,6 @@ public enum SearchOperator {
25 25 isNull, // 空
26 26 isNotNull, // 非空
27 27 isf, //假 isFalse,boolean
28   - ist //真 isTrue,boolean
  28 + ist, //真 isTrue,boolean
  29 + date //时间
29 30 }
... ...
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
1 1 package com.bsth.repository.realcontrol;
2 2  
3 3 import java.util.List;
  4 +import java.util.Map;
4 5  
5 6 import org.springframework.data.domain.Page;
6 7 import org.springframework.data.domain.Pageable;
... ... @@ -21,4 +22,16 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
21 22 @EntityGraph(value = "scheduleRealInfo_childTasks", type = EntityGraph.EntityGraphType.FETCH)
22 23 @Override
23 24 Page<ScheduleRealInfo> findAll(Specification<ScheduleRealInfo> spec, Pageable pageable);
  25 +
  26 + @Query(value="select s from ScheduleRealInfo s where s.xlName = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 group by jName,clZbh,lpName")
  27 + List<ScheduleRealInfo> queryUserInfo(String line,String date);
  28 +
  29 + @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3")
  30 + List<ScheduleRealInfo> exportWaybill(String jName,String clZbh,String lpName);
  31 +
  32 + @Query(value="select new map(clZbh,jGh,jName,sum(jhlc)) from ScheduleRealInfo s where s.xlName = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 group by clZbh,jGh")
  33 + List<Map<String, Object>> dailyInfo(String line,String date);
  34 +
  35 + @Query(value="select s from ScheduleRealInfo s where s.xlName = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.clZbh like ?3")
  36 + List<ScheduleRealInfo> historyMessage(String line,String date,String code);
24 37 }
... ...
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
... ... @@ -58,5 +58,12 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
58 58 */
59 59 void adjustConductor(ScheduleRealInfo schedule, String conductor, String conductorName);
60 60  
  61 + List<ScheduleRealInfo> queryUserInfo(String line,String date);
  62 +
  63 + List<ScheduleRealInfo> exportWaybill(String jName,String clZbh,String lpName);
  64 +
  65 + List<Map<String,Object>> dailyInfo(String line,String date);
  66 +
  67 + List<ScheduleRealInfo> historyMessage(String line,String date,String code);
61 68  
62 69 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
1 1 package com.bsth.service.realcontrol.impl;
2 2  
  3 +import java.io.File;
3 4 import java.text.SimpleDateFormat;
4 5 import java.util.ArrayList;
5 6 import java.util.Collection;
6 7 import java.util.Date;
7 8 import java.util.HashMap;
  9 +import java.util.Iterator;
8 10 import java.util.List;
9 11 import java.util.Map;
10 12 import java.util.Set;
... ... @@ -32,6 +34,7 @@ import com.bsth.security.util.SecurityUtils;
32 34 import com.bsth.service.impl.BaseServiceImpl;
33 35 import com.bsth.service.realcontrol.ScheduleRealInfoService;
34 36 import com.bsth.service.realcontrol.buffer.ScheduleBuffer;
  37 +import com.bsth.util.ReportUtils;
35 38 import com.bsth.vehicle.common.CommonMapped;
36 39 import com.google.common.base.Splitter;
37 40 import com.google.common.collect.ArrayListMultimap;
... ... @@ -325,4 +328,45 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
325 328 schedule.setsGh(conductor);
326 329 schedule.setsName(conductorName);
327 330 }
  331 +
  332 + @Override
  333 + public List<ScheduleRealInfo> queryUserInfo(String line, String date) {
  334 + // TODO Auto-generated method stub
  335 + return scheduleRealInfoRepository.queryUserInfo(line, date);
  336 + }
  337 +
  338 + @Override
  339 + public List<ScheduleRealInfo> exportWaybill(String jName, String clZbh, String lpName) {
  340 + ReportUtils ee = new ReportUtils();
  341 + List<Iterator<?>> list = new ArrayList<Iterator<?>>();
  342 + List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.exportWaybill(jName,clZbh,lpName);
  343 + ScheduleRealInfo scheduleRealInfo = scheduleRealInfoRepository.findOne(scheduleRealInfos.get(0).getId());
  344 +
  345 + File source =new File("D:\\export\\source");
  346 + File target =new File("D:\\export\\target");
  347 + if (!source .exists() && !source .isDirectory()){
  348 + source.mkdirs();
  349 + }
  350 + if (!target .exists() && !target .isDirectory()){
  351 + target.mkdirs();
  352 + }
  353 +
  354 + list.add(scheduleRealInfos.iterator());
  355 + ee.excelReplace(list, new Object[]{scheduleRealInfo}, "D:\\export\\source\\waybill.xls",
  356 + "D:\\export\\target\\"+jName+".xls");
  357 + return scheduleRealInfos;
  358 + }
  359 +
  360 + @Override
  361 + public List<Map<String, Object>> dailyInfo(String line, String date) {
  362 + // TODO Auto-generated method stub
  363 + return scheduleRealInfoRepository.dailyInfo(line,date);
  364 + }
  365 +
  366 + @Override
  367 + public List<ScheduleRealInfo> historyMessage(String line, String date,
  368 + String code) {
  369 + // TODO Auto-generated method stub
  370 + return scheduleRealInfoRepository.historyMessage(line, date,code+"%");
  371 + }
328 372 }
... ...
src/main/java/com/bsth/util/ReportRelatedUtils.java 0 → 100644
  1 +package com.bsth.util;
  2 +
  3 +import java.lang.reflect.InvocationTargetException;
  4 +import java.lang.reflect.Method;
  5 +
  6 +import com.bsth.entity.Line;
  7 +
  8 +public class ReportRelatedUtils {
  9 + public static void main(String[] args) {
  10 + try {
  11 + ReportRelatedUtils test = new ReportRelatedUtils();
  12 + Line line = new Line();
  13 + line.setId(10);
  14 + line.setName("abc");
  15 + test.getValue(line, "name");
  16 + } catch (Exception e) {
  17 + e.printStackTrace();
  18 + }
  19 +
  20 + }
  21 +
  22 + /**
  23 + * 通过字段名取到对象中该字段的相应值
  24 + *
  25 + * @param t
  26 + * 对象
  27 + * @param fieldName
  28 + * 字段名
  29 + * @return
  30 + * @throws ClassNotFoundException
  31 + * @throws IllegalAccessException
  32 + * @throws InvocationTargetException
  33 + * @throws NoSuchMethodException
  34 + * @throws NoSuchFieldException
  35 + */
  36 + public <T> Object getValue(T t, String fieldName)
  37 + throws ClassNotFoundException, IllegalAccessException,
  38 + InvocationTargetException, NoSuchMethodException,
  39 + NoSuchFieldException {
  40 + Object value = "";
  41 + String tmpFieldName = firstCharToUpperCase(fieldName);
  42 + Method method = null;
  43 + try {
  44 + method = t.getClass().getMethod("get" + tmpFieldName);
  45 + value = method.invoke(t);
  46 + } catch (NoSuchMethodException e) {
  47 + if(method == null){
  48 + method = t.getClass().getMethod("get" + tmpFieldName);
  49 + }
  50 + value = method.invoke(t);
  51 + return value;
  52 + }
  53 + return value;
  54 + }
  55 +
  56 + /**
  57 + * 首字母大写
  58 + *
  59 + * @param source
  60 + * 源字符串
  61 + * @return
  62 + */
  63 + private String firstCharToUpperCase(String source) {
  64 + char[] arr = source.toCharArray();
  65 + if (arr[1] >= 'A' && arr[1] <= 'Z') {
  66 + return source;
  67 + }else{
  68 + if (arr[0] >= 'a' && arr[0] <= 'z') {
  69 + arr[0] -= 'a' - 'A';
  70 + }
  71 + }
  72 + return new String(arr);
  73 + }
  74 +}
... ...
src/main/java/com/bsth/util/ReportUtils.java 0 → 100644
  1 +package com.bsth.util;
  2 +
  3 +import java.io.File;
  4 +import java.io.FileInputStream;
  5 +import java.io.FileOutputStream;
  6 +import java.util.ArrayList;
  7 +import java.util.Iterator;
  8 +import java.util.List;
  9 +
  10 +import org.apache.poi.hssf.usermodel.HSSFCell;
  11 +import org.apache.poi.hssf.usermodel.HSSFCellStyle;
  12 +import org.apache.poi.hssf.usermodel.HSSFRow;
  13 +import org.apache.poi.hssf.usermodel.HSSFSheet;
  14 +import org.apache.poi.hssf.usermodel.HSSFWorkbook;
  15 +import org.apache.poi.poifs.filesystem.POIFSFileSystem;
  16 +import org.apache.poi.ss.usermodel.Cell;
  17 +
  18 +import com.bsth.entity.Cars;
  19 +import com.bsth.entity.Line;
  20 +import com.bsth.entity.Section;
  21 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  22 +
  23 +public class ReportUtils {
  24 + // private final String packaegName = "com.bsth.entity.";
  25 + private final String packaegName = "com.bsth.entity.realcontrol.";
  26 +
  27 + /**
  28 + * /**
  29 + *
  30 + * @param list
  31 + * 模板中,需要重复显示的行所需的数据
  32 + * @param map
  33 + * 模板中除以上list外所有的数据
  34 + * @param index
  35 + * 需要重复的行号,该值为行号减1
  36 + * @param sourcePath
  37 + * 模板路径
  38 + * @param targetPath
  39 + * 生成路径
  40 + */
  41 + public void excelReplace(List<Iterator<?>> list, Object[] tArray,
  42 + String sourcePath, String targetPath) {
  43 + try {
  44 + // 把源文件放入流中
  45 + POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(
  46 + sourcePath));
  47 + HSSFWorkbook wb = new HSSFWorkbook(fs);
  48 + HSSFSheet sheet = wb.getSheetAt(0);
  49 + HSSFRow row;
  50 + HSSFCell cell = null;
  51 + String key;
  52 + // 取得总行数
  53 + int rowNum = sheet.getLastRowNum();
  54 + // 取得总列数
  55 + int cellNum = sheet.getRow(0).getLastCellNum();
  56 +
  57 + // 遍历行
  58 + for (int i = 0; i < rowNum; i++) {
  59 + row = sheet.getRow(i);
  60 + // 遍历列
  61 + for (int j = 0; j < cellNum; j++) {
  62 + if (row == null) {
  63 + continue;
  64 + }
  65 + cell = row.getCell(j);
  66 + if (cell == null) {
  67 + continue;
  68 + }
  69 + // 取得每列的内容,如果列内容是$key$格式,则替换内容
  70 + key = cell.getStringCellValue();
  71 + if (key.indexOf("$") != -1 || key.indexOf("#list#") != -1) {
  72 + // * 列中内容有#list#,则表示该行为模板行,需要以该行为模板
  73 + // * 例如:模板行格式 #list#0_0 $Car.id$
  74 + // * 第一个0表示需要在list中取iterator的索引值
  75 + // * 第二个0表示在iterator中取的第几个对象,如果不为0,则取下一个对象,而不是沿用前面获取的对象
  76 + // * $Car.id$表示所取的对象为Car的对象,并且取值为id的值
  77 + if (key.indexOf("#list#") != -1) {
  78 + key = key.replace("#list#", "").trim();
  79 + String[] lists = key.split(" ");
  80 + // 取得list中的索引值
  81 + int listIndex = Integer
  82 + .valueOf(lists[0].split("_")[0]);
  83 + Iterator<?> iterator = list.get(listIndex);
  84 + // 根据模板创建行并填弃数据,返回增加的行数
  85 + int rowCount = iteratorFillCellValue(wb, sheet,
  86 + cell, iterator, i, rowNum, key);
  87 + rowNum += rowCount;
  88 + i += rowCount;
  89 + break;
  90 + } else {
  91 + // 直接填充数据的列,从对象数组中取得值
  92 + getValueAndSetCellValue(cell, key, tArray);
  93 + }
  94 + }
  95 +
  96 + }
  97 + }
  98 + // 创建目标文件夹
  99 + createFolder(targetPath);
  100 + // 输出文件
  101 + FileOutputStream fileOut = new FileOutputStream(targetPath);
  102 + wb.write(fileOut);
  103 + fileOut.close();
  104 + } catch (Exception e) {
  105 + e.printStackTrace();
  106 + }
  107 + }
  108 +
  109 + /**
  110 + * 根据iterator,以及模板中的标识,填充模板
  111 + *
  112 + * @param wb
  113 + * @param sheet
  114 + * @param cell
  115 + * @param iterator
  116 + * iterator
  117 + * @param index
  118 + * 模板行索引
  119 + * @param rowNum
  120 + * 表格总行数
  121 + * @param key
  122 + * 表格内容
  123 + * @return
  124 + */
  125 + private int iteratorFillCellValue(HSSFWorkbook wb, HSSFSheet sheet,
  126 + HSSFCell cell, Iterator<?> iterator, int index, int rowNum,
  127 + String key) {
  128 + int rowCount = 0;
  129 + Object obj = null;
  130 + int p = 0;
  131 + int i = index;
  132 + HSSFRow newRow = null;
  133 + int tmpCellNum = 0;
  134 + int k = 0;
  135 + // 取得模板行
  136 + HSSFRow orgRow = sheet.getRow(index);
  137 + try {
  138 + while (iterator.hasNext()) {
  139 + // 取得iterator的对象
  140 + obj = iterator.next();
  141 + // 移动当前编辑行以下的所有行
  142 + if (p != 0) {
  143 + rowNum += 1;
  144 + i += 1;
  145 + rowCount += 1;// 增加的总行数
  146 + // 把当前行以下的所有行往下移动1行
  147 + sheet.shiftRows(i, rowNum, 1);
  148 + }
  149 + p = 1;
  150 + // 创建新行
  151 + newRow = sheet.createRow(index + k++);
  152 + // 把新行的内容换成和模板行一样
  153 + copyRow(wb, orgRow, newRow, true);
  154 + tmpCellNum = newRow.getLastCellNum();
  155 + for (int l = 0; l < tmpCellNum; l++) {
  156 + cell = newRow.getCell(l);
  157 + key = cell.getStringCellValue();
  158 + /**
  159 + * 如果单无格内容为#list#,表示该行是模板行 #list#0_0
  160 + * 第一个0表示需要在list中取iterator的索引值
  161 + * 第二个0表示在iterator中取的第几个对象,如果不为0,则取下一个对象,而不是沿用前面获取的对象
  162 + */
  163 + if (key.indexOf("#list#") != -1 && key.indexOf("_0") == -1) {
  164 + if (iterator.hasNext()) {
  165 + obj = iterator.next();
  166 + } else {
  167 + obj = null;
  168 + }
  169 + }
  170 + if (key.trim().indexOf(" ") != -1) {
  171 + key = key.split(" ")[1];
  172 + }
  173 + getValueAndSetCellValue(cell, key, obj);
  174 + }
  175 + }
  176 + } catch (Exception e) {
  177 + e.printStackTrace();
  178 + }
  179 + return rowCount;
  180 + }
  181 +
  182 + /**
  183 + * 取到相应的值并填入相应的列中
  184 + *
  185 + * @param cell
  186 + * 列
  187 + * @param key
  188 + * 列内容
  189 + * @param obj
  190 + * 数据源对象
  191 + */
  192 + private void getValueAndSetCellValue(HSSFCell cell, String key, Object obj) {
  193 + try {
  194 + String cellValue = key = key.replace("\\n", "");
  195 + String tmpKey ;
  196 + while(key.indexOf("$") != -1){
  197 + key = key.substring(key.indexOf("$")+1);
  198 + tmpKey = key.substring(0,key.indexOf("$"));
  199 + key = key.substring(key.indexOf("$")+1);
  200 + if (tmpKey.indexOf(".") != -1) {
  201 + String className = tmpKey.substring(0, tmpKey.indexOf("."));
  202 + String classWholeName = packaegName + className;
  203 + String fieldName = tmpKey.substring(tmpKey.indexOf(".") + 1);
  204 + if (obj.getClass().getName().equals(classWholeName)) {
  205 + cellValue = cellValue.replace("$"+tmpKey+"$", getKeyValue(obj,fieldName)+"");
  206 + }
  207 + }
  208 + }
  209 + cell.setCellValue(cellValue);
  210 + } catch (Exception e) {
  211 + e.printStackTrace();
  212 + }
  213 +
  214 + }
  215 +
  216 + /**
  217 + * 取到相应的值并填入相应的列中
  218 + *
  219 + * @param cell
  220 + * 列
  221 + * @param key
  222 + * 列内容
  223 + * @param tArray
  224 + * 数据源对象
  225 + */
  226 + private void getValueAndSetCellValue(HSSFCell cell, String key,
  227 + Object[] tArray) {
  228 + try {
  229 + String cellValue = key = key.replace("\\n", "");
  230 + String tmpKey ;
  231 + while(key.indexOf("$") != -1){
  232 + key = key.substring(key.indexOf("$")+1);
  233 + tmpKey = key.substring(0,key.indexOf("$"));
  234 + key = key.substring(key.indexOf("$")+1);
  235 + if (tmpKey.indexOf(".") != -1) {
  236 + String className = tmpKey.substring(0, tmpKey.indexOf("."));
  237 + String classWholeName = packaegName + className;
  238 + String fieldName = tmpKey.substring(tmpKey.indexOf(".") + 1);
  239 + for (int k = 0; k < tArray.length; k++) {
  240 + if (tArray[k].getClass().getName()
  241 + .equals(classWholeName)) {
  242 + cellValue = cellValue.replace("$"+tmpKey+"$", getKeyValue(tArray[k],fieldName)+"");
  243 + }
  244 + }
  245 + }
  246 + }
  247 + cell.setCellValue(cellValue);
  248 + } catch (Exception e) {
  249 + e.printStackTrace();
  250 + }
  251 +
  252 + }
  253 +
  254 + /**
  255 + * 给列填充数据
  256 + *
  257 + * @param cell
  258 + * 列
  259 + * @param obj
  260 + * 数据源对象
  261 + * @param fieldName
  262 + * 需要取数据的字段
  263 + */
  264 + private Object getKeyValue(Object obj, String fieldName) {
  265 + Object value = "";
  266 + try {
  267 + if (obj != null) {
  268 + ReportRelatedUtils test = new ReportRelatedUtils();
  269 + value = test.getValue(obj, fieldName) == null ? "" : test
  270 + .getValue(obj, fieldName);
  271 + }
  272 + } catch (Exception e) {
  273 + e.printStackTrace();
  274 + }
  275 + return value;
  276 + }
  277 +
  278 + public static void main(String[] args) {
  279 +
  280 + try {
  281 + ReportUtils ee = new ReportUtils();
  282 + List<Iterator<?>> list = new ArrayList<Iterator<?>>();
  283 + Line line = new Line();
  284 + line.setId(1);
  285 + line.setName("line1");
  286 +
  287 + List<Object> dataList = new ArrayList<Object>();
  288 +// Cars cars = new Cars();
  289 +// cars.setId(111);
  290 +// cars.setCompany("111car");
  291 +// dataList.add(cars);
  292 +// cars = new Cars();
  293 +// cars.setId(222);
  294 +// cars.setCompany("222car");
  295 +// dataList.add(cars);
  296 +// cars = new Cars();
  297 +// cars.setId(101);
  298 +// cars.setCompany("101car");
  299 +// dataList.add(cars);
  300 +// cars = new Cars();
  301 +// cars.setId(101);
  302 +// cars.setCompany("101car");
  303 +// dataList.add(cars);
  304 +// cars = new Cars();
  305 +// cars.setId(101);
  306 +// cars.setCompany("101car");
  307 +// dataList.add(cars);
  308 +// cars = new Cars();
  309 +// cars.setId(101);
  310 +// cars.setCompany("101car");
  311 +// dataList.add(cars);
  312 +// cars = new Cars();
  313 +// cars.setId(101);
  314 +// cars.setCompany("101car");
  315 +// dataList.add(cars);
  316 +// cars = new Cars();
  317 +// cars.setId(101);
  318 +// cars.setCompany("101car");
  319 +// dataList.add(cars);
  320 +// cars = new Cars();
  321 +// cars.setId(101);
  322 +// cars.setCompany("101car");
  323 +// dataList.add(cars);
  324 +// list.add(dataList.iterator());
  325 +
  326 + ScheduleRealInfo sr = new ScheduleRealInfo();
  327 + sr.setId((long) 111);
  328 + sr.setXlName("abc");
  329 +
  330 + sr = new ScheduleRealInfo();
  331 + sr.setId((long) 22);
  332 + sr.setXlName("abc22");
  333 + dataList.add(sr);
  334 + sr = new ScheduleRealInfo();
  335 + sr.setId((long) 33);
  336 + sr.setXlName("abc33");
  337 + dataList.add(sr);
  338 + list.add(dataList.iterator());
  339 + // dataList = new ArrayList<Object>();
  340 + // Section section = new Section();
  341 + // section.setId(333);
  342 + // section.setSectionName("333section");
  343 + // dataList.add(section);
  344 + // section = new Section();
  345 + // section.setId(444);
  346 + // section.setSectionName("444section");
  347 + // dataList.add(section);
  348 + // section = new Section();
  349 + // section.setId(555);
  350 + // section.setSectionName("555section");
  351 + // dataList.add(section);
  352 + // section = new Section();
  353 + // section.setId(666);
  354 + // section.setSectionName("666section");
  355 + // dataList.add(section);
  356 + // section = new Section();
  357 + // section.setId(777);
  358 + // section.setSectionName("777section");
  359 + // dataList.add(section);
  360 + // section = new Section();
  361 + // section.setId(888);
  362 + // section.setSectionName("888section");
  363 + // // dataList.add(section);
  364 + // list.add(dataList.iterator());
  365 + ee.excelReplace(list, new Object[] { sr }, "D:\\55.xls",
  366 + "D:\\22.xls");
  367 + // ee.test(line);
  368 + // ee.shiftRow();
  369 + System.out.println("ok");
  370 + } catch (Exception e) {
  371 + e.printStackTrace();
  372 + }
  373 + }
  374 +
  375 + private void shiftRow() {
  376 + try {
  377 + String targetPath = "D:\\22.xls";
  378 + // 把源文件放入流中
  379 + POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(
  380 + "D:\\44.xls"));
  381 + HSSFWorkbook wb = new HSSFWorkbook(fs);
  382 + HSSFSheet sheet = wb.getSheetAt(0);
  383 + sheet.shiftRows(1, 2, 4);
  384 + // 创建目标文件夹
  385 + createFolder(targetPath);
  386 + // 输出文件
  387 + FileOutputStream fileOut = new FileOutputStream(targetPath);
  388 + wb.write(fileOut);
  389 + fileOut.close();
  390 + } catch (Exception e) {
  391 + e.printStackTrace();
  392 + }
  393 +
  394 + }
  395 +
  396 + /**
  397 + * 行复制功能
  398 + *
  399 + * @param fromRow
  400 + * @param toRow
  401 + */
  402 + private void copyRow(HSSFWorkbook wb, HSSFRow fromRow, HSSFRow toRow,
  403 + boolean copyValueFlag) {
  404 + for (Iterator<Cell> cellIt = fromRow.cellIterator(); cellIt.hasNext();) {
  405 + HSSFCell tmpCell = (HSSFCell) cellIt.next();
  406 + HSSFCell newCell = toRow.createCell(tmpCell.getColumnIndex(), 0);
  407 + copyCell(wb, tmpCell, newCell, copyValueFlag);
  408 + }
  409 + }
  410 +
  411 + /**
  412 + * 复制单元格
  413 + *
  414 + * @param srcCell
  415 + * @param distCell
  416 + * @param copyValueFlag
  417 + * true则连同cell的内容一起复制
  418 + */
  419 + public void copyCell(HSSFWorkbook wb, HSSFCell srcCell, HSSFCell distCell,
  420 + boolean copyValueFlag) {
  421 + HSSFCellStyle newstyle = wb.createCellStyle();
  422 + copyCellStyle(wb, srcCell.getCellStyle(), newstyle);
  423 + // 样式
  424 + distCell.setCellStyle(newstyle);
  425 + // 评论
  426 + if (srcCell.getCellComment() != null) {
  427 + distCell.setCellComment(srcCell.getCellComment());
  428 + }
  429 + // 不同数据类型处理
  430 + int srcCellType = srcCell.getCellType();
  431 + distCell.setCellType(srcCellType);
  432 + if (copyValueFlag) {
  433 + if (srcCellType == HSSFCell.CELL_TYPE_NUMERIC) {
  434 + distCell.setCellValue(srcCell.getDateCellValue());
  435 + } else if (srcCellType == HSSFCell.CELL_TYPE_STRING) {
  436 + distCell.setCellValue(srcCell.getRichStringCellValue());
  437 + } else if (srcCellType == HSSFCell.CELL_TYPE_BLANK) {
  438 +
  439 + } else if (srcCellType == HSSFCell.CELL_TYPE_BOOLEAN) {
  440 + distCell.setCellValue(srcCell.getBooleanCellValue());
  441 + } else if (srcCellType == HSSFCell.CELL_TYPE_ERROR) {
  442 + distCell.setCellErrorValue(srcCell.getErrorCellValue());
  443 + } else if (srcCellType == HSSFCell.CELL_TYPE_FORMULA) {
  444 + distCell.setCellFormula(srcCell.getCellFormula());
  445 + } else {
  446 + }
  447 + }
  448 + }
  449 +
  450 + /**
  451 + * 复制一个单元格样式到目的单元格样式
  452 + *
  453 + * @param fromStyle
  454 + * @param toStyle
  455 + */
  456 + public void copyCellStyle(HSSFWorkbook wb, HSSFCellStyle fromStyle,
  457 + HSSFCellStyle toStyle) {
  458 + toStyle.setAlignment(fromStyle.getAlignment());
  459 + // 边框和边框颜色
  460 + toStyle.setBorderBottom(fromStyle.getBorderBottom());
  461 + toStyle.setBorderLeft(fromStyle.getBorderLeft());
  462 + toStyle.setBorderRight(fromStyle.getBorderRight());
  463 + toStyle.setBorderTop(fromStyle.getBorderTop());
  464 + toStyle.setTopBorderColor(fromStyle.getTopBorderColor());
  465 + toStyle.setBottomBorderColor(fromStyle.getBottomBorderColor());
  466 + toStyle.setRightBorderColor(fromStyle.getRightBorderColor());
  467 + toStyle.setLeftBorderColor(fromStyle.getLeftBorderColor());
  468 +
  469 + // 背景和前景
  470 + toStyle.setFillBackgroundColor(fromStyle.getFillBackgroundColor());
  471 + toStyle.setFillForegroundColor(fromStyle.getFillForegroundColor());
  472 +
  473 + toStyle.setDataFormat(fromStyle.getDataFormat());
  474 + toStyle.setFillPattern(fromStyle.getFillPattern());
  475 + toStyle.setHidden(fromStyle.getHidden());
  476 + toStyle.setIndention(fromStyle.getIndention());// 首行缩进
  477 + toStyle.setLocked(fromStyle.getLocked());
  478 + toStyle.setRotation(fromStyle.getRotation());// 旋转
  479 + toStyle.setVerticalAlignment(fromStyle.getVerticalAlignment());
  480 + toStyle.setWrapText(fromStyle.getWrapText());
  481 + // 字体
  482 + toStyle.setFont(fromStyle.getFont(wb));
  483 +
  484 + }
  485 +
  486 + /**
  487 + * 创建文件夹,并删除原有文件
  488 + *
  489 + * @param path
  490 + */
  491 + private void createFolder(String path) {
  492 + File targetFile = null;
  493 + targetFile = new File(path);
  494 + if (targetFile.exists()) {// 删除原有文件
  495 + targetFile.delete();
  496 + }
  497 + // 创建目标文件夹
  498 + targetFile = new File(path.substring(0, path.lastIndexOf("\\")));
  499 + if (!targetFile.exists()) {
  500 + targetFile.mkdirs();
  501 + }
  502 + }
  503 +
  504 +}
... ...
src/main/resources/static/index.html
... ... @@ -237,6 +237,8 @@ tr.row-active td {
237 237 <script src="/metronic_v4.5.4/plugins/jquery.min.js" data-exclude=1></script>
238 238 <!-- bootstrap -->
239 239 <script src="/metronic_v4.5.4/plugins/bootstrap/js/bootstrap.min.js" data-exclude=1></script>
  240 +<script src="/pages/forms/statement/js/jquery.autocompleter.js"></script>
  241 +<script src="/pages/forms/statement/js/jquery.PrintArea.js"></script>
240 242 <!-- MTRONIC JS -->
241 243 <script src="/metronic_v4.5.4/scripts/app.min.js" data-exclude=1></script>
242 244 <script src="/metronic_v4.5.4/layout4/scripts/layout.min.js" data-exclude=1></script>
... ...
src/main/resources/static/pages/forms/statement/account.html 0 → 100644
  1 +<link href="/pages/forms/statement/css/autocompleter.css" rel="stylesheet" type="text/css" />
  2 +<style type="text/css">
  3 + .table-bordered {
  4 + border: 1px solid; }
  5 + .table-bordered > thead > tr > th,
  6 + .table-bordered > thead > tr > td,
  7 + .table-bordered > tbody > tr > th,
  8 + .table-bordered > tbody > tr > td,
  9 + .table-bordered > tfoot > tr > th,
  10 + .table-bordered > tfoot > tr > td {
  11 + border: 1px solid; }
  12 + .table-bordered > thead > tr > th,
  13 + .table-bordered > thead > tr > td {
  14 + border-bottom-width: 2px; }
  15 +
  16 + .table > tbody + tbody {
  17 + border-top: 1px solid; }
  18 +</style>
  19 +
  20 +<div class="page-head">
  21 + <div class="page-title">
  22 + <h1>驾驶员请求台账</h1>
  23 + </div>
  24 +</div>
  25 +
  26 +<div class="row">
  27 + <div class="col-md-12">
  28 + <div class="portlet light porttlet-fit bordered">
  29 + <div class="portlet-title">
  30 + <form class="form-inline" action="">
  31 + <div class="form-group">
  32 + <label for="line">线路:</label>
  33 + <input id="line" type="text" name="xlName_eq"/>
  34 + </div>
  35 + <div class="form-group">
  36 + <label for="date">时间:</label>
  37 + <input type="text" id="date" name="scheduleDate_eq"/>
  38 + </div>
  39 + <div class="form-group">
  40 + <label for="code">内部编码:</label>
  41 + <input type="text" id="code" name="clZbh_eq"/>
  42 + </div>
  43 + <div class="form-group">
  44 + <input class="btn btn-default" type="button" id="query" value="筛选"/>
  45 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  46 + </div>
  47 + </form>
  48 + </div>
  49 + <div class="portlet-body">
  50 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  51 + <table class="table table-bordered table-hover table-checkable" id="forms">
  52 + <thead>
  53 + <tr>
  54 + <th>序号</th>
  55 + <th>线路</th>
  56 + <th>车辆</th>
  57 + <th>所属公司</th>
  58 + <th>请求类型</th>
  59 + <th>请求时间</th>
  60 + </tr>
  61 + </thead>
  62 + <tbody>
  63 +
  64 + </tbody>
  65 + </table>
  66 + </div>
  67 + </div>
  68 + </div>
  69 + </div>
  70 +</div>
  71 +
  72 +<script>
  73 + $(function(){
  74 + // 关闭左侧栏
  75 + if (!$('body').hasClass('page-sidebar-closed'))
  76 + $('.menu-toggler.sidebar-toggler').click();
  77 +
  78 + $("#date").datetimepicker({
  79 + format : 'YYYY-MM-DD',
  80 + locale : 'zh-cn'
  81 + });
  82 +
  83 + var lines = new Array();
  84 + // 取得所有线路
  85 + $get('/line/all', null, function(allLine) {
  86 + // 遍历数组
  87 + $.each(allLine, function(i, e) {
  88 + var line = '{"hex":"'+e.company+'","label":"'+e.name+'"}';
  89 + var obj = jQuery.parseJSON(line);
  90 + lines[i]= obj;
  91 + });
  92 +
  93 + });
  94 + // 给输入框绑定autocomplete事件
  95 + $("#line").autocompleter({
  96 + highlightMatches: true,
  97 + source: lines,
  98 + template: '{{ label }}',
  99 + hint: true,
  100 + empty: false,
  101 + limit: 5,
  102 + });
  103 +
  104 + var cars = new Array();
  105 + // 取得所有线路
  106 + $get('/cars/all', null, function(allCar) {
  107 + debugger
  108 + // 遍历数组
  109 + $.each(allCar, function(i, e) {
  110 + var car = '{"hex":"'+e.company+'","label":"'+e.insideCode+'"}';
  111 + var obj = jQuery.parseJSON(car);
  112 + cars[i]= obj;
  113 + });
  114 +
  115 + });
  116 + // 给输入框绑定autocomplete事件
  117 + $("#code").autocompleter({
  118 + highlightMatches: true,
  119 + source: cars,
  120 + template: '{{ label }}',
  121 + hint: true,
  122 + empty: false,
  123 + limit: 5,
  124 + });
  125 +
  126 + $("#query").on("click",function(){
  127 + var line = $("#line").val();
  128 + var date = $("#date").val();
  129 + var code = $("#code").val();
  130 + $(".hidden").removeClass("hidden");
  131 + $get('/realSchedule/historyMessage',{line:line,date:date,code:code},function(result){
  132 + // 把数据填充到模版中
  133 + var tbodyHtml = template('list_forms',{list:result});
  134 + // 把渲染好的模版html文本追加到表格中
  135 + $('#forms tbody').html(tbodyHtml);
  136 + });
  137 +
  138 + });
  139 + });
  140 +</script>
  141 +<script type="text/html" id="list_forms">
  142 + {{each list as obj i}}
  143 + <tr>
  144 + <td>{{i+1}}</td>
  145 + <td>{{obj.xlName}}</td>
  146 + <td>{{obj.clZbh}}</td>
  147 + <td>{{obj.company}}</td>
  148 + <td>&nbsp;</td>
  149 + <td>&nbsp;</td>
  150 + </tr>
  151 + {{/each}}
  152 + {{if list.length == 0}}
  153 + <tr>
  154 + <td colspan="6"><h6 class="muted">没有找到相关数据</h6></td>
  155 + </tr>
  156 + {{/if}}
  157 +</script>
0 158 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/statement/correctForm.html 0 → 100644
  1 +<link href="/pages/forms/statement/css/autocompleter.css" rel="stylesheet" type="text/css" />
  2 +<style type="text/css">
  3 + .table-bordered {
  4 + border: 1px solid; }
  5 + .table-bordered > thead > tr > th,
  6 + .table-bordered > thead > tr > td,
  7 + .table-bordered > tbody > tr > th,
  8 + .table-bordered > tbody > tr > td,
  9 + .table-bordered > tfoot > tr > th,
  10 + .table-bordered > tfoot > tr > td {
  11 + border: 1px solid; }
  12 + .table-bordered > thead > tr > th,
  13 + .table-bordered > thead > tr > td {
  14 + border-bottom-width: 2px; }
  15 +
  16 + .table > tbody + tbody {
  17 + border-top: 1px solid; }
  18 +</style>
  19 +
  20 +<div class="page-head">
  21 + <div class="page-title">
  22 + <h1>修正报表</h1>
  23 + </div>
  24 +</div>
  25 +
  26 +<div class="row">
  27 + <div class="col-md-12">
  28 + <div class="portlet light porttlet-fit bordered">
  29 + <div class="portlet-title">
  30 + <form class="form-inline" action="">
  31 + <div class="form-group">
  32 + <label for="line">线路名称:</label>
  33 + <select id="line" name="xlName_eq" class="form-control">
  34 + <option>85路</option>
  35 + </select>
  36 + </div>
  37 + <div class="form-group">
  38 + <label for="startDate">开始时间:</label>
  39 + <input type="text" id="startDate" name="startDate_eq"/>
  40 + </div>
  41 + <div class="form-group">
  42 + <label for="endDate">结束时间:</label>
  43 + <input type="text" id="endDate" name="endDate_eq"/>
  44 + </div>
  45 + <div class="form-group">
  46 + <label for="lpName">路牌:</label>
  47 + <input type="text" id="lpName" name="lpName_eq"/>
  48 + </div>
  49 + <div class="form-group">
  50 + <label for="code">内部编码:</label>
  51 + <input type="text" id="code" name="clZbh_eq"/>
  52 + </div>
  53 + <div class="form-group">
  54 + <input class="btn btn-default" type="button" id="query" value="查询"/>
  55 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  56 + </div>
  57 + </form>
  58 + </div>
  59 + <div class="portlet-body">
  60 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  61 + <table class="table table-bordered table-hover table-checkable" id="forms">
  62 + <thead>
  63 + <tr>
  64 + <th colspan="12">营运车辆修正统计表</th>
  65 + </tr>
  66 + <tr>
  67 + <td colspan="12">车队 站 2016年 06月 23日 星期四</td>
  68 + </tr>
  69 + <tr>
  70 + <td rowspan="2">线路名</td>
  71 + <td rowspan="2">路牌</td>
  72 + <td rowspan="2">车号</td>
  73 + <td colspan="2">车号</td>
  74 + <td colspan="2">发车时间</td>
  75 + <td colspan="2">结束时间</td>
  76 + <td rowspan="2">修改人</td>
  77 + <td rowspan="2">修改时间</td>
  78 + <td rowspan="2">备注</td>
  79 + </tr>
  80 + <tr>
  81 + <td>司机</td>
  82 + <td>售票员</td>
  83 + <td>计划</td>
  84 + <td>实际</td>
  85 + <td>计划</td>
  86 + <td>实际</td>
  87 + </tr>
  88 + </thead>
  89 + <tbody>
  90 +
  91 + </tbody>
  92 + <tr>
  93 + <td colspan="2">线路:</td>
  94 + <td>&nbsp;</td>
  95 + <td>调整总数</td>
  96 + <td>&nbsp;</td>
  97 + <td>事先调整</td>
  98 + <td>&nbsp;</td>
  99 + <td>当日调整</td>
  100 + <td>&nbsp;</td>
  101 + <td>历史调整</td>
  102 + <td colspan="2">&nbsp;</td>
  103 + </tr>
  104 + </table>
  105 + </div>
  106 + </div>
  107 + </div>
  108 + </div>
  109 +</div>
  110 +
  111 +<script>
  112 + $(function(){
  113 + // 关闭左侧栏
  114 + if (!$('body').hasClass('page-sidebar-closed'))
  115 + $('.menu-toggler.sidebar-toggler').click();
  116 +
  117 + $("#startDate,#endDate").datetimepicker({
  118 + format : 'YYYY-MM-DD',
  119 + locale : 'zh-cn'
  120 + });
  121 +
  122 + var guideboards = new Array();
  123 + // 取得所有路牌
  124 + $get('/gic', null, function(allGuideboard) {
  125 + // 遍历数组
  126 + $.each(allGuideboard, function(i, e) {
  127 + var guideboard = '{"hex":"'+e.lpType+'","label":"'+e.lpName+'"}';
  128 + var obj = jQuery.parseJSON(guideboard);
  129 + guideboards[i]= obj;
  130 + });
  131 +
  132 + });
  133 + // 给输入框绑定autocomplete事件
  134 + $("#lpName").autocompleter({
  135 + highlightMatches: true,
  136 + source: guideboards,
  137 + template: '{{ label }}',
  138 + hint: true,
  139 + empty: false,
  140 + limit: 5,
  141 + });
  142 +
  143 + var cars = new Array();
  144 + // 取得所有车辆
  145 + $get('/cars/all', null, function(allCar) {
  146 + // 遍历数组
  147 + $.each(allCar, function(i, e) {
  148 + var car = '{"hex":"'+e.company+'","label":"'+e.insideCode+'"}';
  149 + var obj = jQuery.parseJSON(car);
  150 + cars[i]= obj;
  151 + });
  152 +
  153 + });
  154 + // 给输入框绑定autocomplete事件
  155 + $("#code").autocompleter({
  156 + highlightMatches: true,
  157 + source: cars,
  158 + template: '{{ label }}',
  159 + hint: true,
  160 + empty: false,
  161 + limit: 5,
  162 + });
  163 +
  164 + });
  165 +</script>
  166 +<script type="text/html" id="list_forms">
  167 + {{each list as obj i}}
  168 + <tr>
  169 +
  170 + </tr>
  171 + {{/each}}
  172 + {{if list.length == 0}}
  173 + <tr>
  174 + <td colspan="6"><h6 class="muted">没有找到相关数据</h6></td>
  175 + </tr>
  176 + {{/if}}
  177 +</script>
0 178 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/statement/css/autocompleter.css 0 → 100644
  1 +/**
  2 + * Simplecomplete
  3 + */
  4 +
  5 +.autocompleter {
  6 + width: 20%;
  7 + background: #ffffff;
  8 + position: relative;
  9 + z-index: 100;
  10 +}
  11 +
  12 +.autocompleter,
  13 +.autocompleter-hint {
  14 + position: absolute;
  15 +}
  16 +
  17 +.autocompleter-list {
  18 + box-shadow: inset 0px 0px 6px rgba(0,0,0,0.1);
  19 + list-style: none;
  20 + margin: 0;
  21 + padding: 0;
  22 + text-align: left;
  23 +}
  24 +
  25 +.autocompleter-item-selected {
  26 + background: #ffffff;
  27 +}
  28 +
  29 +.autocompleter-item {
  30 + padding: 6px 12px;
  31 + color: #444444;
  32 + font-size: 14px;
  33 + cursor: pointer;
  34 +}
  35 +
  36 +.autocompleter-item:hover {
  37 + background: #ddd;
  38 +}
  39 +
  40 +.autocompleter-item strong {
  41 + background: #f9de8f;
  42 + text-shadow: 0 1px 0 #ffffff;
  43 +}
  44 +
  45 +.autocompleter-item span {
  46 + color: #bbbbbb;
  47 +}
  48 +
  49 +.autocompleter-hint {
  50 + color: #ccc;
  51 + text-align: left;
  52 + top: -56px;
  53 + font-weight: 400;
  54 + left: 0;
  55 + width: 100%;
  56 + padding: 12px 12px 12px 13px;
  57 + font-size: 24px;
  58 + display: none;
  59 +}
  60 +
  61 +.autocompleter-hint span {
  62 + color: transparent;
  63 +}
  64 +
  65 +
  66 +.autocompleter-closed {
  67 + display: none;
  68 +}
... ...
src/main/resources/static/pages/forms/statement/daily.html 0 → 100644
  1 +<link href="/pages/forms/statement/css/autocompleter.css" rel="stylesheet" type="text/css" />
  2 +<style type="text/css">
  3 + .table-bordered {
  4 + border: 1px solid; }
  5 + .table-bordered > thead > tr > th,
  6 + .table-bordered > thead > tr > td,
  7 + .table-bordered > tbody > tr > th,
  8 + .table-bordered > tbody > tr > td,
  9 + .table-bordered > tfoot > tr > th,
  10 + .table-bordered > tfoot > tr > td {
  11 + border: 1px solid; }
  12 + .table-bordered > thead > tr > th,
  13 + .table-bordered > thead > tr > td {
  14 + border-bottom-width: 2px; }
  15 +
  16 + .table > tbody + tbody {
  17 + border-top: 1px solid; }
  18 +</style>
  19 +
  20 +<div class="page-head">
  21 + <div class="page-title">
  22 + <h1>调度日报表</h1>
  23 + </div>
  24 +</div>
  25 +
  26 +<div class="row">
  27 + <div class="col-md-12">
  28 + <div class="portlet light porttlet-fit bordered">
  29 + <div class="portlet-title">
  30 + <form class="form-inline" action="">
  31 + <div class="form-group">
  32 + <label for="line">线路名称:</label>
  33 + <input id="line" type="text" name="xlName_eq"/>
  34 + </div>
  35 + <div class="form-group">
  36 + <label for="date">时间:</label>
  37 + <input type="text" id="date" name="scheduleDate_eq"/>
  38 + </div>
  39 + <div class="form-group">
  40 + <input class="btn btn-default" type="button" id="query" value="查询"/>
  41 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  42 + </div>
  43 + </form>
  44 + </div>
  45 + <div class="portlet-body">
  46 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  47 + <table class="table table-bordered table-hover table-checkable" id="forms">
  48 + <thead>
  49 + <tr>
  50 + <th colspan="7">调度班次日报</th>
  51 + </tr>
  52 + <tr>
  53 + <td>路线:</td>
  54 + <td colspan="2">&nbsp;</td>
  55 + <td>时间:</td>
  56 + <td colspan="3">&nbsp;</td>
  57 + </tr>
  58 + <tr>
  59 + <td>车辆</td>
  60 + <td>工号</td>
  61 + <td>姓名</td>
  62 + <td>总公里</td>
  63 + <td>空驶公里</td>
  64 + <td>油耗</td>
  65 + <td>班次</td>
  66 + </tr>
  67 + </thead>
  68 + <tbody class="dailyInfo">
  69 +
  70 + </tbody>
  71 + <tr>
  72 + <td colspan="3">小计</td>
  73 + <td>&nbsp;</td>
  74 + <td>&nbsp;</td>
  75 + <td>&nbsp;</td>
  76 + <td>&nbsp;</td>
  77 + </tr>
  78 + </table>
  79 + </div>
  80 + </div>
  81 + </div>
  82 + </div>
  83 +</div>
  84 +
  85 +<script>
  86 + $(function(){
  87 + // 关闭左侧栏
  88 + if (!$('body').hasClass('page-sidebar-closed'))
  89 + $('.menu-toggler.sidebar-toggler').click();
  90 +
  91 + $("#date").datetimepicker({
  92 + format : 'YYYY-MM-DD',
  93 + locale : 'zh-cn'
  94 + });
  95 +
  96 + var lines = new Array();
  97 + // 取得所有线路
  98 + $get('/line/all', null, function(allLine) {
  99 + // 遍历数组
  100 + $.each(allLine, function(i, e) {
  101 + var line = '{"hex":"'+e.company+'","label":"'+e.name+'"}';
  102 + var obj = jQuery.parseJSON(line);
  103 + lines[i]= obj;
  104 + });
  105 +
  106 + });
  107 + // 给输入框绑定autocomplete事件
  108 + $("#line").autocompleter({
  109 + highlightMatches: true,
  110 + source: lines,
  111 + template: '{{ label }}',
  112 + hint: true,
  113 + empty: false,
  114 + limit: 5,
  115 + });
  116 +
  117 + $("#query").on("click",function(){
  118 + var line = $("#line").val();
  119 + var date = $("#date").val();
  120 + $get('/realSchedule/dailyInfo',{line:line,date:date},function(result){
  121 + debugger
  122 + // 把数据填充到模版中
  123 + var tbodyHtml = template('dailyInfo',{list:result});
  124 + // 把渲染好的模版html文本追加到表格中
  125 + $('#forms .dailyInfo').html(tbodyHtml);
  126 + });
  127 + });
  128 + });
  129 +</script>
  130 +<script type="text/html" id="dailyInfo">
  131 + {{each list as obj i}}
  132 + <tr>
  133 + <td>{{obj[0]}}</td>
  134 + <td>{{obj[1]}}</td>
  135 + <td>{{obj[2]}}</td>
  136 + <td>{{obj[3]}}</td>
  137 + <td>&nbsp;</td>
  138 + <td>&nbsp;</td>
  139 + <td>&nbsp;</td>
  140 + </tr>
  141 + {{/each}}
  142 + {{if list.length == 0}}
  143 + <tr>
  144 + <td colspan="7"><h6 class="muted">没有找到相关数据</h6></td>
  145 + </tr>
  146 + {{/if}}
  147 +</script>
0 148 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/statement/historyMessage.html 0 → 100644
  1 +<link href="/pages/forms/statement/css/autocompleter.css" rel="stylesheet" type="text/css" />
  2 +<style type="text/css">
  3 + .table-bordered {
  4 + border: 1px solid; }
  5 + .table-bordered > thead > tr > th,
  6 + .table-bordered > thead > tr > td,
  7 + .table-bordered > tbody > tr > th,
  8 + .table-bordered > tbody > tr > td,
  9 + .table-bordered > tfoot > tr > th,
  10 + .table-bordered > tfoot > tr > td {
  11 + border: 1px solid; }
  12 + .table-bordered > thead > tr > th,
  13 + .table-bordered > thead > tr > td {
  14 + border-bottom-width: 2px; }
  15 +
  16 + .table > tbody + tbody {
  17 + border-top: 1px solid; }
  18 +</style>
  19 +
  20 +<div class="page-head">
  21 + <div class="page-title">
  22 + <h1>调度历史消息</h1>
  23 + </div>
  24 +</div>
  25 +
  26 +<div class="row">
  27 + <div class="col-md-12">
  28 + <div class="portlet light porttlet-fit bordered">
  29 + <div class="portlet-title">
  30 + <form id="history" class="form-inline" action="">
  31 + <div class="form-group">
  32 + <label for="line">线路:</label>
  33 + <input id="line" type="text" name="xlName_eq"/>
  34 + </div>
  35 + <div class="form-group">
  36 + <label for="date">时间:</label>
  37 + <input type="text" id="date" name="scheduleDate_eq"/>
  38 + </div>
  39 + <div class="form-group">
  40 + <label for="code">内部编码:</label>
  41 + <input type="text" id="code" name="clZbh_like"/>
  42 + </div>
  43 + <div class="form-group">
  44 + <input class="btn btn-default" type="button" id="query" value="筛选"/>
  45 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  46 + </div>
  47 + </form>
  48 + </div>
  49 + <div class="portlet-body">
  50 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  51 + <table class="table table-bordered table-hover table-checkable" id="forms">
  52 + <thead>
  53 + <tr class="hidden">
  54 + <th>序号</th>
  55 + <th>线路</th>
  56 + <th>路牌</th>
  57 + <th>运营车辆</th>
  58 + <th>发送人</th>
  59 + <th>发送时间</th>
  60 + <th>调度消息内容</th>
  61 + </tr>
  62 + </thead>
  63 + <tbody>
  64 +
  65 + </tbody>
  66 + </table>
  67 + </div>
  68 + </div>
  69 + </div>
  70 + </div>
  71 +</div>
  72 +
  73 +<script>
  74 + $(function(){
  75 + // 关闭左侧栏
  76 + if (!$('body').hasClass('page-sidebar-closed'))
  77 + $('.menu-toggler.sidebar-toggler').click();
  78 +
  79 + $("#date").datetimepicker({
  80 + format : 'YYYY-MM-DD',
  81 + locale : 'zh-cn'
  82 + });
  83 +
  84 + var lines = new Array();
  85 + // 取得所有线路
  86 + $get('/line/all', null, function(allLine) {
  87 + // 遍历数组
  88 + $.each(allLine, function(i, e) {
  89 + var line = '{"hex":"'+e.company+'","label":"'+e.name+'"}';
  90 + var obj = jQuery.parseJSON(line);
  91 + lines[i]= obj;
  92 + });
  93 +
  94 + });
  95 + // 给输入框绑定autocomplete事件
  96 + $("#line").autocompleter({
  97 + highlightMatches: true,
  98 + source: lines,
  99 + template: '{{ label }}',
  100 + hint: true,
  101 + empty: false,
  102 + limit: 5,
  103 + });
  104 +
  105 + var cars = new Array();
  106 + // 取得所有车
  107 + $get('/cars/all', null, function(allCar) {
  108 + debugger
  109 + // 遍历数组
  110 + $.each(allCar, function(i, e) {
  111 + var car = '{"hex":"'+e.company+'","label":"'+e.insideCode+'"}';
  112 + var obj = jQuery.parseJSON(car);
  113 + cars[i]= obj;
  114 + });
  115 +
  116 + });
  117 + // 给输入框绑定autocomplete事件
  118 + $("#code").autocompleter({
  119 + highlightMatches: true,
  120 + source: cars,
  121 + template: '{{ label }}',
  122 + hint: true,
  123 + empty: false,
  124 + limit: 5,
  125 + });
  126 +
  127 + $("#query").on("click",function(){
  128 + /*
  129 + var params = {};
  130 + var name;
  131 + $("#history input[type=text]").each(function(i,e){
  132 + name = $(e).attr("name");
  133 + params[name] = $(e).val();
  134 + alert(params[name]);
  135 + });*/
  136 + var line = $("#line").val();
  137 + var date = $("#date").val();
  138 + var code = $("#code").val();
  139 + $(".hidden").removeClass("hidden");
  140 + $get('/realSchedule/historyMessage',{line:line,date:date,code:code},function(result){
  141 + // 把数据填充到模版中
  142 + var tbodyHtml = template('list_forms',{list:result});
  143 + // 把渲染好的模版html文本追加到表格中
  144 + $('#forms tbody').html(tbodyHtml);
  145 + });
  146 +
  147 + });
  148 +
  149 + });
  150 +</script>
  151 +<script type="text/html" id="list_forms">
  152 + {{each list as obj i}}
  153 + <tr>
  154 + <td>{{i+1}}</td>
  155 + <td>{{obj.xlName}}</td>
  156 + <td>{{obj.lpName}}</td>
  157 + <td>{{obj.clZbh}}</td>
  158 + <td>&nbsp;</td>
  159 + <td>&nbsp;</td>
  160 + <td>&nbsp;</td>
  161 + </tr>
  162 + {{/each}}
  163 + {{if list.length == 0}}
  164 + <tr>
  165 + <td colspan="7"><h6 class="muted">没有找到相关数据</h6></td>
  166 + </tr>
  167 + {{/if}}
  168 +</script>
0 169 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/statement/jobSummary.html 0 → 100644
  1 +<link href="/pages/forms/statement/css/autocompleter.css" rel="stylesheet" type="text/css" />
  2 +<style type="text/css">
  3 + .table-bordered {
  4 + border: 1px solid; }
  5 + .table-bordered > thead > tr > th,
  6 + .table-bordered > thead > tr > td,
  7 + .table-bordered > tbody > tr > th,
  8 + .table-bordered > tbody > tr > td,
  9 + .table-bordered > tfoot > tr > th,
  10 + .table-bordered > tfoot > tr > td {
  11 + border: 1px solid; }
  12 + .table-bordered > thead > tr > th,
  13 + .table-bordered > thead > tr > td {
  14 + border-bottom-width: 2px; }
  15 +
  16 + .table > tbody + tbody {
  17 + border-top: 1px solid; }
  18 +</style>
  19 +
  20 +<div class="page-head">
  21 + <div class="page-title">
  22 + <h1>统计日报</h1>
  23 + </div>
  24 +</div>
  25 +
  26 +<div class="row">
  27 + <div class="col-md-12">
  28 + <div class="portlet light porttlet-fit bordered">
  29 + <div class="portlet-title">
  30 + <form class="form-inline" action="">
  31 + <div class="form-group">
  32 + <label for="line">线路名称:</label>
  33 + <input id="line" type="text" name="xlName_eq"/>
  34 + </div>
  35 + <div class="form-group">
  36 + <label for="date">时间:</label>
  37 + <input type="text" id="date" name="scheduleDate_eq"/>
  38 + </div>
  39 + <div class="form-group">
  40 + <input class="btn btn-default" type="button" id="query" value="查询"/>
  41 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  42 + </div>
  43 + </form>
  44 + </div>
  45 + <div class="portlet-body">
  46 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  47 + <table class="table table-bordered table-hover table-checkable" id="forms">
  48 + <thead>
  49 + <tr>
  50 + <th colspan="10">调度员工作汇总日报</th>
  51 + </tr>
  52 + <tr>
  53 + <td colspan="10">线路:85路&nbsp;&nbsp;&nbsp;&nbsp;日期:2016/5/26</td>
  54 + </tr>
  55 + <tr>
  56 + <td colspan="10">安全服务情况:</td>
  57 + </tr>
  58 + <tr>
  59 + <td colspan="2">少驶班次数</td>
  60 + <td colspan="2">&nbsp;</td>
  61 + <td colspan="2">少驶公里数</td>
  62 + <td colspan="4">&nbsp;</td>
  63 + </tr>
  64 + </thead>
  65 + <tbody>
  66 +
  67 + </tbody>
  68 + <tr>
  69 + <td>内容</td>
  70 + <td>路牌</td>
  71 + <td>车号</td>
  72 + <td>司售</td>
  73 + <td>地点</td>
  74 + <td>时间</td>
  75 + <td>故障分</td>
  76 + <td>烂班班次</td>
  77 + <td>烂班里程</td>
  78 + <td>简要情况</td>
  79 + </tr>
  80 + <tr>
  81 + <td>&nbsp;</td>
  82 + <td>小计</td>
  83 + <td colspan="2">少驶班次</td>
  84 + <td>&nbsp;</td>
  85 + <td colspan="4">少驶公里</td>
  86 + <td>&nbsp;</td>
  87 + </tr>
  88 + <tr><td colspan="10">&nbsp;</td></tr>
  89 + <tr>
  90 + <td colspan="10">服务临加增加情况</td>
  91 + </tr>
  92 + <tr>
  93 + <td colspan="2">临加班次书</td>
  94 + <td colspan="2">&nbsp;</td>
  95 + <td colspan="2">临加公里数</td>
  96 + <td colspan="4">&nbsp;</td>
  97 + </tr>
  98 + <tr>
  99 + <td>路牌</td>
  100 + <td>车号</td>
  101 + <td>司售</td>
  102 + <td>地点</td>
  103 + <td>时间</td>
  104 + <td colspan="5">简要情况</td>
  105 + </tr>
  106 + <tr><td colspan="10">&nbsp;</td></tr>
  107 + <tr>
  108 + <td colspan="10">当日汇总</td>
  109 + </tr>
  110 + <tr>
  111 + <td colspan="2">内容</td>
  112 + <td>计划</td>
  113 + <td>实际</td>
  114 + <td colspan="3">6:31~8:30</td>
  115 + <td colspan="3">16:01~18:00</td>
  116 + </tr>
  117 + <tr>
  118 + <td colspan="2">班次</td>
  119 + <td>&nbsp;</td>
  120 + <td>&nbsp;</td>
  121 + <td colspan="3">&nbsp;</td>
  122 + <td colspan="3">&nbsp;</td>
  123 + </tr>
  124 + <tr>
  125 + <td colspan="2">公里</td>
  126 + <td>&nbsp;</td>
  127 + <td>&nbsp;</td>
  128 + <td colspan="3">&nbsp;</td>
  129 + <td colspan="3">&nbsp;</td>
  130 + </tr>
  131 + <tr>
  132 + <td colspan="2">临加</td>
  133 + <td>&nbsp;</td>
  134 + <td>&nbsp;</td>
  135 + <td colspan="3">&nbsp;</td>
  136 + <td colspan="3">&nbsp;</td>
  137 + </tr>
  138 + <tr>
  139 + <td colspan="2">上行快误点</td>
  140 + <td>&nbsp;</td>
  141 + <td>&nbsp;</td>
  142 + <td colspan="3">&nbsp;</td>
  143 + <td colspan="3">&nbsp;</td>
  144 + </tr>
  145 + <tr>
  146 + <td colspan="2">上行慢误点</td>
  147 + <td>&nbsp;</td>
  148 + <td>&nbsp;</td>
  149 + <td colspan="3">&nbsp;</td>
  150 + <td colspan="3">&nbsp;</td>
  151 + </tr>
  152 + <tr>
  153 + <td colspan="2">下行快误点</td>
  154 + <td>&nbsp;</td>
  155 + <td>&nbsp;</td>
  156 + <td colspan="3">&nbsp;</td>
  157 + <td colspan="3">&nbsp;</td>
  158 + </tr>
  159 + <tr>
  160 + <td colspan="2">下行慢误点</td>
  161 + <td>&nbsp;</td>
  162 + <td>&nbsp;</td>
  163 + <td colspan="3">&nbsp;</td>
  164 + <td colspan="3">&nbsp;</td>
  165 + </tr>
  166 + <tr>
  167 + <td colspan="2">放班班次</td>
  168 + <td>&nbsp;</td>
  169 + <td>&nbsp;</td>
  170 + <td colspan="3">&nbsp;</td>
  171 + <td colspan="3">&nbsp;</td>
  172 + </tr>
  173 + <tr>
  174 + <td colspan="2">调头班次</td>
  175 + <td>&nbsp;</td>
  176 + <td>&nbsp;</td>
  177 + <td colspan="3">&nbsp;</td>
  178 + <td colspan="3">&nbsp;</td>
  179 + </tr>
  180 + </table>
  181 + </div>
  182 + </div>
  183 + </div>
  184 + </div>
  185 +</div>
  186 +
  187 +<script>
  188 + $(function(){
  189 + // 关闭左侧栏
  190 + if (!$('body').hasClass('page-sidebar-closed'))
  191 + $('.menu-toggler.sidebar-toggler').click();
  192 +
  193 + $("#date").datetimepicker({
  194 + format : 'YYYY-MM-DD',
  195 + locale : 'zh-cn'
  196 + });
  197 +
  198 + var lines = new Array();
  199 + // 取得所有线路
  200 + $get('/line/all', null, function(allLine) {
  201 + // 遍历数组
  202 + $.each(allLine, function(i, e) {
  203 + var line = '{"hex":"'+e.company+'","label":"'+e.name+'"}';
  204 + var obj = jQuery.parseJSON(line);
  205 + lines[i]= obj;
  206 + });
  207 +
  208 + });
  209 + // 给输入框绑定autocomplete事件
  210 + $("#line").autocompleter({
  211 + highlightMatches: true,
  212 + source: lines,
  213 + template: '{{ label }}',
  214 + hint: true,
  215 + empty: false,
  216 + limit: 5,
  217 + });
  218 + });
  219 +</script>
  220 +<script type="text/html" id="list_forms">
  221 + {{each list as obj i}}
  222 + <tr>
  223 +
  224 + </tr>
  225 + {{/each}}
  226 + {{if list.length == 0}}
  227 + <tr>
  228 + <td colspan="6"><h6 class="muted">没有找到相关数据</h6></td>
  229 + </tr>
  230 + {{/if}}
  231 +</script>
0 232 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/statement/js/jquery.PrintArea.js 0 → 100644
  1 +/**
  2 + * Version 2.4.0 Copyright (C) 2013
  3 + * Tested in IE 11, FF 28.0 and Chrome 33.0.1750.154
  4 + * No official support for other browsers, but will TRY to accommodate challenges in other browsers.
  5 + * Example:
  6 + * Print Button: <div id="print_button">Print</div>
  7 + * Print Area : <div class="PrintArea" id="MyId" class="MyClass"> ... html ... </div>
  8 + * Javascript : <script>
  9 + * $("div#print_button").click(function(){
  10 + * $("div.PrintArea").printArea( [OPTIONS] );
  11 + * });
  12 + * </script>
  13 + * options are passed as json (example: {mode: "popup", popClose: false})
  14 + *
  15 + * {OPTIONS} | [type] | (default), values | Explanation
  16 + * --------- | --------- | ---------------------- | -----------
  17 + * @mode | [string] | (iframe),popup | printable window is either iframe or browser popup
  18 + * @popHt | [number] | (500) | popup window height
  19 + * @popWd | [number] | (400) | popup window width
  20 + * @popX | [number] | (500) | popup window screen X position
  21 + * @popY | [number] | (500) | popup window screen Y position
  22 + * @popTitle | [string] | ('') | popup window title element
  23 + * @popClose | [boolean] | (false),true | popup window close after printing
  24 + * @extraCss | [string] | ('') | comma separated list of extra css to include
  25 + * @retainAttr | [string[]] | ["id","class","style"] | string array of attributes to retain for the containment area. (ie: id, style, class)
  26 + * @standard | [string] | strict, loose, (html5) | Only for popup. For html 4.01, strict or loose document standard, or html 5 standard
  27 + * @extraHead | [string] | ('') | comma separated list of extra elements to be appended to the head tag
  28 + */
  29 +(function($) {
  30 + var counter = 0;
  31 + var modes = { iframe : "iframe", popup : "popup" };
  32 + var standards = { strict : "strict", loose : "loose", html5 : "html5" };
  33 + var defaults = { mode : modes.iframe,
  34 + standard : standards.html5,
  35 + popHt : 500,
  36 + popWd : 400,
  37 + popX : 200,
  38 + popY : 200,
  39 + popTitle : '',
  40 + popClose : false,
  41 + extraCss : '',
  42 + extraHead : '',
  43 + retainAttr : ["id","class","style"] };
  44 +
  45 + var settings = {};//global settings
  46 +
  47 + $.fn.printArea = function( options )
  48 + {
  49 + $.extend( settings, defaults, options );
  50 +
  51 + counter++;
  52 + var idPrefix = "printArea_";
  53 + $( "[id^=" + idPrefix + "]" ).remove();
  54 +
  55 + settings.id = idPrefix + counter;
  56 +
  57 + var $printSource = $(this);
  58 +
  59 + var PrintAreaWindow = PrintArea.getPrintWindow();
  60 +
  61 + PrintArea.write( PrintAreaWindow.doc, $printSource );
  62 +
  63 + setTimeout( function () { PrintArea.print( PrintAreaWindow ); }, 1000 );
  64 + };
  65 +
  66 + var PrintArea = {
  67 + print : function( PAWindow ) {
  68 + var paWindow = PAWindow.win;
  69 +
  70 + $(PAWindow.doc).ready(function(){
  71 + paWindow.focus();
  72 + paWindow.print();
  73 +
  74 + if ( settings.mode == modes.popup && settings.popClose )
  75 + setTimeout(function() { paWindow.close(); }, 2000);
  76 + });
  77 + },
  78 + write : function ( PADocument, $ele ) {
  79 + PADocument.open();
  80 + PADocument.write( PrintArea.docType() + "<html>" + PrintArea.getHead() + PrintArea.getBody( $ele ) + "</html>" );
  81 + PADocument.close();
  82 + },
  83 + docType : function() {
  84 + if ( settings.mode == modes.iframe ) return "";
  85 +
  86 + if ( settings.standard == standards.html5 ) return "<!DOCTYPE html>";
  87 +
  88 + var transitional = settings.standard == standards.loose ? " Transitional" : "";
  89 + var dtd = settings.standard == standards.loose ? "loose" : "strict";
  90 +
  91 + return '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01' + transitional + '//EN" "http://www.w3.org/TR/html4/' + dtd + '.dtd">';
  92 + },
  93 + getHead : function() {
  94 + var extraHead = "";
  95 + var links = "";
  96 +
  97 + if ( settings.extraHead ) settings.extraHead.replace( /([^,]+)/g, function(m){ extraHead += m });
  98 +
  99 + $(document).find("link")
  100 + .filter(function(){ // Requirement: <link> element MUST have rel="stylesheet" to be considered in print document
  101 + var relAttr = $(this).attr("rel");
  102 + return ($.type(relAttr) === 'undefined') == false && relAttr.toLowerCase() == 'stylesheet';
  103 + })
  104 + .filter(function(){ // Include if media is undefined, empty, print or all
  105 + var mediaAttr = $(this).attr("media");
  106 + return $.type(mediaAttr) === 'undefined' || mediaAttr == "" || mediaAttr.toLowerCase() == 'print' || mediaAttr.toLowerCase() == 'all'
  107 + })
  108 + .each(function(){
  109 + links += '<link type="text/css" rel="stylesheet" href="' + $(this).attr("href") + '" >';
  110 + });
  111 + if ( settings.extraCss ) settings.extraCss.replace( /([^,\s]+)/g, function(m){ links += '<link type="text/css" rel="stylesheet" href="' + m + '">' });
  112 +
  113 + return "<head><title>" + settings.popTitle + "</title>" + extraHead + links + "</head>";
  114 + },
  115 + getBody : function ( elements ) {
  116 + var htm = "";
  117 + var attrs = settings.retainAttr;
  118 + elements.each(function() {
  119 + var ele = PrintArea.getFormData( $(this) );
  120 +
  121 + var attributes = ""
  122 + for ( var x = 0; x < attrs.length; x++ )
  123 + {
  124 + var eleAttr = $(ele).attr( attrs[x] );
  125 + if ( eleAttr ) attributes += (attributes.length > 0 ? " ":"") + attrs[x] + "='" + eleAttr + "'";
  126 + }
  127 +
  128 + htm += '<div ' + attributes + '>' + $(ele).html() + '</div>';
  129 + });
  130 +
  131 + return "<body>" + htm + "</body>";
  132 + },
  133 + getFormData : function ( ele ) {
  134 + var copy = ele.clone();
  135 + var copiedInputs = $("input,select,textarea", copy);
  136 + $("input,select,textarea", ele).each(function( i ){
  137 + var typeInput = $(this).attr("type");
  138 + if ($.type(typeInput) === 'undefined') typeInput = $(this).is("select") ? "select" : $(this).is("textarea") ? "textarea" : "";
  139 + var copiedInput = copiedInputs.eq( i );
  140 +
  141 + if ( typeInput == "radio" || typeInput == "checkbox" ) copiedInput.attr( "checked", $(this).is(":checked") );
  142 + else if ( typeInput == "text" ) copiedInput.attr( "value", $(this).val() );
  143 + else if ( typeInput == "select" )
  144 + $(this).find( "option" ).each( function( i ) {
  145 + if ( $(this).is(":selected") ) $("option", copiedInput).eq( i ).attr( "selected", true );
  146 + });
  147 + else if ( typeInput == "textarea" ) copiedInput.text( $(this).val() );
  148 + });
  149 + return copy;
  150 + },
  151 + getPrintWindow : function () {
  152 + switch ( settings.mode )
  153 + {
  154 + case modes.iframe :
  155 + var f = new PrintArea.Iframe();
  156 + return { win : f.contentWindow || f, doc : f.doc };
  157 + case modes.popup :
  158 + var p = new PrintArea.Popup();
  159 + return { win : p, doc : p.doc };
  160 + }
  161 + },
  162 + Iframe : function () {
  163 + var frameId = settings.id;
  164 + var iframeStyle = 'border:0;position:absolute;width:0px;height:0px;right:0px;top:0px;';
  165 + var iframe;
  166 +
  167 + try
  168 + {
  169 + iframe = document.createElement('iframe');
  170 + document.body.appendChild(iframe);
  171 + $(iframe).attr({ style: iframeStyle, id: frameId, src: "#" + new Date().getTime() });
  172 + iframe.doc = null;
  173 + iframe.doc = iframe.contentDocument ? iframe.contentDocument : ( iframe.contentWindow ? iframe.contentWindow.document : iframe.document);
  174 + }
  175 + catch( e ) { throw e + ". iframes may not be supported in this browser."; }
  176 +
  177 + if ( iframe.doc == null ) throw "Cannot find document.";
  178 +
  179 + return iframe;
  180 + },
  181 + Popup : function () {
  182 + var windowAttr = "location=yes,statusbar=no,directories=no,menubar=no,titlebar=no,toolbar=no,dependent=no";
  183 + windowAttr += ",width=" + settings.popWd + ",height=" + settings.popHt;
  184 + windowAttr += ",resizable=yes,screenX=" + settings.popX + ",screenY=" + settings.popY + ",personalbar=no,scrollbars=yes";
  185 +
  186 + var newWin = window.open( "", "_blank", windowAttr );
  187 +
  188 + newWin.doc = newWin.document;
  189 +
  190 + return newWin;
  191 + }
  192 + };
  193 +})(jQuery);
0 194 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/statement/js/jquery.autocompleter.js 0 → 100644
  1 +/*
  2 + * Autocompleter v0.1.2 - 2014-05-20
  3 + * Simple, easy, customisable and with cache support.
  4 + * http://github.com/ArtemFitiskin/jquery-autocompleter
  5 + *
  6 + * Copyright 2014 Artem Fitiskin; MIT Licensed
  7 + */
  8 +
  9 +;(function ($, window) {
  10 + "use strict";
  11 +
  12 + var guid = 0,
  13 + ignoredKeyCode = [9, 13, 17, 19, 20, 27, 33, 34, 35, 36, 37, 39, 44, 92, 113, 114, 115, 118, 119, 120, 122, 123, 144, 145],
  14 + allowOptions = ['source', 'empty', 'limit', 'cache', 'focusOpen', 'selectFirst', 'changeWhenSelect', 'highlightMatches', 'ignoredKeyCode', 'customLabel', 'customValue', 'template', 'combine', 'callback'],
  15 + userAgent = (window.navigator.userAgent||window.navigator.vendor||window.opera),
  16 + isFirefox = /Firefox/i.test(userAgent),
  17 + isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(userAgent),
  18 + isFirefoxMobile = (isFirefox && isMobile),
  19 + $body = null,
  20 + localStorageKey = 'autocompleterCache',
  21 + supportLocalStorage = (function () {
  22 + var supported = typeof window.localStorage !== 'undefined';
  23 + if (supported) {
  24 + try {
  25 + localStorage.setItem("autocompleter", "autocompleter");
  26 + localStorage.removeItem("autocompleter");
  27 + } catch (e) {
  28 + supported = false;
  29 + }
  30 + }
  31 + return supported;
  32 + })();
  33 +
  34 + /**
  35 + * @options
  36 + * @param source [(string|object)] <null> "URL to the server or a local object"
  37 + * @param empty [boolean] <true> "Launch if value is empty"
  38 + * @param limit [int] <10> "Number of results to be displayed"
  39 + * @param customClass [array] <[]> "Array with custom classes for autocompleter element"
  40 + * @param cache [boolean] <true> "Save xhr data to localStorage to avoid the repetition of requests"
  41 + * @param focusOpen [boolean] <true> "Launch autocompleter when input gets focus"
  42 + * @param hint [boolean] <false> "Add hint to input with first matched label, correct styles should be installed"
  43 + * @param selectFirst [boolean] <false> "If set to true, first element in autocomplete list will be selected automatically, ignore if changeWhenSelect is on"
  44 + * @param changeWhenSelect [boolean] <true> "Allows to change input value using arrow keys navigation in autocomplete list"
  45 + * @param highlightMatches [boolean] <false> "This option defines <strong> tag wrap for matches in autocomplete results"
  46 + * @param ignoredKeyCode [array] <[]> "Array with ignorable keycodes"
  47 + * @param customLabel [boolean] <false> "The name of object's property which will be used as a label"
  48 + * @param customValue [boolean] <false> "The name of object's property which will be used as a value"
  49 + * @param template [(string|boolean)] <false> "Custom template for list items"
  50 + * @param combine [function] <$.noop> "Returns an object which extends ajax data. Useful if you want to pass some additional server options"
  51 + * @param callback [function] <$.noop> "Select value callback function. Arguments: value, index"
  52 + */
  53 + var options = {
  54 + source: null,
  55 + empty: true,
  56 + limit: 10,
  57 + customClass: [],
  58 + cache: true,
  59 + focusOpen: true,
  60 + hint: false,
  61 + selectFirst: false,
  62 + changeWhenSelect: true,
  63 + highlightMatches: false,
  64 + ignoredKeyCode: [],
  65 + customLabel: false,
  66 + customValue: false,
  67 + template: false,
  68 + combine: $.noop,
  69 + callback: $.noop
  70 + };
  71 +
  72 + var publics = {
  73 +
  74 + /**
  75 + * @method
  76 + * @name defaults
  77 + * @description Sets default plugin options
  78 + * @param opts [object] <{}> "Options object"
  79 + * @example $.autocompleter("defaults", opts);
  80 + */
  81 + defaults: function (opts) {
  82 + options = $.extend(options, opts || {});
  83 + return $(this);
  84 + },
  85 +
  86 + /**
  87 + * @method
  88 + * @name option
  89 + * @description Open autocompleter list
  90 + */
  91 + option: function (properties) {
  92 + return $(this).each(function(i, input) {
  93 + var data = $(input).next(".autocompleter").data("autocompleter");
  94 +
  95 + for (var property in properties) {
  96 + if ($.inArray(property, allowOptions) !== -1) {
  97 + data[property] = properties[property];
  98 + }
  99 + }
  100 + });
  101 + },
  102 +
  103 + /**
  104 + * @method
  105 + * @name open
  106 + * @description Open autocompleter list
  107 + */
  108 + open: function () {
  109 + return $(this).each(function(i, input) {
  110 + var data = $(input).next(".autocompleter").data("autocompleter");
  111 +
  112 + if (data) {
  113 + _open(null, data);
  114 + }
  115 + });
  116 + },
  117 +
  118 + /**
  119 + * @method
  120 + * @name close
  121 + * @description Close autocompleter list
  122 + */
  123 + close: function () {
  124 + return $(this).each(function(i, input) {
  125 + var data = $(input).next(".autocompleter").data("autocompleter");
  126 +
  127 + if (data) {
  128 + _close(null, data);
  129 + }
  130 + });
  131 + },
  132 +
  133 + /**
  134 + * @method
  135 + * @name clearCache
  136 + * @description Remove localStorage cache
  137 + */
  138 + clearCache: function () {
  139 + _deleteCache();
  140 + },
  141 +
  142 + /**
  143 + * @method
  144 + * @name destroy
  145 + * @description Removes instance of plugin
  146 + * @example $(".target").autocompleter("destroy");
  147 + */
  148 + destroy: function () {
  149 + return $(this).each(function (i, input) {
  150 + var data = $(input).next(".autocompleter").data("autocompleter");
  151 +
  152 + if (data) {
  153 + // Abort xhr
  154 + if (data.jqxhr) {
  155 + data.jqxhr.abort();
  156 + }
  157 +
  158 + // If has selected item & open - confirm it
  159 + if (data.$autocompleter.hasClass("open")) {
  160 + data.$autocompleter.find(".autocompleter-selected")
  161 + .trigger("click.autocompleter");
  162 + }
  163 +
  164 + // Restore original autocomplete attr
  165 + if(!data.originalAutocomplete) {
  166 + data.$node.removeAttr("autocomplete");
  167 + } else {
  168 + data.$node.attr("autocomplete", data.originalAutocomplete);
  169 + }
  170 +
  171 + // Remove autocompleter & unbind events
  172 + data.$node.off(".autocompleter")
  173 + .removeClass("autocompleter-node");
  174 + data.$autocompleter.off(".autocompleter")
  175 + .remove();
  176 + }
  177 + });
  178 + }
  179 + };
  180 +
  181 + /**
  182 + * @method private
  183 + * @name _init
  184 + * @description Initializes plugin
  185 + * @param opts [object] "Initialization options"
  186 + */
  187 + function _init(opts) {
  188 + // Local options
  189 + opts = $.extend({}, options, opts || {});
  190 +
  191 + // Check for Body
  192 + if ($body === null) {
  193 + $body = $("body");
  194 + }
  195 +
  196 + // Apply to each element
  197 + var $items = $(this);
  198 + for (var i = 0, count = $items.length; i < count; i++) {
  199 + _build($items.eq(i), opts);
  200 + }
  201 +
  202 + return $items;
  203 + }
  204 +
  205 + /**
  206 + * @method private
  207 + * @name _build
  208 + * @description Builds each instance
  209 + * @param $node [jQuery object] "Target jQuery object"
  210 + * @param opts [object] <{}> "Options object"
  211 + */
  212 + function _build($node, opts) {
  213 + if (!$node.hasClass("autocompleter-node")) {
  214 + // Extend options
  215 + opts = $.extend({}, opts, $node.data("autocompleter-options"));
  216 +
  217 + var html = '<div class="autocompleter '+opts.customClass.join(' ')+'" id="autocompleter-'+(guid+1)+'">';
  218 + if (opts.hint) {
  219 + html += '<div class="autocompleter-hint"></div>';
  220 + }
  221 + html += '<ul class="autocompleter-list"></ul>';
  222 + html += '</div>';
  223 +
  224 + $node.addClass("autocompleter-node")
  225 + .after(html);
  226 +
  227 + var $autocompleter = $node.next(".autocompleter").eq(0);
  228 +
  229 + // Set autocomplete to off for warn overlay
  230 + var originalAutocomplete = $node.attr("autocomplete");
  231 + $node.attr("autocomplete", "off");
  232 +
  233 + // Store plugin data
  234 + var data = $.extend({
  235 + $node: $node,
  236 + $autocompleter: $autocompleter,
  237 + $selected: null,
  238 + $list: null,
  239 + index: -1,
  240 + hintText: false,
  241 + source: false,
  242 + jqxhr: false,
  243 + response: null,
  244 + focused: false,
  245 + query: '',
  246 + originalAutocomplete: originalAutocomplete,
  247 + guid: guid++
  248 + }, opts);
  249 +
  250 + // Bind autocompleter events
  251 + data.$autocompleter.on("mousedown.autocompleter", ".autocompleter-item", data, _select)
  252 + .data("autocompleter", data);
  253 +
  254 + // Bind node events
  255 + data.$node.on("keyup.autocompleter", data, _onKeyup)
  256 + .on("keydown.autocompleter", data, _onKeydownHelper)
  257 + .on("focus.autocompleter", data, _onFocus)
  258 + .on("blur.autocompleter", data, _onBlur)
  259 + .on("mousedown.autocompleter", data, _onMousedown);
  260 + }
  261 + }
  262 +
  263 + /**
  264 + * @method private
  265 + * @name _search
  266 + * @description Local search function, return best collation
  267 + * @param query [string] "Query string"
  268 + * @param source [object] "Source data"
  269 + * @param limit [integer] "Results length"
  270 + */
  271 + function _search(query, source, limit) {
  272 + var response = [];
  273 + query = query.toUpperCase();
  274 +
  275 + if (source.length) {
  276 + for (var i = 0; i < 2; i++) {
  277 + for (var item in source) {
  278 + if (response.length < limit) {
  279 + switch (i) {
  280 + case 0:
  281 + if (source[item].label.toUpperCase().search(query) === 0) {
  282 + response.push(source[item]);
  283 + delete source[item];
  284 + }
  285 + break;
  286 +
  287 + case 1:
  288 + if (source[item].label.toUpperCase().search(query) !== -1) {
  289 + response.push(source[item]);
  290 + delete source[item];
  291 + }
  292 + break;
  293 + }
  294 + }
  295 + }
  296 + }
  297 + }
  298 +
  299 + return response;
  300 + }
  301 +
  302 + /**
  303 + * @method private
  304 + * @name _launch
  305 + * @description Use source locally or create xhr
  306 + * @param data [object] "Instance data"
  307 + */
  308 + function _launch(data) {
  309 + data.query = $.trim(data.$node.val());
  310 +
  311 + if (!data.empty && data.query.length === 0) {
  312 + _clear(data);
  313 + return;
  314 + } else {
  315 + if (typeof data.source === 'object') {
  316 + _clear(data);
  317 +
  318 + // Local search
  319 + var search = _search(data.query, _clone(data.source), data.limit);
  320 + if (search.length) {
  321 + _response(search, data);
  322 + }
  323 + } else {
  324 + if (data.jqxhr) {
  325 + data.jqxhr.abort();
  326 + }
  327 +
  328 + var ajaxData = $.extend({
  329 + limit: data.limit,
  330 + query: data.query
  331 + }, data.combine());
  332 +
  333 + data.jqxhr = $.ajax({
  334 + url: data.source,
  335 + dataType: "json",
  336 + data: ajaxData,
  337 + beforeSend: function (xhr) {
  338 + data.$autocompleter.addClass('autocompleter-ajax');
  339 + _clear(data);
  340 + if (data.cache) {
  341 + var stored = _getCache(this.url);
  342 + if (stored) {
  343 + xhr.abort();
  344 + _response(stored, data);
  345 + }
  346 + }
  347 + }
  348 + })
  349 + .done(function (response) {
  350 + if (data.cache) {
  351 + _setCache(this.url, response);
  352 + }
  353 + _response(response, data);
  354 + })
  355 + .always(function () {
  356 + data.$autocompleter.removeClass('autocompleter-ajax');
  357 + });
  358 + }
  359 + }
  360 + }
  361 +
  362 + /**
  363 + * @method private
  364 + * @name _clear
  365 + * @param data [object] "Instance data"
  366 + */
  367 + function _clear(data) {
  368 + // Clear data
  369 + data.response = null;
  370 + data.$list = null;
  371 + data.$selected = null;
  372 + data.index = 0;
  373 + data.$autocompleter.find(".autocompleter-list").empty();
  374 + data.$autocompleter.find('.autocompleter-hint').removeClass('autocompleter-hint-show').empty();
  375 + data.hintText = false;
  376 +
  377 + _close(null, data);
  378 + }
  379 +
  380 + /**
  381 + * @method private
  382 + * @name _response
  383 + * @description Main source response function
  384 + * @param response [object] "Source data"
  385 + * @param data [object] "Instance data"
  386 + */
  387 + function _response(response, data) {
  388 + _buildList(response, data);
  389 +
  390 + if (data.$autocompleter.hasClass('autocompleter-focus')) {
  391 + _open(null, data);
  392 + }
  393 + }
  394 +
  395 + /**
  396 + * @method private
  397 + * @name _buildList
  398 + * @description Generate autocompleter-list and update instance data by source
  399 + * @param list [object] "Source data"
  400 + * @param data [object] "Instance data"
  401 + */
  402 + function _buildList(list, data) {
  403 + var menu = '';
  404 +
  405 + for (var item = 0, count = list.length; item < count; item++) {
  406 + var classes = ["autocompleter-item"];
  407 +
  408 + if (data.selectFirst && item === 0 && !data.changeWhenSelect) {
  409 + classes.push("autocompleter-item-selected");
  410 + }
  411 +
  412 + var highlightReg = new RegExp(data.query, "gi");
  413 + var label = (data.customLabel && list[item][data.customLabel]) ? list[item][data.customLabel] : list[item].label;
  414 +
  415 + var clear = label;
  416 +
  417 + label = data.highlightMatches ? label.replace(highlightReg, "<strong>$&</strong>") : label;
  418 +
  419 + var value = (data.customValue && list[item][data.customValue]) ? list[item][data.customValue] : list[item].value;
  420 +
  421 + // Apply custom template
  422 + if (data.template) {
  423 + var template = data.template.replace(/({{ label }})/gi, label);
  424 +
  425 + for (var property in list[item]) {
  426 + if (list[item].hasOwnProperty(property)) {
  427 + var regex = new RegExp('{{ '+ property +' }}', 'gi');
  428 + template = template.replace(regex, list[item][property]);
  429 + }
  430 + }
  431 +
  432 + label = template;
  433 + }
  434 +
  435 + if (value) {
  436 + menu += '<li data-value="'+value+'" data-label="'+clear+'" class="'+classes.join(' ')+'">'+label+'</li>';
  437 + } else {
  438 + menu += '<li data-label="'+clear+'" class="'+classes.join(' ')+'">'+label+'</li>';
  439 + }
  440 + }
  441 +
  442 + // Set hint
  443 + if (list.length && data.hint) {
  444 + var hint = ( list[0].label.substr(0, data.query.length).toUpperCase() === data.query.toUpperCase() ) ? list[0].label : false;
  445 + if (hint && (data.query !== list[0].label)) {
  446 + var hintReg = new RegExp(data.query, "i");
  447 + var hintText = hint.replace(hintReg, "<span>"+data.query+"</span>");
  448 + data.$autocompleter.find('.autocompleter-hint').addClass('autocompleter-hint-show').html(hintText);
  449 + data.hintText = hintText;
  450 + }
  451 + }
  452 +
  453 + // Update data
  454 + data.response = list;
  455 + data.$autocompleter.find(".autocompleter-list").html(menu);
  456 + data.$selected = (data.$autocompleter.find(".autocompleter-item-selected").length) ? data.$autocompleter.find(".autocompleter-item-selected") : null;
  457 + data.$list = (list.length) ? data.$autocompleter.find(".autocompleter-item") : null;
  458 + data.index = data.$selected ? data.$list.index(data.$selected) : -1;
  459 + data.$autocompleter.find(".autocompleter-item").each(function (i, j) {
  460 + $(j).data(data.response[i]);
  461 + });
  462 + }
  463 +
  464 + /**
  465 + * @method private
  466 + * @name _onKeyup
  467 + * @description Keyup events in node, up/down autocompleter-list navigation, typing and enter button callbacks
  468 + * @param e [object] "Event data"
  469 + */
  470 + function _onKeyup(e) {
  471 + var data = e.data;
  472 + var code = e.keyCode ? e.keyCode : e.which;
  473 +
  474 + if ( (code === 40 || code === 38) && data.$autocompleter.hasClass('autocompleter-show') ) {
  475 + // Arrows up & down
  476 + var len = data.$list.length,
  477 + next,
  478 + prev;
  479 +
  480 + if (len) {
  481 + // Determine new index
  482 + if (len > 1) {
  483 + if (data.index === len - 1) {
  484 + next = data.changeWhenSelect ? -1 : 0;
  485 + prev = data.index - 1;
  486 + } else if (data.index === 0) {
  487 + next = data.index + 1;
  488 + prev = data.changeWhenSelect ? -1 : len - 1;
  489 + } else if (data.index === -1) {
  490 + next = 0;
  491 + prev = len - 1;
  492 + } else {
  493 + next = data.index + 1;
  494 + prev = data.index - 1;
  495 + }
  496 + } else if (data.index === -1) {
  497 + next = 0;
  498 + prev = 0;
  499 + } else {
  500 + prev = -1;
  501 + next = -1;
  502 + }
  503 + data.index = (code === 40) ? next : prev;
  504 +
  505 + // Update HTML
  506 + data.$list.removeClass("autocompleter-item-selected");
  507 + if (data.index !== -1) {
  508 + data.$list.eq(data.index).addClass("autocompleter-item-selected");
  509 + }
  510 + data.$selected = data.$autocompleter.find(".autocompleter-item-selected").length ? data.$autocompleter.find(".autocompleter-item-selected") : null;
  511 + if (data.changeWhenSelect) {
  512 + _setValue(data);
  513 + }
  514 + }
  515 + } else if ($.inArray(code, ignoredKeyCode) === -1 && $.inArray(code, data.ignoredKeyCode) === -1) {
  516 + // Typing
  517 + _launch(data);
  518 + }
  519 + }
  520 +
  521 + /**
  522 + * @method private
  523 + * @name _onKeydownHelper
  524 + * @description Keydown events in node, up/down for prevent cursor moving and right arrow for hint
  525 + * @param e [object] "Event data"
  526 + */
  527 + function _onKeydownHelper(e) {
  528 + var code = e.keyCode ? e.keyCode : e.which;
  529 + var data = e.data;
  530 +
  531 + if (code === 40 || code === 38 ) {
  532 + e.preventDefault();
  533 + e.stopPropagation();
  534 + } else if (code === 39) {
  535 + // Right arrow
  536 + if (data.hint && data.hintText && data.$autocompleter.find('.autocompleter-hint').hasClass('autocompleter-hint-show')) {
  537 + e.preventDefault();
  538 + e.stopPropagation();
  539 +
  540 + var hintOrigin = data.$autocompleter.find(".autocompleter-item").length ? data.$autocompleter.find(".autocompleter-item").eq(0).attr('data-label') : false;
  541 + if (hintOrigin) {
  542 + data.query = hintOrigin;
  543 + _setHint(data);
  544 + }
  545 + }
  546 + } else if (code === 13) {
  547 + // Enter
  548 + if (data.$autocompleter.hasClass('autocompleter-show') && data.$selected) {
  549 + _select(e);
  550 + }
  551 + }
  552 + }
  553 +
  554 + /**
  555 + * @method private
  556 + * @name _onFocus
  557 + * @description Handles instance focus
  558 + * @param e [object] "Event data"
  559 + * @param internal [boolean] "Called by plugin"
  560 + */
  561 + function _onFocus(e, internal) {
  562 + if (!internal) {
  563 + var data = e.data;
  564 +
  565 + data.$autocompleter.addClass("autocompleter-focus");
  566 +
  567 + if (!data.$node.prop("disabled") && !data.$autocompleter.hasClass('autocompleter-show')) {
  568 + if (data.focusOpen) {
  569 + _launch(data);
  570 + data.focused = true;
  571 + setTimeout(function () {
  572 + data.focused = false;
  573 + }, 500);
  574 + }
  575 + }
  576 + }
  577 + }
  578 +
  579 + /**
  580 + * @method private
  581 + * @name _onBlur
  582 + * @description Handles instance blur
  583 + * @param e [object] "Event data"
  584 + * @param internal [boolean] "Called by plugin"
  585 + */
  586 + function _onBlur(e, internal) {
  587 + e.preventDefault();
  588 + e.stopPropagation();
  589 +
  590 + var data = e.data;
  591 +
  592 + if (!internal) {
  593 + data.$autocompleter.removeClass("autocompleter-focus");
  594 + _close(e);
  595 + }
  596 + }
  597 +
  598 + /**
  599 + * @method private
  600 + * @name _onMousedown
  601 + * @description Handles mousedown to node
  602 + * @param e [object] "Event data"
  603 + */
  604 + function _onMousedown(e) {
  605 + // Disable middle & right mouse click
  606 + if (e.type === "mousedown" && $.inArray(e.which, [2, 3]) !== -1) { return; }
  607 +
  608 + var data = e.data;
  609 + if (data.$list && !data.focused) {
  610 + if (!data.$node.is(":disabled")) {
  611 + if (isMobile && !isFirefoxMobile) {
  612 + var el = data.$select[0];
  613 + if (window.document.createEvent) { // All
  614 + var evt = window.document.createEvent("MouseEvents");
  615 + evt.initMouseEvent("mousedown", false, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
  616 + el.dispatchEvent(evt);
  617 + } else if (el.fireEvent) { // IE
  618 + el.fireEvent("onmousedown");
  619 + }
  620 + } else {
  621 + // Delegate intent
  622 + if (data.$autocompleter.hasClass("autocompleter-closed")) {
  623 + _open(e);
  624 + } else if (data.$autocompleter.hasClass("autocompleter-show")) {
  625 + _close(e);
  626 + }
  627 + }
  628 + }
  629 + }
  630 + }
  631 +
  632 + /**
  633 + * @method private
  634 + * @name _open
  635 + * @description Opens option set
  636 + * @param e [object] "Event data"
  637 + * @param instanceData [object] "Instance data"
  638 + */
  639 + function _open(e, instanceData) {
  640 + var data = e ? e.data : instanceData;
  641 +
  642 + if (!data.$node.prop("disabled") && !data.$autocompleter.hasClass("autocompleter-show") && data.$list && data.$list.length ) {
  643 + data.$autocompleter.removeClass("autocompleter-closed").addClass("autocompleter-show");
  644 + $body.on("click.autocompleter-" + data.guid, ":not(.autocompleter-item)", data, _closeHelper);
  645 + }
  646 + }
  647 +
  648 + /**
  649 + * @method private
  650 + * @name _closeHelper
  651 + * @description Determines if event target is outside instance before closing
  652 + * @param e [object] "Event data"
  653 + */
  654 + function _closeHelper(e) {
  655 + if ( $(e.target).hasClass('autocompleter-node') ) {
  656 + return;
  657 + }
  658 +
  659 + if ($(e.currentTarget).parents(".autocompleter").length === 0) {
  660 + _close(e);
  661 + }
  662 + }
  663 +
  664 + /**
  665 + * @method private
  666 + * @name _close
  667 + * @description Closes option set
  668 + * @param e [object] "Event data"
  669 + * @param instanceData [object] "Instance data"
  670 + */
  671 + function _close(e, instanceData) {
  672 + var data = e ? e.data : instanceData;
  673 +
  674 + if (data.$autocompleter.hasClass("autocompleter-show")) {
  675 + data.$autocompleter.removeClass("autocompleter-show").addClass("autocompleter-closed");
  676 + $body.off(".autocompleter-" + data.guid);
  677 + }
  678 + }
  679 +
  680 + /**
  681 + * @method private
  682 + * @name _select
  683 + * @description Select item from .autocompleter-list
  684 + * @param e [object] "Event data"
  685 + */
  686 + function _select(e) {
  687 + // Disable middle & right mouse click
  688 + if (e.type === "mousedown" && $.inArray(e.which, [2, 3]) !== -1) { return; }
  689 +
  690 + var data = e.data;
  691 +
  692 + e.preventDefault();
  693 + e.stopPropagation();
  694 +
  695 + if (e.type === "mousedown" && $(this).length) {
  696 + data.$selected = $(this);
  697 + data.index = data.$list.index(data.$selected);
  698 + }
  699 +
  700 + if (!data.$node.prop("disabled")) {
  701 + _close(e);
  702 + _update(data);
  703 +
  704 + if (e.type === "click") {
  705 + data.$node.trigger("focus", [true]);
  706 + }
  707 + }
  708 + }
  709 +
  710 + /**
  711 + * @method private
  712 + * @name _setHint
  713 + * @description Set autocompleter by hint
  714 + * @param data [object] "Instance data"
  715 + */
  716 + function _setHint(data) {
  717 + _setValue(data);
  718 + _handleChange(data);
  719 + _launch(data);
  720 + }
  721 +
  722 + /**
  723 + * @method private
  724 + * @name _setValue
  725 + * @description Set value for native field
  726 + * @param data [object] "Instance data"
  727 + */
  728 + function _setValue(data) {
  729 + if (data.$selected) {
  730 + if (data.hintText && data.$autocompleter.find('.autocompleter-hint').hasClass('autocompleter-hint-show')) {
  731 + data.$autocompleter.find('.autocompleter-hint').removeClass('autocompleter-hint-show');
  732 + }
  733 + var value = data.$selected.attr('data-value') ? data.$selected.attr('data-value') : data.$selected.attr('data-label');
  734 + data.$node.val(value);
  735 + } else {
  736 + if (data.hintText && !data.$autocompleter.find('.autocompleter-hint').hasClass('autocompleter-hint-show')) {
  737 + data.$autocompleter.find('.autocompleter-hint').addClass('autocompleter-hint-show');
  738 + }
  739 + data.$node.val(data.query);
  740 + }
  741 + }
  742 +
  743 + /**
  744 + * @method private
  745 + * @name _update
  746 + * @param data [object] "Instance data"
  747 + */
  748 + function _update(data) {
  749 + _setValue(data);
  750 + _handleChange(data);
  751 + _clear(data);
  752 + }
  753 +
  754 + /**
  755 + * @method private
  756 + * @name _handleChange
  757 + * @description Trigger node change event and call the callback function
  758 + * @param data [object] "Instance data"
  759 + */
  760 + function _handleChange(data) {
  761 + data.callback.call(data.$autocompleter, data.$node.val(), data.index, data.response[data.index]);
  762 + data.$node.trigger("change");
  763 + }
  764 +
  765 + /**
  766 + * @method private
  767 + * @name _getCache
  768 + * @description Store AJAX response in plugin cache
  769 + * @param url [string] "AJAX get query string"
  770 + * @param data [object] "AJAX response data"
  771 + */
  772 + function _setCache(url, data) {
  773 + if (!supportLocalStorage) { return; }
  774 + if (url && data) {
  775 + cache[url] = {
  776 + value: data
  777 + };
  778 +
  779 + // Proccess to localStorage
  780 + try {
  781 + localStorage.setItem(localStorageKey, JSON.stringify(cache));
  782 + } catch (e) {
  783 + var code = e.code || e.number || e.message;
  784 + if (code === 22) {
  785 + _deleteCache();
  786 + } else {
  787 + throw(e);
  788 + }
  789 + }
  790 + }
  791 + }
  792 +
  793 + /**
  794 + * @method private
  795 + * @name _getCache
  796 + * @description Get cached data by url if exist
  797 + * @param url [string] "AJAX get query string"
  798 + */
  799 + function _getCache(url) {
  800 + if (!url) { return; }
  801 + var response = (cache[url] && cache[url].value) ? cache[url].value : false;
  802 + return response;
  803 + }
  804 +
  805 + /**
  806 + * @method private
  807 + * @name _loadCache
  808 + * @description Load all plugin cache from localStorage
  809 + */
  810 + function _loadCache() {
  811 + if (!supportLocalStorage) { return; }
  812 + var json = localStorage.getItem(localStorageKey) || '{}';
  813 + return JSON.parse(json);
  814 + }
  815 +
  816 + /**
  817 + * @method private
  818 + * @name _deleteCache
  819 + * @description Delete all plugin cache from localStorage
  820 + */
  821 + function _deleteCache() {
  822 + try {
  823 + localStorage.removeItem(localStorageKey);
  824 + cache = _loadCache();
  825 + } catch (e) {
  826 + throw(e);
  827 + }
  828 + }
  829 +
  830 + /**
  831 + * @method private
  832 + * @name _clone
  833 + * @description Clone JavaScript object
  834 + */
  835 + function _clone(obj) {
  836 + if (null === obj || "object" !== typeof obj) {
  837 + return obj;
  838 + }
  839 + var copy = obj.constructor();
  840 + for (var attr in obj) {
  841 + if (obj.hasOwnProperty(attr)) {
  842 + copy[attr] = obj[attr];
  843 + }
  844 + }
  845 + return copy;
  846 + }
  847 +
  848 + // Load cache
  849 + var cache = _loadCache();
  850 +
  851 + $.fn.autocompleter = function (method) {
  852 + if (publics[method]) {
  853 + return publics[method].apply(this, Array.prototype.slice.call(arguments, 1));
  854 + } else if (typeof method === 'object' || !method) {
  855 + return _init.apply(this, arguments);
  856 + }
  857 + return this;
  858 + };
  859 +
  860 + $.autocompleter = function (method) {
  861 + if (method === "defaults") {
  862 + publics.defaults.apply(this, Array.prototype.slice.call(arguments, 1));
  863 + } else if (method === "clearCache") {
  864 + publics.clearCache.apply(this, null);
  865 + }
  866 + };
  867 +})(jQuery, window);
... ...
src/main/resources/static/pages/forms/statement/scheduleDaily.html 0 → 100644
  1 +<link href="/pages/forms/statement/css/autocompleter.css" rel="stylesheet" type="text/css" />
  2 +<style type="text/css">
  3 + .table-bordered {
  4 + border: 1px solid; }
  5 + .table-bordered > thead > tr > th,
  6 + .table-bordered > thead > tr > td,
  7 + .table-bordered > tbody > tr > th,
  8 + .table-bordered > tbody > tr > td,
  9 + .table-bordered > tfoot > tr > th,
  10 + .table-bordered > tfoot > tr > td {
  11 + border: 1px solid; }
  12 + .table-bordered > thead > tr > th,
  13 + .table-bordered > thead > tr > td {
  14 + border-bottom-width: 2px; }
  15 +
  16 + .table > tbody + tbody {
  17 + border-top: 1px solid; }
  18 +</style>
  19 +
  20 +<div class="page-head">
  21 + <div class="page-title">
  22 + <h1>调度日报</h1>
  23 + </div>
  24 +</div>
  25 +
  26 +<div class="row">
  27 + <div class="col-md-12">
  28 + <div class="portlet light porttlet-fit bordered">
  29 + <div class="portlet-title">
  30 + <form class="form-inline" action="">
  31 + <div class="form-group">
  32 + <label for="line">线路名称:</label>
  33 + <input id="line" type="text" name="xlName_eq"/>
  34 + </div>
  35 + <div class="form-group">
  36 + <label for="date">时间:</label>
  37 + <input type="text" id="date" name="scheduleDate_eq"/>
  38 + </div>
  39 + <div class="form-group">
  40 + <input class="btn btn-default" type="button" id="query" value="查询"/>
  41 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  42 + </div>
  43 + </form>
  44 + </div>
  45 + <div class="portlet-body">
  46 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  47 + <table class="table table-bordered table-hover table-checkable" id="forms">
  48 + <thead>
  49 + <tr>
  50 + <th colspan="40">线路调度日报</th>
  51 + </tr>
  52 + <tr>
  53 + <td rowspan="3">路线别</td>
  54 + <td colspan="15">全日营运里程(公里)</td>
  55 + <td colspan="15">全日营运班次</td>
  56 + <td colspan="9">大间隔情况</td>
  57 + </tr>
  58 + <tr>
  59 + <td rowspan="2">计划</td>
  60 + <td rowspan="2">实驶</td>
  61 + <td rowspan="2">少驶</td>
  62 + <td colspan="11">少驶原因(公里)</td>
  63 + <td rowspan="2">临加公里</td>
  64 + <td colspan="3">计划班次</td>
  65 + <td colspan="3">实际班次</td>
  66 + <td colspan="3">临加班次</td>
  67 + <td colspan="3">放站班次</td>
  68 + <td colspan="3">调头班次</td>
  69 + <td colspan="3">发生次数</td>
  70 + <td rowspan="2">最大间隔时间(秒)</td>
  71 + <td colspan="5" rowspan="2">原因</td>
  72 + </tr>
  73 + <tr>
  74 + <td>路阻</td>
  75 + <td>吊慢</td>
  76 + <td>故障</td>
  77 + <td>纠纷</td>
  78 + <td>肇事</td>
  79 + <td>缺人</td>
  80 + <td>缺车</td>
  81 + <td>客稀</td>
  82 + <td>气候</td>
  83 + <td>援外</td>
  84 + <td>其他</td>
  85 + <td>全日</td>
  86 + <td>6:31~8:30</td>
  87 + <td>16:01~18:00</td>
  88 + <td>全日</td>
  89 + <td>6:31~8:30</td>
  90 + <td>16:01~18:00</td>
  91 + <td>全日</td>
  92 + <td>6:31~8:30</td>
  93 + <td>16:01~18:00</td>
  94 + <td>全日</td>
  95 + <td>6:31~8:30</td>
  96 + <td>16:01~18:00</td>
  97 + <td>全日</td>
  98 + <td>6:31~8:30</td>
  99 + <td>16:01~18:00</td>
  100 + <td>全日</td>
  101 + <td>6:31~8:30</td>
  102 + <td>16:01~18:00</td>
  103 + </tr>
  104 + </thead>
  105 + <tr>
  106 + <td colspan="40">&nbsp;</td>
  107 + </tr>
  108 + <tr>
  109 + <td colspan="40">合计</td>
  110 + </tr>
  111 + <tr>
  112 + <td>售票</td>
  113 + <td colspan="2">1元</td>
  114 + <td colspan="2">2元</td>
  115 + <td colspan="2">3元</td>
  116 + <td colspan="2">4元</td>
  117 + <td colspan="2">5元</td>
  118 + <td colspan="2">6元</td>
  119 + <td colspan="2">7元</td>
  120 + <td colspan="2">8元</td>
  121 + <td colspan="2">9元</td>
  122 + <td colspan="2">10元</td>
  123 + <td colspan="2">&nbsp;</td>
  124 + <td colspan="2">合计张数</td>
  125 + <td colspan="2">&nbsp;</td>
  126 + <td colspan="2">预售票</td>
  127 + <td colspan="2">1元</td>
  128 + <td colspan="2">1.5元</td>
  129 + <td colspan="2">合计张数</td>
  130 + <td colspan="5">&nbsp;</td>
  131 + </tr>
  132 + <tr>
  133 + <td>张数</td>
  134 + <td colspan="2">&nbsp;</td>
  135 + <td colspan="2">&nbsp;</td>
  136 + <td colspan="2">&nbsp;</td>
  137 + <td colspan="2">&nbsp;</td>
  138 + <td colspan="2">&nbsp;</td>
  139 + <td colspan="2">&nbsp;</td>
  140 + <td colspan="2">&nbsp;</td>
  141 + <td colspan="2">&nbsp;</td>
  142 + <td colspan="2">&nbsp;</td>
  143 + <td colspan="2">&nbsp;</td>
  144 + <td colspan="2">&nbsp;</td>
  145 + <td colspan="2">合计金额</td>
  146 + <td colspan="2">&nbsp;</td>
  147 + <td colspan="2">张数</td>
  148 + <td colspan="2">&nbsp;</td>
  149 + <td colspan="2">&nbsp;</td>
  150 + <td colspan="2">合计金额</td>
  151 + <td colspan="5">&nbsp;</td>
  152 + </tr>
  153 + <tr>
  154 + <td colspan="40">&nbsp;</td>
  155 + </tr>
  156 + <tr>
  157 + <td colspan="2">班次</td>
  158 + <td colspan="2">车号</td>
  159 + <td>司早</td>
  160 + <td>售早</td>
  161 + <td>司晚</td>
  162 + <td>售晚</td>
  163 + <td colspan="2">班次</td>
  164 + <td colspan="2">车号</td>
  165 + <td>司早</td>
  166 + <td>售早</td>
  167 + <td>司晚</td>
  168 + <td>售晚</td>
  169 + <td colspan="2">班次</td>
  170 + <td colspan="2">车号</td>
  171 + <td>司早</td>
  172 + <td>售早</td>
  173 + <td>司晚</td>
  174 + <td>售晚</td>
  175 + <td colspan="2">班次</td>
  176 + <td colspan="2">车号</td>
  177 + <td>司早</td>
  178 + <td>售早</td>
  179 + <td>司晚</td>
  180 + <td>售晚</td>
  181 + <td colspan="2">班次</td>
  182 + <td colspan="2">车号</td>
  183 + <td>司早</td>
  184 + <td>售早</td>
  185 + <td>司晚</td>
  186 + <td>售晚</td>
  187 + </tr>
  188 + <tr>
  189 + <td colspan="40">&nbsp;</td>
  190 + </tr>
  191 + <tr>
  192 + <td rowspan="2">路牌</td>
  193 + <td colspan="2" rowspan="2">起点站</td>
  194 + <td colspan="4">到达时间</td>
  195 + <td colspan="4">发车时间</td>
  196 + <td colspan="2" rowspan="2">备注</td>
  197 + <td rowspan="2">路牌</td>
  198 + <td colspan="2" rowspan="2">起点站</td>
  199 + <td colspan="4">到达时间</td>
  200 + <td colspan="4">发车时间</td>
  201 + <td colspan="2" rowspan="2">备注</td>
  202 + <td rowspan="2">路牌</td>
  203 + <td colspan="2" rowspan="2">起点站</td>
  204 + <td colspan="4">到达时间</td>
  205 + <td colspan="4">发车时间</td>
  206 + <td colspan="2" rowspan="2">备注</td>
  207 + <td>&nbsp;</td>
  208 + </tr>
  209 + <tr>
  210 + <td>应到</td>
  211 + <td>实到</td>
  212 + <td>快</td>
  213 + <td>慢</td>
  214 + <td>应发</td>
  215 + <td>实发</td>
  216 + <td>快</td>
  217 + <td>慢</td>
  218 + <td>应到</td>
  219 + <td>实到</td>
  220 + <td>快</td>
  221 + <td>慢</td>
  222 + <td>应发</td>
  223 + <td>实发</td>
  224 + <td>快</td>
  225 + <td>慢</td>
  226 + <td>应到</td>
  227 + <td>实到</td>
  228 + <td>快</td>
  229 + <td>慢</td>
  230 + <td>应发</td>
  231 + <td>实发</td>
  232 + <td>快</td>
  233 + <td>慢</td>
  234 + <td>&nbsp;</td>
  235 + </tr>
  236 + <tbody>
  237 +
  238 + </tbody>
  239 + </table>
  240 + </div>
  241 + </div>
  242 + </div>
  243 + </div>
  244 +</div>
  245 +
  246 +<script>
  247 + $(function(){
  248 + // 关闭左侧栏
  249 + if (!$('body').hasClass('page-sidebar-closed'))
  250 + $('.menu-toggler.sidebar-toggler').click();
  251 +
  252 + $("#date").datetimepicker({
  253 + format : 'YYYY-MM-DD',
  254 + locale : 'zh-cn'
  255 + });
  256 +
  257 + var lines = new Array();
  258 + // 取得所有线路
  259 + $get('/line/all', null, function(allLine) {
  260 + // 遍历数组
  261 + $.each(allLine, function(i, e) {
  262 + var line = '{"hex":"'+e.company+'","label":"'+e.name+'"}';
  263 + var obj = jQuery.parseJSON(line);
  264 + lines[i]= obj;
  265 + });
  266 +
  267 + });
  268 + // 给输入框绑定autocomplete事件
  269 + $("#line").autocompleter({
  270 + highlightMatches: true,
  271 + source: lines,
  272 + template: '{{ label }}',
  273 + hint: true,
  274 + empty: false,
  275 + limit: 5,
  276 + });
  277 + });
  278 +</script>
  279 +<script type="text/html" id="list_forms">
  280 + {{each list as obj i}}
  281 + <tr>
  282 +
  283 + </tr>
  284 + {{/each}}
  285 + {{if list.length == 0}}
  286 + <tr>
  287 + <td colspan="6"><h6 class="muted">没有找到相关数据</h6></td>
  288 + </tr>
  289 + {{/if}}
  290 +</script>
0 291 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/statement/statisticsDaily .html 0 → 100644
  1 +<link href="/pages/forms/statement/css/autocompleter.css" rel="stylesheet" type="text/css" />
  2 +<style type="text/css">
  3 + .table-bordered {
  4 + border: 1px solid; }
  5 + .table-bordered > thead > tr > th,
  6 + .table-bordered > thead > tr > td,
  7 + .table-bordered > tbody > tr > th,
  8 + .table-bordered > tbody > tr > td,
  9 + .table-bordered > tfoot > tr > th,
  10 + .table-bordered > tfoot > tr > td {
  11 + border: 1px solid; }
  12 + .table-bordered > thead > tr > th,
  13 + .table-bordered > thead > tr > td {
  14 + border-bottom-width: 2px; }
  15 +
  16 + .table > tbody + tbody {
  17 + border-top: 1px solid; }
  18 +</style>
  19 +
  20 +<div class="page-head">
  21 + <div class="page-title">
  22 + <h1>统计日报</h1>
  23 + </div>
  24 +</div>
  25 +
  26 +<div class="row">
  27 + <div class="col-md-12">
  28 + <div class="portlet light porttlet-fit bordered">
  29 + <div class="portlet-title">
  30 + <form class="form-inline" action="">
  31 + <div class="form-group">
  32 + <label for="line">线路名称:</label>
  33 + <input id="line" type="text" name="xlName_eq"/>
  34 + </div>
  35 + <div class="form-group">
  36 + <label for="date">时间:</label>
  37 + <input type="text" id="date" name="scheduleDate_eq"/>
  38 + </div>
  39 + <div class="form-group">
  40 + <input class="btn btn-default" type="button" id="query" value="查询"/>
  41 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  42 + </div>
  43 + </form>
  44 + </div>
  45 + <div class="portlet-body">
  46 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  47 + <table class="table table-bordered table-hover table-checkable" id="forms">
  48 + <thead>
  49 + <tr>
  50 + <th colspan="36">线路运营情况统计日报</th>
  51 + </tr>
  52 + <tr>
  53 + <td rowspan="3">路线别</td>
  54 + <td colspan="15">全日营运里程(公里)</td>
  55 + <td colspan="15">全日营运班次</td>
  56 + <td colspan="5">大间隔情况</td>
  57 + </tr>
  58 + <tr>
  59 + <td rowspan="2">计划</td>
  60 + <td rowspan="2">实驶</td>
  61 + <td rowspan="2">少驶</td>
  62 + <td colspan="11">少驶原因(公里)</td>
  63 + <td rowspan="2">临加公里</td>
  64 + <td colspan="3">计划班次</td>
  65 + <td colspan="3">实际班次</td>
  66 + <td colspan="3">临加班次</td>
  67 + <td colspan="3">放站班次</td>
  68 + <td colspan="3">调头班次</td>
  69 + <td colspan="3">发生次数</td>
  70 + <td rowspan="2">最大间隔时间(秒)</td>
  71 + <td rowspan="2">原因</td>
  72 + </tr>
  73 + <tr>
  74 + <td>路阻</td>
  75 + <td>吊慢</td>
  76 + <td>故障</td>
  77 + <td>纠纷</td>
  78 + <td>肇事</td>
  79 + <td>缺人</td>
  80 + <td>缺车</td>
  81 + <td>客稀</td>
  82 + <td>气候</td>
  83 + <td>援外</td>
  84 + <td>其他</td>
  85 + <td>全日</td>
  86 + <td>6:31~8:30</td>
  87 + <td>16:01~18:00</td>
  88 + <td>全日</td>
  89 + <td>6:31~8:30</td>
  90 + <td>16:01~18:00</td>
  91 + <td>全日</td>
  92 + <td>6:31~8:30</td>
  93 + <td>16:01~18:00</td>
  94 + <td>全日</td>
  95 + <td>6:31~8:30</td>
  96 + <td>16:01~18:00</td>
  97 + <td>全日</td>
  98 + <td>6:31~8:30</td>
  99 + <td>16:01~18:00</td>
  100 + <td>全日</td>
  101 + <td>6:31~8:30</td>
  102 + <td>16:01~18:00</td>
  103 + </tr>
  104 + </thead>
  105 + <tbody>
  106 +
  107 + </tbody>
  108 + <tr>
  109 + <td>合计</td>
  110 + <td>&nbsp;</td>
  111 + <td>&nbsp;</td>
  112 + <td>&nbsp;</td>
  113 + <td>&nbsp;</td>
  114 + <td>&nbsp;</td>
  115 + <td>&nbsp;</td>
  116 + <td>&nbsp;</td>
  117 + <td>&nbsp;</td>
  118 + <td>&nbsp;</td>
  119 + <td>&nbsp;</td>
  120 + <td>&nbsp;</td>
  121 + <td>&nbsp;</td>
  122 + <td>&nbsp;</td>
  123 + <td>&nbsp;</td>
  124 + <td>&nbsp;</td>
  125 + <td>&nbsp;</td>
  126 + <td>&nbsp;</td>
  127 + <td>&nbsp;</td>
  128 + <td>&nbsp;</td>
  129 + <td>&nbsp;</td>
  130 + <td>&nbsp;</td>
  131 + <td>&nbsp;</td>
  132 + <td>&nbsp;</td>
  133 + <td>&nbsp;</td>
  134 + <td>&nbsp;</td>
  135 + <td>&nbsp;</td>
  136 + <td>&nbsp;</td>
  137 + <td>&nbsp;</td>
  138 + <td>&nbsp;</td>
  139 + <td>&nbsp;</td>
  140 + <td>&nbsp;</td>
  141 + <td>&nbsp;</td>
  142 + <td>&nbsp;</td>
  143 + <td>&nbsp;</td>
  144 + <td>&nbsp;</td>
  145 + </tr>
  146 + <tr>
  147 + <td>运营情况摘录</td>
  148 + <td colspan="35">&nbsp;</td>
  149 + </tr>
  150 + </table>
  151 + </div>
  152 + </div>
  153 + </div>
  154 + </div>
  155 +</div>
  156 +
  157 +<script>
  158 + $(function(){
  159 + // 关闭左侧栏
  160 + if (!$('body').hasClass('page-sidebar-closed'))
  161 + $('.menu-toggler.sidebar-toggler').click();
  162 +
  163 + $("#date").datetimepicker({
  164 + format : 'YYYY-MM-DD',
  165 + locale : 'zh-cn'
  166 + });
  167 +
  168 + var lines = new Array();
  169 + // 取得所有线路
  170 + $get('/line/all', null, function(allLine) {
  171 + // 遍历数组
  172 + $.each(allLine, function(i, e) {
  173 + var line = '{"hex":"'+e.company+'","label":"'+e.name+'"}';
  174 + var obj = jQuery.parseJSON(line);
  175 + lines[i]= obj;
  176 + });
  177 +
  178 + });
  179 + // 给输入框绑定autocomplete事件
  180 + $("#line").autocompleter({
  181 + highlightMatches: true,
  182 + source: lines,
  183 + template: '{{ label }}',
  184 + hint: true,
  185 + empty: false,
  186 + limit: 5,
  187 + });
  188 + });
  189 +</script>
  190 +<script type="text/html" id="list_forms">
  191 + {{each list as obj i}}
  192 + <tr>
  193 +
  194 + </tr>
  195 + {{/each}}
  196 + {{if list.length == 0}}
  197 + <tr>
  198 + <td colspan="6"><h6 class="muted">没有找到相关数据</h6></td>
  199 + </tr>
  200 + {{/if}}
  201 +</script>
0 202 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/statement/waybill.html 0 → 100644
  1 +<link href="/pages/forms/statement/css/autocompleter.css" rel="stylesheet" type="text/css" />
  2 +<style type="text/css">
  3 + .table-bordered {
  4 + border: 1px solid; }
  5 + .table-bordered > thead > tr > th,
  6 + .table-bordered > thead > tr > td,
  7 + .table-bordered > tbody > tr > th,
  8 + .table-bordered > tbody > tr > td,
  9 + .table-bordered > tfoot > tr > th,
  10 + .table-bordered > tfoot > tr > td {
  11 + border: 1px solid; }
  12 + .table-bordered > thead > tr > th,
  13 + .table-bordered > thead > tr > td {
  14 + border-bottom-width: 2px; }
  15 +
  16 + .table > tbody + tbody {
  17 + border-top: 1px solid; }
  18 +</style>
  19 +
  20 +<div class="page-head">
  21 + <div class="page-title">
  22 + <h1>行车路单</h1>
  23 + </div>
  24 +</div>
  25 +
  26 +<div class="row">
  27 + <div class="col-md-12">
  28 + <div class="portlet light porttlet-fit bordered">
  29 + <div class="portlet-title">
  30 + <form class="form-inline" action="">
  31 + <div class="form-group">
  32 + <label for="line">线路:</label>
  33 + <input id="line" type="text" name="xlName_eq"/>
  34 + </div>
  35 + <div class="form-group">
  36 + <label for="date">时间:</label>
  37 + <input type="text" id="date"/>
  38 + </div>
  39 + <div class="form-group">
  40 + <input class="btn btn-default" type="button" id="query" value="查询"/>
  41 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  42 + <input class="btn btn-default" type="button" id="print" value="打印"/>
  43 + <input class="btn btn-default" type="button" id="exportMore" value="批量导出"/>
  44 + </div>
  45 + </form>
  46 + </div>
  47 + <div class="portlet-body">
  48 + <div class="row">
  49 + <div class="col-md-3">
  50 + <div style="margin-top: 10px;overflow:auto;height: 860px">
  51 + <table class="table table-bordered table-hover table-checkable pre-scrollable" id="info">
  52 + <thead>
  53 + <tr class="hidden">
  54 + <th>人员</th>
  55 + <th>自编号</th>
  56 + <th>路牌</th>
  57 + </tr>
  58 + </thead>
  59 + <tbody>
  60 +
  61 + </tbody>
  62 + </table>
  63 + </div>
  64 + </div>
  65 + <div class="col-md-9" id="printArea">
  66 + <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px">
  67 + <table class="table table-bordered table-hover table-checkable" id="forms">
  68 + <tbody class="ludan_1">
  69 +
  70 + </tbody>
  71 + <tbody class="ludan_2">
  72 +
  73 + </tbody>
  74 + <tbody class="ludan_3">
  75 +
  76 + </tbody>
  77 + <tbody class="ludan_4">
  78 +
  79 + </tbody>
  80 + </table>
  81 + </div>
  82 + </div>
  83 + </div>
  84 + </div>
  85 + </div>
  86 + </div>
  87 +</div>
  88 +
  89 +<script>
  90 + $(function(){
  91 + // 关闭左侧栏
  92 + if (!$('body').hasClass('page-sidebar-closed'))
  93 + $('.menu-toggler.sidebar-toggler').click();
  94 +
  95 + $("#date").datetimepicker({
  96 + format : 'YYYY-MM-DD',
  97 + locale : 'zh-cn'
  98 + });
  99 +
  100 + var lines = new Array();
  101 + // 取得所有线路
  102 + $get('/line/all', null, function(allLine) {
  103 + // 遍历数组
  104 + $.each(allLine, function(i, e) {
  105 + var line = '{"hex":"'+e.company+'","label":"'+e.name+'"}';
  106 + var obj = jQuery.parseJSON(line);
  107 + lines[i]= obj;
  108 + });
  109 +
  110 + });
  111 + // 给输入框绑定autocomplete事件
  112 + $("#line").autocompleter({
  113 + highlightMatches: true,
  114 + source: lines,
  115 + template: '{{ label }}',
  116 + hint: true,
  117 + empty: false,
  118 + limit: 5,
  119 + });
  120 +
  121 + $("#query").on("click",function(){
  122 + var line = $("#line").val();
  123 + var date = $("#date").val();
  124 + $(".hidden").removeClass("hidden");
  125 + $get('/realSchedule/queryUserInfo',{line:line,date:date},function(result){
  126 + // 把数据填充到模版中
  127 + var tbodyHtml = template('list_info',{list:result});
  128 + // 把渲染好的模版html文本追加到表格中
  129 + $('#info tbody').html(tbodyHtml);
  130 + });
  131 + });
  132 +
  133 + var params = {};
  134 + var jName;
  135 + $("#info tbody").on("click","tr",function(){
  136 + $('#forms .ludan_1').html('');
  137 + $('#forms .ludan_2').html('');
  138 + $('#forms .ludan_3').html('');
  139 + $('#forms .ludan_4').html('');
  140 + if($(this).children().size() < 2){
  141 + return;
  142 + }
  143 +
  144 + $(this).children().each(function(index){
  145 + params[index] = $(this).text();
  146 + });
  147 + jName = params[0].split("\\")[0];
  148 + var id = $("#"+params[1]).val();
  149 + $get('/realSchedule/'+id,null,function(result){
  150 + debugger
  151 + var ludan_1 = template('ludan_1',result);
  152 + var ludan_3 = template('ludan_3',result);
  153 + var ludan_4 = template('ludan_4',result);
  154 + // 把渲染好的模版html文本追加到表格中
  155 + $('#forms .ludan_1').append(ludan_1);
  156 + $('#forms .ludan_3').append(ludan_3);
  157 + $('#forms .ludan_4').append(ludan_4);
  158 + });
  159 + $get('/realSchedule/all',{jName_eq:jName,clZbh_eq:params[1],lpName_eq:params[2]},function(result){
  160 + var ludan_2 = template('ludan_2',{list:result});
  161 + // 把渲染好的模版html文本追加到表格中
  162 + $('#forms .ludan_2').append(ludan_2);
  163 + });
  164 +
  165 + });
  166 +
  167 + $("#export").on("click",function(){
  168 + $get('/realSchedule/exportWaybill',{jName:jName,clZbh:params[1],lpName:params[2]},function(result){
  169 + window.open("/downloadFile/download?jName="+jName+"&lpName="+params[2]);
  170 + });
  171 + });
  172 +
  173 + $("#print").click(function(){
  174 + $("#printArea").printArea();
  175 + });
  176 + });
  177 +</script>
  178 +<script type="text/html" id="list_info">
  179 + {{each list as obj i}}
  180 + <tr>
  181 + <td width="45%">{{obj.jName}}\{{obj.jGh}}</td>
  182 + <td width="32%">{{obj.clZbh}}</td>
  183 + <td width="23%">{{obj.lpName}}<input type="hidden" id="{{obj.clZbh}}" value="{{obj.id}}"></td>
  184 + </tr>
  185 + {{/each}}
  186 + {{if list.length == 0}}
  187 + <tr>
  188 + <td colspan="3"><h6 class="muted">没有找到相关数据</h6></td>
  189 + </tr>
  190 + {{/if}}
  191 +</script>
  192 +<script type="text/html" id="ludan_1">
  193 + <tr>
  194 + <td colspan="14">行车路单</td>
  195 + </tr>
  196 + <tr>
  197 + <td colspan="14">路别:{{xlName}} 路牌:{{lpName}} 车号:{{clZbh}}/{{carPlate}} 出场时间:{{ccTime}} 到达站名:{{zdzName}} 当班调派:JQHLQ/jqf02 日期:{{scheduleDate}}</td>
  198 + </tr>
  199 + <tr>
  200 + <td colspan="2">出场存油 &nbsp;升</td>
  201 + <td colspan="2">加注油量 &nbsp;升</td>
  202 + <td colspan="2">进场存油 &nbsp;升</td>
  203 + <td colspan="4">加注机油 &nbsp;升</td>
  204 + <td colspan="4">本日耗油 &nbsp;升</td>
  205 + </tr>
  206 + <tr>
  207 + <td rowspan="2">调度章</td>
  208 + <td colspan="1">&nbsp;</td>
  209 + <td rowspan="2">早班</td>
  210 + <td colspan="1">&nbsp;</td>
  211 + <td rowspan="2">夜班</td>
  212 + <td colspan="1">&nbsp;</td>
  213 + <td rowspan="2" colspan="2">交叉</td>
  214 + <td colspan="2">&nbsp;</td>
  215 + <td rowspan="2">其他</td>
  216 + <td colspan="1">&nbsp;</td>
  217 + <td colspan="1">&nbsp;</td>
  218 + <td colspan="1">&nbsp;</td>
  219 + </tr>
  220 + <tr>
  221 + <td colspan="1">&nbsp;</td>
  222 + <td colspan="1">&nbsp;</td>
  223 + <td colspan="1">&nbsp;</td>
  224 + <td colspan="2">&nbsp;</td>
  225 + <td colspan="1">&nbsp;</td>
  226 + <td colspan="1">&nbsp;</td>
  227 + <td colspan="1">&nbsp;</td>
  228 + </tr>
  229 + <tr>
  230 + <td rowspan="2">车次</td>
  231 + <td colspan="2">工号</td>
  232 + <td rowspan="2">公里耗油</td>
  233 + <td colspan="2">起讫站</td>
  234 + <td colspan="4">时间</td>
  235 + <td colspan="2">误点</td>
  236 + <td rowspan="2" width="66px">里程(公里)计划</td>
  237 + <td rowspan="2">备注</td>
  238 + </tr>
  239 + <tr>
  240 + <td colspan="1">司&nbsp;机</td>
  241 + <td colspan="1">售&nbsp;票</td>
  242 + <td colspan="1">起点</td>
  243 + <td colspan="1">终点</td>
  244 + <td colspan="1">计发</td>
  245 + <td colspan="1">实发</td>
  246 + <td colspan="1">应到</td>
  247 + <td colspan="1">实到</td>
  248 + <td colspan="1">快</td>
  249 + <td colspan="1">慢</td>
  250 + </tr>
  251 +</script>
  252 +<script type="text/html" id="ludan_2">
  253 + {{each list as obj i}}
  254 + <tr>
  255 + <td>{{i+1}}</td>
  256 + <td>{{obj.jName}}</td>
  257 + <td>{{obj.sName}}</td>
  258 + <td>&nbsp;</td>
  259 + <td>{{obj.qdzName}}</td>
  260 + <td>{{obj.zdzName}}</td>
  261 + <td>{{obj.fcsj}}</td>
  262 + <td>{{obj.fcsjActual}}</td>
  263 + <td>{{obj.zdsj}}</td>
  264 + <td>{{obj.zdsjActual}}</td>
  265 + <td>&nbsp;</td>
  266 + <td>&nbsp;</td>
  267 + <td>{{obj.jhlc}}</td>
  268 + <td>{{obj.remarks}}</td>
  269 + </tr>
  270 + {{/each}}
  271 + {{if list.length == 0}}
  272 + <tr>
  273 + <td colspan="14"><h6 class="muted">没有找到相关数据</h6></td>
  274 + </tr>
  275 + {{/if}}
  276 +</script>
  277 +<script type="text/html" id="ludan_3">
  278 + <tr>
  279 + <td colspan="2">计划公里</td>
  280 + <td>{{jhlc}}</td>
  281 + <td colspan="2">抽减公里</td>
  282 + <td>{{remMileage}}</td>
  283 + <td colspan="2">增加公里</td>
  284 + <td>{{addMileage}}</td>
  285 + <td colspan="2">实际计划公里</td>
  286 + <td colspan="3">{{jhlc}}</td>
  287 + </tr>
  288 + <tr>
  289 + <td colspan="2">营运公里</td>
  290 + <td>{{realMileage}}</td>
  291 + <td colspan="2">空驶公里</td>
  292 + <td>&nbsp;</td>
  293 + <td colspan="2">总公里</td>
  294 + <td>&nbsp;</td>
  295 + <td colspan="2">计划班次</td>
  296 + <td colspan="3">&nbsp;</td>
  297 + </tr>
  298 + <tr>
  299 + <td colspan="2">抽减班次</td>
  300 + <td>&nbsp;</td>
  301 + <td colspan="2">增加班次</td>
  302 + <td>&nbsp;</td>
  303 + <td colspan="2">实际计划班次</td>
  304 + <td>&nbsp;</td>
  305 + <td colspan="2">实际班次</td>
  306 + <td colspan="3">&nbsp;</td>
  307 + </tr>
  308 +</script>
  309 +<script type="text/html" id="ludan_4">
  310 + <tr>
  311 + <td colspan="12">认真做好终点项目的例保保修工作,杜绝机械火警事故!</td>
  312 + <td>轮胎</td>
  313 + <td>&nbsp;</td>
  314 + </tr>
  315 + <tr>
  316 + <td colspan="3">重点例保项目</td>
  317 + <td>1</td>
  318 + <td>2</td>
  319 + <td>3</td>
  320 + <td colspan="3">重点例保项目</td>
  321 + <td>1</td>
  322 + <td>2</td>
  323 + <td>3</td>
  324 + <td>灭火机</td>
  325 + <td>&nbsp;</td>
  326 + </tr>
  327 + <tr>
  328 + <td colspan="3">各类制动</td>
  329 + <td>&nbsp;</td>
  330 + <td>&nbsp;</td>
  331 + <td>&nbsp;</td>
  332 + <td colspan="3">各类灯光</td>
  333 + <td>&nbsp;</td>
  334 + <td>&nbsp;</td>
  335 + <td>&nbsp;</td>
  336 + <td colspan="2">出场路码表里程</td>
  337 + </tr>
  338 + <tr>
  339 + <td colspan="3">方向机</td>
  340 + <td>&nbsp;</td>
  341 + <td>&nbsp;</td>
  342 + <td>&nbsp;</td>
  343 + <td colspan="3">各类仪表</td>
  344 + <td>&nbsp;</td>
  345 + <td>&nbsp;</td>
  346 + <td>&nbsp;</td>
  347 + <td colspan="2" rowspan="2">&nbsp;</td>
  348 + </tr>
  349 + <tr>
  350 + <td colspan="3">欠压报警器</td>
  351 + <td>&nbsp;</td>
  352 + <td>&nbsp;</td>
  353 + <td>&nbsp;</td>
  354 + <td colspan="3">各类皮带</td>
  355 + <td>&nbsp;</td>
  356 + <td>&nbsp;</td>
  357 + <td>&nbsp;</td>
  358 + </tr>
  359 + <tr>
  360 + <td colspan="3">发动机清洁及响声</td>
  361 + <td>&nbsp;</td>
  362 + <td>&nbsp;</td>
  363 + <td>&nbsp;</td>
  364 + <td colspan="3">油箱及托架</td>
  365 + <td>&nbsp;</td>
  366 + <td>&nbsp;</td>
  367 + <td>&nbsp;</td>
  368 + <td colspan="2">出场路码表里程</td>
  369 + </tr>
  370 + <tr>
  371 + <td colspan="3">地盘响声</td>
  372 + <td>&nbsp;</td>
  373 + <td>&nbsp;</td>
  374 + <td>&nbsp;</td>
  375 + <td colspan="3">轮胎、半轴螺栓螺母</td>
  376 + <td>&nbsp;</td>
  377 + <td>&nbsp;</td>
  378 + <td>&nbsp;</td>
  379 + <td colspan="2" rowspan="3">&nbsp;</td>
  380 + </tr>
  381 + <tr>
  382 + <td colspan="3">化油器及油路</td>
  383 + <td>&nbsp;</td>
  384 + <td>&nbsp;</td>
  385 + <td>&nbsp;</td>
  386 + <td colspan="3">油、电、水、气</td>
  387 + <td>&nbsp;</td>
  388 + <td>&nbsp;</td>
  389 + <td>&nbsp;</td>
  390 + </tr>
  391 + <tr>
  392 + <td colspan="3">进排歧管及排气管</td>
  393 + <td>&nbsp;</td>
  394 + <td>&nbsp;</td>
  395 + <td>&nbsp;</td>
  396 + <td colspan="3">内外车身及附件</td>
  397 + <td>&nbsp;</td>
  398 + <td>&nbsp;</td>
  399 + <td>&nbsp;</td>
  400 + </tr>
  401 + <tr>
  402 + <td colspan="14">1 首次出场,2 复使中途,3 某次进场。√正常,ⓧ报修,×尚未报修</td>
  403 + </tr>
  404 +</script>
0 405 \ No newline at end of file
... ...