Commit cf0771db6e7c38ed6b65e9bc1d755cdcf1e0f750

Authored by 徐烜
2 parents 05849f9c b0d08465

Merge branch 'PSM-26' into minhang

Showing 28 changed files with 2353 additions and 2208 deletions
src/main/java/com/bsth/controller/schedule/CarConfigInfoController.java deleted 100644 → 0
1 -package com.bsth.controller.schedule;  
2 -  
3 -import com.bsth.controller.BaseController;  
4 -import com.bsth.entity.schedule.CarConfigInfo;  
5 -import com.bsth.repository.schedule.CarConfigInfoRepository;  
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.*;  
10 -  
11 -import java.util.List;  
12 -import java.util.Map;  
13 -  
14 -/**  
15 - * Created by xu on 16/5/9.  
16 - */  
17 -@RestController  
18 -@RequestMapping("cci")  
19 -@EnableConfigurationProperties(DataToolsProperties.class)  
20 -public class CarConfigInfoController extends BaseController<CarConfigInfo, Long> {  
21 - @Autowired  
22 - private DataToolsProperties dataToolsProperties;  
23 - @Autowired  
24 - private CarConfigInfoRepository carConfigInfoRepository;  
25 -  
26 - @Override  
27 - protected String getDataImportKtrClasspath() {  
28 - return dataToolsProperties.getCarsconfigDatainputktr();  
29 - }  
30 -  
31 - @Override  
32 - public CarConfigInfo findById(@PathVariable("id") Long aLong) {  
33 - return carConfigInfoRepository.findOneExtend(aLong);  
34 - }  
35 -  
36 - /**  
37 - * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody  
38 - * @Title: save  
39 - * @Description: TODO(持久化对象)  
40 - * @param @param t  
41 - * @param @return 设定文件  
42 - * @return Map<String,Object> {status: 1(成功),-1(失败)}  
43 - * @throws  
44 - */  
45 - @RequestMapping(method = RequestMethod.POST)  
46 - public Map<String, Object> save(@RequestBody CarConfigInfo t){  
47 - return baseService.save(t);  
48 - }  
49 -  
50 - @RequestMapping(value = "/cars", method = RequestMethod.GET)  
51 - public List<Map<String, Object>> findCarConfigCars() {  
52 - return carConfigInfoRepository.findCarConfigCars();  
53 - }  
54 -  
55 - @RequestMapping(value = "/cars2", method = RequestMethod.GET)  
56 - public List<Map<String, Object>> findCarsFromConfig() {  
57 - return carConfigInfoRepository.findCarsFromConfig();  
58 - }  
59 -}  
src/main/java/com/bsth/controller/schedule/EmployeeConfigInfoController.java deleted 100644 → 0
1 -package com.bsth.controller.schedule;  
2 -  
3 -import com.bsth.controller.BaseController;  
4 -import com.bsth.entity.schedule.EmployeeConfigInfo;  
5 -import com.bsth.repository.schedule.EmployeeConfigInfoRepository;  
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.*;  
10 -  
11 -import java.util.List;  
12 -import java.util.Map;  
13 -  
14 -/**  
15 - * Created by xu on 16/5/10.  
16 - */  
17 -@RestController  
18 -@RequestMapping("eci")  
19 -@EnableConfigurationProperties(DataToolsProperties.class)  
20 -public class EmployeeConfigInfoController extends BaseController<EmployeeConfigInfo, Long> {  
21 - @Autowired  
22 - private DataToolsProperties dataToolsProperties;  
23 - @Autowired  
24 - private EmployeeConfigInfoRepository employeeConfigInfoRepository;  
25 -  
26 - @Override  
27 - protected String getDataImportKtrClasspath() {  
28 - return dataToolsProperties.getEmployeesconfigDatainputktr();  
29 - }  
30 -  
31 - @Override  
32 - public EmployeeConfigInfo findById(@PathVariable("id") Long aLong) {  
33 - return employeeConfigInfoRepository.findOneExtend(aLong);  
34 - }  
35 -  
36 - /**  
37 - * 覆写方法,因为form提交的方式参数不全,改用 json形式提交 @RequestBody  
38 - * @Title: save  
39 - * @Description: TODO(持久化对象)  
40 - * @param @param t  
41 - * @param @return 设定文件  
42 - * @return Map<String,Object> {status: 1(成功),-1(失败)}  
43 - * @throws  
44 - */  
45 - @RequestMapping(method = RequestMethod.POST)  
46 - public Map<String, Object> save(@RequestBody EmployeeConfigInfo t){  
47 - return baseService.save(t);  
48 - }  
49 -  
50 - @RequestMapping(value = "/jsy", method = RequestMethod.GET)  
51 - public List<Map<String, Object>> findJsyFromConfig() {  
52 - return employeeConfigInfoRepository.findJsyFromConfig();  
53 - }  
54 -  
55 - @RequestMapping(value = "/spy", method = RequestMethod.GET)  
56 - public List<Map<String, Object>> findSpyFromConfig() {  
57 - return employeeConfigInfoRepository.findSpyFromConfig();  
58 - }  
59 -}  
src/main/java/com/bsth/controller/schedule/core/CarConfigInfoController.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.CarConfigInfo;
  6 +import com.bsth.repository.schedule.CarConfigInfoRepository;
  7 +import com.bsth.service.schedule.CarConfigInfoService;
  8 +import com.bsth.service.schedule.ScheduleException;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestMethod;
  12 +import org.springframework.web.bind.annotation.RequestParam;
  13 +import org.springframework.web.bind.annotation.RestController;
  14 +
  15 +import java.util.HashMap;
  16 +import java.util.List;
  17 +import java.util.Map;
  18 +
  19 +/**
  20 + * Created by xu on 16/5/9.
  21 + */
  22 +@RestController
  23 +@RequestMapping("cci")
  24 +public class CarConfigInfoController extends BController<CarConfigInfo, Long> {
  25 + @Autowired
  26 + private CarConfigInfoRepository carConfigInfoRepository;
  27 + @Autowired
  28 + private CarConfigInfoService carConfigInfoService;
  29 +
  30 +
  31 + @RequestMapping(value = "/cars", method = RequestMethod.GET)
  32 + public List<Map<String, Object>> findCarConfigCars() {
  33 + return carConfigInfoRepository.findCarConfigCars();
  34 + }
  35 +
  36 + @RequestMapping(value = "/cars2", method = RequestMethod.GET)
  37 + public List<Map<String, Object>> findCarsFromConfig() {
  38 + return carConfigInfoRepository.findCarsFromConfig();
  39 + }
  40 +
  41 + @RequestMapping(value = "/validate_cars", method = RequestMethod.GET)
  42 + public Map<String, Object> validate_cars(@RequestParam Map<String, Object> param) {
  43 + Map<String, Object> rtn = new HashMap<>();
  44 + try {
  45 + // 车辆重复配置验证
  46 + CarConfigInfo carConfigInfo = new CarConfigInfo(
  47 + param.get("xl.id_eq"),
  48 + param.get("xl.name_eq"),
  49 + param.get("cl.id_eq")
  50 + );
  51 + carConfigInfoService.validate_cars(carConfigInfo);
  52 + rtn.put("status", ResponseCode.SUCCESS);
  53 + } catch (ScheduleException exp) {
  54 + rtn.put("status", ResponseCode.ERROR);
  55 + rtn.put("msg", exp.getMessage());
  56 + }
  57 +
  58 + return rtn;
  59 + }
  60 +}
src/main/java/com/bsth/controller/schedule/core/EmployeeConfigInfoController.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.EmployeeConfigInfo;
  6 +import com.bsth.repository.schedule.EmployeeConfigInfoRepository;
  7 +import com.bsth.service.schedule.EmployeeConfigInfoService;
  8 +import com.bsth.service.schedule.ScheduleException;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestMethod;
  12 +import org.springframework.web.bind.annotation.RequestParam;
  13 +import org.springframework.web.bind.annotation.RestController;
  14 +
  15 +import java.util.HashMap;
  16 +import java.util.List;
  17 +import java.util.Map;
  18 +
  19 +/**
  20 + * Created by xu on 16/5/10.
  21 + */
  22 +@RestController
  23 +@RequestMapping("eci")
  24 +public class EmployeeConfigInfoController extends BController<EmployeeConfigInfo, Long> {
  25 + @Autowired
  26 + private EmployeeConfigInfoRepository employeeConfigInfoRepository;
  27 + @Autowired
  28 + private EmployeeConfigInfoService employeeConfigInfoService;
  29 +
  30 + @RequestMapping(value = "/jsy", method = RequestMethod.GET)
  31 + public List<Map<String, Object>> findJsyFromConfig() {
  32 + return employeeConfigInfoRepository.findJsyFromConfig();
  33 + }
  34 +
  35 + @RequestMapping(value = "/spy", method = RequestMethod.GET)
  36 + public List<Map<String, Object>> findSpyFromConfig() {
  37 + return employeeConfigInfoRepository.findSpyFromConfig();
  38 + }
  39 +
  40 +
  41 +
  42 + @RequestMapping(value = "/validate_jsy", method = RequestMethod.GET)
  43 + public Map<String, Object> validate_jsy(@RequestParam Map<String, Object> param) {
  44 + Map<String, Object> rtn = new HashMap<>();
  45 + try {
  46 + EmployeeConfigInfo employeeConfigInfo = new EmployeeConfigInfo(
  47 + param.get("xl.id_eq"),
  48 + param.get("xl.name_eq"),
  49 + param.get("jsy.id_eq"),
  50 + null
  51 + );
  52 + employeeConfigInfoService.validate_jsy(employeeConfigInfo);
  53 + rtn.put("status", ResponseCode.SUCCESS);
  54 + } catch (ScheduleException exp) {
  55 + rtn.put("status", ResponseCode.ERROR);
  56 + rtn.put("msg", exp.getMessage());
  57 + }
  58 +
  59 + return rtn;
  60 + }
  61 +
  62 + @RequestMapping(value = "/validate_spy", method = RequestMethod.GET)
  63 + public Map<String, Object> validate_spy(@RequestParam Map<String, Object> param) {
  64 + Map<String, Object> rtn = new HashMap<>();
  65 + try {
  66 + EmployeeConfigInfo employeeConfigInfo = new EmployeeConfigInfo(
  67 + param.get("xl.id_eq"),
  68 + param.get("xl.name_eq"),
  69 + null,
  70 + param.get("spy.id_eq")
  71 + );
  72 + employeeConfigInfoService.validate_spy(employeeConfigInfo);
  73 + rtn.put("status", ResponseCode.SUCCESS);
  74 + } catch (ScheduleException exp) {
  75 + rtn.put("status", ResponseCode.ERROR);
  76 + rtn.put("msg", exp.getMessage());
  77 + }
  78 + return rtn;
  79 + }
  80 +}
src/main/java/com/bsth/entity/Personnel.java
1 package com.bsth.entity; 1 package com.bsth.entity;
2 2
3 import com.bsth.entity.sys.SysUser; 3 import com.bsth.entity.sys.SysUser;
  4 +import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4 5
5 import javax.persistence.*; 6 import javax.persistence.*;
6 import java.util.Date; 7 import java.util.Date;
@@ -21,6 +22,7 @@ import java.util.Date; @@ -21,6 +22,7 @@ import java.util.Date;
21 22
22 @Entity 23 @Entity
23 @Table(name = "bsth_c_personnel") 24 @Table(name = "bsth_c_personnel")
  25 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
24 public class Personnel { 26 public class Personnel {
25 27
26 /** 主键Id */ 28 /** 主键Id */
src/main/java/com/bsth/entity/schedule/CarConfigInfo.java
@@ -3,6 +3,7 @@ package com.bsth.entity.schedule; @@ -3,6 +3,7 @@ package com.bsth.entity.schedule;
3 import com.bsth.entity.Cars; 3 import com.bsth.entity.Cars;
4 import com.bsth.entity.Line; 4 import com.bsth.entity.Line;
5 import com.bsth.entity.sys.SysUser; 5 import com.bsth.entity.sys.SysUser;
  6 +import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
6 7
7 import javax.persistence.*; 8 import javax.persistence.*;
8 import java.io.Serializable; 9 import java.io.Serializable;
@@ -19,6 +20,7 @@ import java.util.Date; @@ -19,6 +20,7 @@ import java.util.Date;
19 @NamedAttributeNode("cl") 20 @NamedAttributeNode("cl")
20 }) 21 })
21 }) 22 })
  23 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
22 public class CarConfigInfo implements Serializable { 24 public class CarConfigInfo implements Serializable {
23 25
24 /** 主健Id */ 26 /** 主健Id */
@@ -71,6 +73,22 @@ public class CarConfigInfo implements Serializable { @@ -71,6 +73,22 @@ public class CarConfigInfo implements Serializable {
71 @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") 73 @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
72 private Date updateDate; 74 private Date updateDate;
73 75
  76 + public CarConfigInfo() {}
  77 + public CarConfigInfo(Object xlid, Object xlname, Object clid) {
  78 + if (xlid != null && xlname != null) {
  79 + Line line = new Line();
  80 + line.setId(Integer.valueOf(xlid.toString()));
  81 + line.setName(xlname.toString());
  82 + this.xl = line;
  83 + }
  84 + if (clid != null) {
  85 + Cars cars = new Cars();
  86 + cars.setId(Integer.valueOf(clid.toString()));
  87 + this.cl = cars;
  88 + }
  89 +
  90 + }
  91 +
74 public Long getId() { 92 public Long getId() {
75 return id; 93 return id;
76 } 94 }
src/main/java/com/bsth/entity/schedule/EmployeeConfigInfo.java
@@ -4,6 +4,7 @@ import com.bsth.entity.Cars; @@ -4,6 +4,7 @@ import com.bsth.entity.Cars;
4 import com.bsth.entity.Line; 4 import com.bsth.entity.Line;
5 import com.bsth.entity.Personnel; 5 import com.bsth.entity.Personnel;
6 import com.bsth.entity.sys.SysUser; 6 import com.bsth.entity.sys.SysUser;
  7 +import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
7 import org.hibernate.annotations.Formula; 8 import org.hibernate.annotations.Formula;
8 9
9 import javax.persistence.*; 10 import javax.persistence.*;
@@ -22,6 +23,7 @@ import java.util.Date; @@ -22,6 +23,7 @@ import java.util.Date;
22 @NamedAttributeNode("xl") 23 @NamedAttributeNode("xl")
23 }) 24 })
24 }) 25 })
  26 +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
25 public class EmployeeConfigInfo { 27 public class EmployeeConfigInfo {
26 28
27 /** 主键Id */ 29 /** 主键Id */
@@ -67,6 +69,27 @@ public class EmployeeConfigInfo { @@ -67,6 +69,27 @@ public class EmployeeConfigInfo {
67 @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") 69 @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
68 private Date updateDate; 70 private Date updateDate;
69 71
  72 + public EmployeeConfigInfo() {}
  73 +
  74 + public EmployeeConfigInfo(Object xlid, Object xlname, Object jsyid, Object spyid) {
  75 + if (xlid != null && xlname != null) {
  76 + Line line = new Line();
  77 + line.setId(Integer.valueOf(xlid.toString()));
  78 + line.setName(xlname.toString());
  79 + this.xl = line;
  80 + }
  81 + if (jsyid != null) {
  82 + Personnel personnel = new Personnel();
  83 + personnel.setId(Integer.valueOf(jsyid.toString()));
  84 + this.jsy = personnel;
  85 + }
  86 + if (spyid != null) {
  87 + Personnel personnel = new Personnel();
  88 + personnel.setId(Integer.valueOf(spyid.toString()));
  89 + this.spy = personnel;
  90 + }
  91 + }
  92 +
70 public Long getId() { 93 public Long getId() {
71 return id; 94 return id;
72 } 95 }
src/main/java/com/bsth/entity/schedule/SchedulePlanInfo.java
@@ -163,8 +163,10 @@ public class SchedulePlanInfo { @@ -163,8 +163,10 @@ public class SchedulePlanInfo {
163 163
164 // TODO:关联的公司名称 164 // TODO:关联的公司名称
165 // TODO:关联的公司编码 165 // TODO:关联的公司编码
  166 + this.gsBm = xl.getCompany();
166 // TODO:关联的分公司名称 167 // TODO:关联的分公司名称
167 // TODO:关联的分公司编码 168 // TODO:关联的分公司编码
  169 + this.fgsBm = xl.getBrancheCompany();
168 // TODO:关联的出场顺序号 170 // TODO:关联的出场顺序号
169 171
170 // 关联的排班计划 172 // 关联的排班计划
src/main/java/com/bsth/service/schedule/CarConfigInfoService.java
1 package com.bsth.service.schedule; 1 package com.bsth.service.schedule;
2 2
3 import com.bsth.entity.schedule.CarConfigInfo; 3 import com.bsth.entity.schedule.CarConfigInfo;
4 -import com.bsth.service.BaseService;  
5 4
6 /** 5 /**
7 * Created by xu on 16/5/9. 6 * Created by xu on 16/5/9.
8 */ 7 */
9 -public interface CarConfigInfoService extends BaseService<CarConfigInfo, Long> { 8 +public interface CarConfigInfoService extends BService<CarConfigInfo, Long> {
  9 + public void validate_cars(CarConfigInfo carConfigInfo) throws ScheduleException;
  10 + public void toggleCancel(Long id) throws ScheduleException;
10 } 11 }
src/main/java/com/bsth/service/schedule/CarConfigInfoServiceImpl.java deleted 100644 → 0
1 -package com.bsth.service.schedule;  
2 -  
3 -import com.bsth.common.ResponseCode;  
4 -import com.bsth.entity.schedule.CarConfigInfo;  
5 -import com.bsth.entity.schedule.rule.ScheduleRule1Flat;  
6 -import com.bsth.repository.schedule.CarConfigInfoRepository;  
7 -import com.bsth.service.impl.BaseServiceImpl;  
8 -import org.springframework.beans.factory.annotation.Autowired;  
9 -import org.springframework.stereotype.Service;  
10 -  
11 -import javax.transaction.Transactional;  
12 -import java.util.*;  
13 -  
14 -/**  
15 - * Created by xu on 16/5/9.  
16 - */  
17 -@Service  
18 -public class CarConfigInfoServiceImpl extends BaseServiceImpl<CarConfigInfo, Long> implements CarConfigInfoService {  
19 - @Autowired  
20 - private CarConfigInfoRepository carConfigInfoRepository;  
21 - @Autowired  
22 - private ScheduleRule1FlatService scheduleRule1FlatService;  
23 -  
24 - @Override  
25 - @Transactional  
26 - public Map<String, Object> delete(Long aLong) {  
27 - // 获取待作废的车辆配置  
28 - CarConfigInfo carConfigInfo = carConfigInfoRepository.findOne(aLong);  
29 - // 查询有无规则使用过此车辆配置  
30 - Map<String, Object> param = new HashMap<>();  
31 - param.put("carConfigInfo.id_eq", carConfigInfo.getId());  
32 - Iterator<ScheduleRule1Flat> scheduleRule1FlatIterator =  
33 - scheduleRule1FlatService.list(param).iterator();  
34 - boolean isExist = false;  
35 - while (scheduleRule1FlatIterator.hasNext()) {  
36 - ScheduleRule1Flat scheduleRule1Flat = scheduleRule1FlatIterator.next();  
37 - if (scheduleRule1Flat.getCarConfigInfo().getId().equals(carConfigInfo.getId())) {  
38 - isExist = true;  
39 - break;  
40 - }  
41 - }  
42 -  
43 - Map<String, Object> map = new HashMap<>();  
44 -  
45 - if (isExist) {  
46 - throw new RuntimeException("车辆配置已被规则使用,不能删除,请先修改规则!");  
47 - } else {  
48 - carConfigInfo.setIsCancel(true);  
49 - map.put("status", ResponseCode.SUCCESS);  
50 - }  
51 -  
52 - return map;  
53 -  
54 - }  
55 -}  
src/main/java/com/bsth/service/schedule/EmployeeConfigInfoService.java
1 package com.bsth.service.schedule; 1 package com.bsth.service.schedule;
2 2
3 import com.bsth.entity.schedule.EmployeeConfigInfo; 3 import com.bsth.entity.schedule.EmployeeConfigInfo;
4 -import com.bsth.service.BaseService;  
5 4
6 /** 5 /**
7 * Created by xu on 16/5/10. 6 * Created by xu on 16/5/10.
8 */ 7 */
9 -public interface EmployeeConfigInfoService extends BaseService<EmployeeConfigInfo, Long> { 8 +public interface EmployeeConfigInfoService extends BService<EmployeeConfigInfo, Long> {
  9 + void validate_jsy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException;
  10 + void validate_spy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException;
  11 + public void toggleCancel(Long id) throws ScheduleException;
10 } 12 }
src/main/java/com/bsth/service/schedule/EmployeeConfigInfoServiceImpl.java deleted 100644 → 0
1 -package com.bsth.service.schedule;  
2 -  
3 -import com.bsth.common.ResponseCode;  
4 -import com.bsth.entity.Line;  
5 -import com.bsth.entity.schedule.EmployeeConfigInfo;  
6 -import com.bsth.entity.schedule.rule.ScheduleRule1Flat;  
7 -import com.bsth.repository.schedule.EmployeeConfigInfoRepository;  
8 -import com.bsth.service.impl.BaseServiceImpl;  
9 -import org.springframework.beans.factory.annotation.Autowired;  
10 -import org.springframework.stereotype.Service;  
11 -  
12 -import javax.transaction.Transactional;  
13 -import java.util.*;  
14 -  
15 -/**  
16 - * Created by xu on 16/5/10.  
17 - */  
18 -@Service  
19 -public class EmployeeConfigInfoServiceImpl extends BaseServiceImpl<EmployeeConfigInfo, Long> implements EmployeeConfigInfoService {  
20 - @Autowired  
21 - private EmployeeConfigInfoRepository employeeConfigInfoRepository;  
22 - @Autowired  
23 - private ScheduleRule1FlatService scheduleRule1FlatService;  
24 -  
25 -  
26 - @Override  
27 - @Transactional  
28 - public Map<String, Object> delete(Long aLong) {  
29 - // 获取待作废的人员配置  
30 - EmployeeConfigInfo employeeConfigInfo = employeeConfigInfoRepository.findOne(aLong);  
31 - // 获取线路  
32 - Line xl = employeeConfigInfo.getXl();  
33 - // 查找线路的规则,比较人员配置信息  
34 - Map<String, Object> param = new HashMap<>();  
35 - param.put("xl.id_eq", xl.getId());  
36 - Iterator<ScheduleRule1Flat> employeeConfigInfoIterator = scheduleRule1FlatService.list(param).iterator();  
37 - List<String> ryConfigIds = new ArrayList<>();  
38 - while (employeeConfigInfoIterator.hasNext()) {  
39 - ScheduleRule1Flat scheduleRule1Flat = employeeConfigInfoIterator.next();  
40 - ryConfigIds.addAll(Arrays.asList(scheduleRule1Flat.getRyConfigIds().split(",")));  
41 - }  
42 -  
43 - Map<String, Object> map = new HashMap<>();  
44 -  
45 - if (ryConfigIds.contains(employeeConfigInfo.getId().toString())) {  
46 - throw new RuntimeException("人员配置已被规则使用,不能删除,请先修改规则!");  
47 - } else {  
48 - employeeConfigInfo.setIsCancel(true);  
49 - map.put("status", ResponseCode.SUCCESS);  
50 - }  
51 -  
52 - return map;  
53 - }  
54 -  
55 -}  
src/main/java/com/bsth/service/schedule/impl/CarConfigInfoServiceImpl.java 0 → 100644
  1 +package com.bsth.service.schedule.impl;
  2 +
  3 +import com.bsth.entity.schedule.CarConfigInfo;
  4 +import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
  5 +import com.bsth.service.schedule.CarConfigInfoService;
  6 +import com.bsth.service.schedule.ScheduleException;
  7 +import com.bsth.service.schedule.ScheduleRule1FlatService;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.stereotype.Service;
  10 +import org.springframework.transaction.annotation.Transactional;
  11 +import org.springframework.util.CollectionUtils;
  12 +
  13 +import java.util.HashMap;
  14 +import java.util.List;
  15 +import java.util.Map;
  16 +
  17 +/**
  18 + * Created by xu on 16/5/9.
  19 + */
  20 +@Service
  21 +public class CarConfigInfoServiceImpl extends BServiceImpl<CarConfigInfo, Long> implements CarConfigInfoService {
  22 + @Autowired
  23 + private ScheduleRule1FlatService scheduleRule1FlatService;
  24 +
  25 + @Transactional
  26 + public void validate_cars(CarConfigInfo carConfigInfo) throws ScheduleException {
  27 + // 相同车辆不能同时配置
  28 + Map<String, Object> param = new HashMap<>();
  29 + if (carConfigInfo.getId() != null) {
  30 + param.put("id_ne", carConfigInfo.getId());
  31 + }
  32 +
  33 + if (carConfigInfo.getXl() == null ||
  34 + carConfigInfo.getXl().getId() == null ||
  35 + carConfigInfo.getXl().getName() == null) {
  36 + throw new ScheduleException("线路未选择");
  37 + } else {
  38 +// param.put("xl.id_eq", carConfigInfo.getXl().getId());
  39 + if (carConfigInfo.getCl() == null || carConfigInfo.getCl().getId() == null) {
  40 + throw new ScheduleException("车辆未选择");
  41 + } else {
  42 + param.put("cl.id_eq", carConfigInfo.getCl().getId());
  43 + if (!CollectionUtils.isEmpty(list(param))) {
  44 + throw new ScheduleException("车辆已经配置在" + carConfigInfo.getXl().getName() + "线路中!");
  45 + }
  46 + }
  47 + }
  48 +
  49 + }
  50 +
  51 + @Transactional
  52 + @Override
  53 + public void delete(Long aLong) throws ScheduleException {
  54 + toggleCancel(aLong);
  55 + }
  56 +
  57 + @Transactional
  58 + public void toggleCancel(Long id) throws ScheduleException {
  59 + CarConfigInfo carConfigInfo = findById(id);
  60 + Map<String, Object> param = new HashMap<>();
  61 + if (carConfigInfo.getIsCancel()) {
  62 + validate_cars(carConfigInfo);
  63 + carConfigInfo.setIsCancel(false);
  64 + } else {
  65 + param.clear();
  66 + param.put("carConfigInfo.id_eq", carConfigInfo.getId());
  67 + List<ScheduleRule1Flat> scheduleRule1Flats = (List<ScheduleRule1Flat>) scheduleRule1FlatService.list(param);
  68 + if (CollectionUtils.isEmpty(scheduleRule1Flats)) {
  69 + carConfigInfo.setIsCancel(true);
  70 + } else {
  71 + throw new ScheduleException("车辆配置已被规则使用,不能作废,请先修改规则!");
  72 + }
  73 + }
  74 + }
  75 +
  76 +}
src/main/java/com/bsth/service/schedule/impl/EmployeeConfigInfoServiceImpl.java 0 → 100644
  1 +package com.bsth.service.schedule.impl;
  2 +
  3 +import com.bsth.entity.schedule.EmployeeConfigInfo;
  4 +import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
  5 +import com.bsth.service.schedule.EmployeeConfigInfoService;
  6 +import com.bsth.service.schedule.ScheduleException;
  7 +import com.bsth.service.schedule.ScheduleRule1FlatService;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.stereotype.Service;
  10 +import org.springframework.transaction.annotation.Transactional;
  11 +import org.springframework.util.CollectionUtils;
  12 +
  13 +import java.util.*;
  14 +
  15 +/**
  16 + * Created by xu on 16/5/10.
  17 + */
  18 +@Service
  19 +public class EmployeeConfigInfoServiceImpl extends BServiceImpl<EmployeeConfigInfo, Long> implements EmployeeConfigInfoService {
  20 + @Autowired
  21 + private ScheduleRule1FlatService scheduleRule1FlatService;
  22 +
  23 + @Transactional
  24 + @Override
  25 + public void validate_jsy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException {
  26 + // 驾驶员不能重复配置
  27 + Map<String, Object> param = new HashMap<>();
  28 + if (employeeConfigInfo.getId() != null) {
  29 + param.put("id_ne", employeeConfigInfo.getId());
  30 + }
  31 +
  32 + if (employeeConfigInfo.getXl() == null ||
  33 + employeeConfigInfo.getXl().getId() == null ||
  34 + employeeConfigInfo.getXl().getName() == null) {
  35 + throw new ScheduleException("线路未选择");
  36 + } else {
  37 + if (employeeConfigInfo.getJsy() == null || employeeConfigInfo.getJsy().getId() == null) {
  38 + throw new ScheduleException("驾驶员未选择");
  39 + } else {
  40 + param.put("jsy.id_eq", employeeConfigInfo.getJsy().getId());
  41 + if (!CollectionUtils.isEmpty(list(param))) {
  42 + throw new ScheduleException("驾驶员已经配置在" + employeeConfigInfo.getXl().getName() + "线路中!");
  43 + }
  44 + }
  45 + }
  46 + }
  47 +
  48 + @Transactional
  49 + @Override
  50 + public void validate_spy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException {
  51 + // 售票员不能重复配置
  52 + Map<String, Object> param = new HashMap<>();
  53 + if (employeeConfigInfo.getId() != null) {
  54 + param.put("id_ne", employeeConfigInfo.getId());
  55 + }
  56 +
  57 + if (employeeConfigInfo.getXl() == null ||
  58 + employeeConfigInfo.getXl().getId() == null ||
  59 + employeeConfigInfo.getXl().getName() == null) {
  60 + throw new ScheduleException("线路未选择");
  61 + } else {
  62 + if (employeeConfigInfo.getSpy() == null || employeeConfigInfo.getSpy().getId() == null) {
  63 + throw new ScheduleException("售票员未选择");
  64 + } else {
  65 + param.put("spy.id_eq", employeeConfigInfo.getSpy().getId());
  66 + if (!CollectionUtils.isEmpty(list(param))) {
  67 + throw new ScheduleException("售票员已经配置在" + employeeConfigInfo.getXl().getName() + "线路中!");
  68 + }
  69 + }
  70 + }
  71 + }
  72 +
  73 + @Transactional
  74 + @Override
  75 + public void delete(Long aLong) throws ScheduleException {
  76 + toggleCancel(aLong);
  77 + }
  78 +
  79 + @Transactional
  80 + @Override
  81 + public void toggleCancel(Long id) throws ScheduleException {
  82 + EmployeeConfigInfo employeeConfigInfo = findById(id);
  83 + Map<String, Object> param = new HashMap<>();
  84 + if (employeeConfigInfo.getIsCancel()) {
  85 + validate_jsy(employeeConfigInfo);
  86 + validate_spy(employeeConfigInfo);
  87 + employeeConfigInfo.setIsCancel(false);
  88 + } else {
  89 + param.clear();
  90 + param.put("xl.id_eq", employeeConfigInfo.getXl().getId());
  91 + List<ScheduleRule1Flat> scheduleRule1Flats = (List<ScheduleRule1Flat>) scheduleRule1FlatService.list(param);
  92 + List<String> ryConfigIds = new ArrayList<>();
  93 + for (ScheduleRule1Flat scheduleRule1Flat : scheduleRule1Flats) {
  94 + ryConfigIds.addAll(Arrays.asList(scheduleRule1Flat.getRyConfigIds().split(",")));
  95 + }
  96 +
  97 + if (ryConfigIds.contains(String.valueOf(id))) {
  98 + throw new ScheduleException("人员配置已被规则使用,不能作废,请先修改规则!");
  99 + } else {
  100 + employeeConfigInfo.setIsCancel(true);
  101 + }
  102 + }
  103 + }
  104 +
  105 +}
src/main/resources/static/pages/scheduleApp/module/common/dts1/validation/remoteValidation.js
@@ -83,9 +83,9 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidation&#39;, [ @@ -83,9 +83,9 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidation&#39;, [
83 */ 83 */
84 attr.$observe("remotevparam", function(value) { 84 attr.$observe("remotevparam", function(value) {
85 if (value && value != "") { 85 if (value && value != "") {
86 - if (!ngModelCtrl.$dirty) { // 没有修改过模型数据,不验证  
87 - return;  
88 - } 86 + //if (!ngModelCtrl.$dirty) { // 没有修改过模型数据,不验证
  87 + // return;
  88 + //}
89 $watch_rvparam_obj = JSON.parse(value); 89 $watch_rvparam_obj = JSON.parse(value);
90 $$internal_validate(ngModelCtrl, scope); 90 $$internal_validate(ngModelCtrl, scope);
91 } 91 }
src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
@@ -105,9 +105,9 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidation&#39;, [ @@ -105,9 +105,9 @@ angular.module(&#39;ScheduleApp&#39;).directive(&#39;remoteValidation&#39;, [
105 */ 105 */
106 attr.$observe("remotevparam", function(value) { 106 attr.$observe("remotevparam", function(value) {
107 if (value && value != "") { 107 if (value && value != "") {
108 - if (!ngModelCtrl.$dirty) { // 没有修改过模型数据,不验证  
109 - return;  
110 - } 108 + //if (!ngModelCtrl.$dirty) { // 没有修改过模型数据,不验证
  109 + // return;
  110 + //}
111 $watch_rvparam_obj = JSON.parse(value); 111 $watch_rvparam_obj = JSON.parse(value);
112 $$internal_validate(ngModelCtrl, scope); 112 $$internal_validate(ngModelCtrl, scope);
113 } 113 }
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice-legacy.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 -  
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 - 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 + cc_cars: { // 车辆不能重复配置
  332 + template: {'xl.id_eq': -1, 'xl.name_eq': '-1', 'cl.id_eq': -1}, // 查询参数模版
  333 + remote: $resource( // $resource封装对象
  334 + '/cci/validate_cars',
  335 + {},
  336 + {
  337 + do: {
  338 + method: 'GET'
  339 + }
  340 + }
  341 + )
  342 + },
  343 + ec_jsy: { // 驾驶员不能重复配置
  344 + template: {'xl.id_eq': -1, 'xl.name_eq': '-1', 'jsy.id_eq': -1}, // 查询参数模版
  345 + remote: $resource( // $resource封装对象
  346 + '/eci/validate_jsy',
  347 + {},
  348 + {
  349 + do: {
  350 + method: 'GET'
  351 + }
  352 + }
  353 + )
  354 + },
  355 + ec_spy: { // 售票员不能重复配置
  356 + template: {'xl.id_eq': -1, 'xl.name_eq': '-1', 'spy.id_eq': -1}, // 查询参数模版
  357 + remote: $resource( // $resource封装对象
  358 + '/eci/validate_spy',
  359 + {},
  360 + {
  361 + do: {
  362 + method: 'GET'
  363 + }
  364 + }
  365 + )
  366 + },
  367 +
  368 + cde1: { // 车辆设备启用日期验证
  369 + template: {'qyrq': 0, 'xl': 1, 'cl': 1}, // 日期毫秒
  370 + remote: $resource( // $resource封装对象
  371 + '/cde//validate/qyrq',
  372 + {},
  373 + {
  374 + do: {
  375 + method: 'GET'
  376 + }
  377 + }
  378 + )
  379 + },
  380 + ttc1: { // 时刻表名字验证
  381 + template: {'xl.id_eq': -1, 'name_eq': 'ddd'},
  382 + remote: $resource( // $resource封装对象
  383 + '/tic/validate/equale',
  384 + {},
  385 + {
  386 + do: {
  387 + method: 'GET'
  388 + }
  389 + }
  390 + )
  391 + },
  392 + sheet: { // 时刻表sheet工作区验证
  393 + template: {'filename': '', 'sheetname': '', 'lineid': -1, 'linename': ''},
  394 + remote: $resource( // $resource封装对象
  395 + '/tidc/validate/sheet',
  396 + {},
  397 + {
  398 + do: {
  399 + method: 'POST',
  400 + headers: {
  401 + 'Content-Type': 'application/x-www-form-urlencoded'
  402 + },
  403 + transformRequest: function(obj) {
  404 + var str = [];
  405 + for (var p in obj) {
  406 + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  407 + }
  408 + return str.join("&");
  409 + }
  410 + }
  411 + }
  412 + )
  413 + },
  414 + sheetli: { // 时刻表线路标准验证
  415 + template: {'lineinfoid': -1},
  416 + remote: $resource( // $resource封装对象
  417 + '/tidc/validate/lineinfo',
  418 + {},
  419 + {
  420 + do: {
  421 + method: 'GET'
  422 + }
  423 + }
  424 + )
  425 + }
  426 + }
  427 +
  428 + //validate: $resource(
  429 + // '/cars/validate/:type',
  430 + // {},
  431 + // {
  432 + // insideCode: {
  433 + // method: 'GET'
  434 + // }
  435 + // }
  436 + //)
  437 +
  438 +
  439 +
  440 + }
  441 +}]);
  442 +
  443 +
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
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 - 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 + transformResponse: function(rs) {
  171 + var dst = angular.fromJson(rs);
  172 + if (dst.status == 'SUCCESS') {
  173 + return dst.data;
  174 + } else {
  175 + return dst; // 业务错误留给控制器处理
  176 + }
  177 + }
  178 + },
  179 + get: {
  180 + method: 'GET',
  181 + transformResponse: function(rs) {
  182 + var dst = angular.fromJson(rs);
  183 + if (dst.status == 'SUCCESS') {
  184 + return dst.data;
  185 + } else {
  186 + return dst;
  187 + }
  188 + }
  189 + },
  190 + save: {
  191 + method: 'POST'
  192 + }
  193 + }
  194 + )
  195 + };
  196 +}]);
  197 +// 线路运营统计service
  198 +angular.module('ScheduleApp').factory('BusLineInfoStatService_g', ['$resource', function($resource) {
  199 + return $resource(
  200 + '/bic/:id',
  201 + {order: 'createDate', direction: 'DESC', id: '@id_route'}, // TODO:以后需要根据属性对象的属性查询
  202 + {
  203 + list: {
  204 + method: 'GET',
  205 + params: {
  206 + page: 0
  207 + }
  208 + }
  209 + }
  210 + );
  211 +}]);
  212 +
  213 +// 人员配置service
  214 +angular.module('ScheduleApp').factory('EmployeeConfigService_g', ['$resource', function($resource) {
  215 + return {
  216 + rest : $resource(
  217 + '/eci/:id',
  218 + {order: 'xl.id,isCancel,dbbmFormula', direction: 'ASC', id: '@id_route'},
  219 + {
  220 + list: {
  221 + method: 'GET',
  222 + params: {
  223 + page: 0
  224 + },
  225 + transformResponse: function(rs) {
  226 + var dst = angular.fromJson(rs);
  227 + if (dst.status == 'SUCCESS') {
  228 + return dst.data;
  229 + } else {
  230 + return dst; // 业务错误留给控制器处理
  231 + }
  232 + }
  233 + },
  234 + get: {
  235 + method: 'GET',
  236 + transformResponse: function(rs) {
  237 + var dst = angular.fromJson(rs);
  238 + if (dst.status == 'SUCCESS') {
  239 + return dst.data;
  240 + } else {
  241 + return dst;
  242 + }
  243 + }
  244 + },
  245 + save: {
  246 + method: 'POST'
  247 + },
  248 + delete: {
  249 + method: 'DELETE'
  250 + }
  251 + }
  252 + ),
  253 + validate: $resource( // TODO:
  254 + '/personnel/validate/:type',
  255 + {},
  256 + {
  257 + jobCode: {
  258 + method: 'GET'
  259 + }
  260 + }
  261 + )
  262 + };
  263 +}]);
  264 +// 路牌管理service
  265 +angular.module('ScheduleApp').factory('GuideboardManageService_g', ['$resource', function($resource) {
  266 + return {
  267 + rest: $resource(
  268 + '/gic/:id',
  269 + {order: 'xl,isCancel', direction: 'DESC,ASC', id: '@id_route'},
  270 + {
  271 + list: {
  272 + method: 'GET',
  273 + params: {
  274 + page: 0
  275 + },
  276 + transformResponse: function(rs) {
  277 + var dst = angular.fromJson(rs);
  278 + if (dst.status == 'SUCCESS') {
  279 + return dst.data;
  280 + } else {
  281 + return dst;
  282 + }
  283 + }
  284 + },
  285 + get: {
  286 + method: 'GET',
  287 + transformResponse: function(rs) {
  288 + var dst = angular.fromJson(rs);
  289 + if (dst.status == 'SUCCESS') {
  290 + return dst.data;
  291 + } else {
  292 + return dst;
  293 + }
  294 + }
  295 + },
  296 + save: {
  297 + method: 'POST'
  298 + }
  299 + // 内部还有默认的方法delete
  300 + }
  301 + )
  302 + };
  303 +}]);
  304 +// 套跑管理service
  305 +angular.module('ScheduleApp').factory('rerunManageService_g', ['$resource', function($resource) {
  306 + return {
  307 + rest: $resource(
  308 + 'rms/:id',
  309 + {order: 'rerunXl.id,isCancel', direction: 'ASC', id: '@id_route'},
  310 + {
  311 + list: {
  312 + method: 'GET',
  313 + params: {
  314 + page: 0
  315 + }
  316 + },
  317 + get: {
  318 + method: 'GET'
  319 + },
  320 + save: {
  321 + method: 'POST'
  322 + },
  323 + delete: {
  324 + method: 'DELETE'
  325 + }
  326 + }
  327 + )
  328 + };
  329 +}]);
  330 +// 排班计划管理service
  331 +angular.module('ScheduleApp').factory('SchedulePlanManageService_g', ['$resource', function($resource) {
  332 + return {
  333 + rest : $resource(
  334 + '/spc/:id',
  335 + {order: 'xl.id,createDate', direction: 'DESC,DESC', id: '@id_route'},
  336 + {
  337 + list: {
  338 + method: 'GET',
  339 + params: {
  340 + page: 0
  341 + }
  342 + },
  343 + get: {
  344 + method: 'GET'
  345 + },
  346 + save: {
  347 + method: 'POST'
  348 + },
  349 + delete: {
  350 + method: 'DELETE'
  351 + }
  352 + }
  353 + ),
  354 + tommorw: $resource(
  355 + '/spc/tommorw',
  356 + {},
  357 + {
  358 + list: {
  359 + method: 'GET'
  360 + }
  361 + }
  362 + )
  363 + };
  364 +}]);
  365 +
  366 +// 排班计划明细管理service
  367 +angular.module('ScheduleApp').factory('SchedulePlanInfoManageService_g', ['$resource', function($resource) {
  368 + return {
  369 + rest : $resource(
  370 + '/spic/:id',
  371 + {order: 'scheduleDate,lp,fcno', direction: 'ASC,ASC,ASC', id: '@id_route'},
  372 + {
  373 + list: {
  374 + method: 'GET',
  375 + params: {
  376 + page: 0
  377 + }
  378 + },
  379 + get: {
  380 + method: 'GET'
  381 + },
  382 + save: {
  383 + method: 'POST'
  384 + }
  385 + }
  386 + ),
  387 + groupinfo : $resource(
  388 + '/spic/groupinfos/:xlid/:sdate',
  389 + {},
  390 + {
  391 + list: {
  392 + method: 'GET',
  393 + isArray: true
  394 + }
  395 + }
  396 + ),
  397 + updateGroupInfo : $resource(
  398 + '/spic/groupinfos/update',
  399 + {},
  400 + {
  401 + update: {
  402 + method: 'POST'
  403 + }
  404 + }
  405 + )
  406 + };
  407 +}]);
  408 +// 排班管理service
  409 +angular.module('ScheduleApp').factory('ScheduleRuleManageService_g', ['$resource', function($resource) {
  410 + return {
  411 + rest: $resource(
  412 + '/sr1fc/:id',
  413 + {order: 'createDate', direction: 'DESC', id: '@id_route'},
  414 + {
  415 + list: {
  416 + method: 'GET',
  417 + params: {
  418 + page: 0
  419 + }
  420 + },
  421 + get: {
  422 + method: 'GET'
  423 + },
  424 + save: {
  425 + method: 'POST'
  426 + },
  427 + delete: {
  428 + method: 'DELETE'
  429 + }
  430 + }
  431 + )
  432 + };
  433 +}]);
  434 +
  435 +// 时刻表管理service
  436 +angular.module('ScheduleApp').factory('TimeTableManageService_g', ['$resource', function($resource) {
  437 + return {
  438 + rest: $resource(
  439 + '/tic/:id',
  440 + {order: 'xl,isCancel,isEnableDisTemplate,qyrq', direction: 'DESC,ASC,DESC,DESC', id: '@id'},
  441 + {
  442 + list: {
  443 + method: 'GET',
  444 + params: {
  445 + page: 0
  446 + }
  447 + }
  448 + }
  449 + )
  450 + };
  451 +}]);
  452 +
  453 +// 时刻表明细管理service
  454 +angular.module('ScheduleApp').factory('TimeTableDetailManageService_g', ['$resource', function($resource) {
  455 + return {
  456 + rest: $resource(
  457 + '/tidc/:id',
  458 + {order: 'createDate', direction: 'DESC', id: '@id_route'},
  459 + {
  460 + get: {
  461 + method: 'GET'
  462 + },
  463 + save: {
  464 + method: 'POST'
  465 + }
  466 + }
  467 + ),
  468 + import: $resource(
  469 + '/tidc/importfile',
  470 + {},
  471 + {
  472 + do: {
  473 + method: 'POST',
  474 + headers: {
  475 + 'Content-Type': 'application/x-www-form-urlencoded'
  476 + },
  477 + transformRequest: function(obj) {
  478 + var str = [];
  479 + for (var p in obj) {
  480 + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  481 + }
  482 + return str.join("&");
  483 + }
  484 + }
  485 + }
  486 + ),
  487 + edit: $resource(
  488 + '/tidc/edit/:xlid/:ttid',
  489 + {},
  490 + {
  491 + list: {
  492 + method: 'GET'
  493 + }
  494 + }
  495 + ),
  496 + bcdetails: $resource(
  497 + '/tidc/bcdetail',
  498 + {},
  499 + {
  500 + list: {
  501 + method: 'GET',
  502 + isArray: true
  503 + }
  504 + }
  505 + ),
  506 + dataTools: $resource(
  507 + '/tidc/:type',
  508 + {},
  509 + {
  510 + dataExport: {
  511 + method: 'GET',
  512 + responseType: "arraybuffer",
  513 + params: {
  514 + type: "dataExportExt"
  515 + },
  516 + transformResponse: function(data, headers){
  517 + return {data : data};
  518 + }
  519 + }
  520 + }
  521 + )
  522 +
  523 + // TODO:导入数据
  524 + };
  525 +}]);
  526 +// 项目通用的全局service服务,供不同的controller使用,自定义指令不使用
  527 +
  528 +// 文件下载服务
  529 +angular.module('ScheduleApp').factory('FileDownload_g', function() {
  530 + return {
  531 + downloadFile: function (data, mimeType, fileName) {
  532 + var success = false;
  533 + var blob = new Blob([data], { type: mimeType });
  534 + try {
  535 + if (navigator.msSaveBlob)
  536 + navigator.msSaveBlob(blob, fileName);
  537 + else {
  538 + // Try using other saveBlob implementations, if available
  539 + var saveBlob = navigator.webkitSaveBlob || navigator.mozSaveBlob || navigator.saveBlob;
  540 + if (saveBlob === undefined) throw "Not supported";
  541 + saveBlob(blob, fileName);
  542 + }
  543 + success = true;
  544 + } catch (ex) {
  545 + console.log("saveBlob method failed with the following exception:");
  546 + console.log(ex);
  547 + }
  548 +
  549 + if (!success) {
  550 + // Get the blob url creator
  551 + var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;
  552 + if (urlCreator) {
  553 + // Try to use a download link
  554 + var link = document.createElement('a');
  555 + if ('download' in link) {
  556 + // Try to simulate a click
  557 + try {
  558 + // Prepare a blob URL
  559 + var url = urlCreator.createObjectURL(blob);
  560 + link.setAttribute('href', url);
  561 +
  562 + // Set the download attribute (Supported in Chrome 14+ / Firefox 20+)
  563 + link.setAttribute("download", fileName);
  564 +
  565 + // Simulate clicking the download link
  566 + var event = document.createEvent('MouseEvents');
  567 + event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
  568 + link.dispatchEvent(event);
  569 + success = true;
  570 +
  571 + } catch (ex) {
  572 + console.log("Download link method with simulated click failed with the following exception:");
  573 + console.log(ex);
  574 + }
  575 + }
  576 +
  577 + if (!success) {
  578 + // Fallback to window.location method
  579 + try {
  580 + // Prepare a blob URL
  581 + // Use application/octet-stream when using window.location to force download
  582 + var url = urlCreator.createObjectURL(blob);
  583 + window.location = url;
  584 + console.log("Download link method with window.location succeeded");
  585 + success = true;
  586 + } catch (ex) {
  587 + console.log("Download link method with window.location failed with the following exception:");
  588 + console.log(ex);
  589 + }
  590 + }
  591 + }
  592 + }
  593 +
  594 + if (!success) {
  595 + // Fallback to window.open method
  596 + console.log("No methods worked for saving the arraybuffer, using last resort window.open");
  597 + window.open("", '_blank', '');
  598 + }
  599 + }
  600 + };
  601 +});
  602 +
  603 +
  604 +/**
  605 + * saSelect2指令,根据属性值,动态载入数据,然后支持拼音搜索,点击右边的按钮清除选择并重新载入数据。
  606 + * 1、compile阶段使用的属性如下:
  607 + * required:用于和表单验证连接,指定成required="true"才有效。
  608 + * 2、link阶段使用的属性如下
  609 + * model:关联的模型对象
  610 + * name:表单验证时需要的名字
  611 + * type:关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加
  612 + * modelcolname1:关联的模型字段名字1(一般应该是编码字段)
  613 + * modelcolname2:关联的模型字段名字2(一般应该是名字字段)
  614 + * datacolname1;内部数据对应的字段名字1(与模型字段1对应)
  615 + * datacolname2:内部数据对应的字段名字2(与模型字段2对应)
  616 + * showcolname:下拉框显示的内部数据字段名(注意:不是模型数据字段名),TODO:以后考虑放动态表达式,并在compile阶段使用
  617 + * placeholder:select placeholder字符串描述
  618 + *
  619 + * $$pyFilter,内部的filter指令,结合简拼音进行拼音过滤。
  620 + * $$SearchInfoService_g,内部使用的数据服务
  621 + */
  622 +// saSelect2指令使用的内部信service
  623 +angular.module('ScheduleApp').factory('$$SearchInfoService_g', ['$resource', function($resource) {
  624 + return {
  625 + xl: $resource(
  626 + '/line/:type',
  627 + {order: 'name', direction: 'ASC'},
  628 + {
  629 + list: {
  630 + method: 'GET',
  631 + isArray: true
  632 + }
  633 + }
  634 + ),
  635 + xlinfo: $resource(
  636 + '/lineInformation/:type',
  637 + {order: 'line.name', direction: 'ASC'},
  638 + {
  639 + list: {
  640 + method: 'GET',
  641 + isArray: true
  642 + }
  643 + }
  644 + ),
  645 + zd: $resource(
  646 + '/stationroute/stations',
  647 + {order: 'stationCode', direction: 'ASC'},
  648 + {
  649 + list: {
  650 + method: 'GET',
  651 + isArray: true
  652 + }
  653 + }
  654 + ),
  655 + tcc: $resource(
  656 + '/carpark/:type',
  657 + {order: 'parkCode', direction: 'ASC'},
  658 + {
  659 + list: {
  660 + method: 'GET',
  661 + isArray: true
  662 + }
  663 + }
  664 + ),
  665 + ry: $resource(
  666 + '/personnel/:type',
  667 + {order: 'personnelName', direction: 'ASC'},
  668 + {
  669 + list: {
  670 + method: 'GET',
  671 + isArray: true
  672 + }
  673 + }
  674 + ),
  675 + cl: $resource(
  676 + '/cars/:type',
  677 + {order: "insideCode", direction: 'ASC'},
  678 + {
  679 + list: {
  680 + method: 'GET',
  681 + isArray: true
  682 + }
  683 + }
  684 + ),
  685 + ttInfo: $resource(
  686 + '/tic/:type',
  687 + {order: "name", direction: 'ASC'},
  688 + {
  689 + list: {
  690 + method: 'GET',
  691 + isArray: true
  692 + }
  693 + }
  694 + ),
  695 + lpInfo: $resource(
  696 + '/gic/ttlpnames',
  697 + {order: "lpName", direction: 'ASC'},
  698 + {
  699 + list: {
  700 + method: 'GET',
  701 + isArray: true
  702 + }
  703 + }
  704 + ),
  705 + lpInfo2: $resource(
  706 + '/gic/:type',
  707 + {order: "lpName", direction: 'ASC'},
  708 + {
  709 + list: {
  710 + method: 'GET',
  711 + isArray: true
  712 + }
  713 + }
  714 + ),
  715 + cci: $resource(
  716 + '/cci/cars',
  717 + {},
  718 + {
  719 + list: {
  720 + method: 'GET',
  721 + isArray: true
  722 + }
  723 + }
  724 +
  725 + ),
  726 + cci2: $resource(
  727 + '/cci/:type',
  728 + {},
  729 + {
  730 + list: {
  731 + method: 'GET',
  732 + isArray: true
  733 + }
  734 + }
  735 + ),
  736 + cci3: $resource(
  737 + '/cci/cars2',
  738 + {},
  739 + {
  740 + list: {
  741 + method: 'GET',
  742 + isArray: true
  743 + }
  744 + }
  745 +
  746 + ),
  747 + eci: $resource(
  748 + '/eci/jsy',
  749 + {},
  750 + {
  751 + list: {
  752 + method: 'GET',
  753 + isArray: true
  754 + }
  755 + }
  756 + ),
  757 + eci2: $resource(
  758 + '/eci/spy',
  759 + {},
  760 + {
  761 + list: {
  762 + method: 'GET',
  763 + isArray: true
  764 + }
  765 + }
  766 + ),
  767 + eci3: $resource(
  768 + '/eci/:type',
  769 + {},
  770 + {
  771 + list: {
  772 + method: 'GET',
  773 + isArray: true
  774 + }
  775 + }
  776 + ),
  777 +
  778 +
  779 + validate: { // remoteValidation指令用到的resource
  780 + gbv1: { // 路牌序号验证
  781 + template: {'xl.id_eq': -1, 'lpNo_eq': 'ddd'},
  782 + remote: $resource(
  783 + '/gic/validate1',
  784 + {},
  785 + {
  786 + do: {
  787 + method: 'GET'
  788 + }
  789 + }
  790 + )
  791 + },
  792 + gbv2: { // 路牌名称验证
  793 + template: {'xl.id_eq': -1, 'lpName_eq': 'ddd'},
  794 + remote: $resource(
  795 + '/gic/validate2',
  796 + {},
  797 + {
  798 + do: {
  799 + method: 'GET'
  800 + }
  801 + }
  802 + )
  803 + },
  804 +
  805 + cars_zbh: { // 自编号验证
  806 + template: {'insideCode_eq': '-1'}, // 查询参数模版
  807 + remote: $resource( // $resource封装对象
  808 + '/cars_sc/validate_zbh',
  809 + {},
  810 + {
  811 + do: {
  812 + method: 'GET'
  813 + }
  814 + }
  815 + )
  816 + },
  817 +
  818 + cars_sbbh: { // 验证设备编号
  819 + template: {'equipmentCode_eq': '-1'}, // 查询参数模版
  820 + remote: $resource( // $resource封装对象
  821 + '/cars_sc/validate_sbbh',
  822 + {},
  823 + {
  824 + do: {
  825 + method: 'GET'
  826 + }
  827 + }
  828 + )
  829 + },
  830 +
  831 + cars_clbh: { // 车辆编号验证
  832 + template: {'carCode_eq': '-1'}, // 查询参数模版
  833 + remote: $resource( // $resource封装对象
  834 + '/cars_sc/validate_clbh',
  835 + {},
  836 + {
  837 + do: {
  838 + method: 'GET'
  839 + }
  840 + }
  841 + )
  842 + },
  843 +
  844 + cars_cph: { // 车牌号验证
  845 + template: {'carPlate_eq': '-1'}, // 查询参数模版
  846 + remote: $resource( // $resource封装对象
  847 + '/cars_sc/validate_cph',
  848 + {},
  849 + {
  850 + do: {
  851 + method: 'GET'
  852 + }
  853 + }
  854 + )
  855 + },
  856 + cc_cars: { // 车辆不能重复配置
  857 + template: {'xl.id_eq': -1, 'xl.name_eq': '-1', 'cl.id_eq': -1}, // 查询参数模版
  858 + remote: $resource( // $resource封装对象
  859 + '/cci/validate_cars',
  860 + {},
  861 + {
  862 + do: {
  863 + method: 'GET'
  864 + }
  865 + }
  866 + )
  867 + },
  868 + ec_jsy: { // 驾驶员不能重复配置
  869 + template: {'xl.id_eq': -1, 'xl.name_eq': '-1', 'jsy.id_eq': -1}, // 查询参数模版
  870 + remote: $resource( // $resource封装对象
  871 + '/eci/validate_jsy',
  872 + {},
  873 + {
  874 + do: {
  875 + method: 'GET'
  876 + }
  877 + }
  878 + )
  879 + },
  880 + ec_spy: { // 售票员不能重复配置
  881 + template: {'xl.id_eq': -1, 'xl.name_eq': '-1', 'spy.id_eq': -1}, // 查询参数模版
  882 + remote: $resource( // $resource封装对象
  883 + '/eci/validate_spy',
  884 + {},
  885 + {
  886 + do: {
  887 + method: 'GET'
  888 + }
  889 + }
  890 + )
  891 + },
  892 +
  893 + cde1: { // 车辆设备启用日期验证
  894 + template: {'qyrq': 0, 'xl': 1, 'cl': 1}, // 日期毫秒
  895 + remote: $resource( // $resource封装对象
  896 + '/cde//validate/qyrq',
  897 + {},
  898 + {
  899 + do: {
  900 + method: 'GET'
  901 + }
  902 + }
  903 + )
  904 + },
  905 + ttc1: { // 时刻表名字验证
  906 + template: {'xl.id_eq': -1, 'name_eq': 'ddd'},
  907 + remote: $resource( // $resource封装对象
  908 + '/tic/validate/equale',
  909 + {},
  910 + {
  911 + do: {
  912 + method: 'GET'
  913 + }
  914 + }
  915 + )
  916 + },
  917 + sheet: { // 时刻表sheet工作区验证
  918 + template: {'filename': '', 'sheetname': '', 'lineid': -1, 'linename': ''},
  919 + remote: $resource( // $resource封装对象
  920 + '/tidc/validate/sheet',
  921 + {},
  922 + {
  923 + do: {
  924 + method: 'POST',
  925 + headers: {
  926 + 'Content-Type': 'application/x-www-form-urlencoded'
  927 + },
  928 + transformRequest: function(obj) {
  929 + var str = [];
  930 + for (var p in obj) {
  931 + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
  932 + }
  933 + return str.join("&");
  934 + }
  935 + }
  936 + }
  937 + )
  938 + },
  939 + sheetli: { // 时刻表线路标准验证
  940 + template: {'lineinfoid': -1},
  941 + remote: $resource( // $resource封装对象
  942 + '/tidc/validate/lineinfo',
  943 + {},
  944 + {
  945 + do: {
  946 + method: 'GET'
  947 + }
  948 + }
  949 + )
  950 + }
  951 + }
  952 +
  953 + //validate: $resource(
  954 + // '/cars/validate/:type',
  955 + // {},
  956 + // {
  957 + // insideCode: {
  958 + // method: 'GET'
  959 + // }
  960 + // }
  961 + //)
  962 +
  963 +
  964 +
  965 + }
  966 +}]);
  967 +
  968 +
  969 +
src/main/resources/static/pages/scheduleApp/module/core/busConfig/edit.html
@@ -76,11 +76,19 @@ @@ -76,11 +76,19 @@
76 searchexp="this.insideCode" 76 searchexp="this.insideCode"
77 required > 77 required >
78 </sa-Select5> 78 </sa-Select5>
  79 + <input type="hidden" name="cl_h" ng-model="ctrl.busConfigForSave.cl.id"
  80 + remote-Validation
  81 + remotevtype="cc_cars"
  82 + remotevparam="{{ {'xl.id_eq': ctrl.busConfigForSave.xl.id, 'xl.name_eq': ctrl.busConfigForSave.xl.name, 'cl.id_eq': ctrl.busConfigForSave.cl.id} | json}}"
  83 + />
79 </div> 84 </div>
80 <!-- 隐藏块,显示验证信息 --> 85 <!-- 隐藏块,显示验证信息 -->
81 <div class="alert alert-danger well-sm" ng-show="myForm.cl.$error.required"> 86 <div class="alert alert-danger well-sm" ng-show="myForm.cl.$error.required">
82 车辆必须选择 87 车辆必须选择
83 </div> 88 </div>
  89 + <div class="alert alert-danger well-sm" ng-show="myForm.cl_h.$error.remote">
  90 + {{$remote_msg}}
  91 + </div>
84 </div> 92 </div>
85 93
86 <div class="form-group has-success has-feedback"> 94 <div class="form-group has-success has-feedback">
src/main/resources/static/pages/scheduleApp/module/core/busConfig/form.html
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 <div class="col-md-3"> 45 <div class="col-md-3">
46 <sa-Select5 name="xl" 46 <sa-Select5 name="xl"
47 model="ctrl.busConfigForSave" 47 model="ctrl.busConfigForSave"
48 - cmaps="{'xl.id': 'id'}" 48 + cmaps="{'xl.id': 'id', 'xl.name': 'name'}"
49 dcname="xl.id" 49 dcname="xl.id"
50 icname="id" 50 icname="id"
51 dsparams="{{ {type: 'ajax', param:{type: 'all', 'destroy_eq': 0}, atype:'xl' } | json }}" 51 dsparams="{{ {type: 'ajax', param:{type: 'all', 'destroy_eq': 0}, atype:'xl' } | json }}"
@@ -76,11 +76,19 @@ @@ -76,11 +76,19 @@
76 searchexp="this.insideCode" 76 searchexp="this.insideCode"
77 required > 77 required >
78 </sa-Select5> 78 </sa-Select5>
  79 + <input type="hidden" name="cl_h" ng-model="ctrl.busConfigForSave.cl.id"
  80 + remote-Validation
  81 + remotevtype="cc_cars"
  82 + remotevparam="{{ {'xl.id_eq': ctrl.busConfigForSave.xl.id, 'xl.name_eq': ctrl.busConfigForSave.xl.name, 'cl.id_eq': ctrl.busConfigForSave.cl.id} | json}}"
  83 + />
79 </div> 84 </div>
80 <!-- 隐藏块,显示验证信息 --> 85 <!-- 隐藏块,显示验证信息 -->
81 <div class="alert alert-danger well-sm" ng-show="myForm.cl.$error.required"> 86 <div class="alert alert-danger well-sm" ng-show="myForm.cl.$error.required">
82 车辆必须选择 87 车辆必须选择
83 </div> 88 </div>
  89 + <div class="alert alert-danger well-sm" ng-show="myForm.cl_h.$error.remote">
  90 + {{$remote_msg}}
  91 + </div>
84 </div> 92 </div>
85 93
86 <div class="form-group has-success has-feedback"> 94 <div class="form-group has-success has-feedback">
src/main/resources/static/pages/scheduleApp/module/core/busConfig/list.html
@@ -36,16 +36,16 @@ @@ -36,16 +36,16 @@
36 <td></td> 36 <td></td>
37 <td> 37 <td>
38 <label class="checkbox-inline input"> 38 <label class="checkbox-inline input">
39 - <input type="checkbox" ng-model="ctrl.searchCondition()['isCancel_eq']" />作废 39 + <input type="checkbox" ng-model="ctrl.searchCondition()['isCancel_eq']" />作废
40 </label> 40 </label>
41 </td> 41 </td>
42 <td> 42 <td>
43 <button class="btn btn-sm green btn-outline filter-submit margin-bottom" 43 <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
44 - ng-click="ctrl.pageChanaged()"> 44 + ng-click="ctrl.doPage()">
45 <i class="fa fa-search"></i> 搜索</button> 45 <i class="fa fa-search"></i> 搜索</button>
46 46
47 <button class="btn btn-sm red btn-outline filter-cancel" 47 <button class="btn btn-sm red btn-outline filter-cancel"
48 - ng-click="ctrl.resetSearchCondition()"> 48 + ng-click="ctrl.reset()">
49 <i class="fa fa-times"></i> 重置</button> 49 <i class="fa fa-times"></i> 重置</button>
50 </td> 50 </td>
51 51
@@ -53,7 +53,7 @@ @@ -53,7 +53,7 @@
53 53
54 </thead> 54 </thead>
55 <tbody> 55 <tbody>
56 - <tr ng-repeat="info in ctrl.pageInfo.infos" ng-class="{odd: true, gradeX: true, danger: info.isCancel}"> 56 + <tr ng-repeat="info in ctrl.page()['content']" ng-class="{odd: true, gradeX: true, danger: info.isCancel}">
57 <td> 57 <td>
58 <span ng-bind="$index + 1"></span> 58 <span ng-bind="$index + 1"></span>
59 </td> 59 </td>
@@ -81,8 +81,8 @@ @@ -81,8 +81,8 @@
81 <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>--> 81 <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>-->
82 <a ui-sref="busConfig_detail({id: info.id})" class="btn btn-info btn-sm"> 详细 </a> 82 <a ui-sref="busConfig_detail({id: info.id})" class="btn btn-info btn-sm"> 详细 </a>
83 <a ui-sref="busConfig_edit({id: info.id})" class="btn btn-info btn-sm" ng-if="info.isCancel == '0'"> 修改 </a> 83 <a ui-sref="busConfig_edit({id: info.id})" class="btn btn-info btn-sm" ng-if="info.isCancel == '0'"> 修改 </a>
84 - <a ng-click="ctrl.deleteEci(info.id)" class="btn btn-danger btn-sm" ng-if="info.isCancel == '0'"> 作废 </a>  
85 - <a ng-click="ctrl.redoDeleteEci(info.id)" class="btn btn-success btn-sm" ng-if="info.isCancel == '1'"> 撤销 </a> 84 + <a ng-click="ctrl.toggleBusConfig(info.id)" class="btn btn-danger btn-sm" ng-if="info.isCancel == '0'"> 作废 </a>
  85 + <a ng-click="ctrl.toggleBusConfig(info.id)" class="btn btn-success btn-sm" ng-if="info.isCancel == '1'"> 撤销 </a>
86 </td> 86 </td>
87 </tr> 87 </tr>
88 </tbody> 88 </tbody>
@@ -90,9 +90,9 @@ @@ -90,9 +90,9 @@
90 </div> 90 </div>
91 91
92 <div style="text-align: right;"> 92 <div style="text-align: right;">
93 - <uib-pagination total-items="ctrl.pageInfo.totalItems"  
94 - ng-model="ctrl.pageInfo.currentPage"  
95 - ng-change="ctrl.pageChanaged()" 93 + <uib-pagination total-items="ctrl.page()['totalElements']"
  94 + ng-model="ctrl.page()['uiNumber']"
  95 + ng-change="ctrl.doPage()"
96 rotate="false" 96 rotate="false"
97 max-size="10" 97 max-size="10"
98 boundary-links="true" 98 boundary-links="true"
src/main/resources/static/pages/scheduleApp/module/core/busConfig/module.js
1 // 车辆配置管理 service controller 等写在一起 1 // 车辆配置管理 service controller 等写在一起
2 -angular.module('ScheduleApp').factory('BusConfigService', ['BusConfigService_g', function(service) {  
3 - /** 当前的查询条件信息 */  
4 - var currentSearchCondition = {'isCancel_eq': false};  
5 -  
6 - /** 当前第几页 */  
7 - var currentPageNo = 1; 2 +angular.module('ScheduleApp').factory(
  3 + 'BusConfigService',
  4 + [
  5 + 'BusConfigService_g',
  6 + function(service) {
  7 + /** 当前的查询条件信息 */
  8 + var currentSearchCondition = {'isCancel_eq': false};
  9 +
  10 + // 当前查询返回的信息
  11 + var currentPage = { // 后台spring data返回的格式
  12 + totalElements: 0,
  13 + number: 0, // 后台返回的页码,spring返回从0开始
  14 + content: [],
  15 +
  16 + uiNumber: 1 // 页面绑定的页码
  17 + };
  18 +
  19 + // 查询对象
  20 + var queryClass = service.rest;
  21 +
  22 + return {
  23 + getQueryClass: function() {
  24 + return queryClass;
  25 + },
  26 + /**
  27 + * 获取查询条件信息,
  28 + * 用于给controller用来和页面数据绑定。
  29 + */
  30 + getSearchCondition: function() {
  31 + currentSearchCondition.page = currentPage.uiNumber - 1;
  32 + return currentSearchCondition;
  33 + },
  34 + /**
  35 + * 组装查询参数,返回一个promise查询结果。
  36 + * @param page 查询参数
  37 + * @return 返回一个 promise
  38 + */
  39 + getPage: function(page) {
  40 + if (page) {
  41 + currentPage.totalElements = page.totalElements;
  42 + currentPage.number = page.number;
  43 + currentPage.content = page.content;
  44 + }
  45 + return currentPage;
  46 + },
  47 + resetStatus: function() {
  48 + currentSearchCondition = {page: 0, 'isCancel_eq': false};
  49 + currentPage = {
  50 + totalElements: 0,
  51 + number: 0,
  52 + content: [],
  53 + uiNumber: 1
  54 + };
  55 + }
8 56
9 - return {  
10 - /**  
11 - * 获取查询条件信息,  
12 - * 用于给controller用来和页面数据绑定。  
13 - */  
14 - getSearchCondition: function() {  
15 - return currentSearchCondition;  
16 - },  
17 - /**  
18 - * 重置查询条件信息。  
19 - */  
20 - resetSearchCondition: function() {  
21 - var key;  
22 - for (key in currentSearchCondition) {  
23 - currentSearchCondition[key] = undefined;  
24 - }  
25 - currentSearchCondition['isCancel_eq'] = false;  
26 - },  
27 - /**  
28 - * 设置当前页码。  
29 - * @param cpn 从1开始,后台是从0开始的  
30 - */  
31 - setCurrentPageNo: function(cpn) {  
32 - currentPageNo = cpn;  
33 - },  
34 - /**  
35 - * 组装查询参数,返回一个promise查询结果。  
36 - * @param params 查询参数  
37 - * @return 返回一个 promise  
38 - */  
39 - getPage: function() {  
40 - var params = currentSearchCondition; // 查询条件  
41 - params.page = currentPageNo - 1; // 服务端页码从0开始  
42 - return service.rest.list(params).$promise;  
43 - },  
44 - /**  
45 - * 获取明细信息。  
46 - * @param id 车辆id  
47 - * @return 返回一个 promise  
48 - */  
49 - getDetail: function(id) {  
50 - var params = {id: id};  
51 - return service.rest.get(params).$promise;  
52 - },  
53 - /**  
54 - * 保存信息。  
55 - * @param obj 车辆详细信息  
56 - * @return 返回一个 promise  
57 - */  
58 - saveDetail: function(obj) {  
59 - return service.rest.save(obj).$promise;  
60 - },  
61 - /**  
62 - * 删除信息。  
63 - * @param id 主键id  
64 - * @returns {*|Function|promise|n}  
65 - */  
66 - deleteDetail: function(id) {  
67 - return service.rest.delete({id: id}).$promise; 57 + };
68 } 58 }
69 - };  
70 -  
71 -}]);  
72 -  
73 -angular.module('ScheduleApp').controller('BusConfigCtrl', ['BusConfigService', '$state', '$uibModal', function(busConfigService, $state, $uibModal) {  
74 - var self = this;  
75 -  
76 - // 切换到form状态  
77 - self.goForm = function() {  
78 - //alert("切换");  
79 - $state.go("busConfig_form");  
80 - };  
81 -  
82 - // 导入excel  
83 - self.importData = function() {  
84 - // large方式弹出模态对话框  
85 - var modalInstance = $uibModal.open({  
86 - templateUrl: '/pages/scheduleApp/module/core/busConfig/dataImport.html',  
87 - size: "lg",  
88 - animation: true,  
89 - backdrop: 'static',  
90 - resolve: {  
91 - // 可以传值给controller  
92 - },  
93 - windowClass: 'center-modal',  
94 - controller: "BusConfigToolsCtrl",  
95 - controllerAs: "ctrl",  
96 - bindToController: true  
97 - });  
98 - modalInstance.result.then(  
99 - function() {  
100 - console.log("dataImport.html打开");  
101 - },  
102 - function() {  
103 - console.log("dataImport.html消失");  
104 - }  
105 - );  
106 - };  
107 -}]); 59 + ]
  60 +);
  61 +
  62 +angular.module('ScheduleApp').controller(
  63 + 'BusConfigCtrl',
  64 + [
  65 + 'BusConfigService',
  66 + '$state',
  67 + '$uibModal',
  68 + function(busConfigService, $state, $uibModal) {
  69 + var self = this;
  70 +
  71 + // 切换到form状态
  72 + self.goForm = function() {
  73 + //alert("切换");
  74 + $state.go("busConfig_form");
  75 + };
  76 +
  77 + // 导入excel
  78 + self.importData = function() {
  79 + // large方式弹出模态对话框
  80 + var modalInstance = $uibModal.open({
  81 + templateUrl: '/pages/scheduleApp/module/core/busConfig/dataImport.html',
  82 + size: "lg",
  83 + animation: true,
  84 + backdrop: 'static',
  85 + resolve: {
  86 + // 可以传值给controller
  87 + },
  88 + windowClass: 'center-modal',
  89 + controller: "BusConfigToolsCtrl",
  90 + controllerAs: "ctrl",
  91 + bindToController: true
  92 + });
  93 + modalInstance.result.then(
  94 + function() {
  95 + console.log("dataImport.html打开");
  96 + },
  97 + function() {
  98 + console.log("dataImport.html消失");
  99 + }
  100 + );
  101 + };
  102 + }
  103 + ]
  104 +);
108 105
109 angular.module('ScheduleApp').controller('BusConfigToolsCtrl', ['$modalInstance', 'FileUploader', function($modalInstance, FileUploader) { 106 angular.module('ScheduleApp').controller('BusConfigToolsCtrl', ['$modalInstance', 'FileUploader', function($modalInstance, FileUploader) {
110 var self = this; 107 var self = this;
@@ -142,205 +139,119 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;BusConfigToolsCtrl&#39;, [&#39;$modalInstance&#39; @@ -142,205 +139,119 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;BusConfigToolsCtrl&#39;, [&#39;$modalInstance&#39;
142 139
143 }]); 140 }]);
144 141
145 -angular.module('ScheduleApp').controller('BusConfigListCtrl', ['BusConfigService', function(busConfigService) {  
146 - var self = this;  
147 - self.pageInfo = {  
148 - totalItems : 0,  
149 - currentPage : 1,  
150 - infos: []  
151 - };  
152 -  
153 - // 初始创建的时候,获取一次列表数据  
154 - busConfigService.getPage().then(  
155 - function(result) {  
156 - self.pageInfo.totalItems = result.totalElements;  
157 - self.pageInfo.currentPage = result.number + 1;  
158 - self.pageInfo.infos = result.content;  
159 - busConfigService.setCurrentPageNo(result.number + 1);  
160 - },  
161 - function(result) {  
162 - alert("出错啦!");  
163 - }  
164 - );  
165 -  
166 - //$scope.$watch("ctrl.pageInfo.currentPage", function() {  
167 - // alert("dfdfdf");  
168 - //});  
169 -  
170 - // 翻页的时候调用  
171 - self.pageChanaged = function() {  
172 - busConfigService.setCurrentPageNo(self.pageInfo.currentPage);  
173 - busConfigService.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 - busConfigService.setCurrentPageNo(result.number + 1);  
179 - },  
180 - function(result) {  
181 - alert("出错啦!");  
182 - }  
183 - );  
184 - };  
185 - // 获取查询条件数据  
186 - self.searchCondition = function() {  
187 - return busConfigService.getSearchCondition();  
188 - };  
189 - // 重置查询条件  
190 - self.resetSearchCondition = function() {  
191 - busConfigService.resetSearchCondition();  
192 - self.pageInfo.currentPage = 1;  
193 - self.pageChanaged();  
194 - };  
195 -  
196 - // 删除时刻表  
197 - self.deleteEci = function(id) {  
198 - // TODO:  
199 - busConfigService.deleteDetail(id).then(  
200 - function(result) {  
201 - if (result.message) { // 暂时这样做,之后全局拦截  
202 - alert("失败:" + result.message);  
203 - } else {  
204 - alert("作废成功!");  
205 -  
206 - busConfigService.getPage().then(  
207 - function(result) {  
208 - self.pageInfo.totalItems = result.totalElements;  
209 - self.pageInfo.currentPage = result.number + 1;  
210 - self.pageInfo.infos = result.content;  
211 - busConfigService.setCurrentPageNo(result.number + 1);  
212 - },  
213 - function(result) {  
214 - alert("出错啦!");  
215 - }  
216 - );  
217 - }  
218 -  
219 - },  
220 - function(result) {  
221 - alert("出错啦!" + result);  
222 - }  
223 - );  
224 - };  
225 -  
226 - // 撤销修改  
227 - self.redoDeleteEci = function(id) {  
228 - busConfigService.getDetail(id).then(  
229 - function(result) {  
230 - result.isCancel = 'false';  
231 - busConfigService.saveDetail(result).then(  
232 - function(result) {  
233 - if (result.message) { // 暂时这样做,之后全局拦截  
234 - alert("失败:" + result.message);  
235 - } else {  
236 - alert("撤销成功!");  
237 -  
238 - busConfigService.getPage().then(  
239 - function(result) {  
240 - self.pageInfo.totalItems = result.totalElements;  
241 - self.pageInfo.currentPage = result.number + 1;  
242 - self.pageInfo.infos = result.content;  
243 - busConfigService.setCurrentPageNo(result.number + 1);  
244 - },  
245 - function(result) {  
246 - alert("出错啦!");  
247 - }  
248 - );  
249 - }  
250 - },  
251 - function(result) {  
252 - // TODO:弹出框方式以后改  
253 - alert("出错啦!"); 142 +// list.html控制器
  143 +angular.module('ScheduleApp').controller(
  144 + 'BusConfigListCtrl',
  145 + [
  146 + 'BusConfigService',
  147 + function(service) {
  148 + var self = this;
  149 + var BusConfig = service.getQueryClass();
  150 +
  151 + self.page = function() {
  152 + return service.getPage();
  153 + };
  154 +
  155 + self.searchCondition = function() {
  156 + return service.getSearchCondition();
  157 + };
  158 +
  159 + self.doPage = function() {
  160 + var page = BusConfig.list(self.searchCondition(), function() {
  161 + service.getPage(page);
  162 + });
  163 + };
  164 + self.reset = function() {
  165 + service.resetStatus();
  166 + var page = BusConfig.list(self.searchCondition(), function() {
  167 + service.getPage(page);
  168 + });
  169 + };
  170 + self.toggleBusConfig = function(id) {
  171 + BusConfig.delete({id: id}, function(result) {
  172 + if (result.message) { // 暂时这样做,之后全局拦截
  173 + alert("失败:" + result.message);
  174 + } else {
  175 + self.doPage();
254 } 176 }
255 - );  
256 - },  
257 - function(result) {  
258 - // TODO:弹出框方式以后改  
259 - alert("出错啦!");  
260 - }  
261 - );  
262 - };  
263 -  
264 -}]);  
265 -  
266 -angular.module('ScheduleApp').controller('BusConfigFormCtrl', ['BusConfigService', '$stateParams', '$state', '$scope', function(busConfigService, $stateParams, $state, $scope) {  
267 - var self = this;  
268 -  
269 - // 启用日期 日期控件开关  
270 - self.qyrqOpen = false;  
271 - self.qyrq_open = function() {  
272 - self.qyrqOpen = true;  
273 - };  
274 -  
275 - // 终止日期 日期控件开关  
276 - self.zzrqOpen = false;  
277 - self.zzrq_open = function() {  
278 - self.zzrqOpen = true;  
279 - }; 177 + });
  178 + };
280 179
281 - // 欲保存的busInfo信息,绑定  
282 - self.busConfigForSave = {xl:{}, cl:{}}; 180 + self.doPage();
283 181
284 - // 获取传过来的id,有的话就是修改,获取一遍数据  
285 - var id = $stateParams.id;  
286 - if (id) {  
287 - self.busConfigForSave.id = id;  
288 - busConfigService.getDetail(id).then(  
289 - function(result) {  
290 - var key;  
291 - for (key in result) {  
292 - self.busConfigForSave[key] = result[key];  
293 - }  
294 - },  
295 - function(result) {  
296 - alert("出错啦!"); 182 + }
  183 + ]
  184 +);
  185 +
  186 +// form.html控制器
  187 +angular.module('ScheduleApp').controller(
  188 + 'BusConfigFormCtrl',
  189 + [
  190 + 'BusConfigService',
  191 + '$stateParams',
  192 + '$state',
  193 + '$scope',
  194 + function(service, $stateParams, $state, $scope) {
  195 + var self = this;
  196 + var BusConfig = service.getQueryClass();
  197 +
  198 + // 启用日期 日期控件开关
  199 + self.qyrqOpen = false;
  200 + self.qyrq_open = function() {
  201 + self.qyrqOpen = true;
  202 + };
  203 +
  204 + // 终止日期 日期控件开关
  205 + self.zzrqOpen = false;
  206 + self.zzrq_open = function() {
  207 + self.zzrqOpen = true;
  208 + };
  209 +
  210 + // 欲保存的busInfo信息,绑定
  211 + self.busConfigForSave = new BusConfig;
  212 + self.busConfigForSave.xl = {};
  213 + self.busConfigForSave.cl = {};
  214 +
  215 + // 获取传过来的id,有的话就是修改,获取一遍数据
  216 + var id = $stateParams.id;
  217 + if (id) {
  218 + BusConfig.get({id: id}, function(value) {
  219 + self.busConfigForSave = value;
  220 + });
297 } 221 }
298 - );  
299 - }  
300 222
301 - // 提交方法  
302 - self.submit = function() {  
303 - console.log(self.busConfigForSave);  
304 - busConfigService.saveDetail(self.busConfigForSave).then(  
305 - function(result) {  
306 - // TODO:弹出框方式以后改  
307 - if (result.status == 'SUCCESS') {  
308 - alert("保存成功!"); 223 + // 提交方法
  224 + self.submit = function() {
  225 + self.busConfigForSave.$save(function() {
309 $state.go("busConfig"); 226 $state.go("busConfig");
310 - } else {  
311 - alert("保存异常!");  
312 - }  
313 - },  
314 - function(result) {  
315 - // TODO:弹出框方式以后改  
316 - alert("出错啦!");  
317 - }  
318 - );  
319 - }; 227 + });
  228 + };
320 }]); 229 }]);
321 230
322 -angular.module('ScheduleApp').controller('BusConfigDetailCtrl', ['BusConfigService', '$stateParams', function(busConfigService, $stateParams) {  
323 - var self = this;  
324 - self.title = "";  
325 - self.busConfigForDetail = {};  
326 - self.busConfigForDetail.id = $stateParams.id;  
327 -  
328 - // 当转向到此页面时,就获取明细信息并绑定  
329 - busConfigService.getDetail($stateParams.id).then(  
330 - function(result) {  
331 - var key;  
332 - for (key in result) {  
333 - self.busConfigForDetail[key] = result[key];  
334 - }  
335 -  
336 - self.title = "车辆 " + self.busConfigForDetail.cl.insideCode + " 配置详细信息";  
337 - },  
338 - function(result) {  
339 - // TODO:弹出框方式以后改  
340 - alert("出错啦!"); 231 +// detail.html控制器
  232 +angular.module('ScheduleApp').controller(
  233 + 'BusConfigDetailCtrl',
  234 + [
  235 + 'BusConfigService',
  236 + '$stateParams',
  237 + function(service, $stateParams) {
  238 + var self = this;
  239 + var BusConfig = service.getQueryClass();
  240 + var id = $stateParams.id;
  241 +
  242 + self.title = "";
  243 + self.busConfigForDetail = {};
  244 +
  245 + // 当转向到此页面时,就获取明细信息并绑定
  246 + BusConfig.get({id: id}, function(value) {
  247 + self.busConfigForDetail = value;
  248 + self.title = "车辆 " +
  249 + self.busConfigForDetail.cl.insideCode +
  250 + " 配置详细信息";
  251 + });
341 } 252 }
342 - );  
343 -}]); 253 + ]
  254 +);
344 255
345 256
346 257
src/main/resources/static/pages/scheduleApp/module/core/busConfig/service.js
1 -// 车辆配置service  
2 -angular.module('ScheduleApp').factory('BusConfigService_g', ['$resource', function($resource) {  
3 - return {  
4 - rest : $resource(  
5 - '/cci/:id',  
6 - {order: 'xl.id,cl.insideCode,isCancel', direction: 'ASC', id: '@id_route'},  
7 - {  
8 - list: {  
9 - method: 'GET',  
10 - params: {  
11 - page: 0  
12 - }  
13 - },  
14 - get: {  
15 - method: 'GET'  
16 - },  
17 - save: {  
18 - method: 'POST'  
19 - }  
20 - }  
21 - )  
22 - }; 1 +// 车辆配置service
  2 +angular.module('ScheduleApp').factory('BusConfigService_g', ['$resource', function($resource) {
  3 + return {
  4 + rest : $resource(
  5 + '/cci/:id',
  6 + {order: 'xl.id,cl.insideCode,isCancel', direction: 'ASC', id: '@id_route'},
  7 + {
  8 + list: {
  9 + method: 'GET',
  10 + params: {
  11 + page: 0
  12 + },
  13 + 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 + };
23 }]); 39 }]);
24 \ No newline at end of file 40 \ No newline at end of file
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/edit.html
@@ -89,11 +89,19 @@ @@ -89,11 +89,19 @@
89 searchexp="this.personnelName + '<' + this.jobCode + '>'" 89 searchexp="this.personnelName + '<' + this.jobCode + '>'"
90 required > 90 required >
91 </sa-Select5> 91 </sa-Select5>
  92 + <input type="hidden" name="jsy_h" ng-model="ctrl.employeeConfigForSave.jsy.id"
  93 + remote-Validation
  94 + remotevtype="ec_jsy"
  95 + remotevparam="{{ {'xl.id_eq': ctrl.employeeConfigForSave.xl.id, 'xl.name_eq': ctrl.employeeConfigForSave.xl.name, 'jsy.id_eq': ctrl.employeeConfigForSave.jsy.id} | json}}"
  96 + />
92 </div> 97 </div>
93 <!-- 隐藏块,显示验证信息 --> 98 <!-- 隐藏块,显示验证信息 -->
94 <div class="alert alert-danger well-sm" ng-show="myForm.jsy.$error.required"> 99 <div class="alert alert-danger well-sm" ng-show="myForm.jsy.$error.required">
95 驾驶员必须选择 100 驾驶员必须选择
96 </div> 101 </div>
  102 + <div class="alert alert-danger well-sm" ng-show="myForm.jsy_h.$error.remote">
  103 + {{$remote_msg}}
  104 + </div>
97 </div> 105 </div>
98 106
99 <div class="form-group"> 107 <div class="form-group">
@@ -111,6 +119,15 @@ @@ -111,6 +119,15 @@
111 searchexp="this.personnelName + '<' + this.jobCode + '>'" 119 searchexp="this.personnelName + '<' + this.jobCode + '>'"
112 > 120 >
113 </sa-Select5> 121 </sa-Select5>
  122 + <input type="hidden" name="spy_h" ng-model="ctrl.employeeConfigForSave.spy.id"
  123 + remote-Validation
  124 + remotevtype="ec_jsy"
  125 + remotevparam="{{ {'xl.id_eq': ctrl.employeeConfigForSave.xl.id, 'xl.name_eq': ctrl.employeeConfigForSave.xl.name, 'jsy.id_eq': ctrl.employeeConfigForSave.spy.id} | json}}"
  126 + />
  127 + </div>
  128 + <!-- 隐藏块,显示验证信息 -->
  129 + <div class="alert alert-danger well-sm" ng-show="myForm.spy_h.$error.remote">
  130 + {{$remote_msg}}
114 </div> 131 </div>
115 </div> 132 </div>
116 133
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/form.html
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 <div class="col-md-3"> 45 <div class="col-md-3">
46 <sa-Select5 name="xl" 46 <sa-Select5 name="xl"
47 model="ctrl.employeeConfigForSave" 47 model="ctrl.employeeConfigForSave"
48 - cmaps="{'xl.id' : 'id'}" 48 + cmaps="{'xl.id' : 'id', 'xl.name': 'name'}"
49 dcname="xl.id" 49 dcname="xl.id"
50 icname="id" 50 icname="id"
51 dsparams="{{ {type: 'ajax', param:{'type': 'all', 'destroy_eq': 0}, atype:'xl' } | json }}" 51 dsparams="{{ {type: 'ajax', param:{'type': 'all', 'destroy_eq': 0}, atype:'xl' } | json }}"
@@ -89,11 +89,19 @@ @@ -89,11 +89,19 @@
89 searchexp="this.personnelName + '<' + this.jobCode + '>'" 89 searchexp="this.personnelName + '<' + this.jobCode + '>'"
90 required > 90 required >
91 </sa-Select5> 91 </sa-Select5>
  92 + <input type="hidden" name="jsy_h" ng-model="ctrl.employeeConfigForSave.jsy.id"
  93 + remote-Validation
  94 + remotevtype="ec_jsy"
  95 + remotevparam="{{ {'xl.id_eq': ctrl.employeeConfigForSave.xl.id, 'xl.name_eq': ctrl.employeeConfigForSave.xl.name, 'jsy.id_eq': ctrl.employeeConfigForSave.jsy.id} | json}}"
  96 + />
92 </div> 97 </div>
93 <!-- 隐藏块,显示验证信息 --> 98 <!-- 隐藏块,显示验证信息 -->
94 <div class="alert alert-danger well-sm" ng-show="myForm.jsy.$error.required"> 99 <div class="alert alert-danger well-sm" ng-show="myForm.jsy.$error.required">
95 驾驶员必须选择 100 驾驶员必须选择
96 </div> 101 </div>
  102 + <div class="alert alert-danger well-sm" ng-show="myForm.jsy_h.$error.remote">
  103 + {{$remote_msg}}
  104 + </div>
97 </div> 105 </div>
98 106
99 <div class="form-group"> 107 <div class="form-group">
@@ -111,6 +119,15 @@ @@ -111,6 +119,15 @@
111 searchexp="this.personnelName + '<' + this.jobCode + '>'" 119 searchexp="this.personnelName + '<' + this.jobCode + '>'"
112 > 120 >
113 </sa-Select5> 121 </sa-Select5>
  122 + <input type="hidden" name="spy_h" ng-model="ctrl.employeeConfigForSave.spy.id"
  123 + remote-Validation
  124 + remotevtype="ec_spy"
  125 + remotevparam="{{ {'xl.id_eq': ctrl.employeeConfigForSave.xl.id, 'xl.name_eq': ctrl.employeeConfigForSave.xl.name, 'spy.id_eq': ctrl.employeeConfigForSave.spy.id} | json}}"
  126 + />
  127 + </div>
  128 + <!-- 隐藏块,显示验证信息 -->
  129 + <div class="alert alert-danger well-sm" ng-show="myForm.spy_h.$error.remote">
  130 + {{$remote_msg}}
114 </div> 131 </div>
115 </div> 132 </div>
116 133
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/list.html
@@ -46,16 +46,16 @@ @@ -46,16 +46,16 @@
46 </td> 46 </td>
47 <td> 47 <td>
48 <label class="checkbox-inline"> 48 <label class="checkbox-inline">
49 - <input type="checkbox" ng-model="ctrl.searchCondition()['isCancel_eq']"/>作废 49 + <input type="checkbox" ng-model="ctrl.searchCondition()['isCancel_eq']"/>作废
50 </label> 50 </label>
51 </td> 51 </td>
52 <td> 52 <td>
53 <button class="btn btn-sm green btn-outline filter-submit margin-bottom" 53 <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
54 - ng-click="ctrl.pageChanaged()"> 54 + ng-click="ctrl.doPage()">
55 <i class="fa fa-search"></i> 搜索</button> 55 <i class="fa fa-search"></i> 搜索</button>
56 56
57 <button class="btn btn-sm red btn-outline filter-cancel" 57 <button class="btn btn-sm red btn-outline filter-cancel"
58 - ng-click="ctrl.resetSearchCondition()"> 58 + ng-click="ctrl.reset()">
59 <i class="fa fa-times"></i> 重置</button> 59 <i class="fa fa-times"></i> 重置</button>
60 </td> 60 </td>
61 61
@@ -63,7 +63,7 @@ @@ -63,7 +63,7 @@
63 63
64 </thead> 64 </thead>
65 <tbody> 65 <tbody>
66 - <tr ng-repeat="info in ctrl.pageInfo.infos" ng-class="{odd: true, gradeX: true, danger: info.isCancel}"> 66 + <tr ng-repeat="info in ctrl.page()['content']" ng-class="{odd: true, gradeX: true, danger: info.isCancel}">
67 <td> 67 <td>
68 <span ng-bind="$index + 1"></span> 68 <span ng-bind="$index + 1"></span>
69 </td> 69 </td>
@@ -94,8 +94,8 @@ @@ -94,8 +94,8 @@
94 <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>--> 94 <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>-->
95 <a ui-sref="employeeConfig_detail({id: info.id})" class="btn btn-info btn-sm"> 详细 </a> 95 <a ui-sref="employeeConfig_detail({id: info.id})" class="btn btn-info btn-sm"> 详细 </a>
96 <a ui-sref="employeeConfig_edit({id: info.id})" class="btn btn-info btn-sm" ng-if="info.isCancel == '0'"> 修改 </a> 96 <a ui-sref="employeeConfig_edit({id: info.id})" class="btn btn-info btn-sm" ng-if="info.isCancel == '0'"> 修改 </a>
97 - <a ng-click="ctrl.deleteEci(info.id)" class="btn btn-danger btn-sm" ng-if="info.isCancel == '0'"> 作废 </a>  
98 - <a ng-click="ctrl.redoDeleteEci(info.id)" class="btn btn-success btn-sm" ng-if="info.isCancel == '1'"> 撤销 </a> 97 + <a ng-click="ctrl.toggleEmpConfig(info.id)" class="btn btn-danger btn-sm" ng-if="info.isCancel == '0'"> 作废 </a>
  98 + <a ng-click="ctrl.toggleEmpConfig(info.id)" class="btn btn-success btn-sm" ng-if="info.isCancel == '1'"> 撤销 </a>
99 </td> 99 </td>
100 </tr> 100 </tr>
101 </tbody> 101 </tbody>
@@ -103,9 +103,9 @@ @@ -103,9 +103,9 @@
103 </div> 103 </div>
104 104
105 <div style="text-align: right;"> 105 <div style="text-align: right;">
106 - <uib-pagination total-items="ctrl.pageInfo.totalItems"  
107 - ng-model="ctrl.pageInfo.currentPage"  
108 - ng-change="ctrl.pageChanaged()" 106 + <uib-pagination total-items="ctrl.page()['totalElements']"
  107 + ng-model="ctrl.page()['uiNumber']"
  108 + ng-change="ctrl.doPage()"
109 rotate="false" 109 rotate="false"
110 max-size="10" 110 max-size="10"
111 boundary-links="true" 111 boundary-links="true"
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/module.js
1 // 人员配置管理 service controller 等写在一起 1 // 人员配置管理 service controller 等写在一起
2 2
3 -angular.module('ScheduleApp').factory('EmployeeConfigService', ['EmployeeConfigService_g', function(service) {  
4 - /** 当前的查询条件信息 */  
5 - var currentSearchCondition = {'isCancel_eq': false};  
6 -  
7 - /** 当前第几页 */  
8 - var currentPageNo = 1; 3 +angular.module('ScheduleApp').factory(
  4 + 'EmployeeConfigService',
  5 + [
  6 + 'EmployeeConfigService_g',
  7 + function(service) {
  8 + /** 当前的查询条件信息 */
  9 + var currentSearchCondition = {'isCancel_eq': false};
  10 + // 当前查询返回的信息
  11 + var currentPage = { // 后台spring data返回的格式
  12 + totalElements: 0,
  13 + number: 0, // 后台返回的页码,spring返回从0开始
  14 + content: [],
  15 +
  16 + uiNumber: 1 // 页面绑定的页码
  17 + };
  18 +
  19 + // 查询对象类
  20 + var queryClass = service.rest;
  21 +
  22 + return {
  23 + getQueryClass: function() {
  24 + return queryClass;
  25 + },
  26 + /**
  27 + * 获取查询条件信息,
  28 + * 用于给controller用来和页面数据绑定。
  29 + */
  30 + getSearchCondition: function() {
  31 + currentSearchCondition.page = currentPage.uiNumber - 1;
  32 + return currentSearchCondition;
  33 + },
  34 + /**
  35 + * 组装查询参数,返回一个promise查询结果。
  36 + * @param page 查询参数
  37 + * @return 返回一个 promise
  38 + */
  39 + getPage: function(page) {
  40 + if (page) {
  41 + currentPage.totalElements = page.totalElements;
  42 + currentPage.number = page.number;
  43 + currentPage.content = page.content;
  44 + }
  45 + return currentPage;
  46 + },
  47 + resetStatus: function() {
  48 + currentSearchCondition = {page: 0, 'isCancel_eq': false};
  49 + currentPage = {
  50 + totalElements: 0,
  51 + number: 0,
  52 + content: [],
  53 + uiNumber: 1
  54 + };
  55 + }
9 56
10 - return {  
11 - /**  
12 - * 获取查询条件信息,  
13 - * 用于给controller用来和页面数据绑定。  
14 - */  
15 - getSearchCondition: function() {  
16 - return currentSearchCondition;  
17 - },  
18 - /**  
19 - * 重置查询条件信息。  
20 - */  
21 - resetSearchCondition: function() {  
22 - var key;  
23 - for (key in currentSearchCondition) {  
24 - currentSearchCondition[key] = undefined;  
25 - }  
26 - currentSearchCondition['isCancel_eq'] = false;  
27 - },  
28 - /**  
29 - * 设置当前页码。  
30 - * @param cpn 从1开始,后台是从0开始的  
31 - */  
32 - setCurrentPageNo: function(cpn) {  
33 - currentPageNo = cpn;  
34 - },  
35 - /**  
36 - * 组装查询参数,返回一个promise查询结果。  
37 - * @param params 查询参数  
38 - * @return 返回一个 promise  
39 - */  
40 - getPage: function() {  
41 - var params = currentSearchCondition; // 查询条件  
42 - params.page = currentPageNo - 1; // 服务端页码从0开始  
43 - return service.rest.list(params).$promise;  
44 - },  
45 - /**  
46 - * 获取明细信息。  
47 - * @param id 车辆id  
48 - * @return 返回一个 promise  
49 - */  
50 - getDetail: function(id) {  
51 - var params = {id: id};  
52 - return service.rest.get(params).$promise;  
53 - },  
54 - /**  
55 - * 保存信息。  
56 - * @param obj 车辆详细信息  
57 - * @return 返回一个 promise  
58 - */  
59 - saveDetail: function(obj) {  
60 - return service.rest.save(obj).$promise;  
61 - },  
62 - /**  
63 - * 删除信息。  
64 - * @param id 主键id  
65 - * @returns {*|Function|promise|n}  
66 - */  
67 - deleteDetail: function(id) {  
68 - return service.rest.delete({id: id}).$promise; 57 + };
69 } 58 }
70 - };  
71 -}]);  
72 -  
73 -angular.module('ScheduleApp').controller('EmployeeConfigCtrl', ['EmployeeConfigService', '$state', '$uibModal', function(employeeConfigService, $state, $uibModal) {  
74 - var self = this;  
75 -  
76 - // 切换到form状态  
77 - self.goForm = function() {  
78 - //alert("切换");  
79 - $state.go("employeeConfig_form");  
80 - };  
81 -  
82 - // 导入excel  
83 - self.importData = function() {  
84 - // large方式弹出模态对话框  
85 - var modalInstance = $uibModal.open({  
86 - templateUrl: '/pages/scheduleApp/module/core/employeeConfig/dataImport.html',  
87 - size: "lg",  
88 - animation: true,  
89 - backdrop: 'static',  
90 - resolve: {  
91 - // 可以传值给controller  
92 - },  
93 - windowClass: 'center-modal',  
94 - controller: "EmployeeConfigToolsCtrl",  
95 - controllerAs: "ctrl",  
96 - bindToController: true  
97 - });  
98 - modalInstance.result.then(  
99 - function() {  
100 - console.log("dataImport.html打开");  
101 - },  
102 - function() {  
103 - console.log("dataImport.html消失");  
104 - }  
105 - );  
106 - };  
107 -}]); 59 + ]
  60 +);
  61 +
  62 +// index.html控制器
  63 +angular.module('ScheduleApp').controller(
  64 + 'EmployeeConfigCtrl',
  65 + [
  66 + 'EmployeeConfigService',
  67 + '$state',
  68 + '$uibModal',
  69 + function(service, $state, $uibModal) {
  70 + var self = this;
  71 +
  72 + // 切换到form状态
  73 + self.goForm = function() {
  74 + //alert("切换");
  75 + $state.go("employeeConfig_form");
  76 + };
  77 +
  78 + // 导入excel
  79 + self.importData = function() {
  80 + // large方式弹出模态对话框
  81 + var modalInstance = $uibModal.open({
  82 + templateUrl: '/pages/scheduleApp/module/core/employeeConfig/dataImport.html',
  83 + size: "lg",
  84 + animation: true,
  85 + backdrop: 'static',
  86 + resolve: {
  87 + // 可以传值给controller
  88 + },
  89 + windowClass: 'center-modal',
  90 + controller: "EmployeeConfigToolsCtrl",
  91 + controllerAs: "ctrl",
  92 + bindToController: true
  93 + });
  94 + modalInstance.result.then(
  95 + function() {
  96 + console.log("dataImport.html打开");
  97 + },
  98 + function() {
  99 + console.log("dataImport.html消失");
  100 + }
  101 + );
  102 + };
  103 + }
  104 + ]
  105 +);
108 106
109 angular.module('ScheduleApp').controller('EmployeeConfigToolsCtrl', ['$modalInstance', 'FileUploader', function($modalInstance, FileUploader) { 107 angular.module('ScheduleApp').controller('EmployeeConfigToolsCtrl', ['$modalInstance', 'FileUploader', function($modalInstance, FileUploader) {
110 var self = this; 108 var self = this;
@@ -142,202 +140,114 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;EmployeeConfigToolsCtrl&#39;, [&#39;$modalInst @@ -142,202 +140,114 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;EmployeeConfigToolsCtrl&#39;, [&#39;$modalInst
142 140
143 }]); 141 }]);
144 142
145 -angular.module('ScheduleApp').controller('EmployeeConfigListCtrl', ['EmployeeConfigService', function(employeeConfigService) {  
146 - var self = this;  
147 - self.pageInfo = {  
148 - totalItems : 0,  
149 - currentPage : 1,  
150 - infos: []  
151 - }; 143 +// list.html控制器
  144 +angular.module('ScheduleApp').controller(
  145 + 'EmployeeConfigListCtrl',
  146 + [
  147 + 'EmployeeConfigService',
  148 + function(service) {
  149 + var self = this;
  150 + var EmpConfig = service.getQueryClass();
  151 +
  152 + self.page = function() {
  153 + return service.getPage();
  154 + };
  155 +
  156 + self.searchCondition = function() {
  157 + return service.getSearchCondition();
  158 + };
  159 + self.doPage = function() {
  160 + var page = EmpConfig.list(self.searchCondition(), function() {
  161 + service.getPage(page);
  162 + });
  163 + };
  164 + self.reset = function() {
  165 + service.resetStatus();
  166 + var page = EmpConfig.list(self.searchCondition(), function() {
  167 + service.getPage(page);
  168 + });
  169 + };
  170 +
  171 + self.toggleEmpConfig = function(id) {
  172 + EmpConfig.delete({id: id}, function(result) {
  173 + if (result.message) { // 暂时这样做,之后全局拦截
  174 + alert("失败:" + result.message);
  175 + } else {
  176 + self.doPage();
  177 + }
  178 + });
  179 + };
152 180
153 - // 初始创建的时候,获取一次列表数据  
154 - employeeConfigService.getPage().then(  
155 - function(result) {  
156 - self.pageInfo.totalItems = result.totalElements;  
157 - self.pageInfo.currentPage = result.number + 1;  
158 - self.pageInfo.infos = result.content;  
159 - employeeConfigService.setCurrentPageNo(result.number + 1);  
160 - },  
161 - function(result) {  
162 - alert("出错啦!"); 181 + self.doPage();
163 } 182 }
164 - );  
165 -  
166 - //$scope.$watch("ctrl.pageInfo.currentPage", function() {  
167 - // alert("dfdfdf");  
168 - //});  
169 -  
170 - // 翻页的时候调用  
171 - self.pageChanaged = function() {  
172 - employeeConfigService.setCurrentPageNo(self.pageInfo.currentPage);  
173 - employeeConfigService.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 - employeeConfigService.setCurrentPageNo(result.number + 1);  
179 - },  
180 - function(result) {  
181 - alert("出错啦!");  
182 - }  
183 - );  
184 - };  
185 - // 获取查询条件数据  
186 - self.searchCondition = function() {  
187 - return employeeConfigService.getSearchCondition();  
188 - };  
189 - // 重置查询条件  
190 - self.resetSearchCondition = function() {  
191 - employeeConfigService.resetSearchCondition();  
192 - self.pageInfo.currentPage = 1;  
193 - self.pageChanaged();  
194 - };  
195 -  
196 - // 删除时刻表  
197 - self.deleteEci = function(id) {  
198 - // TODO:  
199 - employeeConfigService.deleteDetail(id).then(  
200 - function(result) {  
201 - if (result.message) { // 暂时这样做,之后全局拦截  
202 - alert("失败:" + result.message);  
203 - } else {  
204 - alert("作废成功!");  
205 -  
206 - employeeConfigService.getPage().then(  
207 - function(result) {  
208 - self.pageInfo.totalItems = result.totalElements;  
209 - self.pageInfo.currentPage = result.number + 1;  
210 - self.pageInfo.infos = result.content;  
211 - employeeConfigService.setCurrentPageNo(result.number + 1);  
212 - },  
213 - function(result) {  
214 - alert("出错啦!");  
215 - }  
216 - );  
217 - }  
218 -  
219 - },  
220 - function(result) {  
221 - alert("出错啦!" + result);  
222 - }  
223 - );  
224 - };  
225 -  
226 - // 撤销修改  
227 - self.redoDeleteEci = function(id) {  
228 - employeeConfigService.getDetail(id).then(  
229 - function(result) {  
230 - result.isCancel = 'false';  
231 - employeeConfigService.saveDetail(result).then(  
232 - function(result) {  
233 - if (result.message) { // 暂时这样做,之后全局拦截  
234 - alert("失败:" + result.message);  
235 - } else {  
236 - alert("撤销成功!");  
237 -  
238 - employeeConfigService.getPage().then(  
239 - function(result) {  
240 - self.pageInfo.totalItems = result.totalElements;  
241 - self.pageInfo.currentPage = result.number + 1;  
242 - self.pageInfo.infos = result.content;  
243 - employeeConfigService.setCurrentPageNo(result.number + 1);  
244 - },  
245 - function(result) {  
246 - alert("出错啦!");  
247 - }  
248 - );  
249 - }  
250 - },  
251 - function(result) {  
252 - // TODO:弹出框方式以后改  
253 - alert("出错啦!"); 183 + ]
  184 +);
  185 +
  186 +// form.html控制器
  187 +angular.module('ScheduleApp').controller(
  188 + 'EmployeeConfigFormCtrl',
  189 + [
  190 + 'EmployeeConfigService',
  191 + '$stateParams',
  192 + '$state',
  193 + function(service, $stateParams, $state) {
  194 + var self = this;
  195 + var EmpConfig = service.getQueryClass();
  196 +
  197 + // 欲保存的busInfo信息,绑定
  198 + self.employeeConfigForSave = new EmpConfig;
  199 + self.employeeConfigForSave.xl = {};
  200 + self.employeeConfigForSave.jsy = {};
  201 + self.employeeConfigForSave.spy = {};
  202 +
  203 + // 获取传过来的id,有的话就是修改,获取一遍数据
  204 + var id = $stateParams.id;
  205 + if (id) {
  206 + EmpConfig.get({id: id}, function(value) {
  207 + self.employeeConfigForSave = value;
  208 + if (!self.employeeConfigForSave.spy) {
  209 + self.employeeConfigForSave.spy = {};
254 } 210 }
255 - );  
256 - },  
257 - function(result) {  
258 - // TODO:弹出框方式以后改  
259 - alert("出错啦!"); 211 + });
260 } 212 }
261 - );  
262 - };  
263 213
264 -}]); 214 + // 提交方法
  215 + self.submit = function() {
  216 + console.log(self.employeeConfigForSave);
265 217
266 -angular.module('ScheduleApp').controller('EmployeeConfigFormCtrl', ['EmployeeConfigService', '$stateParams', '$state', function(employeeConfigService, $stateParams, $state) {  
267 - var self = this;  
268 -  
269 - // 欲保存的busInfo信息,绑定  
270 - self.employeeConfigForSave = {xl:{}, jsy:{}, spy:{}};  
271 -  
272 - // 获取传过来的id,有的话就是修改,获取一遍数据  
273 - var id = $stateParams.id;  
274 - if (id) {  
275 - self.employeeConfigForSave.id = id;  
276 - employeeConfigService.getDetail(id).then(  
277 - function(result) {  
278 - var key;  
279 - for (key in result) {  
280 - self.employeeConfigForSave[key] = result[key]; 218 + // 如果自对象没id值,设置成null
  219 + if (self.employeeConfigForSave.spy && !self.employeeConfigForSave.spy.id) {
  220 + self.employeeConfigForSave.spy = null;
281 } 221 }
282 222
283 - if (!self.employeeConfigForSave.spy) {  
284 - self.employeeConfigForSave.spy = {};  
285 - }  
286 -  
287 - },  
288 - function(result) {  
289 - alert("出错啦!");  
290 - }  
291 - );  
292 - }  
293 -  
294 - // 提交方法  
295 - self.submit = function() {  
296 - console.log(self.employeeConfigForSave);  
297 -  
298 - // 如果自对象没id值,设置成null  
299 - if (self.employeeConfigForSave.spy && !self.employeeConfigForSave.spy.id) {  
300 - self.employeeConfigForSave.spy = null;  
301 - }  
302 -  
303 - employeeConfigService.saveDetail(self.employeeConfigForSave).then(  
304 - function(result) {  
305 - // TODO:弹出框方式以后改  
306 - if (result.status == 'SUCCESS') {  
307 - alert("保存成功!"); 223 + self.employeeConfigForSave.$save(function() {
308 $state.go("employeeConfig"); 224 $state.go("employeeConfig");
309 - } else {  
310 - alert("保存异常!");  
311 - }  
312 - },  
313 - function(result) {  
314 - // TODO:弹出框方式以后改  
315 - alert("出错啦!");  
316 - }  
317 - );  
318 - }; 225 + });
  226 + };
319 }]); 227 }]);
320 228
321 -angular.module('ScheduleApp').controller('EmployeeConfigDetailCtrl', ['EmployeeConfigService', '$stateParams', function(employeeConfigService, $stateParams) {  
322 - var self = this;  
323 - self.title = "";  
324 - self.employeeConfigForDetail = {};  
325 - self.employeeConfigForDetail.id = $stateParams.id;  
326 -  
327 - // 当转向到此页面时,就获取明细信息并绑定  
328 - employeeConfigService.getDetail($stateParams.id).then(  
329 - function(result) {  
330 - var key;  
331 - for (key in result) {  
332 - self.employeeConfigForDetail[key] = result[key];  
333 - }  
334 -  
335 - self.title = "驾驶员 " + self.employeeConfigForDetail.jsy.personnelName + " 配置详细信息";  
336 - },  
337 - function(result) {  
338 - // TODO:弹出框方式以后改  
339 - alert("出错啦!"); 229 +// detail.html控制器
  230 +angular.module('ScheduleApp').controller(
  231 + 'EmployeeConfigDetailCtrl',
  232 + [
  233 + 'EmployeeConfigService',
  234 + '$stateParams',
  235 + function(service, $stateParams) {
  236 + var self = this;
  237 + var EmpConfig = service.getQueryClass();
  238 + var id = $stateParams.id;
  239 +
  240 + self.title = "";
  241 + self.employeeConfigForDetail = {};
  242 +
  243 + // 当转向到此页面时,就获取明细信息并绑定
  244 + EmpConfig.get({id: id}, function(value) {
  245 + self.employeeConfigForDetail = value;
  246 + self.title = "驾驶员 " +
  247 + self.employeeConfigForDetail.jsy.personnelName +
  248 + " 配置详细信息";
  249 + });
340 } 250 }
341 - );  
342 -}]); 251 + ]
  252 +);
343 253
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/service.js
1 -// 人员配置service  
2 -angular.module('ScheduleApp').factory('EmployeeConfigService_g', ['$resource', function($resource) {  
3 - return {  
4 - rest : $resource(  
5 - '/eci/:id',  
6 - {order: 'xl.id,isCancel,dbbmFormula', direction: 'ASC', id: '@id_route'},  
7 - {  
8 - list: {  
9 - method: 'GET',  
10 - params: {  
11 - page: 0  
12 - }  
13 - },  
14 - get: {  
15 - method: 'GET'  
16 - },  
17 - save: {  
18 - method: 'POST'  
19 - },  
20 - delete: {  
21 - method: 'DELETE'  
22 - }  
23 - }  
24 - ),  
25 - validate: $resource( // TODO:  
26 - '/personnel/validate/:type',  
27 - {},  
28 - {  
29 - jobCode: {  
30 - method: 'GET'  
31 - }  
32 - }  
33 - )  
34 - }; 1 +// 人员配置service
  2 +angular.module('ScheduleApp').factory('EmployeeConfigService_g', ['$resource', function($resource) {
  3 + return {
  4 + rest : $resource(
  5 + '/eci/:id',
  6 + {order: 'xl.id,isCancel,dbbmFormula', direction: 'ASC', id: '@id_route'},
  7 + {
  8 + list: {
  9 + method: 'GET',
  10 + params: {
  11 + page: 0
  12 + },
  13 + 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 + delete: {
  37 + method: 'DELETE'
  38 + }
  39 + }
  40 + ),
  41 + validate: $resource( // TODO:
  42 + '/personnel/validate/:type',
  43 + {},
  44 + {
  45 + jobCode: {
  46 + method: 'GET'
  47 + }
  48 + }
  49 + )
  50 + };
35 }]); 51 }]);
36 \ No newline at end of file 52 \ No newline at end of file