Commit 05849f9cc847eb8a396e41d5f54b1bb6e101d872
Merge branch 'minhang' of 192.168.168.201:panzhaov5/bsth_control into
minhang
Showing
24 changed files
with
2414 additions
and
2413 deletions
Too many changes to show.
To preserve performance only 24 of 44 files are displayed.
src/main/java/com/bsth/controller/schedule/BController.java
| 1 | -package com.bsth.controller.schedule; | ||
| 2 | - | ||
| 3 | -import com.bsth.common.ResponseCode; | ||
| 4 | -import com.bsth.service.schedule.BService; | ||
| 5 | -import com.bsth.service.schedule.ScheduleException; | ||
| 6 | -import com.google.common.base.Splitter; | ||
| 7 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 8 | -import org.springframework.data.domain.PageRequest; | ||
| 9 | -import org.springframework.data.domain.Sort; | ||
| 10 | -import org.springframework.web.bind.annotation.*; | ||
| 11 | - | ||
| 12 | -import java.io.Serializable; | ||
| 13 | -import java.util.ArrayList; | ||
| 14 | -import java.util.HashMap; | ||
| 15 | -import java.util.List; | ||
| 16 | -import java.util.Map; | ||
| 17 | - | ||
| 18 | -/** | ||
| 19 | - * 基础控制器。 | ||
| 20 | - */ | ||
| 21 | -public class BController<T, ID extends Serializable> { | ||
| 22 | - @Autowired | ||
| 23 | - protected BService<T, ID> bService; | ||
| 24 | - | ||
| 25 | - // CRUD 操作 | ||
| 26 | - // Create操作 | ||
| 27 | - @RequestMapping(method = RequestMethod.POST) | ||
| 28 | - public Map<String, Object> save(@RequestBody T t) { | ||
| 29 | - T t_saved = bService.save(t); | ||
| 30 | - Map<String, Object> rtn = new HashMap<>(); | ||
| 31 | - rtn.put("status", ResponseCode.SUCCESS); | ||
| 32 | - rtn.put("data", t_saved); | ||
| 33 | - return rtn; | ||
| 34 | - } | ||
| 35 | - // Update操作 | ||
| 36 | - @RequestMapping(value="/{id}", method = RequestMethod.POST) | ||
| 37 | - public Map<String, Object> update(@RequestBody T t) { | ||
| 38 | - return save(t); | ||
| 39 | - } | ||
| 40 | - // Research操作 | ||
| 41 | - @RequestMapping(value = "/{id}", method = RequestMethod.GET) | ||
| 42 | - public Map<String, Object> findById(@PathVariable("id") ID id) { | ||
| 43 | - T t = bService.findById(id); | ||
| 44 | - Map<String, Object> rtn = new HashMap<>(); | ||
| 45 | - rtn.put("status", ResponseCode.SUCCESS); | ||
| 46 | - rtn.put("data", t); | ||
| 47 | - return rtn; | ||
| 48 | - } | ||
| 49 | - @RequestMapping(value = "/all", method = RequestMethod.GET) | ||
| 50 | - public Map<String, Object> list(@RequestParam Map<String, Object> param) { | ||
| 51 | - List<T> tList = bService.list(param); | ||
| 52 | - Map<String, Object> rtn = new HashMap<>(); | ||
| 53 | - rtn.put("status", ResponseCode.SUCCESS); | ||
| 54 | - rtn.put("data", tList); | ||
| 55 | - return rtn; | ||
| 56 | - } | ||
| 57 | - @RequestMapping(method = RequestMethod.GET) | ||
| 58 | - public Map<String, Object> list( | ||
| 59 | - @RequestParam Map<String, Object> map, | ||
| 60 | - @RequestParam(defaultValue = "0") int page, | ||
| 61 | - @RequestParam(defaultValue = "10") int size, | ||
| 62 | - @RequestParam(defaultValue = "id") String order, | ||
| 63 | - @RequestParam(defaultValue = "DESC") String direction) { | ||
| 64 | - // 允许多个字段排序,order可以写单个字段,也可以写多个字段 | ||
| 65 | - // 多个字段格式:{col1},{col2},{col3},....,{coln} | ||
| 66 | - List<String> order_columns = Splitter.on(",").trimResults().splitToList(order); | ||
| 67 | - // 多字段排序:DESC,ASC... | ||
| 68 | - List<String> order_dirs = Splitter.on(",").trimResults().splitToList(direction); | ||
| 69 | - | ||
| 70 | - Map<String, Object> rtn = new HashMap<>(); | ||
| 71 | - | ||
| 72 | - if (order_dirs.size() == 1) { // 所有字段采用一种排序 | ||
| 73 | - rtn.put("status", ResponseCode.SUCCESS); | ||
| 74 | - if (order_dirs.get(0).equals("ASC")) { | ||
| 75 | - rtn.put("data", bService.list(map, new PageRequest(page, size, new Sort(Sort.Direction.ASC, order_columns)))); | ||
| 76 | - } else { | ||
| 77 | - rtn.put("data", bService.list(map, new PageRequest(page, size, new Sort(Sort.Direction.DESC, order_columns)))); | ||
| 78 | - } | ||
| 79 | - } else if (order_columns.size() == order_dirs.size()) { | ||
| 80 | - List<Sort.Order> orderList = new ArrayList<>(); | ||
| 81 | - for (int i = 0; i < order_columns.size(); i++) { | ||
| 82 | - if (null != order_dirs.get(i) && order_dirs.get(i).equals("ASC")) { | ||
| 83 | - orderList.add(new Sort.Order(Sort.Direction.ASC, order_columns.get(i))); | ||
| 84 | - } else { | ||
| 85 | - orderList.add(new Sort.Order(Sort.Direction.DESC, order_columns.get(i))); | ||
| 86 | - } | ||
| 87 | - } | ||
| 88 | - rtn.put("status", ResponseCode.SUCCESS); | ||
| 89 | - rtn.put("data", bService.list(map, new PageRequest(page, size, new Sort(orderList)))); | ||
| 90 | - } else { | ||
| 91 | - throw new RuntimeException("多字段排序参数格式问题,排序顺序和字段数不一致"); | ||
| 92 | - } | ||
| 93 | - | ||
| 94 | - return rtn; | ||
| 95 | - | ||
| 96 | - } | ||
| 97 | - | ||
| 98 | - // Delete操作 | ||
| 99 | - @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) | ||
| 100 | - public Map<String, Object> delete(@PathVariable("id") ID id) { | ||
| 101 | - Map<String, Object> rtn = new HashMap<>(); | ||
| 102 | - try { | ||
| 103 | - bService.delete(id); | ||
| 104 | - rtn.put("status", ResponseCode.SUCCESS); | ||
| 105 | - } catch (ScheduleException exp) { | ||
| 106 | - rtn.put("status", ResponseCode.ERROR); | ||
| 107 | - rtn.put("msg", exp.getMessage()); | ||
| 108 | - } | ||
| 109 | - | ||
| 110 | - return rtn; | ||
| 111 | - } | ||
| 112 | - | ||
| 113 | -} | 1 | +package com.bsth.controller.schedule; |
| 2 | + | ||
| 3 | +import com.bsth.common.ResponseCode; | ||
| 4 | +import com.bsth.service.schedule.BService; | ||
| 5 | +import com.bsth.service.schedule.ScheduleException; | ||
| 6 | +import com.google.common.base.Splitter; | ||
| 7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 8 | +import org.springframework.data.domain.PageRequest; | ||
| 9 | +import org.springframework.data.domain.Sort; | ||
| 10 | +import org.springframework.web.bind.annotation.*; | ||
| 11 | + | ||
| 12 | +import java.io.Serializable; | ||
| 13 | +import java.util.ArrayList; | ||
| 14 | +import java.util.HashMap; | ||
| 15 | +import java.util.List; | ||
| 16 | +import java.util.Map; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * 基础控制器。 | ||
| 20 | + */ | ||
| 21 | +public class BController<T, ID extends Serializable> { | ||
| 22 | + @Autowired | ||
| 23 | + protected BService<T, ID> bService; | ||
| 24 | + | ||
| 25 | + // CRUD 操作 | ||
| 26 | + // Create操作 | ||
| 27 | + @RequestMapping(method = RequestMethod.POST) | ||
| 28 | + public Map<String, Object> save(@RequestBody T t) { | ||
| 29 | + T t_saved = bService.save(t); | ||
| 30 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 31 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 32 | + rtn.put("data", t_saved); | ||
| 33 | + return rtn; | ||
| 34 | + } | ||
| 35 | + // Update操作 | ||
| 36 | + @RequestMapping(value="/{id}", method = RequestMethod.POST) | ||
| 37 | + public Map<String, Object> update(@RequestBody T t) { | ||
| 38 | + return save(t); | ||
| 39 | + } | ||
| 40 | + // Research操作 | ||
| 41 | + @RequestMapping(value = "/{id}", method = RequestMethod.GET) | ||
| 42 | + public Map<String, Object> findById(@PathVariable("id") ID id) { | ||
| 43 | + T t = bService.findById(id); | ||
| 44 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 45 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 46 | + rtn.put("data", t); | ||
| 47 | + return rtn; | ||
| 48 | + } | ||
| 49 | + @RequestMapping(value = "/all", method = RequestMethod.GET) | ||
| 50 | + public Map<String, Object> list(@RequestParam Map<String, Object> param) { | ||
| 51 | + List<T> tList = bService.list(param); | ||
| 52 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 53 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 54 | + rtn.put("data", tList); | ||
| 55 | + return rtn; | ||
| 56 | + } | ||
| 57 | + @RequestMapping(method = RequestMethod.GET) | ||
| 58 | + public Map<String, Object> list( | ||
| 59 | + @RequestParam Map<String, Object> map, | ||
| 60 | + @RequestParam(defaultValue = "0") int page, | ||
| 61 | + @RequestParam(defaultValue = "10") int size, | ||
| 62 | + @RequestParam(defaultValue = "id") String order, | ||
| 63 | + @RequestParam(defaultValue = "DESC") String direction) { | ||
| 64 | + // 允许多个字段排序,order可以写单个字段,也可以写多个字段 | ||
| 65 | + // 多个字段格式:{col1},{col2},{col3},....,{coln} | ||
| 66 | + List<String> order_columns = Splitter.on(",").trimResults().splitToList(order); | ||
| 67 | + // 多字段排序:DESC,ASC... | ||
| 68 | + List<String> order_dirs = Splitter.on(",").trimResults().splitToList(direction); | ||
| 69 | + | ||
| 70 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 71 | + | ||
| 72 | + if (order_dirs.size() == 1) { // 所有字段采用一种排序 | ||
| 73 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 74 | + if (order_dirs.get(0).equals("ASC")) { | ||
| 75 | + rtn.put("data", bService.list(map, new PageRequest(page, size, new Sort(Sort.Direction.ASC, order_columns)))); | ||
| 76 | + } else { | ||
| 77 | + rtn.put("data", bService.list(map, new PageRequest(page, size, new Sort(Sort.Direction.DESC, order_columns)))); | ||
| 78 | + } | ||
| 79 | + } else if (order_columns.size() == order_dirs.size()) { | ||
| 80 | + List<Sort.Order> orderList = new ArrayList<>(); | ||
| 81 | + for (int i = 0; i < order_columns.size(); i++) { | ||
| 82 | + if (null != order_dirs.get(i) && order_dirs.get(i).equals("ASC")) { | ||
| 83 | + orderList.add(new Sort.Order(Sort.Direction.ASC, order_columns.get(i))); | ||
| 84 | + } else { | ||
| 85 | + orderList.add(new Sort.Order(Sort.Direction.DESC, order_columns.get(i))); | ||
| 86 | + } | ||
| 87 | + } | ||
| 88 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 89 | + rtn.put("data", bService.list(map, new PageRequest(page, size, new Sort(orderList)))); | ||
| 90 | + } else { | ||
| 91 | + throw new RuntimeException("多字段排序参数格式问题,排序顺序和字段数不一致"); | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + return rtn; | ||
| 95 | + | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + // Delete操作 | ||
| 99 | + @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) | ||
| 100 | + public Map<String, Object> delete(@PathVariable("id") ID id) { | ||
| 101 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 102 | + try { | ||
| 103 | + bService.delete(id); | ||
| 104 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 105 | + } catch (ScheduleException exp) { | ||
| 106 | + rtn.put("status", ResponseCode.ERROR); | ||
| 107 | + rtn.put("msg", exp.getMessage()); | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + return rtn; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | +} |
src/main/java/com/bsth/controller/schedule/basicinfo/CarsController.java
| 1 | -package com.bsth.controller.schedule.basicinfo; | ||
| 2 | - | ||
| 3 | -import com.bsth.common.ResponseCode; | ||
| 4 | -import com.bsth.controller.schedule.BController; | ||
| 5 | -import com.bsth.entity.Cars; | ||
| 6 | -import com.bsth.service.schedule.CarsService; | ||
| 7 | -import com.bsth.service.schedule.ScheduleException; | ||
| 8 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 10 | -import org.springframework.web.bind.annotation.RequestMethod; | ||
| 11 | -import org.springframework.web.bind.annotation.RequestParam; | ||
| 12 | -import org.springframework.web.bind.annotation.RestController; | ||
| 13 | - | ||
| 14 | -import java.util.HashMap; | ||
| 15 | -import java.util.Map; | ||
| 16 | - | ||
| 17 | -/** | ||
| 18 | - * 车辆基础信息controller | ||
| 19 | - */ | ||
| 20 | -@RestController(value = "carsController_sc") | ||
| 21 | -@RequestMapping("cars_sc") | ||
| 22 | -public class CarsController extends BController<Cars, Integer> { | ||
| 23 | - @Autowired | ||
| 24 | - private CarsService carsService; | ||
| 25 | - | ||
| 26 | - @RequestMapping(value = "/validate_zbh", method = RequestMethod.GET) | ||
| 27 | - public Map<String, Object> validate_zbh(@RequestParam Map<String, Object> param) { | ||
| 28 | - Map<String, Object> rtn = new HashMap<>(); | ||
| 29 | - try { | ||
| 30 | - // 自编号验证 | ||
| 31 | - Cars cars = new Cars( | ||
| 32 | - param.get("id_eq"), | ||
| 33 | - param.get("insideCode_eq"), | ||
| 34 | - null, | ||
| 35 | - null, | ||
| 36 | - null); | ||
| 37 | - carsService.validate_nbbh(cars); | ||
| 38 | - rtn.put("status", ResponseCode.SUCCESS); | ||
| 39 | - } catch (ScheduleException exp) { | ||
| 40 | - rtn.put("status", ResponseCode.ERROR); | ||
| 41 | - rtn.put("msg", exp.getMessage()); | ||
| 42 | - } | ||
| 43 | - return rtn; | ||
| 44 | - } | ||
| 45 | - | ||
| 46 | - @RequestMapping(value = "/validate_clbh", method = RequestMethod.GET) | ||
| 47 | - public Map<String, Object> validate_clbh(@RequestParam Map<String, Object> param) { | ||
| 48 | - Map<String, Object> rtn = new HashMap<>(); | ||
| 49 | - try { | ||
| 50 | - // 车辆编号验证 | ||
| 51 | - Cars cars = new Cars( | ||
| 52 | - param.get("id_eq"), | ||
| 53 | - null, | ||
| 54 | - param.get("carCode_eq"), | ||
| 55 | - null, | ||
| 56 | - null); | ||
| 57 | - carsService.validate_clbh(cars); | ||
| 58 | - rtn.put("status", ResponseCode.SUCCESS); | ||
| 59 | - } catch (ScheduleException exp) { | ||
| 60 | - rtn.put("status", ResponseCode.ERROR); | ||
| 61 | - rtn.put("msg", exp.getMessage()); | ||
| 62 | - } | ||
| 63 | - return rtn; | ||
| 64 | - } | ||
| 65 | - | ||
| 66 | - @RequestMapping(value = "/validate_cph", method = RequestMethod.GET) | ||
| 67 | - public Map<String, Object> validate_cph(@RequestParam Map<String, Object> param) { | ||
| 68 | - Map<String, Object> rtn = new HashMap<>(); | ||
| 69 | - try { | ||
| 70 | - // 车牌号验证 | ||
| 71 | - Cars cars = new Cars( | ||
| 72 | - param.get("id_eq"), | ||
| 73 | - null, | ||
| 74 | - null, | ||
| 75 | - param.get("carPlate_eq"), | ||
| 76 | - null); | ||
| 77 | - carsService.validate_cph(cars); | ||
| 78 | - rtn.put("status", ResponseCode.SUCCESS); | ||
| 79 | - } catch (ScheduleException exp) { | ||
| 80 | - rtn.put("status", ResponseCode.ERROR); | ||
| 81 | - rtn.put("msg", exp.getMessage()); | ||
| 82 | - } | ||
| 83 | - return rtn; | ||
| 84 | - } | ||
| 85 | - | ||
| 86 | - @RequestMapping(value = "/validate_sbbh", method = RequestMethod.GET) | ||
| 87 | - public Map<String, Object> validate_sbbh(@RequestParam Map<String, Object> param) { | ||
| 88 | - Map<String, Object> rtn = new HashMap<>(); | ||
| 89 | - try { | ||
| 90 | - // 设备编号验证 | ||
| 91 | - Cars cars = new Cars( | ||
| 92 | - param.get("id_eq"), | ||
| 93 | - null, | ||
| 94 | - null, | ||
| 95 | - null, | ||
| 96 | - param.get("equipmentCode_eq") | ||
| 97 | - ); | ||
| 98 | - carsService.validate_sbbh(cars); | ||
| 99 | - rtn.put("status", ResponseCode.SUCCESS); | ||
| 100 | - } catch (ScheduleException exp) { | ||
| 101 | - rtn.put("status", ResponseCode.ERROR); | ||
| 102 | - rtn.put("msg", exp.getMessage()); | ||
| 103 | - } | ||
| 104 | - return rtn; | ||
| 105 | - } | ||
| 106 | -} | 1 | +package com.bsth.controller.schedule.basicinfo; |
| 2 | + | ||
| 3 | +import com.bsth.common.ResponseCode; | ||
| 4 | +import com.bsth.controller.schedule.BController; | ||
| 5 | +import com.bsth.entity.Cars; | ||
| 6 | +import com.bsth.service.schedule.CarsService; | ||
| 7 | +import com.bsth.service.schedule.ScheduleException; | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 10 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 11 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 12 | +import org.springframework.web.bind.annotation.RestController; | ||
| 13 | + | ||
| 14 | +import java.util.HashMap; | ||
| 15 | +import java.util.Map; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * 车辆基础信息controller | ||
| 19 | + */ | ||
| 20 | +@RestController(value = "carsController_sc") | ||
| 21 | +@RequestMapping("cars_sc") | ||
| 22 | +public class CarsController extends BController<Cars, Integer> { | ||
| 23 | + @Autowired | ||
| 24 | + private CarsService carsService; | ||
| 25 | + | ||
| 26 | + @RequestMapping(value = "/validate_zbh", method = RequestMethod.GET) | ||
| 27 | + public Map<String, Object> validate_zbh(@RequestParam Map<String, Object> param) { | ||
| 28 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 29 | + try { | ||
| 30 | + // 自编号验证 | ||
| 31 | + Cars cars = new Cars( | ||
| 32 | + param.get("id_eq"), | ||
| 33 | + param.get("insideCode_eq"), | ||
| 34 | + null, | ||
| 35 | + null, | ||
| 36 | + null); | ||
| 37 | + carsService.validate_nbbh(cars); | ||
| 38 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 39 | + } catch (ScheduleException exp) { | ||
| 40 | + rtn.put("status", ResponseCode.ERROR); | ||
| 41 | + rtn.put("msg", exp.getMessage()); | ||
| 42 | + } | ||
| 43 | + return rtn; | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + @RequestMapping(value = "/validate_clbh", method = RequestMethod.GET) | ||
| 47 | + public Map<String, Object> validate_clbh(@RequestParam Map<String, Object> param) { | ||
| 48 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 49 | + try { | ||
| 50 | + // 车辆编号验证 | ||
| 51 | + Cars cars = new Cars( | ||
| 52 | + param.get("id_eq"), | ||
| 53 | + null, | ||
| 54 | + param.get("carCode_eq"), | ||
| 55 | + null, | ||
| 56 | + null); | ||
| 57 | + carsService.validate_clbh(cars); | ||
| 58 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 59 | + } catch (ScheduleException exp) { | ||
| 60 | + rtn.put("status", ResponseCode.ERROR); | ||
| 61 | + rtn.put("msg", exp.getMessage()); | ||
| 62 | + } | ||
| 63 | + return rtn; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + @RequestMapping(value = "/validate_cph", method = RequestMethod.GET) | ||
| 67 | + public Map<String, Object> validate_cph(@RequestParam Map<String, Object> param) { | ||
| 68 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 69 | + try { | ||
| 70 | + // 车牌号验证 | ||
| 71 | + Cars cars = new Cars( | ||
| 72 | + param.get("id_eq"), | ||
| 73 | + null, | ||
| 74 | + null, | ||
| 75 | + param.get("carPlate_eq"), | ||
| 76 | + null); | ||
| 77 | + carsService.validate_cph(cars); | ||
| 78 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 79 | + } catch (ScheduleException exp) { | ||
| 80 | + rtn.put("status", ResponseCode.ERROR); | ||
| 81 | + rtn.put("msg", exp.getMessage()); | ||
| 82 | + } | ||
| 83 | + return rtn; | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + @RequestMapping(value = "/validate_sbbh", method = RequestMethod.GET) | ||
| 87 | + public Map<String, Object> validate_sbbh(@RequestParam Map<String, Object> param) { | ||
| 88 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 89 | + try { | ||
| 90 | + // 设备编号验证 | ||
| 91 | + Cars cars = new Cars( | ||
| 92 | + param.get("id_eq"), | ||
| 93 | + null, | ||
| 94 | + null, | ||
| 95 | + null, | ||
| 96 | + param.get("equipmentCode_eq") | ||
| 97 | + ); | ||
| 98 | + carsService.validate_sbbh(cars); | ||
| 99 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 100 | + } catch (ScheduleException exp) { | ||
| 101 | + rtn.put("status", ResponseCode.ERROR); | ||
| 102 | + rtn.put("msg", exp.getMessage()); | ||
| 103 | + } | ||
| 104 | + return rtn; | ||
| 105 | + } | ||
| 106 | +} |
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
| @@ -525,7 +525,8 @@ public class FormsServiceImpl implements FormsService { | @@ -525,7 +525,8 @@ public class FormsServiceImpl implements FormsService { | ||
| 525 | tu.setRq(rq); | 525 | tu.setRq(rq); |
| 526 | tu.setGs(arg0.getString("gs_name").toString()); | 526 | tu.setGs(arg0.getString("gs_name").toString()); |
| 527 | tu.setZhgs(arg0.getString("fgs_name").toString()); | 527 | tu.setZhgs(arg0.getString("fgs_name").toString()); |
| 528 | - tu.setXl(arg0.getString("xlgs")); | 528 | + //tu.setXl(arg0.getString("xlgs"));这个是根据公司判断线路有几条 |
| 529 | + tu.setXl(arg0.getString("sxl")); | ||
| 529 | tu.setXlmc(arg0.getString("sxl")); | 530 | tu.setXlmc(arg0.getString("sxl")); |
| 530 | tu.setCchjh(arg0.getString("jcl").toString()); | 531 | tu.setCchjh(arg0.getString("jcl").toString()); |
| 531 | tu.setCchsj(arg0.getString("scl").toString()); | 532 | tu.setCchsj(arg0.getString("scl").toString()); |
src/main/java/com/bsth/service/realcontrol/dto/SectionRouteCoords.java
| 1 | -package com.bsth.service.realcontrol.dto; | ||
| 2 | - | ||
| 3 | -/** | ||
| 4 | - * 线调地图 路段路由DTO | ||
| 5 | - * Created by panzhao on 2016/12/1. | ||
| 6 | - */ | ||
| 7 | -public class SectionRouteCoords { | ||
| 8 | - | ||
| 9 | - private int id; | ||
| 10 | - | ||
| 11 | - private String lineCode; | ||
| 12 | - | ||
| 13 | - private String sectionCode; | ||
| 14 | - | ||
| 15 | - private String sectionrouteCode; | ||
| 16 | - | ||
| 17 | - private int directions; | ||
| 18 | - | ||
| 19 | - private String sectionName; | ||
| 20 | - | ||
| 21 | - private String gsectionVector; | ||
| 22 | - | ||
| 23 | - private Float sectionDistance; | ||
| 24 | - | ||
| 25 | - private Float sectionTime; | ||
| 26 | - | ||
| 27 | - public int getId() { | ||
| 28 | - return id; | ||
| 29 | - } | ||
| 30 | - | ||
| 31 | - public void setId(int id) { | ||
| 32 | - this.id = id; | ||
| 33 | - } | ||
| 34 | - | ||
| 35 | - public String getLineCode() { | ||
| 36 | - return lineCode; | ||
| 37 | - } | ||
| 38 | - | ||
| 39 | - public void setLineCode(String lineCode) { | ||
| 40 | - this.lineCode = lineCode; | ||
| 41 | - } | ||
| 42 | - | ||
| 43 | - public String getSectionCode() { | ||
| 44 | - return sectionCode; | ||
| 45 | - } | ||
| 46 | - | ||
| 47 | - public void setSectionCode(String sectionCode) { | ||
| 48 | - this.sectionCode = sectionCode; | ||
| 49 | - } | ||
| 50 | - | ||
| 51 | - public String getSectionrouteCode() { | ||
| 52 | - return sectionrouteCode; | ||
| 53 | - } | ||
| 54 | - | ||
| 55 | - public void setSectionrouteCode(String sectionrouteCode) { | ||
| 56 | - this.sectionrouteCode = sectionrouteCode; | ||
| 57 | - } | ||
| 58 | - | ||
| 59 | - public int getDirections() { | ||
| 60 | - return directions; | ||
| 61 | - } | ||
| 62 | - | ||
| 63 | - public void setDirections(int directions) { | ||
| 64 | - this.directions = directions; | ||
| 65 | - } | ||
| 66 | - | ||
| 67 | - public String getSectionName() { | ||
| 68 | - return sectionName; | ||
| 69 | - } | ||
| 70 | - | ||
| 71 | - public void setSectionName(String sectionName) { | ||
| 72 | - this.sectionName = sectionName; | ||
| 73 | - } | ||
| 74 | - | ||
| 75 | - public String getGsectionVector() { | ||
| 76 | - return gsectionVector; | ||
| 77 | - } | ||
| 78 | - | ||
| 79 | - public void setGsectionVector(String gsectionVector) { | ||
| 80 | - this.gsectionVector = gsectionVector; | ||
| 81 | - } | ||
| 82 | - | ||
| 83 | - public Float getSectionDistance() { | ||
| 84 | - return sectionDistance; | ||
| 85 | - } | ||
| 86 | - | ||
| 87 | - public void setSectionDistance(Float sectionDistance) { | ||
| 88 | - this.sectionDistance = sectionDistance; | ||
| 89 | - } | ||
| 90 | - | ||
| 91 | - public Float getSectionTime() { | ||
| 92 | - return sectionTime; | ||
| 93 | - } | ||
| 94 | - | ||
| 95 | - public void setSectionTime(Float sectionTime) { | ||
| 96 | - this.sectionTime = sectionTime; | ||
| 97 | - } | ||
| 98 | -} | 1 | +package com.bsth.service.realcontrol.dto; |
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * 线调地图 路段路由DTO | ||
| 5 | + * Created by panzhao on 2016/12/1. | ||
| 6 | + */ | ||
| 7 | +public class SectionRouteCoords { | ||
| 8 | + | ||
| 9 | + private int id; | ||
| 10 | + | ||
| 11 | + private String lineCode; | ||
| 12 | + | ||
| 13 | + private String sectionCode; | ||
| 14 | + | ||
| 15 | + private String sectionrouteCode; | ||
| 16 | + | ||
| 17 | + private int directions; | ||
| 18 | + | ||
| 19 | + private String sectionName; | ||
| 20 | + | ||
| 21 | + private String gsectionVector; | ||
| 22 | + | ||
| 23 | + private Float sectionDistance; | ||
| 24 | + | ||
| 25 | + private Float sectionTime; | ||
| 26 | + | ||
| 27 | + public int getId() { | ||
| 28 | + return id; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + public void setId(int id) { | ||
| 32 | + this.id = id; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + public String getLineCode() { | ||
| 36 | + return lineCode; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + public void setLineCode(String lineCode) { | ||
| 40 | + this.lineCode = lineCode; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + public String getSectionCode() { | ||
| 44 | + return sectionCode; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + public void setSectionCode(String sectionCode) { | ||
| 48 | + this.sectionCode = sectionCode; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + public String getSectionrouteCode() { | ||
| 52 | + return sectionrouteCode; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + public void setSectionrouteCode(String sectionrouteCode) { | ||
| 56 | + this.sectionrouteCode = sectionrouteCode; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + public int getDirections() { | ||
| 60 | + return directions; | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + public void setDirections(int directions) { | ||
| 64 | + this.directions = directions; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + public String getSectionName() { | ||
| 68 | + return sectionName; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + public void setSectionName(String sectionName) { | ||
| 72 | + this.sectionName = sectionName; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + public String getGsectionVector() { | ||
| 76 | + return gsectionVector; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + public void setGsectionVector(String gsectionVector) { | ||
| 80 | + this.gsectionVector = gsectionVector; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + public Float getSectionDistance() { | ||
| 84 | + return sectionDistance; | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + public void setSectionDistance(Float sectionDistance) { | ||
| 88 | + this.sectionDistance = sectionDistance; | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + public Float getSectionTime() { | ||
| 92 | + return sectionTime; | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + public void setSectionTime(Float sectionTime) { | ||
| 96 | + this.sectionTime = sectionTime; | ||
| 97 | + } | ||
| 98 | +} |
src/main/java/com/bsth/service/schedule/BService.java
| 1 | -package com.bsth.service.schedule; | ||
| 2 | - | ||
| 3 | -import org.springframework.data.domain.Page; | ||
| 4 | -import org.springframework.data.domain.Pageable; | ||
| 5 | - | ||
| 6 | -import java.io.Serializable; | ||
| 7 | -import java.util.List; | ||
| 8 | -import java.util.Map; | ||
| 9 | - | ||
| 10 | -/** | ||
| 11 | - * 基础service接口。 | ||
| 12 | - */ | ||
| 13 | -public interface BService<T, ID extends Serializable> { | ||
| 14 | - // CRUD 操作 | ||
| 15 | - // Create,Update操作 | ||
| 16 | - T save(T t); | ||
| 17 | - <S extends T> List<S> bulkSave(List<S> entities); // 批量保存(TODO:待测试) | ||
| 18 | - // Research操作 | ||
| 19 | - T findById(ID id); | ||
| 20 | - List<T> findAll(); | ||
| 21 | - Page<T> list(Map<String, Object> param, Pageable pageable); | ||
| 22 | - List<T> list(Map<String, Object> param); | ||
| 23 | - // Delete操作 | ||
| 24 | - void delete(ID id) throws ScheduleException; | ||
| 25 | -} | 1 | +package com.bsth.service.schedule; |
| 2 | + | ||
| 3 | +import org.springframework.data.domain.Page; | ||
| 4 | +import org.springframework.data.domain.Pageable; | ||
| 5 | + | ||
| 6 | +import java.io.Serializable; | ||
| 7 | +import java.util.List; | ||
| 8 | +import java.util.Map; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 基础service接口。 | ||
| 12 | + */ | ||
| 13 | +public interface BService<T, ID extends Serializable> { | ||
| 14 | + // CRUD 操作 | ||
| 15 | + // Create,Update操作 | ||
| 16 | + T save(T t); | ||
| 17 | + <S extends T> List<S> bulkSave(List<S> entities); // 批量保存(TODO:待测试) | ||
| 18 | + // Research操作 | ||
| 19 | + T findById(ID id); | ||
| 20 | + List<T> findAll(); | ||
| 21 | + Page<T> list(Map<String, Object> param, Pageable pageable); | ||
| 22 | + List<T> list(Map<String, Object> param); | ||
| 23 | + // Delete操作 | ||
| 24 | + void delete(ID id) throws ScheduleException; | ||
| 25 | +} |
src/main/java/com/bsth/service/schedule/CarsService.java
| 1 | -package com.bsth.service.schedule; | ||
| 2 | - | ||
| 3 | -import com.bsth.entity.Cars; | ||
| 4 | - | ||
| 5 | -/** | ||
| 6 | - * Created by xu on 16/12/8. | ||
| 7 | - */ | ||
| 8 | -public interface CarsService extends BService<Cars, Integer> { | ||
| 9 | - public void validate_nbbh(Cars cars) throws ScheduleException; | ||
| 10 | - public void validate_clbh(Cars cars) throws ScheduleException; | ||
| 11 | - public void validate_cph(Cars cars) throws ScheduleException; | ||
| 12 | - public void validate_sbbh(Cars cars) throws ScheduleException; | ||
| 13 | -} | 1 | +package com.bsth.service.schedule; |
| 2 | + | ||
| 3 | +import com.bsth.entity.Cars; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * Created by xu on 16/12/8. | ||
| 7 | + */ | ||
| 8 | +public interface CarsService extends BService<Cars, Integer> { | ||
| 9 | + public void validate_nbbh(Cars cars) throws ScheduleException; | ||
| 10 | + public void validate_clbh(Cars cars) throws ScheduleException; | ||
| 11 | + public void validate_cph(Cars cars) throws ScheduleException; | ||
| 12 | + public void validate_sbbh(Cars cars) throws ScheduleException; | ||
| 13 | +} |
src/main/java/com/bsth/service/schedule/ScheduleException.java
| 1 | -package com.bsth.service.schedule; | ||
| 2 | - | ||
| 3 | -/** | ||
| 4 | - * Created by xu on 16/12/5. | ||
| 5 | - */ | ||
| 6 | -public class ScheduleException extends Exception { | ||
| 7 | - public ScheduleException(String message) { | ||
| 8 | - super("计划调度业务错误==>>" + message); | ||
| 9 | - } | ||
| 10 | -} | 1 | +package com.bsth.service.schedule; |
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * Created by xu on 16/12/5. | ||
| 5 | + */ | ||
| 6 | +public class ScheduleException extends Exception { | ||
| 7 | + public ScheduleException(String message) { | ||
| 8 | + super("计划调度业务错误==>>" + message); | ||
| 9 | + } | ||
| 10 | +} |
src/main/java/com/bsth/service/schedule/impl/BServiceImpl.java
| 1 | -package com.bsth.service.schedule.impl; | ||
| 2 | - | ||
| 3 | -import com.bsth.entity.search.CustomerSpecs; | ||
| 4 | -import com.bsth.repository.BaseRepository; | ||
| 5 | -import com.bsth.service.schedule.BService; | ||
| 6 | -import com.bsth.service.schedule.ScheduleException; | ||
| 7 | -import org.slf4j.Logger; | ||
| 8 | -import org.slf4j.LoggerFactory; | ||
| 9 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 10 | -import org.springframework.beans.factory.annotation.Value; | ||
| 11 | -import org.springframework.data.domain.Page; | ||
| 12 | -import org.springframework.data.domain.Pageable; | ||
| 13 | -import org.springframework.data.jpa.domain.Specification; | ||
| 14 | - | ||
| 15 | -import javax.persistence.EntityManager; | ||
| 16 | -import java.io.Serializable; | ||
| 17 | -import java.util.ArrayList; | ||
| 18 | -import java.util.List; | ||
| 19 | -import java.util.Map; | ||
| 20 | - | ||
| 21 | -/** | ||
| 22 | - * 基础BService实现。 | ||
| 23 | - */ | ||
| 24 | -public class BServiceImpl<T, ID extends Serializable> implements BService<T, ID> { | ||
| 25 | - @Autowired | ||
| 26 | - private BaseRepository<T, ID> baseRepository; | ||
| 27 | - @Autowired | ||
| 28 | - private EntityManager entityManager; | ||
| 29 | - @Value("${hibernate.jdbc.batch_size}") | ||
| 30 | - private int batchSize; | ||
| 31 | - | ||
| 32 | - /** 日志记录器 */ | ||
| 33 | - protected Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 34 | - | ||
| 35 | - // CRUD 操作 | ||
| 36 | - // Create,Update操作 | ||
| 37 | - @Override | ||
| 38 | - public T save(T t) { | ||
| 39 | - if (logger.isDebugEnabled()) { | ||
| 40 | - logger.debug("save..."); | ||
| 41 | - } | ||
| 42 | - return baseRepository.save(t); | ||
| 43 | - } | ||
| 44 | - @Override | ||
| 45 | - public <S extends T> List<S> bulkSave(List<S> entities) { | ||
| 46 | - if (logger.isDebugEnabled()) { | ||
| 47 | - logger.debug("bulkSave..."); | ||
| 48 | - } | ||
| 49 | - | ||
| 50 | - // 不使用内部批量保存,自己实现批量保存 | ||
| 51 | - final List<S> savedEntities = new ArrayList<>(entities.size()); | ||
| 52 | - int i = 0; | ||
| 53 | - for (S t : entities) { | ||
| 54 | - entityManager.persist(t); | ||
| 55 | - savedEntities.add(t); | ||
| 56 | - i++; | ||
| 57 | - if (i % batchSize == 0) { | ||
| 58 | - entityManager.flush(); | ||
| 59 | - entityManager.clear(); | ||
| 60 | - } | ||
| 61 | - } | ||
| 62 | - return savedEntities; | ||
| 63 | - } | ||
| 64 | - | ||
| 65 | - // Research操作 | ||
| 66 | - @Override | ||
| 67 | - public T findById(ID id) { | ||
| 68 | - if (logger.isDebugEnabled()) { | ||
| 69 | - logger.debug("findById..."); | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | - return baseRepository.findOne(id); | ||
| 73 | - } | ||
| 74 | - @Override | ||
| 75 | - public List<T> findAll() { | ||
| 76 | - if (logger.isDebugEnabled()) { | ||
| 77 | - logger.debug("findAll..."); | ||
| 78 | - } | ||
| 79 | - | ||
| 80 | - return (List<T>) baseRepository.findAll(); | ||
| 81 | - } | ||
| 82 | - @Override | ||
| 83 | - public Page<T> list(Map<String, Object> param, Pageable pageable) { | ||
| 84 | - if (logger.isDebugEnabled()) { | ||
| 85 | - logger.debug("list(...,pageable)..."); | ||
| 86 | - } | ||
| 87 | - | ||
| 88 | - // 自定义查询参数 | ||
| 89 | - Specification<T> specification = new CustomerSpecs<>(param); | ||
| 90 | - return baseRepository.findAll(specification, pageable); | ||
| 91 | - } | ||
| 92 | - @Override | ||
| 93 | - public List<T> list(Map<String, Object> param) { | ||
| 94 | - if (logger.isDebugEnabled()) { | ||
| 95 | - logger.debug("list..."); | ||
| 96 | - } | ||
| 97 | - | ||
| 98 | - // 自定义查询参数 | ||
| 99 | - Specification<T> specification = new CustomerSpecs<>(param); | ||
| 100 | - return baseRepository.findAll(specification); | ||
| 101 | - } | ||
| 102 | - // Delete操作 | ||
| 103 | - @Override | ||
| 104 | - public void delete(ID id) throws ScheduleException { | ||
| 105 | - if (logger.isDebugEnabled()) { | ||
| 106 | - logger.debug("delete..."); | ||
| 107 | - } | ||
| 108 | - | ||
| 109 | - baseRepository.delete(id); | ||
| 110 | - } | ||
| 111 | -} | 1 | +package com.bsth.service.schedule.impl; |
| 2 | + | ||
| 3 | +import com.bsth.entity.search.CustomerSpecs; | ||
| 4 | +import com.bsth.repository.BaseRepository; | ||
| 5 | +import com.bsth.service.schedule.BService; | ||
| 6 | +import com.bsth.service.schedule.ScheduleException; | ||
| 7 | +import org.slf4j.Logger; | ||
| 8 | +import org.slf4j.LoggerFactory; | ||
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 10 | +import org.springframework.beans.factory.annotation.Value; | ||
| 11 | +import org.springframework.data.domain.Page; | ||
| 12 | +import org.springframework.data.domain.Pageable; | ||
| 13 | +import org.springframework.data.jpa.domain.Specification; | ||
| 14 | + | ||
| 15 | +import javax.persistence.EntityManager; | ||
| 16 | +import java.io.Serializable; | ||
| 17 | +import java.util.ArrayList; | ||
| 18 | +import java.util.List; | ||
| 19 | +import java.util.Map; | ||
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * 基础BService实现。 | ||
| 23 | + */ | ||
| 24 | +public class BServiceImpl<T, ID extends Serializable> implements BService<T, ID> { | ||
| 25 | + @Autowired | ||
| 26 | + private BaseRepository<T, ID> baseRepository; | ||
| 27 | + @Autowired | ||
| 28 | + private EntityManager entityManager; | ||
| 29 | + @Value("${hibernate.jdbc.batch_size}") | ||
| 30 | + private int batchSize; | ||
| 31 | + | ||
| 32 | + /** 日志记录器 */ | ||
| 33 | + protected Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 34 | + | ||
| 35 | + // CRUD 操作 | ||
| 36 | + // Create,Update操作 | ||
| 37 | + @Override | ||
| 38 | + public T save(T t) { | ||
| 39 | + if (logger.isDebugEnabled()) { | ||
| 40 | + logger.debug("save..."); | ||
| 41 | + } | ||
| 42 | + return baseRepository.save(t); | ||
| 43 | + } | ||
| 44 | + @Override | ||
| 45 | + public <S extends T> List<S> bulkSave(List<S> entities) { | ||
| 46 | + if (logger.isDebugEnabled()) { | ||
| 47 | + logger.debug("bulkSave..."); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + // 不使用内部批量保存,自己实现批量保存 | ||
| 51 | + final List<S> savedEntities = new ArrayList<>(entities.size()); | ||
| 52 | + int i = 0; | ||
| 53 | + for (S t : entities) { | ||
| 54 | + entityManager.persist(t); | ||
| 55 | + savedEntities.add(t); | ||
| 56 | + i++; | ||
| 57 | + if (i % batchSize == 0) { | ||
| 58 | + entityManager.flush(); | ||
| 59 | + entityManager.clear(); | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | + return savedEntities; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + // Research操作 | ||
| 66 | + @Override | ||
| 67 | + public T findById(ID id) { | ||
| 68 | + if (logger.isDebugEnabled()) { | ||
| 69 | + logger.debug("findById..."); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + return baseRepository.findOne(id); | ||
| 73 | + } | ||
| 74 | + @Override | ||
| 75 | + public List<T> findAll() { | ||
| 76 | + if (logger.isDebugEnabled()) { | ||
| 77 | + logger.debug("findAll..."); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + return (List<T>) baseRepository.findAll(); | ||
| 81 | + } | ||
| 82 | + @Override | ||
| 83 | + public Page<T> list(Map<String, Object> param, Pageable pageable) { | ||
| 84 | + if (logger.isDebugEnabled()) { | ||
| 85 | + logger.debug("list(...,pageable)..."); | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + // 自定义查询参数 | ||
| 89 | + Specification<T> specification = new CustomerSpecs<>(param); | ||
| 90 | + return baseRepository.findAll(specification, pageable); | ||
| 91 | + } | ||
| 92 | + @Override | ||
| 93 | + public List<T> list(Map<String, Object> param) { | ||
| 94 | + if (logger.isDebugEnabled()) { | ||
| 95 | + logger.debug("list..."); | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + // 自定义查询参数 | ||
| 99 | + Specification<T> specification = new CustomerSpecs<>(param); | ||
| 100 | + return baseRepository.findAll(specification); | ||
| 101 | + } | ||
| 102 | + // Delete操作 | ||
| 103 | + @Override | ||
| 104 | + public void delete(ID id) throws ScheduleException { | ||
| 105 | + if (logger.isDebugEnabled()) { | ||
| 106 | + logger.debug("delete..."); | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + baseRepository.delete(id); | ||
| 110 | + } | ||
| 111 | +} |
src/main/java/com/bsth/service/schedule/impl/CarsServiceImpl.java
| 1 | -package com.bsth.service.schedule.impl; | ||
| 2 | - | ||
| 3 | -import com.bsth.entity.Cars; | ||
| 4 | -import com.bsth.service.schedule.CarsService; | ||
| 5 | -import com.bsth.service.schedule.ScheduleException; | ||
| 6 | -import org.springframework.stereotype.Service; | ||
| 7 | -import org.springframework.transaction.annotation.Transactional; | ||
| 8 | -import org.springframework.util.CollectionUtils; | ||
| 9 | - | ||
| 10 | -import java.util.HashMap; | ||
| 11 | -import java.util.Map; | ||
| 12 | - | ||
| 13 | -/** | ||
| 14 | - * Created by xu on 16/12/8. | ||
| 15 | - */ | ||
| 16 | -@Service(value = "carsServiceImpl_sc") | ||
| 17 | -public class CarsServiceImpl extends BServiceImpl<Cars, Integer> implements CarsService { | ||
| 18 | - | ||
| 19 | - @Override | ||
| 20 | - @Transactional | ||
| 21 | - public void validate_nbbh(Cars cars) throws ScheduleException { | ||
| 22 | - // 查询条件 | ||
| 23 | - Map<String, Object> param = new HashMap<>(); | ||
| 24 | - if (cars.getId() != null) { | ||
| 25 | - param.put("id_ne", cars.getId()); | ||
| 26 | - } | ||
| 27 | - param.put("insideCode_eq", cars.getInsideCode()); | ||
| 28 | - if (!CollectionUtils.isEmpty(list(param))) { | ||
| 29 | - throw new ScheduleException("车辆内部编号/自编号重复"); | ||
| 30 | - } | ||
| 31 | - } | ||
| 32 | - | ||
| 33 | - @Override | ||
| 34 | - @Transactional | ||
| 35 | - public void validate_clbh(Cars cars) throws ScheduleException { | ||
| 36 | - // 查询条件 | ||
| 37 | - Map<String, Object> param = new HashMap<>(); | ||
| 38 | - if (cars.getId() != null) { | ||
| 39 | - param.put("id_ne", cars.getId()); | ||
| 40 | - } | ||
| 41 | - param.put("carCode_eq", cars.getCarCode()); | ||
| 42 | - if (!CollectionUtils.isEmpty(list(param))) { | ||
| 43 | - throw new ScheduleException("车辆编号重复"); | ||
| 44 | - } | ||
| 45 | - } | ||
| 46 | - | ||
| 47 | - @Override | ||
| 48 | - @Transactional | ||
| 49 | - public void validate_cph(Cars cars) throws ScheduleException { | ||
| 50 | - // 查询条件 | ||
| 51 | - Map<String, Object> param = new HashMap<>(); | ||
| 52 | - if (cars.getId() != null) { | ||
| 53 | - param.put("id_ne", cars.getId()); | ||
| 54 | - } | ||
| 55 | - param.put("carPlate_eq", cars.getCarPlate()); | ||
| 56 | - if (!CollectionUtils.isEmpty(list(param))) { | ||
| 57 | - throw new ScheduleException("车牌号重复"); | ||
| 58 | - } | ||
| 59 | - } | ||
| 60 | - | ||
| 61 | - @Override | ||
| 62 | - @Transactional | ||
| 63 | - public void validate_sbbh(Cars cars) throws ScheduleException { | ||
| 64 | - // 查询条件 | ||
| 65 | - Map<String, Object> param = new HashMap<>(); | ||
| 66 | - if (cars.getId() != null) { | ||
| 67 | - param.put("id_ne", cars.getId()); | ||
| 68 | - } | ||
| 69 | - param.put("equipmentCode_eq", cars.getEquipmentCode()); | ||
| 70 | - if (!CollectionUtils.isEmpty(list(param))) { | ||
| 71 | - throw new ScheduleException("设备编号重复"); | ||
| 72 | - } | ||
| 73 | - } | ||
| 74 | -} | 1 | +package com.bsth.service.schedule.impl; |
| 2 | + | ||
| 3 | +import com.bsth.entity.Cars; | ||
| 4 | +import com.bsth.service.schedule.CarsService; | ||
| 5 | +import com.bsth.service.schedule.ScheduleException; | ||
| 6 | +import org.springframework.stereotype.Service; | ||
| 7 | +import org.springframework.transaction.annotation.Transactional; | ||
| 8 | +import org.springframework.util.CollectionUtils; | ||
| 9 | + | ||
| 10 | +import java.util.HashMap; | ||
| 11 | +import java.util.Map; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * Created by xu on 16/12/8. | ||
| 15 | + */ | ||
| 16 | +@Service(value = "carsServiceImpl_sc") | ||
| 17 | +public class CarsServiceImpl extends BServiceImpl<Cars, Integer> implements CarsService { | ||
| 18 | + | ||
| 19 | + @Override | ||
| 20 | + @Transactional | ||
| 21 | + public void validate_nbbh(Cars cars) throws ScheduleException { | ||
| 22 | + // 查询条件 | ||
| 23 | + Map<String, Object> param = new HashMap<>(); | ||
| 24 | + if (cars.getId() != null) { | ||
| 25 | + param.put("id_ne", cars.getId()); | ||
| 26 | + } | ||
| 27 | + param.put("insideCode_eq", cars.getInsideCode()); | ||
| 28 | + if (!CollectionUtils.isEmpty(list(param))) { | ||
| 29 | + throw new ScheduleException("车辆内部编号/自编号重复"); | ||
| 30 | + } | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + @Override | ||
| 34 | + @Transactional | ||
| 35 | + public void validate_clbh(Cars cars) throws ScheduleException { | ||
| 36 | + // 查询条件 | ||
| 37 | + Map<String, Object> param = new HashMap<>(); | ||
| 38 | + if (cars.getId() != null) { | ||
| 39 | + param.put("id_ne", cars.getId()); | ||
| 40 | + } | ||
| 41 | + param.put("carCode_eq", cars.getCarCode()); | ||
| 42 | + if (!CollectionUtils.isEmpty(list(param))) { | ||
| 43 | + throw new ScheduleException("车辆编号重复"); | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + @Override | ||
| 48 | + @Transactional | ||
| 49 | + public void validate_cph(Cars cars) throws ScheduleException { | ||
| 50 | + // 查询条件 | ||
| 51 | + Map<String, Object> param = new HashMap<>(); | ||
| 52 | + if (cars.getId() != null) { | ||
| 53 | + param.put("id_ne", cars.getId()); | ||
| 54 | + } | ||
| 55 | + param.put("carPlate_eq", cars.getCarPlate()); | ||
| 56 | + if (!CollectionUtils.isEmpty(list(param))) { | ||
| 57 | + throw new ScheduleException("车牌号重复"); | ||
| 58 | + } | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + @Override | ||
| 62 | + @Transactional | ||
| 63 | + public void validate_sbbh(Cars cars) throws ScheduleException { | ||
| 64 | + // 查询条件 | ||
| 65 | + Map<String, Object> param = new HashMap<>(); | ||
| 66 | + if (cars.getId() != null) { | ||
| 67 | + param.put("id_ne", cars.getId()); | ||
| 68 | + } | ||
| 69 | + param.put("equipmentCode_eq", cars.getEquipmentCode()); | ||
| 70 | + if (!CollectionUtils.isEmpty(list(param))) { | ||
| 71 | + throw new ScheduleException("设备编号重复"); | ||
| 72 | + } | ||
| 73 | + } | ||
| 74 | +} |
src/main/resources/static/pages/forms/statement/daily.html
| @@ -98,7 +98,6 @@ | @@ -98,7 +98,6 @@ | ||
| 98 | for(var code in result){ | 98 | for(var code in result){ |
| 99 | data.push({id: code, text: result[code]}); | 99 | data.push({id: code, text: result[code]}); |
| 100 | } | 100 | } |
| 101 | - console.log(data); | ||
| 102 | initPinYinSelect2('#line',data,''); | 101 | initPinYinSelect2('#line',data,''); |
| 103 | 102 | ||
| 104 | }) | 103 | }) |
| @@ -106,9 +105,10 @@ | @@ -106,9 +105,10 @@ | ||
| 106 | var date; | 105 | var date; |
| 107 | $("#query").on("click",function(){ | 106 | $("#query").on("click",function(){ |
| 108 | line = $("#line").val(); | 107 | line = $("#line").val(); |
| 108 | + var lineName=$("#select2-line-container").html(); | ||
| 109 | date = $("#date").val(); | 109 | date = $("#date").val(); |
| 110 | $get('/realSchedule/dailyInfo',{line:line,date:date,type:'query'},function(result){ | 110 | $get('/realSchedule/dailyInfo',{line:line,date:date,type:'query'},function(result){ |
| 111 | - $("#form_line").text(line); | 111 | + $("#form_line").text(lineName); |
| 112 | $("#form_date").text(date); | 112 | $("#form_date").text(date); |
| 113 | var total_zgl = 0,total_ksgl = 0,total_yh = 0,total_bcs = 0; | 113 | var total_zgl = 0,total_ksgl = 0,total_yh = 0,total_bcs = 0; |
| 114 | $.each(result, function(i, obj) { | 114 | $.each(result, function(i, obj) { |
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/service.js
| 1 | -// 车辆信息service | ||
| 2 | -angular.module('ScheduleApp').factory('BusInfoManageService_g', ['$resource', function($resource) { | ||
| 3 | - return { | ||
| 4 | - rest: $resource( | ||
| 5 | - '/cars_sc/:id', | ||
| 6 | - {order: 'carCode', direction: 'ASC', id: '@id_route'}, | ||
| 7 | - { | ||
| 8 | - list: { | ||
| 9 | - method: 'GET', | ||
| 10 | - params: { | ||
| 11 | - page: 0 | ||
| 12 | - }, | ||
| 13 | - transformResponse: function(rs) { | ||
| 14 | - var dst = angular.fromJson(rs); | ||
| 15 | - if (dst.status == 'SUCCESS') { | ||
| 16 | - return dst.data; | ||
| 17 | - } else { | ||
| 18 | - return dst; // 业务错误留给控制器处理 | ||
| 19 | - } | ||
| 20 | - } | ||
| 21 | - }, | ||
| 22 | - get: { | ||
| 23 | - method: 'GET', | ||
| 24 | - transformResponse: function(rs) { | ||
| 25 | - var dst = angular.fromJson(rs); | ||
| 26 | - if (dst.status == 'SUCCESS') { | ||
| 27 | - return dst.data; | ||
| 28 | - } else { | ||
| 29 | - return dst; | ||
| 30 | - } | ||
| 31 | - } | ||
| 32 | - }, | ||
| 33 | - save: { | ||
| 34 | - method: 'POST' | ||
| 35 | - } | ||
| 36 | - } | ||
| 37 | - ), | ||
| 38 | - import: $resource( | ||
| 39 | - '/cars/importfile', | ||
| 40 | - {}, | ||
| 41 | - { | ||
| 42 | - do: { | ||
| 43 | - method: 'POST', | ||
| 44 | - headers: { | ||
| 45 | - 'Content-Type': 'application/x-www-form-urlencoded' | ||
| 46 | - }, | ||
| 47 | - transformRequest: function(obj) { | ||
| 48 | - var str = []; | ||
| 49 | - for (var p in obj) { | ||
| 50 | - str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p])); | ||
| 51 | - } | ||
| 52 | - return str.join("&"); | ||
| 53 | - } | ||
| 54 | - } | ||
| 55 | - } | ||
| 56 | - ), | ||
| 57 | - validate: $resource( | ||
| 58 | - '/cars/validate/:type', | ||
| 59 | - {}, | ||
| 60 | - { | ||
| 61 | - insideCode: { | ||
| 62 | - method: 'GET' | ||
| 63 | - } | ||
| 64 | - } | ||
| 65 | - ), | ||
| 66 | - dataTools: $resource( | ||
| 67 | - '/cars/:type', | ||
| 68 | - {}, | ||
| 69 | - { | ||
| 70 | - dataExport: { | ||
| 71 | - method: 'GET', | ||
| 72 | - responseType: "arraybuffer", | ||
| 73 | - params: { | ||
| 74 | - type: "dataExport" | ||
| 75 | - }, | ||
| 76 | - transformResponse: function(data, headers){ | ||
| 77 | - return {data : data}; | ||
| 78 | - } | ||
| 79 | - } | ||
| 80 | - } | ||
| 81 | - ) | ||
| 82 | - }; | 1 | +// 车辆信息service |
| 2 | +angular.module('ScheduleApp').factory('BusInfoManageService_g', ['$resource', function($resource) { | ||
| 3 | + return { | ||
| 4 | + rest: $resource( | ||
| 5 | + '/cars_sc/:id', | ||
| 6 | + {order: 'carCode', direction: 'ASC', id: '@id_route'}, | ||
| 7 | + { | ||
| 8 | + list: { | ||
| 9 | + method: 'GET', | ||
| 10 | + params: { | ||
| 11 | + page: 0 | ||
| 12 | + }, | ||
| 13 | + transformResponse: function(rs) { | ||
| 14 | + var dst = angular.fromJson(rs); | ||
| 15 | + if (dst.status == 'SUCCESS') { | ||
| 16 | + return dst.data; | ||
| 17 | + } else { | ||
| 18 | + return dst; // 业务错误留给控制器处理 | ||
| 19 | + } | ||
| 20 | + } | ||
| 21 | + }, | ||
| 22 | + get: { | ||
| 23 | + method: 'GET', | ||
| 24 | + transformResponse: function(rs) { | ||
| 25 | + var dst = angular.fromJson(rs); | ||
| 26 | + if (dst.status == 'SUCCESS') { | ||
| 27 | + return dst.data; | ||
| 28 | + } else { | ||
| 29 | + return dst; | ||
| 30 | + } | ||
| 31 | + } | ||
| 32 | + }, | ||
| 33 | + save: { | ||
| 34 | + method: 'POST' | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | + ), | ||
| 38 | + import: $resource( | ||
| 39 | + '/cars/importfile', | ||
| 40 | + {}, | ||
| 41 | + { | ||
| 42 | + do: { | ||
| 43 | + method: 'POST', | ||
| 44 | + headers: { | ||
| 45 | + 'Content-Type': 'application/x-www-form-urlencoded' | ||
| 46 | + }, | ||
| 47 | + transformRequest: function(obj) { | ||
| 48 | + var str = []; | ||
| 49 | + for (var p in obj) { | ||
| 50 | + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p])); | ||
| 51 | + } | ||
| 52 | + return str.join("&"); | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + } | ||
| 56 | + ), | ||
| 57 | + validate: $resource( | ||
| 58 | + '/cars/validate/:type', | ||
| 59 | + {}, | ||
| 60 | + { | ||
| 61 | + insideCode: { | ||
| 62 | + method: 'GET' | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | + ), | ||
| 66 | + dataTools: $resource( | ||
| 67 | + '/cars/:type', | ||
| 68 | + {}, | ||
| 69 | + { | ||
| 70 | + dataExport: { | ||
| 71 | + method: 'GET', | ||
| 72 | + responseType: "arraybuffer", | ||
| 73 | + params: { | ||
| 74 | + type: "dataExport" | ||
| 75 | + }, | ||
| 76 | + transformResponse: function(data, headers){ | ||
| 77 | + return {data : data}; | ||
| 78 | + } | ||
| 79 | + } | ||
| 80 | + } | ||
| 81 | + ) | ||
| 82 | + }; | ||
| 83 | }]); | 83 | }]); |
| 84 | \ No newline at end of file | 84 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/service.js
| 1 | -// 车辆设备信息service | ||
| 2 | -angular.module('ScheduleApp').factory('DeviceInfoManageService_g', ['$resource', function($resource) { | ||
| 3 | - return $resource( | ||
| 4 | - '/cde/:id', | ||
| 5 | - {order: 'xl,isCancel,cl,qyrq', direction: 'ASC,ASC,ASC,DESC', id: '@id_route'}, | ||
| 6 | - { | ||
| 7 | - list: { | ||
| 8 | - method: 'GET', | ||
| 9 | - params: { | ||
| 10 | - page: 0 | ||
| 11 | - } | ||
| 12 | - }, | ||
| 13 | - get: { | ||
| 14 | - method: 'GET' | ||
| 15 | - }, | ||
| 16 | - save: { | ||
| 17 | - method: 'POST' | ||
| 18 | - }, | ||
| 19 | - delete: { | ||
| 20 | - method: 'DELETE' | ||
| 21 | - } | ||
| 22 | - } | ||
| 23 | - ); | 1 | +// 车辆设备信息service |
| 2 | +angular.module('ScheduleApp').factory('DeviceInfoManageService_g', ['$resource', function($resource) { | ||
| 3 | + return $resource( | ||
| 4 | + '/cde/:id', | ||
| 5 | + {order: 'xl,isCancel,cl,qyrq', direction: 'ASC,ASC,ASC,DESC', id: '@id_route'}, | ||
| 6 | + { | ||
| 7 | + list: { | ||
| 8 | + method: 'GET', | ||
| 9 | + params: { | ||
| 10 | + page: 0 | ||
| 11 | + } | ||
| 12 | + }, | ||
| 13 | + get: { | ||
| 14 | + method: 'GET' | ||
| 15 | + }, | ||
| 16 | + save: { | ||
| 17 | + method: 'POST' | ||
| 18 | + }, | ||
| 19 | + delete: { | ||
| 20 | + method: 'DELETE' | ||
| 21 | + } | ||
| 22 | + } | ||
| 23 | + ); | ||
| 24 | }]); | 24 | }]); |
| 25 | \ No newline at end of file | 25 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/service.js
| 1 | -// 人员信息service | ||
| 2 | -angular.module('ScheduleApp').factory('EmployeeInfoManageService_g', ['$resource', function($resource) { | ||
| 3 | - return { | ||
| 4 | - rest : $resource( | ||
| 5 | - '/personnel/:id', | ||
| 6 | - {order: 'jobCode', direction: 'ASC', id: '@id_route'}, | ||
| 7 | - { | ||
| 8 | - list: { | ||
| 9 | - method: 'GET', | ||
| 10 | - params: { | ||
| 11 | - page: 0 | ||
| 12 | - } | ||
| 13 | - }, | ||
| 14 | - get: { | ||
| 15 | - method: 'GET' | ||
| 16 | - }, | ||
| 17 | - save: { | ||
| 18 | - method: 'POST' | ||
| 19 | - } | ||
| 20 | - } | ||
| 21 | - ), | ||
| 22 | - validate: $resource( | ||
| 23 | - '/personnel/validate/:type', | ||
| 24 | - {}, | ||
| 25 | - { | ||
| 26 | - jobCode: { | ||
| 27 | - method: 'GET' | ||
| 28 | - } | ||
| 29 | - } | ||
| 30 | - ), | ||
| 31 | - dataTools: $resource( | ||
| 32 | - '/personnel/:type', | ||
| 33 | - {}, | ||
| 34 | - { | ||
| 35 | - dataExport: { | ||
| 36 | - method: 'GET', | ||
| 37 | - responseType: "arraybuffer", | ||
| 38 | - params: { | ||
| 39 | - type: "dataExport" | ||
| 40 | - }, | ||
| 41 | - transformResponse: function(data, headers){ | ||
| 42 | - return {data : data}; | ||
| 43 | - } | ||
| 44 | - } | ||
| 45 | - } | ||
| 46 | - ) | ||
| 47 | - }; | ||
| 48 | -}]); | 1 | +// 人员信息service |
| 2 | +angular.module('ScheduleApp').factory('EmployeeInfoManageService_g', ['$resource', function($resource) { | ||
| 3 | + return { | ||
| 4 | + rest : $resource( | ||
| 5 | + '/personnel/:id', | ||
| 6 | + {order: 'jobCode', direction: 'ASC', id: '@id_route'}, | ||
| 7 | + { | ||
| 8 | + list: { | ||
| 9 | + method: 'GET', | ||
| 10 | + params: { | ||
| 11 | + page: 0 | ||
| 12 | + } | ||
| 13 | + }, | ||
| 14 | + get: { | ||
| 15 | + method: 'GET' | ||
| 16 | + }, | ||
| 17 | + save: { | ||
| 18 | + method: 'POST' | ||
| 19 | + } | ||
| 20 | + } | ||
| 21 | + ), | ||
| 22 | + validate: $resource( | ||
| 23 | + '/personnel/validate/:type', | ||
| 24 | + {}, | ||
| 25 | + { | ||
| 26 | + jobCode: { | ||
| 27 | + method: 'GET' | ||
| 28 | + } | ||
| 29 | + } | ||
| 30 | + ), | ||
| 31 | + dataTools: $resource( | ||
| 32 | + '/personnel/:type', | ||
| 33 | + {}, | ||
| 34 | + { | ||
| 35 | + dataExport: { | ||
| 36 | + method: 'GET', | ||
| 37 | + responseType: "arraybuffer", | ||
| 38 | + params: { | ||
| 39 | + type: "dataExport" | ||
| 40 | + }, | ||
| 41 | + transformResponse: function(data, headers){ | ||
| 42 | + return {data : data}; | ||
| 43 | + } | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + ) | ||
| 47 | + }; | ||
| 48 | +}]); |
src/main/resources/static/pages/scheduleApp/module/common/directives/select/mySelect.js
| 1 | -/** | ||
| 2 | - * mySelect指令,封装uiselect指令,封装内部数据获取,只支持单选 | ||
| 3 | - * cm(必须):绑定外部对象,因为关联的字段不只一个,单独使用ngModel不够 | ||
| 4 | - * cmoptions(必须):描述绑定的逻辑配置对象,格式如下: | ||
| 5 | - * | ||
| 6 | - * // TODO: | ||
| 7 | - */ | ||
| 8 | -angular.module('ScheduleApp').directive('mySelect', [ | ||
| 9 | - function() { | ||
| 10 | - return { | ||
| 11 | - restrict: 'E', | ||
| 12 | - template: '<div>bioxuxuan</div>', | ||
| 13 | - require: 'ngModel', | ||
| 14 | - compile: function(tElem, tAttrs) { | ||
| 15 | - return { | ||
| 16 | - pre: function(scope, element, attr) { | ||
| 17 | - | ||
| 18 | - }, | ||
| 19 | - post: function(scope, element, attr, ngModelCtr) { | ||
| 20 | - // model -> view | ||
| 21 | - ngModelCtr.$formatters.push(function(modelValue) { | ||
| 22 | - // 监控model的变化 | ||
| 23 | - if (typeof modelValue != "undefined") { | ||
| 24 | - console.log(modelValue); | ||
| 25 | - | ||
| 26 | - return modelValue; | ||
| 27 | - } | ||
| 28 | - }); | ||
| 29 | - | ||
| 30 | - ngModelCtr.$render = function() { | ||
| 31 | - if (typeof scope.ctrl.say != "undefined") { | ||
| 32 | - element.find('div').css('color', 'red'); | ||
| 33 | - } | ||
| 34 | - }; | ||
| 35 | - | ||
| 36 | - ngModelCtr.$setViewValue("init value"); | ||
| 37 | - | ||
| 38 | - | ||
| 39 | - } | ||
| 40 | - } | ||
| 41 | - } | ||
| 42 | - } | ||
| 43 | - } | 1 | +/** |
| 2 | + * mySelect指令,封装uiselect指令,封装内部数据获取,只支持单选 | ||
| 3 | + * cm(必须):绑定外部对象,因为关联的字段不只一个,单独使用ngModel不够 | ||
| 4 | + * cmoptions(必须):描述绑定的逻辑配置对象,格式如下: | ||
| 5 | + * | ||
| 6 | + * // TODO: | ||
| 7 | + */ | ||
| 8 | +angular.module('ScheduleApp').directive('mySelect', [ | ||
| 9 | + function() { | ||
| 10 | + return { | ||
| 11 | + restrict: 'E', | ||
| 12 | + template: '<div>bioxuxuan</div>', | ||
| 13 | + require: 'ngModel', | ||
| 14 | + compile: function(tElem, tAttrs) { | ||
| 15 | + return { | ||
| 16 | + pre: function(scope, element, attr) { | ||
| 17 | + | ||
| 18 | + }, | ||
| 19 | + post: function(scope, element, attr, ngModelCtr) { | ||
| 20 | + // model -> view | ||
| 21 | + ngModelCtr.$formatters.push(function(modelValue) { | ||
| 22 | + // 监控model的变化 | ||
| 23 | + if (typeof modelValue != "undefined") { | ||
| 24 | + console.log(modelValue); | ||
| 25 | + | ||
| 26 | + return modelValue; | ||
| 27 | + } | ||
| 28 | + }); | ||
| 29 | + | ||
| 30 | + ngModelCtr.$render = function() { | ||
| 31 | + if (typeof scope.ctrl.say != "undefined") { | ||
| 32 | + element.find('div').css('color', 'red'); | ||
| 33 | + } | ||
| 34 | + }; | ||
| 35 | + | ||
| 36 | + ngModelCtr.$setViewValue("init value"); | ||
| 37 | + | ||
| 38 | + | ||
| 39 | + } | ||
| 40 | + } | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | + } | ||
| 44 | ]); | 44 | ]); |
| 45 | \ No newline at end of file | 45 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/common/directives/select/mySelectTemplate.html
| 1 | -<div class="input-group" name="指令compile阶段设定1" | ||
| 2 | - ng-model="$saSelectCtrl.$$internalmodel"> | ||
| 3 | - <ui-select ng-model="$saSelectCtrl.$$internal_select_value" on-select="$saSelectCtrl.$$internal_select_fn($item)" | ||
| 4 | - theme="bootstrap" > | ||
| 5 | - <ui-select-match placeholder="指令compile阶段设定">指令compile阶段设定2</ui-select-match> | ||
| 6 | - <ui-select-choices repeat="指令compile阶段设定3" | ||
| 7 | - refresh="$saSelectCtrl.$$internal_refresh_fn($select.search)" | ||
| 8 | - refresh-delay="10"> | ||
| 9 | - | ||
| 10 | - 指令compile阶段设定777 | ||
| 11 | - | ||
| 12 | - </ui-select-choices> | ||
| 13 | - </ui-select> | ||
| 14 | - <span class="input-group-btn"> | ||
| 15 | - <button type="button" ng-click="$saSelectCtrl.$$internal_remove_fn()" class="btn btn-default"> | ||
| 16 | - <span class="glyphicon glyphicon-trash"></span> | ||
| 17 | - </button> | ||
| 18 | - </span> | 1 | +<div class="input-group" name="指令compile阶段设定1" |
| 2 | + ng-model="$saSelectCtrl.$$internalmodel"> | ||
| 3 | + <ui-select ng-model="$saSelectCtrl.$$internal_select_value" on-select="$saSelectCtrl.$$internal_select_fn($item)" | ||
| 4 | + theme="bootstrap" > | ||
| 5 | + <ui-select-match placeholder="指令compile阶段设定">指令compile阶段设定2</ui-select-match> | ||
| 6 | + <ui-select-choices repeat="指令compile阶段设定3" | ||
| 7 | + refresh="$saSelectCtrl.$$internal_refresh_fn($select.search)" | ||
| 8 | + refresh-delay="10"> | ||
| 9 | + | ||
| 10 | + 指令compile阶段设定777 | ||
| 11 | + | ||
| 12 | + </ui-select-choices> | ||
| 13 | + </ui-select> | ||
| 14 | + <span class="input-group-btn"> | ||
| 15 | + <button type="button" ng-click="$saSelectCtrl.$$internal_remove_fn()" class="btn btn-default"> | ||
| 16 | + <span class="glyphicon glyphicon-trash"></span> | ||
| 17 | + </button> | ||
| 18 | + </span> | ||
| 19 | </div> | 19 | </div> |
| 20 | \ No newline at end of file | 20 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/common/dts1/validation/remoteValidation3.js
| 1 | -/** | ||
| 2 | - * remoteValidationt3 远程验证指令(监控依赖的model变化) | ||
| 3 | - * 属性如下: | ||
| 4 | - * remotevtype(必须):验证类型(在service中有对应映射),如rvtype="xl" | ||
| 5 | - * remotemodel(必须):关联的model | ||
| 6 | - * remotemodelcol(必须):关联的model属性 | ||
| 7 | - */ | ||
| 8 | -angular.module('ScheduleApp').directive( | ||
| 9 | - 'remoteValidation3', | ||
| 10 | - [ | ||
| 11 | - '$$SearchInfoService_g', | ||
| 12 | - '$q', | ||
| 13 | - function($$SearchInfoService_g, $q) { | ||
| 14 | - return { | ||
| 15 | - restrict: 'A', // 属性 | ||
| 16 | - require: '^ngModel', // 依赖所属指令的ngModel | ||
| 17 | - compile: function(tElem, tAttrs) { | ||
| 18 | - var remotevtype_attr = tAttrs['remotevtype']; | ||
| 19 | - var remotemodel_attr = tAttrs['remotemodel']; | ||
| 20 | - var remotemodelcol_attr = tAttrs['remotemodelcol']; | ||
| 21 | - if (!remotevtype_attr) { | ||
| 22 | - throw new Error("remotevtype属性必须填写"); | ||
| 23 | - } | ||
| 24 | - if (!remotemodel_attr) { | ||
| 25 | - throw new Error("remotemodel属性必须填写"); | ||
| 26 | - } | ||
| 27 | - if (!remotemodelcol_attr) { | ||
| 28 | - throw new Error("remotemodelcol属性必须填写"); | ||
| 29 | - } | ||
| 30 | - | ||
| 31 | - return { | ||
| 32 | - pre: function(scope, element, attr) { | ||
| 33 | - | ||
| 34 | - }, | ||
| 35 | - | ||
| 36 | - post: function(scope, element, attr, ngModelCtrl) { | ||
| 37 | - ngModelCtrl.$asyncValidators.remote = | ||
| 38 | - function(modelValue, viewValue) { | ||
| 39 | - var deferred = $q.defer(); | ||
| 40 | - | ||
| 41 | - // 远端验证service | ||
| 42 | - var param = JSON.parse(attr['remotemodel']); | ||
| 43 | - console.log(param); | ||
| 44 | - param[remotemodelcol_attr] = modelValue; | ||
| 45 | - $$SearchInfoService_g.validate[remotevtype_attr].remote.do( | ||
| 46 | - param, | ||
| 47 | - function(result) { | ||
| 48 | - if (result.status == "SUCCESS") { | ||
| 49 | - deferred.resolve(); | ||
| 50 | - } else { | ||
| 51 | - scope.$remote_msg = result.msg; | ||
| 52 | - deferred.reject(); | ||
| 53 | - } | ||
| 54 | - }, | ||
| 55 | - function(result) { | ||
| 56 | - deferred.reject(); | ||
| 57 | - } | ||
| 58 | - ); | ||
| 59 | - | ||
| 60 | - return deferred.promise; | ||
| 61 | - }; | ||
| 62 | - } | ||
| 63 | - }; | ||
| 64 | - } | ||
| 65 | - } | ||
| 66 | - } | ||
| 67 | - ] | 1 | +/** |
| 2 | + * remoteValidationt3 远程验证指令(监控依赖的model变化) | ||
| 3 | + * 属性如下: | ||
| 4 | + * remotevtype(必须):验证类型(在service中有对应映射),如rvtype="xl" | ||
| 5 | + * remotemodel(必须):关联的model | ||
| 6 | + * remotemodelcol(必须):关联的model属性 | ||
| 7 | + */ | ||
| 8 | +angular.module('ScheduleApp').directive( | ||
| 9 | + 'remoteValidation3', | ||
| 10 | + [ | ||
| 11 | + '$$SearchInfoService_g', | ||
| 12 | + '$q', | ||
| 13 | + function($$SearchInfoService_g, $q) { | ||
| 14 | + return { | ||
| 15 | + restrict: 'A', // 属性 | ||
| 16 | + require: '^ngModel', // 依赖所属指令的ngModel | ||
| 17 | + compile: function(tElem, tAttrs) { | ||
| 18 | + var remotevtype_attr = tAttrs['remotevtype']; | ||
| 19 | + var remotemodel_attr = tAttrs['remotemodel']; | ||
| 20 | + var remotemodelcol_attr = tAttrs['remotemodelcol']; | ||
| 21 | + if (!remotevtype_attr) { | ||
| 22 | + throw new Error("remotevtype属性必须填写"); | ||
| 23 | + } | ||
| 24 | + if (!remotemodel_attr) { | ||
| 25 | + throw new Error("remotemodel属性必须填写"); | ||
| 26 | + } | ||
| 27 | + if (!remotemodelcol_attr) { | ||
| 28 | + throw new Error("remotemodelcol属性必须填写"); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + return { | ||
| 32 | + pre: function(scope, element, attr) { | ||
| 33 | + | ||
| 34 | + }, | ||
| 35 | + | ||
| 36 | + post: function(scope, element, attr, ngModelCtrl) { | ||
| 37 | + ngModelCtrl.$asyncValidators.remote = | ||
| 38 | + function(modelValue, viewValue) { | ||
| 39 | + var deferred = $q.defer(); | ||
| 40 | + | ||
| 41 | + // 远端验证service | ||
| 42 | + var param = JSON.parse(attr['remotemodel']); | ||
| 43 | + console.log(param); | ||
| 44 | + param[remotemodelcol_attr] = modelValue; | ||
| 45 | + $$SearchInfoService_g.validate[remotevtype_attr].remote.do( | ||
| 46 | + param, | ||
| 47 | + function(result) { | ||
| 48 | + if (result.status == "SUCCESS") { | ||
| 49 | + deferred.resolve(); | ||
| 50 | + } else { | ||
| 51 | + scope.$remote_msg = result.msg; | ||
| 52 | + deferred.reject(); | ||
| 53 | + } | ||
| 54 | + }, | ||
| 55 | + function(result) { | ||
| 56 | + deferred.reject(); | ||
| 57 | + } | ||
| 58 | + ); | ||
| 59 | + | ||
| 60 | + return deferred.promise; | ||
| 61 | + }; | ||
| 62 | + } | ||
| 63 | + }; | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | + } | ||
| 67 | + ] | ||
| 68 | ); | 68 | ); |
| 69 | \ No newline at end of file | 69 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/common/dts2/ttinfotable/mySelect.js
| 1 | -/** | ||
| 2 | - * mySelect指令,封装uiselect指令,封装内部数据获取,只支持单选 | ||
| 3 | - * cm(必须):绑定外部对象,因为关联的字段不只一个,单独使用ngModel不够 | ||
| 4 | - * cmoptions(必须):描述绑定的逻辑配置对象,格式如下: | ||
| 5 | - * | ||
| 6 | - * // TODO: | ||
| 7 | - */ | ||
| 8 | -angular.module('ScheduleApp').directive('mySelect', [ | ||
| 9 | - function() { | ||
| 10 | - return { | ||
| 11 | - restrict: 'E', | ||
| 12 | - template: '<div>bioxuxuan</div>', | ||
| 13 | - require: 'ngModel', | ||
| 14 | - compile: function(tElem, tAttrs) { | ||
| 15 | - return { | ||
| 16 | - pre: function(scope, element, attr) { | ||
| 17 | - | ||
| 18 | - }, | ||
| 19 | - post: function(scope, element, attr, ngModelCtr) { | ||
| 20 | - // model -> view | ||
| 21 | - ngModelCtr.$formatters.push(function(modelValue) { | ||
| 22 | - // 监控model的变化 | ||
| 23 | - if (typeof modelValue != "undefined") { | ||
| 24 | - console.log(modelValue); | ||
| 25 | - | ||
| 26 | - return modelValue; | ||
| 27 | - } | ||
| 28 | - }); | ||
| 29 | - | ||
| 30 | - ngModelCtr.$render = function() { | ||
| 31 | - if (typeof scope.ctrl.say != "undefined") { | ||
| 32 | - element.find('div').css('color', 'red'); | ||
| 33 | - } | ||
| 34 | - }; | ||
| 35 | - | ||
| 36 | - ngModelCtr.$setViewValue("init value"); | ||
| 37 | - | ||
| 38 | - | ||
| 39 | - } | ||
| 40 | - } | ||
| 41 | - } | ||
| 42 | - } | ||
| 43 | - } | 1 | +/** |
| 2 | + * mySelect指令,封装uiselect指令,封装内部数据获取,只支持单选 | ||
| 3 | + * cm(必须):绑定外部对象,因为关联的字段不只一个,单独使用ngModel不够 | ||
| 4 | + * cmoptions(必须):描述绑定的逻辑配置对象,格式如下: | ||
| 5 | + * | ||
| 6 | + * // TODO: | ||
| 7 | + */ | ||
| 8 | +angular.module('ScheduleApp').directive('mySelect', [ | ||
| 9 | + function() { | ||
| 10 | + return { | ||
| 11 | + restrict: 'E', | ||
| 12 | + template: '<div>bioxuxuan</div>', | ||
| 13 | + require: 'ngModel', | ||
| 14 | + compile: function(tElem, tAttrs) { | ||
| 15 | + return { | ||
| 16 | + pre: function(scope, element, attr) { | ||
| 17 | + | ||
| 18 | + }, | ||
| 19 | + post: function(scope, element, attr, ngModelCtr) { | ||
| 20 | + // model -> view | ||
| 21 | + ngModelCtr.$formatters.push(function(modelValue) { | ||
| 22 | + // 监控model的变化 | ||
| 23 | + if (typeof modelValue != "undefined") { | ||
| 24 | + console.log(modelValue); | ||
| 25 | + | ||
| 26 | + return modelValue; | ||
| 27 | + } | ||
| 28 | + }); | ||
| 29 | + | ||
| 30 | + ngModelCtr.$render = function() { | ||
| 31 | + if (typeof scope.ctrl.say != "undefined") { | ||
| 32 | + element.find('div').css('color', 'red'); | ||
| 33 | + } | ||
| 34 | + }; | ||
| 35 | + | ||
| 36 | + ngModelCtr.$setViewValue("init value"); | ||
| 37 | + | ||
| 38 | + | ||
| 39 | + } | ||
| 40 | + } | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | + } | ||
| 44 | ]); | 44 | ]); |
| 45 | \ No newline at end of file | 45 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/common/dts2/ttinfotable/mySelectTemplate.html
| 1 | -<div class="input-group" name="指令compile阶段设定1" | ||
| 2 | - ng-model="$saSelectCtrl.$$internalmodel"> | ||
| 3 | - <ui-select ng-model="$saSelectCtrl.$$internal_select_value" on-select="$saSelectCtrl.$$internal_select_fn($item)" | ||
| 4 | - theme="bootstrap" > | ||
| 5 | - <ui-select-match placeholder="指令compile阶段设定">指令compile阶段设定2</ui-select-match> | ||
| 6 | - <ui-select-choices repeat="指令compile阶段设定3" | ||
| 7 | - refresh="$saSelectCtrl.$$internal_refresh_fn($select.search)" | ||
| 8 | - refresh-delay="10"> | ||
| 9 | - | ||
| 10 | - 指令compile阶段设定777 | ||
| 11 | - | ||
| 12 | - </ui-select-choices> | ||
| 13 | - </ui-select> | ||
| 14 | - <span class="input-group-btn"> | ||
| 15 | - <button type="button" ng-click="$saSelectCtrl.$$internal_remove_fn()" class="btn btn-default"> | ||
| 16 | - <span class="glyphicon glyphicon-trash"></span> | ||
| 17 | - </button> | ||
| 18 | - </span> | 1 | +<div class="input-group" name="指令compile阶段设定1" |
| 2 | + ng-model="$saSelectCtrl.$$internalmodel"> | ||
| 3 | + <ui-select ng-model="$saSelectCtrl.$$internal_select_value" on-select="$saSelectCtrl.$$internal_select_fn($item)" | ||
| 4 | + theme="bootstrap" > | ||
| 5 | + <ui-select-match placeholder="指令compile阶段设定">指令compile阶段设定2</ui-select-match> | ||
| 6 | + <ui-select-choices repeat="指令compile阶段设定3" | ||
| 7 | + refresh="$saSelectCtrl.$$internal_refresh_fn($select.search)" | ||
| 8 | + refresh-delay="10"> | ||
| 9 | + | ||
| 10 | + 指令compile阶段设定777 | ||
| 11 | + | ||
| 12 | + </ui-select-choices> | ||
| 13 | + </ui-select> | ||
| 14 | + <span class="input-group-btn"> | ||
| 15 | + <button type="button" ng-click="$saSelectCtrl.$$internal_remove_fn()" class="btn btn-default"> | ||
| 16 | + <span class="glyphicon glyphicon-trash"></span> | ||
| 17 | + </button> | ||
| 18 | + </span> | ||
| 19 | </div> | 19 | </div> |
| 20 | \ No newline at end of file | 20 | \ No newline at end of file |
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 | + | ||
| 332 | + | ||
| 333 | + cde1: { // 车辆设备启用日期验证 | ||
| 334 | + template: {'qyrq': 0, 'xl': 1, 'cl': 1}, // 日期毫秒 | ||
| 335 | + remote: $resource( // $resource封装对象 | ||
| 336 | + '/cde//validate/qyrq', | ||
| 337 | + {}, | ||
| 338 | + { | ||
| 339 | + do: { | ||
| 340 | + method: 'GET' | ||
| 341 | + } | ||
| 342 | + } | ||
| 343 | + ) | ||
| 344 | + }, | ||
| 345 | + ttc1: { // 时刻表名字验证 | ||
| 346 | + template: {'xl.id_eq': -1, 'name_eq': 'ddd'}, | ||
| 347 | + remote: $resource( // $resource封装对象 | ||
| 348 | + '/tic/validate/equale', | ||
| 349 | + {}, | ||
| 350 | + { | ||
| 351 | + do: { | ||
| 352 | + method: 'GET' | ||
| 353 | + } | ||
| 354 | + } | ||
| 355 | + ) | ||
| 356 | + }, | ||
| 357 | + sheet: { // 时刻表sheet工作区验证 | ||
| 358 | + template: {'filename': '', 'sheetname': '', 'lineid': -1, 'linename': ''}, | ||
| 359 | + remote: $resource( // $resource封装对象 | ||
| 360 | + '/tidc/validate/sheet', | ||
| 361 | + {}, | ||
| 362 | + { | ||
| 363 | + do: { | ||
| 364 | + method: 'POST', | ||
| 365 | + headers: { | ||
| 366 | + 'Content-Type': 'application/x-www-form-urlencoded' | ||
| 367 | + }, | ||
| 368 | + transformRequest: function(obj) { | ||
| 369 | + var str = []; | ||
| 370 | + for (var p in obj) { | ||
| 371 | + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p])); | ||
| 372 | + } | ||
| 373 | + return str.join("&"); | ||
| 374 | + } | ||
| 375 | + } | ||
| 376 | + } | ||
| 377 | + ) | ||
| 378 | + }, | ||
| 379 | + sheetli: { // 时刻表线路标准验证 | ||
| 380 | + template: {'lineinfoid': -1}, | ||
| 381 | + remote: $resource( // $resource封装对象 | ||
| 382 | + '/tidc/validate/lineinfo', | ||
| 383 | + {}, | ||
| 384 | + { | ||
| 385 | + do: { | ||
| 386 | + method: 'GET' | ||
| 387 | + } | ||
| 388 | + } | ||
| 389 | + ) | ||
| 390 | + } | ||
| 391 | + } | ||
| 392 | + | ||
| 393 | + //validate: $resource( | ||
| 394 | + // '/cars/validate/:type', | ||
| 395 | + // {}, | ||
| 396 | + // { | ||
| 397 | + // insideCode: { | ||
| 398 | + // method: 'GET' | ||
| 399 | + // } | ||
| 400 | + // } | ||
| 401 | + //) | ||
| 402 | + | ||
| 403 | + | ||
| 404 | + | ||
| 405 | + } | ||
| 406 | +}]); | ||
| 407 | + | ||
| 408 | + | ||
| 409 | + |
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
| 1 | -//所有模块service配置 | ||
| 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 | + }, | ||
| 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 | + |
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 | + }, | ||
| 14 | + get: { | ||
| 15 | + method: 'GET' | ||
| 16 | + }, | ||
| 17 | + save: { | ||
| 18 | + method: 'POST' | ||
| 19 | + } | ||
| 20 | + } | ||
| 21 | + ) | ||
| 22 | + }; | ||
| 23 | }]); | 23 | }]); |
| 24 | \ No newline at end of file | 24 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/core/busLineInfoStat/service.js
| 1 | -// 线路运营统计service | ||
| 2 | -angular.module('ScheduleApp').factory('BusLineInfoStatService_g', ['$resource', function($resource) { | ||
| 3 | - return $resource( | ||
| 4 | - '/bic/:id', | ||
| 5 | - {order: 'createDate', direction: 'DESC', id: '@id_route'}, // TODO:以后需要根据属性对象的属性查询 | ||
| 6 | - { | ||
| 7 | - list: { | ||
| 8 | - method: 'GET', | ||
| 9 | - params: { | ||
| 10 | - page: 0 | ||
| 11 | - } | ||
| 12 | - } | ||
| 13 | - } | ||
| 14 | - ); | ||
| 15 | -}]); | 1 | +// 线路运营统计service |
| 2 | +angular.module('ScheduleApp').factory('BusLineInfoStatService_g', ['$resource', function($resource) { | ||
| 3 | + return $resource( | ||
| 4 | + '/bic/:id', | ||
| 5 | + {order: 'createDate', direction: 'DESC', id: '@id_route'}, // TODO:以后需要根据属性对象的属性查询 | ||
| 6 | + { | ||
| 7 | + list: { | ||
| 8 | + method: 'GET', | ||
| 9 | + params: { | ||
| 10 | + page: 0 | ||
| 11 | + } | ||
| 12 | + } | ||
| 13 | + } | ||
| 14 | + ); | ||
| 15 | +}]); |
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/service.js
| 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 | + }, | ||
| 14 | + get: { | ||
| 15 | + method: 'GET' | ||
| 16 | + }, | ||
| 17 | + save: { | ||
| 18 | + method: 'POST' | ||
| 19 | + }, | ||
| 20 | + delete: { | ||
| 21 | + method: 'DELETE' | ||
| 22 | + } | ||
| 23 | + } | ||
| 24 | + ), | ||
| 25 | + validate: $resource( // TODO: | ||
| 26 | + '/personnel/validate/:type', | ||
| 27 | + {}, | ||
| 28 | + { | ||
| 29 | + jobCode: { | ||
| 30 | + method: 'GET' | ||
| 31 | + } | ||
| 32 | + } | ||
| 33 | + ) | ||
| 34 | + }; | ||
| 35 | }]); | 35 | }]); |
| 36 | \ No newline at end of file | 36 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/core/guideboardManage/edit.html
| 1 | -<div class="page-head"> | ||
| 2 | - <div class="page-title"> | ||
| 3 | - <h1>路牌管理</h1> | ||
| 4 | - </div> | ||
| 5 | -</div> | ||
| 6 | - | ||
| 7 | -<ul class="page-breadcrumb breadcrumb"> | ||
| 8 | - <li> | ||
| 9 | - <a href="/pages/home.html" data-pjax="">首页</a> | ||
| 10 | - <i class="fa fa-circle"></i> | ||
| 11 | - </li> | ||
| 12 | - <li> | ||
| 13 | - <span class="active">运营计划管理</span> | ||
| 14 | - <i class="fa fa-circle"></i> | ||
| 15 | - </li> | ||
| 16 | - <li> | ||
| 17 | - <a ui-sref="guideboardManage">路牌管理</a> | ||
| 18 | - <i class="fa fa-circle"></i> | ||
| 19 | - </li> | ||
| 20 | - <li> | ||
| 21 | - <span class="active">修改路牌</span> | ||
| 22 | - </li> | ||
| 23 | -</ul> | ||
| 24 | - | ||
| 25 | -<div class="portlet light bordered" ng-controller="GuideboardManageFormCtrl as ctrl"> | ||
| 26 | - <div class="portlet-title"> | ||
| 27 | - <div class="caption"> | ||
| 28 | - <i class="icon-equalizer font-red-sunglo"></i> <span | ||
| 29 | - class="caption-subject font-red-sunglo bold uppercase">表单</span> | ||
| 30 | - </div> | ||
| 31 | - </div> | ||
| 32 | - | ||
| 33 | - <div class="portlet-body form"> | ||
| 34 | - <form ng-submit="ctrl.submit()" class="form-horizontal" novalidate name="myForm"> | ||
| 35 | - | ||
| 36 | - <div class="form-body"> | ||
| 37 | - <div class="form-group has-success has-feedback"> | ||
| 38 | - <label class="col-md-2 control-label">线路*:</label> | ||
| 39 | - <div class="col-md-3"> | ||
| 40 | - <sa-Select5 name="xl" | ||
| 41 | - model="ctrl.guideboardManageForForm" | ||
| 42 | - cmaps="{'xl.id' : 'id'}" | ||
| 43 | - dcname="xl.id" | ||
| 44 | - icname="id" | ||
| 45 | - dsparams="{{ {type: 'ajax', param:{type: 'all', 'destroy_eq': 0}, atype:'xl' } | json }}" | ||
| 46 | - iterobjname="item" | ||
| 47 | - iterobjexp="item.name" | ||
| 48 | - searchph="请输拼音..." | ||
| 49 | - searchexp="this.name" | ||
| 50 | - required > | ||
| 51 | - </sa-Select5> | ||
| 52 | - </div> | ||
| 53 | - <!-- 隐藏块,显示验证信息 --> | ||
| 54 | - <div class="alert alert-danger well-sm" ng-show="myForm.xl.$error.required"> | ||
| 55 | - 线路必须选择 | ||
| 56 | - </div> | ||
| 57 | - </div> | ||
| 58 | - | ||
| 59 | - <div class="form-group has-success has-feedback"> | ||
| 60 | - <label class="col-md-2 control-label">路牌编号:</label> | ||
| 61 | - <div class="col-md-3"> | ||
| 62 | - <input type="number" class="form-control" ng-model="ctrl.guideboardManageForForm.lpNo" | ||
| 63 | - name="lpNo" placeholder="请输入路牌编号..." min="1" required | ||
| 64 | - remote-Validation | ||
| 65 | - remotevtype="gbv1" | ||
| 66 | - remotevparam="{{ {'xl.id_eq': ctrl.guideboardManageForForm.xl.id, 'lpNo_eq': ctrl.guideboardManageForForm.lpNo} | json}}" | ||
| 67 | - | ||
| 68 | - /> | ||
| 69 | - </div> | ||
| 70 | - <div class="alert alert-danger well-sm" ng-show="myForm.lpNo.$error.required"> | ||
| 71 | - 路牌编号必须填写 | ||
| 72 | - </div> | ||
| 73 | - <div class="alert alert-danger well-sm" ng-show="myForm.lpNo.$error.number"> | ||
| 74 | - 必须输入数字 | ||
| 75 | - </div> | ||
| 76 | - <div class="alert alert-danger well-sm" ng-show="myForm.lpNo.$error.remote"> | ||
| 77 | - {{$remote_msg}} | ||
| 78 | - </div> | ||
| 79 | - </div> | ||
| 80 | - | ||
| 81 | - <div class="form-group has-success has-feedback"> | ||
| 82 | - <label class="col-md-2 control-label">路牌名称*:</label> | ||
| 83 | - <div class="col-md-3"> | ||
| 84 | - <input type="text" class="form-control" ng-model="ctrl.guideboardManageForForm.lpName" | ||
| 85 | - name="lpName" placeholder="请输入路牌名字..." required | ||
| 86 | - remote-Validation | ||
| 87 | - remotevtype="gbv2" | ||
| 88 | - remotevparam="{{ {'xl.id_eq': ctrl.guideboardManageForForm.xl.id, 'lpName_eq': ctrl.guideboardManageForForm.lpName} | json}}" | ||
| 89 | - | ||
| 90 | - /> | ||
| 91 | - </div> | ||
| 92 | - | ||
| 93 | - <!-- 隐藏块,显示验证信息 --> | ||
| 94 | - <div class="alert alert-danger well-sm" ng-show="myForm.lpName.$error.required"> | ||
| 95 | - 路牌名称必须填写 | ||
| 96 | - </div> | ||
| 97 | - <div class="alert alert-danger well-sm" ng-show="myForm.lpName.$error.remote"> | ||
| 98 | - {{$remote_msg}} | ||
| 99 | - </div> | ||
| 100 | - </div> | ||
| 101 | - | ||
| 102 | - <!-- 路牌类型暂时是普通路牌,默认填写了 --> | ||
| 103 | - | ||
| 104 | - | ||
| 105 | - </div> | ||
| 106 | - | ||
| 107 | - <div class="form-actions"> | ||
| 108 | - <div class="row"> | ||
| 109 | - <div class="col-md-offset-3 col-md-4"> | ||
| 110 | - <button type="submit" class="btn green" ng-disabled="!myForm.$valid"> | ||
| 111 | - <i class="fa fa-check">提交</i> | ||
| 112 | - </button> | ||
| 113 | - <a type="button" class="btn default" ui-sref="guideboardManage"> | ||
| 114 | - <i class="fa fa-times">取消</i> | ||
| 115 | - </a> | ||
| 116 | - </div> | ||
| 117 | - </div> | ||
| 118 | - </div> | ||
| 119 | - | ||
| 120 | - </form> | ||
| 121 | - | ||
| 122 | - </div> | ||
| 123 | - | ||
| 124 | -</div> | ||
| 125 | - | ||
| 126 | - | ||
| 127 | - | ||
| 128 | - | ||
| 129 | - | ||
| 130 | - | ||
| 131 | - | ||
| 132 | - | ||
| 133 | - | ||
| 134 | - | ||
| 135 | - | ||
| 136 | - | 1 | +<div class="page-head"> |
| 2 | + <div class="page-title"> | ||
| 3 | + <h1>路牌管理</h1> | ||
| 4 | + </div> | ||
| 5 | +</div> | ||
| 6 | + | ||
| 7 | +<ul class="page-breadcrumb breadcrumb"> | ||
| 8 | + <li> | ||
| 9 | + <a href="/pages/home.html" data-pjax="">首页</a> | ||
| 10 | + <i class="fa fa-circle"></i> | ||
| 11 | + </li> | ||
| 12 | + <li> | ||
| 13 | + <span class="active">运营计划管理</span> | ||
| 14 | + <i class="fa fa-circle"></i> | ||
| 15 | + </li> | ||
| 16 | + <li> | ||
| 17 | + <a ui-sref="guideboardManage">路牌管理</a> | ||
| 18 | + <i class="fa fa-circle"></i> | ||
| 19 | + </li> | ||
| 20 | + <li> | ||
| 21 | + <span class="active">修改路牌</span> | ||
| 22 | + </li> | ||
| 23 | +</ul> | ||
| 24 | + | ||
| 25 | +<div class="portlet light bordered" ng-controller="GuideboardManageFormCtrl as ctrl"> | ||
| 26 | + <div class="portlet-title"> | ||
| 27 | + <div class="caption"> | ||
| 28 | + <i class="icon-equalizer font-red-sunglo"></i> <span | ||
| 29 | + class="caption-subject font-red-sunglo bold uppercase">表单</span> | ||
| 30 | + </div> | ||
| 31 | + </div> | ||
| 32 | + | ||
| 33 | + <div class="portlet-body form"> | ||
| 34 | + <form ng-submit="ctrl.submit()" class="form-horizontal" novalidate name="myForm"> | ||
| 35 | + | ||
| 36 | + <div class="form-body"> | ||
| 37 | + <div class="form-group has-success has-feedback"> | ||
| 38 | + <label class="col-md-2 control-label">线路*:</label> | ||
| 39 | + <div class="col-md-3"> | ||
| 40 | + <sa-Select5 name="xl" | ||
| 41 | + model="ctrl.guideboardManageForForm" | ||
| 42 | + cmaps="{'xl.id' : 'id'}" | ||
| 43 | + dcname="xl.id" | ||
| 44 | + icname="id" | ||
| 45 | + dsparams="{{ {type: 'ajax', param:{type: 'all', 'destroy_eq': 0}, atype:'xl' } | json }}" | ||
| 46 | + iterobjname="item" | ||
| 47 | + iterobjexp="item.name" | ||
| 48 | + searchph="请输拼音..." | ||
| 49 | + searchexp="this.name" | ||
| 50 | + required > | ||
| 51 | + </sa-Select5> | ||
| 52 | + </div> | ||
| 53 | + <!-- 隐藏块,显示验证信息 --> | ||
| 54 | + <div class="alert alert-danger well-sm" ng-show="myForm.xl.$error.required"> | ||
| 55 | + 线路必须选择 | ||
| 56 | + </div> | ||
| 57 | + </div> | ||
| 58 | + | ||
| 59 | + <div class="form-group has-success has-feedback"> | ||
| 60 | + <label class="col-md-2 control-label">路牌编号:</label> | ||
| 61 | + <div class="col-md-3"> | ||
| 62 | + <input type="number" class="form-control" ng-model="ctrl.guideboardManageForForm.lpNo" | ||
| 63 | + name="lpNo" placeholder="请输入路牌编号..." min="1" required | ||
| 64 | + remote-Validation | ||
| 65 | + remotevtype="gbv1" | ||
| 66 | + remotevparam="{{ {'xl.id_eq': ctrl.guideboardManageForForm.xl.id, 'lpNo_eq': ctrl.guideboardManageForForm.lpNo} | json}}" | ||
| 67 | + | ||
| 68 | + /> | ||
| 69 | + </div> | ||
| 70 | + <div class="alert alert-danger well-sm" ng-show="myForm.lpNo.$error.required"> | ||
| 71 | + 路牌编号必须填写 | ||
| 72 | + </div> | ||
| 73 | + <div class="alert alert-danger well-sm" ng-show="myForm.lpNo.$error.number"> | ||
| 74 | + 必须输入数字 | ||
| 75 | + </div> | ||
| 76 | + <div class="alert alert-danger well-sm" ng-show="myForm.lpNo.$error.remote"> | ||
| 77 | + {{$remote_msg}} | ||
| 78 | + </div> | ||
| 79 | + </div> | ||
| 80 | + | ||
| 81 | + <div class="form-group has-success has-feedback"> | ||
| 82 | + <label class="col-md-2 control-label">路牌名称*:</label> | ||
| 83 | + <div class="col-md-3"> | ||
| 84 | + <input type="text" class="form-control" ng-model="ctrl.guideboardManageForForm.lpName" | ||
| 85 | + name="lpName" placeholder="请输入路牌名字..." required | ||
| 86 | + remote-Validation | ||
| 87 | + remotevtype="gbv2" | ||
| 88 | + remotevparam="{{ {'xl.id_eq': ctrl.guideboardManageForForm.xl.id, 'lpName_eq': ctrl.guideboardManageForForm.lpName} | json}}" | ||
| 89 | + | ||
| 90 | + /> | ||
| 91 | + </div> | ||
| 92 | + | ||
| 93 | + <!-- 隐藏块,显示验证信息 --> | ||
| 94 | + <div class="alert alert-danger well-sm" ng-show="myForm.lpName.$error.required"> | ||
| 95 | + 路牌名称必须填写 | ||
| 96 | + </div> | ||
| 97 | + <div class="alert alert-danger well-sm" ng-show="myForm.lpName.$error.remote"> | ||
| 98 | + {{$remote_msg}} | ||
| 99 | + </div> | ||
| 100 | + </div> | ||
| 101 | + | ||
| 102 | + <!-- 路牌类型暂时是普通路牌,默认填写了 --> | ||
| 103 | + | ||
| 104 | + | ||
| 105 | + </div> | ||
| 106 | + | ||
| 107 | + <div class="form-actions"> | ||
| 108 | + <div class="row"> | ||
| 109 | + <div class="col-md-offset-3 col-md-4"> | ||
| 110 | + <button type="submit" class="btn green" ng-disabled="!myForm.$valid"> | ||
| 111 | + <i class="fa fa-check">提交</i> | ||
| 112 | + </button> | ||
| 113 | + <a type="button" class="btn default" ui-sref="guideboardManage"> | ||
| 114 | + <i class="fa fa-times">取消</i> | ||
| 115 | + </a> | ||
| 116 | + </div> | ||
| 117 | + </div> | ||
| 118 | + </div> | ||
| 119 | + | ||
| 120 | + </form> | ||
| 121 | + | ||
| 122 | + </div> | ||
| 123 | + | ||
| 124 | +</div> | ||
| 125 | + | ||
| 126 | + | ||
| 127 | + | ||
| 128 | + | ||
| 129 | + | ||
| 130 | + | ||
| 131 | + | ||
| 132 | + | ||
| 133 | + | ||
| 134 | + | ||
| 135 | + | ||
| 136 | + |