Commit 4ad64ba2cfcc0e1c234e84aed6807ab38e400069
Merge branch 'minhang' of http://222.66.0.204:8090/panzhaov5/bsth_control into minhang
# Conflicts: # src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task_v2/add_in_out.html
Showing
12 changed files
with
1632 additions
and
1609 deletions
src/main/java/com/bsth/data/Station2ParkBuffer.java
| 1 | -package com.bsth.data; | ||
| 2 | - | ||
| 3 | -import com.bsth.common.ResponseCode; | ||
| 4 | -import com.bsth.entity.realcontrol.ChildTaskPlan; | ||
| 5 | -import com.bsth.entity.realcontrol.StationToPark; | ||
| 6 | -import com.bsth.repository.realcontrol.StationToParkRepository; | ||
| 7 | -import com.bsth.util.Arith; | ||
| 8 | -import com.google.common.collect.ArrayListMultimap; | ||
| 9 | -import org.joda.time.format.DateTimeFormat; | ||
| 10 | -import org.joda.time.format.DateTimeFormatter; | ||
| 11 | -import org.slf4j.Logger; | ||
| 12 | -import org.slf4j.LoggerFactory; | ||
| 13 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 14 | -import org.springframework.boot.CommandLineRunner; | ||
| 15 | -import org.springframework.stereotype.Component; | ||
| 16 | - | ||
| 17 | -import java.util.*; | ||
| 18 | - | ||
| 19 | -/** | ||
| 20 | - * 站到场 历时、公里 数据缓存 | ||
| 21 | - * Created by panzhao on 2017/7/10. | ||
| 22 | - */ | ||
| 23 | -@Component | ||
| 24 | -public class Station2ParkBuffer implements CommandLineRunner { | ||
| 25 | - | ||
| 26 | - @Autowired | ||
| 27 | - StationToParkRepository stationToParkRepository; | ||
| 28 | - | ||
| 29 | - private static ArrayListMultimap listMultimap; | ||
| 30 | - | ||
| 31 | - private static Set<StationToPark> pstBuff; | ||
| 32 | - | ||
| 33 | - static Logger log = LoggerFactory.getLogger(Station2ParkBuffer.class); | ||
| 34 | - | ||
| 35 | - @Override | ||
| 36 | - public void run(String... strings) throws Exception { | ||
| 37 | - listMultimap = ArrayListMultimap.create(); | ||
| 38 | - pstBuff = new HashSet<>(); | ||
| 39 | - Iterator<StationToPark> iterator = stationToParkRepository.findAll().iterator(); | ||
| 40 | - StationToPark stp; | ||
| 41 | - while (iterator.hasNext()) { | ||
| 42 | - stp = iterator.next(); | ||
| 43 | - listMultimap.put(stp.getLineCode(), stp); | ||
| 44 | - } | ||
| 45 | - } | ||
| 46 | - | ||
| 47 | - public static List<StationToPark> get(String lineCode) { | ||
| 48 | - return listMultimap.get(lineCode); | ||
| 49 | - } | ||
| 50 | - | ||
| 51 | - public static StationToPark get(String lineCode, String sName, String eName) { | ||
| 52 | - List<StationToPark> list = get(lineCode); | ||
| 53 | - StationToPark stp = null; | ||
| 54 | - for (StationToPark s : list) { | ||
| 55 | - if (s.getStationName().equals(sName) && s.getParkName().equals(eName)) { | ||
| 56 | - stp = s; | ||
| 57 | - break; | ||
| 58 | - } | ||
| 59 | - } | ||
| 60 | - return stp; | ||
| 61 | - } | ||
| 62 | - | ||
| 63 | - private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm"); | ||
| 64 | - | ||
| 65 | - public static void put(ChildTaskPlan ctask) { | ||
| 66 | - try{ | ||
| 67 | - String type2 = ctask.getType2(); | ||
| 68 | - String lineCode = ctask.getSchedule().getXlBm(), sName, eName; | ||
| 69 | - | ||
| 70 | - if (type2.equals("2")) { | ||
| 71 | - sName = ctask.getStartStationName(); | ||
| 72 | - eName = ctask.getEndStationName(); | ||
| 73 | - } else if (type2.equals("3")) { | ||
| 74 | - eName = ctask.getStartStationName(); | ||
| 75 | - sName = ctask.getEndStationName(); | ||
| 76 | - } else | ||
| 77 | - return; | ||
| 78 | - | ||
| 79 | - Float time = calcMinute(ctask); | ||
| 80 | - Float mileage = ctask.getMileage(); | ||
| 81 | - | ||
| 82 | - StationToPark stp = get(lineCode, sName, eName); | ||
| 83 | - if (stp == null) { | ||
| 84 | - stp = new StationToPark(); | ||
| 85 | - stp.setLineCode(lineCode); | ||
| 86 | - stp.setStationName(sName); | ||
| 87 | - stp.setParkName(eName); | ||
| 88 | - listMultimap.put(lineCode, stp); | ||
| 89 | - } | ||
| 90 | - | ||
| 91 | - if (type2.equals("2")) { | ||
| 92 | - stp.setTime1(time); | ||
| 93 | - stp.setMileage1(mileage); | ||
| 94 | - } else { | ||
| 95 | - stp.setTime2(time); | ||
| 96 | - stp.setMileage2(mileage); | ||
| 97 | - } | ||
| 98 | - | ||
| 99 | - pstBuff.add(stp); | ||
| 100 | - }catch (Exception e){ | ||
| 101 | - log.error("", e); | ||
| 102 | - } | ||
| 103 | - } | ||
| 104 | - | ||
| 105 | - public static Float calcMinute(ChildTaskPlan ctask) { | ||
| 106 | - long t = 0; | ||
| 107 | - | ||
| 108 | - try { | ||
| 109 | - long st = fmtHHmm.parseMillis(ctask.getStartDate()); | ||
| 110 | - long et = fmtHHmm.parseMillis(ctask.getEndDate()); | ||
| 111 | - | ||
| 112 | - t = et - st; | ||
| 113 | - } catch (Exception e) { | ||
| 114 | - e.printStackTrace(); | ||
| 115 | - } | ||
| 116 | - return Float.parseFloat(String.valueOf(Arith.div(Arith.div(t, 1000), 60))); | ||
| 117 | - } | ||
| 118 | - | ||
| 119 | - public void saveAll(){ | ||
| 120 | - if(pstBuff.size()==0) | ||
| 121 | - return; | ||
| 122 | - Set<StationToPark> pstBuffCopy = pstBuff; | ||
| 123 | - pstBuff = new HashSet<>(); | ||
| 124 | - //持久化到数据库 | ||
| 125 | - stationToParkRepository.save(pstBuffCopy); | ||
| 126 | - } | ||
| 127 | - | ||
| 128 | - public Map<String, Object> delete(String lineCode, Integer id) { | ||
| 129 | - Map<String, Object> rs = new HashMap<>(); | ||
| 130 | - try { | ||
| 131 | - List<StationToPark> list = listMultimap.get(lineCode); | ||
| 132 | - | ||
| 133 | - StationToPark stp = null; | ||
| 134 | - for(StationToPark temp : list){ | ||
| 135 | - if(temp.getId().equals(id)){ | ||
| 136 | - stp=temp; | ||
| 137 | - break; | ||
| 138 | - } | ||
| 139 | - } | ||
| 140 | - | ||
| 141 | - if(stp != null){ | ||
| 142 | - listMultimap.remove(lineCode, stp); | ||
| 143 | - stationToParkRepository.delete(id); | ||
| 144 | - rs.put("status", ResponseCode.SUCCESS); | ||
| 145 | - } | ||
| 146 | - else{ | ||
| 147 | - rs.put("status", ResponseCode.SUCCESS); | ||
| 148 | - rs.put("msg", "操作失败,可能数据已经被删除!"); | ||
| 149 | - } | ||
| 150 | - | ||
| 151 | - }catch (Exception e){ | ||
| 152 | - rs.put("status", ResponseCode.ERROR); | ||
| 153 | - rs.put("msg", e.getMessage()); | ||
| 154 | - log.error("", e); | ||
| 155 | - } | ||
| 156 | - return rs; | ||
| 157 | - } | ||
| 158 | -} | 1 | +package com.bsth.data; |
| 2 | + | ||
| 3 | +import com.bsth.common.ResponseCode; | ||
| 4 | +import com.bsth.entity.realcontrol.ChildTaskPlan; | ||
| 5 | +import com.bsth.entity.realcontrol.StationToPark; | ||
| 6 | +import com.bsth.repository.realcontrol.StationToParkRepository; | ||
| 7 | +import com.bsth.util.Arith; | ||
| 8 | +import com.google.common.collect.ArrayListMultimap; | ||
| 9 | +import org.joda.time.format.DateTimeFormat; | ||
| 10 | +import org.joda.time.format.DateTimeFormatter; | ||
| 11 | +import org.slf4j.Logger; | ||
| 12 | +import org.slf4j.LoggerFactory; | ||
| 13 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 14 | +import org.springframework.boot.CommandLineRunner; | ||
| 15 | +import org.springframework.stereotype.Component; | ||
| 16 | + | ||
| 17 | +import java.util.*; | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * 站到场 历时、公里 数据缓存 | ||
| 21 | + * Created by panzhao on 2017/7/10. | ||
| 22 | + */ | ||
| 23 | +@Component | ||
| 24 | +public class Station2ParkBuffer implements CommandLineRunner { | ||
| 25 | + | ||
| 26 | + @Autowired | ||
| 27 | + StationToParkRepository stationToParkRepository; | ||
| 28 | + | ||
| 29 | + private static ArrayListMultimap listMultimap; | ||
| 30 | + | ||
| 31 | + private static Set<StationToPark> pstBuff; | ||
| 32 | + | ||
| 33 | + static Logger log = LoggerFactory.getLogger(Station2ParkBuffer.class); | ||
| 34 | + | ||
| 35 | + @Override | ||
| 36 | + public void run(String... strings) throws Exception { | ||
| 37 | + listMultimap = ArrayListMultimap.create(); | ||
| 38 | + pstBuff = new HashSet<>(); | ||
| 39 | + Iterator<StationToPark> iterator = stationToParkRepository.findAll().iterator(); | ||
| 40 | + StationToPark stp; | ||
| 41 | + while (iterator.hasNext()) { | ||
| 42 | + stp = iterator.next(); | ||
| 43 | + listMultimap.put(stp.getLineCode(), stp); | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + public static List<StationToPark> get(String lineCode) { | ||
| 48 | + return listMultimap.get(lineCode); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + public static StationToPark get(String lineCode, String sName, String eName) { | ||
| 52 | + List<StationToPark> list = get(lineCode); | ||
| 53 | + StationToPark stp = null; | ||
| 54 | + for (StationToPark s : list) { | ||
| 55 | + if (s.getStationName().equals(sName) && s.getParkName().equals(eName)) { | ||
| 56 | + stp = s; | ||
| 57 | + break; | ||
| 58 | + } | ||
| 59 | + } | ||
| 60 | + return stp; | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm"); | ||
| 64 | + | ||
| 65 | + public static void put(ChildTaskPlan ctask) { | ||
| 66 | + try{ | ||
| 67 | + String type2 = ctask.getType2(); | ||
| 68 | + String lineCode = ctask.getSchedule().getXlBm(), sName, eName; | ||
| 69 | + | ||
| 70 | + if (type2.equals("2")) { | ||
| 71 | + sName = ctask.getStartStationName(); | ||
| 72 | + eName = ctask.getEndStationName(); | ||
| 73 | + } else if (type2.equals("3")) { | ||
| 74 | + eName = ctask.getStartStationName(); | ||
| 75 | + sName = ctask.getEndStationName(); | ||
| 76 | + } else | ||
| 77 | + return; | ||
| 78 | + | ||
| 79 | + Float time = calcMinute(ctask); | ||
| 80 | + Float mileage = ctask.getMileage(); | ||
| 81 | + | ||
| 82 | + StationToPark stp = get(lineCode, sName, eName); | ||
| 83 | + if (stp == null) { | ||
| 84 | + stp = new StationToPark(); | ||
| 85 | + stp.setLineCode(lineCode); | ||
| 86 | + stp.setStationName(sName); | ||
| 87 | + stp.setParkName(eName); | ||
| 88 | + listMultimap.put(lineCode, stp); | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + if (type2.equals("2")) { | ||
| 92 | + stp.setTime1(time); | ||
| 93 | + stp.setMileage1(mileage); | ||
| 94 | + } else { | ||
| 95 | + stp.setTime2(time); | ||
| 96 | + stp.setMileage2(mileage); | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + pstBuff.add(stp); | ||
| 100 | + }catch (Exception e){ | ||
| 101 | + log.error("", e); | ||
| 102 | + } | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + public static Float calcMinute(ChildTaskPlan ctask) { | ||
| 106 | + long t = 0; | ||
| 107 | + | ||
| 108 | + try { | ||
| 109 | + long st = fmtHHmm.parseMillis(ctask.getStartDate()); | ||
| 110 | + long et = fmtHHmm.parseMillis(ctask.getEndDate()); | ||
| 111 | + | ||
| 112 | + t = et - st; | ||
| 113 | + } catch (Exception e) { | ||
| 114 | + e.printStackTrace(); | ||
| 115 | + } | ||
| 116 | + return Float.parseFloat(String.valueOf(Arith.div(Arith.div(t, 1000), 60))); | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + public void saveAll(){ | ||
| 120 | + if(pstBuff.size()==0) | ||
| 121 | + return; | ||
| 122 | + Set<StationToPark> pstBuffCopy = pstBuff; | ||
| 123 | + pstBuff = new HashSet<>(); | ||
| 124 | + //持久化到数据库 | ||
| 125 | + stationToParkRepository.save(pstBuffCopy); | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + public Map<String, Object> delete(String lineCode, Integer id) { | ||
| 129 | + Map<String, Object> rs = new HashMap<>(); | ||
| 130 | + try { | ||
| 131 | + List<StationToPark> list = listMultimap.get(lineCode); | ||
| 132 | + | ||
| 133 | + StationToPark stp = null; | ||
| 134 | + for(StationToPark temp : list){ | ||
| 135 | + if(temp.getId().equals(id)){ | ||
| 136 | + stp=temp; | ||
| 137 | + break; | ||
| 138 | + } | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + if(stp != null){ | ||
| 142 | + listMultimap.remove(lineCode, stp); | ||
| 143 | + stationToParkRepository.delete(id); | ||
| 144 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 145 | + } | ||
| 146 | + else{ | ||
| 147 | + rs.put("status", ResponseCode.SUCCESS); | ||
| 148 | + rs.put("msg", "操作失败,可能数据已经被删除!"); | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + }catch (Exception e){ | ||
| 152 | + rs.put("status", ResponseCode.ERROR); | ||
| 153 | + rs.put("msg", e.getMessage()); | ||
| 154 | + log.error("", e); | ||
| 155 | + } | ||
| 156 | + return rs; | ||
| 157 | + } | ||
| 158 | +} |
src/main/java/com/bsth/data/schedule/edit_logs/loggers/AfterwardsLogger.java
| 1 | -package com.bsth.data.schedule.edit_logs.loggers; | ||
| 2 | - | ||
| 3 | -import com.alibaba.fastjson.JSONArray; | ||
| 4 | -import com.alibaba.fastjson.JSONObject; | ||
| 5 | -import com.bsth.data.schedule.edit_logs.ScheduleModifyLogger; | ||
| 6 | -import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 7 | -import org.slf4j.Logger; | ||
| 8 | -import org.slf4j.LoggerFactory; | ||
| 9 | - | ||
| 10 | -/** | ||
| 11 | - * 事后历史班次编辑 | ||
| 12 | - * Created by panzhao on 2017/5/19. | ||
| 13 | - */ | ||
| 14 | -public class AfterwardsLogger { | ||
| 15 | - | ||
| 16 | - static Logger log = LoggerFactory.getLogger(AfterwardsLogger.class); | ||
| 17 | - | ||
| 18 | - private JSONArray jsonArray = new JSONArray(); | ||
| 19 | - private String remarks; | ||
| 20 | - private ScheduleRealInfo sch; | ||
| 21 | - | ||
| 22 | - public void log(String title, Object old, Object now){ | ||
| 23 | - try { | ||
| 24 | - | ||
| 25 | - JSONObject jsonObject = new JSONObject(); | ||
| 26 | - jsonObject.put("title", title); | ||
| 27 | - jsonObject.put("old", old); | ||
| 28 | - jsonObject.put("now", now); | ||
| 29 | - | ||
| 30 | - jsonArray.add(jsonObject); | ||
| 31 | - }catch (Exception e){ | ||
| 32 | - log.error("", e); | ||
| 33 | - } | ||
| 34 | - } | ||
| 35 | - | ||
| 36 | - public void log(String text){ | ||
| 37 | - try { | ||
| 38 | - JSONObject jsonObject = new JSONObject(); | ||
| 39 | - jsonObject.put("title", text); | ||
| 40 | - | ||
| 41 | - jsonArray.add(jsonObject); | ||
| 42 | - }catch (Exception e){ | ||
| 43 | - log.error("", e); | ||
| 44 | - } | ||
| 45 | - } | ||
| 46 | - | ||
| 47 | - public static AfterwardsLogger start(ScheduleRealInfo sch, String remarks){ | ||
| 48 | - AfterwardsLogger fLog = new AfterwardsLogger(); | ||
| 49 | - fLog.setSch(sch); | ||
| 50 | - fLog.setRemarks(remarks); | ||
| 51 | - return fLog; | ||
| 52 | - } | ||
| 53 | - | ||
| 54 | - public void end(){ | ||
| 55 | - ScheduleModifyLogger.afterEdit(sch, this.remarks, jsonArray); | ||
| 56 | - } | ||
| 57 | - | ||
| 58 | - public String getRemarks() { | ||
| 59 | - return remarks; | ||
| 60 | - } | ||
| 61 | - | ||
| 62 | - public void setRemarks(String remarks) { | ||
| 63 | - this.remarks = remarks; | ||
| 64 | - } | ||
| 65 | - | ||
| 66 | - public ScheduleRealInfo getSch() { | ||
| 67 | - return sch; | ||
| 68 | - } | ||
| 69 | - | ||
| 70 | - public void setSch(ScheduleRealInfo sch) { | ||
| 71 | - this.sch = sch; | ||
| 72 | - } | ||
| 73 | -} | 1 | +package com.bsth.data.schedule.edit_logs.loggers; |
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSONArray; | ||
| 4 | +import com.alibaba.fastjson.JSONObject; | ||
| 5 | +import com.bsth.data.schedule.edit_logs.ScheduleModifyLogger; | ||
| 6 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 7 | +import org.slf4j.Logger; | ||
| 8 | +import org.slf4j.LoggerFactory; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 事后历史班次编辑 | ||
| 12 | + * Created by panzhao on 2017/5/19. | ||
| 13 | + */ | ||
| 14 | +public class AfterwardsLogger { | ||
| 15 | + | ||
| 16 | + static Logger log = LoggerFactory.getLogger(AfterwardsLogger.class); | ||
| 17 | + | ||
| 18 | + private JSONArray jsonArray = new JSONArray(); | ||
| 19 | + private String remarks; | ||
| 20 | + private ScheduleRealInfo sch; | ||
| 21 | + | ||
| 22 | + public void log(String title, Object old, Object now){ | ||
| 23 | + try { | ||
| 24 | + | ||
| 25 | + JSONObject jsonObject = new JSONObject(); | ||
| 26 | + jsonObject.put("title", title); | ||
| 27 | + jsonObject.put("old", old); | ||
| 28 | + jsonObject.put("now", now); | ||
| 29 | + | ||
| 30 | + jsonArray.add(jsonObject); | ||
| 31 | + }catch (Exception e){ | ||
| 32 | + log.error("", e); | ||
| 33 | + } | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + public void log(String text){ | ||
| 37 | + try { | ||
| 38 | + JSONObject jsonObject = new JSONObject(); | ||
| 39 | + jsonObject.put("title", text); | ||
| 40 | + | ||
| 41 | + jsonArray.add(jsonObject); | ||
| 42 | + }catch (Exception e){ | ||
| 43 | + log.error("", e); | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + public static AfterwardsLogger start(ScheduleRealInfo sch, String remarks){ | ||
| 48 | + AfterwardsLogger fLog = new AfterwardsLogger(); | ||
| 49 | + fLog.setSch(sch); | ||
| 50 | + fLog.setRemarks(remarks); | ||
| 51 | + return fLog; | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + public void end(){ | ||
| 55 | + ScheduleModifyLogger.afterEdit(sch, this.remarks, jsonArray); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + public String getRemarks() { | ||
| 59 | + return remarks; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + public void setRemarks(String remarks) { | ||
| 63 | + this.remarks = remarks; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + public ScheduleRealInfo getSch() { | ||
| 67 | + return sch; | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + public void setSch(ScheduleRealInfo sch) { | ||
| 71 | + this.sch = sch; | ||
| 72 | + } | ||
| 73 | +} |
src/main/java/com/bsth/data/utils/CustomStringUtils.java
| 1 | -package com.bsth.data.utils; | ||
| 2 | - | ||
| 3 | -import org.apache.commons.lang3.StringUtils; | ||
| 4 | - | ||
| 5 | -/** | ||
| 6 | - * Created by panzhao on 2017/7/10. | ||
| 7 | - */ | ||
| 8 | -public class CustomStringUtils { | ||
| 9 | - | ||
| 10 | - public static boolean equals(String s1, String s2){ | ||
| 11 | - if(s1 == null){ | ||
| 12 | - if(StringUtils.isNotEmpty(s2)) | ||
| 13 | - return false; | ||
| 14 | - else | ||
| 15 | - return true; | ||
| 16 | - } | ||
| 17 | - return s1.equals(s2); | ||
| 18 | - } | ||
| 19 | -} | 1 | +package com.bsth.data.utils; |
| 2 | + | ||
| 3 | +import org.apache.commons.lang3.StringUtils; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * Created by panzhao on 2017/7/10. | ||
| 7 | + */ | ||
| 8 | +public class CustomStringUtils { | ||
| 9 | + | ||
| 10 | + public static boolean equals(String s1, String s2){ | ||
| 11 | + if(s1 == null){ | ||
| 12 | + if(StringUtils.isNotEmpty(s2)) | ||
| 13 | + return false; | ||
| 14 | + else | ||
| 15 | + return true; | ||
| 16 | + } | ||
| 17 | + return s1.equals(s2); | ||
| 18 | + } | ||
| 19 | +} |
src/main/java/com/bsth/entity/realcontrol/StationToPark.java
| 1 | -package com.bsth.entity.realcontrol; | ||
| 2 | - | ||
| 3 | -import javax.persistence.Entity; | ||
| 4 | -import javax.persistence.GeneratedValue; | ||
| 5 | -import javax.persistence.Id; | ||
| 6 | -import javax.persistence.Table; | ||
| 7 | - | ||
| 8 | -/** | ||
| 9 | - * 站 到 场 | ||
| 10 | - * Created by panzhao on 2017/7/10. | ||
| 11 | - */ | ||
| 12 | -@Entity | ||
| 13 | -@Table(name = "bsth_c_station_to_park") | ||
| 14 | -public class StationToPark { | ||
| 15 | - | ||
| 16 | - @Id | ||
| 17 | - @GeneratedValue | ||
| 18 | - private Integer id; | ||
| 19 | - | ||
| 20 | - /** 线路编码 */ | ||
| 21 | - private String lineCode; | ||
| 22 | - | ||
| 23 | - /** 站点名称 */ | ||
| 24 | - private String stationName; | ||
| 25 | - | ||
| 26 | - /** 停车场编码 */ | ||
| 27 | - private String parkName; | ||
| 28 | - | ||
| 29 | - /** 站到场时间(分钟) */ | ||
| 30 | - private Float time1; | ||
| 31 | - | ||
| 32 | - /** 站到场公里 */ | ||
| 33 | - private Float mileage1; | ||
| 34 | - | ||
| 35 | - /** 场到站时间(分钟) */ | ||
| 36 | - private Float time2; | ||
| 37 | - | ||
| 38 | - /** 场到站公里 */ | ||
| 39 | - private Float mileage2; | ||
| 40 | - | ||
| 41 | - /** 排序字段 */ | ||
| 42 | - private int orderNo; | ||
| 43 | - | ||
| 44 | - public String getLineCode() { | ||
| 45 | - return lineCode; | ||
| 46 | - } | ||
| 47 | - | ||
| 48 | - public void setLineCode(String lineCode) { | ||
| 49 | - this.lineCode = lineCode; | ||
| 50 | - } | ||
| 51 | - | ||
| 52 | - public String getStationName() { | ||
| 53 | - return stationName; | ||
| 54 | - } | ||
| 55 | - | ||
| 56 | - public void setStationName(String stationName) { | ||
| 57 | - this.stationName = stationName; | ||
| 58 | - } | ||
| 59 | - | ||
| 60 | - | ||
| 61 | - public Float getTime1() { | ||
| 62 | - return time1; | ||
| 63 | - } | ||
| 64 | - | ||
| 65 | - public void setTime1(Float time1) { | ||
| 66 | - this.time1 = time1; | ||
| 67 | - } | ||
| 68 | - | ||
| 69 | - public Float getMileage1() { | ||
| 70 | - return mileage1; | ||
| 71 | - } | ||
| 72 | - | ||
| 73 | - public void setMileage1(Float mileage1) { | ||
| 74 | - this.mileage1 = mileage1; | ||
| 75 | - } | ||
| 76 | - | ||
| 77 | - public Float getTime2() { | ||
| 78 | - return time2; | ||
| 79 | - } | ||
| 80 | - | ||
| 81 | - public void setTime2(Float time2) { | ||
| 82 | - this.time2 = time2; | ||
| 83 | - } | ||
| 84 | - | ||
| 85 | - public Float getMileage2() { | ||
| 86 | - return mileage2; | ||
| 87 | - } | ||
| 88 | - | ||
| 89 | - public void setMileage2(Float mileage2) { | ||
| 90 | - this.mileage2 = mileage2; | ||
| 91 | - } | ||
| 92 | - | ||
| 93 | - public Integer getId() { | ||
| 94 | - return id; | ||
| 95 | - } | ||
| 96 | - | ||
| 97 | - public void setId(Integer id) { | ||
| 98 | - this.id = id; | ||
| 99 | - } | ||
| 100 | - | ||
| 101 | - public int getOrderNo() { | ||
| 102 | - return orderNo; | ||
| 103 | - } | ||
| 104 | - | ||
| 105 | - public void setOrderNo(int orderNo) { | ||
| 106 | - this.orderNo = orderNo; | ||
| 107 | - } | ||
| 108 | - | ||
| 109 | - public String getParkName() { | ||
| 110 | - return parkName; | ||
| 111 | - } | ||
| 112 | - | ||
| 113 | - public void setParkName(String parkName) { | ||
| 114 | - this.parkName = parkName; | ||
| 115 | - } | ||
| 116 | - | ||
| 117 | - @Override | ||
| 118 | - public int hashCode() { | ||
| 119 | - return ("stp_" + this.toString()).hashCode(); | ||
| 120 | - } | ||
| 121 | - | ||
| 122 | - @Override | ||
| 123 | - public boolean equals(Object obj) { | ||
| 124 | - return this.toString().equals(((StationToPark)obj).toString()); | ||
| 125 | - } | ||
| 126 | - | ||
| 127 | - @Override | ||
| 128 | - public String toString() { | ||
| 129 | - return this.lineCode + "_" + this.getStationName() + "_" + this.getParkName(); | ||
| 130 | - } | ||
| 131 | -} | 1 | +package com.bsth.entity.realcontrol; |
| 2 | + | ||
| 3 | +import javax.persistence.Entity; | ||
| 4 | +import javax.persistence.GeneratedValue; | ||
| 5 | +import javax.persistence.Id; | ||
| 6 | +import javax.persistence.Table; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 站 到 场 | ||
| 10 | + * Created by panzhao on 2017/7/10. | ||
| 11 | + */ | ||
| 12 | +@Entity | ||
| 13 | +@Table(name = "bsth_c_station_to_park") | ||
| 14 | +public class StationToPark { | ||
| 15 | + | ||
| 16 | + @Id | ||
| 17 | + @GeneratedValue | ||
| 18 | + private Integer id; | ||
| 19 | + | ||
| 20 | + /** 线路编码 */ | ||
| 21 | + private String lineCode; | ||
| 22 | + | ||
| 23 | + /** 站点名称 */ | ||
| 24 | + private String stationName; | ||
| 25 | + | ||
| 26 | + /** 停车场编码 */ | ||
| 27 | + private String parkName; | ||
| 28 | + | ||
| 29 | + /** 站到场时间(分钟) */ | ||
| 30 | + private Float time1; | ||
| 31 | + | ||
| 32 | + /** 站到场公里 */ | ||
| 33 | + private Float mileage1; | ||
| 34 | + | ||
| 35 | + /** 场到站时间(分钟) */ | ||
| 36 | + private Float time2; | ||
| 37 | + | ||
| 38 | + /** 场到站公里 */ | ||
| 39 | + private Float mileage2; | ||
| 40 | + | ||
| 41 | + /** 排序字段 */ | ||
| 42 | + private int orderNo; | ||
| 43 | + | ||
| 44 | + public String getLineCode() { | ||
| 45 | + return lineCode; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + public void setLineCode(String lineCode) { | ||
| 49 | + this.lineCode = lineCode; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + public String getStationName() { | ||
| 53 | + return stationName; | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + public void setStationName(String stationName) { | ||
| 57 | + this.stationName = stationName; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + | ||
| 61 | + public Float getTime1() { | ||
| 62 | + return time1; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + public void setTime1(Float time1) { | ||
| 66 | + this.time1 = time1; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + public Float getMileage1() { | ||
| 70 | + return mileage1; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + public void setMileage1(Float mileage1) { | ||
| 74 | + this.mileage1 = mileage1; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + public Float getTime2() { | ||
| 78 | + return time2; | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + public void setTime2(Float time2) { | ||
| 82 | + this.time2 = time2; | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + public Float getMileage2() { | ||
| 86 | + return mileage2; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + public void setMileage2(Float mileage2) { | ||
| 90 | + this.mileage2 = mileage2; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + public Integer getId() { | ||
| 94 | + return id; | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + public void setId(Integer id) { | ||
| 98 | + this.id = id; | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + public int getOrderNo() { | ||
| 102 | + return orderNo; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + public void setOrderNo(int orderNo) { | ||
| 106 | + this.orderNo = orderNo; | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + public String getParkName() { | ||
| 110 | + return parkName; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + public void setParkName(String parkName) { | ||
| 114 | + this.parkName = parkName; | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + @Override | ||
| 118 | + public int hashCode() { | ||
| 119 | + return ("stp_" + this.toString()).hashCode(); | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + @Override | ||
| 123 | + public boolean equals(Object obj) { | ||
| 124 | + return this.toString().equals(((StationToPark)obj).toString()); | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + @Override | ||
| 128 | + public String toString() { | ||
| 129 | + return this.lineCode + "_" + this.getStationName() + "_" + this.getParkName(); | ||
| 130 | + } | ||
| 131 | +} |
src/main/java/com/bsth/repository/realcontrol/StationToParkRepository.java
| 1 | -package com.bsth.repository.realcontrol; | ||
| 2 | - | ||
| 3 | -import com.bsth.entity.realcontrol.StationToPark; | ||
| 4 | -import com.bsth.repository.BaseRepository; | ||
| 5 | -import org.springframework.stereotype.Repository; | ||
| 6 | - | ||
| 7 | -/** | ||
| 8 | - * Created by panzhao on 2017/7/10. | ||
| 9 | - */ | ||
| 10 | -@Repository | ||
| 11 | -public interface StationToParkRepository extends BaseRepository<StationToPark, Integer>{ | ||
| 12 | -} | 1 | +package com.bsth.repository.realcontrol; |
| 2 | + | ||
| 3 | +import com.bsth.entity.realcontrol.StationToPark; | ||
| 4 | +import com.bsth.repository.BaseRepository; | ||
| 5 | +import org.springframework.stereotype.Repository; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * Created by panzhao on 2017/7/10. | ||
| 9 | + */ | ||
| 10 | +@Repository | ||
| 11 | +public interface StationToParkRepository extends BaseRepository<StationToPark, Integer>{ | ||
| 12 | +} |
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
| @@ -668,25 +668,23 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -668,25 +668,23 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 668 | * @return String | 668 | * @return String |
| 669 | */ | 669 | */ |
| 670 | public String newTextFileToFTP(List<Object[]> objects,Integer lineId) { | 670 | public String newTextFileToFTP(List<Object[]> objects,Integer lineId) { |
| 671 | - | ||
| 672 | // 返回值String | 671 | // 返回值String |
| 673 | String stationRStr = ""; | 672 | String stationRStr = ""; |
| 674 | - | ||
| 675 | // windows下的文本文件换行符 | 673 | // windows下的文本文件换行符 |
| 676 | //String enterStr = "\r\n"; | 674 | //String enterStr = "\r\n"; |
| 677 | - | ||
| 678 | // linux/unix下的文本文件换行符 | 675 | // linux/unix下的文本文件换行符 |
| 679 | String enterStr = "\r"; | 676 | String enterStr = "\r"; |
| 680 | - | 677 | + int defaultZdxh = 0; |
| 681 | if(objects.size()>0) { | 678 | if(objects.size()>0) { |
| 682 | - | ||
| 683 | for(int i = 0; i<objects.size();i++) { | 679 | for(int i = 0; i<objects.size();i++) { |
| 684 | - | 680 | + defaultZdxh ++ ; |
| 685 | // 经度 | 681 | // 经度 |
| 686 | - String lng = objects.get(i)[0].equals("") ? "" : objects.get(i)[0].toString(); | 682 | + String lng = objects.get(i)[0].equals("") ? "0" : objects.get(i)[0].toString(); |
| 687 | 683 | ||
| 688 | // 纬度 | 684 | // 纬度 |
| 689 | - String lat = objects.get(i)[1].equals("") ? "" : objects.get(i)[1].toString(); | 685 | + String lat = objects.get(i)[1].equals("") ? "0" : objects.get(i)[1].toString(); |
| 686 | + | ||
| 687 | + Point point = new Point(Double.valueOf(lng), Double.valueOf(lat)); | ||
| 690 | 688 | ||
| 691 | lat = "\t" + lat; | 689 | lat = "\t" + lat; |
| 692 | 690 | ||
| @@ -696,23 +694,32 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -696,23 +694,32 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 696 | String stationMake = ""; | 694 | String stationMake = ""; |
| 697 | 695 | ||
| 698 | if(stationMakeStr.equals("E")) { | 696 | if(stationMakeStr.equals("E")) { |
| 699 | - | ||
| 700 | stationMake = "\t2"; | 697 | stationMake = "\t2"; |
| 701 | - | ||
| 702 | }else { | 698 | }else { |
| 703 | - | ||
| 704 | stationMake ="\t1"; | 699 | stationMake ="\t1"; |
| 705 | - | ||
| 706 | } | 700 | } |
| 707 | 701 | ||
| 708 | // 站点序号 | 702 | // 站点序号 |
| 709 | - String stationNo = objects.get(i)[4].equals("") ? "" : objects.get(i)[4].toString(); | 703 | + // String stationNo = objects.get(i)[4].equals("") ? "" : objects.get(i)[4].toString(); |
| 704 | + String stationNo = String.valueOf(defaultZdxh); | ||
| 710 | 705 | ||
| 711 | stationNo = "\t" + stationNo; | 706 | stationNo = "\t" + stationNo; |
| 712 | 707 | ||
| 713 | // 站点编码 | 708 | // 站点编码 |
| 714 | String stationCode = objects.get(i)[5].equals("") ? "" : objects.get(i)[5].toString(); | 709 | String stationCode = objects.get(i)[5].equals("") ? "" : objects.get(i)[5].toString(); |
| 715 | 710 | ||
| 711 | + int len = stationCode.length(); | ||
| 712 | + if(len<8) { | ||
| 713 | + int dx = 8 - len; | ||
| 714 | + String addStr = ""; | ||
| 715 | + for(int p =0;p<dx;p++) { | ||
| 716 | + addStr = addStr + "0"; | ||
| 717 | + } | ||
| 718 | + stationCode = addStr + stationCode; | ||
| 719 | + }else if(len>8){ | ||
| 720 | + stationCode = stationCode.substring(8); | ||
| 721 | + } | ||
| 722 | + | ||
| 716 | stationCode = "\t" +stationCode; | 723 | stationCode = "\t" +stationCode; |
| 717 | 724 | ||
| 718 | double dis = objects.get(i)[6]==null ? 0.0 : Double.parseDouble(objects.get(i)[6].toString())*1000; | 725 | double dis = objects.get(i)[6]==null ? 0.0 : Double.parseDouble(objects.get(i)[6].toString())*1000; |
| @@ -732,41 +739,33 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -732,41 +739,33 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 732 | 739 | ||
| 733 | // 限速 | 740 | // 限速 |
| 734 | String sleepStr = ""; | 741 | String sleepStr = ""; |
| 735 | - | ||
| 736 | // 方向 | 742 | // 方向 |
| 737 | int directions = objects.get(i)[8]==null ? null : Integer.valueOf(objects.get(i)[8].toString()); | 743 | int directions = objects.get(i)[8]==null ? null : Integer.valueOf(objects.get(i)[8].toString()); |
| 738 | - | ||
| 739 | /** 获取路段路由信息 @pararm:<lineId:线路ID;directions:方向> */ | 744 | /** 获取路段路由信息 @pararm:<lineId:线路ID;directions:方向> */ |
| 740 | List<Object[]> sobje = routeRepository.sectionRouteVector(lineId,directions); | 745 | List<Object[]> sobje = routeRepository.sectionRouteVector(lineId,directions); |
| 741 | - | ||
| 742 | if(sobje.size()==1) { | 746 | if(sobje.size()==1) { |
| 743 | - | ||
| 744 | - double dsleepStr = sobje.get(0)[2] == null ? 60d : Double.valueOf(sobje.get(0)[2].toString()); | ||
| 745 | - | ||
| 746 | - sleepStr = "\t" + new DecimalFormat("0").format(dsleepStr); | ||
| 747 | - | 747 | + int dsleepStr = sobje.get(0)[2] == null || sobje.get(0)[2].equals("") ? 60 : Integer.valueOf(sobje.get(0)[2].toString()); |
| 748 | + sleepStr = "\t" + String.valueOf(dsleepStr); | ||
| 748 | }else if(sobje.size()>1){ | 749 | }else if(sobje.size()>1){ |
| 749 | - | ||
| 750 | - /** 这里暂时只根据站点名称去匹配所在路段的限速值 ,如果路段名称"至"之前的地名与站点名称等同,就认为站点在路段上。 */ | ||
| 751 | for(int j =0;j<sobje.size();j++) { | 750 | for(int j =0;j<sobje.size();j++) { |
| 752 | - | ||
| 753 | - String sectionName = sobje.get(j)[3].toString(); | ||
| 754 | - | ||
| 755 | - String sectionNameA[] = sectionName.split("至"); | ||
| 756 | - | ||
| 757 | - if(stationName.equals(sectionNameA[0])){ | ||
| 758 | - | ||
| 759 | - /*sleepStr = sobje.get(j)[2].toString();*/ | ||
| 760 | - | ||
| 761 | - double dsleepStrt = sobje.get(0)[2] == null ? 60d : Double.valueOf(sobje.get(j)[2].toString()); | ||
| 762 | - | ||
| 763 | - sleepStr = "\t" + new DecimalFormat("0").format(dsleepStrt); | ||
| 764 | - | 751 | + double dsleepStrt = sobje.get(j)[2] == null || sobje.get(j)[2].equals("") ? 60d : Double.valueOf(sobje.get(j)[2].toString()); |
| 752 | + String pointsStr = sobje.get(j)[1]==null || sobje.get(j)[1].equals("") ? null : sobje.get(j)[1].toString(); | ||
| 753 | + pointsStr = pointsStr.substring(11, pointsStr.length()-1); | ||
| 754 | + List<Point> ps = new ArrayList<>(); | ||
| 755 | + String[] pArray = pointsStr.split(","); | ||
| 756 | + for(int a = 0; a <pArray.length; a++) { | ||
| 757 | + String[] tmepA = pArray[a].split(" "); | ||
| 758 | + Point temp = new Point(Double.valueOf(tmepA[0]), Double.valueOf(tmepA[1])); | ||
| 759 | + ps.add(temp); | ||
| 760 | + } | ||
| 761 | + if(GeoUtils.isInSection(ps, point)) { | ||
| 762 | + sleepStr = "\t" + String.valueOf((int)dsleepStrt); | ||
| 763 | + break; | ||
| 765 | } | 764 | } |
| 766 | - | ||
| 767 | } | 765 | } |
| 768 | } | 766 | } |
| 769 | - | 767 | + if(sleepStr.equals("")) |
| 768 | + sleepStr = "\t" + "60"; | ||
| 770 | stationRStr = stationRStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + stationName + enterStr; | 769 | stationRStr = stationRStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + stationName + enterStr; |
| 771 | } | 770 | } |
| 772 | 771 | ||
| @@ -785,9 +784,12 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -785,9 +784,12 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 785 | for(int i = 0; i<objects.size();i++) { | 784 | for(int i = 0; i<objects.size();i++) { |
| 786 | if(Integer.valueOf(objects.get(i)[8].toString())==0) { | 785 | if(Integer.valueOf(objects.get(i)[8].toString())==0) { |
| 787 | // 经度 | 786 | // 经度 |
| 788 | - String lng = objects.get(i)[0].equals("") ? "" : objects.get(i)[0].toString(); | 787 | + String lng = objects.get(i)[0].equals("") ? "0" : objects.get(i)[0].toString(); |
| 788 | + | ||
| 789 | // 纬度 | 789 | // 纬度 |
| 790 | - String lat = objects.get(i)[1].equals("") ? "" : objects.get(i)[1].toString(); | 790 | + String lat = objects.get(i)[1].equals("") ? "0" : objects.get(i)[1].toString(); |
| 791 | + | ||
| 792 | + Point point = new Point(Double.valueOf(lng), Double.valueOf(lat)); | ||
| 791 | lat = "\t" + lat; | 793 | lat = "\t" + lat; |
| 792 | // 站点类型 | 794 | // 站点类型 |
| 793 | String stationMakeStr = objects.get(i)[3].equals("") ? "" : objects.get(i)[3].toString(); | 795 | String stationMakeStr = objects.get(i)[3].equals("") ? "" : objects.get(i)[3].toString(); |
| @@ -802,6 +804,17 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -802,6 +804,17 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 802 | String stationNo = "\t" + xh; | 804 | String stationNo = "\t" + xh; |
| 803 | // 站点编码 | 805 | // 站点编码 |
| 804 | String stationCode = objects.get(i)[5].equals("") ? "" : objects.get(i)[5].toString(); | 806 | String stationCode = objects.get(i)[5].equals("") ? "" : objects.get(i)[5].toString(); |
| 807 | + int len = stationCode.length(); | ||
| 808 | + if(len<8) { | ||
| 809 | + int dx = 8 - len; | ||
| 810 | + String addStr = ""; | ||
| 811 | + for(int p =0;p<dx;p++) { | ||
| 812 | + addStr = addStr + "0"; | ||
| 813 | + } | ||
| 814 | + stationCode = addStr + stationCode; | ||
| 815 | + }else if(len>8){ | ||
| 816 | + stationCode = stationCode.substring(8); | ||
| 817 | + } | ||
| 805 | stationCode = "\t" +stationCode; | 818 | stationCode = "\t" +stationCode; |
| 806 | double dis = objects.get(i)[6]==null ? 0.0 : Double.parseDouble(objects.get(i)[6].toString())*1000; | 819 | double dis = objects.get(i)[6]==null ? 0.0 : Double.parseDouble(objects.get(i)[6].toString())*1000; |
| 807 | String tempDistc = String.valueOf((int) dis); | 820 | String tempDistc = String.valueOf((int) dis); |
| @@ -817,20 +830,28 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -817,20 +830,28 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 817 | /** 获取路段路由信息 @pararm:<lineId:线路ID;directions:方向> */ | 830 | /** 获取路段路由信息 @pararm:<lineId:线路ID;directions:方向> */ |
| 818 | List<Object[]> sobje = routeRepository.sectionRouteVector(lineId,directions); | 831 | List<Object[]> sobje = routeRepository.sectionRouteVector(lineId,directions); |
| 819 | if(sobje.size()==1) { | 832 | if(sobje.size()==1) { |
| 820 | - double dsleepStr = sobje.get(0)[2] == null ? 60d : Double.valueOf(sobje.get(0)[2].toString()); | ||
| 821 | - sleepStr = "\t" + new DecimalFormat("0").format(dsleepStr); | 833 | + int dsleepStr = sobje.get(0)[2] == null || sobje.get(0)[2].equals("") ? 60 : Integer.valueOf(sobje.get(0)[2].toString()); |
| 834 | + sleepStr = "\t" + String.valueOf(dsleepStr); | ||
| 822 | }else if(sobje.size()>1){ | 835 | }else if(sobje.size()>1){ |
| 823 | - /** 这里暂时只根据站点名称去匹配所在路段的限速值 ,如果路段名称"至"之前的地名与站点名称等同,就认为站点在路段上。 */ | ||
| 824 | for(int j =0;j<sobje.size();j++) { | 836 | for(int j =0;j<sobje.size();j++) { |
| 825 | - String sectionName = sobje.get(j)[3].toString(); | ||
| 826 | - String sectionNameA[] = sectionName.split("至"); | ||
| 827 | - if(stationName.equals(sectionNameA[0])){ | ||
| 828 | - /*sleepStr = sobje.get(j)[2].toString();*/ | ||
| 829 | - double dsleepStrt = sobje.get(0)[2] == null ? 60d : Double.valueOf(sobje.get(j)[2].toString()); | ||
| 830 | - sleepStr = "\t" + new DecimalFormat("0").format(dsleepStrt); | 837 | + double dsleepStrt = sobje.get(j)[2] == null || sobje.get(j)[2].equals("") ? 60d : Double.valueOf(sobje.get(j)[2].toString()); |
| 838 | + String pointsStr = sobje.get(j)[1]==null || sobje.get(j)[1].equals("") ? null : sobje.get(j)[1].toString(); | ||
| 839 | + pointsStr = pointsStr.substring(11, pointsStr.length()-1); | ||
| 840 | + List<Point> ps = new ArrayList<>(); | ||
| 841 | + String[] pArray = pointsStr.split(","); | ||
| 842 | + for(int a = 0; a <pArray.length; a++) { | ||
| 843 | + String[] tmepA = pArray[a].split(" "); | ||
| 844 | + Point temp = new Point(Double.valueOf(tmepA[0]), Double.valueOf(tmepA[1])); | ||
| 845 | + ps.add(temp); | ||
| 846 | + } | ||
| 847 | + if(GeoUtils.isInSection(ps, point)) { | ||
| 848 | + sleepStr = "\t" + String.valueOf((int)dsleepStrt); | ||
| 849 | + break; | ||
| 831 | } | 850 | } |
| 832 | } | 851 | } |
| 833 | } | 852 | } |
| 853 | + if(sleepStr.equals("")) | ||
| 854 | + sleepStr = "\t" + "60"; | ||
| 834 | xh++; | 855 | xh++; |
| 835 | restStr = restStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + stationName + enterStr; | 856 | restStr = restStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + stationName + enterStr; |
| 836 | } | 857 | } |
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
| @@ -24,6 +24,7 @@ import com.bsth.webService.trafficManage.geotool.services.Internal; | @@ -24,6 +24,7 @@ import com.bsth.webService.trafficManage.geotool.services.Internal; | ||
| 24 | import com.bsth.webService.trafficManage.org.tempuri.Results; | 24 | import com.bsth.webService.trafficManage.org.tempuri.Results; |
| 25 | import com.bsth.webService.trafficManage.org.tempuri.WebServiceLocator; | 25 | import com.bsth.webService.trafficManage.org.tempuri.WebServiceLocator; |
| 26 | import com.bsth.webService.trafficManage.org.tempuri.WebServiceSoap; | 26 | import com.bsth.webService.trafficManage.org.tempuri.WebServiceSoap; |
| 27 | +import org.apache.commons.lang.StringUtils; | ||
| 27 | import org.apache.commons.lang.time.DateUtils; | 28 | import org.apache.commons.lang.time.DateUtils; |
| 28 | import org.slf4j.Logger; | 29 | import org.slf4j.Logger; |
| 29 | import org.slf4j.LoggerFactory; | 30 | import org.slf4j.LoggerFactory; |
| @@ -1125,11 +1126,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | @@ -1125,11 +1126,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{ | ||
| 1125 | }else{ | 1126 | }else{ |
| 1126 | flag = 0; | 1127 | flag = 0; |
| 1127 | } | 1128 | } |
| 1128 | - result += flag; | ||
| 1129 | - if(i !=ruleDayArray.length -1){ | ||
| 1130 | - result +=","; | 1129 | + if(flag > 0){ |
| 1130 | + result += flag + ","; | ||
| 1131 | } | 1131 | } |
| 1132 | } | 1132 | } |
| 1133 | + // 去掉最后一个字符 | ||
| 1134 | + if(StringUtils.endsWith(result,",")){ | ||
| 1135 | + result = StringUtils.removeEnd(result,","); | ||
| 1136 | + } | ||
| 1133 | return result; | 1137 | return result; |
| 1134 | } | 1138 | } |
| 1135 | /** | 1139 | /** |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -2577,11 +2577,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -2577,11 +2577,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 2577 | if (a == 2) { | 2577 | if (a == 2) { |
| 2578 | x = b + 1; | 2578 | x = b + 1; |
| 2579 | y = x * 2; | 2579 | y = x * 2; |
| 2580 | - ; | ||
| 2581 | } else if (b == 1) { | 2580 | } else if (b == 1) { |
| 2582 | x = b + 1; | 2581 | x = b + 1; |
| 2583 | y = x * 2 - 1; | 2582 | y = x * 2 - 1; |
| 2584 | - ; | ||
| 2585 | } else { | 2583 | } else { |
| 2586 | x = b; | 2584 | x = b; |
| 2587 | y = 2 * x; | 2585 | y = 2 * x; |
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task_v2/add_custom.html
| 1 | -<div class="add_custom_wrap"> | ||
| 2 | - <div class="forms"></div> | ||
| 3 | - <span class="plus_icon_span"> | ||
| 4 | - <i class="uk-icon-plus"></i> | ||
| 5 | - </span> | ||
| 6 | - <form class="uk-form remarks_form"> | ||
| 7 | - <div class="uk-grid"> | ||
| 8 | - <div class="uk-width-1-1"> | ||
| 9 | - <div class="uk-form-row ct-stacked"> | ||
| 10 | - <div class="uk-form-controls" style="margin-top: 5px;"> | ||
| 11 | - <textarea id="form-s-t" rows="4" name="remarks" data-fv-stringlength="true" style="width: 100%;" | ||
| 12 | - data-fv-stringlength-max="50" placeholder="备注,不超过50个字符"></textarea> | ||
| 13 | - </div> | ||
| 14 | - </div> | ||
| 15 | - </div> | ||
| 16 | - </div> | ||
| 17 | - </form> | ||
| 18 | - <div class="uk-modal-footer uk-text-right" style="margin-top: 5px;"> | ||
| 19 | - <button type="button" class="uk-button uk-modal-close">取消</button> | ||
| 20 | - <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> 保存</button> | ||
| 21 | - </div> | ||
| 22 | - | ||
| 23 | - <script> | ||
| 24 | - (function () { | ||
| 25 | - var wrap = '#add-sub-task-main-modal .add_custom_wrap', | ||
| 26 | - sch, fs=[]; | ||
| 27 | - | ||
| 28 | - $(wrap).on('init', function (e, data) { | ||
| 29 | - e.stopPropagation(); | ||
| 30 | - sch = data.sch; | ||
| 31 | - $('.plus_icon_span', wrap).trigger('click'); | ||
| 32 | - }); | ||
| 33 | - | ||
| 34 | - //plsu icon | ||
| 35 | - $('.plus_icon_span', wrap).on('click', addTaskForm); | ||
| 36 | - | ||
| 37 | - var bcTypeMap = {'in': 2, 'out': 3, 'normal': 1}; | ||
| 38 | - function addTaskForm() { | ||
| 39 | - var htmlStr = template('sub-task-v2-form-temp', {sch: sch}) | ||
| 40 | - var f = $(htmlStr); | ||
| 41 | - $('.forms', wrap).append(f); | ||
| 42 | - //字典转换 | ||
| 43 | - dictionaryUtils.transformDom($('.nt-dictionary', f)); | ||
| 44 | - | ||
| 45 | - //班次类型切换 | ||
| 46 | - if(bcTypeMap[sch.bcType]) | ||
| 47 | - $('[name=type2]', f).val(bcTypeMap[sch.bcType]) | ||
| 48 | - $('[name=type2]', f).trigger('change'); | ||
| 49 | - | ||
| 50 | - //滚动条到底 | ||
| 51 | - $('.forms', wrap).scrollTop($('.forms', wrap)[0].scrollHeight); | ||
| 52 | - | ||
| 53 | - //起点站trigger change | ||
| 54 | - $('[name=startStation]',f).trigger('change'); | ||
| 55 | - | ||
| 56 | - f.prev('.sub_task_form_v2').find('[name=endDate]').trigger('input'); | ||
| 57 | - | ||
| 58 | - f.formValidation({ | ||
| 59 | - framework: 'uikit', | ||
| 60 | - locale: 'zh_CN' | ||
| 61 | - }).on('add_reason_field', function () { | ||
| 62 | - $(this).formValidation('addField', 'reason'); | ||
| 63 | - }); | ||
| 64 | - } | ||
| 65 | - | ||
| 66 | - //提交 | ||
| 67 | - $('button[type=submit]', wrap).on('click', function () { | ||
| 68 | - $(this).addClass('disabled').attr('disabled','disabled'); | ||
| 69 | - dataArray = []; | ||
| 70 | - $('form.sub_task_form_v2', wrap).data('valid', false) | ||
| 71 | - .formValidation('validate'); | ||
| 72 | - }); | ||
| 73 | - | ||
| 74 | - var dataArray = []; | ||
| 75 | - $(wrap).on('success.form.fv', 'form.sub_task_form_v2', function (e) { | ||
| 76 | - e.preventDefault(); | ||
| 77 | - | ||
| 78 | - dataArray.push($.extend($(this).serializeJSON(), gb_common.getDisabledVal(this) | ||
| 79 | - , {remarks: $('#form-s-t',wrap).val(), 'schedule.id': sch.id})); | ||
| 80 | - $(this).data('valid', true); | ||
| 81 | - | ||
| 82 | - if(allValidSuccess()){ | ||
| 83 | - var i = 0, rst; | ||
| 84 | - (function () { | ||
| 85 | - var f = arguments.callee; | ||
| 86 | - if(i >= dataArray.length){ | ||
| 87 | - //完成后更新前端数据 | ||
| 88 | - gb_schedule_table.updateSchedule(rst); | ||
| 89 | - UIkit.modal('#add-sub-task-main-modal').hide(); | ||
| 90 | - $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: sch}); | ||
| 91 | - gb_data_basic.reload_stat_park_data(); | ||
| 92 | - return; | ||
| 93 | - } | ||
| 94 | - var data = dataArray[i]; | ||
| 95 | - //里程为0的不保存 | ||
| 96 | - if(data.mileage==0){ | ||
| 97 | - i++; | ||
| 98 | - f(); | ||
| 99 | - } | ||
| 100 | - else{ | ||
| 101 | - //营运子任务不写备注 | ||
| 102 | - if(data.mileageType == 'service' && !data.destroy) | ||
| 103 | - data.remarks = ''; | ||
| 104 | - gb_common.$post('/childTask', data, function (rs) { | ||
| 105 | - notify_succ('子任务添加成功'); | ||
| 106 | - rst = rs.t; | ||
| 107 | - i++; | ||
| 108 | - f(); | ||
| 109 | - }); | ||
| 110 | - } | ||
| 111 | - })(); | ||
| 112 | - } | ||
| 113 | - }); | ||
| 114 | - //校验不过 | ||
| 115 | - $(wrap).on('err.field.fv','form.sub_task_form_v2', function () { | ||
| 116 | - $('button[type=submit]', wrap).removeClass('disabled').removeAttr('disabled'); | ||
| 117 | - }); | ||
| 118 | - | ||
| 119 | - function allValidSuccess() { | ||
| 120 | - var flag = true; | ||
| 121 | - $('form.sub_task_form_v2', wrap).each(function (i, f) { | ||
| 122 | - if(!$(f).data('valid')){ | ||
| 123 | - flag = false; | ||
| 124 | - return false; | ||
| 125 | - } | ||
| 126 | - }); | ||
| 127 | - return flag; | ||
| 128 | - } | ||
| 129 | - | ||
| 130 | - function $f(name, f) { | ||
| 131 | - return $('[name=' + name + ']', f); | ||
| 132 | - } | ||
| 133 | - })(); | ||
| 134 | - </script> | 1 | +<div class="add_custom_wrap"> |
| 2 | + <div class="forms"></div> | ||
| 3 | + <span class="plus_icon_span"> | ||
| 4 | + <i class="uk-icon-plus"></i> | ||
| 5 | + </span> | ||
| 6 | + <form class="uk-form remarks_form"> | ||
| 7 | + <div class="uk-grid"> | ||
| 8 | + <div class="uk-width-1-1"> | ||
| 9 | + <div class="uk-form-row ct-stacked"> | ||
| 10 | + <div class="uk-form-controls" style="margin-top: 5px;"> | ||
| 11 | + <textarea id="form-s-t" rows="4" name="remarks" data-fv-stringlength="true" style="width: 100%;" | ||
| 12 | + data-fv-stringlength-max="50" placeholder="备注,不超过50个字符"></textarea> | ||
| 13 | + </div> | ||
| 14 | + </div> | ||
| 15 | + </div> | ||
| 16 | + </div> | ||
| 17 | + </form> | ||
| 18 | + <div class="uk-modal-footer uk-text-right" style="margin-top: 5px;"> | ||
| 19 | + <button type="button" class="uk-button uk-modal-close">取消</button> | ||
| 20 | + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> 保存</button> | ||
| 21 | + </div> | ||
| 22 | + | ||
| 23 | + <script> | ||
| 24 | + (function () { | ||
| 25 | + var wrap = '#add-sub-task-main-modal .add_custom_wrap', | ||
| 26 | + sch, fs=[]; | ||
| 27 | + | ||
| 28 | + $(wrap).on('init', function (e, data) { | ||
| 29 | + e.stopPropagation(); | ||
| 30 | + sch = data.sch; | ||
| 31 | + $('.plus_icon_span', wrap).trigger('click'); | ||
| 32 | + }); | ||
| 33 | + | ||
| 34 | + //plsu icon | ||
| 35 | + $('.plus_icon_span', wrap).on('click', addTaskForm); | ||
| 36 | + | ||
| 37 | + var bcTypeMap = {'in': 2, 'out': 3, 'normal': 1}; | ||
| 38 | + function addTaskForm() { | ||
| 39 | + var htmlStr = template('sub-task-v2-form-temp', {sch: sch}) | ||
| 40 | + var f = $(htmlStr); | ||
| 41 | + $('.forms', wrap).append(f); | ||
| 42 | + //字典转换 | ||
| 43 | + dictionaryUtils.transformDom($('.nt-dictionary', f)); | ||
| 44 | + | ||
| 45 | + //班次类型切换 | ||
| 46 | + if(bcTypeMap[sch.bcType]) | ||
| 47 | + $('[name=type2]', f).val(bcTypeMap[sch.bcType]) | ||
| 48 | + $('[name=type2]', f).trigger('change'); | ||
| 49 | + | ||
| 50 | + //滚动条到底 | ||
| 51 | + $('.forms', wrap).scrollTop($('.forms', wrap)[0].scrollHeight); | ||
| 52 | + | ||
| 53 | + //起点站trigger change | ||
| 54 | + $('[name=startStation]',f).trigger('change'); | ||
| 55 | + | ||
| 56 | + f.prev('.sub_task_form_v2').find('[name=endDate]').trigger('input'); | ||
| 57 | + | ||
| 58 | + f.formValidation({ | ||
| 59 | + framework: 'uikit', | ||
| 60 | + locale: 'zh_CN' | ||
| 61 | + }).on('add_reason_field', function () { | ||
| 62 | + $(this).formValidation('addField', 'reason'); | ||
| 63 | + }); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + //提交 | ||
| 67 | + $('button[type=submit]', wrap).on('click', function () { | ||
| 68 | + $(this).addClass('disabled').attr('disabled','disabled'); | ||
| 69 | + dataArray = []; | ||
| 70 | + $('form.sub_task_form_v2', wrap).data('valid', false) | ||
| 71 | + .formValidation('validate'); | ||
| 72 | + }); | ||
| 73 | + | ||
| 74 | + var dataArray = []; | ||
| 75 | + $(wrap).on('success.form.fv', 'form.sub_task_form_v2', function (e) { | ||
| 76 | + e.preventDefault(); | ||
| 77 | + | ||
| 78 | + dataArray.push($.extend($(this).serializeJSON(), gb_common.getDisabledVal(this) | ||
| 79 | + , {remarks: $('#form-s-t',wrap).val(), 'schedule.id': sch.id})); | ||
| 80 | + $(this).data('valid', true); | ||
| 81 | + | ||
| 82 | + if(allValidSuccess()){ | ||
| 83 | + var i = 0, rst; | ||
| 84 | + (function () { | ||
| 85 | + var f = arguments.callee; | ||
| 86 | + if(i >= dataArray.length){ | ||
| 87 | + //完成后更新前端数据 | ||
| 88 | + gb_schedule_table.updateSchedule(rst); | ||
| 89 | + UIkit.modal('#add-sub-task-main-modal').hide(); | ||
| 90 | + $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: sch}); | ||
| 91 | + gb_data_basic.reload_stat_park_data(); | ||
| 92 | + return; | ||
| 93 | + } | ||
| 94 | + var data = dataArray[i]; | ||
| 95 | + //里程为0的不保存 | ||
| 96 | + if(data.mileage==0){ | ||
| 97 | + i++; | ||
| 98 | + f(); | ||
| 99 | + } | ||
| 100 | + else{ | ||
| 101 | + //营运子任务不写备注 | ||
| 102 | + if(data.mileageType == 'service' && !data.destroy) | ||
| 103 | + data.remarks = ''; | ||
| 104 | + gb_common.$post('/childTask', data, function (rs) { | ||
| 105 | + notify_succ('子任务添加成功'); | ||
| 106 | + rst = rs.t; | ||
| 107 | + i++; | ||
| 108 | + f(); | ||
| 109 | + }); | ||
| 110 | + } | ||
| 111 | + })(); | ||
| 112 | + } | ||
| 113 | + }); | ||
| 114 | + //校验不过 | ||
| 115 | + $(wrap).on('err.field.fv','form.sub_task_form_v2', function () { | ||
| 116 | + $('button[type=submit]', wrap).removeClass('disabled').removeAttr('disabled'); | ||
| 117 | + }); | ||
| 118 | + | ||
| 119 | + function allValidSuccess() { | ||
| 120 | + var flag = true; | ||
| 121 | + $('form.sub_task_form_v2', wrap).each(function (i, f) { | ||
| 122 | + if(!$(f).data('valid')){ | ||
| 123 | + flag = false; | ||
| 124 | + return false; | ||
| 125 | + } | ||
| 126 | + }); | ||
| 127 | + return flag; | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + function $f(name, f) { | ||
| 131 | + return $('[name=' + name + ']', f); | ||
| 132 | + } | ||
| 133 | + })(); | ||
| 134 | + </script> | ||
| 135 | </div> | 135 | </div> |
| 136 | \ No newline at end of file | 136 | \ No newline at end of file |
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task_v2/add_range_turn.html
| 1 | -<div class="add_range_wrap"> | ||
| 2 | - <div> | ||
| 3 | - <form class="uk-form uk-form-horizontal st_range_top_form"> | ||
| 4 | - <div class="uk-grid"> | ||
| 5 | - <div class="uk-width-1-3"> | ||
| 6 | - <div class="uk-form-row" style="padding-left: 10px;"> | ||
| 7 | - <label class="uk-form-label">调头站点</label> | ||
| 8 | - <div class="uk-form-controls"> | ||
| 9 | - <select id="turnStationSelect"> | ||
| 10 | - <option value="">请选择...</option> | ||
| 11 | - </select> | ||
| 12 | - </div> | ||
| 13 | - </div> | ||
| 14 | - </div> | ||
| 15 | - <div class="uk-width-1-3"> | ||
| 16 | - <div class="uk-form-row"> | ||
| 17 | - <label class="uk-form-label">调头原因</label> | ||
| 18 | - <div class="uk-form-controls"> | ||
| 19 | - <select id="turnReason" style="width: calc(100% - 13px);"> | ||
| 20 | - <option value="">请选择...</option> | ||
| 21 | - </select> | ||
| 22 | - </div> | ||
| 23 | - </div> | ||
| 24 | - </div> | ||
| 25 | - <div class="uk-width-1-3" style="padding: 28px 0 0 28px;"> | ||
| 26 | - <label id="emptyTurnCbox"></label> | ||
| 27 | - </div> | ||
| 28 | - </div> | ||
| 29 | - </form> | ||
| 30 | - </div> | ||
| 31 | - | ||
| 32 | - <div class="forms"></div> | ||
| 33 | - <form class="uk-form remarks_form"> | ||
| 34 | - <div class="uk-grid"> | ||
| 35 | - <div class="uk-width-1-1"> | ||
| 36 | - <div class="uk-form-row ct-stacked"> | ||
| 37 | - <div class="uk-form-controls" style="margin-top: 5px;"> | ||
| 38 | - <textarea id="form-s-t" rows="4" name="remarks" data-fv-stringlength="true" style="width: 100%;" | ||
| 39 | - data-fv-stringlength-max="50" placeholder="备注,不超过50个字符"></textarea> | ||
| 40 | - </div> | ||
| 41 | - </div> | ||
| 42 | - </div> | ||
| 43 | - </div> | ||
| 44 | - </form> | ||
| 45 | - <div class="uk-modal-footer uk-text-right" style="margin-top: 5px;"> | ||
| 46 | - <button type="button" class="uk-button uk-modal-close">取消</button> | ||
| 47 | - <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> 保存</button> | ||
| 48 | - </div> | ||
| 49 | - | ||
| 50 | - <script> | ||
| 51 | - (function () { | ||
| 52 | - var wrap = '#add-sub-task-main-modal .add_range_wrap', | ||
| 53 | - sch, nextSch, stationRoutes, f1, f2, df1, df2, topf = $('.st_range_top_form', wrap); | ||
| 54 | - | ||
| 55 | - $(wrap).on('init', function (e, data) { | ||
| 56 | - e.stopPropagation(); | ||
| 57 | - sch = data.sch; | ||
| 58 | - nextSch = gb_schedule_table.getNextNormalSch(sch); | ||
| 59 | - if(!nextSch || nextSch.bcType!='normal'){ | ||
| 60 | - $(wrap).html('<div class="err_panel">无法做区间调头,原因是没有找到返程班次!</div>'); | ||
| 61 | - return; | ||
| 62 | - } | ||
| 63 | - | ||
| 64 | - //站点路由 | ||
| 65 | - stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) { | ||
| 66 | - return a.stationRouteCode - b.stationRouteCode; | ||
| 67 | - }), 'directions'); | ||
| 68 | - //第一段营运 | ||
| 69 | - f1 = addTaskForm(); | ||
| 70 | - $f('startStation', f1).trigger('change'); | ||
| 71 | - | ||
| 72 | - disabled_form(f1); | ||
| 73 | - $('.domains', f1).empty(); | ||
| 74 | - //top form 站点select | ||
| 75 | - $('#turnStationSelect', topf).append($f('startStation', f1).html()).on('change', changeTurnStation); | ||
| 76 | - //top form 原因select | ||
| 77 | - var opts = ''; | ||
| 78 | - $.each(gb_common.adjustExps, function () { | ||
| 79 | - opts += '<option value="' + this + '">' + this + '</option>'; | ||
| 80 | - }); | ||
| 81 | - $('#turnReason', topf).append(opts).on('change', changeTurnReason); | ||
| 82 | - //调头空驶 | ||
| 83 | - $('#emptyTurnCbox',topf).html('<input type="checkbox"> 调头空驶回 ' + sch.qdzName); | ||
| 84 | - $('#emptyTurnCbox input',topf).on('click', emptyTurn); | ||
| 85 | - }); | ||
| 86 | - | ||
| 87 | - | ||
| 88 | - function addTaskForm() { | ||
| 89 | - var htmlStr = template('sub-task-v2-form-temp', {sch: sch}); | ||
| 90 | - var f = $(htmlStr); | ||
| 91 | - $('.forms', wrap).append(f); | ||
| 92 | - //字典转换 | ||
| 93 | - dictionaryUtils.transformDom($('.nt-dictionary', f)); | ||
| 94 | - | ||
| 95 | - //班次类型切换 | ||
| 96 | - $('select[name=type2]', f).trigger('change'); | ||
| 97 | - | ||
| 98 | - //滚动条到底 | ||
| 99 | - //$('.forms', wrap).scrollTop($('.forms', wrap)[0].scrollHeight); | ||
| 100 | - | ||
| 101 | - f.formValidation({ | ||
| 102 | - framework: 'uikit', | ||
| 103 | - locale: 'zh_CN' | ||
| 104 | - }).on('add_reason_field', function () { | ||
| 105 | - $(this).formValidation('addField', 'reason'); | ||
| 106 | - }); | ||
| 107 | - return f; | ||
| 108 | - } | ||
| 109 | - | ||
| 110 | - function disabled_form(f) { | ||
| 111 | - //$('input,select',f).attr('disabled', 'disabled'); | ||
| 112 | - $f('type2', f).attr('disabled', 'disabled'); | ||
| 113 | - $f('startStation', f).attr('disabled', 'disabled'); | ||
| 114 | - $f('endStation', f).attr('disabled', 'disabled'); | ||
| 115 | - $f('mileageType', f).attr('disabled', 'disabled'); | ||
| 116 | - $f('destroy', f).attr('disabled', 'disabled'); | ||
| 117 | - return f; | ||
| 118 | - } | ||
| 119 | - | ||
| 120 | - function $f(name, f) { | ||
| 121 | - return $('[name=' + name + ']', f); | ||
| 122 | - } | ||
| 123 | - | ||
| 124 | - | ||
| 125 | - /** | ||
| 126 | - * 切换调头站点 | ||
| 127 | - */ | ||
| 128 | - function changeTurnStation() { | ||
| 129 | - f1.nextAll('.sub_task_form_v2').remove(); | ||
| 130 | - //掉头站点编码 | ||
| 131 | - var eCode = $('#turnStationSelect', topf).val(); | ||
| 132 | - if(!eCode){ | ||
| 133 | - //$('.footer_mileage_count', '#add-sub-task-main-modal').trigger('refresh'); | ||
| 134 | - $f('endStation', f1).val(sch.zdzCode).trigger('change'); | ||
| 135 | - $('#emptyTurnCbox input')[0].checked=false; | ||
| 136 | - return; | ||
| 137 | - } | ||
| 138 | - | ||
| 139 | - //烂班1 | ||
| 140 | - df1 = destroyForm(disabled_form(addTaskForm())); | ||
| 141 | - //烂班2 | ||
| 142 | - df2 = destroyForm(disabled_form(addTaskForm())); | ||
| 143 | - //营运2 | ||
| 144 | - f2 = disabled_form(addTaskForm()); | ||
| 145 | - $('.domains', f2).empty(); | ||
| 146 | - | ||
| 147 | - | ||
| 148 | - //营运1终点 | ||
| 149 | - $f('endStation', f1).val(eCode).trigger('change'); | ||
| 150 | - //烂班1起点 | ||
| 151 | - $f('startStation', df1).val(eCode).trigger('change'); | ||
| 152 | - //烂班2 | ||
| 153 | - $f('startStation', df2).val(sch.zdzCode); | ||
| 154 | - $f('endStation', df2).val(eCode); | ||
| 155 | - $f('mileage', df2).val($f('mileage', df1).val()).trigger('input'); | ||
| 156 | - $('[sch_id_inp]', df2).val(nextSch.id); | ||
| 157 | - //营运2 | ||
| 158 | - $f('startStation', f2).val(eCode); | ||
| 159 | - $f('endStation', f2).val(sch.qdzCode); | ||
| 160 | - $f('startDate',f2).val($f('endDate',f1).val()); | ||
| 161 | - $f('mileage', f2).val($f('mileage', f1).val()).trigger('input'); | ||
| 162 | - $('[sch_id_inp]', f2).val(nextSch.id); | ||
| 163 | - | ||
| 164 | - //set css | ||
| 165 | - //setCss(); | ||
| 166 | - //reason | ||
| 167 | - changeTurnReason(); | ||
| 168 | - } | ||
| 169 | - | ||
| 170 | - /** | ||
| 171 | - * 切换调头原因 | ||
| 172 | - */ | ||
| 173 | - function changeTurnReason() { | ||
| 174 | - var reason = $('#turnReason',topf).val(); | ||
| 175 | - if(reason){ | ||
| 176 | - $('.sub_task_form_v2 [name=reason]', wrap).val(reason).trigger('change'); | ||
| 177 | - //var reInput=$('.remarks_form [name=remarks]', wrap); | ||
| 178 | - //reInput.val(reInput.val() + reason + ','); | ||
| 179 | - } | ||
| 180 | - } | ||
| 181 | - | ||
| 182 | - function destroyForm(f) { | ||
| 183 | - $f('destroy', f)[0].checked = true; | ||
| 184 | - $('.destroy_reason_wrap', f).show(); | ||
| 185 | - f.addClass('destroy_form'); | ||
| 186 | - f.attr('destroy', true); | ||
| 187 | - return f; | ||
| 188 | - } | ||
| 189 | - | ||
| 190 | - /*function setCss() { | ||
| 191 | - $('.sub_task_form_v2', wrap).each(function () { | ||
| 192 | - if($(this).hasClass('destroy_form')) | ||
| 193 | - return true; | ||
| 194 | - | ||
| 195 | - if($f('mileageType', this).val()=='service') | ||
| 196 | - $(this).addClass('service_st_form'); | ||
| 197 | - else | ||
| 198 | - $(this).removeClass('service_st_form'); | ||
| 199 | - }); | ||
| 200 | - }*/ | ||
| 201 | - | ||
| 202 | - /** | ||
| 203 | - * 空驶调头 | ||
| 204 | - */ | ||
| 205 | - function emptyTurn() { | ||
| 206 | - if($('#turnStationSelect', topf).val()==''){ | ||
| 207 | - notify_err('你必须先选择调头站点!'); | ||
| 208 | - this.checked=false; | ||
| 209 | - return; | ||
| 210 | - } | ||
| 211 | - if(this.checked){ | ||
| 212 | - //烂班2 烂全程 | ||
| 213 | - $f('startStation', df2).val(sch.zdzCode); | ||
| 214 | - $f('endStation', df2).val(sch.qdzCode); | ||
| 215 | - $f('mileage', df2).val(nextSch.jhlcOrig); | ||
| 216 | - $f('startDate', df2).val(nextSch.dfsj); | ||
| 217 | - $f('endDate', df2).val(nextSch.zdsj); | ||
| 218 | - //营运2 变空驶 | ||
| 219 | - //f2.removeClass('service_st_form'); | ||
| 220 | - $f('mileageType',f2).val('empty').trigger('change'); | ||
| 221 | - } | ||
| 222 | - else{ | ||
| 223 | - changeTurnStation(); | ||
| 224 | - } | ||
| 225 | - | ||
| 226 | - //$f('mileage', df2).trigger('input'); | ||
| 227 | - } | ||
| 228 | - | ||
| 229 | - //提交 | ||
| 230 | - $('button[type=submit]', wrap).on('click', function () { | ||
| 231 | - $(this).addClass('disabled').attr('disabled','disabled'); | ||
| 232 | - dataArray = []; | ||
| 233 | - $('form.sub_task_form_v2', wrap).data('valid', false) | ||
| 234 | - .formValidation('validate'); | ||
| 235 | - }); | ||
| 236 | - | ||
| 237 | - var dataArray = []; | ||
| 238 | - $(wrap).on('success.form.fv', 'form.sub_task_form_v2', function (e) { | ||
| 239 | - e.preventDefault(); | ||
| 240 | - | ||
| 241 | - dataArray.push($.extend($(this).serializeJSON(), gb_common.getDisabledVal(this) | ||
| 242 | - , {remarks: $('#form-s-t',wrap).val()})); | ||
| 243 | - $(this).data('valid', true); | ||
| 244 | - | ||
| 245 | - if (allValidSuccess()) { | ||
| 246 | - var i = 0; | ||
| 247 | - (function () { | ||
| 248 | - var f = arguments.callee; | ||
| 249 | - if (i >= dataArray.length) { | ||
| 250 | - /** | ||
| 251 | - * 为班次添加备注 | ||
| 252 | - */ | ||
| 253 | - //var remarks = '调头' + $('[name=endDate]', csf).val() + ' 因 ' + $.trim($('#turnReason', modal).val()) + '在' + $('[name=endStation] option:selected', csf).text() + '调头'; | ||
| 254 | - //gb_schedule_table.addRemarks([sch, nextSch], gb_common.trim(remarks, 'g')); | ||
| 255 | - UIkit.modal('#add-sub-task-main-modal').hide(); | ||
| 256 | - $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: sch}); | ||
| 257 | - gb_data_basic.reload_stat_park_data(); | ||
| 258 | - return; | ||
| 259 | - } | ||
| 260 | - var data = dataArray[i]; | ||
| 261 | - //营运子任务不写备注 | ||
| 262 | - if(data.mileageType == 'service' && !data.destroy) | ||
| 263 | - data.remarks = ''; | ||
| 264 | - gb_common.$post('/childTask', data, function (rs) { | ||
| 265 | - notify_succ('子任务添加成功'); | ||
| 266 | - gb_schedule_table.updateSchedule(rs.t); | ||
| 267 | - i++; | ||
| 268 | - f(); | ||
| 269 | - }); | ||
| 270 | - })(); | ||
| 271 | - } | ||
| 272 | - }); | ||
| 273 | - //校验不过 | ||
| 274 | - $(wrap).on('err.field.fv','form.sub_task_form_v2', function () { | ||
| 275 | - $('button[type=submit]', wrap).removeClass('disabled').removeAttr('disabled'); | ||
| 276 | - }); | ||
| 277 | - | ||
| 278 | - function allValidSuccess() { | ||
| 279 | - var flag = true; | ||
| 280 | - $('form.sub_task_form_v2', wrap).each(function (i, f) { | ||
| 281 | - if(!$(f).data('valid')){ | ||
| 282 | - flag = false; | ||
| 283 | - return false; | ||
| 284 | - } | ||
| 285 | - }); | ||
| 286 | - return flag; | ||
| 287 | - } | ||
| 288 | - })(); | ||
| 289 | - </script> | 1 | +<div class="add_range_wrap"> |
| 2 | + <div> | ||
| 3 | + <form class="uk-form uk-form-horizontal st_range_top_form"> | ||
| 4 | + <div class="uk-grid"> | ||
| 5 | + <div class="uk-width-1-3"> | ||
| 6 | + <div class="uk-form-row" style="padding-left: 10px;"> | ||
| 7 | + <label class="uk-form-label">调头站点</label> | ||
| 8 | + <div class="uk-form-controls"> | ||
| 9 | + <select id="turnStationSelect"> | ||
| 10 | + <option value="">请选择...</option> | ||
| 11 | + </select> | ||
| 12 | + </div> | ||
| 13 | + </div> | ||
| 14 | + </div> | ||
| 15 | + <div class="uk-width-1-3"> | ||
| 16 | + <div class="uk-form-row"> | ||
| 17 | + <label class="uk-form-label">调头原因</label> | ||
| 18 | + <div class="uk-form-controls"> | ||
| 19 | + <select id="turnReason" style="width: calc(100% - 13px);"> | ||
| 20 | + <option value="">请选择...</option> | ||
| 21 | + </select> | ||
| 22 | + </div> | ||
| 23 | + </div> | ||
| 24 | + </div> | ||
| 25 | + <div class="uk-width-1-3" style="padding: 28px 0 0 28px;"> | ||
| 26 | + <label id="emptyTurnCbox"></label> | ||
| 27 | + </div> | ||
| 28 | + </div> | ||
| 29 | + </form> | ||
| 30 | + </div> | ||
| 31 | + | ||
| 32 | + <div class="forms"></div> | ||
| 33 | + <form class="uk-form remarks_form"> | ||
| 34 | + <div class="uk-grid"> | ||
| 35 | + <div class="uk-width-1-1"> | ||
| 36 | + <div class="uk-form-row ct-stacked"> | ||
| 37 | + <div class="uk-form-controls" style="margin-top: 5px;"> | ||
| 38 | + <textarea id="form-s-t" rows="4" name="remarks" data-fv-stringlength="true" style="width: 100%;" | ||
| 39 | + data-fv-stringlength-max="50" placeholder="备注,不超过50个字符"></textarea> | ||
| 40 | + </div> | ||
| 41 | + </div> | ||
| 42 | + </div> | ||
| 43 | + </div> | ||
| 44 | + </form> | ||
| 45 | + <div class="uk-modal-footer uk-text-right" style="margin-top: 5px;"> | ||
| 46 | + <button type="button" class="uk-button uk-modal-close">取消</button> | ||
| 47 | + <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> 保存</button> | ||
| 48 | + </div> | ||
| 49 | + | ||
| 50 | + <script> | ||
| 51 | + (function () { | ||
| 52 | + var wrap = '#add-sub-task-main-modal .add_range_wrap', | ||
| 53 | + sch, nextSch, stationRoutes, f1, f2, df1, df2, topf = $('.st_range_top_form', wrap); | ||
| 54 | + | ||
| 55 | + $(wrap).on('init', function (e, data) { | ||
| 56 | + e.stopPropagation(); | ||
| 57 | + sch = data.sch; | ||
| 58 | + nextSch = gb_schedule_table.getNextNormalSch(sch); | ||
| 59 | + if(!nextSch || nextSch.bcType!='normal'){ | ||
| 60 | + $(wrap).html('<div class="err_panel">无法做区间调头,原因是没有找到返程班次!</div>'); | ||
| 61 | + return; | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + //站点路由 | ||
| 65 | + stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) { | ||
| 66 | + return a.stationRouteCode - b.stationRouteCode; | ||
| 67 | + }), 'directions'); | ||
| 68 | + //第一段营运 | ||
| 69 | + f1 = addTaskForm(); | ||
| 70 | + $f('startStation', f1).trigger('change'); | ||
| 71 | + | ||
| 72 | + disabled_form(f1); | ||
| 73 | + $('.domains', f1).empty(); | ||
| 74 | + //top form 站点select | ||
| 75 | + $('#turnStationSelect', topf).append($f('startStation', f1).html()).on('change', changeTurnStation); | ||
| 76 | + //top form 原因select | ||
| 77 | + var opts = ''; | ||
| 78 | + $.each(gb_common.adjustExps, function () { | ||
| 79 | + opts += '<option value="' + this + '">' + this + '</option>'; | ||
| 80 | + }); | ||
| 81 | + $('#turnReason', topf).append(opts).on('change', changeTurnReason); | ||
| 82 | + //调头空驶 | ||
| 83 | + $('#emptyTurnCbox',topf).html('<input type="checkbox"> 调头空驶回 ' + sch.qdzName); | ||
| 84 | + $('#emptyTurnCbox input',topf).on('click', emptyTurn); | ||
| 85 | + }); | ||
| 86 | + | ||
| 87 | + | ||
| 88 | + function addTaskForm() { | ||
| 89 | + var htmlStr = template('sub-task-v2-form-temp', {sch: sch}); | ||
| 90 | + var f = $(htmlStr); | ||
| 91 | + $('.forms', wrap).append(f); | ||
| 92 | + //字典转换 | ||
| 93 | + dictionaryUtils.transformDom($('.nt-dictionary', f)); | ||
| 94 | + | ||
| 95 | + //班次类型切换 | ||
| 96 | + $('select[name=type2]', f).trigger('change'); | ||
| 97 | + | ||
| 98 | + //滚动条到底 | ||
| 99 | + //$('.forms', wrap).scrollTop($('.forms', wrap)[0].scrollHeight); | ||
| 100 | + | ||
| 101 | + f.formValidation({ | ||
| 102 | + framework: 'uikit', | ||
| 103 | + locale: 'zh_CN' | ||
| 104 | + }).on('add_reason_field', function () { | ||
| 105 | + $(this).formValidation('addField', 'reason'); | ||
| 106 | + }); | ||
| 107 | + return f; | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + function disabled_form(f) { | ||
| 111 | + //$('input,select',f).attr('disabled', 'disabled'); | ||
| 112 | + $f('type2', f).attr('disabled', 'disabled'); | ||
| 113 | + $f('startStation', f).attr('disabled', 'disabled'); | ||
| 114 | + $f('endStation', f).attr('disabled', 'disabled'); | ||
| 115 | + $f('mileageType', f).attr('disabled', 'disabled'); | ||
| 116 | + $f('destroy', f).attr('disabled', 'disabled'); | ||
| 117 | + return f; | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + function $f(name, f) { | ||
| 121 | + return $('[name=' + name + ']', f); | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + | ||
| 125 | + /** | ||
| 126 | + * 切换调头站点 | ||
| 127 | + */ | ||
| 128 | + function changeTurnStation() { | ||
| 129 | + f1.nextAll('.sub_task_form_v2').remove(); | ||
| 130 | + //掉头站点编码 | ||
| 131 | + var eCode = $('#turnStationSelect', topf).val(); | ||
| 132 | + if(!eCode){ | ||
| 133 | + //$('.footer_mileage_count', '#add-sub-task-main-modal').trigger('refresh'); | ||
| 134 | + $f('endStation', f1).val(sch.zdzCode).trigger('change'); | ||
| 135 | + $('#emptyTurnCbox input')[0].checked=false; | ||
| 136 | + return; | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + //烂班1 | ||
| 140 | + df1 = destroyForm(disabled_form(addTaskForm())); | ||
| 141 | + //烂班2 | ||
| 142 | + df2 = destroyForm(disabled_form(addTaskForm())); | ||
| 143 | + //营运2 | ||
| 144 | + f2 = disabled_form(addTaskForm()); | ||
| 145 | + $('.domains', f2).empty(); | ||
| 146 | + | ||
| 147 | + | ||
| 148 | + //营运1终点 | ||
| 149 | + $f('endStation', f1).val(eCode).trigger('change'); | ||
| 150 | + //烂班1起点 | ||
| 151 | + $f('startStation', df1).val(eCode).trigger('change'); | ||
| 152 | + //烂班2 | ||
| 153 | + $f('startStation', df2).val(sch.zdzCode); | ||
| 154 | + $f('endStation', df2).val(eCode); | ||
| 155 | + $f('mileage', df2).val($f('mileage', df1).val()).trigger('input'); | ||
| 156 | + $('[sch_id_inp]', df2).val(nextSch.id); | ||
| 157 | + //营运2 | ||
| 158 | + $f('startStation', f2).val(eCode); | ||
| 159 | + $f('endStation', f2).val(sch.qdzCode); | ||
| 160 | + $f('startDate',f2).val($f('endDate',f1).val()); | ||
| 161 | + $f('mileage', f2).val($f('mileage', f1).val()).trigger('input'); | ||
| 162 | + $('[sch_id_inp]', f2).val(nextSch.id); | ||
| 163 | + | ||
| 164 | + //set css | ||
| 165 | + //setCss(); | ||
| 166 | + //reason | ||
| 167 | + changeTurnReason(); | ||
| 168 | + } | ||
| 169 | + | ||
| 170 | + /** | ||
| 171 | + * 切换调头原因 | ||
| 172 | + */ | ||
| 173 | + function changeTurnReason() { | ||
| 174 | + var reason = $('#turnReason',topf).val(); | ||
| 175 | + if(reason){ | ||
| 176 | + $('.sub_task_form_v2 [name=reason]', wrap).val(reason).trigger('change'); | ||
| 177 | + //var reInput=$('.remarks_form [name=remarks]', wrap); | ||
| 178 | + //reInput.val(reInput.val() + reason + ','); | ||
| 179 | + } | ||
| 180 | + } | ||
| 181 | + | ||
| 182 | + function destroyForm(f) { | ||
| 183 | + $f('destroy', f)[0].checked = true; | ||
| 184 | + $('.destroy_reason_wrap', f).show(); | ||
| 185 | + f.addClass('destroy_form'); | ||
| 186 | + f.attr('destroy', true); | ||
| 187 | + return f; | ||
| 188 | + } | ||
| 189 | + | ||
| 190 | + /*function setCss() { | ||
| 191 | + $('.sub_task_form_v2', wrap).each(function () { | ||
| 192 | + if($(this).hasClass('destroy_form')) | ||
| 193 | + return true; | ||
| 194 | + | ||
| 195 | + if($f('mileageType', this).val()=='service') | ||
| 196 | + $(this).addClass('service_st_form'); | ||
| 197 | + else | ||
| 198 | + $(this).removeClass('service_st_form'); | ||
| 199 | + }); | ||
| 200 | + }*/ | ||
| 201 | + | ||
| 202 | + /** | ||
| 203 | + * 空驶调头 | ||
| 204 | + */ | ||
| 205 | + function emptyTurn() { | ||
| 206 | + if($('#turnStationSelect', topf).val()==''){ | ||
| 207 | + notify_err('你必须先选择调头站点!'); | ||
| 208 | + this.checked=false; | ||
| 209 | + return; | ||
| 210 | + } | ||
| 211 | + if(this.checked){ | ||
| 212 | + //烂班2 烂全程 | ||
| 213 | + $f('startStation', df2).val(sch.zdzCode); | ||
| 214 | + $f('endStation', df2).val(sch.qdzCode); | ||
| 215 | + $f('mileage', df2).val(nextSch.jhlcOrig); | ||
| 216 | + $f('startDate', df2).val(nextSch.dfsj); | ||
| 217 | + $f('endDate', df2).val(nextSch.zdsj); | ||
| 218 | + //营运2 变空驶 | ||
| 219 | + //f2.removeClass('service_st_form'); | ||
| 220 | + $f('mileageType',f2).val('empty').trigger('change'); | ||
| 221 | + } | ||
| 222 | + else{ | ||
| 223 | + changeTurnStation(); | ||
| 224 | + } | ||
| 225 | + | ||
| 226 | + //$f('mileage', df2).trigger('input'); | ||
| 227 | + } | ||
| 228 | + | ||
| 229 | + //提交 | ||
| 230 | + $('button[type=submit]', wrap).on('click', function () { | ||
| 231 | + $(this).addClass('disabled').attr('disabled','disabled'); | ||
| 232 | + dataArray = []; | ||
| 233 | + $('form.sub_task_form_v2', wrap).data('valid', false) | ||
| 234 | + .formValidation('validate'); | ||
| 235 | + }); | ||
| 236 | + | ||
| 237 | + var dataArray = []; | ||
| 238 | + $(wrap).on('success.form.fv', 'form.sub_task_form_v2', function (e) { | ||
| 239 | + e.preventDefault(); | ||
| 240 | + | ||
| 241 | + dataArray.push($.extend($(this).serializeJSON(), gb_common.getDisabledVal(this) | ||
| 242 | + , {remarks: $('#form-s-t',wrap).val()})); | ||
| 243 | + $(this).data('valid', true); | ||
| 244 | + | ||
| 245 | + if (allValidSuccess()) { | ||
| 246 | + var i = 0; | ||
| 247 | + (function () { | ||
| 248 | + var f = arguments.callee; | ||
| 249 | + if (i >= dataArray.length) { | ||
| 250 | + /** | ||
| 251 | + * 为班次添加备注 | ||
| 252 | + */ | ||
| 253 | + //var remarks = '调头' + $('[name=endDate]', csf).val() + ' 因 ' + $.trim($('#turnReason', modal).val()) + '在' + $('[name=endStation] option:selected', csf).text() + '调头'; | ||
| 254 | + //gb_schedule_table.addRemarks([sch, nextSch], gb_common.trim(remarks, 'g')); | ||
| 255 | + UIkit.modal('#add-sub-task-main-modal').hide(); | ||
| 256 | + $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: sch}); | ||
| 257 | + gb_data_basic.reload_stat_park_data(); | ||
| 258 | + return; | ||
| 259 | + } | ||
| 260 | + var data = dataArray[i]; | ||
| 261 | + //营运子任务不写备注 | ||
| 262 | + if(data.mileageType == 'service' && !data.destroy) | ||
| 263 | + data.remarks = ''; | ||
| 264 | + gb_common.$post('/childTask', data, function (rs) { | ||
| 265 | + notify_succ('子任务添加成功'); | ||
| 266 | + gb_schedule_table.updateSchedule(rs.t); | ||
| 267 | + i++; | ||
| 268 | + f(); | ||
| 269 | + }); | ||
| 270 | + })(); | ||
| 271 | + } | ||
| 272 | + }); | ||
| 273 | + //校验不过 | ||
| 274 | + $(wrap).on('err.field.fv','form.sub_task_form_v2', function () { | ||
| 275 | + $('button[type=submit]', wrap).removeClass('disabled').removeAttr('disabled'); | ||
| 276 | + }); | ||
| 277 | + | ||
| 278 | + function allValidSuccess() { | ||
| 279 | + var flag = true; | ||
| 280 | + $('form.sub_task_form_v2', wrap).each(function (i, f) { | ||
| 281 | + if(!$(f).data('valid')){ | ||
| 282 | + flag = false; | ||
| 283 | + return false; | ||
| 284 | + } | ||
| 285 | + }); | ||
| 286 | + return flag; | ||
| 287 | + } | ||
| 288 | + })(); | ||
| 289 | + </script> | ||
| 290 | </div> | 290 | </div> |
| 291 | \ No newline at end of file | 291 | \ No newline at end of file |
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task_v2/main.html
| 1 | -<div class="uk-modal ct_move_modal" id="add-sub-task-main-modal"> | ||
| 2 | - <div class="uk-modal-dialog" style="width: 1100px;"> | ||
| 3 | - <a href="" class="uk-modal-close uk-close"></a> | ||
| 4 | - <div class="uk-modal-header"> | ||
| 5 | - <h2>添加子任务</h2></div> | ||
| 6 | - | ||
| 7 | - <div class="uk-grid uk-grid-small"> | ||
| 8 | - <div class="uk-width-2-10"> | ||
| 9 | - <ul data-uk-switcher="{connect:'#tempScheduleContent',swiping:false}" class="uk-nav uk-nav-side left_tabs_lg"> | ||
| 10 | - <li name="normal"><a>1、子任务</a></li> | ||
| 11 | - <li name="in_out"><a>2、进出场</a></li> | ||
| 12 | - <li name="range_turn"><a>3、区间调头</a></li> | ||
| 13 | - </ul> | ||
| 14 | - </div> | ||
| 15 | - <div class="uk-width-8-10"> | ||
| 16 | - <ul id="tempScheduleContent" class="uk-switcher"> | ||
| 17 | - <li class="tab_cont normalCont"></li> | ||
| 18 | - <li class="tab_cont inOutCont"></li> | ||
| 19 | - <li class="tab_cont rangeTurnCont"></li> | ||
| 20 | - </ul> | ||
| 21 | - </div> | ||
| 22 | - </div> | ||
| 23 | - | ||
| 24 | - <div class="footer_tools"> | ||
| 25 | - <!-- 底部公里统计栏 --> | ||
| 26 | - <div class="footer_mileage_count"> | ||
| 27 | - 合计 | ||
| 28 | - <span class="service_sum"></span> | ||
| 29 | - <span class="destroy_sum"></span> | ||
| 30 | - <span class="empty_sum"></span> | ||
| 31 | - </div> | ||
| 32 | - <!-- 站到场 链接 --> | ||
| 33 | - <div class="station_to_park_link"> | ||
| 34 | - <a>站 <i class="uk-icon-exchange"></i> 场</a> | ||
| 35 | - </div> | ||
| 36 | - </div> | ||
| 37 | - </div> | ||
| 38 | - | ||
| 39 | - <script id="sub-task-v2-form-temp" type="text/html"> | ||
| 40 | - <form class="uk-form uk-form-horizontal uk-animation-fade sub_task_form_v2"> | ||
| 41 | - <span class="task_form_close_icon"> | ||
| 42 | - <i class="uk-icon-times"></i> | ||
| 43 | - </span> | ||
| 44 | - <input type="hidden" value="{{sch.id}}" name="schedule.id" sch_id_inp> | ||
| 45 | - <input type="hidden" value="正常" name="type1"> | ||
| 46 | - <div class="uk-grid"> | ||
| 47 | - <div class="uk-width-1-3"> | ||
| 48 | - <div class="uk-form-row"> | ||
| 49 | - <label class="uk-form-label">班次类型</label> | ||
| 50 | - <div class="uk-form-controls"> | ||
| 51 | - <select class="form-control nt-dictionary" data-code="-100" name="type2" | ||
| 52 | - data-group=ChildTaskType></select> | ||
| 53 | - </div> | ||
| 54 | - </div> | ||
| 55 | - </div> | ||
| 56 | - <div class="uk-width-1-3"> | ||
| 57 | - <div class="uk-form-row"> | ||
| 58 | - <label class="uk-form-label">起点 </label> | ||
| 59 | - <div class="uk-form-controls"> | ||
| 60 | - <select name="startStation" required></select> | ||
| 61 | - </div> | ||
| 62 | - </div> | ||
| 63 | - </div> | ||
| 64 | - <div class="uk-width-1-3"> | ||
| 65 | - <div class="uk-form-row"> | ||
| 66 | - <label class="uk-form-label">终点</label> | ||
| 67 | - <div class="uk-form-controls"> | ||
| 68 | - <select name="endStation" required></select> | ||
| 69 | - </div> | ||
| 70 | - </div> | ||
| 71 | - </div> | ||
| 72 | - </div> | ||
| 73 | - | ||
| 74 | - <div class="uk-grid"> | ||
| 75 | - <div class="uk-width-1-3"> | ||
| 76 | - <div class="uk-form-row"> | ||
| 77 | - <label class="uk-form-label">开始时间</label> | ||
| 78 | - <div class="uk-form-controls"> | ||
| 79 | - <input name="startDate" value="{{sch.fcsjActual==null?sch.dfsj:sch.fcsjActual}}" type="time" | ||
| 80 | - required> | ||
| 81 | - </div> | ||
| 82 | - </div> | ||
| 83 | - </div> | ||
| 84 | - <div class="uk-width-1-3"> | ||
| 85 | - <div class="uk-form-row"> | ||
| 86 | - <label class="uk-form-label">结束时间</label> | ||
| 87 | - <div class="uk-form-controls"> | ||
| 88 | - <input name="endDate" type="time" required> | ||
| 89 | - </div> | ||
| 90 | - </div> | ||
| 91 | - </div> | ||
| 92 | - <div class="uk-width-1-3"> | ||
| 93 | - <div class="uk-form-row"> | ||
| 94 | - <label class="uk-form-label">公里数</label> | ||
| 95 | - <div class="uk-form-controls"> | ||
| 96 | - <input class="form-control" name="mileage" max=222 data-fv-lessthan-inclusive="false" | ||
| 97 | - required> | ||
| 98 | - </div> | ||
| 99 | - </div> | ||
| 100 | - </div> | ||
| 101 | - </div> | ||
| 102 | - | ||
| 103 | - <div class="uk-grid"> | ||
| 104 | - <div class="uk-width-2-3 domains"></div> | ||
| 105 | - <div class="uk-width-1-3"> | ||
| 106 | - <div class="uk-form-row"> | ||
| 107 | - <label class="uk-form-label">里程类型</label> | ||
| 108 | - <div class="uk-form-controls"> | ||
| 109 | - <select class="form-control nt-dictionary" required name="mileageType" | ||
| 110 | - data-group="MileageType"></select> | ||
| 111 | - </div> | ||
| 112 | - </div> | ||
| 113 | - </div> | ||
| 114 | - </div> | ||
| 115 | - </form> | ||
| 116 | - </script> | ||
| 117 | - | ||
| 118 | - <script id="st-v2-domains-changecar-form-temp" type="text/html"> | ||
| 119 | - <div class="uk-grid"> | ||
| 120 | - <div class="uk-width-1-2"> | ||
| 121 | - <div class="uk-form-row"> | ||
| 122 | - <label class="uk-form-label">车辆编码</label> | ||
| 123 | - <div class="uk-form-controls"> | ||
| 124 | - <div class="uk-autocomplete autocomplete-cars"> | ||
| 125 | - <input type="text" name="nbbm" placeholder="车辆自编号" required> | ||
| 126 | - </div> | ||
| 127 | - </div> | ||
| 128 | - </div> | ||
| 129 | - </div> | ||
| 130 | - <div class="uk-width-1-2 destroy_reason_wrap"> | ||
| 131 | - <div class="uk-form-row"> | ||
| 132 | - <label class="uk-form-label">换车原因</label> | ||
| 133 | - <div class="uk-form-controls"> | ||
| 134 | - <select class="form-control" name="reason" required> | ||
| 135 | - <option value="">请选择...</option> | ||
| 136 | - {{each inOutExps as exp i}} | ||
| 137 | - <option value="{{exp}}">{{exp}}</option> | ||
| 138 | - {{/each}} | ||
| 139 | - </select> | ||
| 140 | - </div> | ||
| 141 | - </div> | ||
| 142 | - </div> | ||
| 143 | - </div> | ||
| 144 | - </script> | ||
| 145 | - | ||
| 146 | - <script id="st-v2-domains-inout-form-temp" type="text/html"> | ||
| 147 | - <div class="uk-grid"> | ||
| 148 | - <div class="uk-width-1-2"> | ||
| 149 | - <div class="uk-form-row" style="padding-top: 5px;"> | ||
| 150 | - <label class="uk-form-label"></label> | ||
| 151 | - <div class="uk-form-controls"> | ||
| 152 | - <label data-uk-tooltip title="如是无人售票线路,忽略这个选项"> | ||
| 153 | - <input type="checkbox" value=1 name="noClerk" class="i-cbox"> 无售票员 | ||
| 154 | - </label> | ||
| 155 | - </div> | ||
| 156 | - </div> | ||
| 157 | - </div> | ||
| 158 | - <div class="uk-width-1-2 destroy_reason_wrap"> | ||
| 159 | - <div class="uk-form-row"> | ||
| 160 | - <label class="uk-form-label">进出场原因</label> | ||
| 161 | - <div class="uk-form-controls"> | ||
| 162 | - <select class="form-control" name="reason" required> | ||
| 163 | - <option value="">请选择...</option> | ||
| 164 | - {{each inOutExps as exp i}} | ||
| 165 | - <option value="{{exp}}">{{exp}}</option> | ||
| 166 | - {{/each}} | ||
| 167 | - </select> | ||
| 168 | - </div> | ||
| 169 | - </div> | ||
| 170 | - </div> | ||
| 171 | - </div> | ||
| 172 | - </script> | ||
| 173 | - | ||
| 174 | - <script id="st-v2-domains-service-form-temp" type="text/html"> | ||
| 175 | - <div class="uk-grid"> | ||
| 176 | - <div class="uk-width-1-2"> | ||
| 177 | - <div class="uk-form-row" style="padding-top: 5px;"> | ||
| 178 | - <label class="uk-form-label"></label> | ||
| 179 | - <div class="uk-form-controls"> | ||
| 180 | - <label> | ||
| 181 | - <input type="checkbox" value=1 name="destroy" class="i-cbox"> 是否烂班 | ||
| 182 | - </label> | ||
| 183 | - </div> | ||
| 184 | - </div> | ||
| 185 | - </div> | ||
| 186 | - <div class="uk-width-1-2 destroy_reason_wrap" style="display: none;"> | ||
| 187 | - <div class="uk-form-row"> | ||
| 188 | - <label class="uk-form-label">烂班原因</label> | ||
| 189 | - <div class="uk-form-controls"> | ||
| 190 | - <select class="form-control" name="reason" required> | ||
| 191 | - <option value="">请选择...</option> | ||
| 192 | - {{each adjustExps as exp i}} | ||
| 193 | - <option value="{{exp}}">{{exp}}</option> | ||
| 194 | - {{/each}} | ||
| 195 | - </select> | ||
| 196 | - </div> | ||
| 197 | - </div> | ||
| 198 | - </div> | ||
| 199 | - </div> | ||
| 200 | - </script> | ||
| 201 | - <script> | ||
| 202 | - (function () { | ||
| 203 | - var modal = '#add-sub-task-main-modal', sch, | ||
| 204 | - stationRoutes, | ||
| 205 | - parks, | ||
| 206 | - information, | ||
| 207 | - st_park_data; | ||
| 208 | - | ||
| 209 | - $(modal).on('init', function (e, data) { | ||
| 210 | - e.stopPropagation(); | ||
| 211 | - sch = data.sch; | ||
| 212 | - | ||
| 213 | - //站到场数据 | ||
| 214 | - st_park_data = gb_data_basic.get_stat_park_data()[sch.xlBm]; | ||
| 215 | - //站点路由 | ||
| 216 | - stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) { | ||
| 217 | - return a.stationRouteCode - b.stationRouteCode; | ||
| 218 | - }), 'directions'); | ||
| 219 | - //停车场 | ||
| 220 | - parks = gb_data_basic.simpleParksArray(); | ||
| 221 | - //线路标准 | ||
| 222 | - information = gb_data_basic.getLineInformation(sch.xlBm); | ||
| 223 | - | ||
| 224 | - var st_doms = gb_schedule_context_menu.get_st_doms(); | ||
| 225 | - //普通 | ||
| 226 | - $('.normalCont', modal).html(st_doms.custom_dom); | ||
| 227 | - $('.add_custom_wrap', modal).trigger('init', data); | ||
| 228 | - | ||
| 229 | - //进出场班次 | ||
| 230 | - if(sch.bcType=='in'||sch.bcType=='out'){ | ||
| 231 | - $('.left_tabs_lg li[name=in_out]').remove(); | ||
| 232 | - $('.left_tabs_lg li[name=range_turn]').remove(); | ||
| 233 | - } | ||
| 234 | - else{ | ||
| 235 | - //进出场 | ||
| 236 | - $('.inOutCont', modal).html(st_doms.inout_dom); | ||
| 237 | - $('.add_inOut_wrap', modal).trigger('init', data); | ||
| 238 | - //区间调头 | ||
| 239 | - $('.rangeTurnCont', modal).html(st_doms.range_dom); | ||
| 240 | - $('.add_range_wrap', modal).trigger('init', data); | ||
| 241 | - } | ||
| 242 | - }); | ||
| 243 | - | ||
| 244 | - //班次类型切换事件 | ||
| 245 | - $(modal).on('change', 'select[name=type2]', reCalcInputs_type); | ||
| 246 | - //烂班选项点击事件 | ||
| 247 | - $(modal).on('change', 'input[name=destroy]', destroyClick); | ||
| 248 | - //起终点站切换事件 | ||
| 249 | - $(modal).on('change', 'select[name=startStation],select[name=endStation]', reCalcInputs_station); | ||
| 250 | - //开始时间改变 | ||
| 251 | - $(modal).on('input', 'input[name=startDate]', reCalcEndTime); | ||
| 252 | - //公里数改变 | ||
| 253 | - $(modal).on('input', 'input[name=mileage]', reCalcMileageCount); | ||
| 254 | - //终点时间改变 | ||
| 255 | - $(modal).on('input', 'input[name=endDate]', reCalcNext_s_time); | ||
| 256 | - //进出场原因切换 | ||
| 257 | - $(modal).on('change', 'select[name=reason]', reSynchroReason); | ||
| 258 | - //里程类型改变 | ||
| 259 | - $(modal).on('change', 'select[name=mileageType]', changeMileageType); | ||
| 260 | - //关闭 | ||
| 261 | - $(modal).on('click', '.task_form_close_icon', closeTaskForm); | ||
| 262 | - | ||
| 263 | - //公里合计footer | ||
| 264 | - var re_count; | ||
| 265 | - $('.footer_mileage_count', modal).on('refresh', function () { | ||
| 266 | - if(re_count) | ||
| 267 | - return; | ||
| 268 | - re_count = true; | ||
| 269 | - var that=this; | ||
| 270 | - setTimeout(function () { | ||
| 271 | - var fs = $('#tempScheduleContent li.uk-active form.sub_task_form_v2', modal); | ||
| 272 | - var s=0,e=0,d=0,mileage; | ||
| 273 | - $.each(fs, function () { | ||
| 274 | - mileage = parseFloat($f('mileage',this).val()); | ||
| 275 | - if($(this).hasClass('destroy_form')) | ||
| 276 | - d = gb_common.accAdd(d, mileage); | ||
| 277 | - else if($(this).hasClass('service_form')) | ||
| 278 | - s = gb_common.accAdd(s, mileage); | ||
| 279 | - else if($(this).hasClass('empty_form')) | ||
| 280 | - e = gb_common.accAdd(e, mileage); | ||
| 281 | - }); | ||
| 282 | - | ||
| 283 | - $('span',that).hide(); | ||
| 284 | - if(s>0) | ||
| 285 | - $('span.service_sum',that).html('营运: ' + s).show(); | ||
| 286 | - if(e>0) | ||
| 287 | - $('span.empty_sum',that).html('空驶: ' + e).show(); | ||
| 288 | - if(d>0) | ||
| 289 | - $('span.destroy_sum',that).html('烂班: ' + d).show(); | ||
| 290 | - re_count=false; | ||
| 291 | - }, 200); | ||
| 292 | - }); | ||
| 293 | - | ||
| 294 | - /** | ||
| 295 | - * 根据班次类型切换起终点下拉框 | ||
| 296 | - */ | ||
| 297 | - function reCalcInputs_type() { | ||
| 298 | - var f = $(this).parents('.sub_task_form_v2'); | ||
| 299 | - | ||
| 300 | - var routes = stationRoutes[sch.xlDir] | ||
| 301 | - , lastCode = routes[routes.length - 1].stationCode | ||
| 302 | - , opts = '', park_opts = ''; | ||
| 303 | - //station options | ||
| 304 | - $.each(routes, function () { | ||
| 305 | - opts += '<option value="' + this.stationCode + '">' + this.stationName + '</option>' | ||
| 306 | - }); | ||
| 307 | - //park options | ||
| 308 | - for (var code in parks) | ||
| 309 | - park_opts += '<option value="' + code + '">' + parks[code] + '</option>'; | ||
| 310 | - | ||
| 311 | - var qdz = $f('startStation', f), zdz = $f('endStation', f), mType = $f('mileageType', f); | ||
| 312 | - var domainsTemp; | ||
| 313 | - switch ($(this).val()) { | ||
| 314 | - case '3'://出场 | ||
| 315 | - qdz.html(park_opts).val(information.carPark); | ||
| 316 | - zdz.html(opts).trigger('change'); | ||
| 317 | - mType.val('empty').attr('disabled', 'disabled').trigger('change'); | ||
| 318 | - domainsTemp = 'st-v2-domains-inout-form-temp'; | ||
| 319 | - /*//如果上一个form是进场 | ||
| 320 | - try { | ||
| 321 | - var prev_f = f.prev('.sub_task_form_v2'); | ||
| 322 | - if ($f('type2', prev_f).val() == 2) | ||
| 323 | - zdz.val($f('startStation', prev_f).val()); | ||
| 324 | - } catch (e) { | ||
| 325 | - console.log(e); | ||
| 326 | - }*/ | ||
| 327 | - break; | ||
| 328 | - case '2'://进场 | ||
| 329 | - qdz.html(opts) | ||
| 330 | - zdz.html(park_opts).val(information.carPark).trigger('change'); | ||
| 331 | - mType.val('empty').attr('disabled', 'disabled').trigger('change'); | ||
| 332 | - domainsTemp = 'st-v2-domains-inout-form-temp'; | ||
| 333 | - break; | ||
| 334 | - default: | ||
| 335 | - qdz.html(opts); | ||
| 336 | - zdz.html(opts).val(lastCode).trigger('change'); | ||
| 337 | - mType.val('service').removeAttr('disabled').trigger('change'); | ||
| 338 | - domainsTemp = 'st-v2-domains-service-form-temp'; | ||
| 339 | - } | ||
| 340 | - | ||
| 341 | - //可变选项区域 | ||
| 342 | - $('.domains', f).html(template(domainsTemp, { | ||
| 343 | - adjustExps: gb_common.adjustExps, | ||
| 344 | - inOutExps: gb_common.inOutExps | ||
| 345 | - })); | ||
| 346 | - | ||
| 347 | - //校验reason | ||
| 348 | - f.trigger('add_reason_field'); | ||
| 349 | - //qdz.trigger('change'); | ||
| 350 | - //zdz.trigger('change'); | ||
| 351 | - } | ||
| 352 | - | ||
| 353 | - /** | ||
| 354 | - * 根据站位站距计算公里和时间 | ||
| 355 | - */ | ||
| 356 | - function reCalcInputs_station() { | ||
| 357 | - var f = $(this).parents('.sub_task_form_v2') | ||
| 358 | - , type2 = $f('type2', f).val()//班次类型 | ||
| 359 | - , qdzCode = $f('startStation', f).val()//起点站 | ||
| 360 | - , zdzCode = $f('endStation', f).val()//终点站 | ||
| 361 | - , startDate = $f('startDate', f).val();//开始时间 | ||
| 362 | - var mileage, time, upDown; | ||
| 363 | - switch (type2) { | ||
| 364 | - case '2': | ||
| 365 | - upDown = inout_updown(qdzCode, sch); | ||
| 366 | - break; | ||
| 367 | - case '3': | ||
| 368 | - upDown = inout_updown(zdzCode, sch); | ||
| 369 | - break; | ||
| 370 | - default: | ||
| 371 | - upDown = sch.xlDir | ||
| 372 | - } | ||
| 373 | - | ||
| 374 | - //从站到场里获取数据 | ||
| 375 | - var stp = search_st_park(f); | ||
| 376 | - if(stp){ | ||
| 377 | - mileage=type2==2?stp['mileage1']:stp['mileage2']; | ||
| 378 | - time=type2==2?stp['time1']:stp['time2']; | ||
| 379 | - } | ||
| 380 | - else{ | ||
| 381 | - if(upDown==-1) | ||
| 382 | - return; | ||
| 383 | - switch (upDown + '_' + type2) { | ||
| 384 | - case '0_3'://上行出场 | ||
| 385 | - mileage = information.upOutMileage; | ||
| 386 | - time = information.upOutTimer; | ||
| 387 | - break; | ||
| 388 | - case '1_3'://下行出场 | ||
| 389 | - mileage = information.downOutMileage; | ||
| 390 | - time = information.downOutTimer; | ||
| 391 | - break; | ||
| 392 | - case '0_2'://上行进场 | ||
| 393 | - mileage = information.upInMileage; | ||
| 394 | - time = information.upInTimer; | ||
| 395 | - break; | ||
| 396 | - case '1_2'://下行进场 | ||
| 397 | - mileage = information.downInMileage; | ||
| 398 | - time = information.downInTimer; | ||
| 399 | - break; | ||
| 400 | - default: | ||
| 401 | - //线路上站点间 | ||
| 402 | - mileage = calcMileageByRoutes(stationRoutes[upDown], qdzCode, zdzCode); | ||
| 403 | - time = gb_common.mul(gb_common.accDiv(sch.bcsj, sch.jhlcOrig), mileage); | ||
| 404 | - } | ||
| 405 | - } | ||
| 406 | - | ||
| 407 | - $f('mileage', f).val(mileage); | ||
| 408 | - var et = moment(startDate, 'HH:mm').add(time, 'minutes'); | ||
| 409 | - $f('endDate', f).val(et.format('HH:mm')); | ||
| 410 | - | ||
| 411 | - if (type2 != 1) { | ||
| 412 | - reCalcEndTime.call(this); | ||
| 413 | - } | ||
| 414 | - reCalcMileageCount(); | ||
| 415 | - } | ||
| 416 | - | ||
| 417 | - /** | ||
| 418 | - * 计算结束时间 | ||
| 419 | - */ | ||
| 420 | - function reCalcEndTime() { | ||
| 421 | - var f = $(this).parents('.sub_task_form_v2') | ||
| 422 | - , startDate = $f('startDate', f).val()//开始时间 | ||
| 423 | - , mileage = $f('mileage', f).val()//公里 | ||
| 424 | - , type2 = $f('type2', f).val();//班次类型 | ||
| 425 | - if (!startDate || !mileage) | ||
| 426 | - return; | ||
| 427 | - | ||
| 428 | - var time; | ||
| 429 | - //从站到场里获取数据 | ||
| 430 | - var stp = search_st_park(f); | ||
| 431 | - if(stp){ | ||
| 432 | - mileage=type2==2?stp['mileage1']:stp['mileage2']; | ||
| 433 | - time=type2==2?stp['time1']:stp['time2']; | ||
| 434 | - } | ||
| 435 | - else{ | ||
| 436 | - if (type2 == 1) { | ||
| 437 | - time = gb_common.mul(gb_common.accDiv(sch.bcsj, sch.jhlcOrig), mileage); | ||
| 438 | - } | ||
| 439 | - else if (type2 == 2) { | ||
| 440 | - //进场 | ||
| 441 | - var qdzCode = $f('startStation', f).val(), | ||
| 442 | - updown = inout_updown(qdzCode, sch); | ||
| 443 | - | ||
| 444 | - if (updown == -1) | ||
| 445 | - return; | ||
| 446 | - time = updown == 0 ? information.upInTimer : information.downInTimer; | ||
| 447 | - } | ||
| 448 | - else if (type2 == 3) { | ||
| 449 | - //出场 | ||
| 450 | - var zdzCode = $f('endStation', f).val(), | ||
| 451 | - updown = inout_updown(zdzCode, sch); | ||
| 452 | - | ||
| 453 | - if (updown == -1) | ||
| 454 | - return; | ||
| 455 | - time = updown == 0 ? information.upOutTimer : information.downOutTimer; | ||
| 456 | - } | ||
| 457 | - } | ||
| 458 | - | ||
| 459 | - var et = moment(startDate, 'HH:mm').add(time, 'minutes'); | ||
| 460 | - $f('endDate', f).val(et.format('HH:mm')).trigger('input'); | ||
| 461 | - } | ||
| 462 | - | ||
| 463 | - /** | ||
| 464 | - * 将结束时间写入下一个表单的开始时间 | ||
| 465 | - */ | ||
| 466 | - function reCalcNext_s_time() { | ||
| 467 | - var f = $(this).parents('.sub_task_form_v2'), | ||
| 468 | - et = $f('endDate', f).val(); | ||
| 469 | - | ||
| 470 | - var nf = gb_common.next_elem('sub_task_form_v2', f); | ||
| 471 | - | ||
| 472 | - if (f.attr('destroy')) | ||
| 473 | - et = $f('startDate', f).val(); | ||
| 474 | - | ||
| 475 | - if (nf.length > 0) { | ||
| 476 | - $f('startDate', nf).val(et).trigger('input'); | ||
| 477 | - } | ||
| 478 | - } | ||
| 479 | - | ||
| 480 | - /** | ||
| 481 | - * 切换原因 | ||
| 482 | - */ | ||
| 483 | - function reSynchroReason() { | ||
| 484 | - var f = $(this).parents('.sub_task_form_v2'), | ||
| 485 | - reason = $(this).val(); | ||
| 486 | - | ||
| 487 | - var nf = gb_common.next_elem('sub_task_form_v2', f), | ||
| 488 | - nInput = $f('reason', nf); | ||
| 489 | - | ||
| 490 | - if (nf.length > 0 && nInput.length > 0) { | ||
| 491 | - nInput.val(reason).trigger('change'); | ||
| 492 | - } | ||
| 493 | - else { | ||
| 494 | - var cont = f.parents('li.tab_cont'), | ||
| 495 | - remInput = $('.remarks_form [name=remarks]', cont); | ||
| 496 | - | ||
| 497 | - if(remInput.val()==reason + ',') | ||
| 498 | - return; | ||
| 499 | - remInput.val(remInput.val() + reason + ','); | ||
| 500 | - } | ||
| 501 | - } | ||
| 502 | - | ||
| 503 | - function calcMileageByRoutes(routes, s, e) { | ||
| 504 | - var code, flag, mileage = 0; | ||
| 505 | - $.each(routes, function () { | ||
| 506 | - code = this['stationCode']; | ||
| 507 | - if (flag) { | ||
| 508 | - if (!this.distances) | ||
| 509 | - this.distances = 0; | ||
| 510 | - mileage = gb_common.accAdd(mileage, this.distances); | ||
| 511 | - } | ||
| 512 | - if (code == s) | ||
| 513 | - flag = true; | ||
| 514 | - if (code == e) | ||
| 515 | - return false; | ||
| 516 | - }); | ||
| 517 | - return mileage; | ||
| 518 | - } | ||
| 519 | - | ||
| 520 | - function destroyClick() { | ||
| 521 | - var f = $(this).parents('.sub_task_form_v2'); | ||
| 522 | - if (this.checked) { | ||
| 523 | - $('.destroy_reason_wrap', f).show(); | ||
| 524 | - f.attr('destroy', true).addClass('destroy_form'); | ||
| 525 | - } | ||
| 526 | - else { | ||
| 527 | - $('.destroy_reason_wrap', f).hide(); | ||
| 528 | - f.removeAttr('destroy').removeClass('destroy_form'); | ||
| 529 | - } | ||
| 530 | - reCalcMileageCount(); | ||
| 531 | - } | ||
| 532 | - | ||
| 533 | - function changeMileageType() { | ||
| 534 | - var f = $(this).parents('.sub_task_form_v2'), | ||
| 535 | - mileageType = $(this).val(); | ||
| 536 | - if (mileageType) { | ||
| 537 | - f.removeClass('service_form empty_form').addClass(mileageType + '_form'); | ||
| 538 | - reCalcMileageCount(); | ||
| 539 | - } | ||
| 540 | - } | ||
| 541 | - | ||
| 542 | - function $f(name, f) { | ||
| 543 | - return $('[name=' + name + ']', f); | ||
| 544 | - } | ||
| 545 | - | ||
| 546 | - function closeTaskForm() { | ||
| 547 | - $(this).parents('.sub_task_form_v2').remove(); | ||
| 548 | - reCalcMileageCount(); | ||
| 549 | - } | ||
| 550 | - | ||
| 551 | - /** | ||
| 552 | - * 进出场上下行 | ||
| 553 | - * @param qdzCode | ||
| 554 | - * @param sch | ||
| 555 | - */ | ||
| 556 | - function inout_updown(station, sch) { | ||
| 557 | - if (station == sch.qdzCode) | ||
| 558 | - return sch.xlDir; | ||
| 559 | - else if (station == sch.zdzCode) | ||
| 560 | - return sch.xlDir == 0 ? 1 : 0; | ||
| 561 | - else | ||
| 562 | - return -1; | ||
| 563 | - } | ||
| 564 | - | ||
| 565 | - function search_st_park(f) { | ||
| 566 | - if(!st_park_data) | ||
| 567 | - return; | ||
| 568 | - var stp; | ||
| 569 | - var qdSelect=$f('startStation', f)[0],zdSelect=$f('endStation', f)[0]; | ||
| 570 | - | ||
| 571 | - var qdzName=qdSelect.options[qdSelect.options.selectedIndex].text, | ||
| 572 | - zdzName=zdSelect.options[zdSelect.options.selectedIndex].text, | ||
| 573 | - type2 = $f('type2', f).val(); | ||
| 574 | - | ||
| 575 | - if(type2!=2 && type2!=3) | ||
| 576 | - return; | ||
| 577 | - | ||
| 578 | - $.each(st_park_data, function () { | ||
| 579 | - if((type2==2 && this.stationName==qdzName && this.parkName==zdzName) | ||
| 580 | - || (type2==3 && this.stationName==zdzName && this.parkName==qdzName)){ | ||
| 581 | - stp = this; | ||
| 582 | - return false; | ||
| 583 | - } | ||
| 584 | - }); | ||
| 585 | - | ||
| 586 | - return stp; | ||
| 587 | - } | ||
| 588 | - | ||
| 589 | - $('.left_tabs_lg', modal).on('show.uk.switcher', reCalcMileageCount); | ||
| 590 | - | ||
| 591 | - function reCalcMileageCount() { | ||
| 592 | - $('.footer_mileage_count', modal).trigger('refresh'); | ||
| 593 | - var f = $(this).parents('.sub_task_form_v2'); | ||
| 594 | - if($f('type2',f).val()==1) | ||
| 595 | - reCalcEndTime.call(this); | ||
| 596 | - } | ||
| 597 | - | ||
| 598 | - | ||
| 599 | - var folder = '/real_control_v2/fragments/line_schedule/context_menu'; | ||
| 600 | - /** | ||
| 601 | - * 弹出站 到 场对照表 | ||
| 602 | - */ | ||
| 603 | - $('.station_to_park_link', modal).on('click', function () { | ||
| 604 | - open_modal(folder + '/utils/station_to_park.html', { | ||
| 605 | - sch: sch | ||
| 606 | - }, {center: false, bgclose: false, modal: false}); | ||
| 607 | - }); | ||
| 608 | - })(); | ||
| 609 | - </script> | 1 | +<div class="uk-modal ct_move_modal" id="add-sub-task-main-modal"> |
| 2 | + <div class="uk-modal-dialog" style="width: 1100px;"> | ||
| 3 | + <a href="" class="uk-modal-close uk-close"></a> | ||
| 4 | + <div class="uk-modal-header"> | ||
| 5 | + <h2>添加子任务</h2></div> | ||
| 6 | + | ||
| 7 | + <div class="uk-grid uk-grid-small"> | ||
| 8 | + <div class="uk-width-2-10"> | ||
| 9 | + <ul data-uk-switcher="{connect:'#tempScheduleContent',swiping:false}" class="uk-nav uk-nav-side left_tabs_lg"> | ||
| 10 | + <li name="normal"><a>1、子任务</a></li> | ||
| 11 | + <li name="in_out"><a>2、进出场</a></li> | ||
| 12 | + <li name="range_turn"><a>3、区间调头</a></li> | ||
| 13 | + </ul> | ||
| 14 | + </div> | ||
| 15 | + <div class="uk-width-8-10"> | ||
| 16 | + <ul id="tempScheduleContent" class="uk-switcher"> | ||
| 17 | + <li class="tab_cont normalCont"></li> | ||
| 18 | + <li class="tab_cont inOutCont"></li> | ||
| 19 | + <li class="tab_cont rangeTurnCont"></li> | ||
| 20 | + </ul> | ||
| 21 | + </div> | ||
| 22 | + </div> | ||
| 23 | + | ||
| 24 | + <div class="footer_tools"> | ||
| 25 | + <!-- 底部公里统计栏 --> | ||
| 26 | + <div class="footer_mileage_count"> | ||
| 27 | + 合计 | ||
| 28 | + <span class="service_sum"></span> | ||
| 29 | + <span class="destroy_sum"></span> | ||
| 30 | + <span class="empty_sum"></span> | ||
| 31 | + </div> | ||
| 32 | + <!-- 站到场 链接 --> | ||
| 33 | + <div class="station_to_park_link"> | ||
| 34 | + <a>站 <i class="uk-icon-exchange"></i> 场</a> | ||
| 35 | + </div> | ||
| 36 | + </div> | ||
| 37 | + </div> | ||
| 38 | + | ||
| 39 | + <script id="sub-task-v2-form-temp" type="text/html"> | ||
| 40 | + <form class="uk-form uk-form-horizontal uk-animation-fade sub_task_form_v2"> | ||
| 41 | + <span class="task_form_close_icon"> | ||
| 42 | + <i class="uk-icon-times"></i> | ||
| 43 | + </span> | ||
| 44 | + <input type="hidden" value="{{sch.id}}" name="schedule.id" sch_id_inp> | ||
| 45 | + <input type="hidden" value="正常" name="type1"> | ||
| 46 | + <div class="uk-grid"> | ||
| 47 | + <div class="uk-width-1-3"> | ||
| 48 | + <div class="uk-form-row"> | ||
| 49 | + <label class="uk-form-label">班次类型</label> | ||
| 50 | + <div class="uk-form-controls"> | ||
| 51 | + <select class="form-control nt-dictionary" data-code="-100" name="type2" | ||
| 52 | + data-group=ChildTaskType></select> | ||
| 53 | + </div> | ||
| 54 | + </div> | ||
| 55 | + </div> | ||
| 56 | + <div class="uk-width-1-3"> | ||
| 57 | + <div class="uk-form-row"> | ||
| 58 | + <label class="uk-form-label">起点 </label> | ||
| 59 | + <div class="uk-form-controls"> | ||
| 60 | + <select name="startStation" required></select> | ||
| 61 | + </div> | ||
| 62 | + </div> | ||
| 63 | + </div> | ||
| 64 | + <div class="uk-width-1-3"> | ||
| 65 | + <div class="uk-form-row"> | ||
| 66 | + <label class="uk-form-label">终点</label> | ||
| 67 | + <div class="uk-form-controls"> | ||
| 68 | + <select name="endStation" required></select> | ||
| 69 | + </div> | ||
| 70 | + </div> | ||
| 71 | + </div> | ||
| 72 | + </div> | ||
| 73 | + | ||
| 74 | + <div class="uk-grid"> | ||
| 75 | + <div class="uk-width-1-3"> | ||
| 76 | + <div class="uk-form-row"> | ||
| 77 | + <label class="uk-form-label">开始时间</label> | ||
| 78 | + <div class="uk-form-controls"> | ||
| 79 | + <input name="startDate" value="{{sch.fcsjActual==null?sch.dfsj:sch.fcsjActual}}" type="time" | ||
| 80 | + required> | ||
| 81 | + </div> | ||
| 82 | + </div> | ||
| 83 | + </div> | ||
| 84 | + <div class="uk-width-1-3"> | ||
| 85 | + <div class="uk-form-row"> | ||
| 86 | + <label class="uk-form-label">结束时间</label> | ||
| 87 | + <div class="uk-form-controls"> | ||
| 88 | + <input name="endDate" type="time" required> | ||
| 89 | + </div> | ||
| 90 | + </div> | ||
| 91 | + </div> | ||
| 92 | + <div class="uk-width-1-3"> | ||
| 93 | + <div class="uk-form-row"> | ||
| 94 | + <label class="uk-form-label">公里数</label> | ||
| 95 | + <div class="uk-form-controls"> | ||
| 96 | + <input class="form-control" name="mileage" max=222 data-fv-lessthan-inclusive="false" | ||
| 97 | + required> | ||
| 98 | + </div> | ||
| 99 | + </div> | ||
| 100 | + </div> | ||
| 101 | + </div> | ||
| 102 | + | ||
| 103 | + <div class="uk-grid"> | ||
| 104 | + <div class="uk-width-2-3 domains"></div> | ||
| 105 | + <div class="uk-width-1-3"> | ||
| 106 | + <div class="uk-form-row"> | ||
| 107 | + <label class="uk-form-label">里程类型</label> | ||
| 108 | + <div class="uk-form-controls"> | ||
| 109 | + <select class="form-control nt-dictionary" required name="mileageType" | ||
| 110 | + data-group="MileageType"></select> | ||
| 111 | + </div> | ||
| 112 | + </div> | ||
| 113 | + </div> | ||
| 114 | + </div> | ||
| 115 | + </form> | ||
| 116 | + </script> | ||
| 117 | + | ||
| 118 | + <script id="st-v2-domains-changecar-form-temp" type="text/html"> | ||
| 119 | + <div class="uk-grid"> | ||
| 120 | + <div class="uk-width-1-2"> | ||
| 121 | + <div class="uk-form-row"> | ||
| 122 | + <label class="uk-form-label">车辆编码</label> | ||
| 123 | + <div class="uk-form-controls"> | ||
| 124 | + <div class="uk-autocomplete autocomplete-cars"> | ||
| 125 | + <input type="text" name="nbbm" placeholder="车辆自编号" required> | ||
| 126 | + </div> | ||
| 127 | + </div> | ||
| 128 | + </div> | ||
| 129 | + </div> | ||
| 130 | + <div class="uk-width-1-2 destroy_reason_wrap"> | ||
| 131 | + <div class="uk-form-row"> | ||
| 132 | + <label class="uk-form-label">换车原因</label> | ||
| 133 | + <div class="uk-form-controls"> | ||
| 134 | + <select class="form-control" name="reason" required> | ||
| 135 | + <option value="">请选择...</option> | ||
| 136 | + {{each inOutExps as exp i}} | ||
| 137 | + <option value="{{exp}}">{{exp}}</option> | ||
| 138 | + {{/each}} | ||
| 139 | + </select> | ||
| 140 | + </div> | ||
| 141 | + </div> | ||
| 142 | + </div> | ||
| 143 | + </div> | ||
| 144 | + </script> | ||
| 145 | + | ||
| 146 | + <script id="st-v2-domains-inout-form-temp" type="text/html"> | ||
| 147 | + <div class="uk-grid"> | ||
| 148 | + <div class="uk-width-1-2"> | ||
| 149 | + <div class="uk-form-row" style="padding-top: 5px;"> | ||
| 150 | + <label class="uk-form-label"></label> | ||
| 151 | + <div class="uk-form-controls"> | ||
| 152 | + <label data-uk-tooltip title="如是无人售票线路,忽略这个选项"> | ||
| 153 | + <input type="checkbox" value=1 name="noClerk" class="i-cbox"> 无售票员 | ||
| 154 | + </label> | ||
| 155 | + </div> | ||
| 156 | + </div> | ||
| 157 | + </div> | ||
| 158 | + <div class="uk-width-1-2 destroy_reason_wrap"> | ||
| 159 | + <div class="uk-form-row"> | ||
| 160 | + <label class="uk-form-label">进出场原因</label> | ||
| 161 | + <div class="uk-form-controls"> | ||
| 162 | + <select class="form-control" name="reason" required> | ||
| 163 | + <option value="">请选择...</option> | ||
| 164 | + {{each inOutExps as exp i}} | ||
| 165 | + <option value="{{exp}}">{{exp}}</option> | ||
| 166 | + {{/each}} | ||
| 167 | + </select> | ||
| 168 | + </div> | ||
| 169 | + </div> | ||
| 170 | + </div> | ||
| 171 | + </div> | ||
| 172 | + </script> | ||
| 173 | + | ||
| 174 | + <script id="st-v2-domains-service-form-temp" type="text/html"> | ||
| 175 | + <div class="uk-grid"> | ||
| 176 | + <div class="uk-width-1-2"> | ||
| 177 | + <div class="uk-form-row" style="padding-top: 5px;"> | ||
| 178 | + <label class="uk-form-label"></label> | ||
| 179 | + <div class="uk-form-controls"> | ||
| 180 | + <label> | ||
| 181 | + <input type="checkbox" value=1 name="destroy" class="i-cbox"> 是否烂班 | ||
| 182 | + </label> | ||
| 183 | + </div> | ||
| 184 | + </div> | ||
| 185 | + </div> | ||
| 186 | + <div class="uk-width-1-2 destroy_reason_wrap" style="display: none;"> | ||
| 187 | + <div class="uk-form-row"> | ||
| 188 | + <label class="uk-form-label">烂班原因</label> | ||
| 189 | + <div class="uk-form-controls"> | ||
| 190 | + <select class="form-control" name="reason" required> | ||
| 191 | + <option value="">请选择...</option> | ||
| 192 | + {{each adjustExps as exp i}} | ||
| 193 | + <option value="{{exp}}">{{exp}}</option> | ||
| 194 | + {{/each}} | ||
| 195 | + </select> | ||
| 196 | + </div> | ||
| 197 | + </div> | ||
| 198 | + </div> | ||
| 199 | + </div> | ||
| 200 | + </script> | ||
| 201 | + <script> | ||
| 202 | + (function () { | ||
| 203 | + var modal = '#add-sub-task-main-modal', sch, | ||
| 204 | + stationRoutes, | ||
| 205 | + parks, | ||
| 206 | + information, | ||
| 207 | + st_park_data; | ||
| 208 | + | ||
| 209 | + $(modal).on('init', function (e, data) { | ||
| 210 | + e.stopPropagation(); | ||
| 211 | + sch = data.sch; | ||
| 212 | + | ||
| 213 | + //站到场数据 | ||
| 214 | + st_park_data = gb_data_basic.get_stat_park_data()[sch.xlBm]; | ||
| 215 | + //站点路由 | ||
| 216 | + stationRoutes = gb_common.groupBy(gb_data_basic.stationRoutes(sch.xlBm).sort(function (a, b) { | ||
| 217 | + return a.stationRouteCode - b.stationRouteCode; | ||
| 218 | + }), 'directions'); | ||
| 219 | + //停车场 | ||
| 220 | + parks = gb_data_basic.simpleParksArray(); | ||
| 221 | + //线路标准 | ||
| 222 | + information = gb_data_basic.getLineInformation(sch.xlBm); | ||
| 223 | + | ||
| 224 | + var st_doms = gb_schedule_context_menu.get_st_doms(); | ||
| 225 | + //普通 | ||
| 226 | + $('.normalCont', modal).html(st_doms.custom_dom); | ||
| 227 | + $('.add_custom_wrap', modal).trigger('init', data); | ||
| 228 | + | ||
| 229 | + //进出场班次 | ||
| 230 | + if(sch.bcType=='in'||sch.bcType=='out'){ | ||
| 231 | + $('.left_tabs_lg li[name=in_out]').remove(); | ||
| 232 | + $('.left_tabs_lg li[name=range_turn]').remove(); | ||
| 233 | + } | ||
| 234 | + else{ | ||
| 235 | + //进出场 | ||
| 236 | + $('.inOutCont', modal).html(st_doms.inout_dom); | ||
| 237 | + $('.add_inOut_wrap', modal).trigger('init', data); | ||
| 238 | + //区间调头 | ||
| 239 | + $('.rangeTurnCont', modal).html(st_doms.range_dom); | ||
| 240 | + $('.add_range_wrap', modal).trigger('init', data); | ||
| 241 | + } | ||
| 242 | + }); | ||
| 243 | + | ||
| 244 | + //班次类型切换事件 | ||
| 245 | + $(modal).on('change', 'select[name=type2]', reCalcInputs_type); | ||
| 246 | + //烂班选项点击事件 | ||
| 247 | + $(modal).on('change', 'input[name=destroy]', destroyClick); | ||
| 248 | + //起终点站切换事件 | ||
| 249 | + $(modal).on('change', 'select[name=startStation],select[name=endStation]', reCalcInputs_station); | ||
| 250 | + //开始时间改变 | ||
| 251 | + $(modal).on('input', 'input[name=startDate]', reCalcEndTime); | ||
| 252 | + //公里数改变 | ||
| 253 | + $(modal).on('input', 'input[name=mileage]', reCalcMileageCount); | ||
| 254 | + //终点时间改变 | ||
| 255 | + $(modal).on('input', 'input[name=endDate]', reCalcNext_s_time); | ||
| 256 | + //进出场原因切换 | ||
| 257 | + $(modal).on('change', 'select[name=reason]', reSynchroReason); | ||
| 258 | + //里程类型改变 | ||
| 259 | + $(modal).on('change', 'select[name=mileageType]', changeMileageType); | ||
| 260 | + //关闭 | ||
| 261 | + $(modal).on('click', '.task_form_close_icon', closeTaskForm); | ||
| 262 | + | ||
| 263 | + //公里合计footer | ||
| 264 | + var re_count; | ||
| 265 | + $('.footer_mileage_count', modal).on('refresh', function () { | ||
| 266 | + if(re_count) | ||
| 267 | + return; | ||
| 268 | + re_count = true; | ||
| 269 | + var that=this; | ||
| 270 | + setTimeout(function () { | ||
| 271 | + var fs = $('#tempScheduleContent li.uk-active form.sub_task_form_v2', modal); | ||
| 272 | + var s=0,e=0,d=0,mileage; | ||
| 273 | + $.each(fs, function () { | ||
| 274 | + mileage = parseFloat($f('mileage',this).val()); | ||
| 275 | + if($(this).hasClass('destroy_form')) | ||
| 276 | + d = gb_common.accAdd(d, mileage); | ||
| 277 | + else if($(this).hasClass('service_form')) | ||
| 278 | + s = gb_common.accAdd(s, mileage); | ||
| 279 | + else if($(this).hasClass('empty_form')) | ||
| 280 | + e = gb_common.accAdd(e, mileage); | ||
| 281 | + }); | ||
| 282 | + | ||
| 283 | + $('span',that).hide(); | ||
| 284 | + if(s>0) | ||
| 285 | + $('span.service_sum',that).html('营运: ' + s).show(); | ||
| 286 | + if(e>0) | ||
| 287 | + $('span.empty_sum',that).html('空驶: ' + e).show(); | ||
| 288 | + if(d>0) | ||
| 289 | + $('span.destroy_sum',that).html('烂班: ' + d).show(); | ||
| 290 | + re_count=false; | ||
| 291 | + }, 200); | ||
| 292 | + }); | ||
| 293 | + | ||
| 294 | + /** | ||
| 295 | + * 根据班次类型切换起终点下拉框 | ||
| 296 | + */ | ||
| 297 | + function reCalcInputs_type() { | ||
| 298 | + var f = $(this).parents('.sub_task_form_v2'); | ||
| 299 | + | ||
| 300 | + var routes = stationRoutes[sch.xlDir] | ||
| 301 | + , lastCode = routes[routes.length - 1].stationCode | ||
| 302 | + , opts = '', park_opts = ''; | ||
| 303 | + //station options | ||
| 304 | + $.each(routes, function () { | ||
| 305 | + opts += '<option value="' + this.stationCode + '">' + this.stationName + '</option>' | ||
| 306 | + }); | ||
| 307 | + //park options | ||
| 308 | + for (var code in parks) | ||
| 309 | + park_opts += '<option value="' + code + '">' + parks[code] + '</option>'; | ||
| 310 | + | ||
| 311 | + var qdz = $f('startStation', f), zdz = $f('endStation', f), mType = $f('mileageType', f); | ||
| 312 | + var domainsTemp; | ||
| 313 | + switch ($(this).val()) { | ||
| 314 | + case '3'://出场 | ||
| 315 | + qdz.html(park_opts).val(information.carPark); | ||
| 316 | + zdz.html(opts).trigger('change'); | ||
| 317 | + mType.val('empty').attr('disabled', 'disabled').trigger('change'); | ||
| 318 | + domainsTemp = 'st-v2-domains-inout-form-temp'; | ||
| 319 | + /*//如果上一个form是进场 | ||
| 320 | + try { | ||
| 321 | + var prev_f = f.prev('.sub_task_form_v2'); | ||
| 322 | + if ($f('type2', prev_f).val() == 2) | ||
| 323 | + zdz.val($f('startStation', prev_f).val()); | ||
| 324 | + } catch (e) { | ||
| 325 | + console.log(e); | ||
| 326 | + }*/ | ||
| 327 | + break; | ||
| 328 | + case '2'://进场 | ||
| 329 | + qdz.html(opts) | ||
| 330 | + zdz.html(park_opts).val(information.carPark).trigger('change'); | ||
| 331 | + mType.val('empty').attr('disabled', 'disabled').trigger('change'); | ||
| 332 | + domainsTemp = 'st-v2-domains-inout-form-temp'; | ||
| 333 | + break; | ||
| 334 | + default: | ||
| 335 | + qdz.html(opts); | ||
| 336 | + zdz.html(opts).val(lastCode).trigger('change'); | ||
| 337 | + mType.val('service').removeAttr('disabled').trigger('change'); | ||
| 338 | + domainsTemp = 'st-v2-domains-service-form-temp'; | ||
| 339 | + } | ||
| 340 | + | ||
| 341 | + //可变选项区域 | ||
| 342 | + $('.domains', f).html(template(domainsTemp, { | ||
| 343 | + adjustExps: gb_common.adjustExps, | ||
| 344 | + inOutExps: gb_common.inOutExps | ||
| 345 | + })); | ||
| 346 | + | ||
| 347 | + //校验reason | ||
| 348 | + f.trigger('add_reason_field'); | ||
| 349 | + //qdz.trigger('change'); | ||
| 350 | + //zdz.trigger('change'); | ||
| 351 | + } | ||
| 352 | + | ||
| 353 | + /** | ||
| 354 | + * 根据站位站距计算公里和时间 | ||
| 355 | + */ | ||
| 356 | + function reCalcInputs_station() { | ||
| 357 | + var f = $(this).parents('.sub_task_form_v2') | ||
| 358 | + , type2 = $f('type2', f).val()//班次类型 | ||
| 359 | + , qdzCode = $f('startStation', f).val()//起点站 | ||
| 360 | + , zdzCode = $f('endStation', f).val()//终点站 | ||
| 361 | + , startDate = $f('startDate', f).val();//开始时间 | ||
| 362 | + var mileage, time, upDown; | ||
| 363 | + switch (type2) { | ||
| 364 | + case '2': | ||
| 365 | + upDown = inout_updown(qdzCode, sch); | ||
| 366 | + break; | ||
| 367 | + case '3': | ||
| 368 | + upDown = inout_updown(zdzCode, sch); | ||
| 369 | + break; | ||
| 370 | + default: | ||
| 371 | + upDown = sch.xlDir | ||
| 372 | + } | ||
| 373 | + | ||
| 374 | + //从站到场里获取数据 | ||
| 375 | + var stp = search_st_park(f); | ||
| 376 | + if(stp){ | ||
| 377 | + mileage=type2==2?stp['mileage1']:stp['mileage2']; | ||
| 378 | + time=type2==2?stp['time1']:stp['time2']; | ||
| 379 | + } | ||
| 380 | + else{ | ||
| 381 | + if(upDown==-1) | ||
| 382 | + return; | ||
| 383 | + switch (upDown + '_' + type2) { | ||
| 384 | + case '0_3'://上行出场 | ||
| 385 | + mileage = information.upOutMileage; | ||
| 386 | + time = information.upOutTimer; | ||
| 387 | + break; | ||
| 388 | + case '1_3'://下行出场 | ||
| 389 | + mileage = information.downOutMileage; | ||
| 390 | + time = information.downOutTimer; | ||
| 391 | + break; | ||
| 392 | + case '0_2'://上行进场 | ||
| 393 | + mileage = information.upInMileage; | ||
| 394 | + time = information.upInTimer; | ||
| 395 | + break; | ||
| 396 | + case '1_2'://下行进场 | ||
| 397 | + mileage = information.downInMileage; | ||
| 398 | + time = information.downInTimer; | ||
| 399 | + break; | ||
| 400 | + default: | ||
| 401 | + //线路上站点间 | ||
| 402 | + mileage = calcMileageByRoutes(stationRoutes[upDown], qdzCode, zdzCode); | ||
| 403 | + time = gb_common.mul(gb_common.accDiv(sch.bcsj, sch.jhlcOrig), mileage); | ||
| 404 | + } | ||
| 405 | + } | ||
| 406 | + | ||
| 407 | + $f('mileage', f).val(mileage); | ||
| 408 | + var et = moment(startDate, 'HH:mm').add(time, 'minutes'); | ||
| 409 | + $f('endDate', f).val(et.format('HH:mm')); | ||
| 410 | + | ||
| 411 | + if (type2 != 1) { | ||
| 412 | + reCalcEndTime.call(this); | ||
| 413 | + } | ||
| 414 | + reCalcMileageCount(); | ||
| 415 | + } | ||
| 416 | + | ||
| 417 | + /** | ||
| 418 | + * 计算结束时间 | ||
| 419 | + */ | ||
| 420 | + function reCalcEndTime() { | ||
| 421 | + var f = $(this).parents('.sub_task_form_v2') | ||
| 422 | + , startDate = $f('startDate', f).val()//开始时间 | ||
| 423 | + , mileage = $f('mileage', f).val()//公里 | ||
| 424 | + , type2 = $f('type2', f).val();//班次类型 | ||
| 425 | + if (!startDate || !mileage) | ||
| 426 | + return; | ||
| 427 | + | ||
| 428 | + var time; | ||
| 429 | + //从站到场里获取数据 | ||
| 430 | + var stp = search_st_park(f); | ||
| 431 | + if(stp){ | ||
| 432 | + mileage=type2==2?stp['mileage1']:stp['mileage2']; | ||
| 433 | + time=type2==2?stp['time1']:stp['time2']; | ||
| 434 | + } | ||
| 435 | + else{ | ||
| 436 | + if (type2 == 1) { | ||
| 437 | + time = gb_common.mul(gb_common.accDiv(sch.bcsj, sch.jhlcOrig), mileage); | ||
| 438 | + } | ||
| 439 | + else if (type2 == 2) { | ||
| 440 | + //进场 | ||
| 441 | + var qdzCode = $f('startStation', f).val(), | ||
| 442 | + updown = inout_updown(qdzCode, sch); | ||
| 443 | + | ||
| 444 | + if (updown == -1) | ||
| 445 | + return; | ||
| 446 | + time = updown == 0 ? information.upInTimer : information.downInTimer; | ||
| 447 | + } | ||
| 448 | + else if (type2 == 3) { | ||
| 449 | + //出场 | ||
| 450 | + var zdzCode = $f('endStation', f).val(), | ||
| 451 | + updown = inout_updown(zdzCode, sch); | ||
| 452 | + | ||
| 453 | + if (updown == -1) | ||
| 454 | + return; | ||
| 455 | + time = updown == 0 ? information.upOutTimer : information.downOutTimer; | ||
| 456 | + } | ||
| 457 | + } | ||
| 458 | + | ||
| 459 | + var et = moment(startDate, 'HH:mm').add(time, 'minutes'); | ||
| 460 | + $f('endDate', f).val(et.format('HH:mm')).trigger('input'); | ||
| 461 | + } | ||
| 462 | + | ||
| 463 | + /** | ||
| 464 | + * 将结束时间写入下一个表单的开始时间 | ||
| 465 | + */ | ||
| 466 | + function reCalcNext_s_time() { | ||
| 467 | + var f = $(this).parents('.sub_task_form_v2'), | ||
| 468 | + et = $f('endDate', f).val(); | ||
| 469 | + | ||
| 470 | + var nf = gb_common.next_elem('sub_task_form_v2', f); | ||
| 471 | + | ||
| 472 | + if (f.attr('destroy')) | ||
| 473 | + et = $f('startDate', f).val(); | ||
| 474 | + | ||
| 475 | + if (nf.length > 0) { | ||
| 476 | + $f('startDate', nf).val(et).trigger('input'); | ||
| 477 | + } | ||
| 478 | + } | ||
| 479 | + | ||
| 480 | + /** | ||
| 481 | + * 切换原因 | ||
| 482 | + */ | ||
| 483 | + function reSynchroReason() { | ||
| 484 | + var f = $(this).parents('.sub_task_form_v2'), | ||
| 485 | + reason = $(this).val(); | ||
| 486 | + | ||
| 487 | + var nf = gb_common.next_elem('sub_task_form_v2', f), | ||
| 488 | + nInput = $f('reason', nf); | ||
| 489 | + | ||
| 490 | + if (nf.length > 0 && nInput.length > 0) { | ||
| 491 | + nInput.val(reason).trigger('change'); | ||
| 492 | + } | ||
| 493 | + else { | ||
| 494 | + var cont = f.parents('li.tab_cont'), | ||
| 495 | + remInput = $('.remarks_form [name=remarks]', cont); | ||
| 496 | + | ||
| 497 | + if(remInput.val()==reason + ',') | ||
| 498 | + return; | ||
| 499 | + remInput.val(remInput.val() + reason + ','); | ||
| 500 | + } | ||
| 501 | + } | ||
| 502 | + | ||
| 503 | + function calcMileageByRoutes(routes, s, e) { | ||
| 504 | + var code, flag, mileage = 0; | ||
| 505 | + $.each(routes, function () { | ||
| 506 | + code = this['stationCode']; | ||
| 507 | + if (flag) { | ||
| 508 | + if (!this.distances) | ||
| 509 | + this.distances = 0; | ||
| 510 | + mileage = gb_common.accAdd(mileage, this.distances); | ||
| 511 | + } | ||
| 512 | + if (code == s) | ||
| 513 | + flag = true; | ||
| 514 | + if (code == e) | ||
| 515 | + return false; | ||
| 516 | + }); | ||
| 517 | + return mileage; | ||
| 518 | + } | ||
| 519 | + | ||
| 520 | + function destroyClick() { | ||
| 521 | + var f = $(this).parents('.sub_task_form_v2'); | ||
| 522 | + if (this.checked) { | ||
| 523 | + $('.destroy_reason_wrap', f).show(); | ||
| 524 | + f.attr('destroy', true).addClass('destroy_form'); | ||
| 525 | + } | ||
| 526 | + else { | ||
| 527 | + $('.destroy_reason_wrap', f).hide(); | ||
| 528 | + f.removeAttr('destroy').removeClass('destroy_form'); | ||
| 529 | + } | ||
| 530 | + reCalcMileageCount(); | ||
| 531 | + } | ||
| 532 | + | ||
| 533 | + function changeMileageType() { | ||
| 534 | + var f = $(this).parents('.sub_task_form_v2'), | ||
| 535 | + mileageType = $(this).val(); | ||
| 536 | + if (mileageType) { | ||
| 537 | + f.removeClass('service_form empty_form').addClass(mileageType + '_form'); | ||
| 538 | + reCalcMileageCount(); | ||
| 539 | + } | ||
| 540 | + } | ||
| 541 | + | ||
| 542 | + function $f(name, f) { | ||
| 543 | + return $('[name=' + name + ']', f); | ||
| 544 | + } | ||
| 545 | + | ||
| 546 | + function closeTaskForm() { | ||
| 547 | + $(this).parents('.sub_task_form_v2').remove(); | ||
| 548 | + reCalcMileageCount(); | ||
| 549 | + } | ||
| 550 | + | ||
| 551 | + /** | ||
| 552 | + * 进出场上下行 | ||
| 553 | + * @param qdzCode | ||
| 554 | + * @param sch | ||
| 555 | + */ | ||
| 556 | + function inout_updown(station, sch) { | ||
| 557 | + if (station == sch.qdzCode) | ||
| 558 | + return sch.xlDir; | ||
| 559 | + else if (station == sch.zdzCode) | ||
| 560 | + return sch.xlDir == 0 ? 1 : 0; | ||
| 561 | + else | ||
| 562 | + return -1; | ||
| 563 | + } | ||
| 564 | + | ||
| 565 | + function search_st_park(f) { | ||
| 566 | + if(!st_park_data) | ||
| 567 | + return; | ||
| 568 | + var stp; | ||
| 569 | + var qdSelect=$f('startStation', f)[0],zdSelect=$f('endStation', f)[0]; | ||
| 570 | + | ||
| 571 | + var qdzName=qdSelect.options[qdSelect.options.selectedIndex].text, | ||
| 572 | + zdzName=zdSelect.options[zdSelect.options.selectedIndex].text, | ||
| 573 | + type2 = $f('type2', f).val(); | ||
| 574 | + | ||
| 575 | + if(type2!=2 && type2!=3) | ||
| 576 | + return; | ||
| 577 | + | ||
| 578 | + $.each(st_park_data, function () { | ||
| 579 | + if((type2==2 && this.stationName==qdzName && this.parkName==zdzName) | ||
| 580 | + || (type2==3 && this.stationName==zdzName && this.parkName==qdzName)){ | ||
| 581 | + stp = this; | ||
| 582 | + return false; | ||
| 583 | + } | ||
| 584 | + }); | ||
| 585 | + | ||
| 586 | + return stp; | ||
| 587 | + } | ||
| 588 | + | ||
| 589 | + $('.left_tabs_lg', modal).on('show.uk.switcher', reCalcMileageCount); | ||
| 590 | + | ||
| 591 | + function reCalcMileageCount() { | ||
| 592 | + $('.footer_mileage_count', modal).trigger('refresh'); | ||
| 593 | + var f = $(this).parents('.sub_task_form_v2'); | ||
| 594 | + if($f('type2',f).val()==1) | ||
| 595 | + reCalcEndTime.call(this); | ||
| 596 | + } | ||
| 597 | + | ||
| 598 | + | ||
| 599 | + var folder = '/real_control_v2/fragments/line_schedule/context_menu'; | ||
| 600 | + /** | ||
| 601 | + * 弹出站 到 场对照表 | ||
| 602 | + */ | ||
| 603 | + $('.station_to_park_link', modal).on('click', function () { | ||
| 604 | + open_modal(folder + '/utils/station_to_park.html', { | ||
| 605 | + sch: sch | ||
| 606 | + }, {center: false, bgclose: false, modal: false}); | ||
| 607 | + }); | ||
| 608 | + })(); | ||
| 609 | + </script> | ||
| 610 | </div> | 610 | </div> |
| 611 | \ No newline at end of file | 611 | \ No newline at end of file |
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/utils/station_to_park.html
| 1 | -<div class="uk-modal ct-form-modal" id="station_to_park-modal"> | ||
| 2 | - <div class="uk-modal-dialog" style="width: 780px;"> | ||
| 3 | - <a href="" class="uk-modal-close uk-close"></a> | ||
| 4 | - <div class="uk-modal-header"> | ||
| 5 | - <h2>站到场历时、公里对照表</h2></div> | ||
| 6 | - | ||
| 7 | - <div class="ct_lists"> | ||
| 8 | - </div> | ||
| 9 | - | ||
| 10 | - <div class="ct_describe" >从历史的子任务、临加里采集进出场历时和公里</div> | ||
| 11 | - </div> | ||
| 12 | - | ||
| 13 | - <script id="station_park_list-temp" type="text/html"> | ||
| 14 | - {{each list as obj i}} | ||
| 15 | - {{if obj.mileage1 != obj.mileage2}} | ||
| 16 | - <div class="s_2_park_form_wrap" data-id="{{obj.id}}"> | ||
| 17 | - <span class="ct_close"><i class="uk-icon-times"></i></span> | ||
| 18 | - <form class="uk-form"> | ||
| 19 | - {{if obj.time1!=null && obj.mileage1!=null}} | ||
| 20 | - <div class="uk-grid"> | ||
| 21 | - <div class="uk-width-1-4"> | ||
| 22 | - <label class="">起点:</label> | ||
| 23 | - <input type="text" value="{{obj.stationName}}" class="uk-width-1-1" readonly> | ||
| 24 | - </div> | ||
| 25 | - <div class="uk-width-1-4"> | ||
| 26 | - <label>终点:</label> | ||
| 27 | - <input type="text" value="{{obj.parkName}}" class="uk-width-1-1" readonly> | ||
| 28 | - </div> | ||
| 29 | - <div class="uk-width-2-4 uk-grid"> | ||
| 30 | - <div class="uk-width-1-3"> | ||
| 31 | - <label>历时:</label> | ||
| 32 | - <input type="text" value="{{obj.time1}}" class="uk-width-1-1" readonly> | ||
| 33 | - </div> | ||
| 34 | - <div class="uk-width-1-3"> | ||
| 35 | - <label>公里:</label> | ||
| 36 | - <input type="text" value="{{obj.mileage1}}" class="uk-width-1-1" readonly> | ||
| 37 | - </div> | ||
| 38 | - <div class="uk-width-1-3"> | ||
| 39 | - <label class="bottom_label">进场</label> | ||
| 40 | - </div> | ||
| 41 | - </div> | ||
| 42 | - </div> | ||
| 43 | - {{/if}} | ||
| 44 | - {{if obj.time2!=null && obj.mileage2!=null}} | ||
| 45 | - <div class="uk-grid"> | ||
| 46 | - <div class="uk-width-1-4"> | ||
| 47 | - <input type="text" value="{{obj.parkName}}" class="uk-width-1-1" readonly> | ||
| 48 | - </div> | ||
| 49 | - <div class="uk-width-1-4"> | ||
| 50 | - <input type="text" value="{{obj.stationName}}" class="uk-width-1-1" readonly> | ||
| 51 | - </div> | ||
| 52 | - <div class="uk-width-2-4 uk-grid"> | ||
| 53 | - <div class="uk-width-1-3"> | ||
| 54 | - <input type="text" value="{{obj.time2}}" class="uk-width-1-1" readonly> | ||
| 55 | - </div> | ||
| 56 | - <div class="uk-width-1-3"> | ||
| 57 | - <input type="text" value="{{obj.mileage2}}" class="uk-width-1-1" readonly> | ||
| 58 | - </div> | ||
| 59 | - <div class="uk-width-1-3"> | ||
| 60 | - <label class="bottom_label_2">出场</label> | ||
| 61 | - </div> | ||
| 62 | - </div> | ||
| 63 | - </div> | ||
| 64 | - {{/if}} | ||
| 65 | - </form> | ||
| 66 | - </div> | ||
| 67 | - {{else}} | ||
| 68 | - <div class="s_2_park_form_wrap" data-id="{{obj.id}}"> | ||
| 69 | - <span class="ct_close"><i class="uk-icon-times"></i></span> | ||
| 70 | - <form class="uk-form"> | ||
| 71 | - <div class="uk-grid"> | ||
| 72 | - <div class="uk-width-1-4"> | ||
| 73 | - <label class="">起点:</label> | ||
| 74 | - <input type="text" value="{{obj.stationName}}" class="uk-width-1-1" readonly> | ||
| 75 | - </div> | ||
| 76 | - <div class="uk-width-1-4"> | ||
| 77 | - <label>终点:</label> | ||
| 78 | - <input type="text" value="{{obj.parkName}}" class="uk-width-1-1" readonly> | ||
| 79 | - </div> | ||
| 80 | - <div class="uk-width-2-4 uk-grid"> | ||
| 81 | - <div class="uk-width-1-3"> | ||
| 82 | - <label>历时:</label> | ||
| 83 | - <input type="text" value="{{obj.time1}}" class="uk-width-1-1" readonly> | ||
| 84 | - </div> | ||
| 85 | - <div class="uk-width-1-3"> | ||
| 86 | - <label>公里:</label> | ||
| 87 | - <input type="text" value="{{obj.mileage1}}" class="uk-width-1-1" readonly> | ||
| 88 | - </div> | ||
| 89 | - <div class="uk-width-1-3"> | ||
| 90 | - <label class="bottom_label"><input type="checkbox" disabled checked> 进=出 </label> | ||
| 91 | - </div> | ||
| 92 | - </div> | ||
| 93 | - </div> | ||
| 94 | - </form> | ||
| 95 | - </div> | ||
| 96 | - {{/if}} | ||
| 97 | - {{/each}} | ||
| 98 | - </script> | ||
| 99 | - | ||
| 100 | - <script> | ||
| 101 | - (function () { | ||
| 102 | - var modal = '#station_to_park-modal', sch; | ||
| 103 | - | ||
| 104 | - $(modal).on('init', function (e, data) { | ||
| 105 | - e.stopPropagation(); | ||
| 106 | - sch = data.sch; | ||
| 107 | - | ||
| 108 | - var list = gb_data_basic.get_stat_park_data()[sch.xlBm]; | ||
| 109 | - if(!list) | ||
| 110 | - return; | ||
| 111 | - list.sort(function (a, b) { | ||
| 112 | - return a.stationName.localeCompare(b.stationName); | ||
| 113 | - }); | ||
| 114 | - | ||
| 115 | - var htmlStr = template('station_park_list-temp', {list: list}); | ||
| 116 | - $('.ct_lists', modal).html(htmlStr); | ||
| 117 | - }); | ||
| 118 | - | ||
| 119 | - $(modal).on('click', '.s_2_park_form_wrap>.ct_close', function () { | ||
| 120 | - var wrap=$(this).parent(), | ||
| 121 | - id=wrap.data('id'); | ||
| 122 | - | ||
| 123 | - gb_common.$post('/basic/deleteStation2Park', {lineCode: sch.xlBm, id: id}, function () { | ||
| 124 | - gb_data_basic.reload_stat_park_data(); | ||
| 125 | - wrap.remove(); | ||
| 126 | - }); | ||
| 127 | - }); | ||
| 128 | - })(); | ||
| 129 | - </script> | ||
| 130 | -</div> | 1 | +<div class="uk-modal ct-form-modal" id="station_to_park-modal"> |
| 2 | + <div class="uk-modal-dialog" style="width: 780px;"> | ||
| 3 | + <a href="" class="uk-modal-close uk-close"></a> | ||
| 4 | + <div class="uk-modal-header"> | ||
| 5 | + <h2>站到场历时、公里对照表</h2></div> | ||
| 6 | + | ||
| 7 | + <div class="ct_lists"> | ||
| 8 | + </div> | ||
| 9 | + | ||
| 10 | + <div class="ct_describe" >从历史的子任务、临加里采集进出场历时和公里</div> | ||
| 11 | + </div> | ||
| 12 | + | ||
| 13 | + <script id="station_park_list-temp" type="text/html"> | ||
| 14 | + {{each list as obj i}} | ||
| 15 | + {{if obj.mileage1 != obj.mileage2}} | ||
| 16 | + <div class="s_2_park_form_wrap" data-id="{{obj.id}}"> | ||
| 17 | + <span class="ct_close"><i class="uk-icon-times"></i></span> | ||
| 18 | + <form class="uk-form"> | ||
| 19 | + {{if obj.time1!=null && obj.mileage1!=null}} | ||
| 20 | + <div class="uk-grid"> | ||
| 21 | + <div class="uk-width-1-4"> | ||
| 22 | + <label class="">起点:</label> | ||
| 23 | + <input type="text" value="{{obj.stationName}}" class="uk-width-1-1" readonly> | ||
| 24 | + </div> | ||
| 25 | + <div class="uk-width-1-4"> | ||
| 26 | + <label>终点:</label> | ||
| 27 | + <input type="text" value="{{obj.parkName}}" class="uk-width-1-1" readonly> | ||
| 28 | + </div> | ||
| 29 | + <div class="uk-width-2-4 uk-grid"> | ||
| 30 | + <div class="uk-width-1-3"> | ||
| 31 | + <label>历时:</label> | ||
| 32 | + <input type="text" value="{{obj.time1}}" class="uk-width-1-1" readonly> | ||
| 33 | + </div> | ||
| 34 | + <div class="uk-width-1-3"> | ||
| 35 | + <label>公里:</label> | ||
| 36 | + <input type="text" value="{{obj.mileage1}}" class="uk-width-1-1" readonly> | ||
| 37 | + </div> | ||
| 38 | + <div class="uk-width-1-3"> | ||
| 39 | + <label class="bottom_label">进场</label> | ||
| 40 | + </div> | ||
| 41 | + </div> | ||
| 42 | + </div> | ||
| 43 | + {{/if}} | ||
| 44 | + {{if obj.time2!=null && obj.mileage2!=null}} | ||
| 45 | + <div class="uk-grid"> | ||
| 46 | + <div class="uk-width-1-4"> | ||
| 47 | + <input type="text" value="{{obj.parkName}}" class="uk-width-1-1" readonly> | ||
| 48 | + </div> | ||
| 49 | + <div class="uk-width-1-4"> | ||
| 50 | + <input type="text" value="{{obj.stationName}}" class="uk-width-1-1" readonly> | ||
| 51 | + </div> | ||
| 52 | + <div class="uk-width-2-4 uk-grid"> | ||
| 53 | + <div class="uk-width-1-3"> | ||
| 54 | + <input type="text" value="{{obj.time2}}" class="uk-width-1-1" readonly> | ||
| 55 | + </div> | ||
| 56 | + <div class="uk-width-1-3"> | ||
| 57 | + <input type="text" value="{{obj.mileage2}}" class="uk-width-1-1" readonly> | ||
| 58 | + </div> | ||
| 59 | + <div class="uk-width-1-3"> | ||
| 60 | + <label class="bottom_label_2">出场</label> | ||
| 61 | + </div> | ||
| 62 | + </div> | ||
| 63 | + </div> | ||
| 64 | + {{/if}} | ||
| 65 | + </form> | ||
| 66 | + </div> | ||
| 67 | + {{else}} | ||
| 68 | + <div class="s_2_park_form_wrap" data-id="{{obj.id}}"> | ||
| 69 | + <span class="ct_close"><i class="uk-icon-times"></i></span> | ||
| 70 | + <form class="uk-form"> | ||
| 71 | + <div class="uk-grid"> | ||
| 72 | + <div class="uk-width-1-4"> | ||
| 73 | + <label class="">起点:</label> | ||
| 74 | + <input type="text" value="{{obj.stationName}}" class="uk-width-1-1" readonly> | ||
| 75 | + </div> | ||
| 76 | + <div class="uk-width-1-4"> | ||
| 77 | + <label>终点:</label> | ||
| 78 | + <input type="text" value="{{obj.parkName}}" class="uk-width-1-1" readonly> | ||
| 79 | + </div> | ||
| 80 | + <div class="uk-width-2-4 uk-grid"> | ||
| 81 | + <div class="uk-width-1-3"> | ||
| 82 | + <label>历时:</label> | ||
| 83 | + <input type="text" value="{{obj.time1}}" class="uk-width-1-1" readonly> | ||
| 84 | + </div> | ||
| 85 | + <div class="uk-width-1-3"> | ||
| 86 | + <label>公里:</label> | ||
| 87 | + <input type="text" value="{{obj.mileage1}}" class="uk-width-1-1" readonly> | ||
| 88 | + </div> | ||
| 89 | + <div class="uk-width-1-3"> | ||
| 90 | + <label class="bottom_label"><input type="checkbox" disabled checked> 进=出 </label> | ||
| 91 | + </div> | ||
| 92 | + </div> | ||
| 93 | + </div> | ||
| 94 | + </form> | ||
| 95 | + </div> | ||
| 96 | + {{/if}} | ||
| 97 | + {{/each}} | ||
| 98 | + </script> | ||
| 99 | + | ||
| 100 | + <script> | ||
| 101 | + (function () { | ||
| 102 | + var modal = '#station_to_park-modal', sch; | ||
| 103 | + | ||
| 104 | + $(modal).on('init', function (e, data) { | ||
| 105 | + e.stopPropagation(); | ||
| 106 | + sch = data.sch; | ||
| 107 | + | ||
| 108 | + var list = gb_data_basic.get_stat_park_data()[sch.xlBm]; | ||
| 109 | + if(!list) | ||
| 110 | + return; | ||
| 111 | + list.sort(function (a, b) { | ||
| 112 | + return a.stationName.localeCompare(b.stationName); | ||
| 113 | + }); | ||
| 114 | + | ||
| 115 | + var htmlStr = template('station_park_list-temp', {list: list}); | ||
| 116 | + $('.ct_lists', modal).html(htmlStr); | ||
| 117 | + }); | ||
| 118 | + | ||
| 119 | + $(modal).on('click', '.s_2_park_form_wrap>.ct_close', function () { | ||
| 120 | + var wrap=$(this).parent(), | ||
| 121 | + id=wrap.data('id'); | ||
| 122 | + | ||
| 123 | + gb_common.$post('/basic/deleteStation2Park', {lineCode: sch.xlBm, id: id}, function () { | ||
| 124 | + gb_data_basic.reload_stat_park_data(); | ||
| 125 | + wrap.remove(); | ||
| 126 | + }); | ||
| 127 | + }); | ||
| 128 | + })(); | ||
| 129 | + </script> | ||
| 130 | +</div> |