Commit b4cfaebf3afb82885ece5a309572e1f4f1b7abb1

Authored by mcy123
2 parents 6f233257 08fc891a

Merge branch 'minhang' of

http://192.168.168.201:8888/panzhaov5/bsth_control into minhang
Showing 35 changed files with 2910 additions and 1186 deletions

Too many changes to show.

To preserve performance only 35 of 55 files are displayed.

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 deleted 100644 → 0
1   -package com.bsth.controller.schedule;
2   -
3   -import com.bsth.controller.BaseController;
4   -import com.bsth.entity.schedule.GuideboardInfo;
5   -import com.bsth.repository.schedule.GuideboardInfoRepository;
6   -import com.bsth.service.schedule.utils.DataToolsProperties;
7   -import org.springframework.beans.factory.annotation.Autowired;
8   -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;
13   -
14   -import java.util.List;
15   -import java.util.Map;
16   -
17   -/**
18   - * Created by xu on 16/5/11.
19   - */
20   -@RestController
21   -@RequestMapping("gic")
22   -@EnableConfigurationProperties(DataToolsProperties.class)
23   -public class GuideboardInfoController extends BaseController<GuideboardInfo, Long> {
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   - }
44   -}
src/main/java/com/bsth/controller/schedule/basicinfo/CarsController.java 0 → 100644
  1 +package com.bsth.controller.schedule.basicinfo;
  2 +
  3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.controller.schedule.BController;
  5 +import com.bsth.entity.Cars;
  6 +import com.bsth.service.schedule.CarsService;
  7 +import com.bsth.service.schedule.ScheduleException;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RequestMethod;
  11 +import org.springframework.web.bind.annotation.RequestParam;
  12 +import org.springframework.web.bind.annotation.RestController;
  13 +
  14 +import java.util.HashMap;
  15 +import java.util.Map;
  16 +
  17 +/**
  18 + * 车辆基础信息controller
  19 + */
  20 +@RestController(value = "carsController_sc")
  21 +@RequestMapping("cars_sc")
  22 +public class CarsController extends BController<Cars, Integer> {
  23 + @Autowired
  24 + private CarsService carsService;
  25 +
  26 + @RequestMapping(value = "/validate_zbh", method = RequestMethod.GET)
  27 + public Map<String, Object> validate_zbh(@RequestParam Map<String, Object> param) {
  28 + Map<String, Object> rtn = new HashMap<>();
  29 + try {
  30 + // 自编号验证
  31 + Cars cars = new Cars(
  32 + param.get("id_eq"),
  33 + param.get("insideCode_eq"),
  34 + null,
  35 + null,
  36 + null);
  37 + carsService.validate_nbbh(cars);
  38 + rtn.put("status", ResponseCode.SUCCESS);
  39 + } catch (ScheduleException exp) {
  40 + rtn.put("status", ResponseCode.ERROR);
  41 + rtn.put("msg", exp.getMessage());
  42 + }
  43 + return rtn;
  44 + }
  45 +
  46 + @RequestMapping(value = "/validate_clbh", method = RequestMethod.GET)
  47 + public Map<String, Object> validate_clbh(@RequestParam Map<String, Object> param) {
  48 + Map<String, Object> rtn = new HashMap<>();
  49 + try {
  50 + // 车辆编号验证
  51 + Cars cars = new Cars(
  52 + param.get("id_eq"),
  53 + null,
  54 + param.get("carCode_eq"),
  55 + null,
  56 + null);
  57 + carsService.validate_clbh(cars);
  58 + rtn.put("status", ResponseCode.SUCCESS);
  59 + } catch (ScheduleException exp) {
  60 + rtn.put("status", ResponseCode.ERROR);
  61 + rtn.put("msg", exp.getMessage());
  62 + }
  63 + return rtn;
  64 + }
  65 +
  66 + @RequestMapping(value = "/validate_cph", method = RequestMethod.GET)
  67 + public Map<String, Object> validate_cph(@RequestParam Map<String, Object> param) {
  68 + Map<String, Object> rtn = new HashMap<>();
  69 + try {
  70 + // 车牌号验证
  71 + Cars cars = new Cars(
  72 + param.get("id_eq"),
  73 + null,
  74 + null,
  75 + param.get("carPlate_eq"),
  76 + null);
  77 + carsService.validate_cph(cars);
  78 + rtn.put("status", ResponseCode.SUCCESS);
  79 + } catch (ScheduleException exp) {
  80 + rtn.put("status", ResponseCode.ERROR);
  81 + rtn.put("msg", exp.getMessage());
  82 + }
  83 + return rtn;
  84 + }
  85 +
  86 + @RequestMapping(value = "/validate_sbbh", method = RequestMethod.GET)
  87 + public Map<String, Object> validate_sbbh(@RequestParam Map<String, Object> param) {
  88 + Map<String, Object> rtn = new HashMap<>();
  89 + try {
  90 + // 设备编号验证
  91 + Cars cars = new Cars(
  92 + param.get("id_eq"),
  93 + null,
  94 + null,
  95 + null,
  96 + param.get("equipmentCode_eq")
  97 + );
  98 + carsService.validate_sbbh(cars);
  99 + rtn.put("status", ResponseCode.SUCCESS);
  100 + } catch (ScheduleException exp) {
  101 + rtn.put("status", ResponseCode.ERROR);
  102 + rtn.put("msg", exp.getMessage());
  103 + }
  104 + return rtn;
  105 + }
  106 +}
... ...
src/main/java/com/bsth/controller/schedule/core/GuideboardInfoController.java 0 → 100644
  1 +package com.bsth.controller.schedule.core;
  2 +
  3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.controller.schedule.BController;
  5 +import com.bsth.entity.schedule.GuideboardInfo;
  6 +import com.bsth.repository.schedule.GuideboardInfoRepository;
  7 +import com.bsth.service.schedule.GuideboardInfoService;
  8 +import com.bsth.service.schedule.ScheduleException;
  9 +import com.bsth.service.schedule.utils.DataToolsProperties;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.boot.context.properties.EnableConfigurationProperties;
  12 +import org.springframework.web.bind.annotation.RequestMapping;
  13 +import org.springframework.web.bind.annotation.RequestMethod;
  14 +import org.springframework.web.bind.annotation.RequestParam;
  15 +import org.springframework.web.bind.annotation.RestController;
  16 +
  17 +import java.util.HashMap;
  18 +import java.util.List;
  19 +import java.util.Map;
  20 +
  21 +/**
  22 + * 路牌管理控制器。
  23 + */
  24 +@RestController
  25 +@RequestMapping("gic")
  26 +@EnableConfigurationProperties(DataToolsProperties.class)
  27 +public class GuideboardInfoController extends BController<GuideboardInfo, Long> {
  28 + @Autowired
  29 + private GuideboardInfoService guideboardInfoService;
  30 +// @Autowired
  31 +// private DataToolsProperties dataToolsProperties;
  32 + @Autowired
  33 + private GuideboardInfoRepository guideboardInfoRepository;
  34 +//
  35 +// @Override
  36 +// protected String getDataImportKtrClasspath() {
  37 +// return dataToolsProperties.getGuideboardsDatainputktr();
  38 +// }
  39 +//
  40 +// @Override
  41 +// public GuideboardInfo findById(@PathVariable("id") Long aLong) {
  42 +// return guideboardInfoRepository.findOneExtend(aLong);
  43 +// }
  44 +//
  45 +//
  46 + @RequestMapping(value = "/ttlpnames", method = RequestMethod.GET)
  47 + public List<Map<String, Object>> findLpName(Long ttid) {
  48 + return guideboardInfoRepository.findLpName(ttid);
  49 + }
  50 +
  51 + @RequestMapping(value = "/validate1", method = RequestMethod.GET)
  52 + public Map<String, Object> validate1(@RequestParam Map<String, Object> param) {
  53 + Map<String, Object> rtn = new HashMap<>();
  54 + try {
  55 + // 路牌编号验证
  56 + GuideboardInfo guideboardInfo = new GuideboardInfo(
  57 + param.get("xl.id_eq"),
  58 + param.get("lpNo_eq"),
  59 + null
  60 + );
  61 + guideboardInfoService.validate(guideboardInfo);
  62 + rtn.put("status", ResponseCode.SUCCESS);
  63 + } catch (ScheduleException exp) {
  64 + rtn.put("status", ResponseCode.ERROR);
  65 + rtn.put("msg", exp.getMessage());
  66 + }
  67 + return rtn;
  68 + }
  69 +
  70 + @RequestMapping(value = "/validate2", method = RequestMethod.GET)
  71 + public Map<String, Object> validate2(@RequestParam Map<String, Object> param) {
  72 + Map<String, Object> rtn = new HashMap<>();
  73 + try {
  74 + // 路牌名称验证
  75 + GuideboardInfo guideboardInfo = new GuideboardInfo(
  76 + param.get("xl.id_eq"),
  77 + null,
  78 + param.get("lpName_eq")
  79 + );
  80 + guideboardInfoService.validate(guideboardInfo);
  81 + rtn.put("status", ResponseCode.SUCCESS);
  82 + } catch (ScheduleException exp) {
  83 + rtn.put("status", ResponseCode.ERROR);
  84 + rtn.put("msg", exp.getMessage());
  85 + }
  86 + return rtn;
  87 + }
  88 +}
... ...
src/main/java/com/bsth/entity/Cars.java
1 1 package com.bsth.entity;
2 2  
3 3 import com.bsth.entity.sys.SysUser;
  4 +import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4 5  
5 6 import javax.persistence.*;
6 7 import java.io.Serializable;
... ... @@ -22,6 +23,7 @@ import java.util.Date;
22 23  
23 24 @Entity
24 25 @Table(name = "bsth_c_cars")
  26 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
25 27 public class Cars implements Serializable {
26 28  
27 29 /** 主键Id */
... ... @@ -30,7 +32,7 @@ public class Cars implements Serializable {
30 32 private Integer id;
31 33  
32 34 /** 自编号/内部编号 */
33   - @Column(nullable = false, length = 8, unique = true)
  35 + @Column(nullable = false, length = 20, unique = true)
34 36 private String insideCode;
35 37  
36 38 // 公司、分公司暂时不用关联实体
... ... @@ -150,6 +152,26 @@ public class Cars implements Serializable {
150 152 /** 修改日期 */
151 153 @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
152 154 private Date updateDate;
  155 +
  156 + public Cars() {}
  157 +
  158 + public Cars(Object id, Object nbbh, Object clbh, Object cph, Object sbbh) {
  159 + if (id != null) {
  160 + this.id = Integer.valueOf(id.toString());
  161 + }
  162 + if (nbbh != null) {
  163 + this.insideCode = nbbh.toString();
  164 + }
  165 + if (clbh != null) {
  166 + this.carCode = clbh.toString();
  167 + }
  168 + if (cph != null) {
  169 + this.carPlate = cph.toString();
  170 + }
  171 + if (sbbh != null) {
  172 + this.equipmentCode = sbbh.toString();
  173 + }
  174 + }
153 175  
154 176 public String getServiceNo() {
155 177 return serviceNo;
... ...
src/main/java/com/bsth/entity/Line.java
1 1 package com.bsth.entity;
2 2  
  3 +import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
3 4 import org.springframework.format.annotation.DateTimeFormat;
4 5  
5 6 import javax.persistence.*;
... ... @@ -23,6 +24,7 @@ import java.util.Date;
23 24  
24 25 @Entity
25 26 @Table(name = "bsth_c_line")
  27 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
26 28 public class Line implements Serializable {
27 29  
28 30 @Id
... ...
src/main/java/com/bsth/entity/schedule/GuideboardInfo.java
... ... @@ -2,9 +2,9 @@ package com.bsth.entity.schedule;
2 2  
3 3 import com.bsth.entity.Line;
4 4 import com.bsth.entity.sys.SysUser;
  5 +import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
5 6  
6 7 import javax.persistence.*;
7   -import javax.persistence.Table;
8 8 import java.util.Date;
9 9  
10 10 /**
... ... @@ -17,6 +17,7 @@ import java.util.Date;
17 17 @NamedAttributeNode("xl")
18 18 })
19 19 })
  20 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
20 21 public class GuideboardInfo {
21 22  
22 23 /** 主键Id */
... ... @@ -38,6 +39,10 @@ public class GuideboardInfo {
38 39 @Column(nullable = false)
39 40 private String lpType;
40 41  
  42 + /** 是否删除(标记) */
  43 + @Column(nullable = false)
  44 + private Boolean isCancel = false;
  45 +
41 46 /** 创建人 */
42 47 @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST)
43 48 private SysUser createBy;
... ... @@ -53,6 +58,30 @@ public class GuideboardInfo {
53 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 85 public Long getId() {
57 86 return id;
58 87 }
... ... @@ -124,4 +153,12 @@ public class GuideboardInfo {
124 153 public void setUpdateDate(Date updateDate) {
125 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/CarsService.java 0 → 100644
  1 +package com.bsth.service.schedule;
  2 +
  3 +import com.bsth.entity.Cars;
  4 +
  5 +/**
  6 + * Created by xu on 16/12/8.
  7 + */
  8 +public interface CarsService extends BService<Cars, Integer> {
  9 + public void validate_nbbh(Cars cars) throws ScheduleException;
  10 + public void validate_clbh(Cars cars) throws ScheduleException;
  11 + public void validate_cph(Cars cars) throws ScheduleException;
  12 + public void validate_sbbh(Cars cars) throws ScheduleException;
  13 +}
... ...
src/main/java/com/bsth/service/schedule/GuideboardInfoService.java
1 1 package com.bsth.service.schedule;
2 2  
3 3 import com.bsth.entity.schedule.GuideboardInfo;
4   -import com.bsth.service.BaseService;
5 4  
6 5 /**
7 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/CarsServiceImpl.java 0 → 100644
  1 +package com.bsth.service.schedule.impl;
  2 +
  3 +import com.bsth.entity.Cars;
  4 +import com.bsth.service.schedule.CarsService;
  5 +import com.bsth.service.schedule.ScheduleException;
  6 +import org.springframework.stereotype.Service;
  7 +import org.springframework.transaction.annotation.Transactional;
  8 +import org.springframework.util.CollectionUtils;
  9 +
  10 +import java.util.HashMap;
  11 +import java.util.Map;
  12 +
  13 +/**
  14 + * Created by xu on 16/12/8.
  15 + */
  16 +@Service(value = "carsServiceImpl_sc")
  17 +public class CarsServiceImpl extends BServiceImpl<Cars, Integer> implements CarsService {
  18 +
  19 + @Override
  20 + @Transactional
  21 + public void validate_nbbh(Cars cars) throws ScheduleException {
  22 + // 查询条件
  23 + Map<String, Object> param = new HashMap<>();
  24 + if (cars.getId() != null) {
  25 + param.put("id_ne", cars.getId());
  26 + }
  27 + param.put("insideCode_eq", cars.getInsideCode());
  28 + if (!CollectionUtils.isEmpty(list(param))) {
  29 + throw new ScheduleException("车辆内部编号/自编号重复");
  30 + }
  31 + }
  32 +
  33 + @Override
  34 + @Transactional
  35 + public void validate_clbh(Cars cars) throws ScheduleException {
  36 + // 查询条件
  37 + Map<String, Object> param = new HashMap<>();
  38 + if (cars.getId() != null) {
  39 + param.put("id_ne", cars.getId());
  40 + }
  41 + param.put("carCode_eq", cars.getCarCode());
  42 + if (!CollectionUtils.isEmpty(list(param))) {
  43 + throw new ScheduleException("车辆编号重复");
  44 + }
  45 + }
  46 +
  47 + @Override
  48 + @Transactional
  49 + public void validate_cph(Cars cars) throws ScheduleException {
  50 + // 查询条件
  51 + Map<String, Object> param = new HashMap<>();
  52 + if (cars.getId() != null) {
  53 + param.put("id_ne", cars.getId());
  54 + }
  55 + param.put("carPlate_eq", cars.getCarPlate());
  56 + if (!CollectionUtils.isEmpty(list(param))) {
  57 + throw new ScheduleException("车牌号重复");
  58 + }
  59 + }
  60 +
  61 + @Override
  62 + @Transactional
  63 + public void validate_sbbh(Cars cars) throws ScheduleException {
  64 + // 查询条件
  65 + Map<String, Object> param = new HashMap<>();
  66 + if (cars.getId() != null) {
  67 + param.put("id_ne", cars.getId());
  68 + }
  69 + param.put("equipmentCode_eq", cars.getEquipmentCode());
  70 + if (!CollectionUtils.isEmpty(list(param))) {
  71 + throw new ScheduleException("设备编号重复");
  72 + }
  73 + }
  74 +}
... ...
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 14 },
15 15 concat_route: { // 所有模块的route配置合并的js文件
16 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 72 'module/common/dts1/load/loadingWidget.js', // loading界面指令
70 73 'module/common/dts1/validation/remoteValidation.js',// 服务端验证指令
71 74 'module/common/dts1/validation/remoteValidationt2.js',// 服务端验证指令(时刻表专用)
  75 + 'module/common/dts1/validation/remoteValidation3.js',// 服务端验证指令
72 76 'module/common/dts1/select/saSelect.js', // select整合指令1
73 77 'module/common/dts1/select/saSelect2.js', // select整合指令2
74 78 'module/common/dts1/select/saSelect3.js', // select整合指令3
75 79 'module/common/dts1/select/saSelect4.js', // select整合指令4
76 80 'module/common/dts1/select/saSelect5.js', // select整合指令5
  81 + 'module/common/dts2/ttinfotable/mySelect.js', // select整合指令
77 82 'module/common/dts1/radioButton/saRadiogroup.js', // 单选框组整合指令
78 83 'module/common/dts1/checkbox/saCheckboxgroup.js', // 多选框组整合指令
79 84 'module/common/dts2/dateGroup/saDategroup.js', // 特殊日期选择指令
... ... @@ -104,6 +109,26 @@ module.exports = function (grunt) {
104 109 'module/core/ttInfoManage/detailedit/route.js' // 时刻表明细管理模块
105 110 ],
106 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 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 479 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/edit.html
... ... @@ -33,8 +33,8 @@
33 33 <div class="portlet-body form">
34 34 <form ng-submit="ctrl.submit()" class="form-horizontal" novalidate name="myForm">
35 35 <!--<div class="alert alert-danger display-hide">-->
36   - <!--<button class="close" data-close="alert"></button>-->
37   - <!--您的输入有误,请检查下面的输入项-->
  36 + <!--<button class="close" data-close="alert"></button>-->
  37 + <!--您的输入有误,请检查下面的输入项-->
38 38 <!--</div>-->
39 39  
40 40  
... ... @@ -45,9 +45,9 @@
45 45 <div class="col-md-3">
46 46 <input type="text" class="form-control"
47 47 name="insideCode" ng-model="ctrl.busInfoForSave.insideCode"
48   - required ng-maxlength="8"
  48 + required ng-maxlength="20"
49 49 remote-Validation
50   - remotevtype="cl1"
  50 + remotevtype="cars_zbh"
51 51 remotevparam="{{ {'insideCode_eq': ctrl.busInfoForSave.insideCode} | json}}"
52 52 placeholder="请输入车辆内部编码"/>
53 53 </div>
... ... @@ -56,10 +56,10 @@
56 56 内部编号必须填写
57 57 </div>
58 58 <div class="alert alert-danger well-sm" ng-show="myForm.insideCode.$error.maxlength">
59   - 内部编号长度不能超过8
  59 + 内部编号长度不能超过20
60 60 </div>
61 61 <div class="alert alert-danger well-sm" ng-show="myForm.insideCode.$error.remote">
62   - 内部编号不能重复
  62 + {{$remote_msg}}
63 63 </div>
64 64 </div>
65 65  
... ... @@ -78,6 +78,7 @@
78 78 datatype="gsType"
79 79 required >
80 80 </sa-Select3>
  81 +
81 82 </div>
82 83 <!-- 隐藏块,显示验证信息 -->
83 84 <div class="alert alert-danger well-sm" ng-show="myForm.gs.$error.required">
... ... @@ -103,26 +104,40 @@
103 104 <label class="col-md-2 control-label">车辆编码*:</label>
104 105 <div class="col-md-3">
105 106 <input type="text" class="form-control"
106   - name="carCode" ng-model="ctrl.busInfoForSave.carCode"
107   - required placeholder="请输入车辆编码"/>
  107 + name="carCode" ng-model="ctrl.busInfoForSave.carCode"
  108 + required placeholder="请输入车辆编码"
  109 + remote-Validation
  110 + remotevtype="cars_clbh"
  111 + remotevparam="{{ {'carCode_eq': ctrl.busInfoForSave.carCode} | json}}"
  112 + />
108 113 </div>
109 114 <!-- 隐藏块,显示验证信息 -->
110 115 <div class="alert alert-danger well-sm" ng-show="myForm.carCode.$error.required">
111 116 车辆编码必须填写
112 117 </div>
  118 + <div class="alert alert-danger well-sm" ng-show="myForm.carCode.$error.remote">
  119 + {{$remote_msg}}
  120 + </div>
113 121 </div>
114 122  
115 123 <div class="form-group has-success has-feedback">
116 124 <label class="col-md-2 control-label">车牌号*:</label>
117 125 <div class="col-md-3">
118 126 <input type="text" class="form-control"
119   - name="carPlate" ng-model="ctrl.busInfoForSave.carPlate"
120   - required placeholder="请输入车牌号"/>
  127 + name="carPlate" ng-model="ctrl.busInfoForSave.carPlate"
  128 + required placeholder="请输入车牌号"
  129 + remote-Validation
  130 + remotevtype="cars_cph"
  131 + remotevparam="{{ {'carPlate_eq': ctrl.busInfoForSave.carPlate} | json}}"
  132 + />
121 133 </div>
122 134 <!-- 隐藏快,显示验证信息 -->
123 135 <div class="alert alert-danger well-sm" ng-show="myForm.carPlate.$error.required">
124 136 车牌号必须填写
125 137 </div>
  138 + <div class="alert alert-danger well-sm" ng-show="myForm.carPlate.$error.remote">
  139 + {{$remote_msg}}
  140 + </div>
126 141 </div>
127 142  
128 143 <div class="form-group has-success has-feedback">
... ... @@ -149,62 +164,69 @@
149 164 <label class="col-md-2 control-label">终端号*:</label>
150 165 <div class="col-md-3">
151 166 <input type="text" class="form-control"
152   - name="equipmentCode" ng-model="ctrl.busInfoForSave.equipmentCode"
153   - required placeholder="请输入设备终端号"/>
  167 + name="equipmentCode" ng-model="ctrl.busInfoForSave.equipmentCode"
  168 + required placeholder="请输入设备终端号"
  169 + remote-Validation
  170 + remotevtype="cars_sbbh"
  171 + remotevparam="{{ {'equipmentCode_eq': ctrl.busInfoForSave.equipmentCode} | json}}"
  172 + />
154 173 </div>
155 174 <!-- 隐藏块,显示验证信息 -->
156 175 <div class="alert alert-danger well-sm" ng-show="myForm.equipmentCode.$error.required">
157 176 设备终端号必须填写
158 177 </div>
  178 + <div class="alert alert-danger well-sm" ng-show="myForm.equipmentCode.$error.remote">
  179 + {{$remote_msg}}
  180 + </div>
159 181 </div>
160 182  
161 183 <div class="form-group">
162 184 <label class="col-md-2 control-label">车型类别:</label>
163 185 <div class="col-md-4">
164 186 <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.carClass"
165   - placeholder="请输入车型类别"/>
  187 + placeholder="请输入车型类别"/>
166 188 </div>
167 189 </div>
168 190 <div class="form-group">
169 191 <label class="col-md-2 control-label">技术速度:</label>
170 192 <div class="col-md-4">
171 193 <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.speed"
172   - placeholder="请输入技术速度"/>
  194 + placeholder="请输入技术速度"/>
173 195 </div>
174 196 </div>
175 197 <div class="form-group">
176 198 <label class="col-md-2 control-label">座位数:</label>
177 199 <div class="col-md-4">
178 200 <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.carSeatnNumber"
179   - placeholder="请输入座位数"/>
  201 + placeholder="请输入座位数"/>
180 202 </div>
181 203 </div>
182 204 <div class="form-group">
183 205 <label class="col-md-2 control-label">载客标准:</label>
184 206 <div class="col-md-4">
185 207 <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.carStandard"
186   - placeholder="请输入载客标准"/>
  208 + placeholder="请输入载客标准"/>
187 209 </div>
188 210 </div>
189 211 <div class="form-group">
190 212 <label class="col-md-2 control-label">标准油耗/开空调:</label>
191 213 <div class="col-md-4">
192 214 <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.kburnStandard"
193   - placeholder="请输入标准油耗/开空调"/>
  215 + placeholder="请输入标准油耗/开空调"/>
194 216 </div>
195 217 </div>
196 218 <div class="form-group">
197 219 <label class="col-md-2 control-label">标准油耗/关空调:</label>
198 220 <div class="col-md-4">
199 221 <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.gburnStandard"
200   - placeholder="请输入标准油耗/关空调"/>
  222 + placeholder="请输入标准油耗/关空调"/>
201 223 </div>
202 224 </div>
203 225 <div class="form-group">
204 226 <label class="col-md-2 control-label">报废号:</label>
205 227 <div class="col-md-4">
206 228 <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.scrapCode"
207   - placeholder="请输入报废号"/>
  229 + placeholder="请输入报废号"/>
208 230 </div>
209 231 </div>
210 232  
... ... @@ -229,56 +251,56 @@
229 251 <label class="col-md-2 control-label">厂牌型号1:</label>
230 252 <div class="col-md-4">
231 253 <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.makeCodeOne"
232   - placeholder="请输入厂牌型号1"/>
  254 + placeholder="请输入厂牌型号1"/>
233 255 </div>
234 256 </div>
235 257 <div class="form-group">
236 258 <label class="col-md-2 control-label">厂牌型号2:</label>
237 259 <div class="col-md-4">
238 260 <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.makeCodeTwo"
239   - placeholder="请输入厂牌型号2"/>
  261 + placeholder="请输入厂牌型号2"/>
240 262 </div>
241 263 </div>
242 264 <div class="form-group">
243 265 <label class="col-md-2 control-label">车辆等级标准:</label>
244 266 <div class="col-md-4">
245 267 <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.carGride"
246   - placeholder="请输入车辆等级标准"/>
  268 + placeholder="请输入车辆等级标准"/>
247 269 </div>
248 270 </div>
249 271 <div class="form-group">
250 272 <label class="col-md-2 control-label">出厂排放标准:</label>
251 273 <div class="col-md-4">
252 274 <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.emissionsStandard"
253   - placeholder="请输入出场排放标准"/>
  275 + placeholder="请输入出场排放标准"/>
254 276 </div>
255 277 </div>
256 278 <div class="form-group">
257 279 <label class="col-md-2 control-label">发动机号码1:</label>
258 280 <div class="col-md-4">
259 281 <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.engineCodeOne"
260   - placeholder="请输入发动机号码1"/>
  282 + placeholder="请输入发动机号码1"/>
261 283 </div>
262 284 </div>
263 285 <div class="form-group">
264 286 <label class="col-md-2 control-label">发动机号码2:</label>
265 287 <div class="col-md-4">
266 288 <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.engineCodeTwo"
267   - placeholder="请输入发动机号码2"/>
  289 + placeholder="请输入发动机号码2"/>
268 290 </div>
269 291 </div>
270 292 <div class="form-group">
271 293 <label class="col-md-2 control-label">车架号码1:</label>
272 294 <div class="col-md-4">
273 295 <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.carNumberOne"
274   - placeholder="请输入车架号码1"/>
  296 + placeholder="请输入车架号码1"/>
275 297 </div>
276 298 </div>
277 299 <div class="form-group">
278 300 <label class="col-md-2 control-label">车架号码2:</label>
279 301 <div class="col-md-4">
280 302 <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.carNumberTwo"
281   - placeholder="请输入车架号码2"/>
  303 + placeholder="请输入车架号码2"/>
282 304 </div>
283 305 </div>
284 306 <div class="form-group">
... ... @@ -422,5 +444,4 @@
422 444  
423 445 </div>
424 446  
425   -
426 447 </div>
427 448 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/form.html
... ... @@ -45,9 +45,9 @@
45 45 <div class="col-md-3">
46 46 <input type="text" class="form-control"
47 47 name="insideCode" ng-model="ctrl.busInfoForSave.insideCode"
48   - required ng-maxlength="8"
  48 + required ng-maxlength="20"
49 49 remote-Validation
50   - remotevtype="cl1"
  50 + remotevtype="cars_zbh"
51 51 remotevparam="{{ {'insideCode_eq': ctrl.busInfoForSave.insideCode} | json}}"
52 52 placeholder="请输入车辆内部编码"/>
53 53 </div>
... ... @@ -56,10 +56,10 @@
56 56 内部编号必须填写
57 57 </div>
58 58 <div class="alert alert-danger well-sm" ng-show="myForm.insideCode.$error.maxlength">
59   - 内部编号长度不能超过8
  59 + 内部编号长度不能超过20
60 60 </div>
61 61 <div class="alert alert-danger well-sm" ng-show="myForm.insideCode.$error.remote">
62   - 内部编号不能重复
  62 + {{$remote_msg}}
63 63 </div>
64 64 </div>
65 65  
... ... @@ -105,12 +105,19 @@
105 105 <div class="col-md-3">
106 106 <input type="text" class="form-control"
107 107 name="carCode" ng-model="ctrl.busInfoForSave.carCode"
108   - required placeholder="请输入车辆编码"/>
  108 + required placeholder="请输入车辆编码"
  109 + remote-Validation
  110 + remotevtype="cars_clbh"
  111 + remotevparam="{{ {'carCode_eq': ctrl.busInfoForSave.carCode} | json}}"
  112 + />
109 113 </div>
110 114 <!-- 隐藏块,显示验证信息 -->
111 115 <div class="alert alert-danger well-sm" ng-show="myForm.carCode.$error.required">
112 116 车辆编码必须填写
113 117 </div>
  118 + <div class="alert alert-danger well-sm" ng-show="myForm.carCode.$error.remote">
  119 + {{$remote_msg}}
  120 + </div>
114 121 </div>
115 122  
116 123 <div class="form-group has-success has-feedback">
... ... @@ -118,12 +125,19 @@
118 125 <div class="col-md-3">
119 126 <input type="text" class="form-control"
120 127 name="carPlate" ng-model="ctrl.busInfoForSave.carPlate"
121   - required placeholder="请输入车牌号"/>
  128 + required placeholder="请输入车牌号"
  129 + remote-Validation
  130 + remotevtype="cars_cph"
  131 + remotevparam="{{ {'carPlate_eq': ctrl.busInfoForSave.carPlate} | json}}"
  132 + />
122 133 </div>
123 134 <!-- 隐藏快,显示验证信息 -->
124 135 <div class="alert alert-danger well-sm" ng-show="myForm.carPlate.$error.required">
125 136 车牌号必须填写
126 137 </div>
  138 + <div class="alert alert-danger well-sm" ng-show="myForm.carPlate.$error.remote">
  139 + {{$remote_msg}}
  140 + </div>
127 141 </div>
128 142  
129 143 <div class="form-group has-success has-feedback">
... ... @@ -151,12 +165,19 @@
151 165 <div class="col-md-3">
152 166 <input type="text" class="form-control"
153 167 name="equipmentCode" ng-model="ctrl.busInfoForSave.equipmentCode"
154   - required placeholder="请输入设备终端号"/>
  168 + required placeholder="请输入设备终端号"
  169 + remote-Validation
  170 + remotevtype="cars_sbbh"
  171 + remotevparam="{{ {'equipmentCode_eq': ctrl.busInfoForSave.equipmentCode} | json}}"
  172 + />
155 173 </div>
156 174 <!-- 隐藏块,显示验证信息 -->
157 175 <div class="alert alert-danger well-sm" ng-show="myForm.equipmentCode.$error.required">
158 176 设备终端号必须填写
159 177 </div>
  178 + <div class="alert alert-danger well-sm" ng-show="myForm.equipmentCode.$error.remote">
  179 + {{$remote_msg}}
  180 + </div>
160 181 </div>
161 182  
162 183 <div class="form-group">
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/list.html
... ... @@ -7,12 +7,12 @@
7 7 <th style="width: 50px;">序号</th>
8 8 <th style="width: 130px;">车辆编号</th>
9 9 <th style="width: 130px;">内部编号</th>
10   - <th >设备编号</th>
11   - <th >车牌号</th>
12   - <th style="width: 15%;">所在公司</th>
13   - <th >所在分公司</th>
14   - <th style="width: 10%">是否电车</th>
15   - <th style="width: 21%">操作</th>
  10 + <th style="width: 130px;">设备编号</th>
  11 + <th style="width: 130px;">车牌号</th>
  12 + <th style="width: 150px;">所在公司</th>
  13 + <th style="width: 100px;">所在分公司</th>
  14 + <th style="width: 80px">是否电车</th>
  15 + <th style="width: 100%">操作</th>
16 16 </tr>
17 17 <tr role="row" class="filter">
18 18 <td></td>
... ... @@ -23,8 +23,10 @@
23 23 <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition().insideCode_like" placeholder="输入内部编号..."/>
24 24 </td>
25 25 <td>
  26 + <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition().equipmentCode_like" placeholder="输入设备编号..."/>
26 27 </td>
27 28 <td>
  29 + <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition().carCode_like" placeholder="输入车牌号..."/>
28 30 </td>
29 31 <td>
30 32 <div>
... ... @@ -47,18 +49,18 @@
47 49 </td>
48 50 <td>
49 51 <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
50   - ng-click="ctrl.pageChanaged()">
  52 + ng-click="ctrl.doPage()">
51 53 <i class="fa fa-search"></i> 搜索</button>
52 54  
53 55 <button class="btn btn-sm red btn-outline filter-cancel"
54   - ng-click="ctrl.resetSearchCondition()">
  56 + ng-click="ctrl.reset()">
55 57 <i class="fa fa-times"></i> 重置</button>
56 58 </td>
57 59  
58 60 </tr>
59 61 </thead>
60 62 <tbody>
61   - <tr ng-repeat="info in ctrl.pageInfo.infos" class="odd gradeX">
  63 + <tr ng-repeat="info in ctrl.page()['content']" class="odd gradeX">
62 64 <td>
63 65 <span ng-bind="$index + 1"></span>
64 66 </td>
... ... @@ -96,9 +98,9 @@
96 98 </div>
97 99  
98 100 <div style="text-align: right;">
99   - <uib-pagination total-items="ctrl.pageInfo.totalItems"
100   - ng-model="ctrl.pageInfo.currentPage"
101   - ng-change="ctrl.pageChanaged()"
  101 + <uib-pagination total-items="ctrl.page()['totalElements']"
  102 + ng-model="ctrl.page()['uiNumber']"
  103 + ng-change="ctrl.doPage()"
102 104 rotate="false"
103 105 max-size="10"
104 106 boundary-links="true"
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/module.js
1 1 // 车辆基础信息维护 service controller等写在一起
2 2  
3   -angular.module('ScheduleApp').factory('BusInfoManageService', ['BusInfoManageService_g', function(service) {
  3 +angular.module('ScheduleApp').factory(
  4 + 'BusInfoManageService',
  5 + [
  6 + 'BusInfoManageService_g',
  7 + function(service) {
4 8  
5   - /** 当前的查询条件信息 */
6   - var currentSearchCondition = {
7   - "carCode_like" : "",
8   - "insideCode_like" : "",
9   - "equipmentCode_like" : "",
10   - "carPlate_like" : ""
11   - };
12   -
13   - /** 当前第几页 */
14   - var currentPageNo = 1;
15   - return {
16   - /**
17   - * 获取查询条件信息,
18   - * 用于给controller用来和页面数据绑定。
19   - */
20   - getSearchCondition: function() {
21   - return currentSearchCondition;
22   - },
23   - /**
24   - * 重置查询条件信息。
25   - */
26   - resetSearchCondition: function() {
27   - var key;
28   - for (key in currentSearchCondition) {
29   - currentSearchCondition[key] = undefined;
30   - }
31   - currentPageNo = 1;
32   - },
33   - /**
34   - * 设置当前页码。
35   - * @param cpn 从1开始,后台是从0开始的
36   - */
37   - setCurrentPageNo: function(cpn) {
38   - currentPageNo = cpn;
39   - },
40   - /**
41   - * 组装查询参数,返回一个promise查询结果。
42   - * @param params 查询参数
43   - * @return 返回一个 promise
44   - */
45   - getPage: function() {
46   - var params = currentSearchCondition; // 查询条件
47   - params.page = currentPageNo - 1; // 服务端页码从0开始
48   - return service.rest.list(params).$promise;
49   - },
50   - /**
51   - * 获取明细信息。
52   - * @param id 车辆id
53   - * @return 返回一个 promise
54   - */
55   - getDetail: function(id) {
56   - var params = {id: id};
57   - return service.rest.get(params).$promise;
58   - },
59   - /**
60   - * 保存信息。
61   - * @param obj 车辆详细信息
62   - * @return 返回一个 promise
63   - */
64   - saveDetail: function(obj) {
65   - return service.rest.save(obj).$promise;
66   - },
67   - /**
68   - * 数据导出。
69   - * @returns {*|Function|promise|n}
70   - */
71   - dataExport: function() {
72   - return service.dataTools.dataExport().$promise;
73   - }
74   - };
75   -}]);
  9 + /** 当前的查询条件信息 */
  10 + var currentSearchCondition = {
  11 + page: 0,
  12 + "carCode_like" : "",
  13 + "insideCode_like" : "",
  14 + "equipmentCode_like" : "",
  15 + "carPlate_like" : ""
  16 + };
  17 + // 当前查询返回的信息
  18 + var currentPage = { // 后台spring data返回的格式
  19 + totalElements: 0,
  20 + number: 0, // 后台返回的页码,spring返回从0开始
  21 + content: [],
76 22  
77   -angular.module('ScheduleApp').controller('BusInfoManageCtrl', [
78   - 'BusInfoManageService','$state', '$uibModal', 'FileDownload_g',
79   - function(busInfoManageService, $state, $uibModal, fileDownload) {
80   - var self = this;
  23 + uiNumber: 1 // 页面绑定的页码
  24 + };
81 25  
82   - // 切换到form状态
83   - self.goForm = function() {
84   - //alert("切换");
85   - $state.go("busInfoManage_form");
86   - };
  26 + // 查询对象
  27 + var queryClass = service.rest;
87 28  
88   - // 导入excel
89   - self.importData = function() {
90   - // large方式弹出模态对话框
91   - var modalInstance = $uibModal.open({
92   - templateUrl: '/pages/scheduleApp/module/basicInfo/busInfoManage/dataImport.html',
93   - size: "lg",
94   - animation: true,
95   - backdrop: 'static',
96   - resolve: {
97   - // 可以传值给controller
  29 + return {
  30 + getQueryClass: function() {
  31 + return queryClass;
98 32 },
99   - windowClass: 'center-modal',
100   - controller: "BusInfoManageToolsCtrl",
101   - controllerAs: "ctrl",
102   - bindToController: true
103   - });
104   - modalInstance.result.then(
105   - function() {
106   - console.log("dataImport.html打开");
  33 + /**
  34 + * 获取查询条件信息,
  35 + * 用于给controller用来和页面数据绑定。
  36 + */
  37 + getSearchCondition: function() {
  38 + currentSearchCondition.page = currentPage.uiNumber - 1;
  39 + return currentSearchCondition;
107 40 },
108   - function() {
109   - console.log("dataImport.html消失");
110   - }
111   - );
112   - };
113   -
114   - // 导出excel
115   - self.exportData = function() {
116   - busInfoManageService.dataExport().then(
117   - function(result) {
118   - fileDownload.downloadFile(result.data, "application/octet-stream", "车辆基础信息.xls");
  41 + /**
  42 + * 组装查询参数,返回一个promise查询结果。
  43 + * @param params 查询参数
  44 + * @return 返回一个 promise
  45 + */
  46 + getPage: function(page) {
  47 + if (page) {
  48 + currentPage.totalElements = page.totalElements;
  49 + currentPage.number = page.number;
  50 + currentPage.content = page.content;
  51 + }
  52 + return currentPage;
119 53 },
120   - function(result) {
121   - console.log("exportData failed:" + result);
  54 + resetStatus: function() {
  55 + currentSearchCondition = {page: 0};
  56 + currentPage = {
  57 + totalElements: 0,
  58 + number: 0,
  59 + content: [],
  60 + uiNumber: 1
  61 + };
  62 + },
  63 +
  64 + /**
  65 + * 数据导出。
  66 + * @returns {*|Function|promise|n}
  67 + */
  68 + dataExport: function() {
  69 + return service.dataTools.dataExport().$promise;
122 70 }
123   - );
124   - };
125   - }]);
  71 + };
  72 +
  73 + }
  74 + ]
  75 +);
  76 +
  77 +// index.html控制器
  78 +angular.module('ScheduleApp').controller(
  79 + 'BusInfoManageCtrl',
  80 + [
  81 + 'BusInfoManageService',
  82 + '$state',
  83 + '$uibModal',
  84 + 'FileDownload_g',
  85 + function(busInfoManageService, $state, $uibModal, fileDownload) {
  86 + var self = this;
  87 +
  88 + // 切换到form状态
  89 + self.goForm = function() {
  90 + //alert("切换");
  91 + $state.go("busInfoManage_form");
  92 + };
  93 +
  94 + // 导入excel
  95 + self.importData = function() {
  96 + // large方式弹出模态对话框
  97 + var modalInstance = $uibModal.open({
  98 + templateUrl: '/pages/scheduleApp/module/basicInfo/busInfoManage/dataImport.html',
  99 + size: "lg",
  100 + animation: true,
  101 + backdrop: 'static',
  102 + resolve: {
  103 + // 可以传值给controller
  104 + },
  105 + windowClass: 'center-modal',
  106 + controller: "BusInfoManageToolsCtrl",
  107 + controllerAs: "ctrl",
  108 + bindToController: true
  109 + });
  110 + modalInstance.result.then(
  111 + function() {
  112 + console.log("dataImport.html打开");
  113 + },
  114 + function() {
  115 + console.log("dataImport.html消失");
  116 + }
  117 + );
  118 + };
  119 +
  120 + // 导出excel
  121 + self.exportData = function() {
  122 + busInfoManageService.dataExport().then(
  123 + function(result) {
  124 + fileDownload.downloadFile(result.data, "application/octet-stream", "车辆基础信息.xls");
  125 + },
  126 + function(result) {
  127 + console.log("exportData failed:" + result);
  128 + }
  129 + );
  130 + };
  131 + }
  132 + ]
  133 +);
126 134  
127 135 angular.module('ScheduleApp').controller('BusInfoManageToolsCtrl', ['$modalInstance', 'FileUploader', function($modalInstance, FileUploader) {
128 136 var self = this;
... ... @@ -160,143 +168,114 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;BusInfoManageToolsCtrl&#39;, [&#39;$modalInsta
160 168  
161 169 }]);
162 170  
  171 +// list.html控制器
  172 +angular.module('ScheduleApp').controller(
  173 + 'BusInfoManageListCtrl',
  174 + [
  175 + 'BusInfoManageService',
  176 + '$scope',
  177 + function(service, $scope) {
  178 + var self = this;
  179 + var Cars = service.getQueryClass();
163 180  
164   -angular.module('ScheduleApp').controller('BusInfoManageListCtrl', ['BusInfoManageService','$scope', function(busInfoManageService, $scope) {
165   - var self = this;
166   - self.pageInfo = {
167   - totalItems : 0,
168   - currentPage : 1,
169   - infos: []
170   - };
  181 + self.page = function() {
  182 + return service.getPage();
  183 + };
171 184  
172   - // 初始创建的时候,获取一次列表数据
173   - busInfoManageService.getPage().then(
174   - function(result) {
175   - self.pageInfo.totalItems = result.totalElements;
176   - self.pageInfo.currentPage = result.number + 1;
177   - self.pageInfo.infos = result.content;
178   - busInfoManageService.setCurrentPageNo(result.number + 1);
179   - },
180   - function(result) {
181   - alert("出错啦!");
182   - }
183   - );
  185 + self.searchCondition = function() {
  186 + return service.getSearchCondition();
  187 + };
184 188  
185   - //$scope.$watch("ctrl.pageInfo.currentPage", function() {
186   - // alert("dfdfdf");
187   - //});
  189 + self.doPage = function() {
  190 + var result = Cars.list(self.searchCondition(), function() {
  191 + if (!result.status) {
  192 + service.getPage(result);
  193 + }
  194 + });
  195 + };
  196 + self.reset = function() {
  197 + service.resetStatus();
  198 + var result = Cars.list(self.searchCondition(), function() {
  199 + if (!result.status) {
  200 + service.getPage(result);
  201 + }
  202 + });
  203 + };
188 204  
189   - // 翻页的时候调用
190   - self.pageChanaged = function() {
191   - busInfoManageService.setCurrentPageNo(self.pageInfo.currentPage);
192   - busInfoManageService.getPage().then(
193   - function(result) {
194   - self.pageInfo.totalItems = result.totalElements;
195   - self.pageInfo.currentPage = result.number + 1;
196   - self.pageInfo.infos = result.content;
197   - busInfoManageService.setCurrentPageNo(result.number + 1);
198   - },
199   - function(result) {
200   - alert("出错啦!");
201   - }
202   - );
203   - };
204   - // 获取查询条件数据
205   - self.searchCondition = function() {
206   - return busInfoManageService.getSearchCondition();
207   - };
208   - // 重置查询条件
209   - self.resetSearchCondition = function() {
210   - busInfoManageService.resetSearchCondition();
211   - self.pageInfo.currentPage = 1;
212   - self.pageChanaged();
213   - };
214   -}]);
  205 + self.doPage();
  206 + }
  207 + ]
  208 +);
215 209  
216   -angular.module('ScheduleApp').controller('BusInfoManageFormCtrl', ['BusInfoManageService', '$stateParams', '$state', function(busInfoManageService, $stateParams, $state) {
217   - var self = this;
  210 +// form.html控制器
  211 +angular.module('ScheduleApp').controller(
  212 + 'BusInfoManageFormCtrl',
  213 + [
  214 + 'BusInfoManageService',
  215 + '$stateParams',
  216 + '$state',
  217 + function(service, $stateParams, $state) {
  218 + var self = this;
  219 + var Cars = service.getQueryClass();
218 220  
219   - // 报废日期 日期控件开关
220   - self.scrapDateOpen = false;
221   - self.scrapDate_open = function() {
222   - self.scrapDateOpen = true;
223   - };
  221 + // 报废日期 日期控件开关
  222 + self.scrapDateOpen = false;
  223 + self.scrapDate_open = function() {
  224 + self.scrapDateOpen = true;
  225 + };
224 226  
225   - // 启用日期 日期控件开关
226   - self.openDateOpen = false;
227   - self.openDate_open = function() {
228   - self.openDateOpen = true;
229   - };
230   - // 取消日期 日期控件开关
231   - self.closeDateOpen = false;
232   - self.closeDate_open = function() {
233   - self.closeDateOpen = true;
234   - };
  227 + // 启用日期 日期控件开关
  228 + self.openDateOpen = false;
  229 + self.openDate_open = function() {
  230 + self.openDateOpen = true;
  231 + };
  232 + // 取消日期 日期控件开关
  233 + self.closeDateOpen = false;
  234 + self.closeDate_open = function() {
  235 + self.closeDateOpen = true;
  236 + };
235 237  
236   - // 欲保存的busInfo信息,绑定
237   - self.busInfoForSave = {};
  238 + // 欲保存的busInfo信息,绑定
  239 + self.busInfoForSave = new Cars;
238 240  
239   - // 获取传过来的id,有的话就是修改,获取一遍数据
240   - var id = $stateParams.id;
241   - if (id) {
242   - self.busInfoForSave.id = id;
243   - busInfoManageService.getDetail(id).then(
244   - function(result) {
245   - var key;
246   - for (key in result) {
247   - self.busInfoForSave[key] = result[key];
248   - }
249   - },
250   - function(result) {
251   - alert("出错啦!");
  241 + // 获取传过来的id,有的话就是修改,获取一遍数据
  242 + var id = $stateParams.id;
  243 + if (id) {
  244 + self.busInfoForSave = Cars.get({id: id}, function() {});
252 245 }
253   - );
254   - }
255 246  
256   - // 提交方法
257   - self.submit = function() {
258   - console.log(self.busInfoForSave);
259   - //if (self.busInfoForSave) {
260   - // delete $stateParams.id;
261   - //}
262   - busInfoManageService.saveDetail(self.busInfoForSave).then(
263   - function(result) {
264   - // TODO:弹出框方式以后改
265   - if (result.status == 'SUCCESS') {
266   - alert("保存成功!");
  247 + // 提交方法
  248 + self.submit = function() {
  249 + console.log(self.busInfoForSave);
  250 + //if (self.busInfoForSave) {
  251 + // delete $stateParams.id;
  252 + //}
  253 + self.busInfoForSave.$save(function() {
267 254 $state.go("busInfoManage");
268   - } else {
269   - alert("保存异常!");
270   - }
271   - },
272   - function(result) {
273   - // TODO:弹出框方式以后改
274   - alert("出错啦!");
275   - }
276   - );
277   - };
278   -
279   -}]);
  255 + });
  256 + };
  257 + }
  258 + ]
  259 +);
280 260  
281   -angular.module('ScheduleApp').controller('BusInfoManageDetailCtrl', ['BusInfoManageService', '$stateParams', function(busInfoManageService, $stateParams) {
282   - var self = this;
283   - self.title = "";
284   - self.busInfoForDetail = {};
285   - self.busInfoForDetail.id = $stateParams.id;
  261 +// detail.html控制器
  262 +angular.module('ScheduleApp').controller(
  263 + 'BusInfoManageDetailCtrl',
  264 + [
  265 + 'BusInfoManageService',
  266 + '$stateParams',
  267 + function(service, $stateParams) {
  268 + var self = this;
  269 + var Cars = service.getQueryClass();
  270 + var id = $stateParams.id;
286 271  
287   - // 当转向到此页面时,就获取明细信息并绑定
288   - busInfoManageService.getDetail($stateParams.id).then(
289   - function(result) {
290   - var key;
291   - for (key in result) {
292   - self.busInfoForDetail[key] = result[key];
293   - }
  272 + self.title = "";
  273 + self.busInfoForDetail = {};
294 274  
295   - self.title = "车辆 " + self.busInfoForDetail.insideCode + " 详细信息";
296   - },
297   - function(result) {
298   - // TODO:弹出框方式以后改
299   - alert("出错啦!");
  275 + // 当转向到此页面时,就获取明细信息并绑定
  276 + self.busInfoForDetail = Cars.get({id: id}, function() {
  277 + self.title = "车辆 " + self.busInfoForDetail.insideCode + " 详细信息";
  278 + });
300 279 }
301   - );
302   -}]);
303 280 \ No newline at end of file
  281 + ]
  282 +);
304 283 \ 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_sc/:id',
  6 + {order: 'carCode', direction: 'ASC', id: '@id_route'},
  7 + {
  8 + list: {
  9 + method: 'GET',
  10 + params: {
  11 + page: 0
  12 + },
  13 + transformResponse: function(rs) {
  14 + var dst = angular.fromJson(rs);
  15 + if (dst.status == 'SUCCESS') {
  16 + return dst.data;
  17 + } else {
  18 + return dst; // 业务错误留给控制器处理
  19 + }
  20 + }
  21 + },
  22 + get: {
  23 + method: 'GET',
  24 + transformResponse: function(rs) {
  25 + var dst = angular.fromJson(rs);
  26 + if (dst.status == 'SUCCESS') {
  27 + return dst.data;
  28 + } else {
  29 + return dst;
  30 + }
  31 + }
  32 + },
  33 + save: {
  34 + method: 'POST'
  35 + }
  36 + }
  37 + ),
  38 + import: $resource(
  39 + '/cars/importfile',
  40 + {},
  41 + {
  42 + do: {
  43 + method: 'POST',
  44 + headers: {
  45 + 'Content-Type': 'application/x-www-form-urlencoded'
  46 + },
  47 + transformRequest: function(obj) {
  48 + var str = [];
  49 + for (var p in obj) {
  50 + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  51 + }
  52 + return str.join("&");
  53 + }
  54 + }
  55 + }
  56 + ),
  57 + validate: $resource(
  58 + '/cars/validate/:type',
  59 + {},
  60 + {
  61 + insideCode: {
  62 + method: 'GET'
  63 + }
  64 + }
  65 + ),
  66 + dataTools: $resource(
  67 + '/cars/:type',
  68 + {},
  69 + {
  70 + dataExport: {
  71 + method: 'GET',
  72 + responseType: "arraybuffer",
  73 + params: {
  74 + type: "dataExport"
  75 + },
  76 + transformResponse: function(data, headers){
  77 + return {data : data};
  78 + }
  79 + }
  80 + }
  81 + )
  82 + };
  83 +}]);
0 84 \ 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 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 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 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 124  
125 125 // 添加选中事件处理函数
126 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 134 eval("var obj=" + $cmaps_attr);
130 135 for (var mc in obj) { // model的字段名:内部数据源对应字段名
131 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 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 153 eval("var obj=" + $cmaps_attr);
141 154 var mc; // model的字段名
142 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 398 */
382 399 scope.$watch(
383 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 407 function(newValue, oldValue) {
387 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 27 var $watch_rvparam_obj = undefined;
28 28  
29 29 // 验证数据
30   - var $$internal_validate = function(ngModelCtrl) {
  30 + var $$internal_validate = function(ngModelCtrl, scope) {
31 31 if ($watch_rvtype && $watch_rvparam_obj) {
32 32 // 获取查询参数模版
33 33 var paramTemplate = $$SearchInfoService_g.validate[$watch_rvtype].template;
... ... @@ -52,6 +52,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidation&#39;, [
52 52 ngModelCtrl.$setValidity('remote', true);
53 53 } else {
54 54 ngModelCtrl.$setValidity('remote', false);
  55 + scope.$remote_msg = result.msg;
55 56 }
56 57 },
57 58 function(result) {
... ... @@ -74,7 +75,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidation&#39;, [
74 75 attr.$observe("remotevtype", function(value) {
75 76 if (value && value != "") {
76 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 87 return;
87 88 }
88 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 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 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 20 \ No newline at end of file
... ...
src/main/resources/static/pages/scheduleApp/module/common/main.js
... ... @@ -76,13 +76,26 @@ ScheduleApp.factory(
76 76 },
77 77 requestError: function(rejection) {
78 78 requestNotificationChannel.requestEnded();
79   - alert("服务端无响应");
80 79 return rejection;
81 80 },
82 81 response: function(response) {
83 82 requestNotificationChannel.requestEnded();
84 83  
85   - return response;
  84 + var data = response.data;
  85 + var output = [];
  86 + if (data.status == '407') {
  87 + alert("请重新登录!");
  88 + return $q.reject(response);
  89 + } else if (data.status == '500') {
  90 + output.push("状态编码:" + data.status);
  91 + output.push("访问路径:" + data.path);
  92 + output.push("错误消息:" + data.message);
  93 + alert("服务端错误:" + "\n" + output.join("\n"));
  94 + return $q.reject(response);
  95 + } else {
  96 + return response;
  97 + }
  98 +
86 99 },
87 100 responseError: function(rejection) {
88 101 requestNotificationChannel.requestEnded();
... ... @@ -90,25 +103,23 @@ ScheduleApp.factory(
90 103 // 处理错误,springboot会包装返回的错误数据
91 104 // 如:{"timestamp":1478674739246,"status":500,"error":"Internal Server Error","exception":"java.lang.ClassCastException","message":"java.lang.String cannot be cast to java.lang.Long","path":"/tidc/importfile"}
92 105  
93   - var status = rejection.status;
94   - var path = rejection.data.path;
95   - var message = rejection.data.message;
96 106 var output = [];
97   - output.push("状态编码:" + status);
98   - output.push("访问路径:" + path);
99   - output.push("错误消息:" + message);
100   - if (status) {
  107 + if (!status) {
  108 + alert("我擦,后台返回连个状态码都没返回,见鬼了,服务器可能重启了");
  109 + } else if (status == -1) {
  110 + // 服务器断开了
  111 + alert("貌似服务端连接不上");
  112 + } else {
  113 + output.push("状态编码:" + status);
  114 + output.push("访问路径:" + rejection.path);
  115 + output.push("错误消息:" + rejection.message);
101 116 if (status == 500) {
102 117 alert("服务端错误:" + "\n" + output.join("\n"));
103 118 } else if (status == 407) {
104 119 alert("请重新登录:" + "\n" + output.join("\n"));
105   - } else if (status == -1) {
106   - alert("貌似服务端连接不上");
107 120 } else {
108 121 alert("其他错误:" + "\n" + output.join("\n"));
109 122 }
110   - } else {
111   - alert("我擦,后台返回连个状态码都没返回,见鬼了!");
112 123 }
113 124  
114 125 return $q.reject(rejection);
... ...
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 49 var $watch_rvparam_obj = undefined;
50 50  
51 51 // 验证数据
52   - var $$internal_validate = function(ngModelCtrl) {
  52 + var $$internal_validate = function(ngModelCtrl, scope) {
53 53 if ($watch_rvtype && $watch_rvparam_obj) {
54 54 // 获取查询参数模版
55 55 var paramTemplate = $$SearchInfoService_g.validate[$watch_rvtype].template;
... ... @@ -74,6 +74,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidation&#39;, [
74 74 ngModelCtrl.$setValidity('remote', true);
75 75 } else {
76 76 ngModelCtrl.$setValidity('remote', false);
  77 + scope.$remote_msg = result.msg;
77 78 }
78 79 },
79 80 function(result) {
... ... @@ -96,7 +97,7 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidation&#39;, [
96 97 attr.$observe("remotevtype", function(value) {
97 98 if (value && value != "") {
98 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 109 return;
109 110 }
110 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 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 291 angular.module('ScheduleApp').directive("saSelect", ['$timeout', function($timeout) {
223 292 return {
... ... @@ -1331,23 +1400,40 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;saSelect5&#39;, [
1331 1400  
1332 1401 // 添加选中事件处理函数
1333 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 1410 eval("var obj=" + $cmaps_attr);
1337 1411 for (var mc in obj) { // model的字段名:内部数据源对应字段名
1338 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 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 1429 eval("var obj=" + $cmaps_attr);
1348 1430 var mc; // model的字段名
1349 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 1674 */
1589 1675 scope.$watch(
1590 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 1683 function(newValue, oldValue) {
1594 1684 if (newValue === undefined && oldValue === undefined) {
... ... @@ -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 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 + cars_zbh: { // 自编号验证
  281 + template: {'insideCode_eq': '-1'}, // 查询参数模版
  282 + remote: $resource( // $resource封装对象
  283 + '/cars_sc/validate_zbh',
  284 + {},
  285 + {
  286 + do: {
  287 + method: 'GET'
  288 + }
  289 + }
  290 + )
  291 + },
  292 +
  293 + cars_sbbh: { // 验证设备编号
  294 + template: {'equipmentCode_eq': '-1'}, // 查询参数模版
  295 + remote: $resource( // $resource封装对象
  296 + '/cars_sc/validate_sbbh',
  297 + {},
  298 + {
  299 + do: {
  300 + method: 'GET'
  301 + }
  302 + }
  303 + )
  304 + },
  305 +
  306 + cars_clbh: { // 车辆编号验证
  307 + template: {'carCode_eq': '-1'}, // 查询参数模版
  308 + remote: $resource( // $resource封装对象
  309 + '/cars_sc/validate_clbh',
  310 + {},
  311 + {
  312 + do: {
  313 + method: 'GET'
  314 + }
  315 + }
  316 + )
  317 + },
  318 +
  319 + cars_cph: { // 车牌号验证
  320 + template: {'carPlate_eq': '-1'}, // 查询参数模版
  321 + remote: $resource( // $resource封装对象
  322 + '/cars_sc/validate_cph',
  323 + {},
  324 + {
  325 + do: {
  326 + method: 'GET'
  327 + }
  328 + }
  329 + )
  330 + },
  331 +
  332 +
  333 + cde1: { // 车辆设备启用日期验证
  334 + template: {'qyrq': 0, 'xl': 1, 'cl': 1}, // 日期毫秒
  335 + remote: $resource( // $resource封装对象
  336 + '/cde//validate/qyrq',
  337 + {},
  338 + {
  339 + do: {
  340 + method: 'GET'
  341 + }
  342 + }
  343 + )
  344 + },
  345 + ttc1: { // 时刻表名字验证
  346 + template: {'xl.id_eq': -1, 'name_eq': 'ddd'},
  347 + remote: $resource( // $resource封装对象
  348 + '/tic/validate/equale',
  349 + {},
  350 + {
  351 + do: {
  352 + method: 'GET'
  353 + }
  354 + }
  355 + )
  356 + },
  357 + sheet: { // 时刻表sheet工作区验证
  358 + template: {'filename': '', 'sheetname': '', 'lineid': -1, 'linename': ''},
  359 + remote: $resource( // $resource封装对象
  360 + '/tidc/validate/sheet',
  361 + {},
  362 + {
  363 + do: {
  364 + method: 'POST',
  365 + headers: {
  366 + 'Content-Type': 'application/x-www-form-urlencoded'
  367 + },
  368 + transformRequest: function(obj) {
  369 + var str = [];
  370 + for (var p in obj) {
  371 + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  372 + }
  373 + return str.join("&");
  374 + }
  375 + }
  376 + }
  377 + )
  378 + },
  379 + sheetli: { // 时刻表线路标准验证
  380 + template: {'lineinfoid': -1},
  381 + remote: $resource( // $resource封装对象
  382 + '/tidc/validate/lineinfo',
  383 + {},
  384 + {
  385 + do: {
  386 + method: 'GET'
  387 + }
  388 + }
  389 + )
  390 + }
  391 + }
  392 +
  393 + //validate: $resource(
  394 + // '/cars/validate/:type',
  395 + // {},
  396 + // {
  397 + // insideCode: {
  398 + // method: 'GET'
  399 + // }
  400 + // }
  401 + //)
  402 +
  403 +
  404 +
  405 + }
  406 +}]);
  407 +
  408 +
  409 +
... ...
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_sc/:id',
  7 + {order: 'carCode', direction: 'ASC', id: '@id_route'},
  8 + {
  9 + list: {
  10 + method: 'GET',
  11 + params: {
  12 + page: 0
  13 + },
  14 + transformResponse: function(rs) {
  15 + var dst = angular.fromJson(rs);
  16 + if (dst.status == 'SUCCESS') {
  17 + return dst.data;
  18 + } else {
  19 + return dst; // 业务错误留给控制器处理
  20 + }
  21 + }
  22 + },
  23 + get: {
  24 + method: 'GET',
  25 + transformResponse: function(rs) {
  26 + var dst = angular.fromJson(rs);
  27 + if (dst.status == 'SUCCESS') {
  28 + return dst.data;
  29 + } else {
  30 + return dst;
  31 + }
  32 + }
  33 + },
  34 + save: {
  35 + method: 'POST'
  36 + }
  37 + }
  38 + ),
  39 + import: $resource(
  40 + '/cars/importfile',
  41 + {},
  42 + {
  43 + do: {
  44 + method: 'POST',
  45 + headers: {
  46 + 'Content-Type': 'application/x-www-form-urlencoded'
  47 + },
  48 + transformRequest: function(obj) {
  49 + var str = [];
  50 + for (var p in obj) {
  51 + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  52 + }
  53 + return str.join("&");
  54 + }
  55 + }
  56 + }
  57 + ),
  58 + validate: $resource(
  59 + '/cars/validate/:type',
  60 + {},
  61 + {
  62 + insideCode: {
  63 + method: 'GET'
  64 + }
  65 + }
  66 + ),
  67 + dataTools: $resource(
  68 + '/cars/:type',
  69 + {},
  70 + {
  71 + dataExport: {
  72 + method: 'GET',
  73 + responseType: "arraybuffer",
  74 + params: {
  75 + type: "dataExport"
  76 + },
  77 + transformResponse: function(data, headers){
  78 + return {data : data};
  79 + }
  80 + }
  81 + }
  82 + )
  83 + };
  84 +}]);
  85 +// 车辆设备信息service
  86 +angular.module('ScheduleApp').factory('DeviceInfoManageService_g', ['$resource', function($resource) {
  87 + return $resource(
  88 + '/cde/:id',
  89 + {order: 'xl,isCancel,cl,qyrq', direction: 'ASC,ASC,ASC,DESC', id: '@id_route'},
  90 + {
  91 + list: {
  92 + method: 'GET',
  93 + params: {
  94 + page: 0
  95 + }
  96 + },
  97 + get: {
  98 + method: 'GET'
  99 + },
  100 + save: {
  101 + method: 'POST'
  102 + },
  103 + delete: {
  104 + method: 'DELETE'
  105 + }
  106 + }
  107 + );
  108 +}]);
  109 +// 人员信息service
  110 +angular.module('ScheduleApp').factory('EmployeeInfoManageService_g', ['$resource', function($resource) {
  111 + return {
  112 + rest : $resource(
  113 + '/personnel/:id',
  114 + {order: 'jobCode', direction: 'ASC', id: '@id_route'},
  115 + {
  116 + list: {
  117 + method: 'GET',
  118 + params: {
  119 + page: 0
  120 + }
  121 + },
  122 + get: {
  123 + method: 'GET'
  124 + },
  125 + save: {
  126 + method: 'POST'
  127 + }
  128 + }
  129 + ),
  130 + validate: $resource(
  131 + '/personnel/validate/:type',
  132 + {},
  133 + {
  134 + jobCode: {
  135 + method: 'GET'
  136 + }
  137 + }
  138 + ),
  139 + dataTools: $resource(
  140 + '/personnel/:type',
  141 + {},
  142 + {
  143 + dataExport: {
  144 + method: 'GET',
  145 + responseType: "arraybuffer",
  146 + params: {
  147 + type: "dataExport"
  148 + },
  149 + transformResponse: function(data, headers){
  150 + return {data : data};
  151 + }
  152 + }
  153 + }
  154 + )
  155 + };
  156 +}]);
  157 +
  158 +// 车辆配置service
  159 +angular.module('ScheduleApp').factory('BusConfigService_g', ['$resource', function($resource) {
  160 + return {
  161 + rest : $resource(
  162 + '/cci/:id',
  163 + {order: 'xl.id,cl.insideCode,isCancel', direction: 'ASC', id: '@id_route'},
  164 + {
  165 + list: {
  166 + method: 'GET',
  167 + params: {
  168 + page: 0
  169 + }
  170 + },
  171 + get: {
  172 + method: 'GET'
  173 + },
  174 + save: {
  175 + method: 'POST'
  176 + }
  177 + }
  178 + )
  179 + };
  180 +}]);
  181 +// 线路运营统计service
  182 +angular.module('ScheduleApp').factory('BusLineInfoStatService_g', ['$resource', function($resource) {
  183 + return $resource(
  184 + '/bic/:id',
  185 + {order: 'createDate', direction: 'DESC', id: '@id_route'}, // TODO:以后需要根据属性对象的属性查询
  186 + {
  187 + list: {
  188 + method: 'GET',
  189 + params: {
  190 + page: 0
  191 + }
  192 + }
  193 + }
  194 + );
  195 +}]);
  196 +
  197 +// 人员配置service
  198 +angular.module('ScheduleApp').factory('EmployeeConfigService_g', ['$resource', function($resource) {
  199 + return {
  200 + rest : $resource(
  201 + '/eci/:id',
  202 + {order: 'xl.id,isCancel,dbbmFormula', direction: 'ASC', id: '@id_route'},
  203 + {
  204 + list: {
  205 + method: 'GET',
  206 + params: {
  207 + page: 0
  208 + }
  209 + },
  210 + get: {
  211 + method: 'GET'
  212 + },
  213 + save: {
  214 + method: 'POST'
  215 + },
  216 + delete: {
  217 + method: 'DELETE'
  218 + }
  219 + }
  220 + ),
  221 + validate: $resource( // TODO:
  222 + '/personnel/validate/:type',
  223 + {},
  224 + {
  225 + jobCode: {
  226 + method: 'GET'
  227 + }
  228 + }
  229 + )
  230 + };
  231 +}]);
  232 +// 路牌管理service
  233 +angular.module('ScheduleApp').factory('GuideboardManageService_g', ['$resource', function($resource) {
  234 + return {
  235 + rest: $resource(
  236 + '/gic/:id',
  237 + {order: 'xl,isCancel', direction: 'DESC,ASC', id: '@id_route'},
  238 + {
  239 + list: {
  240 + method: 'GET',
  241 + params: {
  242 + page: 0
  243 + },
  244 + transformResponse: function(rs) {
  245 + var dst = angular.fromJson(rs);
  246 + if (dst.status == 'SUCCESS') {
  247 + return dst.data;
  248 + } else {
  249 + return dst;
  250 + }
  251 + }
  252 + },
  253 + get: {
  254 + method: 'GET',
  255 + transformResponse: function(rs) {
  256 + var dst = angular.fromJson(rs);
  257 + if (dst.status == 'SUCCESS') {
  258 + return dst.data;
  259 + } else {
  260 + return dst;
  261 + }
  262 + }
  263 + },
  264 + save: {
  265 + method: 'POST'
  266 + }
  267 + // 内部还有默认的方法delete
  268 + }
  269 + )
  270 + };
  271 +}]);
  272 +// 套跑管理service
  273 +angular.module('ScheduleApp').factory('rerunManageService_g', ['$resource', function($resource) {
  274 + return {
  275 + rest: $resource(
  276 + 'rms/:id',
  277 + {order: 'rerunXl.id,isCancel', direction: 'ASC', id: '@id_route'},
  278 + {
  279 + list: {
  280 + method: 'GET',
  281 + params: {
  282 + page: 0
  283 + }
  284 + },
  285 + get: {
  286 + method: 'GET'
  287 + },
  288 + save: {
  289 + method: 'POST'
  290 + },
  291 + delete: {
  292 + method: 'DELETE'
  293 + }
  294 + }
  295 + )
  296 + };
  297 +}]);
  298 +// 排班计划管理service
  299 +angular.module('ScheduleApp').factory('SchedulePlanManageService_g', ['$resource', function($resource) {
  300 + return {
  301 + rest : $resource(
  302 + '/spc/:id',
  303 + {order: 'xl.id,createDate', direction: 'DESC,DESC', id: '@id_route'},
  304 + {
  305 + list: {
  306 + method: 'GET',
  307 + params: {
  308 + page: 0
  309 + }
  310 + },
  311 + get: {
  312 + method: 'GET'
  313 + },
  314 + save: {
  315 + method: 'POST'
  316 + },
  317 + delete: {
  318 + method: 'DELETE'
  319 + }
  320 + }
  321 + ),
  322 + tommorw: $resource(
  323 + '/spc/tommorw',
  324 + {},
  325 + {
  326 + list: {
  327 + method: 'GET'
  328 + }
  329 + }
  330 + )
  331 + };
  332 +}]);
  333 +
  334 +// 排班计划明细管理service
  335 +angular.module('ScheduleApp').factory('SchedulePlanInfoManageService_g', ['$resource', function($resource) {
  336 + return {
  337 + rest : $resource(
  338 + '/spic/:id',
  339 + {order: 'scheduleDate,lp,fcno', direction: 'ASC,ASC,ASC', id: '@id_route'},
  340 + {
  341 + list: {
  342 + method: 'GET',
  343 + params: {
  344 + page: 0
  345 + }
  346 + },
  347 + get: {
  348 + method: 'GET'
  349 + },
  350 + save: {
  351 + method: 'POST'
  352 + }
  353 + }
  354 + ),
  355 + groupinfo : $resource(
  356 + '/spic/groupinfos/:xlid/:sdate',
  357 + {},
  358 + {
  359 + list: {
  360 + method: 'GET',
  361 + isArray: true
  362 + }
  363 + }
  364 + ),
  365 + updateGroupInfo : $resource(
  366 + '/spic/groupinfos/update',
  367 + {},
  368 + {
  369 + update: {
  370 + method: 'POST'
  371 + }
  372 + }
  373 + )
  374 + };
  375 +}]);
  376 +// 排班管理service
  377 +angular.module('ScheduleApp').factory('ScheduleRuleManageService_g', ['$resource', function($resource) {
  378 + return {
  379 + rest: $resource(
  380 + '/sr1fc/:id',
  381 + {order: 'createDate', direction: 'DESC', id: '@id_route'},
  382 + {
  383 + list: {
  384 + method: 'GET',
  385 + params: {
  386 + page: 0
  387 + }
  388 + },
  389 + get: {
  390 + method: 'GET'
  391 + },
  392 + save: {
  393 + method: 'POST'
  394 + },
  395 + delete: {
  396 + method: 'DELETE'
  397 + }
  398 + }
  399 + )
  400 + };
  401 +}]);
  402 +
  403 +// 时刻表管理service
  404 +angular.module('ScheduleApp').factory('TimeTableManageService_g', ['$resource', function($resource) {
  405 + return {
  406 + rest: $resource(
  407 + '/tic/:id',
  408 + {order: 'xl,isCancel,isEnableDisTemplate,qyrq', direction: 'DESC,ASC,DESC,DESC', id: '@id'},
  409 + {
  410 + list: {
  411 + method: 'GET',
  412 + params: {
  413 + page: 0
  414 + }
  415 + }
  416 + }
  417 + )
  418 + };
  419 +}]);
  420 +
  421 +// 时刻表明细管理service
  422 +angular.module('ScheduleApp').factory('TimeTableDetailManageService_g', ['$resource', function($resource) {
  423 + return {
  424 + rest: $resource(
  425 + '/tidc/:id',
  426 + {order: 'createDate', direction: 'DESC', id: '@id_route'},
  427 + {
  428 + get: {
  429 + method: 'GET'
  430 + },
  431 + save: {
  432 + method: 'POST'
  433 + }
  434 + }
  435 + ),
  436 + import: $resource(
  437 + '/tidc/importfile',
  438 + {},
  439 + {
  440 + do: {
  441 + method: 'POST',
  442 + headers: {
  443 + 'Content-Type': 'application/x-www-form-urlencoded'
  444 + },
  445 + transformRequest: function(obj) {
  446 + var str = [];
  447 + for (var p in obj) {
  448 + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  449 + }
  450 + return str.join("&");
  451 + }
  452 + }
  453 + }
  454 + ),
  455 + edit: $resource(
  456 + '/tidc/edit/:xlid/:ttid',
  457 + {},
  458 + {
  459 + list: {
  460 + method: 'GET'
  461 + }
  462 + }
  463 + ),
  464 + bcdetails: $resource(
  465 + '/tidc/bcdetail',
  466 + {},
  467 + {
  468 + list: {
  469 + method: 'GET',
  470 + isArray: true
  471 + }
  472 + }
  473 + ),
  474 + dataTools: $resource(
  475 + '/tidc/:type',
  476 + {},
  477 + {
  478 + dataExport: {
  479 + method: 'GET',
  480 + responseType: "arraybuffer",
  481 + params: {
  482 + type: "dataExportExt"
  483 + },
  484 + transformResponse: function(data, headers){
  485 + return {data : data};
  486 + }
  487 + }
  488 + }
  489 + )
  490 +
  491 + // TODO:导入数据
  492 + };
  493 +}]);
  494 +// 项目通用的全局service服务,供不同的controller使用,自定义指令不使用
  495 +
  496 +// 文件下载服务
  497 +angular.module('ScheduleApp').factory('FileDownload_g', function() {
  498 + return {
  499 + downloadFile: function (data, mimeType, fileName) {
  500 + var success = false;
  501 + var blob = new Blob([data], { type: mimeType });
  502 + try {
  503 + if (navigator.msSaveBlob)
  504 + navigator.msSaveBlob(blob, fileName);
  505 + else {
  506 + // Try using other saveBlob implementations, if available
  507 + var saveBlob = navigator.webkitSaveBlob || navigator.mozSaveBlob || navigator.saveBlob;
  508 + if (saveBlob === undefined) throw "Not supported";
  509 + saveBlob(blob, fileName);
  510 + }
  511 + success = true;
  512 + } catch (ex) {
  513 + console.log("saveBlob method failed with the following exception:");
  514 + console.log(ex);
  515 + }
  516 +
  517 + if (!success) {
  518 + // Get the blob url creator
  519 + var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
  520 + if (urlCreator) {
  521 + // Try to use a download link
  522 + var link = document.createElement('a');
  523 + if ('download' in link) {
  524 + // Try to simulate a click
  525 + try {
  526 + // Prepare a blob URL
  527 + var url = urlCreator.createObjectURL(blob);
  528 + link.setAttribute('href', url);
  529 +
  530 + // Set the download attribute (Supported in Chrome 14+ / Firefox 20+)
  531 + link.setAttribute("download", fileName);
  532 +
  533 + // Simulate clicking the download link
  534 + var event = document.createEvent('MouseEvents');
  535 + event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
  536 + link.dispatchEvent(event);
  537 + success = true;
  538 +
  539 + } catch (ex) {
  540 + console.log("Download link method with simulated click failed with the following exception:");
  541 + console.log(ex);
  542 + }
  543 + }
  544 +
  545 + if (!success) {
  546 + // Fallback to window.location method
  547 + try {
  548 + // Prepare a blob URL
  549 + // Use application/octet-stream when using window.location to force download
  550 + var url = urlCreator.createObjectURL(blob);
  551 + window.location = url;
  552 + console.log("Download link method with window.location succeeded");
  553 + success = true;
  554 + } catch (ex) {
  555 + console.log("Download link method with window.location failed with the following exception:");
  556 + console.log(ex);
  557 + }
  558 + }
  559 + }
  560 + }
  561 +
  562 + if (!success) {
  563 + // Fallback to window.open method
  564 + console.log("No methods worked for saving the arraybuffer, using last resort window.open");
  565 + window.open("", '_blank', '');
  566 + }
  567 + }
  568 + };
  569 +});
  570 +
  571 +
  572 +/**
  573 + * saSelect2指令,根据属性值,动态载入数据,然后支持拼音搜索,点击右边的按钮清除选择并重新载入数据。
  574 + * 1、compile阶段使用的属性如下:
  575 + * required:用于和表单验证连接,指定成required="true"才有效。
  576 + * 2、link阶段使用的属性如下
  577 + * model:关联的模型对象
  578 + * name:表单验证时需要的名字
  579 + * type:关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加
  580 + * modelcolname1:关联的模型字段名字1(一般应该是编码字段)
  581 + * modelcolname2:关联的模型字段名字2(一般应该是名字字段)
  582 + * datacolname1;内部数据对应的字段名字1(与模型字段1对应)
  583 + * datacolname2:内部数据对应的字段名字2(与模型字段2对应)
  584 + * showcolname:下拉框显示的内部数据字段名(注意:不是模型数据字段名),TODO:以后考虑放动态表达式,并在compile阶段使用
  585 + * placeholder:select placeholder字符串描述
  586 + *
  587 + * $$pyFilter,内部的filter指令,结合简拼音进行拼音过滤。
  588 + * $$SearchInfoService_g,内部使用的数据服务
  589 + */
  590 +// saSelect2指令使用的内部信service
  591 +angular.module('ScheduleApp').factory('$$SearchInfoService_g', ['$resource', function($resource) {
  592 + return {
  593 + xl: $resource(
  594 + '/line/:type',
  595 + {order: 'name', direction: 'ASC'},
  596 + {
  597 + list: {
  598 + method: 'GET',
  599 + isArray: true
  600 + }
  601 + }
  602 + ),
  603 + xlinfo: $resource(
  604 + '/lineInformation/:type',
  605 + {order: 'line.name', direction: 'ASC'},
  606 + {
  607 + list: {
  608 + method: 'GET',
  609 + isArray: true
  610 + }
  611 + }
  612 + ),
  613 + zd: $resource(
  614 + '/stationroute/stations',
  615 + {order: 'stationCode', direction: 'ASC'},
  616 + {
  617 + list: {
  618 + method: 'GET',
  619 + isArray: true
  620 + }
  621 + }
  622 + ),
  623 + tcc: $resource(
  624 + '/carpark/:type',
  625 + {order: 'parkCode', direction: 'ASC'},
  626 + {
  627 + list: {
  628 + method: 'GET',
  629 + isArray: true
  630 + }
  631 + }
  632 + ),
  633 + ry: $resource(
  634 + '/personnel/:type',
  635 + {order: 'personnelName', direction: 'ASC'},
  636 + {
  637 + list: {
  638 + method: 'GET',
  639 + isArray: true
  640 + }
  641 + }
  642 + ),
  643 + cl: $resource(
  644 + '/cars/:type',
  645 + {order: "insideCode", direction: 'ASC'},
  646 + {
  647 + list: {
  648 + method: 'GET',
  649 + isArray: true
  650 + }
  651 + }
  652 + ),
  653 + ttInfo: $resource(
  654 + '/tic/:type',
  655 + {order: "name", direction: 'ASC'},
  656 + {
  657 + list: {
  658 + method: 'GET',
  659 + isArray: true
  660 + }
  661 + }
  662 + ),
  663 + lpInfo: $resource(
  664 + '/gic/ttlpnames',
  665 + {order: "lpName", direction: 'ASC'},
  666 + {
  667 + list: {
  668 + method: 'GET',
  669 + isArray: true
  670 + }
  671 + }
  672 + ),
  673 + lpInfo2: $resource(
  674 + '/gic/:type',
  675 + {order: "lpName", direction: 'ASC'},
  676 + {
  677 + list: {
  678 + method: 'GET',
  679 + isArray: true
  680 + }
  681 + }
  682 + ),
  683 + cci: $resource(
  684 + '/cci/cars',
  685 + {},
  686 + {
  687 + list: {
  688 + method: 'GET',
  689 + isArray: true
  690 + }
  691 + }
  692 +
  693 + ),
  694 + cci2: $resource(
  695 + '/cci/:type',
  696 + {},
  697 + {
  698 + list: {
  699 + method: 'GET',
  700 + isArray: true
  701 + }
  702 + }
  703 + ),
  704 + cci3: $resource(
  705 + '/cci/cars2',
  706 + {},
  707 + {
  708 + list: {
  709 + method: 'GET',
  710 + isArray: true
  711 + }
  712 + }
  713 +
  714 + ),
  715 + eci: $resource(
  716 + '/eci/jsy',
  717 + {},
  718 + {
  719 + list: {
  720 + method: 'GET',
  721 + isArray: true
  722 + }
  723 + }
  724 + ),
  725 + eci2: $resource(
  726 + '/eci/spy',
  727 + {},
  728 + {
  729 + list: {
  730 + method: 'GET',
  731 + isArray: true
  732 + }
  733 + }
  734 + ),
  735 + eci3: $resource(
  736 + '/eci/:type',
  737 + {},
  738 + {
  739 + list: {
  740 + method: 'GET',
  741 + isArray: true
  742 + }
  743 + }
  744 + ),
  745 +
  746 +
  747 + validate: { // remoteValidation指令用到的resource
  748 + gbv1: { // 路牌序号验证
  749 + template: {'xl.id_eq': -1, 'lpNo_eq': 'ddd'},
  750 + remote: $resource(
  751 + '/gic/validate1',
  752 + {},
  753 + {
  754 + do: {
  755 + method: 'GET'
  756 + }
  757 + }
  758 + )
  759 + },
  760 + gbv2: { // 路牌名称验证
  761 + template: {'xl.id_eq': -1, 'lpName_eq': 'ddd'},
  762 + remote: $resource(
  763 + '/gic/validate2',
  764 + {},
  765 + {
  766 + do: {
  767 + method: 'GET'
  768 + }
  769 + }
  770 + )
  771 + },
  772 +
  773 + cars_zbh: { // 自编号验证
  774 + template: {'insideCode_eq': '-1'}, // 查询参数模版
  775 + remote: $resource( // $resource封装对象
  776 + '/cars_sc/validate_zbh',
  777 + {},
  778 + {
  779 + do: {
  780 + method: 'GET'
  781 + }
  782 + }
  783 + )
  784 + },
  785 +
  786 + cars_sbbh: { // 验证设备编号
  787 + template: {'equipmentCode_eq': '-1'}, // 查询参数模版
  788 + remote: $resource( // $resource封装对象
  789 + '/cars_sc/validate_sbbh',
  790 + {},
  791 + {
  792 + do: {
  793 + method: 'GET'
  794 + }
  795 + }
  796 + )
  797 + },
  798 +
  799 + cars_clbh: { // 车辆编号验证
  800 + template: {'carCode_eq': '-1'}, // 查询参数模版
  801 + remote: $resource( // $resource封装对象
  802 + '/cars_sc/validate_clbh',
  803 + {},
  804 + {
  805 + do: {
  806 + method: 'GET'
  807 + }
  808 + }
  809 + )
  810 + },
  811 +
  812 + cars_cph: { // 车牌号验证
  813 + template: {'carPlate_eq': '-1'}, // 查询参数模版
  814 + remote: $resource( // $resource封装对象
  815 + '/cars_sc/validate_cph',
  816 + {},
  817 + {
  818 + do: {
  819 + method: 'GET'
  820 + }
  821 + }
  822 + )
  823 + },
  824 +
  825 +
  826 + cde1: { // 车辆设备启用日期验证
  827 + template: {'qyrq': 0, 'xl': 1, 'cl': 1}, // 日期毫秒
  828 + remote: $resource( // $resource封装对象
  829 + '/cde//validate/qyrq',
  830 + {},
  831 + {
  832 + do: {
  833 + method: 'GET'
  834 + }
  835 + }
  836 + )
  837 + },
  838 + ttc1: { // 时刻表名字验证
  839 + template: {'xl.id_eq': -1, 'name_eq': 'ddd'},
  840 + remote: $resource( // $resource封装对象
  841 + '/tic/validate/equale',
  842 + {},
  843 + {
  844 + do: {
  845 + method: 'GET'
  846 + }
  847 + }
  848 + )
  849 + },
  850 + sheet: { // 时刻表sheet工作区验证
  851 + template: {'filename': '', 'sheetname': '', 'lineid': -1, 'linename': ''},
  852 + remote: $resource( // $resource封装对象
  853 + '/tidc/validate/sheet',
  854 + {},
  855 + {
  856 + do: {
  857 + method: 'POST',
  858 + headers: {
  859 + 'Content-Type': 'application/x-www-form-urlencoded'
  860 + },
  861 + transformRequest: function(obj) {
  862 + var str = [];
  863 + for (var p in obj) {
  864 + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  865 + }
  866 + return str.join("&");
  867 + }
  868 + }
  869 + }
  870 + )
  871 + },
  872 + sheetli: { // 时刻表线路标准验证
  873 + template: {'lineinfoid': -1},
  874 + remote: $resource( // $resource封装对象
  875 + '/tidc/validate/lineinfo',
  876 + {},
  877 + {
  878 + do: {
  879 + method: 'GET'
  880 + }
  881 + }
  882 + )
  883 + }
  884 + }
  885 +
  886 + //validate: $resource(
  887 + // '/cars/validate/:type',
  888 + // {},
  889 + // {
  890 + // insideCode: {
  891 + // method: 'GET'
  892 + // }
  893 + // }
  894 + //)
  895 +
  896 +
  897 +
  898 + }
  899 +}]);
  900 +
  901 +
  902 +
... ...