Commit c12f35f28aee7f0e0477beb837f590398363a4ea
Merge branch 'minhang' of 192.168.168.201:panzhaov5/bsth_control into minhang
Showing
112 changed files
with
9484 additions
and
2690 deletions
src/main/java/com/bsth/controller/forms/ExportController.java
| @@ -203,7 +203,7 @@ public class ExportController { | @@ -203,7 +203,7 @@ public class ExportController { | ||
| 203 | SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); | 203 | SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd"); |
| 204 | List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | 204 | List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); |
| 205 | ReportUtils ee = new ReportUtils(); | 205 | ReportUtils ee = new ReportUtils(); |
| 206 | - List<Vehicleloading> vehicleloading = formsService.vehicleloading(map.get("line").toString(), | 206 | + List<Vehicleloading> vehicleloading = formsService.vehicleloading(/*map.get("gsdmVehic").toString(),map.get("fgsdmVehic").toString(),*/map.get("line").toString(), |
| 207 | map.get("date").toString()); | 207 | map.get("date").toString()); |
| 208 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | 208 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); |
| 209 | int i = 1; | 209 | int i = 1; |
src/main/java/com/bsth/controller/forms/MCY_FormsController.java
| @@ -26,93 +26,90 @@ import com.bsth.service.realcontrol.ScheduleRealInfoService; | @@ -26,93 +26,90 @@ import com.bsth.service.realcontrol.ScheduleRealInfoService; | ||
| 26 | @RestController | 26 | @RestController |
| 27 | @RequestMapping("mcy_forms") | 27 | @RequestMapping("mcy_forms") |
| 28 | public class MCY_FormsController { | 28 | public class MCY_FormsController { |
| 29 | - | 29 | + |
| 30 | @Autowired | 30 | @Autowired |
| 31 | FormsService formsService; | 31 | FormsService formsService; |
| 32 | - | 32 | + |
| 33 | @Autowired | 33 | @Autowired |
| 34 | ScheduleRealInfoService scheduleRealInfoService; | 34 | ScheduleRealInfoService scheduleRealInfoService; |
| 35 | - | ||
| 36 | - //行车路单日报表 | ||
| 37 | - @RequestMapping(value = "/waybillday",method = RequestMethod.POST) | ||
| 38 | - public List<Waybillday> waybillday(@RequestParam Map<String, Object> map){ | ||
| 39 | - | ||
| 40 | - | ||
| 41 | -// scheduleRealInfoService.findKMBC(jName, clZbh, lpName, date) | 35 | + |
| 36 | + // 行车路单日报表 | ||
| 37 | + | ||
| 38 | + @RequestMapping(value = "/waybillday", method = RequestMethod.POST) | ||
| 39 | + public List<Waybillday> waybillday(@RequestParam Map<String, Object> map) { | ||
| 40 | + | ||
| 41 | + // scheduleRealInfoService.findKMBC(jName, clZbh, lpName, date) | ||
| 42 | return formsService.waybillday(map); | 42 | return formsService.waybillday(map); |
| 43 | } | 43 | } |
| 44 | - | ||
| 45 | - //线路客流量报表 | ||
| 46 | - @RequestMapping(value = "/linepasswengerflow",method = RequestMethod.POST) | ||
| 47 | - public List<Linepasswengerflow> linepasswengerflow(@RequestParam Map<String, Object> map){ | ||
| 48 | - | 44 | + |
| 45 | + // 线路客流量报表 | ||
| 46 | + | ||
| 47 | + @RequestMapping(value = "/linepasswengerflow", method = RequestMethod.POST) | ||
| 48 | + public List<Linepasswengerflow> linepasswengerflow(@RequestParam Map<String, Object> map) { | ||
| 49 | + | ||
| 49 | return formsService.linepasswengerflow(map); | 50 | return formsService.linepasswengerflow(map); |
| 50 | } | 51 | } |
| 51 | - | ||
| 52 | - | ||
| 53 | - | ||
| 54 | - //班次车辆人员月报表 | ||
| 55 | - @RequestMapping(value = "/shiftuehiclemanth",method = RequestMethod.POST) | ||
| 56 | - public List<Shiftuehiclemanth> shiftuehiclemanth(@RequestParam Map<String, Object> map){ | ||
| 57 | - | 52 | + |
| 53 | + // 班次车辆人员月报表 | ||
| 54 | + @RequestMapping(value = "/shiftuehiclemanth", method = RequestMethod.POST) | ||
| 55 | + public List<Shiftuehiclemanth> shiftuehiclemanth(@RequestParam Map<String, Object> map) { | ||
| 56 | + | ||
| 58 | return formsService.shiftuehiclemanth(map); | 57 | return formsService.shiftuehiclemanth(map); |
| 59 | } | 58 | } |
| 60 | - | ||
| 61 | - | ||
| 62 | - //班次车辆人员日统计 | ||
| 63 | - @RequestMapping(value = "/shifday",method = RequestMethod.POST) | ||
| 64 | - public List<Shifday> shifday(@RequestParam Map<String, Object> map){ | ||
| 65 | - | 59 | + |
| 60 | + // 班次车辆人员日统计 | ||
| 61 | + @RequestMapping(value = "/shifday", method = RequestMethod.POST) | ||
| 62 | + public List<Shifday> shifday(@RequestParam Map<String, Object> map) { | ||
| 63 | + | ||
| 66 | return formsService.shifday(map); | 64 | return formsService.shifday(map); |
| 67 | } | 65 | } |
| 68 | - | ||
| 69 | - //换人换车情况统计表 | ||
| 70 | - @RequestMapping(value = "/changetochange",method = RequestMethod.POST) | ||
| 71 | - public List<Changetochange> changetochange(@RequestParam Map<String, Object> map){ | ||
| 72 | - | 66 | + |
| 67 | + // 换人换车情况统计表 | ||
| 68 | + @RequestMapping(value = "/changetochange", method = RequestMethod.POST) | ||
| 69 | + public List<Changetochange> changetochange(@RequestParam Map<String, Object> map) { | ||
| 70 | + | ||
| 73 | return formsService.changetochange(map); | 71 | return formsService.changetochange(map); |
| 74 | } | 72 | } |
| 75 | - | ||
| 76 | - //路单数据 | ||
| 77 | - @RequestMapping(value = "/singledata",method = RequestMethod.POST) | ||
| 78 | - public List<Singledata> singledata(@RequestParam Map<String, Object> map){ | ||
| 79 | - | 73 | + |
| 74 | + // 路单数据 | ||
| 75 | + @RequestMapping(value = "/singledata", method = RequestMethod.POST) | ||
| 76 | + public List<Singledata> singledata(@RequestParam Map<String, Object> map) { | ||
| 77 | + | ||
| 80 | return formsService.singledata(map); | 78 | return formsService.singledata(map); |
| 81 | - } | ||
| 82 | - | ||
| 83 | - //车辆加注 | ||
| 84 | - @RequestMapping(value = "/vehicleloading",method = RequestMethod.POST) | ||
| 85 | - public List<Vehicleloading> vehicleloading(@RequestParam String line ,@RequestParam String data){ | ||
| 86 | - return formsService.vehicleloading(line,data); | ||
| 87 | } | 79 | } |
| 88 | - | ||
| 89 | - | ||
| 90 | - //运营服务阶段报表 | ||
| 91 | - @RequestMapping(value = "/operationservice",method = RequestMethod.POST) | ||
| 92 | - public List<Operationservice> operationservice(@RequestParam Map<String, Object> map){ | ||
| 93 | - | 80 | + |
| 81 | + // 车辆加注 | ||
| 82 | + @RequestMapping(value = "/vehicleloading", method = RequestMethod.POST) | ||
| 83 | + public List<Vehicleloading> vehicleloading(/*@RequestParam String gsdmVehic, @RequestParam String fgsdmVehic,*/ | ||
| 84 | + @RequestParam String line, @RequestParam String data) { | ||
| 85 | + return formsService.vehicleloading(/*gsdmVehic, fgsdmVehic, */line, data); | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + // 运营服务阶段报表 | ||
| 89 | + @RequestMapping(value = "/operationservice", method = RequestMethod.POST) | ||
| 90 | + public List<Operationservice> operationservice(@RequestParam Map<String, Object> map) { | ||
| 91 | + | ||
| 94 | return formsService.operationservice(map); | 92 | return formsService.operationservice(map); |
| 95 | } | 93 | } |
| 96 | - | ||
| 97 | - //营运线路出车率统计表 | ||
| 98 | - @RequestMapping(value = "/turnoutrate",method = RequestMethod.POST) | ||
| 99 | - public List<Turnoutrate> turnoutrate(@RequestParam Map<String, Object> map){ | ||
| 100 | - | ||
| 101 | - return formsService.turnoutrate(map); | ||
| 102 | - } | ||
| 103 | - | ||
| 104 | - //班次执行率统计表 | ||
| 105 | - @RequestMapping(value = "/executionrate",method = RequestMethod.POST) | ||
| 106 | - public List<Executionrate> executionrate(@RequestParam Map<String, Object> map){ | ||
| 107 | - | ||
| 108 | - return formsService.executionrate(map); | ||
| 109 | - } | ||
| 110 | - | ||
| 111 | - | ||
| 112 | - //营运线路名称统计表 | ||
| 113 | - @RequestMapping(value = "/allline",method = RequestMethod.POST) | ||
| 114 | - public List<Allline> allline(@RequestParam Map<String, Object> map){ | ||
| 115 | - | ||
| 116 | - return formsService.allline(map); | 94 | + |
| 95 | + // 营运线路出车率统计表 | ||
| 96 | + @RequestMapping(value = "/turnoutrate", method = RequestMethod.POST) | ||
| 97 | + public List<Turnoutrate> turnoutrate(@RequestParam Map<String, Object> map) { | ||
| 98 | + | ||
| 99 | + return formsService.turnoutrate(map); | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + // 班次执行率统计表 | ||
| 103 | + @RequestMapping(value = "/executionrate", method = RequestMethod.POST) | ||
| 104 | + public List<Executionrate> executionrate(@RequestParam Map<String, Object> map) { | ||
| 105 | + | ||
| 106 | + return formsService.executionrate(map); | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + // 营运线路名称统计表 | ||
| 110 | + @RequestMapping(value = "/allline", method = RequestMethod.POST) | ||
| 111 | + public List<Allline> allline(@RequestParam Map<String, Object> map) { | ||
| 112 | + | ||
| 113 | + return formsService.allline(map); | ||
| 117 | } | 114 | } |
| 118 | } | 115 | } |
src/main/java/com/bsth/controller/realcontrol/RealMapController.java
| @@ -23,16 +23,40 @@ public class RealMapController { | @@ -23,16 +23,40 @@ public class RealMapController { | ||
| 23 | * 根据线路获取站点路由及空间数据 | 23 | * 根据线路获取站点路由及空间数据 |
| 24 | */ | 24 | */ |
| 25 | @RequestMapping(value = "/stationSpatialData") | 25 | @RequestMapping(value = "/stationSpatialData") |
| 26 | - public Map<String, Object> stationSpatialData(@RequestParam String idx){ | 26 | + public Map<String, Object> stationSpatialData(@RequestParam String idx) { |
| 27 | return realMapService.stationSpatialData(idx); | 27 | return realMapService.stationSpatialData(idx); |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | /** | 30 | /** |
| 31 | * 停车场 | 31 | * 停车场 |
| 32 | + * | ||
| 32 | * @return | 33 | * @return |
| 33 | */ | 34 | */ |
| 34 | @RequestMapping(value = "/carParkSpatialData") | 35 | @RequestMapping(value = "/carParkSpatialData") |
| 35 | - public Map<String, Object> carParkSpatialData(){ | 36 | + public Map<String, Object> carParkSpatialData() { |
| 36 | return realMapService.carParkSpatialData(); | 37 | return realMapService.carParkSpatialData(); |
| 37 | } | 38 | } |
| 39 | + | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * @param @param lineCode | ||
| 43 | + * @throws | ||
| 44 | + * @Title: findRouteByLine | ||
| 45 | + * @Description: TODO(获取线路的站点,路段路由) | ||
| 46 | + */ | ||
| 47 | + @RequestMapping(value = "/findRouteByLine") | ||
| 48 | + public Map<String, Object> findRouteByLine(@RequestParam String lineCode) { | ||
| 49 | + return realMapService.findRouteByLine(lineCode); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 获取线路的路段路由 和 站点路由信息 (为前端站间距计算提供数据源) | ||
| 55 | + * @param lineCode | ||
| 56 | + * @return | ||
| 57 | + */ | ||
| 58 | + @RequestMapping(value = "/findRouteAndStationByLine") | ||
| 59 | + public Map<String, Object> findRouteAndStationByLine(@RequestParam String lineCode){ | ||
| 60 | + return realMapService.findRouteAndStationByLine(lineCode); | ||
| 61 | + } | ||
| 38 | } | 62 | } |
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| @@ -74,8 +74,8 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -74,8 +74,8 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 74 | @RequestMapping(value = "/destroy", method = RequestMethod.POST) | 74 | @RequestMapping(value = "/destroy", method = RequestMethod.POST) |
| 75 | public Map<String, Object> destroy(@RequestParam String idsStr | 75 | public Map<String, Object> destroy(@RequestParam String idsStr |
| 76 | /*, @RequestParam(defaultValue = "-1") int spaceAdjust*/, | 76 | /*, @RequestParam(defaultValue = "-1") int spaceAdjust*/, |
| 77 | - @RequestParam String remarks/*, @RequestParam String reason, @RequestParam(defaultValue = "0") int spaceNum*/) { | ||
| 78 | - return scheduleRealInfoService.destroy(idsStr/*, spaceAdjust*/, remarks/*, reason, spaceNum*/); | 77 | + @RequestParam String remarks, @RequestParam String adjustExps/*, @RequestParam(defaultValue = "0") int spaceNum*/) { |
| 78 | + return scheduleRealInfoService.destroy(idsStr/*, spaceAdjust*/, remarks, adjustExps/*, spaceNum*/); | ||
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | /** | 81 | /** |
src/main/java/com/bsth/controller/schedule/BController.java
0 → 100644
| 1 | +package com.bsth.controller.schedule; | ||
| 2 | + | ||
| 3 | +import com.bsth.common.ResponseCode; | ||
| 4 | +import com.bsth.service.schedule.BService; | ||
| 5 | +import com.bsth.service.schedule.ScheduleException; | ||
| 6 | +import com.google.common.base.Splitter; | ||
| 7 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 8 | +import org.springframework.data.domain.PageRequest; | ||
| 9 | +import org.springframework.data.domain.Sort; | ||
| 10 | +import org.springframework.web.bind.annotation.*; | ||
| 11 | + | ||
| 12 | +import java.io.Serializable; | ||
| 13 | +import java.util.ArrayList; | ||
| 14 | +import java.util.HashMap; | ||
| 15 | +import java.util.List; | ||
| 16 | +import java.util.Map; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * 基础控制器。 | ||
| 20 | + */ | ||
| 21 | +public class BController<T, ID extends Serializable> { | ||
| 22 | + @Autowired | ||
| 23 | + protected BService<T, ID> bService; | ||
| 24 | + | ||
| 25 | + // CRUD 操作 | ||
| 26 | + // Create操作 | ||
| 27 | + @RequestMapping(method = RequestMethod.POST) | ||
| 28 | + public Map<String, Object> save(@RequestBody T t) { | ||
| 29 | + T t_saved = bService.save(t); | ||
| 30 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 31 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 32 | + rtn.put("data", t_saved); | ||
| 33 | + return rtn; | ||
| 34 | + } | ||
| 35 | + // Update操作 | ||
| 36 | + @RequestMapping(value="/{id}", method = RequestMethod.POST) | ||
| 37 | + public Map<String, Object> update(@RequestBody T t) { | ||
| 38 | + return save(t); | ||
| 39 | + } | ||
| 40 | + // Research操作 | ||
| 41 | + @RequestMapping(value = "/{id}", method = RequestMethod.GET) | ||
| 42 | + public Map<String, Object> findById(@PathVariable("id") ID id) { | ||
| 43 | + T t = bService.findById(id); | ||
| 44 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 45 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 46 | + rtn.put("data", t); | ||
| 47 | + return rtn; | ||
| 48 | + } | ||
| 49 | + @RequestMapping(value = "/all", method = RequestMethod.GET) | ||
| 50 | + public Map<String, Object> list(@RequestParam Map<String, Object> param) { | ||
| 51 | + List<T> tList = bService.list(param); | ||
| 52 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 53 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 54 | + rtn.put("data", tList); | ||
| 55 | + return rtn; | ||
| 56 | + } | ||
| 57 | + @RequestMapping(method = RequestMethod.GET) | ||
| 58 | + public Map<String, Object> list( | ||
| 59 | + @RequestParam Map<String, Object> map, | ||
| 60 | + @RequestParam(defaultValue = "0") int page, | ||
| 61 | + @RequestParam(defaultValue = "10") int size, | ||
| 62 | + @RequestParam(defaultValue = "id") String order, | ||
| 63 | + @RequestParam(defaultValue = "DESC") String direction) { | ||
| 64 | + // 允许多个字段排序,order可以写单个字段,也可以写多个字段 | ||
| 65 | + // 多个字段格式:{col1},{col2},{col3},....,{coln} | ||
| 66 | + List<String> order_columns = Splitter.on(",").trimResults().splitToList(order); | ||
| 67 | + // 多字段排序:DESC,ASC... | ||
| 68 | + List<String> order_dirs = Splitter.on(",").trimResults().splitToList(direction); | ||
| 69 | + | ||
| 70 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 71 | + | ||
| 72 | + if (order_dirs.size() == 1) { // 所有字段采用一种排序 | ||
| 73 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 74 | + if (order_dirs.get(0).equals("ASC")) { | ||
| 75 | + rtn.put("data", bService.list(map, new PageRequest(page, size, new Sort(Sort.Direction.ASC, order_columns)))); | ||
| 76 | + } else { | ||
| 77 | + rtn.put("data", bService.list(map, new PageRequest(page, size, new Sort(Sort.Direction.DESC, order_columns)))); | ||
| 78 | + } | ||
| 79 | + } else if (order_columns.size() == order_dirs.size()) { | ||
| 80 | + List<Sort.Order> orderList = new ArrayList<>(); | ||
| 81 | + for (int i = 0; i < order_columns.size(); i++) { | ||
| 82 | + if (null != order_dirs.get(i) && order_dirs.get(i).equals("ASC")) { | ||
| 83 | + orderList.add(new Sort.Order(Sort.Direction.ASC, order_columns.get(i))); | ||
| 84 | + } else { | ||
| 85 | + orderList.add(new Sort.Order(Sort.Direction.DESC, order_columns.get(i))); | ||
| 86 | + } | ||
| 87 | + } | ||
| 88 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 89 | + rtn.put("data", bService.list(map, new PageRequest(page, size, new Sort(orderList)))); | ||
| 90 | + } else { | ||
| 91 | + throw new RuntimeException("多字段排序参数格式问题,排序顺序和字段数不一致"); | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + return rtn; | ||
| 95 | + | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + // Delete操作 | ||
| 99 | + @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) | ||
| 100 | + public Map<String, Object> delete(@PathVariable("id") ID id) { | ||
| 101 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 102 | + try { | ||
| 103 | + bService.delete(id); | ||
| 104 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 105 | + } catch (ScheduleException exp) { | ||
| 106 | + rtn.put("status", ResponseCode.ERROR); | ||
| 107 | + rtn.put("msg", exp.getMessage()); | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + return rtn; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | +} |
src/main/java/com/bsth/controller/schedule/GuideboardInfoController.java deleted
100644 → 0
| 1 | -package com.bsth.controller.schedule; | ||
| 2 | - | ||
| 3 | -import com.bsth.controller.BaseController; | ||
| 4 | -import com.bsth.entity.schedule.GuideboardInfo; | ||
| 5 | -import com.bsth.repository.schedule.GuideboardInfoRepository; | ||
| 6 | -import com.bsth.service.schedule.utils.DataToolsProperties; | ||
| 7 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 8 | -import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
| 9 | -import org.springframework.web.bind.annotation.PathVariable; | ||
| 10 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 11 | -import org.springframework.web.bind.annotation.RequestMethod; | ||
| 12 | -import org.springframework.web.bind.annotation.RestController; | ||
| 13 | - | ||
| 14 | -import java.util.List; | ||
| 15 | -import java.util.Map; | ||
| 16 | - | ||
| 17 | -/** | ||
| 18 | - * Created by xu on 16/5/11. | ||
| 19 | - */ | ||
| 20 | -@RestController | ||
| 21 | -@RequestMapping("gic") | ||
| 22 | -@EnableConfigurationProperties(DataToolsProperties.class) | ||
| 23 | -public class GuideboardInfoController extends BaseController<GuideboardInfo, Long> { | ||
| 24 | - @Autowired | ||
| 25 | - private DataToolsProperties dataToolsProperties; | ||
| 26 | - @Autowired | ||
| 27 | - private GuideboardInfoRepository guideboardInfoRepository; | ||
| 28 | - | ||
| 29 | - @Override | ||
| 30 | - protected String getDataImportKtrClasspath() { | ||
| 31 | - return dataToolsProperties.getGuideboardsDatainputktr(); | ||
| 32 | - } | ||
| 33 | - | ||
| 34 | - @Override | ||
| 35 | - public GuideboardInfo findById(@PathVariable("id") Long aLong) { | ||
| 36 | - return guideboardInfoRepository.findOneExtend(aLong); | ||
| 37 | - } | ||
| 38 | - | ||
| 39 | - | ||
| 40 | - @RequestMapping(value = "/ttlpnames", method = RequestMethod.GET) | ||
| 41 | - public List<Map<String, Object>> findLpName(Long ttid) { | ||
| 42 | - return guideboardInfoRepository.findLpName(ttid); | ||
| 43 | - } | ||
| 44 | -} |
src/main/java/com/bsth/controller/schedule/basicinfo/CarsController.java
0 → 100644
| 1 | +package com.bsth.controller.schedule.basicinfo; | ||
| 2 | + | ||
| 3 | +import com.bsth.common.ResponseCode; | ||
| 4 | +import com.bsth.controller.schedule.BController; | ||
| 5 | +import com.bsth.entity.Cars; | ||
| 6 | +import com.bsth.service.schedule.CarsService; | ||
| 7 | +import com.bsth.service.schedule.ScheduleException; | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 10 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 11 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 12 | +import org.springframework.web.bind.annotation.RestController; | ||
| 13 | + | ||
| 14 | +import java.util.HashMap; | ||
| 15 | +import java.util.Map; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * 车辆基础信息controller | ||
| 19 | + */ | ||
| 20 | +@RestController(value = "carsController_sc") | ||
| 21 | +@RequestMapping("cars_sc") | ||
| 22 | +public class CarsController extends BController<Cars, Integer> { | ||
| 23 | + @Autowired | ||
| 24 | + private CarsService carsService; | ||
| 25 | + | ||
| 26 | + @RequestMapping(value = "/validate_zbh", method = RequestMethod.GET) | ||
| 27 | + public Map<String, Object> validate_zbh(@RequestParam Map<String, Object> param) { | ||
| 28 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 29 | + try { | ||
| 30 | + // 自编号验证 | ||
| 31 | + Cars cars = new Cars( | ||
| 32 | + param.get("id_eq"), | ||
| 33 | + param.get("insideCode_eq"), | ||
| 34 | + null, | ||
| 35 | + null, | ||
| 36 | + null); | ||
| 37 | + carsService.validate_nbbh(cars); | ||
| 38 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 39 | + } catch (ScheduleException exp) { | ||
| 40 | + rtn.put("status", ResponseCode.ERROR); | ||
| 41 | + rtn.put("msg", exp.getMessage()); | ||
| 42 | + } | ||
| 43 | + return rtn; | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + @RequestMapping(value = "/validate_clbh", method = RequestMethod.GET) | ||
| 47 | + public Map<String, Object> validate_clbh(@RequestParam Map<String, Object> param) { | ||
| 48 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 49 | + try { | ||
| 50 | + // 车辆编号验证 | ||
| 51 | + Cars cars = new Cars( | ||
| 52 | + param.get("id_eq"), | ||
| 53 | + null, | ||
| 54 | + param.get("carCode_eq"), | ||
| 55 | + null, | ||
| 56 | + null); | ||
| 57 | + carsService.validate_clbh(cars); | ||
| 58 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 59 | + } catch (ScheduleException exp) { | ||
| 60 | + rtn.put("status", ResponseCode.ERROR); | ||
| 61 | + rtn.put("msg", exp.getMessage()); | ||
| 62 | + } | ||
| 63 | + return rtn; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + @RequestMapping(value = "/validate_cph", method = RequestMethod.GET) | ||
| 67 | + public Map<String, Object> validate_cph(@RequestParam Map<String, Object> param) { | ||
| 68 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 69 | + try { | ||
| 70 | + // 车牌号验证 | ||
| 71 | + Cars cars = new Cars( | ||
| 72 | + param.get("id_eq"), | ||
| 73 | + null, | ||
| 74 | + null, | ||
| 75 | + param.get("carPlate_eq"), | ||
| 76 | + null); | ||
| 77 | + carsService.validate_cph(cars); | ||
| 78 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 79 | + } catch (ScheduleException exp) { | ||
| 80 | + rtn.put("status", ResponseCode.ERROR); | ||
| 81 | + rtn.put("msg", exp.getMessage()); | ||
| 82 | + } | ||
| 83 | + return rtn; | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + @RequestMapping(value = "/validate_sbbh", method = RequestMethod.GET) | ||
| 87 | + public Map<String, Object> validate_sbbh(@RequestParam Map<String, Object> param) { | ||
| 88 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 89 | + try { | ||
| 90 | + // 设备编号验证 | ||
| 91 | + Cars cars = new Cars( | ||
| 92 | + param.get("id_eq"), | ||
| 93 | + null, | ||
| 94 | + null, | ||
| 95 | + null, | ||
| 96 | + param.get("equipmentCode_eq") | ||
| 97 | + ); | ||
| 98 | + carsService.validate_sbbh(cars); | ||
| 99 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 100 | + } catch (ScheduleException exp) { | ||
| 101 | + rtn.put("status", ResponseCode.ERROR); | ||
| 102 | + rtn.put("msg", exp.getMessage()); | ||
| 103 | + } | ||
| 104 | + return rtn; | ||
| 105 | + } | ||
| 106 | +} |
src/main/java/com/bsth/controller/schedule/core/GuideboardInfoController.java
0 → 100644
| 1 | +package com.bsth.controller.schedule.core; | ||
| 2 | + | ||
| 3 | +import com.bsth.common.ResponseCode; | ||
| 4 | +import com.bsth.controller.schedule.BController; | ||
| 5 | +import com.bsth.entity.schedule.GuideboardInfo; | ||
| 6 | +import com.bsth.repository.schedule.GuideboardInfoRepository; | ||
| 7 | +import com.bsth.service.schedule.GuideboardInfoService; | ||
| 8 | +import com.bsth.service.schedule.ScheduleException; | ||
| 9 | +import com.bsth.service.schedule.utils.DataToolsProperties; | ||
| 10 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 11 | +import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
| 12 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 13 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 14 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 15 | +import org.springframework.web.bind.annotation.RestController; | ||
| 16 | + | ||
| 17 | +import java.util.HashMap; | ||
| 18 | +import java.util.List; | ||
| 19 | +import java.util.Map; | ||
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * 路牌管理控制器。 | ||
| 23 | + */ | ||
| 24 | +@RestController | ||
| 25 | +@RequestMapping("gic") | ||
| 26 | +@EnableConfigurationProperties(DataToolsProperties.class) | ||
| 27 | +public class GuideboardInfoController extends BController<GuideboardInfo, Long> { | ||
| 28 | + @Autowired | ||
| 29 | + private GuideboardInfoService guideboardInfoService; | ||
| 30 | +// @Autowired | ||
| 31 | +// private DataToolsProperties dataToolsProperties; | ||
| 32 | + @Autowired | ||
| 33 | + private GuideboardInfoRepository guideboardInfoRepository; | ||
| 34 | +// | ||
| 35 | +// @Override | ||
| 36 | +// protected String getDataImportKtrClasspath() { | ||
| 37 | +// return dataToolsProperties.getGuideboardsDatainputktr(); | ||
| 38 | +// } | ||
| 39 | +// | ||
| 40 | +// @Override | ||
| 41 | +// public GuideboardInfo findById(@PathVariable("id") Long aLong) { | ||
| 42 | +// return guideboardInfoRepository.findOneExtend(aLong); | ||
| 43 | +// } | ||
| 44 | +// | ||
| 45 | +// | ||
| 46 | + @RequestMapping(value = "/ttlpnames", method = RequestMethod.GET) | ||
| 47 | + public List<Map<String, Object>> findLpName(Long ttid) { | ||
| 48 | + return guideboardInfoRepository.findLpName(ttid); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + @RequestMapping(value = "/validate1", method = RequestMethod.GET) | ||
| 52 | + public Map<String, Object> validate1(@RequestParam Map<String, Object> param) { | ||
| 53 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 54 | + try { | ||
| 55 | + // 路牌编号验证 | ||
| 56 | + GuideboardInfo guideboardInfo = new GuideboardInfo( | ||
| 57 | + param.get("xl.id_eq"), | ||
| 58 | + param.get("lpNo_eq"), | ||
| 59 | + null | ||
| 60 | + ); | ||
| 61 | + guideboardInfoService.validate(guideboardInfo); | ||
| 62 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 63 | + } catch (ScheduleException exp) { | ||
| 64 | + rtn.put("status", ResponseCode.ERROR); | ||
| 65 | + rtn.put("msg", exp.getMessage()); | ||
| 66 | + } | ||
| 67 | + return rtn; | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + @RequestMapping(value = "/validate2", method = RequestMethod.GET) | ||
| 71 | + public Map<String, Object> validate2(@RequestParam Map<String, Object> param) { | ||
| 72 | + Map<String, Object> rtn = new HashMap<>(); | ||
| 73 | + try { | ||
| 74 | + // 路牌名称验证 | ||
| 75 | + GuideboardInfo guideboardInfo = new GuideboardInfo( | ||
| 76 | + param.get("xl.id_eq"), | ||
| 77 | + null, | ||
| 78 | + param.get("lpName_eq") | ||
| 79 | + ); | ||
| 80 | + guideboardInfoService.validate(guideboardInfo); | ||
| 81 | + rtn.put("status", ResponseCode.SUCCESS); | ||
| 82 | + } catch (ScheduleException exp) { | ||
| 83 | + rtn.put("status", ResponseCode.ERROR); | ||
| 84 | + rtn.put("msg", exp.getMessage()); | ||
| 85 | + } | ||
| 86 | + return rtn; | ||
| 87 | + } | ||
| 88 | +} |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| @@ -117,7 +117,7 @@ public class DayOfSchedule implements CommandLineRunner { | @@ -117,7 +117,7 @@ public class DayOfSchedule implements CommandLineRunner { | ||
| 117 | @Override | 117 | @Override |
| 118 | public void run(String... arg0) throws Exception { | 118 | public void run(String... arg0) throws Exception { |
| 119 | //翻班线程 | 119 | //翻班线程 |
| 120 | -// Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS); | 120 | + Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS); |
| 121 | //入库 | 121 | //入库 |
| 122 | // Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS); | 122 | // Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS); |
| 123 | //首班出场指令补发器 | 123 | //首班出场指令补发器 |
src/main/java/com/bsth/entity/Cars.java
| 1 | package com.bsth.entity; | 1 | package com.bsth.entity; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.sys.SysUser; | 3 | import com.bsth.entity.sys.SysUser; |
| 4 | +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
| 4 | 5 | ||
| 5 | import javax.persistence.*; | 6 | import javax.persistence.*; |
| 6 | import java.io.Serializable; | 7 | import java.io.Serializable; |
| @@ -22,6 +23,7 @@ import java.util.Date; | @@ -22,6 +23,7 @@ import java.util.Date; | ||
| 22 | 23 | ||
| 23 | @Entity | 24 | @Entity |
| 24 | @Table(name = "bsth_c_cars") | 25 | @Table(name = "bsth_c_cars") |
| 26 | +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"}) | ||
| 25 | public class Cars implements Serializable { | 27 | public class Cars implements Serializable { |
| 26 | 28 | ||
| 27 | /** 主键Id */ | 29 | /** 主键Id */ |
| @@ -30,7 +32,7 @@ public class Cars implements Serializable { | @@ -30,7 +32,7 @@ public class Cars implements Serializable { | ||
| 30 | private Integer id; | 32 | private Integer id; |
| 31 | 33 | ||
| 32 | /** 自编号/内部编号 */ | 34 | /** 自编号/内部编号 */ |
| 33 | - @Column(nullable = false, length = 8, unique = true) | 35 | + @Column(nullable = false, length = 20, unique = true) |
| 34 | private String insideCode; | 36 | private String insideCode; |
| 35 | 37 | ||
| 36 | // 公司、分公司暂时不用关联实体 | 38 | // 公司、分公司暂时不用关联实体 |
| @@ -150,6 +152,26 @@ public class Cars implements Serializable { | @@ -150,6 +152,26 @@ public class Cars implements Serializable { | ||
| 150 | /** 修改日期 */ | 152 | /** 修改日期 */ |
| 151 | @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") | 153 | @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP") |
| 152 | private Date updateDate; | 154 | private Date updateDate; |
| 155 | + | ||
| 156 | + public Cars() {} | ||
| 157 | + | ||
| 158 | + public Cars(Object id, Object nbbh, Object clbh, Object cph, Object sbbh) { | ||
| 159 | + if (id != null) { | ||
| 160 | + this.id = Integer.valueOf(id.toString()); | ||
| 161 | + } | ||
| 162 | + if (nbbh != null) { | ||
| 163 | + this.insideCode = nbbh.toString(); | ||
| 164 | + } | ||
| 165 | + if (clbh != null) { | ||
| 166 | + this.carCode = clbh.toString(); | ||
| 167 | + } | ||
| 168 | + if (cph != null) { | ||
| 169 | + this.carPlate = cph.toString(); | ||
| 170 | + } | ||
| 171 | + if (sbbh != null) { | ||
| 172 | + this.equipmentCode = sbbh.toString(); | ||
| 173 | + } | ||
| 174 | + } | ||
| 153 | 175 | ||
| 154 | public String getServiceNo() { | 176 | public String getServiceNo() { |
| 155 | return serviceNo; | 177 | return serviceNo; |
src/main/java/com/bsth/entity/Line.java
| 1 | package com.bsth.entity; | 1 | package com.bsth.entity; |
| 2 | 2 | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
| 3 | import org.springframework.format.annotation.DateTimeFormat; | 4 | import org.springframework.format.annotation.DateTimeFormat; |
| 4 | 5 | ||
| 5 | import javax.persistence.*; | 6 | import javax.persistence.*; |
| @@ -23,6 +24,7 @@ import java.util.Date; | @@ -23,6 +24,7 @@ import java.util.Date; | ||
| 23 | 24 | ||
| 24 | @Entity | 25 | @Entity |
| 25 | @Table(name = "bsth_c_line") | 26 | @Table(name = "bsth_c_line") |
| 27 | +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"}) | ||
| 26 | public class Line implements Serializable { | 28 | public class Line implements Serializable { |
| 27 | 29 | ||
| 28 | @Id | 30 | @Id |
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
| @@ -128,6 +128,8 @@ public class ScheduleRealInfo { | @@ -128,6 +128,8 @@ public class ScheduleRealInfo { | ||
| 128 | 128 | ||
| 129 | /**班次状态 0 未执行 1 正在执行 2 已执行 -1 已烂班 */ | 129 | /**班次状态 0 未执行 1 正在执行 2 已执行 -1 已烂班 */ |
| 130 | private int status; | 130 | private int status; |
| 131 | + | ||
| 132 | + private String adjustExps; | ||
| 131 | 133 | ||
| 132 | /** 是否是临加班次 */ | 134 | /** 是否是临加班次 */ |
| 133 | private boolean sflj; | 135 | private boolean sflj; |
| @@ -817,4 +819,12 @@ public class ScheduleRealInfo { | @@ -817,4 +819,12 @@ public class ScheduleRealInfo { | ||
| 817 | public void setLate(boolean late) { | 819 | public void setLate(boolean late) { |
| 818 | this.late = late; | 820 | this.late = late; |
| 819 | } | 821 | } |
| 822 | + | ||
| 823 | + public String getAdjustExps() { | ||
| 824 | + return adjustExps; | ||
| 825 | + } | ||
| 826 | + | ||
| 827 | + public void setAdjustExps(String adjustExps) { | ||
| 828 | + this.adjustExps = adjustExps; | ||
| 829 | + } | ||
| 820 | } | 830 | } |
src/main/java/com/bsth/entity/schedule/GuideboardInfo.java
| @@ -2,9 +2,9 @@ package com.bsth.entity.schedule; | @@ -2,9 +2,9 @@ package com.bsth.entity.schedule; | ||
| 2 | 2 | ||
| 3 | import com.bsth.entity.Line; | 3 | import com.bsth.entity.Line; |
| 4 | import com.bsth.entity.sys.SysUser; | 4 | import com.bsth.entity.sys.SysUser; |
| 5 | +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
| 5 | 6 | ||
| 6 | import javax.persistence.*; | 7 | import javax.persistence.*; |
| 7 | -import javax.persistence.Table; | ||
| 8 | import java.util.Date; | 8 | import java.util.Date; |
| 9 | 9 | ||
| 10 | /** | 10 | /** |
| @@ -17,6 +17,7 @@ import java.util.Date; | @@ -17,6 +17,7 @@ import java.util.Date; | ||
| 17 | @NamedAttributeNode("xl") | 17 | @NamedAttributeNode("xl") |
| 18 | }) | 18 | }) |
| 19 | }) | 19 | }) |
| 20 | +@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"}) | ||
| 20 | public class GuideboardInfo { | 21 | public class GuideboardInfo { |
| 21 | 22 | ||
| 22 | /** 主键Id */ | 23 | /** 主键Id */ |
| @@ -38,6 +39,10 @@ public class GuideboardInfo { | @@ -38,6 +39,10 @@ public class GuideboardInfo { | ||
| 38 | @Column(nullable = false) | 39 | @Column(nullable = false) |
| 39 | private String lpType; | 40 | private String lpType; |
| 40 | 41 | ||
| 42 | + /** 是否删除(标记) */ | ||
| 43 | + @Column(nullable = false) | ||
| 44 | + private Boolean isCancel = false; | ||
| 45 | + | ||
| 41 | /** 创建人 */ | 46 | /** 创建人 */ |
| 42 | @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) | 47 | @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.PERSIST) |
| 43 | private SysUser createBy; | 48 | private SysUser createBy; |
| @@ -53,6 +58,30 @@ public class GuideboardInfo { | @@ -53,6 +58,30 @@ public class GuideboardInfo { | ||
| 53 | private Date updateDate; | 58 | private Date updateDate; |
| 54 | 59 | ||
| 55 | 60 | ||
| 61 | + public GuideboardInfo() {} | ||
| 62 | + | ||
| 63 | + public GuideboardInfo(Object xlid, Object lpNo, Object lpName) { | ||
| 64 | + Integer xlid_ = xlid == null ? null : Integer.valueOf(xlid.toString()); | ||
| 65 | + Integer lpNo_ = lpNo == null ? null : Integer.valueOf(lpNo.toString()); | ||
| 66 | + String lpName_ = lpName == null ? null : String.valueOf(lpName); | ||
| 67 | + | ||
| 68 | + if (xlid_ != null) { | ||
| 69 | + Line line = new Line(); | ||
| 70 | + line.setId(xlid_); | ||
| 71 | + this.xl = line; | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + this.lpNo = lpNo_; | ||
| 75 | + this.lpName = lpName_; | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + public GuideboardInfo(Integer xlid, Integer lpNo) { | ||
| 79 | + this(xlid, lpNo, null); | ||
| 80 | + } | ||
| 81 | + public GuideboardInfo(Integer xlid, String lpName) { | ||
| 82 | + this(xlid, null, lpName); | ||
| 83 | + } | ||
| 84 | + | ||
| 56 | public Long getId() { | 85 | public Long getId() { |
| 57 | return id; | 86 | return id; |
| 58 | } | 87 | } |
| @@ -124,4 +153,12 @@ public class GuideboardInfo { | @@ -124,4 +153,12 @@ public class GuideboardInfo { | ||
| 124 | public void setUpdateDate(Date updateDate) { | 153 | public void setUpdateDate(Date updateDate) { |
| 125 | this.updateDate = updateDate; | 154 | this.updateDate = updateDate; |
| 126 | } | 155 | } |
| 156 | + | ||
| 157 | + public Boolean getIsCancel() { | ||
| 158 | + return isCancel; | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + public void setIsCancel(Boolean isCancel) { | ||
| 162 | + this.isCancel = isCancel; | ||
| 163 | + } | ||
| 127 | } | 164 | } |
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
| @@ -85,6 +85,9 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | @@ -85,6 +85,9 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI | ||
| 85 | @Query(value="select s from ScheduleRealInfo s where s.jGh = ?1 and s.clZbh = ?2 and s.scheduleDate = str_to_date(?3,'%Y-%m-%d') order by bcs") | 85 | @Query(value="select s from ScheduleRealInfo s where s.jGh = ?1 and s.clZbh = ?2 and s.scheduleDate = str_to_date(?3,'%Y-%m-%d') order by bcs") |
| 86 | List<ScheduleRealInfo> queryListWaybill3(String jName,String clZbh,String date); | 86 | List<ScheduleRealInfo> queryListWaybill3(String jName,String clZbh,String date); |
| 87 | 87 | ||
| 88 | + @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') between str_to_date(?3,'%Y-%m-%d') and str_to_date(?4,'%Y-%m-%d') order by bcs") | ||
| 89 | + List<ScheduleRealInfo> queryListWaybill4(String jName,String clZbh,String date,String enddate); | ||
| 90 | + | ||
| 88 | @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2") | 91 | @Query(value="select s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2") |
| 89 | List<ScheduleRealInfo> scheduleDaily(String line,String date); | 92 | List<ScheduleRealInfo> scheduleDaily(String line,String date); |
| 90 | 93 |
src/main/java/com/bsth/service/forms/FormsService.java
| @@ -30,7 +30,7 @@ public interface FormsService { | @@ -30,7 +30,7 @@ public interface FormsService { | ||
| 30 | 30 | ||
| 31 | public List<Singledata> singledata(Map<String, Object> map); | 31 | public List<Singledata> singledata(Map<String, Object> map); |
| 32 | 32 | ||
| 33 | - public List<Vehicleloading> vehicleloading(String line,String data); | 33 | + public List<Vehicleloading> vehicleloading(/*String gsdmVehic,String fgsdmVehic,*/String line,String data); |
| 34 | 34 | ||
| 35 | public List<Operationservice> operationservice(Map<String, Object> map); | 35 | public List<Operationservice> operationservice(Map<String, Object> map); |
| 36 | 36 |
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
| 1 | package com.bsth.service.forms.impl; | 1 | package com.bsth.service.forms.impl; |
| 2 | 2 | ||
| 3 | -import java.math.BigDecimal; | ||
| 4 | -import java.math.MathContext; | ||
| 5 | -import java.math.RoundingMode; | ||
| 6 | import java.sql.ResultSet; | 3 | import java.sql.ResultSet; |
| 7 | import java.sql.SQLException; | 4 | import java.sql.SQLException; |
| 8 | import java.text.NumberFormat; | 5 | import java.text.NumberFormat; |
| 9 | import java.text.ParseException; | 6 | import java.text.ParseException; |
| 10 | import java.text.SimpleDateFormat; | 7 | import java.text.SimpleDateFormat; |
| 11 | -import java.util.ArrayList; | ||
| 12 | import java.util.Date; | 8 | import java.util.Date; |
| 13 | import java.util.HashMap; | 9 | import java.util.HashMap; |
| 14 | import java.util.List; | 10 | import java.util.List; |
| @@ -32,8 +28,6 @@ import com.bsth.entity.mcy_forms.Changetochange; | @@ -32,8 +28,6 @@ import com.bsth.entity.mcy_forms.Changetochange; | ||
| 32 | import com.bsth.entity.mcy_forms.Executionrate; | 28 | import com.bsth.entity.mcy_forms.Executionrate; |
| 33 | import com.bsth.service.forms.FormsService; | 29 | import com.bsth.service.forms.FormsService; |
| 34 | import com.bsth.service.realcontrol.ScheduleRealInfoService; | 30 | import com.bsth.service.realcontrol.ScheduleRealInfoService; |
| 35 | -import com.bsth.util.ReportRelatedUtils; | ||
| 36 | -import com.bsth.util.ReportUtils; | ||
| 37 | 31 | ||
| 38 | @Service | 32 | @Service |
| 39 | public class FormsServiceImpl implements FormsService { | 33 | public class FormsServiceImpl implements FormsService { |
| @@ -47,14 +41,17 @@ public class FormsServiceImpl implements FormsService { | @@ -47,14 +41,17 @@ public class FormsServiceImpl implements FormsService { | ||
| 47 | // 行车路单日报表 | 41 | // 行车路单日报表 |
| 48 | @Override | 42 | @Override |
| 49 | public List<Waybillday> waybillday(Map<String, Object> map) { | 43 | public List<Waybillday> waybillday(Map<String, Object> map) { |
| 50 | - List list1 = new ArrayList<>();// | ||
| 51 | - String sql ="select x.schedule_date,x.j_gh,x.cl_zbh,z.JZL,z.YH,z.personnel_name " | ||
| 52 | - + "from bsth_c_s_sp_info_real x INNER join " | ||
| 53 | - + "( select y.RQ,y.XLBM,y.NBBM,y.JSY,y.JZL,y.YH,c.personnel_name from" | 44 | + String sql ="select x.j_gh,x.cl_zbh,z.JZL,z.YH,z.personnel_name,x.schedule_date,x.gs_bm,x.gs_name,x.fgs_bm,x.fgs_name " |
| 45 | + + " from bsth_c_s_sp_info_real x INNER join " | ||
| 46 | + + " ( select y.RQ,y.XLBM,y.NBBM,y.JSY,y.JZL,y.YH,c.personnel_name from" | ||
| 54 | + " bsth_c_ylb y LEFT JOIN bsth_c_personnel c ON c.job_code=y.JSY " | 47 | + " bsth_c_ylb y LEFT JOIN bsth_c_personnel c ON c.job_code=y.JSY " |
| 55 | - + "where to_days(y.RQ)=to_days('"+map.get("date").toString() + "') and y.XLBM= '"+ map.get("line").toString()+"' GROUP BY y.NBBM) " | ||
| 56 | - + "z on x.cl_zbh=z.nbbm where to_days( x.schedule_date)=to_days('"+map.get("date").toString()+"') " | ||
| 57 | - + "and x.xl_bm='"+map.get("line").toString()+"' GROUP BY x.cl_zbh,j_gh"; | 48 | + + " where to_days(y.RQ)=to_days('"+map.get("date").toString() + "') and y.XLBM= '"+ map.get("line").toString()+"' GROUP BY y.NBBM) " |
| 49 | + + " z on x.cl_zbh=z.nbbm where to_days( x.schedule_date)=to_days('"+map.get("date").toString()+"') " | ||
| 50 | + + " and x.xl_bm='"+map.get("line").toString()+"'" | ||
| 51 | + /*+ " and x.gs_bm='"+map.get("gsdmWaybillday").toString()+"'" | ||
| 52 | + + " and x.fgs_bm='"+map.get("fgsdmWaybillday").toString()+"'"*/ | ||
| 53 | + + " GROUP BY x.j_gh,x.cl_zbh,z.JZL,z.YH,z.personnel_name,x.schedule_date,x.gs_bm,x.gs_name,x.fgs_bm,x.fgs_name"; | ||
| 54 | + //x.cl_zbh,j_gh | ||
| 58 | List<Waybillday> list = jdbcTemplate.query(sql, new RowMapper<Waybillday>() { | 55 | List<Waybillday> list = jdbcTemplate.query(sql, new RowMapper<Waybillday>() { |
| 59 | @Override | 56 | @Override |
| 60 | public Waybillday mapRow(ResultSet arg0, int arg1) throws SQLException { | 57 | public Waybillday mapRow(ResultSet arg0, int arg1) throws SQLException { |
| @@ -83,12 +80,18 @@ public class FormsServiceImpl implements FormsService { | @@ -83,12 +80,18 @@ public class FormsServiceImpl implements FormsService { | ||
| 83 | // 线路客流量报表 | 80 | // 线路客流量报表 |
| 84 | @Override | 81 | @Override |
| 85 | public List<Linepasswengerflow> linepasswengerflow(Map<String, Object> map) { | 82 | public List<Linepasswengerflow> linepasswengerflow(Map<String, Object> map) { |
| 86 | - String sql = " SELECT s.station_name,l.name,l.create_date from bsth_c_stationroute s " | ||
| 87 | - + " LEFT JOIN bsth_c_line l on s.line_code=l.line_code " | 83 | + String sql = " SELECT s.station_name,l.name,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name" |
| 84 | + + " from bsth_c_stationroute s " | ||
| 85 | + + " LEFT JOIN bsth_c_line l on s.line_code=l.line_code " | ||
| 86 | + + " LEFT JOIN bsth_c_s_sp_info_real r on r.xl_bm=l.line_code" | ||
| 88 | + " where to_days(l.create_date)=to_days('"+map.get("date").toString() + "') " | 87 | + " where to_days(l.create_date)=to_days('"+map.get("date").toString() + "') " |
| 89 | - + " and l.line_code=" + map.get("line").toString() | ||
| 90 | - + " GROUP BY s.station_name "; | 88 | + + " and l.line_code=" + map.get("line").toString() |
| 89 | + + " AND r.gs_bm is not null" | ||
| 90 | + /*+ " and r.gs_bm='"+map.get("gsdmLine").toString()+"'" | ||
| 91 | + + " and r.fgs_bm='"+map.get("fgsdmLine").toString()+"'"*/ | ||
| 92 | + + " GROUP BY s.station_name,l.name,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name "; | ||
| 91 | 93 | ||
| 94 | + //s.station_name | ||
| 92 | List<Linepasswengerflow> list = jdbcTemplate.query(sql, new RowMapper<Linepasswengerflow>() { | 95 | List<Linepasswengerflow> list = jdbcTemplate.query(sql, new RowMapper<Linepasswengerflow>() { |
| 93 | 96 | ||
| 94 | @Override | 97 | @Override |
| @@ -108,13 +111,17 @@ public class FormsServiceImpl implements FormsService { | @@ -108,13 +111,17 @@ public class FormsServiceImpl implements FormsService { | ||
| 108 | 111 | ||
| 109 | @Override | 112 | @Override |
| 110 | public List<Shiftuehiclemanth> shiftuehiclemanth(Map<String, Object> map) { | 113 | public List<Shiftuehiclemanth> shiftuehiclemanth(Map<String, Object> map) { |
| 111 | - List list1 = new ArrayList<>();// | ||
| 112 | - String sql = "select r.j_name,r.schedule_date_str,r.update_date,r.cl_zbh " + " from bsth_c_s_sp_info_real r " | ||
| 113 | - + " LEFT JOIN bsth_c_s_ttinfo_detail d on r.lp_name=d.lp " | ||
| 114 | - + " LEFT JOIN bsth_c_line_information l on l.line=r.lp_name " | 114 | + String sql = "select r.j_name,r.cl_zbh,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name " |
| 115 | + + " from bsth_c_s_sp_info_real r " | ||
| 115 | + " where to_days(r.schedule_date_str) BETWEEN to_days('" + map.get("startDate").toString() + "') " | 116 | + " where to_days(r.schedule_date_str) BETWEEN to_days('" + map.get("startDate").toString() + "') " |
| 116 | - + " and to_days('" + map.get("endDate").toString() + "') " + " and r.xl_bm='" | ||
| 117 | - + map.get("line").toString() + "' " + " GROUP BY r.j_name" + " ORDER BY r.j_name"; | 117 | + + " and to_days('" + map.get("endDate").toString() + "') " |
| 118 | + + " and r.xl_bm='"+ map.get("line").toString() + "'" | ||
| 119 | + + " AND r.gs_bm is not null" | ||
| 120 | + /* + " and r.gs_bm='"+map.get("gsdmManth").toString()+"'" | ||
| 121 | + + " and r.fgs_bm='"+map.get("fgsdmManth").toString()+"'"*/ | ||
| 122 | + + " GROUP BY r.j_name,r.cl_zbh,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name" | ||
| 123 | + + " ORDER BY r.j_name"; | ||
| 124 | + //r.j_name | ||
| 118 | startDate = map.get("startDate").toString(); | 125 | startDate = map.get("startDate").toString(); |
| 119 | endDate = map.get("endDate").toString(); | 126 | endDate = map.get("endDate").toString(); |
| 120 | List<Shiftuehiclemanth> list = jdbcTemplate.query(sql, new RowMapper<Shiftuehiclemanth>() { | 127 | List<Shiftuehiclemanth> list = jdbcTemplate.query(sql, new RowMapper<Shiftuehiclemanth>() { |
| @@ -123,11 +130,12 @@ public class FormsServiceImpl implements FormsService { | @@ -123,11 +130,12 @@ public class FormsServiceImpl implements FormsService { | ||
| 123 | public Shiftuehiclemanth mapRow(ResultSet arg0, int arg1) throws SQLException { | 130 | public Shiftuehiclemanth mapRow(ResultSet arg0, int arg1) throws SQLException { |
| 124 | Shiftuehiclemanth shif = new Shiftuehiclemanth(); | 131 | Shiftuehiclemanth shif = new Shiftuehiclemanth(); |
| 125 | shif.setjName(arg0.getString("j_name")); | 132 | shif.setjName(arg0.getString("j_name")); |
| 126 | - | 133 | + |
| 127 | Map<String, Object> maps = new HashMap<>(); | 134 | Map<String, Object> maps = new HashMap<>(); |
| 128 | 135 | ||
| 129 | maps = scheduleRealInfoService.findKMBC1(arg0.getString("j_name"), arg0.getString("cl_zbh"), startDate, | 136 | maps = scheduleRealInfoService.findKMBC1(arg0.getString("j_name"), arg0.getString("cl_zbh"), startDate, |
| 130 | endDate); | 137 | endDate); |
| 138 | + | ||
| 131 | shif.setJhlc(maps.get("jhlc").toString()); | 139 | shif.setJhlc(maps.get("jhlc").toString()); |
| 132 | shif.setEmptMileage(maps.get("ksgl").toString()); | 140 | shif.setEmptMileage(maps.get("ksgl").toString()); |
| 133 | shif.setRemMileage(maps.get("remMileage").toString()); | 141 | shif.setRemMileage(maps.get("remMileage").toString()); |
| @@ -148,9 +156,15 @@ public class FormsServiceImpl implements FormsService { | @@ -148,9 +156,15 @@ public class FormsServiceImpl implements FormsService { | ||
| 148 | // 班次车辆人员日统计 | 156 | // 班次车辆人员日统计 |
| 149 | @Override | 157 | @Override |
| 150 | public List<Shifday> shifday(Map<String, Object> map) { | 158 | public List<Shifday> shifday(Map<String, Object> map) { |
| 151 | - String sql = " select r.lp_name,r.xl_name,r.j_name,r.s_name, r.cl_zbh,r.xl_bm,r.schedule_date,r.cl_zbh,r.j_gh " | ||
| 152 | - + " FROM bsth_c_s_sp_info_real r " + " where to_days(r.schedule_date)=to_days('" | ||
| 153 | - + map.get("date").toString() + "') and r.xl_bm=" + map.get("line").toString() + " GROUP BY r.j_name "; | 159 | + String sql = " select r.schedule_date,r.lp_name,r.xl_name,r.j_name,r.s_name, r.cl_zbh,r.xl_bm," |
| 160 | + + " r.cl_zbh,r.j_gh,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name " | ||
| 161 | + + " FROM bsth_c_s_sp_info_real r " | ||
| 162 | + + " where to_days(r.schedule_date)=to_days('" | ||
| 163 | + + map.get("date").toString() + "') and r.xl_bm=" + map.get("line").toString() | ||
| 164 | + /*+ " and r.gs_bm='"+map.get("gsdmShif").toString()+"'" | ||
| 165 | + + " and r.fgs_bm='"+map.get("fgsdmShif").toString()+"'"*/ | ||
| 166 | + + " GROUP BY r.schedule_date,r.lp_name,r.xl_name,r.j_name,r.s_name, r.cl_zbh,r.xl_bm,r.cl_zbh,r.j_gh,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name " | ||
| 167 | + + " ORDER BY r.lp_name asc"; | ||
| 154 | 168 | ||
| 155 | List<Shifday> list = jdbcTemplate.query(sql, new RowMapper<Shifday>() { | 169 | List<Shifday> list = jdbcTemplate.query(sql, new RowMapper<Shifday>() { |
| 156 | 170 | ||
| @@ -166,14 +180,14 @@ public class FormsServiceImpl implements FormsService { | @@ -166,14 +180,14 @@ public class FormsServiceImpl implements FormsService { | ||
| 166 | map = scheduleRealInfoService.findKMBC2(arg0.getString("j_gh"), arg0.getString("cl_zbh"), | 180 | map = scheduleRealInfoService.findKMBC2(arg0.getString("j_gh"), arg0.getString("cl_zbh"), |
| 167 | arg0.getString("schedule_date")); | 181 | arg0.getString("schedule_date")); |
| 168 | shifday.setJhlc(map.get("jhlc").toString());// 计划里程 | 182 | shifday.setJhlc(map.get("jhlc").toString());// 计划里程 |
| 169 | - // shifday.setSjjhlc(map.get("remMileage").toString());//实际计划里程 | 183 | + //shifday.setSjjhlc(map.get("remMileage").toString());//实际计划里程 |
| 170 | shifday.setYygl(map.get("yygl").toString());// 营运里程 | 184 | shifday.setYygl(map.get("yygl").toString());// 营运里程 |
| 171 | shifday.setEmptMileage(map.get("ksgl").toString());// 空驶里程 | 185 | shifday.setEmptMileage(map.get("ksgl").toString());// 空驶里程 |
| 172 | shifday.setRemMileage(map.get("remMileage").toString());// 抽减里程 | 186 | shifday.setRemMileage(map.get("remMileage").toString());// 抽减里程 |
| 173 | shifday.setAddMileage(map.get("addMileage").toString());// 增加里程 | 187 | shifday.setAddMileage(map.get("addMileage").toString());// 增加里程 |
| 174 | shifday.setTotalm(map.get("realMileage").toString());// 总里程 | 188 | shifday.setTotalm(map.get("realMileage").toString());// 总里程 |
| 175 | shifday.setJhbc(map.get("jhbc").toString());// 计划班次 | 189 | shifday.setJhbc(map.get("jhbc").toString());// 计划班次 |
| 176 | - // shifday.setSjjhbc(map.get("sjjhbc").toString());//实际计划班次 | 190 | + //shifday.setSjjhbc(map.get("sjjhbc").toString());//实际计划班次 |
| 177 | shifday.setCjbc(map.get("cjbc").toString());// 抽减班次 | 191 | shifday.setCjbc(map.get("cjbc").toString());// 抽减班次 |
| 178 | shifday.setLjbc(map.get("ljbc").toString());// 增加班次 | 192 | shifday.setLjbc(map.get("ljbc").toString());// 增加班次 |
| 179 | shifday.setSjbc(map.get("sjbc").toString());// 实际班次 | 193 | shifday.setSjbc(map.get("sjbc").toString());// 实际班次 |
| @@ -249,30 +263,56 @@ public class FormsServiceImpl implements FormsService { | @@ -249,30 +263,56 @@ public class FormsServiceImpl implements FormsService { | ||
| 249 | // 路单数据 | 263 | // 路单数据 |
| 250 | @Override | 264 | @Override |
| 251 | public List<Singledata> singledata(Map<String, Object> map) { | 265 | public List<Singledata> singledata(Map<String, Object> map) { |
| 266 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 267 | + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy年MM月dd日"); | ||
| 268 | + Date d = null; | ||
| 269 | + Date d1 = null; | ||
| 270 | + try { | ||
| 271 | + d = sdf.parse(map.get("startDate").toString()); | ||
| 272 | + d1 = sdf.parse(map.get("endDate").toString()); | ||
| 273 | + } catch (ParseException e) { | ||
| 252 | 274 | ||
| 253 | - String sql = " SELECT y.RQ,y.SSGSDM,y.XLBM,y.NBBM,y.JSY,y.YH,y.JZL " + " FROM bsth_c_ylb y" | ||
| 254 | - + " where y.RQ BETWEEN '" + map.get("startDate").toString() + "'" + " and '" | ||
| 255 | - + map.get("endDate").toString() + "'" + " and y.XLBM='" + map.get("line").toString() + "'" | ||
| 256 | - + " GROUP BY y.NBBM "; | 275 | + e.printStackTrace(); |
| 276 | + } | ||
| 277 | + String rq2 = sdf1.format(d); | ||
| 278 | + String rq3 = sdf1.format(d1); | ||
| 257 | 279 | ||
| 280 | + rq = rq2 + "-" + rq3; | ||
| 281 | + | ||
| 282 | + String sql = " SELECT r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,y.YH,y.JZL,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name " | ||
| 283 | + + " FROM bsth_c_s_sp_info_real r " | ||
| 284 | + + " INNER join ( select y.RQ,y.XLBM,y.NBBM,y.JSY,y.JZL,y.YH from bsth_c_ylb y " | ||
| 285 | + + " where y.RQ BETWEEN '" + map.get("startDate").toString() + "' and '"+ map.get("endDate").toString() + "'" | ||
| 286 | + + " and y.XLBM= '" + map.get("line").toString() + "' GROUP BY y.RQ,y.XLBM,y.NBBM,y.JSY,y.JZL,y.YH) y on r.cl_zbh=y.nbbm " | ||
| 287 | + + " where r.schedule_date_str BETWEEN '" + map.get("startDate").toString() + "'" | ||
| 288 | + + " and '"+ map.get("endDate").toString() + "'" | ||
| 289 | + + " and r.xl_bm='" + map.get("line").toString() + "'" | ||
| 290 | + + " AND r.gs_bm is not null" | ||
| 291 | + /* + " and r.gs_bm='"+map.get("gsdmSing").toString()+"'" | ||
| 292 | + + " and r.fgs_bm='"+map.get("fgsdmSing").toString()+"'"*/ | ||
| 293 | + + " GROUP BY r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,y.YH,y.JZL,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name "; | ||
| 294 | + | ||
| 295 | + startDate = map.get("startDate").toString(); | ||
| 296 | + endDate = map.get("endDate").toString(); | ||
| 258 | List<Singledata> list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { | 297 | List<Singledata> list = jdbcTemplate.query(sql, new RowMapper<Singledata>() { |
| 259 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 260 | - | 298 | + //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| 261 | @Override | 299 | @Override |
| 262 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { | 300 | public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException { |
| 263 | Singledata sin = new Singledata(); | 301 | Singledata sin = new Singledata(); |
| 264 | - sin.setrQ(sdf.format(arg0.getDate("rq"))); | ||
| 265 | - sin.setgS(arg0.getString("SSGSDM").toString()); | ||
| 266 | - sin.setxL(arg0.getString("XLBM").toString()); | ||
| 267 | - sin.setClzbh(arg0.getString("NBBM").toString()); | ||
| 268 | - sin.setJsy(arg0.getString("JSY").toString()); | 302 | + sin.setrQ(rq); |
| 303 | + sin.setgS(arg0.getString("gs_name").toString()); | ||
| 304 | + sin.setxL(arg0.getString("xl_bm").toString()); | ||
| 305 | + sin.setClzbh(arg0.getString("cl_zbh").toString()); | ||
| 306 | + sin.setJsy(arg0.getString("j_gh").toString()); | ||
| 307 | + sin.setjName(arg0.getString("j_name").toString()); | ||
| 269 | sin.setHyl(arg0.getString("YH").toString()); | 308 | sin.setHyl(arg0.getString("YH").toString()); |
| 270 | sin.setJzl(arg0.getString("JZL").toString()); | 309 | sin.setJzl(arg0.getString("JZL").toString()); |
| 271 | // sin.setJzl(arg0.getString(""));//非营业性用油 | 310 | // sin.setJzl(arg0.getString(""));//非营业性用油 |
| 272 | sin.setJhjl(arg0.getString("JZL")); | 311 | sin.setJhjl(arg0.getString("JZL")); |
| 273 | Map<String, Object> maps = new HashMap<>(); | 312 | Map<String, Object> maps = new HashMap<>(); |
| 274 | - maps = scheduleRealInfoService.findKMBC2(sin.getJsy(), sin.getClzbh(), sin.getrQ()); | ||
| 275 | - sin.setjName(maps.get("j_name") == null ? "" : maps.get("j_name").toString()); | 313 | + maps = scheduleRealInfoService.findKMBC1(arg0.getString("j_name"), arg0.getString("cl_zbh"), startDate, |
| 314 | + endDate); | ||
| 315 | + //sin.setjName(maps.get("j_name") == null ? "" : maps.get("j_name").toString()); | ||
| 276 | sin.setSgh(maps.get("s_gh") == null ? "" : maps.get("s_gh").toString()); | 316 | sin.setSgh(maps.get("s_gh") == null ? "" : maps.get("s_gh").toString()); |
| 277 | sin.setsName(maps.get("s_name") == null ? "" : maps.get("s_name").toString()); | 317 | sin.setsName(maps.get("s_name") == null ? "" : maps.get("s_name").toString()); |
| 278 | sin.setJhlc(maps.get("yygl") == null ? "" : maps.get("yygl").toString()); | 318 | sin.setJhlc(maps.get("yygl") == null ? "" : maps.get("yygl").toString()); |
| @@ -289,22 +329,34 @@ public class FormsServiceImpl implements FormsService { | @@ -289,22 +329,34 @@ public class FormsServiceImpl implements FormsService { | ||
| 289 | @Override | 329 | @Override |
| 290 | public List<Operationservice> operationservice(Map<String, Object> map) { | 330 | public List<Operationservice> operationservice(Map<String, Object> map) { |
| 291 | 331 | ||
| 292 | - String sql = " SELECT y.RQ,y.XLBM,y.NBBM,y.JSY,y.YH,y.JZL " + " FROM bsth_c_ylb y" + " where y.RQ BETWEEN '" | ||
| 293 | - + map.get("startDate").toString() + "'" + " and '" + map.get("endDate").toString() + "'" | ||
| 294 | - + " and y.XLBM='" + map.get("line").toString() + "'" + " GROUP BY y.NBBM "; | ||
| 295 | - | 332 | + String sql = " SELECT r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,y.YH,y.JZL,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name " |
| 333 | + + " FROM bsth_c_s_sp_info_real r " | ||
| 334 | + // + "LEFT JOIN bsth_c_s_sp_info_real r on r.cl_zbh=y.NBBM" | ||
| 335 | + + " INNER join ( select y.RQ,y.XLBM,y.NBBM,y.JSY,y.JZL,y.YH from bsth_c_ylb y " | ||
| 336 | + + " where y.RQ BETWEEN '" + map.get("startDate").toString() + "' and '"+ map.get("endDate").toString() + "'" | ||
| 337 | + + " and y.XLBM= '" + map.get("line").toString() + "' GROUP BY y.RQ,y.XLBM,y.NBBM,y.JSY,y.JZL,y.YH) y on r.cl_zbh=y.nbbm " | ||
| 338 | + + " where r.schedule_date_str BETWEEN '"+ map.get("startDate").toString() | ||
| 339 | + + "'" + " and '" + map.get("endDate").toString() + "'" | ||
| 340 | + + " and r.xl_bm='" + map.get("line").toString() + "'" | ||
| 341 | + /* + " and r.gs_bm='"+map.get("gsdmOperat").toString()+"'" | ||
| 342 | + + " and r.fgs_bm='"+map.get("fgsdmOperat").toString()+"'"*/ | ||
| 343 | + + " AND r.gs_bm is not null" | ||
| 344 | + + " GROUP BY r.xl_bm,r.xl_name,r.cl_zbh,r.j_gh,r.j_name,y.YH,y.JZL,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name"; | ||
| 345 | + | ||
| 346 | + //r.j_name | ||
| 347 | + startDate = map.get("startDate").toString(); | ||
| 348 | + endDate = map.get("endDate").toString(); | ||
| 296 | List<Operationservice> list = jdbcTemplate.query(sql, new RowMapper<Operationservice>() { | 349 | List<Operationservice> list = jdbcTemplate.query(sql, new RowMapper<Operationservice>() { |
| 297 | - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 298 | 350 | ||
| 299 | @Override | 351 | @Override |
| 300 | public Operationservice mapRow(ResultSet arg0, int arg1) throws SQLException { | 352 | public Operationservice mapRow(ResultSet arg0, int arg1) throws SQLException { |
| 301 | - Singledata sin = new Singledata(); | ||
| 302 | Operationservice op = new Operationservice(); | 353 | Operationservice op = new Operationservice(); |
| 303 | - op.setXlName(arg0.getString("XLBM").toString()); | 354 | + op.setXlName(arg0.getString("xl_name").toString()); |
| 304 | op.setJzl(arg0.getString("JZL").toString()); | 355 | op.setJzl(arg0.getString("JZL").toString()); |
| 305 | op.setXhl(arg0.getString("YH").toString()); | 356 | op.setXhl(arg0.getString("YH").toString()); |
| 306 | Map<String, Object> maps = new HashMap<>(); | 357 | Map<String, Object> maps = new HashMap<>(); |
| 307 | - maps = scheduleRealInfoService.findKMBC2(sin.getJsy(), sin.getClzbh(), sin.getrQ()); | 358 | + maps = scheduleRealInfoService.findKMBC1(arg0.getString("j_name"), arg0.getString("cl_zbh"), startDate, |
| 359 | + endDate); | ||
| 308 | op.setXsgl(maps.get("yygl").toString() == null ? "" : maps.get("yygl").toString()); | 360 | op.setXsgl(maps.get("yygl").toString() == null ? "" : maps.get("yygl").toString()); |
| 309 | op.setEmptMileage(maps.get("ksgl").toString() == null ? "" : maps.get("ksgl").toString()); | 361 | op.setEmptMileage(maps.get("ksgl").toString() == null ? "" : maps.get("ksgl").toString()); |
| 310 | op.setSjbc(maps.get("sjbc").toString() == null ? "" : maps.get("sjbc").toString()); | 362 | op.setSjbc(maps.get("sjbc").toString() == null ? "" : maps.get("sjbc").toString()); |
| @@ -316,26 +368,36 @@ public class FormsServiceImpl implements FormsService { | @@ -316,26 +368,36 @@ public class FormsServiceImpl implements FormsService { | ||
| 316 | 368 | ||
| 317 | // 车辆加注 | 369 | // 车辆加注 |
| 318 | @Override | 370 | @Override |
| 319 | - public List<Vehicleloading> vehicleloading(String line, String data) { | ||
| 320 | - | ||
| 321 | - String sql = " SELECT y.RQ,y.SSGSDM,y.XLBM,y.NBBM,y.JSY,y.YH,y.JZL " + " FROM bsth_c_ylb y " | ||
| 322 | - + " where to_days(y.RQ)=to_days('" + data + "')" + " and y.XLBM='" + line + "' " | ||
| 323 | - + " GROUP BY y.NBBM "; | ||
| 324 | - | 371 | + public List<Vehicleloading> vehicleloading(/*String gsdmVehic,String fgsdmVehic,*/String line, String date) { |
| 372 | + | ||
| 373 | + String sql = " SELECT r.schedule_date_str,r.xl_bm,r.xl_name,r.cl_zbh,r.j_name,y.YH,y.JZL,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name " | ||
| 374 | + + " FROM bsth_c_s_sp_info_real r " | ||
| 375 | + + " INNER join ( select y.RQ,y.XLBM,y.NBBM,y.JSY,y.JZL,y.YH from bsth_c_ylb y " | ||
| 376 | + + " where to_days(y.RQ)=to_days('" + date + "') and y.XLBM= '" + line + "' GROUP BY y.RQ,y.XLBM,y.NBBM,y.JSY,y.JZL,y.YH) y " | ||
| 377 | + + " on r.cl_zbh=y.nbbm " | ||
| 378 | + + " where to_days(r.schedule_date_str)=to_days('" + date + "')" | ||
| 379 | + + " and r.xl_bm='" + line + "' " | ||
| 380 | + + " AND r.gs_bm is not null" | ||
| 381 | + /* + " and r.gs_bm='"+gsdmVehic +"'" | ||
| 382 | + + " and r.fgs_bm='"+fgsdmVehic +"'"*/ | ||
| 383 | + + " GROUP BY r.schedule_date_str,r.xl_bm,r.xl_name,r.cl_zbh,r.j_name,y.YH,y.JZL,r.j_gh,r.gs_bm,r.gs_name,r.fgs_bm,r.fgs_name "; | ||
| 384 | + | ||
| 385 | + | ||
| 386 | + //r.cl_zbh | ||
| 325 | List<Vehicleloading> list = jdbcTemplate.query(sql, new RowMapper<Vehicleloading>() { | 387 | List<Vehicleloading> list = jdbcTemplate.query(sql, new RowMapper<Vehicleloading>() { |
| 326 | @Override | 388 | @Override |
| 327 | public Vehicleloading mapRow(ResultSet arg0, int arg1) throws SQLException { | 389 | public Vehicleloading mapRow(ResultSet arg0, int arg1) throws SQLException { |
| 328 | Vehicleloading ve = new Vehicleloading(); | 390 | Vehicleloading ve = new Vehicleloading(); |
| 329 | - ve.setrQ(arg0.getString("RQ").toString()); | ||
| 330 | - ve.setgS(arg0.getString("SSDM").toString()); | ||
| 331 | - ve.setxL(arg0.getString("XLBM").toString()); | ||
| 332 | - ve.setClzbh(arg0.getString("NBBM").toString()); | 391 | + ve.setrQ(arg0.getString("schedule_date_str").toString()); |
| 392 | + ve.setgS(arg0.getString("gs_name").toString()); | ||
| 393 | + ve.setxL(arg0.getString("xl_name").toString()); | ||
| 394 | + ve.setClzbh(arg0.getString("cl_zbh").toString()); | ||
| 333 | ve.setHyl(arg0.getString("YH").toString()); | 395 | ve.setHyl(arg0.getString("YH").toString()); |
| 334 | ve.setJzl(arg0.getString("JZL").toString()); | 396 | ve.setJzl(arg0.getString("JZL").toString()); |
| 335 | // ve.setLs(arg0.getString("").toString());//尿素 | 397 | // ve.setLs(arg0.getString("").toString());//尿素 |
| 336 | Map<String, Object> maps = new HashMap<>(); | 398 | Map<String, Object> maps = new HashMap<>(); |
| 337 | - maps = scheduleRealInfoService.findKMBC2(arg0.getString("JSY"), arg0.getString("NBBM"), | ||
| 338 | - arg0.getString("RQ")); | 399 | + maps = scheduleRealInfoService.findKMBC2(arg0.getString("j_gh"), arg0.getString("cl_zbh"), |
| 400 | + arg0.getString("schedule_date_str")); | ||
| 339 | ve.setJhlc(maps.get("yygl") == null ? "" : maps.get("yygl").toString()); | 401 | ve.setJhlc(maps.get("yygl") == null ? "" : maps.get("yygl").toString()); |
| 340 | ve.setJhbc(maps.get("jhbc").toString() == null ? "" : maps.get("jhbc").toString());// 计划班次 | 402 | ve.setJhbc(maps.get("jhbc").toString() == null ? "" : maps.get("jhbc").toString());// 计划班次 |
| 341 | ve.setSjbc(maps.get("sjbc").toString() == null ? "" : maps.get("sjbc").toString());// 实际班次 | 403 | ve.setSjbc(maps.get("sjbc").toString() == null ? "" : maps.get("sjbc").toString());// 实际班次 |
| @@ -367,13 +429,15 @@ public class FormsServiceImpl implements FormsService { | @@ -367,13 +429,15 @@ public class FormsServiceImpl implements FormsService { | ||
| 367 | 429 | ||
| 368 | String sql = " select b.xlgs, a.gs_bm,a.gs_name, a.fgs_bm,a.fgs_name , a.xl_bm,b.sbc,b.sxl,b.scl,a.jbc ,a.jxl ,a.jcl,a.gslsbm,a.fgsbm,b.warrant_car from " | 430 | String sql = " select b.xlgs, a.gs_bm,a.gs_name, a.fgs_bm,a.fgs_name , a.xl_bm,b.sbc,b.sxl,b.scl,a.jbc ,a.jxl ,a.jcl,a.gslsbm,a.fgsbm,b.warrant_car from " |
| 369 | + " (select count(DISTINCT gs_bm) gslsbm, gs_bm, count(DISTINCT fgs_bm) fgsbm,fgs_bm,gs_name,fgs_name ,xl_bm, count(*) as jbc,COUNT(DISTINCT xl_bm) as jxl ,COUNT(DISTINCT cl_zbh) as jcl" | 431 | + " (select count(DISTINCT gs_bm) gslsbm, gs_bm, count(DISTINCT fgs_bm) fgsbm,fgs_bm,gs_name,fgs_name ,xl_bm, count(*) as jbc,COUNT(DISTINCT xl_bm) as jxl ,COUNT(DISTINCT cl_zbh) as jcl" |
| 370 | - + " from bsth_c_s_sp_info" + " where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '" | ||
| 371 | - + map.get("startDate").toString() + "' and '" + map.get("endDate").toString() + "' and xl_bm='" | ||
| 372 | - + map.get("line").toString() + "' AND gs_bm is not null" | 432 | + + " from bsth_c_s_sp_info" + " where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '"+ map.get("startDate").toString() + "' " |
| 433 | + + " and '" + map.get("endDate").toString() + "' and xl_bm='"+ map.get("line").toString() + "' " | ||
| 434 | + + " AND gs_bm is not null " | ||
| 435 | + /*+ " and gs_bm='"+ map.get("gsdmTurn").toString() + "'" | ||
| 436 | + + " and fgs_bm='"+ map.get("fgsdmTurn").toString() + "'"*/ | ||
| 373 | + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name ) a left JOIN (" | 437 | + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name ) a left JOIN (" |
| 374 | - + "SELECT COUNT(*) as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl,t.warrant_car " | ||
| 375 | - + "from bsth_c_line t RIGHT JOIN (select gs_bm,fgs_bm,xl_bm,gs_name,fgs_name, count(*) as sbc,COUNT(DISTINCT xl_bm) as sxl ,COUNT(DISTINCT cl_zbh) as scl from bsth_c_s_sp_info_real " | ||
| 376 | - + "where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '" + map.get("startDate").toString() + "' and '" | 438 | + + " SELECT COUNT(*) as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl,t.warrant_car " |
| 439 | + + " from bsth_c_line t RIGHT JOIN (select gs_bm,fgs_bm,xl_bm,gs_name,fgs_name, count(*) as sbc,COUNT(DISTINCT xl_bm) as sxl ,COUNT(DISTINCT cl_zbh) as scl from bsth_c_s_sp_info_real " | ||
| 440 | + + " where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '" + map.get("startDate").toString() + "' and '" | ||
| 377 | + map.get("endDate").toString() + "' and xl_bm='" + map.get("line").toString() | 441 | + map.get("endDate").toString() + "' and xl_bm='" + map.get("line").toString() |
| 378 | + "' AND gs_bm is not null " | 442 | + "' AND gs_bm is not null " |
| 379 | + "GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name) b ON t.company=b.gs_bm) b on " | 443 | + "GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name) b ON t.company=b.gs_bm) b on " |
| @@ -412,6 +476,8 @@ public class FormsServiceImpl implements FormsService { | @@ -412,6 +476,8 @@ public class FormsServiceImpl implements FormsService { | ||
| 412 | return list; | 476 | return list; |
| 413 | } | 477 | } |
| 414 | 478 | ||
| 479 | + | ||
| 480 | + //班次执行率统计表 | ||
| 415 | @Override | 481 | @Override |
| 416 | public List<Executionrate> executionrate(Map<String, Object> map) { | 482 | public List<Executionrate> executionrate(Map<String, Object> map) { |
| 417 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | 483 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| @@ -435,6 +501,8 @@ public class FormsServiceImpl implements FormsService { | @@ -435,6 +501,8 @@ public class FormsServiceImpl implements FormsService { | ||
| 435 | + " from bsth_c_s_sp_info" + " where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '" | 501 | + " from bsth_c_s_sp_info" + " where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '" |
| 436 | + map.get("startDate").toString() + "' and '" + map.get("endDate").toString() + "' and xl_bm='" | 502 | + map.get("startDate").toString() + "' and '" + map.get("endDate").toString() + "' and xl_bm='" |
| 437 | + map.get("line").toString() + "' AND gs_bm is not null" | 503 | + map.get("line").toString() + "' AND gs_bm is not null" |
| 504 | + /*+ " and gs_bm='"+ map.get("gsdmEcecut").toString() + "'" | ||
| 505 | + + " and fgs_bm='"+ map.get("fgsdmEcecut").toString() + "'"*/ | ||
| 438 | + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name ) a left JOIN (" | 506 | + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name ) a left JOIN (" |
| 439 | + "SELECT COUNT(*) as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b.xl_name,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl " | 507 | + "SELECT COUNT(*) as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b.xl_name,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl " |
| 440 | + "from bsth_c_line t RIGHT JOIN (select gs_bm,fgs_bm,xl_bm,xl_name,gs_name,fgs_name, count(*) as sbc,COUNT(DISTINCT xl_bm) as sxl ,COUNT(DISTINCT cl_zbh) as scl from bsth_c_s_sp_info_real " | 508 | + "from bsth_c_line t RIGHT JOIN (select gs_bm,fgs_bm,xl_bm,xl_name,gs_name,fgs_name, count(*) as sbc,COUNT(DISTINCT xl_bm) as sxl ,COUNT(DISTINCT cl_zbh) as scl from bsth_c_s_sp_info_real " |
| @@ -501,6 +569,8 @@ public class FormsServiceImpl implements FormsService { | @@ -501,6 +569,8 @@ public class FormsServiceImpl implements FormsService { | ||
| 501 | + " from bsth_c_s_sp_info" + " where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '" | 569 | + " from bsth_c_s_sp_info" + " where DATE_FORMAT(schedule_date,'%Y-%m-%d') BETWEEN '" |
| 502 | + map.get("startDate").toString() + "' and '" + map.get("endDate").toString() + "' and xl_bm='" | 570 | + map.get("startDate").toString() + "' and '" + map.get("endDate").toString() + "' and xl_bm='" |
| 503 | + map.get("line").toString() + "' AND gs_bm is not null" | 571 | + map.get("line").toString() + "' AND gs_bm is not null" |
| 572 | + /*+ " and gs_bm='"+ map.get("gsdmAllline").toString() + "'" | ||
| 573 | + + " and fgs_bm='"+ map.get("fgsdmAllline").toString() + "'"*/ | ||
| 504 | + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name ) a left JOIN (" | 574 | + " GROUP BY gs_bm,fgs_bm,xl_bm,gs_name,fgs_name ) a left JOIN (" |
| 505 | + "SELECT COUNT(*) as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b.xl_name,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl " | 575 | + "SELECT COUNT(*) as xlgs,b.gs_bm,b.fgs_bm,b.xl_bm,b.xl_name,b.gs_name,b.fgs_name, b.sbc,b.sxl ,b.scl " |
| 506 | + "from bsth_c_line t RIGHT JOIN (select gs_bm,fgs_bm,xl_bm,xl_name,gs_name,fgs_name, count(*) as sbc,COUNT(DISTINCT xl_bm) as sxl ,COUNT(DISTINCT cl_zbh) as scl from bsth_c_s_sp_info_real " | 576 | + "from bsth_c_line t RIGHT JOIN (select gs_bm,fgs_bm,xl_bm,xl_name,gs_name,fgs_name, count(*) as sbc,COUNT(DISTINCT xl_bm) as sxl ,COUNT(DISTINCT cl_zbh) as scl from bsth_c_s_sp_info_real " |
src/main/java/com/bsth/service/realcontrol/RealMapService.java
| @@ -9,4 +9,8 @@ public interface RealMapService { | @@ -9,4 +9,8 @@ public interface RealMapService { | ||
| 9 | Map<String, Object> stationSpatialData(String idx); | 9 | Map<String, Object> stationSpatialData(String idx); |
| 10 | 10 | ||
| 11 | Map<String,Object> carParkSpatialData(); | 11 | Map<String,Object> carParkSpatialData(); |
| 12 | + | ||
| 13 | + Map<String,Object> findRouteByLine(String lineCode); | ||
| 14 | + | ||
| 15 | + Map<String,Object> findRouteAndStationByLine(String lineCode); | ||
| 12 | } | 16 | } |
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
| 1 | package com.bsth.service.realcontrol; | 1 | package com.bsth.service.realcontrol; |
| 2 | 2 | ||
| 3 | -import java.util.Collection; | ||
| 4 | -import java.util.List; | ||
| 5 | -import java.util.Map; | ||
| 6 | - | ||
| 7 | -import org.springframework.stereotype.Service; | ||
| 8 | - | ||
| 9 | import com.bsth.controller.realcontrol.dto.ChangePersonCar; | 3 | import com.bsth.controller.realcontrol.dto.ChangePersonCar; |
| 10 | import com.bsth.controller.realcontrol.dto.DfsjChange; | 4 | import com.bsth.controller.realcontrol.dto.DfsjChange; |
| 11 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 5 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 12 | import com.bsth.service.BaseService; | 6 | import com.bsth.service.BaseService; |
| 7 | +import org.springframework.stereotype.Service; | ||
| 8 | + | ||
| 9 | +import java.util.Collection; | ||
| 10 | +import java.util.List; | ||
| 11 | +import java.util.Map; | ||
| 13 | 12 | ||
| 14 | @Service | 13 | @Service |
| 15 | public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, Long>{ | 14 | public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, Long>{ |
| @@ -18,7 +17,7 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | @@ -18,7 +17,7 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | ||
| 18 | 17 | ||
| 19 | Map<String, Object> outgoAdjust(Long id, String remarks, String dfsj/*,String nbbm,String jsy,String spy*/); | 18 | Map<String, Object> outgoAdjust(Long id, String remarks, String dfsj/*,String nbbm,String jsy,String spy*/); |
| 20 | 19 | ||
| 21 | - Map<String, Object> destroy(String idsStr/*, int spaceAdjust*/, String remarks/*, String reason, int spaceNum*/); | 20 | + Map<String, Object> destroy(String idsStr/*, int spaceAdjust*/, String remarks, String reason/*, int spaceNum*/); |
| 22 | 21 | ||
| 23 | List<Map<String, String>> findDriverByLine(String lineCode); | 22 | List<Map<String, String>> findDriverByLine(String lineCode); |
| 24 | 23 |
src/main/java/com/bsth/service/realcontrol/dto/SectionRouteCoords.java
0 → 100644
| 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/realcontrol/impl/RealChartsServiceImpl.java
| @@ -218,7 +218,7 @@ public class RealChartsServiceImpl implements RealChartsService { | @@ -218,7 +218,7 @@ public class RealChartsServiceImpl implements RealChartsService { | ||
| 218 | } | 218 | } |
| 219 | inStr = " (" + inStr.substring(1) + ")"; | 219 | inStr = " (" + inStr.substring(1) + ")"; |
| 220 | 220 | ||
| 221 | - String sql = "select min(DFSJ) as STARTDATE,max(DFSJ) as ENDDATE,SCHEDULE_DATE_STR,XL_BM,XL_DIR,REAL_EXEC_DATE from (SELECT SCHEDULE_DATE_STR,concat_ws('_',concat_ws('/', dfsj, fcsj_actual),fcno) AS DFSJ,XL_BM,XL_DIR,REAL_EXEC_DATE FROM bsth_c_s_sp_info_real WHERE schedule_date_str LIKE :month AND bc_type = 'normal' AND dfsj IS NOT NULL AND xl_bm IN "+inStr+") t group by SCHEDULE_DATE_STR,XL_BM,XL_DIR,REAL_EXEC_DATE"; | 221 | + String sql = "select min(DFSJ) as STARTDATE,max(DFSJ) as ENDDATE,SCHEDULE_DATE_STR,XL_BM,XL_DIR,REAL_EXEC_DATE from (SELECT SCHEDULE_DATE_STR,concat_ws('_',concat_ws('/', dfsj, fcsj_actual),fcno) AS DFSJ,XL_BM,XL_DIR,REAL_EXEC_DATE FROM bsth_c_s_sp_info_real WHERE schedule_date_str LIKE :month AND bc_type = 'normal' AND dfsj IS NOT NULL AND xl_bm IN "+inStr+" AND status !=-1) t group by SCHEDULE_DATE_STR,XL_BM,XL_DIR,REAL_EXEC_DATE"; |
| 222 | MapSqlParameterSource parameters = new MapSqlParameterSource(); | 222 | MapSqlParameterSource parameters = new MapSqlParameterSource(); |
| 223 | parameters.addValue("month", month+"-%"); | 223 | parameters.addValue("month", month+"-%"); |
| 224 | 224 |
src/main/java/com/bsth/service/realcontrol/impl/RealMapServiceImpl.java
| @@ -4,17 +4,18 @@ import com.bsth.common.ResponseCode; | @@ -4,17 +4,18 @@ import com.bsth.common.ResponseCode; | ||
| 4 | import com.bsth.controller.realcontrol.dto.StationSpatialData; | 4 | import com.bsth.controller.realcontrol.dto.StationSpatialData; |
| 5 | import com.bsth.entity.CarPark; | 5 | import com.bsth.entity.CarPark; |
| 6 | import com.bsth.service.realcontrol.RealMapService; | 6 | import com.bsth.service.realcontrol.RealMapService; |
| 7 | +import com.bsth.service.realcontrol.dto.SectionRouteCoords; | ||
| 8 | +import com.bsth.util.TransGPS; | ||
| 7 | import com.google.common.base.Splitter; | 9 | import com.google.common.base.Splitter; |
| 8 | import org.slf4j.Logger; | 10 | import org.slf4j.Logger; |
| 9 | import org.slf4j.LoggerFactory; | 11 | import org.slf4j.LoggerFactory; |
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | +import org.springframework.dao.DataAccessException; | ||
| 11 | import org.springframework.jdbc.core.BeanPropertyRowMapper; | 14 | import org.springframework.jdbc.core.BeanPropertyRowMapper; |
| 12 | import org.springframework.jdbc.core.JdbcTemplate; | 15 | import org.springframework.jdbc.core.JdbcTemplate; |
| 13 | import org.springframework.stereotype.Service; | 16 | import org.springframework.stereotype.Service; |
| 14 | 17 | ||
| 15 | -import java.util.HashMap; | ||
| 16 | -import java.util.List; | ||
| 17 | -import java.util.Map; | 18 | +import java.util.*; |
| 18 | 19 | ||
| 19 | /** | 20 | /** |
| 20 | * Created by panzhao on 2016/11/23. | 21 | * Created by panzhao on 2016/11/23. |
| @@ -36,13 +37,13 @@ public class RealMapServiceImpl implements RealMapService { | @@ -36,13 +37,13 @@ public class RealMapServiceImpl implements RealMapService { | ||
| 36 | //拼接in语句 | 37 | //拼接in语句 |
| 37 | String inStr = ""; | 38 | String inStr = ""; |
| 38 | for (String code : idArray) { | 39 | for (String code : idArray) { |
| 39 | - inStr += (",'" + code+"'"); | 40 | + inStr += (",'" + code + "'"); |
| 40 | } | 41 | } |
| 41 | inStr = " (" + inStr.substring(1) + ")"; | 42 | inStr = " (" + inStr.substring(1) + ")"; |
| 42 | 43 | ||
| 43 | - String sql = "select r.LINE_CODE,r.STATION_NAME,r.STATION_CODE,r.STATION_MARK,r.DIRECTIONS,r.DISTANCES,r.TO_TIME, r.VERSIONS,s.G_LONX,s.G_LATY,s.RADIUS,s.SHAPES_TYPE,ST_AsText(s.G_POLYGON_GRID) as G_POLYGON_GRID, r.STATION_ROUTE_CODE from bsth_c_stationroute r inner join bsth_c_station s on r.station=s.id where r.line_code in "+inStr+" and r.destroy=0"; | 44 | + String sql = "select r.LINE_CODE,r.STATION_NAME,r.STATION_CODE,r.STATION_MARK,r.DIRECTIONS,r.DISTANCES,r.TO_TIME, r.VERSIONS,s.G_LONX,s.G_LATY,s.RADIUS,s.SHAPES_TYPE,ST_AsText(s.G_POLYGON_GRID) as G_POLYGON_GRID, r.STATION_ROUTE_CODE from bsth_c_stationroute r inner join bsth_c_station s on r.station=s.id where r.line_code in " + inStr + " and r.destroy=0"; |
| 44 | 45 | ||
| 45 | - List<StationSpatialData> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(StationSpatialData.class)); | 46 | + List<StationSpatialData> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(StationSpatialData.class)); |
| 46 | rs.put("status", ResponseCode.SUCCESS); | 47 | rs.put("status", ResponseCode.SUCCESS); |
| 47 | rs.put("list", list); | 48 | rs.put("list", list); |
| 48 | } catch (Exception e) { | 49 | } catch (Exception e) { |
| @@ -61,7 +62,7 @@ public class RealMapServiceImpl implements RealMapService { | @@ -61,7 +62,7 @@ public class RealMapServiceImpl implements RealMapService { | ||
| 61 | try { | 62 | try { |
| 62 | String sql = "select ID, AREA,PARK_CODE,PARK_NAME,ST_AsText(G_PARK_POINT) as G_PARK_POINT,G_CENTER_POINT,RADIUS,SHAPES_TYPE from bsth_c_car_park WHERE destroy=0 and shapes_type='d'"; | 63 | String sql = "select ID, AREA,PARK_CODE,PARK_NAME,ST_AsText(G_PARK_POINT) as G_PARK_POINT,G_CENTER_POINT,RADIUS,SHAPES_TYPE from bsth_c_car_park WHERE destroy=0 and shapes_type='d'"; |
| 63 | 64 | ||
| 64 | - List<CarPark> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(CarPark.class)); | 65 | + List<CarPark> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(CarPark.class)); |
| 65 | rs.put("status", ResponseCode.SUCCESS); | 66 | rs.put("status", ResponseCode.SUCCESS); |
| 66 | rs.put("list", list); | 67 | rs.put("list", list); |
| 67 | } catch (Exception e) { | 68 | } catch (Exception e) { |
| @@ -71,4 +72,123 @@ public class RealMapServiceImpl implements RealMapService { | @@ -71,4 +72,123 @@ public class RealMapServiceImpl implements RealMapService { | ||
| 71 | } | 72 | } |
| 72 | return rs; | 73 | return rs; |
| 73 | } | 74 | } |
| 75 | + | ||
| 76 | + @Override | ||
| 77 | + public Map<String, Object> findRouteByLine(String lineCode) { | ||
| 78 | + Map<String, Object> rs = new HashMap<>(); | ||
| 79 | + String sql = "SELECT r.ID,r.LINE_CODE,r.SECTION_CODE,r.SECTIONROUTE_CODE,r.DIRECTIONS,s.SECTION_NAME,ST_AsText(s.GSECTION_VECTOR) GSECTION_VECTOR,s.SECTION_DISTANCE,s.SECTION_TIME FROM bsth_c_sectionroute r INNER JOIN bsth_c_section s on r.section_code=s.section_code WHERE r.line_code=? and r.destroy=0 order by sectionroute_code"; | ||
| 80 | + List<SectionRouteCoords> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(SectionRouteCoords.class), lineCode); | ||
| 81 | + | ||
| 82 | + //排序 | ||
| 83 | + Collections.sort(list, new Comparator<SectionRouteCoords>() { | ||
| 84 | + @Override | ||
| 85 | + public int compare(SectionRouteCoords o1, SectionRouteCoords o2) { | ||
| 86 | + return Integer.parseInt(o1.getSectionrouteCode()) - Integer.parseInt(o2.getSectionrouteCode()); | ||
| 87 | + } | ||
| 88 | + }); | ||
| 89 | + | ||
| 90 | + List<String> upList = new ArrayList<>(), | ||
| 91 | + downList = new ArrayList<>(); | ||
| 92 | + | ||
| 93 | + String vectorStr = ""; | ||
| 94 | + for (SectionRouteCoords sr : list) { | ||
| 95 | + vectorStr = sr.getGsectionVector(); | ||
| 96 | + vectorStr = vectorStr.substring(11, vectorStr.length() - 2); | ||
| 97 | + | ||
| 98 | + if (sr.getDirections() == 0) | ||
| 99 | + upList.add(vectorStr); | ||
| 100 | + else | ||
| 101 | + downList.add(vectorStr); | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + rs.put("up", upList); | ||
| 105 | + rs.put("down", downList); | ||
| 106 | + rs.put("up_bd", multiWgsToBd(upList)); | ||
| 107 | + rs.put("down_bd", multiWgsToBd(downList)); | ||
| 108 | + rs.put("up_gcj", multiWgsToGcj(upList)); | ||
| 109 | + rs.put("down_gcj", multiWgsToGcj(downList)); | ||
| 110 | + | ||
| 111 | + rs.put("lineId", lineCode); | ||
| 112 | + return rs; | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + @Override | ||
| 116 | + public Map<String, Object> findRouteAndStationByLine(String lineCode) { | ||
| 117 | + Map<String, Object> rs = new HashMap<>(); | ||
| 118 | + try { | ||
| 119 | + //查询路段信息 | ||
| 120 | + String sql = "select r.LINE_CODE,r.SECTION_CODE,r.SECTIONROUTE_CODE,s.SECTION_NAME,ST_AsText(s.GSECTION_VECTOR) as GSECTION_VECTOR, r.DIRECTIONS from bsth_c_sectionroute r INNER JOIN bsth_c_section s on r.section=s.id where r.line_code=? and r.destroy=0"; | ||
| 121 | + List<Map<String, Object>> secList = jdbcTemplate.queryForList(sql, lineCode); | ||
| 122 | + rs.put("section", secList); | ||
| 123 | + | ||
| 124 | + //查询站点信息 | ||
| 125 | + sql="select r.STATION_NAME,r.STATION_ROUTE_CODE,r.LINE_CODE,r.STATION_CODE,r.STATION_MARK,s.G_LONX,s.G_LATY, r.DIRECTIONS from bsth_c_stationroute r INNER JOIN bsth_c_station s on r.station=s.id and r.line_code=? and r.destroy=0"; | ||
| 126 | + List<Map<String, Object>> stationList = jdbcTemplate.queryForList(sql, lineCode); | ||
| 127 | + rs.put("station", stationList); | ||
| 128 | + | ||
| 129 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 130 | + } catch (DataAccessException e) { | ||
| 131 | + logger.error("", e); | ||
| 132 | + rs.put("status", ResponseCode.ERROR); | ||
| 133 | + } | ||
| 134 | + return rs; | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + /** | ||
| 138 | + * wgs 坐标数组转 百度 | ||
| 139 | + * | ||
| 140 | + * @param list | ||
| 141 | + * @return | ||
| 142 | + */ | ||
| 143 | + private List<String> multiWgsToBd(List<String> list) { | ||
| 144 | + List<String> bdList = new ArrayList<>(); | ||
| 145 | + | ||
| 146 | + StringBuilder itemStr; | ||
| 147 | + String[] subArr, cds; | ||
| 148 | + TransGPS.Location location; | ||
| 149 | + for (String item : list) { | ||
| 150 | + subArr = item.split(","); | ||
| 151 | + | ||
| 152 | + itemStr = new StringBuilder(); | ||
| 153 | + for (String coord : subArr) { | ||
| 154 | + cds = coord.split(" "); | ||
| 155 | + //城建转经纬度 | ||
| 156 | + //Map<String, Double> map = JWDUtil.ConvertSHToJW(Double.parseDouble(cds[0]), Double.parseDouble(cds[1])); | ||
| 157 | + | ||
| 158 | + | ||
| 159 | + location = TransGPS.bd_encrypt(TransGPS.transformFromWGSToGCJ(TransGPS.LocationMake(Double.parseDouble(cds[0]), Double.parseDouble(cds[1])))); | ||
| 160 | + itemStr.append(location.getLng() + " " + location.getLat() + ","); | ||
| 161 | + } | ||
| 162 | + | ||
| 163 | + bdList.add(itemStr.substring(0, itemStr.length() - 1)); | ||
| 164 | + } | ||
| 165 | + return bdList; | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | + /** | ||
| 169 | + * wgs 坐标数组转 Gcj | ||
| 170 | + * | ||
| 171 | + * @param list | ||
| 172 | + * @return | ||
| 173 | + */ | ||
| 174 | + private List<String> multiWgsToGcj(List<String> list) { | ||
| 175 | + List<String> gcjList = new ArrayList<>(); | ||
| 176 | + | ||
| 177 | + StringBuilder itemStr; | ||
| 178 | + String[] subArr, cds; | ||
| 179 | + TransGPS.Location location; | ||
| 180 | + for (String item : list) { | ||
| 181 | + subArr = item.split(","); | ||
| 182 | + | ||
| 183 | + itemStr = new StringBuilder(); | ||
| 184 | + for (String coord : subArr) { | ||
| 185 | + cds = coord.split(" "); | ||
| 186 | + location = TransGPS.transformFromWGSToGCJ(TransGPS.LocationMake(Double.parseDouble(cds[0]), Double.parseDouble(cds[1]))); | ||
| 187 | + itemStr.append(location.getLng() + " " + location.getLat() + ","); | ||
| 188 | + } | ||
| 189 | + | ||
| 190 | + gcjList.add(itemStr.substring(0, itemStr.length() - 1)); | ||
| 191 | + } | ||
| 192 | + return gcjList; | ||
| 193 | + } | ||
| 74 | } | 194 | } |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -33,7 +33,6 @@ import com.bsth.service.SectionRouteService; | @@ -33,7 +33,6 @@ import com.bsth.service.SectionRouteService; | ||
| 33 | import com.bsth.service.impl.BaseServiceImpl; | 33 | import com.bsth.service.impl.BaseServiceImpl; |
| 34 | import com.bsth.service.realcontrol.ScheduleRealInfoService; | 34 | import com.bsth.service.realcontrol.ScheduleRealInfoService; |
| 35 | import com.bsth.util.*; | 35 | import com.bsth.util.*; |
| 36 | -import com.bsth.util.TransGPS.Location; | ||
| 37 | import com.bsth.websocket.handler.SendUtils; | 36 | import com.bsth.websocket.handler.SendUtils; |
| 38 | import com.google.common.base.Splitter; | 37 | import com.google.common.base.Splitter; |
| 39 | import com.google.common.collect.ArrayListMultimap; | 38 | import com.google.common.collect.ArrayListMultimap; |
| @@ -155,7 +154,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -155,7 +154,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 155 | } | 154 | } |
| 156 | 155 | ||
| 157 | @Override | 156 | @Override |
| 158 | - public Map<String, Object> destroy(String idsStr, /*int spaceAdjust, */String remarks/*, String reason, int spaceNum*/) { | 157 | + public Map<String, Object> destroy(String idsStr, /*int spaceAdjust, */String remarks, String reason/*, int spaceNum*/) { |
| 159 | 158 | ||
| 160 | Map<String, Object> map = new HashMap<>(); | 159 | Map<String, Object> map = new HashMap<>(); |
| 161 | List<ScheduleRealInfo> rsList = new ArrayList<>(); | 160 | List<ScheduleRealInfo> rsList = new ArrayList<>(); |
| @@ -171,7 +170,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -171,7 +170,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 171 | map.put("msg", "不必要的重复烂班!"); | 170 | map.put("msg", "不必要的重复烂班!"); |
| 172 | return map; | 171 | return map; |
| 173 | } | 172 | } |
| 174 | - | 173 | + |
| 174 | + schedule.setAdjustExps(reason); | ||
| 175 | schedule.destroy(); | 175 | schedule.destroy(); |
| 176 | schedule.addRemarks(remarks); | 176 | schedule.addRemarks(remarks); |
| 177 | 177 | ||
| @@ -991,7 +991,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -991,7 +991,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 991 | return ""; | 991 | return ""; |
| 992 | 992 | ||
| 993 | String gcjStr = ""; | 993 | String gcjStr = ""; |
| 994 | - Location location; | 994 | + TransGPS.Location location; |
| 995 | for(String crd : array){ | 995 | for(String crd : array){ |
| 996 | subArray = crd.split(" "); | 996 | subArray = crd.split(" "); |
| 997 | if(subArray.length != 2) | 997 | if(subArray.length != 2) |
| @@ -1680,7 +1680,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1680,7 +1680,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1680 | @Override | 1680 | @Override |
| 1681 | public Map<String, Object> findKMBC1(String jName, String clZbh, | 1681 | public Map<String, Object> findKMBC1(String jName, String clZbh, |
| 1682 | String date, String enddate) { | 1682 | String date, String enddate) { |
| 1683 | - List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill2(jName, clZbh, date, enddate); | 1683 | + List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill4(jName, clZbh, date, enddate); |
| 1684 | DecimalFormat format = new DecimalFormat("0.00"); | 1684 | DecimalFormat format = new DecimalFormat("0.00"); |
| 1685 | // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); | 1685 | // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); |
| 1686 | // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); | 1686 | // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); |
src/main/java/com/bsth/service/schedule/BService.java
0 → 100644
| 1 | +package com.bsth.service.schedule; | ||
| 2 | + | ||
| 3 | +import org.springframework.data.domain.Page; | ||
| 4 | +import org.springframework.data.domain.Pageable; | ||
| 5 | + | ||
| 6 | +import java.io.Serializable; | ||
| 7 | +import java.util.List; | ||
| 8 | +import java.util.Map; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 基础service接口。 | ||
| 12 | + */ | ||
| 13 | +public interface BService<T, ID extends Serializable> { | ||
| 14 | + // CRUD 操作 | ||
| 15 | + // Create,Update操作 | ||
| 16 | + T save(T t); | ||
| 17 | + <S extends T> List<S> bulkSave(List<S> entities); // 批量保存(TODO:待测试) | ||
| 18 | + // Research操作 | ||
| 19 | + T findById(ID id); | ||
| 20 | + List<T> findAll(); | ||
| 21 | + Page<T> list(Map<String, Object> param, Pageable pageable); | ||
| 22 | + List<T> list(Map<String, Object> param); | ||
| 23 | + // Delete操作 | ||
| 24 | + void delete(ID id) throws ScheduleException; | ||
| 25 | +} |
src/main/java/com/bsth/service/schedule/CarsService.java
0 → 100644
| 1 | +package com.bsth.service.schedule; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.Cars; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * Created by xu on 16/12/8. | ||
| 7 | + */ | ||
| 8 | +public interface CarsService extends BService<Cars, Integer> { | ||
| 9 | + public void validate_nbbh(Cars cars) throws ScheduleException; | ||
| 10 | + public void validate_clbh(Cars cars) throws ScheduleException; | ||
| 11 | + public void validate_cph(Cars cars) throws ScheduleException; | ||
| 12 | + public void validate_sbbh(Cars cars) throws ScheduleException; | ||
| 13 | +} |
src/main/java/com/bsth/service/schedule/GuideboardInfoService.java
| 1 | package com.bsth.service.schedule; | 1 | package com.bsth.service.schedule; |
| 2 | 2 | ||
| 3 | import com.bsth.entity.schedule.GuideboardInfo; | 3 | import com.bsth.entity.schedule.GuideboardInfo; |
| 4 | -import com.bsth.service.BaseService; | ||
| 5 | 4 | ||
| 6 | /** | 5 | /** |
| 7 | * Created by xu on 16/5/11. | 6 | * Created by xu on 16/5/11. |
| 8 | */ | 7 | */ |
| 9 | -public interface GuideboardInfoService extends BaseService<GuideboardInfo, Long> { | 8 | +public interface GuideboardInfoService extends BService<GuideboardInfo, Long> { |
| 9 | + public void validate(GuideboardInfo guideboardInfo) throws ScheduleException; | ||
| 10 | + public void toggleCancel(Long id) throws ScheduleException; | ||
| 10 | } | 11 | } |
src/main/java/com/bsth/service/schedule/GuideboardInfoServiceImpl.java deleted
100644 → 0
| 1 | -package com.bsth.service.schedule; | ||
| 2 | - | ||
| 3 | -import com.bsth.entity.schedule.GuideboardInfo; | ||
| 4 | -import com.bsth.service.impl.BaseServiceImpl; | ||
| 5 | -import org.springframework.stereotype.Service; | ||
| 6 | - | ||
| 7 | -/** | ||
| 8 | - * Created by xu on 16/5/11. | ||
| 9 | - */ | ||
| 10 | -@Service | ||
| 11 | -public class GuideboardInfoServiceImpl extends BaseServiceImpl<GuideboardInfo, Long> implements GuideboardInfoService { | ||
| 12 | -} |
src/main/java/com/bsth/service/schedule/ScheduleException.java
0 → 100644
src/main/java/com/bsth/service/schedule/impl/BServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.schedule.impl; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.search.CustomerSpecs; | ||
| 4 | +import com.bsth.repository.BaseRepository; | ||
| 5 | +import com.bsth.service.schedule.BService; | ||
| 6 | +import com.bsth.service.schedule.ScheduleException; | ||
| 7 | +import org.slf4j.Logger; | ||
| 8 | +import org.slf4j.LoggerFactory; | ||
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 10 | +import org.springframework.beans.factory.annotation.Value; | ||
| 11 | +import org.springframework.data.domain.Page; | ||
| 12 | +import org.springframework.data.domain.Pageable; | ||
| 13 | +import org.springframework.data.jpa.domain.Specification; | ||
| 14 | + | ||
| 15 | +import javax.persistence.EntityManager; | ||
| 16 | +import java.io.Serializable; | ||
| 17 | +import java.util.ArrayList; | ||
| 18 | +import java.util.List; | ||
| 19 | +import java.util.Map; | ||
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * 基础BService实现。 | ||
| 23 | + */ | ||
| 24 | +public class BServiceImpl<T, ID extends Serializable> implements BService<T, ID> { | ||
| 25 | + @Autowired | ||
| 26 | + private BaseRepository<T, ID> baseRepository; | ||
| 27 | + @Autowired | ||
| 28 | + private EntityManager entityManager; | ||
| 29 | + @Value("${hibernate.jdbc.batch_size}") | ||
| 30 | + private int batchSize; | ||
| 31 | + | ||
| 32 | + /** 日志记录器 */ | ||
| 33 | + protected Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 34 | + | ||
| 35 | + // CRUD 操作 | ||
| 36 | + // Create,Update操作 | ||
| 37 | + @Override | ||
| 38 | + public T save(T t) { | ||
| 39 | + if (logger.isDebugEnabled()) { | ||
| 40 | + logger.debug("save..."); | ||
| 41 | + } | ||
| 42 | + return baseRepository.save(t); | ||
| 43 | + } | ||
| 44 | + @Override | ||
| 45 | + public <S extends T> List<S> bulkSave(List<S> entities) { | ||
| 46 | + if (logger.isDebugEnabled()) { | ||
| 47 | + logger.debug("bulkSave..."); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + // 不使用内部批量保存,自己实现批量保存 | ||
| 51 | + final List<S> savedEntities = new ArrayList<>(entities.size()); | ||
| 52 | + int i = 0; | ||
| 53 | + for (S t : entities) { | ||
| 54 | + entityManager.persist(t); | ||
| 55 | + savedEntities.add(t); | ||
| 56 | + i++; | ||
| 57 | + if (i % batchSize == 0) { | ||
| 58 | + entityManager.flush(); | ||
| 59 | + entityManager.clear(); | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | + return savedEntities; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + // Research操作 | ||
| 66 | + @Override | ||
| 67 | + public T findById(ID id) { | ||
| 68 | + if (logger.isDebugEnabled()) { | ||
| 69 | + logger.debug("findById..."); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + return baseRepository.findOne(id); | ||
| 73 | + } | ||
| 74 | + @Override | ||
| 75 | + public List<T> findAll() { | ||
| 76 | + if (logger.isDebugEnabled()) { | ||
| 77 | + logger.debug("findAll..."); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + return (List<T>) baseRepository.findAll(); | ||
| 81 | + } | ||
| 82 | + @Override | ||
| 83 | + public Page<T> list(Map<String, Object> param, Pageable pageable) { | ||
| 84 | + if (logger.isDebugEnabled()) { | ||
| 85 | + logger.debug("list(...,pageable)..."); | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + // 自定义查询参数 | ||
| 89 | + Specification<T> specification = new CustomerSpecs<>(param); | ||
| 90 | + return baseRepository.findAll(specification, pageable); | ||
| 91 | + } | ||
| 92 | + @Override | ||
| 93 | + public List<T> list(Map<String, Object> param) { | ||
| 94 | + if (logger.isDebugEnabled()) { | ||
| 95 | + logger.debug("list..."); | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + // 自定义查询参数 | ||
| 99 | + Specification<T> specification = new CustomerSpecs<>(param); | ||
| 100 | + return baseRepository.findAll(specification); | ||
| 101 | + } | ||
| 102 | + // Delete操作 | ||
| 103 | + @Override | ||
| 104 | + public void delete(ID id) throws ScheduleException { | ||
| 105 | + if (logger.isDebugEnabled()) { | ||
| 106 | + logger.debug("delete..."); | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + baseRepository.delete(id); | ||
| 110 | + } | ||
| 111 | +} |
src/main/java/com/bsth/service/schedule/impl/CarsServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.schedule.impl; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.Cars; | ||
| 4 | +import com.bsth.service.schedule.CarsService; | ||
| 5 | +import com.bsth.service.schedule.ScheduleException; | ||
| 6 | +import org.springframework.stereotype.Service; | ||
| 7 | +import org.springframework.transaction.annotation.Transactional; | ||
| 8 | +import org.springframework.util.CollectionUtils; | ||
| 9 | + | ||
| 10 | +import java.util.HashMap; | ||
| 11 | +import java.util.Map; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * Created by xu on 16/12/8. | ||
| 15 | + */ | ||
| 16 | +@Service(value = "carsServiceImpl_sc") | ||
| 17 | +public class CarsServiceImpl extends BServiceImpl<Cars, Integer> implements CarsService { | ||
| 18 | + | ||
| 19 | + @Override | ||
| 20 | + @Transactional | ||
| 21 | + public void validate_nbbh(Cars cars) throws ScheduleException { | ||
| 22 | + // 查询条件 | ||
| 23 | + Map<String, Object> param = new HashMap<>(); | ||
| 24 | + if (cars.getId() != null) { | ||
| 25 | + param.put("id_ne", cars.getId()); | ||
| 26 | + } | ||
| 27 | + param.put("insideCode_eq", cars.getInsideCode()); | ||
| 28 | + if (!CollectionUtils.isEmpty(list(param))) { | ||
| 29 | + throw new ScheduleException("车辆内部编号/自编号重复"); | ||
| 30 | + } | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + @Override | ||
| 34 | + @Transactional | ||
| 35 | + public void validate_clbh(Cars cars) throws ScheduleException { | ||
| 36 | + // 查询条件 | ||
| 37 | + Map<String, Object> param = new HashMap<>(); | ||
| 38 | + if (cars.getId() != null) { | ||
| 39 | + param.put("id_ne", cars.getId()); | ||
| 40 | + } | ||
| 41 | + param.put("carCode_eq", cars.getCarCode()); | ||
| 42 | + if (!CollectionUtils.isEmpty(list(param))) { | ||
| 43 | + throw new ScheduleException("车辆编号重复"); | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + @Override | ||
| 48 | + @Transactional | ||
| 49 | + public void validate_cph(Cars cars) throws ScheduleException { | ||
| 50 | + // 查询条件 | ||
| 51 | + Map<String, Object> param = new HashMap<>(); | ||
| 52 | + if (cars.getId() != null) { | ||
| 53 | + param.put("id_ne", cars.getId()); | ||
| 54 | + } | ||
| 55 | + param.put("carPlate_eq", cars.getCarPlate()); | ||
| 56 | + if (!CollectionUtils.isEmpty(list(param))) { | ||
| 57 | + throw new ScheduleException("车牌号重复"); | ||
| 58 | + } | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + @Override | ||
| 62 | + @Transactional | ||
| 63 | + public void validate_sbbh(Cars cars) throws ScheduleException { | ||
| 64 | + // 查询条件 | ||
| 65 | + Map<String, Object> param = new HashMap<>(); | ||
| 66 | + if (cars.getId() != null) { | ||
| 67 | + param.put("id_ne", cars.getId()); | ||
| 68 | + } | ||
| 69 | + param.put("equipmentCode_eq", cars.getEquipmentCode()); | ||
| 70 | + if (!CollectionUtils.isEmpty(list(param))) { | ||
| 71 | + throw new ScheduleException("设备编号重复"); | ||
| 72 | + } | ||
| 73 | + } | ||
| 74 | +} |
src/main/java/com/bsth/service/schedule/impl/GuideboardInfoServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.schedule.impl; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.schedule.GuideboardInfo; | ||
| 4 | +import com.bsth.entity.schedule.TTInfoDetail; | ||
| 5 | +import com.bsth.service.schedule.GuideboardInfoService; | ||
| 6 | +import com.bsth.service.schedule.ScheduleException; | ||
| 7 | +import com.bsth.service.schedule.TTInfoDetailService; | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.stereotype.Service; | ||
| 10 | +import org.springframework.util.CollectionUtils; | ||
| 11 | + | ||
| 12 | +import javax.transaction.Transactional; | ||
| 13 | +import java.util.HashMap; | ||
| 14 | +import java.util.List; | ||
| 15 | +import java.util.Map; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * 路牌信息服务。 | ||
| 19 | + */ | ||
| 20 | +@Service | ||
| 21 | +public class GuideboardInfoServiceImpl extends BServiceImpl<GuideboardInfo, Long> implements GuideboardInfoService { | ||
| 22 | + @Autowired | ||
| 23 | + private TTInfoDetailService ttInfoDetailService; | ||
| 24 | + | ||
| 25 | + // 验证方法 | ||
| 26 | + @Transactional | ||
| 27 | + public void validate(GuideboardInfo guideboardInfo) throws ScheduleException { | ||
| 28 | + // 查询条件 | ||
| 29 | + Map<String, Object> param = new HashMap<>(); | ||
| 30 | + if (guideboardInfo.getId() != null) | ||
| 31 | + param.put("id_ne", guideboardInfo.getId()); | ||
| 32 | + | ||
| 33 | + if (guideboardInfo.getXl() == null || guideboardInfo.getXl().getId() == null) { | ||
| 34 | + throw new ScheduleException("线路未选择"); | ||
| 35 | + } else { | ||
| 36 | + param.put("xl.id_eq", guideboardInfo.getXl().getId()); | ||
| 37 | + | ||
| 38 | +// param.put("isCancel_eq", false); // 作废的也算入判定区 | ||
| 39 | + if (guideboardInfo.getLpNo() != null) { | ||
| 40 | + if (guideboardInfo.getLpName() != null) { | ||
| 41 | + // 如果两个都写了,分开查询 | ||
| 42 | + param.put("lpNo_eq", guideboardInfo.getLpNo()); | ||
| 43 | + if (!CollectionUtils.isEmpty(list(param))) { | ||
| 44 | + throw new ScheduleException("路牌编号重复"); | ||
| 45 | + } | ||
| 46 | + param.remove("lpNo_eq"); | ||
| 47 | + param.put("lpName_eq", guideboardInfo.getLpName()); | ||
| 48 | + if (!CollectionUtils.isEmpty(list(param))) { | ||
| 49 | + throw new ScheduleException("路牌名称重复"); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + } else { | ||
| 53 | + param.put("lpNo_eq", guideboardInfo.getLpNo()); | ||
| 54 | + if (!CollectionUtils.isEmpty(list(param))) { | ||
| 55 | + throw new ScheduleException("路牌编号重复"); | ||
| 56 | + } | ||
| 57 | + } | ||
| 58 | + } else { | ||
| 59 | + if (guideboardInfo.getLpName() != null) { | ||
| 60 | + param.put("lpName_eq", guideboardInfo.getLpName()); | ||
| 61 | + if (!CollectionUtils.isEmpty(list(param))) { | ||
| 62 | + throw new ScheduleException("路牌名字重复"); | ||
| 63 | + } | ||
| 64 | + } else { | ||
| 65 | + // 都为空 | ||
| 66 | + throw new ScheduleException("路牌编号名字都为空"); | ||
| 67 | + } | ||
| 68 | + } | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + @Transactional | ||
| 74 | + @Override | ||
| 75 | + public void delete(Long aLong) throws ScheduleException { | ||
| 76 | + // 删除操作就是作废操作 | ||
| 77 | + toggleCancel(aLong); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + // 作废方法 | ||
| 81 | + @Transactional | ||
| 82 | + public void toggleCancel(Long id) throws ScheduleException { | ||
| 83 | + GuideboardInfo guideboardInfo = findById(id); | ||
| 84 | + Map<String, Object> param = new HashMap<>(); | ||
| 85 | + if (guideboardInfo.getIsCancel()) { | ||
| 86 | + validate(guideboardInfo); | ||
| 87 | + guideboardInfo.setIsCancel(false); | ||
| 88 | + } else { | ||
| 89 | + param.clear(); | ||
| 90 | + param.put("xl.id_eq", guideboardInfo.getXl().getId()); | ||
| 91 | + param.put("ttinfo.isCancel_eq", false); | ||
| 92 | + param.put("lp.id_eq", guideboardInfo.getId()); | ||
| 93 | + List<TTInfoDetail> ttInfoDetailList = (List<TTInfoDetail>) ttInfoDetailService.list(param); | ||
| 94 | + if (CollectionUtils.isEmpty(ttInfoDetailList)) { | ||
| 95 | + guideboardInfo.setIsCancel(true); | ||
| 96 | + } else { | ||
| 97 | + throw new ScheduleException("在时刻表" + | ||
| 98 | + ttInfoDetailList.get(0).getTtinfo().getName() + | ||
| 99 | + "已使用,无法删除!"); | ||
| 100 | + } | ||
| 101 | + } | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | +} |
src/main/resources/static/pages/control/lineallot/allot.html
| @@ -403,8 +403,9 @@ $(function(){ | @@ -403,8 +403,9 @@ $(function(){ | ||
| 403 | } | 403 | } |
| 404 | var f = arguments.callee | 404 | var f = arguments.callee |
| 405 | ,item = lsData[i]; | 405 | ,item = lsData[i]; |
| 406 | - | ||
| 407 | - $.get('/realSchedule/findRouteByLine', {lineCode: item.lineCode}, function(rs){ | 406 | + |
| 407 | + //$.get('/realMap/findRouteByLine', {lineCode: item.lineCode}, function(rs){ | ||
| 408 | + $.get('/realSchedule/findRouteByLine', {lineCode: item.lineCode}, function(rs){ | ||
| 408 | if(rs && rs.lineId){ | 409 | if(rs && rs.lineId){ |
| 409 | cacheData[item.lineCode] = rs; | 410 | cacheData[item.lineCode] = rs; |
| 410 | i ++; | 411 | i ++; |
src/main/resources/static/pages/forms/statement/allline.html
| 1 | <style type="text/css"> | 1 | <style type="text/css"> |
| 2 | - .table-bordered { | ||
| 3 | - border: 1px solid; } | ||
| 4 | - .table-bordered > thead > tr > th, | ||
| 5 | - .table-bordered > thead > tr > td, | ||
| 6 | - .table-bordered > tbody > tr > th, | ||
| 7 | - .table-bordered > tbody > tr > td, | ||
| 8 | - .table-bordered > tfoot > tr > th, | ||
| 9 | - .table-bordered > tfoot > tr > td { | ||
| 10 | - border: 1px solid; } | ||
| 11 | - .table-bordered > thead > tr > th, | ||
| 12 | - .table-bordered > thead > tr > td { | ||
| 13 | - border-bottom-width: 2px; | ||
| 14 | - text-align: center;} | ||
| 15 | - | ||
| 16 | - .table > tbody + tbody { | ||
| 17 | - border-top: 1px solid; } | ||
| 18 | - .table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th{ text-align: center; } | ||
| 19 | -.table-checkable tr > th:first-child, .table-checkable tr > td:first-child { | ||
| 20 | - text-align: center; | ||
| 21 | - max-width: initial; | ||
| 22 | - min-width: 40px; | ||
| 23 | - padding-left: 0; | ||
| 24 | - padding-right: 0; | 2 | +.table-bordered { |
| 3 | + border: 1px solid; | ||
| 25 | } | 4 | } |
| 26 | 5 | ||
| 6 | +.table-bordered>thead>tr>th, .table-bordered>thead>tr>td, | ||
| 7 | + .table-bordered>tbody>tr>th, .table-bordered>tbody>tr>td, | ||
| 8 | + .table-bordered>tfoot>tr>th, .table-bordered>tfoot>tr>td { | ||
| 9 | + border: 1px solid; | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +.table-bordered>thead>tr>th, .table-bordered>thead>tr>td { | ||
| 13 | + border-bottom-width: 2px; | ||
| 14 | + text-align: center; | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | +.table>tbody+tbody { | ||
| 18 | + border-top: 1px solid; | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +.table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, | ||
| 22 | + .table>thead>tr>td, .table>thead>tr>th { | ||
| 23 | + text-align: center; | ||
| 24 | +} | ||
| 25 | + | ||
| 26 | +.table-checkable tr>th:first-child, .table-checkable tr>td:first-child { | ||
| 27 | + text-align: center; | ||
| 28 | + max-width: initial; | ||
| 29 | + min-width: 40px; | ||
| 30 | + padding-left: 0; | ||
| 31 | + padding-right: 0; | ||
| 32 | +} | ||
| 27 | </style> | 33 | </style> |
| 28 | 34 | ||
| 29 | <div class="page-head"> | 35 | <div class="page-head"> |
| @@ -37,51 +43,64 @@ | @@ -37,51 +43,64 @@ | ||
| 37 | <div class="portlet light porttlet-fit bordered"> | 43 | <div class="portlet light porttlet-fit bordered"> |
| 38 | <div class="portlet-title"> | 44 | <div class="portlet-title"> |
| 39 | <form class="form-inline" action="" method="post"> | 45 | <form class="form-inline" action="" method="post"> |
| 40 | - <div style="display: inline-block;"> | ||
| 41 | - <span class="item-label" style="width: 80px;">线路: </span> | ||
| 42 | - <select class="form-control" name="line" id="line" style="width: 120px;"></select> | ||
| 43 | - </div> | ||
| 44 | - <div style="display: inline-block;margin-left: 15px;"> | ||
| 45 | - <span class="item-label" style="width: 80px;">开始时间: </span> | ||
| 46 | - <input class="form-control" type="text" id="startDate" style="width: 120px;"/> | ||
| 47 | - </div> | ||
| 48 | - <div style="display: inline-block;margin-left: 15px;"> | ||
| 49 | - <span class="item-label" style="width: 80px;">结束时间: </span> | ||
| 50 | - <input class="form-control" type="text" id="endDate" style="width: 120px;"/> | ||
| 51 | - </div> | ||
| 52 | - <div class="form-group"> | ||
| 53 | - <input class="btn btn-default" type="button" id="query" value="筛选"/> | ||
| 54 | - <input class="btn btn-default" type="button" id="export" value="导出"/> | ||
| 55 | - </div> | 46 | + <!-- <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv_allline"> |
| 47 | + <span class="item-label" style="width: 80px;">公司: </span> | ||
| 48 | + <select class="form-control" name="company" id="gsdmAllline" style="width: 140px;"></select> | ||
| 49 | + </div> | ||
| 50 | + <div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv_allline"> | ||
| 51 | + <span class="item-label" style="width: 80px;">分公司: </span> | ||
| 52 | + <select class="form-control" name="subCompany" id="fgsdmAllline" style="width: 140px;"></select> | ||
| 53 | + </div> --> | ||
| 54 | + <div style="display: inline-block;"> | ||
| 55 | + <span class="item-label" style="width: 80px;">线路: </span> <select | ||
| 56 | + class="form-control" name="line" id="line" style="width: 120px;"></select> | ||
| 57 | + </div> | ||
| 58 | + <div style="display: inline-block; margin-left: 15px;"> | ||
| 59 | + <span class="item-label" style="width: 80px;">开始时间: </span> <input | ||
| 60 | + class="form-control" type="text" id="startDate" | ||
| 61 | + style="width: 120px;" /> | ||
| 62 | + </div> | ||
| 63 | + <div style="display: inline-block; margin-left: 15px;"> | ||
| 64 | + <span class="item-label" style="width: 80px;">结束时间: </span> <input | ||
| 65 | + class="form-control" type="text" id="endDate" | ||
| 66 | + style="width: 120px;" /> | ||
| 67 | + </div> | ||
| 68 | + <div class="form-group"> | ||
| 69 | + <input class="btn btn-default" type="button" id="query" value="筛选" /> | ||
| 70 | + <input class="btn btn-default" type="button" id="export" | ||
| 71 | + value="导出" /> | ||
| 72 | + </div> | ||
| 56 | </form> | 73 | </form> |
| 57 | </div> | 74 | </div> |
| 58 | <div class="portlet-body"> | 75 | <div class="portlet-body"> |
| 59 | - <div class="table-container" style="margin-top: 20px;overflow:auto;min-width: 1000px"> | ||
| 60 | - <table class="table table-bordered table-hover table-checkable" id="forms1"> | 76 | + <div class="table-container" |
| 77 | + style="margin-top: 20px; overflow: auto; min-width: 1000px"> | ||
| 78 | + <table class="table table-bordered table-hover table-checkable" | ||
| 79 | + id="forms1"> | ||
| 61 | <thead> | 80 | <thead> |
| 62 | <tr> | 81 | <tr> |
| 63 | <th colspan="15">营运线路名称统计表</th> | 82 | <th colspan="15">营运线路名称统计表</th> |
| 64 | </tr> | 83 | </tr> |
| 65 | <tr> | 84 | <tr> |
| 66 | - <td rowspan="2" style=" padding-top: 20px;">日期</td> | ||
| 67 | - <td rowspan="2" style=" padding-top: 20px;">公司</td> | ||
| 68 | - <td rowspan="2" style=" padding-top: 20px;">直属公司</td> | ||
| 69 | - <td rowspan="2" style=" padding-top: 20px;">线路名称</td> | 85 | + <td rowspan="2" style="padding-top: 20px;">日期</td> |
| 86 | + <td rowspan="2" style="padding-top: 20px;">公司</td> | ||
| 87 | + <td rowspan="2" style="padding-top: 20px;">直属公司</td> | ||
| 88 | + <td rowspan="2" style="padding-top: 20px;">线路名称</td> | ||
| 70 | <td colspan="2">出车数</td> | 89 | <td colspan="2">出车数</td> |
| 71 | - <td rowspan="2" >出车率</td> | ||
| 72 | - <td colspan="2" >班次数</td> | ||
| 73 | - <td rowspan="2" style=" padding-top: 20px;">班次执行率</td> | ||
| 74 | - <td rowspan="2" style=" padding-top: 20px;">说明</td> | 90 | + <td rowspan="2">出车率</td> |
| 91 | + <td colspan="2">班次数</td> | ||
| 92 | + <td rowspan="2" style="padding-top: 20px;">班次执行率</td> | ||
| 93 | + <td rowspan="2" style="padding-top: 20px;">说明</td> | ||
| 75 | </tr> | 94 | </tr> |
| 76 | <tr> | 95 | <tr> |
| 77 | <td>计划</td> | 96 | <td>计划</td> |
| 78 | <td>实际</td> | 97 | <td>实际</td> |
| 79 | - <td>计划</td> | 98 | + <td>计划</td> |
| 80 | <td>实际</td> | 99 | <td>实际</td> |
| 81 | </tr> | 100 | </tr> |
| 82 | </thead> | 101 | </thead> |
| 83 | <tbody id="tbody"> | 102 | <tbody id="tbody"> |
| 84 | - | 103 | + |
| 85 | </tbody> | 104 | </tbody> |
| 86 | <tr> | 105 | <tr> |
| 87 | <td colspan="1">分类汇总</td> | 106 | <td colspan="1">分类汇总</td> |
| @@ -104,96 +123,178 @@ | @@ -104,96 +123,178 @@ | ||
| 104 | </div> | 123 | </div> |
| 105 | 124 | ||
| 106 | <script> | 125 | <script> |
| 107 | - $(function(){ | 126 | + $(function() { |
| 108 | // 关闭左侧栏 | 127 | // 关闭左侧栏 |
| 109 | if (!$('body').hasClass('page-sidebar-closed')) | 128 | if (!$('body').hasClass('page-sidebar-closed')) |
| 110 | $('.menu-toggler.sidebar-toggler').click(); | 129 | $('.menu-toggler.sidebar-toggler').click(); |
| 111 | - | 130 | + |
| 112 | $("#startDate,#endDate").datetimepicker({ | 131 | $("#startDate,#endDate").datetimepicker({ |
| 113 | format : 'YYYY-MM-DD', | 132 | format : 'YYYY-MM-DD', |
| 114 | locale : 'zh-cn' | 133 | locale : 'zh-cn' |
| 115 | }); | 134 | }); |
| 116 | - | ||
| 117 | - $.get('/basic/lineCode2Name',function(result){ | ||
| 118 | - var data=[]; | ||
| 119 | - | ||
| 120 | - for(var code in result){ | ||
| 121 | - data.push({id: code, text: result[code]}); | 135 | + |
| 136 | + var obj = []; | ||
| 137 | + $.get('/user/companyData', function(result) { | ||
| 138 | + obj = result; | ||
| 139 | + var options = ''; | ||
| 140 | + for (var i = 0; i < obj.length; i++) { | ||
| 141 | + options += '<option value="'+obj[i].companyCode+'">' | ||
| 142 | + + obj[i].companyName + '</option>'; | ||
| 122 | } | 143 | } |
| 123 | - initPinYinSelect2('#line',data,''); | ||
| 124 | - | ||
| 125 | - }) | ||
| 126 | 144 | ||
| 127 | - var line; | ||
| 128 | - var startDate; | ||
| 129 | - var endDate; | ||
| 130 | - $("#query").on("click",function(){ | ||
| 131 | - | ||
| 132 | - line = $("#line").val(); | ||
| 133 | - startDate1=$("#startDate").val(); | ||
| 134 | - endDate1=$("#endDate").val(); | ||
| 135 | - | ||
| 136 | - if(startDate1!=''&&endDate1!=''){ | ||
| 137 | - $post('/mcy_forms/allline',{line:line,startDate:$("#startDate").val(),endDate:$("#endDate").val(),type:'query'},function(result){ | ||
| 138 | - // 把数据填充到模版中 | ||
| 139 | - var tbodyHtml = template('allline',{list:result}); | ||
| 140 | - // 把渲染好的模版html文本追加到表格中 | ||
| 141 | - $('#tbody').html(tbodyHtml); | ||
| 142 | - line = $("#line").val(); | ||
| 143 | - startDate = $("#startDate").val(); | ||
| 144 | - endDate = $("#endDate").val(); | ||
| 145 | - $("#sDate").text(startDate); | ||
| 146 | - $("#eDate").text(endDate); | ||
| 147 | - | ||
| 148 | - var total_jh = 0; | ||
| 149 | - var total_sj = 0,total_ccl = 0,total_bcjh = 0; | ||
| 150 | - var total_bcjh = 0,total_bcsj = 0,total_bczxl = 0; | ||
| 151 | - var total_gs=0; | ||
| 152 | - var total_zhgs=0; | ||
| 153 | - $.each(result, function(i, obj) { | ||
| 154 | - total_gs +=Number(obj.gsgs); | ||
| 155 | - total_zhgs +=Number(obj.fgsgs); | ||
| 156 | - total_jh = Number(obj.cchjh)+Number(total_jh); | ||
| 157 | - total_sj = Number(obj.cchsj)+Number(total_sj); | ||
| 158 | - | ||
| 159 | - total_ccl =(Number(total_sj)/Number(total_jh))*100; | ||
| 160 | - total_bcjh = Number(obj.bcjh)+Number(total_bcjh); | ||
| 161 | - total_bcsj = Number(obj.bcsj)+Number(total_bcsj); | ||
| 162 | - total_bczxl = (Number(total_bcsj)/Number(total_bcjh))*100; | ||
| 163 | - | ||
| 164 | - }); | ||
| 165 | - $("#total_gs").text(total_gs); | ||
| 166 | - $("#total_zhgs").text(total_zhgs); | ||
| 167 | - $("#total_jh").text(total_jh); | ||
| 168 | - $("#total_sj").text(total_sj); | ||
| 169 | - $("#total_ccl").text(total_ccl.toFixed(2)+'%'); | ||
| 170 | - $("#total_bcjh").text(total_bcjh); | ||
| 171 | - $("#total_bcsj").text(total_bcsj); | ||
| 172 | - $("#total_bczxl").text(total_bczxl.toFixed(2)+'%'); | ||
| 173 | - | ||
| 174 | - var temp = {}; | ||
| 175 | - var today_account = 0; | ||
| 176 | - | ||
| 177 | - temp["line"] = $("#line").text(); | ||
| 178 | - $.each(result, function(i, obj) { | ||
| 179 | - if(moment(obj.schedule_date_str).format("YYYY-MM-DD") == moment(obj.startDate).format("YYYY-MM-DD")){ | ||
| 180 | - today_account++; | ||
| 181 | - } | ||
| 182 | - obj.updateDate = moment(obj.startDate).format("YYYY-MM-DD HH:mm:ss"); | ||
| 183 | - }); | ||
| 184 | - | ||
| 185 | - }) | ||
| 186 | - | ||
| 187 | - }else{ | ||
| 188 | - alert("请选择时间范围!"); | ||
| 189 | - } | ||
| 190 | - }); | ||
| 191 | - | ||
| 192 | - $("#export").on("click",function(){ | ||
| 193 | - $post('/mcy_export/alllineExport',{line:line,startDate:startDate,endDate:endDate,type:'export'},function(result){ | ||
| 194 | - window.open("/downloadFile/download?fileName=营运线路名称统计表"+moment(startDate).format("YYYYMMDD")); | 145 | + if (obj.length == 0) { |
| 146 | + $("#gsdmDiv_allline").css('display', 'none'); | ||
| 147 | + $('#fgsdmDiv_allline').css('display', 'none'); | ||
| 148 | + } else if (obj.length == 1) { | ||
| 149 | + $("#gsdmDiv_allline").css('display', 'none'); | ||
| 150 | + if (obj[0].children.length == 1 || obj[0].children.length == 0) | ||
| 151 | + $('#fgsdmDiv_allline').css('display', 'none'); | ||
| 152 | + } | ||
| 153 | + $('#gsdmAllline').html(options); | ||
| 154 | + updateCompany(); | ||
| 195 | }); | 155 | }); |
| 196 | - }); | 156 | + |
| 157 | + $("#gsdmAllline").on("change", updateCompany); | ||
| 158 | + function updateCompany() { | ||
| 159 | + var company = $('#gsdmAllline').val(); | ||
| 160 | + var options = ''; | ||
| 161 | + for (var i = 0; i < obj.length; i++) { | ||
| 162 | + if (obj[i].companyCode == company) { | ||
| 163 | + var children = obj[i].children; | ||
| 164 | + for (var j = 0; j < children.length; j++) { | ||
| 165 | + options += '<option value="'+children[j].code+'">' | ||
| 166 | + + children[j].name + '</option>'; | ||
| 167 | + } | ||
| 168 | + } | ||
| 169 | + } | ||
| 170 | + $('#fgsdmAllline').html(options); | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + $.get('/basic/lineCode2Name', function(result) { | ||
| 174 | + var data = []; | ||
| 175 | + | ||
| 176 | + for ( var code in result) { | ||
| 177 | + data.push({ | ||
| 178 | + id : code, | ||
| 179 | + text : result[code] | ||
| 180 | + }); | ||
| 181 | + } | ||
| 182 | + initPinYinSelect2('#line', data, ''); | ||
| 183 | + | ||
| 184 | + }) | ||
| 185 | + | ||
| 186 | + var line; | ||
| 187 | + var startDate; | ||
| 188 | + var endDate; | ||
| 189 | + var gsdmAllline; | ||
| 190 | + var fgsdmAllline; | ||
| 191 | + $("#query").on("click",function() { | ||
| 192 | + line = $("#line").val(); | ||
| 193 | + startDate1 = $("#startDate").val(); | ||
| 194 | + endDate1 = $("#endDate").val(); | ||
| 195 | + gsdmAllline = $("#gsdmAllline").val(); | ||
| 196 | + fgsdmAllline = $("#fgsdmAllline").val(); | ||
| 197 | + if (startDate1 != '' && endDate1 != '') { | ||
| 198 | + $post('/mcy_forms/allline',{ | ||
| 199 | + /* gsdmAllline:gsdmAllline,fgsdmAllline:fgsdmAllline, */ | ||
| 200 | + line : line, | ||
| 201 | + startDate : $("#startDate").val(), | ||
| 202 | + endDate : $("#endDate").val(), | ||
| 203 | + type : 'query' | ||
| 204 | + }, | ||
| 205 | + function(result) { | ||
| 206 | + // 把数据填充到模版中 | ||
| 207 | + var tbodyHtml = template('allline', | ||
| 208 | + { | ||
| 209 | + list : result | ||
| 210 | + }); | ||
| 211 | + // 把渲染好的模版html文本追加到表格中 | ||
| 212 | + $('#tbody').html(tbodyHtml); | ||
| 213 | + line = $("#line").val(); | ||
| 214 | + startDate = $("#startDate").val(); | ||
| 215 | + endDate = $("#endDate").val(); | ||
| 216 | + $("#sDate").text(startDate); | ||
| 217 | + $("#eDate").text(endDate); | ||
| 218 | + | ||
| 219 | + var total_jh = 0; | ||
| 220 | + var total_sj = 0, total_ccl = 0, total_bcjh = 0; | ||
| 221 | + var total_bcjh = 0, total_bcsj = 0, total_bczxl = 0; | ||
| 222 | + var total_gs = 0; | ||
| 223 | + var total_zhgs = 0; | ||
| 224 | + $ | ||
| 225 | + .each( | ||
| 226 | + result, | ||
| 227 | + function(i, obj) { | ||
| 228 | + total_gs += Number(obj.gsgs); | ||
| 229 | + total_zhgs += Number(obj.fgsgs); | ||
| 230 | + total_jh = Number(obj.cchjh) | ||
| 231 | + + Number(total_jh); | ||
| 232 | + total_sj = Number(obj.cchsj) | ||
| 233 | + + Number(total_sj); | ||
| 234 | + | ||
| 235 | + total_ccl = (Number(total_sj) / Number(total_jh)) * 100; | ||
| 236 | + total_bcjh = Number(obj.bcjh) | ||
| 237 | + + Number(total_bcjh); | ||
| 238 | + total_bcsj = Number(obj.bcsj) | ||
| 239 | + + Number(total_bcsj); | ||
| 240 | + total_bczxl = (Number(total_bcsj) / Number(total_bcjh)) * 100; | ||
| 241 | + | ||
| 242 | + }); | ||
| 243 | + $("#total_gs").text(total_gs); | ||
| 244 | + $("#total_zhgs").text(total_zhgs); | ||
| 245 | + $("#total_jh").text(total_jh); | ||
| 246 | + $("#total_sj").text(total_sj); | ||
| 247 | + $("#total_ccl").text( | ||
| 248 | + total_ccl.toFixed(2) + '%'); | ||
| 249 | + $("#total_bcjh").text(total_bcjh); | ||
| 250 | + $("#total_bcsj").text(total_bcsj); | ||
| 251 | + $("#total_bczxl").text( | ||
| 252 | + total_bczxl.toFixed(2) | ||
| 253 | + + '%'); | ||
| 254 | + | ||
| 255 | + var temp = {}; | ||
| 256 | + var today_account = 0; | ||
| 257 | + | ||
| 258 | + temp["line"] = $("#line").text(); | ||
| 259 | + $ | ||
| 260 | + .each( | ||
| 261 | + result, | ||
| 262 | + function(i, obj) { | ||
| 263 | + if (moment( | ||
| 264 | + obj.schedule_date_str) | ||
| 265 | + .format( | ||
| 266 | + "YYYY-MM-DD") == moment( | ||
| 267 | + obj.startDate) | ||
| 268 | + .format( | ||
| 269 | + "YYYY-MM-DD")) { | ||
| 270 | + today_account++; | ||
| 271 | + } | ||
| 272 | + obj.updateDate = moment( | ||
| 273 | + obj.startDate) | ||
| 274 | + .format( | ||
| 275 | + "YYYY-MM-DD HH:mm:ss"); | ||
| 276 | + }); | ||
| 277 | + | ||
| 278 | + }) | ||
| 279 | + | ||
| 280 | + } else { | ||
| 281 | + alert("请选择时间范围!"); | ||
| 282 | + } | ||
| 283 | + }); | ||
| 284 | + | ||
| 285 | + $("#export").on( | ||
| 286 | + "click", | ||
| 287 | + function() { | ||
| 288 | + $post('/mcy_export/alllineExport', { | ||
| 289 | + line : line, | ||
| 290 | + startDate : startDate, | ||
| 291 | + endDate : endDate, | ||
| 292 | + type : 'export' | ||
| 293 | + }, function(result) { | ||
| 294 | + window.open("/downloadFile/download?fileName=营运线路名称统计表" | ||
| 295 | + + moment(startDate).format("YYYYMMDD")); | ||
| 296 | + }); | ||
| 297 | + }); | ||
| 197 | }); | 298 | }); |
| 198 | </script> | 299 | </script> |
| 199 | <script type="text/html" id="allline"> | 300 | <script type="text/html" id="allline"> |
src/main/resources/static/pages/forms/statement/changetochange.html
| 1 | <style type="text/css"> | 1 | <style type="text/css"> |
| 2 | - .table-bordered { | ||
| 3 | - border: 1px solid; } | ||
| 4 | - .table-bordered > thead > tr > th, | ||
| 5 | - .table-bordered > thead > tr > td, | ||
| 6 | - .table-bordered > tbody > tr > th, | ||
| 7 | - .table-bordered > tbody > tr > td, | ||
| 8 | - .table-bordered > tfoot > tr > th, | ||
| 9 | - .table-bordered > tfoot > tr > td { | ||
| 10 | - border: 1px solid; } | ||
| 11 | - .table-bordered > thead > tr > th, | ||
| 12 | - .table-bordered > thead > tr > td { | ||
| 13 | - border-bottom-width: 2px; | ||
| 14 | - text-align: center;} | ||
| 15 | - | ||
| 16 | - .table > tbody + tbody { | ||
| 17 | - border-top: 1px solid; } | ||
| 18 | - .table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th{ text-align: center; } | ||
| 19 | -.table-checkable tr > th:first-child, .table-checkable tr > td:first-child { | ||
| 20 | - text-align: center; | ||
| 21 | - max-width: initial; | ||
| 22 | - min-width: 40px; | ||
| 23 | - padding-left: 0; | ||
| 24 | - padding-right: 0; | 2 | +.table-bordered { |
| 3 | + border: 1px solid; | ||
| 25 | } | 4 | } |
| 26 | 5 | ||
| 6 | +.table-bordered>thead>tr>th, .table-bordered>thead>tr>td, | ||
| 7 | + .table-bordered>tbody>tr>th, .table-bordered>tbody>tr>td, | ||
| 8 | + .table-bordered>tfoot>tr>th, .table-bordered>tfoot>tr>td { | ||
| 9 | + border: 1px solid; | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +.table-bordered>thead>tr>th, .table-bordered>thead>tr>td { | ||
| 13 | + border-bottom-width: 2px; | ||
| 14 | + text-align: center; | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | +.table>tbody+tbody { | ||
| 18 | + border-top: 1px solid; | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +.table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, | ||
| 22 | + .table>thead>tr>td, .table>thead>tr>th { | ||
| 23 | + text-align: center; | ||
| 24 | +} | ||
| 25 | + | ||
| 26 | +.table-checkable tr>th:first-child, .table-checkable tr>td:first-child { | ||
| 27 | + text-align: center; | ||
| 28 | + max-width: initial; | ||
| 29 | + min-width: 40px; | ||
| 30 | + padding-left: 0; | ||
| 31 | + padding-right: 0; | ||
| 32 | +} | ||
| 27 | </style> | 33 | </style> |
| 28 | 34 | ||
| 29 | <div class="page-head"> | 35 | <div class="page-head"> |
| @@ -37,58 +43,71 @@ | @@ -37,58 +43,71 @@ | ||
| 37 | <div class="portlet light porttlet-fit bordered"> | 43 | <div class="portlet light porttlet-fit bordered"> |
| 38 | <div class="portlet-title"> | 44 | <div class="portlet-title"> |
| 39 | <form class="form-inline" action="" method="post"> | 45 | <form class="form-inline" action="" method="post"> |
| 40 | - <div style="display: inline-block;"> | 46 | + <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv_change"> |
| 47 | + <span class="item-label" style="width: 80px;">公司: </span> | ||
| 48 | + <select class="form-control" name="company" id="gsdmChange" style="width: 140px;"></select> | ||
| 49 | + </div> | ||
| 50 | + <div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv_change"> | ||
| 51 | + <span class="item-label" style="width: 80px;">分公司: </span> | ||
| 52 | + <select class="form-control" name="subCompany" id="fgsdmChange" style="width: 140px;"></select> | ||
| 53 | + </div> | ||
| 54 | + <div style="display: inline-block;"> | ||
| 41 | <span class="item-label" style="width: 80px;">线路: </span> | 55 | <span class="item-label" style="width: 80px;">线路: </span> |
| 42 | - <select class="form-control" name="line" id="line" style="width: 120px;"></select> | ||
| 43 | - </div> | ||
| 44 | - <div style="display: inline-block;margin-left: 15px;"> | ||
| 45 | - <span class="item-label" style="width: 80px;">开始时间: </span> | ||
| 46 | - <input class="form-control" type="text" id="startDate" style="width: 120px;"/> | 56 | + <select class="form-control" name="line" id="line" style="width: 180px;"></select> |
| 47 | </div> | 57 | </div> |
| 48 | - <div style="display: inline-block;margin-left: 15px;"> | ||
| 49 | - <span class="item-label" style="width: 80px;">结束时间: </span> | ||
| 50 | - <input class="form-control" type="text" id="endDate" style="width: 120px;"/> | ||
| 51 | - </div> | ||
| 52 | - <div style="display: inline-block;"> | ||
| 53 | - <span class="item-label" style="width: 120px;">类型: </span> | ||
| 54 | - <select class="form-control" id="sel"> | ||
| 55 | - <option value="">请选择</option> | ||
| 56 | - <option value="1">换人</option> | ||
| 57 | - <option value="2">换车</option> | 58 | + <div style="display: inline-block; margin-left: 15px;"> |
| 59 | + <span class="item-label" style="width: 80px;">开始时间: </span> <input | ||
| 60 | + class="form-control" type="text" id="startDate" | ||
| 61 | + style="width: 120px;" /> | ||
| 62 | + </div> | ||
| 63 | + <div style="display: inline-block; margin-left: 15px;"> | ||
| 64 | + <span class="item-label" style="width: 80px;">结束时间: </span> <input | ||
| 65 | + class="form-control" type="text" id="endDate" | ||
| 66 | + style="width: 120px;" /> | ||
| 67 | + </div> | ||
| 68 | + <div style="display: inline-block;"> | ||
| 69 | + <span class="item-label" style="width: 120px;">类型: </span> <select | ||
| 70 | + class="form-control" id="sel"> | ||
| 71 | + <option value="">请选择</option> | ||
| 72 | + <option value="1">换人</option> | ||
| 73 | + <option value="2">换车</option> | ||
| 58 | </select> | 74 | </select> |
| 59 | </div> | 75 | </div> |
| 60 | - <div class="form-group"> | ||
| 61 | - <input class="btn btn-default" type="button" id="query" value="筛选"/> | ||
| 62 | - <input class="btn btn-default" type="button" id="export" value="导出"/> | ||
| 63 | - </div> | 76 | + <div class="form-group"> |
| 77 | + <input class="btn btn-default" type="button" id="query" value="筛选" /> | ||
| 78 | + <input class="btn btn-default" type="button" id="export" | ||
| 79 | + value="导出" /> | ||
| 80 | + </div> | ||
| 64 | </form> | 81 | </form> |
| 65 | </div> | 82 | </div> |
| 66 | <div class="portlet-body"> | 83 | <div class="portlet-body"> |
| 67 | - <div class="table-container" style="margin-top: 20px;overflow:auto;min-width: 1000px"> | ||
| 68 | - <table class="table table-bordered table-hover table-checkable" id="forms"> | 84 | + <div class="table-container" |
| 85 | + style="margin-top: 20px; overflow: auto; min-width: 1000px"> | ||
| 86 | + <table class="table table-bordered table-hover table-checkable" | ||
| 87 | + id="forms"> | ||
| 69 | <thead> | 88 | <thead> |
| 70 | <tr> | 89 | <tr> |
| 71 | <th colspan="15">换人换车情况统计表</th> | 90 | <th colspan="15">换人换车情况统计表</th> |
| 72 | </tr> | 91 | </tr> |
| 73 | <tr> | 92 | <tr> |
| 74 | - <td rowspan="3" style=" padding-top: 50px;">日期</td> | ||
| 75 | - <td rowspan="3" style=" padding-top: 50px;">公司</td> | ||
| 76 | - <td rowspan="3" style=" padding-top: 50px;">分公司</td> | ||
| 77 | - <td rowspan="3" style=" padding-top: 50px;">线路</td> | ||
| 78 | - <td rowspan="3" style=" padding-top: 50px;">路牌</td> | ||
| 79 | - <td rowspan="3" style=" padding-top: 50px;">发生时间</td> | ||
| 80 | - <td rowspan="3" style=" padding-top: 50px;">修改时间</td> | 93 | + <td rowspan="3" style="padding-top: 50px;">日期</td> |
| 94 | + <td rowspan="3" style="padding-top: 50px;">公司</td> | ||
| 95 | + <td rowspan="3" style="padding-top: 50px;">分公司</td> | ||
| 96 | + <td rowspan="3" style="padding-top: 50px;">线路</td> | ||
| 97 | + <td rowspan="3" style="padding-top: 50px;">路牌</td> | ||
| 98 | + <td rowspan="3" style="padding-top: 50px;">发生时间</td> | ||
| 99 | + <td rowspan="3" style="padding-top: 50px;">修改时间</td> | ||
| 81 | <td colspan="2">配车</td> | 100 | <td colspan="2">配车</td> |
| 82 | <td colspan="4">人员</td> | 101 | <td colspan="4">人员</td> |
| 83 | - <td rowspan="3" style=" padding-top: 50px;">原因</td> | ||
| 84 | - <td rowspan="3" style=" padding-top: 50px;">修改人</td> | 102 | + <td rowspan="3" style="padding-top: 50px;">原因</td> |
| 103 | + <td rowspan="3" style="padding-top: 50px;">修改人</td> | ||
| 85 | </tr> | 104 | </tr> |
| 86 | <tr> | 105 | <tr> |
| 87 | <td>计划</td> | 106 | <td>计划</td> |
| 88 | <td>实际</td> | 107 | <td>实际</td> |
| 89 | <td colspan="2">计划</td> | 108 | <td colspan="2">计划</td> |
| 90 | <td colspan="2">实际</td> | 109 | <td colspan="2">实际</td> |
| 91 | - | 110 | + |
| 92 | </tr> | 111 | </tr> |
| 93 | <tr> | 112 | <tr> |
| 94 | <td>车号</td> | 113 | <td>车号</td> |
| @@ -100,7 +119,7 @@ | @@ -100,7 +119,7 @@ | ||
| 100 | </tr> | 119 | </tr> |
| 101 | </thead> | 120 | </thead> |
| 102 | <tbody> | 121 | <tbody> |
| 103 | - | 122 | + |
| 104 | </tbody> | 123 | </tbody> |
| 105 | </table> | 124 | </table> |
| 106 | </div> | 125 | </div> |
| @@ -110,94 +129,121 @@ | @@ -110,94 +129,121 @@ | ||
| 110 | </div> | 129 | </div> |
| 111 | 130 | ||
| 112 | <script> | 131 | <script> |
| 113 | - $(function(){ | 132 | + $(function() { |
| 114 | // 关闭左侧栏 | 133 | // 关闭左侧栏 |
| 115 | if (!$('body').hasClass('page-sidebar-closed')) | 134 | if (!$('body').hasClass('page-sidebar-closed')) |
| 116 | $('.menu-toggler.sidebar-toggler').click(); | 135 | $('.menu-toggler.sidebar-toggler').click(); |
| 117 | - | 136 | + |
| 118 | $("#startDate,#endDate").datetimepicker({ | 137 | $("#startDate,#endDate").datetimepicker({ |
| 119 | format : 'YYYY-MM-DD', | 138 | format : 'YYYY-MM-DD', |
| 120 | locale : 'zh-cn' | 139 | locale : 'zh-cn' |
| 121 | }); | 140 | }); |
| 141 | + | ||
| 122 | 142 | ||
| 123 | - $('#line').select2({ | ||
| 124 | - ajax: { | ||
| 125 | - url: '/realSchedule/findLine', | ||
| 126 | - type: 'post', | ||
| 127 | - dataType: 'json', | ||
| 128 | - delay: 150, | ||
| 129 | - data: function(params){ | ||
| 130 | - return{line: params.term}; | ||
| 131 | - }, | ||
| 132 | - processResults: function (data) { | ||
| 133 | - return { | ||
| 134 | - results: data | ||
| 135 | - }; | ||
| 136 | - }, | ||
| 137 | - cache: true | ||
| 138 | - }, | ||
| 139 | - templateResult: function(repo){ | ||
| 140 | - if (repo.loading) return repo.text; | ||
| 141 | - var h = '<span>'+repo.text+'</span>'; | ||
| 142 | - return h; | ||
| 143 | - }, | ||
| 144 | - escapeMarkup: function (markup) { return markup; }, | ||
| 145 | - minimumInputLength: 1, | ||
| 146 | - templateSelection: function(repo){ | ||
| 147 | - return repo.text; | ||
| 148 | - }, | ||
| 149 | - language: { | ||
| 150 | - noResults: function(){ | ||
| 151 | - return '<span style="color:red;font-size: 12px;">没有搜索到线路!</span>'; | ||
| 152 | - }, | ||
| 153 | - inputTooShort : function(e) { | ||
| 154 | - return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入线路搜索线路</span>'; | ||
| 155 | - }, | ||
| 156 | - searching : function() { | ||
| 157 | - return '<span style="color:gray;font-size: 12px;"> 正在搜索线路...</span>'; | ||
| 158 | - } | ||
| 159 | - } | ||
| 160 | - }); | ||
| 161 | - var line; | ||
| 162 | - var startDate; | ||
| 163 | - var endDate; | ||
| 164 | - $("#query").on("click",function(){ | ||
| 165 | - line = $("#line").val(); | ||
| 166 | - sel = $("#sel").val(); | ||
| 167 | - var startDate1=$("#startDate").val(); | ||
| 168 | - var endDate1=$("#endDate").val(); | 143 | + var obj = []; |
| 144 | + $.get('/user/companyData', function(result){ | ||
| 145 | + obj = result; | ||
| 146 | + var options = ''; | ||
| 147 | + for(var i = 0; i < obj.length; i++){ | ||
| 148 | + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | ||
| 149 | + } | ||
| 150 | + if(obj.length ==0){ | ||
| 151 | + $("#gsdmDiv_change").css('display','none'); | ||
| 152 | + $('#fgsdmDiv_change').css('display','none'); | ||
| 153 | + }else if(obj.length ==1){ | ||
| 154 | + $("#gsdmDiv_change").css('display','none'); | ||
| 155 | + if(obj[0].children.length == 1 || obj[0].children.length ==0) | ||
| 156 | + $('#fgsdmDiv_change').css('display','none'); | ||
| 157 | + } | ||
| 158 | + $('#gsdmChange').html(options); | ||
| 159 | + updateCompany(); | ||
| 160 | + }); | ||
| 161 | + | ||
| 162 | + $("#gsdmChange").on("change",updateCompany); | ||
| 163 | + function updateCompany(){ | ||
| 164 | + var company = $('#gsdmChange').val(); | ||
| 165 | + var options = ''; | ||
| 166 | + for(var i = 0; i < obj.length; i++){ | ||
| 167 | + if(obj[i].companyCode == company){ | ||
| 168 | + var children = obj[i].children; | ||
| 169 | + for(var j = 0; j < children.length; j++){ | ||
| 170 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | ||
| 171 | + } | ||
| 172 | + } | ||
| 173 | + } | ||
| 174 | + $('#fgsdmChange').html(options); | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + $.get('/basic/lineCode2Name',function(result){ | ||
| 178 | + var data=[]; | ||
| 169 | 179 | ||
| 170 | - if(startDate1!=''&&endDate1!=''){ | ||
| 171 | - $post('/mcy_forms/changetochange',{sel:sel,line:line,startDate:$("#startDate").val(),endDate:$("#endDate").val(),type:'query'},function(result){ | ||
| 172 | - startDate = $("#startDate").val(); | ||
| 173 | - endDate = $("#endDate").val(); | ||
| 174 | - $("#sDate").text(startDate); | ||
| 175 | - $("#eDate").text(endDate); | ||
| 176 | - var temp = {}; | ||
| 177 | - var today_account = 0; | ||
| 178 | - temp["line"] = $("#line").text(); | ||
| 179 | - $.each(result, function(i, obj) { | ||
| 180 | - if(moment(obj.schedule_date_str).format("YYYY-MM-DD") == moment(obj.startDate).format("YYYY-MM-DD")){ | ||
| 181 | - today_account++; | ||
| 182 | - } | ||
| 183 | - obj.updateDate = moment(obj.startDate).format("YYYY-MM-DD HH:mm:ss"); | ||
| 184 | - }); | ||
| 185 | - // 把数据填充到模版中 | ||
| 186 | - var tbodyHtml = template('changetochange',{list:result}); | ||
| 187 | - // 把渲染好的模版html文本追加到表格中 | ||
| 188 | - $('#forms tbody').html(tbodyHtml); | ||
| 189 | - }) | 180 | + for(var code in result){ |
| 181 | + data.push({id: code, text: result[code]}); | ||
| 182 | + } | ||
| 183 | + initPinYinSelect2('#line',data,''); | ||
| 184 | + | ||
| 185 | + }) | ||
| 190 | 186 | ||
| 191 | - }else{ | ||
| 192 | - alert("请选择时间范围!"); | ||
| 193 | - } | ||
| 194 | - }); | ||
| 195 | - | ||
| 196 | - $("#export").on("click",function(){ | ||
| 197 | - $post('/mcy_export/changetochangeExport',{startDate:startDate,endDate:endDate,type:'export'},function(result){ | ||
| 198 | - window.open("/downloadFile/download?fileName=换人换车情况日统计"+moment(startDate).format("YYYYMMDD")); | ||
| 199 | - }); | ||
| 200 | - }); | 187 | + var line; |
| 188 | + var startDate; | ||
| 189 | + var endDate; | ||
| 190 | + $("#query").on( | ||
| 191 | + "click", | ||
| 192 | + function() { | ||
| 193 | + line = $("#line").val(); | ||
| 194 | + sel = $("#sel").val(); | ||
| 195 | + var startDate1 = $("#startDate").val(); | ||
| 196 | + var endDate1 = $("#endDate").val(); | ||
| 197 | + | ||
| 198 | + if (startDate1 != '' && endDate1 != '') { | ||
| 199 | + $post('/mcy_forms/changetochange', { | ||
| 200 | + sel : sel, | ||
| 201 | + line : line, | ||
| 202 | + startDate : $("#startDate").val(), | ||
| 203 | + endDate : $("#endDate").val(), | ||
| 204 | + type : 'query' | ||
| 205 | + }, function(result) { | ||
| 206 | + startDate = $("#startDate").val(); | ||
| 207 | + endDate = $("#endDate").val(); | ||
| 208 | + $("#sDate").text(startDate); | ||
| 209 | + $("#eDate").text(endDate); | ||
| 210 | + var temp = {}; | ||
| 211 | + var today_account = 0; | ||
| 212 | + temp["line"] = $("#line").text(); | ||
| 213 | + $.each(result, function(i, obj) { | ||
| 214 | + if (moment(obj.schedule_date_str).format( | ||
| 215 | + "YYYY-MM-DD") == moment(obj.startDate) | ||
| 216 | + .format("YYYY-MM-DD")) { | ||
| 217 | + today_account++; | ||
| 218 | + } | ||
| 219 | + obj.updateDate = moment(obj.startDate).format( | ||
| 220 | + "YYYY-MM-DD HH:mm:ss"); | ||
| 221 | + }); | ||
| 222 | + // 把数据填充到模版中 | ||
| 223 | + var tbodyHtml = template('changetochange', { | ||
| 224 | + list : result | ||
| 225 | + }); | ||
| 226 | + // 把渲染好的模版html文本追加到表格中 | ||
| 227 | + $('#forms tbody').html(tbodyHtml); | ||
| 228 | + }) | ||
| 229 | + | ||
| 230 | + } else { | ||
| 231 | + alert("请选择时间范围!"); | ||
| 232 | + } | ||
| 233 | + }); | ||
| 234 | + | ||
| 235 | + $("#export").on( | ||
| 236 | + "click", | ||
| 237 | + function() { | ||
| 238 | + $post('/mcy_export/changetochangeExport', { | ||
| 239 | + startDate : startDate, | ||
| 240 | + endDate : endDate, | ||
| 241 | + type : 'export' | ||
| 242 | + }, function(result) { | ||
| 243 | + window.open("/downloadFile/download?fileName=换人换车情况日统计" | ||
| 244 | + + moment(startDate).format("YYYYMMDD")); | ||
| 245 | + }); | ||
| 246 | + }); | ||
| 201 | }); | 247 | }); |
| 202 | </script> | 248 | </script> |
| 203 | <script type="text/html" id="changetochange"> | 249 | <script type="text/html" id="changetochange"> |
src/main/resources/static/pages/forms/statement/executionrate.html
| @@ -37,6 +37,14 @@ | @@ -37,6 +37,14 @@ | ||
| 37 | <div class="portlet light porttlet-fit bordered"> | 37 | <div class="portlet light porttlet-fit bordered"> |
| 38 | <div class="portlet-title"> | 38 | <div class="portlet-title"> |
| 39 | <form class="form-inline" action="" method="post"> | 39 | <form class="form-inline" action="" method="post"> |
| 40 | + <!-- <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv_ececut"> | ||
| 41 | + <span class="item-label" style="width: 80px;">公司: </span> | ||
| 42 | + <select class="form-control" name="company" id="gsdmEcecut" style="width: 140px;"></select> | ||
| 43 | + </div> | ||
| 44 | + <div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv_ececut"> | ||
| 45 | + <span class="item-label" style="width: 80px;">分公司: </span> | ||
| 46 | + <select class="form-control" name="subCompany" id="fgsdmEcecut" style="width: 140px;"></select> | ||
| 47 | + </div> --> | ||
| 40 | <div style="display: inline-block;"> | 48 | <div style="display: inline-block;"> |
| 41 | <span class="item-label" style="width: 80px;">线路: </span> | 49 | <span class="item-label" style="width: 80px;">线路: </span> |
| 42 | <select class="form-control" name="line" id="line" style="width: 120px;"></select> | 50 | <select class="form-control" name="line" id="line" style="width: 120px;"></select> |
| @@ -114,6 +122,42 @@ | @@ -114,6 +122,42 @@ | ||
| 114 | locale : 'zh-cn' | 122 | locale : 'zh-cn' |
| 115 | }); | 123 | }); |
| 116 | 124 | ||
| 125 | + | ||
| 126 | + var obj = []; | ||
| 127 | + $.get('/user/companyData', function(result){ | ||
| 128 | + obj = result; | ||
| 129 | + var options = ''; | ||
| 130 | + for(var i = 0; i < obj.length; i++){ | ||
| 131 | + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + if(obj.length ==0){ | ||
| 135 | + $("#gsdmDiv_ececut").css('display','none'); | ||
| 136 | + $('#fgsdmDiv_ececut').css('display','none'); | ||
| 137 | + }else if(obj.length ==1){ | ||
| 138 | + $("#gsdmDiv_ececut").css('display','none'); | ||
| 139 | + if(obj[0].children.length == 1 || obj[0].children.length ==0) | ||
| 140 | + $('#fgsdmDiv_ececut').css('display','none'); | ||
| 141 | + } | ||
| 142 | + $('#gsdmEcecut').html(options); | ||
| 143 | + updateCompany(); | ||
| 144 | + }); | ||
| 145 | + | ||
| 146 | + $("#gsdmEcecut").on("change",updateCompany); | ||
| 147 | + function updateCompany(){ | ||
| 148 | + var company = $('#gsdmEcecut').val(); | ||
| 149 | + var options = ''; | ||
| 150 | + for(var i = 0; i < obj.length; i++){ | ||
| 151 | + if(obj[i].companyCode == company){ | ||
| 152 | + var children = obj[i].children; | ||
| 153 | + for(var j = 0; j < children.length; j++){ | ||
| 154 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | ||
| 155 | + } | ||
| 156 | + } | ||
| 157 | + } | ||
| 158 | + $('#fgsdmEcecut').html(options); | ||
| 159 | + } | ||
| 160 | + | ||
| 117 | $.get('/basic/lineCode2Name',function(result){ | 161 | $.get('/basic/lineCode2Name',function(result){ |
| 118 | var data=[]; | 162 | var data=[]; |
| 119 | 163 | ||
| @@ -127,19 +171,23 @@ | @@ -127,19 +171,23 @@ | ||
| 127 | var line; | 171 | var line; |
| 128 | var startDate; | 172 | var startDate; |
| 129 | var endDate; | 173 | var endDate; |
| 174 | + var gsdmEcecut; | ||
| 175 | + var fgsdmEcecut; | ||
| 130 | $("#query").on("click",function(){ | 176 | $("#query").on("click",function(){ |
| 131 | 177 | ||
| 132 | line = $("#line").val(); | 178 | line = $("#line").val(); |
| 133 | startDate1=$("#startDate").val(); | 179 | startDate1=$("#startDate").val(); |
| 134 | endDate1=$("#endDate").val(); | 180 | endDate1=$("#endDate").val(); |
| 135 | - | 181 | + gsdmEcecut=$("#gsdmEcecut").val(); |
| 182 | + fgsdmEcecut=$("#fgsdmEcecut").val(); | ||
| 136 | if(startDate1!=''&&endDate1!=''){ | 183 | if(startDate1!=''&&endDate1!=''){ |
| 137 | - $post('/mcy_forms/executionrate',{line:line,startDate:$("#startDate").val(),endDate:$("#endDate").val(),type:'query'},function(result){ | 184 | + $post('/mcy_forms/executionrate',{/* gsdmEcecut:gsdmEcecut,fgsdmEcecut:fgsdmEcecut, */line:line,startDate:$("#startDate").val(),endDate:$("#endDate").val(),type:'query'},function(result){ |
| 138 | // 把数据填充到模版中 | 185 | // 把数据填充到模版中 |
| 139 | var tbodyHtml = template('executionrate',{list:result}); | 186 | var tbodyHtml = template('executionrate',{list:result}); |
| 140 | // 把渲染好的模版html文本追加到表格中 | 187 | // 把渲染好的模版html文本追加到表格中 |
| 141 | $('#tbody').html(tbodyHtml); | 188 | $('#tbody').html(tbodyHtml); |
| 142 | line = $("#line").val(); | 189 | line = $("#line").val(); |
| 190 | + | ||
| 143 | startDate = $("#startDate").val(); | 191 | startDate = $("#startDate").val(); |
| 144 | endDate = $("#endDate").val(); | 192 | endDate = $("#endDate").val(); |
| 145 | $("#sDate").text(startDate); | 193 | $("#sDate").text(startDate); |
src/main/resources/static/pages/forms/statement/linepassengerflow.html
| @@ -27,6 +27,14 @@ | @@ -27,6 +27,14 @@ | ||
| 27 | <div class="portlet light porttlet-fit bordered"> | 27 | <div class="portlet light porttlet-fit bordered"> |
| 28 | <div class="portlet-title"> | 28 | <div class="portlet-title"> |
| 29 | <form class="form-inline" action=""> | 29 | <form class="form-inline" action=""> |
| 30 | + <!-- <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv_line"> | ||
| 31 | + <span class="item-label" style="width: 80px;">公司: </span> | ||
| 32 | + <select class="form-control" name="company" id="gsdmLine" style="width: 140px;"></select> | ||
| 33 | + </div> | ||
| 34 | + <div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv_line"> | ||
| 35 | + <span class="item-label" style="width: 80px;">分公司: </span> | ||
| 36 | + <select class="form-control" name="subCompany" id="fgsdmLine" style="width: 140px;"></select> | ||
| 37 | + </div> --> | ||
| 30 | <div style="display: inline-block;"> | 38 | <div style="display: inline-block;"> |
| 31 | <span class="item-label" style="width: 80px;">线路: </span> | 39 | <span class="item-label" style="width: 80px;">线路: </span> |
| 32 | <select class="form-control" name="line" id="line" style="width: 180px;"></select> | 40 | <select class="form-control" name="line" id="line" style="width: 180px;"></select> |
| @@ -74,6 +82,43 @@ | @@ -74,6 +82,43 @@ | ||
| 74 | locale : 'zh-cn' | 82 | locale : 'zh-cn' |
| 75 | }); | 83 | }); |
| 76 | 84 | ||
| 85 | + var obj = []; | ||
| 86 | + $.get('/user/companyData', function(result){ | ||
| 87 | + obj = result; | ||
| 88 | + var options = ''; | ||
| 89 | + for(var i = 0; i < obj.length; i++){ | ||
| 90 | + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + if(obj.length ==0){ | ||
| 94 | + $("#gsdmDiv_line").css('display','none'); | ||
| 95 | + $('#fgsdmDiv_line').css('display','none'); | ||
| 96 | + }else if(obj.length ==1){ | ||
| 97 | + $("#gsdmDiv_line").css('display','none'); | ||
| 98 | + if(obj[0].children.length == 1 || obj[0].children.length ==0) | ||
| 99 | + $('#fgsdmDiv_line').css('display','none'); | ||
| 100 | + } | ||
| 101 | + $('#gsdmLine').html(options); | ||
| 102 | + updateCompany(); | ||
| 103 | + }); | ||
| 104 | + | ||
| 105 | + $("#gsdmLine").on("change",updateCompany); | ||
| 106 | + function updateCompany(){ | ||
| 107 | + var company = $('#gsdmLine').val(); | ||
| 108 | + var options = ''; | ||
| 109 | + for(var i = 0; i < obj.length; i++){ | ||
| 110 | + if(obj[i].companyCode == company){ | ||
| 111 | + var children = obj[i].children; | ||
| 112 | + for(var j = 0; j < children.length; j++){ | ||
| 113 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | ||
| 114 | + } | ||
| 115 | + } | ||
| 116 | + } | ||
| 117 | + $('#fgsdmLine').html(options); | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + | ||
| 121 | + | ||
| 77 | $.get('/basic/lineCode2Name',function(result){ | 122 | $.get('/basic/lineCode2Name',function(result){ |
| 78 | var data=[]; | 123 | var data=[]; |
| 79 | 124 | ||
| @@ -85,10 +130,17 @@ | @@ -85,10 +130,17 @@ | ||
| 85 | 130 | ||
| 86 | }) | 131 | }) |
| 87 | 132 | ||
| 133 | + | ||
| 134 | + var line; | ||
| 135 | + var date; | ||
| 136 | + var gsdmLine; | ||
| 137 | + var fgsdmLine; | ||
| 88 | $("#query").on("click",function(){ | 138 | $("#query").on("click",function(){ |
| 89 | var line = $("#line").val(); | 139 | var line = $("#line").val(); |
| 90 | var date = $("#date").val(); | 140 | var date = $("#date").val(); |
| 91 | - $post('/mcy_forms/linepasswengerflow',{line:line,date:date},function(result){ | 141 | + var gsdmLine = $("#gsdmLine").val(); |
| 142 | + var fgsdmLine = $("#fgsdmLine").val(); | ||
| 143 | + $post('/mcy_forms/linepasswengerflow',{/* gsdmLine:gsdmLine,fgsdmLine:fgsdmLine, */line:line,date:date,type:'query'},function(result){ | ||
| 92 | $.each(result, function(i, obj) { | 144 | $.each(result, function(i, obj) { |
| 93 | obj.requestType = reqCodeMap[obj.requestType]; | 145 | obj.requestType = reqCodeMap[obj.requestType]; |
| 94 | }); | 146 | }); |
src/main/resources/static/pages/forms/statement/operationservice.html
| 1 | <style type="text/css"> | 1 | <style type="text/css"> |
| 2 | - .table-bordered { | ||
| 3 | - border: 1px solid; } | ||
| 4 | - .table-bordered > thead > tr > th, | ||
| 5 | - .table-bordered > thead > tr > td, | ||
| 6 | - .table-bordered > tbody > tr > th, | ||
| 7 | - .table-bordered > tbody > tr > td, | ||
| 8 | - .table-bordered > tfoot > tr > th, | ||
| 9 | - .table-bordered > tfoot > tr > td { | ||
| 10 | - border: 1px solid; } | ||
| 11 | - .table-bordered > thead > tr > th, | ||
| 12 | - .table-bordered > thead > tr > td { | ||
| 13 | - border-bottom-width: 2px; | ||
| 14 | - text-align: center; } | ||
| 15 | - | ||
| 16 | - .table > tbody + tbody { | ||
| 17 | - border-top: 1px solid; } | 2 | +.table-bordered { |
| 3 | + border: 1px solid; | ||
| 4 | +} | ||
| 5 | + | ||
| 6 | +.table-bordered>thead>tr>th, .table-bordered>thead>tr>td, | ||
| 7 | + .table-bordered>tbody>tr>th, .table-bordered>tbody>tr>td, | ||
| 8 | + .table-bordered>tfoot>tr>th, .table-bordered>tfoot>tr>td { | ||
| 9 | + border: 1px solid; | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +.table-bordered>thead>tr>th, .table-bordered>thead>tr>td { | ||
| 13 | + border-bottom-width: 2px; | ||
| 14 | + text-align: center; | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | +.table>tbody+tbody { | ||
| 18 | + border-top: 1px solid; | ||
| 19 | +} | ||
| 18 | </style> | 20 | </style> |
| 19 | 21 | ||
| 20 | <div class="page-head"> | 22 | <div class="page-head"> |
| @@ -22,54 +24,53 @@ | @@ -22,54 +24,53 @@ | ||
| 22 | <h1>运营服务阶段报表</h1> | 24 | <h1>运营服务阶段报表</h1> |
| 23 | </div> | 25 | </div> |
| 24 | </div> | 26 | </div> |
| 25 | - | ||
| 26 | -<div class="row"> | ||
| 27 | - <div class="col-md-12"> | ||
| 28 | - <div class="portlet light porttlet-fit bordered"> | ||
| 29 | - <div class="portlet-title"> | ||
| 30 | - <form class="form-inline" action=""> | ||
| 31 | - <!-- <div style="display: inline-block;"> | ||
| 32 | - <span class="item-label" style="width: 120px;">公司: </span> | ||
| 33 | - <select class="form-control"> | ||
| 34 | - <option value="normal">请选择</option> | ||
| 35 | - <option value="22">金高公司</option> | ||
| 36 | - <option value="05">杨高公司</option> | ||
| 37 | - <option value="26">南汇公司</option> | ||
| 38 | - <option value="55">上南公司</option> | ||
| 39 | - <option value="77">闵行公司</option> | ||
| 40 | - </select> | ||
| 41 | - <select class="form-control"> | ||
| 42 | - <option value="22">金高公司</option> | ||
| 43 | - <option value="05">杨高公司</option> | ||
| 44 | - <option value="26">南汇公司</option> | ||
| 45 | - <option value="55">上南公司</option> | ||
| 46 | - <option value="77">闵行公司</option> | ||
| 47 | - </select> | ||
| 48 | - </div> --> | ||
| 49 | - <div style="display: inline-block;"> | ||
| 50 | - <span class="item-label" style="width: 80px;">线路: </span> | ||
| 51 | - <select class="form-control" name="line" id="line" style="width: 136px;"></select> | ||
| 52 | - </div> | ||
| 53 | - <div style="display: inline-block;margin-left: 15px;"> | ||
| 54 | - <span class="item-label" style="width: 80px;">开始时间: </span> | ||
| 55 | - <input class="form-control" type="text" id="startDate" style="width: 120px;"/> | ||
| 56 | - </div> | ||
| 57 | - <div style="display: inline-block;margin-left: 15px;"> | ||
| 58 | - <span class="item-label" style="width: 80px;">结束时间: </span> | ||
| 59 | - <input class="form-control" type="text" id="endDate" style="width: 120px;"/> | ||
| 60 | - </div> | ||
| 61 | - <div style="display: inline-block;margin-left: 15px"> | ||
| 62 | - <span class="item-label" style="width: 150px;">统计: </span> | ||
| 63 | - </div> | ||
| 64 | - <div class="form-group"> | ||
| 65 | - <input class="btn btn-default" type="button" id="query" value="筛选"/> | ||
| 66 | - <input class="btn btn-default" type="button" id="export" value="导出"/> | ||
| 67 | - </div> | ||
| 68 | - </form> | ||
| 69 | - </div> | ||
| 70 | - <div class="portlet-body"> | ||
| 71 | - <div class="table-container" style="margin-top: 10px;overflow:auto;min-width: 906px"> | ||
| 72 | - <table class="table table-bordered table-hover table-checkable" id="forms"> | 27 | + |
| 28 | +<div class="row"> | ||
| 29 | + <div class="col-md-12"> | ||
| 30 | + <div class="portlet light porttlet-fit bordered"> | ||
| 31 | + <div class="portlet-title"> | ||
| 32 | + <form class="form-inline" action="" method="post"> | ||
| 33 | + <!--<div style="display: inline-block; margin-left: 33px;" | ||
| 34 | + id="gsdmDiv_operat"> | ||
| 35 | + <span class="item-label" style="width: 80px;">公司: </span> <select | ||
| 36 | + class="form-control" name="company" id="gsdmOperat" | ||
| 37 | + style="width: 140px;"></select> | ||
| 38 | + </div> | ||
| 39 | + <div style="display: inline-block; margin-left: 24px;" | ||
| 40 | + id="fgsdmDiv_operat"> | ||
| 41 | + <span class="item-label" style="width: 80px;">分公司: </span> <select | ||
| 42 | + class="form-control" name="subCompany" id="fgsdmOperat" | ||
| 43 | + style="width: 140px;"></select> | ||
| 44 | + </div> --> | ||
| 45 | + <div style="display: inline-block;"> | ||
| 46 | + <span class="item-label" style="width: 80px;">线路: </span> <select | ||
| 47 | + class="form-control" name="line" id="line" style="width: 180px;"></select> | ||
| 48 | + </div> | ||
| 49 | + <div style="display: inline-block; margin-left: 15px;"> | ||
| 50 | + <span class="item-label" style="width: 80px;">开始时间: </span> <input | ||
| 51 | + class="form-control" type="text" id="startDate" | ||
| 52 | + style="width: 120px;" /> | ||
| 53 | + </div> | ||
| 54 | + <div style="display: inline-block; margin-left: 15px;"> | ||
| 55 | + <span class="item-label" style="width: 80px;">结束时间: </span> <input | ||
| 56 | + class="form-control" type="text" id="endDate" | ||
| 57 | + style="width: 120px;" /> | ||
| 58 | + </div> | ||
| 59 | + <div style="display: inline-block; margin-left: 15px"> | ||
| 60 | + <span class="item-label" style="width: 150px;">统计: </span> | ||
| 61 | + </div> | ||
| 62 | + <div class="form-group"> | ||
| 63 | + <input class="btn btn-default" type="button" id="query" value="筛选" /> | ||
| 64 | + <input class="btn btn-default" type="button" id="export" | ||
| 65 | + value="导出" /> | ||
| 66 | + </div> | ||
| 67 | + </form> | ||
| 68 | + </div> | ||
| 69 | + <div class="portlet-body"> | ||
| 70 | + <div class="table-container" | ||
| 71 | + style="margin-top: 10px; overflow: auto; min-width: 906px"> | ||
| 72 | + <table class="table table-bordered table-hover table-checkable" | ||
| 73 | + id="forms"> | ||
| 73 | <thead> | 74 | <thead> |
| 74 | <tr> | 75 | <tr> |
| 75 | <th>序号</th> | 76 | <th>序号</th> |
| @@ -82,102 +83,133 @@ | @@ -82,102 +83,133 @@ | ||
| 82 | </tr> | 83 | </tr> |
| 83 | </thead> | 84 | </thead> |
| 84 | <tbody> | 85 | <tbody> |
| 85 | - | 86 | + |
| 86 | </tbody> | 87 | </tbody> |
| 87 | </table> | 88 | </table> |
| 88 | - </div> | ||
| 89 | - </div> | ||
| 90 | - </div> | ||
| 91 | - </div> | ||
| 92 | -</div> | ||
| 93 | - | ||
| 94 | -<script> | ||
| 95 | - $(function(){ | ||
| 96 | - // 关闭左侧栏 | ||
| 97 | - if (!$('body').hasClass('page-sidebar-closed')) | 89 | + </div> |
| 90 | + </div> | ||
| 91 | + </div> | ||
| 92 | + </div> | ||
| 93 | +</div> | ||
| 94 | + | ||
| 95 | +<script> | ||
| 96 | + $(function() { | ||
| 97 | + // 关闭左侧栏 | ||
| 98 | + if (!$('body').hasClass('page-sidebar-closed')) | ||
| 98 | $('.menu-toggler.sidebar-toggler').click(); | 99 | $('.menu-toggler.sidebar-toggler').click(); |
| 99 | - | ||
| 100 | - $("#startDate,#endDate").datetimepicker({ | ||
| 101 | - format : 'YYYY-MM-DD', | ||
| 102 | - locale : 'zh-cn' | 100 | + |
| 101 | + $("#startDate,#endDate").datetimepicker({ | ||
| 102 | + format : 'YYYY-MM-DD', | ||
| 103 | + locale : 'zh-cn' | ||
| 103 | }); | 104 | }); |
| 104 | - | ||
| 105 | - | ||
| 106 | - $.get('/basic/lineCode2Name',function(result){ | ||
| 107 | - var data=[]; | ||
| 108 | - | ||
| 109 | - for(var code in result){ | ||
| 110 | - data.push({id: code, text: result[code]}); | 105 | + |
| 106 | + $.get('/basic/lineCode2Name', function(result) { | ||
| 107 | + var data = []; | ||
| 108 | + | ||
| 109 | + for ( var code in result) { | ||
| 110 | + data.push({ | ||
| 111 | + id : code, | ||
| 112 | + text : result[code] | ||
| 113 | + }); | ||
| 111 | } | 114 | } |
| 112 | console.log(data); | 115 | console.log(data); |
| 113 | - initPinYinSelect2('#line',data,''); | ||
| 114 | - | 116 | + initPinYinSelect2('#line', data, ''); |
| 117 | + | ||
| 115 | }) | 118 | }) |
| 116 | - | ||
| 117 | - $('#lpName').select2({ | ||
| 118 | - ajax: { | ||
| 119 | - url: '/realSchedule/findLpName', | ||
| 120 | - type: 'post', | ||
| 121 | - dataType: 'json', | ||
| 122 | - delay: 150, | ||
| 123 | - data: function(params){ | ||
| 124 | - return{lpName: params.term}; | ||
| 125 | - }, | ||
| 126 | - processResults: function (data) { | ||
| 127 | - return { | ||
| 128 | - results: data | ||
| 129 | - }; | ||
| 130 | - }, | ||
| 131 | - cache: true | ||
| 132 | - }, | ||
| 133 | - templateResult: function(repo){ | ||
| 134 | - if (repo.loading) return repo.text; | ||
| 135 | - var h = '<span>'+repo.text+'</span>'; | ||
| 136 | - return h; | ||
| 137 | - }, | ||
| 138 | - escapeMarkup: function (markup) { return markup; }, | ||
| 139 | - minimumInputLength: 1, | ||
| 140 | - templateSelection: function(repo){ | ||
| 141 | - return repo.text; | ||
| 142 | - }, | ||
| 143 | - language: { | ||
| 144 | - noResults: function(){ | ||
| 145 | - return '<span style="color:red;font-size: 12px;">没有搜索到路牌!</span>'; | ||
| 146 | - }, | ||
| 147 | - inputTooShort : function(e) { | ||
| 148 | - return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入路牌搜索路牌</span>'; | ||
| 149 | - }, | ||
| 150 | - searching : function() { | ||
| 151 | - return '<span style="color:gray;font-size: 12px;"> 正在搜索路牌...</span>'; | ||
| 152 | - } | ||
| 153 | - } | ||
| 154 | - }); | ||
| 155 | - $("#query").on("click",function(){ | ||
| 156 | - var line = $("#line").val(); | ||
| 157 | - var startDate = $("#startDate").val(); | ||
| 158 | - var endDate = $("#endDate").val(); | ||
| 159 | - var lpName = $("#lpName").val(); | ||
| 160 | - $post("/mcy_forms/operationservice",{line:line,startDate:startDate,endDate:endDate ,lpName:lpName},function(result){ | ||
| 161 | - $("#sDate").text(startDate); | ||
| 162 | - $("#eDate").text(endDate); | ||
| 163 | - var temp = {}; | ||
| 164 | - var today_account = 0; | ||
| 165 | - temp["line"] = $("#line").text(); | ||
| 166 | - $.each(result, function(i, obj) { | ||
| 167 | - if(moment(obj.schedule_date_str).format("YYYY-MM-DD") == moment(obj.startDate).format("YYYY-MM-DD")){ | ||
| 168 | - today_account++; | ||
| 169 | - } | ||
| 170 | - obj.updateDate = moment(obj.startDate).format("YYYY-MM-DD HH:mm:ss"); | ||
| 171 | - }); | ||
| 172 | - console.log(result); | ||
| 173 | - var operationservice = template('operationservice',{list:result}); | ||
| 174 | - // 把渲染好的模版html文本追加到表格中 | ||
| 175 | - $('#forms tbody').html(operationservice); | ||
| 176 | - | ||
| 177 | - }); | ||
| 178 | - }); | ||
| 179 | - }); | ||
| 180 | -</script> | 119 | + |
| 120 | + var obj = []; | ||
| 121 | + $.get('/user/companyData', function(result) { | ||
| 122 | + obj = result; | ||
| 123 | + var options = ''; | ||
| 124 | + for (var i = 0; i < obj.length; i++) { | ||
| 125 | + options += '<option value="'+obj[i].companyCode+'">' | ||
| 126 | + + obj[i].companyName + '</option>'; | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + if (obj.length == 0) { | ||
| 130 | + $("#gsdmDiv_operat").css('display', 'none'); | ||
| 131 | + $('#fgsdmDiv_operat').css('display', 'none'); | ||
| 132 | + } else if (obj.length == 1) { | ||
| 133 | + $("#gsdmDiv_operat").css('display', 'none'); | ||
| 134 | + if (obj[0].children.length == 1 || obj[0].children.length == 0) | ||
| 135 | + $('#fgsdmDiv_operat').css('display', 'none'); | ||
| 136 | + } | ||
| 137 | + $('#gsdmOperat').html(options); | ||
| 138 | + updateCompany(); | ||
| 139 | + }); | ||
| 140 | + | ||
| 141 | + $("#gsdmOperat").on("change", updateCompany); | ||
| 142 | + function updateCompany() { | ||
| 143 | + var company = $('#gsdmOperat').val(); | ||
| 144 | + var options = ''; | ||
| 145 | + for (var i = 0; i < obj.length; i++) { | ||
| 146 | + if (obj[i].companyCode == company) { | ||
| 147 | + var children = obj[i].children; | ||
| 148 | + for (var j = 0; j < children.length; j++) { | ||
| 149 | + options += '<option value="'+children[j].code+'">' | ||
| 150 | + + children[j].name + '</option>'; | ||
| 151 | + } | ||
| 152 | + } | ||
| 153 | + } | ||
| 154 | + $('#fgsdmOperat').html(options); | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + $.get('/basic/lineCode2Name', function(result) { | ||
| 158 | + var data = []; | ||
| 159 | + | ||
| 160 | + for ( var code in result) { | ||
| 161 | + data.push({ | ||
| 162 | + id : code, | ||
| 163 | + text : result[code] | ||
| 164 | + }); | ||
| 165 | + } | ||
| 166 | + initPinYinSelect2('#line', data, ''); | ||
| 167 | + | ||
| 168 | + }) | ||
| 169 | + | ||
| 170 | + $("#query").on( | ||
| 171 | + "click", | ||
| 172 | + function() { | ||
| 173 | + var line = $("#line").val(); | ||
| 174 | + var startDate = $("#startDate").val(); | ||
| 175 | + var endDate = $("#endDate").val(); | ||
| 176 | + var lpName = $("#lpName").val(); | ||
| 177 | + /* var gsdmOperat = $("#gsdmOperat").val(); | ||
| 178 | + var fgsdmOperat = $("#fgsdmOperat").val(); */ | ||
| 179 | + $post("/mcy_forms/operationservice", { | ||
| 180 | + /* gsdmOperat : gsdmOperat, | ||
| 181 | + fgsdmOperat : fgsdmOperat, */ | ||
| 182 | + line : line, | ||
| 183 | + startDate : startDate, | ||
| 184 | + endDate : endDate, | ||
| 185 | + lpName : lpName, | ||
| 186 | + type:'query' | ||
| 187 | + }, function(result) { | ||
| 188 | + $("#sDate").text(startDate); | ||
| 189 | + $("#eDate").text(endDate); | ||
| 190 | + var temp = {}; | ||
| 191 | + var today_account = 0; | ||
| 192 | + temp["line"] = $("#line").text(); | ||
| 193 | + $.each(result, function(i, obj) { | ||
| 194 | + if (moment(obj.schedule_date_str).format( | ||
| 195 | + "YYYY-MM-DD") == moment(obj.startDate) | ||
| 196 | + .format("YYYY-MM-DD")) { | ||
| 197 | + today_account++; | ||
| 198 | + } | ||
| 199 | + obj.updateDate = moment(obj.startDate).format( | ||
| 200 | + "YYYY-MM-DD HH:mm:ss"); | ||
| 201 | + }); | ||
| 202 | + console.log(result); | ||
| 203 | + var operationservice = template('operationservice', { | ||
| 204 | + list : result | ||
| 205 | + }); | ||
| 206 | + // 把渲染好的模版html文本追加到表格中 | ||
| 207 | + $('#forms tbody').html(operationservice); | ||
| 208 | + | ||
| 209 | + }); | ||
| 210 | + }); | ||
| 211 | + }); | ||
| 212 | +</script> | ||
| 181 | <script type="text/html" id="operationservice"> | 213 | <script type="text/html" id="operationservice"> |
| 182 | {{each list as obj i}} | 214 | {{each list as obj i}} |
| 183 | <tr> | 215 | <tr> |
| @@ -192,7 +224,7 @@ | @@ -192,7 +224,7 @@ | ||
| 192 | {{/each}} | 224 | {{/each}} |
| 193 | {{if list.length == 0}} | 225 | {{if list.length == 0}} |
| 194 | <tr> | 226 | <tr> |
| 195 | - <td colspan="6"><h6 class="muted">没有找到相关数据</h6></td> | 227 | + <td colspan="7"><h6 class="muted">没有找到相关数据</h6></td> |
| 196 | </tr> | 228 | </tr> |
| 197 | {{/if}} | 229 | {{/if}} |
| 198 | </script> | 230 | </script> |
src/main/resources/static/pages/forms/statement/shifday.html
| @@ -28,6 +28,14 @@ | @@ -28,6 +28,14 @@ | ||
| 28 | <div class="portlet light porttlet-fit bordered"> | 28 | <div class="portlet light porttlet-fit bordered"> |
| 29 | <div class="portlet-title"> | 29 | <div class="portlet-title"> |
| 30 | <form class="form-inline" action="" method="post"> | 30 | <form class="form-inline" action="" method="post"> |
| 31 | + <!-- <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv_shif"> | ||
| 32 | + <span class="item-label" style="width: 80px;">公司: </span> | ||
| 33 | + <select class="form-control" name="company" id="gsdmShif" style="width: 140px;"></select> | ||
| 34 | + </div> | ||
| 35 | + <div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv_shif"> | ||
| 36 | + <span class="item-label" style="width: 80px;">分公司: </span> | ||
| 37 | + <select class="form-control" name="subCompany" id="fgsdmShif" style="width: 140px;"></select> | ||
| 38 | + </div> --> | ||
| 31 | <div style="display: inline-block;"> | 39 | <div style="display: inline-block;"> |
| 32 | <span class="item-label" style="width: 80px;">线路: </span> | 40 | <span class="item-label" style="width: 80px;">线路: </span> |
| 33 | <select class="form-control" name="line" id="line" style="width: 180px;"></select> | 41 | <select class="form-control" name="line" id="line" style="width: 180px;"></select> |
| @@ -97,6 +105,41 @@ $(function(){ | @@ -97,6 +105,41 @@ $(function(){ | ||
| 97 | locale : 'zh-cn' | 105 | locale : 'zh-cn' |
| 98 | }); | 106 | }); |
| 99 | 107 | ||
| 108 | + var obj = []; | ||
| 109 | + $.get('/user/companyData', function(result){ | ||
| 110 | + obj = result; | ||
| 111 | + var options = ''; | ||
| 112 | + for(var i = 0; i < obj.length; i++){ | ||
| 113 | + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + if(obj.length ==0){ | ||
| 117 | + $("#gsdmDiv_shif").css('display','none'); | ||
| 118 | + $('#fgsdmDiv_shif').css('display','none'); | ||
| 119 | + }else if(obj.length ==1){ | ||
| 120 | + $("#gsdmDiv_shif").css('display','none'); | ||
| 121 | + if(obj[0].children.length == 1 || obj[0].children.length ==0) | ||
| 122 | + $('#fgsdmDiv_shif').css('display','none'); | ||
| 123 | + } | ||
| 124 | + $('#gsdmShif').html(options); | ||
| 125 | + updateCompany(); | ||
| 126 | + }); | ||
| 127 | + | ||
| 128 | + $("#gsdmShif").on("change",updateCompany); | ||
| 129 | + function updateCompany(){ | ||
| 130 | + var company = $('#gsdmShif').val(); | ||
| 131 | + var options = ''; | ||
| 132 | + for(var i = 0; i < obj.length; i++){ | ||
| 133 | + if(obj[i].companyCode == company){ | ||
| 134 | + var children = obj[i].children; | ||
| 135 | + for(var j = 0; j < children.length; j++){ | ||
| 136 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | ||
| 137 | + } | ||
| 138 | + } | ||
| 139 | + } | ||
| 140 | + $('#fgsdmShif').html(options); | ||
| 141 | + } | ||
| 142 | + | ||
| 100 | 143 | ||
| 101 | $.get('/basic/lineCode2Name',function(result){ | 144 | $.get('/basic/lineCode2Name',function(result){ |
| 102 | var data=[]; | 145 | var data=[]; |
| @@ -112,7 +155,9 @@ $(function(){ | @@ -112,7 +155,9 @@ $(function(){ | ||
| 112 | $("#query").on("click",function(){ | 155 | $("#query").on("click",function(){ |
| 113 | var line = $("#line").val(); | 156 | var line = $("#line").val(); |
| 114 | var date = $("#date").val(); | 157 | var date = $("#date").val(); |
| 115 | - $post('/mcy_forms/shifday',{line:line,date:date},function(result){ | 158 | + /* var gsdmShif = $("#gsdmShif").val(); |
| 159 | + var fgsdmShif = $("#fgsdmShif").val(); */ | ||
| 160 | + $post('/mcy_forms/shifday',{/* gsdmShif:gsdmShif,fgsdmShif:fgsdmShif, */line:line,date:date},function(result){ | ||
| 116 | $.each(result, function(i, obj) { | 161 | $.each(result, function(i, obj) { |
| 117 | obj.requestType = reqCodeMap[obj.requestType]; | 162 | obj.requestType = reqCodeMap[obj.requestType]; |
| 118 | }); | 163 | }); |
src/main/resources/static/pages/forms/statement/shiftuehiclemanth.html
| @@ -27,7 +27,15 @@ | @@ -27,7 +27,15 @@ | ||
| 27 | <div class="col-md-12"> | 27 | <div class="col-md-12"> |
| 28 | <div class="portlet light porttlet-fit bordered"> | 28 | <div class="portlet light porttlet-fit bordered"> |
| 29 | <div class="portlet-title"> | 29 | <div class="portlet-title"> |
| 30 | - <form class="form-inline" action=""> | 30 | + <form class="form-inline" action=""> |
| 31 | + <!-- <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv_manth"> | ||
| 32 | + <span class="item-label" style="width: 80px;">公司: </span> | ||
| 33 | + <select class="form-control" name="company" id="gsdmManth" style="width: 140px;"></select> | ||
| 34 | + </div> | ||
| 35 | + <div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv_manth"> | ||
| 36 | + <span class="item-label" style="width: 80px;">分公司: </span> | ||
| 37 | + <select class="form-control" name="subCompany" id="fgsdmManth" style="width: 140px;"></select> | ||
| 38 | + </div> --> | ||
| 31 | <div style="display: inline-block;"> | 39 | <div style="display: inline-block;"> |
| 32 | <span class="item-label" style="width: 80px;">线路: </span> | 40 | <span class="item-label" style="width: 80px;">线路: </span> |
| 33 | <select class="form-control" name="line" id="line" style="width: 136px;"></select> | 41 | <select class="form-control" name="line" id="line" style="width: 136px;"></select> |
| @@ -87,6 +95,41 @@ | @@ -87,6 +95,41 @@ | ||
| 87 | locale : 'zh-cn' | 95 | locale : 'zh-cn' |
| 88 | }); | 96 | }); |
| 89 | 97 | ||
| 98 | + var obj = []; | ||
| 99 | + $.get('/user/companyData', function(result){ | ||
| 100 | + obj = result; | ||
| 101 | + var options = ''; | ||
| 102 | + for(var i = 0; i < obj.length; i++){ | ||
| 103 | + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + if(obj.length ==0){ | ||
| 107 | + $("#gsdmDiv_manth").css('display','none'); | ||
| 108 | + $('#fgsdmDiv_manth').css('display','none'); | ||
| 109 | + }else if(obj.length ==1){ | ||
| 110 | + $("#gsdmDiv_manth").css('display','none'); | ||
| 111 | + if(obj[0].children.length == 1 || obj[0].children.length ==0) | ||
| 112 | + $('#fgsdmDiv_manth').css('display','none'); | ||
| 113 | + } | ||
| 114 | + $('#gsdmManth').html(options); | ||
| 115 | + updateCompany(); | ||
| 116 | + }); | ||
| 117 | + | ||
| 118 | + $("#gsdmManth").on("change",updateCompany); | ||
| 119 | + function updateCompany(){ | ||
| 120 | + var company = $('#gsdmManth').val(); | ||
| 121 | + var options = ''; | ||
| 122 | + for(var i = 0; i < obj.length; i++){ | ||
| 123 | + if(obj[i].companyCode == company){ | ||
| 124 | + var children = obj[i].children; | ||
| 125 | + for(var j = 0; j < children.length; j++){ | ||
| 126 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + } | ||
| 130 | + $('#fgsdmManth').html(options); | ||
| 131 | + } | ||
| 132 | + | ||
| 90 | 133 | ||
| 91 | $.get('/basic/lineCode2Name',function(result){ | 134 | $.get('/basic/lineCode2Name',function(result){ |
| 92 | var data=[]; | 135 | var data=[]; |
| @@ -141,7 +184,9 @@ | @@ -141,7 +184,9 @@ | ||
| 141 | var startDate = $("#startDate").val(); | 184 | var startDate = $("#startDate").val(); |
| 142 | var endDate = $("#endDate").val(); | 185 | var endDate = $("#endDate").val(); |
| 143 | var lpName = $("#lpName").val(); | 186 | var lpName = $("#lpName").val(); |
| 144 | - $post("/mcy_forms/shiftuehiclemanth",{line:line,startDate:startDate,endDate:endDate ,lpName:lpName},function(result){ | 187 | + /* var gsdmManth= $("#gsdmManth").val(); |
| 188 | + var fgsdmManth= $("#fgsdmManth").val(); */ | ||
| 189 | + $post("/mcy_forms/shiftuehiclemanth",{/* gsdmManth:gsdmManth,fgsdmManth:fgsdmManth, */line:line,startDate:startDate,endDate:endDate ,lpName:lpName},function(result){ | ||
| 145 | $("#sDate").text(startDate); | 190 | $("#sDate").text(startDate); |
| 146 | $("#eDate").text(endDate); | 191 | $("#eDate").text(endDate); |
| 147 | var temp = {}; | 192 | var temp = {}; |
| @@ -153,7 +198,7 @@ | @@ -153,7 +198,7 @@ | ||
| 153 | } | 198 | } |
| 154 | obj.updateDate = moment(obj.startDate).format("YYYY-MM-DD HH:mm:ss"); | 199 | obj.updateDate = moment(obj.startDate).format("YYYY-MM-DD HH:mm:ss"); |
| 155 | }); | 200 | }); |
| 156 | - console.log(result); | 201 | + |
| 157 | var list_shiftuehiclemanth = template('list_shiftuehiclemanth',{list:result}); | 202 | var list_shiftuehiclemanth = template('list_shiftuehiclemanth',{list:result}); |
| 158 | // 把渲染好的模版html文本追加到表格中 | 203 | // 把渲染好的模版html文本追加到表格中 |
| 159 | $('#forms tbody').html(list_shiftuehiclemanth); | 204 | $('#forms tbody').html(list_shiftuehiclemanth); |
src/main/resources/static/pages/forms/statement/singledata.html
| @@ -28,6 +28,14 @@ | @@ -28,6 +28,14 @@ | ||
| 28 | <div class="portlet light porttlet-fit bordered"> | 28 | <div class="portlet light porttlet-fit bordered"> |
| 29 | <div class="portlet-title"> | 29 | <div class="portlet-title"> |
| 30 | <form class="form-inline" action=""> | 30 | <form class="form-inline" action=""> |
| 31 | + <!-- <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv_sing"> | ||
| 32 | + <span class="item-label" style="width: 80px;">公司: </span> | ||
| 33 | + <select class="form-control" name="company" id="gsdmSing" style="width: 140px;"></select> | ||
| 34 | + </div> | ||
| 35 | + <div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv_sing"> | ||
| 36 | + <span class="item-label" style="width: 80px;">分公司: </span> | ||
| 37 | + <select class="form-control" name="subCompany" id="fgsdmSing" style="width: 140px;"></select> | ||
| 38 | + </div> --> | ||
| 31 | <div style="display: inline-block;"> | 39 | <div style="display: inline-block;"> |
| 32 | <span class="item-label" style="width: 80px;">线路: </span> | 40 | <span class="item-label" style="width: 80px;">线路: </span> |
| 33 | <select class="form-control" name="line" id="line" style="width: 136px;"></select> | 41 | <select class="form-control" name="line" id="line" style="width: 136px;"></select> |
| @@ -92,6 +100,41 @@ | @@ -92,6 +100,41 @@ | ||
| 92 | locale : 'zh-cn' | 100 | locale : 'zh-cn' |
| 93 | }); | 101 | }); |
| 94 | 102 | ||
| 103 | + var obj = []; | ||
| 104 | + $.get('/user/companyData', function(result){ | ||
| 105 | + obj = result; | ||
| 106 | + var options = ''; | ||
| 107 | + for(var i = 0; i < obj.length; i++){ | ||
| 108 | + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + if(obj.length ==0){ | ||
| 112 | + $("#gsdmDiv_sing").css('display','none'); | ||
| 113 | + $('#fgsdmDiv_sing').css('display','none'); | ||
| 114 | + }else if(obj.length ==1){ | ||
| 115 | + $("#gsdmDiv_sing").css('display','none'); | ||
| 116 | + if(obj[0].children.length == 1 || obj[0].children.length ==0) | ||
| 117 | + $('#fgsdmDiv_sing').css('display','none'); | ||
| 118 | + } | ||
| 119 | + $('#gsdmSing').html(options); | ||
| 120 | + updateCompany(); | ||
| 121 | + }); | ||
| 122 | + | ||
| 123 | + $("#gsdmSing").on("change",updateCompany); | ||
| 124 | + function updateCompany(){ | ||
| 125 | + var company = $('#gsdmSing').val(); | ||
| 126 | + var options = ''; | ||
| 127 | + for(var i = 0; i < obj.length; i++){ | ||
| 128 | + if(obj[i].companyCode == company){ | ||
| 129 | + var children = obj[i].children; | ||
| 130 | + for(var j = 0; j < children.length; j++){ | ||
| 131 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | ||
| 132 | + } | ||
| 133 | + } | ||
| 134 | + } | ||
| 135 | + $('#fgsdmSing').html(options); | ||
| 136 | + } | ||
| 137 | + | ||
| 95 | 138 | ||
| 96 | $.get('/basic/lineCode2Name',function(result){ | 139 | $.get('/basic/lineCode2Name',function(result){ |
| 97 | var data=[]; | 140 | var data=[]; |
| @@ -104,50 +147,15 @@ | @@ -104,50 +147,15 @@ | ||
| 104 | 147 | ||
| 105 | }) | 148 | }) |
| 106 | 149 | ||
| 107 | - $('#lpName').select2({ | ||
| 108 | - ajax: { | ||
| 109 | - url: '/realSchedule/findLpName', | ||
| 110 | - type: 'post', | ||
| 111 | - dataType: 'json', | ||
| 112 | - delay: 150, | ||
| 113 | - data: function(params){ | ||
| 114 | - return{lpName: params.term}; | ||
| 115 | - }, | ||
| 116 | - processResults: function (data) { | ||
| 117 | - return { | ||
| 118 | - results: data | ||
| 119 | - }; | ||
| 120 | - }, | ||
| 121 | - cache: true | ||
| 122 | - }, | ||
| 123 | - templateResult: function(repo){ | ||
| 124 | - if (repo.loading) return repo.text; | ||
| 125 | - var h = '<span>'+repo.text+'</span>'; | ||
| 126 | - return h; | ||
| 127 | - }, | ||
| 128 | - escapeMarkup: function (markup) { return markup; }, | ||
| 129 | - minimumInputLength: 1, | ||
| 130 | - templateSelection: function(repo){ | ||
| 131 | - return repo.text; | ||
| 132 | - }, | ||
| 133 | - language: { | ||
| 134 | - noResults: function(){ | ||
| 135 | - return '<span style="color:red;font-size: 12px;">没有搜索到路牌!</span>'; | ||
| 136 | - }, | ||
| 137 | - inputTooShort : function(e) { | ||
| 138 | - return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入路牌搜索路牌</span>'; | ||
| 139 | - }, | ||
| 140 | - searching : function() { | ||
| 141 | - return '<span style="color:gray;font-size: 12px;"> 正在搜索路牌...</span>'; | ||
| 142 | - } | ||
| 143 | - } | ||
| 144 | - }); | 150 | + |
| 145 | $("#query").on("click",function(){ | 151 | $("#query").on("click",function(){ |
| 146 | var line = $("#line").val(); | 152 | var line = $("#line").val(); |
| 147 | var startDate = $("#startDate").val(); | 153 | var startDate = $("#startDate").val(); |
| 148 | var endDate = $("#endDate").val(); | 154 | var endDate = $("#endDate").val(); |
| 149 | var lpName = $("#lpName").val(); | 155 | var lpName = $("#lpName").val(); |
| 150 | - $post("/mcy_forms/singledata",{line:line,startDate:startDate,endDate:endDate ,lpName:lpName},function(result){ | 156 | + /* var gsdmSing = $("#gsdmSing").val(); |
| 157 | + var fgsdmSing = $("#fgsdmSing").val(); */ | ||
| 158 | + $post("/mcy_forms/singledata",{/* gsdmSing:gsdmSing,fgsdmSing:fgsdmSing, */line:line,startDate:startDate,endDate:endDate ,lpName:lpName},function(result){ | ||
| 151 | $("#sDate").text(startDate); | 159 | $("#sDate").text(startDate); |
| 152 | $("#eDate").text(endDate); | 160 | $("#eDate").text(endDate); |
| 153 | var temp = {}; | 161 | var temp = {}; |
src/main/resources/static/pages/forms/statement/turnoutrate.html
| @@ -37,6 +37,14 @@ | @@ -37,6 +37,14 @@ | ||
| 37 | <div class="portlet light porttlet-fit bordered"> | 37 | <div class="portlet light porttlet-fit bordered"> |
| 38 | <div class="portlet-title"> | 38 | <div class="portlet-title"> |
| 39 | <form class="form-inline" action="" method="post"> | 39 | <form class="form-inline" action="" method="post"> |
| 40 | + <!-- <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv_turn"> | ||
| 41 | + <span class="item-label" style="width: 80px;">公司: </span> | ||
| 42 | + <select class="form-control" name="company" id="gsdmTurn" style="width: 140px;"></select> | ||
| 43 | + </div> | ||
| 44 | + <div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv_turn"> | ||
| 45 | + <span class="item-label" style="width: 80px;">分公司: </span> | ||
| 46 | + <select class="form-control" name="subCompany" id="fgsdmTurn" style="width: 140px;"></select> | ||
| 47 | + </div> --> | ||
| 40 | <div style="display: inline-block;"> | 48 | <div style="display: inline-block;"> |
| 41 | <span class="item-label" style="width: 80px;">线路: </span> | 49 | <span class="item-label" style="width: 80px;">线路: </span> |
| 42 | <select class="form-control" name="line" id="line" style="width: 120px;"></select> | 50 | <select class="form-control" name="line" id="line" style="width: 120px;"></select> |
| @@ -116,6 +124,42 @@ | @@ -116,6 +124,42 @@ | ||
| 116 | locale : 'zh-cn' | 124 | locale : 'zh-cn' |
| 117 | }); | 125 | }); |
| 118 | 126 | ||
| 127 | + var obj = []; | ||
| 128 | + $.get('/user/companyData', function(result){ | ||
| 129 | + obj = result; | ||
| 130 | + var options = ''; | ||
| 131 | + for(var i = 0; i < obj.length; i++){ | ||
| 132 | + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + if(obj.length ==0){ | ||
| 136 | + $("#gsdmDiv_turn").css('display','none'); | ||
| 137 | + $('#fgsdmDiv_turn').css('display','none'); | ||
| 138 | + }else if(obj.length ==1){ | ||
| 139 | + $("#gsdmDiv_turn").css('display','none'); | ||
| 140 | + if(obj[0].children.length == 1 || obj[0].children.length ==0) | ||
| 141 | + $('#fgsdmDiv_turn').css('display','none'); | ||
| 142 | + } | ||
| 143 | + $('#gsdmTurn').html(options); | ||
| 144 | + updateCompany(); | ||
| 145 | + }); | ||
| 146 | + | ||
| 147 | + $("#gsdmTurn").on("change",updateCompany); | ||
| 148 | + function updateCompany(){ | ||
| 149 | + var company = $('#gsdmTurn').val(); | ||
| 150 | + var options = ''; | ||
| 151 | + for(var i = 0; i < obj.length; i++){ | ||
| 152 | + if(obj[i].companyCode == company){ | ||
| 153 | + var children = obj[i].children; | ||
| 154 | + for(var j = 0; j < children.length; j++){ | ||
| 155 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | ||
| 156 | + } | ||
| 157 | + } | ||
| 158 | + } | ||
| 159 | + $('#fgsdmTurn').html(options); | ||
| 160 | + } | ||
| 161 | + | ||
| 162 | + | ||
| 119 | $.get('/basic/lineCode2Name',function(result){ | 163 | $.get('/basic/lineCode2Name',function(result){ |
| 120 | var data=[]; | 164 | var data=[]; |
| 121 | 165 | ||
| @@ -129,14 +173,17 @@ | @@ -129,14 +173,17 @@ | ||
| 129 | var line; | 173 | var line; |
| 130 | var startDate; | 174 | var startDate; |
| 131 | var endDate; | 175 | var endDate; |
| 176 | + var gsdmTurn; | ||
| 177 | + var fgsdmTurn; | ||
| 132 | $("#query").on("click",function(){ | 178 | $("#query").on("click",function(){ |
| 133 | 179 | ||
| 134 | line = $("#line").val(); | 180 | line = $("#line").val(); |
| 135 | startDate1=$("#startDate").val(); | 181 | startDate1=$("#startDate").val(); |
| 136 | endDate1=$("#endDate").val(); | 182 | endDate1=$("#endDate").val(); |
| 137 | - | 183 | + gsdmTurn=$("#gsdmTurn").val(); |
| 184 | + fgsdmTurn=$("#fgsdmTurn").val(); | ||
| 138 | if(startDate1!=''&&endDate1!=''){ | 185 | if(startDate1!=''&&endDate1!=''){ |
| 139 | - $post('/mcy_forms/turnoutrate',{line:line,startDate:$("#startDate").val(),endDate:$("#endDate").val(),type:'query'},function(result){ | 186 | + $post('/mcy_forms/turnoutrate',{/* gsdmTurn:gsdmTurn,fgsdmTurn:fgsdmTurn, */line:line,startDate:$("#startDate").val(),endDate:$("#endDate").val(),type:'query'},function(result){ |
| 140 | // 把数据填充到模版中 | 187 | // 把数据填充到模版中 |
| 141 | var tbodyHtml = template('turnoutrate',{list:result}); | 188 | var tbodyHtml = template('turnoutrate',{list:result}); |
| 142 | // 把渲染好的模版html文本追加到表格中 | 189 | // 把渲染好的模版html文本追加到表格中 |
src/main/resources/static/pages/forms/statement/vehicleloading.html
| @@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
| 19 | 19 | ||
| 20 | <div class="page-head"> | 20 | <div class="page-head"> |
| 21 | <div class="page-title"> | 21 | <div class="page-title"> |
| 22 | - <h1>车辆加注</h1> | 22 | + <h1>车辆加注/消耗量</h1> |
| 23 | </div> | 23 | </div> |
| 24 | </div> | 24 | </div> |
| 25 | 25 | ||
| @@ -28,6 +28,14 @@ | @@ -28,6 +28,14 @@ | ||
| 28 | <div class="portlet light porttlet-fit bordered"> | 28 | <div class="portlet light porttlet-fit bordered"> |
| 29 | <div class="portlet-title"> | 29 | <div class="portlet-title"> |
| 30 | <form class="form-inline" action="" method="post"> | 30 | <form class="form-inline" action="" method="post"> |
| 31 | + <!-- <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv_vehic"> | ||
| 32 | + <span class="item-label" style="width: 80px;">公司: </span> | ||
| 33 | + <select class="form-control" name="company" id="gsdmVehic" style="width: 140px;"></select> | ||
| 34 | + </div> | ||
| 35 | + <div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv_vehic"> | ||
| 36 | + <span class="item-label" style="width: 80px;">分公司: </span> | ||
| 37 | + <select class="form-control" name="subCompany" id="fgsdmVehic" style="width: 140px;"></select> | ||
| 38 | + </div> --> | ||
| 31 | <div style="display: inline-block;"> | 39 | <div style="display: inline-block;"> |
| 32 | <span class="item-label" style="width: 80px;">线路: </span> | 40 | <span class="item-label" style="width: 80px;">线路: </span> |
| 33 | <select class="form-control" name="line" id="line" style="width: 180px;"></select> | 41 | <select class="form-control" name="line" id="line" style="width: 180px;"></select> |
| @@ -82,7 +90,40 @@ | @@ -82,7 +90,40 @@ | ||
| 82 | locale : 'zh-cn' | 90 | locale : 'zh-cn' |
| 83 | }); | 91 | }); |
| 84 | 92 | ||
| 85 | - | 93 | + $.get('/user/companyData', function(result){ |
| 94 | + obj = result; | ||
| 95 | + var options = ''; | ||
| 96 | + for(var i = 0; i < obj.length; i++){ | ||
| 97 | + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + if(obj.length ==0){ | ||
| 101 | + $("#gsdmDiv_vehic").css('display','none'); | ||
| 102 | + $('#fgsdmDiv_vehic').css('display','none'); | ||
| 103 | + }else if(obj.length ==1){ | ||
| 104 | + $("#gsdmDiv_vehic").css('display','none'); | ||
| 105 | + if(obj[0].children.length == 1 || obj[0].children.length ==0) | ||
| 106 | + $('#fgsdmDiv_vehic').css('display','none'); | ||
| 107 | + } | ||
| 108 | + $('#gsdmVehic').html(options); | ||
| 109 | + updateCompany(); | ||
| 110 | + }); | ||
| 111 | + | ||
| 112 | + $("#gsdmVehic").on("change",updateCompany); | ||
| 113 | + function updateCompany(){ | ||
| 114 | + var company = $('#gsdmVehic').val(); | ||
| 115 | + var options = ''; | ||
| 116 | + for(var i = 0; i < obj.length; i++){ | ||
| 117 | + if(obj[i].companyCode == company){ | ||
| 118 | + var children = obj[i].children; | ||
| 119 | + for(var j = 0; j < children.length; j++){ | ||
| 120 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | ||
| 121 | + } | ||
| 122 | + } | ||
| 123 | + } | ||
| 124 | + $('#fgsdmVehic').html(options); | ||
| 125 | + } | ||
| 126 | + | ||
| 86 | $.get('/basic/lineCode2Name',function(result){ | 127 | $.get('/basic/lineCode2Name',function(result){ |
| 87 | var data=[]; | 128 | var data=[]; |
| 88 | 129 | ||
| @@ -94,50 +135,13 @@ | @@ -94,50 +135,13 @@ | ||
| 94 | 135 | ||
| 95 | }) | 136 | }) |
| 96 | 137 | ||
| 97 | - | ||
| 98 | - $('#lpName').select2({ | ||
| 99 | - ajax: { | ||
| 100 | - url: '/realSchedule/findLpName', | ||
| 101 | - type: 'post', | ||
| 102 | - dataType: 'json', | ||
| 103 | - delay: 150, | ||
| 104 | - data: function(params){ | ||
| 105 | - return{lpName: params.term}; | ||
| 106 | - }, | ||
| 107 | - processResults: function (data) { | ||
| 108 | - return { | ||
| 109 | - results: data | ||
| 110 | - }; | ||
| 111 | - }, | ||
| 112 | - cache: true | ||
| 113 | - }, | ||
| 114 | - templateResult: function(repo){ | ||
| 115 | - if (repo.loading) return repo.text; | ||
| 116 | - var h = '<span>'+repo.text+'</span>'; | ||
| 117 | - return h; | ||
| 118 | - }, | ||
| 119 | - escapeMarkup: function (markup) { return markup; }, | ||
| 120 | - minimumInputLength: 1, | ||
| 121 | - templateSelection: function(repo){ | ||
| 122 | - return repo.text; | ||
| 123 | - }, | ||
| 124 | - language: { | ||
| 125 | - noResults: function(){ | ||
| 126 | - return '<span style="color:red;font-size: 12px;">没有搜索到路牌!</span>'; | ||
| 127 | - }, | ||
| 128 | - inputTooShort : function(e) { | ||
| 129 | - return '<span style="color:gray;font-size: 12px;"><i class="fa fa-search"></i> 输入路牌搜索路牌</span>'; | ||
| 130 | - }, | ||
| 131 | - searching : function() { | ||
| 132 | - return '<span style="color:gray;font-size: 12px;"> 正在搜索路牌...</span>'; | ||
| 133 | - } | ||
| 134 | - } | ||
| 135 | - }); | 138 | + |
| 136 | $("#query").on("click",function(){ | 139 | $("#query").on("click",function(){ |
| 137 | var line = $("#line").val(); | 140 | var line = $("#line").val(); |
| 138 | var date = $("#date").val(); | 141 | var date = $("#date").val(); |
| 139 | - $(".hidden").removeClass("hidden"); | ||
| 140 | - $post("/mcy_forms/vehicleloading",{line:line,data:date},function(result){ | 142 | + /* var gsdmVehic = $("#gsdmVehic").val(); |
| 143 | + var fgsdmVehic = $("#fgsdmVehic").val(); */ | ||
| 144 | + $post('/mcy_forms/vehicleloading',{line:line,data:date},function(result){ | ||
| 141 | // 把数据填充到模版中 | 145 | // 把数据填充到模版中 |
| 142 | var tbodyHtml = template('vehicleloading',{list:result}); | 146 | var tbodyHtml = template('vehicleloading',{list:result}); |
| 143 | // 把渲染好的模版html文本追加到表格中 | 147 | // 把渲染好的模版html文本追加到表格中 |
src/main/resources/static/pages/forms/statement/waybillday.html
| @@ -28,6 +28,14 @@ | @@ -28,6 +28,14 @@ | ||
| 28 | <div class="portlet light porttlet-fit bordered"> | 28 | <div class="portlet light porttlet-fit bordered"> |
| 29 | <div class="portlet-title"> | 29 | <div class="portlet-title"> |
| 30 | <form class="form-inline" action="" method="post"> | 30 | <form class="form-inline" action="" method="post"> |
| 31 | + <!-- <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv_waybillday"> | ||
| 32 | + <span class="item-label" style="width: 80px;">公司: </span> | ||
| 33 | + <select class="form-control" name="company" id="gsdmWaybillday" style="width: 140px;"></select> | ||
| 34 | + </div> | ||
| 35 | + <div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv_waybillday"> | ||
| 36 | + <span class="item-label" style="width: 80px;">分公司: </span> | ||
| 37 | + <select class="form-control" name="subCompany" id="fgsdmWaybillday" style="width: 140px;"></select> | ||
| 38 | + </div> --> | ||
| 31 | <div style="display: inline-block;"> | 39 | <div style="display: inline-block;"> |
| 32 | <span class="item-label" style="width: 80px;">线路: </span> | 40 | <span class="item-label" style="width: 80px;">线路: </span> |
| 33 | <select class="form-control" name="line" id="line" style="width: 180px;"></select> | 41 | <select class="form-control" name="line" id="line" style="width: 180px;"></select> |
| @@ -79,6 +87,42 @@ | @@ -79,6 +87,42 @@ | ||
| 79 | locale : 'zh-cn' | 87 | locale : 'zh-cn' |
| 80 | }); | 88 | }); |
| 81 | 89 | ||
| 90 | + var obj = []; | ||
| 91 | + $.get('/user/companyData', function(result){ | ||
| 92 | + obj = result; | ||
| 93 | + var options = ''; | ||
| 94 | + for(var i = 0; i < obj.length; i++){ | ||
| 95 | + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + if(obj.length ==0){ | ||
| 99 | + $("#gsdmDiv_waybillday").css('display','none'); | ||
| 100 | + $('#fgsdmDiv_waybillday').css('display','none'); | ||
| 101 | + }else if(obj.length ==1){ | ||
| 102 | + $("#gsdmDiv_waybillday").css('display','none'); | ||
| 103 | + if(obj[0].children.length == 1 || obj[0].children.length ==0) | ||
| 104 | + $('#fgsdmDiv_waybillday').css('display','none'); | ||
| 105 | + } | ||
| 106 | + $('#gsdmWaybillday').html(options); | ||
| 107 | + updateCompany(); | ||
| 108 | + }); | ||
| 109 | + | ||
| 110 | + $("#gsdmWaybillday").on("change",updateCompany); | ||
| 111 | + function updateCompany(){ | ||
| 112 | + var company = $('#gsdmWaybillday').val(); | ||
| 113 | + var options = ''; | ||
| 114 | + for(var i = 0; i < obj.length; i++){ | ||
| 115 | + if(obj[i].companyCode == company){ | ||
| 116 | + var children = obj[i].children; | ||
| 117 | + for(var j = 0; j < children.length; j++){ | ||
| 118 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | ||
| 119 | + } | ||
| 120 | + } | ||
| 121 | + } | ||
| 122 | + $('#fgsdmWaybillday').html(options); | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + | ||
| 82 | $.get('/basic/lineCode2Name',function(result){ | 126 | $.get('/basic/lineCode2Name',function(result){ |
| 83 | var data=[]; | 127 | var data=[]; |
| 84 | 128 | ||
| @@ -91,10 +135,15 @@ | @@ -91,10 +135,15 @@ | ||
| 91 | }) | 135 | }) |
| 92 | var line; | 136 | var line; |
| 93 | var date; | 137 | var date; |
| 138 | + var gsdmWaybillday; | ||
| 139 | + var fgsdmWaybillday; | ||
| 94 | $("#query").on("click",function(){ | 140 | $("#query").on("click",function(){ |
| 95 | line = $("#line").val(); | 141 | line = $("#line").val(); |
| 96 | date = $("#date").val(); | 142 | date = $("#date").val(); |
| 97 | - $post('/mcy_forms/waybillday',{line:line,date:$("#date").val(),type:'query'},function(result){ | 143 | + gsdmWaybillday=$("#gsdmWaybillday").val(); |
| 144 | + fgsdmWaybillday = $("#fgsdmWaybillday").val(); | ||
| 145 | + | ||
| 146 | + $post('/mcy_forms/waybillday',{/* gsdmWaybillday:gsdmWaybillday,fgsdmWaybillday:fgsdmWaybillday, */line:line,date:$("#date").val(),type:'query'},function(result){ | ||
| 98 | $.each(result, function(i, obj) { | 147 | $.each(result, function(i, obj) { |
| 99 | obj.requestType = reqCodeMap[obj.requestType]; | 148 | obj.requestType = reqCodeMap[obj.requestType]; |
| 100 | }); | 149 | }); |
src/main/resources/static/pages/report/timetable/timetable.html
| @@ -245,6 +245,7 @@ | @@ -245,6 +245,7 @@ | ||
| 245 | initPinYinSelect2('#line',data,''); | 245 | initPinYinSelect2('#line',data,''); |
| 246 | 246 | ||
| 247 | }) | 247 | }) |
| 248 | + | ||
| 248 | //查询 | 249 | //查询 |
| 249 | $("#query").on('click',function(){ | 250 | $("#query").on('click',function(){ |
| 250 | console.log($("#gsdmTime").val()); | 251 | console.log($("#gsdmTime").val()); |
src/main/resources/static/pages/scheduleApp/Gruntfile.js
| @@ -14,6 +14,9 @@ module.exports = function (grunt) { | @@ -14,6 +14,9 @@ module.exports = function (grunt) { | ||
| 14 | }, | 14 | }, |
| 15 | concat_route: { // 所有模块的route配置合并的js文件 | 15 | concat_route: { // 所有模块的route配置合并的js文件 |
| 16 | src: ['module/common/prj-common-ui-route-state.js'] | 16 | src: ['module/common/prj-common-ui-route-state.js'] |
| 17 | + }, | ||
| 18 | + concat_service: { // 所有模块的servie服务合并的js文件 | ||
| 19 | + src: ['module/common/prj-common-globalservice.js'] | ||
| 17 | } | 20 | } |
| 18 | 21 | ||
| 19 | //, | 22 | //, |
| @@ -69,11 +72,13 @@ module.exports = function (grunt) { | @@ -69,11 +72,13 @@ module.exports = function (grunt) { | ||
| 69 | 'module/common/dts1/load/loadingWidget.js', // loading界面指令 | 72 | 'module/common/dts1/load/loadingWidget.js', // loading界面指令 |
| 70 | 'module/common/dts1/validation/remoteValidation.js',// 服务端验证指令 | 73 | 'module/common/dts1/validation/remoteValidation.js',// 服务端验证指令 |
| 71 | 'module/common/dts1/validation/remoteValidationt2.js',// 服务端验证指令(时刻表专用) | 74 | 'module/common/dts1/validation/remoteValidationt2.js',// 服务端验证指令(时刻表专用) |
| 75 | + 'module/common/dts1/validation/remoteValidation3.js',// 服务端验证指令 | ||
| 72 | 'module/common/dts1/select/saSelect.js', // select整合指令1 | 76 | 'module/common/dts1/select/saSelect.js', // select整合指令1 |
| 73 | 'module/common/dts1/select/saSelect2.js', // select整合指令2 | 77 | 'module/common/dts1/select/saSelect2.js', // select整合指令2 |
| 74 | 'module/common/dts1/select/saSelect3.js', // select整合指令3 | 78 | 'module/common/dts1/select/saSelect3.js', // select整合指令3 |
| 75 | 'module/common/dts1/select/saSelect4.js', // select整合指令4 | 79 | 'module/common/dts1/select/saSelect4.js', // select整合指令4 |
| 76 | 'module/common/dts1/select/saSelect5.js', // select整合指令5 | 80 | 'module/common/dts1/select/saSelect5.js', // select整合指令5 |
| 81 | + 'module/common/dts2/ttinfotable/mySelect.js', // select整合指令 | ||
| 77 | 'module/common/dts1/radioButton/saRadiogroup.js', // 单选框组整合指令 | 82 | 'module/common/dts1/radioButton/saRadiogroup.js', // 单选框组整合指令 |
| 78 | 'module/common/dts1/checkbox/saCheckboxgroup.js', // 多选框组整合指令 | 83 | 'module/common/dts1/checkbox/saCheckboxgroup.js', // 多选框组整合指令 |
| 79 | 'module/common/dts2/dateGroup/saDategroup.js', // 特殊日期选择指令 | 84 | 'module/common/dts2/dateGroup/saDategroup.js', // 特殊日期选择指令 |
| @@ -104,6 +109,26 @@ module.exports = function (grunt) { | @@ -104,6 +109,26 @@ module.exports = function (grunt) { | ||
| 104 | 'module/core/ttInfoManage/detailedit/route.js' // 时刻表明细管理模块 | 109 | 'module/core/ttInfoManage/detailedit/route.js' // 时刻表明细管理模块 |
| 105 | ], | 110 | ], |
| 106 | dest: 'module/common/prj-common-ui-route-state.js' | 111 | dest: 'module/common/prj-common-ui-route-state.js' |
| 112 | + }, | ||
| 113 | + service: { | ||
| 114 | + options: { | ||
| 115 | + banner: '//所有模块service配置\n' | ||
| 116 | + }, | ||
| 117 | + src: [ | ||
| 118 | + 'module/basicInfo/busInfoManage/service.js', // 车辆基础信息管理service | ||
| 119 | + 'module/basicInfo/deviceInfoManage/service.js', // 设备信息管理service | ||
| 120 | + 'module/basicInfo/employeeInfoManage/service.js', // 人员基础信息管理service | ||
| 121 | + 'module/core/busConfig/service.js', // 车辆配置service | ||
| 122 | + 'module/core/busLineInfoStat/service.js', // 线路运营概览service | ||
| 123 | + 'module/core/employeeConfig/service.js', // 人员配置service | ||
| 124 | + 'module/core/guideboardManage/service.js', // 路牌管理service | ||
| 125 | + 'module/core/rerunManage/service.js', // 套跑管理service | ||
| 126 | + 'module/core/schedulePlanManage/service.js', // 排班计划管理service | ||
| 127 | + 'module/core/scheduleRuleManage/service.js', // 排班规则管理service | ||
| 128 | + 'module/core/ttInfoManage/service.js', // 时刻表管理service | ||
| 129 | + 'module/common/prj-common-globalservice-legacy.js' // 其他用service | ||
| 130 | + ], | ||
| 131 | + dest: 'module/common/prj-common-globalservice.js' | ||
| 107 | } | 132 | } |
| 108 | }, | 133 | }, |
| 109 | 134 | ||
| @@ -440,4 +465,14 @@ module.exports = function (grunt) { | @@ -440,4 +465,14 @@ module.exports = function (grunt) { | ||
| 440 | 'clean:concat_route', 'concat:route' | 465 | 'clean:concat_route', 'concat:route' |
| 441 | ]); | 466 | ]); |
| 442 | 467 | ||
| 468 | + /* | ||
| 469 | + 定义了一个service的grunt任务 | ||
| 470 | + 任务组有顺序,如下说明: | ||
| 471 | + 1、clean:concat_route,清除合并生成的prj-common-globalservice.js文件 | ||
| 472 | + 2、concat:route,重新合并prj-common-globalservice.js文件 | ||
| 473 | + */ | ||
| 474 | + grunt.registerTask('service', [ | ||
| 475 | + 'clean:concat_service', 'concat:service' | ||
| 476 | + ]); | ||
| 477 | + | ||
| 443 | }; | 478 | }; |
| 444 | \ No newline at end of file | 479 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/edit.html
| @@ -33,8 +33,8 @@ | @@ -33,8 +33,8 @@ | ||
| 33 | <div class="portlet-body form"> | 33 | <div class="portlet-body form"> |
| 34 | <form ng-submit="ctrl.submit()" class="form-horizontal" novalidate name="myForm"> | 34 | <form ng-submit="ctrl.submit()" class="form-horizontal" novalidate name="myForm"> |
| 35 | <!--<div class="alert alert-danger display-hide">--> | 35 | <!--<div class="alert alert-danger display-hide">--> |
| 36 | - <!--<button class="close" data-close="alert"></button>--> | ||
| 37 | - <!--您的输入有误,请检查下面的输入项--> | 36 | + <!--<button class="close" data-close="alert"></button>--> |
| 37 | + <!--您的输入有误,请检查下面的输入项--> | ||
| 38 | <!--</div>--> | 38 | <!--</div>--> |
| 39 | 39 | ||
| 40 | 40 | ||
| @@ -45,9 +45,9 @@ | @@ -45,9 +45,9 @@ | ||
| 45 | <div class="col-md-3"> | 45 | <div class="col-md-3"> |
| 46 | <input type="text" class="form-control" | 46 | <input type="text" class="form-control" |
| 47 | name="insideCode" ng-model="ctrl.busInfoForSave.insideCode" | 47 | name="insideCode" ng-model="ctrl.busInfoForSave.insideCode" |
| 48 | - required ng-maxlength="8" | 48 | + required ng-maxlength="20" |
| 49 | remote-Validation | 49 | remote-Validation |
| 50 | - remotevtype="cl1" | 50 | + remotevtype="cars_zbh" |
| 51 | remotevparam="{{ {'insideCode_eq': ctrl.busInfoForSave.insideCode} | json}}" | 51 | remotevparam="{{ {'insideCode_eq': ctrl.busInfoForSave.insideCode} | json}}" |
| 52 | placeholder="请输入车辆内部编码"/> | 52 | placeholder="请输入车辆内部编码"/> |
| 53 | </div> | 53 | </div> |
| @@ -56,10 +56,10 @@ | @@ -56,10 +56,10 @@ | ||
| 56 | 内部编号必须填写 | 56 | 内部编号必须填写 |
| 57 | </div> | 57 | </div> |
| 58 | <div class="alert alert-danger well-sm" ng-show="myForm.insideCode.$error.maxlength"> | 58 | <div class="alert alert-danger well-sm" ng-show="myForm.insideCode.$error.maxlength"> |
| 59 | - 内部编号长度不能超过8位 | 59 | + 内部编号长度不能超过20位 |
| 60 | </div> | 60 | </div> |
| 61 | <div class="alert alert-danger well-sm" ng-show="myForm.insideCode.$error.remote"> | 61 | <div class="alert alert-danger well-sm" ng-show="myForm.insideCode.$error.remote"> |
| 62 | - 内部编号不能重复 | 62 | + {{$remote_msg}} |
| 63 | </div> | 63 | </div> |
| 64 | </div> | 64 | </div> |
| 65 | 65 | ||
| @@ -78,6 +78,7 @@ | @@ -78,6 +78,7 @@ | ||
| 78 | datatype="gsType" | 78 | datatype="gsType" |
| 79 | required > | 79 | required > |
| 80 | </sa-Select3> | 80 | </sa-Select3> |
| 81 | + | ||
| 81 | </div> | 82 | </div> |
| 82 | <!-- 隐藏块,显示验证信息 --> | 83 | <!-- 隐藏块,显示验证信息 --> |
| 83 | <div class="alert alert-danger well-sm" ng-show="myForm.gs.$error.required"> | 84 | <div class="alert alert-danger well-sm" ng-show="myForm.gs.$error.required"> |
| @@ -103,26 +104,40 @@ | @@ -103,26 +104,40 @@ | ||
| 103 | <label class="col-md-2 control-label">车辆编码*:</label> | 104 | <label class="col-md-2 control-label">车辆编码*:</label> |
| 104 | <div class="col-md-3"> | 105 | <div class="col-md-3"> |
| 105 | <input type="text" class="form-control" | 106 | <input type="text" class="form-control" |
| 106 | - name="carCode" ng-model="ctrl.busInfoForSave.carCode" | ||
| 107 | - required placeholder="请输入车辆编码"/> | 107 | + name="carCode" ng-model="ctrl.busInfoForSave.carCode" |
| 108 | + required placeholder="请输入车辆编码" | ||
| 109 | + remote-Validation | ||
| 110 | + remotevtype="cars_clbh" | ||
| 111 | + remotevparam="{{ {'carCode_eq': ctrl.busInfoForSave.carCode} | json}}" | ||
| 112 | + /> | ||
| 108 | </div> | 113 | </div> |
| 109 | <!-- 隐藏块,显示验证信息 --> | 114 | <!-- 隐藏块,显示验证信息 --> |
| 110 | <div class="alert alert-danger well-sm" ng-show="myForm.carCode.$error.required"> | 115 | <div class="alert alert-danger well-sm" ng-show="myForm.carCode.$error.required"> |
| 111 | 车辆编码必须填写 | 116 | 车辆编码必须填写 |
| 112 | </div> | 117 | </div> |
| 118 | + <div class="alert alert-danger well-sm" ng-show="myForm.carCode.$error.remote"> | ||
| 119 | + {{$remote_msg}} | ||
| 120 | + </div> | ||
| 113 | </div> | 121 | </div> |
| 114 | 122 | ||
| 115 | <div class="form-group has-success has-feedback"> | 123 | <div class="form-group has-success has-feedback"> |
| 116 | <label class="col-md-2 control-label">车牌号*:</label> | 124 | <label class="col-md-2 control-label">车牌号*:</label> |
| 117 | <div class="col-md-3"> | 125 | <div class="col-md-3"> |
| 118 | <input type="text" class="form-control" | 126 | <input type="text" class="form-control" |
| 119 | - name="carPlate" ng-model="ctrl.busInfoForSave.carPlate" | ||
| 120 | - required placeholder="请输入车牌号"/> | 127 | + name="carPlate" ng-model="ctrl.busInfoForSave.carPlate" |
| 128 | + required placeholder="请输入车牌号" | ||
| 129 | + remote-Validation | ||
| 130 | + remotevtype="cars_cph" | ||
| 131 | + remotevparam="{{ {'carPlate_eq': ctrl.busInfoForSave.carPlate} | json}}" | ||
| 132 | + /> | ||
| 121 | </div> | 133 | </div> |
| 122 | <!-- 隐藏快,显示验证信息 --> | 134 | <!-- 隐藏快,显示验证信息 --> |
| 123 | <div class="alert alert-danger well-sm" ng-show="myForm.carPlate.$error.required"> | 135 | <div class="alert alert-danger well-sm" ng-show="myForm.carPlate.$error.required"> |
| 124 | 车牌号必须填写 | 136 | 车牌号必须填写 |
| 125 | </div> | 137 | </div> |
| 138 | + <div class="alert alert-danger well-sm" ng-show="myForm.carPlate.$error.remote"> | ||
| 139 | + {{$remote_msg}} | ||
| 140 | + </div> | ||
| 126 | </div> | 141 | </div> |
| 127 | 142 | ||
| 128 | <div class="form-group has-success has-feedback"> | 143 | <div class="form-group has-success has-feedback"> |
| @@ -149,62 +164,69 @@ | @@ -149,62 +164,69 @@ | ||
| 149 | <label class="col-md-2 control-label">终端号*:</label> | 164 | <label class="col-md-2 control-label">终端号*:</label> |
| 150 | <div class="col-md-3"> | 165 | <div class="col-md-3"> |
| 151 | <input type="text" class="form-control" | 166 | <input type="text" class="form-control" |
| 152 | - name="equipmentCode" ng-model="ctrl.busInfoForSave.equipmentCode" | ||
| 153 | - required placeholder="请输入设备终端号"/> | 167 | + name="equipmentCode" ng-model="ctrl.busInfoForSave.equipmentCode" |
| 168 | + required placeholder="请输入设备终端号" | ||
| 169 | + remote-Validation | ||
| 170 | + remotevtype="cars_sbbh" | ||
| 171 | + remotevparam="{{ {'equipmentCode_eq': ctrl.busInfoForSave.equipmentCode} | json}}" | ||
| 172 | + /> | ||
| 154 | </div> | 173 | </div> |
| 155 | <!-- 隐藏块,显示验证信息 --> | 174 | <!-- 隐藏块,显示验证信息 --> |
| 156 | <div class="alert alert-danger well-sm" ng-show="myForm.equipmentCode.$error.required"> | 175 | <div class="alert alert-danger well-sm" ng-show="myForm.equipmentCode.$error.required"> |
| 157 | 设备终端号必须填写 | 176 | 设备终端号必须填写 |
| 158 | </div> | 177 | </div> |
| 178 | + <div class="alert alert-danger well-sm" ng-show="myForm.equipmentCode.$error.remote"> | ||
| 179 | + {{$remote_msg}} | ||
| 180 | + </div> | ||
| 159 | </div> | 181 | </div> |
| 160 | 182 | ||
| 161 | <div class="form-group"> | 183 | <div class="form-group"> |
| 162 | <label class="col-md-2 control-label">车型类别:</label> | 184 | <label class="col-md-2 control-label">车型类别:</label> |
| 163 | <div class="col-md-4"> | 185 | <div class="col-md-4"> |
| 164 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.carClass" | 186 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.carClass" |
| 165 | - placeholder="请输入车型类别"/> | 187 | + placeholder="请输入车型类别"/> |
| 166 | </div> | 188 | </div> |
| 167 | </div> | 189 | </div> |
| 168 | <div class="form-group"> | 190 | <div class="form-group"> |
| 169 | <label class="col-md-2 control-label">技术速度:</label> | 191 | <label class="col-md-2 control-label">技术速度:</label> |
| 170 | <div class="col-md-4"> | 192 | <div class="col-md-4"> |
| 171 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.speed" | 193 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.speed" |
| 172 | - placeholder="请输入技术速度"/> | 194 | + placeholder="请输入技术速度"/> |
| 173 | </div> | 195 | </div> |
| 174 | </div> | 196 | </div> |
| 175 | <div class="form-group"> | 197 | <div class="form-group"> |
| 176 | <label class="col-md-2 control-label">座位数:</label> | 198 | <label class="col-md-2 control-label">座位数:</label> |
| 177 | <div class="col-md-4"> | 199 | <div class="col-md-4"> |
| 178 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.carSeatnNumber" | 200 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.carSeatnNumber" |
| 179 | - placeholder="请输入座位数"/> | 201 | + placeholder="请输入座位数"/> |
| 180 | </div> | 202 | </div> |
| 181 | </div> | 203 | </div> |
| 182 | <div class="form-group"> | 204 | <div class="form-group"> |
| 183 | <label class="col-md-2 control-label">载客标准:</label> | 205 | <label class="col-md-2 control-label">载客标准:</label> |
| 184 | <div class="col-md-4"> | 206 | <div class="col-md-4"> |
| 185 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.carStandard" | 207 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.carStandard" |
| 186 | - placeholder="请输入载客标准"/> | 208 | + placeholder="请输入载客标准"/> |
| 187 | </div> | 209 | </div> |
| 188 | </div> | 210 | </div> |
| 189 | <div class="form-group"> | 211 | <div class="form-group"> |
| 190 | <label class="col-md-2 control-label">标准油耗/开空调:</label> | 212 | <label class="col-md-2 control-label">标准油耗/开空调:</label> |
| 191 | <div class="col-md-4"> | 213 | <div class="col-md-4"> |
| 192 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.kburnStandard" | 214 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.kburnStandard" |
| 193 | - placeholder="请输入标准油耗/开空调"/> | 215 | + placeholder="请输入标准油耗/开空调"/> |
| 194 | </div> | 216 | </div> |
| 195 | </div> | 217 | </div> |
| 196 | <div class="form-group"> | 218 | <div class="form-group"> |
| 197 | <label class="col-md-2 control-label">标准油耗/关空调:</label> | 219 | <label class="col-md-2 control-label">标准油耗/关空调:</label> |
| 198 | <div class="col-md-4"> | 220 | <div class="col-md-4"> |
| 199 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.gburnStandard" | 221 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.gburnStandard" |
| 200 | - placeholder="请输入标准油耗/关空调"/> | 222 | + placeholder="请输入标准油耗/关空调"/> |
| 201 | </div> | 223 | </div> |
| 202 | </div> | 224 | </div> |
| 203 | <div class="form-group"> | 225 | <div class="form-group"> |
| 204 | <label class="col-md-2 control-label">报废号:</label> | 226 | <label class="col-md-2 control-label">报废号:</label> |
| 205 | <div class="col-md-4"> | 227 | <div class="col-md-4"> |
| 206 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.scrapCode" | 228 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.scrapCode" |
| 207 | - placeholder="请输入报废号"/> | 229 | + placeholder="请输入报废号"/> |
| 208 | </div> | 230 | </div> |
| 209 | </div> | 231 | </div> |
| 210 | 232 | ||
| @@ -229,56 +251,56 @@ | @@ -229,56 +251,56 @@ | ||
| 229 | <label class="col-md-2 control-label">厂牌型号1:</label> | 251 | <label class="col-md-2 control-label">厂牌型号1:</label> |
| 230 | <div class="col-md-4"> | 252 | <div class="col-md-4"> |
| 231 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.makeCodeOne" | 253 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.makeCodeOne" |
| 232 | - placeholder="请输入厂牌型号1"/> | 254 | + placeholder="请输入厂牌型号1"/> |
| 233 | </div> | 255 | </div> |
| 234 | </div> | 256 | </div> |
| 235 | <div class="form-group"> | 257 | <div class="form-group"> |
| 236 | <label class="col-md-2 control-label">厂牌型号2:</label> | 258 | <label class="col-md-2 control-label">厂牌型号2:</label> |
| 237 | <div class="col-md-4"> | 259 | <div class="col-md-4"> |
| 238 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.makeCodeTwo" | 260 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.makeCodeTwo" |
| 239 | - placeholder="请输入厂牌型号2"/> | 261 | + placeholder="请输入厂牌型号2"/> |
| 240 | </div> | 262 | </div> |
| 241 | </div> | 263 | </div> |
| 242 | <div class="form-group"> | 264 | <div class="form-group"> |
| 243 | <label class="col-md-2 control-label">车辆等级标准:</label> | 265 | <label class="col-md-2 control-label">车辆等级标准:</label> |
| 244 | <div class="col-md-4"> | 266 | <div class="col-md-4"> |
| 245 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.carGride" | 267 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.carGride" |
| 246 | - placeholder="请输入车辆等级标准"/> | 268 | + placeholder="请输入车辆等级标准"/> |
| 247 | </div> | 269 | </div> |
| 248 | </div> | 270 | </div> |
| 249 | <div class="form-group"> | 271 | <div class="form-group"> |
| 250 | <label class="col-md-2 control-label">出厂排放标准:</label> | 272 | <label class="col-md-2 control-label">出厂排放标准:</label> |
| 251 | <div class="col-md-4"> | 273 | <div class="col-md-4"> |
| 252 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.emissionsStandard" | 274 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.emissionsStandard" |
| 253 | - placeholder="请输入出场排放标准"/> | 275 | + placeholder="请输入出场排放标准"/> |
| 254 | </div> | 276 | </div> |
| 255 | </div> | 277 | </div> |
| 256 | <div class="form-group"> | 278 | <div class="form-group"> |
| 257 | <label class="col-md-2 control-label">发动机号码1:</label> | 279 | <label class="col-md-2 control-label">发动机号码1:</label> |
| 258 | <div class="col-md-4"> | 280 | <div class="col-md-4"> |
| 259 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.engineCodeOne" | 281 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.engineCodeOne" |
| 260 | - placeholder="请输入发动机号码1"/> | 282 | + placeholder="请输入发动机号码1"/> |
| 261 | </div> | 283 | </div> |
| 262 | </div> | 284 | </div> |
| 263 | <div class="form-group"> | 285 | <div class="form-group"> |
| 264 | <label class="col-md-2 control-label">发动机号码2:</label> | 286 | <label class="col-md-2 control-label">发动机号码2:</label> |
| 265 | <div class="col-md-4"> | 287 | <div class="col-md-4"> |
| 266 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.engineCodeTwo" | 288 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.engineCodeTwo" |
| 267 | - placeholder="请输入发动机号码2"/> | 289 | + placeholder="请输入发动机号码2"/> |
| 268 | </div> | 290 | </div> |
| 269 | </div> | 291 | </div> |
| 270 | <div class="form-group"> | 292 | <div class="form-group"> |
| 271 | <label class="col-md-2 control-label">车架号码1:</label> | 293 | <label class="col-md-2 control-label">车架号码1:</label> |
| 272 | <div class="col-md-4"> | 294 | <div class="col-md-4"> |
| 273 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.carNumberOne" | 295 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.carNumberOne" |
| 274 | - placeholder="请输入车架号码1"/> | 296 | + placeholder="请输入车架号码1"/> |
| 275 | </div> | 297 | </div> |
| 276 | </div> | 298 | </div> |
| 277 | <div class="form-group"> | 299 | <div class="form-group"> |
| 278 | <label class="col-md-2 control-label">车架号码2:</label> | 300 | <label class="col-md-2 control-label">车架号码2:</label> |
| 279 | <div class="col-md-4"> | 301 | <div class="col-md-4"> |
| 280 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.carNumberTwo" | 302 | <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.carNumberTwo" |
| 281 | - placeholder="请输入车架号码2"/> | 303 | + placeholder="请输入车架号码2"/> |
| 282 | </div> | 304 | </div> |
| 283 | </div> | 305 | </div> |
| 284 | <div class="form-group"> | 306 | <div class="form-group"> |
| @@ -422,5 +444,4 @@ | @@ -422,5 +444,4 @@ | ||
| 422 | 444 | ||
| 423 | </div> | 445 | </div> |
| 424 | 446 | ||
| 425 | - | ||
| 426 | </div> | 447 | </div> |
| 427 | \ No newline at end of file | 448 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/form.html
| @@ -45,9 +45,9 @@ | @@ -45,9 +45,9 @@ | ||
| 45 | <div class="col-md-3"> | 45 | <div class="col-md-3"> |
| 46 | <input type="text" class="form-control" | 46 | <input type="text" class="form-control" |
| 47 | name="insideCode" ng-model="ctrl.busInfoForSave.insideCode" | 47 | name="insideCode" ng-model="ctrl.busInfoForSave.insideCode" |
| 48 | - required ng-maxlength="8" | 48 | + required ng-maxlength="20" |
| 49 | remote-Validation | 49 | remote-Validation |
| 50 | - remotevtype="cl1" | 50 | + remotevtype="cars_zbh" |
| 51 | remotevparam="{{ {'insideCode_eq': ctrl.busInfoForSave.insideCode} | json}}" | 51 | remotevparam="{{ {'insideCode_eq': ctrl.busInfoForSave.insideCode} | json}}" |
| 52 | placeholder="请输入车辆内部编码"/> | 52 | placeholder="请输入车辆内部编码"/> |
| 53 | </div> | 53 | </div> |
| @@ -56,10 +56,10 @@ | @@ -56,10 +56,10 @@ | ||
| 56 | 内部编号必须填写 | 56 | 内部编号必须填写 |
| 57 | </div> | 57 | </div> |
| 58 | <div class="alert alert-danger well-sm" ng-show="myForm.insideCode.$error.maxlength"> | 58 | <div class="alert alert-danger well-sm" ng-show="myForm.insideCode.$error.maxlength"> |
| 59 | - 内部编号长度不能超过8位 | 59 | + 内部编号长度不能超过20位 |
| 60 | </div> | 60 | </div> |
| 61 | <div class="alert alert-danger well-sm" ng-show="myForm.insideCode.$error.remote"> | 61 | <div class="alert alert-danger well-sm" ng-show="myForm.insideCode.$error.remote"> |
| 62 | - 内部编号不能重复 | 62 | + {{$remote_msg}} |
| 63 | </div> | 63 | </div> |
| 64 | </div> | 64 | </div> |
| 65 | 65 | ||
| @@ -105,12 +105,19 @@ | @@ -105,12 +105,19 @@ | ||
| 105 | <div class="col-md-3"> | 105 | <div class="col-md-3"> |
| 106 | <input type="text" class="form-control" | 106 | <input type="text" class="form-control" |
| 107 | name="carCode" ng-model="ctrl.busInfoForSave.carCode" | 107 | name="carCode" ng-model="ctrl.busInfoForSave.carCode" |
| 108 | - required placeholder="请输入车辆编码"/> | 108 | + required placeholder="请输入车辆编码" |
| 109 | + remote-Validation | ||
| 110 | + remotevtype="cars_clbh" | ||
| 111 | + remotevparam="{{ {'carCode_eq': ctrl.busInfoForSave.carCode} | json}}" | ||
| 112 | + /> | ||
| 109 | </div> | 113 | </div> |
| 110 | <!-- 隐藏块,显示验证信息 --> | 114 | <!-- 隐藏块,显示验证信息 --> |
| 111 | <div class="alert alert-danger well-sm" ng-show="myForm.carCode.$error.required"> | 115 | <div class="alert alert-danger well-sm" ng-show="myForm.carCode.$error.required"> |
| 112 | 车辆编码必须填写 | 116 | 车辆编码必须填写 |
| 113 | </div> | 117 | </div> |
| 118 | + <div class="alert alert-danger well-sm" ng-show="myForm.carCode.$error.remote"> | ||
| 119 | + {{$remote_msg}} | ||
| 120 | + </div> | ||
| 114 | </div> | 121 | </div> |
| 115 | 122 | ||
| 116 | <div class="form-group has-success has-feedback"> | 123 | <div class="form-group has-success has-feedback"> |
| @@ -118,12 +125,19 @@ | @@ -118,12 +125,19 @@ | ||
| 118 | <div class="col-md-3"> | 125 | <div class="col-md-3"> |
| 119 | <input type="text" class="form-control" | 126 | <input type="text" class="form-control" |
| 120 | name="carPlate" ng-model="ctrl.busInfoForSave.carPlate" | 127 | name="carPlate" ng-model="ctrl.busInfoForSave.carPlate" |
| 121 | - required placeholder="请输入车牌号"/> | 128 | + required placeholder="请输入车牌号" |
| 129 | + remote-Validation | ||
| 130 | + remotevtype="cars_cph" | ||
| 131 | + remotevparam="{{ {'carPlate_eq': ctrl.busInfoForSave.carPlate} | json}}" | ||
| 132 | + /> | ||
| 122 | </div> | 133 | </div> |
| 123 | <!-- 隐藏快,显示验证信息 --> | 134 | <!-- 隐藏快,显示验证信息 --> |
| 124 | <div class="alert alert-danger well-sm" ng-show="myForm.carPlate.$error.required"> | 135 | <div class="alert alert-danger well-sm" ng-show="myForm.carPlate.$error.required"> |
| 125 | 车牌号必须填写 | 136 | 车牌号必须填写 |
| 126 | </div> | 137 | </div> |
| 138 | + <div class="alert alert-danger well-sm" ng-show="myForm.carPlate.$error.remote"> | ||
| 139 | + {{$remote_msg}} | ||
| 140 | + </div> | ||
| 127 | </div> | 141 | </div> |
| 128 | 142 | ||
| 129 | <div class="form-group has-success has-feedback"> | 143 | <div class="form-group has-success has-feedback"> |
| @@ -151,12 +165,19 @@ | @@ -151,12 +165,19 @@ | ||
| 151 | <div class="col-md-3"> | 165 | <div class="col-md-3"> |
| 152 | <input type="text" class="form-control" | 166 | <input type="text" class="form-control" |
| 153 | name="equipmentCode" ng-model="ctrl.busInfoForSave.equipmentCode" | 167 | name="equipmentCode" ng-model="ctrl.busInfoForSave.equipmentCode" |
| 154 | - required placeholder="请输入设备终端号"/> | 168 | + required placeholder="请输入设备终端号" |
| 169 | + remote-Validation | ||
| 170 | + remotevtype="cars_sbbh" | ||
| 171 | + remotevparam="{{ {'equipmentCode_eq': ctrl.busInfoForSave.equipmentCode} | json}}" | ||
| 172 | + /> | ||
| 155 | </div> | 173 | </div> |
| 156 | <!-- 隐藏块,显示验证信息 --> | 174 | <!-- 隐藏块,显示验证信息 --> |
| 157 | <div class="alert alert-danger well-sm" ng-show="myForm.equipmentCode.$error.required"> | 175 | <div class="alert alert-danger well-sm" ng-show="myForm.equipmentCode.$error.required"> |
| 158 | 设备终端号必须填写 | 176 | 设备终端号必须填写 |
| 159 | </div> | 177 | </div> |
| 178 | + <div class="alert alert-danger well-sm" ng-show="myForm.equipmentCode.$error.remote"> | ||
| 179 | + {{$remote_msg}} | ||
| 180 | + </div> | ||
| 160 | </div> | 181 | </div> |
| 161 | 182 | ||
| 162 | <div class="form-group"> | 183 | <div class="form-group"> |
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/list.html
| @@ -7,12 +7,12 @@ | @@ -7,12 +7,12 @@ | ||
| 7 | <th style="width: 50px;">序号</th> | 7 | <th style="width: 50px;">序号</th> |
| 8 | <th style="width: 130px;">车辆编号</th> | 8 | <th style="width: 130px;">车辆编号</th> |
| 9 | <th style="width: 130px;">内部编号</th> | 9 | <th style="width: 130px;">内部编号</th> |
| 10 | - <th >设备编号</th> | ||
| 11 | - <th >车牌号</th> | ||
| 12 | - <th style="width: 15%;">所在公司</th> | ||
| 13 | - <th >所在分公司</th> | ||
| 14 | - <th style="width: 10%">是否电车</th> | ||
| 15 | - <th style="width: 21%">操作</th> | 10 | + <th style="width: 130px;">设备编号</th> |
| 11 | + <th style="width: 130px;">车牌号</th> | ||
| 12 | + <th style="width: 150px;">所在公司</th> | ||
| 13 | + <th style="width: 100px;">所在分公司</th> | ||
| 14 | + <th style="width: 80px">是否电车</th> | ||
| 15 | + <th style="width: 100%">操作</th> | ||
| 16 | </tr> | 16 | </tr> |
| 17 | <tr role="row" class="filter"> | 17 | <tr role="row" class="filter"> |
| 18 | <td></td> | 18 | <td></td> |
| @@ -23,8 +23,10 @@ | @@ -23,8 +23,10 @@ | ||
| 23 | <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition().insideCode_like" placeholder="输入内部编号..."/> | 23 | <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition().insideCode_like" placeholder="输入内部编号..."/> |
| 24 | </td> | 24 | </td> |
| 25 | <td> | 25 | <td> |
| 26 | + <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition().equipmentCode_like" placeholder="输入设备编号..."/> | ||
| 26 | </td> | 27 | </td> |
| 27 | <td> | 28 | <td> |
| 29 | + <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition().carCode_like" placeholder="输入车牌号..."/> | ||
| 28 | </td> | 30 | </td> |
| 29 | <td> | 31 | <td> |
| 30 | <div> | 32 | <div> |
| @@ -47,18 +49,18 @@ | @@ -47,18 +49,18 @@ | ||
| 47 | </td> | 49 | </td> |
| 48 | <td> | 50 | <td> |
| 49 | <button class="btn btn-sm green btn-outline filter-submit margin-bottom" | 51 | <button class="btn btn-sm green btn-outline filter-submit margin-bottom" |
| 50 | - ng-click="ctrl.pageChanaged()"> | 52 | + ng-click="ctrl.doPage()"> |
| 51 | <i class="fa fa-search"></i> 搜索</button> | 53 | <i class="fa fa-search"></i> 搜索</button> |
| 52 | 54 | ||
| 53 | <button class="btn btn-sm red btn-outline filter-cancel" | 55 | <button class="btn btn-sm red btn-outline filter-cancel" |
| 54 | - ng-click="ctrl.resetSearchCondition()"> | 56 | + ng-click="ctrl.reset()"> |
| 55 | <i class="fa fa-times"></i> 重置</button> | 57 | <i class="fa fa-times"></i> 重置</button> |
| 56 | </td> | 58 | </td> |
| 57 | 59 | ||
| 58 | </tr> | 60 | </tr> |
| 59 | </thead> | 61 | </thead> |
| 60 | <tbody> | 62 | <tbody> |
| 61 | - <tr ng-repeat="info in ctrl.pageInfo.infos" class="odd gradeX"> | 63 | + <tr ng-repeat="info in ctrl.page()['content']" class="odd gradeX"> |
| 62 | <td> | 64 | <td> |
| 63 | <span ng-bind="$index + 1"></span> | 65 | <span ng-bind="$index + 1"></span> |
| 64 | </td> | 66 | </td> |
| @@ -96,9 +98,9 @@ | @@ -96,9 +98,9 @@ | ||
| 96 | </div> | 98 | </div> |
| 97 | 99 | ||
| 98 | <div style="text-align: right;"> | 100 | <div style="text-align: right;"> |
| 99 | - <uib-pagination total-items="ctrl.pageInfo.totalItems" | ||
| 100 | - ng-model="ctrl.pageInfo.currentPage" | ||
| 101 | - ng-change="ctrl.pageChanaged()" | 101 | + <uib-pagination total-items="ctrl.page()['totalElements']" |
| 102 | + ng-model="ctrl.page()['uiNumber']" | ||
| 103 | + ng-change="ctrl.doPage()" | ||
| 102 | rotate="false" | 104 | rotate="false" |
| 103 | max-size="10" | 105 | max-size="10" |
| 104 | boundary-links="true" | 106 | boundary-links="true" |
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/module.js
| 1 | // 车辆基础信息维护 service controller等写在一起 | 1 | // 车辆基础信息维护 service controller等写在一起 |
| 2 | 2 | ||
| 3 | -angular.module('ScheduleApp').factory('BusInfoManageService', ['BusInfoManageService_g', function(service) { | 3 | +angular.module('ScheduleApp').factory( |
| 4 | + 'BusInfoManageService', | ||
| 5 | + [ | ||
| 6 | + 'BusInfoManageService_g', | ||
| 7 | + function(service) { | ||
| 4 | 8 | ||
| 5 | - /** 当前的查询条件信息 */ | ||
| 6 | - var currentSearchCondition = { | ||
| 7 | - "carCode_like" : "", | ||
| 8 | - "insideCode_like" : "", | ||
| 9 | - "equipmentCode_like" : "", | ||
| 10 | - "carPlate_like" : "" | ||
| 11 | - }; | ||
| 12 | - | ||
| 13 | - /** 当前第几页 */ | ||
| 14 | - var currentPageNo = 1; | ||
| 15 | - return { | ||
| 16 | - /** | ||
| 17 | - * 获取查询条件信息, | ||
| 18 | - * 用于给controller用来和页面数据绑定。 | ||
| 19 | - */ | ||
| 20 | - getSearchCondition: function() { | ||
| 21 | - return currentSearchCondition; | ||
| 22 | - }, | ||
| 23 | - /** | ||
| 24 | - * 重置查询条件信息。 | ||
| 25 | - */ | ||
| 26 | - resetSearchCondition: function() { | ||
| 27 | - var key; | ||
| 28 | - for (key in currentSearchCondition) { | ||
| 29 | - currentSearchCondition[key] = undefined; | ||
| 30 | - } | ||
| 31 | - currentPageNo = 1; | ||
| 32 | - }, | ||
| 33 | - /** | ||
| 34 | - * 设置当前页码。 | ||
| 35 | - * @param cpn 从1开始,后台是从0开始的 | ||
| 36 | - */ | ||
| 37 | - setCurrentPageNo: function(cpn) { | ||
| 38 | - currentPageNo = cpn; | ||
| 39 | - }, | ||
| 40 | - /** | ||
| 41 | - * 组装查询参数,返回一个promise查询结果。 | ||
| 42 | - * @param params 查询参数 | ||
| 43 | - * @return 返回一个 promise | ||
| 44 | - */ | ||
| 45 | - getPage: function() { | ||
| 46 | - var params = currentSearchCondition; // 查询条件 | ||
| 47 | - params.page = currentPageNo - 1; // 服务端页码从0开始 | ||
| 48 | - return service.rest.list(params).$promise; | ||
| 49 | - }, | ||
| 50 | - /** | ||
| 51 | - * 获取明细信息。 | ||
| 52 | - * @param id 车辆id | ||
| 53 | - * @return 返回一个 promise | ||
| 54 | - */ | ||
| 55 | - getDetail: function(id) { | ||
| 56 | - var params = {id: id}; | ||
| 57 | - return service.rest.get(params).$promise; | ||
| 58 | - }, | ||
| 59 | - /** | ||
| 60 | - * 保存信息。 | ||
| 61 | - * @param obj 车辆详细信息 | ||
| 62 | - * @return 返回一个 promise | ||
| 63 | - */ | ||
| 64 | - saveDetail: function(obj) { | ||
| 65 | - return service.rest.save(obj).$promise; | ||
| 66 | - }, | ||
| 67 | - /** | ||
| 68 | - * 数据导出。 | ||
| 69 | - * @returns {*|Function|promise|n} | ||
| 70 | - */ | ||
| 71 | - dataExport: function() { | ||
| 72 | - return service.dataTools.dataExport().$promise; | ||
| 73 | - } | ||
| 74 | - }; | ||
| 75 | -}]); | 9 | + /** 当前的查询条件信息 */ |
| 10 | + var currentSearchCondition = { | ||
| 11 | + page: 0, | ||
| 12 | + "carCode_like" : "", | ||
| 13 | + "insideCode_like" : "", | ||
| 14 | + "equipmentCode_like" : "", | ||
| 15 | + "carPlate_like" : "" | ||
| 16 | + }; | ||
| 17 | + // 当前查询返回的信息 | ||
| 18 | + var currentPage = { // 后台spring data返回的格式 | ||
| 19 | + totalElements: 0, | ||
| 20 | + number: 0, // 后台返回的页码,spring返回从0开始 | ||
| 21 | + content: [], | ||
| 76 | 22 | ||
| 77 | -angular.module('ScheduleApp').controller('BusInfoManageCtrl', [ | ||
| 78 | - 'BusInfoManageService','$state', '$uibModal', 'FileDownload_g', | ||
| 79 | - function(busInfoManageService, $state, $uibModal, fileDownload) { | ||
| 80 | - var self = this; | 23 | + uiNumber: 1 // 页面绑定的页码 |
| 24 | + }; | ||
| 81 | 25 | ||
| 82 | - // 切换到form状态 | ||
| 83 | - self.goForm = function() { | ||
| 84 | - //alert("切换"); | ||
| 85 | - $state.go("busInfoManage_form"); | ||
| 86 | - }; | 26 | + // 查询对象 |
| 27 | + var queryClass = service.rest; | ||
| 87 | 28 | ||
| 88 | - // 导入excel | ||
| 89 | - self.importData = function() { | ||
| 90 | - // large方式弹出模态对话框 | ||
| 91 | - var modalInstance = $uibModal.open({ | ||
| 92 | - templateUrl: '/pages/scheduleApp/module/basicInfo/busInfoManage/dataImport.html', | ||
| 93 | - size: "lg", | ||
| 94 | - animation: true, | ||
| 95 | - backdrop: 'static', | ||
| 96 | - resolve: { | ||
| 97 | - // 可以传值给controller | 29 | + return { |
| 30 | + getQueryClass: function() { | ||
| 31 | + return queryClass; | ||
| 98 | }, | 32 | }, |
| 99 | - windowClass: 'center-modal', | ||
| 100 | - controller: "BusInfoManageToolsCtrl", | ||
| 101 | - controllerAs: "ctrl", | ||
| 102 | - bindToController: true | ||
| 103 | - }); | ||
| 104 | - modalInstance.result.then( | ||
| 105 | - function() { | ||
| 106 | - console.log("dataImport.html打开"); | 33 | + /** |
| 34 | + * 获取查询条件信息, | ||
| 35 | + * 用于给controller用来和页面数据绑定。 | ||
| 36 | + */ | ||
| 37 | + getSearchCondition: function() { | ||
| 38 | + currentSearchCondition.page = currentPage.uiNumber - 1; | ||
| 39 | + return currentSearchCondition; | ||
| 107 | }, | 40 | }, |
| 108 | - function() { | ||
| 109 | - console.log("dataImport.html消失"); | ||
| 110 | - } | ||
| 111 | - ); | ||
| 112 | - }; | ||
| 113 | - | ||
| 114 | - // 导出excel | ||
| 115 | - self.exportData = function() { | ||
| 116 | - busInfoManageService.dataExport().then( | ||
| 117 | - function(result) { | ||
| 118 | - fileDownload.downloadFile(result.data, "application/octet-stream", "车辆基础信息.xls"); | 41 | + /** |
| 42 | + * 组装查询参数,返回一个promise查询结果。 | ||
| 43 | + * @param params 查询参数 | ||
| 44 | + * @return 返回一个 promise | ||
| 45 | + */ | ||
| 46 | + getPage: function(page) { | ||
| 47 | + if (page) { | ||
| 48 | + currentPage.totalElements = page.totalElements; | ||
| 49 | + currentPage.number = page.number; | ||
| 50 | + currentPage.content = page.content; | ||
| 51 | + } | ||
| 52 | + return currentPage; | ||
| 119 | }, | 53 | }, |
| 120 | - function(result) { | ||
| 121 | - console.log("exportData failed:" + result); | 54 | + resetStatus: function() { |
| 55 | + currentSearchCondition = {page: 0}; | ||
| 56 | + currentPage = { | ||
| 57 | + totalElements: 0, | ||
| 58 | + number: 0, | ||
| 59 | + content: [], | ||
| 60 | + uiNumber: 1 | ||
| 61 | + }; | ||
| 62 | + }, | ||
| 63 | + | ||
| 64 | + /** | ||
| 65 | + * 数据导出。 | ||
| 66 | + * @returns {*|Function|promise|n} | ||
| 67 | + */ | ||
| 68 | + dataExport: function() { | ||
| 69 | + return service.dataTools.dataExport().$promise; | ||
| 122 | } | 70 | } |
| 123 | - ); | ||
| 124 | - }; | ||
| 125 | - }]); | 71 | + }; |
| 72 | + | ||
| 73 | + } | ||
| 74 | + ] | ||
| 75 | +); | ||
| 76 | + | ||
| 77 | +// index.html控制器 | ||
| 78 | +angular.module('ScheduleApp').controller( | ||
| 79 | + 'BusInfoManageCtrl', | ||
| 80 | + [ | ||
| 81 | + 'BusInfoManageService', | ||
| 82 | + '$state', | ||
| 83 | + '$uibModal', | ||
| 84 | + 'FileDownload_g', | ||
| 85 | + function(busInfoManageService, $state, $uibModal, fileDownload) { | ||
| 86 | + var self = this; | ||
| 87 | + | ||
| 88 | + // 切换到form状态 | ||
| 89 | + self.goForm = function() { | ||
| 90 | + //alert("切换"); | ||
| 91 | + $state.go("busInfoManage_form"); | ||
| 92 | + }; | ||
| 93 | + | ||
| 94 | + // 导入excel | ||
| 95 | + self.importData = function() { | ||
| 96 | + // large方式弹出模态对话框 | ||
| 97 | + var modalInstance = $uibModal.open({ | ||
| 98 | + templateUrl: '/pages/scheduleApp/module/basicInfo/busInfoManage/dataImport.html', | ||
| 99 | + size: "lg", | ||
| 100 | + animation: true, | ||
| 101 | + backdrop: 'static', | ||
| 102 | + resolve: { | ||
| 103 | + // 可以传值给controller | ||
| 104 | + }, | ||
| 105 | + windowClass: 'center-modal', | ||
| 106 | + controller: "BusInfoManageToolsCtrl", | ||
| 107 | + controllerAs: "ctrl", | ||
| 108 | + bindToController: true | ||
| 109 | + }); | ||
| 110 | + modalInstance.result.then( | ||
| 111 | + function() { | ||
| 112 | + console.log("dataImport.html打开"); | ||
| 113 | + }, | ||
| 114 | + function() { | ||
| 115 | + console.log("dataImport.html消失"); | ||
| 116 | + } | ||
| 117 | + ); | ||
| 118 | + }; | ||
| 119 | + | ||
| 120 | + // 导出excel | ||
| 121 | + self.exportData = function() { | ||
| 122 | + busInfoManageService.dataExport().then( | ||
| 123 | + function(result) { | ||
| 124 | + fileDownload.downloadFile(result.data, "application/octet-stream", "车辆基础信息.xls"); | ||
| 125 | + }, | ||
| 126 | + function(result) { | ||
| 127 | + console.log("exportData failed:" + result); | ||
| 128 | + } | ||
| 129 | + ); | ||
| 130 | + }; | ||
| 131 | + } | ||
| 132 | + ] | ||
| 133 | +); | ||
| 126 | 134 | ||
| 127 | angular.module('ScheduleApp').controller('BusInfoManageToolsCtrl', ['$modalInstance', 'FileUploader', function($modalInstance, FileUploader) { | 135 | angular.module('ScheduleApp').controller('BusInfoManageToolsCtrl', ['$modalInstance', 'FileUploader', function($modalInstance, FileUploader) { |
| 128 | var self = this; | 136 | var self = this; |
| @@ -160,143 +168,114 @@ angular.module('ScheduleApp').controller('BusInfoManageToolsCtrl', ['$modalInsta | @@ -160,143 +168,114 @@ angular.module('ScheduleApp').controller('BusInfoManageToolsCtrl', ['$modalInsta | ||
| 160 | 168 | ||
| 161 | }]); | 169 | }]); |
| 162 | 170 | ||
| 171 | +// list.html控制器 | ||
| 172 | +angular.module('ScheduleApp').controller( | ||
| 173 | + 'BusInfoManageListCtrl', | ||
| 174 | + [ | ||
| 175 | + 'BusInfoManageService', | ||
| 176 | + '$scope', | ||
| 177 | + function(service, $scope) { | ||
| 178 | + var self = this; | ||
| 179 | + var Cars = service.getQueryClass(); | ||
| 163 | 180 | ||
| 164 | -angular.module('ScheduleApp').controller('BusInfoManageListCtrl', ['BusInfoManageService','$scope', function(busInfoManageService, $scope) { | ||
| 165 | - var self = this; | ||
| 166 | - self.pageInfo = { | ||
| 167 | - totalItems : 0, | ||
| 168 | - currentPage : 1, | ||
| 169 | - infos: [] | ||
| 170 | - }; | 181 | + self.page = function() { |
| 182 | + return service.getPage(); | ||
| 183 | + }; | ||
| 171 | 184 | ||
| 172 | - // 初始创建的时候,获取一次列表数据 | ||
| 173 | - busInfoManageService.getPage().then( | ||
| 174 | - function(result) { | ||
| 175 | - self.pageInfo.totalItems = result.totalElements; | ||
| 176 | - self.pageInfo.currentPage = result.number + 1; | ||
| 177 | - self.pageInfo.infos = result.content; | ||
| 178 | - busInfoManageService.setCurrentPageNo(result.number + 1); | ||
| 179 | - }, | ||
| 180 | - function(result) { | ||
| 181 | - alert("出错啦!"); | ||
| 182 | - } | ||
| 183 | - ); | 185 | + self.searchCondition = function() { |
| 186 | + return service.getSearchCondition(); | ||
| 187 | + }; | ||
| 184 | 188 | ||
| 185 | - //$scope.$watch("ctrl.pageInfo.currentPage", function() { | ||
| 186 | - // alert("dfdfdf"); | ||
| 187 | - //}); | 189 | + self.doPage = function() { |
| 190 | + var result = Cars.list(self.searchCondition(), function() { | ||
| 191 | + if (!result.status) { | ||
| 192 | + service.getPage(result); | ||
| 193 | + } | ||
| 194 | + }); | ||
| 195 | + }; | ||
| 196 | + self.reset = function() { | ||
| 197 | + service.resetStatus(); | ||
| 198 | + var result = Cars.list(self.searchCondition(), function() { | ||
| 199 | + if (!result.status) { | ||
| 200 | + service.getPage(result); | ||
| 201 | + } | ||
| 202 | + }); | ||
| 203 | + }; | ||
| 188 | 204 | ||
| 189 | - // 翻页的时候调用 | ||
| 190 | - self.pageChanaged = function() { | ||
| 191 | - busInfoManageService.setCurrentPageNo(self.pageInfo.currentPage); | ||
| 192 | - busInfoManageService.getPage().then( | ||
| 193 | - function(result) { | ||
| 194 | - self.pageInfo.totalItems = result.totalElements; | ||
| 195 | - self.pageInfo.currentPage = result.number + 1; | ||
| 196 | - self.pageInfo.infos = result.content; | ||
| 197 | - busInfoManageService.setCurrentPageNo(result.number + 1); | ||
| 198 | - }, | ||
| 199 | - function(result) { | ||
| 200 | - alert("出错啦!"); | ||
| 201 | - } | ||
| 202 | - ); | ||
| 203 | - }; | ||
| 204 | - // 获取查询条件数据 | ||
| 205 | - self.searchCondition = function() { | ||
| 206 | - return busInfoManageService.getSearchCondition(); | ||
| 207 | - }; | ||
| 208 | - // 重置查询条件 | ||
| 209 | - self.resetSearchCondition = function() { | ||
| 210 | - busInfoManageService.resetSearchCondition(); | ||
| 211 | - self.pageInfo.currentPage = 1; | ||
| 212 | - self.pageChanaged(); | ||
| 213 | - }; | ||
| 214 | -}]); | 205 | + self.doPage(); |
| 206 | + } | ||
| 207 | + ] | ||
| 208 | +); | ||
| 215 | 209 | ||
| 216 | -angular.module('ScheduleApp').controller('BusInfoManageFormCtrl', ['BusInfoManageService', '$stateParams', '$state', function(busInfoManageService, $stateParams, $state) { | ||
| 217 | - var self = this; | 210 | +// form.html控制器 |
| 211 | +angular.module('ScheduleApp').controller( | ||
| 212 | + 'BusInfoManageFormCtrl', | ||
| 213 | + [ | ||
| 214 | + 'BusInfoManageService', | ||
| 215 | + '$stateParams', | ||
| 216 | + '$state', | ||
| 217 | + function(service, $stateParams, $state) { | ||
| 218 | + var self = this; | ||
| 219 | + var Cars = service.getQueryClass(); | ||
| 218 | 220 | ||
| 219 | - // 报废日期 日期控件开关 | ||
| 220 | - self.scrapDateOpen = false; | ||
| 221 | - self.scrapDate_open = function() { | ||
| 222 | - self.scrapDateOpen = true; | ||
| 223 | - }; | 221 | + // 报废日期 日期控件开关 |
| 222 | + self.scrapDateOpen = false; | ||
| 223 | + self.scrapDate_open = function() { | ||
| 224 | + self.scrapDateOpen = true; | ||
| 225 | + }; | ||
| 224 | 226 | ||
| 225 | - // 启用日期 日期控件开关 | ||
| 226 | - self.openDateOpen = false; | ||
| 227 | - self.openDate_open = function() { | ||
| 228 | - self.openDateOpen = true; | ||
| 229 | - }; | ||
| 230 | - // 取消日期 日期控件开关 | ||
| 231 | - self.closeDateOpen = false; | ||
| 232 | - self.closeDate_open = function() { | ||
| 233 | - self.closeDateOpen = true; | ||
| 234 | - }; | 227 | + // 启用日期 日期控件开关 |
| 228 | + self.openDateOpen = false; | ||
| 229 | + self.openDate_open = function() { | ||
| 230 | + self.openDateOpen = true; | ||
| 231 | + }; | ||
| 232 | + // 取消日期 日期控件开关 | ||
| 233 | + self.closeDateOpen = false; | ||
| 234 | + self.closeDate_open = function() { | ||
| 235 | + self.closeDateOpen = true; | ||
| 236 | + }; | ||
| 235 | 237 | ||
| 236 | - // 欲保存的busInfo信息,绑定 | ||
| 237 | - self.busInfoForSave = {}; | 238 | + // 欲保存的busInfo信息,绑定 |
| 239 | + self.busInfoForSave = new Cars; | ||
| 238 | 240 | ||
| 239 | - // 获取传过来的id,有的话就是修改,获取一遍数据 | ||
| 240 | - var id = $stateParams.id; | ||
| 241 | - if (id) { | ||
| 242 | - self.busInfoForSave.id = id; | ||
| 243 | - busInfoManageService.getDetail(id).then( | ||
| 244 | - function(result) { | ||
| 245 | - var key; | ||
| 246 | - for (key in result) { | ||
| 247 | - self.busInfoForSave[key] = result[key]; | ||
| 248 | - } | ||
| 249 | - }, | ||
| 250 | - function(result) { | ||
| 251 | - alert("出错啦!"); | 241 | + // 获取传过来的id,有的话就是修改,获取一遍数据 |
| 242 | + var id = $stateParams.id; | ||
| 243 | + if (id) { | ||
| 244 | + self.busInfoForSave = Cars.get({id: id}, function() {}); | ||
| 252 | } | 245 | } |
| 253 | - ); | ||
| 254 | - } | ||
| 255 | 246 | ||
| 256 | - // 提交方法 | ||
| 257 | - self.submit = function() { | ||
| 258 | - console.log(self.busInfoForSave); | ||
| 259 | - //if (self.busInfoForSave) { | ||
| 260 | - // delete $stateParams.id; | ||
| 261 | - //} | ||
| 262 | - busInfoManageService.saveDetail(self.busInfoForSave).then( | ||
| 263 | - function(result) { | ||
| 264 | - // TODO:弹出框方式以后改 | ||
| 265 | - if (result.status == 'SUCCESS') { | ||
| 266 | - alert("保存成功!"); | 247 | + // 提交方法 |
| 248 | + self.submit = function() { | ||
| 249 | + console.log(self.busInfoForSave); | ||
| 250 | + //if (self.busInfoForSave) { | ||
| 251 | + // delete $stateParams.id; | ||
| 252 | + //} | ||
| 253 | + self.busInfoForSave.$save(function() { | ||
| 267 | $state.go("busInfoManage"); | 254 | $state.go("busInfoManage"); |
| 268 | - } else { | ||
| 269 | - alert("保存异常!"); | ||
| 270 | - } | ||
| 271 | - }, | ||
| 272 | - function(result) { | ||
| 273 | - // TODO:弹出框方式以后改 | ||
| 274 | - alert("出错啦!"); | ||
| 275 | - } | ||
| 276 | - ); | ||
| 277 | - }; | ||
| 278 | - | ||
| 279 | -}]); | 255 | + }); |
| 256 | + }; | ||
| 257 | + } | ||
| 258 | + ] | ||
| 259 | +); | ||
| 280 | 260 | ||
| 281 | -angular.module('ScheduleApp').controller('BusInfoManageDetailCtrl', ['BusInfoManageService', '$stateParams', function(busInfoManageService, $stateParams) { | ||
| 282 | - var self = this; | ||
| 283 | - self.title = ""; | ||
| 284 | - self.busInfoForDetail = {}; | ||
| 285 | - self.busInfoForDetail.id = $stateParams.id; | 261 | +// detail.html控制器 |
| 262 | +angular.module('ScheduleApp').controller( | ||
| 263 | + 'BusInfoManageDetailCtrl', | ||
| 264 | + [ | ||
| 265 | + 'BusInfoManageService', | ||
| 266 | + '$stateParams', | ||
| 267 | + function(service, $stateParams) { | ||
| 268 | + var self = this; | ||
| 269 | + var Cars = service.getQueryClass(); | ||
| 270 | + var id = $stateParams.id; | ||
| 286 | 271 | ||
| 287 | - // 当转向到此页面时,就获取明细信息并绑定 | ||
| 288 | - busInfoManageService.getDetail($stateParams.id).then( | ||
| 289 | - function(result) { | ||
| 290 | - var key; | ||
| 291 | - for (key in result) { | ||
| 292 | - self.busInfoForDetail[key] = result[key]; | ||
| 293 | - } | 272 | + self.title = ""; |
| 273 | + self.busInfoForDetail = {}; | ||
| 294 | 274 | ||
| 295 | - self.title = "车辆 " + self.busInfoForDetail.insideCode + " 详细信息"; | ||
| 296 | - }, | ||
| 297 | - function(result) { | ||
| 298 | - // TODO:弹出框方式以后改 | ||
| 299 | - alert("出错啦!"); | 275 | + // 当转向到此页面时,就获取明细信息并绑定 |
| 276 | + self.busInfoForDetail = Cars.get({id: id}, function() { | ||
| 277 | + self.title = "车辆 " + self.busInfoForDetail.insideCode + " 详细信息"; | ||
| 278 | + }); | ||
| 300 | } | 279 | } |
| 301 | - ); | ||
| 302 | -}]); | ||
| 303 | \ No newline at end of file | 280 | \ No newline at end of file |
| 281 | + ] | ||
| 282 | +); | ||
| 304 | \ No newline at end of file | 283 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/service.js
0 → 100644
| 1 | +// 车辆信息service | ||
| 2 | +angular.module('ScheduleApp').factory('BusInfoManageService_g', ['$resource', function($resource) { | ||
| 3 | + return { | ||
| 4 | + rest: $resource( | ||
| 5 | + '/cars_sc/:id', | ||
| 6 | + {order: 'carCode', direction: 'ASC', id: '@id_route'}, | ||
| 7 | + { | ||
| 8 | + list: { | ||
| 9 | + method: 'GET', | ||
| 10 | + params: { | ||
| 11 | + page: 0 | ||
| 12 | + }, | ||
| 13 | + transformResponse: function(rs) { | ||
| 14 | + var dst = angular.fromJson(rs); | ||
| 15 | + if (dst.status == 'SUCCESS') { | ||
| 16 | + return dst.data; | ||
| 17 | + } else { | ||
| 18 | + return dst; // 业务错误留给控制器处理 | ||
| 19 | + } | ||
| 20 | + } | ||
| 21 | + }, | ||
| 22 | + get: { | ||
| 23 | + method: 'GET', | ||
| 24 | + transformResponse: function(rs) { | ||
| 25 | + var dst = angular.fromJson(rs); | ||
| 26 | + if (dst.status == 'SUCCESS') { | ||
| 27 | + return dst.data; | ||
| 28 | + } else { | ||
| 29 | + return dst; | ||
| 30 | + } | ||
| 31 | + } | ||
| 32 | + }, | ||
| 33 | + save: { | ||
| 34 | + method: 'POST' | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | + ), | ||
| 38 | + import: $resource( | ||
| 39 | + '/cars/importfile', | ||
| 40 | + {}, | ||
| 41 | + { | ||
| 42 | + do: { | ||
| 43 | + method: 'POST', | ||
| 44 | + headers: { | ||
| 45 | + 'Content-Type': 'application/x-www-form-urlencoded' | ||
| 46 | + }, | ||
| 47 | + transformRequest: function(obj) { | ||
| 48 | + var str = []; | ||
| 49 | + for (var p in obj) { | ||
| 50 | + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p])); | ||
| 51 | + } | ||
| 52 | + return str.join("&"); | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + } | ||
| 56 | + ), | ||
| 57 | + validate: $resource( | ||
| 58 | + '/cars/validate/:type', | ||
| 59 | + {}, | ||
| 60 | + { | ||
| 61 | + insideCode: { | ||
| 62 | + method: 'GET' | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | + ), | ||
| 66 | + dataTools: $resource( | ||
| 67 | + '/cars/:type', | ||
| 68 | + {}, | ||
| 69 | + { | ||
| 70 | + dataExport: { | ||
| 71 | + method: 'GET', | ||
| 72 | + responseType: "arraybuffer", | ||
| 73 | + params: { | ||
| 74 | + type: "dataExport" | ||
| 75 | + }, | ||
| 76 | + transformResponse: function(data, headers){ | ||
| 77 | + return {data : data}; | ||
| 78 | + } | ||
| 79 | + } | ||
| 80 | + } | ||
| 81 | + ) | ||
| 82 | + }; | ||
| 83 | +}]); | ||
| 0 | \ No newline at end of file | 84 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/basicInfo/deviceInfoManage/service.js
0 → 100644
| 1 | +// 车辆设备信息service | ||
| 2 | +angular.module('ScheduleApp').factory('DeviceInfoManageService_g', ['$resource', function($resource) { | ||
| 3 | + return $resource( | ||
| 4 | + '/cde/:id', | ||
| 5 | + {order: 'xl,isCancel,cl,qyrq', direction: 'ASC,ASC,ASC,DESC', id: '@id_route'}, | ||
| 6 | + { | ||
| 7 | + list: { | ||
| 8 | + method: 'GET', | ||
| 9 | + params: { | ||
| 10 | + page: 0 | ||
| 11 | + } | ||
| 12 | + }, | ||
| 13 | + get: { | ||
| 14 | + method: 'GET' | ||
| 15 | + }, | ||
| 16 | + save: { | ||
| 17 | + method: 'POST' | ||
| 18 | + }, | ||
| 19 | + delete: { | ||
| 20 | + method: 'DELETE' | ||
| 21 | + } | ||
| 22 | + } | ||
| 23 | + ); | ||
| 24 | +}]); | ||
| 0 | \ No newline at end of file | 25 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/basicInfo/employeeInfoManage/service.js
0 → 100644
| 1 | +// 人员信息service | ||
| 2 | +angular.module('ScheduleApp').factory('EmployeeInfoManageService_g', ['$resource', function($resource) { | ||
| 3 | + return { | ||
| 4 | + rest : $resource( | ||
| 5 | + '/personnel/:id', | ||
| 6 | + {order: 'jobCode', direction: 'ASC', id: '@id_route'}, | ||
| 7 | + { | ||
| 8 | + list: { | ||
| 9 | + method: 'GET', | ||
| 10 | + params: { | ||
| 11 | + page: 0 | ||
| 12 | + } | ||
| 13 | + }, | ||
| 14 | + get: { | ||
| 15 | + method: 'GET' | ||
| 16 | + }, | ||
| 17 | + save: { | ||
| 18 | + method: 'POST' | ||
| 19 | + } | ||
| 20 | + } | ||
| 21 | + ), | ||
| 22 | + validate: $resource( | ||
| 23 | + '/personnel/validate/:type', | ||
| 24 | + {}, | ||
| 25 | + { | ||
| 26 | + jobCode: { | ||
| 27 | + method: 'GET' | ||
| 28 | + } | ||
| 29 | + } | ||
| 30 | + ), | ||
| 31 | + dataTools: $resource( | ||
| 32 | + '/personnel/:type', | ||
| 33 | + {}, | ||
| 34 | + { | ||
| 35 | + dataExport: { | ||
| 36 | + method: 'GET', | ||
| 37 | + responseType: "arraybuffer", | ||
| 38 | + params: { | ||
| 39 | + type: "dataExport" | ||
| 40 | + }, | ||
| 41 | + transformResponse: function(data, headers){ | ||
| 42 | + return {data : data}; | ||
| 43 | + } | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + ) | ||
| 47 | + }; | ||
| 48 | +}]); |
src/main/resources/static/pages/scheduleApp/module/common/directives/.gitkeep.txt
0 → 100644
src/main/resources/static/pages/scheduleApp/module/common/directives/select/mySelect.js
0 → 100644
| 1 | +/** | ||
| 2 | + * mySelect指令,封装uiselect指令,封装内部数据获取,只支持单选 | ||
| 3 | + * cm(必须):绑定外部对象,因为关联的字段不只一个,单独使用ngModel不够 | ||
| 4 | + * cmoptions(必须):描述绑定的逻辑配置对象,格式如下: | ||
| 5 | + * | ||
| 6 | + * // TODO: | ||
| 7 | + */ | ||
| 8 | +angular.module('ScheduleApp').directive('mySelect', [ | ||
| 9 | + function() { | ||
| 10 | + return { | ||
| 11 | + restrict: 'E', | ||
| 12 | + template: '<div>bioxuxuan</div>', | ||
| 13 | + require: 'ngModel', | ||
| 14 | + compile: function(tElem, tAttrs) { | ||
| 15 | + return { | ||
| 16 | + pre: function(scope, element, attr) { | ||
| 17 | + | ||
| 18 | + }, | ||
| 19 | + post: function(scope, element, attr, ngModelCtr) { | ||
| 20 | + // model -> view | ||
| 21 | + ngModelCtr.$formatters.push(function(modelValue) { | ||
| 22 | + // 监控model的变化 | ||
| 23 | + if (typeof modelValue != "undefined") { | ||
| 24 | + console.log(modelValue); | ||
| 25 | + | ||
| 26 | + return modelValue; | ||
| 27 | + } | ||
| 28 | + }); | ||
| 29 | + | ||
| 30 | + ngModelCtr.$render = function() { | ||
| 31 | + if (typeof scope.ctrl.say != "undefined") { | ||
| 32 | + element.find('div').css('color', 'red'); | ||
| 33 | + } | ||
| 34 | + }; | ||
| 35 | + | ||
| 36 | + ngModelCtr.$setViewValue("init value"); | ||
| 37 | + | ||
| 38 | + | ||
| 39 | + } | ||
| 40 | + } | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | + } | ||
| 44 | +]); | ||
| 0 | \ No newline at end of file | 45 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/common/directives/select/mySelectTemplate.html
0 → 100644
| 1 | +<div class="input-group" name="指令compile阶段设定1" | ||
| 2 | + ng-model="$saSelectCtrl.$$internalmodel"> | ||
| 3 | + <ui-select ng-model="$saSelectCtrl.$$internal_select_value" on-select="$saSelectCtrl.$$internal_select_fn($item)" | ||
| 4 | + theme="bootstrap" > | ||
| 5 | + <ui-select-match placeholder="指令compile阶段设定">指令compile阶段设定2</ui-select-match> | ||
| 6 | + <ui-select-choices repeat="指令compile阶段设定3" | ||
| 7 | + refresh="$saSelectCtrl.$$internal_refresh_fn($select.search)" | ||
| 8 | + refresh-delay="10"> | ||
| 9 | + | ||
| 10 | + 指令compile阶段设定777 | ||
| 11 | + | ||
| 12 | + </ui-select-choices> | ||
| 13 | + </ui-select> | ||
| 14 | + <span class="input-group-btn"> | ||
| 15 | + <button type="button" ng-click="$saSelectCtrl.$$internal_remove_fn()" class="btn btn-default"> | ||
| 16 | + <span class="glyphicon glyphicon-trash"></span> | ||
| 17 | + </button> | ||
| 18 | + </span> | ||
| 19 | +</div> | ||
| 0 | \ No newline at end of file | 20 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/common/dts1/select/saSelect5.js
| @@ -124,23 +124,40 @@ angular.module('ScheduleApp').directive('saSelect5', [ | @@ -124,23 +124,40 @@ angular.module('ScheduleApp').directive('saSelect5', [ | ||
| 124 | 124 | ||
| 125 | // 添加选中事件处理函数 | 125 | // 添加选中事件处理函数 |
| 126 | scope[ctrlAs].$$internal_select_fn = function($item) { | 126 | scope[ctrlAs].$$internal_select_fn = function($item) { |
| 127 | - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";"); | 127 | + if ($dcname_attr.indexOf('_') > 0) { |
| 128 | + scope[ctrlAs].model[$dcname_attr] = $item[$icname_attr]; | ||
| 129 | + } else { | ||
| 130 | + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";"); | ||
| 131 | + } | ||
| 132 | + | ||
| 128 | 133 | ||
| 129 | eval("var obj=" + $cmaps_attr); | 134 | eval("var obj=" + $cmaps_attr); |
| 130 | for (var mc in obj) { // model的字段名:内部数据源对应字段名 | 135 | for (var mc in obj) { // model的字段名:内部数据源对应字段名 |
| 131 | var ic = obj[mc]; // 内部数据源对应字段 | 136 | var ic = obj[mc]; // 内部数据源对应字段 |
| 132 | - eval("scope[ctrlAs].model" + "." + mc + " = $item" + "." + ic + ";"); | 137 | + if (mc.indexOf('_') > 0) { |
| 138 | + scope[ctrlAs].model[mc] = $item[ic]; | ||
| 139 | + } else { | ||
| 140 | + eval("scope[ctrlAs].model" + "." + mc + " = $item" + "." + ic + ";"); | ||
| 141 | + } | ||
| 133 | } | 142 | } |
| 134 | }; | 143 | }; |
| 135 | 144 | ||
| 136 | // 删除选中事件处理函数 | 145 | // 删除选中事件处理函数 |
| 137 | scope[ctrlAs].$$internal_remove_fn = function() { | 146 | scope[ctrlAs].$$internal_remove_fn = function() { |
| 138 | - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;"); | 147 | + if ($dcname_attr.indexOf('_') > 0) { |
| 148 | + scope[ctrlAs].model[$dcname_attr] = undefined; | ||
| 149 | + } else { | ||
| 150 | + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;"); | ||
| 151 | + } | ||
| 139 | 152 | ||
| 140 | eval("var obj=" + $cmaps_attr); | 153 | eval("var obj=" + $cmaps_attr); |
| 141 | var mc; // model的字段名 | 154 | var mc; // model的字段名 |
| 142 | for (mc in obj) { | 155 | for (mc in obj) { |
| 143 | - eval("scope[ctrlAs].model" + "." + mc + " = undefined;"); | 156 | + if (mc.indexOf('_') > 0) { |
| 157 | + scope[ctrlAs].model[mc] = undefined; | ||
| 158 | + } else { | ||
| 159 | + eval("scope[ctrlAs].model" + "." + mc + " = undefined;"); | ||
| 160 | + } | ||
| 144 | } | 161 | } |
| 145 | }; | 162 | }; |
| 146 | 163 | ||
| @@ -381,7 +398,11 @@ angular.module('ScheduleApp').directive('saSelect5', [ | @@ -381,7 +398,11 @@ angular.module('ScheduleApp').directive('saSelect5', [ | ||
| 381 | */ | 398 | */ |
| 382 | scope.$watch( | 399 | scope.$watch( |
| 383 | function() { | 400 | function() { |
| 384 | - return eval("scope." + ctrlAs + ".model" + "." + $dcname_attr); | 401 | + if ($dcname_attr.indexOf('_') > 0) { |
| 402 | + return scope[ctrlAs].model[$dcname_attr]; | ||
| 403 | + } else { | ||
| 404 | + return eval("scope." + ctrlAs + ".model" + "." + $dcname_attr); | ||
| 405 | + } | ||
| 385 | }, | 406 | }, |
| 386 | function(newValue, oldValue) { | 407 | function(newValue, oldValue) { |
| 387 | if (newValue === undefined && oldValue === undefined) { | 408 | if (newValue === undefined && oldValue === undefined) { |
src/main/resources/static/pages/scheduleApp/module/common/dts1/validation/remoteValidation.js
| @@ -27,7 +27,7 @@ angular.module('ScheduleApp').directive('remoteValidation', [ | @@ -27,7 +27,7 @@ angular.module('ScheduleApp').directive('remoteValidation', [ | ||
| 27 | var $watch_rvparam_obj = undefined; | 27 | var $watch_rvparam_obj = undefined; |
| 28 | 28 | ||
| 29 | // 验证数据 | 29 | // 验证数据 |
| 30 | - var $$internal_validate = function(ngModelCtrl) { | 30 | + var $$internal_validate = function(ngModelCtrl, scope) { |
| 31 | if ($watch_rvtype && $watch_rvparam_obj) { | 31 | if ($watch_rvtype && $watch_rvparam_obj) { |
| 32 | // 获取查询参数模版 | 32 | // 获取查询参数模版 |
| 33 | var paramTemplate = $$SearchInfoService_g.validate[$watch_rvtype].template; | 33 | var paramTemplate = $$SearchInfoService_g.validate[$watch_rvtype].template; |
| @@ -52,6 +52,7 @@ angular.module('ScheduleApp').directive('remoteValidation', [ | @@ -52,6 +52,7 @@ angular.module('ScheduleApp').directive('remoteValidation', [ | ||
| 52 | ngModelCtrl.$setValidity('remote', true); | 52 | ngModelCtrl.$setValidity('remote', true); |
| 53 | } else { | 53 | } else { |
| 54 | ngModelCtrl.$setValidity('remote', false); | 54 | ngModelCtrl.$setValidity('remote', false); |
| 55 | + scope.$remote_msg = result.msg; | ||
| 55 | } | 56 | } |
| 56 | }, | 57 | }, |
| 57 | function(result) { | 58 | function(result) { |
| @@ -74,7 +75,7 @@ angular.module('ScheduleApp').directive('remoteValidation', [ | @@ -74,7 +75,7 @@ angular.module('ScheduleApp').directive('remoteValidation', [ | ||
| 74 | attr.$observe("remotevtype", function(value) { | 75 | attr.$observe("remotevtype", function(value) { |
| 75 | if (value && value != "") { | 76 | if (value && value != "") { |
| 76 | $watch_rvtype = value; | 77 | $watch_rvtype = value; |
| 77 | - $$internal_validate(ngModelCtrl); | 78 | + $$internal_validate(ngModelCtrl, scope); |
| 78 | } | 79 | } |
| 79 | }); | 80 | }); |
| 80 | /** | 81 | /** |
| @@ -86,7 +87,7 @@ angular.module('ScheduleApp').directive('remoteValidation', [ | @@ -86,7 +87,7 @@ angular.module('ScheduleApp').directive('remoteValidation', [ | ||
| 86 | return; | 87 | return; |
| 87 | } | 88 | } |
| 88 | $watch_rvparam_obj = JSON.parse(value); | 89 | $watch_rvparam_obj = JSON.parse(value); |
| 89 | - $$internal_validate(ngModelCtrl); | 90 | + $$internal_validate(ngModelCtrl, scope); |
| 90 | } | 91 | } |
| 91 | }); | 92 | }); |
| 92 | } | 93 | } |
src/main/resources/static/pages/scheduleApp/module/common/dts1/validation/remoteValidation3.js
0 → 100644
| 1 | +/** | ||
| 2 | + * remoteValidationt3 远程验证指令(监控依赖的model变化) | ||
| 3 | + * 属性如下: | ||
| 4 | + * remotevtype(必须):验证类型(在service中有对应映射),如rvtype="xl" | ||
| 5 | + * remotemodel(必须):关联的model | ||
| 6 | + * remotemodelcol(必须):关联的model属性 | ||
| 7 | + */ | ||
| 8 | +angular.module('ScheduleApp').directive( | ||
| 9 | + 'remoteValidation3', | ||
| 10 | + [ | ||
| 11 | + '$$SearchInfoService_g', | ||
| 12 | + '$q', | ||
| 13 | + function($$SearchInfoService_g, $q) { | ||
| 14 | + return { | ||
| 15 | + restrict: 'A', // 属性 | ||
| 16 | + require: '^ngModel', // 依赖所属指令的ngModel | ||
| 17 | + compile: function(tElem, tAttrs) { | ||
| 18 | + var remotevtype_attr = tAttrs['remotevtype']; | ||
| 19 | + var remotemodel_attr = tAttrs['remotemodel']; | ||
| 20 | + var remotemodelcol_attr = tAttrs['remotemodelcol']; | ||
| 21 | + if (!remotevtype_attr) { | ||
| 22 | + throw new Error("remotevtype属性必须填写"); | ||
| 23 | + } | ||
| 24 | + if (!remotemodel_attr) { | ||
| 25 | + throw new Error("remotemodel属性必须填写"); | ||
| 26 | + } | ||
| 27 | + if (!remotemodelcol_attr) { | ||
| 28 | + throw new Error("remotemodelcol属性必须填写"); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + return { | ||
| 32 | + pre: function(scope, element, attr) { | ||
| 33 | + | ||
| 34 | + }, | ||
| 35 | + | ||
| 36 | + post: function(scope, element, attr, ngModelCtrl) { | ||
| 37 | + ngModelCtrl.$asyncValidators.remote = | ||
| 38 | + function(modelValue, viewValue) { | ||
| 39 | + var deferred = $q.defer(); | ||
| 40 | + | ||
| 41 | + // 远端验证service | ||
| 42 | + var param = JSON.parse(attr['remotemodel']); | ||
| 43 | + console.log(param); | ||
| 44 | + param[remotemodelcol_attr] = modelValue; | ||
| 45 | + $$SearchInfoService_g.validate[remotevtype_attr].remote.do( | ||
| 46 | + param, | ||
| 47 | + function(result) { | ||
| 48 | + if (result.status == "SUCCESS") { | ||
| 49 | + deferred.resolve(); | ||
| 50 | + } else { | ||
| 51 | + scope.$remote_msg = result.msg; | ||
| 52 | + deferred.reject(); | ||
| 53 | + } | ||
| 54 | + }, | ||
| 55 | + function(result) { | ||
| 56 | + deferred.reject(); | ||
| 57 | + } | ||
| 58 | + ); | ||
| 59 | + | ||
| 60 | + return deferred.promise; | ||
| 61 | + }; | ||
| 62 | + } | ||
| 63 | + }; | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | + } | ||
| 67 | + ] | ||
| 68 | +); | ||
| 0 | \ No newline at end of file | 69 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/common/dts2/ttinfotable/mySelect.js
0 → 100644
| 1 | +/** | ||
| 2 | + * mySelect指令,封装uiselect指令,封装内部数据获取,只支持单选 | ||
| 3 | + * cm(必须):绑定外部对象,因为关联的字段不只一个,单独使用ngModel不够 | ||
| 4 | + * cmoptions(必须):描述绑定的逻辑配置对象,格式如下: | ||
| 5 | + * | ||
| 6 | + * // TODO: | ||
| 7 | + */ | ||
| 8 | +angular.module('ScheduleApp').directive('mySelect', [ | ||
| 9 | + function() { | ||
| 10 | + return { | ||
| 11 | + restrict: 'E', | ||
| 12 | + template: '<div>bioxuxuan</div>', | ||
| 13 | + require: 'ngModel', | ||
| 14 | + compile: function(tElem, tAttrs) { | ||
| 15 | + return { | ||
| 16 | + pre: function(scope, element, attr) { | ||
| 17 | + | ||
| 18 | + }, | ||
| 19 | + post: function(scope, element, attr, ngModelCtr) { | ||
| 20 | + // model -> view | ||
| 21 | + ngModelCtr.$formatters.push(function(modelValue) { | ||
| 22 | + // 监控model的变化 | ||
| 23 | + if (typeof modelValue != "undefined") { | ||
| 24 | + console.log(modelValue); | ||
| 25 | + | ||
| 26 | + return modelValue; | ||
| 27 | + } | ||
| 28 | + }); | ||
| 29 | + | ||
| 30 | + ngModelCtr.$render = function() { | ||
| 31 | + if (typeof scope.ctrl.say != "undefined") { | ||
| 32 | + element.find('div').css('color', 'red'); | ||
| 33 | + } | ||
| 34 | + }; | ||
| 35 | + | ||
| 36 | + ngModelCtr.$setViewValue("init value"); | ||
| 37 | + | ||
| 38 | + | ||
| 39 | + } | ||
| 40 | + } | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | + } | ||
| 44 | +]); | ||
| 0 | \ No newline at end of file | 45 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/common/dts2/ttinfotable/mySelectTemplate.html
0 → 100644
| 1 | +<div class="input-group" name="指令compile阶段设定1" | ||
| 2 | + ng-model="$saSelectCtrl.$$internalmodel"> | ||
| 3 | + <ui-select ng-model="$saSelectCtrl.$$internal_select_value" on-select="$saSelectCtrl.$$internal_select_fn($item)" | ||
| 4 | + theme="bootstrap" > | ||
| 5 | + <ui-select-match placeholder="指令compile阶段设定">指令compile阶段设定2</ui-select-match> | ||
| 6 | + <ui-select-choices repeat="指令compile阶段设定3" | ||
| 7 | + refresh="$saSelectCtrl.$$internal_refresh_fn($select.search)" | ||
| 8 | + refresh-delay="10"> | ||
| 9 | + | ||
| 10 | + 指令compile阶段设定777 | ||
| 11 | + | ||
| 12 | + </ui-select-choices> | ||
| 13 | + </ui-select> | ||
| 14 | + <span class="input-group-btn"> | ||
| 15 | + <button type="button" ng-click="$saSelectCtrl.$$internal_remove_fn()" class="btn btn-default"> | ||
| 16 | + <span class="glyphicon glyphicon-trash"></span> | ||
| 17 | + </button> | ||
| 18 | + </span> | ||
| 19 | +</div> | ||
| 0 | \ No newline at end of file | 20 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/common/main.js
| @@ -76,13 +76,26 @@ ScheduleApp.factory( | @@ -76,13 +76,26 @@ ScheduleApp.factory( | ||
| 76 | }, | 76 | }, |
| 77 | requestError: function(rejection) { | 77 | requestError: function(rejection) { |
| 78 | requestNotificationChannel.requestEnded(); | 78 | requestNotificationChannel.requestEnded(); |
| 79 | - alert("服务端无响应"); | ||
| 80 | return rejection; | 79 | return rejection; |
| 81 | }, | 80 | }, |
| 82 | response: function(response) { | 81 | response: function(response) { |
| 83 | requestNotificationChannel.requestEnded(); | 82 | requestNotificationChannel.requestEnded(); |
| 84 | 83 | ||
| 85 | - return response; | 84 | + var data = response.data; |
| 85 | + var output = []; | ||
| 86 | + if (data.status == '407') { | ||
| 87 | + alert("请重新登录!"); | ||
| 88 | + return $q.reject(response); | ||
| 89 | + } else if (data.status == '500') { | ||
| 90 | + output.push("状态编码:" + data.status); | ||
| 91 | + output.push("访问路径:" + data.path); | ||
| 92 | + output.push("错误消息:" + data.message); | ||
| 93 | + alert("服务端错误:" + "\n" + output.join("\n")); | ||
| 94 | + return $q.reject(response); | ||
| 95 | + } else { | ||
| 96 | + return response; | ||
| 97 | + } | ||
| 98 | + | ||
| 86 | }, | 99 | }, |
| 87 | responseError: function(rejection) { | 100 | responseError: function(rejection) { |
| 88 | requestNotificationChannel.requestEnded(); | 101 | requestNotificationChannel.requestEnded(); |
| @@ -90,25 +103,23 @@ ScheduleApp.factory( | @@ -90,25 +103,23 @@ ScheduleApp.factory( | ||
| 90 | // 处理错误,springboot会包装返回的错误数据 | 103 | // 处理错误,springboot会包装返回的错误数据 |
| 91 | // 如:{"timestamp":1478674739246,"status":500,"error":"Internal Server Error","exception":"java.lang.ClassCastException","message":"java.lang.String cannot be cast to java.lang.Long","path":"/tidc/importfile"} | 104 | // 如:{"timestamp":1478674739246,"status":500,"error":"Internal Server Error","exception":"java.lang.ClassCastException","message":"java.lang.String cannot be cast to java.lang.Long","path":"/tidc/importfile"} |
| 92 | 105 | ||
| 93 | - var status = rejection.status; | ||
| 94 | - var path = rejection.data.path; | ||
| 95 | - var message = rejection.data.message; | ||
| 96 | var output = []; | 106 | var output = []; |
| 97 | - output.push("状态编码:" + status); | ||
| 98 | - output.push("访问路径:" + path); | ||
| 99 | - output.push("错误消息:" + message); | ||
| 100 | - if (status) { | 107 | + if (!status) { |
| 108 | + alert("我擦,后台返回连个状态码都没返回,见鬼了,服务器可能重启了"); | ||
| 109 | + } else if (status == -1) { | ||
| 110 | + // 服务器断开了 | ||
| 111 | + alert("貌似服务端连接不上"); | ||
| 112 | + } else { | ||
| 113 | + output.push("状态编码:" + status); | ||
| 114 | + output.push("访问路径:" + rejection.path); | ||
| 115 | + output.push("错误消息:" + rejection.message); | ||
| 101 | if (status == 500) { | 116 | if (status == 500) { |
| 102 | alert("服务端错误:" + "\n" + output.join("\n")); | 117 | alert("服务端错误:" + "\n" + output.join("\n")); |
| 103 | } else if (status == 407) { | 118 | } else if (status == 407) { |
| 104 | alert("请重新登录:" + "\n" + output.join("\n")); | 119 | alert("请重新登录:" + "\n" + output.join("\n")); |
| 105 | - } else if (status == -1) { | ||
| 106 | - alert("貌似服务端连接不上"); | ||
| 107 | } else { | 120 | } else { |
| 108 | alert("其他错误:" + "\n" + output.join("\n")); | 121 | alert("其他错误:" + "\n" + output.join("\n")); |
| 109 | } | 122 | } |
| 110 | - } else { | ||
| 111 | - alert("我擦,后台返回连个状态码都没返回,见鬼了!"); | ||
| 112 | } | 123 | } |
| 113 | 124 | ||
| 114 | return $q.reject(rejection); | 125 | return $q.reject(rejection); |
src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
| @@ -49,7 +49,7 @@ angular.module('ScheduleApp').directive('remoteValidation', [ | @@ -49,7 +49,7 @@ angular.module('ScheduleApp').directive('remoteValidation', [ | ||
| 49 | var $watch_rvparam_obj = undefined; | 49 | var $watch_rvparam_obj = undefined; |
| 50 | 50 | ||
| 51 | // 验证数据 | 51 | // 验证数据 |
| 52 | - var $$internal_validate = function(ngModelCtrl) { | 52 | + var $$internal_validate = function(ngModelCtrl, scope) { |
| 53 | if ($watch_rvtype && $watch_rvparam_obj) { | 53 | if ($watch_rvtype && $watch_rvparam_obj) { |
| 54 | // 获取查询参数模版 | 54 | // 获取查询参数模版 |
| 55 | var paramTemplate = $$SearchInfoService_g.validate[$watch_rvtype].template; | 55 | var paramTemplate = $$SearchInfoService_g.validate[$watch_rvtype].template; |
| @@ -74,6 +74,7 @@ angular.module('ScheduleApp').directive('remoteValidation', [ | @@ -74,6 +74,7 @@ angular.module('ScheduleApp').directive('remoteValidation', [ | ||
| 74 | ngModelCtrl.$setValidity('remote', true); | 74 | ngModelCtrl.$setValidity('remote', true); |
| 75 | } else { | 75 | } else { |
| 76 | ngModelCtrl.$setValidity('remote', false); | 76 | ngModelCtrl.$setValidity('remote', false); |
| 77 | + scope.$remote_msg = result.msg; | ||
| 77 | } | 78 | } |
| 78 | }, | 79 | }, |
| 79 | function(result) { | 80 | function(result) { |
| @@ -96,7 +97,7 @@ angular.module('ScheduleApp').directive('remoteValidation', [ | @@ -96,7 +97,7 @@ angular.module('ScheduleApp').directive('remoteValidation', [ | ||
| 96 | attr.$observe("remotevtype", function(value) { | 97 | attr.$observe("remotevtype", function(value) { |
| 97 | if (value && value != "") { | 98 | if (value && value != "") { |
| 98 | $watch_rvtype = value; | 99 | $watch_rvtype = value; |
| 99 | - $$internal_validate(ngModelCtrl); | 100 | + $$internal_validate(ngModelCtrl, scope); |
| 100 | } | 101 | } |
| 101 | }); | 102 | }); |
| 102 | /** | 103 | /** |
| @@ -108,7 +109,7 @@ angular.module('ScheduleApp').directive('remoteValidation', [ | @@ -108,7 +109,7 @@ angular.module('ScheduleApp').directive('remoteValidation', [ | ||
| 108 | return; | 109 | return; |
| 109 | } | 110 | } |
| 110 | $watch_rvparam_obj = JSON.parse(value); | 111 | $watch_rvparam_obj = JSON.parse(value); |
| 111 | - $$internal_validate(ngModelCtrl); | 112 | + $$internal_validate(ngModelCtrl, scope); |
| 112 | } | 113 | } |
| 113 | }); | 114 | }); |
| 114 | } | 115 | } |
| @@ -218,6 +219,74 @@ angular.module('ScheduleApp').directive('remoteValidationt2', [ | @@ -218,6 +219,74 @@ angular.module('ScheduleApp').directive('remoteValidationt2', [ | ||
| 218 | } | 219 | } |
| 219 | ]); | 220 | ]); |
| 220 | 221 | ||
| 222 | +/** | ||
| 223 | + * remoteValidationt3 远程验证指令(监控依赖的model变化) | ||
| 224 | + * 属性如下: | ||
| 225 | + * remotevtype(必须):验证类型(在service中有对应映射),如rvtype="xl" | ||
| 226 | + * remotemodel(必须):关联的model | ||
| 227 | + * remotemodelcol(必须):关联的model属性 | ||
| 228 | + */ | ||
| 229 | +angular.module('ScheduleApp').directive( | ||
| 230 | + 'remoteValidation3', | ||
| 231 | + [ | ||
| 232 | + '$$SearchInfoService_g', | ||
| 233 | + '$q', | ||
| 234 | + function($$SearchInfoService_g, $q) { | ||
| 235 | + return { | ||
| 236 | + restrict: 'A', // 属性 | ||
| 237 | + require: '^ngModel', // 依赖所属指令的ngModel | ||
| 238 | + compile: function(tElem, tAttrs) { | ||
| 239 | + var remotevtype_attr = tAttrs['remotevtype']; | ||
| 240 | + var remotemodel_attr = tAttrs['remotemodel']; | ||
| 241 | + var remotemodelcol_attr = tAttrs['remotemodelcol']; | ||
| 242 | + if (!remotevtype_attr) { | ||
| 243 | + throw new Error("remotevtype属性必须填写"); | ||
| 244 | + } | ||
| 245 | + if (!remotemodel_attr) { | ||
| 246 | + throw new Error("remotemodel属性必须填写"); | ||
| 247 | + } | ||
| 248 | + if (!remotemodelcol_attr) { | ||
| 249 | + throw new Error("remotemodelcol属性必须填写"); | ||
| 250 | + } | ||
| 251 | + | ||
| 252 | + return { | ||
| 253 | + pre: function(scope, element, attr) { | ||
| 254 | + | ||
| 255 | + }, | ||
| 256 | + | ||
| 257 | + post: function(scope, element, attr, ngModelCtrl) { | ||
| 258 | + ngModelCtrl.$asyncValidators.remote = | ||
| 259 | + function(modelValue, viewValue) { | ||
| 260 | + var deferred = $q.defer(); | ||
| 261 | + | ||
| 262 | + // 远端验证service | ||
| 263 | + var param = JSON.parse(attr['remotemodel']); | ||
| 264 | + console.log(param); | ||
| 265 | + param[remotemodelcol_attr] = modelValue; | ||
| 266 | + $$SearchInfoService_g.validate[remotevtype_attr].remote.do( | ||
| 267 | + param, | ||
| 268 | + function(result) { | ||
| 269 | + if (result.status == "SUCCESS") { | ||
| 270 | + deferred.resolve(); | ||
| 271 | + } else { | ||
| 272 | + scope.$remote_msg = result.msg; | ||
| 273 | + deferred.reject(); | ||
| 274 | + } | ||
| 275 | + }, | ||
| 276 | + function(result) { | ||
| 277 | + deferred.reject(); | ||
| 278 | + } | ||
| 279 | + ); | ||
| 280 | + | ||
| 281 | + return deferred.promise; | ||
| 282 | + }; | ||
| 283 | + } | ||
| 284 | + }; | ||
| 285 | + } | ||
| 286 | + } | ||
| 287 | + } | ||
| 288 | + ] | ||
| 289 | +); | ||
| 221 | 290 | ||
| 222 | angular.module('ScheduleApp').directive("saSelect", ['$timeout', function($timeout) { | 291 | angular.module('ScheduleApp').directive("saSelect", ['$timeout', function($timeout) { |
| 223 | return { | 292 | return { |
| @@ -1331,23 +1400,40 @@ angular.module('ScheduleApp').directive('saSelect5', [ | @@ -1331,23 +1400,40 @@ angular.module('ScheduleApp').directive('saSelect5', [ | ||
| 1331 | 1400 | ||
| 1332 | // 添加选中事件处理函数 | 1401 | // 添加选中事件处理函数 |
| 1333 | scope[ctrlAs].$$internal_select_fn = function($item) { | 1402 | scope[ctrlAs].$$internal_select_fn = function($item) { |
| 1334 | - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";"); | 1403 | + if ($dcname_attr.indexOf('_') > 0) { |
| 1404 | + scope[ctrlAs].model[$dcname_attr] = $item[$icname_attr]; | ||
| 1405 | + } else { | ||
| 1406 | + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = $item" + "." + $icname_attr + ";"); | ||
| 1407 | + } | ||
| 1408 | + | ||
| 1335 | 1409 | ||
| 1336 | eval("var obj=" + $cmaps_attr); | 1410 | eval("var obj=" + $cmaps_attr); |
| 1337 | for (var mc in obj) { // model的字段名:内部数据源对应字段名 | 1411 | for (var mc in obj) { // model的字段名:内部数据源对应字段名 |
| 1338 | var ic = obj[mc]; // 内部数据源对应字段 | 1412 | var ic = obj[mc]; // 内部数据源对应字段 |
| 1339 | - eval("scope[ctrlAs].model" + "." + mc + " = $item" + "." + ic + ";"); | 1413 | + if (mc.indexOf('_') > 0) { |
| 1414 | + scope[ctrlAs].model[mc] = $item[ic]; | ||
| 1415 | + } else { | ||
| 1416 | + eval("scope[ctrlAs].model" + "." + mc + " = $item" + "." + ic + ";"); | ||
| 1417 | + } | ||
| 1340 | } | 1418 | } |
| 1341 | }; | 1419 | }; |
| 1342 | 1420 | ||
| 1343 | // 删除选中事件处理函数 | 1421 | // 删除选中事件处理函数 |
| 1344 | scope[ctrlAs].$$internal_remove_fn = function() { | 1422 | scope[ctrlAs].$$internal_remove_fn = function() { |
| 1345 | - eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;"); | 1423 | + if ($dcname_attr.indexOf('_') > 0) { |
| 1424 | + scope[ctrlAs].model[$dcname_attr] = undefined; | ||
| 1425 | + } else { | ||
| 1426 | + eval("scope[ctrlAs].model" + "." + $dcname_attr + " = undefined;"); | ||
| 1427 | + } | ||
| 1346 | 1428 | ||
| 1347 | eval("var obj=" + $cmaps_attr); | 1429 | eval("var obj=" + $cmaps_attr); |
| 1348 | var mc; // model的字段名 | 1430 | var mc; // model的字段名 |
| 1349 | for (mc in obj) { | 1431 | for (mc in obj) { |
| 1350 | - eval("scope[ctrlAs].model" + "." + mc + " = undefined;"); | 1432 | + if (mc.indexOf('_') > 0) { |
| 1433 | + scope[ctrlAs].model[mc] = undefined; | ||
| 1434 | + } else { | ||
| 1435 | + eval("scope[ctrlAs].model" + "." + mc + " = undefined;"); | ||
| 1436 | + } | ||
| 1351 | } | 1437 | } |
| 1352 | }; | 1438 | }; |
| 1353 | 1439 | ||
| @@ -1588,7 +1674,11 @@ angular.module('ScheduleApp').directive('saSelect5', [ | @@ -1588,7 +1674,11 @@ angular.module('ScheduleApp').directive('saSelect5', [ | ||
| 1588 | */ | 1674 | */ |
| 1589 | scope.$watch( | 1675 | scope.$watch( |
| 1590 | function() { | 1676 | function() { |
| 1591 | - return eval("scope." + ctrlAs + ".model" + "." + $dcname_attr); | 1677 | + if ($dcname_attr.indexOf('_') > 0) { |
| 1678 | + return scope[ctrlAs].model[$dcname_attr]; | ||
| 1679 | + } else { | ||
| 1680 | + return eval("scope." + ctrlAs + ".model" + "." + $dcname_attr); | ||
| 1681 | + } | ||
| 1592 | }, | 1682 | }, |
| 1593 | function(newValue, oldValue) { | 1683 | function(newValue, oldValue) { |
| 1594 | if (newValue === undefined && oldValue === undefined) { | 1684 | if (newValue === undefined && oldValue === undefined) { |
| @@ -1608,6 +1698,50 @@ angular.module('ScheduleApp').directive('saSelect5', [ | @@ -1608,6 +1698,50 @@ angular.module('ScheduleApp').directive('saSelect5', [ | ||
| 1608 | }; | 1698 | }; |
| 1609 | } | 1699 | } |
| 1610 | ]); | 1700 | ]); |
| 1701 | +/** | ||
| 1702 | + * mySelect指令,封装uiselect指令,封装内部数据获取,只支持单选 | ||
| 1703 | + * cm(必须):绑定外部对象,因为关联的字段不只一个,单独使用ngModel不够 | ||
| 1704 | + * cmoptions(必须):描述绑定的逻辑配置对象,格式如下: | ||
| 1705 | + * | ||
| 1706 | + * // TODO: | ||
| 1707 | + */ | ||
| 1708 | +angular.module('ScheduleApp').directive('mySelect', [ | ||
| 1709 | + function() { | ||
| 1710 | + return { | ||
| 1711 | + restrict: 'E', | ||
| 1712 | + template: '<div>bioxuxuan</div>', | ||
| 1713 | + require: 'ngModel', | ||
| 1714 | + compile: function(tElem, tAttrs) { | ||
| 1715 | + return { | ||
| 1716 | + pre: function(scope, element, attr) { | ||
| 1717 | + | ||
| 1718 | + }, | ||
| 1719 | + post: function(scope, element, attr, ngModelCtr) { | ||
| 1720 | + // model -> view | ||
| 1721 | + ngModelCtr.$formatters.push(function(modelValue) { | ||
| 1722 | + // 监控model的变化 | ||
| 1723 | + if (typeof modelValue != "undefined") { | ||
| 1724 | + console.log(modelValue); | ||
| 1725 | + | ||
| 1726 | + return modelValue; | ||
| 1727 | + } | ||
| 1728 | + }); | ||
| 1729 | + | ||
| 1730 | + ngModelCtr.$render = function() { | ||
| 1731 | + if (typeof scope.ctrl.say != "undefined") { | ||
| 1732 | + element.find('div').css('color', 'red'); | ||
| 1733 | + } | ||
| 1734 | + }; | ||
| 1735 | + | ||
| 1736 | + ngModelCtr.$setViewValue("init value"); | ||
| 1737 | + | ||
| 1738 | + | ||
| 1739 | + } | ||
| 1740 | + } | ||
| 1741 | + } | ||
| 1742 | + } | ||
| 1743 | + } | ||
| 1744 | +]); | ||
| 1611 | 1745 | ||
| 1612 | /** | 1746 | /** |
| 1613 | * saRadiogroup指令 | 1747 | * saRadiogroup指令 |
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice-legacy.js
0 → 100644
| 1 | +// 项目通用的全局service服务,供不同的controller使用,自定义指令不使用 | ||
| 2 | + | ||
| 3 | +// 文件下载服务 | ||
| 4 | +angular.module('ScheduleApp').factory('FileDownload_g', function() { | ||
| 5 | + return { | ||
| 6 | + downloadFile: function (data, mimeType, fileName) { | ||
| 7 | + var success = false; | ||
| 8 | + var blob = new Blob([data], { type: mimeType }); | ||
| 9 | + try { | ||
| 10 | + if (navigator.msSaveBlob) | ||
| 11 | + navigator.msSaveBlob(blob, fileName); | ||
| 12 | + else { | ||
| 13 | + // Try using other saveBlob implementations, if available | ||
| 14 | + var saveBlob = navigator.webkitSaveBlob || navigator.mozSaveBlob || navigator.saveBlob; | ||
| 15 | + if (saveBlob === undefined) throw "Not supported"; | ||
| 16 | + saveBlob(blob, fileName); | ||
| 17 | + } | ||
| 18 | + success = true; | ||
| 19 | + } catch (ex) { | ||
| 20 | + console.log("saveBlob method failed with the following exception:"); | ||
| 21 | + console.log(ex); | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + if (!success) { | ||
| 25 | + // Get the blob url creator | ||
| 26 | + var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL; | ||
| 27 | + if (urlCreator) { | ||
| 28 | + // Try to use a download link | ||
| 29 | + var link = document.createElement('a'); | ||
| 30 | + if ('download' in link) { | ||
| 31 | + // Try to simulate a click | ||
| 32 | + try { | ||
| 33 | + // Prepare a blob URL | ||
| 34 | + var url = urlCreator.createObjectURL(blob); | ||
| 35 | + link.setAttribute('href', url); | ||
| 36 | + | ||
| 37 | + // Set the download attribute (Supported in Chrome 14+ / Firefox 20+) | ||
| 38 | + link.setAttribute("download", fileName); | ||
| 39 | + | ||
| 40 | + // Simulate clicking the download link | ||
| 41 | + var event = document.createEvent('MouseEvents'); | ||
| 42 | + event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null); | ||
| 43 | + link.dispatchEvent(event); | ||
| 44 | + success = true; | ||
| 45 | + | ||
| 46 | + } catch (ex) { | ||
| 47 | + console.log("Download link method with simulated click failed with the following exception:"); | ||
| 48 | + console.log(ex); | ||
| 49 | + } | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + if (!success) { | ||
| 53 | + // Fallback to window.location method | ||
| 54 | + try { | ||
| 55 | + // Prepare a blob URL | ||
| 56 | + // Use application/octet-stream when using window.location to force download | ||
| 57 | + var url = urlCreator.createObjectURL(blob); | ||
| 58 | + window.location = url; | ||
| 59 | + console.log("Download link method with window.location succeeded"); | ||
| 60 | + success = true; | ||
| 61 | + } catch (ex) { | ||
| 62 | + console.log("Download link method with window.location failed with the following exception:"); | ||
| 63 | + console.log(ex); | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | + } | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + if (!success) { | ||
| 70 | + // Fallback to window.open method | ||
| 71 | + console.log("No methods worked for saving the arraybuffer, using last resort window.open"); | ||
| 72 | + window.open("", '_blank', ''); | ||
| 73 | + } | ||
| 74 | + } | ||
| 75 | + }; | ||
| 76 | +}); | ||
| 77 | + | ||
| 78 | + | ||
| 79 | +/** | ||
| 80 | + * saSelect2指令,根据属性值,动态载入数据,然后支持拼音搜索,点击右边的按钮清除选择并重新载入数据。 | ||
| 81 | + * 1、compile阶段使用的属性如下: | ||
| 82 | + * required:用于和表单验证连接,指定成required="true"才有效。 | ||
| 83 | + * 2、link阶段使用的属性如下 | ||
| 84 | + * model:关联的模型对象 | ||
| 85 | + * name:表单验证时需要的名字 | ||
| 86 | + * type:关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加 | ||
| 87 | + * modelcolname1:关联的模型字段名字1(一般应该是编码字段) | ||
| 88 | + * modelcolname2:关联的模型字段名字2(一般应该是名字字段) | ||
| 89 | + * datacolname1;内部数据对应的字段名字1(与模型字段1对应) | ||
| 90 | + * datacolname2:内部数据对应的字段名字2(与模型字段2对应) | ||
| 91 | + * showcolname:下拉框显示的内部数据字段名(注意:不是模型数据字段名),TODO:以后考虑放动态表达式,并在compile阶段使用 | ||
| 92 | + * placeholder:select placeholder字符串描述 | ||
| 93 | + * | ||
| 94 | + * $$pyFilter,内部的filter指令,结合简拼音进行拼音过滤。 | ||
| 95 | + * $$SearchInfoService_g,内部使用的数据服务 | ||
| 96 | + */ | ||
| 97 | +// saSelect2指令使用的内部信service | ||
| 98 | +angular.module('ScheduleApp').factory('$$SearchInfoService_g', ['$resource', function($resource) { | ||
| 99 | + return { | ||
| 100 | + xl: $resource( | ||
| 101 | + '/line/:type', | ||
| 102 | + {order: 'name', direction: 'ASC'}, | ||
| 103 | + { | ||
| 104 | + list: { | ||
| 105 | + method: 'GET', | ||
| 106 | + isArray: true | ||
| 107 | + } | ||
| 108 | + } | ||
| 109 | + ), | ||
| 110 | + xlinfo: $resource( | ||
| 111 | + '/lineInformation/:type', | ||
| 112 | + {order: 'line.name', direction: 'ASC'}, | ||
| 113 | + { | ||
| 114 | + list: { | ||
| 115 | + method: 'GET', | ||
| 116 | + isArray: true | ||
| 117 | + } | ||
| 118 | + } | ||
| 119 | + ), | ||
| 120 | + zd: $resource( | ||
| 121 | + '/stationroute/stations', | ||
| 122 | + {order: 'stationCode', direction: 'ASC'}, | ||
| 123 | + { | ||
| 124 | + list: { | ||
| 125 | + method: 'GET', | ||
| 126 | + isArray: true | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + ), | ||
| 130 | + tcc: $resource( | ||
| 131 | + '/carpark/:type', | ||
| 132 | + {order: 'parkCode', direction: 'ASC'}, | ||
| 133 | + { | ||
| 134 | + list: { | ||
| 135 | + method: 'GET', | ||
| 136 | + isArray: true | ||
| 137 | + } | ||
| 138 | + } | ||
| 139 | + ), | ||
| 140 | + ry: $resource( | ||
| 141 | + '/personnel/:type', | ||
| 142 | + {order: 'personnelName', direction: 'ASC'}, | ||
| 143 | + { | ||
| 144 | + list: { | ||
| 145 | + method: 'GET', | ||
| 146 | + isArray: true | ||
| 147 | + } | ||
| 148 | + } | ||
| 149 | + ), | ||
| 150 | + cl: $resource( | ||
| 151 | + '/cars/:type', | ||
| 152 | + {order: "insideCode", direction: 'ASC'}, | ||
| 153 | + { | ||
| 154 | + list: { | ||
| 155 | + method: 'GET', | ||
| 156 | + isArray: true | ||
| 157 | + } | ||
| 158 | + } | ||
| 159 | + ), | ||
| 160 | + ttInfo: $resource( | ||
| 161 | + '/tic/:type', | ||
| 162 | + {order: "name", direction: 'ASC'}, | ||
| 163 | + { | ||
| 164 | + list: { | ||
| 165 | + method: 'GET', | ||
| 166 | + isArray: true | ||
| 167 | + } | ||
| 168 | + } | ||
| 169 | + ), | ||
| 170 | + lpInfo: $resource( | ||
| 171 | + '/gic/ttlpnames', | ||
| 172 | + {order: "lpName", direction: 'ASC'}, | ||
| 173 | + { | ||
| 174 | + list: { | ||
| 175 | + method: 'GET', | ||
| 176 | + isArray: true | ||
| 177 | + } | ||
| 178 | + } | ||
| 179 | + ), | ||
| 180 | + lpInfo2: $resource( | ||
| 181 | + '/gic/:type', | ||
| 182 | + {order: "lpName", direction: 'ASC'}, | ||
| 183 | + { | ||
| 184 | + list: { | ||
| 185 | + method: 'GET', | ||
| 186 | + isArray: true | ||
| 187 | + } | ||
| 188 | + } | ||
| 189 | + ), | ||
| 190 | + cci: $resource( | ||
| 191 | + '/cci/cars', | ||
| 192 | + {}, | ||
| 193 | + { | ||
| 194 | + list: { | ||
| 195 | + method: 'GET', | ||
| 196 | + isArray: true | ||
| 197 | + } | ||
| 198 | + } | ||
| 199 | + | ||
| 200 | + ), | ||
| 201 | + cci2: $resource( | ||
| 202 | + '/cci/:type', | ||
| 203 | + {}, | ||
| 204 | + { | ||
| 205 | + list: { | ||
| 206 | + method: 'GET', | ||
| 207 | + isArray: true | ||
| 208 | + } | ||
| 209 | + } | ||
| 210 | + ), | ||
| 211 | + cci3: $resource( | ||
| 212 | + '/cci/cars2', | ||
| 213 | + {}, | ||
| 214 | + { | ||
| 215 | + list: { | ||
| 216 | + method: 'GET', | ||
| 217 | + isArray: true | ||
| 218 | + } | ||
| 219 | + } | ||
| 220 | + | ||
| 221 | + ), | ||
| 222 | + eci: $resource( | ||
| 223 | + '/eci/jsy', | ||
| 224 | + {}, | ||
| 225 | + { | ||
| 226 | + list: { | ||
| 227 | + method: 'GET', | ||
| 228 | + isArray: true | ||
| 229 | + } | ||
| 230 | + } | ||
| 231 | + ), | ||
| 232 | + eci2: $resource( | ||
| 233 | + '/eci/spy', | ||
| 234 | + {}, | ||
| 235 | + { | ||
| 236 | + list: { | ||
| 237 | + method: 'GET', | ||
| 238 | + isArray: true | ||
| 239 | + } | ||
| 240 | + } | ||
| 241 | + ), | ||
| 242 | + eci3: $resource( | ||
| 243 | + '/eci/:type', | ||
| 244 | + {}, | ||
| 245 | + { | ||
| 246 | + list: { | ||
| 247 | + method: 'GET', | ||
| 248 | + isArray: true | ||
| 249 | + } | ||
| 250 | + } | ||
| 251 | + ), | ||
| 252 | + | ||
| 253 | + | ||
| 254 | + validate: { // remoteValidation指令用到的resource | ||
| 255 | + gbv1: { // 路牌序号验证 | ||
| 256 | + template: {'xl.id_eq': -1, 'lpNo_eq': 'ddd'}, | ||
| 257 | + remote: $resource( | ||
| 258 | + '/gic/validate1', | ||
| 259 | + {}, | ||
| 260 | + { | ||
| 261 | + do: { | ||
| 262 | + method: 'GET' | ||
| 263 | + } | ||
| 264 | + } | ||
| 265 | + ) | ||
| 266 | + }, | ||
| 267 | + gbv2: { // 路牌名称验证 | ||
| 268 | + template: {'xl.id_eq': -1, 'lpName_eq': 'ddd'}, | ||
| 269 | + remote: $resource( | ||
| 270 | + '/gic/validate2', | ||
| 271 | + {}, | ||
| 272 | + { | ||
| 273 | + do: { | ||
| 274 | + method: 'GET' | ||
| 275 | + } | ||
| 276 | + } | ||
| 277 | + ) | ||
| 278 | + }, | ||
| 279 | + | ||
| 280 | + cars_zbh: { // 自编号验证 | ||
| 281 | + template: {'insideCode_eq': '-1'}, // 查询参数模版 | ||
| 282 | + remote: $resource( // $resource封装对象 | ||
| 283 | + '/cars_sc/validate_zbh', | ||
| 284 | + {}, | ||
| 285 | + { | ||
| 286 | + do: { | ||
| 287 | + method: 'GET' | ||
| 288 | + } | ||
| 289 | + } | ||
| 290 | + ) | ||
| 291 | + }, | ||
| 292 | + | ||
| 293 | + cars_sbbh: { // 验证设备编号 | ||
| 294 | + template: {'equipmentCode_eq': '-1'}, // 查询参数模版 | ||
| 295 | + remote: $resource( // $resource封装对象 | ||
| 296 | + '/cars_sc/validate_sbbh', | ||
| 297 | + {}, | ||
| 298 | + { | ||
| 299 | + do: { | ||
| 300 | + method: 'GET' | ||
| 301 | + } | ||
| 302 | + } | ||
| 303 | + ) | ||
| 304 | + }, | ||
| 305 | + | ||
| 306 | + cars_clbh: { // 车辆编号验证 | ||
| 307 | + template: {'carCode_eq': '-1'}, // 查询参数模版 | ||
| 308 | + remote: $resource( // $resource封装对象 | ||
| 309 | + '/cars_sc/validate_clbh', | ||
| 310 | + {}, | ||
| 311 | + { | ||
| 312 | + do: { | ||
| 313 | + method: 'GET' | ||
| 314 | + } | ||
| 315 | + } | ||
| 316 | + ) | ||
| 317 | + }, | ||
| 318 | + | ||
| 319 | + cars_cph: { // 车牌号验证 | ||
| 320 | + template: {'carPlate_eq': '-1'}, // 查询参数模版 | ||
| 321 | + remote: $resource( // $resource封装对象 | ||
| 322 | + '/cars_sc/validate_cph', | ||
| 323 | + {}, | ||
| 324 | + { | ||
| 325 | + do: { | ||
| 326 | + method: 'GET' | ||
| 327 | + } | ||
| 328 | + } | ||
| 329 | + ) | ||
| 330 | + }, | ||
| 331 | + | ||
| 332 | + | ||
| 333 | + cde1: { // 车辆设备启用日期验证 | ||
| 334 | + template: {'qyrq': 0, 'xl': 1, 'cl': 1}, // 日期毫秒 | ||
| 335 | + remote: $resource( // $resource封装对象 | ||
| 336 | + '/cde//validate/qyrq', | ||
| 337 | + {}, | ||
| 338 | + { | ||
| 339 | + do: { | ||
| 340 | + method: 'GET' | ||
| 341 | + } | ||
| 342 | + } | ||
| 343 | + ) | ||
| 344 | + }, | ||
| 345 | + ttc1: { // 时刻表名字验证 | ||
| 346 | + template: {'xl.id_eq': -1, 'name_eq': 'ddd'}, | ||
| 347 | + remote: $resource( // $resource封装对象 | ||
| 348 | + '/tic/validate/equale', | ||
| 349 | + {}, | ||
| 350 | + { | ||
| 351 | + do: { | ||
| 352 | + method: 'GET' | ||
| 353 | + } | ||
| 354 | + } | ||
| 355 | + ) | ||
| 356 | + }, | ||
| 357 | + sheet: { // 时刻表sheet工作区验证 | ||
| 358 | + template: {'filename': '', 'sheetname': '', 'lineid': -1, 'linename': ''}, | ||
| 359 | + remote: $resource( // $resource封装对象 | ||
| 360 | + '/tidc/validate/sheet', | ||
| 361 | + {}, | ||
| 362 | + { | ||
| 363 | + do: { | ||
| 364 | + method: 'POST', | ||
| 365 | + headers: { | ||
| 366 | + 'Content-Type': 'application/x-www-form-urlencoded' | ||
| 367 | + }, | ||
| 368 | + transformRequest: function(obj) { | ||
| 369 | + var str = []; | ||
| 370 | + for (var p in obj) { | ||
| 371 | + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p])); | ||
| 372 | + } | ||
| 373 | + return str.join("&"); | ||
| 374 | + } | ||
| 375 | + } | ||
| 376 | + } | ||
| 377 | + ) | ||
| 378 | + }, | ||
| 379 | + sheetli: { // 时刻表线路标准验证 | ||
| 380 | + template: {'lineinfoid': -1}, | ||
| 381 | + remote: $resource( // $resource封装对象 | ||
| 382 | + '/tidc/validate/lineinfo', | ||
| 383 | + {}, | ||
| 384 | + { | ||
| 385 | + do: { | ||
| 386 | + method: 'GET' | ||
| 387 | + } | ||
| 388 | + } | ||
| 389 | + ) | ||
| 390 | + } | ||
| 391 | + } | ||
| 392 | + | ||
| 393 | + //validate: $resource( | ||
| 394 | + // '/cars/validate/:type', | ||
| 395 | + // {}, | ||
| 396 | + // { | ||
| 397 | + // insideCode: { | ||
| 398 | + // method: 'GET' | ||
| 399 | + // } | ||
| 400 | + // } | ||
| 401 | + //) | ||
| 402 | + | ||
| 403 | + | ||
| 404 | + | ||
| 405 | + } | ||
| 406 | +}]); | ||
| 407 | + | ||
| 408 | + | ||
| 409 | + |
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
| 1 | -// 项目通用的全局service服务,供不同的controller使用,自定义指令不使用 | ||
| 2 | - | ||
| 3 | -// 文件下载服务 | ||
| 4 | -angular.module('ScheduleApp').factory('FileDownload_g', function() { | ||
| 5 | - return { | ||
| 6 | - downloadFile: function (data, mimeType, fileName) { | ||
| 7 | - var success = false; | ||
| 8 | - var blob = new Blob([data], { type: mimeType }); | ||
| 9 | - try { | ||
| 10 | - if (navigator.msSaveBlob) | ||
| 11 | - navigator.msSaveBlob(blob, fileName); | ||
| 12 | - else { | ||
| 13 | - // Try using other saveBlob implementations, if available | ||
| 14 | - var saveBlob = navigator.webkitSaveBlob || navigator.mozSaveBlob || navigator.saveBlob; | ||
| 15 | - if (saveBlob === undefined) throw "Not supported"; | ||
| 16 | - saveBlob(blob, fileName); | ||
| 17 | - } | ||
| 18 | - success = true; | ||
| 19 | - } catch (ex) { | ||
| 20 | - console.log("saveBlob method failed with the following exception:"); | ||
| 21 | - console.log(ex); | ||
| 22 | - } | ||
| 23 | - | ||
| 24 | - if (!success) { | ||
| 25 | - // Get the blob url creator | ||
| 26 | - var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL; | ||
| 27 | - if (urlCreator) { | ||
| 28 | - // Try to use a download link | ||
| 29 | - var link = document.createElement('a'); | ||
| 30 | - if ('download' in link) { | ||
| 31 | - // Try to simulate a click | ||
| 32 | - try { | ||
| 33 | - // Prepare a blob URL | ||
| 34 | - var url = urlCreator.createObjectURL(blob); | ||
| 35 | - link.setAttribute('href', url); | ||
| 36 | - | ||
| 37 | - // Set the download attribute (Supported in Chrome 14+ / Firefox 20+) | ||
| 38 | - link.setAttribute("download", fileName); | ||
| 39 | - | ||
| 40 | - // Simulate clicking the download link | ||
| 41 | - var event = document.createEvent('MouseEvents'); | ||
| 42 | - event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null); | ||
| 43 | - link.dispatchEvent(event); | ||
| 44 | - success = true; | ||
| 45 | - | ||
| 46 | - } catch (ex) { | ||
| 47 | - console.log("Download link method with simulated click failed with the following exception:"); | ||
| 48 | - console.log(ex); | ||
| 49 | - } | ||
| 50 | - } | ||
| 51 | - | ||
| 52 | - if (!success) { | ||
| 53 | - // Fallback to window.location method | ||
| 54 | - try { | ||
| 55 | - // Prepare a blob URL | ||
| 56 | - // Use application/octet-stream when using window.location to force download | ||
| 57 | - var url = urlCreator.createObjectURL(blob); | ||
| 58 | - window.location = url; | ||
| 59 | - console.log("Download link method with window.location succeeded"); | ||
| 60 | - success = true; | ||
| 61 | - } catch (ex) { | ||
| 62 | - console.log("Download link method with window.location failed with the following exception:"); | ||
| 63 | - console.log(ex); | ||
| 64 | - } | ||
| 65 | - } | ||
| 66 | - } | ||
| 67 | - } | ||
| 68 | - | ||
| 69 | - if (!success) { | ||
| 70 | - // Fallback to window.open method | ||
| 71 | - console.log("No methods worked for saving the arraybuffer, using last resort window.open"); | ||
| 72 | - window.open("", '_blank', ''); | ||
| 73 | - } | ||
| 74 | - } | ||
| 75 | - }; | ||
| 76 | -}); | ||
| 77 | - | ||
| 78 | -// 车辆信息service | ||
| 79 | -angular.module('ScheduleApp').factory('BusInfoManageService_g', ['$resource', function($resource) { | ||
| 80 | - return { | ||
| 81 | - rest: $resource( | ||
| 82 | - '/cars/:id', | ||
| 83 | - {order: 'carCode', direction: 'ASC', id: '@id_route'}, | ||
| 84 | - { | ||
| 85 | - list: { | ||
| 86 | - method: 'GET', | ||
| 87 | - params: { | ||
| 88 | - page: 0 | ||
| 89 | - } | ||
| 90 | - }, | ||
| 91 | - get: { | ||
| 92 | - method: 'GET' | ||
| 93 | - }, | ||
| 94 | - save: { | ||
| 95 | - method: 'POST' | ||
| 96 | - } | ||
| 97 | - } | ||
| 98 | - ), | ||
| 99 | - import: $resource( | ||
| 100 | - '/cars/importfile', | ||
| 101 | - {}, | ||
| 102 | - { | ||
| 103 | - do: { | ||
| 104 | - method: 'POST', | ||
| 105 | - headers: { | ||
| 106 | - 'Content-Type': 'application/x-www-form-urlencoded' | ||
| 107 | - }, | ||
| 108 | - transformRequest: function(obj) { | ||
| 109 | - var str = []; | ||
| 110 | - for (var p in obj) { | ||
| 111 | - str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p])); | ||
| 112 | - } | ||
| 113 | - return str.join("&"); | ||
| 114 | - } | ||
| 115 | - } | ||
| 116 | - } | ||
| 117 | - ), | ||
| 118 | - validate: $resource( | ||
| 119 | - '/cars/validate/:type', | ||
| 120 | - {}, | ||
| 121 | - { | ||
| 122 | - insideCode: { | ||
| 123 | - method: 'GET' | ||
| 124 | - } | ||
| 125 | - } | ||
| 126 | - ), | ||
| 127 | - dataTools: $resource( | ||
| 128 | - '/cars/:type', | ||
| 129 | - {}, | ||
| 130 | - { | ||
| 131 | - dataExport: { | ||
| 132 | - method: 'GET', | ||
| 133 | - responseType: "arraybuffer", | ||
| 134 | - params: { | ||
| 135 | - type: "dataExport" | ||
| 136 | - }, | ||
| 137 | - transformResponse: function(data, headers){ | ||
| 138 | - return {data : data}; | ||
| 139 | - } | ||
| 140 | - } | ||
| 141 | - } | ||
| 142 | - ) | ||
| 143 | - }; | ||
| 144 | -}]); | ||
| 145 | -// 人员信息service | ||
| 146 | -angular.module('ScheduleApp').factory('EmployeeInfoManageService_g', ['$resource', function($resource) { | ||
| 147 | - return { | ||
| 148 | - rest : $resource( | ||
| 149 | - '/personnel/:id', | ||
| 150 | - {order: 'jobCode', direction: 'ASC', id: '@id_route'}, | ||
| 151 | - { | ||
| 152 | - list: { | ||
| 153 | - method: 'GET', | ||
| 154 | - params: { | ||
| 155 | - page: 0 | ||
| 156 | - } | ||
| 157 | - }, | ||
| 158 | - get: { | ||
| 159 | - method: 'GET' | ||
| 160 | - }, | ||
| 161 | - save: { | ||
| 162 | - method: 'POST' | ||
| 163 | - } | ||
| 164 | - } | ||
| 165 | - ), | ||
| 166 | - validate: $resource( | ||
| 167 | - '/personnel/validate/:type', | ||
| 168 | - {}, | ||
| 169 | - { | ||
| 170 | - jobCode: { | ||
| 171 | - method: 'GET' | ||
| 172 | - } | ||
| 173 | - } | ||
| 174 | - ), | ||
| 175 | - dataTools: $resource( | ||
| 176 | - '/personnel/:type', | ||
| 177 | - {}, | ||
| 178 | - { | ||
| 179 | - dataExport: { | ||
| 180 | - method: 'GET', | ||
| 181 | - responseType: "arraybuffer", | ||
| 182 | - params: { | ||
| 183 | - type: "dataExport" | ||
| 184 | - }, | ||
| 185 | - transformResponse: function(data, headers){ | ||
| 186 | - return {data : data}; | ||
| 187 | - } | ||
| 188 | - } | ||
| 189 | - } | ||
| 190 | - ) | ||
| 191 | - }; | ||
| 192 | -}]); | ||
| 193 | -// 车辆设备信息service | ||
| 194 | -angular.module('ScheduleApp').factory('DeviceInfoManageService_g', ['$resource', function($resource) { | ||
| 195 | - return $resource( | ||
| 196 | - '/cde/:id', | ||
| 197 | - {order: 'xl,isCancel,cl,qyrq', direction: 'ASC,ASC,ASC,DESC', id: '@id_route'}, | ||
| 198 | - { | ||
| 199 | - list: { | ||
| 200 | - method: 'GET', | ||
| 201 | - params: { | ||
| 202 | - page: 0 | ||
| 203 | - } | ||
| 204 | - }, | ||
| 205 | - get: { | ||
| 206 | - method: 'GET' | ||
| 207 | - }, | ||
| 208 | - save: { | ||
| 209 | - method: 'POST' | ||
| 210 | - }, | ||
| 211 | - delete: { | ||
| 212 | - method: 'DELETE' | ||
| 213 | - } | ||
| 214 | - } | ||
| 215 | - ); | ||
| 216 | -}]); | ||
| 217 | - | ||
| 218 | -// 车辆配置service | ||
| 219 | -angular.module('ScheduleApp').factory('BusConfigService_g', ['$resource', function($resource) { | ||
| 220 | - return { | ||
| 221 | - rest : $resource( | ||
| 222 | - '/cci/:id', | ||
| 223 | - {order: 'xl.id,cl.insideCode,isCancel', direction: 'ASC', id: '@id_route'}, | ||
| 224 | - { | ||
| 225 | - list: { | ||
| 226 | - method: 'GET', | ||
| 227 | - params: { | ||
| 228 | - page: 0 | ||
| 229 | - } | ||
| 230 | - }, | ||
| 231 | - get: { | ||
| 232 | - method: 'GET' | ||
| 233 | - }, | ||
| 234 | - save: { | ||
| 235 | - method: 'POST' | ||
| 236 | - } | ||
| 237 | - } | ||
| 238 | - ) | ||
| 239 | - }; | ||
| 240 | -}]); | ||
| 241 | - | ||
| 242 | -// 人员配置service | ||
| 243 | -angular.module('ScheduleApp').factory('EmployeeConfigService_g', ['$resource', function($resource) { | ||
| 244 | - return { | ||
| 245 | - rest : $resource( | ||
| 246 | - '/eci/:id', | ||
| 247 | - {order: 'xl.id,isCancel,dbbmFormula', direction: 'ASC', id: '@id_route'}, | ||
| 248 | - { | ||
| 249 | - list: { | ||
| 250 | - method: 'GET', | ||
| 251 | - params: { | ||
| 252 | - page: 0 | ||
| 253 | - } | ||
| 254 | - }, | ||
| 255 | - get: { | ||
| 256 | - method: 'GET' | ||
| 257 | - }, | ||
| 258 | - save: { | ||
| 259 | - method: 'POST' | ||
| 260 | - }, | ||
| 261 | - delete: { | ||
| 262 | - method: 'DELETE' | ||
| 263 | - } | ||
| 264 | - } | ||
| 265 | - ), | ||
| 266 | - validate: $resource( // TODO: | ||
| 267 | - '/personnel/validate/:type', | ||
| 268 | - {}, | ||
| 269 | - { | ||
| 270 | - jobCode: { | ||
| 271 | - method: 'GET' | ||
| 272 | - } | ||
| 273 | - } | ||
| 274 | - ) | ||
| 275 | - }; | ||
| 276 | -}]); | ||
| 277 | - | ||
| 278 | -// 路牌管理service | ||
| 279 | -angular.module('ScheduleApp').factory('GuideboardManageService_g', ['$resource', function($resource) { | ||
| 280 | - return { | ||
| 281 | - rest: $resource( | ||
| 282 | - '/gic/:id', | ||
| 283 | - {order: 'createDate', direction: 'DESC', id: '@id_route'}, | ||
| 284 | - { | ||
| 285 | - list: { | ||
| 286 | - method: 'GET', | ||
| 287 | - params: { | ||
| 288 | - page: 0 | ||
| 289 | - } | ||
| 290 | - }, | ||
| 291 | - get: { | ||
| 292 | - method: 'GET' | ||
| 293 | - }, | ||
| 294 | - save: { | ||
| 295 | - method: 'POST' | ||
| 296 | - } | ||
| 297 | - } | ||
| 298 | - ) | ||
| 299 | - }; | ||
| 300 | -}]); | ||
| 301 | - | ||
| 302 | -// 排班管理service | ||
| 303 | -angular.module('ScheduleApp').factory('ScheduleRuleManageService_g', ['$resource', function($resource) { | ||
| 304 | - return { | ||
| 305 | - rest: $resource( | ||
| 306 | - '/sr1fc/:id', | ||
| 307 | - {order: 'createDate', direction: 'DESC', id: '@id_route'}, | ||
| 308 | - { | ||
| 309 | - list: { | ||
| 310 | - method: 'GET', | ||
| 311 | - params: { | ||
| 312 | - page: 0 | ||
| 313 | - } | ||
| 314 | - }, | ||
| 315 | - get: { | ||
| 316 | - method: 'GET' | ||
| 317 | - }, | ||
| 318 | - save: { | ||
| 319 | - method: 'POST' | ||
| 320 | - }, | ||
| 321 | - delete: { | ||
| 322 | - method: 'DELETE' | ||
| 323 | - } | ||
| 324 | - } | ||
| 325 | - ) | ||
| 326 | - }; | ||
| 327 | -}]); | ||
| 328 | - | ||
| 329 | -// 套跑管理service | ||
| 330 | -angular.module('ScheduleApp').factory('rerunManageService_g', ['$resource', function($resource) { | ||
| 331 | - return { | ||
| 332 | - rest: $resource( | ||
| 333 | - 'rms/:id', | ||
| 334 | - {order: 'rerunXl.id,isCancel', direction: 'ASC', id: '@id_route'}, | ||
| 335 | - { | ||
| 336 | - list: { | ||
| 337 | - method: 'GET', | ||
| 338 | - params: { | ||
| 339 | - page: 0 | ||
| 340 | - } | ||
| 341 | - }, | ||
| 342 | - get: { | ||
| 343 | - method: 'GET' | ||
| 344 | - }, | ||
| 345 | - save: { | ||
| 346 | - method: 'POST' | ||
| 347 | - }, | ||
| 348 | - delete: { | ||
| 349 | - method: 'DELETE' | ||
| 350 | - } | ||
| 351 | - } | ||
| 352 | - ) | ||
| 353 | - }; | ||
| 354 | -}]); | ||
| 355 | - | ||
| 356 | -// 时刻表管理service | ||
| 357 | -angular.module('ScheduleApp').factory('TimeTableManageService_g', ['$resource', function($resource) { | ||
| 358 | - return { | ||
| 359 | - rest: $resource( | ||
| 360 | - '/tic/:id', | ||
| 361 | - {order: 'xl,isCancel,isEnableDisTemplate,qyrq', direction: 'DESC,ASC,DESC,DESC', id: '@id'}, | ||
| 362 | - { | ||
| 363 | - list: { | ||
| 364 | - method: 'GET', | ||
| 365 | - params: { | ||
| 366 | - page: 0 | ||
| 367 | - } | ||
| 368 | - } | ||
| 369 | - } | ||
| 370 | - ) | ||
| 371 | - }; | ||
| 372 | -}]); | ||
| 373 | -// 时刻表明细管理service | ||
| 374 | -angular.module('ScheduleApp').factory('TimeTableDetailManageService_g', ['$resource', function($resource) { | ||
| 375 | - return { | ||
| 376 | - rest: $resource( | ||
| 377 | - '/tidc/:id', | ||
| 378 | - {order: 'createDate', direction: 'DESC', id: '@id_route'}, | ||
| 379 | - { | ||
| 380 | - get: { | ||
| 381 | - method: 'GET' | ||
| 382 | - }, | ||
| 383 | - save: { | ||
| 384 | - method: 'POST' | ||
| 385 | - } | ||
| 386 | - } | ||
| 387 | - ), | ||
| 388 | - import: $resource( | ||
| 389 | - '/tidc/importfile', | ||
| 390 | - {}, | ||
| 391 | - { | ||
| 392 | - do: { | ||
| 393 | - method: 'POST', | ||
| 394 | - headers: { | ||
| 395 | - 'Content-Type': 'application/x-www-form-urlencoded' | ||
| 396 | - }, | ||
| 397 | - transformRequest: function(obj) { | ||
| 398 | - var str = []; | ||
| 399 | - for (var p in obj) { | ||
| 400 | - str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p])); | ||
| 401 | - } | ||
| 402 | - return str.join("&"); | ||
| 403 | - } | ||
| 404 | - } | ||
| 405 | - } | ||
| 406 | - ), | ||
| 407 | - edit: $resource( | ||
| 408 | - '/tidc/edit/:xlid/:ttid', | ||
| 409 | - {}, | ||
| 410 | - { | ||
| 411 | - list: { | ||
| 412 | - method: 'GET' | ||
| 413 | - } | ||
| 414 | - } | ||
| 415 | - ), | ||
| 416 | - bcdetails: $resource( | ||
| 417 | - '/tidc/bcdetail', | ||
| 418 | - {}, | ||
| 419 | - { | ||
| 420 | - list: { | ||
| 421 | - method: 'GET', | ||
| 422 | - isArray: true | ||
| 423 | - } | ||
| 424 | - } | ||
| 425 | - ), | ||
| 426 | - dataTools: $resource( | ||
| 427 | - '/tidc/:type', | ||
| 428 | - {}, | ||
| 429 | - { | ||
| 430 | - dataExport: { | ||
| 431 | - method: 'GET', | ||
| 432 | - responseType: "arraybuffer", | ||
| 433 | - params: { | ||
| 434 | - type: "dataExportExt" | ||
| 435 | - }, | ||
| 436 | - transformResponse: function(data, headers){ | ||
| 437 | - return {data : data}; | ||
| 438 | - } | ||
| 439 | - } | ||
| 440 | - } | ||
| 441 | - ) | ||
| 442 | - | ||
| 443 | - // TODO:导入数据 | ||
| 444 | - }; | ||
| 445 | -}]); | ||
| 446 | - | ||
| 447 | - | ||
| 448 | - | ||
| 449 | -// 排班计划管理service | ||
| 450 | -angular.module('ScheduleApp').factory('SchedulePlanManageService_g', ['$resource', function($resource) { | ||
| 451 | - return { | ||
| 452 | - rest : $resource( | ||
| 453 | - '/spc/:id', | ||
| 454 | - {order: 'xl.id,createDate', direction: 'DESC,DESC', id: '@id_route'}, | ||
| 455 | - { | ||
| 456 | - list: { | ||
| 457 | - method: 'GET', | ||
| 458 | - params: { | ||
| 459 | - page: 0 | ||
| 460 | - } | ||
| 461 | - }, | ||
| 462 | - get: { | ||
| 463 | - method: 'GET' | ||
| 464 | - }, | ||
| 465 | - save: { | ||
| 466 | - method: 'POST' | ||
| 467 | - }, | ||
| 468 | - delete: { | ||
| 469 | - method: 'DELETE' | ||
| 470 | - } | ||
| 471 | - } | ||
| 472 | - ), | ||
| 473 | - tommorw: $resource( | ||
| 474 | - '/spc/tommorw', | ||
| 475 | - {}, | ||
| 476 | - { | ||
| 477 | - list: { | ||
| 478 | - method: 'GET' | ||
| 479 | - } | ||
| 480 | - } | ||
| 481 | - ) | ||
| 482 | - }; | ||
| 483 | -}]); | ||
| 484 | - | ||
| 485 | -// 排班计划明细管理service | ||
| 486 | -angular.module('ScheduleApp').factory('SchedulePlanInfoManageService_g', ['$resource', function($resource) { | ||
| 487 | - return { | ||
| 488 | - rest : $resource( | ||
| 489 | - '/spic/:id', | ||
| 490 | - {order: 'scheduleDate,lp,fcno', direction: 'ASC,ASC,ASC', id: '@id_route'}, | ||
| 491 | - { | ||
| 492 | - list: { | ||
| 493 | - method: 'GET', | ||
| 494 | - params: { | ||
| 495 | - page: 0 | ||
| 496 | - } | ||
| 497 | - }, | ||
| 498 | - get: { | ||
| 499 | - method: 'GET' | ||
| 500 | - }, | ||
| 501 | - save: { | ||
| 502 | - method: 'POST' | ||
| 503 | - } | ||
| 504 | - } | ||
| 505 | - ), | ||
| 506 | - groupinfo : $resource( | ||
| 507 | - '/spic/groupinfos/:xlid/:sdate', | ||
| 508 | - {}, | ||
| 509 | - { | ||
| 510 | - list: { | ||
| 511 | - method: 'GET', | ||
| 512 | - isArray: true | ||
| 513 | - } | ||
| 514 | - } | ||
| 515 | - ), | ||
| 516 | - updateGroupInfo : $resource( | ||
| 517 | - '/spic/groupinfos/update', | ||
| 518 | - {}, | ||
| 519 | - { | ||
| 520 | - update: { | ||
| 521 | - method: 'POST' | ||
| 522 | - } | ||
| 523 | - } | ||
| 524 | - ) | ||
| 525 | - }; | ||
| 526 | -}]); | ||
| 527 | - | ||
| 528 | -// 线路运营统计service | ||
| 529 | -angular.module('ScheduleApp').factory('BusLineInfoStatService_g', ['$resource', function($resource) { | ||
| 530 | - return $resource( | ||
| 531 | - '/bic/:id', | ||
| 532 | - {order: 'createDate', direction: 'DESC', id: '@id_route'}, // TODO:以后需要根据属性对象的属性查询 | ||
| 533 | - { | ||
| 534 | - list: { | ||
| 535 | - method: 'GET', | ||
| 536 | - params: { | ||
| 537 | - page: 0 | ||
| 538 | - } | ||
| 539 | - } | ||
| 540 | - } | ||
| 541 | - ); | ||
| 542 | -}]); | ||
| 543 | - | ||
| 544 | - | ||
| 545 | - | ||
| 546 | - | ||
| 547 | -/** | ||
| 548 | - * saSelect2指令,根据属性值,动态载入数据,然后支持拼音搜索,点击右边的按钮清除选择并重新载入数据。 | ||
| 549 | - * 1、compile阶段使用的属性如下: | ||
| 550 | - * required:用于和表单验证连接,指定成required="true"才有效。 | ||
| 551 | - * 2、link阶段使用的属性如下 | ||
| 552 | - * model:关联的模型对象 | ||
| 553 | - * name:表单验证时需要的名字 | ||
| 554 | - * type:关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加 | ||
| 555 | - * modelcolname1:关联的模型字段名字1(一般应该是编码字段) | ||
| 556 | - * modelcolname2:关联的模型字段名字2(一般应该是名字字段) | ||
| 557 | - * datacolname1;内部数据对应的字段名字1(与模型字段1对应) | ||
| 558 | - * datacolname2:内部数据对应的字段名字2(与模型字段2对应) | ||
| 559 | - * showcolname:下拉框显示的内部数据字段名(注意:不是模型数据字段名),TODO:以后考虑放动态表达式,并在compile阶段使用 | ||
| 560 | - * placeholder:select placeholder字符串描述 | ||
| 561 | - * | ||
| 562 | - * $$pyFilter,内部的filter指令,结合简拼音进行拼音过滤。 | ||
| 563 | - * $$SearchInfoService_g,内部使用的数据服务 | ||
| 564 | - */ | ||
| 565 | -// saSelect2指令使用的内部信service | ||
| 566 | -angular.module('ScheduleApp').factory('$$SearchInfoService_g', ['$resource', function($resource) { | ||
| 567 | - return { | ||
| 568 | - xl: $resource( | ||
| 569 | - '/line/:type', | ||
| 570 | - {order: 'name', direction: 'ASC'}, | ||
| 571 | - { | ||
| 572 | - list: { | ||
| 573 | - method: 'GET', | ||
| 574 | - isArray: true | ||
| 575 | - } | ||
| 576 | - } | ||
| 577 | - ), | ||
| 578 | - xlinfo: $resource( | ||
| 579 | - '/lineInformation/:type', | ||
| 580 | - {order: 'line.name', direction: 'ASC'}, | ||
| 581 | - { | ||
| 582 | - list: { | ||
| 583 | - method: 'GET', | ||
| 584 | - isArray: true | ||
| 585 | - } | ||
| 586 | - } | ||
| 587 | - ), | ||
| 588 | - zd: $resource( | ||
| 589 | - '/stationroute/stations', | ||
| 590 | - {order: 'stationCode', direction: 'ASC'}, | ||
| 591 | - { | ||
| 592 | - list: { | ||
| 593 | - method: 'GET', | ||
| 594 | - isArray: true | ||
| 595 | - } | ||
| 596 | - } | ||
| 597 | - ), | ||
| 598 | - tcc: $resource( | ||
| 599 | - '/carpark/:type', | ||
| 600 | - {order: 'parkCode', direction: 'ASC'}, | ||
| 601 | - { | ||
| 602 | - list: { | ||
| 603 | - method: 'GET', | ||
| 604 | - isArray: true | ||
| 605 | - } | ||
| 606 | - } | ||
| 607 | - ), | ||
| 608 | - ry: $resource( | ||
| 609 | - '/personnel/:type', | ||
| 610 | - {order: 'personnelName', direction: 'ASC'}, | ||
| 611 | - { | ||
| 612 | - list: { | ||
| 613 | - method: 'GET', | ||
| 614 | - isArray: true | ||
| 615 | - } | ||
| 616 | - } | ||
| 617 | - ), | ||
| 618 | - cl: $resource( | ||
| 619 | - '/cars/:type', | ||
| 620 | - {order: "insideCode", direction: 'ASC'}, | ||
| 621 | - { | ||
| 622 | - list: { | ||
| 623 | - method: 'GET', | ||
| 624 | - isArray: true | ||
| 625 | - } | ||
| 626 | - } | ||
| 627 | - ), | ||
| 628 | - ttInfo: $resource( | ||
| 629 | - '/tic/:type', | ||
| 630 | - {order: "name", direction: 'ASC'}, | ||
| 631 | - { | ||
| 632 | - list: { | ||
| 633 | - method: 'GET', | ||
| 634 | - isArray: true | ||
| 635 | - } | ||
| 636 | - } | ||
| 637 | - ), | ||
| 638 | - lpInfo: $resource( | ||
| 639 | - '/gic/ttlpnames', | ||
| 640 | - {order: "lpName", direction: 'ASC'}, | ||
| 641 | - { | ||
| 642 | - list: { | ||
| 643 | - method: 'GET', | ||
| 644 | - isArray: true | ||
| 645 | - } | ||
| 646 | - } | ||
| 647 | - ), | ||
| 648 | - lpInfo2: $resource( | ||
| 649 | - '/gic/:type', | ||
| 650 | - {order: "lpName", direction: 'ASC'}, | ||
| 651 | - { | ||
| 652 | - list: { | ||
| 653 | - method: 'GET', | ||
| 654 | - isArray: true | ||
| 655 | - } | ||
| 656 | - } | ||
| 657 | - ), | ||
| 658 | - cci: $resource( | ||
| 659 | - '/cci/cars', | ||
| 660 | - {}, | ||
| 661 | - { | ||
| 662 | - list: { | ||
| 663 | - method: 'GET', | ||
| 664 | - isArray: true | ||
| 665 | - } | ||
| 666 | - } | ||
| 667 | - | ||
| 668 | - ), | ||
| 669 | - cci2: $resource( | ||
| 670 | - '/cci/:type', | ||
| 671 | - {}, | ||
| 672 | - { | ||
| 673 | - list: { | ||
| 674 | - method: 'GET', | ||
| 675 | - isArray: true | ||
| 676 | - } | ||
| 677 | - } | ||
| 678 | - ), | ||
| 679 | - cci3: $resource( | ||
| 680 | - '/cci/cars2', | ||
| 681 | - {}, | ||
| 682 | - { | ||
| 683 | - list: { | ||
| 684 | - method: 'GET', | ||
| 685 | - isArray: true | ||
| 686 | - } | ||
| 687 | - } | ||
| 688 | - | ||
| 689 | - ), | ||
| 690 | - eci: $resource( | ||
| 691 | - '/eci/jsy', | ||
| 692 | - {}, | ||
| 693 | - { | ||
| 694 | - list: { | ||
| 695 | - method: 'GET', | ||
| 696 | - isArray: true | ||
| 697 | - } | ||
| 698 | - } | ||
| 699 | - ), | ||
| 700 | - eci2: $resource( | ||
| 701 | - '/eci/spy', | ||
| 702 | - {}, | ||
| 703 | - { | ||
| 704 | - list: { | ||
| 705 | - method: 'GET', | ||
| 706 | - isArray: true | ||
| 707 | - } | ||
| 708 | - } | ||
| 709 | - ), | ||
| 710 | - eci3: $resource( | ||
| 711 | - '/eci/:type', | ||
| 712 | - {}, | ||
| 713 | - { | ||
| 714 | - list: { | ||
| 715 | - method: 'GET', | ||
| 716 | - isArray: true | ||
| 717 | - } | ||
| 718 | - } | ||
| 719 | - ), | ||
| 720 | - | ||
| 721 | - | ||
| 722 | - validate: { // remoteValidation指令用到的resource | ||
| 723 | - cl1: { // 车辆自编号不能重复验证 | ||
| 724 | - template: {'insideCode_eq': '-1'}, // 查询参数模版 | ||
| 725 | - remote: $resource( // $resource封装对象 | ||
| 726 | - '/cars/validate/equale', | ||
| 727 | - {}, | ||
| 728 | - { | ||
| 729 | - do: { | ||
| 730 | - method: 'GET' | ||
| 731 | - } | ||
| 732 | - } | ||
| 733 | - ) | ||
| 734 | - }, | ||
| 735 | - cde1: { // 车辆设备启用日期验证 | ||
| 736 | - template: {'qyrq': 0, 'xl': 1, 'cl': 1}, // 日期毫秒 | ||
| 737 | - remote: $resource( // $resource封装对象 | ||
| 738 | - '/cde//validate/qyrq', | ||
| 739 | - {}, | ||
| 740 | - { | ||
| 741 | - do: { | ||
| 742 | - method: 'GET' | ||
| 743 | - } | ||
| 744 | - } | ||
| 745 | - ) | ||
| 746 | - }, | ||
| 747 | - ttc1: { // 时刻表名字验证 | ||
| 748 | - template: {'xl.id_eq': -1, 'name_eq': 'ddd'}, | ||
| 749 | - remote: $resource( // $resource封装对象 | ||
| 750 | - '/tic/validate/equale', | ||
| 751 | - {}, | ||
| 752 | - { | ||
| 753 | - do: { | ||
| 754 | - method: 'GET' | ||
| 755 | - } | ||
| 756 | - } | ||
| 757 | - ) | ||
| 758 | - }, | ||
| 759 | - sheet: { // 时刻表sheet工作区验证 | ||
| 760 | - template: {'filename': '', 'sheetname': '', 'lineid': -1, 'linename': ''}, | ||
| 761 | - remote: $resource( // $resource封装对象 | ||
| 762 | - '/tidc/validate/sheet', | ||
| 763 | - {}, | ||
| 764 | - { | ||
| 765 | - do: { | ||
| 766 | - method: 'POST', | ||
| 767 | - headers: { | ||
| 768 | - 'Content-Type': 'application/x-www-form-urlencoded' | ||
| 769 | - }, | ||
| 770 | - transformRequest: function(obj) { | ||
| 771 | - var str = []; | ||
| 772 | - for (var p in obj) { | ||
| 773 | - str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p])); | ||
| 774 | - } | ||
| 775 | - return str.join("&"); | ||
| 776 | - } | ||
| 777 | - } | ||
| 778 | - } | ||
| 779 | - ) | ||
| 780 | - }, | ||
| 781 | - sheetli: { // 时刻表线路标准验证 | ||
| 782 | - template: {'lineinfoid': -1}, | ||
| 783 | - remote: $resource( // $resource封装对象 | ||
| 784 | - '/tidc/validate/lineinfo', | ||
| 785 | - {}, | ||
| 786 | - { | ||
| 787 | - do: { | ||
| 788 | - method: 'GET' | ||
| 789 | - } | ||
| 790 | - } | ||
| 791 | - ) | ||
| 792 | - } | ||
| 793 | - } | ||
| 794 | - | ||
| 795 | - //validate: $resource( | ||
| 796 | - // '/cars/validate/:type', | ||
| 797 | - // {}, | ||
| 798 | - // { | ||
| 799 | - // insideCode: { | ||
| 800 | - // method: 'GET' | ||
| 801 | - // } | ||
| 802 | - // } | ||
| 803 | - //) | ||
| 804 | - | ||
| 805 | - | ||
| 806 | - | ||
| 807 | - } | ||
| 808 | -}]); | ||
| 809 | - | ||
| 810 | - | ||
| 811 | - | 1 | +//所有模块service配置 |
| 2 | +// 车辆信息service | ||
| 3 | +angular.module('ScheduleApp').factory('BusInfoManageService_g', ['$resource', function($resource) { | ||
| 4 | + return { | ||
| 5 | + rest: $resource( | ||
| 6 | + '/cars_sc/:id', | ||
| 7 | + {order: 'carCode', direction: 'ASC', id: '@id_route'}, | ||
| 8 | + { | ||
| 9 | + list: { | ||
| 10 | + method: 'GET', | ||
| 11 | + params: { | ||
| 12 | + page: 0 | ||
| 13 | + }, | ||
| 14 | + transformResponse: function(rs) { | ||
| 15 | + var dst = angular.fromJson(rs); | ||
| 16 | + if (dst.status == 'SUCCESS') { | ||
| 17 | + return dst.data; | ||
| 18 | + } else { | ||
| 19 | + return dst; // 业务错误留给控制器处理 | ||
| 20 | + } | ||
| 21 | + } | ||
| 22 | + }, | ||
| 23 | + get: { | ||
| 24 | + method: 'GET', | ||
| 25 | + transformResponse: function(rs) { | ||
| 26 | + var dst = angular.fromJson(rs); | ||
| 27 | + if (dst.status == 'SUCCESS') { | ||
| 28 | + return dst.data; | ||
| 29 | + } else { | ||
| 30 | + return dst; | ||
| 31 | + } | ||
| 32 | + } | ||
| 33 | + }, | ||
| 34 | + save: { | ||
| 35 | + method: 'POST' | ||
| 36 | + } | ||
| 37 | + } | ||
| 38 | + ), | ||
| 39 | + import: $resource( | ||
| 40 | + '/cars/importfile', | ||
| 41 | + {}, | ||
| 42 | + { | ||
| 43 | + do: { | ||
| 44 | + method: 'POST', | ||
| 45 | + headers: { | ||
| 46 | + 'Content-Type': 'application/x-www-form-urlencoded' | ||
| 47 | + }, | ||
| 48 | + transformRequest: function(obj) { | ||
| 49 | + var str = []; | ||
| 50 | + for (var p in obj) { | ||
| 51 | + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p])); | ||
| 52 | + } | ||
| 53 | + return str.join("&"); | ||
| 54 | + } | ||
| 55 | + } | ||
| 56 | + } | ||
| 57 | + ), | ||
| 58 | + validate: $resource( | ||
| 59 | + '/cars/validate/:type', | ||
| 60 | + {}, | ||
| 61 | + { | ||
| 62 | + insideCode: { | ||
| 63 | + method: 'GET' | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | + ), | ||
| 67 | + dataTools: $resource( | ||
| 68 | + '/cars/:type', | ||
| 69 | + {}, | ||
| 70 | + { | ||
| 71 | + dataExport: { | ||
| 72 | + method: 'GET', | ||
| 73 | + responseType: "arraybuffer", | ||
| 74 | + params: { | ||
| 75 | + type: "dataExport" | ||
| 76 | + }, | ||
| 77 | + transformResponse: function(data, headers){ | ||
| 78 | + return {data : data}; | ||
| 79 | + } | ||
| 80 | + } | ||
| 81 | + } | ||
| 82 | + ) | ||
| 83 | + }; | ||
| 84 | +}]); | ||
| 85 | +// 车辆设备信息service | ||
| 86 | +angular.module('ScheduleApp').factory('DeviceInfoManageService_g', ['$resource', function($resource) { | ||
| 87 | + return $resource( | ||
| 88 | + '/cde/:id', | ||
| 89 | + {order: 'xl,isCancel,cl,qyrq', direction: 'ASC,ASC,ASC,DESC', id: '@id_route'}, | ||
| 90 | + { | ||
| 91 | + list: { | ||
| 92 | + method: 'GET', | ||
| 93 | + params: { | ||
| 94 | + page: 0 | ||
| 95 | + } | ||
| 96 | + }, | ||
| 97 | + get: { | ||
| 98 | + method: 'GET' | ||
| 99 | + }, | ||
| 100 | + save: { | ||
| 101 | + method: 'POST' | ||
| 102 | + }, | ||
| 103 | + delete: { | ||
| 104 | + method: 'DELETE' | ||
| 105 | + } | ||
| 106 | + } | ||
| 107 | + ); | ||
| 108 | +}]); | ||
| 109 | +// 人员信息service | ||
| 110 | +angular.module('ScheduleApp').factory('EmployeeInfoManageService_g', ['$resource', function($resource) { | ||
| 111 | + return { | ||
| 112 | + rest : $resource( | ||
| 113 | + '/personnel/:id', | ||
| 114 | + {order: 'jobCode', direction: 'ASC', id: '@id_route'}, | ||
| 115 | + { | ||
| 116 | + list: { | ||
| 117 | + method: 'GET', | ||
| 118 | + params: { | ||
| 119 | + page: 0 | ||
| 120 | + } | ||
| 121 | + }, | ||
| 122 | + get: { | ||
| 123 | + method: 'GET' | ||
| 124 | + }, | ||
| 125 | + save: { | ||
| 126 | + method: 'POST' | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + ), | ||
| 130 | + validate: $resource( | ||
| 131 | + '/personnel/validate/:type', | ||
| 132 | + {}, | ||
| 133 | + { | ||
| 134 | + jobCode: { | ||
| 135 | + method: 'GET' | ||
| 136 | + } | ||
| 137 | + } | ||
| 138 | + ), | ||
| 139 | + dataTools: $resource( | ||
| 140 | + '/personnel/:type', | ||
| 141 | + {}, | ||
| 142 | + { | ||
| 143 | + dataExport: { | ||
| 144 | + method: 'GET', | ||
| 145 | + responseType: "arraybuffer", | ||
| 146 | + params: { | ||
| 147 | + type: "dataExport" | ||
| 148 | + }, | ||
| 149 | + transformResponse: function(data, headers){ | ||
| 150 | + return {data : data}; | ||
| 151 | + } | ||
| 152 | + } | ||
| 153 | + } | ||
| 154 | + ) | ||
| 155 | + }; | ||
| 156 | +}]); | ||
| 157 | + | ||
| 158 | +// 车辆配置service | ||
| 159 | +angular.module('ScheduleApp').factory('BusConfigService_g', ['$resource', function($resource) { | ||
| 160 | + return { | ||
| 161 | + rest : $resource( | ||
| 162 | + '/cci/:id', | ||
| 163 | + {order: 'xl.id,cl.insideCode,isCancel', direction: 'ASC', id: '@id_route'}, | ||
| 164 | + { | ||
| 165 | + list: { | ||
| 166 | + method: 'GET', | ||
| 167 | + params: { | ||
| 168 | + page: 0 | ||
| 169 | + } | ||
| 170 | + }, | ||
| 171 | + get: { | ||
| 172 | + method: 'GET' | ||
| 173 | + }, | ||
| 174 | + save: { | ||
| 175 | + method: 'POST' | ||
| 176 | + } | ||
| 177 | + } | ||
| 178 | + ) | ||
| 179 | + }; | ||
| 180 | +}]); | ||
| 181 | +// 线路运营统计service | ||
| 182 | +angular.module('ScheduleApp').factory('BusLineInfoStatService_g', ['$resource', function($resource) { | ||
| 183 | + return $resource( | ||
| 184 | + '/bic/:id', | ||
| 185 | + {order: 'createDate', direction: 'DESC', id: '@id_route'}, // TODO:以后需要根据属性对象的属性查询 | ||
| 186 | + { | ||
| 187 | + list: { | ||
| 188 | + method: 'GET', | ||
| 189 | + params: { | ||
| 190 | + page: 0 | ||
| 191 | + } | ||
| 192 | + } | ||
| 193 | + } | ||
| 194 | + ); | ||
| 195 | +}]); | ||
| 196 | + | ||
| 197 | +// 人员配置service | ||
| 198 | +angular.module('ScheduleApp').factory('EmployeeConfigService_g', ['$resource', function($resource) { | ||
| 199 | + return { | ||
| 200 | + rest : $resource( | ||
| 201 | + '/eci/:id', | ||
| 202 | + {order: 'xl.id,isCancel,dbbmFormula', direction: 'ASC', id: '@id_route'}, | ||
| 203 | + { | ||
| 204 | + list: { | ||
| 205 | + method: 'GET', | ||
| 206 | + params: { | ||
| 207 | + page: 0 | ||
| 208 | + } | ||
| 209 | + }, | ||
| 210 | + get: { | ||
| 211 | + method: 'GET' | ||
| 212 | + }, | ||
| 213 | + save: { | ||
| 214 | + method: 'POST' | ||
| 215 | + }, | ||
| 216 | + delete: { | ||
| 217 | + method: 'DELETE' | ||
| 218 | + } | ||
| 219 | + } | ||
| 220 | + ), | ||
| 221 | + validate: $resource( // TODO: | ||
| 222 | + '/personnel/validate/:type', | ||
| 223 | + {}, | ||
| 224 | + { | ||
| 225 | + jobCode: { | ||
| 226 | + method: 'GET' | ||
| 227 | + } | ||
| 228 | + } | ||
| 229 | + ) | ||
| 230 | + }; | ||
| 231 | +}]); | ||
| 232 | +// 路牌管理service | ||
| 233 | +angular.module('ScheduleApp').factory('GuideboardManageService_g', ['$resource', function($resource) { | ||
| 234 | + return { | ||
| 235 | + rest: $resource( | ||
| 236 | + '/gic/:id', | ||
| 237 | + {order: 'xl,isCancel', direction: 'DESC,ASC', id: '@id_route'}, | ||
| 238 | + { | ||
| 239 | + list: { | ||
| 240 | + method: 'GET', | ||
| 241 | + params: { | ||
| 242 | + page: 0 | ||
| 243 | + }, | ||
| 244 | + transformResponse: function(rs) { | ||
| 245 | + var dst = angular.fromJson(rs); | ||
| 246 | + if (dst.status == 'SUCCESS') { | ||
| 247 | + return dst.data; | ||
| 248 | + } else { | ||
| 249 | + return dst; | ||
| 250 | + } | ||
| 251 | + } | ||
| 252 | + }, | ||
| 253 | + get: { | ||
| 254 | + method: 'GET', | ||
| 255 | + transformResponse: function(rs) { | ||
| 256 | + var dst = angular.fromJson(rs); | ||
| 257 | + if (dst.status == 'SUCCESS') { | ||
| 258 | + return dst.data; | ||
| 259 | + } else { | ||
| 260 | + return dst; | ||
| 261 | + } | ||
| 262 | + } | ||
| 263 | + }, | ||
| 264 | + save: { | ||
| 265 | + method: 'POST' | ||
| 266 | + } | ||
| 267 | + // 内部还有默认的方法delete | ||
| 268 | + } | ||
| 269 | + ) | ||
| 270 | + }; | ||
| 271 | +}]); | ||
| 272 | +// 套跑管理service | ||
| 273 | +angular.module('ScheduleApp').factory('rerunManageService_g', ['$resource', function($resource) { | ||
| 274 | + return { | ||
| 275 | + rest: $resource( | ||
| 276 | + 'rms/:id', | ||
| 277 | + {order: 'rerunXl.id,isCancel', direction: 'ASC', id: '@id_route'}, | ||
| 278 | + { | ||
| 279 | + list: { | ||
| 280 | + method: 'GET', | ||
| 281 | + params: { | ||
| 282 | + page: 0 | ||
| 283 | + } | ||
| 284 | + }, | ||
| 285 | + get: { | ||
| 286 | + method: 'GET' | ||
| 287 | + }, | ||
| 288 | + save: { | ||
| 289 | + method: 'POST' | ||
| 290 | + }, | ||
| 291 | + delete: { | ||
| 292 | + method: 'DELETE' | ||
| 293 | + } | ||
| 294 | + } | ||
| 295 | + ) | ||
| 296 | + }; | ||
| 297 | +}]); | ||
| 298 | +// 排班计划管理service | ||
| 299 | +angular.module('ScheduleApp').factory('SchedulePlanManageService_g', ['$resource', function($resource) { | ||
| 300 | + return { | ||
| 301 | + rest : $resource( | ||
| 302 | + '/spc/:id', | ||
| 303 | + {order: 'xl.id,createDate', direction: 'DESC,DESC', id: '@id_route'}, | ||
| 304 | + { | ||
| 305 | + list: { | ||
| 306 | + method: 'GET', | ||
| 307 | + params: { | ||
| 308 | + page: 0 | ||
| 309 | + } | ||
| 310 | + }, | ||
| 311 | + get: { | ||
| 312 | + method: 'GET' | ||
| 313 | + }, | ||
| 314 | + save: { | ||
| 315 | + method: 'POST' | ||
| 316 | + }, | ||
| 317 | + delete: { | ||
| 318 | + method: 'DELETE' | ||
| 319 | + } | ||
| 320 | + } | ||
| 321 | + ), | ||
| 322 | + tommorw: $resource( | ||
| 323 | + '/spc/tommorw', | ||
| 324 | + {}, | ||
| 325 | + { | ||
| 326 | + list: { | ||
| 327 | + method: 'GET' | ||
| 328 | + } | ||
| 329 | + } | ||
| 330 | + ) | ||
| 331 | + }; | ||
| 332 | +}]); | ||
| 333 | + | ||
| 334 | +// 排班计划明细管理service | ||
| 335 | +angular.module('ScheduleApp').factory('SchedulePlanInfoManageService_g', ['$resource', function($resource) { | ||
| 336 | + return { | ||
| 337 | + rest : $resource( | ||
| 338 | + '/spic/:id', | ||
| 339 | + {order: 'scheduleDate,lp,fcno', direction: 'ASC,ASC,ASC', id: '@id_route'}, | ||
| 340 | + { | ||
| 341 | + list: { | ||
| 342 | + method: 'GET', | ||
| 343 | + params: { | ||
| 344 | + page: 0 | ||
| 345 | + } | ||
| 346 | + }, | ||
| 347 | + get: { | ||
| 348 | + method: 'GET' | ||
| 349 | + }, | ||
| 350 | + save: { | ||
| 351 | + method: 'POST' | ||
| 352 | + } | ||
| 353 | + } | ||
| 354 | + ), | ||
| 355 | + groupinfo : $resource( | ||
| 356 | + '/spic/groupinfos/:xlid/:sdate', | ||
| 357 | + {}, | ||
| 358 | + { | ||
| 359 | + list: { | ||
| 360 | + method: 'GET', | ||
| 361 | + isArray: true | ||
| 362 | + } | ||
| 363 | + } | ||
| 364 | + ), | ||
| 365 | + updateGroupInfo : $resource( | ||
| 366 | + '/spic/groupinfos/update', | ||
| 367 | + {}, | ||
| 368 | + { | ||
| 369 | + update: { | ||
| 370 | + method: 'POST' | ||
| 371 | + } | ||
| 372 | + } | ||
| 373 | + ) | ||
| 374 | + }; | ||
| 375 | +}]); | ||
| 376 | +// 排班管理service | ||
| 377 | +angular.module('ScheduleApp').factory('ScheduleRuleManageService_g', ['$resource', function($resource) { | ||
| 378 | + return { | ||
| 379 | + rest: $resource( | ||
| 380 | + '/sr1fc/:id', | ||
| 381 | + {order: 'createDate', direction: 'DESC', id: '@id_route'}, | ||
| 382 | + { | ||
| 383 | + list: { | ||
| 384 | + method: 'GET', | ||
| 385 | + params: { | ||
| 386 | + page: 0 | ||
| 387 | + } | ||
| 388 | + }, | ||
| 389 | + get: { | ||
| 390 | + method: 'GET' | ||
| 391 | + }, | ||
| 392 | + save: { | ||
| 393 | + method: 'POST' | ||
| 394 | + }, | ||
| 395 | + delete: { | ||
| 396 | + method: 'DELETE' | ||
| 397 | + } | ||
| 398 | + } | ||
| 399 | + ) | ||
| 400 | + }; | ||
| 401 | +}]); | ||
| 402 | + | ||
| 403 | +// 时刻表管理service | ||
| 404 | +angular.module('ScheduleApp').factory('TimeTableManageService_g', ['$resource', function($resource) { | ||
| 405 | + return { | ||
| 406 | + rest: $resource( | ||
| 407 | + '/tic/:id', | ||
| 408 | + {order: 'xl,isCancel,isEnableDisTemplate,qyrq', direction: 'DESC,ASC,DESC,DESC', id: '@id'}, | ||
| 409 | + { | ||
| 410 | + list: { | ||
| 411 | + method: 'GET', | ||
| 412 | + params: { | ||
| 413 | + page: 0 | ||
| 414 | + } | ||
| 415 | + } | ||
| 416 | + } | ||
| 417 | + ) | ||
| 418 | + }; | ||
| 419 | +}]); | ||
| 420 | + | ||
| 421 | +// 时刻表明细管理service | ||
| 422 | +angular.module('ScheduleApp').factory('TimeTableDetailManageService_g', ['$resource', function($resource) { | ||
| 423 | + return { | ||
| 424 | + rest: $resource( | ||
| 425 | + '/tidc/:id', | ||
| 426 | + {order: 'createDate', direction: 'DESC', id: '@id_route'}, | ||
| 427 | + { | ||
| 428 | + get: { | ||
| 429 | + method: 'GET' | ||
| 430 | + }, | ||
| 431 | + save: { | ||
| 432 | + method: 'POST' | ||
| 433 | + } | ||
| 434 | + } | ||
| 435 | + ), | ||
| 436 | + import: $resource( | ||
| 437 | + '/tidc/importfile', | ||
| 438 | + {}, | ||
| 439 | + { | ||
| 440 | + do: { | ||
| 441 | + method: 'POST', | ||
| 442 | + headers: { | ||
| 443 | + 'Content-Type': 'application/x-www-form-urlencoded' | ||
| 444 | + }, | ||
| 445 | + transformRequest: function(obj) { | ||
| 446 | + var str = []; | ||
| 447 | + for (var p in obj) { | ||
| 448 | + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p])); | ||
| 449 | + } | ||
| 450 | + return str.join("&"); | ||
| 451 | + } | ||
| 452 | + } | ||
| 453 | + } | ||
| 454 | + ), | ||
| 455 | + edit: $resource( | ||
| 456 | + '/tidc/edit/:xlid/:ttid', | ||
| 457 | + {}, | ||
| 458 | + { | ||
| 459 | + list: { | ||
| 460 | + method: 'GET' | ||
| 461 | + } | ||
| 462 | + } | ||
| 463 | + ), | ||
| 464 | + bcdetails: $resource( | ||
| 465 | + '/tidc/bcdetail', | ||
| 466 | + {}, | ||
| 467 | + { | ||
| 468 | + list: { | ||
| 469 | + method: 'GET', | ||
| 470 | + isArray: true | ||
| 471 | + } | ||
| 472 | + } | ||
| 473 | + ), | ||
| 474 | + dataTools: $resource( | ||
| 475 | + '/tidc/:type', | ||
| 476 | + {}, | ||
| 477 | + { | ||
| 478 | + dataExport: { | ||
| 479 | + method: 'GET', | ||
| 480 | + responseType: "arraybuffer", | ||
| 481 | + params: { | ||
| 482 | + type: "dataExportExt" | ||
| 483 | + }, | ||
| 484 | + transformResponse: function(data, headers){ | ||
| 485 | + return {data : data}; | ||
| 486 | + } | ||
| 487 | + } | ||
| 488 | + } | ||
| 489 | + ) | ||
| 490 | + | ||
| 491 | + // TODO:导入数据 | ||
| 492 | + }; | ||
| 493 | +}]); | ||
| 494 | +// 项目通用的全局service服务,供不同的controller使用,自定义指令不使用 | ||
| 495 | + | ||
| 496 | +// 文件下载服务 | ||
| 497 | +angular.module('ScheduleApp').factory('FileDownload_g', function() { | ||
| 498 | + return { | ||
| 499 | + downloadFile: function (data, mimeType, fileName) { | ||
| 500 | + var success = false; | ||
| 501 | + var blob = new Blob([data], { type: mimeType }); | ||
| 502 | + try { | ||
| 503 | + if (navigator.msSaveBlob) | ||
| 504 | + navigator.msSaveBlob(blob, fileName); | ||
| 505 | + else { | ||
| 506 | + // Try using other saveBlob implementations, if available | ||
| 507 | + var saveBlob = navigator.webkitSaveBlob || navigator.mozSaveBlob || navigator.saveBlob; | ||
| 508 | + if (saveBlob === undefined) throw "Not supported"; | ||
| 509 | + saveBlob(blob, fileName); | ||
| 510 | + } | ||
| 511 | + success = true; | ||
| 512 | + } catch (ex) { | ||
| 513 | + console.log("saveBlob method failed with the following exception:"); | ||
| 514 | + console.log(ex); | ||
| 515 | + } | ||
| 516 | + | ||
| 517 | + if (!success) { | ||
| 518 | + // Get the blob url creator | ||
| 519 | + var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL; | ||
| 520 | + if (urlCreator) { | ||
| 521 | + // Try to use a download link | ||
| 522 | + var link = document.createElement('a'); | ||
| 523 | + if ('download' in link) { | ||
| 524 | + // Try to simulate a click | ||
| 525 | + try { | ||
| 526 | + // Prepare a blob URL | ||
| 527 | + var url = urlCreator.createObjectURL(blob); | ||
| 528 | + link.setAttribute('href', url); | ||
| 529 | + | ||
| 530 | + // Set the download attribute (Supported in Chrome 14+ / Firefox 20+) | ||
| 531 | + link.setAttribute("download", fileName); | ||
| 532 | + | ||
| 533 | + // Simulate clicking the download link | ||
| 534 | + var event = document.createEvent('MouseEvents'); | ||
| 535 | + event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null); | ||
| 536 | + link.dispatchEvent(event); | ||
| 537 | + success = true; | ||
| 538 | + | ||
| 539 | + } catch (ex) { | ||
| 540 | + console.log("Download link method with simulated click failed with the following exception:"); | ||
| 541 | + console.log(ex); | ||
| 542 | + } | ||
| 543 | + } | ||
| 544 | + | ||
| 545 | + if (!success) { | ||
| 546 | + // Fallback to window.location method | ||
| 547 | + try { | ||
| 548 | + // Prepare a blob URL | ||
| 549 | + // Use application/octet-stream when using window.location to force download | ||
| 550 | + var url = urlCreator.createObjectURL(blob); | ||
| 551 | + window.location = url; | ||
| 552 | + console.log("Download link method with window.location succeeded"); | ||
| 553 | + success = true; | ||
| 554 | + } catch (ex) { | ||
| 555 | + console.log("Download link method with window.location failed with the following exception:"); | ||
| 556 | + console.log(ex); | ||
| 557 | + } | ||
| 558 | + } | ||
| 559 | + } | ||
| 560 | + } | ||
| 561 | + | ||
| 562 | + if (!success) { | ||
| 563 | + // Fallback to window.open method | ||
| 564 | + console.log("No methods worked for saving the arraybuffer, using last resort window.open"); | ||
| 565 | + window.open("", '_blank', ''); | ||
| 566 | + } | ||
| 567 | + } | ||
| 568 | + }; | ||
| 569 | +}); | ||
| 570 | + | ||
| 571 | + | ||
| 572 | +/** | ||
| 573 | + * saSelect2指令,根据属性值,动态载入数据,然后支持拼音搜索,点击右边的按钮清除选择并重新载入数据。 | ||
| 574 | + * 1、compile阶段使用的属性如下: | ||
| 575 | + * required:用于和表单验证连接,指定成required="true"才有效。 | ||
| 576 | + * 2、link阶段使用的属性如下 | ||
| 577 | + * model:关联的模型对象 | ||
| 578 | + * name:表单验证时需要的名字 | ||
| 579 | + * type:关联的那种数据值(xl/cl/ry)-> 对应线路信息/车辆信息/人员信息,后面有的继续加 | ||
| 580 | + * modelcolname1:关联的模型字段名字1(一般应该是编码字段) | ||
| 581 | + * modelcolname2:关联的模型字段名字2(一般应该是名字字段) | ||
| 582 | + * datacolname1;内部数据对应的字段名字1(与模型字段1对应) | ||
| 583 | + * datacolname2:内部数据对应的字段名字2(与模型字段2对应) | ||
| 584 | + * showcolname:下拉框显示的内部数据字段名(注意:不是模型数据字段名),TODO:以后考虑放动态表达式,并在compile阶段使用 | ||
| 585 | + * placeholder:select placeholder字符串描述 | ||
| 586 | + * | ||
| 587 | + * $$pyFilter,内部的filter指令,结合简拼音进行拼音过滤。 | ||
| 588 | + * $$SearchInfoService_g,内部使用的数据服务 | ||
| 589 | + */ | ||
| 590 | +// saSelect2指令使用的内部信service | ||
| 591 | +angular.module('ScheduleApp').factory('$$SearchInfoService_g', ['$resource', function($resource) { | ||
| 592 | + return { | ||
| 593 | + xl: $resource( | ||
| 594 | + '/line/:type', | ||
| 595 | + {order: 'name', direction: 'ASC'}, | ||
| 596 | + { | ||
| 597 | + list: { | ||
| 598 | + method: 'GET', | ||
| 599 | + isArray: true | ||
| 600 | + } | ||
| 601 | + } | ||
| 602 | + ), | ||
| 603 | + xlinfo: $resource( | ||
| 604 | + '/lineInformation/:type', | ||
| 605 | + {order: 'line.name', direction: 'ASC'}, | ||
| 606 | + { | ||
| 607 | + list: { | ||
| 608 | + method: 'GET', | ||
| 609 | + isArray: true | ||
| 610 | + } | ||
| 611 | + } | ||
| 612 | + ), | ||
| 613 | + zd: $resource( | ||
| 614 | + '/stationroute/stations', | ||
| 615 | + {order: 'stationCode', direction: 'ASC'}, | ||
| 616 | + { | ||
| 617 | + list: { | ||
| 618 | + method: 'GET', | ||
| 619 | + isArray: true | ||
| 620 | + } | ||
| 621 | + } | ||
| 622 | + ), | ||
| 623 | + tcc: $resource( | ||
| 624 | + '/carpark/:type', | ||
| 625 | + {order: 'parkCode', direction: 'ASC'}, | ||
| 626 | + { | ||
| 627 | + list: { | ||
| 628 | + method: 'GET', | ||
| 629 | + isArray: true | ||
| 630 | + } | ||
| 631 | + } | ||
| 632 | + ), | ||
| 633 | + ry: $resource( | ||
| 634 | + '/personnel/:type', | ||
| 635 | + {order: 'personnelName', direction: 'ASC'}, | ||
| 636 | + { | ||
| 637 | + list: { | ||
| 638 | + method: 'GET', | ||
| 639 | + isArray: true | ||
| 640 | + } | ||
| 641 | + } | ||
| 642 | + ), | ||
| 643 | + cl: $resource( | ||
| 644 | + '/cars/:type', | ||
| 645 | + {order: "insideCode", direction: 'ASC'}, | ||
| 646 | + { | ||
| 647 | + list: { | ||
| 648 | + method: 'GET', | ||
| 649 | + isArray: true | ||
| 650 | + } | ||
| 651 | + } | ||
| 652 | + ), | ||
| 653 | + ttInfo: $resource( | ||
| 654 | + '/tic/:type', | ||
| 655 | + {order: "name", direction: 'ASC'}, | ||
| 656 | + { | ||
| 657 | + list: { | ||
| 658 | + method: 'GET', | ||
| 659 | + isArray: true | ||
| 660 | + } | ||
| 661 | + } | ||
| 662 | + ), | ||
| 663 | + lpInfo: $resource( | ||
| 664 | + '/gic/ttlpnames', | ||
| 665 | + {order: "lpName", direction: 'ASC'}, | ||
| 666 | + { | ||
| 667 | + list: { | ||
| 668 | + method: 'GET', | ||
| 669 | + isArray: true | ||
| 670 | + } | ||
| 671 | + } | ||
| 672 | + ), | ||
| 673 | + lpInfo2: $resource( | ||
| 674 | + '/gic/:type', | ||
| 675 | + {order: "lpName", direction: 'ASC'}, | ||
| 676 | + { | ||
| 677 | + list: { | ||
| 678 | + method: 'GET', | ||
| 679 | + isArray: true | ||
| 680 | + } | ||
| 681 | + } | ||
| 682 | + ), | ||
| 683 | + cci: $resource( | ||
| 684 | + '/cci/cars', | ||
| 685 | + {}, | ||
| 686 | + { | ||
| 687 | + list: { | ||
| 688 | + method: 'GET', | ||
| 689 | + isArray: true | ||
| 690 | + } | ||
| 691 | + } | ||
| 692 | + | ||
| 693 | + ), | ||
| 694 | + cci2: $resource( | ||
| 695 | + '/cci/:type', | ||
| 696 | + {}, | ||
| 697 | + { | ||
| 698 | + list: { | ||
| 699 | + method: 'GET', | ||
| 700 | + isArray: true | ||
| 701 | + } | ||
| 702 | + } | ||
| 703 | + ), | ||
| 704 | + cci3: $resource( | ||
| 705 | + '/cci/cars2', | ||
| 706 | + {}, | ||
| 707 | + { | ||
| 708 | + list: { | ||
| 709 | + method: 'GET', | ||
| 710 | + isArray: true | ||
| 711 | + } | ||
| 712 | + } | ||
| 713 | + | ||
| 714 | + ), | ||
| 715 | + eci: $resource( | ||
| 716 | + '/eci/jsy', | ||
| 717 | + {}, | ||
| 718 | + { | ||
| 719 | + list: { | ||
| 720 | + method: 'GET', | ||
| 721 | + isArray: true | ||
| 722 | + } | ||
| 723 | + } | ||
| 724 | + ), | ||
| 725 | + eci2: $resource( | ||
| 726 | + '/eci/spy', | ||
| 727 | + {}, | ||
| 728 | + { | ||
| 729 | + list: { | ||
| 730 | + method: 'GET', | ||
| 731 | + isArray: true | ||
| 732 | + } | ||
| 733 | + } | ||
| 734 | + ), | ||
| 735 | + eci3: $resource( | ||
| 736 | + '/eci/:type', | ||
| 737 | + {}, | ||
| 738 | + { | ||
| 739 | + list: { | ||
| 740 | + method: 'GET', | ||
| 741 | + isArray: true | ||
| 742 | + } | ||
| 743 | + } | ||
| 744 | + ), | ||
| 745 | + | ||
| 746 | + | ||
| 747 | + validate: { // remoteValidation指令用到的resource | ||
| 748 | + gbv1: { // 路牌序号验证 | ||
| 749 | + template: {'xl.id_eq': -1, 'lpNo_eq': 'ddd'}, | ||
| 750 | + remote: $resource( | ||
| 751 | + '/gic/validate1', | ||
| 752 | + {}, | ||
| 753 | + { | ||
| 754 | + do: { | ||
| 755 | + method: 'GET' | ||
| 756 | + } | ||
| 757 | + } | ||
| 758 | + ) | ||
| 759 | + }, | ||
| 760 | + gbv2: { // 路牌名称验证 | ||
| 761 | + template: {'xl.id_eq': -1, 'lpName_eq': 'ddd'}, | ||
| 762 | + remote: $resource( | ||
| 763 | + '/gic/validate2', | ||
| 764 | + {}, | ||
| 765 | + { | ||
| 766 | + do: { | ||
| 767 | + method: 'GET' | ||
| 768 | + } | ||
| 769 | + } | ||
| 770 | + ) | ||
| 771 | + }, | ||
| 772 | + | ||
| 773 | + cars_zbh: { // 自编号验证 | ||
| 774 | + template: {'insideCode_eq': '-1'}, // 查询参数模版 | ||
| 775 | + remote: $resource( // $resource封装对象 | ||
| 776 | + '/cars_sc/validate_zbh', | ||
| 777 | + {}, | ||
| 778 | + { | ||
| 779 | + do: { | ||
| 780 | + method: 'GET' | ||
| 781 | + } | ||
| 782 | + } | ||
| 783 | + ) | ||
| 784 | + }, | ||
| 785 | + | ||
| 786 | + cars_sbbh: { // 验证设备编号 | ||
| 787 | + template: {'equipmentCode_eq': '-1'}, // 查询参数模版 | ||
| 788 | + remote: $resource( // $resource封装对象 | ||
| 789 | + '/cars_sc/validate_sbbh', | ||
| 790 | + {}, | ||
| 791 | + { | ||
| 792 | + do: { | ||
| 793 | + method: 'GET' | ||
| 794 | + } | ||
| 795 | + } | ||
| 796 | + ) | ||
| 797 | + }, | ||
| 798 | + | ||
| 799 | + cars_clbh: { // 车辆编号验证 | ||
| 800 | + template: {'carCode_eq': '-1'}, // 查询参数模版 | ||
| 801 | + remote: $resource( // $resource封装对象 | ||
| 802 | + '/cars_sc/validate_clbh', | ||
| 803 | + {}, | ||
| 804 | + { | ||
| 805 | + do: { | ||
| 806 | + method: 'GET' | ||
| 807 | + } | ||
| 808 | + } | ||
| 809 | + ) | ||
| 810 | + }, | ||
| 811 | + | ||
| 812 | + cars_cph: { // 车牌号验证 | ||
| 813 | + template: {'carPlate_eq': '-1'}, // 查询参数模版 | ||
| 814 | + remote: $resource( // $resource封装对象 | ||
| 815 | + '/cars_sc/validate_cph', | ||
| 816 | + {}, | ||
| 817 | + { | ||
| 818 | + do: { | ||
| 819 | + method: 'GET' | ||
| 820 | + } | ||
| 821 | + } | ||
| 822 | + ) | ||
| 823 | + }, | ||
| 824 | + | ||
| 825 | + | ||
| 826 | + cde1: { // 车辆设备启用日期验证 | ||
| 827 | + template: {'qyrq': 0, 'xl': 1, 'cl': 1}, // 日期毫秒 | ||
| 828 | + remote: $resource( // $resource封装对象 | ||
| 829 | + '/cde//validate/qyrq', | ||
| 830 | + {}, | ||
| 831 | + { | ||
| 832 | + do: { | ||
| 833 | + method: 'GET' | ||
| 834 | + } | ||
| 835 | + } | ||
| 836 | + ) | ||
| 837 | + }, | ||
| 838 | + ttc1: { // 时刻表名字验证 | ||
| 839 | + template: {'xl.id_eq': -1, 'name_eq': 'ddd'}, | ||
| 840 | + remote: $resource( // $resource封装对象 | ||
| 841 | + '/tic/validate/equale', | ||
| 842 | + {}, | ||
| 843 | + { | ||
| 844 | + do: { | ||
| 845 | + method: 'GET' | ||
| 846 | + } | ||
| 847 | + } | ||
| 848 | + ) | ||
| 849 | + }, | ||
| 850 | + sheet: { // 时刻表sheet工作区验证 | ||
| 851 | + template: {'filename': '', 'sheetname': '', 'lineid': -1, 'linename': ''}, | ||
| 852 | + remote: $resource( // $resource封装对象 | ||
| 853 | + '/tidc/validate/sheet', | ||
| 854 | + {}, | ||
| 855 | + { | ||
| 856 | + do: { | ||
| 857 | + method: 'POST', | ||
| 858 | + headers: { | ||
| 859 | + 'Content-Type': 'application/x-www-form-urlencoded' | ||
| 860 | + }, | ||
| 861 | + transformRequest: function(obj) { | ||
| 862 | + var str = []; | ||
| 863 | + for (var p in obj) { | ||
| 864 | + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p])); | ||
| 865 | + } | ||
| 866 | + return str.join("&"); | ||
| 867 | + } | ||
| 868 | + } | ||
| 869 | + } | ||
| 870 | + ) | ||
| 871 | + }, | ||
| 872 | + sheetli: { // 时刻表线路标准验证 | ||
| 873 | + template: {'lineinfoid': -1}, | ||
| 874 | + remote: $resource( // $resource封装对象 | ||
| 875 | + '/tidc/validate/lineinfo', | ||
| 876 | + {}, | ||
| 877 | + { | ||
| 878 | + do: { | ||
| 879 | + method: 'GET' | ||
| 880 | + } | ||
| 881 | + } | ||
| 882 | + ) | ||
| 883 | + } | ||
| 884 | + } | ||
| 885 | + | ||
| 886 | + //validate: $resource( | ||
| 887 | + // '/cars/validate/:type', | ||
| 888 | + // {}, | ||
| 889 | + // { | ||
| 890 | + // insideCode: { | ||
| 891 | + // method: 'GET' | ||
| 892 | + // } | ||
| 893 | + // } | ||
| 894 | + //) | ||
| 895 | + | ||
| 896 | + | ||
| 897 | + | ||
| 898 | + } | ||
| 899 | +}]); | ||
| 900 | + | ||
| 901 | + | ||
| 902 | + |
src/main/resources/static/pages/scheduleApp/module/common/prj-common-ui-route-state.js
| @@ -91,7 +91,7 @@ ScheduleApp.config([ | @@ -91,7 +91,7 @@ ScheduleApp.config([ | ||
| 91 | } | 91 | } |
| 92 | }) | 92 | }) |
| 93 | } | 93 | } |
| 94 | -]); | 94 | +]); |
| 95 | // ui route 配置 | 95 | // ui route 配置 |
| 96 | 96 | ||
| 97 | /** 车辆设备信息模块配置route */ | 97 | /** 车辆设备信息模块配置route */ |
| @@ -185,7 +185,7 @@ ScheduleApp.config([ | @@ -185,7 +185,7 @@ ScheduleApp.config([ | ||
| 185 | }) | 185 | }) |
| 186 | 186 | ||
| 187 | } | 187 | } |
| 188 | -]); | 188 | +]); |
| 189 | // ui route 配置 | 189 | // ui route 配置 |
| 190 | 190 | ||
| 191 | /** 人员基础信息模块配置route */ | 191 | /** 人员基础信息模块配置route */ |
| @@ -279,7 +279,7 @@ ScheduleApp.config([ | @@ -279,7 +279,7 @@ ScheduleApp.config([ | ||
| 279 | } | 279 | } |
| 280 | }) | 280 | }) |
| 281 | 281 | ||
| 282 | -}]); | 282 | +}]); |
| 283 | // ui route 配置 | 283 | // ui route 配置 |
| 284 | 284 | ||
| 285 | /** 车辆配置模块页面route */ | 285 | /** 车辆配置模块页面route */ |
| @@ -376,7 +376,7 @@ ScheduleApp.config([ | @@ -376,7 +376,7 @@ ScheduleApp.config([ | ||
| 376 | ]); | 376 | ]); |
| 377 | 377 | ||
| 378 | 378 | ||
| 379 | - | 379 | + |
| 380 | // ui route 配置 | 380 | // ui route 配置 |
| 381 | 381 | ||
| 382 | /** 线路运营概览配置route */ | 382 | /** 线路运营概览配置route */ |
| @@ -413,7 +413,7 @@ ScheduleApp.config([ | @@ -413,7 +413,7 @@ ScheduleApp.config([ | ||
| 413 | }); | 413 | }); |
| 414 | 414 | ||
| 415 | } | 415 | } |
| 416 | -]); | 416 | +]); |
| 417 | // ui route 配置 | 417 | // ui route 配置 |
| 418 | 418 | ||
| 419 | /** 人员配置模块页面route */ | 419 | /** 人员配置模块页面route */ |
| @@ -508,63 +508,102 @@ ScheduleApp.config([ | @@ -508,63 +508,102 @@ ScheduleApp.config([ | ||
| 508 | }) | 508 | }) |
| 509 | 509 | ||
| 510 | } | 510 | } |
| 511 | -]); | ||
| 512 | -// ui route 配置 | ||
| 513 | - | ||
| 514 | -/** 路牌管理配置所有模块页面route */ | ||
| 515 | -ScheduleApp.config([ | ||
| 516 | - '$stateProvider', | ||
| 517 | - '$urlRouterProvider', | ||
| 518 | - function($stateProvider, $urlRouterProvider) { | ||
| 519 | - // 默认路由 | ||
| 520 | - //$urlRouterProvider.otherwise('/busConfig.html'); | ||
| 521 | - | ||
| 522 | - $stateProvider | ||
| 523 | - .state("guideboardManage", { // index页面 | ||
| 524 | - url: '/guideboardManage', | ||
| 525 | - views: { | ||
| 526 | - "": { | ||
| 527 | - templateUrl: 'pages/scheduleApp/module/core/guideboardManage/index.html' | ||
| 528 | - }, | ||
| 529 | - "guideboardManage_list@guideboardManage": { | ||
| 530 | - templateUrl: 'pages/scheduleApp/module/core/guideboardManage/list.html' | ||
| 531 | - } | ||
| 532 | - }, | ||
| 533 | - | ||
| 534 | - resolve: { | ||
| 535 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 536 | - return $ocLazyLoad.load({ | ||
| 537 | - name: 'guideboardManage_module', | ||
| 538 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 539 | - files: [ | ||
| 540 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 541 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 542 | - "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js", | ||
| 543 | - "pages/scheduleApp/module/core/guideboardManage/module.js" | ||
| 544 | - ] | ||
| 545 | - }); | ||
| 546 | - }] | ||
| 547 | - } | ||
| 548 | - }) | ||
| 549 | - .state("guideboardManage_detail", { // 详细信息页面 | ||
| 550 | - url: '/guideboardManage_detail/:id', | ||
| 551 | - views: { | ||
| 552 | - "": {templateUrl: 'pages/scheduleApp/module/core/guideboardManage/detail.html'} | ||
| 553 | - }, | ||
| 554 | - resolve: { | ||
| 555 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 556 | - return $ocLazyLoad.load({ | ||
| 557 | - name: 'guideboardManage_detail_module', | ||
| 558 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 559 | - files: [ | ||
| 560 | - "pages/scheduleApp/module/core/guideboardManage/module.js" | ||
| 561 | - ] | ||
| 562 | - }); | ||
| 563 | - }] | ||
| 564 | - } | ||
| 565 | - }) | ||
| 566 | - | ||
| 567 | -}]); | 511 | +]); |
| 512 | +// ui route 配置 | ||
| 513 | + | ||
| 514 | +/** 路牌管理配置所有模块页面route */ | ||
| 515 | +ScheduleApp.config([ | ||
| 516 | + '$stateProvider', | ||
| 517 | + '$urlRouterProvider', | ||
| 518 | + function($stateProvider, $urlRouterProvider) { | ||
| 519 | + // 默认路由 | ||
| 520 | + //$urlRouterProvider.otherwise('/busConfig.html'); | ||
| 521 | + | ||
| 522 | + $stateProvider | ||
| 523 | + .state("guideboardManage", { // index页面 | ||
| 524 | + url: '/guideboardManage', | ||
| 525 | + views: { | ||
| 526 | + "": { | ||
| 527 | + templateUrl: 'pages/scheduleApp/module/core/guideboardManage/index.html' | ||
| 528 | + }, | ||
| 529 | + "guideboardManage_list@guideboardManage": { | ||
| 530 | + templateUrl: 'pages/scheduleApp/module/core/guideboardManage/list.html' | ||
| 531 | + } | ||
| 532 | + }, | ||
| 533 | + | ||
| 534 | + resolve: { | ||
| 535 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 536 | + return $ocLazyLoad.load({ | ||
| 537 | + name: 'guideboardManage_module', | ||
| 538 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 539 | + files: [ | ||
| 540 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 541 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 542 | + "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js", | ||
| 543 | + "pages/scheduleApp/module/core/guideboardManage/module.js" | ||
| 544 | + ] | ||
| 545 | + }); | ||
| 546 | + }] | ||
| 547 | + } | ||
| 548 | + }) | ||
| 549 | + .state('guideboardManage_form', { // 添加路牌form | ||
| 550 | + url: '/guideboardManage_form', | ||
| 551 | + views: { | ||
| 552 | + '': {templateUrl: 'pages/scheduleApp/module/core/guideboardManage/form.html'} | ||
| 553 | + }, | ||
| 554 | + resolve: { | ||
| 555 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 556 | + return $ocLazyLoad.load({ | ||
| 557 | + name: 'guideboardManage_form_module', | ||
| 558 | + insertBefore: '#ng_load_plugins_before', | ||
| 559 | + files: [ | ||
| 560 | + 'assets/bower_components/angular-ui-select/dist/select.min.css', | ||
| 561 | + 'assets/bower_components/angular-ui-select/dist/select.min.js', | ||
| 562 | + 'pages/scheduleApp/module/core/guideboardManage/module.js' | ||
| 563 | + ] | ||
| 564 | + }); | ||
| 565 | + }] | ||
| 566 | + } | ||
| 567 | + }) | ||
| 568 | + .state('guideboardManage_edit', { // 修改路牌form | ||
| 569 | + url: '/guideboardManage_edit/:id', | ||
| 570 | + views: { | ||
| 571 | + '': {templateUrl: 'pages/scheduleApp/module/core/guideboardManage/edit.html'} | ||
| 572 | + }, | ||
| 573 | + resolve: { | ||
| 574 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 575 | + return $ocLazyLoad.load({ | ||
| 576 | + name: 'guideboardManage_edit_module', | ||
| 577 | + insertBefore: '#ng_load_plugins_before', | ||
| 578 | + files: [ | ||
| 579 | + 'assets/bower_components/angular-ui-select/dist/select.min.css', | ||
| 580 | + 'assets/bower_components/angular-ui-select/dist/select.min.js', | ||
| 581 | + 'pages/scheduleApp/module/core/guideboardManage/module.js' | ||
| 582 | + ] | ||
| 583 | + }); | ||
| 584 | + }] | ||
| 585 | + } | ||
| 586 | + }) | ||
| 587 | + .state("guideboardManage_detail", { // 详细信息页面 | ||
| 588 | + url: '/guideboardManage_detail/:id', | ||
| 589 | + views: { | ||
| 590 | + "": {templateUrl: 'pages/scheduleApp/module/core/guideboardManage/detail.html'} | ||
| 591 | + }, | ||
| 592 | + resolve: { | ||
| 593 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 594 | + return $ocLazyLoad.load({ | ||
| 595 | + name: 'guideboardManage_detail_module', | ||
| 596 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 597 | + files: [ | ||
| 598 | + "pages/scheduleApp/module/core/guideboardManage/module.js" | ||
| 599 | + ] | ||
| 600 | + }); | ||
| 601 | + }] | ||
| 602 | + } | ||
| 603 | + }) | ||
| 604 | + | ||
| 605 | + | ||
| 606 | +}]); | ||
| 568 | // ui route 配置 | 607 | // ui route 配置 |
| 569 | 608 | ||
| 570 | /** 套跑管理模块配置页面route */ | 609 | /** 套跑管理模块配置页面route */ |
| @@ -657,7 +696,7 @@ ScheduleApp.config([ | @@ -657,7 +696,7 @@ ScheduleApp.config([ | ||
| 657 | } | 696 | } |
| 658 | }) | 697 | }) |
| 659 | } | 698 | } |
| 660 | -]); | 699 | +]); |
| 661 | // ui route 配置 | 700 | // ui route 配置 |
| 662 | 701 | ||
| 663 | /** 排班计划管理配置route */ | 702 | /** 排班计划管理配置route */ |
| @@ -719,7 +758,7 @@ ScheduleApp.config([ | @@ -719,7 +758,7 @@ ScheduleApp.config([ | ||
| 719 | 758 | ||
| 720 | 759 | ||
| 721 | } | 760 | } |
| 722 | -]); | 761 | +]); |
| 723 | // ui route 配置 | 762 | // ui route 配置 |
| 724 | 763 | ||
| 725 | /** 排班计划明细配置route */ | 764 | /** 排班计划明细配置route */ |
| @@ -757,7 +796,7 @@ ScheduleApp.config([ | @@ -757,7 +796,7 @@ ScheduleApp.config([ | ||
| 757 | }); | 796 | }); |
| 758 | 797 | ||
| 759 | } | 798 | } |
| 760 | -]); | 799 | +]); |
| 761 | // ui route 配置 | 800 | // ui route 配置 |
| 762 | 801 | ||
| 763 | /** 排班调度值勤日报配置route */ | 802 | /** 排班调度值勤日报配置route */ |
| @@ -819,7 +858,7 @@ ScheduleApp.config([ | @@ -819,7 +858,7 @@ ScheduleApp.config([ | ||
| 819 | }); | 858 | }); |
| 820 | 859 | ||
| 821 | } | 860 | } |
| 822 | -]); | 861 | +]); |
| 823 | // ui route 配置 | 862 | // ui route 配置 |
| 824 | 863 | ||
| 825 | /** 排班规则模块配置route */ | 864 | /** 排班规则模块配置route */ |
| @@ -912,102 +951,119 @@ ScheduleApp.config([ | @@ -912,102 +951,119 @@ ScheduleApp.config([ | ||
| 912 | } | 951 | } |
| 913 | }) | 952 | }) |
| 914 | } | 953 | } |
| 915 | -]); | ||
| 916 | -// ui route 配置 | ||
| 917 | - | ||
| 918 | -/** 时刻表管理配置route */ | ||
| 919 | -ScheduleApp.config([ | ||
| 920 | - '$stateProvider', | ||
| 921 | - '$urlRouterProvider', | ||
| 922 | - function($stateProvider, $urlRouterProvider) { | ||
| 923 | - // 默认路由 | ||
| 924 | - //$urlRouterProvider.otherwise('/busConfig.html'); | ||
| 925 | - | ||
| 926 | - $stateProvider | ||
| 927 | - .state("ttInfoManage", { // index页面 | ||
| 928 | - url: '/ttInfoManage', | ||
| 929 | - views: { | ||
| 930 | - "": { | ||
| 931 | - templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/index.html' | ||
| 932 | - }, | ||
| 933 | - "ttInfoManage_list@ttInfoManage": { | ||
| 934 | - templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/list.html' | ||
| 935 | - } | ||
| 936 | - }, | ||
| 937 | - | ||
| 938 | - resolve: { | ||
| 939 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 940 | - return $ocLazyLoad.load({ | ||
| 941 | - name: 'ttInfoManage_module', | ||
| 942 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 943 | - files: [ | ||
| 944 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 945 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 946 | - "pages/scheduleApp/module/core/ttInfoManage/module.js" | ||
| 947 | - ] | ||
| 948 | - }); | ||
| 949 | - }] | ||
| 950 | - } | ||
| 951 | - }) | ||
| 952 | - .state("ttInfoManage_form", { // 添加时刻表信息form | ||
| 953 | - url: '/ttInfoManage_form', | ||
| 954 | - views: { | ||
| 955 | - "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/form.html'} | ||
| 956 | - }, | ||
| 957 | - resolve: { | ||
| 958 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 959 | - return $ocLazyLoad.load({ | ||
| 960 | - name: 'ttInfoManage_form_module', | ||
| 961 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 962 | - files: [ | ||
| 963 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 964 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 965 | - "pages/scheduleApp/module/core/ttInfoManage/module.js" | ||
| 966 | - ] | ||
| 967 | - }); | ||
| 968 | - }] | ||
| 969 | - } | ||
| 970 | - }) | ||
| 971 | - .state("ttInfoManage_edit", { // 修改时刻表信息form | ||
| 972 | - url: '/ttInfoManage_edit/:id', | ||
| 973 | - views: { | ||
| 974 | - "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/edit.html'} | ||
| 975 | - }, | ||
| 976 | - resolve: { | ||
| 977 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 978 | - return $ocLazyLoad.load({ | ||
| 979 | - name: 'ttInfoManage_edit_module', | ||
| 980 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 981 | - files: [ | ||
| 982 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 983 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 984 | - "pages/scheduleApp/module/core/ttInfoManage/module.js" | ||
| 985 | - ] | ||
| 986 | - }); | ||
| 987 | - }] | ||
| 988 | - } | ||
| 989 | - }) | ||
| 990 | - .state("ttInfoManage_detail", { // 时刻表详细信息 | ||
| 991 | - url: '/ttInfoManage_detail/:id', | ||
| 992 | - views: { | ||
| 993 | - "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/detail.html'} | ||
| 994 | - }, | ||
| 995 | - resolve: { | ||
| 996 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 997 | - return $ocLazyLoad.load({ | ||
| 998 | - name: 'ttInfoManage_detail_module', | ||
| 999 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 1000 | - files: [ | ||
| 1001 | - "pages/scheduleApp/module/core/ttInfoManage/module.js" | ||
| 1002 | - ] | ||
| 1003 | - }); | ||
| 1004 | - }] | ||
| 1005 | - } | ||
| 1006 | - }); | ||
| 1007 | - | ||
| 1008 | - | ||
| 1009 | - } | ||
| 1010 | -]); | 954 | +]); |
| 955 | +// ui route 配置 | ||
| 956 | + | ||
| 957 | +/** 时刻表管理配置route */ | ||
| 958 | +ScheduleApp.config([ | ||
| 959 | + '$stateProvider', | ||
| 960 | + '$urlRouterProvider', | ||
| 961 | + function($stateProvider, $urlRouterProvider) { | ||
| 962 | + // 默认路由 | ||
| 963 | + //$urlRouterProvider.otherwise('/busConfig.html'); | ||
| 964 | + | ||
| 965 | + $stateProvider | ||
| 966 | + .state("ttInfoManage", { // index页面 | ||
| 967 | + url: '/ttInfoManage', | ||
| 968 | + views: { | ||
| 969 | + "": { | ||
| 970 | + templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/index.html' | ||
| 971 | + }, | ||
| 972 | + "ttInfoManage_list@ttInfoManage": { | ||
| 973 | + templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/list.html' | ||
| 974 | + } | ||
| 975 | + }, | ||
| 976 | + | ||
| 977 | + resolve: { | ||
| 978 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 979 | + return $ocLazyLoad.load({ | ||
| 980 | + name: 'ttInfoManage_module', | ||
| 981 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 982 | + files: [ | ||
| 983 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 984 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 985 | + "pages/scheduleApp/module/core/ttInfoManage/module.js" | ||
| 986 | + ] | ||
| 987 | + }); | ||
| 988 | + }] | ||
| 989 | + } | ||
| 990 | + }) | ||
| 991 | + .state("ttInfoManage_form", { // 添加时刻表信息form | ||
| 992 | + url: '/ttInfoManage_form', | ||
| 993 | + views: { | ||
| 994 | + "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/form.html'} | ||
| 995 | + }, | ||
| 996 | + resolve: { | ||
| 997 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 998 | + return $ocLazyLoad.load({ | ||
| 999 | + name: 'ttInfoManage_form_module', | ||
| 1000 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 1001 | + files: [ | ||
| 1002 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 1003 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 1004 | + "pages/scheduleApp/module/core/ttInfoManage/module.js" | ||
| 1005 | + ] | ||
| 1006 | + }); | ||
| 1007 | + }] | ||
| 1008 | + } | ||
| 1009 | + }) | ||
| 1010 | + .state("ttInfoManage_edit", { // 修改时刻表信息form | ||
| 1011 | + url: '/ttInfoManage_edit/:id', | ||
| 1012 | + views: { | ||
| 1013 | + "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/edit.html'} | ||
| 1014 | + }, | ||
| 1015 | + resolve: { | ||
| 1016 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 1017 | + return $ocLazyLoad.load({ | ||
| 1018 | + name: 'ttInfoManage_edit_module', | ||
| 1019 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 1020 | + files: [ | ||
| 1021 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 1022 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 1023 | + "pages/scheduleApp/module/core/ttInfoManage/module.js" | ||
| 1024 | + ] | ||
| 1025 | + }); | ||
| 1026 | + }] | ||
| 1027 | + } | ||
| 1028 | + }) | ||
| 1029 | + .state("ttInfoManage_detail", { // 时刻表详细信息 | ||
| 1030 | + url: '/ttInfoManage_detail/:id', | ||
| 1031 | + views: { | ||
| 1032 | + "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/detail.html'} | ||
| 1033 | + }, | ||
| 1034 | + resolve: { | ||
| 1035 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 1036 | + return $ocLazyLoad.load({ | ||
| 1037 | + name: 'ttInfoManage_detail_module', | ||
| 1038 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 1039 | + files: [ | ||
| 1040 | + "pages/scheduleApp/module/core/ttInfoManage/module.js" | ||
| 1041 | + ] | ||
| 1042 | + }); | ||
| 1043 | + }] | ||
| 1044 | + } | ||
| 1045 | + }) | ||
| 1046 | + .state('ttInfoManage_test', { // TODO:测试页面 | ||
| 1047 | + url: '/ttInfoManage_test', | ||
| 1048 | + views: { | ||
| 1049 | + '': {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/test.html'} | ||
| 1050 | + }, | ||
| 1051 | + resolve: { | ||
| 1052 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 1053 | + return $ocLazyLoad.load({ | ||
| 1054 | + name: 'ttInfoManage_test_module', | ||
| 1055 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 1056 | + files: [ | ||
| 1057 | + 'pages/scheduleApp/module/core/ttInfoManage/test.js' | ||
| 1058 | + ] | ||
| 1059 | + }); | ||
| 1060 | + }] | ||
| 1061 | + } | ||
| 1062 | + }) | ||
| 1063 | + | ||
| 1064 | + | ||
| 1065 | + } | ||
| 1066 | +]); | ||
| 1011 | // ui route 配置 | 1067 | // ui route 配置 |
| 1012 | 1068 | ||
| 1013 | /** 时刻表编辑管理配置route */ | 1069 | /** 时刻表编辑管理配置route */ |
src/main/resources/static/pages/scheduleApp/module/core/busConfig/service.js
0 → 100644
| 1 | +// 车辆配置service | ||
| 2 | +angular.module('ScheduleApp').factory('BusConfigService_g', ['$resource', function($resource) { | ||
| 3 | + return { | ||
| 4 | + rest : $resource( | ||
| 5 | + '/cci/:id', | ||
| 6 | + {order: 'xl.id,cl.insideCode,isCancel', direction: 'ASC', id: '@id_route'}, | ||
| 7 | + { | ||
| 8 | + list: { | ||
| 9 | + method: 'GET', | ||
| 10 | + params: { | ||
| 11 | + page: 0 | ||
| 12 | + } | ||
| 13 | + }, | ||
| 14 | + get: { | ||
| 15 | + method: 'GET' | ||
| 16 | + }, | ||
| 17 | + save: { | ||
| 18 | + method: 'POST' | ||
| 19 | + } | ||
| 20 | + } | ||
| 21 | + ) | ||
| 22 | + }; | ||
| 23 | +}]); | ||
| 0 | \ No newline at end of file | 24 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/core/busLineInfoStat/service.js
0 → 100644
| 1 | +// 线路运营统计service | ||
| 2 | +angular.module('ScheduleApp').factory('BusLineInfoStatService_g', ['$resource', function($resource) { | ||
| 3 | + return $resource( | ||
| 4 | + '/bic/:id', | ||
| 5 | + {order: 'createDate', direction: 'DESC', id: '@id_route'}, // TODO:以后需要根据属性对象的属性查询 | ||
| 6 | + { | ||
| 7 | + list: { | ||
| 8 | + method: 'GET', | ||
| 9 | + params: { | ||
| 10 | + page: 0 | ||
| 11 | + } | ||
| 12 | + } | ||
| 13 | + } | ||
| 14 | + ); | ||
| 15 | +}]); |
src/main/resources/static/pages/scheduleApp/module/core/employeeConfig/service.js
0 → 100644
| 1 | +// 人员配置service | ||
| 2 | +angular.module('ScheduleApp').factory('EmployeeConfigService_g', ['$resource', function($resource) { | ||
| 3 | + return { | ||
| 4 | + rest : $resource( | ||
| 5 | + '/eci/:id', | ||
| 6 | + {order: 'xl.id,isCancel,dbbmFormula', direction: 'ASC', id: '@id_route'}, | ||
| 7 | + { | ||
| 8 | + list: { | ||
| 9 | + method: 'GET', | ||
| 10 | + params: { | ||
| 11 | + page: 0 | ||
| 12 | + } | ||
| 13 | + }, | ||
| 14 | + get: { | ||
| 15 | + method: 'GET' | ||
| 16 | + }, | ||
| 17 | + save: { | ||
| 18 | + method: 'POST' | ||
| 19 | + }, | ||
| 20 | + delete: { | ||
| 21 | + method: 'DELETE' | ||
| 22 | + } | ||
| 23 | + } | ||
| 24 | + ), | ||
| 25 | + validate: $resource( // TODO: | ||
| 26 | + '/personnel/validate/:type', | ||
| 27 | + {}, | ||
| 28 | + { | ||
| 29 | + jobCode: { | ||
| 30 | + method: 'GET' | ||
| 31 | + } | ||
| 32 | + } | ||
| 33 | + ) | ||
| 34 | + }; | ||
| 35 | +}]); | ||
| 0 | \ No newline at end of file | 36 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/core/guideboardManage/edit.html
| 1 | +<div class="page-head"> | ||
| 2 | + <div class="page-title"> | ||
| 3 | + <h1>路牌管理</h1> | ||
| 4 | + </div> | ||
| 5 | +</div> | ||
| 6 | + | ||
| 7 | +<ul class="page-breadcrumb breadcrumb"> | ||
| 8 | + <li> | ||
| 9 | + <a href="/pages/home.html" data-pjax="">首页</a> | ||
| 10 | + <i class="fa fa-circle"></i> | ||
| 11 | + </li> | ||
| 12 | + <li> | ||
| 13 | + <span class="active">运营计划管理</span> | ||
| 14 | + <i class="fa fa-circle"></i> | ||
| 15 | + </li> | ||
| 16 | + <li> | ||
| 17 | + <a ui-sref="guideboardManage">路牌管理</a> | ||
| 18 | + <i class="fa fa-circle"></i> | ||
| 19 | + </li> | ||
| 20 | + <li> | ||
| 21 | + <span class="active">修改路牌</span> | ||
| 22 | + </li> | ||
| 23 | +</ul> | ||
| 24 | + | ||
| 25 | +<div class="portlet light bordered" ng-controller="GuideboardManageFormCtrl as ctrl"> | ||
| 26 | + <div class="portlet-title"> | ||
| 27 | + <div class="caption"> | ||
| 28 | + <i class="icon-equalizer font-red-sunglo"></i> <span | ||
| 29 | + class="caption-subject font-red-sunglo bold uppercase">表单</span> | ||
| 30 | + </div> | ||
| 31 | + </div> | ||
| 32 | + | ||
| 33 | + <div class="portlet-body form"> | ||
| 34 | + <form ng-submit="ctrl.submit()" class="form-horizontal" novalidate name="myForm"> | ||
| 35 | + | ||
| 36 | + <div class="form-body"> | ||
| 37 | + <div class="form-group has-success has-feedback"> | ||
| 38 | + <label class="col-md-2 control-label">线路*:</label> | ||
| 39 | + <div class="col-md-3"> | ||
| 40 | + <sa-Select5 name="xl" | ||
| 41 | + model="ctrl.guideboardManageForForm" | ||
| 42 | + cmaps="{'xl.id' : 'id'}" | ||
| 43 | + dcname="xl.id" | ||
| 44 | + icname="id" | ||
| 45 | + dsparams="{{ {type: 'ajax', param:{type: 'all', 'destroy_eq': 0}, atype:'xl' } | json }}" | ||
| 46 | + iterobjname="item" | ||
| 47 | + iterobjexp="item.name" | ||
| 48 | + searchph="请输拼音..." | ||
| 49 | + searchexp="this.name" | ||
| 50 | + required > | ||
| 51 | + </sa-Select5> | ||
| 52 | + </div> | ||
| 53 | + <!-- 隐藏块,显示验证信息 --> | ||
| 54 | + <div class="alert alert-danger well-sm" ng-show="myForm.xl.$error.required"> | ||
| 55 | + 线路必须选择 | ||
| 56 | + </div> | ||
| 57 | + </div> | ||
| 58 | + | ||
| 59 | + <div class="form-group has-success has-feedback"> | ||
| 60 | + <label class="col-md-2 control-label">路牌编号:</label> | ||
| 61 | + <div class="col-md-3"> | ||
| 62 | + <input type="number" class="form-control" ng-model="ctrl.guideboardManageForForm.lpNo" | ||
| 63 | + name="lpNo" placeholder="请输入路牌编号..." min="1" required | ||
| 64 | + remote-Validation | ||
| 65 | + remotevtype="gbv1" | ||
| 66 | + remotevparam="{{ {'xl.id_eq': ctrl.guideboardManageForForm.xl.id, 'lpNo_eq': ctrl.guideboardManageForForm.lpNo} | json}}" | ||
| 67 | + | ||
| 68 | + /> | ||
| 69 | + </div> | ||
| 70 | + <div class="alert alert-danger well-sm" ng-show="myForm.lpNo.$error.required"> | ||
| 71 | + 路牌编号必须填写 | ||
| 72 | + </div> | ||
| 73 | + <div class="alert alert-danger well-sm" ng-show="myForm.lpNo.$error.number"> | ||
| 74 | + 必须输入数字 | ||
| 75 | + </div> | ||
| 76 | + <div class="alert alert-danger well-sm" ng-show="myForm.lpNo.$error.remote"> | ||
| 77 | + {{$remote_msg}} | ||
| 78 | + </div> | ||
| 79 | + </div> | ||
| 80 | + | ||
| 81 | + <div class="form-group has-success has-feedback"> | ||
| 82 | + <label class="col-md-2 control-label">路牌名称*:</label> | ||
| 83 | + <div class="col-md-3"> | ||
| 84 | + <input type="text" class="form-control" ng-model="ctrl.guideboardManageForForm.lpName" | ||
| 85 | + name="lpName" placeholder="请输入路牌名字..." required | ||
| 86 | + remote-Validation | ||
| 87 | + remotevtype="gbv2" | ||
| 88 | + remotevparam="{{ {'xl.id_eq': ctrl.guideboardManageForForm.xl.id, 'lpName_eq': ctrl.guideboardManageForForm.lpName} | json}}" | ||
| 89 | + | ||
| 90 | + /> | ||
| 91 | + </div> | ||
| 92 | + | ||
| 93 | + <!-- 隐藏块,显示验证信息 --> | ||
| 94 | + <div class="alert alert-danger well-sm" ng-show="myForm.lpName.$error.required"> | ||
| 95 | + 路牌名称必须填写 | ||
| 96 | + </div> | ||
| 97 | + <div class="alert alert-danger well-sm" ng-show="myForm.lpName.$error.remote"> | ||
| 98 | + {{$remote_msg}} | ||
| 99 | + </div> | ||
| 100 | + </div> | ||
| 101 | + | ||
| 102 | + <!-- 路牌类型暂时是普通路牌,默认填写了 --> | ||
| 103 | + | ||
| 104 | + | ||
| 105 | + </div> | ||
| 106 | + | ||
| 107 | + <div class="form-actions"> | ||
| 108 | + <div class="row"> | ||
| 109 | + <div class="col-md-offset-3 col-md-4"> | ||
| 110 | + <button type="submit" class="btn green" ng-disabled="!myForm.$valid"> | ||
| 111 | + <i class="fa fa-check">提交</i> | ||
| 112 | + </button> | ||
| 113 | + <a type="button" class="btn default" ui-sref="guideboardManage"> | ||
| 114 | + <i class="fa fa-times">取消</i> | ||
| 115 | + </a> | ||
| 116 | + </div> | ||
| 117 | + </div> | ||
| 118 | + </div> | ||
| 119 | + | ||
| 120 | + </form> | ||
| 121 | + | ||
| 122 | + </div> | ||
| 123 | + | ||
| 124 | +</div> | ||
| 125 | + | ||
| 126 | + | ||
| 127 | + | ||
| 128 | + | ||
| 129 | + | ||
| 130 | + | ||
| 131 | + | ||
| 132 | + | ||
| 133 | + | ||
| 134 | + | ||
| 135 | + | ||
| 136 | + |
src/main/resources/static/pages/scheduleApp/module/core/guideboardManage/form.html
| 1 | -<h1>TODO</h1> | ||
| 2 | \ No newline at end of file | 1 | \ No newline at end of file |
| 2 | +<div class="page-head"> | ||
| 3 | + <div class="page-title"> | ||
| 4 | + <h1>路牌管理</h1> | ||
| 5 | + </div> | ||
| 6 | +</div> | ||
| 7 | + | ||
| 8 | +<ul class="page-breadcrumb breadcrumb"> | ||
| 9 | + <li> | ||
| 10 | + <a href="/pages/home.html" data-pjax="">首页</a> | ||
| 11 | + <i class="fa fa-circle"></i> | ||
| 12 | + </li> | ||
| 13 | + <li> | ||
| 14 | + <span class="active">运营计划管理</span> | ||
| 15 | + <i class="fa fa-circle"></i> | ||
| 16 | + </li> | ||
| 17 | + <li> | ||
| 18 | + <a ui-sref="guideboardManage">路牌管理</a> | ||
| 19 | + <i class="fa fa-circle"></i> | ||
| 20 | + </li> | ||
| 21 | + <li> | ||
| 22 | + <span class="active">添加路牌</span> | ||
| 23 | + </li> | ||
| 24 | +</ul> | ||
| 25 | + | ||
| 26 | +<div class="portlet light bordered" ng-controller="GuideboardManageFormCtrl as ctrl"> | ||
| 27 | + <div class="portlet-title"> | ||
| 28 | + <div class="caption"> | ||
| 29 | + <i class="icon-equalizer font-red-sunglo"></i> <span | ||
| 30 | + class="caption-subject font-red-sunglo bold uppercase">表单</span> | ||
| 31 | + </div> | ||
| 32 | + </div> | ||
| 33 | + | ||
| 34 | + <div class="portlet-body form"> | ||
| 35 | + <form ng-submit="ctrl.submit()" class="form-horizontal" novalidate name="myForm"> | ||
| 36 | + | ||
| 37 | + <div class="form-body"> | ||
| 38 | + <div class="form-group has-success has-feedback"> | ||
| 39 | + <label class="col-md-2 control-label">线路*:</label> | ||
| 40 | + <div class="col-md-3"> | ||
| 41 | + <sa-Select5 name="xl" | ||
| 42 | + model="ctrl.guideboardManageForForm" | ||
| 43 | + cmaps="{'xl.id' : 'id'}" | ||
| 44 | + dcname="xl.id" | ||
| 45 | + icname="id" | ||
| 46 | + dsparams="{{ {type: 'ajax', param:{type: 'all', 'destroy_eq': 0}, atype:'xl' } | json }}" | ||
| 47 | + iterobjname="item" | ||
| 48 | + iterobjexp="item.name" | ||
| 49 | + searchph="请输拼音..." | ||
| 50 | + searchexp="this.name" | ||
| 51 | + required > | ||
| 52 | + </sa-Select5> | ||
| 53 | + </div> | ||
| 54 | + <!-- 隐藏块,显示验证信息 --> | ||
| 55 | + <div class="alert alert-danger well-sm" ng-show="myForm.xl.$error.required"> | ||
| 56 | + 线路必须选择 | ||
| 57 | + </div> | ||
| 58 | + </div> | ||
| 59 | + | ||
| 60 | + <div class="form-group has-success has-feedback"> | ||
| 61 | + <label class="col-md-2 control-label">路牌编号:</label> | ||
| 62 | + <div class="col-md-3"> | ||
| 63 | + <input type="number" class="form-control" ng-model="ctrl.guideboardManageForForm.lpNo" | ||
| 64 | + name="lpNo" placeholder="请输入路牌编号..." min="1" required | ||
| 65 | + remote-Validation | ||
| 66 | + remotevtype="gbv1" | ||
| 67 | + remotevparam="{{ {'xl.id_eq': ctrl.guideboardManageForForm.xl.id, 'lpNo_eq': ctrl.guideboardManageForForm.lpNo} | json}}" | ||
| 68 | + | ||
| 69 | + /> | ||
| 70 | + </div> | ||
| 71 | + <div class="alert alert-danger well-sm" ng-show="myForm.lpNo.$error.required"> | ||
| 72 | + 路牌编号必须填写 | ||
| 73 | + </div> | ||
| 74 | + <div class="alert alert-danger well-sm" ng-show="myForm.lpNo.$error.number"> | ||
| 75 | + 必须输入数字 | ||
| 76 | + </div> | ||
| 77 | + <div class="alert alert-danger well-sm" ng-show="myForm.lpNo.$error.remote"> | ||
| 78 | + {{$remote_msg}} | ||
| 79 | + </div> | ||
| 80 | + </div> | ||
| 81 | + | ||
| 82 | + <div class="form-group has-success has-feedback"> | ||
| 83 | + <label class="col-md-2 control-label">路牌名称*:</label> | ||
| 84 | + <div class="col-md-3"> | ||
| 85 | + <input type="text" class="form-control" ng-model="ctrl.guideboardManageForForm.lpName" | ||
| 86 | + name="lpName" placeholder="请输入路牌名字..." required | ||
| 87 | + remote-Validation | ||
| 88 | + remotevtype="gbv2" | ||
| 89 | + remotevparam="{{ {'xl.id_eq': ctrl.guideboardManageForForm.xl.id, 'lpName_eq': ctrl.guideboardManageForForm.lpName} | json}}" | ||
| 90 | + | ||
| 91 | + /> | ||
| 92 | + </div> | ||
| 93 | + | ||
| 94 | + <!-- 隐藏块,显示验证信息 --> | ||
| 95 | + <div class="alert alert-danger well-sm" ng-show="myForm.lpName.$error.required"> | ||
| 96 | + 路牌名称必须填写 | ||
| 97 | + </div> | ||
| 98 | + <div class="alert alert-danger well-sm" ng-show="myForm.lpName.$error.remote"> | ||
| 99 | + {{$remote_msg}} | ||
| 100 | + </div> | ||
| 101 | + </div> | ||
| 102 | + | ||
| 103 | + <!-- 路牌类型暂时是普通路牌,默认填写了 --> | ||
| 104 | + | ||
| 105 | + | ||
| 106 | + </div> | ||
| 107 | + | ||
| 108 | + <div class="form-actions"> | ||
| 109 | + <div class="row"> | ||
| 110 | + <div class="col-md-offset-3 col-md-4"> | ||
| 111 | + <button type="submit" class="btn green" | ||
| 112 | + ng-disabled="!myForm.$valid" | ||
| 113 | + > | ||
| 114 | + <i class="fa fa-check">提交</i> | ||
| 115 | + </button> | ||
| 116 | + <a type="button" class="btn default" ui-sref="guideboardManage"> | ||
| 117 | + <i class="fa fa-times">取消</i> | ||
| 118 | + </a> | ||
| 119 | + </div> | ||
| 120 | + </div> | ||
| 121 | + </div> | ||
| 122 | + | ||
| 123 | + </form> | ||
| 124 | + | ||
| 125 | + </div> | ||
| 126 | + | ||
| 127 | +</div> | ||
| 128 | + | ||
| 129 | + | ||
| 130 | + | ||
| 131 | + |
src/main/resources/static/pages/scheduleApp/module/core/guideboardManage/index.html
| @@ -27,10 +27,10 @@ | @@ -27,10 +27,10 @@ | ||
| 27 | <span class="caption-subject bold uppercase">路牌表</span> | 27 | <span class="caption-subject bold uppercase">路牌表</span> |
| 28 | </div> | 28 | </div> |
| 29 | <div class="actions"> | 29 | <div class="actions"> |
| 30 | - <!--<a href="javascirpt:" class="btn btn-circle blue" ng-click="ctrl.goForm()">--> | ||
| 31 | - <!--<i class="fa fa-plus"></i>--> | ||
| 32 | - <!--添加路牌--> | ||
| 33 | - <!--</a>--> | 30 | + <a ui-sref="guideboardManage_form" class="btn btn-circle blue"> |
| 31 | + <i class="fa fa-plus"></i> | ||
| 32 | + 添加路牌 | ||
| 33 | + </a> | ||
| 34 | 34 | ||
| 35 | <div class="btn-group"> | 35 | <div class="btn-group"> |
| 36 | <a href="javascript:" class="btn red btn-outline btn-circle" data-toggle="dropdown"> | 36 | <a href="javascript:" class="btn red btn-outline btn-circle" data-toggle="dropdown"> |
src/main/resources/static/pages/scheduleApp/module/core/guideboardManage/list.html
| @@ -4,44 +4,55 @@ | @@ -4,44 +4,55 @@ | ||
| 4 | <table class="fixTable table table-striped table-bordered table-hover table-checkable order-column"> | 4 | <table class="fixTable table table-striped table-bordered table-hover table-checkable order-column"> |
| 5 | <thead> | 5 | <thead> |
| 6 | <tr role="row" class="heading"> | 6 | <tr role="row" class="heading"> |
| 7 | - <th style="width: 5%">序号</th> | ||
| 8 | - <th style="width: 15%">线路</th> | ||
| 9 | - <th >路牌编号</th> | 7 | + <th style="width: 50px">序号</th> |
| 8 | + <th style="width: 150px;">线路</th> | ||
| 9 | + <th style="width: 100px;">路牌编号</th> | ||
| 10 | <th >路牌名称</th> | 10 | <th >路牌名称</th> |
| 11 | - <th >路牌类型</th> | ||
| 12 | - <th style="width: 21%">操作</th> | 11 | + <th style="width: 100px;">路牌类型</th> |
| 12 | + <th style="width: 80px;">状态</th> | ||
| 13 | + <th style="width: 20%">操作</th> | ||
| 13 | </tr> | 14 | </tr> |
| 14 | <tr role="row" class="filter"> | 15 | <tr role="row" class="filter"> |
| 15 | <td></td> | 16 | <td></td> |
| 16 | <td> | 17 | <td> |
| 17 | <div> | 18 | <div> |
| 18 | - <sa-Select3 model="ctrl.searchCondition()" | ||
| 19 | - name="xl" | ||
| 20 | - placeholder="请输拼音..." | ||
| 21 | - dcvalue="{{ctrl.searchCondition()['xl.lineCode_eq']}}" | 19 | + <sa-Select5 name="xl" |
| 20 | + model="ctrl.searchCondition()" | ||
| 21 | + cmaps="{'xl.lineCode_eq' : 'lineCode'}" | ||
| 22 | dcname="xl.lineCode_eq" | 22 | dcname="xl.lineCode_eq" |
| 23 | icname="lineCode" | 23 | icname="lineCode" |
| 24 | - icnames="name" | ||
| 25 | - datatype="xl"> | ||
| 26 | - </sa-Select3> | 24 | + dsparams="{{ {type: 'ajax', param:{type: 'all', 'destroy_eq': 0}, atype:'xl' } | json }}" |
| 25 | + iterobjname="item" | ||
| 26 | + iterobjexp="item.name" | ||
| 27 | + searchph="请输拼音..." | ||
| 28 | + searchexp="this.name" | ||
| 29 | + required > | ||
| 30 | + </sa-Select5> | ||
| 27 | </div> | 31 | </div> |
| 28 | </td> | 32 | </td> |
| 29 | <td></td> | 33 | <td></td> |
| 30 | - <td></td> | 34 | + <td> |
| 35 | + <input type="text" class="form-control form-filter input-sm" ng-model="ctrl.searchCondition()['lpName_like']" placeholder="请输入路牌名字..."/> | ||
| 36 | + </td> | ||
| 31 | <td></td> | 37 | <td></td> |
| 32 | <td> | 38 | <td> |
| 39 | + <label class="checkbox-inline"> | ||
| 40 | + <input type="checkbox" ng-model="ctrl.searchCondition()['isCancel_eq']"/>已作废 | ||
| 41 | + </label> | ||
| 42 | + </td> | ||
| 43 | + <td> | ||
| 33 | <button class="btn btn-sm green btn-outline filter-submit margin-bottom" | 44 | <button class="btn btn-sm green btn-outline filter-submit margin-bottom" |
| 34 | - ng-click="ctrl.pageChanaged()"> | 45 | + ng-click="ctrl.doPage()"> |
| 35 | <i class="fa fa-search"></i> 搜索</button> | 46 | <i class="fa fa-search"></i> 搜索</button> |
| 36 | 47 | ||
| 37 | <button class="btn btn-sm red btn-outline filter-cancel" | 48 | <button class="btn btn-sm red btn-outline filter-cancel" |
| 38 | - ng-click="ctrl.resetSearchCondition()"> | 49 | + ng-click="ctrl.reset()"> |
| 39 | <i class="fa fa-times"></i> 重置</button> | 50 | <i class="fa fa-times"></i> 重置</button> |
| 40 | </td> | 51 | </td> |
| 41 | </tr> | 52 | </tr> |
| 42 | </thead> | 53 | </thead> |
| 43 | <tbody> | 54 | <tbody> |
| 44 | - <tr ng-repeat="info in ctrl.pageInfo.infos" class="odd gradeX"> | 55 | + <tr ng-repeat="info in ctrl.page()['content']" ng-class="{odd: true, gradeX: true, danger: info.isCancel}"> |
| 45 | <td> | 56 | <td> |
| 46 | <span ng-bind="$index + 1"></span> | 57 | <span ng-bind="$index + 1"></span> |
| 47 | </td> | 58 | </td> |
| @@ -58,10 +69,16 @@ | @@ -58,10 +69,16 @@ | ||
| 58 | <span ng-bind="info.lpType"></span> | 69 | <span ng-bind="info.lpType"></span> |
| 59 | </td> | 70 | </td> |
| 60 | <td> | 71 | <td> |
| 72 | + <span class="glyphicon glyphicon-ok" ng-if="info.isCancel == '0'"></span> | ||
| 73 | + <span class="glyphicon glyphicon-remove" ng-if="info.isCancel == '1'"></span> | ||
| 74 | + </td> | ||
| 75 | + <td> | ||
| 61 | <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>--> | 76 | <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>--> |
| 62 | <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>--> | 77 | <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>--> |
| 63 | <a ui-sref="guideboardManage_detail({id : info.id})" class="btn btn-info btn-sm"> 详细 </a> | 78 | <a ui-sref="guideboardManage_detail({id : info.id})" class="btn btn-info btn-sm"> 详细 </a> |
| 64 | - <!--<a ui-sref="#" class="btn default blue-stripe btn-sm"> 修改 </a>--> | 79 | + <a ui-sref="guideboardManage_edit({id: info.id})" class="btn btn-info btn-sm" ng-if="info.isCancel == '0'"> 修改 </a> |
| 80 | + <a ng-click="ctrl.toggleCancel(info.id)" class="btn btn-danger btn-sm" ng-if="info.isCancel == '0'"> 作废 </a> | ||
| 81 | + <a ng-click="ctrl.toggleCancel(info.id)" class="btn btn-success btn-sm" ng-if="info.isCancel == '1'"> 撤销 </a> | ||
| 65 | </td> | 82 | </td> |
| 66 | </tr> | 83 | </tr> |
| 67 | </tbody> | 84 | </tbody> |
| @@ -69,9 +86,9 @@ | @@ -69,9 +86,9 @@ | ||
| 69 | </div> | 86 | </div> |
| 70 | 87 | ||
| 71 | <div style="text-align: right;"> | 88 | <div style="text-align: right;"> |
| 72 | - <uib-pagination total-items="ctrl.pageInfo.totalItems" | ||
| 73 | - ng-model="ctrl.pageInfo.currentPage" | ||
| 74 | - ng-change="ctrl.pageChanaged()" | 89 | + <uib-pagination total-items="ctrl.page()['totalElements']" |
| 90 | + ng-model="ctrl.page()['uiNumber']" | ||
| 91 | + ng-change="ctrl.doPage()" | ||
| 75 | rotate="false" | 92 | rotate="false" |
| 76 | max-size="10" | 93 | max-size="10" |
| 77 | boundary-links="true" | 94 | boundary-links="true" |
src/main/resources/static/pages/scheduleApp/module/core/guideboardManage/module.js
| 1 | -// 路牌管理 service controller 等写在一起 | ||
| 2 | - | ||
| 3 | -angular.module('ScheduleApp').factory('GuideboardManageService', ['GuideboardManageService_g', function(service) { | ||
| 4 | - /** 当前的查询条件信息 */ | ||
| 5 | - var currentSearchCondition = {}; | ||
| 6 | - | ||
| 7 | - /** 当前第几页 */ | ||
| 8 | - var currentPageNo = 1; | ||
| 9 | - | ||
| 10 | - return { | ||
| 11 | - /** | ||
| 12 | - * 获取查询条件信息, | ||
| 13 | - * 用于给controller用来和页面数据绑定。 | ||
| 14 | - */ | ||
| 15 | - getSearchCondition: function() { | ||
| 16 | - return currentSearchCondition; | ||
| 17 | - }, | ||
| 18 | - /** | ||
| 19 | - * 重置查询条件信息。 | ||
| 20 | - */ | ||
| 21 | - resetSearchCondition: function() { | ||
| 22 | - var key; | ||
| 23 | - for (key in currentSearchCondition) { | ||
| 24 | - currentSearchCondition[key] = undefined; | ||
| 25 | - } | ||
| 26 | - }, | ||
| 27 | - /** | ||
| 28 | - * 设置当前页码。 | ||
| 29 | - * @param cpn 从1开始,后台是从0开始的 | ||
| 30 | - */ | ||
| 31 | - setCurrentPageNo: function(cpn) { | ||
| 32 | - currentPageNo = cpn; | ||
| 33 | - }, | ||
| 34 | - /** | ||
| 35 | - * 组装查询参数,返回一个promise查询结果。 | ||
| 36 | - * @param params 查询参数 | ||
| 37 | - * @return 返回一个 promise | ||
| 38 | - */ | ||
| 39 | - getPage: function() { | ||
| 40 | - var params = currentSearchCondition; // 查询条件 | ||
| 41 | - params.page = currentPageNo - 1; // 服务端页码从0开始 | ||
| 42 | - return service.rest.list(params).$promise; | ||
| 43 | - }, | ||
| 44 | - /** | ||
| 45 | - * 获取明细信息。 | ||
| 46 | - * @param id 车辆id | ||
| 47 | - * @return 返回一个 promise | ||
| 48 | - */ | ||
| 49 | - getDetail: function(id) { | ||
| 50 | - var params = {id: id}; | ||
| 51 | - return service.rest.get(params).$promise; | ||
| 52 | - }, | ||
| 53 | - /** | ||
| 54 | - * 保存信息。 | ||
| 55 | - * @param obj 车辆详细信息 | ||
| 56 | - * @return 返回一个 promise | ||
| 57 | - */ | ||
| 58 | - saveDetail: function(obj) { | ||
| 59 | - return service.rest.save(obj).$promise; | ||
| 60 | - } | ||
| 61 | - }; | ||
| 62 | -}]); | ||
| 63 | - | ||
| 64 | -angular.module('ScheduleApp').controller('GuideboardManageCtrl', ['GuideboardManageService', '$state', '$uibModal', function(guideboardManageService, $state, $uibModal) { | ||
| 65 | - var self = this; | ||
| 66 | - | ||
| 67 | - // 切换到form状态 | ||
| 68 | - self.goForm = function() { | ||
| 69 | - alert("切换添加"); | ||
| 70 | - }; | ||
| 71 | - | ||
| 72 | - // 导入excel | ||
| 73 | - self.importData = function() { | ||
| 74 | - // large方式弹出模态对话框 | ||
| 75 | - var modalInstance = $uibModal.open({ | ||
| 76 | - templateUrl: '/pages/scheduleApp/module/core/guideboardManage/dataImport.html', | ||
| 77 | - size: "lg", | ||
| 78 | - animation: true, | ||
| 79 | - backdrop: 'static', | ||
| 80 | - resolve: { | ||
| 81 | - // 可以传值给controller | ||
| 82 | - }, | ||
| 83 | - windowClass: 'center-modal', | ||
| 84 | - controller: "GuideboardManageToolsCtrl", | ||
| 85 | - controllerAs: "ctrl", | ||
| 86 | - bindToController: true | ||
| 87 | - }); | ||
| 88 | - modalInstance.result.then( | ||
| 89 | - function() { | ||
| 90 | - console.log("dataImport.html打开"); | ||
| 91 | - }, | ||
| 92 | - function() { | ||
| 93 | - console.log("dataImport.html消失"); | ||
| 94 | - } | ||
| 95 | - ); | ||
| 96 | - }; | ||
| 97 | -}]); | ||
| 98 | - | ||
| 99 | -angular.module('ScheduleApp').controller('GuideboardManageToolsCtrl', ['$modalInstance', 'FileUploader', function($modalInstance, FileUploader) { | ||
| 100 | - var self = this; | ||
| 101 | - self.data = "TODO"; | ||
| 102 | - | ||
| 103 | - // 关闭窗口 | ||
| 104 | - self.close = function() { | ||
| 105 | - $modalInstance.dismiss("cancel"); | ||
| 106 | - }; | ||
| 107 | - | ||
| 108 | - self.clearInputFile = function() { | ||
| 109 | - angular.element("input[type='file']").val(null); | ||
| 110 | - }; | ||
| 111 | - | ||
| 112 | - // 上传文件组件 | ||
| 113 | - self.uploader = new FileUploader({ | ||
| 114 | - url: "/gic/dataImport", | ||
| 115 | - filters: [] // 用于过滤文件,比如只允许导入excel | ||
| 116 | - }); | ||
| 117 | - self.uploader.onAfterAddingFile = function(fileItem) | ||
| 118 | - { | ||
| 119 | - console.info('onAfterAddingFile', fileItem); | ||
| 120 | - console.log(self.uploader.queue.length); | ||
| 121 | - if (self.uploader.queue.length > 1) | ||
| 122 | - self.uploader.removeFromQueue(0); | ||
| 123 | - }; | ||
| 124 | - self.uploader.onSuccessItem = function(fileItem, response, status, headers) | ||
| 125 | - { | ||
| 126 | - console.info('onSuccessItem', fileItem, response, status, headers); | ||
| 127 | - }; | ||
| 128 | - self.uploader.onErrorItem = function(fileItem, response, status, headers) | ||
| 129 | - { | ||
| 130 | - console.info('onErrorItem', fileItem, response, status, headers); | ||
| 131 | - }; | ||
| 132 | - | ||
| 133 | -}]); | ||
| 134 | - | ||
| 135 | -angular.module('ScheduleApp').controller('GuideboardManageListCtrl', ['GuideboardManageService', function(guideboardManageService) { | ||
| 136 | - var self = this; | ||
| 137 | - self.pageInfo = { | ||
| 138 | - totalItems : 0, | ||
| 139 | - currentPage : 1, | ||
| 140 | - infos: [] | ||
| 141 | - }; | ||
| 142 | - | ||
| 143 | - // 初始创建的时候,获取一次列表数据 | ||
| 144 | - guideboardManageService.getPage().then( | ||
| 145 | - function(result) { | ||
| 146 | - self.pageInfo.totalItems = result.totalElements; | ||
| 147 | - self.pageInfo.currentPage = result.number + 1; | ||
| 148 | - self.pageInfo.infos = result.content; | ||
| 149 | - guideboardManageService.setCurrentPageNo(result.number + 1); | ||
| 150 | - }, | ||
| 151 | - function(result) { | ||
| 152 | - alert("出错啦!"); | ||
| 153 | - } | ||
| 154 | - ); | ||
| 155 | - | ||
| 156 | - //$scope.$watch("ctrl.pageInfo.currentPage", function() { | ||
| 157 | - // alert("dfdfdf"); | ||
| 158 | - //}); | ||
| 159 | - | ||
| 160 | - // 翻页的时候调用 | ||
| 161 | - self.pageChanaged = function() { | ||
| 162 | - guideboardManageService.setCurrentPageNo(self.pageInfo.currentPage); | ||
| 163 | - guideboardManageService.getPage().then( | ||
| 164 | - function(result) { | ||
| 165 | - self.pageInfo.totalItems = result.totalElements; | ||
| 166 | - self.pageInfo.currentPage = result.number + 1; | ||
| 167 | - self.pageInfo.infos = result.content; | ||
| 168 | - guideboardManageService.setCurrentPageNo(result.number + 1); | ||
| 169 | - }, | ||
| 170 | - function(result) { | ||
| 171 | - alert("出错啦!"); | ||
| 172 | - } | ||
| 173 | - ); | ||
| 174 | - }; | ||
| 175 | - // 获取查询条件数据 | ||
| 176 | - self.searchCondition = function() { | ||
| 177 | - return guideboardManageService.getSearchCondition(); | ||
| 178 | - }; | ||
| 179 | - // 重置查询条件 | ||
| 180 | - self.resetSearchCondition = function() { | ||
| 181 | - guideboardManageService.resetSearchCondition(); | ||
| 182 | - self.pageInfo.currentPage = 1; | ||
| 183 | - self.pageChanaged(); | ||
| 184 | - }; | ||
| 185 | - | ||
| 186 | -}]); | ||
| 187 | - | ||
| 188 | -angular.module('ScheduleApp').controller('GuideboardManageFormCtrl', ['GuideboardManageService', '$stateParams', '$state', function(guideboardManageService, $stateParams, $state) { | ||
| 189 | - // TODO: | ||
| 190 | -}]); | ||
| 191 | - | ||
| 192 | -angular.module('ScheduleApp').controller('GuideboardManageDetailCtrl', ['GuideboardManageService', '$stateParams', function(guideboardManageService, $stateParams) { | ||
| 193 | - var self = this; | ||
| 194 | - self.title = ""; | ||
| 195 | - self.guideboardForDetail = {}; | ||
| 196 | - self.guideboardForDetail.id = $stateParams.id; | ||
| 197 | - | ||
| 198 | - // 当转向到此页面时,就获取明细信息并绑定 | ||
| 199 | - guideboardManageService.getDetail($stateParams.id).then( | ||
| 200 | - function(result) { | ||
| 201 | - var key; | ||
| 202 | - for (key in result) { | ||
| 203 | - self.guideboardForDetail[key] = result[key]; | ||
| 204 | - } | ||
| 205 | - | ||
| 206 | - self.title = "路牌 " + self.guideboardForDetail.lpName + " 详细信息"; | ||
| 207 | - }, | ||
| 208 | - function(result) { | ||
| 209 | - // TODO:弹出框方式以后改 | ||
| 210 | - alert("出错啦!"); | ||
| 211 | - } | ||
| 212 | - ); | ||
| 213 | -}]); | ||
| 214 | - | ||
| 215 | - | 1 | +// 路牌管理 service controller 等写在一起 |
| 2 | + | ||
| 3 | +angular.module('ScheduleApp').factory( | ||
| 4 | + 'GuideboardManageService', | ||
| 5 | + [ | ||
| 6 | + 'GuideboardManageService_g', | ||
| 7 | + function(service) { | ||
| 8 | + | ||
| 9 | + /** 当前的查询条件信息 */ | ||
| 10 | + var currentSearchCondition = {page: 0, 'isCancel_eq': false}; | ||
| 11 | + // 当前查询返回的信息 | ||
| 12 | + var currentPage = { // 后台spring data返回的格式 | ||
| 13 | + totalElements: 0, | ||
| 14 | + number: 0, // 后台返回的页码,spring返回从0开始 | ||
| 15 | + content: [], | ||
| 16 | + | ||
| 17 | + uiNumber: 1 // 页面绑定的页码 | ||
| 18 | + }; | ||
| 19 | + | ||
| 20 | + // 查询对象类 | ||
| 21 | + var queryClass = service.rest; | ||
| 22 | + | ||
| 23 | + return { | ||
| 24 | + getGbQueryClass: function() { | ||
| 25 | + return queryClass; | ||
| 26 | + }, | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 获取查询条件信息, | ||
| 30 | + * 用于给controller用来和页面数据绑定。 | ||
| 31 | + */ | ||
| 32 | + getSearchCondition: function() { | ||
| 33 | + currentSearchCondition.page = currentPage.uiNumber - 1; | ||
| 34 | + return currentSearchCondition; | ||
| 35 | + }, | ||
| 36 | + /** | ||
| 37 | + * 重置查询条件信息。 | ||
| 38 | + */ | ||
| 39 | + resetStatus: function() { | ||
| 40 | + currentSearchCondition = {page: 0, 'isCancel_eq': false}; | ||
| 41 | + currentPage = { | ||
| 42 | + totalElements: 0, | ||
| 43 | + number: 0, | ||
| 44 | + content: [], | ||
| 45 | + uiNumber: 1 | ||
| 46 | + }; | ||
| 47 | + }, | ||
| 48 | + /** | ||
| 49 | + * 组装查询参数,返回一个promise查询结果。 | ||
| 50 | + * @param params 查询参数 | ||
| 51 | + * @return 返回一个 promise | ||
| 52 | + */ | ||
| 53 | + getPage: function(page) { | ||
| 54 | + if (page) { | ||
| 55 | + currentPage.totalElements = page.totalElements; | ||
| 56 | + currentPage.number = page.number; | ||
| 57 | + currentPage.content = page.content; | ||
| 58 | + } | ||
| 59 | + return currentPage; | ||
| 60 | + }, | ||
| 61 | + /** | ||
| 62 | + * 获取明细信息。 | ||
| 63 | + * @param id 车辆id | ||
| 64 | + * @return 返回一个 promise | ||
| 65 | + */ | ||
| 66 | + getDetail: function(id) { | ||
| 67 | + var params = {id: id}; | ||
| 68 | + return service.rest.get(params).$promise; | ||
| 69 | + }, | ||
| 70 | + /** | ||
| 71 | + * 保存信息。 | ||
| 72 | + * @param obj 车辆详细信息 | ||
| 73 | + * @return 返回一个 promise | ||
| 74 | + */ | ||
| 75 | + saveDetail: function(obj) { | ||
| 76 | + return service.rest.save(obj).$promise; | ||
| 77 | + } | ||
| 78 | + }; | ||
| 79 | + } | ||
| 80 | + ] | ||
| 81 | +); | ||
| 82 | + | ||
| 83 | +angular.module('ScheduleApp').controller('GuideboardManageCtrl', ['GuideboardManageService', '$state', '$uibModal', function(guideboardManageService, $state, $uibModal) { | ||
| 84 | + var self = this; | ||
| 85 | + | ||
| 86 | + // 切换到form状态 | ||
| 87 | + self.goForm = function() { | ||
| 88 | + alert("切换添加"); | ||
| 89 | + }; | ||
| 90 | + | ||
| 91 | + // 导入excel | ||
| 92 | + self.importData = function() { | ||
| 93 | + // large方式弹出模态对话框 | ||
| 94 | + var modalInstance = $uibModal.open({ | ||
| 95 | + templateUrl: '/pages/scheduleApp/module/core/guideboardManage/dataImport.html', | ||
| 96 | + size: "lg", | ||
| 97 | + animation: true, | ||
| 98 | + backdrop: 'static', | ||
| 99 | + resolve: { | ||
| 100 | + // 可以传值给controller | ||
| 101 | + }, | ||
| 102 | + windowClass: 'center-modal', | ||
| 103 | + controller: "GuideboardManageToolsCtrl", | ||
| 104 | + controllerAs: "ctrl", | ||
| 105 | + bindToController: true | ||
| 106 | + }); | ||
| 107 | + modalInstance.result.then( | ||
| 108 | + function() { | ||
| 109 | + console.log("dataImport.html打开"); | ||
| 110 | + }, | ||
| 111 | + function() { | ||
| 112 | + console.log("dataImport.html消失"); | ||
| 113 | + } | ||
| 114 | + ); | ||
| 115 | + }; | ||
| 116 | + | ||
| 117 | +}]); | ||
| 118 | + | ||
| 119 | +angular.module('ScheduleApp').controller('GuideboardManageToolsCtrl', ['$modalInstance', 'FileUploader', function($modalInstance, FileUploader) { | ||
| 120 | + var self = this; | ||
| 121 | + self.data = "TODO"; | ||
| 122 | + | ||
| 123 | + // 关闭窗口 | ||
| 124 | + self.close = function() { | ||
| 125 | + $modalInstance.dismiss("cancel"); | ||
| 126 | + }; | ||
| 127 | + | ||
| 128 | + self.clearInputFile = function() { | ||
| 129 | + angular.element("input[type='file']").val(null); | ||
| 130 | + }; | ||
| 131 | + | ||
| 132 | + // 上传文件组件 | ||
| 133 | + self.uploader = new FileUploader({ | ||
| 134 | + url: "/gic/dataImport", | ||
| 135 | + filters: [] // 用于过滤文件,比如只允许导入excel | ||
| 136 | + }); | ||
| 137 | + self.uploader.onAfterAddingFile = function(fileItem) | ||
| 138 | + { | ||
| 139 | + console.info('onAfterAddingFile', fileItem); | ||
| 140 | + console.log(self.uploader.queue.length); | ||
| 141 | + if (self.uploader.queue.length > 1) | ||
| 142 | + self.uploader.removeFromQueue(0); | ||
| 143 | + }; | ||
| 144 | + self.uploader.onSuccessItem = function(fileItem, response, status, headers) | ||
| 145 | + { | ||
| 146 | + console.info('onSuccessItem', fileItem, response, status, headers); | ||
| 147 | + }; | ||
| 148 | + self.uploader.onErrorItem = function(fileItem, response, status, headers) | ||
| 149 | + { | ||
| 150 | + console.info('onErrorItem', fileItem, response, status, headers); | ||
| 151 | + }; | ||
| 152 | + | ||
| 153 | +}]); | ||
| 154 | + | ||
| 155 | +// list.html控制器 | ||
| 156 | +angular.module('ScheduleApp').controller( | ||
| 157 | + 'GuideboardManageListCtrl', | ||
| 158 | + [ | ||
| 159 | + 'GuideboardManageService', | ||
| 160 | + function(service) { | ||
| 161 | + var self = this; | ||
| 162 | + var Gb = service.getGbQueryClass(); | ||
| 163 | + | ||
| 164 | + self.page = function() { | ||
| 165 | + return service.getPage(); | ||
| 166 | + }; | ||
| 167 | + | ||
| 168 | + self.searchCondition = function() { | ||
| 169 | + return service.getSearchCondition(); | ||
| 170 | + }; | ||
| 171 | + | ||
| 172 | + self.doPage = function() { | ||
| 173 | + var result = Gb.list(self.searchCondition(), function(result) { | ||
| 174 | + service.getPage(result); | ||
| 175 | + }); | ||
| 176 | + }; | ||
| 177 | + self.reset = function() { | ||
| 178 | + service.resetStatus(); | ||
| 179 | + var result = Gb.list(self.searchCondition(), function() { | ||
| 180 | + service.getPage(result); | ||
| 181 | + }); | ||
| 182 | + }; | ||
| 183 | + self.toggleTtinfo = function(id) { | ||
| 184 | + Gb.delete({id: id}, function(result) { | ||
| 185 | + if (result.message) { // 暂时这样做,之后全局拦截 | ||
| 186 | + alert("失败:" + result.message); | ||
| 187 | + } else { | ||
| 188 | + self.doPage(); | ||
| 189 | + } | ||
| 190 | + }); | ||
| 191 | + }; | ||
| 192 | + | ||
| 193 | + // 作废切换 | ||
| 194 | + self.toggleCancel = function(id) { | ||
| 195 | + Gb.delete({id: id}, function(result) { | ||
| 196 | + if (result.status == "ERROR") { // 暂时这样做,之后全局拦截 | ||
| 197 | + alert("失败:" + result.msg); | ||
| 198 | + } else { | ||
| 199 | + self.doPage(); | ||
| 200 | + } | ||
| 201 | + }); | ||
| 202 | + }; | ||
| 203 | + | ||
| 204 | + | ||
| 205 | + // TODO:导出 | ||
| 206 | + | ||
| 207 | + | ||
| 208 | + self.doPage(); | ||
| 209 | + } | ||
| 210 | + ] | ||
| 211 | +); | ||
| 212 | + | ||
| 213 | +//form.html控制器 | ||
| 214 | +angular.module('ScheduleApp').controller( | ||
| 215 | + 'GuideboardManageFormCtrl', | ||
| 216 | + [ | ||
| 217 | + 'GuideboardManageService', | ||
| 218 | + '$stateParams', | ||
| 219 | + '$state', | ||
| 220 | + '$scope', | ||
| 221 | + function(service, $stateParams, $state, $scope) { | ||
| 222 | + var self = this; | ||
| 223 | + var Gb = service.getGbQueryClass(); | ||
| 224 | + | ||
| 225 | + // 欲保存的表单信息,双向绑定 | ||
| 226 | + self.guideboardManageForForm = new Gb; | ||
| 227 | + self.guideboardManageForForm.xl = {}; | ||
| 228 | + | ||
| 229 | + // 如果是修改,获取传过来的id,从后台获取一份数据,用于绑定页面form值 | ||
| 230 | + var id = $stateParams.id; | ||
| 231 | + if (id) { | ||
| 232 | + Gb.get({id: id}, function(value) { | ||
| 233 | + self.guideboardManageForForm = value; | ||
| 234 | + }); | ||
| 235 | + } | ||
| 236 | + // form提交方法 | ||
| 237 | + self.submit = function() { | ||
| 238 | + console.log($scope); | ||
| 239 | + console.log(self.guideboardManageForForm); | ||
| 240 | + | ||
| 241 | + self.guideboardManageForForm.lpType = "普通路牌"; | ||
| 242 | + self.guideboardManageForForm.$save(function() { | ||
| 243 | + $state.go("guideboardManage"); | ||
| 244 | + }); | ||
| 245 | + }; | ||
| 246 | + | ||
| 247 | + } | ||
| 248 | + ] | ||
| 249 | +); | ||
| 250 | + | ||
| 251 | +// detail.html控制器 | ||
| 252 | +angular.module('ScheduleApp').controller( | ||
| 253 | + 'GuideboardManageDetailCtrl', | ||
| 254 | + [ | ||
| 255 | + 'GuideboardManageService', | ||
| 256 | + '$stateParams', | ||
| 257 | + function(service, $stateParams) { | ||
| 258 | + var self = this; | ||
| 259 | + var Gb = service.getGbQueryClass(); | ||
| 260 | + var id = $stateParams.id; | ||
| 261 | + | ||
| 262 | + self.title = ""; | ||
| 263 | + self.guideboardForDetail = {}; | ||
| 264 | + | ||
| 265 | + // 当转向到此页面时,就获取明细信息并绑定 | ||
| 266 | + Gb.get({id: id}, function(result) { | ||
| 267 | + self.guideboardForDetail = result.data; | ||
| 268 | + self.title = "路牌 " + self.guideboardForDetail.lpName + " 详细信息"; | ||
| 269 | + }); | ||
| 270 | + } | ||
| 271 | + ] | ||
| 272 | +); | ||
| 273 | + | ||
| 274 | + |
src/main/resources/static/pages/scheduleApp/module/core/guideboardManage/route.js
| 1 | -// ui route 配置 | ||
| 2 | - | ||
| 3 | -/** 路牌管理配置所有模块页面route */ | ||
| 4 | -ScheduleApp.config([ | ||
| 5 | - '$stateProvider', | ||
| 6 | - '$urlRouterProvider', | ||
| 7 | - function($stateProvider, $urlRouterProvider) { | ||
| 8 | - // 默认路由 | ||
| 9 | - //$urlRouterProvider.otherwise('/busConfig.html'); | ||
| 10 | - | ||
| 11 | - $stateProvider | ||
| 12 | - .state("guideboardManage", { // index页面 | ||
| 13 | - url: '/guideboardManage', | ||
| 14 | - views: { | ||
| 15 | - "": { | ||
| 16 | - templateUrl: 'pages/scheduleApp/module/core/guideboardManage/index.html' | ||
| 17 | - }, | ||
| 18 | - "guideboardManage_list@guideboardManage": { | ||
| 19 | - templateUrl: 'pages/scheduleApp/module/core/guideboardManage/list.html' | ||
| 20 | - } | ||
| 21 | - }, | ||
| 22 | - | ||
| 23 | - resolve: { | ||
| 24 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 25 | - return $ocLazyLoad.load({ | ||
| 26 | - name: 'guideboardManage_module', | ||
| 27 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 28 | - files: [ | ||
| 29 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 30 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 31 | - "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js", | ||
| 32 | - "pages/scheduleApp/module/core/guideboardManage/module.js" | ||
| 33 | - ] | ||
| 34 | - }); | ||
| 35 | - }] | ||
| 36 | - } | ||
| 37 | - }) | ||
| 38 | - .state("guideboardManage_detail", { // 详细信息页面 | ||
| 39 | - url: '/guideboardManage_detail/:id', | ||
| 40 | - views: { | ||
| 41 | - "": {templateUrl: 'pages/scheduleApp/module/core/guideboardManage/detail.html'} | ||
| 42 | - }, | ||
| 43 | - resolve: { | ||
| 44 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 45 | - return $ocLazyLoad.load({ | ||
| 46 | - name: 'guideboardManage_detail_module', | ||
| 47 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 48 | - files: [ | ||
| 49 | - "pages/scheduleApp/module/core/guideboardManage/module.js" | ||
| 50 | - ] | ||
| 51 | - }); | ||
| 52 | - }] | ||
| 53 | - } | ||
| 54 | - }) | ||
| 55 | - | 1 | +// ui route 配置 |
| 2 | + | ||
| 3 | +/** 路牌管理配置所有模块页面route */ | ||
| 4 | +ScheduleApp.config([ | ||
| 5 | + '$stateProvider', | ||
| 6 | + '$urlRouterProvider', | ||
| 7 | + function($stateProvider, $urlRouterProvider) { | ||
| 8 | + // 默认路由 | ||
| 9 | + //$urlRouterProvider.otherwise('/busConfig.html'); | ||
| 10 | + | ||
| 11 | + $stateProvider | ||
| 12 | + .state("guideboardManage", { // index页面 | ||
| 13 | + url: '/guideboardManage', | ||
| 14 | + views: { | ||
| 15 | + "": { | ||
| 16 | + templateUrl: 'pages/scheduleApp/module/core/guideboardManage/index.html' | ||
| 17 | + }, | ||
| 18 | + "guideboardManage_list@guideboardManage": { | ||
| 19 | + templateUrl: 'pages/scheduleApp/module/core/guideboardManage/list.html' | ||
| 20 | + } | ||
| 21 | + }, | ||
| 22 | + | ||
| 23 | + resolve: { | ||
| 24 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 25 | + return $ocLazyLoad.load({ | ||
| 26 | + name: 'guideboardManage_module', | ||
| 27 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 28 | + files: [ | ||
| 29 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 30 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 31 | + "assets/bower_components/angular-file-upload/dist/angular-file-upload.min.js", | ||
| 32 | + "pages/scheduleApp/module/core/guideboardManage/module.js" | ||
| 33 | + ] | ||
| 34 | + }); | ||
| 35 | + }] | ||
| 36 | + } | ||
| 37 | + }) | ||
| 38 | + .state('guideboardManage_form', { // 添加路牌form | ||
| 39 | + url: '/guideboardManage_form', | ||
| 40 | + views: { | ||
| 41 | + '': {templateUrl: 'pages/scheduleApp/module/core/guideboardManage/form.html'} | ||
| 42 | + }, | ||
| 43 | + resolve: { | ||
| 44 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 45 | + return $ocLazyLoad.load({ | ||
| 46 | + name: 'guideboardManage_form_module', | ||
| 47 | + insertBefore: '#ng_load_plugins_before', | ||
| 48 | + files: [ | ||
| 49 | + 'assets/bower_components/angular-ui-select/dist/select.min.css', | ||
| 50 | + 'assets/bower_components/angular-ui-select/dist/select.min.js', | ||
| 51 | + 'pages/scheduleApp/module/core/guideboardManage/module.js' | ||
| 52 | + ] | ||
| 53 | + }); | ||
| 54 | + }] | ||
| 55 | + } | ||
| 56 | + }) | ||
| 57 | + .state('guideboardManage_edit', { // 修改路牌form | ||
| 58 | + url: '/guideboardManage_edit/:id', | ||
| 59 | + views: { | ||
| 60 | + '': {templateUrl: 'pages/scheduleApp/module/core/guideboardManage/edit.html'} | ||
| 61 | + }, | ||
| 62 | + resolve: { | ||
| 63 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 64 | + return $ocLazyLoad.load({ | ||
| 65 | + name: 'guideboardManage_edit_module', | ||
| 66 | + insertBefore: '#ng_load_plugins_before', | ||
| 67 | + files: [ | ||
| 68 | + 'assets/bower_components/angular-ui-select/dist/select.min.css', | ||
| 69 | + 'assets/bower_components/angular-ui-select/dist/select.min.js', | ||
| 70 | + 'pages/scheduleApp/module/core/guideboardManage/module.js' | ||
| 71 | + ] | ||
| 72 | + }); | ||
| 73 | + }] | ||
| 74 | + } | ||
| 75 | + }) | ||
| 76 | + .state("guideboardManage_detail", { // 详细信息页面 | ||
| 77 | + url: '/guideboardManage_detail/:id', | ||
| 78 | + views: { | ||
| 79 | + "": {templateUrl: 'pages/scheduleApp/module/core/guideboardManage/detail.html'} | ||
| 80 | + }, | ||
| 81 | + resolve: { | ||
| 82 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 83 | + return $ocLazyLoad.load({ | ||
| 84 | + name: 'guideboardManage_detail_module', | ||
| 85 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 86 | + files: [ | ||
| 87 | + "pages/scheduleApp/module/core/guideboardManage/module.js" | ||
| 88 | + ] | ||
| 89 | + }); | ||
| 90 | + }] | ||
| 91 | + } | ||
| 92 | + }) | ||
| 93 | + | ||
| 94 | + | ||
| 56 | }]); | 95 | }]); |
| 57 | \ No newline at end of file | 96 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/core/guideboardManage/service.js
0 → 100644
| 1 | +// 路牌管理service | ||
| 2 | +angular.module('ScheduleApp').factory('GuideboardManageService_g', ['$resource', function($resource) { | ||
| 3 | + return { | ||
| 4 | + rest: $resource( | ||
| 5 | + '/gic/:id', | ||
| 6 | + {order: 'xl,isCancel', direction: 'DESC,ASC', id: '@id_route'}, | ||
| 7 | + { | ||
| 8 | + list: { | ||
| 9 | + method: 'GET', | ||
| 10 | + params: { | ||
| 11 | + page: 0 | ||
| 12 | + }, | ||
| 13 | + transformResponse: function(rs) { | ||
| 14 | + var dst = angular.fromJson(rs); | ||
| 15 | + if (dst.status == 'SUCCESS') { | ||
| 16 | + return dst.data; | ||
| 17 | + } else { | ||
| 18 | + return dst; | ||
| 19 | + } | ||
| 20 | + } | ||
| 21 | + }, | ||
| 22 | + get: { | ||
| 23 | + method: 'GET', | ||
| 24 | + transformResponse: function(rs) { | ||
| 25 | + var dst = angular.fromJson(rs); | ||
| 26 | + if (dst.status == 'SUCCESS') { | ||
| 27 | + return dst.data; | ||
| 28 | + } else { | ||
| 29 | + return dst; | ||
| 30 | + } | ||
| 31 | + } | ||
| 32 | + }, | ||
| 33 | + save: { | ||
| 34 | + method: 'POST' | ||
| 35 | + } | ||
| 36 | + // 内部还有默认的方法delete | ||
| 37 | + } | ||
| 38 | + ) | ||
| 39 | + }; | ||
| 40 | +}]); | ||
| 0 | \ No newline at end of file | 41 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/core/rerunManage/service.js
0 → 100644
| 1 | +// 套跑管理service | ||
| 2 | +angular.module('ScheduleApp').factory('rerunManageService_g', ['$resource', function($resource) { | ||
| 3 | + return { | ||
| 4 | + rest: $resource( | ||
| 5 | + 'rms/:id', | ||
| 6 | + {order: 'rerunXl.id,isCancel', direction: 'ASC', id: '@id_route'}, | ||
| 7 | + { | ||
| 8 | + list: { | ||
| 9 | + method: 'GET', | ||
| 10 | + params: { | ||
| 11 | + page: 0 | ||
| 12 | + } | ||
| 13 | + }, | ||
| 14 | + get: { | ||
| 15 | + method: 'GET' | ||
| 16 | + }, | ||
| 17 | + save: { | ||
| 18 | + method: 'POST' | ||
| 19 | + }, | ||
| 20 | + delete: { | ||
| 21 | + method: 'DELETE' | ||
| 22 | + } | ||
| 23 | + } | ||
| 24 | + ) | ||
| 25 | + }; | ||
| 26 | +}]); | ||
| 0 | \ No newline at end of file | 27 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/service.js
0 → 100644
| 1 | +// 排班计划管理service | ||
| 2 | +angular.module('ScheduleApp').factory('SchedulePlanManageService_g', ['$resource', function($resource) { | ||
| 3 | + return { | ||
| 4 | + rest : $resource( | ||
| 5 | + '/spc/:id', | ||
| 6 | + {order: 'xl.id,createDate', direction: 'DESC,DESC', id: '@id_route'}, | ||
| 7 | + { | ||
| 8 | + list: { | ||
| 9 | + method: 'GET', | ||
| 10 | + params: { | ||
| 11 | + page: 0 | ||
| 12 | + } | ||
| 13 | + }, | ||
| 14 | + get: { | ||
| 15 | + method: 'GET' | ||
| 16 | + }, | ||
| 17 | + save: { | ||
| 18 | + method: 'POST' | ||
| 19 | + }, | ||
| 20 | + delete: { | ||
| 21 | + method: 'DELETE' | ||
| 22 | + } | ||
| 23 | + } | ||
| 24 | + ), | ||
| 25 | + tommorw: $resource( | ||
| 26 | + '/spc/tommorw', | ||
| 27 | + {}, | ||
| 28 | + { | ||
| 29 | + list: { | ||
| 30 | + method: 'GET' | ||
| 31 | + } | ||
| 32 | + } | ||
| 33 | + ) | ||
| 34 | + }; | ||
| 35 | +}]); | ||
| 36 | + | ||
| 37 | +// 排班计划明细管理service | ||
| 38 | +angular.module('ScheduleApp').factory('SchedulePlanInfoManageService_g', ['$resource', function($resource) { | ||
| 39 | + return { | ||
| 40 | + rest : $resource( | ||
| 41 | + '/spic/:id', | ||
| 42 | + {order: 'scheduleDate,lp,fcno', direction: 'ASC,ASC,ASC', id: '@id_route'}, | ||
| 43 | + { | ||
| 44 | + list: { | ||
| 45 | + method: 'GET', | ||
| 46 | + params: { | ||
| 47 | + page: 0 | ||
| 48 | + } | ||
| 49 | + }, | ||
| 50 | + get: { | ||
| 51 | + method: 'GET' | ||
| 52 | + }, | ||
| 53 | + save: { | ||
| 54 | + method: 'POST' | ||
| 55 | + } | ||
| 56 | + } | ||
| 57 | + ), | ||
| 58 | + groupinfo : $resource( | ||
| 59 | + '/spic/groupinfos/:xlid/:sdate', | ||
| 60 | + {}, | ||
| 61 | + { | ||
| 62 | + list: { | ||
| 63 | + method: 'GET', | ||
| 64 | + isArray: true | ||
| 65 | + } | ||
| 66 | + } | ||
| 67 | + ), | ||
| 68 | + updateGroupInfo : $resource( | ||
| 69 | + '/spic/groupinfos/update', | ||
| 70 | + {}, | ||
| 71 | + { | ||
| 72 | + update: { | ||
| 73 | + method: 'POST' | ||
| 74 | + } | ||
| 75 | + } | ||
| 76 | + ) | ||
| 77 | + }; | ||
| 78 | +}]); | ||
| 0 | \ No newline at end of file | 79 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/core/scheduleRuleManage/service.js
0 → 100644
| 1 | +// 排班管理service | ||
| 2 | +angular.module('ScheduleApp').factory('ScheduleRuleManageService_g', ['$resource', function($resource) { | ||
| 3 | + return { | ||
| 4 | + rest: $resource( | ||
| 5 | + '/sr1fc/:id', | ||
| 6 | + {order: 'createDate', direction: 'DESC', id: '@id_route'}, | ||
| 7 | + { | ||
| 8 | + list: { | ||
| 9 | + method: 'GET', | ||
| 10 | + params: { | ||
| 11 | + page: 0 | ||
| 12 | + } | ||
| 13 | + }, | ||
| 14 | + get: { | ||
| 15 | + method: 'GET' | ||
| 16 | + }, | ||
| 17 | + save: { | ||
| 18 | + method: 'POST' | ||
| 19 | + }, | ||
| 20 | + delete: { | ||
| 21 | + method: 'DELETE' | ||
| 22 | + } | ||
| 23 | + } | ||
| 24 | + ) | ||
| 25 | + }; | ||
| 26 | +}]); |
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/index.html
| @@ -27,6 +27,10 @@ | @@ -27,6 +27,10 @@ | ||
| 27 | <span class="caption-subject bold uppercase">时刻表</span> | 27 | <span class="caption-subject bold uppercase">时刻表</span> |
| 28 | </div> | 28 | </div> |
| 29 | <div class="actions"> | 29 | <div class="actions"> |
| 30 | + <a ui-sref="ttInfoManage_test" class="btn btn-circle blue"> | ||
| 31 | + <i class="fa fa-plus"></i> | ||
| 32 | + 测试 | ||
| 33 | + </a> | ||
| 30 | <a href="javascirpt:" class="btn btn-circle blue" ng-click="ctrl.toTtInfoManageForm()"> | 34 | <a href="javascirpt:" class="btn btn-circle blue" ng-click="ctrl.toTtInfoManageForm()"> |
| 31 | <i class="fa fa-plus"></i> | 35 | <i class="fa fa-plus"></i> |
| 32 | 添加时刻表 | 36 | 添加时刻表 |
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/route.js
| 1 | -// ui route 配置 | ||
| 2 | - | ||
| 3 | -/** 时刻表管理配置route */ | ||
| 4 | -ScheduleApp.config([ | ||
| 5 | - '$stateProvider', | ||
| 6 | - '$urlRouterProvider', | ||
| 7 | - function($stateProvider, $urlRouterProvider) { | ||
| 8 | - // 默认路由 | ||
| 9 | - //$urlRouterProvider.otherwise('/busConfig.html'); | ||
| 10 | - | ||
| 11 | - $stateProvider | ||
| 12 | - .state("ttInfoManage", { // index页面 | ||
| 13 | - url: '/ttInfoManage', | ||
| 14 | - views: { | ||
| 15 | - "": { | ||
| 16 | - templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/index.html' | ||
| 17 | - }, | ||
| 18 | - "ttInfoManage_list@ttInfoManage": { | ||
| 19 | - templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/list.html' | ||
| 20 | - } | ||
| 21 | - }, | ||
| 22 | - | ||
| 23 | - resolve: { | ||
| 24 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 25 | - return $ocLazyLoad.load({ | ||
| 26 | - name: 'ttInfoManage_module', | ||
| 27 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 28 | - files: [ | ||
| 29 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 30 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 31 | - "pages/scheduleApp/module/core/ttInfoManage/module.js" | ||
| 32 | - ] | ||
| 33 | - }); | ||
| 34 | - }] | ||
| 35 | - } | ||
| 36 | - }) | ||
| 37 | - .state("ttInfoManage_form", { // 添加时刻表信息form | ||
| 38 | - url: '/ttInfoManage_form', | ||
| 39 | - views: { | ||
| 40 | - "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/form.html'} | ||
| 41 | - }, | ||
| 42 | - resolve: { | ||
| 43 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 44 | - return $ocLazyLoad.load({ | ||
| 45 | - name: 'ttInfoManage_form_module', | ||
| 46 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 47 | - files: [ | ||
| 48 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 49 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 50 | - "pages/scheduleApp/module/core/ttInfoManage/module.js" | ||
| 51 | - ] | ||
| 52 | - }); | ||
| 53 | - }] | ||
| 54 | - } | ||
| 55 | - }) | ||
| 56 | - .state("ttInfoManage_edit", { // 修改时刻表信息form | ||
| 57 | - url: '/ttInfoManage_edit/:id', | ||
| 58 | - views: { | ||
| 59 | - "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/edit.html'} | ||
| 60 | - }, | ||
| 61 | - resolve: { | ||
| 62 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 63 | - return $ocLazyLoad.load({ | ||
| 64 | - name: 'ttInfoManage_edit_module', | ||
| 65 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 66 | - files: [ | ||
| 67 | - "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 68 | - "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 69 | - "pages/scheduleApp/module/core/ttInfoManage/module.js" | ||
| 70 | - ] | ||
| 71 | - }); | ||
| 72 | - }] | ||
| 73 | - } | ||
| 74 | - }) | ||
| 75 | - .state("ttInfoManage_detail", { // 时刻表详细信息 | ||
| 76 | - url: '/ttInfoManage_detail/:id', | ||
| 77 | - views: { | ||
| 78 | - "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/detail.html'} | ||
| 79 | - }, | ||
| 80 | - resolve: { | ||
| 81 | - deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 82 | - return $ocLazyLoad.load({ | ||
| 83 | - name: 'ttInfoManage_detail_module', | ||
| 84 | - insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 85 | - files: [ | ||
| 86 | - "pages/scheduleApp/module/core/ttInfoManage/module.js" | ||
| 87 | - ] | ||
| 88 | - }); | ||
| 89 | - }] | ||
| 90 | - } | ||
| 91 | - }); | ||
| 92 | - | ||
| 93 | - | ||
| 94 | - } | 1 | +// ui route 配置 |
| 2 | + | ||
| 3 | +/** 时刻表管理配置route */ | ||
| 4 | +ScheduleApp.config([ | ||
| 5 | + '$stateProvider', | ||
| 6 | + '$urlRouterProvider', | ||
| 7 | + function($stateProvider, $urlRouterProvider) { | ||
| 8 | + // 默认路由 | ||
| 9 | + //$urlRouterProvider.otherwise('/busConfig.html'); | ||
| 10 | + | ||
| 11 | + $stateProvider | ||
| 12 | + .state("ttInfoManage", { // index页面 | ||
| 13 | + url: '/ttInfoManage', | ||
| 14 | + views: { | ||
| 15 | + "": { | ||
| 16 | + templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/index.html' | ||
| 17 | + }, | ||
| 18 | + "ttInfoManage_list@ttInfoManage": { | ||
| 19 | + templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/list.html' | ||
| 20 | + } | ||
| 21 | + }, | ||
| 22 | + | ||
| 23 | + resolve: { | ||
| 24 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 25 | + return $ocLazyLoad.load({ | ||
| 26 | + name: 'ttInfoManage_module', | ||
| 27 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 28 | + files: [ | ||
| 29 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 30 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 31 | + "pages/scheduleApp/module/core/ttInfoManage/module.js" | ||
| 32 | + ] | ||
| 33 | + }); | ||
| 34 | + }] | ||
| 35 | + } | ||
| 36 | + }) | ||
| 37 | + .state("ttInfoManage_form", { // 添加时刻表信息form | ||
| 38 | + url: '/ttInfoManage_form', | ||
| 39 | + views: { | ||
| 40 | + "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/form.html'} | ||
| 41 | + }, | ||
| 42 | + resolve: { | ||
| 43 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 44 | + return $ocLazyLoad.load({ | ||
| 45 | + name: 'ttInfoManage_form_module', | ||
| 46 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 47 | + files: [ | ||
| 48 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 49 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 50 | + "pages/scheduleApp/module/core/ttInfoManage/module.js" | ||
| 51 | + ] | ||
| 52 | + }); | ||
| 53 | + }] | ||
| 54 | + } | ||
| 55 | + }) | ||
| 56 | + .state("ttInfoManage_edit", { // 修改时刻表信息form | ||
| 57 | + url: '/ttInfoManage_edit/:id', | ||
| 58 | + views: { | ||
| 59 | + "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/edit.html'} | ||
| 60 | + }, | ||
| 61 | + resolve: { | ||
| 62 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 63 | + return $ocLazyLoad.load({ | ||
| 64 | + name: 'ttInfoManage_edit_module', | ||
| 65 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 66 | + files: [ | ||
| 67 | + "assets/bower_components/angular-ui-select/dist/select.min.css", | ||
| 68 | + "assets/bower_components/angular-ui-select/dist/select.min.js", | ||
| 69 | + "pages/scheduleApp/module/core/ttInfoManage/module.js" | ||
| 70 | + ] | ||
| 71 | + }); | ||
| 72 | + }] | ||
| 73 | + } | ||
| 74 | + }) | ||
| 75 | + .state("ttInfoManage_detail", { // 时刻表详细信息 | ||
| 76 | + url: '/ttInfoManage_detail/:id', | ||
| 77 | + views: { | ||
| 78 | + "": {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/detail.html'} | ||
| 79 | + }, | ||
| 80 | + resolve: { | ||
| 81 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 82 | + return $ocLazyLoad.load({ | ||
| 83 | + name: 'ttInfoManage_detail_module', | ||
| 84 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 85 | + files: [ | ||
| 86 | + "pages/scheduleApp/module/core/ttInfoManage/module.js" | ||
| 87 | + ] | ||
| 88 | + }); | ||
| 89 | + }] | ||
| 90 | + } | ||
| 91 | + }) | ||
| 92 | + .state('ttInfoManage_test', { // TODO:测试页面 | ||
| 93 | + url: '/ttInfoManage_test', | ||
| 94 | + views: { | ||
| 95 | + '': {templateUrl: 'pages/scheduleApp/module/core/ttInfoManage/test.html'} | ||
| 96 | + }, | ||
| 97 | + resolve: { | ||
| 98 | + deps: ['$ocLazyLoad', function($ocLazyLoad) { | ||
| 99 | + return $ocLazyLoad.load({ | ||
| 100 | + name: 'ttInfoManage_test_module', | ||
| 101 | + insertBefore: '#ng_load_plugins_before', // 动态载入模块时放置的位置 | ||
| 102 | + files: [ | ||
| 103 | + 'pages/scheduleApp/module/core/ttInfoManage/test.js' | ||
| 104 | + ] | ||
| 105 | + }); | ||
| 106 | + }] | ||
| 107 | + } | ||
| 108 | + }) | ||
| 109 | + | ||
| 110 | + | ||
| 111 | + } | ||
| 95 | ]); | 112 | ]); |
| 96 | \ No newline at end of file | 113 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/service.js
0 → 100644
| 1 | +// 时刻表管理service | ||
| 2 | +angular.module('ScheduleApp').factory('TimeTableManageService_g', ['$resource', function($resource) { | ||
| 3 | + return { | ||
| 4 | + rest: $resource( | ||
| 5 | + '/tic/:id', | ||
| 6 | + {order: 'xl,isCancel,isEnableDisTemplate,qyrq', direction: 'DESC,ASC,DESC,DESC', id: '@id'}, | ||
| 7 | + { | ||
| 8 | + list: { | ||
| 9 | + method: 'GET', | ||
| 10 | + params: { | ||
| 11 | + page: 0 | ||
| 12 | + } | ||
| 13 | + } | ||
| 14 | + } | ||
| 15 | + ) | ||
| 16 | + }; | ||
| 17 | +}]); | ||
| 18 | + | ||
| 19 | +// 时刻表明细管理service | ||
| 20 | +angular.module('ScheduleApp').factory('TimeTableDetailManageService_g', ['$resource', function($resource) { | ||
| 21 | + return { | ||
| 22 | + rest: $resource( | ||
| 23 | + '/tidc/:id', | ||
| 24 | + {order: 'createDate', direction: 'DESC', id: '@id_route'}, | ||
| 25 | + { | ||
| 26 | + get: { | ||
| 27 | + method: 'GET' | ||
| 28 | + }, | ||
| 29 | + save: { | ||
| 30 | + method: 'POST' | ||
| 31 | + } | ||
| 32 | + } | ||
| 33 | + ), | ||
| 34 | + import: $resource( | ||
| 35 | + '/tidc/importfile', | ||
| 36 | + {}, | ||
| 37 | + { | ||
| 38 | + do: { | ||
| 39 | + method: 'POST', | ||
| 40 | + headers: { | ||
| 41 | + 'Content-Type': 'application/x-www-form-urlencoded' | ||
| 42 | + }, | ||
| 43 | + transformRequest: function(obj) { | ||
| 44 | + var str = []; | ||
| 45 | + for (var p in obj) { | ||
| 46 | + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p])); | ||
| 47 | + } | ||
| 48 | + return str.join("&"); | ||
| 49 | + } | ||
| 50 | + } | ||
| 51 | + } | ||
| 52 | + ), | ||
| 53 | + edit: $resource( | ||
| 54 | + '/tidc/edit/:xlid/:ttid', | ||
| 55 | + {}, | ||
| 56 | + { | ||
| 57 | + list: { | ||
| 58 | + method: 'GET' | ||
| 59 | + } | ||
| 60 | + } | ||
| 61 | + ), | ||
| 62 | + bcdetails: $resource( | ||
| 63 | + '/tidc/bcdetail', | ||
| 64 | + {}, | ||
| 65 | + { | ||
| 66 | + list: { | ||
| 67 | + method: 'GET', | ||
| 68 | + isArray: true | ||
| 69 | + } | ||
| 70 | + } | ||
| 71 | + ), | ||
| 72 | + dataTools: $resource( | ||
| 73 | + '/tidc/:type', | ||
| 74 | + {}, | ||
| 75 | + { | ||
| 76 | + dataExport: { | ||
| 77 | + method: 'GET', | ||
| 78 | + responseType: "arraybuffer", | ||
| 79 | + params: { | ||
| 80 | + type: "dataExportExt" | ||
| 81 | + }, | ||
| 82 | + transformResponse: function(data, headers){ | ||
| 83 | + return {data : data}; | ||
| 84 | + } | ||
| 85 | + } | ||
| 86 | + } | ||
| 87 | + ) | ||
| 88 | + | ||
| 89 | + // TODO:导入数据 | ||
| 90 | + }; | ||
| 91 | +}]); | ||
| 0 | \ No newline at end of file | 92 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/test.html
0 → 100644
| 1 | +<h1>测试新的改版select指令</h1> | ||
| 2 | + | ||
| 3 | +<div ng-controller="TestCtrl as ctrl"> | ||
| 4 | + <form name="myForm" class="form-horizontal" ng-submit="ctrl.sub()"> | ||
| 5 | + <div class="form-body"> | ||
| 6 | + <div class="form-group"> | ||
| 7 | + <label class="col-md-2 control-label">测试文本:</label> | ||
| 8 | + <div class="col-md-3"> | ||
| 9 | + <input type="text" class="form-control" name="txt" ng-model="ctrl.say"/> | ||
| 10 | + </div> | ||
| 11 | + </div> | ||
| 12 | + <div class="form-group"> | ||
| 13 | + <my-select name="mtxt" ng-model="ctrl.say" required> | ||
| 14 | + <h1>{{ctrl.say}}</h1> | ||
| 15 | + </my-select> | ||
| 16 | + </div> | ||
| 17 | + </div> | ||
| 18 | + <div class="form-actions"> | ||
| 19 | + <div class="row"> | ||
| 20 | + <button type="submit" class="btn green" ng-disabled="!myForm.$valid"> | ||
| 21 | + <i class="fa fa-check"></i> | ||
| 22 | + 提交 | ||
| 23 | + </button> | ||
| 24 | + </div> | ||
| 25 | + </div> | ||
| 26 | + </form> | ||
| 27 | +</div> |
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/test.js
0 → 100644
| 1 | +// 测试controller | ||
| 2 | + | ||
| 3 | +angular.module('ScheduleApp').controller('TestCtrl', [ | ||
| 4 | + function() { | ||
| 5 | + var self = this; | ||
| 6 | + self.say = "say something"; | ||
| 7 | + | ||
| 8 | + self.sub = function() { | ||
| 9 | + alert("submit..."); | ||
| 10 | + }; | ||
| 11 | + | ||
| 12 | + self.loaddata = function() { | ||
| 13 | + alert("数据数据数据") | ||
| 14 | + }; | ||
| 15 | + } | ||
| 16 | +]); | ||
| 0 | \ No newline at end of file | 17 | \ No newline at end of file |
src/main/resources/static/pages/scheduleApp/package.json
src/main/resources/static/real_control_v2/css/line_schedule.css
| @@ -309,7 +309,7 @@ span.fcsj-diff { | @@ -309,7 +309,7 @@ span.fcsj-diff { | ||
| 309 | 309 | ||
| 310 | .ct-form-modal form input, .ct-form-modal form select { | 310 | .ct-form-modal form input, .ct-form-modal form select { |
| 311 | width: 100%; | 311 | width: 100%; |
| 312 | - height: 34px!important; | 312 | + height: 34px; |
| 313 | } | 313 | } |
| 314 | 314 | ||
| 315 | .ct-form-modal form small.font-danger { | 315 | .ct-form-modal form small.font-danger { |
| @@ -690,7 +690,7 @@ i.add-temp-sch-icon:hover{ | @@ -690,7 +690,7 @@ i.add-temp-sch-icon:hover{ | ||
| 690 | 690 | ||
| 691 | input.i-cbox[type=checkbox]{ | 691 | input.i-cbox[type=checkbox]{ |
| 692 | width: 20px; | 692 | width: 20px; |
| 693 | - height: 18px !important; | 693 | + height: 18px; |
| 694 | vertical-align: middle; | 694 | vertical-align: middle; |
| 695 | margin-top: -3px; | 695 | margin-top: -3px; |
| 696 | } | 696 | } |
| @@ -846,4 +846,59 @@ input.i-cbox[type=checkbox]{ | @@ -846,4 +846,59 @@ input.i-cbox[type=checkbox]{ | ||
| 846 | color: #bab6b6; | 846 | color: #bab6b6; |
| 847 | font-family: 微软雅黑; | 847 | font-family: 微软雅黑; |
| 848 | font-size: 13px; | 848 | font-size: 13px; |
| 849 | +} | ||
| 850 | + | ||
| 851 | +#add-sub-task-inpark-modal .uk-panel-box{ | ||
| 852 | + background-color: #ffffff; | ||
| 853 | +} | ||
| 854 | + | ||
| 855 | +#add-sub-task-inpark-modal .pl5{ | ||
| 856 | + padding-left: 5px; | ||
| 857 | +} | ||
| 858 | + | ||
| 859 | +#add-sub-task-inpark-modal.uk-modal .uk-form.fv-form{ | ||
| 860 | + margin-bottom: 0px !important; | ||
| 861 | +} | ||
| 862 | +#add-sub-task-inpark-modal .uk-form select, | ||
| 863 | +#add-sub-task-inpark-modal .uk-form input[type=text], | ||
| 864 | +#add-sub-task-inpark-modal .uk-form input[type=time]{ | ||
| 865 | + width: 100% | ||
| 866 | +} | ||
| 867 | + | ||
| 868 | +#add-sub-task-inpark-modal .uk-grid{ | ||
| 869 | + margin-top: 10px; | ||
| 870 | +} | ||
| 871 | + | ||
| 872 | +.sub-task-card{ | ||
| 873 | + display: inline-block;vertical-align: top;margin-right: 1%; | ||
| 874 | + width: 48.5%; | ||
| 875 | +} | ||
| 876 | + | ||
| 877 | +.sub-task-card.destroy-card{ | ||
| 878 | + vertical-align: top; | ||
| 879 | + margin-right: 0; | ||
| 880 | + display: none; | ||
| 881 | +} | ||
| 882 | + | ||
| 883 | +#add-sub-task-inpark-modal .uk-modal-dialog{ | ||
| 884 | + width: 755px; | ||
| 885 | + transition: all .3s ease; | ||
| 886 | +} | ||
| 887 | + | ||
| 888 | +#add-sub-task-inpark-modal .uk-modal-dialog.three-children{ | ||
| 889 | + width: 955px; | ||
| 890 | +} | ||
| 891 | + | ||
| 892 | +#add-sub-task-inpark-modal .uk-modal-dialog.three-children .sub-task-card{ | ||
| 893 | + width: 32%; | ||
| 894 | +} | ||
| 895 | + | ||
| 896 | +.uk-modal-footer .ct-footer-left{ | ||
| 897 | + float: left; | ||
| 898 | + font-size: 12px; | ||
| 899 | +} | ||
| 900 | + | ||
| 901 | +.uk-modal-footer .ct-footer-left a{ | ||
| 902 | + color: #6e6b6b; | ||
| 903 | + margin-right: 5px; | ||
| 849 | } | 904 | } |
| 850 | \ No newline at end of file | 905 | \ No newline at end of file |
src/main/resources/static/real_control_v2/css/main.css
| @@ -314,4 +314,59 @@ li.map-panel{ | @@ -314,4 +314,59 @@ li.map-panel{ | ||
| 314 | .main-container .load-panel{ | 314 | .main-container .load-panel{ |
| 315 | display: block; | 315 | display: block; |
| 316 | color: #999797; | 316 | color: #999797; |
| 317 | +} | ||
| 318 | + | ||
| 319 | +.uk-panel-box-danger { | ||
| 320 | + background-color: #fff1f0; | ||
| 321 | + color: #d85030; | ||
| 322 | + border-color: rgba(216,80,48,.3); | ||
| 323 | +} | ||
| 324 | + | ||
| 325 | +.uk-panel-box-danger .uk-panel-title { | ||
| 326 | + color: #d85030; | ||
| 327 | +} | ||
| 328 | + | ||
| 329 | +.uk-badge-default { | ||
| 330 | + background-color: #a09b9c; | ||
| 331 | + background-image: -webkit-linear-gradient(top,#9a9898,#8c8687); | ||
| 332 | + background-image: linear-gradient(to bottom,#9a9898,#8c8687); | ||
| 333 | +} | ||
| 334 | + | ||
| 335 | +.ct-bottom-drawer{ | ||
| 336 | + width: 100%; | ||
| 337 | + background: rgb(255, 255, 255); | ||
| 338 | + position: fixed; | ||
| 339 | + bottom: 0; | ||
| 340 | + box-shadow: 0 0 10px rgba(0,0,0,.3); | ||
| 341 | + transition: all .3s ease; | ||
| 342 | + height: 0; | ||
| 343 | +} | ||
| 344 | + | ||
| 345 | +.ct-bottom-drawer.open{ | ||
| 346 | + height: 320px; | ||
| 347 | +} | ||
| 348 | + | ||
| 349 | +.ct-bottom-drawer a.ct-bottom-drawer-close{ | ||
| 350 | + position: absolute; | ||
| 351 | + right: 10px; | ||
| 352 | + top: 10px; | ||
| 353 | + color: #c3c3c3; | ||
| 354 | + width: 20px; | ||
| 355 | + line-height: 20px; | ||
| 356 | +} | ||
| 357 | + | ||
| 358 | +.ct-bottom-drawer a.ct-bottom-drawer-close:hover{ | ||
| 359 | + text-decoration: none; | ||
| 360 | + color: grey; | ||
| 361 | +} | ||
| 362 | + | ||
| 363 | +.ct-bottom-drawer a.ct-bottom-drawer-close:after { | ||
| 364 | + display: block; | ||
| 365 | + content: "\f00d"; | ||
| 366 | + font-family: FontAwesome; | ||
| 367 | +} | ||
| 368 | + | ||
| 369 | +.ct-bottom-drawer-body{ | ||
| 370 | + width: 100%; | ||
| 371 | + height: 100%; | ||
| 317 | } | 372 | } |
| 318 | \ No newline at end of file | 373 | \ No newline at end of file |
src/main/resources/static/real_control_v2/css/pace.css
0 → 100644
| 1 | +.pace { | ||
| 2 | + width: 140px; | ||
| 3 | + height: 300px; | ||
| 4 | + margin-left: calc(50% - 70px); | ||
| 5 | + | ||
| 6 | + z-index: 2000; | ||
| 7 | + -webkit-transform: scale(0); | ||
| 8 | + -moz-transform: scale(0); | ||
| 9 | + -ms-transform: scale(0); | ||
| 10 | + -o-transform: scale(0); | ||
| 11 | + transform: scale(0); | ||
| 12 | + opacity: 0; | ||
| 13 | + -webkit-transition: all 2s linear 0s; | ||
| 14 | + -moz-transition: all 2s linear 0s; | ||
| 15 | + transition: all 2s linear 0s; | ||
| 16 | +} | ||
| 17 | + | ||
| 18 | +.pace .text{ | ||
| 19 | + position: absolute; | ||
| 20 | + bottom: -50px; | ||
| 21 | + font-size: 12px; | ||
| 22 | + transform: scale(4); | ||
| 23 | + color: grey; | ||
| 24 | +} | ||
| 25 | + | ||
| 26 | +.pace.pace-active { | ||
| 27 | + -webkit-transform: scale(.25); | ||
| 28 | + -moz-transform: scale(.25); | ||
| 29 | + -ms-transform: scale(.25); | ||
| 30 | + -o-transform: scale(.25); | ||
| 31 | + transform: scale(.25); | ||
| 32 | + opacity: 1; | ||
| 33 | +} | ||
| 34 | + | ||
| 35 | +.pace .pace-activity { | ||
| 36 | + width: 140px; | ||
| 37 | + height: 140px; | ||
| 38 | + border-radius: 70px; | ||
| 39 | + background: #29d; | ||
| 40 | + position: absolute; | ||
| 41 | + top: 0; | ||
| 42 | + z-index: 1911; | ||
| 43 | + -webkit-animation: pace-bounce 1s infinite; | ||
| 44 | + -moz-animation: pace-bounce 1s infinite; | ||
| 45 | + -o-animation: pace-bounce 1s infinite; | ||
| 46 | + -ms-animation: pace-bounce 1s infinite; | ||
| 47 | + animation: pace-bounce 1s infinite; | ||
| 48 | +} | ||
| 49 | + | ||
| 50 | +.pace .pace-progress { | ||
| 51 | + position: absolute; | ||
| 52 | + display: block; | ||
| 53 | + left: 50%; | ||
| 54 | + bottom: 0; | ||
| 55 | + z-index: 1910; | ||
| 56 | + margin-left: -30px; | ||
| 57 | + width: 60px; | ||
| 58 | + height: 75px; | ||
| 59 | + background: rgba(20, 20, 20, .1); | ||
| 60 | + box-shadow: 0 0 20px 35px rgba(20, 20, 20, .1); | ||
| 61 | + border-radius: 30px / 40px; | ||
| 62 | + -webkit-transform: scaleY(.3) !important; | ||
| 63 | + -moz-transform: scaleY(.3) !important; | ||
| 64 | + -ms-transform: scaleY(.3) !important; | ||
| 65 | + -o-transform: scaleY(.3) !important; | ||
| 66 | + transform: scaleY(.3) !important; | ||
| 67 | + -webkit-animation: pace-compress .5s infinite alternate; | ||
| 68 | + -moz-animation: pace-compress .5s infinite alternate; | ||
| 69 | + -o-animation: pace-compress .5s infinite alternate; | ||
| 70 | + -ms-animation: pace-compress .5s infinite alternate; | ||
| 71 | + animation: pace-compress .5s infinite alternate; | ||
| 72 | +} | ||
| 73 | + | ||
| 74 | +@-webkit-keyframes pace-bounce { | ||
| 75 | + 0% { | ||
| 76 | + top: 0; | ||
| 77 | + -webkit-animation-timing-function: ease-in; | ||
| 78 | + } | ||
| 79 | + 40% {} | ||
| 80 | + 50% { | ||
| 81 | + top: 140px; | ||
| 82 | + height: 140px; | ||
| 83 | + -webkit-animation-timing-function: ease-out; | ||
| 84 | + } | ||
| 85 | + 55% { | ||
| 86 | + top: 160px; | ||
| 87 | + height: 120px; | ||
| 88 | + border-radius: 70px / 60px; | ||
| 89 | + -webkit-animation-timing-function: ease-in; | ||
| 90 | + } | ||
| 91 | + 65% { | ||
| 92 | + top: 120px; | ||
| 93 | + height: 140px; | ||
| 94 | + border-radius: 70px; | ||
| 95 | + -webkit-animation-timing-function: ease-out; | ||
| 96 | + } | ||
| 97 | + 95% { | ||
| 98 | + top: 0; | ||
| 99 | + -webkit-animation-timing-function: ease-in; | ||
| 100 | + } | ||
| 101 | + 100% { | ||
| 102 | + top: 0; | ||
| 103 | + -webkit-animation-timing-function: ease-in; | ||
| 104 | + } | ||
| 105 | +} | ||
| 106 | + | ||
| 107 | +@-moz-keyframes pace-bounce { | ||
| 108 | + 0% { | ||
| 109 | + top: 0; | ||
| 110 | + -moz-animation-timing-function: ease-in; | ||
| 111 | + } | ||
| 112 | + 40% {} | ||
| 113 | + 50% { | ||
| 114 | + top: 140px; | ||
| 115 | + height: 140px; | ||
| 116 | + -moz-animation-timing-function: ease-out; | ||
| 117 | + } | ||
| 118 | + 55% { | ||
| 119 | + top: 160px; | ||
| 120 | + height: 120px; | ||
| 121 | + border-radius: 70px / 60px; | ||
| 122 | + -moz-animation-timing-function: ease-in; | ||
| 123 | + } | ||
| 124 | + 65% { | ||
| 125 | + top: 120px; | ||
| 126 | + height: 140px; | ||
| 127 | + border-radius: 70px; | ||
| 128 | + -moz-animation-timing-function: ease-out;} | ||
| 129 | + 95% { | ||
| 130 | + top: 0; | ||
| 131 | + -moz-animation-timing-function: ease-in; | ||
| 132 | + } | ||
| 133 | + 100% {top: 0; | ||
| 134 | + -moz-animation-timing-function: ease-in; | ||
| 135 | + } | ||
| 136 | +} | ||
| 137 | + | ||
| 138 | +@keyframes pace-bounce { | ||
| 139 | + 0% { | ||
| 140 | + top: 0; | ||
| 141 | + animation-timing-function: ease-in; | ||
| 142 | + } | ||
| 143 | + 50% { | ||
| 144 | + top: 140px; | ||
| 145 | + height: 140px; | ||
| 146 | + animation-timing-function: ease-out; | ||
| 147 | + } | ||
| 148 | + 55% { | ||
| 149 | + top: 160px; | ||
| 150 | + height: 120px; | ||
| 151 | + border-radius: 70px / 60px; | ||
| 152 | + animation-timing-function: ease-in; | ||
| 153 | + } | ||
| 154 | + 65% { | ||
| 155 | + top: 120px; | ||
| 156 | + height: 140px; | ||
| 157 | + border-radius: 70px; | ||
| 158 | + animation-timing-function: ease-out; | ||
| 159 | + } | ||
| 160 | + 95% { | ||
| 161 | + top: 0; | ||
| 162 | + animation-timing-function: ease-in; | ||
| 163 | + } | ||
| 164 | + 100% { | ||
| 165 | + top: 0; | ||
| 166 | + animation-timing-function: ease-in; | ||
| 167 | + } | ||
| 168 | +} | ||
| 169 | + | ||
| 170 | +@-webkit-keyframes pace-compress { | ||
| 171 | + 0% { | ||
| 172 | + bottom: 0; | ||
| 173 | + margin-left: -30px; | ||
| 174 | + width: 60px; | ||
| 175 | + height: 75px; | ||
| 176 | + background: rgba(20, 20, 20, .1); | ||
| 177 | + box-shadow: 0 0 20px 35px rgba(20, 20, 20, .1); | ||
| 178 | + border-radius: 30px / 40px; | ||
| 179 | + -webkit-animation-timing-function: ease-in; | ||
| 180 | + } | ||
| 181 | + 100% { | ||
| 182 | + bottom: 30px; | ||
| 183 | + margin-left: -10px; | ||
| 184 | + width: 20px; | ||
| 185 | + height: 5px; | ||
| 186 | + background: rgba(20, 20, 20, .3); | ||
| 187 | + box-shadow: 0 0 20px 35px rgba(20, 20, 20, .3); | ||
| 188 | + border-radius: 20px / 20px; | ||
| 189 | + -webkit-animation-timing-function: ease-out; | ||
| 190 | + } | ||
| 191 | +} | ||
| 192 | + | ||
| 193 | +@-moz-keyframes pace-compress { | ||
| 194 | + 0% { | ||
| 195 | + bottom: 0; | ||
| 196 | + margin-left: -30px; | ||
| 197 | + width: 60px; | ||
| 198 | + height: 75px; | ||
| 199 | + background: rgba(20, 20, 20, .1); | ||
| 200 | + box-shadow: 0 0 20px 35px rgba(20, 20, 20, .1); | ||
| 201 | + border-radius: 30px / 40px; | ||
| 202 | + -moz-animation-timing-function: ease-in; | ||
| 203 | + } | ||
| 204 | + 100% { | ||
| 205 | + bottom: 30px; | ||
| 206 | + margin-left: -10px; | ||
| 207 | + width: 20px; | ||
| 208 | + height: 5px; | ||
| 209 | + background: rgba(20, 20, 20, .3); | ||
| 210 | + box-shadow: 0 0 20px 35px rgba(20, 20, 20, .3); | ||
| 211 | + border-radius: 20px / 20px; | ||
| 212 | + -moz-animation-timing-function: ease-out; | ||
| 213 | + } | ||
| 214 | +} | ||
| 215 | + | ||
| 216 | +@keyframes pace-compress { | ||
| 217 | + 0% { | ||
| 218 | + bottom: 0; | ||
| 219 | + margin-left: -30px; | ||
| 220 | + width: 60px; | ||
| 221 | + height: 75px; | ||
| 222 | + background: rgba(20, 20, 20, .1); | ||
| 223 | + box-shadow: 0 0 20px 35px rgba(20, 20, 20, .1); | ||
| 224 | + border-radius: 30px / 40px; | ||
| 225 | + animation-timing-function: ease-in; | ||
| 226 | + } | ||
| 227 | + 100% { | ||
| 228 | + bottom: 30px; | ||
| 229 | + margin-left: -10px; | ||
| 230 | + width: 20px; | ||
| 231 | + height: 5px; | ||
| 232 | + background: rgba(20, 20, 20, .3); | ||
| 233 | + box-shadow: 0 0 20px 35px rgba(20, 20, 20, .3); | ||
| 234 | + border-radius: 20px / 20px; | ||
| 235 | + animation-timing-function: ease-out; | ||
| 236 | + } | ||
| 237 | +} | ||
| 0 | \ No newline at end of file | 238 | \ No newline at end of file |
src/main/resources/static/real_control_v2/fragments/geo/calc_station_space.html
0 → 100644
| 1 | +<!-- 嵌入下抽屉 --> | ||
| 2 | +<div id="cal_station_space_drawer" style="width: 100%;height: 100%;"> | ||
| 3 | + | ||
| 4 | + <div style="text-align: center;padding-top: 30px;" class="calcBeforePanel"> | ||
| 5 | + <p style="margin: 9px 0 9px 0;">当前站点间里程数据取自 <a target="_blank" id="stationRouteLink">基础信息->线路信息->站点详细</a> | ||
| 6 | + 你可以手动编辑。</p> | ||
| 7 | + <p style="margin: 9px 0 9px 0;">此外,我们提供另一种选择,根据路段和站点空间坐标计算站间距。计算后的数据将存储在本地。 | ||
| 8 | + </p> | ||
| 9 | + <p style="margin: 0px 0 9px 0;"> | ||
| 10 | + <span style="color: grey;font-size: 12px;">该操作会借用本地计算能力进行,如果你同意,请点击下方按钮!</span> | ||
| 11 | + </p> | ||
| 12 | + <p style="margin: 9px 0 9px 0;"> | ||
| 13 | + <button class="uk-button uk-button-large uk-button-primary" type="button" id="startCalcBtn">开始计算</button> | ||
| 14 | + </p> | ||
| 15 | + </div> | ||
| 16 | + | ||
| 17 | + <div class="pace pace-active" style="display: none;"> | ||
| 18 | + <div class="pace-progress" data-progress="50" data-progress-text="50%" | ||
| 19 | + style="-webkit-transform: translate3d(50%, 0px, 0px); -ms-transform: translate3d(50%, 0px, 0px); transform: translate3d(50%, 0px, 0px);"> | ||
| 20 | + <div class="pace-progress-inner"></div> | ||
| 21 | + </div> | ||
| 22 | + <div class="pace-activity"></div> | ||
| 23 | + <span class="text"></span> | ||
| 24 | + </div> | ||
| 25 | + | ||
| 26 | + <script> | ||
| 27 | + | ||
| 28 | + (function () { | ||
| 29 | + var drawer = '#cal_station_space_drawer' | ||
| 30 | + , sch, line; | ||
| 31 | + | ||
| 32 | + $(drawer).on('drawer-init', function (e, data) { | ||
| 33 | + sch = data.sch; | ||
| 34 | + line = gb_data_basic.codeToLine[sch.xlBm]; | ||
| 35 | + //线路路由信息调整链接 | ||
| 36 | + $('#stationRouteLink', drawer).attr('href', '/pages/base/stationroute/list.html?no=' + line.id); | ||
| 37 | + | ||
| 38 | + $('#startCalcBtn', drawer).on('click', startCalc); | ||
| 39 | + }); | ||
| 40 | + | ||
| 41 | + | ||
| 42 | + function startCalc() { | ||
| 43 | + $(this).attr('disabled', 'disabled'); | ||
| 44 | + | ||
| 45 | + gb_common.$get('/realMap/findRouteAndStationByLine', {lineCode: line.lineCode}, function (spatialData) { | ||
| 46 | + $('.calcBeforePanel', drawer).hide(); | ||
| 47 | + $('.pace', drawer).show(); | ||
| 48 | + | ||
| 49 | + startGeoCalc(spatialData); | ||
| 50 | + }); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + function startGeoCalc(spatialData) { | ||
| 54 | + setCalcText('初始化数据'); | ||
| 55 | + //console.log('spatialData', spatialData); | ||
| 56 | + //路段上下行分组排序 | ||
| 57 | + var sections = gb_common.groupBy(spatialData.section, 'DIRECTIONS'); | ||
| 58 | + sections[0].sort(sectionArrSort); | ||
| 59 | + sections[1].sort(sectionArrSort); | ||
| 60 | + | ||
| 61 | + //站点上下行分组排序 | ||
| 62 | + var stations = gb_common.groupBy(spatialData.station, 'DIRECTIONS'); | ||
| 63 | + stations[0].sort(stationArrSort); | ||
| 64 | + stations[1].sort(stationArrSort); | ||
| 65 | + | ||
| 66 | + setCalcText('拼接路段,计算重叠区域'); | ||
| 67 | + var fullSections = [ | ||
| 68 | + connectSections(sections[0]), | ||
| 69 | + connectSections(sections[1]) | ||
| 70 | + ]; | ||
| 71 | + | ||
| 72 | + setCalcText('计算上行数据'); | ||
| 73 | + var upCalcRs = calcStationSpace(stations[0], fullSections[0]); | ||
| 74 | + | ||
| 75 | + setCalcText('计算下行数据'); | ||
| 76 | + var downCalcRs = calcStationSpace(stations[1], fullSections[1]); | ||
| 77 | + | ||
| 78 | + var locData={ | ||
| 79 | + stations: {up: upCalcRs,down: downCalcRs}, | ||
| 80 | + sections: {up: fullSections[0], down: fullSections[1]} | ||
| 81 | + }; | ||
| 82 | + | ||
| 83 | + window.localStorage.setItem('control_route_distance_'+sch.xlBm, JSON.stringify(locData)); | ||
| 84 | + //console.log('结果', locData); | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + function sectionArrSort(s1, s2) { | ||
| 88 | + return s1.SECTIONROUTE_CODE - s2.SECTIONROUTE_CODE; | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + function stationArrSort(s1, s2) { | ||
| 92 | + return s1.STATION_ROUTE_CODE - s2.STATION_ROUTE_CODE; | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + function setCalcText(t) { | ||
| 96 | + $('.pace .text', drawer).text(t); | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + //连接路段数组 | ||
| 100 | + function connectSections(sectionArray) { | ||
| 101 | + var coords = []; | ||
| 102 | + | ||
| 103 | + var vs, temps; | ||
| 104 | + for (var i = 0, section; section = sectionArray[i++];) { | ||
| 105 | + vs = section.GSECTION_VECTOR; | ||
| 106 | + temps = vs.substr(11, vs.length - 2).split(','); | ||
| 107 | + | ||
| 108 | + connectCoords(coords, temps); | ||
| 109 | + } | ||
| 110 | + return coords; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + function connectCoords(all, subArr) { | ||
| 114 | + | ||
| 115 | + var point, ts, len = all.length, inLine, sIndex = 0; | ||
| 116 | + if (len > 0) { | ||
| 117 | + $.each(subArr, function (i, p) { | ||
| 118 | + ts = p.split(' '); | ||
| 119 | + point = {latitude: parseFloat(ts[1]), longitude: parseFloat(ts[0])}; | ||
| 120 | + //找到起始点 | ||
| 121 | + sIndex = 0; | ||
| 122 | + for (var j = 1; j < len; j++) { | ||
| 123 | + inLine = geolib.isPointInLine(point, all[j - 1], all[j]); | ||
| 124 | + | ||
| 125 | + if (inLine) | ||
| 126 | + break; | ||
| 127 | + else | ||
| 128 | + sIndex = i; | ||
| 129 | + } | ||
| 130 | + }); | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + //拼接 | ||
| 134 | + for (var i = sIndex; i < subArr.length; i++) { | ||
| 135 | + ts = subArr[i].split(' '); | ||
| 136 | + all.push({ | ||
| 137 | + latitude: parseFloat(ts[1]), longitude: parseFloat(ts[0]) | ||
| 138 | + }); | ||
| 139 | + } | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + //计算站点间距 | ||
| 143 | + function calcStationSpace(stations, coords) { | ||
| 144 | + | ||
| 145 | + var nearArray = []; | ||
| 146 | + for (var i = 1; i < stations.length; i++) { | ||
| 147 | + | ||
| 148 | + //点到线的最短距离 并计算交点坐标 | ||
| 149 | + var rs = calcPointToLineNearPoint({ | ||
| 150 | + latitude: stations[i].G_LATY, | ||
| 151 | + longitude: stations[i].G_LONX | ||
| 152 | + }, coords); | ||
| 153 | + rs.station = stations[i]; | ||
| 154 | + | ||
| 155 | + //将交点插入线路中 | ||
| 156 | + coords.splice(rs.index, 0, rs.intersection); | ||
| 157 | + | ||
| 158 | + nearArray.push(rs); | ||
| 159 | + //console.log('站点' + i + '计算结果', rs.intersection, rs); | ||
| 160 | + } | ||
| 161 | + | ||
| 162 | + //根据交点截断line,并计算距离 | ||
| 163 | + var s = 0, e, distance; | ||
| 164 | + $.each(nearArray, function (i) { | ||
| 165 | + e = this.index; | ||
| 166 | + distance = 0; | ||
| 167 | + for (; s < e; s++) { | ||
| 168 | + distance += geolib.getDistance(coords[s], coords[s + 1]); | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + this.toDistance = distance; | ||
| 172 | + s = e; | ||
| 173 | + }); | ||
| 174 | + return nearArray; | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + function calcPointToLineNearPoint(point, coords) { | ||
| 178 | + var minRs, rs; | ||
| 179 | + for (var i = 1; i < coords.length; i++) { | ||
| 180 | + | ||
| 181 | + var start = coords[i - 1], end = coords[i]; | ||
| 182 | + var d1 = geolib.getDistance(start, point, 1, 3); | ||
| 183 | + var d2 = geolib.getDistance(point, end, 1, 3); | ||
| 184 | + var d3 = geolib.getDistance(start, end, 1, 3); | ||
| 185 | + | ||
| 186 | + var alpha = Math.acos((d1 * d1 + d3 * d3 - d2 * d2) / (2 * d1 * d3)); | ||
| 187 | + var beta = Math.acos((d2 * d2 + d3 * d3 - d1 * d1) / (2 * d2 * d3)); | ||
| 188 | + | ||
| 189 | + if (d3 < 0.5 || isNaN(alpha) || isNaN(beta)) | ||
| 190 | + continue; | ||
| 191 | + | ||
| 192 | + rs = {index: i}; | ||
| 193 | + if (alpha > Math.PI / 2) { | ||
| 194 | + rs.distance = d1; | ||
| 195 | + rs.intersection = start; | ||
| 196 | + } | ||
| 197 | + else if (beta > Math.PI / 2) { | ||
| 198 | + rs.distance = d2; | ||
| 199 | + rs.intersection = end; | ||
| 200 | + } | ||
| 201 | + else { | ||
| 202 | + rs.distance = Math.sin(alpha) * d1; | ||
| 203 | + rs.intersection = perpendularPoint(start, end, point); | ||
| 204 | + } | ||
| 205 | + | ||
| 206 | + if (!minRs || minRs.distance > rs.distance) | ||
| 207 | + minRs = rs | ||
| 208 | + } | ||
| 209 | + | ||
| 210 | + return minRs; | ||
| 211 | + } | ||
| 212 | + | ||
| 213 | + //获取点 到 线的垂直交点 | ||
| 214 | + function perpendularPoint(lp1, lp2, p) { | ||
| 215 | + var a = lp1.latitude - lp2.latitude, b = lp2.longitude - lp1.longitude, c = lp1.longitude * lp2.latitude - lp2.longitude * lp1.latitude; | ||
| 216 | + var lon = (Math.pow(b, 2) * p.longitude - a * b * p.latitude - a * c) / (Math.pow(a, 2) + Math.pow(b, 2)); | ||
| 217 | + var lat = (Math.pow(a, 2) * p.latitude - a * b * p.longitude - b * c) / (Math.pow(a, 2) + Math.pow(b, 2)); | ||
| 218 | + return {longitude: lon, latitude: lat}; | ||
| 219 | + } | ||
| 220 | + | ||
| 221 | + })(); | ||
| 222 | + </script> | ||
| 223 | +</div> | ||
| 0 | \ No newline at end of file | 224 | \ No newline at end of file |
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/lj_zrw.html
| @@ -37,7 +37,7 @@ | @@ -37,7 +37,7 @@ | ||
| 37 | <dl> | 37 | <dl> |
| 38 | <dt>序号</dt> | 38 | <dt>序号</dt> |
| 39 | <dt>开始时间 | 39 | <dt>开始时间 |
| 40 | - <i class="uk-icon-question-circle" data-uk-tooltip title="蓝色字为实发时间"></i></dt> | 40 | + <i class="uk-icon-question-circle" data-uk-tooltip title="蓝色字为实发时间"></i></dt> |
| 41 | <dt>结束时间</dt> | 41 | <dt>结束时间</dt> |
| 42 | <dt>起点</dt> | 42 | <dt>起点</dt> |
| 43 | <dt>终点</dt> | 43 | <dt>终点</dt> |
| @@ -75,13 +75,13 @@ | @@ -75,13 +75,13 @@ | ||
| 75 | 75 | ||
| 76 | <script id="schedule-main-table-temp" type="text/html"> | 76 | <script id="schedule-main-table-temp" type="text/html"> |
| 77 | {{each list as sch i}} | 77 | {{each list as sch i}} |
| 78 | - <dl data-id={{sch.id}}> | 78 | + <dl data-id={{sch.id}} data-line-code="{{sch.xlBm}}"> |
| 79 | <dd>{{i+1}}</dd> | 79 | <dd>{{i+1}}</dd> |
| 80 | <dd> | 80 | <dd> |
| 81 | {{if sch.fcsjActual==null}} | 81 | {{if sch.fcsjActual==null}} |
| 82 | - {{sch.dfsj}} | 82 | + {{sch.dfsj}} |
| 83 | {{else}} | 83 | {{else}} |
| 84 | - <span class="sjfc-time">{{sch.fcsjActual}}</span> | 84 | + <span class="sjfc-time">{{sch.fcsjActual}}</span> |
| 85 | {{/if}} | 85 | {{/if}} |
| 86 | 86 | ||
| 87 | {{if sch.bcType == "out"}} | 87 | {{if sch.bcType == "out"}} |
| @@ -98,7 +98,7 @@ | @@ -98,7 +98,7 @@ | ||
| 98 | {{/if}} | 98 | {{/if}} |
| 99 | 99 | ||
| 100 | {{if sch.cTasks.length > 0}} | 100 | {{if sch.cTasks.length > 0}} |
| 101 | - <span class="uk-badge uk-badge-notification">{{sch.cTasks.length}}</span> | 101 | + <span class="uk-badge uk-badge-notification">{{sch.cTasks.length}}</span> |
| 102 | {{/if}} | 102 | {{/if}} |
| 103 | </dd> | 103 | </dd> |
| 104 | <dd>{{sch.zdsj}}</dd> | 104 | <dd>{{sch.zdsj}}</dd> |
| @@ -111,67 +111,67 @@ | @@ -111,67 +111,67 @@ | ||
| 111 | {{/each}} | 111 | {{/each}} |
| 112 | </script> | 112 | </script> |
| 113 | <script id="sub_task-table-temp" type="text/html"> | 113 | <script id="sub_task-table-temp" type="text/html"> |
| 114 | - {{each list as task i}} | 114 | + {{each list as task i}} |
| 115 | <dl data-id="{{task.id}}"> | 115 | <dl data-id="{{task.id}}"> |
| 116 | - <dd>{{i+1}}</dd> | ||
| 117 | - <dd><span class="nt-dictionary" data-group="ChildTaskType">{{task.type2}}</span></dd> | ||
| 118 | - <dd>{{task.startStationName}}</dd> | ||
| 119 | - <dd>{{task.endStationName}}</dd> | ||
| 120 | - <dd>{{task.startDate}}</dd> | ||
| 121 | - <dd>{{task.endDate}}</dd> | ||
| 122 | - <dd> | ||
| 123 | - {{task.mileage}} | ||
| 124 | - (<span class="nt-dictionary" data-group="MileageType">{{task.mileageType}}</span> | ||
| 125 | - {{if task.destroy}} | ||
| 126 | - <small style="color:red;">烂班</small> | ||
| 127 | - {{/if}} | ||
| 128 | - ) | ||
| 129 | - </dd> | ||
| 130 | - <dd title="{{task.remarks}}">{{task.remarks}}</dd> | 116 | + <dd>{{i+1}}</dd> |
| 117 | + <dd><span class="nt-dictionary" data-group="ChildTaskType">{{task.type2}}</span></dd> | ||
| 118 | + <dd>{{task.startStationName}}</dd> | ||
| 119 | + <dd>{{task.endStationName}}</dd> | ||
| 120 | + <dd>{{task.startDate}}</dd> | ||
| 121 | + <dd>{{task.endDate}}</dd> | ||
| 122 | + <dd> | ||
| 123 | + {{task.mileage}} | ||
| 124 | + (<span class="nt-dictionary" data-group="MileageType">{{task.mileageType}}</span> | ||
| 125 | + {{if task.destroy}} | ||
| 126 | + <small style="color:red;">烂班</small> | ||
| 127 | + {{/if}} | ||
| 128 | + ) | ||
| 129 | + </dd> | ||
| 130 | + <dd title="{{task.remarks}}">{{task.remarks}}</dd> | ||
| 131 | </dl> | 131 | </dl> |
| 132 | - {{/each}} | 132 | + {{/each}} |
| 133 | </script> | 133 | </script> |
| 134 | <script> | 134 | <script> |
| 135 | - (function() { | ||
| 136 | - var modal_opts = { center: false, bgclose: false, modal:false } | 135 | + (function () { |
| 136 | + var modal_opts = {center: false, bgclose: false, modal: false} | ||
| 137 | var modal = '#schedule-lj_zrw-modal', | 137 | var modal = '#schedule-lj_zrw-modal', |
| 138 | - f, | ||
| 139 | - m_t_body = '.main-schedule-table .ct_table_body', | ||
| 140 | - s_t_body = '.sub-task-table .ct_table_body', | ||
| 141 | - folder = '/real_control_v2/fragments/line_schedule/context_menu', | ||
| 142 | - sch, schList, lp2SchMap; | ||
| 143 | - $(modal).on('init', function(e, data) { | 138 | + f, |
| 139 | + m_t_body = '.main-schedule-table .ct_table_body', | ||
| 140 | + s_t_body = '.sub-task-table .ct_table_body', | ||
| 141 | + folder = '/real_control_v2/fragments/line_schedule/context_menu', | ||
| 142 | + sch, schList, lp2SchMap; | ||
| 143 | + $(modal).on('init', function (e, data) { | ||
| 144 | sch = data.sch; | 144 | sch = data.sch; |
| 145 | 145 | ||
| 146 | f = $('.search-form', modal); | 146 | f = $('.search-form', modal); |
| 147 | //线路下拉框 | 147 | //线路下拉框 |
| 148 | var opts = ''; | 148 | var opts = ''; |
| 149 | - $.each(gb_data_basic.activeLines, function() { | 149 | + $.each(gb_data_basic.activeLines, function () { |
| 150 | opts += '<option value="' + this.lineCode + '">' + this.name + '</option>'; | 150 | opts += '<option value="' + this.lineCode + '">' + this.name + '</option>'; |
| 151 | }); | 151 | }); |
| 152 | $('[name=lineSelect]', f).html(opts) | 152 | $('[name=lineSelect]', f).html(opts) |
| 153 | - .on('change', function() { | ||
| 154 | - var lineCode = $(this).val(); | ||
| 155 | - schList = gb_schedule_table.findScheduleByLine(lineCode); | ||
| 156 | - lp2SchMap = gb_common.groupBy(schList, 'lpName'); | 153 | + .on('change', function () { |
| 154 | + var lineCode = $(this).val(); | ||
| 155 | + schList = gb_schedule_table.findScheduleByLine(lineCode); | ||
| 156 | + lp2SchMap = gb_common.groupBy(schList, 'lpName'); | ||
| 157 | 157 | ||
| 158 | - var opts = ''; | ||
| 159 | - for (var lpName in lp2SchMap) | ||
| 160 | - opts += '<option value="' + lpName + '">' + lpName + '</option>'; | ||
| 161 | - $('[name=lpName]', f).html(opts).trigger('change'); | ||
| 162 | - }); | 158 | + var opts = ''; |
| 159 | + for (var lpName in lp2SchMap) | ||
| 160 | + opts += '<option value="' + lpName + '">' + lpName + '</option>'; | ||
| 161 | + $('[name=lpName]', f).html(opts).trigger('change'); | ||
| 162 | + }); | ||
| 163 | 163 | ||
| 164 | //路牌下拉框 | 164 | //路牌下拉框 |
| 165 | - $('[name=lpName]', f).on('change', function() { | 165 | + $('[name=lpName]', f).on('change', function () { |
| 166 | var list = lp2SchMap[$(this).val()].sort(gb_schedule_table.schedule_sort), | 166 | var list = lp2SchMap[$(this).val()].sort(gb_schedule_table.schedule_sort), |
| 167 | - htmlBody = template('schedule-main-table-temp', { | ||
| 168 | - list: list | ||
| 169 | - }); | 167 | + htmlBody = template('schedule-main-table-temp', { |
| 168 | + list: list | ||
| 169 | + }); | ||
| 170 | $(m_t_body, modal).html(htmlBody); | 170 | $(m_t_body, modal).html(htmlBody); |
| 171 | $(s_t_body, modal).empty(); | 171 | $(s_t_body, modal).empty(); |
| 172 | }); | 172 | }); |
| 173 | //班次点击 | 173 | //班次点击 |
| 174 | - $(modal).on('click contextmenu', m_t_body + ' dl', function() { | 174 | + $(modal).on('click contextmenu', m_t_body + ' dl', function () { |
| 175 | $(this).parent().find('.active').removeClass('active'); | 175 | $(this).parent().find('.active').removeClass('active'); |
| 176 | $(this).addClass('active'); | 176 | $(this).addClass('active'); |
| 177 | //show 子任务 | 177 | //show 子任务 |
| @@ -186,122 +186,132 @@ | @@ -186,122 +186,132 @@ | ||
| 186 | selectedDl(sch); | 186 | selectedDl(sch); |
| 187 | }); | 187 | }); |
| 188 | 188 | ||
| 189 | - function selectedDl(sch){ | ||
| 190 | - //默认选中项 | ||
| 191 | - $('[name=lineSelect]', f).val(sch.xlBm).trigger('change'); | ||
| 192 | - $('[name=lpName]', f).val(sch.lpName).trigger('change'); | ||
| 193 | - var dl = $('.main-schedule-table', modal).find('dl[data-id=' + sch.id + ']').trigger('click'); | ||
| 194 | - //滚动到可视区域 | ||
| 195 | - var cont = $('.main-schedule-wrap', modal); | ||
| 196 | - cont.animate({ | ||
| 197 | - scrollTop: dl.offset().top - cont.offset().top + cont.scrollTop() - 38 | ||
| 198 | - }, 500); | 189 | + function selectedDl(sch) { |
| 190 | + //默认选中项 | ||
| 191 | + $('[name=lineSelect]', f).val(sch.xlBm).trigger('change'); | ||
| 192 | + $('[name=lpName]', f).val(sch.lpName).trigger('change'); | ||
| 193 | + var dl = $('.main-schedule-table', modal).find('dl[data-id=' + sch.id + ']').trigger('click'); | ||
| 194 | + //滚动到可视区域 | ||
| 195 | + var cont = $('.main-schedule-wrap', modal); | ||
| 196 | + cont.animate({ | ||
| 197 | + scrollTop: dl.offset().top - cont.offset().top + cont.scrollTop() - 38 | ||
| 198 | + }, 500); | ||
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | - function getActiveSch(){ | ||
| 202 | - var dl=$('.main-schedule-table dl.active', modal) | ||
| 203 | - ,sch, lineCode=$('[name=lineSelect]', f).val(); | ||
| 204 | - if(dl.length > 0) | ||
| 205 | - sch=gb_schedule_table.findScheduleByLine(lineCode)[dl.data('id')]; | 201 | + function getActiveSch() { |
| 202 | + var dl = $('.main-schedule-table dl.active', modal) | ||
| 203 | + , sch, lineCode = dl.data('line-code');//$('[name=lineSelect]', f).val(); | ||
| 204 | + if (dl.length > 0) | ||
| 205 | + sch = gb_schedule_table.findScheduleByLine(lineCode)[dl.data('id')]; | ||
| 206 | 206 | ||
| 207 | - return sch; | 207 | + return sch; |
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | //刷新主任务表格 | 210 | //刷新主任务表格 |
| 211 | - var m_s_table_update=function(e, opts){ | ||
| 212 | - var lineCode=$('[name=lineSelect]', f).val(); | ||
| 213 | - //重新获取班次数据 | ||
| 214 | - schList = gb_schedule_table.findScheduleByLine(lineCode); | ||
| 215 | - lp2SchMap = gb_common.groupBy(schList, 'lpName'); | ||
| 216 | - $('[name=lpName]', f).trigger('change'); | 211 | + var m_s_table_update = function (e, opts) { |
| 212 | + var lineCode = $('[name=lineSelect]', f).val(); | ||
| 213 | + //重新获取班次数据 | ||
| 214 | + schList = gb_schedule_table.findScheduleByLine(lineCode); | ||
| 215 | + lp2SchMap = gb_common.groupBy(schList, 'lpName'); | ||
| 216 | + $('[name=lpName]', f).trigger('change'); | ||
| 217 | 217 | ||
| 218 | - if(opts && opts.sch){ | ||
| 219 | - selectedDl(opts.sch); | ||
| 220 | - } | 218 | + if (opts && opts.sch) { |
| 219 | + selectedDl(opts.sch); | ||
| 220 | + } | ||
| 221 | } | 221 | } |
| 222 | 222 | ||
| 223 | //刷新子任务表格 | 223 | //刷新子任务表格 |
| 224 | - var sub_task_update=function(){ | ||
| 225 | - var sch=getActiveSch() | ||
| 226 | - ,htmlStr='' | ||
| 227 | - ,tbody=$(s_t_body, modal); | ||
| 228 | - sch.cTasks.sort(sub_task_sort); | ||
| 229 | - htmlStr = template('sub_task-table-temp', {list: sch.cTasks}); | ||
| 230 | - tbody.html(htmlStr); | ||
| 231 | - //字典转换 | ||
| 232 | - dictionaryUtils.transformDom($('.nt-dictionary', tbody)); | 224 | + var sub_task_update = function () { |
| 225 | + var sch = getActiveSch() | ||
| 226 | + , htmlStr = '' | ||
| 227 | + , tbody = $(s_t_body, modal); | ||
| 228 | + sch.cTasks.sort(sub_task_sort); | ||
| 229 | + htmlStr = template('sub_task-table-temp', {list: sch.cTasks}); | ||
| 230 | + tbody.html(htmlStr); | ||
| 231 | + //字典转换 | ||
| 232 | + dictionaryUtils.transformDom($('.nt-dictionary', tbody)); | ||
| 233 | } | 233 | } |
| 234 | 234 | ||
| 235 | //新增临加 | 235 | //新增临加 |
| 236 | - var add_temp_sch=function(){ | ||
| 237 | - var sch=getActiveSch(); | ||
| 238 | - if(!sch) | ||
| 239 | - sch={xlBm: $('[name=lineSelect]', f).val(), lpName: $('[name=lpName]', f).val()}; | 236 | + var add_temp_sch = function () { |
| 237 | + var sch = getActiveSch(); | ||
| 238 | + if (!sch) | ||
| 239 | + sch = {xlBm: $('[name=lineSelect]', f).val(), lpName: $('[name=lpName]', f).val()}; | ||
| 240 | 240 | ||
| 241 | - open_modal(folder + '/add_temp_sch.html', { | ||
| 242 | - sch:sch | ||
| 243 | - }, modal_opts); | 241 | + open_modal(folder + '/add_temp_sch.html', { |
| 242 | + sch: sch | ||
| 243 | + }, modal_opts); | ||
| 244 | } | 244 | } |
| 245 | 245 | ||
| 246 | //删除临加班次 | 246 | //删除临加班次 |
| 247 | - var remove_sch=function(){ | ||
| 248 | - var sch = getActiveSch(); | ||
| 249 | - if(!sch || !sch.sflj) | ||
| 250 | - return notify_err('只能删除临加班次!'); | ||
| 251 | - var str='<h3>确定要删除临加班次<span style="color:red;margin: 0 5px;">' + sch.clZbh + '( ' + sch.dfsj + ' )</span>?</h3>'; | ||
| 252 | - alt_confirm(str, function(){ | ||
| 253 | - gb_common.$del('/realSchedule/' + sch.id, function(rs){ | ||
| 254 | - //前端数据更新 | ||
| 255 | - gb_schedule_table.updateSchedule(rs.ts); | ||
| 256 | - gb_schedule_table.deheteSchedule(rs.delete); | ||
| 257 | - //m_s_table_update(); | ||
| 258 | - $('.main-schedule-table', modal).trigger('refresh'); | ||
| 259 | - }); | ||
| 260 | - }, '确定删除'); | ||
| 261 | - } | 247 | + var remove_sch = function () { |
| 248 | + var sch = getActiveSch(); | ||
| 249 | + if (!sch || !sch.sflj) | ||
| 250 | + return notify_err('只能删除临加班次!'); | ||
| 251 | + var str = '<h3>确定要删除临加班次<span style="color:red;margin: 0 5px;">' + sch.clZbh + '( ' + sch.dfsj + ' )</span>?</h3>'; | ||
| 252 | + alt_confirm(str, function () { | ||
| 253 | + gb_common.$del('/realSchedule/' + sch.id, function (rs) { | ||
| 254 | + //前端数据更新 | ||
| 255 | + gb_schedule_table.updateSchedule(rs.ts); | ||
| 256 | + gb_schedule_table.deheteSchedule(rs.delete); | ||
| 257 | + //m_s_table_update(); | ||
| 258 | + $('.main-schedule-table', modal).trigger('refresh'); | ||
| 259 | + }); | ||
| 260 | + }, '确定删除'); | ||
| 261 | + }; | ||
| 262 | //添加自定义子任务 | 262 | //添加自定义子任务 |
| 263 | - var add_sub_task_other=function(){ | ||
| 264 | - var sch=getActiveSch(); | ||
| 265 | - if(!sch) | ||
| 266 | - return notify_err('无法获取到主任务信息!'); | ||
| 267 | - open_modal(folder + '/sub_task/add_sub_task_other.html', { | ||
| 268 | - sch:sch | ||
| 269 | - }, modal_opts); | ||
| 270 | - } | 263 | + var add_sub_task_other = function () { |
| 264 | + var sch = getActiveSch(); | ||
| 265 | + if (!sch) | ||
| 266 | + return notify_err('无法获取到主任务信息!'); | ||
| 267 | + open_modal(folder + '/sub_task/add_sub_task_other.html', { | ||
| 268 | + sch: sch | ||
| 269 | + }, modal_opts); | ||
| 270 | + }; | ||
| 271 | + | ||
| 272 | + //回场子任务 | ||
| 273 | + var add_sub_task_in = function () { | ||
| 274 | + var sch = getActiveSch(); | ||
| 275 | + if (!sch) | ||
| 276 | + return notify_err('无法获取到主任务信息!'); | ||
| 277 | + open_modal(folder + '/sub_task/add_sub_task_inpark.html', { | ||
| 278 | + sch: sch | ||
| 279 | + }, modal_opts); | ||
| 280 | + }; | ||
| 271 | 281 | ||
| 272 | //删除子任务 | 282 | //删除子任务 |
| 273 | - var remove_sub_task=function(){ | ||
| 274 | - var activeDl=$(s_t_body, modal).find('dl.context-menu-active'); | ||
| 275 | - if(activeDl.length==0) | ||
| 276 | - return; | ||
| 277 | - var dds=activeDl.find('dd'); | ||
| 278 | - console.log(dds); | ||
| 279 | - var id=activeDl.data('id') | ||
| 280 | - ,str='<h3>确定要删除子任务<span style="color:red;margin: 0 5px;">'+ $(dds[4]).text()+','+ $(dds[6]).text() +' </span>?</h3>'; | ||
| 281 | - alt_confirm(str, function(){ | ||
| 282 | - gb_common.$del('/childTask/' + id, function(rs){ | ||
| 283 | - gb_schedule_table.updateSchedule(rs.t); | ||
| 284 | - notify_succ('删除子任务成功!'); | ||
| 285 | - //刷新班次列表 | ||
| 286 | - m_s_table_update(); | ||
| 287 | - //选中班次 | ||
| 288 | - selectedDl(rs.t); | ||
| 289 | - }); | ||
| 290 | - }, '确定删除'); | ||
| 291 | - } | 283 | + var remove_sub_task = function () { |
| 284 | + var activeDl = $(s_t_body, modal).find('dl.context-menu-active'); | ||
| 285 | + if (activeDl.length == 0) | ||
| 286 | + return; | ||
| 287 | + var dds = activeDl.find('dd'); | ||
| 288 | + var id = activeDl.data('id') | ||
| 289 | + , str = '<h3>确定要删除子任务<span style="color:red;margin: 0 5px;">' + $(dds[4]).text() + ',' + $(dds[6]).text() + ' </span>?</h3>'; | ||
| 290 | + alt_confirm(str, function () { | ||
| 291 | + gb_common.$del('/childTask/' + id, function (rs) { | ||
| 292 | + gb_schedule_table.updateSchedule(rs.t); | ||
| 293 | + notify_succ('删除子任务成功!'); | ||
| 294 | + //刷新班次列表 | ||
| 295 | + m_s_table_update(); | ||
| 296 | + //选中班次 | ||
| 297 | + selectedDl(rs.t); | ||
| 298 | + }); | ||
| 299 | + }, '确定删除'); | ||
| 300 | + }; | ||
| 292 | 301 | ||
| 293 | - var callbackHandler={ | ||
| 294 | - add_temp_sch:add_temp_sch, | ||
| 295 | - remove_sch: remove_sch, | ||
| 296 | - add_sub_task_other:add_sub_task_other, | ||
| 297 | - remove_sub_task: remove_sub_task | ||
| 298 | - } | 302 | + var callbackHandler = { |
| 303 | + add_temp_sch: add_temp_sch, | ||
| 304 | + remove_sch: remove_sch, | ||
| 305 | + add_sub_task_other: add_sub_task_other, | ||
| 306 | + add_sub_task_in: add_sub_task_in, | ||
| 307 | + remove_sub_task: remove_sub_task | ||
| 308 | + }; | ||
| 299 | 309 | ||
| 300 | //右键菜单 | 310 | //右键菜单 |
| 301 | $.contextMenu({ | 311 | $.contextMenu({ |
| 302 | - selector: modal+ ' '+m_t_body+' dl', | 312 | + selector: modal + ' ' + m_t_body + ' dl', |
| 303 | className: 'schedule-ct-menu', | 313 | className: 'schedule-ct-menu', |
| 304 | - callback: function(key, options) { | 314 | + callback: function (key, options) { |
| 305 | callbackHandler[key] && callbackHandler[key](); | 315 | callbackHandler[key] && callbackHandler[key](); |
| 306 | }, | 316 | }, |
| 307 | items: { | 317 | items: { |
| @@ -312,12 +322,11 @@ | @@ -312,12 +322,11 @@ | ||
| 312 | name: "添加子任务", | 322 | name: "添加子任务", |
| 313 | items: { | 323 | items: { |
| 314 | 'add_sub_task_in': { | 324 | 'add_sub_task_in': { |
| 315 | - name: '回场', | ||
| 316 | - disabled:true | 325 | + name: '回场' |
| 317 | }, | 326 | }, |
| 318 | 'add_sub_task_out': { | 327 | 'add_sub_task_out': { |
| 319 | name: '出场', | 328 | name: '出场', |
| 320 | - disabled:true | 329 | + disabled: true |
| 321 | }, | 330 | }, |
| 322 | 'add_sub_task_other': { | 331 | 'add_sub_task_other': { |
| 323 | name: '自定义' | 332 | name: '自定义' |
| @@ -325,16 +334,16 @@ | @@ -325,16 +334,16 @@ | ||
| 325 | } | 334 | } |
| 326 | }, | 335 | }, |
| 327 | 'remove_sch': { | 336 | 'remove_sch': { |
| 328 | - name: '删除' | 337 | + name: '删除' |
| 329 | } | 338 | } |
| 330 | } | 339 | } |
| 331 | }); | 340 | }); |
| 332 | 341 | ||
| 333 | //右键菜单 | 342 | //右键菜单 |
| 334 | $.contextMenu({ | 343 | $.contextMenu({ |
| 335 | - selector: modal+' '+s_t_body+' dl', | 344 | + selector: modal + ' ' + s_t_body + ' dl', |
| 336 | className: 'schedule-ct-menu', | 345 | className: 'schedule-ct-menu', |
| 337 | - callback: function(key, options) { | 346 | + callback: function (key, options) { |
| 338 | callbackHandler[key] && callbackHandler[key](); | 347 | callbackHandler[key] && callbackHandler[key](); |
| 339 | }, | 348 | }, |
| 340 | items: { | 349 | items: { |
| @@ -349,8 +358,8 @@ | @@ -349,8 +358,8 @@ | ||
| 349 | 358 | ||
| 350 | $('.add-temp-sch-icon', modal).on('click', add_temp_sch); | 359 | $('.add-temp-sch-icon', modal).on('click', add_temp_sch); |
| 351 | 360 | ||
| 352 | - function sub_task_sort(a, b){ | ||
| 353 | - return a.id - b.id; | 361 | + function sub_task_sort(a, b) { |
| 362 | + return a.id - b.id; | ||
| 354 | } | 363 | } |
| 355 | })(); | 364 | })(); |
| 356 | </script> | 365 | </script> |
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task/add_sub_task_inpark.html
0 → 100644
| 1 | +<div class="uk-modal" id="add-sub-task-inpark-modal"> | ||
| 2 | + <div class="uk-modal-dialog"> | ||
| 3 | + <a href="" class="uk-modal-close uk-close"></a> | ||
| 4 | + <div class="uk-modal-header"> | ||
| 5 | + <h2>回场子任务</h2></div> | ||
| 6 | + | ||
| 7 | + <div style="width: 100%;padding-left: 1%;"> | ||
| 8 | + <div class="sub-task-card"> | ||
| 9 | + <div class="uk-panel uk-panel-box uk-panel-box-primary"> | ||
| 10 | + <div class="uk-panel-badge uk-badge">营运</div> | ||
| 11 | + <h3 class="uk-panel-title">线路上站点间</h3> | ||
| 12 | + <form class="uk-form uk-form-horizontal" service_form> | ||
| 13 | + <div class="uk-grid"> | ||
| 14 | + <div class="uk-width-3-10"> | ||
| 15 | + <div class="uk-form-row"> | ||
| 16 | + <label class="uk-form-label">起点 </label> | ||
| 17 | + </div> | ||
| 18 | + </div> | ||
| 19 | + <div class="uk-width-7-10 pl5"> | ||
| 20 | + <select name="startStation" disabled></select> | ||
| 21 | + </div> | ||
| 22 | + </div> | ||
| 23 | + <div class="uk-grid"> | ||
| 24 | + <div class="uk-width-3-10"> | ||
| 25 | + <div class="uk-form-row"> | ||
| 26 | + <label class="uk-form-label">终点 </label> | ||
| 27 | + </div> | ||
| 28 | + </div> | ||
| 29 | + <div class="uk-width-7-10 pl5"> | ||
| 30 | + <select name="endStation" class="ct_focus"></select> | ||
| 31 | + </div> | ||
| 32 | + </div> | ||
| 33 | + <div class="uk-grid"> | ||
| 34 | + <div class="uk-width-3-10"> | ||
| 35 | + <div class="uk-form-row"> | ||
| 36 | + <label class="uk-form-label">营运里程</label> | ||
| 37 | + </div> | ||
| 38 | + </div> | ||
| 39 | + <div class="uk-width-7-10 pl5"> | ||
| 40 | + <input type="text" name="mileageType" required> | ||
| 41 | + </div> | ||
| 42 | + </div> | ||
| 43 | + <div class="uk-grid"> | ||
| 44 | + <div class="uk-width-3-10"> | ||
| 45 | + <div class="uk-form-row"> | ||
| 46 | + <label class="uk-form-label">开始时间</label> | ||
| 47 | + </div> | ||
| 48 | + </div> | ||
| 49 | + <div class="uk-width-7-10 pl5"> | ||
| 50 | + <input type="time" name="startDate" required> | ||
| 51 | + </div> | ||
| 52 | + </div> | ||
| 53 | + <div class="uk-grid"> | ||
| 54 | + <div class="uk-width-3-10"> | ||
| 55 | + <div class="uk-form-row"> | ||
| 56 | + <label class="uk-form-label">结束时间</label> | ||
| 57 | + </div> | ||
| 58 | + </div> | ||
| 59 | + <div class="uk-width-7-10 pl5"> | ||
| 60 | + <input type="time" name="endDate" required> | ||
| 61 | + </div> | ||
| 62 | + </div> | ||
| 63 | + </form> | ||
| 64 | + </div> | ||
| 65 | + </div> | ||
| 66 | + <div class="sub-task-card"> | ||
| 67 | + <div class="uk-panel uk-panel-box uk-panel-box-secondary"> | ||
| 68 | + <div class="uk-panel-badge uk-badge uk-badge-default">空驶</div> | ||
| 69 | + <h3 class="uk-panel-title">进场</h3> | ||
| 70 | + <form class="uk-form uk-form-horizontal" empty_form> | ||
| 71 | + <div class="uk-grid"> | ||
| 72 | + <div class="uk-width-3-10"> | ||
| 73 | + <div class="uk-form-row"> | ||
| 74 | + <label class="uk-form-label">起点 </label> | ||
| 75 | + </div> | ||
| 76 | + </div> | ||
| 77 | + <div class="uk-width-7-10 pl5"> | ||
| 78 | + <select name="startStation" disabled></select> | ||
| 79 | + </div> | ||
| 80 | + </div> | ||
| 81 | + <div class="uk-grid"> | ||
| 82 | + <div class="uk-width-3-10"> | ||
| 83 | + <div class="uk-form-row"> | ||
| 84 | + <label class="uk-form-label">终点 </label> | ||
| 85 | + </div> | ||
| 86 | + </div> | ||
| 87 | + <div class="uk-width-7-10 pl5"> | ||
| 88 | + <select name="endStation" class="ct_focus"></select> | ||
| 89 | + </div> | ||
| 90 | + </div> | ||
| 91 | + <div class="uk-grid"> | ||
| 92 | + <div class="uk-width-3-10"> | ||
| 93 | + <div class="uk-form-row"> | ||
| 94 | + <label class="uk-form-label">空驶里程</label> | ||
| 95 | + </div> | ||
| 96 | + </div> | ||
| 97 | + <div class="uk-width-7-10 pl5"> | ||
| 98 | + <input type="text" name="mileageType" required style="width: calc(100% - 62px);"> | ||
| 99 | + <a style="font-size: 12px;">路径(3)</a> | ||
| 100 | + </div> | ||
| 101 | + </div> | ||
| 102 | + <div class="uk-grid"> | ||
| 103 | + <div class="uk-width-3-10"> | ||
| 104 | + <div class="uk-form-row"> | ||
| 105 | + <label class="uk-form-label">开始时间</label> | ||
| 106 | + </div> | ||
| 107 | + </div> | ||
| 108 | + <div class="uk-width-7-10 pl5"> | ||
| 109 | + <input type="time" name="startDate" required> | ||
| 110 | + </div> | ||
| 111 | + </div> | ||
| 112 | + <div class="uk-grid"> | ||
| 113 | + <div class="uk-width-3-10"> | ||
| 114 | + <div class="uk-form-row"> | ||
| 115 | + <label class="uk-form-label">结束时间</label> | ||
| 116 | + </div> | ||
| 117 | + </div> | ||
| 118 | + <div class="uk-width-7-10 pl5"> | ||
| 119 | + <input type="time" name="endDate" required> | ||
| 120 | + </div> | ||
| 121 | + </div> | ||
| 122 | + </form> | ||
| 123 | + </div> | ||
| 124 | + </div> | ||
| 125 | + <div class="sub-task-card destroy-card uk-animation-scale"> | ||
| 126 | + <div class="uk-panel uk-panel-box uk-panel-box-danger"> | ||
| 127 | + <div class="uk-panel-badge uk-badge uk-badge-danger">烂班</div> | ||
| 128 | + <h3 class="uk-panel-title">线路上站点间</h3> | ||
| 129 | + <form class="uk-form uk-form-horizontal" destroy_form> | ||
| 130 | + <div class="uk-grid"> | ||
| 131 | + <div class="uk-width-3-10"> | ||
| 132 | + <div class="uk-form-row"> | ||
| 133 | + <label class="uk-form-label">起点 </label> | ||
| 134 | + </div> | ||
| 135 | + </div> | ||
| 136 | + <div class="uk-width-7-10 pl5"> | ||
| 137 | + <select name="startStation" disabled></select> | ||
| 138 | + </div> | ||
| 139 | + </div> | ||
| 140 | + <div class="uk-grid"> | ||
| 141 | + <div class="uk-width-3-10"> | ||
| 142 | + <div class="uk-form-row"> | ||
| 143 | + <label class="uk-form-label">终点 </label> | ||
| 144 | + </div> | ||
| 145 | + </div> | ||
| 146 | + <div class="uk-width-7-10 pl5"> | ||
| 147 | + <select name="endStation" class="ct_focus" disabled></select> | ||
| 148 | + </div> | ||
| 149 | + </div> | ||
| 150 | + <div class="uk-grid"> | ||
| 151 | + <div class="uk-width-3-10"> | ||
| 152 | + <div class="uk-form-row"> | ||
| 153 | + <label class="uk-form-label">烂班里程</label> | ||
| 154 | + </div> | ||
| 155 | + </div> | ||
| 156 | + <div class="uk-width-7-10 pl5"> | ||
| 157 | + <input type="text" name="mileageType" required> | ||
| 158 | + </div> | ||
| 159 | + </div> | ||
| 160 | + <div class="uk-grid"> | ||
| 161 | + <div class="uk-width-3-10"> | ||
| 162 | + <div class="uk-form-row"> | ||
| 163 | + <label class="uk-form-label">开始时间</label> | ||
| 164 | + </div> | ||
| 165 | + </div> | ||
| 166 | + <div class="uk-width-7-10 pl5"> | ||
| 167 | + <input type="time" name="startDate" required> | ||
| 168 | + </div> | ||
| 169 | + </div> | ||
| 170 | + <div class="uk-grid"> | ||
| 171 | + <div class="uk-width-3-10"> | ||
| 172 | + <div class="uk-form-row"> | ||
| 173 | + <label class="uk-form-label">烂班原因</label> | ||
| 174 | + </div> | ||
| 175 | + </div> | ||
| 176 | + <div class="uk-width-7-10 pl5"> | ||
| 177 | + <select name="destroyReason" required></select> | ||
| 178 | + </div> | ||
| 179 | + </div> | ||
| 180 | + </form> | ||
| 181 | + </div> | ||
| 182 | + </div> | ||
| 183 | + | ||
| 184 | + <form class="uk-form" style="margin-top: 15px; padding: 0 10px 0 0;"> | ||
| 185 | + <textarea placeholder="备注" style="width: 100%;height: 70px;"></textarea> | ||
| 186 | + </form> | ||
| 187 | + </div> | ||
| 188 | + | ||
| 189 | + <div class="uk-modal-footer uk-text-right"> | ||
| 190 | + <button type="button" class="uk-button uk-modal-close">取消</button> | ||
| 191 | + <button type="button" class="uk-button uk-button-primary">提交子任务</button> | ||
| 192 | + | ||
| 193 | + <div class="ct-footer-left"> | ||
| 194 | + <a id="betweenStationRangeCalc" data-drawer-id="cal_station_space_drawer">站点间公里不准?</a> | ||
| 195 | + </div> | ||
| 196 | + </div> | ||
| 197 | + </div> | ||
| 198 | + | ||
| 199 | + <div class="ct-bottom-drawer"> | ||
| 200 | + <a class="ct-bottom-drawer-close"></a> | ||
| 201 | + | ||
| 202 | + <div class="ct-bottom-drawer-body"></div> | ||
| 203 | + </div> | ||
| 204 | + | ||
| 205 | + <script id="sub-task-inpark-form-temp" type="text/html"> | ||
| 206 | + </script> | ||
| 207 | + | ||
| 208 | + <script> | ||
| 209 | + (function () { | ||
| 210 | + var modal = '#add-sub-task-inpark-modal', | ||
| 211 | + serviceForm = $('form[service_form]', modal), | ||
| 212 | + emptyForm = $('form[empty_form]', modal), | ||
| 213 | + destroyForm = $('form[destroy_form]', modal), | ||
| 214 | + sch, stationRoutes, parks, information, esCode; | ||
| 215 | + var adjustExps = ['配车', '保养', '故障', '肇事', '路阻', '纠纷', '缺人', '客稀', '缺车', '气候', '援外', '吊慢', '抽减', '其他']; | ||
| 216 | + $(modal).on('init', function (e, data) { | ||
| 217 | + sch = data.sch; | ||
| 218 | + //var formHtml = template('sub-task-inpark-form-temp', {sch:sch, adjustExps: adjustExps}); | ||
| 219 | + //$('form', modal).html(formHtml); | ||
| 220 | + //字典转换 | ||
| 221 | + //dictionaryUtils.transformDom($('.nt-dictionary', modal)); | ||
| 222 | + | ||
| 223 | + //站点路由 | ||
| 224 | + stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) { | ||
| 225 | + return a.stationRouteCode - b.stationRouteCode; | ||
| 226 | + }), 'directions')[sch.xlDir]; | ||
| 227 | + //空驶终点(停车场) | ||
| 228 | + $.get('/basic/parks', function (rs) { | ||
| 229 | + parks = rs; | ||
| 230 | + var opts = ''; | ||
| 231 | + for (var code in parks) { | ||
| 232 | + opts += '<option value="' + code + '">' + parks[code] + '</option>'; | ||
| 233 | + } | ||
| 234 | + $('select[name=endStation]', emptyForm).html(opts).val(information.carPark); | ||
| 235 | + }); | ||
| 236 | + //线路标准 | ||
| 237 | + information = gb_data_basic.getLineInformation(sch.xlBm); | ||
| 238 | + | ||
| 239 | + var routeOpts = ''; | ||
| 240 | + $.each(stationRoutes, function () { | ||
| 241 | + routeOpts += '<option value="' + this.stationCode + '">' + this.stationName + '</option>'; | ||
| 242 | + }); | ||
| 243 | + esCode = stationRoutes[stationRoutes.length - 1].stationCode; | ||
| 244 | + | ||
| 245 | + //营运起终点 | ||
| 246 | + $('select[name=startStation],select[name=endStation]', serviceForm).html(routeOpts); | ||
| 247 | + //空驶起点 | ||
| 248 | + $('select[name=startStation]', emptyForm).html(routeOpts).val(esCode); | ||
| 249 | + //烂班起终点 | ||
| 250 | + $('select[name=startStation],select[name=endStation]', destroyForm).html(routeOpts).val(esCode); | ||
| 251 | + | ||
| 252 | + //烂班原因 | ||
| 253 | + var adjustExpsOpts = '<option value="">请选择...</option>'; | ||
| 254 | + $.each(adjustExps, function (i, str) { | ||
| 255 | + adjustExpsOpts += '<option value="' + str + '">' + str + '</option>'; | ||
| 256 | + }); | ||
| 257 | + $('select[name=destroyReason]', destroyForm).html(adjustExpsOpts); | ||
| 258 | + | ||
| 259 | + //切换营运终点 | ||
| 260 | + $('select[name=endStation]', serviceForm).val(esCode).on('change', function () { | ||
| 261 | + var val = $(this).val(); | ||
| 262 | + if (val == esCode) { | ||
| 263 | + $('.uk-modal-dialog', modal).removeClass('three-children'); | ||
| 264 | + $('.sub-task-card.destroy-card').css("display", "none"); | ||
| 265 | + } | ||
| 266 | + else { | ||
| 267 | + $('.uk-modal-dialog', modal).addClass('three-children'); | ||
| 268 | + $('.sub-task-card.destroy-card').css("display", "inline-block"); | ||
| 269 | + } | ||
| 270 | + | ||
| 271 | + reClac(); | ||
| 272 | + }); | ||
| 273 | + | ||
| 274 | + | ||
| 275 | + //submit | ||
| 276 | + /*var f = $('form', modal).formValidation({ | ||
| 277 | + framework: 'uikit', | ||
| 278 | + locale: 'zh_CN', | ||
| 279 | + }); | ||
| 280 | + f.on('success.form.fv', function(e) { | ||
| 281 | + disabled_submit_btn(this); | ||
| 282 | + e.preventDefault(); | ||
| 283 | + var data = $(this).serializeJSON(); | ||
| 284 | + | ||
| 285 | + });*/ | ||
| 286 | + }); | ||
| 287 | + | ||
| 288 | + function reClac() { | ||
| 289 | + var serviceEnd = $('select[name=endStation]', serviceForm).val(); | ||
| 290 | + //空驶起点 == 营运终点 | ||
| 291 | + $('select[name=startStation]', emptyForm).val(serviceEnd); | ||
| 292 | + | ||
| 293 | + if (serviceEnd != esCode) { | ||
| 294 | + //烂班起点 == 营运终点 | ||
| 295 | + $('select[name=startStation]', destroyForm).val(serviceEnd); | ||
| 296 | + } | ||
| 297 | + } | ||
| 298 | + | ||
| 299 | + | ||
| 300 | + //------ 下抽屉 ------ | ||
| 301 | + $('#betweenStationRangeCalc', modal).on('click', function () { | ||
| 302 | + var id = $(this).data('drawer-id'); | ||
| 303 | + switchBtmDrawer(id, '/real_control_v2/fragments/geo/calc_station_space.html'); | ||
| 304 | + }); | ||
| 305 | + | ||
| 306 | + var btmDrawer = $('.ct-bottom-drawer', modal); | ||
| 307 | + //打开事件 | ||
| 308 | + btmDrawer.on('drawer_show', function () { | ||
| 309 | + var url = $(this).data('url'); | ||
| 310 | + if(!url){ | ||
| 311 | + alert('无效的地址'); | ||
| 312 | + } | ||
| 313 | + | ||
| 314 | + var drawerPanel=$(this).data('name'); | ||
| 315 | + $('.ct-bottom-drawer-body', btmDrawer).load(url, function () { | ||
| 316 | + $('#'+drawerPanel).trigger('drawer-init', {sch: sch}); | ||
| 317 | + }); | ||
| 318 | + }); | ||
| 319 | + | ||
| 320 | + function switchBtmDrawer(id, url) { | ||
| 321 | + if (btmDrawer.hasClass('open') && btmDrawer.data('name') == id) { | ||
| 322 | + btmDrawer.removeClass('open'); | ||
| 323 | + btmDrawer.removeData('name').removeData('url'); | ||
| 324 | + } | ||
| 325 | + else { | ||
| 326 | + btmDrawer.addClass('open'); | ||
| 327 | + btmDrawer.data('name', id).data('url', url).trigger('drawer_show'); | ||
| 328 | + } | ||
| 329 | + } | ||
| 330 | + })(); | ||
| 331 | + </script> | ||
| 332 | +</div> |
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task/add_sub_task_other.html
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | <div class="uk-modal-dialog" style="width: 635px;"> | 2 | <div class="uk-modal-dialog" style="width: 635px;"> |
| 3 | <a href="" class="uk-modal-close uk-close"></a> | 3 | <a href="" class="uk-modal-close uk-close"></a> |
| 4 | <div class="uk-modal-header"> | 4 | <div class="uk-modal-header"> |
| 5 | - <h2>新增自定义子任务</h2></div> | 5 | + <h2>自定义子任务</h2></div> |
| 6 | <form class="uk-form uk-form-horizontal"> | 6 | <form class="uk-form uk-form-horizontal"> |
| 7 | </form> | 7 | </form> |
| 8 | </div> | 8 | </div> |
| @@ -15,10 +15,11 @@ | @@ -15,10 +15,11 @@ | ||
| 15 | <label class="uk-form-label">班次类型</label> | 15 | <label class="uk-form-label">班次类型</label> |
| 16 | <div class="uk-form-controls"> | 16 | <div class="uk-form-controls"> |
| 17 | <select class="form-control" name="type1" style="width: 65px;"> | 17 | <select class="form-control" name="type1" style="width: 65px;"> |
| 18 | - <option>正常</option> | ||
| 19 | - <option>临加</option> | 18 | + <option>正常</option> |
| 19 | + <option>临加</option> | ||
| 20 | </select> | 20 | </select> |
| 21 | - <select class="form-control nt-dictionary" name="type2" data-group=ChildTaskType style="width: 126px;;"></select> | 21 | + <select class="form-control nt-dictionary" name="type2" data-group=ChildTaskType |
| 22 | + style="width: 126px;;"></select> | ||
| 22 | </div> | 23 | </div> |
| 23 | </div> | 24 | </div> |
| 24 | </div> | 25 | </div> |
| @@ -47,7 +48,8 @@ | @@ -47,7 +48,8 @@ | ||
| 47 | <div class="uk-form-row"> | 48 | <div class="uk-form-row"> |
| 48 | <label class="uk-form-label">里程类型</label> | 49 | <label class="uk-form-label">里程类型</label> |
| 49 | <div class="uk-form-controls"> | 50 | <div class="uk-form-controls"> |
| 50 | - <select class="form-control nt-dictionary" required name="mileageType" data-group="MileageType" ></select> | 51 | + <select class="form-control nt-dictionary" required name="mileageType" |
| 52 | + data-group="MileageType"></select> | ||
| 51 | </div> | 53 | </div> |
| 52 | </div> | 54 | </div> |
| 53 | </div> | 55 | </div> |
| @@ -74,7 +76,7 @@ | @@ -74,7 +76,7 @@ | ||
| 74 | <div class="uk-form-row"> | 76 | <div class="uk-form-row"> |
| 75 | <label class="uk-form-label">结束时间</label> | 77 | <label class="uk-form-label">结束时间</label> |
| 76 | <div class="uk-form-controls"> | 78 | <div class="uk-form-controls"> |
| 77 | - <input name="endDate" value="{{sch.zdsj}}" type="time" required> | 79 | + <input name="endDate" value="{{sch.zdsj}}" type="time" required> |
| 78 | </div> | 80 | </div> |
| 79 | </div> | 81 | </div> |
| 80 | </div> | 82 | </div> |
| @@ -95,12 +97,12 @@ | @@ -95,12 +97,12 @@ | ||
| 95 | <div class="uk-form-row"> | 97 | <div class="uk-form-row"> |
| 96 | <label class="uk-form-label">烂班原因</label> | 98 | <label class="uk-form-label">烂班原因</label> |
| 97 | <div class="uk-form-controls"> | 99 | <div class="uk-form-controls"> |
| 98 | - <select class="form-control" name="destroyReason" > | ||
| 99 | - <option value="">请选择...</option> | ||
| 100 | - {{each adjustExps as exp i}} | ||
| 101 | - <option value="{{exp}}">{{exp}}</option> | ||
| 102 | - {{/each}} | ||
| 103 | - </select> | 100 | + <select class="form-control" name="destroyReason"> |
| 101 | + <option value="">请选择...</option> | ||
| 102 | + {{each adjustExps as exp i}} | ||
| 103 | + <option value="{{exp}}">{{exp}}</option> | ||
| 104 | + {{/each}} | ||
| 105 | + </select> | ||
| 104 | </div> | 106 | </div> |
| 105 | </div> | 107 | </div> |
| 106 | </div> | 108 | </div> |
| @@ -110,7 +112,8 @@ | @@ -110,7 +112,8 @@ | ||
| 110 | <div class="uk-width-1-1"> | 112 | <div class="uk-width-1-1"> |
| 111 | <div class="uk-form-row ct-stacked"> | 113 | <div class="uk-form-row ct-stacked"> |
| 112 | <div class="uk-form-controls" style="margin-top: 5px;"> | 114 | <div class="uk-form-controls" style="margin-top: 5px;"> |
| 113 | - <textarea id="form-s-t" cols="30" rows="5" name="remarks" data-fv-stringlength="true" data-fv-stringlength-max="50" placeholder="备注,不超过50个字符"></textarea> | 115 | + <textarea id="form-s-t" cols="30" rows="5" name="remarks" data-fv-stringlength="true" |
| 116 | + data-fv-stringlength-max="50" placeholder="备注,不超过50个字符"></textarea> | ||
| 114 | </div> | 117 | </div> |
| 115 | </div> | 118 | </div> |
| 116 | </div> | 119 | </div> |
| @@ -122,48 +125,36 @@ | @@ -122,48 +125,36 @@ | ||
| 122 | </script> | 125 | </script> |
| 123 | 126 | ||
| 124 | <script> | 127 | <script> |
| 125 | - (function() { | 128 | + (function () { |
| 126 | var modal = '#add-sub-task-other-modal', | 129 | var modal = '#add-sub-task-other-modal', |
| 127 | - sch, stationRoutes, parks, information; | 130 | + sch, stationRoutes, parks, information; |
| 128 | var adjustExps = ['配车', '保养', '故障', '肇事', '路阻', '纠纷', '缺人', '客稀', '缺车', '气候', '援外', '吊慢', '抽减', '其他']; | 131 | var adjustExps = ['配车', '保养', '故障', '肇事', '路阻', '纠纷', '缺人', '客稀', '缺车', '气候', '援外', '吊慢', '抽减', '其他']; |
| 129 | - $(modal).on('init', function(e, data) { | 132 | + $(modal).on('init', function (e, data) { |
| 130 | sch = data.sch; | 133 | sch = data.sch; |
| 131 | - var formHtml = template('sub-task-other-form-temp', {sch:sch, adjustExps: adjustExps}); | 134 | + var formHtml = template('sub-task-other-form-temp', {sch: sch, adjustExps: adjustExps}); |
| 132 | $('form', modal).html(formHtml); | 135 | $('form', modal).html(formHtml); |
| 133 | //字典转换 | 136 | //字典转换 |
| 134 | dictionaryUtils.transformDom($('.nt-dictionary', modal)); | 137 | dictionaryUtils.transformDom($('.nt-dictionary', modal)); |
| 135 | 138 | ||
| 136 | - //----------- Autocomplete -------------- | ||
| 137 | - // $.get('/basic/cars', function(rs) { | ||
| 138 | - // //车辆 | ||
| 139 | - // gb_common.carAutocomplete($('.car-autocom', modal), rs); | ||
| 140 | - // }); | ||
| 141 | - // $.get('/basic/all_personnel', function(rs) { | ||
| 142 | - // //驾驶员 | ||
| 143 | - // gb_common.personAutocomplete($('.jsy-autocom', modal), rs); | ||
| 144 | - // //售票员 | ||
| 145 | - // gb_common.personAutocomplete($('.spy-autocom', modal), rs); | ||
| 146 | - // }); | ||
| 147 | - | ||
| 148 | //站点路由 | 139 | //站点路由 |
| 149 | - stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function(a, b){ | ||
| 150 | - return a.stationRouteCode-b.stationRouteCode; | 140 | + stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) { |
| 141 | + return a.stationRouteCode - b.stationRouteCode; | ||
| 151 | }), 'directions'); | 142 | }), 'directions'); |
| 152 | //停车场 | 143 | //停车场 |
| 153 | - $.get('/basic/parks', function(rs){ | ||
| 154 | - parks=rs; | 144 | + $.get('/basic/parks', function (rs) { |
| 145 | + parks = rs; | ||
| 155 | }); | 146 | }); |
| 156 | //线路标准 | 147 | //线路标准 |
| 157 | - information=gb_data_basic.getLineInformation(sch.xlBm); | 148 | + information = gb_data_basic.getLineInformation(sch.xlBm); |
| 158 | 149 | ||
| 159 | //submit | 150 | //submit |
| 160 | var f = $('form', modal).formValidation(gb_form_validation_opts); | 151 | var f = $('form', modal).formValidation(gb_form_validation_opts); |
| 161 | - f.on('success.form.fv', function(e) { | 152 | + f.on('success.form.fv', function (e) { |
| 162 | disabled_submit_btn(this); | 153 | disabled_submit_btn(this); |
| 163 | e.preventDefault(); | 154 | e.preventDefault(); |
| 164 | var data = $(this).serializeJSON(); | 155 | var data = $(this).serializeJSON(); |
| 165 | 156 | ||
| 166 | - gb_common.$post('/childTask', data, function(rs){ | 157 | + gb_common.$post('/childTask', data, function (rs) { |
| 167 | notify_succ('子任务添加成功'); | 158 | notify_succ('子任务添加成功'); |
| 168 | gb_schedule_table.updateSchedule(rs.t); | 159 | gb_schedule_table.updateSchedule(rs.t); |
| 169 | $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: rs.t}); | 160 | $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: rs.t}); |
| @@ -172,49 +163,49 @@ | @@ -172,49 +163,49 @@ | ||
| 172 | }); | 163 | }); |
| 173 | 164 | ||
| 174 | //班次类型 | 165 | //班次类型 |
| 175 | - $('[name=type2]', f).on('change', function(){ | ||
| 176 | - var routes=stationRoutes[sch.xlDir] | ||
| 177 | - ,lastCode=routes[routes.length-1].stationCode | ||
| 178 | - ,opts='',park_opts=''; | ||
| 179 | - //station options | ||
| 180 | - $.each(routes, function(){ | ||
| 181 | - opts+='<option value="'+this.stationCode+'">'+this.stationName+'</option>' | ||
| 182 | - }); | ||
| 183 | - //park options | ||
| 184 | - for(var code in parks) | ||
| 185 | - park_opts+='<option value="'+code+'">'+parks[code]+'</option>'; | 166 | + $('[name=type2]', f).on('change', function () { |
| 167 | + var routes = stationRoutes[sch.xlDir] | ||
| 168 | + , lastCode = routes[routes.length - 1].stationCode | ||
| 169 | + , opts = '', park_opts = ''; | ||
| 170 | + //station options | ||
| 171 | + $.each(routes, function () { | ||
| 172 | + opts += '<option value="' + this.stationCode + '">' + this.stationName + '</option>' | ||
| 173 | + }); | ||
| 174 | + //park options | ||
| 175 | + for (var code in parks) | ||
| 176 | + park_opts += '<option value="' + code + '">' + parks[code] + '</option>'; | ||
| 186 | 177 | ||
| 187 | - var qdz=$('[name=startStation]', f),zdz=$('[name=endStation]', f); | ||
| 188 | - switch ($(this).val()) { | ||
| 189 | - case '3'://出场 | ||
| 190 | - qdz.html(park_opts).val(information.carPark); | ||
| 191 | - zdz.html(opts); | ||
| 192 | - break; | ||
| 193 | - case '2'://进场 | ||
| 194 | - qdz.html(opts); | ||
| 195 | - zdz.html(park_opts).val(information.carPark); | ||
| 196 | - break; | ||
| 197 | - default: | ||
| 198 | - qdz.html(opts); | ||
| 199 | - zdz.html(opts).val(lastCode); | ||
| 200 | - } | 178 | + var qdz = $('[name=startStation]', f), zdz = $('[name=endStation]', f); |
| 179 | + switch ($(this).val()) { | ||
| 180 | + case '3'://出场 | ||
| 181 | + qdz.html(park_opts).val(information.carPark); | ||
| 182 | + zdz.html(opts); | ||
| 183 | + break; | ||
| 184 | + case '2'://进场 | ||
| 185 | + qdz.html(opts); | ||
| 186 | + zdz.html(park_opts).val(information.carPark); | ||
| 187 | + break; | ||
| 188 | + default: | ||
| 189 | + qdz.html(opts); | ||
| 190 | + zdz.html(opts).val(lastCode); | ||
| 191 | + } | ||
| 201 | }); | 192 | }); |
| 202 | 193 | ||
| 203 | //是否烂班 | 194 | //是否烂班 |
| 204 | - $('[name=destroy]', f).on('click', function(){ | 195 | + $('[name=destroy]', f).on('click', function () { |
| 205 | console.log(this, this.checked); | 196 | console.log(this, this.checked); |
| 206 | - if(this.checked){ | ||
| 207 | - $('.destroy_reason_wrap', modal).show(); | 197 | + if (this.checked) { |
| 198 | + $('.destroy_reason_wrap', modal).show(); | ||
| 208 | } | 199 | } |
| 209 | else { | 200 | else { |
| 210 | - $('.destroy_reason_wrap', modal).hide(); | 201 | + $('.destroy_reason_wrap', modal).hide(); |
| 211 | } | 202 | } |
| 212 | }); | 203 | }); |
| 213 | 204 | ||
| 214 | - $('[name=destroyReason]', f).on('change', function(){ | ||
| 215 | - var rem=$('[name=remarks]', f); | ||
| 216 | - rem.val(rem.val() + $(this).val() + ','); | ||
| 217 | - }); | 205 | + $('[name=destroyReason]', f).on('change', function () { |
| 206 | + var rem = $('[name=remarks]', f); | ||
| 207 | + rem.val(rem.val() + $(this).val() + ','); | ||
| 208 | + }); | ||
| 218 | }); | 209 | }); |
| 219 | })(); | 210 | })(); |
| 220 | </script> | 211 | </script> |
src/main/resources/static/real_control_v2/fragments/line_schedule/sch_table.html
| @@ -121,7 +121,7 @@ | @@ -121,7 +121,7 @@ | ||
| 121 | tl-zzzx | 121 | tl-zzzx |
| 122 | {{else if status == 0 && late}} | 122 | {{else if status == 0 && late}} |
| 123 | tl-wd | 123 | tl-wd |
| 124 | - {{/if}}"> | 124 | + {{/if}} fcsjActualCell"> |
| 125 | {{fcsjActual}}<span class="fcsj-diff">{{fcsj_diff}}</span> | 125 | {{fcsjActual}}<span class="fcsj-diff">{{fcsj_diff}}</span> |
| 126 | </dd> | 126 | </dd> |
| 127 | </script> | 127 | </script> |
| @@ -141,8 +141,8 @@ | @@ -141,8 +141,8 @@ | ||
| 141 | <li><span>实发:</span>{{fcsjActual}}</li> | 141 | <li><span>实发:</span>{{fcsjActual}}</li> |
| 142 | <li><span>计达:</span>{{zdsj}}</li> | 142 | <li><span>计达:</span>{{zdsj}}</li> |
| 143 | <li><span>实达:</span>{{zdsjActual}}</li> | 143 | <li><span>实达:</span>{{zdsjActual}}</li> |
| 144 | - <li><span>驾驶员:</span>{{jName}}</li> | ||
| 145 | - <li><span>售票员:</span>{{sName}}</li> | 144 | + <li><span>驾驶员:</span>{{jGh}}/{{jName}}</li> |
| 145 | + <li><span>售票员:</span>{{sGh}}/{{sName}}</li> | ||
| 146 | <li><span>终点站:</span>{{zdzName}}</li> | 146 | <li><span>终点站:</span>{{zdzName}}</li> |
| 147 | </ul> | 147 | </ul> |
| 148 | </script> | 148 | </script> |
src/main/resources/static/real_control_v2/fragments/north/tabs.html
| 1 | <div> | 1 | <div> |
| 2 | <script id="north-tabs-temp" type="text/html"> | 2 | <script id="north-tabs-temp" type="text/html"> |
| 3 | - <ul class="uk-tab" data-uk-tab="{connect:'#main-tab-content'}"> | 3 | + <ul class="uk-tab" data-uk-switcher="{connect:'#main-tab-content', swiping: false}" > |
| 4 | <li class="uk-active" ><a>主页</a></li> | 4 | <li class="uk-active" ><a>主页</a></li> |
| 5 | <li id="north_tabs_map_btn"><a>地图</a></li> | 5 | <li id="north_tabs_map_btn"><a>地图</a></li> |
| 6 | {{each list as line i}} | 6 | {{each list as line i}} |
| @@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
| 10 | </script> | 10 | </script> |
| 11 | 11 | ||
| 12 | <script id="north-tab-content-temp" type="text/html"> | 12 | <script id="north-tab-content-temp" type="text/html"> |
| 13 | - <ul id="main-tab-content" class="uk-switcher uk-margin "> | 13 | + <ul id="main-tab-content" class="uk-switcher uk-margin " > |
| 14 | <li class="uk-active home-panel">主页</li> | 14 | <li class="uk-active home-panel">主页</li> |
| 15 | <li class="map-panel">地图未渲染</li> | 15 | <li class="map-panel">地图未渲染</li> |
| 16 | {{each list as line i}} | 16 | {{each list as line i}} |
src/main/resources/static/real_control_v2/geolib/geolib.elevation.js
0 → 100644
| 1 | +/*! geolib.elevation 2.0.21 by Manuel Bieh | ||
| 2 | +* | ||
| 3 | +* Elevation Addon for Geolib.js | ||
| 4 | +* | ||
| 5 | +* @author Manuel Bieh | ||
| 6 | +* @url http://www.manuelbieh.com/ | ||
| 7 | +* @version 2.0.21 | ||
| 8 | +* @license MIT | ||
| 9 | +*/ | ||
| 10 | +;(function(global, geolib, undefined) { | ||
| 11 | + | ||
| 12 | + var elevation = { | ||
| 13 | + | ||
| 14 | + /*global google:true geolib:true require:true module:true elevationResult:true */ | ||
| 15 | + | ||
| 16 | + /** | ||
| 17 | + * @param Array Collection of coords [{latitude: 51.510, longitude: 7.1321}, {latitude: 49.1238, longitude: "8° 30' W"}, ...] | ||
| 18 | + * @return Array [{lat:#lat, lng:#lng, elev:#elev},....]} | ||
| 19 | + */ | ||
| 20 | + getElevation: function() { | ||
| 21 | + if (typeof global.navigator !== 'undefined') { | ||
| 22 | + this.getElevationClient.apply(this, arguments); | ||
| 23 | + } else { | ||
| 24 | + this.getElevationServer.apply(this, arguments); | ||
| 25 | + } | ||
| 26 | + }, | ||
| 27 | + | ||
| 28 | + | ||
| 29 | + /* Optional elevation addon requires Googlemaps API JS */ | ||
| 30 | + getElevationClient: function(coords, cb) { | ||
| 31 | + | ||
| 32 | + if (!global.google) { | ||
| 33 | + throw new Error("Google maps api not loaded"); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + if (coords.length === 0) { | ||
| 37 | + return cb(null, null); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + if (coords.length === 1) { | ||
| 41 | + return cb(new Error("getElevation requires at least 2 points.")); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + var path = []; | ||
| 45 | + | ||
| 46 | + for(var i = 0; i < coords.length; i++) { | ||
| 47 | + path.push(new google.maps.LatLng( | ||
| 48 | + this.latitude(coords[i]), | ||
| 49 | + this.longitude(coords[i]) | ||
| 50 | + )); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + var positionalRequest = { | ||
| 54 | + 'path': path, | ||
| 55 | + 'samples': path.length | ||
| 56 | + }; | ||
| 57 | + | ||
| 58 | + var elevationService = new google.maps.ElevationService(); | ||
| 59 | + var geolib = this; | ||
| 60 | + | ||
| 61 | + elevationService.getElevationAlongPath(positionalRequest, function (results, status) { | ||
| 62 | + geolib.elevationHandler(results, status, coords, cb); | ||
| 63 | + }); | ||
| 64 | + | ||
| 65 | + }, | ||
| 66 | + | ||
| 67 | + | ||
| 68 | + getElevationServer: function(coords, cb) { | ||
| 69 | + | ||
| 70 | + if (coords.length === 0) { | ||
| 71 | + return cb(null, null); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + if (coords.length === 1) { | ||
| 75 | + return cb(new Error("getElevation requires at least 2 points.")); | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + var gm = require('googlemaps'); | ||
| 79 | + var path = []; | ||
| 80 | + | ||
| 81 | + for(var i = 0; i < coords.length; i++) { | ||
| 82 | + path.push( | ||
| 83 | + this.latitude(coords[i]) + ',' + this.longitude(coords[i]) | ||
| 84 | + ); | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + var geolib = this; | ||
| 88 | + | ||
| 89 | + gm.elevationFromPath(path.join('|'), path.length, function(err, results) { | ||
| 90 | + geolib.elevationHandler(results.results, results.status, coords, cb); | ||
| 91 | + }); | ||
| 92 | + | ||
| 93 | + }, | ||
| 94 | + | ||
| 95 | + | ||
| 96 | + elevationHandler: function(results, status, coords, cb) { | ||
| 97 | + | ||
| 98 | + var latsLngsElevs = []; | ||
| 99 | + | ||
| 100 | + if (status == "OK" ) { | ||
| 101 | + | ||
| 102 | + for (var i = 0; i < results.length; i++) { | ||
| 103 | + latsLngsElevs.push({ | ||
| 104 | + "lat": this.latitude(coords[i]), | ||
| 105 | + "lng": this.longitude(coords[i]), | ||
| 106 | + "elev":results[i].elevation | ||
| 107 | + }); | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + cb(null, latsLngsElevs); | ||
| 111 | + | ||
| 112 | + } else { | ||
| 113 | + | ||
| 114 | + cb(new Error("Could not get elevation using Google's API"), elevationResult.status); | ||
| 115 | + | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + }, | ||
| 119 | + | ||
| 120 | + | ||
| 121 | + /** | ||
| 122 | + * @param Array [{lat:#lat, lng:#lng, elev:#elev},....]} | ||
| 123 | + * @return Number % grade | ||
| 124 | + */ | ||
| 125 | + getGrade: function(coords) { | ||
| 126 | + | ||
| 127 | + var rise = Math.abs( | ||
| 128 | + this.elevation(coords[coords.length-1]) - this.elevation(coords[0]) | ||
| 129 | + ); | ||
| 130 | + | ||
| 131 | + var run = this.getPathLength(coords); | ||
| 132 | + | ||
| 133 | + return Math.floor((rise/run)*100); | ||
| 134 | + | ||
| 135 | + }, | ||
| 136 | + | ||
| 137 | + | ||
| 138 | + /** | ||
| 139 | + * @param Array [{lat:#lat, lng:#lng, elev:#elev},....]} | ||
| 140 | + * @return Object {gain:#gain, loss:#loss} | ||
| 141 | + */ | ||
| 142 | + getTotalElevationGainAndLoss: function(coords) { | ||
| 143 | + | ||
| 144 | + var gain = 0; | ||
| 145 | + var loss = 0; | ||
| 146 | + | ||
| 147 | + for(var i = 0; i < coords.length - 1; i++) { | ||
| 148 | + | ||
| 149 | + var deltaElev = this.elevation(coords[i]) - this.elevation(coords[i + 1]); | ||
| 150 | + | ||
| 151 | + if (deltaElev > 0) { | ||
| 152 | + loss += deltaElev; | ||
| 153 | + } else { | ||
| 154 | + gain += Math.abs(deltaElev); | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + return { | ||
| 160 | + "gain": gain, | ||
| 161 | + "loss": loss | ||
| 162 | + }; | ||
| 163 | + | ||
| 164 | + } | ||
| 165 | + | ||
| 166 | + }; | ||
| 167 | + | ||
| 168 | + // Node module | ||
| 169 | + if (typeof module !== 'undefined' && | ||
| 170 | + typeof module.exports !== 'undefined') { | ||
| 171 | + | ||
| 172 | + geolib = require('geolib'); | ||
| 173 | + geolib.extend(elevation); | ||
| 174 | + | ||
| 175 | + // AMD module | ||
| 176 | + } else if (typeof define === "function" && define.amd) { | ||
| 177 | + | ||
| 178 | + define(["geolib"], function (geolib) { | ||
| 179 | + geolib.extend(elevation); | ||
| 180 | + return geolib; | ||
| 181 | + }); | ||
| 182 | + | ||
| 183 | + // we're in a browser | ||
| 184 | + } else { | ||
| 185 | + | ||
| 186 | + geolib.extend(elevation); | ||
| 187 | + | ||
| 188 | + } | ||
| 189 | + | ||
| 190 | +}(this, this.geolib)); | ||
| 0 | \ No newline at end of file | 191 | \ No newline at end of file |
src/main/resources/static/real_control_v2/geolib/geolib.elevation.min.js
0 → 100644
| 1 | +/*! geolib.elevation 2.0.21 by Manuel Bieh | ||
| 2 | +* | ||
| 3 | +* Elevation Addon for Geolib.js | ||
| 4 | +* | ||
| 5 | +* @author Manuel Bieh | ||
| 6 | +* @url http://www.manuelbieh.com/ | ||
| 7 | +* @version 2.0.21 | ||
| 8 | +* @license MIT | ||
| 9 | +*/ | ||
| 10 | +!function(a,b,c){var d={getElevation:function(){"undefined"!=typeof a.navigator?this.getElevationClient.apply(this,arguments):this.getElevationServer.apply(this,arguments)},getElevationClient:function(b,c){if(!a.google)throw new Error("Google maps api not loaded");if(0===b.length)return c(null,null);if(1===b.length)return c(new Error("getElevation requires at least 2 points."));for(var d=[],e=0;e<b.length;e++)d.push(new google.maps.LatLng(this.latitude(b[e]),this.longitude(b[e])));var f={path:d,samples:d.length},g=new google.maps.ElevationService,h=this;g.getElevationAlongPath(f,function(a,d){h.elevationHandler(a,d,b,c)})},getElevationServer:function(a,b){if(0===a.length)return b(null,null);if(1===a.length)return b(new Error("getElevation requires at least 2 points."));for(var c=require("googlemaps"),d=[],e=0;e<a.length;e++)d.push(this.latitude(a[e])+","+this.longitude(a[e]));var f=this;c.elevationFromPath(d.join("|"),d.length,function(c,d){f.elevationHandler(d.results,d.status,a,b)})},elevationHandler:function(a,b,c,d){var e=[];if("OK"==b){for(var f=0;f<a.length;f++)e.push({lat:this.latitude(c[f]),lng:this.longitude(c[f]),elev:a[f].elevation});d(null,e)}else d(new Error("Could not get elevation using Google's API"),elevationResult.status)},getGrade:function(a){var b=Math.abs(this.elevation(a[a.length-1])-this.elevation(a[0])),c=this.getPathLength(a);return Math.floor(b/c*100)},getTotalElevationGainAndLoss:function(a){for(var b=0,c=0,d=0;d<a.length-1;d++){var e=this.elevation(a[d])-this.elevation(a[d+1]);e>0?c+=e:b+=Math.abs(e)}return{gain:b,loss:c}}};"undefined"!=typeof module&&"undefined"!=typeof module.exports?(b=require("geolib"),b.extend(d)):"function"==typeof define&&define.amd?define(["geolib"],function(a){return a.extend(d),a}):b.extend(d)}(this,this.geolib); | ||
| 0 | \ No newline at end of file | 11 | \ No newline at end of file |
src/main/resources/static/real_control_v2/geolib/geolib.isPointInsideRobust.js
0 → 100644
| 1 | +/*! geolib.isPointInsideRobust 2.0.21 | ||
| 2 | +* !!EXPERIMENTAL!! | ||
| 3 | +* | ||
| 4 | +* Robust version of isPointInside for Geolib.js | ||
| 5 | +* | ||
| 6 | +* Based on https://github.com/mikolalysenko/robust-point-in-polygon | ||
| 7 | +* by Mikola Lysenko, licensed under MIT | ||
| 8 | +* | ||
| 9 | +* @author Manuel Bieh | ||
| 10 | +* @url http://www.manuelbieh.com/ | ||
| 11 | +* @version 2.0.21 | ||
| 12 | +* @license MIT | ||
| 13 | +* | ||
| 14 | +*/ | ||
| 15 | +;(function(global, geolib, undefined) { | ||
| 16 | + | ||
| 17 | + var addOn = function(geolib) { | ||
| 18 | + | ||
| 19 | + var SPLITTER = +(Math.pow(2, 27) + 1.0); | ||
| 20 | + | ||
| 21 | + var NUM_EXPAND = 5; | ||
| 22 | + var EPSILON = 1.1102230246251565e-16; | ||
| 23 | + var ERRBOUND3 = (3.0 + 16.0 * EPSILON) * EPSILON; | ||
| 24 | + var ERRBOUND4 = (7.0 + 56.0 * EPSILON) * EPSILON; | ||
| 25 | + | ||
| 26 | + var twoProduct = function(a, b, result) { | ||
| 27 | + var x = a * b; | ||
| 28 | + var c = SPLITTER * a; | ||
| 29 | + var abig = c - a; | ||
| 30 | + var ahi = c - abig; | ||
| 31 | + var alo = a - ahi; | ||
| 32 | + var d = SPLITTER * b; | ||
| 33 | + var bbig = d - b; | ||
| 34 | + var bhi = d - bbig; | ||
| 35 | + var blo = b - bhi; | ||
| 36 | + var err1 = x - (ahi * bhi); | ||
| 37 | + var err2 = err1 - (alo * bhi); | ||
| 38 | + var err3 = err2 - (ahi * blo); | ||
| 39 | + var y = alo * blo - err3; | ||
| 40 | + if(result) { | ||
| 41 | + result[0] = y; | ||
| 42 | + result[1] = x; | ||
| 43 | + return result; | ||
| 44 | + } | ||
| 45 | + return [ y, x ]; | ||
| 46 | + }; | ||
| 47 | + | ||
| 48 | + var fastTwoSum = function(a, b, result) { | ||
| 49 | + var x = a + b; | ||
| 50 | + var bv = x - a; | ||
| 51 | + var av = x - bv; | ||
| 52 | + var br = b - bv; | ||
| 53 | + var ar = a - av; | ||
| 54 | + if(result) { | ||
| 55 | + result[0] = ar + br; | ||
| 56 | + result[1] = x; | ||
| 57 | + return result; | ||
| 58 | + } | ||
| 59 | + return [ar+br, x]; | ||
| 60 | + }; | ||
| 61 | + | ||
| 62 | + var twoSum = fastTwoSum; | ||
| 63 | + | ||
| 64 | + var linearExpansionSum = function(e, f) { | ||
| 65 | + var ne = e.length|0; | ||
| 66 | + var nf = f.length|0; | ||
| 67 | + if(ne === 1 && nf === 1) { | ||
| 68 | + return scalarScalar(e[0], f[0]); | ||
| 69 | + } | ||
| 70 | + var n = ne + nf; | ||
| 71 | + var g = new Array(n); | ||
| 72 | + var count = 0; | ||
| 73 | + var eptr = 0; | ||
| 74 | + var fptr = 0; | ||
| 75 | + var abs = Math.abs; | ||
| 76 | + var ei = e[eptr]; | ||
| 77 | + var ea = abs(ei); | ||
| 78 | + var fi = f[fptr]; | ||
| 79 | + var fa = abs(fi); | ||
| 80 | + var a, b; | ||
| 81 | + if(ea < fa) { | ||
| 82 | + b = ei; | ||
| 83 | + eptr += 1; | ||
| 84 | + if(eptr < ne) { | ||
| 85 | + ei = e[eptr]; | ||
| 86 | + ea = abs(ei); | ||
| 87 | + } | ||
| 88 | + } else { | ||
| 89 | + b = fi; | ||
| 90 | + fptr += 1; | ||
| 91 | + if(fptr < nf) { | ||
| 92 | + fi = f[fptr]; | ||
| 93 | + fa = abs(fi); | ||
| 94 | + } | ||
| 95 | + } | ||
| 96 | + if((eptr < ne && ea < fa) || (fptr >= nf)) { | ||
| 97 | + a = ei; | ||
| 98 | + eptr += 1; | ||
| 99 | + if(eptr < ne) { | ||
| 100 | + ei = e[eptr]; | ||
| 101 | + ea = abs(ei); | ||
| 102 | + } | ||
| 103 | + } else { | ||
| 104 | + a = fi; | ||
| 105 | + fptr += 1; | ||
| 106 | + if(fptr < nf) { | ||
| 107 | + fi = f[fptr]; | ||
| 108 | + fa = abs(fi); | ||
| 109 | + } | ||
| 110 | + } | ||
| 111 | + var x = a + b; | ||
| 112 | + var bv = x - a; | ||
| 113 | + var y = b - bv; | ||
| 114 | + var q0 = y; | ||
| 115 | + var q1 = x; | ||
| 116 | + var _x, _bv, _av, _br, _ar; | ||
| 117 | + while(eptr < ne && fptr < nf) { | ||
| 118 | + if(ea < fa) { | ||
| 119 | + a = ei; | ||
| 120 | + eptr += 1; | ||
| 121 | + if(eptr < ne) { | ||
| 122 | + ei = e[eptr]; | ||
| 123 | + ea = abs(ei); | ||
| 124 | + } | ||
| 125 | + } else { | ||
| 126 | + a = fi; | ||
| 127 | + fptr += 1; | ||
| 128 | + if(fptr < nf) { | ||
| 129 | + fi = f[fptr]; | ||
| 130 | + fa = abs(fi); | ||
| 131 | + } | ||
| 132 | + } | ||
| 133 | + b = q0; | ||
| 134 | + x = a + b; | ||
| 135 | + bv = x - a; | ||
| 136 | + y = b - bv; | ||
| 137 | + if(y) { | ||
| 138 | + g[count++] = y; | ||
| 139 | + } | ||
| 140 | + _x = q1 + x; | ||
| 141 | + _bv = _x - q1; | ||
| 142 | + _av = _x - _bv; | ||
| 143 | + _br = x - _bv; | ||
| 144 | + _ar = q1 - _av; | ||
| 145 | + q0 = _ar + _br; | ||
| 146 | + q1 = _x; | ||
| 147 | + } | ||
| 148 | + while(eptr < ne) { | ||
| 149 | + a = ei; | ||
| 150 | + b = q0; | ||
| 151 | + x = a + b; | ||
| 152 | + bv = x - a; | ||
| 153 | + y = b - bv; | ||
| 154 | + if(y) { | ||
| 155 | + g[count++] = y; | ||
| 156 | + } | ||
| 157 | + _x = q1 + x; | ||
| 158 | + _bv = _x - q1; | ||
| 159 | + _av = _x - _bv; | ||
| 160 | + _br = x - _bv; | ||
| 161 | + _ar = q1 - _av; | ||
| 162 | + q0 = _ar + _br; | ||
| 163 | + q1 = _x; | ||
| 164 | + eptr += 1; | ||
| 165 | + if(eptr < ne) { | ||
| 166 | + ei = e[eptr]; | ||
| 167 | + } | ||
| 168 | + } | ||
| 169 | + while(fptr < nf) { | ||
| 170 | + a = fi; | ||
| 171 | + b = q0; | ||
| 172 | + x = a + b; | ||
| 173 | + bv = x - a; | ||
| 174 | + y = b - bv; | ||
| 175 | + if(y) { | ||
| 176 | + g[count++] = y; | ||
| 177 | + } | ||
| 178 | + _x = q1 + x; | ||
| 179 | + _bv = _x - q1; | ||
| 180 | + _av = _x - _bv; | ||
| 181 | + _br = x - _bv; | ||
| 182 | + _ar = q1 - _av; | ||
| 183 | + q0 = _ar + _br; | ||
| 184 | + q1 = _x; | ||
| 185 | + fptr += 1; | ||
| 186 | + if(fptr < nf) { | ||
| 187 | + fi = f[fptr]; | ||
| 188 | + } | ||
| 189 | + } | ||
| 190 | + if(q0) { | ||
| 191 | + g[count++] = q0; | ||
| 192 | + } | ||
| 193 | + if(q1) { | ||
| 194 | + g[count++] = q1; | ||
| 195 | + } | ||
| 196 | + if(!count) { | ||
| 197 | + g[count++] = 0.0; | ||
| 198 | + } | ||
| 199 | + g.length = count; | ||
| 200 | + return g; | ||
| 201 | + }; | ||
| 202 | + | ||
| 203 | + var robustSum = linearExpansionSum; | ||
| 204 | + | ||
| 205 | + var scaleLinearExpansion = function(e, scale) { | ||
| 206 | + var n = e.length; | ||
| 207 | + if(n === 1) { | ||
| 208 | + var ts = twoProduct(e[0], scale); | ||
| 209 | + if(ts[0]) { | ||
| 210 | + return ts; | ||
| 211 | + } | ||
| 212 | + return [ ts[1] ]; | ||
| 213 | + } | ||
| 214 | + var g = new Array(2 * n); | ||
| 215 | + var q = [0.1, 0.1]; | ||
| 216 | + var t = [0.1, 0.1]; | ||
| 217 | + var count = 0; | ||
| 218 | + twoProduct(e[0], scale, q); | ||
| 219 | + if(q[0]) { | ||
| 220 | + g[count++] = q[0]; | ||
| 221 | + } | ||
| 222 | + for(var i=1; i<n; ++i) { | ||
| 223 | + twoProduct(e[i], scale, t); | ||
| 224 | + var pq = q[1]; | ||
| 225 | + twoSum(pq, t[0], q); | ||
| 226 | + if(q[0]) { | ||
| 227 | + g[count++] = q[0]; | ||
| 228 | + } | ||
| 229 | + var a = t[1]; | ||
| 230 | + var b = q[1]; | ||
| 231 | + var x = a + b; | ||
| 232 | + var bv = x - a; | ||
| 233 | + var y = b - bv; | ||
| 234 | + q[1] = x; | ||
| 235 | + if(y) { | ||
| 236 | + g[count++] = y; | ||
| 237 | + } | ||
| 238 | + } | ||
| 239 | + if(q[1]) { | ||
| 240 | + g[count++] = q[1]; | ||
| 241 | + } | ||
| 242 | + if(count === 0) { | ||
| 243 | + g[count++] = 0.0; | ||
| 244 | + } | ||
| 245 | + g.length = count; | ||
| 246 | + return g; | ||
| 247 | + }; | ||
| 248 | + | ||
| 249 | + var robustScale = scaleLinearExpansion; | ||
| 250 | + | ||
| 251 | + var scalarScalar = function(a, b) { | ||
| 252 | + var x = a + b; | ||
| 253 | + var bv = x - a; | ||
| 254 | + var av = x - bv; | ||
| 255 | + var br = b - bv; | ||
| 256 | + var ar = a - av; | ||
| 257 | + var y = ar + br; | ||
| 258 | + if(y) { | ||
| 259 | + return [y, x]; | ||
| 260 | + } | ||
| 261 | + return [x]; | ||
| 262 | + }; | ||
| 263 | + | ||
| 264 | + var robustSubtract = function(e, f) { | ||
| 265 | + var ne = e.length|0; | ||
| 266 | + var nf = f.length|0; | ||
| 267 | + if(ne === 1 && nf === 1) { | ||
| 268 | + return scalarScalar(e[0], -f[0]); | ||
| 269 | + } | ||
| 270 | + var n = ne + nf; | ||
| 271 | + var g = new Array(n); | ||
| 272 | + var count = 0; | ||
| 273 | + var eptr = 0; | ||
| 274 | + var fptr = 0; | ||
| 275 | + var abs = Math.abs; | ||
| 276 | + var ei = e[eptr]; | ||
| 277 | + var ea = abs(ei); | ||
| 278 | + var fi = -f[fptr]; | ||
| 279 | + var fa = abs(fi); | ||
| 280 | + var a, b; | ||
| 281 | + if(ea < fa) { | ||
| 282 | + b = ei; | ||
| 283 | + eptr += 1; | ||
| 284 | + if(eptr < ne) { | ||
| 285 | + ei = e[eptr]; | ||
| 286 | + ea = abs(ei); | ||
| 287 | + } | ||
| 288 | + } else { | ||
| 289 | + b = fi; | ||
| 290 | + fptr += 1; | ||
| 291 | + if(fptr < nf) { | ||
| 292 | + fi = -f[fptr]; | ||
| 293 | + fa = abs(fi); | ||
| 294 | + } | ||
| 295 | + } | ||
| 296 | + if((eptr < ne && ea < fa) || (fptr >= nf)) { | ||
| 297 | + a = ei; | ||
| 298 | + eptr += 1; | ||
| 299 | + if(eptr < ne) { | ||
| 300 | + ei = e[eptr]; | ||
| 301 | + ea = abs(ei); | ||
| 302 | + } | ||
| 303 | + } else { | ||
| 304 | + a = fi; | ||
| 305 | + fptr += 1; | ||
| 306 | + if(fptr < nf) { | ||
| 307 | + fi = -f[fptr]; | ||
| 308 | + fa = abs(fi); | ||
| 309 | + } | ||
| 310 | + } | ||
| 311 | + var x = a + b; | ||
| 312 | + var bv = x - a; | ||
| 313 | + var y = b - bv; | ||
| 314 | + var q0 = y; | ||
| 315 | + var q1 = x; | ||
| 316 | + var _x, _bv, _av, _br, _ar; | ||
| 317 | + while(eptr < ne && fptr < nf) { | ||
| 318 | + if(ea < fa) { | ||
| 319 | + a = ei; | ||
| 320 | + eptr += 1; | ||
| 321 | + if(eptr < ne) { | ||
| 322 | + ei = e[eptr]; | ||
| 323 | + ea = abs(ei); | ||
| 324 | + } | ||
| 325 | + } else { | ||
| 326 | + a = fi; | ||
| 327 | + fptr += 1; | ||
| 328 | + if(fptr < nf) { | ||
| 329 | + fi = -f[fptr]; | ||
| 330 | + fa = abs(fi); | ||
| 331 | + } | ||
| 332 | + } | ||
| 333 | + b = q0; | ||
| 334 | + x = a + b; | ||
| 335 | + bv = x - a; | ||
| 336 | + y = b - bv; | ||
| 337 | + if(y) { | ||
| 338 | + g[count++] = y; | ||
| 339 | + } | ||
| 340 | + _x = q1 + x; | ||
| 341 | + _bv = _x - q1; | ||
| 342 | + _av = _x - _bv; | ||
| 343 | + _br = x - _bv; | ||
| 344 | + _ar = q1 - _av; | ||
| 345 | + q0 = _ar + _br; | ||
| 346 | + q1 = _x; | ||
| 347 | + } | ||
| 348 | + while(eptr < ne) { | ||
| 349 | + a = ei; | ||
| 350 | + b = q0; | ||
| 351 | + x = a + b; | ||
| 352 | + bv = x - a; | ||
| 353 | + y = b - bv; | ||
| 354 | + if(y) { | ||
| 355 | + g[count++] = y; | ||
| 356 | + } | ||
| 357 | + _x = q1 + x; | ||
| 358 | + _bv = _x - q1; | ||
| 359 | + _av = _x - _bv; | ||
| 360 | + _br = x - _bv; | ||
| 361 | + _ar = q1 - _av; | ||
| 362 | + q0 = _ar + _br; | ||
| 363 | + q1 = _x; | ||
| 364 | + eptr += 1; | ||
| 365 | + if(eptr < ne) { | ||
| 366 | + ei = e[eptr]; | ||
| 367 | + } | ||
| 368 | + } | ||
| 369 | + while(fptr < nf) { | ||
| 370 | + a = fi; | ||
| 371 | + b = q0; | ||
| 372 | + x = a + b; | ||
| 373 | + bv = x - a; | ||
| 374 | + y = b - bv; | ||
| 375 | + if(y) { | ||
| 376 | + g[count++] = y; | ||
| 377 | + } | ||
| 378 | + _x = q1 + x; | ||
| 379 | + _bv = _x - q1; | ||
| 380 | + _av = _x - _bv; | ||
| 381 | + _br = x - _bv; | ||
| 382 | + _ar = q1 - _av; | ||
| 383 | + q0 = _ar + _br; | ||
| 384 | + q1 = _x; | ||
| 385 | + fptr += 1; | ||
| 386 | + if(fptr < nf) { | ||
| 387 | + fi = -f[fptr]; | ||
| 388 | + } | ||
| 389 | + } | ||
| 390 | + if(q0) { | ||
| 391 | + g[count++] = q0; | ||
| 392 | + } | ||
| 393 | + if(q1) { | ||
| 394 | + g[count++] = q1; | ||
| 395 | + } | ||
| 396 | + if(!count) { | ||
| 397 | + g[count++] = 0.0; | ||
| 398 | + } | ||
| 399 | + g.length = count; | ||
| 400 | + return g; | ||
| 401 | + }; | ||
| 402 | + | ||
| 403 | + var cofactor = function(m, c) { | ||
| 404 | + var result = new Array(m.length-1); | ||
| 405 | + for(var i=1; i<m.length; ++i) { | ||
| 406 | + var r = result[i-1] = new Array(m.length-1); | ||
| 407 | + for(var j=0,k=0; j<m.length; ++j) { | ||
| 408 | + if(j === c) { | ||
| 409 | + continue; | ||
| 410 | + } | ||
| 411 | + r[k++] = m[i][j]; | ||
| 412 | + } | ||
| 413 | + } | ||
| 414 | + return result; | ||
| 415 | + }; | ||
| 416 | + | ||
| 417 | + var matrix = function(n) { | ||
| 418 | + var result = new Array(n); | ||
| 419 | + for(var i=0; i<n; ++i) { | ||
| 420 | + result[i] = new Array(n); | ||
| 421 | + for(var j=0; j<n; ++j) { | ||
| 422 | + result[i][j] = ["m", j, "[", (n-i-1), "]"].join(""); | ||
| 423 | + } | ||
| 424 | + } | ||
| 425 | + return result; | ||
| 426 | + }; | ||
| 427 | + | ||
| 428 | + var sign = function(n) { | ||
| 429 | + if(n & 1) { | ||
| 430 | + return "-"; | ||
| 431 | + } | ||
| 432 | + return ""; | ||
| 433 | + }; | ||
| 434 | + | ||
| 435 | + var generateSum = function(expr) { | ||
| 436 | + if(expr.length === 1) { | ||
| 437 | + return expr[0]; | ||
| 438 | + } else if(expr.length === 2) { | ||
| 439 | + return ["sum(", expr[0], ",", expr[1], ")"].join(""); | ||
| 440 | + } else { | ||
| 441 | + var m = expr.length>>1; | ||
| 442 | + return ["sum(", generateSum(expr.slice(0, m)), ",", generateSum(expr.slice(m)), ")"].join(""); | ||
| 443 | + } | ||
| 444 | + }; | ||
| 445 | + | ||
| 446 | + var determinant = function(m) { | ||
| 447 | + if(m.length === 2) { | ||
| 448 | + return [["sum(prod(", m[0][0], ",", m[1][1], "),prod(-", m[0][1], ",", m[1][0], "))"].join("")]; | ||
| 449 | + } else { | ||
| 450 | + var expr = []; | ||
| 451 | + for(var i=0; i<m.length; ++i) { | ||
| 452 | + expr.push(["scale(", generateSum(determinant(cofactor(m, i))), ",", sign(i), m[0][i], ")"].join("")); | ||
| 453 | + } | ||
| 454 | + return expr; | ||
| 455 | + } | ||
| 456 | + }; | ||
| 457 | + | ||
| 458 | + var orientation = function(n) { | ||
| 459 | + var pos = []; | ||
| 460 | + var neg = []; | ||
| 461 | + var m = matrix(n); | ||
| 462 | + var args = []; | ||
| 463 | + for(var i=0; i<n; ++i) { | ||
| 464 | + if((i&1)===0) { | ||
| 465 | + pos.push.apply(pos, determinant(cofactor(m, i))); | ||
| 466 | + } else { | ||
| 467 | + neg.push.apply(neg, determinant(cofactor(m, i))); | ||
| 468 | + } | ||
| 469 | + args.push("m" + i); | ||
| 470 | + } | ||
| 471 | + var posExpr = generateSum(pos); | ||
| 472 | + var negExpr = generateSum(neg); | ||
| 473 | + var funcName = "orientation" + n + "Exact"; | ||
| 474 | + var code = [ | ||
| 475 | + "function ", | ||
| 476 | + funcName, | ||
| 477 | + "(", args.join(), "){var p=", | ||
| 478 | + posExpr, | ||
| 479 | + ",n=", | ||
| 480 | + negExpr, | ||
| 481 | + ",d=sub(p,n);return d[d.length-1];};return ", | ||
| 482 | + funcName | ||
| 483 | + ].join(""); | ||
| 484 | + var proc = new Function("sum", "prod", "scale", "sub", code); | ||
| 485 | + return proc(robustSum, twoProduct, robustScale, robustSubtract); | ||
| 486 | + }; | ||
| 487 | + | ||
| 488 | + var orient; | ||
| 489 | + var orientation3Exact = orientation(3); | ||
| 490 | + var orientation4Exact = orientation(4); | ||
| 491 | + | ||
| 492 | + var CACHED = [ | ||
| 493 | + function orientation0() { return 0; }, | ||
| 494 | + function orientation1() { return 0; }, | ||
| 495 | + function orientation2(a, b) { | ||
| 496 | + return b[0] - a[0]; | ||
| 497 | + }, | ||
| 498 | + function orientation3(a, b, c) { | ||
| 499 | + var l = (a[1] - c[1]) * (b[0] - c[0]); | ||
| 500 | + var r = (a[0] - c[0]) * (b[1] - c[1]); | ||
| 501 | + var det = l - r; | ||
| 502 | + var s; | ||
| 503 | + if(l > 0) { | ||
| 504 | + if(r <= 0) { | ||
| 505 | + return det; | ||
| 506 | + } else { | ||
| 507 | + s = l + r; | ||
| 508 | + } | ||
| 509 | + } else if(l < 0) { | ||
| 510 | + if(r >= 0) { | ||
| 511 | + return det; | ||
| 512 | + } else { | ||
| 513 | + s = -(l + r); | ||
| 514 | + } | ||
| 515 | + } else { | ||
| 516 | + return det; | ||
| 517 | + } | ||
| 518 | + var tol = ERRBOUND3 * s; | ||
| 519 | + if(det >= tol || det <= -tol) { | ||
| 520 | + return det; | ||
| 521 | + } | ||
| 522 | + return orientation3Exact(a, b, c); | ||
| 523 | + }, | ||
| 524 | + function orientation4(a,b,c,d) { | ||
| 525 | + var adx = a[0] - d[0]; | ||
| 526 | + var bdx = b[0] - d[0]; | ||
| 527 | + var cdx = c[0] - d[0]; | ||
| 528 | + var ady = a[1] - d[1]; | ||
| 529 | + var bdy = b[1] - d[1]; | ||
| 530 | + var cdy = c[1] - d[1]; | ||
| 531 | + var adz = a[2] - d[2]; | ||
| 532 | + var bdz = b[2] - d[2]; | ||
| 533 | + var cdz = c[2] - d[2]; | ||
| 534 | + var bdxcdy = bdx * cdy; | ||
| 535 | + var cdxbdy = cdx * bdy; | ||
| 536 | + var cdxady = cdx * ady; | ||
| 537 | + var adxcdy = adx * cdy; | ||
| 538 | + var adxbdy = adx * bdy; | ||
| 539 | + var bdxady = bdx * ady; | ||
| 540 | + var det = adz * (bdxcdy - cdxbdy) + | ||
| 541 | + bdz * (cdxady - adxcdy) + | ||
| 542 | + cdz * (adxbdy - bdxady); | ||
| 543 | + var permanent = (Math.abs(bdxcdy) + Math.abs(cdxbdy)) * Math.abs(adz) + | ||
| 544 | + (Math.abs(cdxady) + Math.abs(adxcdy)) * Math.abs(bdz) + | ||
| 545 | + (Math.abs(adxbdy) + Math.abs(bdxady)) * Math.abs(cdz); | ||
| 546 | + var tol = ERRBOUND4 * permanent; | ||
| 547 | + if ((det > tol) || (-det > tol)) { | ||
| 548 | + return det; | ||
| 549 | + } | ||
| 550 | + return orientation4Exact(a,b,c,d); | ||
| 551 | + } | ||
| 552 | + ]; | ||
| 553 | + | ||
| 554 | + var slowOrient = function(args) { | ||
| 555 | + var proc = CACHED[args.length]; | ||
| 556 | + if(!proc) { | ||
| 557 | + proc = CACHED[args.length] = orientation(args.length); | ||
| 558 | + } | ||
| 559 | + return proc.apply(undefined, args); | ||
| 560 | + }; | ||
| 561 | + | ||
| 562 | + var generateOrientationProc = function() { | ||
| 563 | + while(CACHED.length <= NUM_EXPAND) { | ||
| 564 | + CACHED.push(orientation(CACHED.length)); | ||
| 565 | + } | ||
| 566 | + var args = []; | ||
| 567 | + var procArgs = ["slow"]; | ||
| 568 | + for(var i=0; i<=NUM_EXPAND; ++i) { | ||
| 569 | + args.push("a" + i); | ||
| 570 | + procArgs.push("o" + i); | ||
| 571 | + } | ||
| 572 | + var code = [ | ||
| 573 | + "function getOrientation(", | ||
| 574 | + args.join(), | ||
| 575 | + "){switch(arguments.length){case 0:case 1:return 0;" | ||
| 576 | + ]; | ||
| 577 | + for(i=2; i<=NUM_EXPAND; ++i) { | ||
| 578 | + code.push("case ", i, ":return o", i, "(", args.slice(0, i).join(), ");"); | ||
| 579 | + } | ||
| 580 | + code.push("}var s=new Array(arguments.length);for(var i=0;i<arguments.length;++i){s[i]=arguments[i]};return slow(s);}return getOrientation"); | ||
| 581 | + procArgs.push(code.join("")); | ||
| 582 | + | ||
| 583 | + var proc = Function.apply(undefined, procArgs); | ||
| 584 | + orient = proc.apply(undefined, [slowOrient].concat(CACHED)); | ||
| 585 | + for(i=0; i<=NUM_EXPAND; ++i) { | ||
| 586 | + orient[i] = CACHED[i]; | ||
| 587 | + } | ||
| 588 | + }; | ||
| 589 | + | ||
| 590 | + generateOrientationProc(); | ||
| 591 | + | ||
| 592 | + var robustPointInPolygon = function(vs, point) { | ||
| 593 | + // transform from geolib format to array syntax | ||
| 594 | + var x = geolib.longitude(point); | ||
| 595 | + var y = geolib.latitude(point); | ||
| 596 | + var coords = vs.map(function(coords) { | ||
| 597 | + return [geolib.longitude(coords), geolib.latitude(coords)]; | ||
| 598 | + }); | ||
| 599 | + | ||
| 600 | + vs = coords; | ||
| 601 | + point = [x,y]; | ||
| 602 | + | ||
| 603 | + var n = vs.length; | ||
| 604 | + var inside = 1; | ||
| 605 | + var lim = n; | ||
| 606 | + | ||
| 607 | + var s, c, yk, px, p; | ||
| 608 | + | ||
| 609 | + for(var i = 0, j = n-1; i<lim; j=i++) { | ||
| 610 | + var a = vs[i]; | ||
| 611 | + var b = vs[j]; | ||
| 612 | + var yi = a[1]; | ||
| 613 | + var yj = b[1]; | ||
| 614 | + if(yj < yi) { | ||
| 615 | + if(yj < y && y < yi) { | ||
| 616 | + s = orient(a, b, point); | ||
| 617 | + if(s === 0) { | ||
| 618 | + return 0; | ||
| 619 | + } else { | ||
| 620 | + inside ^= (0 < s)|0; | ||
| 621 | + } | ||
| 622 | + } else if(y === yi) { | ||
| 623 | + c = vs[(i+1)%n]; | ||
| 624 | + yk = c[1]; | ||
| 625 | + if(yi < yk) { | ||
| 626 | + s = orient(a, b, point); | ||
| 627 | + if(s === 0) { | ||
| 628 | + return 0; | ||
| 629 | + } else { | ||
| 630 | + inside ^= (0 < s)|0; | ||
| 631 | + } | ||
| 632 | + } | ||
| 633 | + } | ||
| 634 | + } else if(yi < yj) { | ||
| 635 | + if(yi < y && y < yj) { | ||
| 636 | + s = orient(a, b, point); | ||
| 637 | + if(s === 0) { | ||
| 638 | + return 0; | ||
| 639 | + } else { | ||
| 640 | + inside ^= (s < 0)|0; | ||
| 641 | + } | ||
| 642 | + } else if(y === yi) { | ||
| 643 | + c = vs[(i+1)%n]; | ||
| 644 | + yk = c[1]; | ||
| 645 | + if(yk < yi) { | ||
| 646 | + s = orient(a, b, point); | ||
| 647 | + if(s === 0) { | ||
| 648 | + return 0; | ||
| 649 | + } else { | ||
| 650 | + inside ^= (s < 0)|0; | ||
| 651 | + } | ||
| 652 | + } | ||
| 653 | + } | ||
| 654 | + } else if(y === yi) { | ||
| 655 | + var x0 = Math.min(a[0], b[0]); | ||
| 656 | + var x1 = Math.max(a[0], b[0]); | ||
| 657 | + if(i === 0) { | ||
| 658 | + while(j>0) { | ||
| 659 | + var k = (j+n-1)%n; | ||
| 660 | + p = vs[k]; | ||
| 661 | + if(p[1] !== y) { | ||
| 662 | + break; | ||
| 663 | + } | ||
| 664 | + px = p[0]; | ||
| 665 | + x0 = Math.min(x0, px); | ||
| 666 | + x1 = Math.max(x1, px); | ||
| 667 | + j = k; | ||
| 668 | + } | ||
| 669 | + if(j === 0) { | ||
| 670 | + if(x0 <= x && x <= x1) { | ||
| 671 | + return 0; | ||
| 672 | + } | ||
| 673 | + return 1; | ||
| 674 | + } | ||
| 675 | + lim = j+1; | ||
| 676 | + } | ||
| 677 | + var y0 = vs[(j+n-1)%n][1]; | ||
| 678 | + while(i+1<lim) { | ||
| 679 | + p = vs[i+1]; | ||
| 680 | + if(p[1] !== y) { | ||
| 681 | + break; | ||
| 682 | + } | ||
| 683 | + px = p[0]; | ||
| 684 | + x0 = Math.min(x0, px); | ||
| 685 | + x1 = Math.max(x1, px); | ||
| 686 | + i += 1; | ||
| 687 | + } | ||
| 688 | + if(x0 <= x && x <= x1) { | ||
| 689 | + return 0; | ||
| 690 | + } | ||
| 691 | + var y1 = vs[(i+1)%n][1]; | ||
| 692 | + if(x < x0 && (y0 < y !== y1 < y)) { | ||
| 693 | + inside ^= 1; | ||
| 694 | + } | ||
| 695 | + } | ||
| 696 | + } | ||
| 697 | + return 2 * inside - 1; | ||
| 698 | + }; | ||
| 699 | + | ||
| 700 | + return { | ||
| 701 | + | ||
| 702 | + /** | ||
| 703 | + * @param object coordinate to check e.g. {latitude: 51.5023, longitude: 7.3815} | ||
| 704 | + * @param array array with coords e.g. [{latitude: 51.5143, longitude: 7.4138}, {latitude: 123, longitude: 123}, ...] | ||
| 705 | + * @return integer -1 if point is inside, 0 if point is on boundaries, 1 if point is outside | ||
| 706 | + */ | ||
| 707 | + isPointInsideRobust: function(latlng, coords) { | ||
| 708 | + return robustPointInPolygon(coords, latlng); | ||
| 709 | + }, | ||
| 710 | + | ||
| 711 | + isInside: function() { | ||
| 712 | + return this.isPointInsideRobust.apply(this, arguments); | ||
| 713 | + } | ||
| 714 | + | ||
| 715 | + }; | ||
| 716 | + | ||
| 717 | + }; | ||
| 718 | + | ||
| 719 | + | ||
| 720 | + // Node module | ||
| 721 | + if (typeof module !== 'undefined' && | ||
| 722 | + typeof module.exports !== 'undefined') { | ||
| 723 | + | ||
| 724 | + module.exports = function(geolib) { | ||
| 725 | + geolib.extend(addOn(geolib), true); | ||
| 726 | + return geolib; | ||
| 727 | + }; | ||
| 728 | + | ||
| 729 | + // AMD module | ||
| 730 | + } else if (typeof define === "function" && define.amd) { | ||
| 731 | + | ||
| 732 | + define(["geolib"], function (geolib) { | ||
| 733 | + geolib.extend(addOn(geolib), true); | ||
| 734 | + return geolib; | ||
| 735 | + }); | ||
| 736 | + | ||
| 737 | + // we're in a browser | ||
| 738 | + } else { | ||
| 739 | + | ||
| 740 | + geolib.extend(addOn(geolib), true); | ||
| 741 | + | ||
| 742 | + } | ||
| 743 | + | ||
| 744 | +}(this, this.geolib)); |
src/main/resources/static/real_control_v2/geolib/geolib.isPointInsideRobust.min.js
0 → 100644
| 1 | +/*! geolib.isPointInsideRobust 2.0.21 | ||
| 2 | +* !!EXPERIMENTAL!! | ||
| 3 | +* | ||
| 4 | +* Robust version of isPointInside for Geolib.js | ||
| 5 | +* | ||
| 6 | +* Based on https://github.com/mikolalysenko/robust-point-in-polygon | ||
| 7 | +* by Mikola Lysenko, licensed under MIT | ||
| 8 | +* | ||
| 9 | +* @author Manuel Bieh | ||
| 10 | +* @url http://www.manuelbieh.com/ | ||
| 11 | +* @version 2.0.21 | ||
| 12 | +* @license MIT | ||
| 13 | +* | ||
| 14 | +*/ | ||
| 15 | +!function(a,b,c){var d=function(a){var b,d=+(Math.pow(2,27)+1),e=5,f=1.1102230246251565e-16,g=(3+16*f)*f,h=(7+56*f)*f,i=function(a,b,c){var e=a*b,f=d*a,g=f-a,h=f-g,i=a-h,j=d*b,k=j-b,l=j-k,m=b-l,n=e-h*l,o=n-i*l,p=o-h*m,q=i*m-p;return c?(c[0]=q,c[1]=e,c):[q,e]},j=function(a,b,c){var d=a+b,e=d-a,f=d-e,g=b-e,h=a-f;return c?(c[0]=h+g,c[1]=d,c):[h+g,d]},k=j,l=function(a,b){var c=0|a.length,d=0|b.length;if(1===c&&1===d)return p(a[0],b[0]);var e,f,g=c+d,h=new Array(g),i=0,j=0,k=0,l=Math.abs,m=a[j],n=l(m),o=b[k],q=l(o);q>n?(f=m,j+=1,c>j&&(m=a[j],n=l(m))):(f=o,k+=1,d>k&&(o=b[k],q=l(o))),c>j&&q>n||k>=d?(e=m,j+=1,c>j&&(m=a[j],n=l(m))):(e=o,k+=1,d>k&&(o=b[k],q=l(o)));for(var r,s,t,u,v,w=e+f,x=w-e,y=f-x,z=y,A=w;c>j&&d>k;)q>n?(e=m,j+=1,c>j&&(m=a[j],n=l(m))):(e=o,k+=1,d>k&&(o=b[k],q=l(o))),f=z,w=e+f,x=w-e,y=f-x,y&&(h[i++]=y),r=A+w,s=r-A,t=r-s,u=w-s,v=A-t,z=v+u,A=r;for(;c>j;)e=m,f=z,w=e+f,x=w-e,y=f-x,y&&(h[i++]=y),r=A+w,s=r-A,t=r-s,u=w-s,v=A-t,z=v+u,A=r,j+=1,c>j&&(m=a[j]);for(;d>k;)e=o,f=z,w=e+f,x=w-e,y=f-x,y&&(h[i++]=y),r=A+w,s=r-A,t=r-s,u=w-s,v=A-t,z=v+u,A=r,k+=1,d>k&&(o=b[k]);return z&&(h[i++]=z),A&&(h[i++]=A),i||(h[i++]=0),h.length=i,h},m=l,n=function(a,b){var c=a.length;if(1===c){var d=i(a[0],b);return d[0]?d:[d[1]]}var e=new Array(2*c),f=[.1,.1],g=[.1,.1],h=0;i(a[0],b,f),f[0]&&(e[h++]=f[0]);for(var j=1;c>j;++j){i(a[j],b,g);var l=f[1];k(l,g[0],f),f[0]&&(e[h++]=f[0]);var m=g[1],n=f[1],o=m+n,p=o-m,q=n-p;f[1]=o,q&&(e[h++]=q)}return f[1]&&(e[h++]=f[1]),0===h&&(e[h++]=0),e.length=h,e},o=n,p=function(a,b){var c=a+b,d=c-a,e=c-d,f=b-d,g=a-e,h=g+f;return h?[h,c]:[c]},q=function(a,b){var c=0|a.length,d=0|b.length;if(1===c&&1===d)return p(a[0],-b[0]);var e,f,g=c+d,h=new Array(g),i=0,j=0,k=0,l=Math.abs,m=a[j],n=l(m),o=-b[k],q=l(o);q>n?(f=m,j+=1,c>j&&(m=a[j],n=l(m))):(f=o,k+=1,d>k&&(o=-b[k],q=l(o))),c>j&&q>n||k>=d?(e=m,j+=1,c>j&&(m=a[j],n=l(m))):(e=o,k+=1,d>k&&(o=-b[k],q=l(o)));for(var r,s,t,u,v,w=e+f,x=w-e,y=f-x,z=y,A=w;c>j&&d>k;)q>n?(e=m,j+=1,c>j&&(m=a[j],n=l(m))):(e=o,k+=1,d>k&&(o=-b[k],q=l(o))),f=z,w=e+f,x=w-e,y=f-x,y&&(h[i++]=y),r=A+w,s=r-A,t=r-s,u=w-s,v=A-t,z=v+u,A=r;for(;c>j;)e=m,f=z,w=e+f,x=w-e,y=f-x,y&&(h[i++]=y),r=A+w,s=r-A,t=r-s,u=w-s,v=A-t,z=v+u,A=r,j+=1,c>j&&(m=a[j]);for(;d>k;)e=o,f=z,w=e+f,x=w-e,y=f-x,y&&(h[i++]=y),r=A+w,s=r-A,t=r-s,u=w-s,v=A-t,z=v+u,A=r,k+=1,d>k&&(o=-b[k]);return z&&(h[i++]=z),A&&(h[i++]=A),i||(h[i++]=0),h.length=i,h},r=function(a,b){for(var c=new Array(a.length-1),d=1;d<a.length;++d)for(var e=c[d-1]=new Array(a.length-1),f=0,g=0;f<a.length;++f)f!==b&&(e[g++]=a[d][f]);return c},s=function(a){for(var b=new Array(a),c=0;a>c;++c){b[c]=new Array(a);for(var d=0;a>d;++d)b[c][d]=["m",d,"[",a-c-1,"]"].join("")}return b},t=function(a){return 1&a?"-":""},u=function(a){if(1===a.length)return a[0];if(2===a.length)return["sum(",a[0],",",a[1],")"].join("");var b=a.length>>1;return["sum(",u(a.slice(0,b)),",",u(a.slice(b)),")"].join("")},v=function(a){if(2===a.length)return[["sum(prod(",a[0][0],",",a[1][1],"),prod(-",a[0][1],",",a[1][0],"))"].join("")];for(var b=[],c=0;c<a.length;++c)b.push(["scale(",u(v(r(a,c))),",",t(c),a[0][c],")"].join(""));return b},w=function(a){for(var b=[],c=[],d=s(a),e=[],f=0;a>f;++f)0===(1&f)?b.push.apply(b,v(r(d,f))):c.push.apply(c,v(r(d,f))),e.push("m"+f);var g=u(b),h=u(c),j="orientation"+a+"Exact",k=["function ",j,"(",e.join(),"){var p=",g,",n=",h,",d=sub(p,n);return d[d.length-1];};return ",j].join(""),l=new Function("sum","prod","scale","sub",k);return l(m,i,o,q)},x=w(3),y=w(4),z=[function(){return 0},function(){return 0},function(a,b){return b[0]-a[0]},function(a,b,c){var d,e=(a[1]-c[1])*(b[0]-c[0]),f=(a[0]-c[0])*(b[1]-c[1]),h=e-f;if(e>0){if(0>=f)return h;d=e+f}else{if(!(0>e))return h;if(f>=0)return h;d=-(e+f)}var i=g*d;return h>=i||-i>=h?h:x(a,b,c)},function(a,b,c,d){var e=a[0]-d[0],f=b[0]-d[0],g=c[0]-d[0],i=a[1]-d[1],j=b[1]-d[1],k=c[1]-d[1],l=a[2]-d[2],m=b[2]-d[2],n=c[2]-d[2],o=f*k,p=g*j,q=g*i,r=e*k,s=e*j,t=f*i,u=l*(o-p)+m*(q-r)+n*(s-t),v=(Math.abs(o)+Math.abs(p))*Math.abs(l)+(Math.abs(q)+Math.abs(r))*Math.abs(m)+(Math.abs(s)+Math.abs(t))*Math.abs(n),w=h*v;return u>w||-u>w?u:y(a,b,c,d)}],A=function(a){var b=z[a.length];return b||(b=z[a.length]=w(a.length)),b.apply(c,a)},B=function(){for(;z.length<=e;)z.push(w(z.length));for(var a=[],d=["slow"],f=0;e>=f;++f)a.push("a"+f),d.push("o"+f);var g=["function getOrientation(",a.join(),"){switch(arguments.length){case 0:case 1:return 0;"];for(f=2;e>=f;++f)g.push("case ",f,":return o",f,"(",a.slice(0,f).join(),");");g.push("}var s=new Array(arguments.length);for(var i=0;i<arguments.length;++i){s[i]=arguments[i]};return slow(s);}return getOrientation"),d.push(g.join(""));var h=Function.apply(c,d);for(b=h.apply(c,[A].concat(z)),f=0;e>=f;++f)b[f]=z[f]};B();var C=function(c,d){var e=a.longitude(d),f=a.latitude(d),g=c.map(function(b){return[a.longitude(b),a.latitude(b)]});c=g,d=[e,f];for(var h,i,j,k,l,m=c.length,n=1,o=m,p=0,q=m-1;o>p;q=p++){var r=c[p],s=c[q],t=r[1],u=s[1];if(t>u){if(f>u&&t>f){if(h=b(r,s,d),0===h)return 0;n^=h>0|0}else if(f===t&&(i=c[(p+1)%m],j=i[1],j>t)){if(h=b(r,s,d),0===h)return 0;n^=h>0|0}}else if(u>t){if(f>t&&u>f){if(h=b(r,s,d),0===h)return 0;n^=0>h|0}else if(f===t&&(i=c[(p+1)%m],j=i[1],t>j)){if(h=b(r,s,d),0===h)return 0;n^=0>h|0}}else if(f===t){var v=Math.min(r[0],s[0]),w=Math.max(r[0],s[0]);if(0===p){for(;q>0;){var x=(q+m-1)%m;if(l=c[x],l[1]!==f)break;k=l[0],v=Math.min(v,k),w=Math.max(w,k),q=x}if(0===q)return e>=v&&w>=e?0:1;o=q+1}for(var y=c[(q+m-1)%m][1];o>p+1&&(l=c[p+1],l[1]===f);)k=l[0],v=Math.min(v,k),w=Math.max(w,k),p+=1;if(e>=v&&w>=e)return 0;var z=c[(p+1)%m][1];v>e&&f>y!=f>z&&(n^=1)}}return 2*n-1};return{isPointInsideRobust:function(a,b){return C(b,a)},isInside:function(){return this.isPointInsideRobust.apply(this,arguments)}}};"undefined"!=typeof module&&"undefined"!=typeof module.exports?module.exports=function(a){return a.extend(d(a),!0),a}:"function"==typeof define&&define.amd?define(["geolib"],function(a){return a.extend(d(a),!0),a}):b.extend(d(b),!0)}(this,this.geolib); | ||
| 0 | \ No newline at end of file | 16 | \ No newline at end of file |
src/main/resources/static/real_control_v2/geolib/geolib.js
0 → 100644
| 1 | +/*! geolib 2.0.21 by Manuel Bieh | ||
| 2 | +* Library to provide geo functions like distance calculation, | ||
| 3 | +* conversion of decimal coordinates to sexagesimal and vice versa, etc. | ||
| 4 | +* WGS 84 (World Geodetic System 1984) | ||
| 5 | +* | ||
| 6 | +* @author Manuel Bieh | ||
| 7 | +* @url http://www.manuelbieh.com/ | ||
| 8 | +* @version 2.0.21 | ||
| 9 | +* @license MIT | ||
| 10 | +**/;(function(global, undefined) { | ||
| 11 | + | ||
| 12 | + "use strict"; | ||
| 13 | + | ||
| 14 | + function Geolib() {} | ||
| 15 | + | ||
| 16 | + // Constants | ||
| 17 | + Geolib.TO_RAD = Math.PI / 180; | ||
| 18 | + Geolib.TO_DEG = 180 / Math.PI; | ||
| 19 | + Geolib.PI_X2 = Math.PI * 2; | ||
| 20 | + Geolib.PI_DIV4 = Math.PI / 4; | ||
| 21 | + | ||
| 22 | + // Setting readonly defaults | ||
| 23 | + var geolib = Object.create(Geolib.prototype, { | ||
| 24 | + version: { | ||
| 25 | + value: "2.0.21" | ||
| 26 | + }, | ||
| 27 | + radius: { | ||
| 28 | + value: 6378137 | ||
| 29 | + }, | ||
| 30 | + minLat: { | ||
| 31 | + value: -90 | ||
| 32 | + }, | ||
| 33 | + maxLat: { | ||
| 34 | + value: 90 | ||
| 35 | + }, | ||
| 36 | + minLon: { | ||
| 37 | + value: -180 | ||
| 38 | + }, | ||
| 39 | + maxLon: { | ||
| 40 | + value: 180 | ||
| 41 | + }, | ||
| 42 | + sexagesimalPattern: { | ||
| 43 | + value: /^([0-9]{1,3})°\s*([0-9]{1,3}(?:\.(?:[0-9]{1,2}))?)'\s*(([0-9]{1,3}(\.([0-9]{1,4}))?)"\s*)?([NEOSW]?)$/ | ||
| 44 | + }, | ||
| 45 | + measures: { | ||
| 46 | + value: Object.create(Object.prototype, { | ||
| 47 | + "m" : {value: 1}, | ||
| 48 | + "km": {value: 0.001}, | ||
| 49 | + "cm": {value: 100}, | ||
| 50 | + "mm": {value: 1000}, | ||
| 51 | + "mi": {value: (1 / 1609.344)}, | ||
| 52 | + "sm": {value: (1 / 1852.216)}, | ||
| 53 | + "ft": {value: (100 / 30.48)}, | ||
| 54 | + "in": {value: (100 / 2.54)}, | ||
| 55 | + "yd": {value: (1 / 0.9144)} | ||
| 56 | + }) | ||
| 57 | + }, | ||
| 58 | + prototype: { | ||
| 59 | + value: Geolib.prototype | ||
| 60 | + }, | ||
| 61 | + extend: { | ||
| 62 | + value: function(methods, overwrite) { | ||
| 63 | + for(var prop in methods) { | ||
| 64 | + if(typeof geolib.prototype[prop] === 'undefined' || overwrite === true) { | ||
| 65 | + if(typeof methods[prop] === 'function' && typeof methods[prop].bind === 'function') { | ||
| 66 | + geolib.prototype[prop] = methods[prop].bind(geolib); | ||
| 67 | + } else { | ||
| 68 | + geolib.prototype[prop] = methods[prop]; | ||
| 69 | + } | ||
| 70 | + } | ||
| 71 | + } | ||
| 72 | + } | ||
| 73 | + } | ||
| 74 | + }); | ||
| 75 | + | ||
| 76 | + if (typeof(Number.prototype.toRad) === 'undefined') { | ||
| 77 | + Number.prototype.toRad = function() { | ||
| 78 | + return this * Geolib.TO_RAD; | ||
| 79 | + }; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + if (typeof(Number.prototype.toDeg) === 'undefined') { | ||
| 83 | + Number.prototype.toDeg = function() { | ||
| 84 | + return this * Geolib.TO_DEG; | ||
| 85 | + }; | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + // Here comes the magic | ||
| 89 | + geolib.extend({ | ||
| 90 | + | ||
| 91 | + decimal: {}, | ||
| 92 | + | ||
| 93 | + sexagesimal: {}, | ||
| 94 | + | ||
| 95 | + distance: null, | ||
| 96 | + | ||
| 97 | + getKeys: function(point) { | ||
| 98 | + | ||
| 99 | + // GeoJSON Array [longitude, latitude(, elevation)] | ||
| 100 | + if(Object.prototype.toString.call(point) == '[object Array]') { | ||
| 101 | + | ||
| 102 | + return { | ||
| 103 | + longitude: point.length >= 1 ? 0 : undefined, | ||
| 104 | + latitude: point.length >= 2 ? 1 : undefined, | ||
| 105 | + elevation: point.length >= 3 ? 2 : undefined | ||
| 106 | + }; | ||
| 107 | + | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + var getKey = function(possibleValues) { | ||
| 111 | + | ||
| 112 | + var key; | ||
| 113 | + | ||
| 114 | + possibleValues.every(function(val) { | ||
| 115 | + // TODO: check if point is an object | ||
| 116 | + if(typeof point != 'object') { | ||
| 117 | + return true; | ||
| 118 | + } | ||
| 119 | + return point.hasOwnProperty(val) ? (function() { key = val; return false; }()) : true; | ||
| 120 | + }); | ||
| 121 | + | ||
| 122 | + return key; | ||
| 123 | + | ||
| 124 | + }; | ||
| 125 | + | ||
| 126 | + var longitude = getKey(['lng', 'lon', 'longitude']); | ||
| 127 | + var latitude = getKey(['lat', 'latitude']); | ||
| 128 | + var elevation = getKey(['alt', 'altitude', 'elevation', 'elev']); | ||
| 129 | + | ||
| 130 | + // return undefined if not at least one valid property was found | ||
| 131 | + if(typeof latitude == 'undefined' && | ||
| 132 | + typeof longitude == 'undefined' && | ||
| 133 | + typeof elevation == 'undefined') { | ||
| 134 | + return undefined; | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + return { | ||
| 138 | + latitude: latitude, | ||
| 139 | + longitude: longitude, | ||
| 140 | + elevation: elevation | ||
| 141 | + }; | ||
| 142 | + | ||
| 143 | + }, | ||
| 144 | + | ||
| 145 | + // returns latitude of a given point, converted to decimal | ||
| 146 | + // set raw to true to avoid conversion | ||
| 147 | + getLat: function(point, raw) { | ||
| 148 | + return raw === true ? point[this.getKeys(point).latitude] : this.useDecimal(point[this.getKeys(point).latitude]); | ||
| 149 | + }, | ||
| 150 | + | ||
| 151 | + // Alias for getLat | ||
| 152 | + latitude: function(point) { | ||
| 153 | + return this.getLat.call(this, point); | ||
| 154 | + }, | ||
| 155 | + | ||
| 156 | + // returns longitude of a given point, converted to decimal | ||
| 157 | + // set raw to true to avoid conversion | ||
| 158 | + getLon: function(point, raw) { | ||
| 159 | + return raw === true ? point[this.getKeys(point).longitude] : this.useDecimal(point[this.getKeys(point).longitude]); | ||
| 160 | + }, | ||
| 161 | + | ||
| 162 | + // Alias for getLon | ||
| 163 | + longitude: function(point) { | ||
| 164 | + return this.getLon.call(this, point); | ||
| 165 | + }, | ||
| 166 | + | ||
| 167 | + getElev: function(point) { | ||
| 168 | + return point[this.getKeys(point).elevation]; | ||
| 169 | + }, | ||
| 170 | + | ||
| 171 | + // Alias for getElev | ||
| 172 | + elevation: function(point) { | ||
| 173 | + return this.getElev.call(this, point); | ||
| 174 | + }, | ||
| 175 | + | ||
| 176 | + coords: function(point, raw) { | ||
| 177 | + | ||
| 178 | + var retval = { | ||
| 179 | + latitude: raw === true ? point[this.getKeys(point).latitude] : this.useDecimal(point[this.getKeys(point).latitude]), | ||
| 180 | + longitude: raw === true ? point[this.getKeys(point).longitude] : this.useDecimal(point[this.getKeys(point).longitude]) | ||
| 181 | + }; | ||
| 182 | + | ||
| 183 | + var elev = point[this.getKeys(point).elevation]; | ||
| 184 | + | ||
| 185 | + if(typeof elev !== 'undefined') { | ||
| 186 | + retval['elevation'] = elev; | ||
| 187 | + } | ||
| 188 | + | ||
| 189 | + return retval; | ||
| 190 | + | ||
| 191 | + }, | ||
| 192 | + | ||
| 193 | + // Alias for coords | ||
| 194 | + ll: function(point, raw) { | ||
| 195 | + return this.coords.call(this, point, raw); | ||
| 196 | + }, | ||
| 197 | + | ||
| 198 | + | ||
| 199 | + // checks if a variable contains a valid latlong object | ||
| 200 | + validate: function(point) { | ||
| 201 | + | ||
| 202 | + var keys = this.getKeys(point); | ||
| 203 | + | ||
| 204 | + if(typeof keys === 'undefined' || typeof keys.latitude === 'undefined' || keys.longitude === 'undefined') { | ||
| 205 | + return false; | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + var lat = point[keys.latitude]; | ||
| 209 | + var lng = point[keys.longitude]; | ||
| 210 | + | ||
| 211 | + if(typeof lat === 'undefined' || !this.isDecimal(lat) && !this.isSexagesimal(lat)) { | ||
| 212 | + return false; | ||
| 213 | + } | ||
| 214 | + | ||
| 215 | + if(typeof lng === 'undefined' || !this.isDecimal(lng) && !this.isSexagesimal(lng)) { | ||
| 216 | + return false; | ||
| 217 | + } | ||
| 218 | + | ||
| 219 | + lat = this.useDecimal(lat); | ||
| 220 | + lng = this.useDecimal(lng); | ||
| 221 | + | ||
| 222 | + if(lat < this.minLat || lat > this.maxLat || lng < this.minLon || lng > this.maxLon) { | ||
| 223 | + return false; | ||
| 224 | + } | ||
| 225 | + | ||
| 226 | + return true; | ||
| 227 | + | ||
| 228 | + }, | ||
| 229 | + | ||
| 230 | + /** | ||
| 231 | + * Calculates geodetic distance between two points specified by latitude/longitude using | ||
| 232 | + * Vincenty inverse formula for ellipsoids | ||
| 233 | + * Vincenty Inverse Solution of Geodesics on the Ellipsoid (c) Chris Veness 2002-2010 | ||
| 234 | + * (Licensed under CC BY 3.0) | ||
| 235 | + * | ||
| 236 | + * @param object Start position {latitude: 123, longitude: 123} | ||
| 237 | + * @param object End position {latitude: 123, longitude: 123} | ||
| 238 | + * @param integer Accuracy (in meters) | ||
| 239 | + * @param integer Precision (in decimal cases) | ||
| 240 | + * @return integer Distance (in meters) | ||
| 241 | + */ | ||
| 242 | + getDistance: function(start, end, accuracy, precision) { | ||
| 243 | + | ||
| 244 | + accuracy = Math.floor(accuracy) || 1; | ||
| 245 | + precision = Math.floor(precision) || 0; | ||
| 246 | + | ||
| 247 | + var s = this.coords(start); | ||
| 248 | + var e = this.coords(end); | ||
| 249 | + | ||
| 250 | + var a = 6378137, b = 6356752.314245, f = 1/298.257223563; // WGS-84 ellipsoid params | ||
| 251 | + var L = (e['longitude']-s['longitude']).toRad(); | ||
| 252 | + | ||
| 253 | + var cosSigma, sigma, sinAlpha, cosSqAlpha, cos2SigmaM, sinSigma; | ||
| 254 | + | ||
| 255 | + var U1 = Math.atan((1-f) * Math.tan(parseFloat(s['latitude']).toRad())); | ||
| 256 | + var U2 = Math.atan((1-f) * Math.tan(parseFloat(e['latitude']).toRad())); | ||
| 257 | + var sinU1 = Math.sin(U1), cosU1 = Math.cos(U1); | ||
| 258 | + var sinU2 = Math.sin(U2), cosU2 = Math.cos(U2); | ||
| 259 | + | ||
| 260 | + var lambda = L, lambdaP, iterLimit = 100; | ||
| 261 | + do { | ||
| 262 | + var sinLambda = Math.sin(lambda), cosLambda = Math.cos(lambda); | ||
| 263 | + sinSigma = ( | ||
| 264 | + Math.sqrt( | ||
| 265 | + ( | ||
| 266 | + cosU2 * sinLambda | ||
| 267 | + ) * ( | ||
| 268 | + cosU2 * sinLambda | ||
| 269 | + ) + ( | ||
| 270 | + cosU1 * sinU2 - sinU1 * cosU2 * cosLambda | ||
| 271 | + ) * ( | ||
| 272 | + cosU1 * sinU2 - sinU1 * cosU2 * cosLambda | ||
| 273 | + ) | ||
| 274 | + ) | ||
| 275 | + ); | ||
| 276 | + if (sinSigma === 0) { | ||
| 277 | + return geolib.distance = 0; // co-incident points | ||
| 278 | + } | ||
| 279 | + | ||
| 280 | + cosSigma = sinU1 * sinU2 + cosU1 * cosU2 * cosLambda; | ||
| 281 | + sigma = Math.atan2(sinSigma, cosSigma); | ||
| 282 | + sinAlpha = cosU1 * cosU2 * sinLambda / sinSigma; | ||
| 283 | + cosSqAlpha = 1 - sinAlpha * sinAlpha; | ||
| 284 | + cos2SigmaM = cosSigma - 2 * sinU1 * sinU2 / cosSqAlpha; | ||
| 285 | + | ||
| 286 | + if (isNaN(cos2SigmaM)) { | ||
| 287 | + cos2SigmaM = 0; // equatorial line: cosSqAlpha=0 (§6) | ||
| 288 | + } | ||
| 289 | + var C = ( | ||
| 290 | + f / 16 * cosSqAlpha * ( | ||
| 291 | + 4 + f * ( | ||
| 292 | + 4 - 3 * cosSqAlpha | ||
| 293 | + ) | ||
| 294 | + ) | ||
| 295 | + ); | ||
| 296 | + lambdaP = lambda; | ||
| 297 | + lambda = ( | ||
| 298 | + L + ( | ||
| 299 | + 1 - C | ||
| 300 | + ) * f * sinAlpha * ( | ||
| 301 | + sigma + C * sinSigma * ( | ||
| 302 | + cos2SigmaM + C * cosSigma * ( | ||
| 303 | + -1 + 2 * cos2SigmaM * cos2SigmaM | ||
| 304 | + ) | ||
| 305 | + ) | ||
| 306 | + ) | ||
| 307 | + ); | ||
| 308 | + | ||
| 309 | + } while (Math.abs(lambda-lambdaP) > 1e-12 && --iterLimit>0); | ||
| 310 | + | ||
| 311 | + if (iterLimit === 0) { | ||
| 312 | + return NaN; // formula failed to converge | ||
| 313 | + } | ||
| 314 | + | ||
| 315 | + var uSq = ( | ||
| 316 | + cosSqAlpha * ( | ||
| 317 | + a * a - b * b | ||
| 318 | + ) / ( | ||
| 319 | + b*b | ||
| 320 | + ) | ||
| 321 | + ); | ||
| 322 | + | ||
| 323 | + var A = ( | ||
| 324 | + 1 + uSq / 16384 * ( | ||
| 325 | + 4096 + uSq * ( | ||
| 326 | + -768 + uSq * ( | ||
| 327 | + 320 - 175 * uSq | ||
| 328 | + ) | ||
| 329 | + ) | ||
| 330 | + ) | ||
| 331 | + ); | ||
| 332 | + | ||
| 333 | + var B = ( | ||
| 334 | + uSq / 1024 * ( | ||
| 335 | + 256 + uSq * ( | ||
| 336 | + -128 + uSq * ( | ||
| 337 | + 74-47 * uSq | ||
| 338 | + ) | ||
| 339 | + ) | ||
| 340 | + ) | ||
| 341 | + ); | ||
| 342 | + | ||
| 343 | + var deltaSigma = ( | ||
| 344 | + B * sinSigma * ( | ||
| 345 | + cos2SigmaM + B / 4 * ( | ||
| 346 | + cosSigma * ( | ||
| 347 | + -1 + 2 * cos2SigmaM * cos2SigmaM | ||
| 348 | + ) -B / 6 * cos2SigmaM * ( | ||
| 349 | + -3 + 4 * sinSigma * sinSigma | ||
| 350 | + ) * ( | ||
| 351 | + -3 + 4 * cos2SigmaM * cos2SigmaM | ||
| 352 | + ) | ||
| 353 | + ) | ||
| 354 | + ) | ||
| 355 | + ); | ||
| 356 | + | ||
| 357 | + var distance = b * A * (sigma - deltaSigma); | ||
| 358 | + | ||
| 359 | + distance = distance.toFixed(precision); // round to 1mm precision | ||
| 360 | + | ||
| 361 | + //if (start.hasOwnProperty(elevation) && end.hasOwnProperty(elevation)) { | ||
| 362 | + if (typeof this.elevation(start) !== 'undefined' && typeof this.elevation(end) !== 'undefined') { | ||
| 363 | + var climb = Math.abs(this.elevation(start) - this.elevation(end)); | ||
| 364 | + distance = Math.sqrt(distance * distance + climb * climb); | ||
| 365 | + } | ||
| 366 | + | ||
| 367 | + return this.distance = Math.round(distance * Math.pow(10, precision) / accuracy) * accuracy / Math.pow(10, precision); | ||
| 368 | + | ||
| 369 | + /* | ||
| 370 | + // note: to return initial/final bearings in addition to distance, use something like: | ||
| 371 | + var fwdAz = Math.atan2(cosU2*sinLambda, cosU1*sinU2-sinU1*cosU2*cosLambda); | ||
| 372 | + var revAz = Math.atan2(cosU1*sinLambda, -sinU1*cosU2+cosU1*sinU2*cosLambda); | ||
| 373 | + | ||
| 374 | + return { distance: s, initialBearing: fwdAz.toDeg(), finalBearing: revAz.toDeg() }; | ||
| 375 | + */ | ||
| 376 | + | ||
| 377 | + }, | ||
| 378 | + | ||
| 379 | + | ||
| 380 | + /** | ||
| 381 | + * Calculates the distance between two spots. | ||
| 382 | + * This method is more simple but also far more inaccurate | ||
| 383 | + * | ||
| 384 | + * @param object Start position {latitude: 123, longitude: 123} | ||
| 385 | + * @param object End position {latitude: 123, longitude: 123} | ||
| 386 | + * @param integer Accuracy (in meters) | ||
| 387 | + * @return integer Distance (in meters) | ||
| 388 | + */ | ||
| 389 | + getDistanceSimple: function(start, end, accuracy) { | ||
| 390 | + | ||
| 391 | + accuracy = Math.floor(accuracy) || 1; | ||
| 392 | + | ||
| 393 | + var distance = | ||
| 394 | + Math.round( | ||
| 395 | + Math.acos( | ||
| 396 | + Math.sin( | ||
| 397 | + this.latitude(end).toRad() | ||
| 398 | + ) * | ||
| 399 | + Math.sin( | ||
| 400 | + this.latitude(start).toRad() | ||
| 401 | + ) + | ||
| 402 | + Math.cos( | ||
| 403 | + this.latitude(end).toRad() | ||
| 404 | + ) * | ||
| 405 | + Math.cos( | ||
| 406 | + this.latitude(start).toRad() | ||
| 407 | + ) * | ||
| 408 | + Math.cos( | ||
| 409 | + this.longitude(start).toRad() - this.longitude(end).toRad() | ||
| 410 | + ) | ||
| 411 | + ) * this.radius | ||
| 412 | + ); | ||
| 413 | + | ||
| 414 | + return geolib.distance = Math.floor(Math.round(distance/accuracy)*accuracy); | ||
| 415 | + | ||
| 416 | + }, | ||
| 417 | + | ||
| 418 | + | ||
| 419 | + /** | ||
| 420 | + * Calculates the center of a collection of geo coordinates | ||
| 421 | + * | ||
| 422 | + * @param array Collection of coords [{latitude: 51.510, longitude: 7.1321}, {latitude: 49.1238, longitude: "8° 30' W"}, ...] | ||
| 423 | + * @return object {latitude: centerLat, longitude: centerLng} | ||
| 424 | + */ | ||
| 425 | + getCenter: function(coords) { | ||
| 426 | + | ||
| 427 | + var coordsArray = coords; | ||
| 428 | + if(typeof coords === 'object' && !(coords instanceof Array)) { | ||
| 429 | + | ||
| 430 | + coordsArray = []; | ||
| 431 | + | ||
| 432 | + for(var key in coords) { | ||
| 433 | + coordsArray.push( | ||
| 434 | + this.coords(coords[key]) | ||
| 435 | + ); | ||
| 436 | + } | ||
| 437 | + | ||
| 438 | + } | ||
| 439 | + | ||
| 440 | + if(!coordsArray.length) { | ||
| 441 | + return false; | ||
| 442 | + } | ||
| 443 | + | ||
| 444 | + var X = 0.0; | ||
| 445 | + var Y = 0.0; | ||
| 446 | + var Z = 0.0; | ||
| 447 | + var lat, lon, hyp; | ||
| 448 | + | ||
| 449 | + coordsArray.forEach(function(coord) { | ||
| 450 | + | ||
| 451 | + lat = this.latitude(coord).toRad(); | ||
| 452 | + lon = this.longitude(coord).toRad(); | ||
| 453 | + | ||
| 454 | + X += Math.cos(lat) * Math.cos(lon); | ||
| 455 | + Y += Math.cos(lat) * Math.sin(lon); | ||
| 456 | + Z += Math.sin(lat); | ||
| 457 | + | ||
| 458 | + }, this); | ||
| 459 | + | ||
| 460 | + var nb_coords = coordsArray.length; | ||
| 461 | + X = X / nb_coords; | ||
| 462 | + Y = Y / nb_coords; | ||
| 463 | + Z = Z / nb_coords; | ||
| 464 | + | ||
| 465 | + lon = Math.atan2(Y, X); | ||
| 466 | + hyp = Math.sqrt(X * X + Y * Y); | ||
| 467 | + lat = Math.atan2(Z, hyp); | ||
| 468 | + | ||
| 469 | + return { | ||
| 470 | + latitude: (lat * Geolib.TO_DEG).toFixed(6), | ||
| 471 | + longitude: (lon * Geolib.TO_DEG).toFixed(6) | ||
| 472 | + }; | ||
| 473 | + | ||
| 474 | + }, | ||
| 475 | + | ||
| 476 | + | ||
| 477 | + /** | ||
| 478 | + * Gets the max and min, latitude, longitude, and elevation (if provided). | ||
| 479 | + * @param array array with coords e.g. [{latitude: 51.5143, longitude: 7.4138}, {latitude: 123, longitude: 123}, ...] | ||
| 480 | + * @return object {maxLat: maxLat, | ||
| 481 | + * minLat: minLat | ||
| 482 | + * maxLng: maxLng, | ||
| 483 | + * minLng: minLng, | ||
| 484 | + * maxElev: maxElev, | ||
| 485 | + * minElev: minElev} | ||
| 486 | + */ | ||
| 487 | + getBounds: function(coords) { | ||
| 488 | + | ||
| 489 | + if (!coords.length) { | ||
| 490 | + return false; | ||
| 491 | + } | ||
| 492 | + | ||
| 493 | + var useElevation = this.elevation(coords[0]); | ||
| 494 | + | ||
| 495 | + var stats = { | ||
| 496 | + maxLat: -Infinity, | ||
| 497 | + minLat: Infinity, | ||
| 498 | + maxLng: -Infinity, | ||
| 499 | + minLng: Infinity | ||
| 500 | + }; | ||
| 501 | + | ||
| 502 | + if (typeof useElevation != 'undefined') { | ||
| 503 | + stats.maxElev = 0; | ||
| 504 | + stats.minElev = Infinity; | ||
| 505 | + } | ||
| 506 | + | ||
| 507 | + for (var i = 0, l = coords.length; i < l; ++i) { | ||
| 508 | + | ||
| 509 | + stats.maxLat = Math.max(this.latitude(coords[i]), stats.maxLat); | ||
| 510 | + stats.minLat = Math.min(this.latitude(coords[i]), stats.minLat); | ||
| 511 | + stats.maxLng = Math.max(this.longitude(coords[i]), stats.maxLng); | ||
| 512 | + stats.minLng = Math.min(this.longitude(coords[i]), stats.minLng); | ||
| 513 | + | ||
| 514 | + if (useElevation) { | ||
| 515 | + stats.maxElev = Math.max(this.elevation(coords[i]), stats.maxElev); | ||
| 516 | + stats.minElev = Math.min(this.elevation(coords[i]), stats.minElev); | ||
| 517 | + } | ||
| 518 | + | ||
| 519 | + } | ||
| 520 | + | ||
| 521 | + return stats; | ||
| 522 | + | ||
| 523 | + }, | ||
| 524 | + | ||
| 525 | + /** | ||
| 526 | + * Calculates the center of the bounds of geo coordinates. | ||
| 527 | + * | ||
| 528 | + * On polygons like political borders (eg. states) | ||
| 529 | + * this may gives a closer result to human expectation, than `getCenter`, | ||
| 530 | + * because that function can be disturbed by uneven distribution of | ||
| 531 | + * point in different sides. | ||
| 532 | + * Imagine the US state Oklahoma: `getCenter` on that gives a southern | ||
| 533 | + * point, because the southern border contains a lot more nodes, | ||
| 534 | + * than the others. | ||
| 535 | + * | ||
| 536 | + * @param array Collection of coords [{latitude: 51.510, longitude: 7.1321}, {latitude: 49.1238, longitude: "8° 30' W"}, ...] | ||
| 537 | + * @return object {latitude: centerLat, longitude: centerLng} | ||
| 538 | + */ | ||
| 539 | + getCenterOfBounds: function(coords) { | ||
| 540 | + var b = this.getBounds(coords); | ||
| 541 | + var latitude = b.minLat + ((b.maxLat - b.minLat) / 2); | ||
| 542 | + var longitude = b.minLng + ((b.maxLng - b.minLng) / 2); | ||
| 543 | + return { | ||
| 544 | + latitude: parseFloat(latitude.toFixed(6)), | ||
| 545 | + longitude: parseFloat(longitude.toFixed(6)) | ||
| 546 | + }; | ||
| 547 | + }, | ||
| 548 | + | ||
| 549 | + | ||
| 550 | + /** | ||
| 551 | + * Computes the bounding coordinates of all points on the surface | ||
| 552 | + * of the earth less than or equal to the specified great circle | ||
| 553 | + * distance. | ||
| 554 | + * | ||
| 555 | + * @param object Point position {latitude: 123, longitude: 123} | ||
| 556 | + * @param number Distance (in meters). | ||
| 557 | + * @return array Collection of two points defining the SW and NE corners. | ||
| 558 | + */ | ||
| 559 | + getBoundsOfDistance: function(point, distance) { | ||
| 560 | + | ||
| 561 | + var latitude = this.latitude(point); | ||
| 562 | + var longitude = this.longitude(point); | ||
| 563 | + | ||
| 564 | + var radLat = latitude.toRad(); | ||
| 565 | + var radLon = longitude.toRad(); | ||
| 566 | + | ||
| 567 | + var radDist = distance / this.radius; | ||
| 568 | + var minLat = radLat - radDist; | ||
| 569 | + var maxLat = radLat + radDist; | ||
| 570 | + | ||
| 571 | + var MAX_LAT_RAD = this.maxLat.toRad(); | ||
| 572 | + var MIN_LAT_RAD = this.minLat.toRad(); | ||
| 573 | + var MAX_LON_RAD = this.maxLon.toRad(); | ||
| 574 | + var MIN_LON_RAD = this.minLon.toRad(); | ||
| 575 | + | ||
| 576 | + var minLon; | ||
| 577 | + var maxLon; | ||
| 578 | + | ||
| 579 | + if (minLat > MIN_LAT_RAD && maxLat < MAX_LAT_RAD) { | ||
| 580 | + | ||
| 581 | + var deltaLon = Math.asin(Math.sin(radDist) / Math.cos(radLat)); | ||
| 582 | + minLon = radLon - deltaLon; | ||
| 583 | + | ||
| 584 | + if (minLon < MIN_LON_RAD) { | ||
| 585 | + minLon += Geolib.PI_X2; | ||
| 586 | + } | ||
| 587 | + | ||
| 588 | + maxLon = radLon + deltaLon; | ||
| 589 | + | ||
| 590 | + if (maxLon > MAX_LON_RAD) { | ||
| 591 | + maxLon -= Geolib.PI_X2; | ||
| 592 | + } | ||
| 593 | + | ||
| 594 | + } else { | ||
| 595 | + // A pole is within the distance. | ||
| 596 | + minLat = Math.max(minLat, MIN_LAT_RAD); | ||
| 597 | + maxLat = Math.min(maxLat, MAX_LAT_RAD); | ||
| 598 | + minLon = MIN_LON_RAD; | ||
| 599 | + maxLon = MAX_LON_RAD; | ||
| 600 | + } | ||
| 601 | + | ||
| 602 | + return [ | ||
| 603 | + // Southwest | ||
| 604 | + { | ||
| 605 | + latitude: minLat.toDeg(), | ||
| 606 | + longitude: minLon.toDeg() | ||
| 607 | + }, | ||
| 608 | + // Northeast | ||
| 609 | + { | ||
| 610 | + latitude: maxLat.toDeg(), | ||
| 611 | + longitude: maxLon.toDeg() | ||
| 612 | + } | ||
| 613 | + ]; | ||
| 614 | + | ||
| 615 | + }, | ||
| 616 | + | ||
| 617 | + | ||
| 618 | + /** | ||
| 619 | + * Checks whether a point is inside of a polygon or not. | ||
| 620 | + * Note that the polygon coords must be in correct order! | ||
| 621 | + * | ||
| 622 | + * @param object coordinate to check e.g. {latitude: 51.5023, longitude: 7.3815} | ||
| 623 | + * @param array array with coords e.g. [{latitude: 51.5143, longitude: 7.4138}, {latitude: 123, longitude: 123}, ...] | ||
| 624 | + * @return bool true if the coordinate is inside the given polygon | ||
| 625 | + */ | ||
| 626 | + isPointInside: function(latlng, coords) { | ||
| 627 | + | ||
| 628 | + for(var c = false, i = -1, l = coords.length, j = l - 1; ++i < l; j = i) { | ||
| 629 | + | ||
| 630 | + if( | ||
| 631 | + ( | ||
| 632 | + (this.longitude(coords[i]) <= this.longitude(latlng) && this.longitude(latlng) < this.longitude(coords[j])) || | ||
| 633 | + (this.longitude(coords[j]) <= this.longitude(latlng) && this.longitude(latlng) < this.longitude(coords[i])) | ||
| 634 | + ) && | ||
| 635 | + ( | ||
| 636 | + this.latitude(latlng) < (this.latitude(coords[j]) - this.latitude(coords[i])) * | ||
| 637 | + (this.longitude(latlng) - this.longitude(coords[i])) / | ||
| 638 | + (this.longitude(coords[j]) - this.longitude(coords[i])) + | ||
| 639 | + this.latitude(coords[i]) | ||
| 640 | + ) | ||
| 641 | + ) { | ||
| 642 | + c = !c; | ||
| 643 | + } | ||
| 644 | + | ||
| 645 | + } | ||
| 646 | + | ||
| 647 | + return c; | ||
| 648 | + | ||
| 649 | + }, | ||
| 650 | + | ||
| 651 | + | ||
| 652 | + /** | ||
| 653 | + * Pre calculate the polygon coords, to speed up the point inside check. | ||
| 654 | + * Use this function before calling isPointInsideWithPreparedPolygon() | ||
| 655 | + * @see Algorythm from http://alienryderflex.com/polygon/ | ||
| 656 | + * @param array array with coords e.g. [{latitude: 51.5143, longitude: 7.4138}, {latitude: 123, longitude: 123}, ...] | ||
| 657 | + */ | ||
| 658 | + preparePolygonForIsPointInsideOptimized: function(coords) { | ||
| 659 | + | ||
| 660 | + for(var i = 0, j = coords.length-1; i < coords.length; i++) { | ||
| 661 | + | ||
| 662 | + if(this.longitude(coords[j]) === this.longitude(coords[i])) { | ||
| 663 | + | ||
| 664 | + coords[i].constant = this.latitude(coords[i]); | ||
| 665 | + coords[i].multiple = 0; | ||
| 666 | + | ||
| 667 | + } else { | ||
| 668 | + | ||
| 669 | + coords[i].constant = this.latitude(coords[i]) - ( | ||
| 670 | + this.longitude(coords[i]) * this.latitude(coords[j]) | ||
| 671 | + ) / ( | ||
| 672 | + this.longitude(coords[j]) - this.longitude(coords[i]) | ||
| 673 | + ) + ( | ||
| 674 | + this.longitude(coords[i])*this.latitude(coords[i]) | ||
| 675 | + ) / ( | ||
| 676 | + this.longitude(coords[j])-this.longitude(coords[i]) | ||
| 677 | + ); | ||
| 678 | + | ||
| 679 | + coords[i].multiple = ( | ||
| 680 | + this.latitude(coords[j])-this.latitude(coords[i]) | ||
| 681 | + ) / ( | ||
| 682 | + this.longitude(coords[j])-this.longitude(coords[i]) | ||
| 683 | + ); | ||
| 684 | + | ||
| 685 | + } | ||
| 686 | + | ||
| 687 | + j=i; | ||
| 688 | + | ||
| 689 | + } | ||
| 690 | + | ||
| 691 | + }, | ||
| 692 | + | ||
| 693 | + /** | ||
| 694 | + * Checks whether a point is inside of a polygon or not. | ||
| 695 | + * "This is useful if you have many points that need to be tested against the same (static) polygon." | ||
| 696 | + * Please call the function preparePolygonForIsPointInsideOptimized() with the same coords object before using this function. | ||
| 697 | + * Note that the polygon coords must be in correct order! | ||
| 698 | + * | ||
| 699 | + * @see Algorythm from http://alienryderflex.com/polygon/ | ||
| 700 | + * | ||
| 701 | + * @param object coordinate to check e.g. {latitude: 51.5023, longitude: 7.3815} | ||
| 702 | + * @param array array with coords e.g. [{latitude: 51.5143, longitude: 7.4138}, {latitude: 123, longitude: 123}, ...] | ||
| 703 | + * @return bool true if the coordinate is inside the given polygon | ||
| 704 | + */ | ||
| 705 | + isPointInsideWithPreparedPolygon: function(point, coords) { | ||
| 706 | + | ||
| 707 | + var flgPointInside = false, | ||
| 708 | + y = this.longitude(point), | ||
| 709 | + x = this.latitude(point); | ||
| 710 | + | ||
| 711 | + for(var i = 0, j = coords.length-1; i < coords.length; i++) { | ||
| 712 | + | ||
| 713 | + if ((this.longitude(coords[i]) < y && this.longitude(coords[j]) >=y || | ||
| 714 | + this.longitude(coords[j]) < y && this.longitude(coords[i]) >= y)) { | ||
| 715 | + | ||
| 716 | + flgPointInside^=(y*coords[i].multiple+coords[i].constant < x); | ||
| 717 | + | ||
| 718 | + } | ||
| 719 | + | ||
| 720 | + j=i; | ||
| 721 | + | ||
| 722 | + } | ||
| 723 | + | ||
| 724 | + return flgPointInside; | ||
| 725 | + | ||
| 726 | + }, | ||
| 727 | + | ||
| 728 | + | ||
| 729 | + /** | ||
| 730 | + * Shortcut for geolib.isPointInside() | ||
| 731 | + */ | ||
| 732 | + isInside: function() { | ||
| 733 | + return this.isPointInside.apply(this, arguments); | ||
| 734 | + }, | ||
| 735 | + | ||
| 736 | + | ||
| 737 | + /** | ||
| 738 | + * Checks whether a point is inside of a circle or not. | ||
| 739 | + * | ||
| 740 | + * @param object coordinate to check (e.g. {latitude: 51.5023, longitude: 7.3815}) | ||
| 741 | + * @param object coordinate of the circle's center (e.g. {latitude: 51.4812, longitude: 7.4025}) | ||
| 742 | + * @param integer maximum radius in meters | ||
| 743 | + * @return bool true if the coordinate is within the given radius | ||
| 744 | + */ | ||
| 745 | + isPointInCircle: function(latlng, center, radius) { | ||
| 746 | + return this.getDistance(latlng, center) < radius; | ||
| 747 | + }, | ||
| 748 | + | ||
| 749 | + | ||
| 750 | + /** | ||
| 751 | + * Shortcut for geolib.isPointInCircle() | ||
| 752 | + */ | ||
| 753 | + withinRadius: function() { | ||
| 754 | + return this.isPointInCircle.apply(this, arguments); | ||
| 755 | + }, | ||
| 756 | + | ||
| 757 | + | ||
| 758 | + /** | ||
| 759 | + * Gets rhumb line bearing of two points. Find out about the difference between rhumb line and | ||
| 760 | + * great circle bearing on Wikipedia. It's quite complicated. Rhumb line should be fine in most cases: | ||
| 761 | + * | ||
| 762 | + * http://en.wikipedia.org/wiki/Rhumb_line#General_and_mathematical_description | ||
| 763 | + * | ||
| 764 | + * Function heavily based on Doug Vanderweide's great PHP version (licensed under GPL 3.0) | ||
| 765 | + * http://www.dougv.com/2009/07/13/calculating-the-bearing-and-compass-rose-direction-between-two-latitude-longitude-coordinates-in-php/ | ||
| 766 | + * | ||
| 767 | + * @param object origin coordinate (e.g. {latitude: 51.5023, longitude: 7.3815}) | ||
| 768 | + * @param object destination coordinate | ||
| 769 | + * @return integer calculated bearing | ||
| 770 | + */ | ||
| 771 | + getRhumbLineBearing: function(originLL, destLL) { | ||
| 772 | + | ||
| 773 | + // difference of longitude coords | ||
| 774 | + var diffLon = this.longitude(destLL).toRad() - this.longitude(originLL).toRad(); | ||
| 775 | + | ||
| 776 | + // difference latitude coords phi | ||
| 777 | + var diffPhi = Math.log( | ||
| 778 | + Math.tan( | ||
| 779 | + this.latitude(destLL).toRad() / 2 + Geolib.PI_DIV4 | ||
| 780 | + ) / | ||
| 781 | + Math.tan( | ||
| 782 | + this.latitude(originLL).toRad() / 2 + Geolib.PI_DIV4 | ||
| 783 | + ) | ||
| 784 | + ); | ||
| 785 | + | ||
| 786 | + // recalculate diffLon if it is greater than pi | ||
| 787 | + if(Math.abs(diffLon) > Math.PI) { | ||
| 788 | + if(diffLon > 0) { | ||
| 789 | + diffLon = (Geolib.PI_X2 - diffLon) * -1; | ||
| 790 | + } | ||
| 791 | + else { | ||
| 792 | + diffLon = Geolib.PI_X2 + diffLon; | ||
| 793 | + } | ||
| 794 | + } | ||
| 795 | + | ||
| 796 | + //return the angle, normalized | ||
| 797 | + return (Math.atan2(diffLon, diffPhi).toDeg() + 360) % 360; | ||
| 798 | + | ||
| 799 | + }, | ||
| 800 | + | ||
| 801 | + | ||
| 802 | + /** | ||
| 803 | + * Gets great circle bearing of two points. See description of getRhumbLineBearing for more information | ||
| 804 | + * | ||
| 805 | + * @param object origin coordinate (e.g. {latitude: 51.5023, longitude: 7.3815}) | ||
| 806 | + * @param object destination coordinate | ||
| 807 | + * @return integer calculated bearing | ||
| 808 | + */ | ||
| 809 | + getBearing: function(originLL, destLL) { | ||
| 810 | + | ||
| 811 | + destLL['latitude'] = this.latitude(destLL); | ||
| 812 | + destLL['longitude'] = this.longitude(destLL); | ||
| 813 | + originLL['latitude'] = this.latitude(originLL); | ||
| 814 | + originLL['longitude'] = this.longitude(originLL); | ||
| 815 | + | ||
| 816 | + var bearing = ( | ||
| 817 | + ( | ||
| 818 | + Math.atan2( | ||
| 819 | + Math.sin( | ||
| 820 | + destLL['longitude'].toRad() - | ||
| 821 | + originLL['longitude'].toRad() | ||
| 822 | + ) * | ||
| 823 | + Math.cos( | ||
| 824 | + destLL['latitude'].toRad() | ||
| 825 | + ), | ||
| 826 | + Math.cos( | ||
| 827 | + originLL['latitude'].toRad() | ||
| 828 | + ) * | ||
| 829 | + Math.sin( | ||
| 830 | + destLL['latitude'].toRad() | ||
| 831 | + ) - | ||
| 832 | + Math.sin( | ||
| 833 | + originLL['latitude'].toRad() | ||
| 834 | + ) * | ||
| 835 | + Math.cos( | ||
| 836 | + destLL['latitude'].toRad() | ||
| 837 | + ) * | ||
| 838 | + Math.cos( | ||
| 839 | + destLL['longitude'].toRad() - originLL['longitude'].toRad() | ||
| 840 | + ) | ||
| 841 | + ) | ||
| 842 | + ).toDeg() + 360 | ||
| 843 | + ) % 360; | ||
| 844 | + | ||
| 845 | + return bearing; | ||
| 846 | + | ||
| 847 | + }, | ||
| 848 | + | ||
| 849 | + | ||
| 850 | + /** | ||
| 851 | + * Gets the compass direction from an origin coordinate to a destination coordinate. | ||
| 852 | + * | ||
| 853 | + * @param object origin coordinate (e.g. {latitude: 51.5023, longitude: 7.3815}) | ||
| 854 | + * @param object destination coordinate | ||
| 855 | + * @param string Bearing mode. Can be either circle or rhumbline | ||
| 856 | + * @return object Returns an object with a rough (NESW) and an exact direction (NNE, NE, ENE, E, ESE, etc). | ||
| 857 | + */ | ||
| 858 | + getCompassDirection: function(originLL, destLL, bearingMode) { | ||
| 859 | + | ||
| 860 | + var direction; | ||
| 861 | + var bearing; | ||
| 862 | + | ||
| 863 | + if(bearingMode == 'circle') { | ||
| 864 | + // use great circle bearing | ||
| 865 | + bearing = this.getBearing(originLL, destLL); | ||
| 866 | + } else { | ||
| 867 | + // default is rhumb line bearing | ||
| 868 | + bearing = this.getRhumbLineBearing(originLL, destLL); | ||
| 869 | + } | ||
| 870 | + | ||
| 871 | + switch(Math.round(bearing/22.5)) { | ||
| 872 | + case 1: | ||
| 873 | + direction = {exact: "NNE", rough: "N"}; | ||
| 874 | + break; | ||
| 875 | + case 2: | ||
| 876 | + direction = {exact: "NE", rough: "N"}; | ||
| 877 | + break; | ||
| 878 | + case 3: | ||
| 879 | + direction = {exact: "ENE", rough: "E"}; | ||
| 880 | + break; | ||
| 881 | + case 4: | ||
| 882 | + direction = {exact: "E", rough: "E"}; | ||
| 883 | + break; | ||
| 884 | + case 5: | ||
| 885 | + direction = {exact: "ESE", rough: "E"}; | ||
| 886 | + break; | ||
| 887 | + case 6: | ||
| 888 | + direction = {exact: "SE", rough: "E"}; | ||
| 889 | + break; | ||
| 890 | + case 7: | ||
| 891 | + direction = {exact: "SSE", rough: "S"}; | ||
| 892 | + break; | ||
| 893 | + case 8: | ||
| 894 | + direction = {exact: "S", rough: "S"}; | ||
| 895 | + break; | ||
| 896 | + case 9: | ||
| 897 | + direction = {exact: "SSW", rough: "S"}; | ||
| 898 | + break; | ||
| 899 | + case 10: | ||
| 900 | + direction = {exact: "SW", rough: "S"}; | ||
| 901 | + break; | ||
| 902 | + case 11: | ||
| 903 | + direction = {exact: "WSW", rough: "W"}; | ||
| 904 | + break; | ||
| 905 | + case 12: | ||
| 906 | + direction = {exact: "W", rough: "W"}; | ||
| 907 | + break; | ||
| 908 | + case 13: | ||
| 909 | + direction = {exact: "WNW", rough: "W"}; | ||
| 910 | + break; | ||
| 911 | + case 14: | ||
| 912 | + direction = {exact: "NW", rough: "W"}; | ||
| 913 | + break; | ||
| 914 | + case 15: | ||
| 915 | + direction = {exact: "NNW", rough: "N"}; | ||
| 916 | + break; | ||
| 917 | + default: | ||
| 918 | + direction = {exact: "N", rough: "N"}; | ||
| 919 | + } | ||
| 920 | + | ||
| 921 | + direction['bearing'] = bearing; | ||
| 922 | + return direction; | ||
| 923 | + | ||
| 924 | + }, | ||
| 925 | + | ||
| 926 | + | ||
| 927 | + /** | ||
| 928 | + * Shortcut for getCompassDirection | ||
| 929 | + */ | ||
| 930 | + getDirection: function(originLL, destLL, bearingMode) { | ||
| 931 | + return this.getCompassDirection.apply(this, arguments); | ||
| 932 | + }, | ||
| 933 | + | ||
| 934 | + | ||
| 935 | + /** | ||
| 936 | + * Sorts an array of coords by distance from a reference coordinate | ||
| 937 | + * | ||
| 938 | + * @param object reference coordinate e.g. {latitude: 51.5023, longitude: 7.3815} | ||
| 939 | + * @param mixed array or object with coords [{latitude: 51.5143, longitude: 7.4138}, {latitude: 123, longitude: 123}, ...] | ||
| 940 | + * @return array ordered array | ||
| 941 | + */ | ||
| 942 | + orderByDistance: function(latlng, coords) { | ||
| 943 | + | ||
| 944 | + var coordsArray = []; | ||
| 945 | + | ||
| 946 | + for(var coord in coords) { | ||
| 947 | + | ||
| 948 | + var distance = this.getDistance(latlng, coords[coord]); | ||
| 949 | + var augmentedCoord = Object.create(coords[coord]); | ||
| 950 | + augmentedCoord.distance = distance; | ||
| 951 | + augmentedCoord.key = coord; | ||
| 952 | + | ||
| 953 | + coordsArray.push(augmentedCoord); | ||
| 954 | + | ||
| 955 | + } | ||
| 956 | + | ||
| 957 | + return coordsArray.sort(function(a, b) { | ||
| 958 | + return a.distance - b.distance; | ||
| 959 | + }); | ||
| 960 | + | ||
| 961 | + }, | ||
| 962 | + | ||
| 963 | + /** | ||
| 964 | + * Check if a point lies in line created by two other points | ||
| 965 | + * | ||
| 966 | + * @param object Point to check: {latitude: 123, longitude: 123} | ||
| 967 | + * @param object Start of line {latitude: 123, longitude: 123} | ||
| 968 | + * @param object End of line {latitude: 123, longitude: 123} | ||
| 969 | + * @return boolean | ||
| 970 | + */ | ||
| 971 | + isPointInLine: function(point, start, end) { | ||
| 972 | + | ||
| 973 | + return (this.getDistance(start, point, 1, 3)+this.getDistance(point, end, 1, 3)).toFixed(3)==this.getDistance(start, end, 1, 3); | ||
| 974 | + }, | ||
| 975 | + | ||
| 976 | + /** | ||
| 977 | + * Check if a point lies within a given distance from a line created by two other points | ||
| 978 | + * | ||
| 979 | + * @param object Point to check: {latitude: 123, longitude: 123} | ||
| 980 | + * @param object Start of line {latitude: 123, longitude: 123} | ||
| 981 | + * @param object End of line {latitude: 123, longitude: 123} | ||
| 982 | + * @pararm float maximum distance from line | ||
| 983 | + * @return boolean | ||
| 984 | + */ | ||
| 985 | + isPointNearLine: function(point, start, end, distance) { | ||
| 986 | + return this.getDistanceFromLine(point, start, end) < distance; | ||
| 987 | + }, | ||
| 988 | + | ||
| 989 | + /** | ||
| 990 | + * return the minimum distance from a point to a line | ||
| 991 | + * | ||
| 992 | + * @param object Point away from line | ||
| 993 | + * @param object Start of line {latitude: 123, longitude: 123} | ||
| 994 | + * @param object End of line {latitude: 123, longitude: 123} | ||
| 995 | + * @return float distance from point to line | ||
| 996 | + */ | ||
| 997 | + getDistanceFromLine: function(point, start, end) { | ||
| 998 | + var d1 = this.getDistance(start, point, 1, 3); | ||
| 999 | + var d2 = this.getDistance(point, end, 1, 3); | ||
| 1000 | + var d3 = this.getDistance(start, end, 1, 3); | ||
| 1001 | + var distance = 0; | ||
| 1002 | + | ||
| 1003 | + // alpha is the angle between the line from start to point, and from start to end // | ||
| 1004 | + var alpha = Math.acos((d1*d1 + d3*d3 - d2*d2)/(2*d1*d3)); | ||
| 1005 | + // beta is the angle between the line from end to point and from end to start // | ||
| 1006 | + var beta = Math.acos((d2*d2 + d3*d3 - d1*d1)/(2*d2*d3)); | ||
| 1007 | + | ||
| 1008 | + // if the angle is greater than 90 degrees, then the minimum distance is the | ||
| 1009 | + // line from the start to the point // | ||
| 1010 | + if(alpha>Math.PI/2) { | ||
| 1011 | + distance = d1; | ||
| 1012 | + } | ||
| 1013 | + // same for the beta // | ||
| 1014 | + else if(beta > Math.PI/2) { | ||
| 1015 | + distance = d2; | ||
| 1016 | + } | ||
| 1017 | + // otherwise the minimum distance is achieved through a line perpendular to the start-end line, | ||
| 1018 | + // which goes from the start-end line to the point // | ||
| 1019 | + else { | ||
| 1020 | + distance = Math.sin(alpha) * d1; | ||
| 1021 | + } | ||
| 1022 | + | ||
| 1023 | + return distance; | ||
| 1024 | + }, | ||
| 1025 | + | ||
| 1026 | + /** | ||
| 1027 | + * Finds the nearest coordinate to a reference coordinate | ||
| 1028 | + * | ||
| 1029 | + * @param object reference coordinate e.g. {latitude: 51.5023, longitude: 7.3815} | ||
| 1030 | + * @param mixed array or object with coords [{latitude: 51.5143, longitude: 7.4138}, {latitude: 123, longitude: 123}, ...] | ||
| 1031 | + * @return array ordered array | ||
| 1032 | + */ | ||
| 1033 | + findNearest: function(latlng, coords, offset, limit) { | ||
| 1034 | + | ||
| 1035 | + offset = offset || 0; | ||
| 1036 | + limit = limit || 1; | ||
| 1037 | + var ordered = this.orderByDistance(latlng, coords); | ||
| 1038 | + | ||
| 1039 | + if(limit === 1) { | ||
| 1040 | + return ordered[offset]; | ||
| 1041 | + } else { | ||
| 1042 | + return ordered.splice(offset, limit); | ||
| 1043 | + } | ||
| 1044 | + | ||
| 1045 | + }, | ||
| 1046 | + | ||
| 1047 | + | ||
| 1048 | + /** | ||
| 1049 | + * Calculates the length of a given path | ||
| 1050 | + * | ||
| 1051 | + * @param mixed array or object with coords [{latitude: 51.5143, longitude: 7.4138}, {latitude: 123, longitude: 123}, ...] | ||
| 1052 | + * @return integer length of the path (in meters) | ||
| 1053 | + */ | ||
| 1054 | + getPathLength: function(coords) { | ||
| 1055 | + | ||
| 1056 | + var dist = 0; | ||
| 1057 | + var last; | ||
| 1058 | + | ||
| 1059 | + for (var i = 0, l = coords.length; i < l; ++i) { | ||
| 1060 | + if(last) { | ||
| 1061 | + //console.log(coords[i], last, this.getDistance(coords[i], last)); | ||
| 1062 | + dist += this.getDistance(this.coords(coords[i]), last); | ||
| 1063 | + } | ||
| 1064 | + last = this.coords(coords[i]); | ||
| 1065 | + } | ||
| 1066 | + | ||
| 1067 | + return dist; | ||
| 1068 | + | ||
| 1069 | + }, | ||
| 1070 | + | ||
| 1071 | + | ||
| 1072 | + /** | ||
| 1073 | + * Calculates the speed between to points within a given time span. | ||
| 1074 | + * | ||
| 1075 | + * @param object coords with javascript timestamp {latitude: 51.5143, longitude: 7.4138, time: 1360231200880} | ||
| 1076 | + * @param object coords with javascript timestamp {latitude: 51.5502, longitude: 7.4323, time: 1360245600460} | ||
| 1077 | + * @param object options (currently "unit" is the only option. Default: km(h)); | ||
| 1078 | + * @return float speed in unit per hour | ||
| 1079 | + */ | ||
| 1080 | + getSpeed: function(start, end, options) { | ||
| 1081 | + | ||
| 1082 | + var unit = options && options.unit || 'km'; | ||
| 1083 | + | ||
| 1084 | + if(unit == 'mph') { | ||
| 1085 | + unit = 'mi'; | ||
| 1086 | + } else if(unit == 'kmh') { | ||
| 1087 | + unit = 'km'; | ||
| 1088 | + } | ||
| 1089 | + | ||
| 1090 | + var distance = geolib.getDistance(start, end); | ||
| 1091 | + var time = ((end.time*1)/1000) - ((start.time*1)/1000); | ||
| 1092 | + var mPerHr = (distance/time)*3600; | ||
| 1093 | + var speed = Math.round(mPerHr * this.measures[unit] * 10000)/10000; | ||
| 1094 | + return speed; | ||
| 1095 | + | ||
| 1096 | + }, | ||
| 1097 | + | ||
| 1098 | + | ||
| 1099 | + /** | ||
| 1100 | + * Computes the destination point given an initial point, a distance | ||
| 1101 | + * and a bearing | ||
| 1102 | + * | ||
| 1103 | + * see http://www.movable-type.co.uk/scripts/latlong.html for the original code | ||
| 1104 | + * | ||
| 1105 | + * @param object start coordinate (e.g. {latitude: 51.5023, longitude: 7.3815}) | ||
| 1106 | + * @param float longitude of the inital point in degree | ||
| 1107 | + * @param float distance to go from the inital point in meter | ||
| 1108 | + * @param float bearing in degree of the direction to go, e.g. 0 = north, 180 = south | ||
| 1109 | + * @param float optional (in meter), defaults to mean radius of the earth | ||
| 1110 | + * @return object {latitude: destLat (in degree), longitude: destLng (in degree)} | ||
| 1111 | + */ | ||
| 1112 | + computeDestinationPoint: function(start, distance, bearing, radius) { | ||
| 1113 | + | ||
| 1114 | + var lat = this.latitude(start); | ||
| 1115 | + var lng = this.longitude(start); | ||
| 1116 | + | ||
| 1117 | + radius = (typeof radius === 'undefined') ? this.radius : Number(radius); | ||
| 1118 | + | ||
| 1119 | + var δ = Number(distance) / radius; // angular distance in radians | ||
| 1120 | + var θ = Number(bearing).toRad(); | ||
| 1121 | + | ||
| 1122 | + var φ1 = Number(lat).toRad(); | ||
| 1123 | + var λ1 = Number(lng).toRad(); | ||
| 1124 | + | ||
| 1125 | + var φ2 = Math.asin( Math.sin(φ1)*Math.cos(δ) + | ||
| 1126 | + Math.cos(φ1)*Math.sin(δ)*Math.cos(θ) ); | ||
| 1127 | + var λ2 = λ1 + Math.atan2(Math.sin(θ)*Math.sin(δ)*Math.cos(φ1), | ||
| 1128 | + Math.cos(δ)-Math.sin(φ1)*Math.sin(φ2)); | ||
| 1129 | + λ2 = (λ2+3*Math.PI) % (2*Math.PI) - Math.PI; // normalise to -180..+180° | ||
| 1130 | + | ||
| 1131 | + return { | ||
| 1132 | + latitude: φ2.toDeg(), | ||
| 1133 | + longitude: λ2.toDeg() | ||
| 1134 | + }; | ||
| 1135 | + | ||
| 1136 | + }, | ||
| 1137 | + | ||
| 1138 | + | ||
| 1139 | + /** | ||
| 1140 | + * Converts a distance from meters to km, mm, cm, mi, ft, in or yd | ||
| 1141 | + * | ||
| 1142 | + * @param string Format to be converted in | ||
| 1143 | + * @param float Distance in meters | ||
| 1144 | + * @param float Decimal places for rounding (default: 4) | ||
| 1145 | + * @return float Converted distance | ||
| 1146 | + */ | ||
| 1147 | + convertUnit: function(unit, distance, round) { | ||
| 1148 | + | ||
| 1149 | + if(distance === 0) { | ||
| 1150 | + | ||
| 1151 | + return 0; | ||
| 1152 | + | ||
| 1153 | + } else if(typeof distance === 'undefined') { | ||
| 1154 | + | ||
| 1155 | + if(this.distance === null) { | ||
| 1156 | + throw new Error('No distance was given'); | ||
| 1157 | + } else if(this.distance === 0) { | ||
| 1158 | + return 0; | ||
| 1159 | + } else { | ||
| 1160 | + distance = this.distance; | ||
| 1161 | + } | ||
| 1162 | + | ||
| 1163 | + } | ||
| 1164 | + | ||
| 1165 | + unit = unit || 'm'; | ||
| 1166 | + round = (null == round ? 4 : round); | ||
| 1167 | + | ||
| 1168 | + if(typeof this.measures[unit] !== 'undefined') { | ||
| 1169 | + return this.round(distance * this.measures[unit], round); | ||
| 1170 | + } else { | ||
| 1171 | + throw new Error('Unknown unit for conversion.'); | ||
| 1172 | + } | ||
| 1173 | + | ||
| 1174 | + }, | ||
| 1175 | + | ||
| 1176 | + | ||
| 1177 | + /** | ||
| 1178 | + * Checks if a value is in decimal format or, if neccessary, converts to decimal | ||
| 1179 | + * | ||
| 1180 | + * @param mixed Value(s) to be checked/converted (array of latlng objects, latlng object, sexagesimal string, float) | ||
| 1181 | + * @return float Input data in decimal format | ||
| 1182 | + */ | ||
| 1183 | + useDecimal: function(value) { | ||
| 1184 | + | ||
| 1185 | + if(Object.prototype.toString.call(value) === '[object Array]') { | ||
| 1186 | + | ||
| 1187 | + var geolib = this; | ||
| 1188 | + | ||
| 1189 | + value = value.map(function(val) { | ||
| 1190 | + | ||
| 1191 | + //if(!isNaN(parseFloat(val))) { | ||
| 1192 | + if(geolib.isDecimal(val)) { | ||
| 1193 | + | ||
| 1194 | + return geolib.useDecimal(val); | ||
| 1195 | + | ||
| 1196 | + } else if(typeof val == 'object') { | ||
| 1197 | + | ||
| 1198 | + if(geolib.validate(val)) { | ||
| 1199 | + | ||
| 1200 | + return geolib.coords(val); | ||
| 1201 | + | ||
| 1202 | + } else { | ||
| 1203 | + | ||
| 1204 | + for(var prop in val) { | ||
| 1205 | + val[prop] = geolib.useDecimal(val[prop]); | ||
| 1206 | + } | ||
| 1207 | + | ||
| 1208 | + return val; | ||
| 1209 | + | ||
| 1210 | + } | ||
| 1211 | + | ||
| 1212 | + } else if(geolib.isSexagesimal(val)) { | ||
| 1213 | + | ||
| 1214 | + return geolib.sexagesimal2decimal(val); | ||
| 1215 | + | ||
| 1216 | + } else { | ||
| 1217 | + | ||
| 1218 | + return val; | ||
| 1219 | + | ||
| 1220 | + } | ||
| 1221 | + | ||
| 1222 | + }); | ||
| 1223 | + | ||
| 1224 | + return value; | ||
| 1225 | + | ||
| 1226 | + } else if(typeof value === 'object' && this.validate(value)) { | ||
| 1227 | + | ||
| 1228 | + return this.coords(value); | ||
| 1229 | + | ||
| 1230 | + } else if(typeof value === 'object') { | ||
| 1231 | + | ||
| 1232 | + for(var prop in value) { | ||
| 1233 | + value[prop] = this.useDecimal(value[prop]); | ||
| 1234 | + } | ||
| 1235 | + | ||
| 1236 | + return value; | ||
| 1237 | + | ||
| 1238 | + } | ||
| 1239 | + | ||
| 1240 | + | ||
| 1241 | + if (this.isDecimal(value)) { | ||
| 1242 | + | ||
| 1243 | + return parseFloat(value); | ||
| 1244 | + | ||
| 1245 | + } else if(this.isSexagesimal(value) === true) { | ||
| 1246 | + | ||
| 1247 | + return parseFloat(this.sexagesimal2decimal(value)); | ||
| 1248 | + | ||
| 1249 | + } | ||
| 1250 | + | ||
| 1251 | + throw new Error('Unknown format.'); | ||
| 1252 | + | ||
| 1253 | + }, | ||
| 1254 | + | ||
| 1255 | + /** | ||
| 1256 | + * Converts a decimal coordinate value to sexagesimal format | ||
| 1257 | + * | ||
| 1258 | + * @param float decimal | ||
| 1259 | + * @return string Sexagesimal value (XX° YY' ZZ") | ||
| 1260 | + */ | ||
| 1261 | + decimal2sexagesimal: function(dec) { | ||
| 1262 | + | ||
| 1263 | + if (dec in this.sexagesimal) { | ||
| 1264 | + return this.sexagesimal[dec]; | ||
| 1265 | + } | ||
| 1266 | + | ||
| 1267 | + var tmp = dec.toString().split('.'); | ||
| 1268 | + | ||
| 1269 | + var deg = Math.abs(tmp[0]); | ||
| 1270 | + var min = ('0.' + (tmp[1] || 0))*60; | ||
| 1271 | + var sec = min.toString().split('.'); | ||
| 1272 | + | ||
| 1273 | + min = Math.floor(min); | ||
| 1274 | + sec = (('0.' + (sec[1] || 0)) * 60).toFixed(2); | ||
| 1275 | + | ||
| 1276 | + this.sexagesimal[dec] = (deg + '° ' + min + "' " + sec + '"'); | ||
| 1277 | + | ||
| 1278 | + return this.sexagesimal[dec]; | ||
| 1279 | + | ||
| 1280 | + }, | ||
| 1281 | + | ||
| 1282 | + | ||
| 1283 | + /** | ||
| 1284 | + * Converts a sexagesimal coordinate to decimal format | ||
| 1285 | + * | ||
| 1286 | + * @param float Sexagesimal coordinate | ||
| 1287 | + * @return string Decimal value (XX.XXXXXXXX) | ||
| 1288 | + */ | ||
| 1289 | + sexagesimal2decimal: function(sexagesimal) { | ||
| 1290 | + | ||
| 1291 | + if (sexagesimal in this.decimal) { | ||
| 1292 | + return this.decimal[sexagesimal]; | ||
| 1293 | + } | ||
| 1294 | + | ||
| 1295 | + var regEx = new RegExp(this.sexagesimalPattern); | ||
| 1296 | + var data = regEx.exec(sexagesimal); | ||
| 1297 | + var min = 0, sec = 0; | ||
| 1298 | + | ||
| 1299 | + if(data) { | ||
| 1300 | + min = parseFloat(data[2]/60); | ||
| 1301 | + sec = parseFloat(data[4]/3600) || 0; | ||
| 1302 | + } | ||
| 1303 | + | ||
| 1304 | + var dec = ((parseFloat(data[1]) + min + sec)).toFixed(8); | ||
| 1305 | + //var dec = ((parseFloat(data[1]) + min + sec)); | ||
| 1306 | + | ||
| 1307 | + // South and West are negative decimals | ||
| 1308 | + dec = (data[7] == 'S' || data[7] == 'W') ? parseFloat(-dec) : parseFloat(dec); | ||
| 1309 | + //dec = (data[7] == 'S' || data[7] == 'W') ? -dec : dec; | ||
| 1310 | + | ||
| 1311 | + this.decimal[sexagesimal] = dec; | ||
| 1312 | + | ||
| 1313 | + return dec; | ||
| 1314 | + | ||
| 1315 | + }, | ||
| 1316 | + | ||
| 1317 | + | ||
| 1318 | + /** | ||
| 1319 | + * Checks if a value is in decimal format | ||
| 1320 | + * | ||
| 1321 | + * @param string Value to be checked | ||
| 1322 | + * @return bool True if in sexagesimal format | ||
| 1323 | + */ | ||
| 1324 | + isDecimal: function(value) { | ||
| 1325 | + | ||
| 1326 | + value = value.toString().replace(/\s*/, ''); | ||
| 1327 | + | ||
| 1328 | + // looks silly but works as expected | ||
| 1329 | + // checks if value is in decimal format | ||
| 1330 | + return (!isNaN(parseFloat(value)) && parseFloat(value) == value); | ||
| 1331 | + | ||
| 1332 | + }, | ||
| 1333 | + | ||
| 1334 | + | ||
| 1335 | + /** | ||
| 1336 | + * Checks if a value is in sexagesimal format | ||
| 1337 | + * | ||
| 1338 | + * @param string Value to be checked | ||
| 1339 | + * @return bool True if in sexagesimal format | ||
| 1340 | + */ | ||
| 1341 | + isSexagesimal: function(value) { | ||
| 1342 | + | ||
| 1343 | + value = value.toString().replace(/\s*/, ''); | ||
| 1344 | + | ||
| 1345 | + return this.sexagesimalPattern.test(value); | ||
| 1346 | + | ||
| 1347 | + }, | ||
| 1348 | + | ||
| 1349 | + round: function(value, n) { | ||
| 1350 | + var decPlace = Math.pow(10, n); | ||
| 1351 | + return Math.round(value * decPlace)/decPlace; | ||
| 1352 | + } | ||
| 1353 | + | ||
| 1354 | + }); | ||
| 1355 | + | ||
| 1356 | + // Node module | ||
| 1357 | + if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { | ||
| 1358 | + | ||
| 1359 | + module.exports = geolib; | ||
| 1360 | + | ||
| 1361 | + // react native | ||
| 1362 | + if (typeof global === 'object') { | ||
| 1363 | + global.geolib = geolib; | ||
| 1364 | + } | ||
| 1365 | + | ||
| 1366 | + // AMD module | ||
| 1367 | + } else if (typeof define === "function" && define.amd) { | ||
| 1368 | + | ||
| 1369 | + define("geolib", [], function () { | ||
| 1370 | + return geolib; | ||
| 1371 | + }); | ||
| 1372 | + | ||
| 1373 | + // we're in a browser | ||
| 1374 | + } else { | ||
| 1375 | + | ||
| 1376 | + global.geolib = geolib; | ||
| 1377 | + | ||
| 1378 | + } | ||
| 1379 | + | ||
| 1380 | +}(this)); |
src/main/resources/static/real_control_v2/geolib/geolib.min.js
0 → 100644
| 1 | +/*! geolib 2.0.21 by Manuel Bieh | ||
| 2 | +* Library to provide geo functions like distance calculation, | ||
| 3 | +* conversion of decimal coordinates to sexagesimal and vice versa, etc. | ||
| 4 | +* WGS 84 (World Geodetic System 1984) | ||
| 5 | +* | ||
| 6 | +* @author Manuel Bieh | ||
| 7 | +* @url http://www.manuelbieh.com/ | ||
| 8 | +* @version 2.0.21 | ||
| 9 | +* @license MIT | ||
| 10 | +**/ | ||
| 11 | +!function(a,b){"use strict";function c(){}c.TO_RAD=Math.PI/180,c.TO_DEG=180/Math.PI,c.PI_X2=2*Math.PI,c.PI_DIV4=Math.PI/4;var d=Object.create(c.prototype,{version:{value:"2.0.21"},radius:{value:6378137},minLat:{value:-90},maxLat:{value:90},minLon:{value:-180},maxLon:{value:180},sexagesimalPattern:{value:/^([0-9]{1,3})°\s*([0-9]{1,3}(?:\.(?:[0-9]{1,2}))?)'\s*(([0-9]{1,3}(\.([0-9]{1,4}))?)"\s*)?([NEOSW]?)$/},measures:{value:Object.create(Object.prototype,{m:{value:1},km:{value:.001},cm:{value:100},mm:{value:1e3},mi:{value:1/1609.344},sm:{value:1/1852.216},ft:{value:100/30.48},"in":{value:100/2.54},yd:{value:1/.9144}})},prototype:{value:c.prototype},extend:{value:function(a,b){for(var c in a)("undefined"==typeof d.prototype[c]||b===!0)&&("function"==typeof a[c]&&"function"==typeof a[c].bind?d.prototype[c]=a[c].bind(d):d.prototype[c]=a[c])}}});"undefined"==typeof Number.prototype.toRad&&(Number.prototype.toRad=function(){return this*c.TO_RAD}),"undefined"==typeof Number.prototype.toDeg&&(Number.prototype.toDeg=function(){return this*c.TO_DEG}),d.extend({decimal:{},sexagesimal:{},distance:null,getKeys:function(a){if("[object Array]"==Object.prototype.toString.call(a))return{longitude:a.length>=1?0:b,latitude:a.length>=2?1:b,elevation:a.length>=3?2:b};var c=function(b){var c;return b.every(function(b){return"object"!=typeof a?!0:a.hasOwnProperty(b)?function(){return c=b,!1}():!0}),c},d=c(["lng","lon","longitude"]),e=c(["lat","latitude"]),f=c(["alt","altitude","elevation","elev"]);return"undefined"==typeof e&&"undefined"==typeof d&&"undefined"==typeof f?b:{latitude:e,longitude:d,elevation:f}},getLat:function(a,b){return b===!0?a[this.getKeys(a).latitude]:this.useDecimal(a[this.getKeys(a).latitude])},latitude:function(a){return this.getLat.call(this,a)},getLon:function(a,b){return b===!0?a[this.getKeys(a).longitude]:this.useDecimal(a[this.getKeys(a).longitude])},longitude:function(a){return this.getLon.call(this,a)},getElev:function(a){return a[this.getKeys(a).elevation]},elevation:function(a){return this.getElev.call(this,a)},coords:function(a,b){var c={latitude:b===!0?a[this.getKeys(a).latitude]:this.useDecimal(a[this.getKeys(a).latitude]),longitude:b===!0?a[this.getKeys(a).longitude]:this.useDecimal(a[this.getKeys(a).longitude])},d=a[this.getKeys(a).elevation];return"undefined"!=typeof d&&(c.elevation=d),c},ll:function(a,b){return this.coords.call(this,a,b)},validate:function(a){var b=this.getKeys(a);if("undefined"==typeof b||"undefined"==typeof b.latitude||"undefined"===b.longitude)return!1;var c=a[b.latitude],d=a[b.longitude];return"undefined"==typeof c||!this.isDecimal(c)&&!this.isSexagesimal(c)?!1:"undefined"==typeof d||!this.isDecimal(d)&&!this.isSexagesimal(d)?!1:(c=this.useDecimal(c),d=this.useDecimal(d),c<this.minLat||c>this.maxLat||d<this.minLon||d>this.maxLon?!1:!0)},getDistance:function(a,b,c,e){c=Math.floor(c)||1,e=Math.floor(e)||0;var f,g,h,i,j,k,l,m=this.coords(a),n=this.coords(b),o=6378137,p=6356752.314245,q=1/298.257223563,r=(n.longitude-m.longitude).toRad(),s=Math.atan((1-q)*Math.tan(parseFloat(m.latitude).toRad())),t=Math.atan((1-q)*Math.tan(parseFloat(n.latitude).toRad())),u=Math.sin(s),v=Math.cos(s),w=Math.sin(t),x=Math.cos(t),y=r,z=100;do{var A=Math.sin(y),B=Math.cos(y);if(k=Math.sqrt(x*A*(x*A)+(v*w-u*x*B)*(v*w-u*x*B)),0===k)return d.distance=0;f=u*w+v*x*B,g=Math.atan2(k,f),h=v*x*A/k,i=1-h*h,j=f-2*u*w/i,isNaN(j)&&(j=0);var C=q/16*i*(4+q*(4-3*i));l=y,y=r+(1-C)*q*h*(g+C*k*(j+C*f*(-1+2*j*j)))}while(Math.abs(y-l)>1e-12&&--z>0);if(0===z)return NaN;var D=i*(o*o-p*p)/(p*p),E=1+D/16384*(4096+D*(-768+D*(320-175*D))),F=D/1024*(256+D*(-128+D*(74-47*D))),G=F*k*(j+F/4*(f*(-1+2*j*j)-F/6*j*(-3+4*k*k)*(-3+4*j*j))),H=p*E*(g-G);if(H=H.toFixed(e),"undefined"!=typeof this.elevation(a)&&"undefined"!=typeof this.elevation(b)){var I=Math.abs(this.elevation(a)-this.elevation(b));H=Math.sqrt(H*H+I*I)}return this.distance=Math.round(H*Math.pow(10,e)/c)*c/Math.pow(10,e)},getDistanceSimple:function(a,b,c){c=Math.floor(c)||1;var e=Math.round(Math.acos(Math.sin(this.latitude(b).toRad())*Math.sin(this.latitude(a).toRad())+Math.cos(this.latitude(b).toRad())*Math.cos(this.latitude(a).toRad())*Math.cos(this.longitude(a).toRad()-this.longitude(b).toRad()))*this.radius);return d.distance=Math.floor(Math.round(e/c)*c)},getCenter:function(a){var b=a;if("object"==typeof a&&!(a instanceof Array)){b=[];for(var d in a)b.push(this.coords(a[d]))}if(!b.length)return!1;var e,f,g,h=0,i=0,j=0;b.forEach(function(a){e=this.latitude(a).toRad(),f=this.longitude(a).toRad(),h+=Math.cos(e)*Math.cos(f),i+=Math.cos(e)*Math.sin(f),j+=Math.sin(e)},this);var k=b.length;return h/=k,i/=k,j/=k,f=Math.atan2(i,h),g=Math.sqrt(h*h+i*i),e=Math.atan2(j,g),{latitude:(e*c.TO_DEG).toFixed(6),longitude:(f*c.TO_DEG).toFixed(6)}},getBounds:function(a){if(!a.length)return!1;var b=this.elevation(a[0]),c={maxLat:-(1/0),minLat:1/0,maxLng:-(1/0),minLng:1/0};"undefined"!=typeof b&&(c.maxElev=0,c.minElev=1/0);for(var d=0,e=a.length;e>d;++d)c.maxLat=Math.max(this.latitude(a[d]),c.maxLat),c.minLat=Math.min(this.latitude(a[d]),c.minLat),c.maxLng=Math.max(this.longitude(a[d]),c.maxLng),c.minLng=Math.min(this.longitude(a[d]),c.minLng),b&&(c.maxElev=Math.max(this.elevation(a[d]),c.maxElev),c.minElev=Math.min(this.elevation(a[d]),c.minElev));return c},getCenterOfBounds:function(a){var b=this.getBounds(a),c=b.minLat+(b.maxLat-b.minLat)/2,d=b.minLng+(b.maxLng-b.minLng)/2;return{latitude:parseFloat(c.toFixed(6)),longitude:parseFloat(d.toFixed(6))}},getBoundsOfDistance:function(a,b){var d,e,f=this.latitude(a),g=this.longitude(a),h=f.toRad(),i=g.toRad(),j=b/this.radius,k=h-j,l=h+j,m=this.maxLat.toRad(),n=this.minLat.toRad(),o=this.maxLon.toRad(),p=this.minLon.toRad();if(k>n&&m>l){var q=Math.asin(Math.sin(j)/Math.cos(h));d=i-q,p>d&&(d+=c.PI_X2),e=i+q,e>o&&(e-=c.PI_X2)}else k=Math.max(k,n),l=Math.min(l,m),d=p,e=o;return[{latitude:k.toDeg(),longitude:d.toDeg()},{latitude:l.toDeg(),longitude:e.toDeg()}]},isPointInside:function(a,b){for(var c=!1,d=-1,e=b.length,f=e-1;++d<e;f=d)(this.longitude(b[d])<=this.longitude(a)&&this.longitude(a)<this.longitude(b[f])||this.longitude(b[f])<=this.longitude(a)&&this.longitude(a)<this.longitude(b[d]))&&this.latitude(a)<(this.latitude(b[f])-this.latitude(b[d]))*(this.longitude(a)-this.longitude(b[d]))/(this.longitude(b[f])-this.longitude(b[d]))+this.latitude(b[d])&&(c=!c);return c},preparePolygonForIsPointInsideOptimized:function(a){for(var b=0,c=a.length-1;b<a.length;b++)this.longitude(a[c])===this.longitude(a[b])?(a[b].constant=this.latitude(a[b]),a[b].multiple=0):(a[b].constant=this.latitude(a[b])-this.longitude(a[b])*this.latitude(a[c])/(this.longitude(a[c])-this.longitude(a[b]))+this.longitude(a[b])*this.latitude(a[b])/(this.longitude(a[c])-this.longitude(a[b])),a[b].multiple=(this.latitude(a[c])-this.latitude(a[b]))/(this.longitude(a[c])-this.longitude(a[b]))),c=b},isPointInsideWithPreparedPolygon:function(a,b){for(var c=!1,d=this.longitude(a),e=this.latitude(a),f=0,g=b.length-1;f<b.length;f++)(this.longitude(b[f])<d&&this.longitude(b[g])>=d||this.longitude(b[g])<d&&this.longitude(b[f])>=d)&&(c^=d*b[f].multiple+b[f].constant<e),g=f;return c},isInside:function(){return this.isPointInside.apply(this,arguments)},isPointInCircle:function(a,b,c){return this.getDistance(a,b)<c},withinRadius:function(){return this.isPointInCircle.apply(this,arguments)},getRhumbLineBearing:function(a,b){var d=this.longitude(b).toRad()-this.longitude(a).toRad(),e=Math.log(Math.tan(this.latitude(b).toRad()/2+c.PI_DIV4)/Math.tan(this.latitude(a).toRad()/2+c.PI_DIV4));return Math.abs(d)>Math.PI&&(d=d>0?-1*(c.PI_X2-d):c.PI_X2+d),(Math.atan2(d,e).toDeg()+360)%360},getBearing:function(a,b){b.latitude=this.latitude(b),b.longitude=this.longitude(b),a.latitude=this.latitude(a),a.longitude=this.longitude(a);var c=(Math.atan2(Math.sin(b.longitude.toRad()-a.longitude.toRad())*Math.cos(b.latitude.toRad()),Math.cos(a.latitude.toRad())*Math.sin(b.latitude.toRad())-Math.sin(a.latitude.toRad())*Math.cos(b.latitude.toRad())*Math.cos(b.longitude.toRad()-a.longitude.toRad())).toDeg()+360)%360;return c},getCompassDirection:function(a,b,c){var d,e;switch(e="circle"==c?this.getBearing(a,b):this.getRhumbLineBearing(a,b),Math.round(e/22.5)){case 1:d={exact:"NNE",rough:"N"};break;case 2:d={exact:"NE",rough:"N"};break;case 3:d={exact:"ENE",rough:"E"};break;case 4:d={exact:"E",rough:"E"};break;case 5:d={exact:"ESE",rough:"E"};break;case 6:d={exact:"SE",rough:"E"};break;case 7:d={exact:"SSE",rough:"S"};break;case 8:d={exact:"S",rough:"S"};break;case 9:d={exact:"SSW",rough:"S"};break;case 10:d={exact:"SW",rough:"S"};break;case 11:d={exact:"WSW",rough:"W"};break;case 12:d={exact:"W",rough:"W"};break;case 13:d={exact:"WNW",rough:"W"};break;case 14:d={exact:"NW",rough:"W"};break;case 15:d={exact:"NNW",rough:"N"};break;default:d={exact:"N",rough:"N"}}return d.bearing=e,d},getDirection:function(a,b,c){return this.getCompassDirection.apply(this,arguments)},orderByDistance:function(a,b){var c=[];for(var d in b){var e=this.getDistance(a,b[d]),f=Object.create(b[d]);f.distance=e,f.key=d,c.push(f)}return c.sort(function(a,b){return a.distance-b.distance})},isPointInLine:function(a,b,c){return(this.getDistance(b,a,1,3)+this.getDistance(a,c,1,3)).toFixed(3)==this.getDistance(b,c,1,3)},isPointNearLine:function(a,b,c,d){return this.getDistanceFromLine(a,b,c)<d},getDistanceFromLine:function(a,b,c){var d=this.getDistance(b,a,1,3),e=this.getDistance(a,c,1,3),f=this.getDistance(b,c,1,3),g=0,h=Math.acos((d*d+f*f-e*e)/(2*d*f)),i=Math.acos((e*e+f*f-d*d)/(2*e*f));return g=h>Math.PI/2?d:i>Math.PI/2?e:Math.sin(h)*d},findNearest:function(a,b,c,d){c=c||0,d=d||1;var e=this.orderByDistance(a,b);return 1===d?e[c]:e.splice(c,d)},getPathLength:function(a){for(var b,c=0,d=0,e=a.length;e>d;++d)b&&(c+=this.getDistance(this.coords(a[d]),b)),b=this.coords(a[d]);return c},getSpeed:function(a,b,c){var e=c&&c.unit||"km";"mph"==e?e="mi":"kmh"==e&&(e="km");var f=d.getDistance(a,b),g=1*b.time/1e3-1*a.time/1e3,h=f/g*3600,i=Math.round(h*this.measures[e]*1e4)/1e4;return i},computeDestinationPoint:function(a,b,c,d){var e=this.latitude(a),f=this.longitude(a);d="undefined"==typeof d?this.radius:Number(d);var g=Number(b)/d,h=Number(c).toRad(),i=Number(e).toRad(),j=Number(f).toRad(),k=Math.asin(Math.sin(i)*Math.cos(g)+Math.cos(i)*Math.sin(g)*Math.cos(h)),l=j+Math.atan2(Math.sin(h)*Math.sin(g)*Math.cos(i),Math.cos(g)-Math.sin(i)*Math.sin(k));return l=(l+3*Math.PI)%(2*Math.PI)-Math.PI,{latitude:k.toDeg(),longitude:l.toDeg()}},convertUnit:function(a,b,c){if(0===b)return 0;if("undefined"==typeof b){if(null===this.distance)throw new Error("No distance was given");if(0===this.distance)return 0;b=this.distance}if(a=a||"m",c=null==c?4:c,"undefined"!=typeof this.measures[a])return this.round(b*this.measures[a],c);throw new Error("Unknown unit for conversion.")},useDecimal:function(a){if("[object Array]"===Object.prototype.toString.call(a)){var b=this;return a=a.map(function(a){if(b.isDecimal(a))return b.useDecimal(a);if("object"==typeof a){if(b.validate(a))return b.coords(a);for(var c in a)a[c]=b.useDecimal(a[c]);return a}return b.isSexagesimal(a)?b.sexagesimal2decimal(a):a})}if("object"==typeof a&&this.validate(a))return this.coords(a);if("object"==typeof a){for(var c in a)a[c]=this.useDecimal(a[c]);return a}if(this.isDecimal(a))return parseFloat(a);if(this.isSexagesimal(a)===!0)return parseFloat(this.sexagesimal2decimal(a));throw new Error("Unknown format.")},decimal2sexagesimal:function(a){if(a in this.sexagesimal)return this.sexagesimal[a];var b=a.toString().split("."),c=Math.abs(b[0]),d=60*("0."+(b[1]||0)),e=d.toString().split(".");return d=Math.floor(d),e=(60*("0."+(e[1]||0))).toFixed(2),this.sexagesimal[a]=c+"° "+d+"' "+e+'"',this.sexagesimal[a]},sexagesimal2decimal:function(a){if(a in this.decimal)return this.decimal[a];var b=new RegExp(this.sexagesimalPattern),c=b.exec(a),d=0,e=0;c&&(d=parseFloat(c[2]/60),e=parseFloat(c[4]/3600)||0);var f=(parseFloat(c[1])+d+e).toFixed(8);return f="S"==c[7]||"W"==c[7]?parseFloat(-f):parseFloat(f),this.decimal[a]=f,f},isDecimal:function(a){return a=a.toString().replace(/\s*/,""),!isNaN(parseFloat(a))&&parseFloat(a)==a},isSexagesimal:function(a){return a=a.toString().replace(/\s*/,""),this.sexagesimalPattern.test(a)},round:function(a,b){var c=Math.pow(10,b);return Math.round(a*c)/c}}),"undefined"!=typeof module&&"undefined"!=typeof module.exports?(module.exports=d,"object"==typeof a&&(a.geolib=d)):"function"==typeof define&&define.amd?define("geolib",[],function(){return d}):a.geolib=d}(this); | ||
| 0 | \ No newline at end of file | 12 | \ No newline at end of file |
src/main/resources/static/real_control_v2/js/common.js
| @@ -124,8 +124,8 @@ var gb_common = (function () { | @@ -124,8 +124,8 @@ var gb_common = (function () { | ||
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | var get_device_tree_data = function (allGps, idBefore) { | 126 | var get_device_tree_data = function (allGps, idBefore) { |
| 127 | - if(!idBefore) | ||
| 128 | - idBefore=''; | 127 | + if (!idBefore) |
| 128 | + idBefore = ''; | ||
| 129 | var treeData = []; | 129 | var treeData = []; |
| 130 | //var data = groupBy(get_vals(gb_data_gps.allGps), 'lineId'); | 130 | //var data = groupBy(get_vals(gb_data_gps.allGps), 'lineId'); |
| 131 | var data = groupBy(get_vals(allGps), 'lineId'); | 131 | var data = groupBy(get_vals(allGps), 'lineId'); |
| @@ -135,28 +135,28 @@ var gb_common = (function () { | @@ -135,28 +135,28 @@ var gb_common = (function () { | ||
| 135 | data[name] = groupBy(data[code], 'upDown'); | 135 | data[name] = groupBy(data[code], 'upDown'); |
| 136 | treeData.push({ | 136 | treeData.push({ |
| 137 | 'text': name, | 137 | 'text': name, |
| 138 | - 'a_attr': {'type': 'line', 'id': idBefore+'line_'+code}, | 138 | + 'a_attr': {'type': 'line', 'id': idBefore + 'line_' + code}, |
| 139 | 'children': [{ | 139 | 'children': [{ |
| 140 | 'text': '上行', | 140 | 'text': '上行', |
| 141 | - 'children': grabs(data[name][0]), | 141 | + 'children': grabs(data[name][0], idBefore), |
| 142 | 'a_attr': { | 142 | 'a_attr': { |
| 143 | 'type': 'route', | 143 | 'type': 'route', |
| 144 | 'route': code + '_0', | 144 | 'route': code + '_0', |
| 145 | - 'id': idBefore+'route_' + code + '_0' | 145 | + 'id': idBefore + 'route_' + code + '_0' |
| 146 | } | 146 | } |
| 147 | }, { | 147 | }, { |
| 148 | 'text': '下行', | 148 | 'text': '下行', |
| 149 | - 'children': grabs(data[name][1]), | 149 | + 'children': grabs(data[name][1], idBefore), |
| 150 | 'a_attr': { | 150 | 'a_attr': { |
| 151 | 'type': 'route', | 151 | 'type': 'route', |
| 152 | 'route': code + '_1', | 152 | 'route': code + '_1', |
| 153 | - 'id': idBefore+'route_' + code + '_1' | 153 | + 'id': idBefore + 'route_' + code + '_1' |
| 154 | } | 154 | } |
| 155 | }] | 155 | }] |
| 156 | }); | 156 | }); |
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | - function grabs(array) { | 159 | + function grabs(array, idBefore) { |
| 160 | if (!array) | 160 | if (!array) |
| 161 | return; | 161 | return; |
| 162 | var rs = []; | 162 | var rs = []; |
| @@ -165,7 +165,8 @@ var gb_common = (function () { | @@ -165,7 +165,8 @@ var gb_common = (function () { | ||
| 165 | 'text': this.nbbm, | 165 | 'text': this.nbbm, |
| 166 | 'a_attr': { | 166 | 'a_attr': { |
| 167 | 'type': 'device', | 167 | 'type': 'device', |
| 168 | - 'device': this.deviceId | 168 | + 'device': this.deviceId, |
| 169 | + 'id': idBefore + 'device_' + this.nbbm | ||
| 169 | }, | 170 | }, |
| 170 | 'data': {lineId: this.lineId, upDown: this.upDown}, | 171 | 'data': {lineId: this.lineId, upDown: this.upDown}, |
| 171 | 'icon': 'uk-icon-bus' | 172 | 'icon': 'uk-icon-bus' |
src/main/resources/static/real_control_v2/js/data/data_gps.js
| @@ -15,11 +15,23 @@ var gb_data_gps = (function() { | @@ -15,11 +15,23 @@ var gb_data_gps = (function() { | ||
| 15 | }; | 15 | }; |
| 16 | 16 | ||
| 17 | var refresh = function(cb) { | 17 | var refresh = function(cb) { |
| 18 | - $.get('/gps/real/line', { | 18 | + /*$.get('/gps/real/line', { |
| 19 | lineCodes: gb_data_basic.line_idx | 19 | lineCodes: gb_data_basic.line_idx |
| 20 | }, function(rs) { | 20 | }, function(rs) { |
| 21 | refreshData(rs); | 21 | refreshData(rs); |
| 22 | cb(); | 22 | cb(); |
| 23 | + });*/ | ||
| 24 | + $.ajax({ | ||
| 25 | + url: '/gps/real/line', | ||
| 26 | + data:{lineCodes: gb_data_basic.line_idx}, | ||
| 27 | + success: function (rs) { | ||
| 28 | + refreshData(rs); | ||
| 29 | + cb(); | ||
| 30 | + }, | ||
| 31 | + error: function (xr, t) { | ||
| 32 | + notify_err('刷新GPS失败,稍后重试' + t); | ||
| 33 | + cb(); | ||
| 34 | + } | ||
| 23 | }); | 35 | }); |
| 24 | }; | 36 | }; |
| 25 | 37 |
src/main/resources/static/real_control_v2/js/line_schedule/sch_table.js
| @@ -68,11 +68,42 @@ var gb_schedule_table = (function() { | @@ -68,11 +68,42 @@ var gb_schedule_table = (function() { | ||
| 68 | fcsjActualCellQtip(); | 68 | fcsjActualCellQtip(); |
| 69 | cb && cb(); | 69 | cb && cb(); |
| 70 | }); | 70 | }); |
| 71 | - } | 71 | + }; |
| 72 | 72 | ||
| 73 | function fcsjActualCellQtip(){ | 73 | function fcsjActualCellQtip(){ |
| 74 | //单击实发单元格显示详细信息 | 74 | //单击实发单元格显示详细信息 |
| 75 | - $('dd.fcsjActualCell').qtip({ | 75 | + $(document).on('click', 'dd.fcsjActualCell', function () { |
| 76 | + var that=this; | ||
| 77 | + $(that).qtip({ | ||
| 78 | + show: true, | ||
| 79 | + content: { | ||
| 80 | + text: function(e) { | ||
| 81 | + var lineCode=$(that).parents('li.line_schedule').data('id') | ||
| 82 | + ,id=$(that).parents('dl').data('id') | ||
| 83 | + ,sch=line2Schedule[lineCode][id]; | ||
| 84 | + return temps['sfsj_sch-detail-temp'](sch); | ||
| 85 | + } | ||
| 86 | + } | ||
| 87 | + ,style: { | ||
| 88 | + classes: 'qtip-dark qtip-rounded qtip-shadow' | ||
| 89 | + }, | ||
| 90 | + hide: { | ||
| 91 | + fixed: true, | ||
| 92 | + delay: 300 | ||
| 93 | + }, | ||
| 94 | + position: { | ||
| 95 | + target: that, | ||
| 96 | + my: 'center left', | ||
| 97 | + at: 'center right' | ||
| 98 | + }, | ||
| 99 | + events: { | ||
| 100 | + hidden: function (event, api) { | ||
| 101 | + $(this).qtip('destroy', true); | ||
| 102 | + } | ||
| 103 | + } | ||
| 104 | + }); | ||
| 105 | + }); | ||
| 106 | +/* $('dd.fcsjActualCell').qtip({ | ||
| 76 | show: 'click', | 107 | show: 'click', |
| 77 | content: { | 108 | content: { |
| 78 | text: function(e) { | 109 | text: function(e) { |
| @@ -92,8 +123,13 @@ var gb_schedule_table = (function() { | @@ -92,8 +123,13 @@ var gb_schedule_table = (function() { | ||
| 92 | position: { | 123 | position: { |
| 93 | my: 'center left', | 124 | my: 'center left', |
| 94 | at: 'center right' | 125 | at: 'center right' |
| 126 | + }, | ||
| 127 | + events: { | ||
| 128 | + hidden: function (event, api) { | ||
| 129 | + $(this).qtip('destroy', true); | ||
| 130 | + } | ||
| 95 | } | 131 | } |
| 96 | - }); | 132 | + });*/ |
| 97 | } | 133 | } |
| 98 | 134 | ||
| 99 | //重置序号 | 135 | //重置序号 |
src/main/resources/static/real_control_v2/js/main.js
| @@ -59,6 +59,8 @@ var gb_main_ep = new EventProxy(), | @@ -59,6 +59,8 @@ var gb_main_ep = new EventProxy(), | ||
| 59 | 59 | ||
| 60 | //嵌入地图页面 | 60 | //嵌入地图页面 |
| 61 | $('li.map-panel','#main-tab-content').load('/real_control_v2/mapmonitor/real.html'); | 61 | $('li.map-panel','#main-tab-content').load('/real_control_v2/mapmonitor/real.html'); |
| 62 | + | ||
| 63 | + showUpdateDescription(); | ||
| 62 | }); | 64 | }); |
| 63 | 65 | ||
| 64 | function g_emit(id) { | 66 | function g_emit(id) { |
| @@ -73,6 +75,17 @@ var gb_main_ep = new EventProxy(), | @@ -73,6 +75,17 @@ var gb_main_ep = new EventProxy(), | ||
| 73 | //modal hide remove dom | 75 | //modal hide remove dom |
| 74 | $(document).on('hide.uk.modal', '.uk-modal', function() { | 76 | $(document).on('hide.uk.modal', '.uk-modal', function() { |
| 75 | $(this).remove(); | 77 | $(this).remove(); |
| 78 | +/* //如果modal内部存在context-menu,则注销 | ||
| 79 | + var ctx = $('.context-menu-item', this); | ||
| 80 | + debugger | ||
| 81 | + if(ctx.length > 0){ | ||
| 82 | + //ctx.contextMenu('destroy'); | ||
| 83 | + $.contextMenu('destroy', ctx); | ||
| 84 | + }*/ | ||
| 85 | +}); | ||
| 86 | + | ||
| 87 | +$(document).on('click', '.ct-bottom-drawer-close', function () { | ||
| 88 | + $(this).parent().removeClass('open'); | ||
| 76 | }); | 89 | }); |
| 77 | 90 | ||
| 78 | function connectArr(arr, separator, transFun) { | 91 | function connectArr(arr, separator, transFun) { |
| @@ -178,3 +191,27 @@ var open_modal = function(pageUrl, data, opt) { | @@ -178,3 +191,27 @@ var open_modal = function(pageUrl, data, opt) { | ||
| 178 | $(id).trigger('init', data); | 191 | $(id).trigger('init', data); |
| 179 | }); | 192 | }); |
| 180 | }; | 193 | }; |
| 194 | + | ||
| 195 | + | ||
| 196 | +function showUpdateDescription() { | ||
| 197 | + //更新说明 | ||
| 198 | + var updateDescription={ | ||
| 199 | + date: '2016-12-11', | ||
| 200 | + text: '<h5>1、电子路单单击“实发”时,tootip内的人员显示工号。</h5><h5>2、修复某些情况下,班次被操作后 点击“实发” 无法显示tootip的情况。</h5><h5>3、获取GPS数据失败时,页面会弹出提示,并等待7秒后尝试再次获取。</h5>' | ||
| 201 | + }; | ||
| 202 | + | ||
| 203 | + var storage = window.localStorage | ||
| 204 | + ,key = 'update_' + updateDescription.date; | ||
| 205 | + var text = storage.getItem(key); | ||
| 206 | + if(!text){ | ||
| 207 | + var modal = '<div class="uk-modal" id="update-description-modal">'+ | ||
| 208 | + ' <div class="uk-modal-dialog">'+ | ||
| 209 | + ' <a class="uk-modal-close uk-close"></a>'+ | ||
| 210 | + ' <div class="uk-modal-header">'+ | ||
| 211 | + ' <h2>'+updateDescription.date+' 更新说明</h2></div>'+updateDescription.text+ | ||
| 212 | + ' </div>'; | ||
| 213 | + | ||
| 214 | + show_modal('#update-description-modal', modal); | ||
| 215 | + storage.setItem(key, updateDescription.text); | ||
| 216 | + } | ||
| 217 | +} | ||
| 181 | \ No newline at end of file | 218 | \ No newline at end of file |
src/main/resources/static/real_control_v2/js/utils/svg_chart_tooltip.js
| @@ -52,15 +52,17 @@ var gb_svg_tooltip = (function () { | @@ -52,15 +52,17 @@ var gb_svg_tooltip = (function () { | ||
| 52 | //multiple gps tooltip | 52 | //multiple gps tooltip |
| 53 | $(document).on('mouseenter', 'svg .merge-item rect', function () { | 53 | $(document).on('mouseenter', 'svg .merge-item rect', function () { |
| 54 | var rect = $(this); | 54 | var rect = $(this); |
| 55 | - if (rect.attr('aria-describedby')) | ||
| 56 | - return; | 55 | + //console.log('111', rect,rect.attr('aria-describedby')); |
| 56 | + /*if (rect.attr('aria-describedby')) | ||
| 57 | + return;*/ | ||
| 57 | // var gps = gb_data_gps.findOne($(this).attr('_id').split('_')[1]); | 58 | // var gps = gb_data_gps.findOne($(this).attr('_id').split('_')[1]); |
| 59 | + | ||
| 60 | + $('.qtip-multi-gps').qtip('destroy', true); | ||
| 58 | //获取聚合的gps | 61 | //获取聚合的gps |
| 59 | var lineCode = $(this).parents('svg').data('code') | 62 | var lineCode = $(this).parents('svg').data('code') |
| 60 | , stop = $(this).parent().attr('_id').substr(7)//merger_ | 63 | , stop = $(this).parent().attr('_id').substr(7)//merger_ |
| 61 | , gpsArray = searchByStop(gb_data_gps.gpsByLineCode(lineCode), stop); | 64 | , gpsArray = searchByStop(gb_data_gps.gpsByLineCode(lineCode), stop); |
| 62 | 65 | ||
| 63 | - // console.log('stop...',stop); | ||
| 64 | $(this).qtip({ | 66 | $(this).qtip({ |
| 65 | show: { | 67 | show: { |
| 66 | ready: true, | 68 | ready: true, |
src/main/resources/static/real_control_v2/main.html
| @@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
| 9 | <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/notify.gradient.min.css" /> | 9 | <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/notify.gradient.min.css" /> |
| 10 | <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/tooltip.gradient.min.css" /> | 10 | <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/tooltip.gradient.min.css" /> |
| 11 | <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/autocomplete.gradient.min.css" /> | 11 | <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/autocomplete.gradient.min.css" /> |
| 12 | - <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/slider.gradient.min.css" /> | 12 | + <!--<link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/slider.gradient.min.css" />--> |
| 13 | 13 | ||
| 14 | <!-- main style --> | 14 | <!-- main style --> |
| 15 | <link rel="stylesheet" href="/real_control_v2/css/main.css" /> | 15 | <link rel="stylesheet" href="/real_control_v2/css/main.css" /> |
| @@ -31,6 +31,7 @@ | @@ -31,6 +31,7 @@ | ||
| 31 | <!-- tooltip css--> | 31 | <!-- tooltip css--> |
| 32 | <link rel="stylesheet" href="/real_control_v2/assets/plugins/qtip/jquery.qtip.min.css" /> | 32 | <link rel="stylesheet" href="/real_control_v2/assets/plugins/qtip/jquery.qtip.min.css" /> |
| 33 | 33 | ||
| 34 | + <link rel="stylesheet" href="/real_control_v2/css/pace.css" /> | ||
| 34 | </head> | 35 | </head> |
| 35 | 36 | ||
| 36 | <body> | 37 | <body> |
| @@ -86,7 +87,7 @@ | @@ -86,7 +87,7 @@ | ||
| 86 | <script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/pagination.min.js"></script> | 87 | <script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/pagination.min.js"></script> |
| 87 | <script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/tooltip.min.js"></script> | 88 | <script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/tooltip.min.js"></script> |
| 88 | <script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/autocomplete.min.js"></script> | 89 | <script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/autocomplete.min.js"></script> |
| 89 | - <script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/slider.min.js"></script> | 90 | + <!--<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/slider.min.js"></script>--> |
| 90 | <!-- jquery contextMenu --> | 91 | <!-- jquery contextMenu --> |
| 91 | <script src="/real_control_v2/assets/js/jquery.contextMenu.min.js"></script> | 92 | <script src="/real_control_v2/assets/js/jquery.contextMenu.min.js"></script> |
| 92 | <script src="/real_control_v2/assets/js/jquery.ui.position.min.js"></script> | 93 | <script src="/real_control_v2/assets/js/jquery.ui.position.min.js"></script> |
| @@ -138,6 +139,8 @@ | @@ -138,6 +139,8 @@ | ||
| 138 | 139 | ||
| 139 | <!-- echart --> | 140 | <!-- echart --> |
| 140 | <script src="/real_control_v2/assets/echarts-3/echarts.js"></script> | 141 | <script src="/real_control_v2/assets/echarts-3/echarts.js"></script> |
| 142 | + <!-- Geolib --> | ||
| 143 | + <script src="/real_control_v2/geolib/geolib.js"></script> | ||
| 141 | </body> | 144 | </body> |
| 142 | 145 | ||
| 143 | </html> | 146 | </html> |
src/main/resources/static/real_control_v2/mapmonitor/css/real.css
| @@ -113,8 +113,17 @@ input[type=checkbox].disabled{ | @@ -113,8 +113,17 @@ input[type=checkbox].disabled{ | ||
| 113 | width: 240px; | 113 | width: 240px; |
| 114 | right: 327px; | 114 | right: 327px; |
| 115 | padding-left: 20px; | 115 | padding-left: 20px; |
| 116 | + transition: all .07s linear; | ||
| 116 | } | 117 | } |
| 117 | 118 | ||
| 119 | +.real_bottom_panel .telescopic{ | ||
| 120 | + position: absolute; | ||
| 121 | + top: 4px; | ||
| 122 | + right: 7px; | ||
| 123 | + color: #827f7f; | ||
| 124 | + cursor: pointer; | ||
| 125 | + font-size: 16px; | ||
| 126 | +} | ||
| 118 | 127 | ||
| 119 | .real_right_gps_panel>form{ | 128 | .real_right_gps_panel>form{ |
| 120 | text-align: center; | 129 | text-align: center; |
| @@ -180,7 +189,7 @@ input[type=checkbox].disabled{ | @@ -180,7 +189,7 @@ input[type=checkbox].disabled{ | ||
| 180 | width: 100%; | 189 | width: 100%; |
| 181 | height: 100%; | 190 | height: 100%; |
| 182 | height: calc(100% - 7px); | 191 | height: calc(100% - 7px); |
| 183 | - overflow: auto; | 192 | + overflow: hidden; |
| 184 | padding-top: 7px; | 193 | padding-top: 7px; |
| 185 | font-size: 13px; | 194 | font-size: 13px; |
| 186 | position: relative; | 195 | position: relative; |
src/main/resources/static/real_control_v2/mapmonitor/js/gps_tree.js
| @@ -7,7 +7,7 @@ var gb_map_gps_tree = (function () { | @@ -7,7 +7,7 @@ var gb_map_gps_tree = (function () { | ||
| 7 | var jstreeChanged = function (e, node, event) { | 7 | var jstreeChanged = function (e, node, event) { |
| 8 | gb_map_overlay_mge.refresh(); | 8 | gb_map_overlay_mge.refresh(); |
| 9 | }; | 9 | }; |
| 10 | - | 10 | + |
| 11 | var init = function (cb) { | 11 | var init = function (cb) { |
| 12 | var allGps = gb_data_gps.allGps; | 12 | var allGps = gb_data_gps.allGps; |
| 13 | _devices = gb_common.get_keys(allGps); | 13 | _devices = gb_common.get_keys(allGps); |
src/main/resources/static/real_control_v2/mapmonitor/js/map/platform/baidu.js
| @@ -73,20 +73,35 @@ var gb_map_baidu = (function(){ | @@ -73,20 +73,35 @@ var gb_map_baidu = (function(){ | ||
| 73 | if(polylines[opt.id]) | 73 | if(polylines[opt.id]) |
| 74 | return; | 74 | return; |
| 75 | 75 | ||
| 76 | - var pos = [], temps; | ||
| 77 | - var route = opt.upDown==0?opt.route.up:opt.route.down; | 76 | + var pos, temps; |
| 77 | + var route = opt.upDown==0?opt.route.up_bd:opt.route.down_bd; | ||
| 78 | + var polyline, _pLines=[]; | ||
| 79 | + $.each(route, function (i, item) { | ||
| 80 | + | ||
| 81 | + pos = []; | ||
| 82 | + $.each(item.split(','), function () { | ||
| 83 | + temps = this.split(' '); | ||
| 84 | + pos.push(new BMap.Point(temps[0], temps[1])); | ||
| 85 | + }); | ||
| 86 | + polyline = new BMap.Polyline(pos, opt.style); | ||
| 87 | + map.addOverlay(polyline); | ||
| 88 | + _pLines.push(polyline); | ||
| 89 | + | ||
| 90 | + }); | ||
| 78 | 91 | ||
| 79 | - $.each(route.split(','), function(){ | 92 | + //根据ID保存映射 |
| 93 | + polylines[opt.id]=_pLines; | ||
| 94 | + /*$.each(route.split(','), function(){ | ||
| 80 | temps = this.split(' '); | 95 | temps = this.split(' '); |
| 81 | pos.push(new BMap.Point(temps[0], temps[1])); | 96 | pos.push(new BMap.Point(temps[0], temps[1])); |
| 82 | - }); | 97 | + });*/ |
| 83 | 98 | ||
| 84 | - var polyline = new BMap.Polyline(pos, opt.style); | 99 | + /*var polyline = new BMap.Polyline(pos, opt.style); |
| 85 | //根据ID保存映射 | 100 | //根据ID保存映射 |
| 86 | polylines[opt.id]=polyline; | 101 | polylines[opt.id]=polyline; |
| 87 | if(opt.hide) | 102 | if(opt.hide) |
| 88 | polyline.hide(); | 103 | polyline.hide(); |
| 89 | - map.addOverlay(polyline); | 104 | + map.addOverlay(polyline);*/ |
| 90 | 105 | ||
| 91 | //延迟居中,避免多次调用时抖动 | 106 | //延迟居中,避免多次调用时抖动 |
| 92 | //delayToCenter(pos[parseInt(pos.length / 2)]); | 107 | //delayToCenter(pos[parseInt(pos.length / 2)]); |
| @@ -102,16 +117,24 @@ var gb_map_baidu = (function(){ | @@ -102,16 +117,24 @@ var gb_map_baidu = (function(){ | ||
| 102 | refreshPolyline: function (opt) { | 117 | refreshPolyline: function (opt) { |
| 103 | var idx = opt.idx; | 118 | var idx = opt.idx; |
| 104 | for(var id in polylines){ | 119 | for(var id in polylines){ |
| 105 | - if(idx.indexOf(id) != -1) | ||
| 106 | - polylines[id].show(); | ||
| 107 | - else | ||
| 108 | - polylines[id].hide(); | 120 | + if(idx.indexOf(id) != -1){ |
| 121 | + $.each(polylines[id], function () { | ||
| 122 | + this.show(); | ||
| 123 | + }) | ||
| 124 | + } | ||
| 125 | + else{ | ||
| 126 | + $.each(polylines[id], function () { | ||
| 127 | + this.hide(); | ||
| 128 | + }) | ||
| 129 | + } | ||
| 109 | } | 130 | } |
| 110 | }, | 131 | }, |
| 111 | //定位到线路中间点 | 132 | //定位到线路中间点 |
| 112 | centerToLine: function (opt) { | 133 | centerToLine: function (opt) { |
| 113 | - var pos=polylines[opt.id].getPath(); | ||
| 114 | - delayToCenter(pos[parseInt(pos.length / 2)]); | 134 | + var _pLines = polylines[opt.id]; |
| 135 | + delayToCenter(_pLines[parseInt(_pLines.length/2)].getPath()[0]); | ||
| 136 | + //var pos=polylines[opt.id].getPath(); | ||
| 137 | + //delayToCenter(pos[parseInt(pos.length / 2)]); | ||
| 115 | }, | 138 | }, |
| 116 | //绘制GPS信号 | 139 | //绘制GPS信号 |
| 117 | drawRealGpsMarker: function(opts){ | 140 | drawRealGpsMarker: function(opts){ |
src/main/resources/static/real_control_v2/mapmonitor/js/map/platform/gaode.js
| @@ -83,8 +83,31 @@ var gb_map_gaode = (function() { | @@ -83,8 +83,31 @@ var gb_map_gaode = (function() { | ||
| 83 | map.clearMap(); | 83 | map.clearMap(); |
| 84 | }, | 84 | }, |
| 85 | drawLine: function(opt){ | 85 | drawLine: function(opt){ |
| 86 | - //linePolyline = []; | ||
| 87 | - var pos = [], temps; | 86 | + if(polylines[opt.id]) |
| 87 | + return; | ||
| 88 | + | ||
| 89 | + var pos, temps; | ||
| 90 | + var route = opt.upDown==0?opt.route.up_gcj:opt.route.down_gcj; | ||
| 91 | + | ||
| 92 | + var polyline, _pLines=[]; | ||
| 93 | + $.each(route, function (i, item) { | ||
| 94 | + | ||
| 95 | + pos = []; | ||
| 96 | + $.each(item.split(','), function () { | ||
| 97 | + temps = this.split(' '); | ||
| 98 | + pos.push([temps[0], temps[1]]); | ||
| 99 | + }); | ||
| 100 | + | ||
| 101 | + opt.style.path=pos; | ||
| 102 | + var polyline = new AMap.Polyline(opt.style); | ||
| 103 | + polyline.setMap(map); | ||
| 104 | + | ||
| 105 | + _pLines.push(polyline); | ||
| 106 | + }); | ||
| 107 | + | ||
| 108 | + polylines[opt.id]=_pLines; | ||
| 109 | + | ||
| 110 | + /*var pos = [], temps; | ||
| 88 | var route = opt.upDown==0?opt.route.up_gcj:opt.route.down_gcj; | 111 | var route = opt.upDown==0?opt.route.up_gcj:opt.route.down_gcj; |
| 89 | 112 | ||
| 90 | $.each(route.split(','), function(){ | 113 | $.each(route.split(','), function(){ |
| @@ -99,21 +122,30 @@ var gb_map_gaode = (function() { | @@ -99,21 +122,30 @@ var gb_map_gaode = (function() { | ||
| 99 | if(opt.hide) | 122 | if(opt.hide) |
| 100 | polyline.hide(); | 123 | polyline.hide(); |
| 101 | 124 | ||
| 102 | - polyline.setMap(map); | 125 | + polyline.setMap(map);*/ |
| 103 | }, | 126 | }, |
| 104 | //定位到线路中间点 | 127 | //定位到线路中间点 |
| 105 | centerToLine: function (opt) { | 128 | centerToLine: function (opt) { |
| 106 | - var pos=polylines[opt.id].getPath(); | ||
| 107 | - map.setCenter(pos[parseInt(pos.length / 2)]); | 129 | + //var pos=polylines[opt.id].getPath(); |
| 130 | + //map.setCenter(pos[parseInt(pos.length / 2)]); | ||
| 131 | + | ||
| 132 | + var _pLines = polylines[opt.id]; | ||
| 133 | + map.setCenter(_pLines[parseInt(_pLines.length/2)].getPath()[0]); | ||
| 108 | }, | 134 | }, |
| 109 | //根据id 显示polyline | 135 | //根据id 显示polyline |
| 110 | refreshPolyline: function (opt) { | 136 | refreshPolyline: function (opt) { |
| 111 | var idx = opt.idx; | 137 | var idx = opt.idx; |
| 112 | for(var id in polylines){ | 138 | for(var id in polylines){ |
| 113 | - if(idx.indexOf(id) != -1) | ||
| 114 | - polylines[id].show(); | ||
| 115 | - else | ||
| 116 | - polylines[id].hide(); | 139 | + if(idx.indexOf(id) != -1){ |
| 140 | + $.each(polylines[id], function () { | ||
| 141 | + this.show(); | ||
| 142 | + }) | ||
| 143 | + } | ||
| 144 | + else{ | ||
| 145 | + $.each(polylines[id], function () { | ||
| 146 | + this.hide(); | ||
| 147 | + }) | ||
| 148 | + } | ||
| 117 | } | 149 | } |
| 118 | }, | 150 | }, |
| 119 | drawStationMarker: function (opt) { | 151 | drawStationMarker: function (opt) { |
| @@ -332,7 +364,6 @@ var gb_map_gaode = (function() { | @@ -332,7 +364,6 @@ var gb_map_gaode = (function() { | ||
| 332 | if(config.carIcon.angle) { | 364 | if(config.carIcon.angle) { |
| 333 | marker.setIcon(gb_map_imap.busIcon); | 365 | marker.setIcon(gb_map_imap.busIcon); |
| 334 | marker.setAngle(gps.direction - 90); | 366 | marker.setAngle(gps.direction - 90); |
| 335 | - marker.setOffset(new AMap.Pixel(-(w / 2), -12)); | ||
| 336 | 367 | ||
| 337 | marker.setLabel({ | 368 | marker.setLabel({ |
| 338 | content: gps.nbbm, | 369 | content: gps.nbbm, |
| @@ -345,6 +376,7 @@ var gb_map_gaode = (function() { | @@ -345,6 +376,7 @@ var gb_map_gaode = (function() { | ||
| 345 | image: gb_map_imap.createCarIcon(gps, w) | 376 | image: gb_map_imap.createCarIcon(gps, w) |
| 346 | })); | 377 | })); |
| 347 | } | 378 | } |
| 379 | + marker.setOffset(new AMap.Pixel(-(w / 2), -12.5)); | ||
| 348 | } | 380 | } |
| 349 | 381 | ||
| 350 | //创建站点marker | 382 | //创建站点marker |
src/main/resources/static/real_control_v2/mapmonitor/js/map_overlay_manager.js
| @@ -203,11 +203,11 @@ var gb_map_overlay_mge = (function () { | @@ -203,11 +203,11 @@ var gb_map_overlay_mge = (function () { | ||
| 203 | 203 | ||
| 204 | //地图居中至合理的位置 | 204 | //地图居中至合理的位置 |
| 205 | var centerToRational=function () { | 205 | var centerToRational=function () { |
| 206 | - var chs=gb_map_gps_tree.getChecked(); | 206 | + /*var chs=getCheckedDevice(); |
| 207 | if(chs && chs.length > 0){ | 207 | if(chs && chs.length > 0){ |
| 208 | var id=chs[0].data.lineId+'_'+chs[0].data.upDown; | 208 | var id=chs[0].data.lineId+'_'+chs[0].data.upDown; |
| 209 | gb_map_imap.call('centerToLine', {id: id}); | 209 | gb_map_imap.call('centerToLine', {id: id}); |
| 210 | - } | 210 | + }*/ |
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | return { | 213 | return { |
src/main/resources/static/real_control_v2/mapmonitor/js/real.js
| @@ -10,11 +10,12 @@ var mapmonitor_load_ep = EventProxy.create('load_iMap', 'load_baidu', 'load_gaod | @@ -10,11 +10,12 @@ var mapmonitor_load_ep = EventProxy.create('load_iMap', 'load_baidu', 'load_gaod | ||
| 10 | .changeMap(gb_map_config.getConfig().map_type); | 10 | .changeMap(gb_map_config.getConfig().map_type); |
| 11 | 11 | ||
| 12 | //init tree | 12 | //init tree |
| 13 | - gb_map_gps_tree.init(function () { | 13 | + /* gb_map_gps_tree.init(function () { |
| 14 | gb_map_overlay_mge.init(); | 14 | gb_map_overlay_mge.init(); |
| 15 | gb_map_spatial_data.init(); | 15 | gb_map_spatial_data.init(); |
| 16 | - }); | 16 | + });*/ |
| 17 | 17 | ||
| 18 | +/* | ||
| 18 | $(".real_bottom_panel").resizable({ | 19 | $(".real_bottom_panel").resizable({ |
| 19 | handles: { | 20 | handles: { |
| 20 | 'n': '.real_bottom_panel #handle' | 21 | 'n': '.real_bottom_panel #handle' |
| @@ -22,6 +23,27 @@ var mapmonitor_load_ep = EventProxy.create('load_iMap', 'load_baidu', 'load_gaod | @@ -22,6 +23,27 @@ var mapmonitor_load_ep = EventProxy.create('load_iMap', 'load_baidu', 'load_gaod | ||
| 22 | maxHeight: 384, | 23 | maxHeight: 384, |
| 23 | minHeight: 18 | 24 | minHeight: 18 |
| 24 | }); | 25 | }); |
| 26 | +*/ | ||
| 27 | + | ||
| 28 | + var maxHeight=384, minHeight=124, threshold=8; | ||
| 29 | + $(".real_bottom_panel").on('mousewheel', function (e) { | ||
| 30 | + var event = e.originalEvent; | ||
| 31 | + var code = delta = (event.wheelDelta) ? event.wheelDelta / 120 : -(event.detail || 0) / 3; | ||
| 32 | + | ||
| 33 | + if(code > 0){ | ||
| 34 | + var h = $(this).height()-threshold; | ||
| 35 | + $(this).height(h>minHeight?h:minHeight); | ||
| 36 | + } | ||
| 37 | + else{ | ||
| 38 | + var h = $(this).height()+threshold; | ||
| 39 | + $(this).height(h<maxHeight?h:maxHeight); | ||
| 40 | + } | ||
| 41 | + return false; | ||
| 42 | + }); | ||
| 43 | + | ||
| 44 | + $('.real_bottom_panel .telescopic').on('click', function () { | ||
| 45 | + | ||
| 46 | + }); | ||
| 25 | }); | 47 | }); |
| 26 | 48 | ||
| 27 | var gb_map_consts = { | 49 | var gb_map_consts = { |
| @@ -36,13 +58,13 @@ var gb_map_consts = { | @@ -36,13 +58,13 @@ var gb_map_consts = { | ||
| 36 | CanvasRenderingContext2D.prototype.roundRect = function (x, y, w, h, r) { | 58 | CanvasRenderingContext2D.prototype.roundRect = function (x, y, w, h, r) { |
| 37 | if (w < 2 * r) r = w / 2; | 59 | if (w < 2 * r) r = w / 2; |
| 38 | if (h < 2 * r) r = h / 2; | 60 | if (h < 2 * r) r = h / 2; |
| 39 | - this.strokeStyle ='rgba(0,102,0,.1)'; | 61 | + this.strokeStyle = 'rgba(0,102,0,.1)'; |
| 40 | this.beginPath(); | 62 | this.beginPath(); |
| 41 | - this.moveTo(x+r, y); | ||
| 42 | - this.arcTo(x+w, y, x+w, y+h, r); | ||
| 43 | - this.arcTo(x+w, y+h, x, y+h, r); | ||
| 44 | - this.arcTo(x, y+h, x, y, r); | ||
| 45 | - this.arcTo(x, y, x+w, y, r); | 63 | + this.moveTo(x + r, y); |
| 64 | + this.arcTo(x + w, y, x + w, y + h, r); | ||
| 65 | + this.arcTo(x + w, y + h, x, y + h, r); | ||
| 66 | + this.arcTo(x, y + h, x, y, r); | ||
| 67 | + this.arcTo(x, y, x + w, y, r); | ||
| 46 | this.closePath(); | 68 | this.closePath(); |
| 47 | return this; | 69 | return this; |
| 48 | } | 70 | } |
| 49 | \ No newline at end of file | 71 | \ No newline at end of file |
src/main/resources/static/real_control_v2/mapmonitor/js/spatial_data.js
| @@ -126,7 +126,7 @@ var gb_map_spatial_data = (function () { | @@ -126,7 +126,7 @@ var gb_map_spatial_data = (function () { | ||
| 126 | 126 | ||
| 127 | refresh(); | 127 | refresh(); |
| 128 | }); | 128 | }); |
| 129 | - } | 129 | + }; |
| 130 | 130 | ||
| 131 | //计算多边形面积 | 131 | //计算多边形面积 |
| 132 | function calcPolygonArea(polygonStr) { | 132 | function calcPolygonArea(polygonStr) { |
src/main/resources/static/real_control_v2/mapmonitor/real.html
| @@ -32,8 +32,11 @@ | @@ -32,8 +32,11 @@ | ||
| 32 | </div> | 32 | </div> |
| 33 | 33 | ||
| 34 | <div class="real_bottom_panel"> | 34 | <div class="real_bottom_panel"> |
| 35 | - <div id="handle" class="ui-resizable-handle ui-resizable-n"></div> | 35 | + <!--<div id="handle" class="ui-resizable-handle ui-resizable-n"></div>--> |
| 36 | <div class="real_br_cont map_config_wrap"></div> | 36 | <div class="real_br_cont map_config_wrap"></div> |
| 37 | + <div class="telescopic"> | ||
| 38 | + <i class="uk-icon-angle-double-up" ></i> | ||
| 39 | + </div> | ||
| 37 | </div> | 40 | </div> |
| 38 | 41 | ||
| 39 | <div class="real_spatial_panel"> | 42 | <div class="real_spatial_panel"> |