Commit f7603ac9a28d4a5bbe7ff2e930da53a6b727d9b9

Authored by 徐烜
2 parents 5e56f6a1 5e99b8a6

PSM-14

Showing 35 changed files with 3411 additions and 1017 deletions

Too many changes to show.

To preserve performance only 35 of 40 files are displayed.

src/main/java/com/bsth/controller/BaseController2.java 0 → 100644
  1 +package com.bsth.controller;
  2 +
  3 +
  4 +import com.bsth.common.ResponseCode;
  5 +import com.bsth.service.BaseService;
  6 +import com.bsth.service.schedule.utils.DataImportExportService;
  7 +import com.google.common.base.Splitter;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.data.domain.Page;
  10 +import org.springframework.data.domain.PageRequest;
  11 +import org.springframework.data.domain.Sort;
  12 +import org.springframework.web.bind.annotation.*;
  13 +import org.springframework.web.multipart.MultipartFile;
  14 +
  15 +import javax.servlet.http.HttpServletResponse;
  16 +import java.io.*;
  17 +import java.util.ArrayList;
  18 +import java.util.HashMap;
  19 +import java.util.List;
  20 +import java.util.Map;
  21 +
  22 +/**
  23 + * Created by xu on 16/11/3.
  24 + */
  25 +public class BaseController2<T, ID extends Serializable> {
  26 +
  27 + @Autowired
  28 + protected BaseService<T, ID> baseService;
  29 + @Autowired
  30 + DataImportExportService dataImportExportService;
  31 +
  32 + /**
  33 + *
  34 + * @Title: list
  35 + * @Description: TODO(多条件分页查询)
  36 + * @param @param map 查询条件
  37 + * @param @param page 页码
  38 + * @param @param size 每页显示数量
  39 + * @throws
  40 + */
  41 + @RequestMapping(method = RequestMethod.GET)
  42 + public Page<T> list(@RequestParam Map<String, Object> map,
  43 + @RequestParam(defaultValue = "0") int page,
  44 + @RequestParam(defaultValue = "10") int size,
  45 + @RequestParam(defaultValue = "id") String order,
  46 + @RequestParam(defaultValue = "DESC") String direction){
  47 +
  48 + // 允许多个字段排序,order可以写单个字段,也可以写多个字段
  49 + // 多个字段格式:{col1},{col2},{col3},....,{coln}
  50 + List<String> order_columns = Splitter.on(",").trimResults().splitToList(order);
  51 + // 多字段排序:DESC,ASC...
  52 + List<String> order_dirs = Splitter.on(",").trimResults().splitToList(direction);
  53 +
  54 + if (order_dirs.size() == 1) { // 所有字段采用一种排序
  55 + if (null != order_dirs.get(0) && order_dirs.get(0).equals("ASC")) {
  56 + return baseService.list(map, new PageRequest(page, size, new Sort(Sort.Direction.ASC, order_columns)));
  57 + } else {
  58 + return baseService.list(map, new PageRequest(page, size, new Sort(Sort.Direction.DESC, order_columns)));
  59 + }
  60 + } else if (order_columns.size() == order_dirs.size()) {
  61 + List<Sort.Order> orderList = new ArrayList<>();
  62 + for (int i = 0; i < order_columns.size(); i++) {
  63 + if (null != order_dirs.get(i) && order_dirs.get(i).equals("ASC")) {
  64 + orderList.add(new Sort.Order(Sort.Direction.ASC, order_columns.get(i)));
  65 + } else {
  66 + orderList.add(new Sort.Order(Sort.Direction.DESC, order_columns.get(i)));
  67 + }
  68 + }
  69 + return baseService.list(map, new PageRequest(page, size, new Sort(orderList)));
  70 + } else {
  71 + throw new RuntimeException("多字段排序参数格式问题,排序顺序和字段数不一致");
  72 + }
  73 + }
  74 +
  75 + /**
  76 + *
  77 + * @Title: list
  78 + * @Description: TODO(多条件查询)
  79 + * @param @param map
  80 + * @throws
  81 + */
  82 + @RequestMapping(value = "/all", method = RequestMethod.GET)
  83 + public Iterable<T> list(@RequestParam Map<String, Object> map){
  84 + return baseService.list(map);
  85 + }
  86 +
  87 + /**
  88 + * 这里保存直接返回保存后的对象,不自己定义Map返回了,和前端angularjs配合。
  89 + * form也可以提交,但是页面参数可能不全,
  90 + * json的化比较灵活,但是貌似有多余属性也会报错,或者碰到lazy属性值,也有问题
  91 + * 不论form,还是json提交都能解决问题,就看哪个方便哪个来
  92 + *
  93 + * @param t 参数需要使用@RequestBody转换json成对象
  94 + * @return
  95 + */
  96 + @RequestMapping(method = RequestMethod.POST)
  97 + public T save(@RequestBody T t) {
  98 + baseService.save(t);
  99 + return t;
  100 + }
  101 +
  102 + @RequestMapping(value="/{id}", method = RequestMethod.POST)
  103 + public T update(@RequestBody T t) {
  104 + baseService.save(t);
  105 + return t;
  106 + }
  107 +
  108 + /**
  109 + *
  110 + * @Title: findById
  111 + * @Description: TODO(根据主键获取单个对象)
  112 + * @param @param id
  113 + * @throws
  114 + */
  115 + @RequestMapping(value="/{id}",method = RequestMethod.GET)
  116 + public T findById(@PathVariable("id") ID id){
  117 + return baseService.findById(id);
  118 + }
  119 +
  120 + /**
  121 + *
  122 + * @Title: delete
  123 + * @Description: TODO(根据主键删除对象)
  124 + * @param @param id
  125 + * @throws
  126 + */
  127 + @RequestMapping(value="/{id}",method = RequestMethod.DELETE)
  128 + public Map<String, Object> delete(@PathVariable("id") ID id){
  129 + return baseService.delete(id);
  130 + }
  131 +
  132 + /**
  133 + * 上传数据文件,并使用ktr转换文件导入数据。
  134 + * @param file
  135 + * @return
  136 + * @throws Exception
  137 + */
  138 + @RequestMapping(value = "/dataImport", method = RequestMethod.POST)
  139 + public Map<String, Object> uploadDataAndImport(MultipartFile file) throws Exception {
  140 + Map<String, Object> resultMap = new HashMap<>();
  141 +
  142 + try {
  143 + // 获取ktr转换文件绝对路径
  144 + File ktrfile = new File(this.getClass().getResource(getDataImportKtrClasspath()).toURI());
  145 + System.out.println(ktrfile.getAbsolutePath());
  146 + // 导入数据
  147 + dataImportExportService.fileDataImport(file, ktrfile);
  148 +
  149 + resultMap.put("status", ResponseCode.SUCCESS);
  150 + resultMap.put("msg", "导入成功");
  151 + } catch (Exception exp) {
  152 + exp.printStackTrace();
  153 + resultMap.put("status", ResponseCode.ERROR);
  154 + resultMap.put("msg", exp.getLocalizedMessage());
  155 + }
  156 +
  157 + return resultMap;
  158 + }
  159 +
  160 + /**
  161 + * 使用ktr导出数据。
  162 + * @param response
  163 + * @throws Exception
  164 + */
  165 + @RequestMapping(value = "/dataExport", method = RequestMethod.GET)
  166 + public void dataExport(HttpServletResponse response) throws Exception {
  167 + // 1、使用ktr转换获取输出文件
  168 + File ktrfile = new File(this.getClass().getResource(getDataExportKtrClasspath()).toURI());
  169 + File outputfile = dataImportExportService.fileDataOutput(
  170 + getDataExportFilename(),
  171 + ktrfile);
  172 +
  173 + System.out.println(outputfile.getName());
  174 + String filePath = outputfile.getAbsolutePath();
  175 + String fp[] = filePath.split(File.separator);
  176 + String fileName = fp[fp.length - 1];
  177 +
  178 + // TODO:使用ktr获取导出数据
  179 +
  180 + response.setHeader("conent-type", "application/octet-stream");
  181 + response.setContentType("application/octet-stream");
  182 + response.setHeader("Content-Disposition", "attachment; filename=" + "东东");
  183 +
  184 + OutputStream os = response.getOutputStream();
  185 + BufferedOutputStream bos = new BufferedOutputStream(os);
  186 +
  187 + InputStream is = null;
  188 +
  189 + is = new FileInputStream(filePath);
  190 + BufferedInputStream bis = new BufferedInputStream(is);
  191 +
  192 + int length = 0;
  193 + byte[] temp = new byte[1 * 1024 * 10];
  194 +
  195 + while ((length = bis.read(temp)) != -1) {
  196 + bos.write(temp, 0, length);
  197 + }
  198 + bos.flush();
  199 + bis.close();
  200 + bos.close();
  201 + is.close();
  202 + }
  203 +
  204 + /**
  205 + * @return 数据导出的ktr转换文件类路径。
  206 + */
  207 + protected String getDataExportKtrClasspath() {
  208 + // 默认返回异常,子类如果要使用导出功能,必须覆写此方法,指定ktr文件类路径
  209 + throw new RuntimeException("必须override,并指定ktr classpath");
  210 + }
  211 +
  212 + /**
  213 + * @return 导出文件名。
  214 + */
  215 + protected String getDataExportFilename() {
  216 + // 默认返回异常,子类如果要使用导出功能,必须覆写此方法,指定导出的文件路径名
  217 + throw new RuntimeException("必须override,并指定导出文件名");
  218 + }
  219 +
  220 + /**
  221 + * @return 数据导入的ktr转换文件类路径。
  222 + */
  223 + protected String getDataImportKtrClasspath() {
  224 + // 默认返回异常,子类如果要使用导入功能,必须覆写此方法,指定ktr文件类路径
  225 + throw new RuntimeException("必须override,并指定ktr classpath");
  226 + }
  227 +
  228 +}
... ...
src/main/java/com/bsth/controller/schedule/TTInfoController.java
1 1 package com.bsth.controller.schedule;
2 2  
3   -import com.bsth.controller.BaseController;
  3 +import com.bsth.controller.BaseController2;
4 4 import com.bsth.entity.schedule.TTInfo;
5 5 import com.bsth.repository.schedule.TTInfoDetailRepository;
6 6 import com.bsth.repository.schedule.TTInfoRepository;
... ... @@ -18,7 +18,7 @@ import java.util.Map;
18 18 @RestController
19 19 @RequestMapping("tic")
20 20 @EnableConfigurationProperties(DataToolsProperties.class)
21   -public class TTInfoController extends BaseController<TTInfo, Long> {
  21 +public class TTInfoController extends BaseController2<TTInfo, Long> {
22 22 @Autowired
23 23 private DataToolsProperties dataToolsProperties;
24 24 @Autowired
... ... @@ -31,20 +31,6 @@ public class TTInfoController extends BaseController&lt;TTInfo, Long&gt; {
31 31 return dataToolsProperties.getTtinfoDatainputktr();
32 32 }
33 33  
34   - /**
35   - * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody
36   - * @Title: save
37   - * @Description: TODO(持久化对象)
38   - * @param @param t
39   - * @param @return 设定文件
40   - * @return Map<String,Object> {status: 1(成功),-1(失败)}
41   - * @throws
42   - */
43   - @RequestMapping(method = RequestMethod.POST)
44   - public Map<String, Object> save(@RequestBody TTInfo t){
45   - return baseService.save(t);
46   - }
47   -
48 34 @Override
49 35 public TTInfo findById(@PathVariable("id") Long aLong) {
50 36 return ttInfoRepository.findOneExtend(aLong);
... ...
src/main/java/com/bsth/controller/schedule/TTInfoDetailController.java
... ... @@ -4,20 +4,32 @@ import com.bsth.common.ResponseCode;
4 4 import com.bsth.controller.BaseController;
5 5 import com.bsth.entity.CarPark;
6 6 import com.bsth.entity.LineInformation;
  7 +import com.bsth.entity.StationRoute;
  8 +import com.bsth.entity.schedule.GuideboardInfo;
7 9 import com.bsth.entity.schedule.TTInfoDetail;
8 10 import com.bsth.repository.schedule.TTInfoDetailRepository;
9 11 import com.bsth.service.CarParkService;
10 12 import com.bsth.service.LineInformationService;
11   -import com.bsth.service.schedule.TTInfoDetailServiceImpl;
  13 +import com.bsth.service.StationRouteService;
  14 +import com.bsth.service.schedule.GuideboardInfoService;
  15 +import com.bsth.service.schedule.TTInfoDetailService;
  16 +import com.bsth.service.schedule.utils.DataImportExportService;
  17 +import jxl.Cell;
  18 +import jxl.Sheet;
  19 +import jxl.Workbook;
  20 +import jxl.write.Label;
  21 +import jxl.write.WritableSheet;
  22 +import jxl.write.WritableWorkbook;
12 23 import org.apache.commons.lang3.StringUtils;
13 24 import org.springframework.beans.factory.annotation.Autowired;
  25 +import org.springframework.util.CollectionUtils;
14 26 import org.springframework.web.bind.annotation.*;
15 27 import org.springframework.web.multipart.MultipartFile;
16 28  
17   -import java.util.HashMap;
18   -import java.util.Iterator;
19   -import java.util.List;
20   -import java.util.Map;
  29 +import java.io.File;
  30 +import java.util.*;
  31 +import java.util.regex.Matcher;
  32 +import java.util.regex.Pattern;
21 33  
22 34 /**
23 35 * Created by xu on 16/7/2.
... ... @@ -26,14 +38,340 @@ import java.util.Map;
26 38 @RequestMapping("tidc")
27 39 public class TTInfoDetailController extends BaseController<TTInfoDetail, Long> {
28 40 @Autowired
29   - private TTInfoDetailServiceImpl ttInfoDetailService;
  41 + private TTInfoDetailService ttInfoDetailService;
30 42 @Autowired
31 43 private CarParkService carParkService;
32 44 @Autowired
33 45 private LineInformationService lineInformationService;
34 46 @Autowired
35 47 private TTInfoDetailRepository ttInfoDetailRepository;
  48 + @Autowired
  49 + private DataImportExportService dataImportExportService;
  50 + @Autowired
  51 + private StationRouteService stationRouteService;
  52 + @Autowired
  53 + private GuideboardInfoService guideboardInfoService;
  54 +
  55 +
  56 + public static class ExcelFileOutput {
  57 + private String fileName;
  58 + private List<Map<String, Object>> sheetnames = new ArrayList<>();
  59 +
  60 + public String getFileName() {
  61 + return fileName;
  62 + }
  63 +
  64 + public void setFileName(String fileName) {
  65 + this.fileName = fileName;
  66 + }
  67 +
  68 + public List<Map<String, Object>> getSheetnames() {
  69 + return sheetnames;
  70 + }
  71 +
  72 + public void setSheetnames(List<Map<String, Object>> sheetnames) {
  73 + this.sheetnames = sheetnames;
  74 + }
  75 + }
  76 +
  77 + /**
  78 + * 1、上传Excel文件,返回文件全路径名,工作区名称列表。
  79 + * @param file
  80 + * @return
  81 + * @throws Exception
  82 + */
  83 + @RequestMapping(value = "/uploadFile", method = RequestMethod.POST)
  84 + public ExcelFileOutput fileUpload(MultipartFile file) throws Exception {
  85 + // 返回对象
  86 + ExcelFileOutput rs = new ExcelFileOutput();
  87 +
  88 + // 上传文件
  89 + File file1 = dataImportExportService.uploadFile(file);
  90 + // 获取文件的sheet
  91 + Workbook book = Workbook.getWorkbook(file1);
  92 + for (Sheet sheet : book.getSheets()) {
  93 + String sheetname = sheet.getName();
  94 + Map<String, Object> s = new HashMap<>();
  95 + s.put("name", sheetname);
  96 + rs.getSheetnames().add(s);
  97 + }
  98 +
  99 + rs.setFileName(file1.getAbsolutePath());
  100 + return rs;
  101 + }
  102 +
  103 + /**
  104 + * 2、验证sheet(以后放到规则引擎里去做)。
  105 + * @param filename excel文件全路径名
  106 + * @param sheetname sheet名字
  107 + * @param lineid 线路id
  108 + * @param linename 线路名称
  109 + * @return
  110 + */
  111 + @RequestMapping(value = "/validate/sheet", method = RequestMethod.POST)
  112 + public Map<String, Object> validateSheet(String filename, String sheetname, Integer lineid, String linename) throws Exception {
  113 + Map<String, Object> rtn = new HashMap<>();
  114 + Workbook book = Workbook.getWorkbook(new File(filename));
  115 + Sheet sheet = book.getSheet(sheetname);
  116 + if (sheet.getRows() == 0 || sheet.getColumns() == 0) { // 工作区是否为空
  117 + rtn.put("status", ResponseCode.ERROR);
  118 + rtn.put("msg", String.format("%s 工作区没有数据!", sheetname));
  119 + } else {
  120 + if (sheet.getRows() <= 1 || sheet.getColumns() <= 1) {
  121 + rtn.put("status", ResponseCode.ERROR);
  122 + rtn.put("msg", String.format("工作区至少包含2行2列的数据"));
  123 + return rtn;
  124 + } else {
  125 + Cell[] cells = sheet.getRow(0); // 获取第一行数据列
  126 + for (int i = 0; i < cells.length; i++) {
  127 + String cell_con = cells[i].getContents();
  128 + if (StringUtils.isEmpty(cell_con)) {
  129 + rtn.put("status", ResponseCode.ERROR);
  130 + rtn.put("msg", String.format("第1行,第%d列数据不能为空", i + 1));
  131 + return rtn;
  132 + } else {
  133 + if (i == 0) { // 第一列必须是路牌2个字
  134 + if (!"路牌".equals(cell_con.trim())) {
  135 + rtn.put("status", ResponseCode.ERROR);
  136 + rtn.put("msg", "第1行,第1列数据必须是路牌2个字");
  137 + return rtn;
  138 + }
  139 + } else { // 排除出场,进场,其余内容到站点路由里查询,以各个方向的起点站为查询依据
  140 + if ((!"出场".equals(cell_con.trim())) &&
  141 + (!"进场".equals(cell_con.trim()))) {
  142 + Map<String, Object> p1 = new HashMap<>();
  143 + p1.put("line.id_eq", lineid);
  144 + p1.put("stationName_eq", cell_con.trim());
  145 + p1.put("stationMark_eq", "B");
  146 +
  147 + List<StationRoute> stationRouteList = (List<StationRoute>) stationRouteService.list(p1);
  148 + if (CollectionUtils.isEmpty(stationRouteList)) {
  149 + rtn.put("status", ResponseCode.ERROR);
  150 + rtn.put("msg", String.format("第1行,第%d列数据在%s站点路由中不是起点站", i + 1, linename));
  151 + return rtn;
  152 + } else if (stationRouteList.size() > 1) {
  153 + rtn.put("status", ResponseCode.ERROR);
  154 + rtn.put("msg", String.format("第1行,第%d列数据在%s站点路由中上下行都是起点站", i + 1, linename));
  155 + return rtn;
  156 + }
  157 + }
  158 +
  159 + }
  160 + }
  161 + }
  162 +
  163 + // 验证路牌内容
  164 + Map<String, Integer> gbindexmap = new HashMap<>(); // 记录每个路牌在第几行
  165 + for (int i = 1; i < sheet.getRows(); i++) { // 从第2行开始验证数据
  166 + Cell bcell = sheet.getRow(i)[0]; // 获取第1列
  167 + String bcell_con = bcell.getContents();
  168 + if (StringUtils.isEmpty(bcell_con)) {
  169 + rtn.put("status", ResponseCode.ERROR);
  170 + rtn.put("msg", String.format("第%d行,第1列路牌无数据", i + 1));
  171 + return rtn;
  172 + } else if (gbindexmap.get(bcell_con.trim()) != null) {
  173 + rtn.put("status", ResponseCode.ERROR);
  174 + rtn.put("msg", String.format("第%d行,第1列的路牌数据与第%d行,第1列数据重复",
  175 + i + 1,
  176 + gbindexmap.get(bcell_con.trim())));
  177 + return rtn;
  178 + } else {
  179 + Map<String, Object> p2 = new HashMap<>();
  180 + p2.put("xl.id_eq", lineid);
  181 + p2.put("lpName_eq", bcell_con.trim());
  182 + List<GuideboardInfo> guideboardInfoList = (List<GuideboardInfo>) guideboardInfoService.list(p2);
  183 + if (CollectionUtils.isEmpty(guideboardInfoList)) {
  184 + rtn.put("status", ResponseCode.ERROR);
  185 + rtn.put("msg", String.format("第%d行,第1列的路牌在%s中不存在", i + 1, linename));
  186 + return rtn;
  187 + } else if (guideboardInfoList.size() > 1) {
  188 + rtn.put("status", ResponseCode.ERROR);
  189 + rtn.put("msg", String.format("第%d行,第1列的路牌在%s中重复", i + 1, linename));
  190 + return rtn;
  191 + } else {
  192 + gbindexmap.put(bcell_con.trim(), i + 1);
  193 + }
  194 + }
  195 + }
  196 +
  197 + // 班次时间验证,正则表达式,格式hh:mm或者hhmm
  198 + String el = "^(([0-1]\\d)|(2[0-4])):[0-5]\\d$"; // hh:mm格式
  199 + String el2 = "^(([0-1]\\d)|(2[0-4]))[0-5]\\d$"; // hhmm格式
  200 + Pattern p = Pattern.compile(el);
  201 + Pattern p2 = Pattern.compile(el2);
  202 +
  203 + for (int i = 1; i < sheet.getRows(); i++) { // 从第2行开始验证数据
  204 + Cell[] bcells = sheet.getRow(i);
  205 + for (int j = 1; j < bcells.length; j++) { // 从第2列开始
  206 + String bcell_con = bcells[j].getContents();
  207 + if (StringUtils.isNotEmpty(bcell_con)) {
  208 + Matcher m = p.matcher(bcell_con.trim());
  209 + Matcher m2 = p2.matcher(bcell_con.trim());
  210 + if ((!m.matches()) && (!m2.matches())) {
  211 + rtn.put("status", ResponseCode.ERROR);
  212 + rtn.put("msg", String.format("第%d行,第%d列的发车时间格式不正确,格式应为hh:mm或hhmm", i + 1, j + 1));
  213 + return rtn;
  214 + }
  215 + }
  216 + }
  217 + }
  218 + }
  219 +
  220 + }
  221 +
  222 + rtn.put("status", ResponseCode.SUCCESS);
  223 + return rtn;
  224 + }
  225 +
  226 + /**
  227 + * 3、验证关联的线路标准信息(以后放到规则引擎里去做)。
  228 + * @param lineinfoid
  229 + * @return
  230 + */
  231 + @RequestMapping(value = "/validate/lineinfo", method = RequestMethod.GET)
  232 + public Map<String, Object> validateAssoLineInfo(Integer lineinfoid) {
  233 + Map<String, Object> rtn = new HashMap<>();
  234 + LineInformation lineInformation = lineInformationService.findById(lineinfoid);
  235 + if (lineInformation.getUpInMileage() == null) {
  236 + rtn.put("status", ResponseCode.ERROR);
  237 + rtn.put("msg", "上行进场里程为空");
  238 + return rtn;
  239 + } else if (lineInformation.getUpInTimer() == null) {
  240 + rtn.put("status", ResponseCode.ERROR);
  241 + rtn.put("msg", "上行进场时间为空");
  242 + return rtn;
  243 + } else if (lineInformation.getUpOutMileage() == null) {
  244 + rtn.put("status", ResponseCode.ERROR);
  245 + rtn.put("msg", "上行出场里程为空");
  246 + return rtn;
  247 + } else if (lineInformation.getUpOutTimer() == null) {
  248 + rtn.put("status", ResponseCode.ERROR);
  249 + rtn.put("msg", "上行出场时间为空");
  250 + return rtn;
  251 + } else if (lineInformation.getUpMileage() == null) {
  252 + rtn.put("status", ResponseCode.ERROR);
  253 + rtn.put("msg", "上行班次里程为空");
  254 + return rtn;
  255 + } else if (lineInformation.getUpTravelTime() == null) {
  256 + rtn.put("status", ResponseCode.ERROR);
  257 + rtn.put("msg", "上行班次时间为空");
  258 + return rtn;
  259 + } else if (lineInformation.getDownInMileage() == null) {
  260 + rtn.put("status", ResponseCode.ERROR);
  261 + rtn.put("msg", "下行进场里程为空");
  262 + return rtn;
  263 + } else if (lineInformation.getDownInTimer() == null) {
  264 + rtn.put("status", ResponseCode.ERROR);
  265 + rtn.put("msg", "下行进场时间为空");
  266 + return rtn;
  267 + } else if (lineInformation.getDownOutMileage() == null) {
  268 + rtn.put("status", ResponseCode.ERROR);
  269 + rtn.put("msg", "下行出场里程为空");
  270 + return rtn;
  271 + } else if (lineInformation.getDownOutTimer() == null) {
  272 + rtn.put("status", ResponseCode.ERROR);
  273 + rtn.put("msg", "下行出场时间为空");
  274 + return rtn;
  275 + } else if (lineInformation.getDownMileage() == null) {
  276 + rtn.put("status", ResponseCode.ERROR);
  277 + rtn.put("msg", "下行班次里程为空");
  278 + return rtn;
  279 + } else if (lineInformation.getDownTravelTime() == null) {
  280 + rtn.put("status", ResponseCode.ERROR);
  281 + rtn.put("msg", "下行班次时间为空");
  282 + return rtn;
  283 + } else if (StringUtils.isEmpty(lineInformation.getCarPark())) {
  284 + rtn.put("status", ResponseCode.ERROR);
  285 + rtn.put("msg", "停车场必须选择");
  286 + return rtn;
  287 + }
  288 +
  289 + // 单独验证停车场信息
  290 + String tcccode = lineInformation.getCarPark();
  291 + Map<String, Object> p1 = new HashMap<>();
  292 + p1.put("parkCode_eq", tcccode);
  293 + List<CarPark> carParkList = (List<CarPark>) carParkService.list(p1);
  294 + if (CollectionUtils.isEmpty(carParkList)) {
  295 + rtn.put("status", ResponseCode.ERROR);
  296 + rtn.put("msg", String.format("线路标准里的停车场code=%s,在停车场信息中未找到", tcccode));
  297 + return rtn;
  298 + } else if (carParkList.size() > 1) {
  299 + rtn.put("status", ResponseCode.ERROR);
  300 + rtn.put("msg", String.format("线路标准里的停车场code=%s,在停车场信息中有重复数据", tcccode));
  301 + return rtn;
  302 + } else {
  303 + CarPark carPark = carParkList.get(0);
  304 + if (StringUtils.isEmpty(carPark.getParkName())) {
  305 + rtn.put("status", ResponseCode.ERROR);
  306 + rtn.put("msg", String.format("线路标准里的停车场code=%s,在停车场信息中没有停车场名字", tcccode));
  307 + return rtn;
  308 + }
  309 + }
  310 +
  311 + rtn.put("status", ResponseCode.SUCCESS);
  312 + return rtn;
  313 + }
  314 +
  315 + /**
  316 + * 4、导入时刻表明细数据。
  317 + * @param form
  318 + * @return
  319 + */
  320 + @RequestMapping(value = "/importfile", method = RequestMethod.POST)
  321 + public Map<String, Object> importTTinfo(@RequestParam Map<String, Object> form) throws Exception {
  322 + Map<String, Object> rtn = new HashMap<>();
  323 +
  324 + // 1、修改已经上传的excel文件,在每个起点站后标示数字,表示第几个班次
  325 + // 2、由于格式问题,需要把内容都转换成字符串
  326 + String filename = (String) form.get("filename");
  327 + List<String> colList = new ArrayList<>();
  328 + Workbook workbook = Workbook.getWorkbook(new File(filename));
  329 + Sheet sheet = workbook.getSheet((String) form.get("sheetname"));
  330 + Cell[] cells = sheet.getRow(0);
  331 + for (int i = 0; i < cells.length; i++) {
  332 + if (i == 0) {
  333 + colList.add(cells[i].getContents().trim());
  334 + } else {
  335 + colList.add(cells[i].getContents() + i);
  336 + }
  337 + }
  338 +
  339 + WritableWorkbook writableWorkbook = Workbook.createWorkbook(new File(filename + "_temp.xls"), workbook);
  340 + WritableSheet sheet1 = writableWorkbook.getSheet((String) form.get("sheetname"));
  341 + for (int i = 0; i < sheet1.getColumns(); i++) { // 第一行数据
  342 + sheet1.addCell(new Label(i, 0, colList.get(i)));
  343 + }
  344 + for (int i = 1; i < sheet1.getRows(); i++) { // 第二行开始
  345 + Cell[] cells1 = sheet.getRow(i);
  346 + for (int j = 0; j < cells1.length; j++) {
  347 + sheet1.addCell(new Label(j, i, cells1[j].getContents()));
  348 + }
  349 + }
  350 + writableWorkbook.write();
  351 + writableWorkbook.close();
  352 +
  353 + // 2、删除原有数据
  354 + ttInfoDetailService.deleteByTtinfo(Long.valueOf(form.get("ttid").toString()));
  355 +
  356 + // 3、导入时刻表
  357 + // 获取停车场名字
  358 + LineInformation lineInformation = lineInformationService.findById(Integer.valueOf(form.get("lineinfo").toString()));
  359 + Map<String, Object> p1 = new HashMap<>();
  360 + p1.put("parkCode_eq", lineInformation.getCarPark());
  361 + List<CarPark> carParkList = (List<CarPark>) carParkService.list(p1);
  362 + String tccname = carParkList.get(0).getParkName();
  363 +
  364 + ttInfoDetailService.fileDataImport(
  365 + new File(filename + "_temp.xls"),
  366 + (String) form.get("xlname"),
  367 + (String) form.get("ttname"),
  368 + tccname
  369 + );
  370 +
  371 + return rtn;
  372 + }
36 373  
  374 + //------------- 旧版本 --------------//
37 375 @RequestMapping(value = "/dataImportExtend", method = RequestMethod.POST)
38 376 public Map<String, Object> uploadDataAndImport(
39 377 MultipartFile file, String xlmc, String ttinfoname) throws Exception {
... ...
src/main/java/com/bsth/repository/schedule/TTInfoDetailRepository.java
... ... @@ -7,8 +7,12 @@ import org.springframework.data.domain.Page;
7 7 import org.springframework.data.domain.Pageable;
8 8 import org.springframework.data.jpa.domain.Specification;
9 9 import org.springframework.data.jpa.repository.EntityGraph;
  10 +import org.springframework.data.jpa.repository.Modifying;
10 11 import org.springframework.data.jpa.repository.Query;
11 12 import org.springframework.stereotype.Repository;
  13 +import org.springframework.transaction.annotation.Isolation;
  14 +import org.springframework.transaction.annotation.Propagation;
  15 +import org.springframework.transaction.annotation.Transactional;
12 16  
13 17 import java.util.List;
14 18  
... ... @@ -38,4 +42,8 @@ public interface TTInfoDetailRepository extends BaseRepository&lt;TTInfoDetail, Lon
38 42 @Query(value = "select tt from TTInfoDetail tt where tt.xl.id = ?1 and tt.ttinfo.id = ?2 and tt.lp.id = ?3 order by tt.fcno asc")
39 43 List<TTInfoDetail> findBcdetails(Integer xlId, Long ttinfoId, Long lpId);
40 44  
  45 + @Modifying
  46 + @Query(value = "delete from TTInfoDetail t where t.ttinfo.id = ?1")
  47 + void deleteByTtinfo(Long ttinfoid);
  48 +
41 49 }
... ...
src/main/java/com/bsth/service/impl/BaseServiceImpl.java
... ... @@ -45,14 +45,9 @@ public class BaseServiceImpl&lt;T, ID extends Serializable&gt; implements BaseService&lt;
45 45 @Override
46 46 public Map<String, Object> save(T t) {
47 47 Map<String, Object> map = new HashMap<>();
48   - try{
49   - baseRepository.save(t);
50   - map.put("status", ResponseCode.SUCCESS);
51   - map.put("t", t);
52   - }catch(Exception e){
53   - map.put("status", ResponseCode.ERROR);
54   - logger.error("save erro.", e);
55   - }
  48 + baseRepository.save(t);
  49 + map.put("status", ResponseCode.SUCCESS);
  50 + map.put("t", t);
56 51 return map;
57 52 }
58 53  
... ...
src/main/java/com/bsth/service/schedule/TTInfoDetailService.java
... ... @@ -2,9 +2,141 @@ package com.bsth.service.schedule;
2 2  
3 3 import com.bsth.entity.schedule.TTInfoDetail;
4 4 import com.bsth.service.BaseService;
  5 +import org.apache.commons.lang3.StringUtils;
  6 +import org.springframework.web.multipart.MultipartFile;
  7 +
  8 +import java.io.File;
  9 +import java.util.ArrayList;
  10 +import java.util.List;
5 11  
6 12 /**
7 13 * Created by xu on 16/7/2.
8 14 */
9 15 public interface TTInfoDetailService extends BaseService<TTInfoDetail, Long> {
  16 +
  17 + void deleteByTtinfo(Long ttinfoid);
  18 +
  19 + /**
  20 + * 发车信息内部类。
  21 + */
  22 + public static class FcInfo {
  23 + /** 时刻明细id */
  24 + private Long ttdid;
  25 + /** 发车时间 */
  26 + private String fcsj;
  27 + /** 班次类型 */
  28 + private String bc_type;
  29 + /** 线路上下行 */
  30 + private String xldir;
  31 + /** 是偶分班 */
  32 + private Boolean isfb;
  33 +
  34 + public FcInfo() {
  35 + }
  36 +
  37 + public FcInfo(String ttdid_str, String bc_type, String fcsj, String xldir, String isfb) {
  38 + this.ttdid = StringUtils.isEmpty(ttdid_str) ? null : Long.valueOf(ttdid_str);
  39 + this.bc_type = bc_type;
  40 + this.fcsj = fcsj;
  41 + this.xldir = xldir;
  42 + if ("N".equals(isfb))
  43 + this.isfb = false;
  44 + else if ("Y".equals(isfb))
  45 + this.isfb = true;
  46 + else
  47 + this.isfb = false;
  48 +
  49 + }
  50 +
  51 + public Long getTtdid() {
  52 + return ttdid;
  53 + }
  54 +
  55 + public void setTtdid(Long ttdid) {
  56 + this.ttdid = ttdid;
  57 + }
  58 +
  59 + public String getFcsj() {
  60 + return fcsj;
  61 + }
  62 +
  63 + public void setFcsj(String fcsj) {
  64 + this.fcsj = fcsj;
  65 + }
  66 +
  67 + public String getBc_type() {
  68 + return bc_type;
  69 + }
  70 +
  71 + public void setBc_type(String bc_type) {
  72 + this.bc_type = bc_type;
  73 + }
  74 +
  75 + public String getXldir() {
  76 + return xldir;
  77 + }
  78 +
  79 + public void setXldir(String xldir) {
  80 + this.xldir = xldir;
  81 + }
  82 +
  83 + public Boolean getIsfb() {
  84 + return isfb;
  85 + }
  86 +
  87 + public void setIsfb(Boolean isfb) {
  88 + this.isfb = isfb;
  89 + }
  90 + }
  91 +
  92 + /**
  93 + * 时刻表编辑用的返回数据。
  94 + */
  95 + public static class EditInfo {
  96 + /** 标题数据 */
  97 + private List<String> header = new ArrayList<>();
  98 + /** 内容数据 */
  99 + private List<List<FcInfo>> contents = new ArrayList<>();
  100 +
  101 + public List<String> getHeader() {
  102 + return header;
  103 + }
  104 +
  105 + public void setHeader(List<String> header) {
  106 + this.header = header;
  107 + }
  108 +
  109 + public List<List<FcInfo>> getContents() {
  110 + return contents;
  111 + }
  112 +
  113 + public void setContents(List<List<FcInfo>> contents) {
  114 + this.contents = contents;
  115 + }
  116 + }
  117 +
  118 + /**
  119 + * 获取待编辑的数据。
  120 + * @param xlid 线路id
  121 + * @param ttid 时刻表id
  122 + * @return
  123 + */
  124 + EditInfo getEditInfo(Integer xlid, Long ttid) throws Exception;
  125 +
  126 + /**
  127 + * 上传并导入数据,和DataImportExportService的同名方法有差别。
  128 + * @param datafile form上传文件
  129 + * @param xlmc 线路名称
  130 + * @param ttinfoname 时刻表名字
  131 + * @param tccname 停车场名字
  132 + * @throws Exception
  133 + */
  134 + void fileDataImport(MultipartFile datafile,
  135 + String xlmc,
  136 + String ttinfoname,
  137 + String tccname) throws Exception;
  138 +
  139 + void fileDataImport(File file, String xlmc, String ttinfoname, String tccname) throws Exception;
  140 +
  141 +
10 142 }
... ...
src/main/java/com/bsth/service/schedule/TTInfoDetailServiceImpl.java
... ... @@ -14,6 +14,9 @@ import org.pentaho.di.trans.TransMeta;
14 14 import org.springframework.beans.factory.annotation.Autowired;
15 15 import org.springframework.boot.context.properties.EnableConfigurationProperties;
16 16 import org.springframework.stereotype.Service;
  17 +import org.springframework.transaction.annotation.Isolation;
  18 +import org.springframework.transaction.annotation.Propagation;
  19 +import org.springframework.transaction.annotation.Transactional;
17 20 import org.springframework.web.multipart.MultipartFile;
18 21  
19 22 import java.io.File;
... ... @@ -34,103 +37,10 @@ public class TTInfoDetailServiceImpl extends BaseServiceImpl&lt;TTInfoDetail, Long&gt;
34 37 @Autowired
35 38 private TTInfoDetailRepository ttInfoDetailRepository;
36 39  
37   - /**
38   - * 发车信息内部类。
39   - */
40   - public static class FcInfo {
41   - /** 时刻明细id */
42   - private Long ttdid;
43   - /** 发车时间 */
44   - private String fcsj;
45   - /** 班次类型 */
46   - private String bc_type;
47   - /** 线路上下行 */
48   - private String xldir;
49   - /** 是偶分班 */
50   - private Boolean isfb;
51   -
52   - public FcInfo() {
53   - }
54   -
55   - public FcInfo(String ttdid_str, String bc_type, String fcsj, String xldir, String isfb) {
56   - this.ttdid = StringUtils.isEmpty(ttdid_str) ? null : Long.valueOf(ttdid_str);
57   - this.bc_type = bc_type;
58   - this.fcsj = fcsj;
59   - this.xldir = xldir;
60   - if ("N".equals(isfb))
61   - this.isfb = false;
62   - else if ("Y".equals(isfb))
63   - this.isfb = true;
64   - else
65   - this.isfb = false;
66   -
67   - }
68   -
69   - public Long getTtdid() {
70   - return ttdid;
71   - }
72   -
73   - public void setTtdid(Long ttdid) {
74   - this.ttdid = ttdid;
75   - }
76   -
77   - public String getFcsj() {
78   - return fcsj;
79   - }
80   -
81   - public void setFcsj(String fcsj) {
82   - this.fcsj = fcsj;
83   - }
84   -
85   - public String getBc_type() {
86   - return bc_type;
87   - }
88   -
89   - public void setBc_type(String bc_type) {
90   - this.bc_type = bc_type;
91   - }
92   -
93   - public String getXldir() {
94   - return xldir;
95   - }
96   -
97   - public void setXldir(String xldir) {
98   - this.xldir = xldir;
99   - }
100   -
101   - public Boolean getIsfb() {
102   - return isfb;
103   - }
104   -
105   - public void setIsfb(Boolean isfb) {
106   - this.isfb = isfb;
107   - }
108   - }
109   -
110   - /**
111   - * 时刻表编辑用的返回数据。
112   - */
113   - public static class EditInfo {
114   - /** 标题数据 */
115   - private List<String> header = new ArrayList<>();
116   - /** 内容数据 */
117   - private List<List<FcInfo>> contents = new ArrayList<>();
118   -
119   - public List<String> getHeader() {
120   - return header;
121   - }
122   -
123   - public void setHeader(List<String> header) {
124   - this.header = header;
125   - }
126   -
127   - public List<List<FcInfo>> getContents() {
128   - return contents;
129   - }
130   -
131   - public void setContents(List<List<FcInfo>> contents) {
132   - this.contents = contents;
133   - }
  40 + @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED)
  41 + @Override
  42 + public void deleteByTtinfo(Long ttinfoid) {
  43 + ttInfoDetailRepository.deleteByTtinfo(ttinfoid);
134 44 }
135 45  
136 46 /**
... ... @@ -139,6 +49,7 @@ public class TTInfoDetailServiceImpl extends BaseServiceImpl&lt;TTInfoDetail, Long&gt;
139 49 * @param ttid 时刻表id
140 50 * @return
141 51 */
  52 + @Override
142 53 public EditInfo getEditInfo(Integer xlid, Long ttid) throws Exception {
143 54 // 1、使用ktr转换获取输出文件
144 55 // 1.1、获取转换用ktr
... ... @@ -215,9 +126,15 @@ public class TTInfoDetailServiceImpl extends BaseServiceImpl&lt;TTInfoDetail, Long&gt;
215 126 String xlmc,
216 127 String ttinfoname,
217 128 String tccname) throws Exception {
218   - // 1、上传数据文件
  129 + // 上传数据文件
219 130 File uploadFile = dataImportExportService.uploadFile(datafile);
  131 + fileDataImport(uploadFile, xlmc, ttinfoname, tccname);
220 132  
  133 + }
  134 +
  135 + @Override
  136 + public void fileDataImport(File uploadFile, String xlmc, String ttinfoname, String tccname) throws Exception {
  137 + // 1、上传数据文件
221 138 System.out.println("线路名称:" + xlmc);
222 139 System.out.println("时刻表名称:" + ttinfoname);
223 140 System.out.println("停车场名字:" + tccname);
... ...
src/main/java/com/bsth/service/schedule/TTInfoServiceImpl.java
... ... @@ -5,7 +5,6 @@ import com.bsth.entity.schedule.TTInfo;
5 5 import com.bsth.repository.schedule.TTInfoRepository;
6 6 import com.bsth.service.impl.BaseServiceImpl;
7 7 import org.springframework.beans.factory.annotation.Autowired;
8   -import org.springframework.dao.DataIntegrityViolationException;
9 8 import org.springframework.stereotype.Service;
10 9  
11 10 import javax.transaction.Transactional;
... ... @@ -21,19 +20,28 @@ public class TTInfoServiceImpl extends BaseServiceImpl&lt;TTInfo, Long&gt; implements
21 20 @Autowired
22 21 private TTInfoRepository ttInfoRepository;
23 22  
  23 + @Transactional
24 24 @Override
25 25 public Map<String, Object> delete(Long aLong) {
  26 + // 获取待作废的数据
26 27 TTInfo ttInfo = ttInfoRepository.findOne(aLong);
27   - ttInfo.setIsCancel(true);
  28 +
  29 + toogleIsCancel(ttInfo);
28 30  
29 31 Map<String, Object> map = new HashMap<>();
30   - try{
31   - ttInfoRepository.save(ttInfo);
32   - map.put("status", ResponseCode.SUCCESS);
33   - }catch(DataIntegrityViolationException de){
34   - map.put("status", ResponseCode.ERROR);
35   - map.put("msg", "“完整性约束”校验失败,请检查要删除的对象是否存在外键约束");
36   - }
  32 + map.put("status", ResponseCode.SUCCESS);
  33 +
37 34 return map;
38 35 }
  36 +
  37 +
  38 +
  39 + private void toogleIsCancel(TTInfo ttInfo) {
  40 + boolean isCancel = ttInfo.getIsCancel();
  41 + if (isCancel) {
  42 + ttInfo.setIsCancel(false);
  43 + } else {
  44 + ttInfo.setIsCancel(true);
  45 + }
  46 + }
39 47 }
... ...
src/main/resources/static/pages/scheduleApp/Gruntfile.js
... ... @@ -64,7 +64,8 @@ module.exports = function (grunt) {
64 64 },
65 65 src: [
66 66 'module/common/dts1/load/loadingWidget.js', // loading界面指令
67   - 'module/common/dts1/validation/remoteValidaton.js',// 服务端验证指令
  67 + 'module/common/dts1/validation/remoteValidation.js',// 服务端验证指令
  68 + 'module/common/dts1/validation/remoteValidationt2.js',// 服务端验证指令(时刻表专用)
68 69 'module/common/dts1/select/saSelect.js', // select整合指令1
69 70 'module/common/dts1/select/saSelect2.js', // select整合指令2
70 71 'module/common/dts1/select/saSelect3.js', // select整合指令3
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/list.html
... ... @@ -88,8 +88,8 @@
88 88 <td>
89 89 <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>-->
90 90 <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>-->
91   - <a ui-sref="busInfoManage_detail({id: info.id})" class="btn default blue-stripe btn-sm"> 详细 </a>
92   - <a ui-sref="busInfoManage_edit({id: info.id})" class="btn default blue-stripe btn-sm"> 修改 </a>
  91 + <a ui-sref="busInfoManage_detail({id: info.id})" class="btn btn-info btn-sm"> 详细 </a>
  92 + <a ui-sref="busInfoManage_edit({id: info.id})" class="btn btn-info btn-sm"> 修改 </a>
93 93 </td>
94 94 </tr>
95 95 </tbody>
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/list.html
... ... @@ -84,10 +84,10 @@
84 84 <td>
85 85 <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>-->
86 86 <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>-->
87   - <a ui-sref="deviceInfoManage_detail({id: info.id})" class="btn default blue-stripe btn-sm"> 详细 </a>
88   - <a ui-sref="deviceInfoManage_edit({id: info.id})" class="btn default blue-stripe btn-sm" ng-if="info.isCancel == '0'"> 修改 </a>
89   - <a ng-click="ctrl.toggleCde(info.id)" class="btn default blue-stripe btn-sm" ng-if="info.isCancel == '0'"> 作废 </a>
90   - <a ng-click="ctrl.toggleCde(info.id)" class="btn default blue-stripe btn-sm" ng-if="info.isCancel == '1'"> 撤销 </a>
  87 + <a ui-sref="deviceInfoManage_detail({id: info.id})" class="btn btn-info btn-sm"> 详细 </a>
  88 + <a ui-sref="deviceInfoManage_edit({id: info.id})" class="btn btn-info btn-sm" ng-if="info.isCancel == '0'"> 修改 </a>
  89 + <a ng-click="ctrl.toggleCde(info.id)" class="btn btn-danger btn-sm" ng-if="info.isCancel == '0'"> 作废 </a>
  90 + <a ng-click="ctrl.toggleCde(info.id)" class="btn btn-success btn-sm" ng-if="info.isCancel == '1'"> 撤销 </a>
91 91 </td>
92 92 </tr>
93 93 </tbody>
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/list.html
... ... @@ -94,8 +94,8 @@
94 94 <td>
95 95 <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>-->
96 96 <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>-->
97   - <a ui-sref="employeeInfoManage_detail({id: info.id})" class="btn default blue-stripe btn-sm"> 详细 </a>
98   - <a ui-sref="employeeInfoManage_edit({id: info.id})" class="btn default blue-stripe btn-sm"> 修改 </a>
  97 + <a ui-sref="employeeInfoManage_detail({id: info.id})" class="btn btn-info btn-sm"> 详细 </a>
  98 + <a ui-sref="employeeInfoManage_edit({id: info.id})" class="btn btn-info btn-sm"> 修改 </a>
99 99 </td>
100 100 </tr>
101 101 </tbody>
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts1/select/saSelect5.js
... ... @@ -333,6 +333,25 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
333 333 };
334 334  
335 335 /**
  336 + * 内部方法,读取本地动态数据源。
  337 + * @param ldata
  338 + */
  339 + scope[ctrlAs].$$internal_local_data = function(ldata) {
  340 + // 重新创建内部保存的数据
  341 + scope[ctrlAs].$$data_real = [];
  342 + // 重新创建内部ui-select显示用数据,默认取10条记录显示
  343 + scope[ctrlAs].$$data = [];
  344 +
  345 + // 本地动态数据直接显示,暂时不优化
  346 + for (var i = 0; i < ldata.length; i++) {
  347 + scope[ctrlAs].$$data_real.push(ldata[i]);
  348 + scope[ctrlAs].$$data.push(ldata[i]);
  349 + }
  350 +
  351 + scope[ctrlAs].$$internal_validate_model();
  352 + };
  353 +
  354 + /**
336 355 * 监控dsparams属性变化
337 356 */
338 357 attr.$observe("dsparams", function(value) {
... ... @@ -348,6 +367,8 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
348 367  
349 368 } else if (obj.type == 'ajax') {
350 369 scope[ctrlAs].$$internal_ajax_data(obj.atype, obj.param);
  370 + } else if (obj.type == 'local') {
  371 + scope[ctrlAs].$$internal_local_data(obj.ldata);
351 372 } else {
352 373 throw new Error("dsparams参数格式异常=" + obj);
353 374 }
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts1/upload/saFileupload.js 0 → 100644
src/main/resources/static/pages/scheduleApp/module/common/dts1/upload/saFileuploadTemplate.html 0 → 100644
  1 +<div class="input-group">
  2 + <input type="file" name="file" id="file"/>
  3 +
  4 + <input type="file" class="form-control" nv-file-select="" uploader="ctrl.uploader"/>
  5 + <span class="input-group-btn">
  6 + <button type="button" ng-click="ctrl.clearInputFile()" class="btn btn-default">
  7 + <span class="glyphicon glyphicon-trash"></span>
  8 + </button>
  9 + <button type="button" class="btn btn-success">
  10 + <span class="glyphicon glyphicon-upload"></span> 上传
  11 + </button>
  12 + </span>
  13 +
  14 +
  15 +
  16 +
  17 +</div>
0 18 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts1/validation/remoteValidaton.js renamed to src/main/resources/static/pages/scheduleApp/module/common/dts1/validation/remoteValidation.js
1 1 /**
2   - * remoteValidatio指令,远程数据验证验证,作为属性放在某个指令上,依赖与指令的ngModel。
  2 + * remoteValidation指令,远程数据验证验证,作为属性放在某个指令上,依赖与指令的ngModel。
3 3 * 属性如下:
4 4 * remotevtype(必须):验证类型(在service中有对应映射),如rvtype="xl"
5 5 * remotevparam(必须):后端判定查询参数,如rvparam={{ {'xl.id_eq': '123'} | json }}
... ...
src/main/resources/static/pages/scheduleApp/module/common/dts1/validation/remoteValidationt2.js 0 → 100644
  1 +/**
  2 + * remoteValidatiot2指令,远程数据验证验证,作为属性放在某个指令上,依赖与指令的ngModel(专门用于时刻表sheet验证)。
  3 + * 属性如下:
  4 + * remotevtype(必须):验证类型(在service中有对应映射),如rvtype="xl"
  5 + * remotevparam(必须):后端判定查询参数,如rvparam={{ {'xl.id_eq': '123'} | json }}
  6 + *
  7 + */
  8 +angular.module('ScheduleApp').directive('remoteValidationt2', [
  9 + '$$SearchInfoService_g',
  10 + function($$SearchInfoService_g) {
  11 + return {
  12 + restrict: "A", // 属性
  13 + require: "^ngModel", // 依赖所属指令的ngModel
  14 + compile: function(tElem, tAttrs) {
  15 + // 验证属性
  16 + if (!tAttrs["remotevtype"]) { // 验证类型
  17 + throw new Error("remotevtype属性必须填写");
  18 + } else if (!$$SearchInfoService_g.validate[tAttrs["remotevtype"]]) {
  19 + throw new Error(!tAttrs["remotevtype"] + "验证类型不存在");
  20 + }
  21 + if (!tAttrs["remotevparam"]) { // 查询参数
  22 + throw new Error("remotevparam属性必须填写");
  23 + }
  24 +
  25 + // 监听获取的数据
  26 + var $watch_rvtype = undefined;
  27 + var $watch_rvparam_obj = undefined;
  28 +
  29 + // 验证数据
  30 + var $$internal_validate = function(ngModelCtrl, scope) {
  31 + if ($watch_rvtype && $watch_rvparam_obj) {
  32 + // 获取查询参数模版
  33 + var paramTemplate = $$SearchInfoService_g.validate[$watch_rvtype].template;
  34 + if (!paramTemplate) {
  35 + throw new Error($watch_rvtype + "查询模版不存在");
  36 + }
  37 + // 判定如果参数对象不全,没有完全和模版参数里对应上,则不验证
  38 + var isParamAll = true;
  39 + for (var key in paramTemplate) {
  40 + if (!$watch_rvparam_obj[key]) {
  41 + isParamAll = false;
  42 + break;
  43 + }
  44 + }
  45 + if (!isParamAll) {
  46 + ngModelCtrl.$setValidity('remote', true);
  47 + } else { // 开始验证
  48 + $$SearchInfoService_g.validate[$watch_rvtype].remote.do(
  49 + $watch_rvparam_obj,
  50 + function(result) {
  51 + if (result.status == "SUCCESS") {
  52 + ngModelCtrl.$setValidity('remote', true);
  53 + } else {
  54 + ngModelCtrl.$setValidity('remote', false);
  55 + scope.ctrl.ttInfoDetailManageForForm.sheetvaliddesc = result.msg;
  56 + }
  57 + },
  58 + function(result) {
  59 + alert("出错拉");
  60 + ngModelCtrl.$setValidity('remote', true);
  61 + }
  62 + );
  63 + }
  64 + }
  65 + };
  66 +
  67 + return {
  68 + pre: function(scope, element, attr) {
  69 +
  70 + },
  71 +
  72 + post: function(scope, element, attr, ngModelCtrl) {
  73 + /**
  74 + * 监控验证类型属性变化。
  75 + */
  76 + attr.$observe("remotevtype", function(value) {
  77 + if (value && value != "") {
  78 + $watch_rvtype = value;
  79 + $$internal_validate(ngModelCtrl, scope);
  80 + }
  81 + });
  82 + /**
  83 + * 监控查询结果属性变化。
  84 + */
  85 + attr.$observe("remotevparam", function(value) {
  86 + if (value && value != "") {
  87 + //if (!ngModelCtrl.$dirty) { // 没有修改过模型数据,不验证
  88 + // return;
  89 + //}
  90 + $watch_rvparam_obj = JSON.parse(value);
  91 + $$internal_validate(ngModelCtrl, scope);
  92 + }
  93 + });
  94 + }
  95 + };
  96 + }
  97 + }
  98 + }
  99 +]);
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
... ... @@ -19,9 +19,9 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;loadingWidget&#39;, [&#39;requestNotificationCh
19 19 });
20 20 }
21 21 };
22   -}]);
  22 +}]);
23 23 /**
24   - * remoteValidatio指令,远程数据验证验证,作为属性放在某个指令上,依赖与指令的ngModel。
  24 + * remoteValidation指令,远程数据验证验证,作为属性放在某个指令上,依赖与指令的ngModel。
25 25 * 属性如下:
26 26 * remotevtype(必须):验证类型(在service中有对应映射),如rvtype="xl"
27 27 * remotevparam(必须):后端判定查询参数,如rvparam={{ {'xl.id_eq': '123'} | json }}
... ... @@ -117,7 +117,107 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidation&#39;, [
117 117 }
118 118 }
119 119 ]);
120   -
  120 +
  121 +/**
  122 + * remoteValidatiot2指令,远程数据验证验证,作为属性放在某个指令上,依赖与指令的ngModel(专门用于时刻表sheet验证)。
  123 + * 属性如下:
  124 + * remotevtype(必须):验证类型(在service中有对应映射),如rvtype="xl"
  125 + * remotevparam(必须):后端判定查询参数,如rvparam={{ {'xl.id_eq': '123'} | json }}
  126 + *
  127 + */
  128 +angular.module('ScheduleApp').directive('remoteValidationt2', [
  129 + '$$SearchInfoService_g',
  130 + function($$SearchInfoService_g) {
  131 + return {
  132 + restrict: "A", // 属性
  133 + require: "^ngModel", // 依赖所属指令的ngModel
  134 + compile: function(tElem, tAttrs) {
  135 + // 验证属性
  136 + if (!tAttrs["remotevtype"]) { // 验证类型
  137 + throw new Error("remotevtype属性必须填写");
  138 + } else if (!$$SearchInfoService_g.validate[tAttrs["remotevtype"]]) {
  139 + throw new Error(!tAttrs["remotevtype"] + "验证类型不存在");
  140 + }
  141 + if (!tAttrs["remotevparam"]) { // 查询参数
  142 + throw new Error("remotevparam属性必须填写");
  143 + }
  144 +
  145 + // 监听获取的数据
  146 + var $watch_rvtype = undefined;
  147 + var $watch_rvparam_obj = undefined;
  148 +
  149 + // 验证数据
  150 + var $$internal_validate = function(ngModelCtrl, scope) {
  151 + if ($watch_rvtype && $watch_rvparam_obj) {
  152 + // 获取查询参数模版
  153 + var paramTemplate = $$SearchInfoService_g.validate[$watch_rvtype].template;
  154 + if (!paramTemplate) {
  155 + throw new Error($watch_rvtype + "查询模版不存在");
  156 + }
  157 + // 判定如果参数对象不全,没有完全和模版参数里对应上,则不验证
  158 + var isParamAll = true;
  159 + for (var key in paramTemplate) {
  160 + if (!$watch_rvparam_obj[key]) {
  161 + isParamAll = false;
  162 + break;
  163 + }
  164 + }
  165 + if (!isParamAll) {
  166 + ngModelCtrl.$setValidity('remote', true);
  167 + } else { // 开始验证
  168 + $$SearchInfoService_g.validate[$watch_rvtype].remote.do(
  169 + $watch_rvparam_obj,
  170 + function(result) {
  171 + if (result.status == "SUCCESS") {
  172 + ngModelCtrl.$setValidity('remote', true);
  173 + } else {
  174 + ngModelCtrl.$setValidity('remote', false);
  175 + scope.ctrl.ttInfoDetailManageForForm.sheetvaliddesc = result.msg;
  176 + }
  177 + },
  178 + function(result) {
  179 + alert("出错拉");
  180 + ngModelCtrl.$setValidity('remote', true);
  181 + }
  182 + );
  183 + }
  184 + }
  185 + };
  186 +
  187 + return {
  188 + pre: function(scope, element, attr) {
  189 +
  190 + },
  191 +
  192 + post: function(scope, element, attr, ngModelCtrl) {
  193 + /**
  194 + * 监控验证类型属性变化。
  195 + */
  196 + attr.$observe("remotevtype", function(value) {
  197 + if (value && value != "") {
  198 + $watch_rvtype = value;
  199 + $$internal_validate(ngModelCtrl, scope);
  200 + }
  201 + });
  202 + /**
  203 + * 监控查询结果属性变化。
  204 + */
  205 + attr.$observe("remotevparam", function(value) {
  206 + if (value && value != "") {
  207 + //if (!ngModelCtrl.$dirty) { // 没有修改过模型数据,不验证
  208 + // return;
  209 + //}
  210 + $watch_rvparam_obj = JSON.parse(value);
  211 + $$internal_validate(ngModelCtrl, scope);
  212 + }
  213 + });
  214 + }
  215 + };
  216 + }
  217 + }
  218 + }
  219 +]);
  220 +
121 221  
122 222 angular.module('ScheduleApp').directive("saSelect", ['$timeout', function($timeout) {
123 223 return {
... ... @@ -230,7 +330,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&quot;saSelect&quot;, [&#39;$timeout&#39;, function($timeo
230 330 }
231 331 };
232 332 }]);
233   -
  333 +
234 334  
235 335  
236 336 angular.module('ScheduleApp').directive("saSelect2", [
... ... @@ -390,7 +490,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&quot;saSelect2&quot;, [
390 490 }
391 491 ]);
392 492  
393   -
  493 +
394 494  
395 495  
396 496  
... ... @@ -781,7 +881,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&quot;saSelect3&quot;, [
781 881 }
782 882 ]);
783 883  
784   -
  884 +
785 885 /**
786 886 * saSelect4指令,封装angular-ui-select控件,并添加相应的业务。
787 887 * name(必须):控件的名字
... ... @@ -1104,7 +1204,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect4&#39;, [
1104 1204  
1105 1205 };
1106 1206 }
1107   -]);
  1207 +]);
1108 1208 /**
1109 1209 * saSelect5指令,基于简拼查询的select,内部封装angular-ui-select控件,并嵌入相应的业务逻辑。
1110 1210 * name(必须):控件的名字
... ... @@ -1440,6 +1540,25 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
1440 1540 };
1441 1541  
1442 1542 /**
  1543 + * 内部方法,读取本地动态数据源。
  1544 + * @param ldata
  1545 + */
  1546 + scope[ctrlAs].$$internal_local_data = function(ldata) {
  1547 + // 重新创建内部保存的数据
  1548 + scope[ctrlAs].$$data_real = [];
  1549 + // 重新创建内部ui-select显示用数据,默认取10条记录显示
  1550 + scope[ctrlAs].$$data = [];
  1551 +
  1552 + // 本地动态数据直接显示,暂时不优化
  1553 + for (var i = 0; i < ldata.length; i++) {
  1554 + scope[ctrlAs].$$data_real.push(ldata[i]);
  1555 + scope[ctrlAs].$$data.push(ldata[i]);
  1556 + }
  1557 +
  1558 + scope[ctrlAs].$$internal_validate_model();
  1559 + };
  1560 +
  1561 + /**
1443 1562 * 监控dsparams属性变化
1444 1563 */
1445 1564 attr.$observe("dsparams", function(value) {
... ... @@ -1455,6 +1574,8 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
1455 1574  
1456 1575 } else if (obj.type == 'ajax') {
1457 1576 scope[ctrlAs].$$internal_ajax_data(obj.atype, obj.param);
  1577 + } else if (obj.type == 'local') {
  1578 + scope[ctrlAs].$$internal_local_data(obj.ldata);
1458 1579 } else {
1459 1580 throw new Error("dsparams参数格式异常=" + obj);
1460 1581 }
... ... @@ -1486,7 +1607,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
1486 1607 }
1487 1608 };
1488 1609 }
1489   -]);
  1610 +]);
1490 1611  
1491 1612 /**
1492 1613 * saRadiogroup指令
... ... @@ -1586,7 +1707,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&quot;saRadiogroup&quot;, [function() {
1586 1707 }
1587 1708 };
1588 1709 }]);
1589   -
  1710 +
1590 1711  
1591 1712  
1592 1713 /**
... ... @@ -1747,7 +1868,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saCheckboxgroup&#39;, [
1747 1868 }
1748 1869 ]);
1749 1870  
1750   -
  1871 +
1751 1872  
1752 1873  
1753 1874 /**
... ... @@ -1936,7 +2057,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saDategroup&#39;, [
1936 2057 }
1937 2058 ]);
1938 2059  
1939   -
  2060 +
1940 2061  
1941 2062  
1942 2063 /**
... ... @@ -2311,7 +2432,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saGuideboardgroup&#39;, [
2311 2432 }
2312 2433 ]);
2313 2434  
2314   -
  2435 +
2315 2436  
2316 2437  
2317 2438 /**
... ... @@ -2951,7 +3072,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saEmployeegroup&#39;, [
2951 3072 }
2952 3073 ]);
2953 3074  
2954   -
  3075 +
2955 3076 /**
2956 3077 * saBcgroup指令,用于套跑界面中,从指定线路,指定时刻表,指定路牌的班次列表中选择套跑班次。
2957 3078 * 属性如下:
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
1   -// 项目通用的全局service服务,供不同的controller使用,自定义指令不使用
2   -
3   -// 文件下载服务
4   -angular.module('ScheduleApp').factory('FileDownload_g', function() {
5   - return {
6   - downloadFile: function (data, mimeType, fileName) {
7   - var success = false;
8   - var blob = new Blob([data], { type: mimeType });
9   - try {
10   - if (navigator.msSaveBlob)
11   - navigator.msSaveBlob(blob, fileName);
12   - else {
13   - // Try using other saveBlob implementations, if available
14   - var saveBlob = navigator.webkitSaveBlob || navigator.mozSaveBlob || navigator.saveBlob;
15   - if (saveBlob === undefined) throw "Not supported";
16   - saveBlob(blob, fileName);
17   - }
18   - success = true;
19   - } catch (ex) {
20   - console.log("saveBlob method failed with the following exception:");
21   - console.log(ex);
22   - }
23   -
24   - if (!success) {
25   - // Get the blob url creator
26   - var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
27   - if (urlCreator) {
28   - // Try to use a download link
29   - var link = document.createElement('a');
30   - if ('download' in link) {
31   - // Try to simulate a click
32   - try {
33   - // Prepare a blob URL
34   - var url = urlCreator.createObjectURL(blob);
35   - link.setAttribute('href', url);
36   -
37   - // Set the download attribute (Supported in Chrome 14+ / Firefox 20+)
38   - link.setAttribute("download", fileName);
39   -
40   - // Simulate clicking the download link
41   - var event = document.createEvent('MouseEvents');
42   - event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
43   - link.dispatchEvent(event);
44   - success = true;
45   -
46   - } catch (ex) {
47   - console.log("Download link method with simulated click failed with the following exception:");
48   - console.log(ex);
49   - }
50   - }
51   -
52   - if (!success) {
53   - // Fallback to window.location method
54   - try {
55   - // Prepare a blob URL
56   - // Use application/octet-stream when using window.location to force download
57   - var url = urlCreator.createObjectURL(blob);
58   - window.location = url;
59   - console.log("Download link method with window.location succeeded");
60   - success = true;
61   - } catch (ex) {
62   - console.log("Download link method with window.location failed with the following exception:");
63   - console.log(ex);
64   - }
65   - }
66   - }
67   - }
68   -
69   - if (!success) {
70   - // Fallback to window.open method
71   - console.log("No methods worked for saving the arraybuffer, using last resort window.open");
72   - window.open("", '_blank', '');
73   - }
74   - }
75   - };
76   -});
77   -
78   -// 车辆信息service
79   -angular.module('ScheduleApp').factory('BusInfoManageService_g', ['$resource', function($resource) {
80   - return {
81   - rest: $resource(
82   - '/cars/:id',
83   - {order: 'carCode', direction: 'ASC', id: '@id_route'},
84   - {
85   - list: {
86   - method: 'GET',
87   - params: {
88   - page: 0
89   - }
90   - },
91   - get: {
92   - method: 'GET'
93   - },
94   - save: {
95   - method: 'POST'
96   - }
97   - }
98   - ),
99   - validate: $resource(
100   - '/cars/validate/:type',
101   - {},
102   - {
103   - insideCode: {
104   - method: 'GET'
105   - }
106   - }
107   - ),
108   - dataTools: $resource(
109   - '/cars/:type',
110   - {},
111   - {
112   - dataExport: {
113   - method: 'GET',
114   - responseType: "arraybuffer",
115   - params: {
116   - type: "dataExport"
117   - },
118   - transformResponse: function(data, headers){
119   - return {data : data};
120   - }
121   - }
122   - }
123   - )
124   - };
125   -}]);
126   -// 人员信息service
127   -angular.module('ScheduleApp').factory('EmployeeInfoManageService_g', ['$resource', function($resource) {
128   - return {
129   - rest : $resource(
130   - '/personnel/:id',
131   - {order: 'jobCode', direction: 'ASC', id: '@id_route'},
132   - {
133   - list: {
134   - method: 'GET',
135   - params: {
136   - page: 0
137   - }
138   - },
139   - get: {
140   - method: 'GET'
141   - },
142   - save: {
143   - method: 'POST'
144   - }
145   - }
146   - ),
147   - validate: $resource(
148   - '/personnel/validate/:type',
149   - {},
150   - {
151   - jobCode: {
152   - method: 'GET'
153   - }
154   - }
155   - ),
156   - dataTools: $resource(
157   - '/personnel/:type',
158   - {},
159   - {
160   - dataExport: {
161   - method: 'GET',
162   - responseType: "arraybuffer",
163   - params: {
164   - type: "dataExport"
165   - },
166   - transformResponse: function(data, headers){
167   - return {data : data};
168   - }
169   - }
170   - }
171   - )
172   - };
173   -}]);
174   -// 车辆设备信息service
175   -angular.module('ScheduleApp').factory('DeviceInfoManageService_g', ['$resource', function($resource) {
176   - return $resource(
177   - '/cde/:id',
178   - {order: 'xl,isCancel,cl,qyrq', direction: 'ASC,ASC,ASC,DESC', id: '@id_route'},
179   - {
180   - list: {
181   - method: 'GET',
182   - params: {
183   - page: 0
184   - }
185   - },
186   - get: {
187   - method: 'GET'
188   - },
189   - save: {
190   - method: 'POST'
191   - },
192   - delete: {
193   - method: 'DELETE'
194   - }
195   - }
196   - );
197   -}]);
198   -
199   -// 车辆配置service
200   -angular.module('ScheduleApp').factory('BusConfigService_g', ['$resource', function($resource) {
201   - return {
202   - rest : $resource(
203   - '/cci/:id',
204   - {order: 'xl.id,cl.insideCode,isCancel', direction: 'ASC', id: '@id_route'},
205   - {
206   - list: {
207   - method: 'GET',
208   - params: {
209   - page: 0
210   - }
211   - },
212   - get: {
213   - method: 'GET'
214   - },
215   - save: {
216   - method: 'POST'
217   - }
218   - }
219   - )
220   - };
221   -}]);
222   -
223   -// 人员配置service
224   -angular.module('ScheduleApp').factory('EmployeeConfigService_g', ['$resource', function($resource) {
225   - return {
226   - rest : $resource(
227   - '/eci/:id',
228   - {order: 'xl.id,isCancel,dbbmFormula', direction: 'ASC', id: '@id_route'},
229   - {
230   - list: {
231   - method: 'GET',
232   - params: {
233   - page: 0
234   - }
235   - },
236   - get: {
237   - method: 'GET'
238   - },
239   - save: {
240   - method: 'POST'
241   - },
242   - delete: {
243   - method: 'DELETE'
244   - }
245   - }
246   - ),
247   - validate: $resource( // TODO:
248   - '/personnel/validate/:type',
249   - {},
250   - {
251   - jobCode: {
252   - method: 'GET'
253   - }
254   - }
255   - )
256   - };
257   -}]);
258   -
259   -// 路牌管理service
260   -angular.module('ScheduleApp').factory('GuideboardManageService_g', ['$resource', function($resource) {
261   - return {
262   - rest: $resource(
263   - '/gic/:id',
264   - {order: 'createDate', direction: 'DESC', id: '@id_route'},
265   - {
266   - list: {
267   - method: 'GET',
268   - params: {
269   - page: 0
270   - }
271   - },
272   - get: {
273   - method: 'GET'
274   - },
275   - save: {
276   - method: 'POST'
277   - }
278   - }
279   - )
280   - };
281   -}]);
282   -
283   -// 排班管理service
284   -angular.module('ScheduleApp').factory('ScheduleRuleManageService_g', ['$resource', function($resource) {
285   - return {
286   - rest: $resource(
287   - '/sr1fc/:id',
288   - {order: 'createDate', direction: 'DESC', id: '@id_route'},
289   - {
290   - list: {
291   - method: 'GET',
292   - params: {
293   - page: 0
294   - }
295   - },
296   - get: {
297   - method: 'GET'
298   - },
299   - save: {
300   - method: 'POST'
301   - },
302   - delete: {
303   - method: 'DELETE'
304   - }
305   - }
306   - )
307   - };
308   -}]);
309   -
310   -// 套跑管理service
311   -angular.module('ScheduleApp').factory('rerunManageService_g', ['$resource', function($resource) {
312   - return {
313   - rest: $resource(
314   - 'rms/:id',
315   - {order: 'rerunXl.id,isCancel', direction: 'ASC', id: '@id_route'},
316   - {
317   - list: {
318   - method: 'GET',
319   - params: {
320   - page: 0
321   - }
322   - },
323   - get: {
324   - method: 'GET'
325   - },
326   - save: {
327   - method: 'POST'
328   - },
329   - delete: {
330   - method: 'DELETE'
331   - }
332   - }
333   - )
334   - };
335   -}]);
336   -
337   -// 时刻表管理service
338   -angular.module('ScheduleApp').factory('TimeTableManageService_g', ['$resource', function($resource) {
339   - return {
340   - rest: $resource(
341   - '/tic/:id',
342   - {order: 'createDate', direction: 'DESC', id: '@id_route'},
343   - {
344   - list: {
345   - method: 'GET',
346   - params: {
347   - page: 0,
348   - isCancel_eq: 'false'
349   - }
350   - },
351   - get: {
352   - method: 'GET'
353   - },
354   - save: {
355   - method: 'POST'
356   - },
357   - delete: {
358   - method: 'DELETE'
359   - }
360   - }
361   - ),
362   - validate: $resource(
363   - '/tic/validate/:type',
364   - {},
365   - {
366   - ttinfoname: {
367   - method: 'GET'
368   - }
369   - }
370   - )
371   - };
372   -}]);
373   -// 时刻表明细管理service
374   -angular.module('ScheduleApp').factory('TimeTableDetailManageService_g', ['$resource', function($resource) {
375   - return {
376   - rest: $resource(
377   - '/tidc/:id',
378   - {order: 'createDate', direction: 'DESC', id: '@id_route'},
379   - {
380   - get: {
381   - method: 'GET'
382   - },
383   - save: {
384   - method: 'POST'
385   - }
386   - }
387   - ),
388   - edit: $resource(
389   - '/tidc/edit/:xlid/:ttid',
390   - {},
391   - {
392   - list: {
393   - method: 'GET'
394   - }
395   - }
396   - ),
397   - bcdetails: $resource(
398   - '/tidc/bcdetail',
399   - {},
400   - {
401   - list: {
402   - method: 'GET',
403   - isArray: true
404   - }
405   - }
406   - )
407   - };
408   -}]);
409   -
410   -
411   -
412   -// 排班计划管理service
413   -angular.module('ScheduleApp').factory('SchedulePlanManageService_g', ['$resource', function($resource) {
414   - return {
415   - rest : $resource(
416   - '/spc/:id',
417   - {order: 'createDate', direction: 'DESC', id: '@id_route'},
418   - {
419   - list: {
420   - method: 'GET',
421   - params: {
422   - page: 0
423   - }
424   - },
425   - get: {
426   - method: 'GET'
427   - },
428   - save: {
429   - method: 'POST'
430   - },
431   - delete: {
432   - method: 'DELETE'
433   - }
434   - }
435   - ),
436   - tommorw: $resource(
437   - '/spc/tommorw',
438   - {},
439   - {
440   - list: {
441   - method: 'GET'
442   - }
443   - }
444   - )
445   - };
446   -}]);
447   -
448   -// 排班计划明细管理service
449   -angular.module('ScheduleApp').factory('SchedulePlanInfoManageService_g', ['$resource', function($resource) {
450   - return {
451   - rest : $resource(
452   - '/spic/:id',
453   - {order: 'scheduleDate,lp,fcno', direction: 'ASC', id: '@id_route'},
454   - {
455   - list: {
456   - method: 'GET',
457   - params: {
458   - page: 0
459   - }
460   - },
461   - get: {
462   - method: 'GET'
463   - },
464   - save: {
465   - method: 'POST'
466   - }
467   - }
468   - ),
469   - groupinfo : $resource(
470   - '/spic/groupinfos/:xlid/:sdate',
471   - {},
472   - {
473   - list: {
474   - method: 'GET',
475   - isArray: true
476   - }
477   - }
478   - ),
479   - updateGroupInfo : $resource(
480   - '/spic/groupinfos/update',
481   - {},
482   - {
483   - update: {
484   - method: 'POST'
485   - }
486   - }
487   - )
488   - };
489   -}]);
490   -
491   -// 线路运营统计service
492   -angular.module('ScheduleApp').factory('BusLineInfoStatService_g', ['$resource', function($resource) {
493   - return $resource(
494   - '/bic/:id',
495   - {order: 'createDate', direction: 'DESC', id: '@id_route'}, // TODO:以后需要根据属性对象的属性查询
496   - {
497   - list: {
498   - method: 'GET',
499   - params: {
500   - page: 0
501   - }
502   - }
503   - }
504   - );
505   -}]);
506   -
507   -
508   -
509   -
510   -/**
511   - * saSelect2指令,根据属性值,动态载入数据,然后支持拼音搜索,点击右边的按钮清除选择并重新载入数据。
512   - * 1、compile阶段使用的属性如下:
513   - * required:用于和表单验证连接,指定成required="true"才有效。
514   - * 2、link阶段使用的属性如下
515   - * model:关联的模型对象
516   - * name:表单验证时需要的名字
517   - * type:关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加
518   - * modelcolname1:关联的模型字段名字1(一般应该是编码字段)
519   - * modelcolname2:关联的模型字段名字2(一般应该是名字字段)
520   - * datacolname1;内部数据对应的字段名字1(与模型字段1对应)
521   - * datacolname2:内部数据对应的字段名字2(与模型字段2对应)
522   - * showcolname:下拉框显示的内部数据字段名(注意:不是模型数据字段名),TODO:以后考虑放动态表达式,并在compile阶段使用
523   - * placeholder:select placeholder字符串描述
524   - *
525   - * $$pyFilter,内部的filter指令,结合简拼音进行拼音过滤。
526   - * $$SearchInfoService_g,内部使用的数据服务
527   - */
528   -// saSelect2指令使用的内部信service
529   -angular.module('ScheduleApp').factory('$$SearchInfoService_g', ['$resource', function($resource) {
530   - return {
531   - xl: $resource(
532   - '/line/:type',
533   - {order: 'name', direction: 'ASC'},
534   - {
535   - list: {
536   - method: 'GET',
537   - isArray: true
538   - }
539   - }
540   - ),
541   - zd: $resource(
542   - '/stationroute/stations',
543   - {order: 'stationCode', direction: 'ASC'},
544   - {
545   - list: {
546   - method: 'GET',
547   - isArray: true
548   - }
549   - }
550   - ),
551   - tcc: $resource(
552   - '/carpark/:type',
553   - {order: 'parkCode', direction: 'ASC'},
554   - {
555   - list: {
556   - method: 'GET',
557   - isArray: true
558   - }
559   - }
560   - ),
561   - ry: $resource(
562   - '/personnel/:type',
563   - {order: 'personnelName', direction: 'ASC'},
564   - {
565   - list: {
566   - method: 'GET',
567   - isArray: true
568   - }
569   - }
570   - ),
571   - cl: $resource(
572   - '/cars/:type',
573   - {order: "insideCode", direction: 'ASC'},
574   - {
575   - list: {
576   - method: 'GET',
577   - isArray: true
578   - }
579   - }
580   - ),
581   - ttInfo: $resource(
582   - '/tic/:type',
583   - {order: "name", direction: 'ASC'},
584   - {
585   - list: {
586   - method: 'GET',
587   - isArray: true
588   - }
589   - }
590   - ),
591   - lpInfo: $resource(
592   - '/gic/ttlpnames',
593   - {order: "lpName", direction: 'ASC'},
594   - {
595   - list: {
596   - method: 'GET',
597   - isArray: true
598   - }
599   - }
600   - ),
601   - lpInfo2: $resource(
602   - '/gic/:type',
603   - {order: "lpName", direction: 'ASC'},
604   - {
605   - list: {
606   - method: 'GET',
607   - isArray: true
608   - }
609   - }
610   - ),
611   - cci: $resource(
612   - '/cci/cars',
613   - {},
614   - {
615   - list: {
616   - method: 'GET',
617   - isArray: true
618   - }
619   - }
620   -
621   - ),
622   - cci2: $resource(
623   - '/cci/:type',
624   - {},
625   - {
626   - list: {
627   - method: 'GET',
628   - isArray: true
629   - }
630   - }
631   - ),
632   - cci3: $resource(
633   - '/cci/cars2',
634   - {},
635   - {
636   - list: {
637   - method: 'GET',
638   - isArray: true
639   - }
640   - }
641   -
642   - ),
643   - eci: $resource(
644   - '/eci/jsy',
645   - {},
646   - {
647   - list: {
648   - method: 'GET',
649   - isArray: true
650   - }
651   - }
652   - ),
653   - eci2: $resource(
654   - '/eci/spy',
655   - {},
656   - {
657   - list: {
658   - method: 'GET',
659   - isArray: true
660   - }
661   - }
662   - ),
663   - eci3: $resource(
664   - '/eci/:type',
665   - {},
666   - {
667   - list: {
668   - method: 'GET',
669   - isArray: true
670   - }
671   - }
672   - ),
673   -
674   -
675   - validate: { // remoteValidation指令用到的resource
676   - cl1: { // 车辆自编号不能重复验证
677   - template: {'insideCode_eq': '-1'}, // 查询参数模版
678   - remote: $resource( // $resource封装对象
679   - '/cars/validate/equale',
680   - {},
681   - {
682   - do: {
683   - method: 'GET'
684   - }
685   - }
686   - )
687   - },
688   - cde1: { // 车辆设备启用日期验证
689   - template: {'qyrq': 0, 'xl': 1, 'cl': 1}, // 日期毫秒
690   - remote: $resource( // $resource封装对象
691   - '/cde//validate/qyrq',
692   - {},
693   - {
694   - do: {
695   - method: 'GET'
696   - }
697   - }
698   - )
699   - }
700   - }
701   -
702   - //validate: $resource(
703   - // '/cars/validate/:type',
704   - // {},
705   - // {
706   - // insideCode: {
707   - // method: 'GET'
708   - // }
709   - // }
710   - //)
711   -
712   -
713   -
714   - }
715   -}]);
716   -
717   -
718   -
  1 +// 项目通用的全局service服务,供不同的controller使用,自定义指令不使用
  2 +
  3 +// 文件下载服务
  4 +angular.module('ScheduleApp').factory('FileDownload_g', function() {
  5 + return {
  6 + downloadFile: function (data, mimeType, fileName) {
  7 + var success = false;
  8 + var blob = new Blob([data], { type: mimeType });
  9 + try {
  10 + if (navigator.msSaveBlob)
  11 + navigator.msSaveBlob(blob, fileName);
  12 + else {
  13 + // Try using other saveBlob implementations, if available
  14 + var saveBlob = navigator.webkitSaveBlob || navigator.mozSaveBlob || navigator.saveBlob;
  15 + if (saveBlob === undefined) throw "Not supported";
  16 + saveBlob(blob, fileName);
  17 + }
  18 + success = true;
  19 + } catch (ex) {
  20 + console.log("saveBlob method failed with the following exception:");
  21 + console.log(ex);
  22 + }
  23 +
  24 + if (!success) {
  25 + // Get the blob url creator
  26 + var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
  27 + if (urlCreator) {
  28 + // Try to use a download link
  29 + var link = document.createElement('a');
  30 + if ('download' in link) {
  31 + // Try to simulate a click
  32 + try {
  33 + // Prepare a blob URL
  34 + var url = urlCreator.createObjectURL(blob);
  35 + link.setAttribute('href', url);
  36 +
  37 + // Set the download attribute (Supported in Chrome 14+ / Firefox 20+)
  38 + link.setAttribute("download", fileName);
  39 +
  40 + // Simulate clicking the download link
  41 + var event = document.createEvent('MouseEvents');
  42 + event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
  43 + link.dispatchEvent(event);
  44 + success = true;
  45 +
  46 + } catch (ex) {
  47 + console.log("Download link method with simulated click failed with the following exception:");
  48 + console.log(ex);
  49 + }
  50 + }
  51 +
  52 + if (!success) {
  53 + // Fallback to window.location method
  54 + try {
  55 + // Prepare a blob URL
  56 + // Use application/octet-stream when using window.location to force download
  57 + var url = urlCreator.createObjectURL(blob);
  58 + window.location = url;
  59 + console.log("Download link method with window.location succeeded");
  60 + success = true;
  61 + } catch (ex) {
  62 + console.log("Download link method with window.location failed with the following exception:");
  63 + console.log(ex);
  64 + }
  65 + }
  66 + }
  67 + }
  68 +
  69 + if (!success) {
  70 + // Fallback to window.open method
  71 + console.log("No methods worked for saving the arraybuffer, using last resort window.open");
  72 + window.open("", '_blank', '');
  73 + }
  74 + }
  75 + };
  76 +});
  77 +
  78 +// 车辆信息service
  79 +angular.module('ScheduleApp').factory('BusInfoManageService_g', ['$resource', function($resource) {
  80 + return {
  81 + rest: $resource(
  82 + '/cars/:id',
  83 + {order: 'carCode', direction: 'ASC', id: '@id_route'},
  84 + {
  85 + list: {
  86 + method: 'GET',
  87 + params: {
  88 + page: 0
  89 + }
  90 + },
  91 + get: {
  92 + method: 'GET'
  93 + },
  94 + save: {
  95 + method: 'POST'
  96 + }
  97 + }
  98 + ),
  99 + validate: $resource(
  100 + '/cars/validate/:type',
  101 + {},
  102 + {
  103 + insideCode: {
  104 + method: 'GET'
  105 + }
  106 + }
  107 + ),
  108 + dataTools: $resource(
  109 + '/cars/:type',
  110 + {},
  111 + {
  112 + dataExport: {
  113 + method: 'GET',
  114 + responseType: "arraybuffer",
  115 + params: {
  116 + type: "dataExport"
  117 + },
  118 + transformResponse: function(data, headers){
  119 + return {data : data};
  120 + }
  121 + }
  122 + }
  123 + )
  124 + };
  125 +}]);
  126 +// 人员信息service
  127 +angular.module('ScheduleApp').factory('EmployeeInfoManageService_g', ['$resource', function($resource) {
  128 + return {
  129 + rest : $resource(
  130 + '/personnel/:id',
  131 + {order: 'jobCode', direction: 'ASC', id: '@id_route'},
  132 + {
  133 + list: {
  134 + method: 'GET',
  135 + params: {
  136 + page: 0
  137 + }
  138 + },
  139 + get: {
  140 + method: 'GET'
  141 + },
  142 + save: {
  143 + method: 'POST'
  144 + }
  145 + }
  146 + ),
  147 + validate: $resource(
  148 + '/personnel/validate/:type',
  149 + {},
  150 + {
  151 + jobCode: {
  152 + method: 'GET'
  153 + }
  154 + }
  155 + ),
  156 + dataTools: $resource(
  157 + '/personnel/:type',
  158 + {},
  159 + {
  160 + dataExport: {
  161 + method: 'GET',
  162 + responseType: "arraybuffer",
  163 + params: {
  164 + type: "dataExport"
  165 + },
  166 + transformResponse: function(data, headers){
  167 + return {data : data};
  168 + }
  169 + }
  170 + }
  171 + )
  172 + };
  173 +}]);
  174 +// 车辆设备信息service
  175 +angular.module('ScheduleApp').factory('DeviceInfoManageService_g', ['$resource', function($resource) {
  176 + return $resource(
  177 + '/cde/:id',
  178 + {order: 'xl,isCancel,cl,qyrq', direction: 'ASC,ASC,ASC,DESC', id: '@id_route'},
  179 + {
  180 + list: {
  181 + method: 'GET',
  182 + params: {
  183 + page: 0
  184 + }
  185 + },
  186 + get: {
  187 + method: 'GET'
  188 + },
  189 + save: {
  190 + method: 'POST'
  191 + },
  192 + delete: {
  193 + method: 'DELETE'
  194 + }
  195 + }
  196 + );
  197 +}]);
  198 +
  199 +// 车辆配置service
  200 +angular.module('ScheduleApp').factory('BusConfigService_g', ['$resource', function($resource) {
  201 + return {
  202 + rest : $resource(
  203 + '/cci/:id',
  204 + {order: 'xl.id,cl.insideCode,isCancel', direction: 'ASC', id: '@id_route'},
  205 + {
  206 + list: {
  207 + method: 'GET',
  208 + params: {
  209 + page: 0
  210 + }
  211 + },
  212 + get: {
  213 + method: 'GET'
  214 + },
  215 + save: {
  216 + method: 'POST'
  217 + }
  218 + }
  219 + )
  220 + };
  221 +}]);
  222 +
  223 +// 人员配置service
  224 +angular.module('ScheduleApp').factory('EmployeeConfigService_g', ['$resource', function($resource) {
  225 + return {
  226 + rest : $resource(
  227 + '/eci/:id',
  228 + {order: 'xl.id,isCancel,dbbmFormula', direction: 'ASC', id: '@id_route'},
  229 + {
  230 + list: {
  231 + method: 'GET',
  232 + params: {
  233 + page: 0
  234 + }
  235 + },
  236 + get: {
  237 + method: 'GET'
  238 + },
  239 + save: {
  240 + method: 'POST'
  241 + },
  242 + delete: {
  243 + method: 'DELETE'
  244 + }
  245 + }
  246 + ),
  247 + validate: $resource( // TODO:
  248 + '/personnel/validate/:type',
  249 + {},
  250 + {
  251 + jobCode: {
  252 + method: 'GET'
  253 + }
  254 + }
  255 + )
  256 + };
  257 +}]);
  258 +
  259 +// 路牌管理service
  260 +angular.module('ScheduleApp').factory('GuideboardManageService_g', ['$resource', function($resource) {
  261 + return {
  262 + rest: $resource(
  263 + '/gic/:id',
  264 + {order: 'createDate', direction: 'DESC', id: '@id_route'},
  265 + {
  266 + list: {
  267 + method: 'GET',
  268 + params: {
  269 + page: 0
  270 + }
  271 + },
  272 + get: {
  273 + method: 'GET'
  274 + },
  275 + save: {
  276 + method: 'POST'
  277 + }
  278 + }
  279 + )
  280 + };
  281 +}]);
  282 +
  283 +// 排班管理service
  284 +angular.module('ScheduleApp').factory('ScheduleRuleManageService_g', ['$resource', function($resource) {
  285 + return {
  286 + rest: $resource(
  287 + '/sr1fc/:id',
  288 + {order: 'createDate', direction: 'DESC', id: '@id_route'},
  289 + {
  290 + list: {
  291 + method: 'GET',
  292 + params: {
  293 + page: 0
  294 + }
  295 + },
  296 + get: {
  297 + method: 'GET'
  298 + },
  299 + save: {
  300 + method: 'POST'
  301 + },
  302 + delete: {
  303 + method: 'DELETE'
  304 + }
  305 + }
  306 + )
  307 + };
  308 +}]);
  309 +
  310 +// 套跑管理service
  311 +angular.module('ScheduleApp').factory('rerunManageService_g', ['$resource', function($resource) {
  312 + return {
  313 + rest: $resource(
  314 + 'rms/:id',
  315 + {order: 'rerunXl.id,isCancel', direction: 'ASC', id: '@id_route'},
  316 + {
  317 + list: {
  318 + method: 'GET',
  319 + params: {
  320 + page: 0
  321 + }
  322 + },
  323 + get: {
  324 + method: 'GET'
  325 + },
  326 + save: {
  327 + method: 'POST'
  328 + },
  329 + delete: {
  330 + method: 'DELETE'
  331 + }
  332 + }
  333 + )
  334 + };
  335 +}]);
  336 +
  337 +// 时刻表管理service
  338 +angular.module('ScheduleApp').factory('TimeTableManageService_g', ['$resource', function($resource) {
  339 + return {
  340 + rest: $resource(
  341 + '/tic/:id',
  342 + {order: 'xl,isCancel,isEnableDisTemplate,qyrq', direction: 'DESC,ASC,DESC,DESC', id: '@id'},
  343 + {
  344 + list: {
  345 + method: 'GET',
  346 + params: {
  347 + page: 0
  348 + }
  349 + }
  350 + }
  351 + )
  352 + };
  353 +}]);
  354 +// 时刻表明细管理service
  355 +angular.module('ScheduleApp').factory('TimeTableDetailManageService_g', ['$resource', function($resource) {
  356 + return {
  357 + rest: $resource(
  358 + '/tidc/:id',
  359 + {order: 'createDate', direction: 'DESC', id: '@id_route'},
  360 + {
  361 + get: {
  362 + method: 'GET'
  363 + },
  364 + save: {
  365 + method: 'POST'
  366 + }
  367 + }
  368 + ),
  369 + import: $resource(
  370 + '/tidc/importfile',
  371 + {},
  372 + {
  373 + do: {
  374 + method: 'POST',
  375 + headers: {
  376 + 'Content-Type': 'application/x-www-form-urlencoded'
  377 + },
  378 + transformRequest: function(obj) {
  379 + var str = [];
  380 + for (var p in obj) {
  381 + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  382 + }
  383 + return str.join("&");
  384 + }
  385 + }
  386 + }
  387 + ),
  388 + edit: $resource(
  389 + '/tidc/edit/:xlid/:ttid',
  390 + {},
  391 + {
  392 + list: {
  393 + method: 'GET'
  394 + }
  395 + }
  396 + ),
  397 + bcdetails: $resource(
  398 + '/tidc/bcdetail',
  399 + {},
  400 + {
  401 + list: {
  402 + method: 'GET',
  403 + isArray: true
  404 + }
  405 + }
  406 + )
  407 +
  408 + // TODO:导入数据
  409 + };
  410 +}]);
  411 +
  412 +
  413 +
  414 +// 排班计划管理service
  415 +angular.module('ScheduleApp').factory('SchedulePlanManageService_g', ['$resource', function($resource) {
  416 + return {
  417 + rest : $resource(
  418 + '/spc/:id',
  419 + {order: 'createDate', direction: 'DESC', id: '@id_route'},
  420 + {
  421 + list: {
  422 + method: 'GET',
  423 + params: {
  424 + page: 0
  425 + }
  426 + },
  427 + get: {
  428 + method: 'GET'
  429 + },
  430 + save: {
  431 + method: 'POST'
  432 + },
  433 + delete: {
  434 + method: 'DELETE'
  435 + }
  436 + }
  437 + ),
  438 + tommorw: $resource(
  439 + '/spc/tommorw',
  440 + {},
  441 + {
  442 + list: {
  443 + method: 'GET'
  444 + }
  445 + }
  446 + )
  447 + };
  448 +}]);
  449 +
  450 +// 排班计划明细管理service
  451 +angular.module('ScheduleApp').factory('SchedulePlanInfoManageService_g', ['$resource', function($resource) {
  452 + return {
  453 + rest : $resource(
  454 + '/spic/:id',
  455 + {order: 'scheduleDate,lp,fcno', direction: 'ASC', id: '@id_route'},
  456 + {
  457 + list: {
  458 + method: 'GET',
  459 + params: {
  460 + page: 0
  461 + }
  462 + },
  463 + get: {
  464 + method: 'GET'
  465 + },
  466 + save: {
  467 + method: 'POST'
  468 + }
  469 + }
  470 + ),
  471 + groupinfo : $resource(
  472 + '/spic/groupinfos/:xlid/:sdate',
  473 + {},
  474 + {
  475 + list: {
  476 + method: 'GET',
  477 + isArray: true
  478 + }
  479 + }
  480 + ),
  481 + updateGroupInfo : $resource(
  482 + '/spic/groupinfos/update',
  483 + {},
  484 + {
  485 + update: {
  486 + method: 'POST'
  487 + }
  488 + }
  489 + )
  490 + };
  491 +}]);
  492 +
  493 +// 线路运营统计service
  494 +angular.module('ScheduleApp').factory('BusLineInfoStatService_g', ['$resource', function($resource) {
  495 + return $resource(
  496 + '/bic/:id',
  497 + {order: 'createDate', direction: 'DESC', id: '@id_route'}, // TODO:以后需要根据属性对象的属性查询
  498 + {
  499 + list: {
  500 + method: 'GET',
  501 + params: {
  502 + page: 0
  503 + }
  504 + }
  505 + }
  506 + );
  507 +}]);
  508 +
  509 +
  510 +
  511 +
  512 +/**
  513 + * saSelect2指令,根据属性值,动态载入数据,然后支持拼音搜索,点击右边的按钮清除选择并重新载入数据。
  514 + * 1、compile阶段使用的属性如下:
  515 + * required:用于和表单验证连接,指定成required="true"才有效。
  516 + * 2、link阶段使用的属性如下
  517 + * model:关联的模型对象
  518 + * name:表单验证时需要的名字
  519 + * type:关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加
  520 + * modelcolname1:关联的模型字段名字1(一般应该是编码字段)
  521 + * modelcolname2:关联的模型字段名字2(一般应该是名字字段)
  522 + * datacolname1;内部数据对应的字段名字1(与模型字段1对应)
  523 + * datacolname2:内部数据对应的字段名字2(与模型字段2对应)
  524 + * showcolname:下拉框显示的内部数据字段名(注意:不是模型数据字段名),TODO:以后考虑放动态表达式,并在compile阶段使用
  525 + * placeholder:select placeholder字符串描述
  526 + *
  527 + * $$pyFilter,内部的filter指令,结合简拼音进行拼音过滤。
  528 + * $$SearchInfoService_g,内部使用的数据服务
  529 + */
  530 +// saSelect2指令使用的内部信service
  531 +angular.module('ScheduleApp').factory('$$SearchInfoService_g', ['$resource', function($resource) {
  532 + return {
  533 + xl: $resource(
  534 + '/line/:type',
  535 + {order: 'name', direction: 'ASC'},
  536 + {
  537 + list: {
  538 + method: 'GET',
  539 + isArray: true
  540 + }
  541 + }
  542 + ),
  543 + xlinfo: $resource(
  544 + '/lineInformation/:type',
  545 + {order: 'line.name', direction: 'ASC'},
  546 + {
  547 + list: {
  548 + method: 'GET',
  549 + isArray: true
  550 + }
  551 + }
  552 + ),
  553 + zd: $resource(
  554 + '/stationroute/stations',
  555 + {order: 'stationCode', direction: 'ASC'},
  556 + {
  557 + list: {
  558 + method: 'GET',
  559 + isArray: true
  560 + }
  561 + }
  562 + ),
  563 + tcc: $resource(
  564 + '/carpark/:type',
  565 + {order: 'parkCode', direction: 'ASC'},
  566 + {
  567 + list: {
  568 + method: 'GET',
  569 + isArray: true
  570 + }
  571 + }
  572 + ),
  573 + ry: $resource(
  574 + '/personnel/:type',
  575 + {order: 'personnelName', direction: 'ASC'},
  576 + {
  577 + list: {
  578 + method: 'GET',
  579 + isArray: true
  580 + }
  581 + }
  582 + ),
  583 + cl: $resource(
  584 + '/cars/:type',
  585 + {order: "insideCode", direction: 'ASC'},
  586 + {
  587 + list: {
  588 + method: 'GET',
  589 + isArray: true
  590 + }
  591 + }
  592 + ),
  593 + ttInfo: $resource(
  594 + '/tic/:type',
  595 + {order: "name", direction: 'ASC'},
  596 + {
  597 + list: {
  598 + method: 'GET',
  599 + isArray: true
  600 + }
  601 + }
  602 + ),
  603 + lpInfo: $resource(
  604 + '/gic/ttlpnames',
  605 + {order: "lpName", direction: 'ASC'},
  606 + {
  607 + list: {
  608 + method: 'GET',
  609 + isArray: true
  610 + }
  611 + }
  612 + ),
  613 + lpInfo2: $resource(
  614 + '/gic/:type',
  615 + {order: "lpName", direction: 'ASC'},
  616 + {
  617 + list: {
  618 + method: 'GET',
  619 + isArray: true
  620 + }
  621 + }
  622 + ),
  623 + cci: $resource(
  624 + '/cci/cars',
  625 + {},
  626 + {
  627 + list: {
  628 + method: 'GET',
  629 + isArray: true
  630 + }
  631 + }
  632 +
  633 + ),
  634 + cci2: $resource(
  635 + '/cci/:type',
  636 + {},
  637 + {
  638 + list: {
  639 + method: 'GET',
  640 + isArray: true
  641 + }
  642 + }
  643 + ),
  644 + cci3: $resource(
  645 + '/cci/cars2',
  646 + {},
  647 + {
  648 + list: {
  649 + method: 'GET',
  650 + isArray: true
  651 + }
  652 + }
  653 +
  654 + ),
  655 + eci: $resource(
  656 + '/eci/jsy',
  657 + {},
  658 + {
  659 + list: {
  660 + method: 'GET',
  661 + isArray: true
  662 + }
  663 + }
  664 + ),
  665 + eci2: $resource(
  666 + '/eci/spy',
  667 + {},
  668 + {
  669 + list: {
  670 + method: 'GET',
  671 + isArray: true
  672 + }
  673 + }
  674 + ),
  675 + eci3: $resource(
  676 + '/eci/:type',
  677 + {},
  678 + {
  679 + list: {
  680 + method: 'GET',
  681 + isArray: true
  682 + }
  683 + }
  684 + ),
  685 +
  686 +
  687 + validate: { // remoteValidation指令用到的resource
  688 + cl1: { // 车辆自编号不能重复验证
  689 + template: {'insideCode_eq': '-1'}, // 查询参数模版
  690 + remote: $resource( // $resource封装对象
  691 + '/cars/validate/equale',
  692 + {},
  693 + {
  694 + do: {
  695 + method: 'GET'
  696 + }
  697 + }
  698 + )
  699 + },
  700 + cde1: { // 车辆设备启用日期验证
  701 + template: {'qyrq': 0, 'xl': 1, 'cl': 1}, // 日期毫秒
  702 + remote: $resource( // $resource封装对象
  703 + '/cde//validate/qyrq',
  704 + {},
  705 + {
  706 + do: {
  707 + method: 'GET'
  708 + }
  709 + }
  710 + )
  711 + },
  712 + ttc1: { // 时刻表名字验证
  713 + template: {'xl.id_eq': -1, 'name_eq': 'ddd'},
  714 + remote: $resource( // $resource封装对象
  715 + '/tic/validate/equale',
  716 + {},
  717 + {
  718 + do: {
  719 + method: 'GET'
  720 + }
  721 + }
  722 + )
  723 + },
  724 + sheet: { // 时刻表sheet工作区验证
  725 + template: {'filename': '', 'sheetname': '', 'lineid': -1, 'linename': ''},
  726 + remote: $resource( // $resource封装对象
  727 + '/tidc/validate/sheet',
  728 + {},
  729 + {
  730 + do: {
  731 + method: 'POST',
  732 + headers: {
  733 + 'Content-Type': 'application/x-www-form-urlencoded'
  734 + },
  735 + transformRequest: function(obj) {
  736 + var str = [];
  737 + for (var p in obj) {
  738 + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  739 + }
  740 + return str.join("&");
  741 + }
  742 + }
  743 + }
  744 + )
  745 + },
  746 + sheetli: { // 时刻表线路标准验证
  747 + template: {'lineinfoid': -1},
  748 + remote: $resource( // $resource封装对象
  749 + '/tidc/validate/lineinfo',
  750 + {},
  751 + {
  752 + do: {
  753 + method: 'GET'
  754 + }
  755 + }
  756 + )
  757 + }
  758 + }
  759 +
  760 + //validate: $resource(
  761 + // '/cars/validate/:type',
  762 + // {},
  763 + // {
  764 + // insideCode: {
  765 + // method: 'GET'
  766 + // }
  767 + // }
  768 + //)
  769 +
  770 +
  771 +
  772 + }
  773 +}]);
  774 +
  775 +
  776 +
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-ui-route-state.js
... ... @@ -484,6 +484,8 @@ ScheduleApp.config([&#39;$stateProvider&#39;, &#39;$urlRouterProvider&#39;, function($stateProvi
484 484 name: 'timeTableManage_module',
485 485 insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
486 486 files: [
  487 + "assets/bower_components/angular-ui-select/dist/select.min.css",
  488 + "assets/bower_components/angular-ui-select/dist/select.min.js",
487 489 "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js",
488 490 "pages/scheduleApp/module/core/timeTableManage/timeTableManage.js"
489 491 ]
... ... @@ -583,6 +585,164 @@ ScheduleApp.config([&#39;$stateProvider&#39;, &#39;$urlRouterProvider&#39;, function($stateProvi
583 585 }
584 586 })
585 587  
  588 + // 时刻表管理(新版本)
  589 + .state("ttInfoManage", { // 时刻表基础信息界面
  590 + url: '/ttInfoManage',
  591 + views: {
  592 + "": {
  593 + templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/index.html'
  594 + },
  595 + "ttInfoManage_list@ttInfoManage": {
  596 + templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/list.html'
  597 + }
  598 + },
  599 +
  600 + resolve: {
  601 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  602 + return $ocLazyLoad.load({
  603 + name: 'ttInfoManage_module',
  604 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  605 + files: [
  606 + "assets/bower_components/angular-ui-select/dist/select.min.css",
  607 + "assets/bower_components/angular-ui-select/dist/select.min.js",
  608 + "pages/scheduleApp/module/core/ttInfoManage/main.js"
  609 + ]
  610 + });
  611 + }]
  612 + }
  613 + })
  614 + .state("ttInfoManage_form", {
  615 + url: '/ttInfoManage_form',
  616 + views: {
  617 + "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/form.html'}
  618 + },
  619 + resolve: {
  620 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  621 + return $ocLazyLoad.load({
  622 + name: 'ttInfoManage_form_module',
  623 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  624 + files: [
  625 + "assets/bower_components/angular-ui-select/dist/select.min.css",
  626 + "assets/bower_components/angular-ui-select/dist/select.min.js",
  627 + "pages/scheduleApp/module/core/ttInfoManage/main.js"
  628 + ]
  629 + });
  630 + }]
  631 + }
  632 + })
  633 + .state("ttInfoManage_edit", {
  634 + url: '/ttInfoManage_edit/:id',
  635 + views: {
  636 + "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/edit.html'}
  637 + },
  638 + resolve: {
  639 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  640 + return $ocLazyLoad.load({
  641 + name: 'ttInfoManage_edit_module',
  642 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  643 + files: [
  644 + "assets/bower_components/angular-ui-select/dist/select.min.css",
  645 + "assets/bower_components/angular-ui-select/dist/select.min.js",
  646 + "pages/scheduleApp/module/core/ttInfoManage/main.js"
  647 + ]
  648 + });
  649 + }]
  650 + }
  651 + })
  652 + .state("ttInfoManage_detail", {
  653 + url: '/ttInfoManage_detail/:id',
  654 + views: {
  655 + "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/detail.html'}
  656 + },
  657 + resolve: {
  658 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  659 + return $ocLazyLoad.load({
  660 + name: 'ttInfoManage_detail_module',
  661 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  662 + files: [
  663 + "pages/scheduleApp/module/core/ttInfoManage/main.js"
  664 + ]
  665 + });
  666 + }]
  667 + }
  668 + })
  669 + .state("ttInfoDetailManage_form", {
  670 + url: '/ttInfoDetailManage_form/:xlid/:ttid/:xlname/:ttname',
  671 + views: {
  672 + "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoDetailManage/form.html'}
  673 + },
  674 + resolve: {
  675 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  676 + return $ocLazyLoad.load({
  677 + name: 'ttInfoDetailManage_form_module',
  678 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  679 + files: [
  680 + "assets/bower_components/angular-ui-select/dist/select.min.css",
  681 + "assets/bower_components/angular-ui-select/dist/select.min.js",
  682 + "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js",
  683 + "pages/scheduleApp/module/core/ttInfoDetailManage/main.js"
  684 + ]
  685 + });
  686 + }]
  687 + }
  688 + })
  689 + .state("ttInfoDetailManage_edit", {
  690 + url: '/ttInfoDetailManage_edit/:xlid/:ttid/:xlname/:ttname',
  691 + views: {
  692 + "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoDetailManage/edit.html'}
  693 + },
  694 + resolve: {
  695 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  696 + return $ocLazyLoad.load({
  697 + name: 'ttInfoDetailManage_edit_module',
  698 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  699 + files: [
  700 + "pages/scheduleApp/module/core/ttInfoDetailManage/timeTableDetailManage_old.js"
  701 + ]
  702 + });
  703 + }]
  704 + }
  705 + })
  706 + .state("ttInfoDetailManage_detail_edit", {
  707 + url: '/ttInfoDetailManage_detail_edit/:id/:xlid/:ttid/:xlname/:ttname',
  708 + views: {
  709 + "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoDetailManage/edit-detail.html'}
  710 + },
  711 + resolve: {
  712 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  713 + return $ocLazyLoad.load({
  714 + name: 'ttInfoDetailManage_detail_edit_module',
  715 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  716 + files: [
  717 + "assets/bower_components/angular-ui-select/dist/select.min.css",
  718 + "assets/bower_components/angular-ui-select/dist/select.min.js",
  719 + "pages/scheduleApp/module/core/ttInfoDetailManage/timeTableDetailManage_old.js"
  720 + ]
  721 + });
  722 + }]
  723 + }
  724 + })
  725 +
  726 +
  727 +
  728 +
  729 +
  730 +
  731 +
  732 +
  733 +
  734 +
  735 +
  736 +
  737 +
  738 +
  739 +
  740 +
  741 +
  742 +
  743 +
  744 +
  745 +
586 746 // 排班规则管理模块
587 747 .state("scheduleRuleManage", {
588 748 url: '/scheduleRuleManage',
... ...
src/main/resources/static/pages/scheduleApp/module/core/busConfig/list.html
... ... @@ -69,10 +69,10 @@
69 69 <td>
70 70 <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>-->
71 71 <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>-->
72   - <a ui-sref="busConfig_detail({id: info.id})" class="btn default blue-stripe btn-sm"> 详细 </a>
73   - <a ui-sref="busConfig_edit({id: info.id})" class="btn default blue-stripe btn-sm" ng-if="info.isCancel == '0'"> 修改 </a>
74   - <a ng-click="ctrl.deleteEci(info.id)" class="btn default blue-stripe btn-sm" ng-if="info.isCancel == '0'"> 作废 </a>
75   - <a ng-click="ctrl.redoDeleteEci(info.id)" class="btn default blue-stripe btn-sm" ng-if="info.isCancel == '1'"> 撤销 </a>
  72 + <a ui-sref="busConfig_detail({id: info.id})" class="btn btn-info btn-sm"> 详细 </a>
  73 + <a ui-sref="busConfig_edit({id: info.id})" class="btn btn-info btn-sm" ng-if="info.isCancel == '0'"> 修改 </a>
  74 + <a ng-click="ctrl.deleteEci(info.id)" class="btn btn-danger btn-sm" ng-if="info.isCancel == '0'"> 作废 </a>
  75 + <a ng-click="ctrl.redoDeleteEci(info.id)" class="btn btn-success btn-sm" ng-if="info.isCancel == '1'"> 撤销 </a>
76 76 </td>
77 77 </tr>
78 78 </tbody>
... ...
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/list.html
... ... @@ -82,10 +82,10 @@
82 82 <td>
83 83 <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>-->
84 84 <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>-->
85   - <a ui-sref="employeeConfig_detail({id: info.id})" class="btn default blue-stripe btn-sm"> 详细 </a>
86   - <a ui-sref="employeeConfig_edit({id: info.id})" class="btn default blue-stripe btn-sm" ng-if="info.isCancel == '0'"> 修改 </a>
87   - <a ng-click="ctrl.deleteEci(info.id)" class="btn default blue-stripe btn-sm" ng-if="info.isCancel == '0'"> 作废 </a>
88   - <a ng-click="ctrl.redoDeleteEci(info.id)" class="btn default blue-stripe btn-sm" ng-if="info.isCancel == '1'"> 撤销 </a>
  85 + <a ui-sref="employeeConfig_detail({id: info.id})" class="btn btn-info btn-sm"> 详细 </a>
  86 + <a ui-sref="employeeConfig_edit({id: info.id})" class="btn btn-info btn-sm" ng-if="info.isCancel == '0'"> 修改 </a>
  87 + <a ng-click="ctrl.deleteEci(info.id)" class="btn btn-danger btn-sm" ng-if="info.isCancel == '0'"> 作废 </a>
  88 + <a ng-click="ctrl.redoDeleteEci(info.id)" class="btn btn-success btn-sm" ng-if="info.isCancel == '1'"> 撤销 </a>
89 89 </td>
90 90 </tr>
91 91 </tbody>
... ...
src/main/resources/static/pages/scheduleApp/module/core/rerunManage/list.html
... ... @@ -74,10 +74,10 @@
74 74 <td>
75 75 <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>-->
76 76 <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>-->
77   - <a ui-sref="rerunManage_detail({id : info.id})" class="btn default blue-stripe btn-sm"> 详细 </a>
78   - <a ui-sref="rerunManage_edit({id : info.id})" class="btn default blue-stripe btn-sm" ng-if="info.isCancel == '0'"> 修改 </a>
79   - <a ng-click="ctrl.toggleRerun(info.id)" class="btn default blue-stripe btn-sm" ng-if="info.isCancel == '0'"> 作废 </a>
80   - <a ng-click="ctrl.toggleRerun(info.id)" class="btn default blue-stripe btn-sm" ng-if="info.isCancel == '1'"> 撤销 </a>
  77 + <a ui-sref="rerunManage_detail({id : info.id})" class="btn btn-info btn-sm"> 详细 </a>
  78 + <a ui-sref="rerunManage_edit({id : info.id})" class="btn btn-info btn-sm" ng-if="info.isCancel == '0'"> 修改 </a>
  79 + <a ng-click="ctrl.toggleRerun(info.id)" class="btn btn-danger btn-sm" ng-if="info.isCancel == '0'"> 作废 </a>
  80 + <a ng-click="ctrl.toggleRerun(info.id)" class="btn btn-success btn-sm" ng-if="info.isCancel == '1'"> 撤销 </a>
81 81 </td>
82 82 </tr>
83 83 </tbody>
... ...
src/main/resources/static/pages/scheduleApp/module/core/timeTableManage/edit.html
1 1 <div class="page-head">
2 2 <div class="page-title">
3   - <h1>修改时刻表基础信息</h1>
  3 + <h1>添加时刻表基础信息</h1>
4 4 </div>
5 5 </div>
6 6  
... ... @@ -43,17 +43,18 @@
43 43 <div class="form-group has-success has-feedback">
44 44 <label class="col-md-2 control-label">线路*:</label>
45 45 <div class="col-md-3">
46   - <sa-Select3 model="ctrl.timeTableManageForForm"
47   - name="xl"
48   - placeholder="请输拼音..."
49   - dcvalue="{{ctrl.timeTableManageForForm.xl.id}}"
  46 + <sa-Select5 name="xl"
  47 + model="ctrl.timeTableManageForForm"
  48 + cmaps="{'xl.id' : 'id'}"
50 49 dcname="xl.id"
51 50 icname="id"
52   - icnames="name"
53   - datatype="xl"
54   - mlp="true"
  51 + dsparams="{{ {type: 'ajax', param:{type: 'all'}, atype:'xl' } | json }}"
  52 + iterobjname="item"
  53 + iterobjexp="item.name"
  54 + searchph="请输拼音..."
  55 + searchexp="this.name"
55 56 required >
56   - </sa-Select3>
  57 + </sa-Select5>
57 58 </div>
58 59 <!-- 隐藏块,显示验证信息 -->
59 60 <div class="alert alert-danger well-sm" ng-show="myForm.xl.$error.required">
... ... @@ -76,8 +77,10 @@
76 77 <label class="col-md-2 control-label">时刻表名字*:</label>
77 78 <div class="col-md-3">
78 79 <input type="text" class="form-control" ng-model="ctrl.timeTableManageForForm.name"
79   - name="name" placeholder="请输入时刻表名字" required
80   - remote-Validaton rvtype="ttinfoname" rv1="{{ctrl.timeTableManageForForm.xl.id}}"
  80 + name="name" placeholder="请输入时刻表名字..." required
  81 + remote-Validation
  82 + remotevtype="ttc1"
  83 + remotevparam="{{ {'xl.id_eq': ctrl.timeTableManageForForm.xl.id, 'name_eq': ctrl.timeTableManageForForm.name} | json}}"
81 84 />
82 85 </div>
83 86  
... ... @@ -86,7 +89,7 @@
86 89 时刻表名字必须填写
87 90 </div>
88 91 <div class="alert alert-danger well-sm" ng-show="myForm.name.$error.remote">
89   - 选择线路并且相同相同线路时刻表名字不能重复
  92 + 相同线路下的时刻表不能同名
90 93 </div>
91 94 </div>
92 95  
... ... @@ -130,7 +133,7 @@
130 133 <label class="col-md-2 control-label">路牌数量:</label>
131 134 <div class="col-md-3">
132 135 <input type="number" class="form-control" ng-model="ctrl.timeTableManageForForm.lpCount"
133   - name="lpCount" placeholder="请输入路牌数" min="1"/>
  136 + name="lpCount" placeholder="请输入路牌数..." min="1"/>
134 137 </div>
135 138 <div class="alert alert-danger well-sm" ng-show="myForm.lpCount.$error.number">
136 139 必须输入数字
... ... @@ -144,7 +147,7 @@
144 147 <label class="col-md-2 control-label">营运圈数:</label>
145 148 <div class="col-md-3">
146 149 <input type="number" class="form-control" ng-model="ctrl.timeTableManageForForm.loopCount"
147   - name="loopCount" placeholder="请输入圈数" min="1"/>
  150 + name="loopCount" placeholder="请输入圈数..." min="1"/>
148 151 </div>
149 152 <div class="alert alert-danger well-sm" ng-show="myForm.loopCount.$error.number">
150 153 必须输入数字
... ... @@ -158,10 +161,10 @@
158 161 <label class="col-md-2 control-label">常规有效日:</label>
159 162 <div class="col-md-6">
160 163 <sa-Checkboxgroup model="ctrl.timeTableManageForForm"
161   - name="rule_days"
162   - dcvalue="{{ctrl.timeTableManageForForm.rule_days}}"
163   - dcname="rule_days"
164   - required >
  164 + name="rule_days"
  165 + dcvalue="{{ctrl.timeTableManageForForm.rule_days}}"
  166 + dcname="rule_days"
  167 + required >
165 168 </sa-Checkboxgroup>
166 169 </div>
167 170 <div class="alert alert-danger well-sm" ng-show="myForm.rule_days.$error.required">
... ... @@ -173,10 +176,10 @@
173 176 <label class="col-md-2 control-label">特殊有效日:</label>
174 177 <div class="col-md-6">
175 178 <sa-Dategroup model="ctrl.timeTableManageForForm"
176   - name="special_days"
177   - dcvalue="{{ctrl.timeTableManageForForm.special_days}}"
178   - dcname="special_days"
179   - >
  179 + name="special_days"
  180 + dcvalue="{{ctrl.timeTableManageForForm.special_days}}"
  181 + dcname="special_days"
  182 + >
180 183 </sa-Dategroup>
181 184 </div>
182 185 <div class="alert alert-danger well-sm" ng-show="myForm.special_days.$error.required">
... ...
src/main/resources/static/pages/scheduleApp/module/core/timeTableManage/form.html
... ... @@ -43,17 +43,18 @@
43 43 <div class="form-group has-success has-feedback">
44 44 <label class="col-md-2 control-label">线路*:</label>
45 45 <div class="col-md-3">
46   - <sa-Select3 model="ctrl.timeTableManageForForm"
47   - name="xl"
48   - placeholder="请输拼音..."
49   - dcvalue="{{ctrl.timeTableManageForForm.xl.id}}"
  46 + <sa-Select5 name="xl"
  47 + model="ctrl.timeTableManageForForm"
  48 + cmaps="{'xl.id' : 'id'}"
50 49 dcname="xl.id"
51 50 icname="id"
52   - icnames="name"
53   - datatype="xl"
54   - mlp="true"
  51 + dsparams="{{ {type: 'ajax', param:{type: 'all'}, atype:'xl' } | json }}"
  52 + iterobjname="item"
  53 + iterobjexp="item.name"
  54 + searchph="请输拼音..."
  55 + searchexp="this.name"
55 56 required >
56   - </sa-Select3>
  57 + </sa-Select5>
57 58 </div>
58 59 <!-- 隐藏块,显示验证信息 -->
59 60 <div class="alert alert-danger well-sm" ng-show="myForm.xl.$error.required">
... ... @@ -76,8 +77,10 @@
76 77 <label class="col-md-2 control-label">时刻表名字*:</label>
77 78 <div class="col-md-3">
78 79 <input type="text" class="form-control" ng-model="ctrl.timeTableManageForForm.name"
79   - name="name" placeholder="请输入时刻表名字" required
80   - remote-Validaton rvtype="ttinfoname" rv1="{{ctrl.timeTableManageForForm.xl.id}}"
  80 + name="name" placeholder="请输入时刻表名字..." required
  81 + remote-Validation
  82 + remotevtype="ttc1"
  83 + remotevparam="{{ {'xl.id_eq': ctrl.timeTableManageForForm.xl.id, 'name_eq': ctrl.timeTableManageForForm.name} | json}}"
81 84 />
82 85 </div>
83 86  
... ... @@ -86,7 +89,7 @@
86 89 时刻表名字必须填写
87 90 </div>
88 91 <div class="alert alert-danger well-sm" ng-show="myForm.name.$error.remote">
89   - 选择线路并且相同相同线路时刻表名字不能重复
  92 + 相同线路下的时刻表不能同名
90 93 </div>
91 94 </div>
92 95  
... ... @@ -130,7 +133,7 @@
130 133 <label class="col-md-2 control-label">路牌数量:</label>
131 134 <div class="col-md-3">
132 135 <input type="number" class="form-control" ng-model="ctrl.timeTableManageForForm.lpCount"
133   - name="lpCount" placeholder="请输入路牌数" min="1"/>
  136 + name="lpCount" placeholder="请输入路牌数..." min="1"/>
134 137 </div>
135 138 <div class="alert alert-danger well-sm" ng-show="myForm.lpCount.$error.number">
136 139 必须输入数字
... ... @@ -144,7 +147,7 @@
144 147 <label class="col-md-2 control-label">营运圈数:</label>
145 148 <div class="col-md-3">
146 149 <input type="number" class="form-control" ng-model="ctrl.timeTableManageForForm.loopCount"
147   - name="loopCount" placeholder="请输入圈数" min="1"/>
  150 + name="loopCount" placeholder="请输入圈数..." min="1"/>
148 151 </div>
149 152 <div class="alert alert-danger well-sm" ng-show="myForm.loopCount.$error.number">
150 153 必须输入数字
... ...
src/main/resources/static/pages/scheduleApp/module/core/timeTableManage/index.html
... ... @@ -39,18 +39,6 @@
39 39 <i class="fa fa-angle-down"></i>
40 40 </a>
41 41 <ul class="dropdown-menu pull-right">
42   - <li>
43   - <a href="javascript:" class="tool-action" ng-click="ctrl.importData()">
44   - <i class="fa fa-file-excel-o"></i>
45   - 导入excel
46   - </a>
47   - </li>
48   - <li>
49   - <a href="javascript:" class="tool-action">
50   - <i class="fa fa-file-excel-o"></i>
51   - 导出excel
52   - </a>
53   - </li>
54 42 <li class="divider"></li>
55 43 <li>
56 44 <a href="javascript:" class="tool-action">
... ...
src/main/resources/static/pages/scheduleApp/module/core/timeTableManage/list.html
... ... @@ -4,24 +4,32 @@
4 4 <table class="fixTable table table-striped table-bordered table-hover table-checkable order-column">
5 5 <thead>
6 6 <tr role="row" class="heading">
7   - <th style="width: 5%;">序号</th>
8   - <th style="width: 8%;">线路</th>
9   - <th >名称</th>
10   - <th>路牌数</th>
11   - <th>圈数</th>
12   - <th>上下行</th>
13   - <th>启用</th>
14   - <th style="width: 10%">启用日期</th>
15   - <th style="width: 25%">时刻表明细</th>
16   - <th style="width: 21%">操作</th>
  7 + <th style="width: 50px;">序号</th>
  8 + <th style="width: 150px;">线路</th>
  9 + <th style="width: 180px;">时刻表名称</th>
  10 + <th style="width: 100px">路牌数/圈数</th>
  11 + <th style="width: 80px">上下行</th>
  12 + <th style="width: 50px;">启用</th>
  13 + <th style="width: 120px">启用日期</th>
  14 + <th style="width: 50%">时刻表明细</th>
  15 + <th style="width: 50%">操作</th>
17 16 </tr>
18 17 <tr role="row" class="filter">
19 18 <td></td>
20   - <td></td>
21 19 <td>
22   - <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition().name_like"/>
  20 + <sa-Select3 model="ctrl.searchCondition()"
  21 + name="xl"
  22 + placeholder="请输拼音..."
  23 + dcvalue="{{ctrl.searchCondition()['xl.id_eq']}}"
  24 + dcname="xl.id_eq"
  25 + icname="id"
  26 + icnames="name"
  27 + datatype="xl">
  28 + </sa-Select3>
  29 + </td>
  30 + <td>
  31 + <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition().name_like" placeholder="输入时刻表名称..."/>
23 32 </td>
24   - <td></td>
25 33 <td></td>
26 34 <td></td>
27 35 <td></td>
... ... @@ -40,7 +48,7 @@
40 48  
41 49 </thead>
42 50 <tbody>
43   - <tr ng-repeat="info in ctrl.pageInfo.infos" class="odd gradeX">
  51 + <tr ng-repeat="info in ctrl.pageInfo.infos" ng-class="{odd: true, gradeX: true, danger: info.isCancel}">
44 52 <td>
45 53 <span ng-bind="$index + 1"></span>
46 54 </td>
... ... @@ -48,12 +56,11 @@
48 56 <span ng-bind="info.xl.name"></span>
49 57 </td>
50 58 <td>
51   - <span ng-bind="info.name"></span>
  59 + <span ng-bind="info.name" title="{{info.name}}"></span>
52 60 </td>
53 61 <td>
54 62 <span ng-bind="info.lpCount"></span>
55   - </td>
56   - <td>
  63 + /
57 64 <span ng-bind="info.loopCount"></span>
58 65 </td>
59 66 <td>
... ... @@ -67,17 +74,17 @@
67 74 </td>
68 75 <td>
69 76 <a ui-sref="timeTableDetailInfoManage({xlid: info.xl.id, ttid : info.id, xlname: info.xl.name, ttname : info.name})"
70   - class="btn default blue-stripe btn-sm"> 编辑 </a>
71   - <a ng-click="ctrl.importData($index)" class="btn default blue-stripe btn-sm"> 导入 </a>
72   - <a href="javascript:" class="btn default blue-stripe btn-sm"> 导出 </a>
73   - <a href="javascript:" class="btn default blue-stripe btn-sm"> 清空 </a>
  77 + class="btn btn-info btn-sm" ng-if="info.isCancel == '0'"> 编辑 </a>
  78 + <a ng-click="ctrl.importData($index)" class="btn btn-info btn-sm" ng-if="info.isCancel == '0'"> 导入 </a>
  79 + <a href="javascript:" class="btn btn-info btn-sm"> 导出 </a>
74 80 </td>
75 81 <td>
76 82 <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>-->
77 83 <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>-->
78   - <a ui-sref="timeTableManage_detail({id: info.id})" class="btn default blue-stripe btn-sm"> 详细 </a>
79   - <a ui-sref="timeTableManage_edit({id: info.id})" class="btn default blue-stripe btn-sm"> 修改 </a>
80   - <a ng-click="ctrl.deleteTTinfo(info.id)" class="btn default blue-stripe btn-sm"> 作废 </a>
  84 + <a ui-sref="timeTableManage_detail({id: info.id})" class="btn btn-info btn-sm"> 详细 </a>
  85 + <a ui-sref="timeTableManage_edit({id: info.id})" class="btn btn-info btn-sm" ng-if="info.isCancel == '0'"> 修改 </a>
  86 + <a ng-click="ctrl.toggleTtinfo(info.id)" class="btn btn-danger btn-sm" ng-if="info.isCancel == '0'"> 作废 </a>
  87 + <a ng-click="ctrl.toggleTtinfo(info.id)" class="btn btn-success btn-sm" ng-if="info.isCancel == '1'"> 撤销 </a>
81 88 </td>
82 89 </tr>
83 90 </tbody>
... ...
src/main/resources/static/pages/scheduleApp/module/core/timeTableManage/timeTableManage.js
... ... @@ -187,30 +187,37 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;TimeTableManageListCtrl&#39;, [&#39;TimeTableM
187 187 };
188 188 // 重置查询条件
189 189 self.resetSearchCondition = function() {
190   - return timeTableManageService.resetSearchCondition();
  190 + timeTableManageService.resetSearchCondition();
  191 + self.pageInfo.currentPage = 1;
  192 + self.pageChanaged();
191 193 };
192 194  
193   - // 删除时刻表
194   - self.deleteTTinfo = function(id) {
  195 + // 作废/撤销
  196 + self.toggleTtinfo = function(id) {
195 197 // TODO:
196 198 timeTableManageService.deleteDetail(id).then(
197 199 function(result) {
198   - alert("作废成功!");
199   -
200   - timeTableManageService.getPage().then(
201   - function(result) {
202   - self.pageInfo.totalItems = result.totalElements;
203   - self.pageInfo.currentPage = result.number + 1;
204   - self.pageInfo.infos = result.content;
205   - timeTableManageService.setCurrentPageNo(result.number + 1);
206   - },
207   - function(result) {
208   - alert("出错啦!");
209   - }
210   - );
  200 + if (result.message) { // 暂时这样做,之后全局拦截
  201 + alert("失败:" + result.message);
  202 + } else {
  203 + alert("成功!");
  204 +
  205 + timeTableManageService.getPage().then(
  206 + function(result) {
  207 + self.pageInfo.totalItems = result.totalElements;
  208 + self.pageInfo.currentPage = result.number + 1;
  209 + self.pageInfo.infos = result.content;
  210 + timeTableManageService.setCurrentPageNo(result.number + 1);
  211 + },
  212 + function(result) {
  213 + alert("出错啦!");
  214 + }
  215 + );
  216 + }
  217 +
211 218 },
212 219 function(result) {
213   - alert("出错啦!");
  220 + alert("出错啦!" + result);
214 221 }
215 222 );
216 223 };
... ... @@ -289,51 +296,49 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;TimeTableDetailManageToolsCtrl&#39;, [&#39;$mo
289 296  
290 297 }]);
291 298  
292   -angular.module('ScheduleApp').controller('TimeTableManageFormCtrl', ['TimeTableManageService', '$stateParams', '$state', function(timeTableManageService, $stateParams, $state) {
  299 +angular.module('ScheduleApp').controller('TimeTableManageFormCtrl', [
  300 + 'TimeTableManageService',
  301 + '$stateParams',
  302 + '$state', function(timeTableManageService, $stateParams, $state) {
293 303 var self = this;
294 304  
295   - // 启用日期 日期控件开关
296   - self.qyrqOpen = false;
297   - self.qyrq_open = function() {
298   - self.qyrqOpen = true;
299   - };
300   -
301   - // 欲保存的表单信息,双向绑定
302   - self.timeTableManageForForm= {xl : {}};
303   -
304   - // 如果是修改,获取传过来的id,从后台获取一份数据,用于绑定页面form值
305   - var id = $stateParams.id;
306   - if (id) {
307   - self.timeTableManageForForm.id = id;
308   - timeTableManageService.getDetail(id).then(
309   - function(result) {
310   - var key;
311   - for (key in result) {
312   - self.timeTableManageForForm[key] = result[key];
  305 + // 启用日期 日期控件开关
  306 + self.qyrqOpen = false;
  307 + self.qyrq_open = function() {
  308 + self.qyrqOpen = true;
  309 + };
  310 +
  311 + // 欲保存的表单信息,双向绑定
  312 + self.timeTableManageForForm= {xl : {}};
  313 +
  314 + // 如果是修改,获取传过来的id,从后台获取一份数据,用于绑定页面form值
  315 + var id = $stateParams.id;
  316 + if (id) {
  317 + self.timeTableManageForForm.id = id;
  318 + timeTableManageService.getDetail(id).then(
  319 + function(result) {
  320 + var key;
  321 + for (key in result) {
  322 + self.timeTableManageForForm[key] = result[key];
  323 + }
  324 + },
  325 + function(result) {
  326 + alert("出错啦!");
313 327 }
314   - },
315   - function(result) {
316   - alert("出错啦!");
317   - }
318   - );
319   - }
  328 + );
  329 + }
320 330  
321   - // form提交方法
322   - self.submit = function() {
323   - timeTableManageService.saveDetail(self.timeTableManageForForm).then(
324   - function(result) {
325   - if (result.status == 'SUCCESS') {
326   - alert("保存成功!");
  331 + // form提交方法
  332 + self.submit = function() {
  333 + timeTableManageService.saveDetail(self.timeTableManageForForm).then(
  334 + function(result) {
327 335 $state.go("timeTableManage");
328   - } else {
329   - alert("保存异常!");
  336 + },
  337 + function(result) {
  338 + alert("出错啦!");
330 339 }
331   - },
332   - function(result) {
333   - alert("出错啦!");
334   - }
335   - );
336   - };
  340 + );
  341 + };
337 342  
338 343  
339 344 }]);
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoDetailManage/edit-detail.html 0 → 100644
  1 +<div ng-controller="TimeTableDetailManageFormCtrl_old as ctrl">
  2 + <div class="page-head">
  3 + <div class="page-title">
  4 + <h1>修改班次信息2</h1>
  5 + </div>
  6 + </div>
  7 +
  8 + <ul class="page-breadcrumb breadcrumb">
  9 + <li>
  10 + <a href="/pages/home.html" data-pjax>首页</a>
  11 + <i class="fa fa-circle"></i>
  12 + </li>
  13 + <li>
  14 + <span class="active">运营计划管理</span>
  15 + <i class="fa fa-circle"></i>
  16 + </li>
  17 + <li>
  18 + <a ui-sref="ttInfoManage">时刻表管理</a>
  19 + <i class="fa fa-circle"></i>
  20 + </li>
  21 + <li>
  22 + <a ui-sref="ttInfoDetailManage_edit({xlid: ctrl.xlid, ttid : ctrl.ttid, xlname: ctrl.xlname, ttname : ctrl.ttname})"><span ng-bind="ctrl.title1"></span></a>
  23 + <i class="fa fa-circle"></i>
  24 + </li>
  25 + <li>
  26 + <span class="active">修改班次信息</span>
  27 + </li>
  28 + </ul>
  29 +
  30 + <div class="portlet light bordered">
  31 + <div class="portlet-title">
  32 + <div class="caption">
  33 + <i class="icon-equalizer font-red-sunglo"></i> <span
  34 + class="caption-subject font-red-sunglo bold uppercase" ng-bind="ctrl.title2"></span>
  35 + </div>
  36 + </div>
  37 +
  38 + <div class="portlet-body form">
  39 + <form ng-submit="ctrl.submit()" class="form-horizontal" novalidate name="myForm">
  40 + <div class="form-body">
  41 + <div class="form-group has-success has-feedback">
  42 + <label class="col-md-3 control-label">线路*:</label>
  43 + <div class="col-md-7">
  44 + <input type="text" class="form-control"
  45 + ng-value="ctrl.TimeTableDetailForSave.xl.name"
  46 + readonly/>
  47 + </div>
  48 +
  49 + </div>
  50 + <div class="form-group has-success has-feedback">
  51 + <label class="col-md-3 control-label">时刻表名称*:</label>
  52 + <div class="col-md-7">
  53 + <input type="text" class="form-control"
  54 + ng-value="ctrl.TimeTableDetailForSave.ttinfo.name"
  55 + readonly/>
  56 + </div>
  57 + </div>
  58 + <div class="form-group has-success has-feedback">
  59 + <label class="col-md-3 control-label">路牌*:</label>
  60 + <div class="col-md-7">
  61 + <input type="text" class="form-control"
  62 + ng-value="ctrl.TimeTableDetailForSave.lp.lpName"
  63 + readonly/>
  64 + </div>
  65 +
  66 + </div>
  67 + <div class="form-group has-success has-feedback">
  68 + <label class="col-md-3 control-label">发车顺序号*:</label>
  69 + <div class="col-md-7">
  70 + <input type="text" class="form-control"
  71 + ng-value="ctrl.TimeTableDetailForSave.fcno"
  72 + readonly/>
  73 + </div>
  74 +
  75 + </div>
  76 + <div class="form-group has-success has-feedback">
  77 + <label class="col-md-3 control-label">方向*:</label>
  78 + <div class="col-md-7">
  79 + <sa-Radiogroup model="ctrl.TimeTableDetailForSave.xlDir" dicgroup="LineTrend" name="xlDir" required></sa-Radiogroup>
  80 + </div>
  81 + <!-- 隐藏块,显示验证信息 -->
  82 + <div class="alert alert-danger well-sm" ng-show="myForm.xlDir.$error.required">
  83 + 请选择线路上下行
  84 + </div>
  85 +
  86 + </div>
  87 + <div class="form-group">
  88 + <label class="col-md-3 control-label">起点站:</label>
  89 + <div class="col-md-7">
  90 + <sa-Select3 model="ctrl.TimeTableDetailForSave"
  91 + name="qdz"
  92 + placeholder="请输拼音..."
  93 + dcvalue="{{ctrl.TimeTableDetailForSave.qdz.id}}"
  94 + dcname="qdz.id"
  95 + icname="stationid"
  96 + icnames="stationname"
  97 + datatype="zd"
  98 + dataassociate="true"
  99 + dataparam="{{ {'xlid': ctrl.TimeTableDetailForSave.xl.id, 'xldir': ctrl.TimeTableDetailForSave.xlDir} | json }}"
  100 + mlp="true"
  101 + >
  102 + </sa-Select3>
  103 + </div>
  104 + </div>
  105 + <div class="form-group">
  106 + <label class="col-md-3 control-label">终点站:</label>
  107 + <div class="col-md-7">
  108 + <sa-Select3 model="ctrl.TimeTableDetailForSave"
  109 + name="zdz"
  110 + placeholder="请输拼音..."
  111 + dcvalue="{{ctrl.TimeTableDetailForSave.zdz.id}}"
  112 + dcname="zdz.id"
  113 + icname="stationid"
  114 + icnames="stationname"
  115 + datatype="zd"
  116 + dataassociate="true"
  117 + dataparam="{{ {'xlid': ctrl.TimeTableDetailForSave.xl.id, 'xldir': ctrl.TimeTableDetailForSave.xlDir} | json }}"
  118 + mlp="true"
  119 + >
  120 + </sa-Select3>
  121 + </div>
  122 + </div>
  123 + <div class="form-group">
  124 + <label class="col-md-3 control-label">停车场:</label>
  125 + <div class="col-md-7">
  126 + <sa-Select3 model="ctrl.TimeTableDetailForSave"
  127 + name="tcc"
  128 + placeholder="请输拼音..."
  129 + dcvalue="{{ctrl.TimeTableDetailForSave.tcc.id}}"
  130 + dcname="tcc.id"
  131 + icname="id"
  132 + icnames="parkName"
  133 + datatype="tcc"
  134 + mlp="true"
  135 + >
  136 + </sa-Select3>
  137 + </div>
  138 + </div>
  139 +
  140 + <div class="form-group has-success has-feedback">
  141 + <label class="col-md-3 control-label">发车时间*:</label>
  142 + <div class="col-md-7">
  143 + <input type="text" class="form-control"
  144 + ng-model="ctrl.TimeTableDetailForSave.fcsj"
  145 + />
  146 + </div>
  147 +
  148 + </div>
  149 + <div class="form-group">
  150 + <label class="col-md-3 control-label">对应班次数:</label>
  151 + <div class="col-md-7">
  152 + <input type="text" class="form-control"
  153 + ng-value="ctrl.TimeTableDetailForSave.bcs"
  154 + readonly/>
  155 + </div>
  156 +
  157 + </div>
  158 + <div class="form-group">
  159 + <label class="col-md-3 control-label">计划里程:</label>
  160 + <div class="col-md-7">
  161 + <input type="text" class="form-control"
  162 + ng-model="ctrl.TimeTableDetailForSave.jhlc"
  163 + />
  164 + </div>
  165 +
  166 + </div>
  167 + <div class="form-group">
  168 + <label class="col-md-3 control-label">班次历时:</label>
  169 + <div class="col-md-7">
  170 + <input type="text" class="form-control"
  171 + ng-model="ctrl.TimeTableDetailForSave.bcsj"
  172 + />
  173 + </div>
  174 +
  175 + </div>
  176 + <div class="form-group has-success has-feedback">
  177 + <label class="col-md-3 control-label">班次类型*:</label>
  178 + <div class="col-md-7">
  179 + <sa-Select3 model="ctrl.TimeTableDetailForSave"
  180 + name="bcType"
  181 + placeholder="请选择班次类型..."
  182 + dcvalue="{{ctrl.TimeTableDetailForSave.bcType}}"
  183 + dcname="bcType"
  184 + icname="code"
  185 + icnames="name"
  186 + datatype="ScheduleType"
  187 + required >
  188 + </sa-Select3>
  189 + </div>
  190 +
  191 + </div>
  192 + <div class="form-group">
  193 + <label class="col-md-3 control-label">备注:</label>
  194 + <div class="col-md-7">
  195 + <textarea class="form-control"
  196 + ng-model="ctrl.TimeTableDetailForSave.remark"
  197 + />
  198 + </div>
  199 +
  200 + </div>
  201 +
  202 + </div>
  203 +
  204 + <div class="form-actions">
  205 + <div class="row">
  206 + <div class="col-md-offset-3 col-md-4">
  207 + <button type="submit" class="btn green"
  208 + ng-disabled="!myForm.$valid"><i class="fa fa-check"></i> 提交</button>
  209 + <a type="button" class="btn default"
  210 + ui-sref="ttInfoDetailManage_edit({xlid: ctrl.xlid, ttid : ctrl.ttid, xlname: ctrl.xlname, ttname : ctrl.ttname})" ><i class="fa fa-times"></i> 取消</a>
  211 + </div>
  212 + </div>
  213 + </div>
  214 + </form>
  215 +
  216 + </div>
  217 + </div>
  218 +
  219 +
  220 +
  221 +
  222 +</div>
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoDetailManage/edit.html 0 → 100644
  1 +<div class="page-head">
  2 + <div class="page-title">
  3 + <h1>时刻表管理2</h1>
  4 + </div>
  5 +</div>
  6 +
  7 +<ul class="page-breadcrumb breadcrumb">
  8 + <li>
  9 + <a href="/pages/home.html" data-pjax>首页</a>
  10 + <i class="fa fa-circle"></i>
  11 + </li>
  12 + <li>
  13 + <span class="active">运营计划管理</span>
  14 + <i class="fa fa-circle"></i>
  15 + </li>
  16 + <li>
  17 + <a ui-sref="ttInfoManage">时刻表管理</a>
  18 + <i class="fa fa-circle"></i>
  19 + </li>
  20 + <li>
  21 + <span class="active">编辑时刻表明细信息</span>
  22 + </li>
  23 +</ul>
  24 +
  25 +<!--&lt;!&ndash; loading widget &ndash;&gt;-->
  26 +<!--<div id="loadingWidget" class="flyover mask" loading-widget>-->
  27 +<!--<div class="alert alert-info">-->
  28 +<!--<strong>载入中......</strong>-->
  29 +<!--</div>-->
  30 +<!--</div>-->
  31 +
  32 +<div class="row" id="timeTableDetail" ng-controller="TimeTableDetailManageCtrl_old as ctrl">
  33 + <div class="col-md-12">
  34 + <div class="portlet light bordered">
  35 + <div class="portlet-title">
  36 + <div class="caption font-dark">
  37 + <i class="fa fa-database font-dark"></i>
  38 + <span class="caption-subject bold uppercase" ng-bind="ctrl.title"></span>
  39 + </div>
  40 + <div class="actions">
  41 + <i class="fa fa-arrow-up" aria-hidden="true"></i>
  42 + <span style="padding-right: 10px;">上行班次</span>
  43 + <i class="fa fa-arrow-down" aria-hidden="true"></i>
  44 + <span style="padding-right: 10px;">下行班次</span>
  45 + <i class="fa fa-circle-o-notch" aria-hidden="true"></i>
  46 + <span style="padding-right: 10px;">区间班次</span>
  47 + <i class="fa fa-adjust" aria-hidden="true"></i>
  48 + <span style="padding-right: 10px;">分班班次</span>
  49 +
  50 + <div class="btn-group">
  51 + <a href="javascript:" class="btn red btn-outline btn-circle" data-toggle="dropdown">
  52 + <i class="fa fa-share"></i>
  53 + <span>数据工具</span>
  54 + <i class="fa fa-angle-down"></i>
  55 + </a>
  56 + <ul class="dropdown-menu pull-right">
  57 + <li>
  58 + <a href="javascript:" class="tool-action">
  59 + <i class="fa fa-file-excel-o"></i>
  60 + 导出excel
  61 + </a>
  62 + </li>
  63 + <li class="divider"></li>
  64 + <li>
  65 + <a href="javascript:" class="tool-action" ng-click="ctrl.refresh()">
  66 + <i class="fa fa-refresh"></i>
  67 + 刷行数据
  68 + </a>
  69 + </li>
  70 + </ul>
  71 + </div>
  72 +
  73 + </div>
  74 + </div>
  75 +
  76 + <div class="portlet-body">
  77 + <!--<div ng-view></div>-->
  78 + <div class="fixDiv">
  79 + <table style="width: 2000px" class="table table-striped table-bordered table-hover table-checkable order-column">
  80 + <thead>
  81 + <tr>
  82 + <th ng-repeat="head in ctrl.detailHeads track by $index">
  83 + <span ng-bind="head"></span>
  84 + </th>
  85 +
  86 + </tr>
  87 + </thead>
  88 + <tbody>
  89 + <tr ng-repeat="info in ctrl.detailInfos">
  90 + <td ng-repeat="cell in info track by $index">
  91 +
  92 + <!--<span ng-bind="cell.fcsj"></span>-->
  93 + <span ng-if="!cell.ttdid" ng-bind="cell.fcsj"></span>
  94 +
  95 + <div ng-if="cell.ttdid" class="btn-group">
  96 + <a href="javascript:" class="btn blue btn-outline btn-circle" data-toggle="dropdown">
  97 + <!-- 上下行图标 -->
  98 + <i ng-if="cell.xldir == '0'" class="fa fa-arrow-up" aria-hidden="true"></i>
  99 + <i ng-if="cell.xldir == '1'" class="fa fa-arrow-down" aria-hidden="true"></i>
  100 + <!-- 班次类型图标(区间班次) -->
  101 + <i ng-if="cell.bc_type == 'region'" class="fa fa-circle-o-notch" aria-hidden="true"></i>
  102 + <!-- 分班班次 -->
  103 + <i ng-if="cell.isfb == true" class="fa fa-adjust" aria-hidden="true"></i>
  104 +
  105 + <span ng-bind="cell.fcsj"></span>
  106 + <i class="fa fa-angle-down"></i>
  107 + </a>
  108 + <ul class="dropdown-menu pull-left">
  109 + <li>
  110 + <a href="javascript:" class="tool-action" ui-sref="ttInfoDetailManage_detail_edit({id: cell.ttdid, xlid: ctrl.xlid, ttid: ctrl.ttid, xlname: ctrl.xlname, ttname: ctrl.ttname})">
  111 + <i class="fa fa-file-excel-o"></i>
  112 + 修改
  113 + </a>
  114 + </li>
  115 + <li>
  116 + <a href="javascript:" class="tool-action">
  117 + <i class="fa fa-refresh"></i>
  118 + 删除
  119 + </a>
  120 + </li>
  121 + <li class="divider"></li>
  122 + <li>
  123 + <a href="javascript:" class="tool-action" ng-click="ctrl.changeDirect(cell, 0)">
  124 + <i class="fa fa-file-excel-o"></i>
  125 + 设为上行
  126 + <i class="fa fa-arrow-up" aria-hidden="true"></i>
  127 + </a>
  128 + </li>
  129 + <li>
  130 + <a href="javascript:" class="tool-action" ng-click="ctrl.changeDirect(cell, 1)">
  131 + <i class="fa fa-file-excel-o"></i>
  132 + 设为下行
  133 + <i class="fa fa-arrow-down" aria-hidden="true"></i>
  134 + </a>
  135 + </li>
  136 + <li>
  137 + <a href="javascript:" class="tool-action" ng-click="ctrl.changeFB(cell, true)">
  138 + <i class="fa fa-file-excel-o"></i>
  139 + 设置分班
  140 + <i class="fa fa-adjust" aria-hidden="true"></i>
  141 + </a>
  142 + </li>
  143 + <li>
  144 + <a href="javascript:" class="tool-action" ng-click="ctrl.changeFB(cell, false)">
  145 + <i class="fa fa-file-excel-o"></i>
  146 + 取消分班
  147 + <i class="fa fa-adjust" aria-hidden="true"></i>
  148 + </a>
  149 + </li>
  150 + <li>
  151 + <a href="javascript:" class="tool-action" ng-click="ctrl.changeBCType(cell, 'region')">
  152 + <i class="fa fa-file-excel-o"></i>
  153 + 设为区间
  154 + <i class="fa fa-circle-o-notch" aria-hidden="true"></i>
  155 + </a>
  156 + </li>
  157 +
  158 +
  159 + </ul>
  160 + </div>
  161 +
  162 +
  163 +
  164 + </td>
  165 + </tr>
  166 +
  167 + </tbody>
  168 + </table>
  169 + </div>
  170 +
  171 +
  172 + </div>
  173 + </div>
  174 + </div>
  175 +</div>
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoDetailManage/form.html 0 → 100644
  1 +<div class="page-head">
  2 + <div class="page-title">
  3 + <h1>时刻表管理2</h1>
  4 + </div>
  5 +</div>
  6 +
  7 +<ul class="page-breadcrumb breadcrumb">
  8 + <li>
  9 + <a href="/pages/home.html" data-pjax>首页</a>
  10 + <i class="fa fa-circle"></i>
  11 + </li>
  12 + <li>
  13 + <span class="active">运营计划管理</span>
  14 + <i class="fa fa-circle"></i>
  15 + </li>
  16 + <li>
  17 + <a ui-sref="ttInfoManage">时刻表管理</a>
  18 + <i class="fa fa-circle"></i>
  19 + </li>
  20 + <li>
  21 + <span class="active">时刻表明细</span>
  22 + </li>
  23 + <li>
  24 + <span class="active">导入时刻表 </span>
  25 + </li>
  26 +</ul>
  27 +
  28 +<div class="portlet light bordered" ng-controller="TtInfoDetailManageFormCtrl as ctrl">
  29 + <div class="portlet-title">
  30 + <div class="caption">
  31 + <i class="icon-equalizer font-red-sunglo"></i> <span
  32 + class="caption-subject font-red-sunglo bold uppercase"
  33 + ng-bind="ctrl.title">
  34 + </span>
  35 + </div>
  36 + </div>
  37 +
  38 +
  39 + <div class="col-md-6">
  40 + <div class="input-group">
  41 + <input type="file" class="form-control" nv-file-select="" uploader="ctrl.uploader"/>
  42 + <span class="input-group-btn">
  43 + <button type="button" ng-click="ctrl.clearInputFile()" class="btn btn-default">
  44 + <span class="glyphicon glyphicon-trash"></span>
  45 + </button>
  46 + </span>
  47 + </div>
  48 + </div>
  49 + <div class="table-scrollable table-scrollable-borderless">
  50 + <table class="table table-hover table-light">
  51 + <thead>
  52 + <tr class="uppercase">
  53 + <th width="50%">文件名</th>
  54 + <th ng-show="ctrl.uploader.isHTML5">大小(M)</th>
  55 + <th ng-show="ctrl.uploader.isHTML5">进度</th>
  56 + <th>状态</th>
  57 + <th>操作</th>
  58 + </tr>
  59 + </thead>
  60 + <tbody>
  61 + <tr ng-repeat="item in ctrl.uploader.queue">
  62 + <td>
  63 + <strong>{{ item.file.name }}</strong>
  64 + </td>
  65 + <td ng-show="ctrl.uploader.isHTML5" nowrap>{{ item.file.size/1024/1024|number:2 }} MB</td>
  66 + <td ng-show="ctrl.uploader.isHTML5">
  67 + <div class="progress progress-sm" style="margin-bottom: 0;">
  68 + <div class="progress-bar progress-bar-info" role="progressbar"
  69 + ng-style="{ 'width': item.progress + '%' }"></div>
  70 + </div>
  71 + </td>
  72 + <td class="text-center">
  73 + <span ng-show="item.isSuccess" class="text-success">
  74 + <i class="glyphicon glyphicon-ok"></i>
  75 + </span>
  76 + <span ng-show="item.isCancel" class="text-info">
  77 + <i class="glyphicon glyphicon-ban-circle"></i>
  78 + </span>
  79 + <span ng-show="item.isError" class="text-danger">
  80 + <i class="glyphicon glyphicon-remove"></i>
  81 + </span>
  82 + </td>
  83 + <td nowrap>
  84 + <button type="button" class="btn btn-success btn-xs" ng-click="item.upload()"
  85 + ng-disabled="item.isReady || item.isUploading || item.isSuccess">
  86 + <span class="glyphicon glyphicon-upload"></span> 上传
  87 + </button>
  88 + <button type="button" class="btn btn-warning btn-xs" ng-click="item.cancel()"
  89 + ng-disabled="!item.isUploading">
  90 + <span class="glyphicon glyphicon-ban-circle"></span> 取消
  91 + </button>
  92 + <button type="button" class="btn btn-danger btn-xs" ng-click="item.remove()">
  93 + <span class="glyphicon glyphicon-trash"></span> 删除
  94 + </button>
  95 + </td>
  96 + </tr>
  97 + </tbody>
  98 + </table>
  99 + </div>
  100 +
  101 +
  102 + <div class="portlet-body form">
  103 + <form ng-submit="ctrl.submit()" class="form-horizontal" novalidate name="myForm">
  104 + <div class="form-body">
  105 + <div class="form-group has-success has-feedback">
  106 + <label class="col-md-2 control-label">excel工作区*:</label>
  107 + <div class="col-md-3">
  108 + <sa-Select5 name="sheetname"
  109 + model="ctrl.ttInfoDetailManageForForm"
  110 + cmaps="{'sheetname' : 'name'}"
  111 + dcname="sheetname"
  112 + icname="name"
  113 + dsparams="{{ {type: 'local', ldata: ctrl.sheetnames} | json }}"
  114 + iterobjname="item"
  115 + iterobjexp="item.name"
  116 + searchph="请选择..."
  117 + searchexp="this.name"
  118 + required >
  119 + </sa-Select5>
  120 + <input type="hidden" name="sheetname_h" ng-model="ctrl.ttInfoDetailManageForForm.sheetvaliddesc"
  121 + remote-Validationt2
  122 + remotevtype="sheet"
  123 + remotevparam="{{ {
  124 + 'filename': ctrl.ttInfoDetailManageForForm.filename,
  125 + 'sheetname': ctrl.ttInfoDetailManageForForm.sheetname,
  126 + 'lineid' : ctrl.ttInfoDetailManageForForm.xlid,
  127 + 'linename' : ctrl.ttInfoDetailManageForForm.xlname
  128 + } | json}}"/>
  129 + </div>
  130 + <!-- 隐藏块,显示验证信息 -->
  131 + <div class="alert alert-danger well-sm" ng-show="myForm.sheetname.$error.required">
  132 + 工作区必须选择
  133 + </div>
  134 + <div class="alert alert-danger well-sm" ng-show="myForm.sheetname_h.$error.remote">
  135 + {{ctrl.ttInfoDetailManageForForm.sheetvaliddesc}}
  136 + </div>
  137 + </div>
  138 +
  139 + <div class="form-group has-success has-feedback">
  140 + <label class="col-md-2 control-label">线路标准*:</label>
  141 + <div class="col-md-3">
  142 + <sa-Select5 name="lineinfo"
  143 + model="ctrl.ttInfoDetailManageForForm"
  144 + cmaps="{'lineinfo' : 'id'}"
  145 + dcname="lineinfo"
  146 + icname="id"
  147 + dsparams="{{ {type: 'ajax', param:{'type': 'all', 'line.id_eq': ctrl.ttInfoDetailManageForForm.xlid}, atype:'xlinfo' } | json }}"
  148 + iterobjname="item"
  149 + iterobjexp="item.line.name + '-' + (item.descriptions ? item.descriptions : '')"
  150 + searchph="请输拼音..."
  151 + searchexp="this.line.name + '-' + (this.descriptions ? this.descriptions : '')"
  152 + required >
  153 + </sa-Select5>
  154 + <input type="hidden" name="lineinfo_h" ng-model="ctrl.ttInfoDetailManageForForm.lineinfo"
  155 + remote-Validationt2
  156 + remotevtype="sheetli"
  157 + remotevparam="{{ {'lineinfoid': ctrl.ttInfoDetailManageForForm.lineinfo} | json}}"/>
  158 + </div>
  159 + <!-- 隐藏块,显示验证信息 -->
  160 + <div class="alert alert-danger well-sm" ng-show="myForm.lineinfo.$error.required">
  161 + 线路标准必须选择
  162 + </div>
  163 + <div class="alert alert-danger well-sm" ng-show="myForm.lineinfo_h.$error.remote">
  164 + {{ctrl.ttInfoDetailManageForForm.lineinfovaliddesc}}
  165 +
  166 + 上下行出场进场里程时间必须填写,上下行班次里程时间必须填写,停车场必须填写
  167 + </div>
  168 + </div>
  169 +
  170 +
  171 + </div>
  172 +
  173 + <div class="form-actions">
  174 + <div class="row">
  175 + <div class="col-md-offset-3 col-md-4">
  176 + <button type="submit" class="btn green"
  177 + ng-disabled="!myForm.$valid"><i class="fa fa-check"></i> 提交</button>
  178 + <a type="button" class="btn default" ui-sref="ttInfoManage" ><i class="fa fa-times"></i> 取消</a>
  179 + </div>
  180 + </div>
  181 + </div>
  182 +
  183 + </form>
  184 +
  185 + </div>
  186 +
  187 +
  188 +</div>
0 189 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoDetailManage/main.js 0 → 100644
  1 +// 时刻表明晰管理service,包装外部定义的globalservice,并保存一定的操作状态
  2 +angular.module('ScheduleApp').factory(
  3 + 'TtInfoDetailManageService',
  4 + [
  5 + 'TimeTableDetailManageService_g',
  6 + function(service) {
  7 + // TODO:
  8 +
  9 + return {
  10 + importDetail: function(param) {
  11 + return service.import.do(param).$promise;
  12 + },
  13 + /**
  14 + * 获取编辑用的时刻表明细数据。
  15 + * @param ttid 时刻表id
  16 + */
  17 + getEditInfo: function(xlid, ttid) {
  18 + var params = {xlid : xlid, ttid : ttid};
  19 + return service.edit.list(params).$promise;
  20 + }
  21 + };
  22 + }
  23 + ]
  24 +);
  25 +
  26 +// form.html控制器
  27 +angular.module('ScheduleApp').controller(
  28 + 'TtInfoDetailManageFormCtrl',
  29 + [
  30 + 'TtInfoDetailManageService',
  31 + 'FileUploader',
  32 + '$stateParams',
  33 + '$state',
  34 + function(service, FileUploader, $stateParams, $state) {
  35 + var self = this;
  36 + var xlid = $stateParams.xlid;
  37 + var ttid = $stateParams.ttid;
  38 + var xlname = $stateParams.xlname;
  39 + var ttname = $stateParams.ttname;
  40 +
  41 + self.title = xlname + '(' + ttname + ')' + '时刻表明细信息excel数据导入';
  42 +
  43 + // 欲保存的表单信息,双向绑定
  44 + self.ttInfoDetailManageForForm = {
  45 + xlid: xlid, // 线路id
  46 + ttid: ttid, // 时刻表id
  47 + xlname: xlname, // 线路名称
  48 + ttname: ttname, // 时刻表名称
  49 + filename: undefined, // 上传后的文件名
  50 + sheetname: undefined, // sheet名字
  51 + sheetvaliddesc: undefined, // sheet验证描述返回
  52 + lineinfo: undefined, // 线路标准id
  53 + lineinfovaliddesc: undefined // 线路标准验证描述返回
  54 + };
  55 + self.sheetnames = [
  56 + //{name: '工作表1'}, {name: '工作表2'} // sheet名字列表
  57 + ];
  58 +
  59 + //--------------- 上传文件功能 ---------------//
  60 +
  61 + self.clearInputFile = function() {
  62 + angular.element("input[type='file']").val(null);
  63 + };
  64 +
  65 + // 上传文件组件
  66 + self.uploader = new FileUploader({
  67 + url: "/tidc/uploadFile",
  68 + filters: [], // 用于过滤文件,比如只允许导入excel,
  69 + formData: [
  70 + {
  71 + xlmc: self.xlmc,
  72 + ttinfoname: self.ttinfoname
  73 + }
  74 + ]
  75 + });
  76 + self.uploader.onAfterAddingFile = function(fileItem)
  77 + {
  78 + console.info('onAfterAddingFile', fileItem);
  79 + console.log(self.uploader.queue.length);
  80 + if (self.uploader.queue.length > 1)
  81 + self.uploader.removeFromQueue(0);
  82 + };
  83 + self.uploader.onSuccessItem = function(fileItem, response, status, headers)
  84 + {
  85 + self.sheetnames = response.sheetnames;
  86 + self.ttInfoDetailManageForForm.filename = response.fileName;
  87 + console.info('onSuccessItem', fileItem, response, status, headers);
  88 + };
  89 + self.uploader.onErrorItem = function(fileItem, response, status, headers)
  90 + {
  91 + alert("error");
  92 + self.sheetnames = [];
  93 + console.info('onErrorItem', fileItem, response, status, headers);
  94 + };
  95 +
  96 +
  97 + // form提交方法
  98 + self.submit = function() {
  99 + service.importDetail(self.ttInfoDetailManageForForm).then(
  100 + function(result) {
  101 + $state.go("ttInfoManage");
  102 + },
  103 + function(result) {
  104 + alert("出错啦!");
  105 + }
  106 + );
  107 + };
  108 +
  109 +
  110 + // TODO:edit操作暂时使用旧版本的js文件
  111 +
  112 + // {"timestamp":1478674739246,"status":500,"error":"Internal Server Error","exception":"java.lang.ClassCastException","message":"java.lang.String cannot be cast to java.lang.Long","path":"/tidc/importfile"}
  113 + }
  114 + ]
  115 +);
0 116 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoDetailManage/timeTableDetailManage_old.js 0 → 100644
  1 +
  2 +angular.module('ScheduleApp').factory('TimeTableDetailManageService_old', ['TimeTableDetailManageService_g', function(service) {
  3 +
  4 + return {
  5 + /**
  6 + * 获取明细信息。
  7 + * @param id 车辆id
  8 + * @return 返回一个 promise
  9 + */
  10 + getDetail: function(id) {
  11 + var params = {id: id};
  12 + return service.rest.get(params).$promise;
  13 + },
  14 + /**
  15 + * 保存信息。
  16 + * @param obj 车辆详细信息
  17 + * @return 返回一个 promise
  18 + */
  19 + saveDetail: function(obj) {
  20 + return service.rest.save(obj).$promise;
  21 + },
  22 + /**
  23 + * 获取编辑用的时刻表明细数据。
  24 + * @param ttid 时刻表id
  25 + */
  26 + getEditInfo: function(xlid, ttid) {
  27 + var params = {xlid : xlid, ttid : ttid};
  28 + return service.edit.list(params).$promise;
  29 + }
  30 + };
  31 +
  32 +}]);
  33 +
  34 +angular.module('ScheduleApp').controller('TimeTableDetailManageCtrl_old', ['TimeTableDetailManageService_old', '$stateParams', '$uibModal', function(service, $stateParams, $uibModal) {
  35 + var self = this;
  36 + self.xlid = $stateParams.xlid; // 获取传过来的线路id
  37 + self.ttid = $stateParams.ttid; // 获取传过来的时刻表id
  38 + self.xlname = $stateParams.xlname; // 获取传过来的线路名字
  39 + self.ttname = $stateParams.ttname; // 获取传过来的时刻表名字
  40 +
  41 + self.title = self.xlname + "(" + self.ttname + ")" + "时刻表明细信息";
  42 +
  43 + // 载入待编辑的时刻表明细数据
  44 + service.getEditInfo(self.xlid, self.ttid).then(
  45 + function(result) {
  46 + // TODO;获取数据待展示
  47 + self.detailHeads = result.header;
  48 + self.detailInfos = result.contents;
  49 + },
  50 + function(result) {
  51 + alert("出错啦!");
  52 + }
  53 + );
  54 +
  55 + // 刷新数据
  56 + self.refresh = function() {
  57 + service.getEditInfo(self.xlid, self.ttid).then(
  58 + function(result) {
  59 + // TODO;获取数据待展示
  60 + self.detailHeads = result.header;
  61 + self.detailInfos = result.contents;
  62 + },
  63 + function(result) {
  64 + alert("出错啦!");
  65 + }
  66 + );
  67 + };
  68 +
  69 + /**
  70 + * 反向操作。
  71 + * @param cell 明细信息
  72 + */
  73 + self.changeDirect = function(detailInfo, xldir) {
  74 + service.getDetail(detailInfo.ttdid).then(
  75 + function(result) {
  76 + result.xlDir = xldir;
  77 + service.saveDetail(result).then(
  78 + function(result) {
  79 + detailInfo.xldir = xldir;
  80 + },
  81 + function(result) {
  82 + alert("出错啦!");
  83 + }
  84 + );
  85 + },
  86 + function(result) {
  87 + alert("出错啦!");
  88 + }
  89 + );
  90 + };
  91 +
  92 + /**
  93 + * 更新分班。
  94 + * @param detailInfo 明细信息
  95 + * @param flag 分班标识
  96 + */
  97 + self.changeFB = function(detailInfo, flag) {
  98 + service.getDetail(detailInfo.ttdid).then(
  99 + function(result) {
  100 + result.isFB = flag;
  101 + service.saveDetail(result).then(
  102 + function(result) {
  103 + detailInfo.isfb = flag;
  104 + },
  105 + function(result) {
  106 + alert("出错啦!");
  107 + }
  108 + );
  109 + },
  110 + function(result) {
  111 + alert("出错啦!");
  112 + }
  113 + );
  114 + };
  115 +
  116 + /**
  117 + * 改变便次类型。
  118 + * @param detailInfo 明细信息
  119 + * @param type 班次类型
  120 + */
  121 + self.changeBCType = function(detailInfo, type) {
  122 + service.getDetail(detailInfo.ttdid).then(
  123 + function(result) {
  124 + result.bcType = type;
  125 + service.saveDetail(result).then(
  126 + function(result) {
  127 + detailInfo.bc_type = type;
  128 + },
  129 + function(result) {
  130 + alert("出错啦!");
  131 + }
  132 + );
  133 + },
  134 + function(result) {
  135 + alert("出错啦!");
  136 + }
  137 + );
  138 + };
  139 +
  140 +}]);
  141 +
  142 +angular.module('ScheduleApp').controller('TimeTableDetailManageFormCtrl_old', ['TimeTableDetailManageService_old', '$stateParams', '$state', function(service, $stateParams, $state) {
  143 + var self = this;
  144 +
  145 + // 欲保存的busInfo信息,绑定
  146 + self.TimeTableDetailForSave = {};
  147 +
  148 + // 获取传过来的id,有的话就是修改,获取一遍数据
  149 + var id = $stateParams.id; // 时刻明细班次id
  150 + self.xlid = $stateParams.xlid; // 获取传过来的线路id
  151 + self.ttid = $stateParams.ttid; // 获取传过来的时刻表id
  152 + self.xlname = $stateParams.xlname; // 获取传过来的线路名字
  153 + self.ttname = $stateParams.ttname; // 获取传过来的时刻表名字
  154 +
  155 + self.title1 = self.xlname + "(" + self.ttname + ")" + "时刻表明细信息";
  156 +
  157 + if (id) {
  158 + self.TimeTableDetailForSave.id = id;
  159 + service.getDetail(id).then(
  160 + function(result) {
  161 + var key;
  162 + for (key in result) {
  163 + self.TimeTableDetailForSave[key] = result[key];
  164 + }
  165 +
  166 + self.title2 =
  167 + self.xlname + "(" + self.ttname + ")" + "时刻表明细信息" +
  168 + "->路牌" + self.TimeTableDetailForSave.lp.lpName +
  169 + "->发车顺序号" + self.TimeTableDetailForSave.fcno +
  170 + "->班次详细信息";
  171 +
  172 + },
  173 + function(result) {
  174 + alert("出错啦!");
  175 + }
  176 + );
  177 + }
  178 +
  179 + // 提交方法
  180 + self.submit = function() {
  181 + console.log(self.TimeTableDetailForSave);
  182 + //if (self.busInfoForSave) {
  183 + // delete $stateParams.id;
  184 + //}
  185 + service.saveDetail(self.TimeTableDetailForSave).then(
  186 + function(result) {
  187 + // TODO:弹出框方式以后改
  188 + if (result.status == 'SUCCESS') {
  189 + //alert("保存成功!");
  190 + $state.go("ttInfoDetailManage_edit", {
  191 + xlid: self.xlid,
  192 + ttid: self.ttid,
  193 + xlname: self.xlname,
  194 + ttname: self.ttname
  195 + });
  196 + } else {
  197 + alert("保存异常!");
  198 + }
  199 + },
  200 + function(result) {
  201 + // TODO:弹出框方式以后改
  202 + alert("出错啦!");
  203 + }
  204 + );
  205 + };
  206 +
  207 +}]);
0 208 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detail.html 0 → 100644
  1 +<div class="page-head">
  2 + <div class="page-title">
  3 + <h1>时刻表管理2</h1>
  4 + </div>
  5 +</div>
  6 +
  7 +<ul class="page-breadcrumb breadcrumb">
  8 + <li>
  9 + <a href="/pages/home.html" data-pjax>首页</a>
  10 + <i class="fa fa-circle"></i>
  11 + </li>
  12 + <li>
  13 + <span class="active">运营计划管理</span>
  14 + <i class="fa fa-circle"></i>
  15 + </li>
  16 + <li>
  17 + <a ui-sref="ttInfoManage">时刻表管理</a>
  18 + <i class="fa fa-circle"></i>
  19 + </li>
  20 + <li>
  21 + <span class="active">时刻表基础信息</span>
  22 + </li>
  23 +</ul>
  24 +
  25 +<div class="portlet light bordered" ng-controller="TtInfoManageDetailCtrl as ctrl">
  26 + <div class="portlet-title">
  27 + <div class="caption">
  28 + <i class="icon-equalizer font-red-sunglo"></i> <span
  29 + class="caption-subject font-red-sunglo bold uppercase"
  30 + ng-bind="ctrl.title"></span>
  31 + </div>
  32 + </div>
  33 +
  34 + <div class="portlet-body form">
  35 + <form class="form-horizontal" novalidate name="myForm">
  36 + <!--<div class="alert alert-danger display-hide">-->
  37 + <!--<button class="close" data-close="alert"></button>-->
  38 + <!--您的输入有误,请检查下面的输入项-->
  39 + <!--</div>-->
  40 +
  41 +
  42 + <!-- 其他信息放置在这里 -->
  43 + <div class="form-body">
  44 + <div class="form-group has-success has-feedback">
  45 + <label class="col-md-2 control-label">线路*:</label>
  46 + <div class="col-md-4">
  47 + <input type="text" class="form-control"
  48 + name="xl" ng-model="ctrl.ttInfoManageForDetail.xl.name" readonly/>
  49 + </div>
  50 + </div>
  51 +
  52 + <div class="form-group has-success has-feedback">
  53 + <label class="col-md-2 control-label">线路走向*:</label>
  54 + <div class="col-md-4">
  55 + <sa-Radiogroup model="ctrl.ttInfoManageForDetail.xlDir" dicgroup="LineTrend2" name="xlDir" disabled="true"></sa-Radiogroup>
  56 + </div>
  57 + </div>
  58 +
  59 + <div class="form-group has-success has-feedback">
  60 + <label class="col-md-2 control-label">时刻表名字*:</label>
  61 + <div class="col-md-4">
  62 + <input type="text" class="form-control"
  63 + name="name" ng-model="ctrl.ttInfoManageForDetail.name" readonly/>
  64 + </div>
  65 + </div>
  66 +
  67 + <div class="form-group has-success has-feedback">
  68 + <label class="col-md-2 control-label">启用日期*:</label>
  69 + <div class="col-md-4">
  70 + <input type="text" class="form-control"
  71 + name="qyrq" uib-datepicker-popup="yyyy年MM月dd日"
  72 + ng-model="ctrl.ttInfoManageForDetail.qyrq" readonly/>
  73 + </div>
  74 + </div>
  75 +
  76 + <div class="form-group has-success has-feedback">
  77 + <label class="col-md-2 control-label">是否启用*:</label>
  78 + <div class="col-md-4">
  79 + <sa-Radiogroup model="ctrl.ttInfoManageForDetail.isEnableDisTemplate" dicgroup="truefalseType" name="isEnableDisTemplate" disabled="true"></sa-Radiogroup>
  80 + </div>
  81 +
  82 + </div>
  83 +
  84 + <div class="form-group">
  85 + <label class="col-md-2 control-label">路牌数量:</label>
  86 + <div class="col-md-4">
  87 + <input type="number" class="form-control" ng-value="ctrl.ttInfoManageForDetail.lpCount"
  88 + name="lpCount" placeholder="请输入路牌数" min="1" readonly/>
  89 + </div>
  90 + </div>
  91 +
  92 + <div class="form-group">
  93 + <label class="col-md-2 control-label">营运圈数:</label>
  94 + <div class="col-md-4">
  95 + <input type="number" class="form-control" ng-value="ctrl.ttInfoManageForDetail.loopCount"
  96 + name="loopCount" placeholder="请输入圈数" min="1" readonly/>
  97 + </div>
  98 + </div>
  99 +
  100 + <div class="form-group">
  101 + <label class="col-md-2 control-label">停车场:</label>
  102 + <div class="col-md-4">
  103 + <input type="text" class="form-control" ng-value="ctrl.ttInfoManageForDetail.xl.carParkCode | dict:'CarPark':'未知' "
  104 + name="carParkCode" readonly/>
  105 + </div>
  106 + </div>
  107 +
  108 + <div class="form-group">
  109 + <label class="col-md-2 control-label">常规有效日:</label>
  110 + <div class="col-md-6">
  111 + <sa-Checkboxgroup model="ctrl.timeTableManageForForm"
  112 + name="rule_days"
  113 + dcvalue="{{ctrl.ttInfoManageForDetail.rule_days}}"
  114 + disabled >
  115 + </sa-Checkboxgroup>
  116 + </div>
  117 + </div>
  118 +
  119 + <div class="form-group">
  120 + <label class="col-md-2 control-label">特殊有效日:</label>
  121 + <div class="col-md-6">
  122 + <sa-Dategroup model="ctrl.ttInfoManageForDetail"
  123 + name="special_days"
  124 + dcvalue="{{ctrl.timeTableManageForDetail.special_days}}"
  125 + disabled
  126 + >
  127 + </sa-Dategroup>
  128 + </div>
  129 + </div>
  130 +
  131 + <!--<div class="form-group">-->
  132 + <!--<label class="col-md-2 control-label">备注:</label>-->
  133 + <!--</div>-->
  134 +
  135 + <div class="form-group">
  136 + <label class="col-md-2 control-label">创建人:</label>
  137 + <div class="col-md-4">
  138 + <input type="text" class="form-control" ng-value="ctrl.ttInfoManageForDetail.createBy.name"
  139 + name="createBy" readonly/>
  140 + </div>
  141 + </div>
  142 +
  143 + <div class="form-group">
  144 + <label class="col-md-2 control-label">创建时间:</label>
  145 + <div class="col-md-4">
  146 + <input type="text" class="form-control" ng-model="ctrl.ttInfoManageForDetail.createDate"
  147 + name="createDate" uib-datepicker-popup="yyyy年MM月dd日 hh:mm:ss"
  148 + readonly/>
  149 + </div>
  150 + </div>
  151 +
  152 + <div class="form-group">
  153 + <label class="col-md-2 control-label">更新人:</label>
  154 + <div class="col-md-4">
  155 + <input type="text" class="form-control" ng-value="ctrl.ttInfoManageForDetail.updateBy.name"
  156 + name="updateBy" readonly/>
  157 + </div>
  158 + </div>
  159 +
  160 + <div class="form-group">
  161 + <label class="col-md-2 control-label">更新时间:</label>
  162 + <div class="col-md-4">
  163 + <input type="text" class="form-control" ng-model="ctrl.ttInfoManageForDetail.updateDate"
  164 + name="updateDate" uib-datepicker-popup="yyyy年MM月dd日 hh:mm:ss"
  165 + readonly/>
  166 + </div>
  167 + </div>
  168 +
  169 + <!-- 其他form-group -->
  170 +
  171 + </div>
  172 +
  173 + </form>
  174 +
  175 + </div>
  176 +
  177 +
  178 +</div>
0 179 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/edit.html 0 → 100644
  1 +<div class="page-head">
  2 + <div class="page-title">
  3 + <h1>时刻表管理2</h1>
  4 + </div>
  5 +</div>
  6 +
  7 +<ul class="page-breadcrumb breadcrumb">
  8 + <li>
  9 + <a href="/pages/home.html" data-pjax>首页</a>
  10 + <i class="fa fa-circle"></i>
  11 + </li>
  12 + <li>
  13 + <span class="active">运营计划管理</span>
  14 + <i class="fa fa-circle"></i>
  15 + </li>
  16 + <li>
  17 + <a ui-sref="ttInfoManage">时刻表管理</a>
  18 + <i class="fa fa-circle"></i>
  19 + </li>
  20 + <li>
  21 + <span class="active">修改时刻表基础信息</span>
  22 + </li>
  23 +</ul>
  24 +
  25 +<div class="portlet light bordered" ng-controller="TtInfoManageFormCtrl as ctrl">
  26 + <div class="portlet-title">
  27 + <div class="caption">
  28 + <i class="icon-equalizer font-red-sunglo"></i> <span
  29 + class="caption-subject font-red-sunglo bold uppercase">表单</span>
  30 + </div>
  31 + </div>
  32 +
  33 + <div class="portlet-body form">
  34 + <form ng-submit="ctrl.submit()" class="form-horizontal" novalidate name="myForm">
  35 + <!--<div class="alert alert-danger display-hide">-->
  36 + <!--<button class="close" data-close="alert"></button>-->
  37 + <!--您的输入有误,请检查下面的输入项-->
  38 + <!--</div>-->
  39 +
  40 +
  41 + <!-- 其他信息放置在这里 -->
  42 + <div class="form-body">
  43 + <div class="form-group has-success has-feedback">
  44 + <label class="col-md-2 control-label">线路*:</label>
  45 + <div class="col-md-3">
  46 + <sa-Select5 name="xl"
  47 + model="ctrl.ttInfoManageForForm"
  48 + cmaps="{'xl.id' : 'id'}"
  49 + dcname="xl.id"
  50 + icname="id"
  51 + dsparams="{{ {type: 'ajax', param:{type: 'all'}, atype:'xl' } | json }}"
  52 + iterobjname="item"
  53 + iterobjexp="item.name"
  54 + searchph="请输拼音..."
  55 + searchexp="this.name"
  56 + required >
  57 + </sa-Select5>
  58 + </div>
  59 + <!-- 隐藏块,显示验证信息 -->
  60 + <div class="alert alert-danger well-sm" ng-show="myForm.xl.$error.required">
  61 + 线路必须选择
  62 + </div>
  63 + </div>
  64 +
  65 + <div class="form-group has-success has-feedback">
  66 + <label class="col-md-2 control-label">线路走向*:</label>
  67 + <div class="col-md-3">
  68 + <sa-Radiogroup model="ctrl.ttInfoManageForForm.xlDir" dicgroup="LineTrend2" name="xlDir" required></sa-Radiogroup>
  69 + </div>
  70 + <!-- 隐藏块,显示验证信息 -->
  71 + <div class="alert alert-danger well-sm" ng-show="myForm.xlDir.$error.required">
  72 + 线路走向必须填写
  73 + </div>
  74 + </div>
  75 +
  76 + <div class="form-group has-success has-feedback">
  77 + <label class="col-md-2 control-label">时刻表名字*:</label>
  78 + <div class="col-md-3">
  79 + <input type="text" class="form-control" ng-model="ctrl.ttInfoManageForForm.name"
  80 + name="name" placeholder="请输入时刻表名字..." required
  81 + remote-Validation
  82 + remotevtype="ttc1"
  83 + remotevparam="{{ {'xl.id_eq': ctrl.ttInfoManageForForm.xl.id, 'name_eq': ctrl.ttInfoManageForForm.name} | json}}"
  84 + />
  85 + </div>
  86 +
  87 + <!-- 隐藏块,显示验证信息 -->
  88 + <div class="alert alert-danger well-sm" ng-show="myForm.name.$error.required">
  89 + 时刻表名字必须填写
  90 + </div>
  91 + <div class="alert alert-danger well-sm" ng-show="myForm.name.$error.remote">
  92 + 相同线路下的时刻表不能同名
  93 + </div>
  94 + </div>
  95 +
  96 + <div class="form-group has-success has-feedback">
  97 + <label class="col-md-2 control-label">启用日期*:</label>
  98 + <div class="col-md-3">
  99 + <div class="input-group">
  100 + <input type="text" class="form-control"
  101 + name="qyrq" placeholder="请选择启用日期..."
  102 + uib-datepicker-popup="yyyy年MM月dd日"
  103 + is-open="ctrl.qyrqOpen"
  104 + ng-model="ctrl.ttInfoManageForForm.qyrq" readonly required/>
  105 + <span class="input-group-btn">
  106 + <button type="button" class="btn btn-default" ng-click="ctrl.qyrq_open()">
  107 + <i class="glyphicon glyphicon-calendar"></i>
  108 + </button>
  109 + </span>
  110 + </div>
  111 + </div>
  112 +
  113 + <!-- 隐藏块,显示验证信息 -->
  114 + <div class="alert alert-danger well-sm" ng-show="myForm.qyrq.$error.required">
  115 + 启用日期必须填写
  116 + </div>
  117 + </div>
  118 +
  119 + <div class="form-group has-success has-feedback">
  120 + <label class="col-md-2 control-label">是否启用*:</label>
  121 + <div class="col-md-3">
  122 + <sa-Radiogroup model="ctrl.ttInfoManageForForm.isEnableDisTemplate" dicgroup="truefalseType" name="isEnableDisTemplate" required></sa-Radiogroup>
  123 + </div>
  124 +
  125 + <!-- 隐藏块,显示验证信息 -->
  126 + <div class="alert alert-danger well-sm" ng-show="myForm.isEnableDisTemplate.$error.required">
  127 + 是否启用必须选择
  128 + </div>
  129 +
  130 + </div>
  131 +
  132 + <div class="form-group">
  133 + <label class="col-md-2 control-label">路牌数量:</label>
  134 + <div class="col-md-3">
  135 + <input type="number" class="form-control" ng-model="ctrl.ttInfoManageForForm.lpCount"
  136 + name="lpCount" placeholder="请输入路牌数..." min="1"/>
  137 + </div>
  138 + <div class="alert alert-danger well-sm" ng-show="myForm.lpCount.$error.number">
  139 + 必须输入数字
  140 + </div>
  141 + <div class="alert alert-danger well-sm" ng-show="myForm.lpCount.$error.min">
  142 + 路爬数量必须大于1
  143 + </div>
  144 + </div>
  145 +
  146 + <div class="form-group">
  147 + <label class="col-md-2 control-label">营运圈数:</label>
  148 + <div class="col-md-3">
  149 + <input type="number" class="form-control" ng-model="ctrl.ttInfoManageForForm.loopCount"
  150 + name="loopCount" placeholder="请输入圈数..." min="1"/>
  151 + </div>
  152 + <div class="alert alert-danger well-sm" ng-show="myForm.loopCount.$error.number">
  153 + 必须输入数字
  154 + </div>
  155 + <div class="alert alert-danger well-sm" ng-show="myForm.loopCount.$error.min">
  156 + 营运圈数必须大于1
  157 + </div>
  158 + </div>
  159 +
  160 + <div class="form-group">
  161 + <label class="col-md-2 control-label">常规有效日:</label>
  162 + <div class="col-md-6">
  163 + <sa-Checkboxgroup model="ctrl.ttInfoManageForForm"
  164 + name="rule_days"
  165 + dcvalue="{{ctrl.ttInfoManageForForm.rule_days}}"
  166 + dcname="rule_days"
  167 + required >
  168 + </sa-Checkboxgroup>
  169 + </div>
  170 + <div class="alert alert-danger well-sm" ng-show="myForm.rule_days.$error.required">
  171 + 请操作一下1
  172 + </div>
  173 + </div>
  174 +
  175 + <div class="form-group">
  176 + <label class="col-md-2 control-label">特殊有效日:</label>
  177 + <div class="col-md-6">
  178 + <sa-Dategroup model="ctrl.ttInfoManageForForm"
  179 + name="special_days"
  180 + dcvalue="{{ctrl.ttInfoManageForForm.special_days}}"
  181 + dcname="special_days"
  182 + >
  183 + </sa-Dategroup>
  184 + </div>
  185 + <div class="alert alert-danger well-sm" ng-show="myForm.special_days.$error.required">
  186 + 请操作一下2
  187 + </div>
  188 + </div>
  189 +
  190 + <!--<div class="form-group">-->
  191 + <!--<label class="col-md-2 control-label">备注:</label>-->
  192 + <!--</div>-->
  193 +
  194 + <!-- 其他form-group -->
  195 +
  196 + </div>
  197 +
  198 + <!-- TODO:!myForm.$valid 在这里有点问题,改用以下方法验证 -->
  199 + <div class="form-actions">
  200 + <div class="row">
  201 + <div class="col-md-offset-3 col-md-4">
  202 + <button type="submit" class="btn green"
  203 + ng-disabled="!myForm.$valid"><i class="fa fa-check"></i> 提交</button>
  204 + <a type="button" class="btn default" ui-sref="ttInfoManage" ><i class="fa fa-times"></i> 取消</a>
  205 + </div>
  206 + </div>
  207 + </div>
  208 +
  209 + </form>
  210 +
  211 + </div>
  212 +
  213 +
  214 +</div>
0 215 \ No newline at end of file
... ...