Commit 2c04aa5599bb950b5e6345bb1ed0d314adce5e43

Authored by 徐烜
1 parent 499f236c

PSM_22_23_24

Showing 45 changed files with 3197 additions and 1024 deletions
src/main/java/com/bsth/controller/schedule/BController.java 0 → 100644
  1 +package com.bsth.controller.schedule;
  2 +
  3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.service.schedule.BService;
  5 +import com.bsth.service.schedule.ScheduleException;
  6 +import com.google.common.base.Splitter;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.data.domain.PageRequest;
  9 +import org.springframework.data.domain.Sort;
  10 +import org.springframework.web.bind.annotation.*;
  11 +
  12 +import java.io.Serializable;
  13 +import java.util.ArrayList;
  14 +import java.util.HashMap;
  15 +import java.util.List;
  16 +import java.util.Map;
  17 +
  18 +/**
  19 + * 基础控制器。
  20 + */
  21 +public class BController<T, ID extends Serializable> {
  22 + @Autowired
  23 + protected BService<T, ID> bService;
  24 +
  25 + // CRUD 操作
  26 + // Create操作
  27 + @RequestMapping(method = RequestMethod.POST)
  28 + public Map<String, Object> save(@RequestBody T t) {
  29 + T t_saved = bService.save(t);
  30 + Map<String, Object> rtn = new HashMap<>();
  31 + rtn.put("status", ResponseCode.SUCCESS);
  32 + rtn.put("data", t_saved);
  33 + return rtn;
  34 + }
  35 + // Update操作
  36 + @RequestMapping(value="/{id}", method = RequestMethod.POST)
  37 + public Map<String, Object> update(@RequestBody T t) {
  38 + return save(t);
  39 + }
  40 + // Research操作
  41 + @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  42 + public Map<String, Object> findById(@PathVariable("id") ID id) {
  43 + T t = bService.findById(id);
  44 + Map<String, Object> rtn = new HashMap<>();
  45 + rtn.put("status", ResponseCode.SUCCESS);
  46 + rtn.put("data", t);
  47 + return rtn;
  48 + }
  49 + @RequestMapping(value = "/all", method = RequestMethod.GET)
  50 + public Map<String, Object> list(@RequestParam Map<String, Object> param) {
  51 + List<T> tList = bService.list(param);
  52 + Map<String, Object> rtn = new HashMap<>();
  53 + rtn.put("status", ResponseCode.SUCCESS);
  54 + rtn.put("data", tList);
  55 + return rtn;
  56 + }
  57 + @RequestMapping(method = RequestMethod.GET)
  58 + public Map<String, Object> list(
  59 + @RequestParam Map<String, Object> map,
  60 + @RequestParam(defaultValue = "0") int page,
  61 + @RequestParam(defaultValue = "10") int size,
  62 + @RequestParam(defaultValue = "id") String order,
  63 + @RequestParam(defaultValue = "DESC") String direction) {
  64 + // 允许多个字段排序,order可以写单个字段,也可以写多个字段
  65 + // 多个字段格式:{col1},{col2},{col3},....,{coln}
  66 + List<String> order_columns = Splitter.on(",").trimResults().splitToList(order);
  67 + // 多字段排序:DESC,ASC...
  68 + List<String> order_dirs = Splitter.on(",").trimResults().splitToList(direction);
  69 +
  70 + Map<String, Object> rtn = new HashMap<>();
  71 +
  72 + if (order_dirs.size() == 1) { // 所有字段采用一种排序
  73 + rtn.put("status", ResponseCode.SUCCESS);
  74 + if (order_dirs.get(0).equals("ASC")) {
  75 + rtn.put("data", bService.list(map, new PageRequest(page, size, new Sort(Sort.Direction.ASC, order_columns))));
  76 + } else {
  77 + rtn.put("data", bService.list(map, new PageRequest(page, size, new Sort(Sort.Direction.DESC, order_columns))));
  78 + }
  79 + } else if (order_columns.size() == order_dirs.size()) {
  80 + List<Sort.Order> orderList = new ArrayList<>();
  81 + for (int i = 0; i < order_columns.size(); i++) {
  82 + if (null != order_dirs.get(i) && order_dirs.get(i).equals("ASC")) {
  83 + orderList.add(new Sort.Order(Sort.Direction.ASC, order_columns.get(i)));
  84 + } else {
  85 + orderList.add(new Sort.Order(Sort.Direction.DESC, order_columns.get(i)));
  86 + }
  87 + }
  88 + rtn.put("status", ResponseCode.SUCCESS);
  89 + rtn.put("data", bService.list(map, new PageRequest(page, size, new Sort(orderList))));
  90 + } else {
  91 + throw new RuntimeException("多字段排序参数格式问题,排序顺序和字段数不一致");
  92 + }
  93 +
  94 + return rtn;
  95 +
  96 + }
  97 +
  98 + // Delete操作
  99 + @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
  100 + public Map<String, Object> delete(@PathVariable("id") ID id) {
  101 + Map<String, Object> rtn = new HashMap<>();
  102 + try {
  103 + bService.delete(id);
  104 + rtn.put("status", ResponseCode.SUCCESS);
  105 + } catch (ScheduleException exp) {
  106 + rtn.put("status", ResponseCode.ERROR);
  107 + rtn.put("msg", exp.getMessage());
  108 + }
  109 +
  110 + return rtn;
  111 + }
  112 +
  113 +}
src/main/java/com/bsth/controller/schedule/GuideboardInfoController.java
1 package com.bsth.controller.schedule; 1 package com.bsth.controller.schedule;
2 2
3 -import com.bsth.controller.BaseController; 3 +import com.bsth.common.ResponseCode;
4 import com.bsth.entity.schedule.GuideboardInfo; 4 import com.bsth.entity.schedule.GuideboardInfo;
5 -import com.bsth.repository.schedule.GuideboardInfoRepository; 5 +import com.bsth.service.schedule.GuideboardInfoService;
  6 +import com.bsth.service.schedule.ScheduleException;
6 import com.bsth.service.schedule.utils.DataToolsProperties; 7 import com.bsth.service.schedule.utils.DataToolsProperties;
7 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.boot.context.properties.EnableConfigurationProperties; 9 import org.springframework.boot.context.properties.EnableConfigurationProperties;
9 -import org.springframework.web.bind.annotation.PathVariable;  
10 -import org.springframework.web.bind.annotation.RequestMapping;  
11 -import org.springframework.web.bind.annotation.RequestMethod;  
12 -import org.springframework.web.bind.annotation.RestController; 10 +import org.springframework.web.bind.annotation.*;
13 11
14 -import java.util.List; 12 +import java.util.HashMap;
15 import java.util.Map; 13 import java.util.Map;
16 14
17 /** 15 /**
18 - * Created by xu on 16/5/11. 16 + * 路牌管理控制器。
19 */ 17 */
20 @RestController 18 @RestController
21 @RequestMapping("gic") 19 @RequestMapping("gic")
22 @EnableConfigurationProperties(DataToolsProperties.class) 20 @EnableConfigurationProperties(DataToolsProperties.class)
23 -public class GuideboardInfoController extends BaseController<GuideboardInfo, Long> { 21 +public class GuideboardInfoController extends BController<GuideboardInfo, Long> {
24 @Autowired 22 @Autowired
25 - private DataToolsProperties dataToolsProperties;  
26 - @Autowired  
27 - private GuideboardInfoRepository guideboardInfoRepository;  
28 -  
29 - @Override  
30 - protected String getDataImportKtrClasspath() {  
31 - return dataToolsProperties.getGuideboardsDatainputktr();  
32 - } 23 + private GuideboardInfoService guideboardInfoService;
  24 +// @Autowired
  25 +// private DataToolsProperties dataToolsProperties;
  26 +// @Autowired
  27 +// private GuideboardInfoRepository guideboardInfoRepository;
  28 +//
  29 +// @Override
  30 +// protected String getDataImportKtrClasspath() {
  31 +// return dataToolsProperties.getGuideboardsDatainputktr();
  32 +// }
  33 +//
  34 +// @Override
  35 +// public GuideboardInfo findById(@PathVariable("id") Long aLong) {
  36 +// return guideboardInfoRepository.findOneExtend(aLong);
  37 +// }
  38 +//
  39 +//
  40 +// @RequestMapping(value = "/ttlpnames", method = RequestMethod.GET)
  41 +// public List<Map<String, Object>> findLpName(Long ttid) {
  42 +// return guideboardInfoRepository.findLpName(ttid);
  43 +// }
33 44
34 - @Override  
35 - public GuideboardInfo findById(@PathVariable("id") Long aLong) {  
36 - return guideboardInfoRepository.findOneExtend(aLong); 45 + @RequestMapping(value = "/validate1", method = RequestMethod.GET)
  46 + public Map<String, Object> validate1(@RequestParam Map<String, Object> param) {
  47 + Map<String, Object> rtn = new HashMap<>();
  48 + try {
  49 + // 路牌编号验证
  50 + GuideboardInfo guideboardInfo = new GuideboardInfo(
  51 + param.get("xl.id_eq"),
  52 + param.get("lpNo_eq"),
  53 + null
  54 + );
  55 + guideboardInfoService.validate(guideboardInfo);
  56 + rtn.put("status", ResponseCode.SUCCESS);
  57 + } catch (ScheduleException exp) {
  58 + rtn.put("status", ResponseCode.ERROR);
  59 + rtn.put("msg", exp.getMessage());
  60 + }
  61 + return rtn;
37 } 62 }
38 63
39 -  
40 - @RequestMapping(value = "/ttlpnames", method = RequestMethod.GET)  
41 - public List<Map<String, Object>> findLpName(Long ttid) {  
42 - return guideboardInfoRepository.findLpName(ttid); 64 + @RequestMapping(value = "/validate2", method = RequestMethod.GET)
  65 + public Map<String, Object> validate2(@RequestParam Map<String, Object> param) {
  66 + Map<String, Object> rtn = new HashMap<>();
  67 + try {
  68 + // 路牌名称验证
  69 + GuideboardInfo guideboardInfo = new GuideboardInfo(
  70 + param.get("xl.id_eq"),
  71 + null,
  72 + param.get("lpName_eq")
  73 + );
  74 + guideboardInfoService.validate(guideboardInfo);
  75 + rtn.put("status", ResponseCode.SUCCESS);
  76 + } catch (ScheduleException exp) {
  77 + rtn.put("status", ResponseCode.ERROR);
  78 + rtn.put("msg", exp.getMessage());
  79 + }
  80 + return rtn;
43 } 81 }
44 } 82 }
src/main/java/com/bsth/entity/Line.java
1 package com.bsth.entity; 1 package com.bsth.entity;
2 2
  3 +import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
3 import org.springframework.format.annotation.DateTimeFormat; 4 import org.springframework.format.annotation.DateTimeFormat;
4 5
5 import javax.persistence.*; 6 import javax.persistence.*;
@@ -23,6 +24,7 @@ import java.util.Date; @@ -23,6 +24,7 @@ import java.util.Date;
23 24
24 @Entity 25 @Entity
25 @Table(name = "bsth_c_line") 26 @Table(name = "bsth_c_line")
  27 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
26 public class Line implements Serializable { 28 public class Line implements Serializable {
27 29
28 @Id 30 @Id
src/main/java/com/bsth/entity/schedule/GuideboardInfo.java
@@ -2,9 +2,9 @@ package com.bsth.entity.schedule; @@ -2,9 +2,9 @@ package com.bsth.entity.schedule;
2 2
3 import com.bsth.entity.Line; 3 import com.bsth.entity.Line;
4 import com.bsth.entity.sys.SysUser; 4 import com.bsth.entity.sys.SysUser;
  5 +import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
5 6
6 import javax.persistence.*; 7 import javax.persistence.*;
7 -import javax.persistence.Table;  
8 import java.util.Date; 8 import java.util.Date;
9 9
10 /** 10 /**
@@ -17,6 +17,7 @@ import java.util.Date; @@ -17,6 +17,7 @@ import java.util.Date;
17 @NamedAttributeNode("xl") 17 @NamedAttributeNode("xl")
18 }) 18 })
19 }) 19 })
  20 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
20 public class GuideboardInfo { 21 public class GuideboardInfo {
21 22
22 /** 主键Id */ 23 /** 主键Id */
@@ -38,6 +39,10 @@ public class GuideboardInfo { @@ -38,6 +39,10 @@ public class GuideboardInfo {
38 @Column(nullable = false) 39 @Column(nullable = false)
39 private String lpType; 40 private String lpType;
40 41
  42 + /** 是否删除(标记) */
  43 + @Column(nullable = false)
  44 + private Boolean isCancel = false;
  45 +
41 /** 创建人 */ 46 /** 创建人 */
42 @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) 47 @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
43 private SysUser createBy; 48 private SysUser createBy;
@@ -53,6 +58,30 @@ public class GuideboardInfo { @@ -53,6 +58,30 @@ public class GuideboardInfo {
53 private Date updateDate; 58 private Date updateDate;
54 59
55 60
  61 + public GuideboardInfo() {}
  62 +
  63 + public GuideboardInfo(Object xlid, Object lpNo, Object lpName) {
  64 + Integer xlid_ = xlid == null ? null : Integer.valueOf(xlid.toString());
  65 + Integer lpNo_ = lpNo == null ? null : Integer.valueOf(lpNo.toString());
  66 + String lpName_ = lpName == null ? null : String.valueOf(lpName);
  67 +
  68 + if (xlid_ != null) {
  69 + Line line = new Line();
  70 + line.setId(xlid_);
  71 + this.xl = line;
  72 + }
  73 +
  74 + this.lpNo = lpNo_;
  75 + this.lpName = lpName_;
  76 + }
  77 +
  78 + public GuideboardInfo(Integer xlid, Integer lpNo) {
  79 + this(xlid, lpNo, null);
  80 + }
  81 + public GuideboardInfo(Integer xlid, String lpName) {
  82 + this(xlid, null, lpName);
  83 + }
  84 +
56 public Long getId() { 85 public Long getId() {
57 return id; 86 return id;
58 } 87 }
@@ -124,4 +153,12 @@ public class GuideboardInfo { @@ -124,4 +153,12 @@ public class GuideboardInfo {
124 public void setUpdateDate(Date updateDate) { 153 public void setUpdateDate(Date updateDate) {
125 this.updateDate = updateDate; 154 this.updateDate = updateDate;
126 } 155 }
  156 +
  157 + public Boolean getIsCancel() {
  158 + return isCancel;
  159 + }
  160 +
  161 + public void setIsCancel(Boolean isCancel) {
  162 + this.isCancel = isCancel;
  163 + }
127 } 164 }
src/main/java/com/bsth/service/schedule/BService.java 0 → 100644
  1 +package com.bsth.service.schedule;
  2 +
  3 +import org.springframework.data.domain.Page;
  4 +import org.springframework.data.domain.Pageable;
  5 +
  6 +import java.io.Serializable;
  7 +import java.util.List;
  8 +import java.util.Map;
  9 +
  10 +/**
  11 + * 基础service接口。
  12 + */
  13 +public interface BService<T, ID extends Serializable> {
  14 + // CRUD 操作
  15 + // Create,Update操作
  16 + T save(T t);
  17 + <S extends T> List<S> bulkSave(List<S> entities); // 批量保存(TODO:待测试)
  18 + // Research操作
  19 + T findById(ID id);
  20 + List<T> findAll();
  21 + Page<T> list(Map<String, Object> param, Pageable pageable);
  22 + List<T> list(Map<String, Object> param);
  23 + // Delete操作
  24 + void delete(ID id) throws ScheduleException;
  25 +}
src/main/java/com/bsth/service/schedule/GuideboardInfoService.java
1 package com.bsth.service.schedule; 1 package com.bsth.service.schedule;
2 2
3 import com.bsth.entity.schedule.GuideboardInfo; 3 import com.bsth.entity.schedule.GuideboardInfo;
4 -import com.bsth.service.BaseService;  
5 4
6 /** 5 /**
7 * Created by xu on 16/5/11. 6 * Created by xu on 16/5/11.
8 */ 7 */
9 -public interface GuideboardInfoService extends BaseService<GuideboardInfo, Long> { 8 +public interface GuideboardInfoService extends BService<GuideboardInfo, Long> {
  9 + public void validate(GuideboardInfo guideboardInfo) throws ScheduleException;
  10 + public void toggleCancel(Long id) throws ScheduleException;
10 } 11 }
src/main/java/com/bsth/service/schedule/GuideboardInfoServiceImpl.java deleted 100644 → 0
1 -package com.bsth.service.schedule;  
2 -  
3 -import com.bsth.entity.schedule.GuideboardInfo;  
4 -import com.bsth.service.impl.BaseServiceImpl;  
5 -import org.springframework.stereotype.Service;  
6 -  
7 -/**  
8 - * Created by xu on 16/5/11.  
9 - */  
10 -@Service  
11 -public class GuideboardInfoServiceImpl extends BaseServiceImpl<GuideboardInfo, Long> implements GuideboardInfoService {  
12 -}  
src/main/java/com/bsth/service/schedule/ScheduleException.java 0 → 100644
  1 +package com.bsth.service.schedule;
  2 +
  3 +/**
  4 + * Created by xu on 16/12/5.
  5 + */
  6 +public class ScheduleException extends Exception {
  7 + public ScheduleException(String message) {
  8 + super("计划调度业务错误==>>" + message);
  9 + }
  10 +}
src/main/java/com/bsth/service/schedule/impl/BServiceImpl.java 0 → 100644
  1 +package com.bsth.service.schedule.impl;
  2 +
  3 +import com.bsth.entity.search.CustomerSpecs;
  4 +import com.bsth.repository.BaseRepository;
  5 +import com.bsth.service.schedule.BService;
  6 +import com.bsth.service.schedule.ScheduleException;
  7 +import org.slf4j.Logger;
  8 +import org.slf4j.LoggerFactory;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.beans.factory.annotation.Value;
  11 +import org.springframework.data.domain.Page;
  12 +import org.springframework.data.domain.Pageable;
  13 +import org.springframework.data.jpa.domain.Specification;
  14 +
  15 +import javax.persistence.EntityManager;
  16 +import java.io.Serializable;
  17 +import java.util.ArrayList;
  18 +import java.util.List;
  19 +import java.util.Map;
  20 +
  21 +/**
  22 + * 基础BService实现。
  23 + */
  24 +public class BServiceImpl<T, ID extends Serializable> implements BService<T, ID> {
  25 + @Autowired
  26 + private BaseRepository<T, ID> baseRepository;
  27 + @Autowired
  28 + private EntityManager entityManager;
  29 + @Value("${hibernate.jdbc.batch_size}")
  30 + private int batchSize;
  31 +
  32 + /** 日志记录器 */
  33 + protected Logger logger = LoggerFactory.getLogger(this.getClass());
  34 +
  35 + // CRUD 操作
  36 + // Create,Update操作
  37 + @Override
  38 + public T save(T t) {
  39 + if (logger.isDebugEnabled()) {
  40 + logger.debug("save...");
  41 + }
  42 + return baseRepository.save(t);
  43 + }
  44 + @Override
  45 + public <S extends T> List<S> bulkSave(List<S> entities) {
  46 + if (logger.isDebugEnabled()) {
  47 + logger.debug("bulkSave...");
  48 + }
  49 +
  50 + // 不使用内部批量保存,自己实现批量保存
  51 + final List<S> savedEntities = new ArrayList<>(entities.size());
  52 + int i = 0;
  53 + for (S t : entities) {
  54 + entityManager.persist(t);
  55 + savedEntities.add(t);
  56 + i++;
  57 + if (i % batchSize == 0) {
  58 + entityManager.flush();
  59 + entityManager.clear();
  60 + }
  61 + }
  62 + return savedEntities;
  63 + }
  64 +
  65 + // Research操作
  66 + @Override
  67 + public T findById(ID id) {
  68 + if (logger.isDebugEnabled()) {
  69 + logger.debug("findById...");
  70 + }
  71 +
  72 + return baseRepository.findOne(id);
  73 + }
  74 + @Override
  75 + public List<T> findAll() {
  76 + if (logger.isDebugEnabled()) {
  77 + logger.debug("findAll...");
  78 + }
  79 +
  80 + return (List<T>) baseRepository.findAll();
  81 + }
  82 + @Override
  83 + public Page<T> list(Map<String, Object> param, Pageable pageable) {
  84 + if (logger.isDebugEnabled()) {
  85 + logger.debug("list(...,pageable)...");
  86 + }
  87 +
  88 + // 自定义查询参数
  89 + Specification<T> specification = new CustomerSpecs<>(param);
  90 + return baseRepository.findAll(specification, pageable);
  91 + }
  92 + @Override
  93 + public List<T> list(Map<String, Object> param) {
  94 + if (logger.isDebugEnabled()) {
  95 + logger.debug("list...");
  96 + }
  97 +
  98 + // 自定义查询参数
  99 + Specification<T> specification = new CustomerSpecs<>(param);
  100 + return baseRepository.findAll(specification);
  101 + }
  102 + // Delete操作
  103 + @Override
  104 + public void delete(ID id) throws ScheduleException {
  105 + if (logger.isDebugEnabled()) {
  106 + logger.debug("delete...");
  107 + }
  108 +
  109 + baseRepository.delete(id);
  110 + }
  111 +}
src/main/java/com/bsth/service/schedule/impl/GuideboardInfoServiceImpl.java 0 → 100644
  1 +package com.bsth.service.schedule.impl;
  2 +
  3 +import com.bsth.entity.schedule.GuideboardInfo;
  4 +import com.bsth.entity.schedule.TTInfoDetail;
  5 +import com.bsth.service.schedule.GuideboardInfoService;
  6 +import com.bsth.service.schedule.ScheduleException;
  7 +import com.bsth.service.schedule.TTInfoDetailService;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.stereotype.Service;
  10 +import org.springframework.util.CollectionUtils;
  11 +
  12 +import javax.transaction.Transactional;
  13 +import java.util.HashMap;
  14 +import java.util.List;
  15 +import java.util.Map;
  16 +
  17 +/**
  18 + * 路牌信息服务。
  19 + */
  20 +@Service
  21 +public class GuideboardInfoServiceImpl extends BServiceImpl<GuideboardInfo, Long> implements GuideboardInfoService {
  22 + @Autowired
  23 + private TTInfoDetailService ttInfoDetailService;
  24 +
  25 + // 验证方法
  26 + @Transactional
  27 + public void validate(GuideboardInfo guideboardInfo) throws ScheduleException {
  28 + // 查询条件
  29 + Map<String, Object> param = new HashMap<>();
  30 + if (guideboardInfo.getId() != null)
  31 + param.put("id_ne", guideboardInfo.getId());
  32 +
  33 + if (guideboardInfo.getXl() == null || guideboardInfo.getXl().getId() == null) {
  34 + throw new ScheduleException("线路未选择");
  35 + } else {
  36 + param.put("xl.id_eq", guideboardInfo.getXl().getId());
  37 +
  38 +// param.put("isCancel_eq", false); // 作废的也算入判定区
  39 + if (guideboardInfo.getLpNo() != null) {
  40 + if (guideboardInfo.getLpName() != null) {
  41 + // 如果两个都写了,分开查询
  42 + param.put("lpNo_eq", guideboardInfo.getLpNo());
  43 + if (!CollectionUtils.isEmpty(list(param))) {
  44 + throw new ScheduleException("路牌编号重复");
  45 + }
  46 + param.remove("lpNo_eq");
  47 + param.put("lpName_eq", guideboardInfo.getLpName());
  48 + if (!CollectionUtils.isEmpty(list(param))) {
  49 + throw new ScheduleException("路牌名称重复");
  50 + }
  51 +
  52 + } else {
  53 + param.put("lpNo_eq", guideboardInfo.getLpNo());
  54 + if (!CollectionUtils.isEmpty(list(param))) {
  55 + throw new ScheduleException("路牌编号重复");
  56 + }
  57 + }
  58 + } else {
  59 + if (guideboardInfo.getLpName() != null) {
  60 + param.put("lpName_eq", guideboardInfo.getLpName());
  61 + if (!CollectionUtils.isEmpty(list(param))) {
  62 + throw new ScheduleException("路牌名字重复");
  63 + }
  64 + } else {
  65 + // 都为空
  66 + throw new ScheduleException("路牌编号名字都为空");
  67 + }
  68 + }
  69 + }
  70 +
  71 + }
  72 +
  73 + @Transactional
  74 + @Override
  75 + public void delete(Long aLong) throws ScheduleException {
  76 + // 删除操作就是作废操作
  77 + toggleCancel(aLong);
  78 + }
  79 +
  80 + // 作废方法
  81 + @Transactional
  82 + public void toggleCancel(Long id) throws ScheduleException {
  83 + GuideboardInfo guideboardInfo = findById(id);
  84 + Map<String, Object> param = new HashMap<>();
  85 + if (guideboardInfo.getIsCancel()) {
  86 + validate(guideboardInfo);
  87 + guideboardInfo.setIsCancel(false);
  88 + } else {
  89 + param.clear();
  90 + param.put("xl.id_eq", guideboardInfo.getXl().getId());
  91 + param.put("ttinfo.isCancel_eq", false);
  92 + param.put("lp.id_eq", guideboardInfo.getId());
  93 + List<TTInfoDetail> ttInfoDetailList = (List<TTInfoDetail>) ttInfoDetailService.list(param);
  94 + if (CollectionUtils.isEmpty(ttInfoDetailList)) {
  95 + guideboardInfo.setIsCancel(true);
  96 + } else {
  97 + throw new ScheduleException("在时刻表" +
  98 + ttInfoDetailList.get(0).getTtinfo().getName() +
  99 + "已使用,无法删除!");
  100 + }
  101 + }
  102 + }
  103 +
  104 +}
src/main/resources/static/pages/scheduleApp/Gruntfile.js
@@ -14,6 +14,9 @@ module.exports = function (grunt) { @@ -14,6 +14,9 @@ module.exports = function (grunt) {
14 }, 14 },
15 concat_route: { // 所有模块的route配置合并的js文件 15 concat_route: { // 所有模块的route配置合并的js文件
16 src: ['module/common/prj-common-ui-route-state.js'] 16 src: ['module/common/prj-common-ui-route-state.js']
  17 + },
  18 + concat_service: { // 所有模块的servie服务合并的js文件
  19 + src: ['module/common/prj-common-globalservice.js']
17 } 20 }
18 21
19 //, 22 //,
@@ -69,11 +72,13 @@ module.exports = function (grunt) { @@ -69,11 +72,13 @@ module.exports = function (grunt) {
69 'module/common/dts1/load/loadingWidget.js', // loading界面指令 72 'module/common/dts1/load/loadingWidget.js', // loading界面指令
70 'module/common/dts1/validation/remoteValidation.js',// 服务端验证指令 73 'module/common/dts1/validation/remoteValidation.js',// 服务端验证指令
71 'module/common/dts1/validation/remoteValidationt2.js',// 服务端验证指令(时刻表专用) 74 'module/common/dts1/validation/remoteValidationt2.js',// 服务端验证指令(时刻表专用)
  75 + 'module/common/dts1/validation/remoteValidation3.js',// 服务端验证指令
72 'module/common/dts1/select/saSelect.js', // select整合指令1 76 'module/common/dts1/select/saSelect.js', // select整合指令1
73 'module/common/dts1/select/saSelect2.js', // select整合指令2 77 'module/common/dts1/select/saSelect2.js', // select整合指令2
74 'module/common/dts1/select/saSelect3.js', // select整合指令3 78 'module/common/dts1/select/saSelect3.js', // select整合指令3
75 'module/common/dts1/select/saSelect4.js', // select整合指令4 79 'module/common/dts1/select/saSelect4.js', // select整合指令4
76 'module/common/dts1/select/saSelect5.js', // select整合指令5 80 'module/common/dts1/select/saSelect5.js', // select整合指令5
  81 + 'module/common/dts2/ttinfotable/mySelect.js', // select整合指令
77 'module/common/dts1/radioButton/saRadiogroup.js', // 单选框组整合指令 82 'module/common/dts1/radioButton/saRadiogroup.js', // 单选框组整合指令
78 'module/common/dts1/checkbox/saCheckboxgroup.js', // 多选框组整合指令 83 'module/common/dts1/checkbox/saCheckboxgroup.js', // 多选框组整合指令
79 'module/common/dts2/dateGroup/saDategroup.js', // 特殊日期选择指令 84 'module/common/dts2/dateGroup/saDategroup.js', // 特殊日期选择指令
@@ -104,6 +109,26 @@ module.exports = function (grunt) { @@ -104,6 +109,26 @@ module.exports = function (grunt) {
104 'module/core/ttInfoManage/detailedit/route.js' // 时刻表明细管理模块 109 'module/core/ttInfoManage/detailedit/route.js' // 时刻表明细管理模块
105 ], 110 ],
106 dest: 'module/common/prj-common-ui-route-state.js' 111 dest: 'module/common/prj-common-ui-route-state.js'
  112 + },
  113 + service: {
  114 + options: {
  115 + banner: '//所有模块service配置\n'
  116 + },
  117 + src: [
  118 + 'module/basicInfo/busInfoManage/service.js', // 车辆基础信息管理service
  119 + 'module/basicInfo/deviceInfoManage/service.js', // 设备信息管理service
  120 + 'module/basicInfo/employeeInfoManage/service.js', // 人员基础信息管理service
  121 + 'module/core/busConfig/service.js', // 车辆配置service
  122 + 'module/core/busLineInfoStat/service.js', // 线路运营概览service
  123 + 'module/core/employeeConfig/service.js', // 人员配置service
  124 + 'module/core/guideboardManage/service.js', // 路牌管理service
  125 + 'module/core/rerunManage/service.js', // 套跑管理service
  126 + 'module/core/schedulePlanManage/service.js', // 排班计划管理service
  127 + 'module/core/scheduleRuleManage/service.js', // 排班规则管理service
  128 + 'module/core/ttInfoManage/service.js', // 时刻表管理service
  129 + 'module/common/prj-common-globalservice-legacy.js' // 其他用service
  130 + ],
  131 + dest: 'module/common/prj-common-globalservice.js'
107 } 132 }
108 }, 133 },
109 134
@@ -440,4 +465,14 @@ module.exports = function (grunt) { @@ -440,4 +465,14 @@ module.exports = function (grunt) {
440 'clean:concat_route', 'concat:route' 465 'clean:concat_route', 'concat:route'
441 ]); 466 ]);
442 467
  468 + /*
  469 + 定义了一个service的grunt任务
  470 + 任务组有顺序,如下说明:
  471 + 1、clean:concat_route,清除合并生成的prj-common-globalservice.js文件
  472 + 2、concat:route,重新合并prj-common-globalservice.js文件
  473 + */
  474 + grunt.registerTask('service', [
  475 + 'clean:concat_service', 'concat:service'
  476 + ]);
  477 +
443 }; 478 };
444 \ No newline at end of file 479 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/service.js 0 → 100644
  1 +// 车辆信息service
  2 +angular.module('ScheduleApp').factory('BusInfoManageService_g', ['$resource', function($resource) {
  3 + return {
  4 + rest: $resource(
  5 + '/cars/:id',
  6 + {order: 'carCode', direction: 'ASC', id: '@id_route'},
  7 + {
  8 + list: {
  9 + method: 'GET',
  10 + params: {
  11 + page: 0
  12 + }
  13 + },
  14 + get: {
  15 + method: 'GET'
  16 + },
  17 + save: {
  18 + method: 'POST'
  19 + }
  20 + }
  21 + ),
  22 + import: $resource(
  23 + '/cars/importfile',
  24 + {},
  25 + {
  26 + do: {
  27 + method: 'POST',
  28 + headers: {
  29 + 'Content-Type': 'application/x-www-form-urlencoded'
  30 + },
  31 + transformRequest: function(obj) {
  32 + var str = [];
  33 + for (var p in obj) {
  34 + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  35 + }
  36 + return str.join("&");
  37 + }
  38 + }
  39 + }
  40 + ),
  41 + validate: $resource(
  42 + '/cars/validate/:type',
  43 + {},
  44 + {
  45 + insideCode: {
  46 + method: 'GET'
  47 + }
  48 + }
  49 + ),
  50 + dataTools: $resource(
  51 + '/cars/:type',
  52 + {},
  53 + {
  54 + dataExport: {
  55 + method: 'GET',
  56 + responseType: "arraybuffer",
  57 + params: {
  58 + type: "dataExport"
  59 + },
  60 + transformResponse: function(data, headers){
  61 + return {data : data};
  62 + }
  63 + }
  64 + }
  65 + )
  66 + };
  67 +}]);
0 \ No newline at end of file 68 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/service.js 0 → 100644
  1 +// 车辆设备信息service
  2 +angular.module('ScheduleApp').factory('DeviceInfoManageService_g', ['$resource', function($resource) {
  3 + return $resource(
  4 + '/cde/:id',
  5 + {order: 'xl,isCancel,cl,qyrq', direction: 'ASC,ASC,ASC,DESC', id: '@id_route'},
  6 + {
  7 + list: {
  8 + method: 'GET',
  9 + params: {
  10 + page: 0
  11 + }
  12 + },
  13 + get: {
  14 + method: 'GET'
  15 + },
  16 + save: {
  17 + method: 'POST'
  18 + },
  19 + delete: {
  20 + method: 'DELETE'
  21 + }
  22 + }
  23 + );
  24 +}]);
0 \ No newline at end of file 25 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/service.js 0 → 100644
  1 +// 人员信息service
  2 +angular.module('ScheduleApp').factory('EmployeeInfoManageService_g', ['$resource', function($resource) {
  3 + return {
  4 + rest : $resource(
  5 + '/personnel/:id',
  6 + {order: 'jobCode', direction: 'ASC', id: '@id_route'},
  7 + {
  8 + list: {
  9 + method: 'GET',
  10 + params: {
  11 + page: 0
  12 + }
  13 + },
  14 + get: {
  15 + method: 'GET'
  16 + },
  17 + save: {
  18 + method: 'POST'
  19 + }
  20 + }
  21 + ),
  22 + validate: $resource(
  23 + '/personnel/validate/:type',
  24 + {},
  25 + {
  26 + jobCode: {
  27 + method: 'GET'
  28 + }
  29 + }
  30 + ),
  31 + dataTools: $resource(
  32 + '/personnel/:type',
  33 + {},
  34 + {
  35 + dataExport: {
  36 + method: 'GET',
  37 + responseType: "arraybuffer",
  38 + params: {
  39 + type: "dataExport"
  40 + },
  41 + transformResponse: function(data, headers){
  42 + return {data : data};
  43 + }
  44 + }
  45 + }
  46 + )
  47 + };
  48 +}]);
src/main/resources/static/pages/scheduleApp/module/common/directives/.gitkeep.txt 0 → 100644
src/main/resources/static/pages/scheduleApp/module/common/directives/select/mySelect.js 0 → 100644
  1 +/**
  2 + * mySelect指令,封装uiselect指令,封装内部数据获取,只支持单选
  3 + * cm(必须):绑定外部对象,因为关联的字段不只一个,单独使用ngModel不够
  4 + * cmoptions(必须):描述绑定的逻辑配置对象,格式如下:
  5 + *
  6 + * // TODO:
  7 + */
  8 +angular.module('ScheduleApp').directive('mySelect', [
  9 + function() {
  10 + return {
  11 + restrict: 'E',
  12 + template: '<div>bioxuxuan</div>',
  13 + require: 'ngModel',
  14 + compile: function(tElem, tAttrs) {
  15 + return {
  16 + pre: function(scope, element, attr) {
  17 +
  18 + },
  19 + post: function(scope, element, attr, ngModelCtr) {
  20 + // model -> view
  21 + ngModelCtr.$formatters.push(function(modelValue) {
  22 + // 监控model的变化
  23 + if (typeof modelValue != "undefined") {
  24 + console.log(modelValue);
  25 +
  26 + return modelValue;
  27 + }
  28 + });
  29 +
  30 + ngModelCtr.$render = function() {
  31 + if (typeof scope.ctrl.say != "undefined") {
  32 + element.find('div').css('color', 'red');
  33 + }
  34 + };
  35 +
  36 + ngModelCtr.$setViewValue("init value");
  37 +
  38 +
  39 + }
  40 + }
  41 + }
  42 + }
  43 + }
  44 +]);
0 \ No newline at end of file 45 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/common/directives/select/mySelectTemplate.html 0 → 100644
  1 +<div class="input-group" name="指令compile阶段设定1"
  2 + ng-model="$saSelectCtrl.$$internalmodel">
  3 + <ui-select ng-model="$saSelectCtrl.$$internal_select_value" on-select="$saSelectCtrl.$$internal_select_fn($item)"
  4 + theme="bootstrap" >
  5 + <ui-select-match placeholder="指令compile阶段设定">指令compile阶段设定2</ui-select-match>
  6 + <ui-select-choices repeat="指令compile阶段设定3"
  7 + refresh="$saSelectCtrl.$$internal_refresh_fn($select.search)"
  8 + refresh-delay="10">
  9 +
  10 + 指令compile阶段设定777
  11 +
  12 + </ui-select-choices>
  13 + </ui-select>
  14 + <span class="input-group-btn">
  15 + <button type="button" ng-click="$saSelectCtrl.$$internal_remove_fn()" class="btn btn-default">
  16 + <span class="glyphicon glyphicon-trash"></span>
  17 + </button>
  18 + </span>
  19 +</div>
0 \ No newline at end of file 20 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/common/dts1/select/saSelect5.js
@@ -124,23 +124,40 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [ @@ -124,23 +124,40 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
124 124
125 // 添加选中事件处理函数 125 // 添加选中事件处理函数
126 scope[ctrlAs].$$internal_select_fn = function($item) { 126 scope[ctrlAs].$$internal_select_fn = function($item) {
127 - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";"); 127 + if ($dcname_attr.indexOf('_') > 0) {
  128 + scope[ctrlAs].model[$dcname_attr] = $item[$icname_attr];
  129 + } else {
  130 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");
  131 + }
  132 +
128 133
129 eval("var obj=" + $cmaps_attr); 134 eval("var obj=" + $cmaps_attr);
130 for (var mc in obj) { // model的字段名:内部数据源对应字段名 135 for (var mc in obj) { // model的字段名:内部数据源对应字段名
131 var ic = obj[mc]; // 内部数据源对应字段 136 var ic = obj[mc]; // 内部数据源对应字段
132 - eval("scope[ctrlAs].model" + "." + mc + " = $item" + "." + ic + ";"); 137 + if (mc.indexOf('_') > 0) {
  138 + scope[ctrlAs].model[mc] = $item[ic];
  139 + } else {
  140 + eval("scope[ctrlAs].model" + "." + mc + " = $item" + "." + ic + ";");
  141 + }
133 } 142 }
134 }; 143 };
135 144
136 // 删除选中事件处理函数 145 // 删除选中事件处理函数
137 scope[ctrlAs].$$internal_remove_fn = function() { 146 scope[ctrlAs].$$internal_remove_fn = function() {
138 - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;"); 147 + if ($dcname_attr.indexOf('_') > 0) {
  148 + scope[ctrlAs].model[$dcname_attr] = undefined;
  149 + } else {
  150 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;");
  151 + }
139 152
140 eval("var obj=" + $cmaps_attr); 153 eval("var obj=" + $cmaps_attr);
141 var mc; // model的字段名 154 var mc; // model的字段名
142 for (mc in obj) { 155 for (mc in obj) {
143 - eval("scope[ctrlAs].model" + "." + mc + " = undefined;"); 156 + if (mc.indexOf('_') > 0) {
  157 + scope[ctrlAs].model[mc] = undefined;
  158 + } else {
  159 + eval("scope[ctrlAs].model" + "." + mc + " = undefined;");
  160 + }
144 } 161 }
145 }; 162 };
146 163
@@ -381,7 +398,11 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [ @@ -381,7 +398,11 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
381 */ 398 */
382 scope.$watch( 399 scope.$watch(
383 function() { 400 function() {
384 - return eval("scope." + ctrlAs + ".model" + "." + $dcname_attr); 401 + if ($dcname_attr.indexOf('_') > 0) {
  402 + return scope[ctrlAs].model[$dcname_attr];
  403 + } else {
  404 + return eval("scope." + ctrlAs + ".model" + "." + $dcname_attr);
  405 + }
385 }, 406 },
386 function(newValue, oldValue) { 407 function(newValue, oldValue) {
387 if (newValue === undefined && oldValue === undefined) { 408 if (newValue === undefined && oldValue === undefined) {
src/main/resources/static/pages/scheduleApp/module/common/dts1/validation/remoteValidation.js
@@ -27,7 +27,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidation&#39;, [ @@ -27,7 +27,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidation&#39;, [
27 var $watch_rvparam_obj = undefined; 27 var $watch_rvparam_obj = undefined;
28 28
29 // 验证数据 29 // 验证数据
30 - var $$internal_validate = function(ngModelCtrl) { 30 + var $$internal_validate = function(ngModelCtrl, scope) {
31 if ($watch_rvtype && $watch_rvparam_obj) { 31 if ($watch_rvtype && $watch_rvparam_obj) {
32 // 获取查询参数模版 32 // 获取查询参数模版
33 var paramTemplate = $$SearchInfoService_g.validate[$watch_rvtype].template; 33 var paramTemplate = $$SearchInfoService_g.validate[$watch_rvtype].template;
@@ -52,6 +52,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidation&#39;, [ @@ -52,6 +52,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidation&#39;, [
52 ngModelCtrl.$setValidity('remote', true); 52 ngModelCtrl.$setValidity('remote', true);
53 } else { 53 } else {
54 ngModelCtrl.$setValidity('remote', false); 54 ngModelCtrl.$setValidity('remote', false);
  55 + scope.$remote_msg = result.msg;
55 } 56 }
56 }, 57 },
57 function(result) { 58 function(result) {
@@ -74,7 +75,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidation&#39;, [ @@ -74,7 +75,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidation&#39;, [
74 attr.$observe("remotevtype", function(value) { 75 attr.$observe("remotevtype", function(value) {
75 if (value && value != "") { 76 if (value && value != "") {
76 $watch_rvtype = value; 77 $watch_rvtype = value;
77 - $$internal_validate(ngModelCtrl); 78 + $$internal_validate(ngModelCtrl, scope);
78 } 79 }
79 }); 80 });
80 /** 81 /**
@@ -86,7 +87,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidation&#39;, [ @@ -86,7 +87,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidation&#39;, [
86 return; 87 return;
87 } 88 }
88 $watch_rvparam_obj = JSON.parse(value); 89 $watch_rvparam_obj = JSON.parse(value);
89 - $$internal_validate(ngModelCtrl); 90 + $$internal_validate(ngModelCtrl, scope);
90 } 91 }
91 }); 92 });
92 } 93 }
src/main/resources/static/pages/scheduleApp/module/common/dts1/validation/remoteValidation3.js 0 → 100644
  1 +/**
  2 + * remoteValidationt3 远程验证指令(监控依赖的model变化)
  3 + * 属性如下:
  4 + * remotevtype(必须):验证类型(在service中有对应映射),如rvtype="xl"
  5 + * remotemodel(必须):关联的model
  6 + * remotemodelcol(必须):关联的model属性
  7 + */
  8 +angular.module('ScheduleApp').directive(
  9 + 'remoteValidation3',
  10 + [
  11 + '$$SearchInfoService_g',
  12 + '$q',
  13 + function($$SearchInfoService_g, $q) {
  14 + return {
  15 + restrict: 'A', // 属性
  16 + require: '^ngModel', // 依赖所属指令的ngModel
  17 + compile: function(tElem, tAttrs) {
  18 + var remotevtype_attr = tAttrs['remotevtype'];
  19 + var remotemodel_attr = tAttrs['remotemodel'];
  20 + var remotemodelcol_attr = tAttrs['remotemodelcol'];
  21 + if (!remotevtype_attr) {
  22 + throw new Error("remotevtype属性必须填写");
  23 + }
  24 + if (!remotemodel_attr) {
  25 + throw new Error("remotemodel属性必须填写");
  26 + }
  27 + if (!remotemodelcol_attr) {
  28 + throw new Error("remotemodelcol属性必须填写");
  29 + }
  30 +
  31 + return {
  32 + pre: function(scope, element, attr) {
  33 +
  34 + },
  35 +
  36 + post: function(scope, element, attr, ngModelCtrl) {
  37 + ngModelCtrl.$asyncValidators.remote =
  38 + function(modelValue, viewValue) {
  39 + var deferred = $q.defer();
  40 +
  41 + // 远端验证service
  42 + var param = JSON.parse(attr['remotemodel']);
  43 + console.log(param);
  44 + param[remotemodelcol_attr] = modelValue;
  45 + $$SearchInfoService_g.validate[remotevtype_attr].remote.do(
  46 + param,
  47 + function(result) {
  48 + if (result.status == "SUCCESS") {
  49 + deferred.resolve();
  50 + } else {
  51 + scope.$remote_msg = result.msg;
  52 + deferred.reject();
  53 + }
  54 + },
  55 + function(result) {
  56 + deferred.reject();
  57 + }
  58 + );
  59 +
  60 + return deferred.promise;
  61 + };
  62 + }
  63 + };
  64 + }
  65 + }
  66 + }
  67 + ]
  68 +);
0 \ No newline at end of file 69 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/common/dts2/ttinfotable/mySelect.js 0 → 100644
  1 +/**
  2 + * mySelect指令,封装uiselect指令,封装内部数据获取,只支持单选
  3 + * cm(必须):绑定外部对象,因为关联的字段不只一个,单独使用ngModel不够
  4 + * cmoptions(必须):描述绑定的逻辑配置对象,格式如下:
  5 + *
  6 + * // TODO:
  7 + */
  8 +angular.module('ScheduleApp').directive('mySelect', [
  9 + function() {
  10 + return {
  11 + restrict: 'E',
  12 + template: '<div>bioxuxuan</div>',
  13 + require: 'ngModel',
  14 + compile: function(tElem, tAttrs) {
  15 + return {
  16 + pre: function(scope, element, attr) {
  17 +
  18 + },
  19 + post: function(scope, element, attr, ngModelCtr) {
  20 + // model -> view
  21 + ngModelCtr.$formatters.push(function(modelValue) {
  22 + // 监控model的变化
  23 + if (typeof modelValue != "undefined") {
  24 + console.log(modelValue);
  25 +
  26 + return modelValue;
  27 + }
  28 + });
  29 +
  30 + ngModelCtr.$render = function() {
  31 + if (typeof scope.ctrl.say != "undefined") {
  32 + element.find('div').css('color', 'red');
  33 + }
  34 + };
  35 +
  36 + ngModelCtr.$setViewValue("init value");
  37 +
  38 +
  39 + }
  40 + }
  41 + }
  42 + }
  43 + }
  44 +]);
0 \ No newline at end of file 45 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/common/dts2/ttinfotable/mySelectTemplate.html 0 → 100644
  1 +<div class="input-group" name="指令compile阶段设定1"
  2 + ng-model="$saSelectCtrl.$$internalmodel">
  3 + <ui-select ng-model="$saSelectCtrl.$$internal_select_value" on-select="$saSelectCtrl.$$internal_select_fn($item)"
  4 + theme="bootstrap" >
  5 + <ui-select-match placeholder="指令compile阶段设定">指令compile阶段设定2</ui-select-match>
  6 + <ui-select-choices repeat="指令compile阶段设定3"
  7 + refresh="$saSelectCtrl.$$internal_refresh_fn($select.search)"
  8 + refresh-delay="10">
  9 +
  10 + 指令compile阶段设定777
  11 +
  12 + </ui-select-choices>
  13 + </ui-select>
  14 + <span class="input-group-btn">
  15 + <button type="button" ng-click="$saSelectCtrl.$$internal_remove_fn()" class="btn btn-default">
  16 + <span class="glyphicon glyphicon-trash"></span>
  17 + </button>
  18 + </span>
  19 +</div>
0 \ No newline at end of file 20 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
@@ -49,7 +49,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidation&#39;, [ @@ -49,7 +49,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidation&#39;, [
49 var $watch_rvparam_obj = undefined; 49 var $watch_rvparam_obj = undefined;
50 50
51 // 验证数据 51 // 验证数据
52 - var $$internal_validate = function(ngModelCtrl) { 52 + var $$internal_validate = function(ngModelCtrl, scope) {
53 if ($watch_rvtype && $watch_rvparam_obj) { 53 if ($watch_rvtype && $watch_rvparam_obj) {
54 // 获取查询参数模版 54 // 获取查询参数模版
55 var paramTemplate = $$SearchInfoService_g.validate[$watch_rvtype].template; 55 var paramTemplate = $$SearchInfoService_g.validate[$watch_rvtype].template;
@@ -74,6 +74,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidation&#39;, [ @@ -74,6 +74,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidation&#39;, [
74 ngModelCtrl.$setValidity('remote', true); 74 ngModelCtrl.$setValidity('remote', true);
75 } else { 75 } else {
76 ngModelCtrl.$setValidity('remote', false); 76 ngModelCtrl.$setValidity('remote', false);
  77 + scope.$remote_msg = result.msg;
77 } 78 }
78 }, 79 },
79 function(result) { 80 function(result) {
@@ -96,7 +97,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidation&#39;, [ @@ -96,7 +97,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidation&#39;, [
96 attr.$observe("remotevtype", function(value) { 97 attr.$observe("remotevtype", function(value) {
97 if (value && value != "") { 98 if (value && value != "") {
98 $watch_rvtype = value; 99 $watch_rvtype = value;
99 - $$internal_validate(ngModelCtrl); 100 + $$internal_validate(ngModelCtrl, scope);
100 } 101 }
101 }); 102 });
102 /** 103 /**
@@ -108,7 +109,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidation&#39;, [ @@ -108,7 +109,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidation&#39;, [
108 return; 109 return;
109 } 110 }
110 $watch_rvparam_obj = JSON.parse(value); 111 $watch_rvparam_obj = JSON.parse(value);
111 - $$internal_validate(ngModelCtrl); 112 + $$internal_validate(ngModelCtrl, scope);
112 } 113 }
113 }); 114 });
114 } 115 }
@@ -218,6 +219,74 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidationt2&#39;, [ @@ -218,6 +219,74 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidationt2&#39;, [
218 } 219 }
219 ]); 220 ]);
220 221
  222 +/**
  223 + * remoteValidationt3 远程验证指令(监控依赖的model变化)
  224 + * 属性如下:
  225 + * remotevtype(必须):验证类型(在service中有对应映射),如rvtype="xl"
  226 + * remotemodel(必须):关联的model
  227 + * remotemodelcol(必须):关联的model属性
  228 + */
  229 +angular.module('ScheduleApp').directive(
  230 + 'remoteValidation3',
  231 + [
  232 + '$$SearchInfoService_g',
  233 + '$q',
  234 + function($$SearchInfoService_g, $q) {
  235 + return {
  236 + restrict: 'A', // 属性
  237 + require: '^ngModel', // 依赖所属指令的ngModel
  238 + compile: function(tElem, tAttrs) {
  239 + var remotevtype_attr = tAttrs['remotevtype'];
  240 + var remotemodel_attr = tAttrs['remotemodel'];
  241 + var remotemodelcol_attr = tAttrs['remotemodelcol'];
  242 + if (!remotevtype_attr) {
  243 + throw new Error("remotevtype属性必须填写");
  244 + }
  245 + if (!remotemodel_attr) {
  246 + throw new Error("remotemodel属性必须填写");
  247 + }
  248 + if (!remotemodelcol_attr) {
  249 + throw new Error("remotemodelcol属性必须填写");
  250 + }
  251 +
  252 + return {
  253 + pre: function(scope, element, attr) {
  254 +
  255 + },
  256 +
  257 + post: function(scope, element, attr, ngModelCtrl) {
  258 + ngModelCtrl.$asyncValidators.remote =
  259 + function(modelValue, viewValue) {
  260 + var deferred = $q.defer();
  261 +
  262 + // 远端验证service
  263 + var param = JSON.parse(attr['remotemodel']);
  264 + console.log(param);
  265 + param[remotemodelcol_attr] = modelValue;
  266 + $$SearchInfoService_g.validate[remotevtype_attr].remote.do(
  267 + param,
  268 + function(result) {
  269 + if (result.status == "SUCCESS") {
  270 + deferred.resolve();
  271 + } else {
  272 + scope.$remote_msg = result.msg;
  273 + deferred.reject();
  274 + }
  275 + },
  276 + function(result) {
  277 + deferred.reject();
  278 + }
  279 + );
  280 +
  281 + return deferred.promise;
  282 + };
  283 + }
  284 + };
  285 + }
  286 + }
  287 + }
  288 + ]
  289 +);
221 290
222 angular.module('ScheduleApp').directive("saSelect", ['$timeout', function($timeout) { 291 angular.module('ScheduleApp').directive("saSelect", ['$timeout', function($timeout) {
223 return { 292 return {
@@ -1331,23 +1400,40 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [ @@ -1331,23 +1400,40 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
1331 1400
1332 // 添加选中事件处理函数 1401 // 添加选中事件处理函数
1333 scope[ctrlAs].$$internal_select_fn = function($item) { 1402 scope[ctrlAs].$$internal_select_fn = function($item) {
1334 - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";"); 1403 + if ($dcname_attr.indexOf('_') > 0) {
  1404 + scope[ctrlAs].model[$dcname_attr] = $item[$icname_attr];
  1405 + } else {
  1406 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";");
  1407 + }
  1408 +
1335 1409
1336 eval("var obj=" + $cmaps_attr); 1410 eval("var obj=" + $cmaps_attr);
1337 for (var mc in obj) { // model的字段名:内部数据源对应字段名 1411 for (var mc in obj) { // model的字段名:内部数据源对应字段名
1338 var ic = obj[mc]; // 内部数据源对应字段 1412 var ic = obj[mc]; // 内部数据源对应字段
1339 - eval("scope[ctrlAs].model" + "." + mc + " = $item" + "." + ic + ";"); 1413 + if (mc.indexOf('_') > 0) {
  1414 + scope[ctrlAs].model[mc] = $item[ic];
  1415 + } else {
  1416 + eval("scope[ctrlAs].model" + "." + mc + " = $item" + "." + ic + ";");
  1417 + }
1340 } 1418 }
1341 }; 1419 };
1342 1420
1343 // 删除选中事件处理函数 1421 // 删除选中事件处理函数
1344 scope[ctrlAs].$$internal_remove_fn = function() { 1422 scope[ctrlAs].$$internal_remove_fn = function() {
1345 - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;"); 1423 + if ($dcname_attr.indexOf('_') > 0) {
  1424 + scope[ctrlAs].model[$dcname_attr] = undefined;
  1425 + } else {
  1426 + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;");
  1427 + }
1346 1428
1347 eval("var obj=" + $cmaps_attr); 1429 eval("var obj=" + $cmaps_attr);
1348 var mc; // model的字段名 1430 var mc; // model的字段名
1349 for (mc in obj) { 1431 for (mc in obj) {
1350 - eval("scope[ctrlAs].model" + "." + mc + " = undefined;"); 1432 + if (mc.indexOf('_') > 0) {
  1433 + scope[ctrlAs].model[mc] = undefined;
  1434 + } else {
  1435 + eval("scope[ctrlAs].model" + "." + mc + " = undefined;");
  1436 + }
1351 } 1437 }
1352 }; 1438 };
1353 1439
@@ -1588,7 +1674,11 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [ @@ -1588,7 +1674,11 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
1588 */ 1674 */
1589 scope.$watch( 1675 scope.$watch(
1590 function() { 1676 function() {
1591 - return eval("scope." + ctrlAs + ".model" + "." + $dcname_attr); 1677 + if ($dcname_attr.indexOf('_') > 0) {
  1678 + return scope[ctrlAs].model[$dcname_attr];
  1679 + } else {
  1680 + return eval("scope." + ctrlAs + ".model" + "." + $dcname_attr);
  1681 + }
1592 }, 1682 },
1593 function(newValue, oldValue) { 1683 function(newValue, oldValue) {
1594 if (newValue === undefined && oldValue === undefined) { 1684 if (newValue === undefined && oldValue === undefined) {
@@ -1608,6 +1698,50 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [ @@ -1608,6 +1698,50 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
1608 }; 1698 };
1609 } 1699 }
1610 ]); 1700 ]);
  1701 +/**
  1702 + * mySelect指令,封装uiselect指令,封装内部数据获取,只支持单选
  1703 + * cm(必须):绑定外部对象,因为关联的字段不只一个,单独使用ngModel不够
  1704 + * cmoptions(必须):描述绑定的逻辑配置对象,格式如下:
  1705 + *
  1706 + * // TODO:
  1707 + */
  1708 +angular.module('ScheduleApp').directive('mySelect', [
  1709 + function() {
  1710 + return {
  1711 + restrict: 'E',
  1712 + template: '<div>bioxuxuan</div>',
  1713 + require: 'ngModel',
  1714 + compile: function(tElem, tAttrs) {
  1715 + return {
  1716 + pre: function(scope, element, attr) {
  1717 +
  1718 + },
  1719 + post: function(scope, element, attr, ngModelCtr) {
  1720 + // model -> view
  1721 + ngModelCtr.$formatters.push(function(modelValue) {
  1722 + // 监控model的变化
  1723 + if (typeof modelValue != "undefined") {
  1724 + console.log(modelValue);
  1725 +
  1726 + return modelValue;
  1727 + }
  1728 + });
  1729 +
  1730 + ngModelCtr.$render = function() {
  1731 + if (typeof scope.ctrl.say != "undefined") {
  1732 + element.find('div').css('color', 'red');
  1733 + }
  1734 + };
  1735 +
  1736 + ngModelCtr.$setViewValue("init value");
  1737 +
  1738 +
  1739 + }
  1740 + }
  1741 + }
  1742 + }
  1743 + }
  1744 +]);
1611 1745
1612 /** 1746 /**
1613 * saRadiogroup指令 1747 * saRadiogroup指令
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice-legacy.js 0 → 100644
  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 +
  79 +/**
  80 + * saSelect2指令,根据属性值,动态载入数据,然后支持拼音搜索,点击右边的按钮清除选择并重新载入数据。
  81 + * 1、compile阶段使用的属性如下:
  82 + * required:用于和表单验证连接,指定成required="true"才有效。
  83 + * 2、link阶段使用的属性如下
  84 + * model:关联的模型对象
  85 + * name:表单验证时需要的名字
  86 + * type:关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加
  87 + * modelcolname1:关联的模型字段名字1(一般应该是编码字段)
  88 + * modelcolname2:关联的模型字段名字2(一般应该是名字字段)
  89 + * datacolname1;内部数据对应的字段名字1(与模型字段1对应)
  90 + * datacolname2:内部数据对应的字段名字2(与模型字段2对应)
  91 + * showcolname:下拉框显示的内部数据字段名(注意:不是模型数据字段名),TODO:以后考虑放动态表达式,并在compile阶段使用
  92 + * placeholder:select placeholder字符串描述
  93 + *
  94 + * $$pyFilter,内部的filter指令,结合简拼音进行拼音过滤。
  95 + * $$SearchInfoService_g,内部使用的数据服务
  96 + */
  97 +// saSelect2指令使用的内部信service
  98 +angular.module('ScheduleApp').factory('$$SearchInfoService_g', ['$resource', function($resource) {
  99 + return {
  100 + xl: $resource(
  101 + '/line/:type',
  102 + {order: 'name', direction: 'ASC'},
  103 + {
  104 + list: {
  105 + method: 'GET',
  106 + isArray: true
  107 + }
  108 + }
  109 + ),
  110 + xlinfo: $resource(
  111 + '/lineInformation/:type',
  112 + {order: 'line.name', direction: 'ASC'},
  113 + {
  114 + list: {
  115 + method: 'GET',
  116 + isArray: true
  117 + }
  118 + }
  119 + ),
  120 + zd: $resource(
  121 + '/stationroute/stations',
  122 + {order: 'stationCode', direction: 'ASC'},
  123 + {
  124 + list: {
  125 + method: 'GET',
  126 + isArray: true
  127 + }
  128 + }
  129 + ),
  130 + tcc: $resource(
  131 + '/carpark/:type',
  132 + {order: 'parkCode', direction: 'ASC'},
  133 + {
  134 + list: {
  135 + method: 'GET',
  136 + isArray: true
  137 + }
  138 + }
  139 + ),
  140 + ry: $resource(
  141 + '/personnel/:type',
  142 + {order: 'personnelName', direction: 'ASC'},
  143 + {
  144 + list: {
  145 + method: 'GET',
  146 + isArray: true
  147 + }
  148 + }
  149 + ),
  150 + cl: $resource(
  151 + '/cars/:type',
  152 + {order: "insideCode", direction: 'ASC'},
  153 + {
  154 + list: {
  155 + method: 'GET',
  156 + isArray: true
  157 + }
  158 + }
  159 + ),
  160 + ttInfo: $resource(
  161 + '/tic/:type',
  162 + {order: "name", direction: 'ASC'},
  163 + {
  164 + list: {
  165 + method: 'GET',
  166 + isArray: true
  167 + }
  168 + }
  169 + ),
  170 + lpInfo: $resource(
  171 + '/gic/ttlpnames',
  172 + {order: "lpName", direction: 'ASC'},
  173 + {
  174 + list: {
  175 + method: 'GET',
  176 + isArray: true
  177 + }
  178 + }
  179 + ),
  180 + lpInfo2: $resource(
  181 + '/gic/:type',
  182 + {order: "lpName", direction: 'ASC'},
  183 + {
  184 + list: {
  185 + method: 'GET',
  186 + isArray: true
  187 + }
  188 + }
  189 + ),
  190 + cci: $resource(
  191 + '/cci/cars',
  192 + {},
  193 + {
  194 + list: {
  195 + method: 'GET',
  196 + isArray: true
  197 + }
  198 + }
  199 +
  200 + ),
  201 + cci2: $resource(
  202 + '/cci/:type',
  203 + {},
  204 + {
  205 + list: {
  206 + method: 'GET',
  207 + isArray: true
  208 + }
  209 + }
  210 + ),
  211 + cci3: $resource(
  212 + '/cci/cars2',
  213 + {},
  214 + {
  215 + list: {
  216 + method: 'GET',
  217 + isArray: true
  218 + }
  219 + }
  220 +
  221 + ),
  222 + eci: $resource(
  223 + '/eci/jsy',
  224 + {},
  225 + {
  226 + list: {
  227 + method: 'GET',
  228 + isArray: true
  229 + }
  230 + }
  231 + ),
  232 + eci2: $resource(
  233 + '/eci/spy',
  234 + {},
  235 + {
  236 + list: {
  237 + method: 'GET',
  238 + isArray: true
  239 + }
  240 + }
  241 + ),
  242 + eci3: $resource(
  243 + '/eci/:type',
  244 + {},
  245 + {
  246 + list: {
  247 + method: 'GET',
  248 + isArray: true
  249 + }
  250 + }
  251 + ),
  252 +
  253 +
  254 + validate: { // remoteValidation指令用到的resource
  255 + gbv1: { // 路牌序号验证
  256 + template: {'xl.id_eq': -1, 'lpNo_eq': 'ddd'},
  257 + remote: $resource(
  258 + '/gic/validate1',
  259 + {},
  260 + {
  261 + do: {
  262 + method: 'GET'
  263 + }
  264 + }
  265 + )
  266 + },
  267 + gbv2: { // 路牌名称验证
  268 + template: {'xl.id_eq': -1, 'lpName_eq': 'ddd'},
  269 + remote: $resource(
  270 + '/gic/validate2',
  271 + {},
  272 + {
  273 + do: {
  274 + method: 'GET'
  275 + }
  276 + }
  277 + )
  278 + },
  279 +
  280 + cl1: { // 车辆自编号不能重复验证
  281 + template: {'insideCode_eq': '-1'}, // 查询参数模版
  282 + remote: $resource( // $resource封装对象
  283 + '/cars/validate/equale',
  284 + {},
  285 + {
  286 + do: {
  287 + method: 'GET'
  288 + }
  289 + }
  290 + )
  291 + },
  292 + cde1: { // 车辆设备启用日期验证
  293 + template: {'qyrq': 0, 'xl': 1, 'cl': 1}, // 日期毫秒
  294 + remote: $resource( // $resource封装对象
  295 + '/cde//validate/qyrq',
  296 + {},
  297 + {
  298 + do: {
  299 + method: 'GET'
  300 + }
  301 + }
  302 + )
  303 + },
  304 + ttc1: { // 时刻表名字验证
  305 + template: {'xl.id_eq': -1, 'name_eq': 'ddd'},
  306 + remote: $resource( // $resource封装对象
  307 + '/tic/validate/equale',
  308 + {},
  309 + {
  310 + do: {
  311 + method: 'GET'
  312 + }
  313 + }
  314 + )
  315 + },
  316 + sheet: { // 时刻表sheet工作区验证
  317 + template: {'filename': '', 'sheetname': '', 'lineid': -1, 'linename': ''},
  318 + remote: $resource( // $resource封装对象
  319 + '/tidc/validate/sheet',
  320 + {},
  321 + {
  322 + do: {
  323 + method: 'POST',
  324 + headers: {
  325 + 'Content-Type': 'application/x-www-form-urlencoded'
  326 + },
  327 + transformRequest: function(obj) {
  328 + var str = [];
  329 + for (var p in obj) {
  330 + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  331 + }
  332 + return str.join("&");
  333 + }
  334 + }
  335 + }
  336 + )
  337 + },
  338 + sheetli: { // 时刻表线路标准验证
  339 + template: {'lineinfoid': -1},
  340 + remote: $resource( // $resource封装对象
  341 + '/tidc/validate/lineinfo',
  342 + {},
  343 + {
  344 + do: {
  345 + method: 'GET'
  346 + }
  347 + }
  348 + )
  349 + }
  350 + }
  351 +
  352 + //validate: $resource(
  353 + // '/cars/validate/:type',
  354 + // {},
  355 + // {
  356 + // insideCode: {
  357 + // method: 'GET'
  358 + // }
  359 + // }
  360 + //)
  361 +
  362 +
  363 +
  364 + }
  365 +}]);
  366 +
  367 +
  368 +
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 - import: $resource(  
100 - '/cars/importfile',  
101 - {},  
102 - {  
103 - do: {  
104 - method: 'POST',  
105 - headers: {  
106 - 'Content-Type': 'application/x-www-form-urlencoded'  
107 - },  
108 - transformRequest: function(obj) {  
109 - var str = [];  
110 - for (var p in obj) {  
111 - str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));  
112 - }  
113 - return str.join("&");  
114 - }  
115 - }  
116 - }  
117 - ),  
118 - validate: $resource(  
119 - '/cars/validate/:type',  
120 - {},  
121 - {  
122 - insideCode: {  
123 - method: 'GET'  
124 - }  
125 - }  
126 - ),  
127 - dataTools: $resource(  
128 - '/cars/:type',  
129 - {},  
130 - {  
131 - dataExport: {  
132 - method: 'GET',  
133 - responseType: "arraybuffer",  
134 - params: {  
135 - type: "dataExport"  
136 - },  
137 - transformResponse: function(data, headers){  
138 - return {data : data};  
139 - }  
140 - }  
141 - }  
142 - )  
143 - };  
144 -}]);  
145 -// 人员信息service  
146 -angular.module('ScheduleApp').factory('EmployeeInfoManageService_g', ['$resource', function($resource) {  
147 - return {  
148 - rest : $resource(  
149 - '/personnel/:id',  
150 - {order: 'jobCode', direction: 'ASC', id: '@id_route'},  
151 - {  
152 - list: {  
153 - method: 'GET',  
154 - params: {  
155 - page: 0  
156 - }  
157 - },  
158 - get: {  
159 - method: 'GET'  
160 - },  
161 - save: {  
162 - method: 'POST'  
163 - }  
164 - }  
165 - ),  
166 - validate: $resource(  
167 - '/personnel/validate/:type',  
168 - {},  
169 - {  
170 - jobCode: {  
171 - method: 'GET'  
172 - }  
173 - }  
174 - ),  
175 - dataTools: $resource(  
176 - '/personnel/:type',  
177 - {},  
178 - {  
179 - dataExport: {  
180 - method: 'GET',  
181 - responseType: "arraybuffer",  
182 - params: {  
183 - type: "dataExport"  
184 - },  
185 - transformResponse: function(data, headers){  
186 - return {data : data};  
187 - }  
188 - }  
189 - }  
190 - )  
191 - };  
192 -}]);  
193 -// 车辆设备信息service  
194 -angular.module('ScheduleApp').factory('DeviceInfoManageService_g', ['$resource', function($resource) {  
195 - return $resource(  
196 - '/cde/:id',  
197 - {order: 'xl,isCancel,cl,qyrq', direction: 'ASC,ASC,ASC,DESC', id: '@id_route'},  
198 - {  
199 - list: {  
200 - method: 'GET',  
201 - params: {  
202 - page: 0  
203 - }  
204 - },  
205 - get: {  
206 - method: 'GET'  
207 - },  
208 - save: {  
209 - method: 'POST'  
210 - },  
211 - delete: {  
212 - method: 'DELETE'  
213 - }  
214 - }  
215 - );  
216 -}]);  
217 -  
218 -// 车辆配置service  
219 -angular.module('ScheduleApp').factory('BusConfigService_g', ['$resource', function($resource) {  
220 - return {  
221 - rest : $resource(  
222 - '/cci/:id',  
223 - {order: 'xl.id,cl.insideCode,isCancel', direction: 'ASC', id: '@id_route'},  
224 - {  
225 - list: {  
226 - method: 'GET',  
227 - params: {  
228 - page: 0  
229 - }  
230 - },  
231 - get: {  
232 - method: 'GET'  
233 - },  
234 - save: {  
235 - method: 'POST'  
236 - }  
237 - }  
238 - )  
239 - };  
240 -}]);  
241 -  
242 -// 人员配置service  
243 -angular.module('ScheduleApp').factory('EmployeeConfigService_g', ['$resource', function($resource) {  
244 - return {  
245 - rest : $resource(  
246 - '/eci/:id',  
247 - {order: 'xl.id,isCancel,dbbmFormula', direction: 'ASC', id: '@id_route'},  
248 - {  
249 - list: {  
250 - method: 'GET',  
251 - params: {  
252 - page: 0  
253 - }  
254 - },  
255 - get: {  
256 - method: 'GET'  
257 - },  
258 - save: {  
259 - method: 'POST'  
260 - },  
261 - delete: {  
262 - method: 'DELETE'  
263 - }  
264 - }  
265 - ),  
266 - validate: $resource( // TODO:  
267 - '/personnel/validate/:type',  
268 - {},  
269 - {  
270 - jobCode: {  
271 - method: 'GET'  
272 - }  
273 - }  
274 - )  
275 - };  
276 -}]);  
277 -  
278 -// 路牌管理service  
279 -angular.module('ScheduleApp').factory('GuideboardManageService_g', ['$resource', function($resource) {  
280 - return {  
281 - rest: $resource(  
282 - '/gic/:id',  
283 - {order: 'createDate', direction: 'DESC', id: '@id_route'},  
284 - {  
285 - list: {  
286 - method: 'GET',  
287 - params: {  
288 - page: 0  
289 - }  
290 - },  
291 - get: {  
292 - method: 'GET'  
293 - },  
294 - save: {  
295 - method: 'POST'  
296 - }  
297 - }  
298 - )  
299 - };  
300 -}]);  
301 -  
302 -// 排班管理service  
303 -angular.module('ScheduleApp').factory('ScheduleRuleManageService_g', ['$resource', function($resource) {  
304 - return {  
305 - rest: $resource(  
306 - '/sr1fc/:id',  
307 - {order: 'createDate', direction: 'DESC', id: '@id_route'},  
308 - {  
309 - list: {  
310 - method: 'GET',  
311 - params: {  
312 - page: 0  
313 - }  
314 - },  
315 - get: {  
316 - method: 'GET'  
317 - },  
318 - save: {  
319 - method: 'POST'  
320 - },  
321 - delete: {  
322 - method: 'DELETE'  
323 - }  
324 - }  
325 - )  
326 - };  
327 -}]);  
328 -  
329 -// 套跑管理service  
330 -angular.module('ScheduleApp').factory('rerunManageService_g', ['$resource', function($resource) {  
331 - return {  
332 - rest: $resource(  
333 - 'rms/:id',  
334 - {order: 'rerunXl.id,isCancel', direction: 'ASC', id: '@id_route'},  
335 - {  
336 - list: {  
337 - method: 'GET',  
338 - params: {  
339 - page: 0  
340 - }  
341 - },  
342 - get: {  
343 - method: 'GET'  
344 - },  
345 - save: {  
346 - method: 'POST'  
347 - },  
348 - delete: {  
349 - method: 'DELETE'  
350 - }  
351 - }  
352 - )  
353 - };  
354 -}]);  
355 -  
356 -// 时刻表管理service  
357 -angular.module('ScheduleApp').factory('TimeTableManageService_g', ['$resource', function($resource) {  
358 - return {  
359 - rest: $resource(  
360 - '/tic/:id',  
361 - {order: 'xl,isCancel,isEnableDisTemplate,qyrq', direction: 'DESC,ASC,DESC,DESC', id: '@id'},  
362 - {  
363 - list: {  
364 - method: 'GET',  
365 - params: {  
366 - page: 0  
367 - }  
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 - import: $resource(  
389 - '/tidc/importfile',  
390 - {},  
391 - {  
392 - do: {  
393 - method: 'POST',  
394 - headers: {  
395 - 'Content-Type': 'application/x-www-form-urlencoded'  
396 - },  
397 - transformRequest: function(obj) {  
398 - var str = [];  
399 - for (var p in obj) {  
400 - str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));  
401 - }  
402 - return str.join("&");  
403 - }  
404 - }  
405 - }  
406 - ),  
407 - edit: $resource(  
408 - '/tidc/edit/:xlid/:ttid',  
409 - {},  
410 - {  
411 - list: {  
412 - method: 'GET'  
413 - }  
414 - }  
415 - ),  
416 - bcdetails: $resource(  
417 - '/tidc/bcdetail',  
418 - {},  
419 - {  
420 - list: {  
421 - method: 'GET',  
422 - isArray: true  
423 - }  
424 - }  
425 - ),  
426 - dataTools: $resource(  
427 - '/tidc/:type',  
428 - {},  
429 - {  
430 - dataExport: {  
431 - method: 'GET',  
432 - responseType: "arraybuffer",  
433 - params: {  
434 - type: "dataExportExt"  
435 - },  
436 - transformResponse: function(data, headers){  
437 - return {data : data};  
438 - }  
439 - }  
440 - }  
441 - )  
442 -  
443 - // TODO:导入数据  
444 - };  
445 -}]);  
446 -  
447 -  
448 -  
449 -// 排班计划管理service  
450 -angular.module('ScheduleApp').factory('SchedulePlanManageService_g', ['$resource', function($resource) {  
451 - return {  
452 - rest : $resource(  
453 - '/spc/:id',  
454 - {order: 'xl.id,createDate', direction: 'DESC,DESC', id: '@id_route'},  
455 - {  
456 - list: {  
457 - method: 'GET',  
458 - params: {  
459 - page: 0  
460 - }  
461 - },  
462 - get: {  
463 - method: 'GET'  
464 - },  
465 - save: {  
466 - method: 'POST'  
467 - },  
468 - delete: {  
469 - method: 'DELETE'  
470 - }  
471 - }  
472 - ),  
473 - tommorw: $resource(  
474 - '/spc/tommorw',  
475 - {},  
476 - {  
477 - list: {  
478 - method: 'GET'  
479 - }  
480 - }  
481 - )  
482 - };  
483 -}]);  
484 -  
485 -// 排班计划明细管理service  
486 -angular.module('ScheduleApp').factory('SchedulePlanInfoManageService_g', ['$resource', function($resource) {  
487 - return {  
488 - rest : $resource(  
489 - '/spic/:id',  
490 - {order: 'scheduleDate,lp,fcno', direction: 'ASC,ASC,ASC', id: '@id_route'},  
491 - {  
492 - list: {  
493 - method: 'GET',  
494 - params: {  
495 - page: 0  
496 - }  
497 - },  
498 - get: {  
499 - method: 'GET'  
500 - },  
501 - save: {  
502 - method: 'POST'  
503 - }  
504 - }  
505 - ),  
506 - groupinfo : $resource(  
507 - '/spic/groupinfos/:xlid/:sdate',  
508 - {},  
509 - {  
510 - list: {  
511 - method: 'GET',  
512 - isArray: true  
513 - }  
514 - }  
515 - ),  
516 - updateGroupInfo : $resource(  
517 - '/spic/groupinfos/update',  
518 - {},  
519 - {  
520 - update: {  
521 - method: 'POST'  
522 - }  
523 - }  
524 - )  
525 - };  
526 -}]);  
527 -  
528 -// 线路运营统计service  
529 -angular.module('ScheduleApp').factory('BusLineInfoStatService_g', ['$resource', function($resource) {  
530 - return $resource(  
531 - '/bic/:id',  
532 - {order: 'createDate', direction: 'DESC', id: '@id_route'}, // TODO:以后需要根据属性对象的属性查询  
533 - {  
534 - list: {  
535 - method: 'GET',  
536 - params: {  
537 - page: 0  
538 - }  
539 - }  
540 - }  
541 - );  
542 -}]);  
543 -  
544 -  
545 -  
546 -  
547 -/**  
548 - * saSelect2指令,根据属性值,动态载入数据,然后支持拼音搜索,点击右边的按钮清除选择并重新载入数据。  
549 - * 1、compile阶段使用的属性如下:  
550 - * required:用于和表单验证连接,指定成required="true"才有效。  
551 - * 2、link阶段使用的属性如下  
552 - * model:关联的模型对象  
553 - * name:表单验证时需要的名字  
554 - * type:关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加  
555 - * modelcolname1:关联的模型字段名字1(一般应该是编码字段)  
556 - * modelcolname2:关联的模型字段名字2(一般应该是名字字段)  
557 - * datacolname1;内部数据对应的字段名字1(与模型字段1对应)  
558 - * datacolname2:内部数据对应的字段名字2(与模型字段2对应)  
559 - * showcolname:下拉框显示的内部数据字段名(注意:不是模型数据字段名),TODO:以后考虑放动态表达式,并在compile阶段使用  
560 - * placeholder:select placeholder字符串描述  
561 - *  
562 - * $$pyFilter,内部的filter指令,结合简拼音进行拼音过滤。  
563 - * $$SearchInfoService_g,内部使用的数据服务  
564 - */  
565 -// saSelect2指令使用的内部信service  
566 -angular.module('ScheduleApp').factory('$$SearchInfoService_g', ['$resource', function($resource) {  
567 - return {  
568 - xl: $resource(  
569 - '/line/:type',  
570 - {order: 'name', direction: 'ASC'},  
571 - {  
572 - list: {  
573 - method: 'GET',  
574 - isArray: true  
575 - }  
576 - }  
577 - ),  
578 - xlinfo: $resource(  
579 - '/lineInformation/:type',  
580 - {order: 'line.name', direction: 'ASC'},  
581 - {  
582 - list: {  
583 - method: 'GET',  
584 - isArray: true  
585 - }  
586 - }  
587 - ),  
588 - zd: $resource(  
589 - '/stationroute/stations',  
590 - {order: 'stationCode', direction: 'ASC'},  
591 - {  
592 - list: {  
593 - method: 'GET',  
594 - isArray: true  
595 - }  
596 - }  
597 - ),  
598 - tcc: $resource(  
599 - '/carpark/:type',  
600 - {order: 'parkCode', direction: 'ASC'},  
601 - {  
602 - list: {  
603 - method: 'GET',  
604 - isArray: true  
605 - }  
606 - }  
607 - ),  
608 - ry: $resource(  
609 - '/personnel/:type',  
610 - {order: 'personnelName', direction: 'ASC'},  
611 - {  
612 - list: {  
613 - method: 'GET',  
614 - isArray: true  
615 - }  
616 - }  
617 - ),  
618 - cl: $resource(  
619 - '/cars/:type',  
620 - {order: "insideCode", direction: 'ASC'},  
621 - {  
622 - list: {  
623 - method: 'GET',  
624 - isArray: true  
625 - }  
626 - }  
627 - ),  
628 - ttInfo: $resource(  
629 - '/tic/:type',  
630 - {order: "name", direction: 'ASC'},  
631 - {  
632 - list: {  
633 - method: 'GET',  
634 - isArray: true  
635 - }  
636 - }  
637 - ),  
638 - lpInfo: $resource(  
639 - '/gic/ttlpnames',  
640 - {order: "lpName", direction: 'ASC'},  
641 - {  
642 - list: {  
643 - method: 'GET',  
644 - isArray: true  
645 - }  
646 - }  
647 - ),  
648 - lpInfo2: $resource(  
649 - '/gic/:type',  
650 - {order: "lpName", direction: 'ASC'},  
651 - {  
652 - list: {  
653 - method: 'GET',  
654 - isArray: true  
655 - }  
656 - }  
657 - ),  
658 - cci: $resource(  
659 - '/cci/cars',  
660 - {},  
661 - {  
662 - list: {  
663 - method: 'GET',  
664 - isArray: true  
665 - }  
666 - }  
667 -  
668 - ),  
669 - cci2: $resource(  
670 - '/cci/:type',  
671 - {},  
672 - {  
673 - list: {  
674 - method: 'GET',  
675 - isArray: true  
676 - }  
677 - }  
678 - ),  
679 - cci3: $resource(  
680 - '/cci/cars2',  
681 - {},  
682 - {  
683 - list: {  
684 - method: 'GET',  
685 - isArray: true  
686 - }  
687 - }  
688 -  
689 - ),  
690 - eci: $resource(  
691 - '/eci/jsy',  
692 - {},  
693 - {  
694 - list: {  
695 - method: 'GET',  
696 - isArray: true  
697 - }  
698 - }  
699 - ),  
700 - eci2: $resource(  
701 - '/eci/spy',  
702 - {},  
703 - {  
704 - list: {  
705 - method: 'GET',  
706 - isArray: true  
707 - }  
708 - }  
709 - ),  
710 - eci3: $resource(  
711 - '/eci/:type',  
712 - {},  
713 - {  
714 - list: {  
715 - method: 'GET',  
716 - isArray: true  
717 - }  
718 - }  
719 - ),  
720 -  
721 -  
722 - validate: { // remoteValidation指令用到的resource  
723 - cl1: { // 车辆自编号不能重复验证  
724 - template: {'insideCode_eq': '-1'}, // 查询参数模版  
725 - remote: $resource( // $resource封装对象  
726 - '/cars/validate/equale',  
727 - {},  
728 - {  
729 - do: {  
730 - method: 'GET'  
731 - }  
732 - }  
733 - )  
734 - },  
735 - cde1: { // 车辆设备启用日期验证  
736 - template: {'qyrq': 0, 'xl': 1, 'cl': 1}, // 日期毫秒  
737 - remote: $resource( // $resource封装对象  
738 - '/cde//validate/qyrq',  
739 - {},  
740 - {  
741 - do: {  
742 - method: 'GET'  
743 - }  
744 - }  
745 - )  
746 - },  
747 - ttc1: { // 时刻表名字验证  
748 - template: {'xl.id_eq': -1, 'name_eq': 'ddd'},  
749 - remote: $resource( // $resource封装对象  
750 - '/tic/validate/equale',  
751 - {},  
752 - {  
753 - do: {  
754 - method: 'GET'  
755 - }  
756 - }  
757 - )  
758 - },  
759 - sheet: { // 时刻表sheet工作区验证  
760 - template: {'filename': '', 'sheetname': '', 'lineid': -1, 'linename': ''},  
761 - remote: $resource( // $resource封装对象  
762 - '/tidc/validate/sheet',  
763 - {},  
764 - {  
765 - do: {  
766 - method: 'POST',  
767 - headers: {  
768 - 'Content-Type': 'application/x-www-form-urlencoded'  
769 - },  
770 - transformRequest: function(obj) {  
771 - var str = [];  
772 - for (var p in obj) {  
773 - str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));  
774 - }  
775 - return str.join("&");  
776 - }  
777 - }  
778 - }  
779 - )  
780 - },  
781 - sheetli: { // 时刻表线路标准验证  
782 - template: {'lineinfoid': -1},  
783 - remote: $resource( // $resource封装对象  
784 - '/tidc/validate/lineinfo',  
785 - {},  
786 - {  
787 - do: {  
788 - method: 'GET'  
789 - }  
790 - }  
791 - )  
792 - }  
793 - }  
794 -  
795 - //validate: $resource(  
796 - // '/cars/validate/:type',  
797 - // {},  
798 - // {  
799 - // insideCode: {  
800 - // method: 'GET'  
801 - // }  
802 - // }  
803 - //)  
804 -  
805 -  
806 -  
807 - }  
808 -}]);  
809 -  
810 -  
811 - 1 +//所有模块service配置
  2 +// 车辆信息service
  3 +angular.module('ScheduleApp').factory('BusInfoManageService_g', ['$resource', function($resource) {
  4 + return {
  5 + rest: $resource(
  6 + '/cars/:id',
  7 + {order: 'carCode', direction: 'ASC', id: '@id_route'},
  8 + {
  9 + list: {
  10 + method: 'GET',
  11 + params: {
  12 + page: 0
  13 + }
  14 + },
  15 + get: {
  16 + method: 'GET'
  17 + },
  18 + save: {
  19 + method: 'POST'
  20 + }
  21 + }
  22 + ),
  23 + import: $resource(
  24 + '/cars/importfile',
  25 + {},
  26 + {
  27 + do: {
  28 + method: 'POST',
  29 + headers: {
  30 + 'Content-Type': 'application/x-www-form-urlencoded'
  31 + },
  32 + transformRequest: function(obj) {
  33 + var str = [];
  34 + for (var p in obj) {
  35 + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  36 + }
  37 + return str.join("&");
  38 + }
  39 + }
  40 + }
  41 + ),
  42 + validate: $resource(
  43 + '/cars/validate/:type',
  44 + {},
  45 + {
  46 + insideCode: {
  47 + method: 'GET'
  48 + }
  49 + }
  50 + ),
  51 + dataTools: $resource(
  52 + '/cars/:type',
  53 + {},
  54 + {
  55 + dataExport: {
  56 + method: 'GET',
  57 + responseType: "arraybuffer",
  58 + params: {
  59 + type: "dataExport"
  60 + },
  61 + transformResponse: function(data, headers){
  62 + return {data : data};
  63 + }
  64 + }
  65 + }
  66 + )
  67 + };
  68 +}]);
  69 +// 车辆设备信息service
  70 +angular.module('ScheduleApp').factory('DeviceInfoManageService_g', ['$resource', function($resource) {
  71 + return $resource(
  72 + '/cde/:id',
  73 + {order: 'xl,isCancel,cl,qyrq', direction: 'ASC,ASC,ASC,DESC', id: '@id_route'},
  74 + {
  75 + list: {
  76 + method: 'GET',
  77 + params: {
  78 + page: 0
  79 + }
  80 + },
  81 + get: {
  82 + method: 'GET'
  83 + },
  84 + save: {
  85 + method: 'POST'
  86 + },
  87 + delete: {
  88 + method: 'DELETE'
  89 + }
  90 + }
  91 + );
  92 +}]);
  93 +// 人员信息service
  94 +angular.module('ScheduleApp').factory('EmployeeInfoManageService_g', ['$resource', function($resource) {
  95 + return {
  96 + rest : $resource(
  97 + '/personnel/:id',
  98 + {order: 'jobCode', direction: 'ASC', id: '@id_route'},
  99 + {
  100 + list: {
  101 + method: 'GET',
  102 + params: {
  103 + page: 0
  104 + }
  105 + },
  106 + get: {
  107 + method: 'GET'
  108 + },
  109 + save: {
  110 + method: 'POST'
  111 + }
  112 + }
  113 + ),
  114 + validate: $resource(
  115 + '/personnel/validate/:type',
  116 + {},
  117 + {
  118 + jobCode: {
  119 + method: 'GET'
  120 + }
  121 + }
  122 + ),
  123 + dataTools: $resource(
  124 + '/personnel/:type',
  125 + {},
  126 + {
  127 + dataExport: {
  128 + method: 'GET',
  129 + responseType: "arraybuffer",
  130 + params: {
  131 + type: "dataExport"
  132 + },
  133 + transformResponse: function(data, headers){
  134 + return {data : data};
  135 + }
  136 + }
  137 + }
  138 + )
  139 + };
  140 +}]);
  141 +
  142 +// 车辆配置service
  143 +angular.module('ScheduleApp').factory('BusConfigService_g', ['$resource', function($resource) {
  144 + return {
  145 + rest : $resource(
  146 + '/cci/:id',
  147 + {order: 'xl.id,cl.insideCode,isCancel', direction: 'ASC', id: '@id_route'},
  148 + {
  149 + list: {
  150 + method: 'GET',
  151 + params: {
  152 + page: 0
  153 + }
  154 + },
  155 + get: {
  156 + method: 'GET'
  157 + },
  158 + save: {
  159 + method: 'POST'
  160 + }
  161 + }
  162 + )
  163 + };
  164 +}]);
  165 +// 线路运营统计service
  166 +angular.module('ScheduleApp').factory('BusLineInfoStatService_g', ['$resource', function($resource) {
  167 + return $resource(
  168 + '/bic/:id',
  169 + {order: 'createDate', direction: 'DESC', id: '@id_route'}, // TODO:以后需要根据属性对象的属性查询
  170 + {
  171 + list: {
  172 + method: 'GET',
  173 + params: {
  174 + page: 0
  175 + }
  176 + }
  177 + }
  178 + );
  179 +}]);
  180 +
  181 +// 人员配置service
  182 +angular.module('ScheduleApp').factory('EmployeeConfigService_g', ['$resource', function($resource) {
  183 + return {
  184 + rest : $resource(
  185 + '/eci/:id',
  186 + {order: 'xl.id,isCancel,dbbmFormula', direction: 'ASC', id: '@id_route'},
  187 + {
  188 + list: {
  189 + method: 'GET',
  190 + params: {
  191 + page: 0
  192 + }
  193 + },
  194 + get: {
  195 + method: 'GET'
  196 + },
  197 + save: {
  198 + method: 'POST'
  199 + },
  200 + delete: {
  201 + method: 'DELETE'
  202 + }
  203 + }
  204 + ),
  205 + validate: $resource( // TODO:
  206 + '/personnel/validate/:type',
  207 + {},
  208 + {
  209 + jobCode: {
  210 + method: 'GET'
  211 + }
  212 + }
  213 + )
  214 + };
  215 +}]);
  216 +// 路牌管理service
  217 +angular.module('ScheduleApp').factory('GuideboardManageService_g', ['$resource', function($resource) {
  218 + return {
  219 + rest: $resource(
  220 + '/gic/:id',
  221 + {order: 'xl,isCancel', direction: 'DESC,ASC', id: '@id_route'},
  222 + {
  223 + list: {
  224 + method: 'GET',
  225 + params: {
  226 + page: 0
  227 + }
  228 + },
  229 + get: {
  230 + method: 'GET',
  231 + transformResponse: function(rs) {
  232 + var dst = angular.fromJson(rs);
  233 + if (dst.status == 'SUCCESS') {
  234 + return dst.data;
  235 + } else {
  236 + return dst;
  237 + }
  238 + }
  239 + },
  240 + save: {
  241 + method: 'POST'
  242 + }
  243 + // 内部还有默认的方法delete
  244 + }
  245 + )
  246 + };
  247 +}]);
  248 +// 套跑管理service
  249 +angular.module('ScheduleApp').factory('rerunManageService_g', ['$resource', function($resource) {
  250 + return {
  251 + rest: $resource(
  252 + 'rms/:id',
  253 + {order: 'rerunXl.id,isCancel', direction: 'ASC', id: '@id_route'},
  254 + {
  255 + list: {
  256 + method: 'GET',
  257 + params: {
  258 + page: 0
  259 + }
  260 + },
  261 + get: {
  262 + method: 'GET'
  263 + },
  264 + save: {
  265 + method: 'POST'
  266 + },
  267 + delete: {
  268 + method: 'DELETE'
  269 + }
  270 + }
  271 + )
  272 + };
  273 +}]);
  274 +// 排班计划管理service
  275 +angular.module('ScheduleApp').factory('SchedulePlanManageService_g', ['$resource', function($resource) {
  276 + return {
  277 + rest : $resource(
  278 + '/spc/:id',
  279 + {order: 'xl.id,createDate', direction: 'DESC,DESC', id: '@id_route'},
  280 + {
  281 + list: {
  282 + method: 'GET',
  283 + params: {
  284 + page: 0
  285 + }
  286 + },
  287 + get: {
  288 + method: 'GET'
  289 + },
  290 + save: {
  291 + method: 'POST'
  292 + },
  293 + delete: {
  294 + method: 'DELETE'
  295 + }
  296 + }
  297 + ),
  298 + tommorw: $resource(
  299 + '/spc/tommorw',
  300 + {},
  301 + {
  302 + list: {
  303 + method: 'GET'
  304 + }
  305 + }
  306 + )
  307 + };
  308 +}]);
  309 +
  310 +// 排班计划明细管理service
  311 +angular.module('ScheduleApp').factory('SchedulePlanInfoManageService_g', ['$resource', function($resource) {
  312 + return {
  313 + rest : $resource(
  314 + '/spic/:id',
  315 + {order: 'scheduleDate,lp,fcno', direction: 'ASC,ASC,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 + }
  330 + ),
  331 + groupinfo : $resource(
  332 + '/spic/groupinfos/:xlid/:sdate',
  333 + {},
  334 + {
  335 + list: {
  336 + method: 'GET',
  337 + isArray: true
  338 + }
  339 + }
  340 + ),
  341 + updateGroupInfo : $resource(
  342 + '/spic/groupinfos/update',
  343 + {},
  344 + {
  345 + update: {
  346 + method: 'POST'
  347 + }
  348 + }
  349 + )
  350 + };
  351 +}]);
  352 +// 排班管理service
  353 +angular.module('ScheduleApp').factory('ScheduleRuleManageService_g', ['$resource', function($resource) {
  354 + return {
  355 + rest: $resource(
  356 + '/sr1fc/:id',
  357 + {order: 'createDate', direction: 'DESC', id: '@id_route'},
  358 + {
  359 + list: {
  360 + method: 'GET',
  361 + params: {
  362 + page: 0
  363 + }
  364 + },
  365 + get: {
  366 + method: 'GET'
  367 + },
  368 + save: {
  369 + method: 'POST'
  370 + },
  371 + delete: {
  372 + method: 'DELETE'
  373 + }
  374 + }
  375 + )
  376 + };
  377 +}]);
  378 +
  379 +// 时刻表管理service
  380 +angular.module('ScheduleApp').factory('TimeTableManageService_g', ['$resource', function($resource) {
  381 + return {
  382 + rest: $resource(
  383 + '/tic/:id',
  384 + {order: 'xl,isCancel,isEnableDisTemplate,qyrq', direction: 'DESC,ASC,DESC,DESC', id: '@id'},
  385 + {
  386 + list: {
  387 + method: 'GET',
  388 + params: {
  389 + page: 0
  390 + }
  391 + }
  392 + }
  393 + )
  394 + };
  395 +}]);
  396 +
  397 +// 时刻表明细管理service
  398 +angular.module('ScheduleApp').factory('TimeTableDetailManageService_g', ['$resource', function($resource) {
  399 + return {
  400 + rest: $resource(
  401 + '/tidc/:id',
  402 + {order: 'createDate', direction: 'DESC', id: '@id_route'},
  403 + {
  404 + get: {
  405 + method: 'GET'
  406 + },
  407 + save: {
  408 + method: 'POST'
  409 + }
  410 + }
  411 + ),
  412 + import: $resource(
  413 + '/tidc/importfile',
  414 + {},
  415 + {
  416 + do: {
  417 + method: 'POST',
  418 + headers: {
  419 + 'Content-Type': 'application/x-www-form-urlencoded'
  420 + },
  421 + transformRequest: function(obj) {
  422 + var str = [];
  423 + for (var p in obj) {
  424 + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  425 + }
  426 + return str.join("&");
  427 + }
  428 + }
  429 + }
  430 + ),
  431 + edit: $resource(
  432 + '/tidc/edit/:xlid/:ttid',
  433 + {},
  434 + {
  435 + list: {
  436 + method: 'GET'
  437 + }
  438 + }
  439 + ),
  440 + bcdetails: $resource(
  441 + '/tidc/bcdetail',
  442 + {},
  443 + {
  444 + list: {
  445 + method: 'GET',
  446 + isArray: true
  447 + }
  448 + }
  449 + ),
  450 + dataTools: $resource(
  451 + '/tidc/:type',
  452 + {},
  453 + {
  454 + dataExport: {
  455 + method: 'GET',
  456 + responseType: "arraybuffer",
  457 + params: {
  458 + type: "dataExportExt"
  459 + },
  460 + transformResponse: function(data, headers){
  461 + return {data : data};
  462 + }
  463 + }
  464 + }
  465 + )
  466 +
  467 + // TODO:导入数据
  468 + };
  469 +}]);
  470 +// 项目通用的全局service服务,供不同的controller使用,自定义指令不使用
  471 +
  472 +// 文件下载服务
  473 +angular.module('ScheduleApp').factory('FileDownload_g', function() {
  474 + return {
  475 + downloadFile: function (data, mimeType, fileName) {
  476 + var success = false;
  477 + var blob = new Blob([data], { type: mimeType });
  478 + try {
  479 + if (navigator.msSaveBlob)
  480 + navigator.msSaveBlob(blob, fileName);
  481 + else {
  482 + // Try using other saveBlob implementations, if available
  483 + var saveBlob = navigator.webkitSaveBlob || navigator.mozSaveBlob || navigator.saveBlob;
  484 + if (saveBlob === undefined) throw "Not supported";
  485 + saveBlob(blob, fileName);
  486 + }
  487 + success = true;
  488 + } catch (ex) {
  489 + console.log("saveBlob method failed with the following exception:");
  490 + console.log(ex);
  491 + }
  492 +
  493 + if (!success) {
  494 + // Get the blob url creator
  495 + var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
  496 + if (urlCreator) {
  497 + // Try to use a download link
  498 + var link = document.createElement('a');
  499 + if ('download' in link) {
  500 + // Try to simulate a click
  501 + try {
  502 + // Prepare a blob URL
  503 + var url = urlCreator.createObjectURL(blob);
  504 + link.setAttribute('href', url);
  505 +
  506 + // Set the download attribute (Supported in Chrome 14+ / Firefox 20+)
  507 + link.setAttribute("download", fileName);
  508 +
  509 + // Simulate clicking the download link
  510 + var event = document.createEvent('MouseEvents');
  511 + event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
  512 + link.dispatchEvent(event);
  513 + success = true;
  514 +
  515 + } catch (ex) {
  516 + console.log("Download link method with simulated click failed with the following exception:");
  517 + console.log(ex);
  518 + }
  519 + }
  520 +
  521 + if (!success) {
  522 + // Fallback to window.location method
  523 + try {
  524 + // Prepare a blob URL
  525 + // Use application/octet-stream when using window.location to force download
  526 + var url = urlCreator.createObjectURL(blob);
  527 + window.location = url;
  528 + console.log("Download link method with window.location succeeded");
  529 + success = true;
  530 + } catch (ex) {
  531 + console.log("Download link method with window.location failed with the following exception:");
  532 + console.log(ex);
  533 + }
  534 + }
  535 + }
  536 + }
  537 +
  538 + if (!success) {
  539 + // Fallback to window.open method
  540 + console.log("No methods worked for saving the arraybuffer, using last resort window.open");
  541 + window.open("", '_blank', '');
  542 + }
  543 + }
  544 + };
  545 +});
  546 +
  547 +
  548 +/**
  549 + * saSelect2指令,根据属性值,动态载入数据,然后支持拼音搜索,点击右边的按钮清除选择并重新载入数据。
  550 + * 1、compile阶段使用的属性如下:
  551 + * required:用于和表单验证连接,指定成required="true"才有效。
  552 + * 2、link阶段使用的属性如下
  553 + * model:关联的模型对象
  554 + * name:表单验证时需要的名字
  555 + * type:关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加
  556 + * modelcolname1:关联的模型字段名字1(一般应该是编码字段)
  557 + * modelcolname2:关联的模型字段名字2(一般应该是名字字段)
  558 + * datacolname1;内部数据对应的字段名字1(与模型字段1对应)
  559 + * datacolname2:内部数据对应的字段名字2(与模型字段2对应)
  560 + * showcolname:下拉框显示的内部数据字段名(注意:不是模型数据字段名),TODO:以后考虑放动态表达式,并在compile阶段使用
  561 + * placeholder:select placeholder字符串描述
  562 + *
  563 + * $$pyFilter,内部的filter指令,结合简拼音进行拼音过滤。
  564 + * $$SearchInfoService_g,内部使用的数据服务
  565 + */
  566 +// saSelect2指令使用的内部信service
  567 +angular.module('ScheduleApp').factory('$$SearchInfoService_g', ['$resource', function($resource) {
  568 + return {
  569 + xl: $resource(
  570 + '/line/:type',
  571 + {order: 'name', direction: 'ASC'},
  572 + {
  573 + list: {
  574 + method: 'GET',
  575 + isArray: true
  576 + }
  577 + }
  578 + ),
  579 + xlinfo: $resource(
  580 + '/lineInformation/:type',
  581 + {order: 'line.name', direction: 'ASC'},
  582 + {
  583 + list: {
  584 + method: 'GET',
  585 + isArray: true
  586 + }
  587 + }
  588 + ),
  589 + zd: $resource(
  590 + '/stationroute/stations',
  591 + {order: 'stationCode', direction: 'ASC'},
  592 + {
  593 + list: {
  594 + method: 'GET',
  595 + isArray: true
  596 + }
  597 + }
  598 + ),
  599 + tcc: $resource(
  600 + '/carpark/:type',
  601 + {order: 'parkCode', direction: 'ASC'},
  602 + {
  603 + list: {
  604 + method: 'GET',
  605 + isArray: true
  606 + }
  607 + }
  608 + ),
  609 + ry: $resource(
  610 + '/personnel/:type',
  611 + {order: 'personnelName', direction: 'ASC'},
  612 + {
  613 + list: {
  614 + method: 'GET',
  615 + isArray: true
  616 + }
  617 + }
  618 + ),
  619 + cl: $resource(
  620 + '/cars/:type',
  621 + {order: "insideCode", direction: 'ASC'},
  622 + {
  623 + list: {
  624 + method: 'GET',
  625 + isArray: true
  626 + }
  627 + }
  628 + ),
  629 + ttInfo: $resource(
  630 + '/tic/:type',
  631 + {order: "name", direction: 'ASC'},
  632 + {
  633 + list: {
  634 + method: 'GET',
  635 + isArray: true
  636 + }
  637 + }
  638 + ),
  639 + lpInfo: $resource(
  640 + '/gic/ttlpnames',
  641 + {order: "lpName", direction: 'ASC'},
  642 + {
  643 + list: {
  644 + method: 'GET',
  645 + isArray: true
  646 + }
  647 + }
  648 + ),
  649 + lpInfo2: $resource(
  650 + '/gic/:type',
  651 + {order: "lpName", direction: 'ASC'},
  652 + {
  653 + list: {
  654 + method: 'GET',
  655 + isArray: true
  656 + }
  657 + }
  658 + ),
  659 + cci: $resource(
  660 + '/cci/cars',
  661 + {},
  662 + {
  663 + list: {
  664 + method: 'GET',
  665 + isArray: true
  666 + }
  667 + }
  668 +
  669 + ),
  670 + cci2: $resource(
  671 + '/cci/:type',
  672 + {},
  673 + {
  674 + list: {
  675 + method: 'GET',
  676 + isArray: true
  677 + }
  678 + }
  679 + ),
  680 + cci3: $resource(
  681 + '/cci/cars2',
  682 + {},
  683 + {
  684 + list: {
  685 + method: 'GET',
  686 + isArray: true
  687 + }
  688 + }
  689 +
  690 + ),
  691 + eci: $resource(
  692 + '/eci/jsy',
  693 + {},
  694 + {
  695 + list: {
  696 + method: 'GET',
  697 + isArray: true
  698 + }
  699 + }
  700 + ),
  701 + eci2: $resource(
  702 + '/eci/spy',
  703 + {},
  704 + {
  705 + list: {
  706 + method: 'GET',
  707 + isArray: true
  708 + }
  709 + }
  710 + ),
  711 + eci3: $resource(
  712 + '/eci/:type',
  713 + {},
  714 + {
  715 + list: {
  716 + method: 'GET',
  717 + isArray: true
  718 + }
  719 + }
  720 + ),
  721 +
  722 +
  723 + validate: { // remoteValidation指令用到的resource
  724 + gbv1: { // 路牌序号验证
  725 + template: {'xl.id_eq': -1, 'lpNo_eq': 'ddd'},
  726 + remote: $resource(
  727 + '/gic/validate1',
  728 + {},
  729 + {
  730 + do: {
  731 + method: 'GET'
  732 + }
  733 + }
  734 + )
  735 + },
  736 + gbv2: { // 路牌名称验证
  737 + template: {'xl.id_eq': -1, 'lpName_eq': 'ddd'},
  738 + remote: $resource(
  739 + '/gic/validate2',
  740 + {},
  741 + {
  742 + do: {
  743 + method: 'GET'
  744 + }
  745 + }
  746 + )
  747 + },
  748 +
  749 + cl1: { // 车辆自编号不能重复验证
  750 + template: {'insideCode_eq': '-1'}, // 查询参数模版
  751 + remote: $resource( // $resource封装对象
  752 + '/cars/validate/equale',
  753 + {},
  754 + {
  755 + do: {
  756 + method: 'GET'
  757 + }
  758 + }
  759 + )
  760 + },
  761 + cde1: { // 车辆设备启用日期验证
  762 + template: {'qyrq': 0, 'xl': 1, 'cl': 1}, // 日期毫秒
  763 + remote: $resource( // $resource封装对象
  764 + '/cde//validate/qyrq',
  765 + {},
  766 + {
  767 + do: {
  768 + method: 'GET'
  769 + }
  770 + }
  771 + )
  772 + },
  773 + ttc1: { // 时刻表名字验证
  774 + template: {'xl.id_eq': -1, 'name_eq': 'ddd'},
  775 + remote: $resource( // $resource封装对象
  776 + '/tic/validate/equale',
  777 + {},
  778 + {
  779 + do: {
  780 + method: 'GET'
  781 + }
  782 + }
  783 + )
  784 + },
  785 + sheet: { // 时刻表sheet工作区验证
  786 + template: {'filename': '', 'sheetname': '', 'lineid': -1, 'linename': ''},
  787 + remote: $resource( // $resource封装对象
  788 + '/tidc/validate/sheet',
  789 + {},
  790 + {
  791 + do: {
  792 + method: 'POST',
  793 + headers: {
  794 + 'Content-Type': 'application/x-www-form-urlencoded'
  795 + },
  796 + transformRequest: function(obj) {
  797 + var str = [];
  798 + for (var p in obj) {
  799 + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  800 + }
  801 + return str.join("&");
  802 + }
  803 + }
  804 + }
  805 + )
  806 + },
  807 + sheetli: { // 时刻表线路标准验证
  808 + template: {'lineinfoid': -1},
  809 + remote: $resource( // $resource封装对象
  810 + '/tidc/validate/lineinfo',
  811 + {},
  812 + {
  813 + do: {
  814 + method: 'GET'
  815 + }
  816 + }
  817 + )
  818 + }
  819 + }
  820 +
  821 + //validate: $resource(
  822 + // '/cars/validate/:type',
  823 + // {},
  824 + // {
  825 + // insideCode: {
  826 + // method: 'GET'
  827 + // }
  828 + // }
  829 + //)
  830 +
  831 +
  832 +
  833 + }
  834 +}]);
  835 +
  836 +
  837 +
src/main/resources/static/pages/scheduleApp/module/common/prj-common-ui-route-state.js
@@ -546,6 +546,44 @@ ScheduleApp.config([ @@ -546,6 +546,44 @@ ScheduleApp.config([
546 }] 546 }]
547 } 547 }
548 }) 548 })
  549 + .state('guideboardManage_form', { // 添加路牌form
  550 + url: '/guideboardManage_form',
  551 + views: {
  552 + '': {templateUrl: 'pages/scheduleApp/module/core/guideboardManage/form.html'}
  553 + },
  554 + resolve: {
  555 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  556 + return $ocLazyLoad.load({
  557 + name: 'guideboardManage_form_module',
  558 + insertBefore: '#ng_load_plugins_before',
  559 + files: [
  560 + 'assets/bower_components/angular-ui-select/dist/select.min.css',
  561 + 'assets/bower_components/angular-ui-select/dist/select.min.js',
  562 + 'pages/scheduleApp/module/core/guideboardManage/module.js'
  563 + ]
  564 + });
  565 + }]
  566 + }
  567 + })
  568 + .state('guideboardManage_edit', { // 修改路牌form
  569 + url: '/guideboardManage_edit/:id',
  570 + views: {
  571 + '': {templateUrl: 'pages/scheduleApp/module/core/guideboardManage/edit.html'}
  572 + },
  573 + resolve: {
  574 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  575 + return $ocLazyLoad.load({
  576 + name: 'guideboardManage_edit_module',
  577 + insertBefore: '#ng_load_plugins_before',
  578 + files: [
  579 + 'assets/bower_components/angular-ui-select/dist/select.min.css',
  580 + 'assets/bower_components/angular-ui-select/dist/select.min.js',
  581 + 'pages/scheduleApp/module/core/guideboardManage/module.js'
  582 + ]
  583 + });
  584 + }]
  585 + }
  586 + })
549 .state("guideboardManage_detail", { // 详细信息页面 587 .state("guideboardManage_detail", { // 详细信息页面
550 url: '/guideboardManage_detail/:id', 588 url: '/guideboardManage_detail/:id',
551 views: { 589 views: {
@@ -564,6 +602,7 @@ ScheduleApp.config([ @@ -564,6 +602,7 @@ ScheduleApp.config([
564 } 602 }
565 }) 603 })
566 604
  605 +
567 }]); 606 }]);
568 // ui route 配置 607 // ui route 配置
569 608
@@ -1003,7 +1042,24 @@ ScheduleApp.config([ @@ -1003,7 +1042,24 @@ ScheduleApp.config([
1003 }); 1042 });
1004 }] 1043 }]
1005 } 1044 }
1006 - }); 1045 + })
  1046 + .state('ttInfoManage_test', { // TODO:测试页面
  1047 + url: '/ttInfoManage_test',
  1048 + views: {
  1049 + '': {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/test.html'}
  1050 + },
  1051 + resolve: {
  1052 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  1053 + return $ocLazyLoad.load({
  1054 + name: 'ttInfoManage_test_module',
  1055 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  1056 + files: [
  1057 + 'pages/scheduleApp/module/core/ttInfoManage/test.js'
  1058 + ]
  1059 + });
  1060 + }]
  1061 + }
  1062 + })
1007 1063
1008 1064
1009 } 1065 }
src/main/resources/static/pages/scheduleApp/module/core/busConfig/service.js 0 → 100644
  1 +// 车辆配置service
  2 +angular.module('ScheduleApp').factory('BusConfigService_g', ['$resource', function($resource) {
  3 + return {
  4 + rest : $resource(
  5 + '/cci/:id',
  6 + {order: 'xl.id,cl.insideCode,isCancel', direction: 'ASC', id: '@id_route'},
  7 + {
  8 + list: {
  9 + method: 'GET',
  10 + params: {
  11 + page: 0
  12 + }
  13 + },
  14 + get: {
  15 + method: 'GET'
  16 + },
  17 + save: {
  18 + method: 'POST'
  19 + }
  20 + }
  21 + )
  22 + };
  23 +}]);
0 \ No newline at end of file 24 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/core/busLineInfoStat/service.js 0 → 100644
  1 +// 线路运营统计service
  2 +angular.module('ScheduleApp').factory('BusLineInfoStatService_g', ['$resource', function($resource) {
  3 + return $resource(
  4 + '/bic/:id',
  5 + {order: 'createDate', direction: 'DESC', id: '@id_route'}, // TODO:以后需要根据属性对象的属性查询
  6 + {
  7 + list: {
  8 + method: 'GET',
  9 + params: {
  10 + page: 0
  11 + }
  12 + }
  13 + }
  14 + );
  15 +}]);
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/service.js 0 → 100644
  1 +// 人员配置service
  2 +angular.module('ScheduleApp').factory('EmployeeConfigService_g', ['$resource', function($resource) {
  3 + return {
  4 + rest : $resource(
  5 + '/eci/:id',
  6 + {order: 'xl.id,isCancel,dbbmFormula', direction: 'ASC', id: '@id_route'},
  7 + {
  8 + list: {
  9 + method: 'GET',
  10 + params: {
  11 + page: 0
  12 + }
  13 + },
  14 + get: {
  15 + method: 'GET'
  16 + },
  17 + save: {
  18 + method: 'POST'
  19 + },
  20 + delete: {
  21 + method: 'DELETE'
  22 + }
  23 + }
  24 + ),
  25 + validate: $resource( // TODO:
  26 + '/personnel/validate/:type',
  27 + {},
  28 + {
  29 + jobCode: {
  30 + method: 'GET'
  31 + }
  32 + }
  33 + )
  34 + };
  35 +}]);
0 \ No newline at end of file 36 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/core/guideboardManage/edit.html
  1 +<div class="page-head">
  2 + <div class="page-title">
  3 + <h1>路牌管理</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="guideboardManage">路牌管理</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="GuideboardManageFormCtrl 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 +
  36 + <div class="form-body">
  37 + <div class="form-group has-success has-feedback">
  38 + <label class="col-md-2 control-label">线路*:</label>
  39 + <div class="col-md-3">
  40 + <sa-Select5 name="xl"
  41 + model="ctrl.guideboardManageForForm"
  42 + cmaps="{'xl.id' : 'id'}"
  43 + dcname="xl.id"
  44 + icname="id"
  45 + dsparams="{{ {type: 'ajax', param:{type: 'all', 'destroy_eq': 0}, atype:'xl' } | json }}"
  46 + iterobjname="item"
  47 + iterobjexp="item.name"
  48 + searchph="请输拼音..."
  49 + searchexp="this.name"
  50 + required >
  51 + </sa-Select5>
  52 + </div>
  53 + <!-- 隐藏块,显示验证信息 -->
  54 + <div class="alert alert-danger well-sm" ng-show="myForm.xl.$error.required">
  55 + 线路必须选择
  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-3">
  62 + <input type="number" class="form-control" ng-model="ctrl.guideboardManageForForm.lpNo"
  63 + name="lpNo" placeholder="请输入路牌编号..." min="1" required
  64 + remote-Validation
  65 + remotevtype="gbv1"
  66 + remotevparam="{{ {'xl.id_eq': ctrl.guideboardManageForForm.xl.id, 'lpNo_eq': ctrl.guideboardManageForForm.lpNo} | json}}"
  67 +
  68 + />
  69 + </div>
  70 + <div class="alert alert-danger well-sm" ng-show="myForm.lpNo.$error.required">
  71 + 路牌编号必须填写
  72 + </div>
  73 + <div class="alert alert-danger well-sm" ng-show="myForm.lpNo.$error.number">
  74 + 必须输入数字
  75 + </div>
  76 + <div class="alert alert-danger well-sm" ng-show="myForm.lpNo.$error.remote">
  77 + {{$remote_msg}}
  78 + </div>
  79 + </div>
  80 +
  81 + <div class="form-group has-success has-feedback">
  82 + <label class="col-md-2 control-label">路牌名称*:</label>
  83 + <div class="col-md-3">
  84 + <input type="text" class="form-control" ng-model="ctrl.guideboardManageForForm.lpName"
  85 + name="lpName" placeholder="请输入路牌名字..." required
  86 + remote-Validation
  87 + remotevtype="gbv2"
  88 + remotevparam="{{ {'xl.id_eq': ctrl.guideboardManageForForm.xl.id, 'lpName_eq': ctrl.guideboardManageForForm.lpName} | json}}"
  89 +
  90 + />
  91 + </div>
  92 +
  93 + <!-- 隐藏块,显示验证信息 -->
  94 + <div class="alert alert-danger well-sm" ng-show="myForm.lpName.$error.required">
  95 + 路牌名称必须填写
  96 + </div>
  97 + <div class="alert alert-danger well-sm" ng-show="myForm.lpName.$error.remote">
  98 + {{$remote_msg}}
  99 + </div>
  100 + </div>
  101 +
  102 + <!-- 路牌类型暂时是普通路牌,默认填写了 -->
  103 +
  104 +
  105 + </div>
  106 +
  107 + <div class="form-actions">
  108 + <div class="row">
  109 + <div class="col-md-offset-3 col-md-4">
  110 + <button type="submit" class="btn green" ng-disabled="!myForm.$valid">
  111 + <i class="fa fa-check">提交</i>
  112 + </button>
  113 + <a type="button" class="btn default" ui-sref="guideboardManage">
  114 + <i class="fa fa-times">取消</i>
  115 + </a>
  116 + </div>
  117 + </div>
  118 + </div>
  119 +
  120 + </form>
  121 +
  122 + </div>
  123 +
  124 +</div>
  125 +
  126 +
  127 +
  128 +
  129 +
  130 +
  131 +
  132 +
  133 +
  134 +
  135 +
  136 +
src/main/resources/static/pages/scheduleApp/module/core/guideboardManage/form.html
1 -<h1>TODO</h1>  
2 \ No newline at end of file 1 \ No newline at end of file
  2 +<div class="page-head">
  3 + <div class="page-title">
  4 + <h1>路牌管理</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="guideboardManage">路牌管理</a>
  19 + <i class="fa fa-circle"></i>
  20 + </li>
  21 + <li>
  22 + <span class="active">添加路牌</span>
  23 + </li>
  24 +</ul>
  25 +
  26 +<div class="portlet light bordered" ng-controller="GuideboardManageFormCtrl as ctrl">
  27 + <div class="portlet-title">
  28 + <div class="caption">
  29 + <i class="icon-equalizer font-red-sunglo"></i> <span
  30 + class="caption-subject font-red-sunglo bold uppercase">表单</span>
  31 + </div>
  32 + </div>
  33 +
  34 + <div class="portlet-body form">
  35 + <form ng-submit="ctrl.submit()" class="form-horizontal" novalidate name="myForm">
  36 +
  37 + <div class="form-body">
  38 + <div class="form-group has-success has-feedback">
  39 + <label class="col-md-2 control-label">线路*:</label>
  40 + <div class="col-md-3">
  41 + <sa-Select5 name="xl"
  42 + model="ctrl.guideboardManageForForm"
  43 + cmaps="{'xl.id' : 'id'}"
  44 + dcname="xl.id"
  45 + icname="id"
  46 + dsparams="{{ {type: 'ajax', param:{type: 'all', 'destroy_eq': 0}, atype:'xl' } | json }}"
  47 + iterobjname="item"
  48 + iterobjexp="item.name"
  49 + searchph="请输拼音..."
  50 + searchexp="this.name"
  51 + required >
  52 + </sa-Select5>
  53 + </div>
  54 + <!-- 隐藏块,显示验证信息 -->
  55 + <div class="alert alert-danger well-sm" ng-show="myForm.xl.$error.required">
  56 + 线路必须选择
  57 + </div>
  58 + </div>
  59 +
  60 + <div class="form-group has-success has-feedback">
  61 + <label class="col-md-2 control-label">路牌编号:</label>
  62 + <div class="col-md-3">
  63 + <input type="number" class="form-control" ng-model="ctrl.guideboardManageForForm.lpNo"
  64 + name="lpNo" placeholder="请输入路牌编号..." min="1" required
  65 + remote-Validation
  66 + remotevtype="gbv1"
  67 + remotevparam="{{ {'xl.id_eq': ctrl.guideboardManageForForm.xl.id, 'lpNo_eq': ctrl.guideboardManageForForm.lpNo} | json}}"
  68 +
  69 + />
  70 + </div>
  71 + <div class="alert alert-danger well-sm" ng-show="myForm.lpNo.$error.required">
  72 + 路牌编号必须填写
  73 + </div>
  74 + <div class="alert alert-danger well-sm" ng-show="myForm.lpNo.$error.number">
  75 + 必须输入数字
  76 + </div>
  77 + <div class="alert alert-danger well-sm" ng-show="myForm.lpNo.$error.remote">
  78 + {{$remote_msg}}
  79 + </div>
  80 + </div>
  81 +
  82 + <div class="form-group has-success has-feedback">
  83 + <label class="col-md-2 control-label">路牌名称*:</label>
  84 + <div class="col-md-3">
  85 + <input type="text" class="form-control" ng-model="ctrl.guideboardManageForForm.lpName"
  86 + name="lpName" placeholder="请输入路牌名字..." required
  87 + remote-Validation
  88 + remotevtype="gbv2"
  89 + remotevparam="{{ {'xl.id_eq': ctrl.guideboardManageForForm.xl.id, 'lpName_eq': ctrl.guideboardManageForForm.lpName} | json}}"
  90 +
  91 + />
  92 + </div>
  93 +
  94 + <!-- 隐藏块,显示验证信息 -->
  95 + <div class="alert alert-danger well-sm" ng-show="myForm.lpName.$error.required">
  96 + 路牌名称必须填写
  97 + </div>
  98 + <div class="alert alert-danger well-sm" ng-show="myForm.lpName.$error.remote">
  99 + {{$remote_msg}}
  100 + </div>
  101 + </div>
  102 +
  103 + <!-- 路牌类型暂时是普通路牌,默认填写了 -->
  104 +
  105 +
  106 + </div>
  107 +
  108 + <div class="form-actions">
  109 + <div class="row">
  110 + <div class="col-md-offset-3 col-md-4">
  111 + <button type="submit" class="btn green"
  112 + ng-disabled="!myForm.$valid"
  113 + >
  114 + <i class="fa fa-check">提交</i>
  115 + </button>
  116 + <a type="button" class="btn default" ui-sref="guideboardManage">
  117 + <i class="fa fa-times">取消</i>
  118 + </a>
  119 + </div>
  120 + </div>
  121 + </div>
  122 +
  123 + </form>
  124 +
  125 + </div>
  126 +
  127 +</div>
  128 +
  129 +
  130 +
  131 +
src/main/resources/static/pages/scheduleApp/module/core/guideboardManage/index.html
@@ -27,10 +27,10 @@ @@ -27,10 +27,10 @@
27 <span class="caption-subject bold uppercase">路牌表</span> 27 <span class="caption-subject bold uppercase">路牌表</span>
28 </div> 28 </div>
29 <div class="actions"> 29 <div class="actions">
30 - <!--<a href="javascirpt:" class="btn btn-circle blue" ng-click="ctrl.goForm()">-->  
31 - <!--<i class="fa fa-plus"></i>-->  
32 - <!--添加路牌-->  
33 - <!--</a>--> 30 + <a ui-sref="guideboardManage_form" class="btn btn-circle blue">
  31 + <i class="fa fa-plus"></i>
  32 + 添加路牌
  33 + </a>
34 34
35 <div class="btn-group"> 35 <div class="btn-group">
36 <a href="javascript:" class="btn red btn-outline btn-circle" data-toggle="dropdown"> 36 <a href="javascript:" class="btn red btn-outline btn-circle" data-toggle="dropdown">
src/main/resources/static/pages/scheduleApp/module/core/guideboardManage/list.html
@@ -4,44 +4,55 @@ @@ -4,44 +4,55 @@
4 <table class="fixTable table table-striped table-bordered table-hover table-checkable order-column"> 4 <table class="fixTable table table-striped table-bordered table-hover table-checkable order-column">
5 <thead> 5 <thead>
6 <tr role="row" class="heading"> 6 <tr role="row" class="heading">
7 - <th style="width: 5%">序号</th>  
8 - <th style="width: 15%">线路</th>  
9 - <th >路牌编号</th> 7 + <th style="width: 50px">序号</th>
  8 + <th style="width: 150px;">线路</th>
  9 + <th style="width: 100px;">路牌编号</th>
10 <th >路牌名称</th> 10 <th >路牌名称</th>
11 - <th >路牌类型</th>  
12 - <th style="width: 21%">操作</th> 11 + <th style="width: 100px;">路牌类型</th>
  12 + <th style="width: 80px;">状态</th>
  13 + <th style="width: 20%">操作</th>
13 </tr> 14 </tr>
14 <tr role="row" class="filter"> 15 <tr role="row" class="filter">
15 <td></td> 16 <td></td>
16 <td> 17 <td>
17 <div> 18 <div>
18 - <sa-Select3 model="ctrl.searchCondition()"  
19 - name="xl"  
20 - placeholder="请输拼音..."  
21 - dcvalue="{{ctrl.searchCondition()['xl.lineCode_eq']}}" 19 + <sa-Select5 name="xl"
  20 + model="ctrl.searchCondition()"
  21 + cmaps="{'xl.lineCode_eq' : 'lineCode'}"
22 dcname="xl.lineCode_eq" 22 dcname="xl.lineCode_eq"
23 icname="lineCode" 23 icname="lineCode"
24 - icnames="name"  
25 - datatype="xl">  
26 - </sa-Select3> 24 + dsparams="{{ {type: 'ajax', param:{type: 'all', 'destroy_eq': 0}, atype:'xl' } | json }}"
  25 + iterobjname="item"
  26 + iterobjexp="item.name"
  27 + searchph="请输拼音..."
  28 + searchexp="this.name"
  29 + required >
  30 + </sa-Select5>
27 </div> 31 </div>
28 </td> 32 </td>
29 <td></td> 33 <td></td>
30 - <td></td> 34 + <td>
  35 + <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition()['lpName_like']" placeholder="请输入路牌名字..."/>
  36 + </td>
31 <td></td> 37 <td></td>
32 <td> 38 <td>
  39 + <label class="checkbox-inline">
  40 + <input type="checkbox" ng-model="ctrl.searchCondition()['isCancel_eq']"/>已作废
  41 + </label>
  42 + </td>
  43 + <td>
33 <button class="btn btn-sm green btn-outline filter-submit margin-bottom" 44 <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
34 - ng-click="ctrl.pageChanaged()"> 45 + ng-click="ctrl.doPage()">
35 <i class="fa fa-search"></i> 搜索</button> 46 <i class="fa fa-search"></i> 搜索</button>
36 47
37 <button class="btn btn-sm red btn-outline filter-cancel" 48 <button class="btn btn-sm red btn-outline filter-cancel"
38 - ng-click="ctrl.resetSearchCondition()"> 49 + ng-click="ctrl.reset()">
39 <i class="fa fa-times"></i> 重置</button> 50 <i class="fa fa-times"></i> 重置</button>
40 </td> 51 </td>
41 </tr> 52 </tr>
42 </thead> 53 </thead>
43 <tbody> 54 <tbody>
44 - <tr ng-repeat="info in ctrl.pageInfo.infos" class="odd gradeX"> 55 + <tr ng-repeat="info in ctrl.page()['content']" ng-class="{odd: true, gradeX: true, danger: info.isCancel}">
45 <td> 56 <td>
46 <span ng-bind="$index + 1"></span> 57 <span ng-bind="$index + 1"></span>
47 </td> 58 </td>
@@ -58,10 +69,16 @@ @@ -58,10 +69,16 @@
58 <span ng-bind="info.lpType"></span> 69 <span ng-bind="info.lpType"></span>
59 </td> 70 </td>
60 <td> 71 <td>
  72 + <span class="glyphicon glyphicon-ok" ng-if="info.isCancel == '0'"></span>
  73 + <span class="glyphicon glyphicon-remove" ng-if="info.isCancel == '1'"></span>
  74 + </td>
  75 + <td>
61 <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>--> 76 <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>-->
62 <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>--> 77 <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>-->
63 <a ui-sref="guideboardManage_detail({id : info.id})" class="btn btn-info btn-sm"> 详细 </a> 78 <a ui-sref="guideboardManage_detail({id : info.id})" class="btn btn-info btn-sm"> 详细 </a>
64 - <!--<a ui-sref="#" class="btn default blue-stripe btn-sm"> 修改 </a>--> 79 + <a ui-sref="guideboardManage_edit({id: info.id})" class="btn btn-info btn-sm" ng-if="info.isCancel == '0'"> 修改 </a>
  80 + <a ng-click="ctrl.toggleCancel(info.id)" class="btn btn-danger btn-sm" ng-if="info.isCancel == '0'"> 作废 </a>
  81 + <a ng-click="ctrl.toggleCancel(info.id)" class="btn btn-success btn-sm" ng-if="info.isCancel == '1'"> 撤销 </a>
65 </td> 82 </td>
66 </tr> 83 </tr>
67 </tbody> 84 </tbody>
@@ -69,9 +86,9 @@ @@ -69,9 +86,9 @@
69 </div> 86 </div>
70 87
71 <div style="text-align: right;"> 88 <div style="text-align: right;">
72 - <uib-pagination total-items="ctrl.pageInfo.totalItems"  
73 - ng-model="ctrl.pageInfo.currentPage"  
74 - ng-change="ctrl.pageChanaged()" 89 + <uib-pagination total-items="ctrl.page()['totalElements']"
  90 + ng-model="ctrl.page()['uiNumber']"
  91 + ng-change="ctrl.doPage()"
75 rotate="false" 92 rotate="false"
76 max-size="10" 93 max-size="10"
77 boundary-links="true" 94 boundary-links="true"
src/main/resources/static/pages/scheduleApp/module/core/guideboardManage/module.js
1 // 路牌管理 service controller 等写在一起 1 // 路牌管理 service controller 等写在一起
2 2
3 -angular.module('ScheduleApp').factory('GuideboardManageService', ['GuideboardManageService_g', function(service) {  
4 - /** 当前的查询条件信息 */  
5 - var currentSearchCondition = {};  
6 -  
7 - /** 当前第几页 */  
8 - var currentPageNo = 1;  
9 -  
10 - return {  
11 - /**  
12 - * 获取查询条件信息,  
13 - * 用于给controller用来和页面数据绑定。  
14 - */  
15 - getSearchCondition: function() {  
16 - return currentSearchCondition;  
17 - },  
18 - /**  
19 - * 重置查询条件信息。  
20 - */  
21 - resetSearchCondition: function() {  
22 - var key;  
23 - for (key in currentSearchCondition) {  
24 - currentSearchCondition[key] = undefined;  
25 - }  
26 - },  
27 - /**  
28 - * 设置当前页码。  
29 - * @param cpn 从1开始,后台是从0开始的  
30 - */  
31 - setCurrentPageNo: function(cpn) {  
32 - currentPageNo = cpn;  
33 - },  
34 - /**  
35 - * 组装查询参数,返回一个promise查询结果。  
36 - * @param params 查询参数  
37 - * @return 返回一个 promise  
38 - */  
39 - getPage: function() {  
40 - var params = currentSearchCondition; // 查询条件  
41 - params.page = currentPageNo - 1; // 服务端页码从0开始  
42 - return service.rest.list(params).$promise;  
43 - },  
44 - /**  
45 - * 获取明细信息。  
46 - * @param id 车辆id  
47 - * @return 返回一个 promise  
48 - */  
49 - getDetail: function(id) {  
50 - var params = {id: id};  
51 - return service.rest.get(params).$promise;  
52 - },  
53 - /**  
54 - * 保存信息。  
55 - * @param obj 车辆详细信息  
56 - * @return 返回一个 promise  
57 - */  
58 - saveDetail: function(obj) {  
59 - return service.rest.save(obj).$promise; 3 +angular.module('ScheduleApp').factory(
  4 + 'GuideboardManageService',
  5 + [
  6 + 'GuideboardManageService_g',
  7 + function(service) {
  8 +
  9 + /** 当前的查询条件信息 */
  10 + var currentSearchCondition = {page: 0, 'isCancel_eq': false};
  11 + // 当前查询返回的信息
  12 + var currentPage = { // 后台spring data返回的格式
  13 + totalElements: 0,
  14 + number: 0, // 后台返回的页码,spring返回从0开始
  15 + content: [],
  16 +
  17 + uiNumber: 1 // 页面绑定的页码
  18 + };
  19 +
  20 + // 查询对象类
  21 + var queryClass = service.rest;
  22 +
  23 + return {
  24 + getGbQueryClass: function() {
  25 + return queryClass;
  26 + },
  27 +
  28 + /**
  29 + * 获取查询条件信息,
  30 + * 用于给controller用来和页面数据绑定。
  31 + */
  32 + getSearchCondition: function() {
  33 + currentSearchCondition.page = currentPage.uiNumber - 1;
  34 + return currentSearchCondition;
  35 + },
  36 + /**
  37 + * 重置查询条件信息。
  38 + */
  39 + resetStatus: function() {
  40 + currentSearchCondition = {page: 0, 'isCancel_eq': false};
  41 + currentPage = {
  42 + totalElements: 0,
  43 + number: 0,
  44 + content: [],
  45 + uiNumber: 1
  46 + };
  47 + },
  48 + /**
  49 + * 组装查询参数,返回一个promise查询结果。
  50 + * @param params 查询参数
  51 + * @return 返回一个 promise
  52 + */
  53 + getPage: function(page) {
  54 + if (page) {
  55 + currentPage.totalElements = page.totalElements;
  56 + currentPage.number = page.number;
  57 + currentPage.content = page.content;
  58 + }
  59 + return currentPage;
  60 + },
  61 + /**
  62 + * 获取明细信息。
  63 + * @param id 车辆id
  64 + * @return 返回一个 promise
  65 + */
  66 + getDetail: function(id) {
  67 + var params = {id: id};
  68 + return service.rest.get(params).$promise;
  69 + },
  70 + /**
  71 + * 保存信息。
  72 + * @param obj 车辆详细信息
  73 + * @return 返回一个 promise
  74 + */
  75 + saveDetail: function(obj) {
  76 + return service.rest.save(obj).$promise;
  77 + }
  78 + };
60 } 79 }
61 - };  
62 -}]); 80 + ]
  81 +);
63 82
64 angular.module('ScheduleApp').controller('GuideboardManageCtrl', ['GuideboardManageService', '$state', '$uibModal', function(guideboardManageService, $state, $uibModal) { 83 angular.module('ScheduleApp').controller('GuideboardManageCtrl', ['GuideboardManageService', '$state', '$uibModal', function(guideboardManageService, $state, $uibModal) {
65 var self = this; 84 var self = this;
@@ -94,6 +113,7 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;GuideboardManageCtrl&#39;, [&#39;GuideboardMan @@ -94,6 +113,7 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;GuideboardManageCtrl&#39;, [&#39;GuideboardMan
94 } 113 }
95 ); 114 );
96 }; 115 };
  116 +
97 }]); 117 }]);
98 118
99 angular.module('ScheduleApp').controller('GuideboardManageToolsCtrl', ['$modalInstance', 'FileUploader', function($modalInstance, FileUploader) { 119 angular.module('ScheduleApp').controller('GuideboardManageToolsCtrl', ['$modalInstance', 'FileUploader', function($modalInstance, FileUploader) {
@@ -132,84 +152,123 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;GuideboardManageToolsCtrl&#39;, [&#39;$modalIn @@ -132,84 +152,123 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;GuideboardManageToolsCtrl&#39;, [&#39;$modalIn
132 152
133 }]); 153 }]);
134 154
135 -angular.module('ScheduleApp').controller('GuideboardManageListCtrl', ['GuideboardManageService', function(guideboardManageService) {  
136 - var self = this;  
137 - self.pageInfo = {  
138 - totalItems : 0,  
139 - currentPage : 1,  
140 - infos: []  
141 - }; 155 +// list.html控制器
  156 +angular.module('ScheduleApp').controller(
  157 + 'GuideboardManageListCtrl',
  158 + [
  159 + 'GuideboardManageService',
  160 + function(service) {
  161 + var self = this;
  162 + var Gb = service.getGbQueryClass();
  163 +
  164 + self.page = function() {
  165 + return service.getPage();
  166 + };
  167 +
  168 + self.searchCondition = function() {
  169 + return service.getSearchCondition();
  170 + };
  171 +
  172 + self.doPage = function() {
  173 + var result = Gb.list(self.searchCondition(), function(result) {
  174 + service.getPage(result.data);
  175 + });
  176 + };
  177 + self.reset = function() {
  178 + service.resetStatus();
  179 + var result = Gb.list(self.searchCondition(), function() {
  180 + service.getPage(result.data);
  181 + });
  182 + };
  183 + self.toggleTtinfo = function(id) {
  184 + Gb.delete({id: id}, function(result) {
  185 + if (result.message) { // 暂时这样做,之后全局拦截
  186 + alert("失败:" + result.message);
  187 + } else {
  188 + self.doPage();
  189 + }
  190 + });
  191 + };
  192 +
  193 + // 作废切换
  194 + self.toggleCancel = function(id) {
  195 + Gb.delete({id: id}, function(result) {
  196 + if (result.status == "ERROR") { // 暂时这样做,之后全局拦截
  197 + alert("失败:" + result.msg);
  198 + } else {
  199 + self.doPage();
  200 + }
  201 + });
  202 + };
  203 +
  204 +
  205 + // TODO:导出
142 206
143 - // 初始创建的时候,获取一次列表数据  
144 - guideboardManageService.getPage().then(  
145 - function(result) {  
146 - self.pageInfo.totalItems = result.totalElements;  
147 - self.pageInfo.currentPage = result.number + 1;  
148 - self.pageInfo.infos = result.content;  
149 - guideboardManageService.setCurrentPageNo(result.number + 1);  
150 - },  
151 - function(result) {  
152 - alert("出错啦!"); 207 +
  208 + self.doPage();
153 } 209 }
154 - );  
155 -  
156 - //$scope.$watch("ctrl.pageInfo.currentPage", function() {  
157 - // alert("dfdfdf");  
158 - //});  
159 -  
160 - // 翻页的时候调用  
161 - self.pageChanaged = function() {  
162 - guideboardManageService.setCurrentPageNo(self.pageInfo.currentPage);  
163 - guideboardManageService.getPage().then(  
164 - function(result) {  
165 - self.pageInfo.totalItems = result.totalElements;  
166 - self.pageInfo.currentPage = result.number + 1;  
167 - self.pageInfo.infos = result.content;  
168 - guideboardManageService.setCurrentPageNo(result.number + 1);  
169 - },  
170 - function(result) {  
171 - alert("出错啦!");  
172 - }  
173 - );  
174 - };  
175 - // 获取查询条件数据  
176 - self.searchCondition = function() {  
177 - return guideboardManageService.getSearchCondition();  
178 - };  
179 - // 重置查询条件  
180 - self.resetSearchCondition = function() {  
181 - guideboardManageService.resetSearchCondition();  
182 - self.pageInfo.currentPage = 1;  
183 - self.pageChanaged();  
184 - }; 210 + ]
  211 +);
185 212
186 -}]); 213 +//form.html控制器
  214 +angular.module('ScheduleApp').controller(
  215 + 'GuideboardManageFormCtrl',
  216 + [
  217 + 'GuideboardManageService',
  218 + '$stateParams',
  219 + '$state',
  220 + '$scope',
  221 + function(service, $stateParams, $state, $scope) {
  222 + var self = this;
  223 + var Gb = service.getGbQueryClass();
187 224
188 -angular.module('ScheduleApp').controller('GuideboardManageFormCtrl', ['GuideboardManageService', '$stateParams', '$state', function(guideboardManageService, $stateParams, $state) {  
189 - // TODO:  
190 -}]); 225 + // 欲保存的表单信息,双向绑定
  226 + self.guideboardManageForForm = new Gb;
  227 + self.guideboardManageForForm.xl = {};
191 228
192 -angular.module('ScheduleApp').controller('GuideboardManageDetailCtrl', ['GuideboardManageService', '$stateParams', function(guideboardManageService, $stateParams) {  
193 - var self = this;  
194 - self.title = "";  
195 - self.guideboardForDetail = {};  
196 - self.guideboardForDetail.id = $stateParams.id;  
197 -  
198 - // 当转向到此页面时,就获取明细信息并绑定  
199 - guideboardManageService.getDetail($stateParams.id).then(  
200 - function(result) {  
201 - var key;  
202 - for (key in result) {  
203 - self.guideboardForDetail[key] = result[key]; 229 + // 如果是修改,获取传过来的id,从后台获取一份数据,用于绑定页面form值
  230 + var id = $stateParams.id;
  231 + if (id) {
  232 + Gb.get({id: id}, function(value) {
  233 + self.guideboardManageForForm = value;
  234 + });
204 } 235 }
  236 + // form提交方法
  237 + self.submit = function() {
  238 + console.log($scope);
  239 + console.log(self.guideboardManageForForm);
  240 +
  241 + self.guideboardManageForForm.lpType = "普通路牌";
  242 + self.guideboardManageForForm.$save(function() {
  243 + $state.go("guideboardManage");
  244 + });
  245 + };
205 246
206 - self.title = "路牌 " + self.guideboardForDetail.lpName + " 详细信息";  
207 - },  
208 - function(result) {  
209 - // TODO:弹出框方式以后改  
210 - alert("出错啦!");  
211 } 247 }
212 - );  
213 -}]); 248 + ]
  249 +);
  250 +
  251 +// detail.html控制器
  252 +angular.module('ScheduleApp').controller(
  253 + 'GuideboardManageDetailCtrl',
  254 + [
  255 + 'GuideboardManageService',
  256 + '$stateParams',
  257 + function(service, $stateParams) {
  258 + var self = this;
  259 + var Gb = service.getGbQueryClass();
  260 + var id = $stateParams.id;
  261 +
  262 + self.title = "";
  263 + self.guideboardForDetail = {};
  264 +
  265 + // 当转向到此页面时,就获取明细信息并绑定
  266 + Gb.get({id: id}, function(result) {
  267 + self.guideboardForDetail = result.data;
  268 + self.title = "路牌 " + self.guideboardForDetail.lpName + " 详细信息";
  269 + });
  270 + }
  271 + ]
  272 +);
214 273
215 274
src/main/resources/static/pages/scheduleApp/module/core/guideboardManage/route.js
@@ -35,6 +35,44 @@ ScheduleApp.config([ @@ -35,6 +35,44 @@ ScheduleApp.config([
35 }] 35 }]
36 } 36 }
37 }) 37 })
  38 + .state('guideboardManage_form', { // 添加路牌form
  39 + url: '/guideboardManage_form',
  40 + views: {
  41 + '': {templateUrl: 'pages/scheduleApp/module/core/guideboardManage/form.html'}
  42 + },
  43 + resolve: {
  44 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  45 + return $ocLazyLoad.load({
  46 + name: 'guideboardManage_form_module',
  47 + insertBefore: '#ng_load_plugins_before',
  48 + files: [
  49 + 'assets/bower_components/angular-ui-select/dist/select.min.css',
  50 + 'assets/bower_components/angular-ui-select/dist/select.min.js',
  51 + 'pages/scheduleApp/module/core/guideboardManage/module.js'
  52 + ]
  53 + });
  54 + }]
  55 + }
  56 + })
  57 + .state('guideboardManage_edit', { // 修改路牌form
  58 + url: '/guideboardManage_edit/:id',
  59 + views: {
  60 + '': {templateUrl: 'pages/scheduleApp/module/core/guideboardManage/edit.html'}
  61 + },
  62 + resolve: {
  63 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  64 + return $ocLazyLoad.load({
  65 + name: 'guideboardManage_edit_module',
  66 + insertBefore: '#ng_load_plugins_before',
  67 + files: [
  68 + 'assets/bower_components/angular-ui-select/dist/select.min.css',
  69 + 'assets/bower_components/angular-ui-select/dist/select.min.js',
  70 + 'pages/scheduleApp/module/core/guideboardManage/module.js'
  71 + ]
  72 + });
  73 + }]
  74 + }
  75 + })
38 .state("guideboardManage_detail", { // 详细信息页面 76 .state("guideboardManage_detail", { // 详细信息页面
39 url: '/guideboardManage_detail/:id', 77 url: '/guideboardManage_detail/:id',
40 views: { 78 views: {
@@ -53,4 +91,5 @@ ScheduleApp.config([ @@ -53,4 +91,5 @@ ScheduleApp.config([
53 } 91 }
54 }) 92 })
55 93
  94 +
56 }]); 95 }]);
57 \ No newline at end of file 96 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/core/guideboardManage/service.js 0 → 100644
  1 +// 路牌管理service
  2 +angular.module('ScheduleApp').factory('GuideboardManageService_g', ['$resource', function($resource) {
  3 + return {
  4 + rest: $resource(
  5 + '/gic/:id',
  6 + {order: 'xl,isCancel', direction: 'DESC,ASC', id: '@id_route'},
  7 + {
  8 + list: {
  9 + method: 'GET',
  10 + params: {
  11 + page: 0
  12 + }
  13 + },
  14 + get: {
  15 + method: 'GET',
  16 + transformResponse: function(rs) {
  17 + var dst = angular.fromJson(rs);
  18 + if (dst.status == 'SUCCESS') {
  19 + return dst.data;
  20 + } else {
  21 + return dst;
  22 + }
  23 + }
  24 + },
  25 + save: {
  26 + method: 'POST'
  27 + }
  28 + // 内部还有默认的方法delete
  29 + }
  30 + )
  31 + };
  32 +}]);
0 \ No newline at end of file 33 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/core/rerunManage/service.js 0 → 100644
  1 +// 套跑管理service
  2 +angular.module('ScheduleApp').factory('rerunManageService_g', ['$resource', function($resource) {
  3 + return {
  4 + rest: $resource(
  5 + 'rms/:id',
  6 + {order: 'rerunXl.id,isCancel', direction: 'ASC', id: '@id_route'},
  7 + {
  8 + list: {
  9 + method: 'GET',
  10 + params: {
  11 + page: 0
  12 + }
  13 + },
  14 + get: {
  15 + method: 'GET'
  16 + },
  17 + save: {
  18 + method: 'POST'
  19 + },
  20 + delete: {
  21 + method: 'DELETE'
  22 + }
  23 + }
  24 + )
  25 + };
  26 +}]);
0 \ No newline at end of file 27 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/service.js 0 → 100644
  1 +// 排班计划管理service
  2 +angular.module('ScheduleApp').factory('SchedulePlanManageService_g', ['$resource', function($resource) {
  3 + return {
  4 + rest : $resource(
  5 + '/spc/:id',
  6 + {order: 'xl.id,createDate', direction: 'DESC,DESC', id: '@id_route'},
  7 + {
  8 + list: {
  9 + method: 'GET',
  10 + params: {
  11 + page: 0
  12 + }
  13 + },
  14 + get: {
  15 + method: 'GET'
  16 + },
  17 + save: {
  18 + method: 'POST'
  19 + },
  20 + delete: {
  21 + method: 'DELETE'
  22 + }
  23 + }
  24 + ),
  25 + tommorw: $resource(
  26 + '/spc/tommorw',
  27 + {},
  28 + {
  29 + list: {
  30 + method: 'GET'
  31 + }
  32 + }
  33 + )
  34 + };
  35 +}]);
  36 +
  37 +// 排班计划明细管理service
  38 +angular.module('ScheduleApp').factory('SchedulePlanInfoManageService_g', ['$resource', function($resource) {
  39 + return {
  40 + rest : $resource(
  41 + '/spic/:id',
  42 + {order: 'scheduleDate,lp,fcno', direction: 'ASC,ASC,ASC', id: '@id_route'},
  43 + {
  44 + list: {
  45 + method: 'GET',
  46 + params: {
  47 + page: 0
  48 + }
  49 + },
  50 + get: {
  51 + method: 'GET'
  52 + },
  53 + save: {
  54 + method: 'POST'
  55 + }
  56 + }
  57 + ),
  58 + groupinfo : $resource(
  59 + '/spic/groupinfos/:xlid/:sdate',
  60 + {},
  61 + {
  62 + list: {
  63 + method: 'GET',
  64 + isArray: true
  65 + }
  66 + }
  67 + ),
  68 + updateGroupInfo : $resource(
  69 + '/spic/groupinfos/update',
  70 + {},
  71 + {
  72 + update: {
  73 + method: 'POST'
  74 + }
  75 + }
  76 + )
  77 + };
  78 +}]);
0 \ No newline at end of file 79 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/core/scheduleRuleManage/service.js 0 → 100644
  1 +// 排班管理service
  2 +angular.module('ScheduleApp').factory('ScheduleRuleManageService_g', ['$resource', function($resource) {
  3 + return {
  4 + rest: $resource(
  5 + '/sr1fc/:id',
  6 + {order: 'createDate', direction: 'DESC', id: '@id_route'},
  7 + {
  8 + list: {
  9 + method: 'GET',
  10 + params: {
  11 + page: 0
  12 + }
  13 + },
  14 + get: {
  15 + method: 'GET'
  16 + },
  17 + save: {
  18 + method: 'POST'
  19 + },
  20 + delete: {
  21 + method: 'DELETE'
  22 + }
  23 + }
  24 + )
  25 + };
  26 +}]);
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/index.html
@@ -27,6 +27,10 @@ @@ -27,6 +27,10 @@
27 <span class="caption-subject bold uppercase">时刻表</span> 27 <span class="caption-subject bold uppercase">时刻表</span>
28 </div> 28 </div>
29 <div class="actions"> 29 <div class="actions">
  30 + <a ui-sref="ttInfoManage_test" class="btn btn-circle blue">
  31 + <i class="fa fa-plus"></i>
  32 + 测试
  33 + </a>
30 <a href="javascirpt:" class="btn btn-circle blue" ng-click="ctrl.toTtInfoManageForm()"> 34 <a href="javascirpt:" class="btn btn-circle blue" ng-click="ctrl.toTtInfoManageForm()">
31 <i class="fa fa-plus"></i> 35 <i class="fa fa-plus"></i>
32 添加时刻表 36 添加时刻表
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/route.js
@@ -88,7 +88,24 @@ ScheduleApp.config([ @@ -88,7 +88,24 @@ ScheduleApp.config([
88 }); 88 });
89 }] 89 }]
90 } 90 }
91 - }); 91 + })
  92 + .state('ttInfoManage_test', { // TODO:测试页面
  93 + url: '/ttInfoManage_test',
  94 + views: {
  95 + '': {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/test.html'}
  96 + },
  97 + resolve: {
  98 + deps: ['$ocLazyLoad', function($ocLazyLoad) {
  99 + return $ocLazyLoad.load({
  100 + name: 'ttInfoManage_test_module',
  101 + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置
  102 + files: [
  103 + 'pages/scheduleApp/module/core/ttInfoManage/test.js'
  104 + ]
  105 + });
  106 + }]
  107 + }
  108 + })
92 109
93 110
94 } 111 }
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/service.js 0 → 100644
  1 +// 时刻表管理service
  2 +angular.module('ScheduleApp').factory('TimeTableManageService_g', ['$resource', function($resource) {
  3 + return {
  4 + rest: $resource(
  5 + '/tic/:id',
  6 + {order: 'xl,isCancel,isEnableDisTemplate,qyrq', direction: 'DESC,ASC,DESC,DESC', id: '@id'},
  7 + {
  8 + list: {
  9 + method: 'GET',
  10 + params: {
  11 + page: 0
  12 + }
  13 + }
  14 + }
  15 + )
  16 + };
  17 +}]);
  18 +
  19 +// 时刻表明细管理service
  20 +angular.module('ScheduleApp').factory('TimeTableDetailManageService_g', ['$resource', function($resource) {
  21 + return {
  22 + rest: $resource(
  23 + '/tidc/:id',
  24 + {order: 'createDate', direction: 'DESC', id: '@id_route'},
  25 + {
  26 + get: {
  27 + method: 'GET'
  28 + },
  29 + save: {
  30 + method: 'POST'
  31 + }
  32 + }
  33 + ),
  34 + import: $resource(
  35 + '/tidc/importfile',
  36 + {},
  37 + {
  38 + do: {
  39 + method: 'POST',
  40 + headers: {
  41 + 'Content-Type': 'application/x-www-form-urlencoded'
  42 + },
  43 + transformRequest: function(obj) {
  44 + var str = [];
  45 + for (var p in obj) {
  46 + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  47 + }
  48 + return str.join("&");
  49 + }
  50 + }
  51 + }
  52 + ),
  53 + edit: $resource(
  54 + '/tidc/edit/:xlid/:ttid',
  55 + {},
  56 + {
  57 + list: {
  58 + method: 'GET'
  59 + }
  60 + }
  61 + ),
  62 + bcdetails: $resource(
  63 + '/tidc/bcdetail',
  64 + {},
  65 + {
  66 + list: {
  67 + method: 'GET',
  68 + isArray: true
  69 + }
  70 + }
  71 + ),
  72 + dataTools: $resource(
  73 + '/tidc/:type',
  74 + {},
  75 + {
  76 + dataExport: {
  77 + method: 'GET',
  78 + responseType: "arraybuffer",
  79 + params: {
  80 + type: "dataExportExt"
  81 + },
  82 + transformResponse: function(data, headers){
  83 + return {data : data};
  84 + }
  85 + }
  86 + }
  87 + )
  88 +
  89 + // TODO:导入数据
  90 + };
  91 +}]);
0 \ No newline at end of file 92 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/test.html 0 → 100644
  1 +<h1>测试新的改版select指令</h1>
  2 +
  3 +<div ng-controller="TestCtrl as ctrl">
  4 + <form name="myForm" class="form-horizontal" ng-submit="ctrl.sub()">
  5 + <div class="form-body">
  6 + <div class="form-group">
  7 + <label class="col-md-2 control-label">测试文本:</label>
  8 + <div class="col-md-3">
  9 + <input type="text" class="form-control" name="txt" ng-model="ctrl.say"/>
  10 + </div>
  11 + </div>
  12 + <div class="form-group">
  13 + <my-select name="mtxt" ng-model="ctrl.say" required>
  14 + <h1>{{ctrl.say}}</h1>
  15 + </my-select>
  16 + </div>
  17 + </div>
  18 + <div class="form-actions">
  19 + <div class="row">
  20 + <button type="submit" class="btn green" ng-disabled="!myForm.$valid">
  21 + <i class="fa fa-check"></i>
  22 + 提交
  23 + </button>
  24 + </div>
  25 + </div>
  26 + </form>
  27 +</div>
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/test.js 0 → 100644
  1 +// 测试controller
  2 +
  3 +angular.module('ScheduleApp').controller('TestCtrl', [
  4 + function() {
  5 + var self = this;
  6 + self.say = "say something";
  7 +
  8 + self.sub = function() {
  9 + alert("submit...");
  10 + };
  11 +
  12 + self.loaddata = function() {
  13 + alert("数据数据数据")
  14 + };
  15 + }
  16 +]);
0 \ No newline at end of file 17 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/package.json
@@ -34,6 +34,6 @@ @@ -34,6 +34,6 @@
34 "protractor": "protractor test/protractor-conf.js", 34 "protractor": "protractor test/protractor-conf.js",
35 35
36 36
37 - "build": "grunt directive route" 37 + "build": "grunt directive route service"
38 } 38 }
39 } 39 }