Commit 676e47d53f1477799c7e6b5d47510f426105ee50

Authored by 潘钊
1 parent 40e09602

线调页面部分完善

src/main/java/com/bsth/controller/realcontrol/ChildTaskPlanController.java 0 → 100644
  1 +package com.bsth.controller.realcontrol;
  2 +
  3 +import org.springframework.web.bind.annotation.RequestMapping;
  4 +import org.springframework.web.bind.annotation.RestController;
  5 +
  6 +import com.bsth.controller.BaseController;
  7 +import com.bsth.entity.realcontrol.ChildTaskPlan;
  8 +
  9 +@RestController
  10 +@RequestMapping("/childTask")
  11 +public class ChildTaskPlanController extends BaseController<ChildTaskPlan, Long>{
  12 +
  13 +}
... ...
src/main/java/com/bsth/repository/realcontrol/ChildTaskPlanRepository.java 0 → 100644
  1 +package com.bsth.repository.realcontrol;
  2 +
  3 +import org.springframework.stereotype.Repository;
  4 +
  5 +import com.bsth.entity.realcontrol.ChildTaskPlan;
  6 +import com.bsth.repository.BaseRepository;
  7 +
  8 +@Repository
  9 +public interface ChildTaskPlanRepository extends BaseRepository<ChildTaskPlan, Long>{
  10 +
  11 +}
... ...
src/main/java/com/bsth/service/realcontrol/ChildTaskPlanService.java 0 → 100644
  1 +package com.bsth.service.realcontrol;
  2 +
  3 +import com.bsth.entity.realcontrol.ChildTaskPlan;
  4 +import com.bsth.service.BaseService;
  5 +
  6 +public interface ChildTaskPlanService extends BaseService<ChildTaskPlan, Long>{
  7 +
  8 +}
... ...
src/main/java/com/bsth/service/realcontrol/impl/ChildTaskPlanServiceImpl.java 0 → 100644
  1 +package com.bsth.service.realcontrol.impl;
  2 +
  3 +import org.springframework.stereotype.Service;
  4 +
  5 +import com.bsth.entity.realcontrol.ChildTaskPlan;
  6 +import com.bsth.service.impl.BaseServiceImpl;
  7 +import com.bsth.service.realcontrol.ChildTaskPlanService;
  8 +
  9 +@Service
  10 +public class ChildTaskPlanServiceImpl extends BaseServiceImpl<ChildTaskPlan, Long> implements ChildTaskPlanService{
  11 +
  12 +}
... ...
src/main/java/com/bsth/util/db/BaseDao_MS.java 0 → 100644
  1 +package com.bsth.util.db;
  2 +
  3 +
  4 +import org.apache.commons.lang3.CharUtils;
  5 +import org.apache.commons.lang3.StringUtils;
  6 +import org.slf4j.Logger;
  7 +import org.slf4j.LoggerFactory;
  8 +
  9 +
  10 +/**
  11 + *
  12 + * @ClassName: BaseDao
  13 + * @author PanZhao
  14 + * @param <T>
  15 + * @date 2016年6月27日 上午10:33:12
  16 + *
  17 + */
  18 +public class BaseDao_MS {
  19 +
  20 + static Logger logger = LoggerFactory.getLogger(BaseDao_MS.class);
  21 +
  22 + /**
  23 + *
  24 + * @Title: propertyToField
  25 + * @Description: TODO(java转数据库字段名)
  26 + * @param @param property
  27 + * @throws
  28 + */
  29 + public static String propertyToField(String property) {
  30 + if (null == property) {
  31 + return "";
  32 + }
  33 + char[] chars = property.toCharArray();
  34 + StringBuffer sb = new StringBuffer();
  35 + for (char c : chars) {
  36 + if (CharUtils.isAsciiAlphaUpper(c)) {
  37 + sb.append("_" + StringUtils.lowerCase(CharUtils.toString(c)));
  38 + } else {
  39 + sb.append(c);
  40 + }
  41 + }
  42 + return sb.toString();
  43 + }
  44 +}
... ...
src/main/java/com/bsth/util/db/DBUtils_MS.java 0 → 100644
  1 +package com.bsth.util.db;
  2 +
  3 +import java.io.FileNotFoundException;
  4 +import java.io.IOException;
  5 +import java.sql.Connection;
  6 +import java.sql.ResultSet;
  7 +import java.sql.SQLException;
  8 +import java.sql.Statement;
  9 +import java.util.HashMap;
  10 +import java.util.Map;
  11 +import java.util.Properties;
  12 +
  13 +import javax.sql.DataSource;
  14 +
  15 +import org.apache.log4j.Logger;
  16 +import org.springframework.stereotype.Component;
  17 +
  18 +import com.mchange.v2.c3p0.DataSources;
  19 +
  20 +/**
  21 + * 808GPS SQL Server数据库连接工具类
  22 + * @author PanZhao
  23 + *
  24 + */
  25 +@Component
  26 +public class DBUtils_MS {
  27 +
  28 + private static String url = null;
  29 +
  30 + private static String username = null;
  31 +
  32 + private static String pwd = null;
  33 +
  34 + private static DataSource ds_pooled;
  35 +
  36 + static Logger logger = Logger.getLogger(DBUtils_MS.class);
  37 +
  38 + static {
  39 + Properties env = new Properties();
  40 +
  41 + try {
  42 + env.load(DBUtils_MS.class.getClassLoader().getResourceAsStream("ms-jdbc.properties"));
  43 + // 1. 加载驱动类
  44 + Class.forName(env.getProperty("ms.mysql.driver"));
  45 +
  46 + url = env.getProperty("ms.mysql.url");
  47 + username = env.getProperty("ms.mysql.username");
  48 + pwd = env.getProperty("ms.mysql.password");
  49 +
  50 + // 设置连接数据库的配置信息
  51 + DataSource ds_unpooled = DataSources.unpooledDataSource(url,
  52 + username, pwd);
  53 +
  54 + Map<String, Object> pool_conf = new HashMap<String, Object>();
  55 + // 设置最大连接数
  56 + pool_conf.put("maxPoolSize", 10);
  57 + ds_pooled = DataSources.pooledDataSource(ds_unpooled, pool_conf);
  58 + } catch (FileNotFoundException e) {
  59 + logger.error(e.toString());
  60 + e.printStackTrace();
  61 + } catch (IOException e) {
  62 + logger.error(e.toString());
  63 + e.printStackTrace();
  64 + } catch (ClassNotFoundException e) {
  65 + logger.error(e.toString());
  66 + e.printStackTrace();
  67 + } catch (SQLException e) {
  68 + logger.error(e.toString());
  69 + e.printStackTrace();
  70 + }
  71 + }
  72 +
  73 + /**
  74 + * 获取连接对象
  75 + */
  76 + public static Connection getConnection() throws SQLException {
  77 + return ds_pooled.getConnection();
  78 + }
  79 +
  80 + /**
  81 + * 释放连接池资源
  82 + */
  83 + public static void clearup() {
  84 + if (ds_pooled != null) {
  85 + try {
  86 + DataSources.destroy(ds_pooled);
  87 + } catch (SQLException e) {
  88 + logger.error(e.toString());
  89 + e.printStackTrace();
  90 + }
  91 + }
  92 + }
  93 +
  94 + /**
  95 + * 资源关闭
  96 + *
  97 + * @param rs
  98 + * @param stmt
  99 + * @param conn
  100 + */
  101 + public static void close(ResultSet rs, Statement stmt, Connection conn) {
  102 + if (rs != null) {
  103 + try {
  104 + rs.close();
  105 + } catch (SQLException e) {
  106 + logger.error(e.toString());
  107 + e.printStackTrace();
  108 + }
  109 + }
  110 +
  111 + if (stmt != null) {
  112 + try {
  113 + stmt.close();
  114 + } catch (SQLException e) {
  115 + logger.error(e.toString());
  116 + e.printStackTrace();
  117 + }
  118 + }
  119 +
  120 + if (conn != null) {
  121 + try {
  122 + conn.close();
  123 + } catch (SQLException e) {
  124 + logger.error(e.toString());
  125 + e.printStackTrace();
  126 + }
  127 + }
  128 + }
  129 +}
... ...
src/main/java/com/bsth/vehicle/gpsdata/GpsArrivalStationThread.java 0 → 100644
  1 +package com.bsth.vehicle.gpsdata;
  2 +
  3 +import java.sql.Connection;
  4 +import java.sql.PreparedStatement;
  5 +import java.sql.ResultSet;
  6 +import java.text.ParseException;
  7 +import java.text.SimpleDateFormat;
  8 +import java.util.ArrayList;
  9 +import java.util.Calendar;
  10 +import java.util.Iterator;
  11 +import java.util.LinkedList;
  12 +import java.util.List;
  13 +import java.util.Set;
  14 +
  15 +import org.slf4j.Logger;
  16 +import org.slf4j.LoggerFactory;
  17 +import org.springframework.stereotype.Component;
  18 +
  19 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  20 +import com.bsth.service.realcontrol.buffer.ScheduleBuffer;
  21 +import com.bsth.util.DateUtils;
  22 +import com.bsth.util.db.DBUtils_MS;
  23 +import com.bsth.vehicle.gpsdata.buffer.GpsArrivalDataBuffer;
  24 +import com.bsth.vehicle.gpsdata.entity.ArrivalInfo;
  25 +
  26 +/**
  27 + *
  28 + * @ClassName: GpsArrivalStationThread
  29 + * @Description: TODO(GPS到离站)
  30 + * @author PanZhao
  31 + * @date 2016年6月27日 上午10:58:13
  32 + *
  33 + */
  34 +@Component
  35 +public class GpsArrivalStationThread extends Thread{
  36 +
  37 + Logger logger = LoggerFactory.getLogger(this.getClass());
  38 + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
  39 +
  40 + private static int diff = 1000 * 60 * 60;
  41 +
  42 + @Override
  43 + public void run() {
  44 + List<ArrivalInfo> list = null;
  45 + try {
  46 + list = loadData();
  47 + } catch (ParseException e) {
  48 + e.printStackTrace();
  49 + }
  50 + System.out.println("size: " + list.size());
  51 + GpsArrivalDataBuffer.putAll(list);
  52 + //实际到离站和计划排班相匹配
  53 +
  54 + Set<String> keySet = GpsArrivalDataBuffer.allMap.keySet();
  55 + System.out.println("开始...");
  56 + List<ScheduleRealInfo> schList;
  57 + for(String key : keySet){
  58 + schList = ScheduleBuffer.vehLinkedMap.get(key);
  59 + if(null != schList)
  60 + match(GpsArrivalDataBuffer.allMap.get(key), schList);
  61 + }
  62 + System.out.println("结束...");
  63 + }
  64 +
  65 +
  66 + /**
  67 + *
  68 + * @Title: match
  69 + * @Description: TODO(实际和计划进行匹配)
  70 + * @param @param arrList 实际GPS到离站链表
  71 + * @param @param schList 计划排班链表
  72 + * @throws
  73 + */
  74 + public void match(List<ArrivalInfo> arrList, List<ScheduleRealInfo> schList){
  75 + Iterator<ScheduleRealInfo> schIterator = schList.iterator();
  76 +
  77 + while(schIterator.hasNext())
  78 + match(schIterator.next(), arrList);
  79 + }
  80 +
  81 +
  82 + public void match(ScheduleRealInfo scInfo, List<ArrivalInfo> arrList){
  83 + for(ArrivalInfo arr : arrList){
  84 + match(scInfo, arr);
  85 + }
  86 + }
  87 +
  88 + //单个匹配
  89 + public void match(ScheduleRealInfo scInfo, ArrivalInfo arr){
  90 + Long ts = arr.getTs();
  91 + //起点
  92 + if(scInfo.getFcsjActualTime() == null
  93 + && scInfo.getQdzCode().equals(arr.getStopNo())
  94 + && Math.abs(scInfo.getFcsjT() - ts) < diff){
  95 +
  96 + scInfo.setFcsjActualTime(ts);
  97 + scInfo.setFcsjActual(sdf.format(ts));
  98 + System.out.println("成功匹配一个起点...");
  99 + }
  100 + //终点
  101 + if(scInfo.getZdsjActualTime() == null
  102 + && scInfo.getZdzCode().equals(arr.getStopNo())
  103 + && Math.abs(scInfo.getZdsjT() - ts) < diff){
  104 +
  105 + scInfo.setZdsjActualTime(ts);
  106 + scInfo.setZdsjActual(sdf.format(ts));
  107 + System.out.println("成功匹配一个终点...");
  108 + }
  109 + }
  110 +
  111 + /**
  112 + * @throws ParseException
  113 + *
  114 + * @Title: loadData
  115 + * @Description: TODO(从数据库加载到离站信息)
  116 + * @return List<ArrivalInfo> 返回类型
  117 + * @throws
  118 + */
  119 + private List<ArrivalInfo> loadData() throws ParseException{
  120 + Calendar cal = Calendar.getInstance();
  121 + //周数,表分区字段
  122 + int weeks_year = cal.get(Calendar.WEEK_OF_YEAR);
  123 + //按时间标记增量加载
  124 + if(null == GpsArrivalDataBuffer.markTime){
  125 + //第一次从当天0点开始
  126 + GpsArrivalDataBuffer.markTime = DateUtils.getTimesmorning() * 1000L;
  127 + }
  128 +
  129 + String sql = "select * from bsth_c_arrival_info where weeks_year=? and create_date > ?";
  130 +
  131 + List<ArrivalInfo> list = new ArrayList<>();
  132 + Connection conn = null;
  133 + PreparedStatement ps = null;
  134 + ResultSet rs = null;
  135 + try {
  136 + conn = DBUtils_MS.getConnection();
  137 + ps = conn.prepareStatement(sql);
  138 + ps.setInt(1, weeks_year);
  139 + ps.setLong(2, GpsArrivalDataBuffer.markTime);
  140 +
  141 + Long t = System.currentTimeMillis();
  142 + rs = ps.executeQuery();
  143 +
  144 + while(rs.next()){
  145 + list.add(new ArrivalInfo(rs.getString("device_id"), rs.getLong("ts"), rs.getString("line_id")
  146 + , rs.getInt("up_down"), rs.getString("stop_no"), rs.getInt("in_out"), rs.getDate("create_date"), rs.getInt("weeks_year")));
  147 + }
  148 +
  149 + //重新打时间标记
  150 + GpsArrivalDataBuffer.markTime = t;
  151 +
  152 + } catch (Exception e) {
  153 + logger.error("", e);
  154 + }finally {
  155 + DBUtils_MS.close(rs, ps, conn);
  156 + }
  157 + return list;
  158 + }
  159 +}
... ...
src/main/java/com/bsth/vehicle/gpsdata/buffer/GpsArrivalDataBuffer.java 0 → 100644
  1 +package com.bsth.vehicle.gpsdata.buffer;
  2 +
  3 +import java.util.Collections;
  4 +import java.util.Comparator;
  5 +import java.util.Date;
  6 +import java.util.List;
  7 +
  8 +import com.bsth.vehicle.common.CommonMapped;
  9 +import com.bsth.vehicle.gpsdata.entity.ArrivalInfo;
  10 +import com.google.common.collect.LinkedListMultimap;
  11 +
  12 +/**
  13 + *
  14 + * @ClassName: GpsArrivalDataBuffer
  15 + * @Description: TODO(GPS到离站数据缓存)
  16 + * @author PanZhao
  17 + * @date 2016年6月27日 下午1:08:35
  18 + *
  19 + */
  20 +public class GpsArrivalDataBuffer {
  21 +
  22 + /**
  23 + * 车辆 时间戳排序的进出站链表
  24 + */
  25 + public static LinkedListMultimap<String, ArrivalInfo> allMap;
  26 +
  27 + /**
  28 + * 时间戳标记,从数据库增量查询时起始时间
  29 + */
  30 + public static Long markTime;
  31 +
  32 +
  33 + static{
  34 + allMap = LinkedListMultimap.create();
  35 + }
  36 +
  37 + /**
  38 + *
  39 + * @Title: putAll
  40 + * @Description: TODO(将增量数据添加到缓存)
  41 + * @param @param list 设定文件
  42 + * @return void 返回类型
  43 + * @throws
  44 + */
  45 + public static void putAll(List<ArrivalInfo> list){
  46 + //按时间戳排序
  47 + Collections.sort(list, new Comparator<ArrivalInfo>() {
  48 + @Override
  49 + public int compare(ArrivalInfo o1, ArrivalInfo o2) {
  50 + return (int) (o1.getTs() - o2.getTs());
  51 + }
  52 + });
  53 +
  54 + int len = list.size();
  55 + ArrivalInfo arrival;
  56 + String nbbm;
  57 + for(int i = 0; i < len; i ++){
  58 + arrival = list.get(i);
  59 + nbbm = CommonMapped.vehicDeviceBiMap.get(arrival.getDeviceId());
  60 +
  61 + if(null != nbbm)
  62 + allMap.put(nbbm, arrival);
  63 + }
  64 + }
  65 +}
... ...
src/main/java/com/bsth/vehicle/gpsdata/entity/ArrivalInfo.java 0 → 100644
  1 +package com.bsth.vehicle.gpsdata.entity;
  2 +
  3 +import java.text.ParseException;
  4 +import java.text.SimpleDateFormat;
  5 +import java.util.Date;
  6 +
  7 +import javax.persistence.Transient;
  8 +
  9 +/**
  10 + *
  11 + * @ClassName: ArrivalInfo
  12 + * @Description: TODO(到离站信息)
  13 + * @author PanZhao
  14 + * @date 2016年6月27日 上午9:53:19
  15 + *
  16 + */
  17 +public class ArrivalInfo {
  18 +
  19 + @Transient
  20 + static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd")
  21 + ,sdf2 = new SimpleDateFormat("HH:mm")
  22 + ,sdf3 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
  23 +
  24 +
  25 + public ArrivalInfo(String deviceId, Long ts, String lineCode, Integer upDown, String stopNo, Integer inOut,
  26 + Date createDate, Integer weeksYear) {
  27 + this.deviceId = deviceId;
  28 +
  29 + //gps是2014年的数据,临时将ts拉到当天
  30 + try {
  31 + this.ts = sdf3.parse(sdf.format(new Date()) +" " + sdf2.format(new Date(ts))).getTime();
  32 + } catch (ParseException e) {
  33 + e.printStackTrace();
  34 + }
  35 + //this.ts = ts;
  36 +
  37 +
  38 + this.lineCode = lineCode;
  39 + this.upDown = upDown;
  40 + this.stopNo = stopNo;
  41 + this.inOut = inOut;
  42 + this.createDate = createDate;
  43 + this.weeksYear = weeksYear;
  44 + }
  45 +
  46 + /**
  47 + * 设备号
  48 + */
  49 + private String deviceId;
  50 +
  51 + /**
  52 + * 时间戳
  53 + */
  54 + private Long ts;
  55 +
  56 + /**
  57 + * 线路编码
  58 + */
  59 + private String lineCode;
  60 +
  61 + /**
  62 + * 上下行
  63 + */
  64 + private Integer upDown;
  65 +
  66 + /**
  67 + * 站点
  68 + */
  69 + private String stopNo;
  70 +
  71 + /**
  72 + * 0: 进 1:出
  73 + */
  74 + private Integer inOut;
  75 +
  76 + private Date createDate;
  77 +
  78 + /**
  79 + * 分区字段,当年的第几周
  80 + */
  81 + private Integer weeksYear;
  82 +
  83 + public String getLineCode() {
  84 + return lineCode;
  85 + }
  86 +
  87 + public void setLineCode(String lineCode) {
  88 + this.lineCode = lineCode;
  89 + }
  90 +
  91 + public Integer getUpDown() {
  92 + return upDown;
  93 + }
  94 +
  95 + public void setUpDown(Integer upDown) {
  96 + this.upDown = upDown;
  97 + }
  98 +
  99 + public String getStopNo() {
  100 + return stopNo;
  101 + }
  102 +
  103 + public void setStopNo(String stopNo) {
  104 + this.stopNo = stopNo;
  105 + }
  106 +
  107 + public Integer getInOut() {
  108 + return inOut;
  109 + }
  110 +
  111 + public void setInOut(Integer inOut) {
  112 + this.inOut = inOut;
  113 + }
  114 +
  115 + public Date getCreateDate() {
  116 + return createDate;
  117 + }
  118 +
  119 + public void setCreateDate(Date createDate) {
  120 + this.createDate = createDate;
  121 + }
  122 +
  123 + public Integer getWeeksYear() {
  124 + return weeksYear;
  125 + }
  126 +
  127 + public void setWeeksYear(Integer weeksYear) {
  128 + this.weeksYear = weeksYear;
  129 + }
  130 +
  131 + public String getDeviceId() {
  132 + return deviceId;
  133 + }
  134 +
  135 + public void setDeviceId(String deviceId) {
  136 + this.deviceId = deviceId;
  137 + }
  138 +
  139 + public Long getTs() {
  140 + return ts;
  141 + }
  142 +
  143 + public void setTs(Long ts) {
  144 + this.ts = ts;
  145 + }
  146 +}
... ...
src/main/resources/ms-jdbc.properties 0 → 100644
  1 +ms.mysql.driver= com.mysql.jdbc.Driver
  2 +ms.mysql.url= jdbc:mysql://192.168.168.192:3306/ms?useUnicode=true&characterEncoding=utf-8
  3 +ms.mysql.username= root
  4 +ms.mysql.password= root2jsp
0 5 \ No newline at end of file
... ...
src/main/resources/static/assets/js/common.js
... ... @@ -110,6 +110,8 @@ function initPinYinSelect2(selector, data, cb){
110 110  
111 111 cb && cb();
112 112 });
  113 +
  114 + return $(selector);
113 115 }
114 116  
115 117 /**
... ...
src/main/resources/static/assets/js/dictionary.js
... ... @@ -16,8 +16,6 @@ var dictionaryUtils = (function(){
16 16 dictionaryData[this.dGroup] = {};
17 17 dictionaryData[this.dGroup][this.dCode] = this.dName;
18 18 });
19   -
20   - console.log(dictionaryData);
21 19 });
22 20  
23 21 var dictObject = {
... ... @@ -86,8 +84,12 @@ var dictionaryUtils = (function(){
86 84 else
87 85 ops += '<option value="'+c+'">'+items[c]+'</option>';
88 86 }
89   - $(e).removeClass('nt-dictionary');
90   - $(e).replaceWith('<select class="'+$(e).attr('class')+'">'+ops+'</select>');
  87 + //如果没有默认选中值
  88 + if(!code)
  89 + ops = '<option value="">请选择...</option>' + ops;
  90 +
  91 + var newE = $(e).clone().removeClass('nt-dictionary').html(ops);
  92 + $(e).replaceWith(newE);
91 93 }
92 94  
93 95 return dictObject;
... ...
src/main/resources/static/pages/control/line/child_pages/child_task.html
... ... @@ -64,14 +64,13 @@
64 64 <thead>
65 65 <tr>
66 66 <th width="6%">序号</th>
67   - <th width="9%">开始时间</th>
68   - <th width="9%">结束时间</th>
69   - <th width="14%">起点</th>
70   - <th width="14%">终点</th>
71   - <th width="6%">里程</th>
72   - <th width="10%">车辆</th>
73   - <th width="9%">驾驶员</th>
74   - <th width="9%">售票员</th>
  67 + <th width="11%">类型</th>
  68 + <th width="16%">起点</th>
  69 + <th width="16%">终点</th>
  70 + <th width="10%">开始时间</th>
  71 + <th width="10%">结束时间</th>
  72 + <th width="7%">里程</th>
  73 + <th width="11%">备注</th>
75 74 </tr>
76 75 </thead>
77 76 </table>
... ... @@ -82,91 +81,73 @@
82 81 <tbody>
83 82 <tr>
84 83 <td width="6%">1</td>
85   - <td width="9%"></td>
86   - <td width="9%"></td>
87   - <td width="14%"></td>
88   - <td width="14%"></td>
89   - <td width="6%"></td>
  84 + <td width="11%"></td>
  85 + <td width="16%"></td>
  86 + <td width="16%"></td>
90 87 <td width="10%"></td>
91   - <td width="9%"></td>
92   - <td width="9%"></td>
93   - </tr>
94   - <tr>
95   - <td>2</td>
96   - <td></td>
97   - <td></td>
98   - <td></td>
99   - <td></td>
100   - <td></td>
101   - <td></td>
102   - <td></td>
103   - <td></td>
  88 + <td width="10%"></td>
  89 + <td width="7%"></td>
  90 + <td width="11%"></td>
104 91 </tr>
105 92 <tr>
106   - <td>3</td>
107   - <td></td>
108   - <td></td>
109   - <td></td>
110   - <td></td>
111   - <td></td>
112   - <td></td>
113   - <td></td>
114   - <td></td>
  93 + <td width="6%">2</td>
  94 + <td width="11%"></td>
  95 + <td width="16%"></td>
  96 + <td width="16%"></td>
  97 + <td width="10%"></td>
  98 + <td width="10%"></td>
  99 + <td width="7%"></td>
  100 + <td width="11%"></td>
115 101 </tr>
116 102 <tr>
117   - <td>4</td>
118   - <td></td>
119   - <td></td>
120   - <td></td>
121   - <td></td>
122   - <td></td>
123   - <td></td>
124   - <td></td>
125   - <td></td>
  103 + <td width="6%">3</td>
  104 + <td width="11%"></td>
  105 + <td width="16%"></td>
  106 + <td width="16%"></td>
  107 + <td width="10%"></td>
  108 + <td width="10%"></td>
  109 + <td width="7%"></td>
  110 + <td width="11%"></td>
126 111 </tr>
127 112 <tr>
128   - <td>5</td>
129   - <td></td>
130   - <td></td>
131   - <td></td>
132   - <td></td>
133   - <td></td>
134   - <td></td>
135   - <td></td>
136   - <td></td>
  113 + <td width="6%">4</td>
  114 + <td width="11%"></td>
  115 + <td width="16%"></td>
  116 + <td width="16%"></td>
  117 + <td width="10%"></td>
  118 + <td width="10%"></td>
  119 + <td width="7%"></td>
  120 + <td width="11%"></td>
137 121 </tr>
138 122 <tr>
139   - <td>6</td>
140   - <td></td>
141   - <td></td>
142   - <td></td>
143   - <td></td>
144   - <td></td>
145   - <td></td>
146   - <td></td>
147   - <td></td>
  123 + <td width="6%">5</td>
  124 + <td width="11%"></td>
  125 + <td width="16%"></td>
  126 + <td width="16%"></td>
  127 + <td width="10%"></td>
  128 + <td width="10%"></td>
  129 + <td width="7%"></td>
  130 + <td width="11%"></td>
148 131 </tr>
149 132 <tr>
150   - <td>7</td>
151   - <td></td>
152   - <td></td>
153   - <td></td>
154   - <td></td>
155   - <td></td>
156   - <td></td>
157   - <td></td>
158   - <td></td>
  133 + <td width="6%">6</td>
  134 + <td width="11%"></td>
  135 + <td width="16%"></td>
  136 + <td width="16%"></td>
  137 + <td width="10%"></td>
  138 + <td width="10%"></td>
  139 + <td width="7%"></td>
  140 + <td width="11%"></td>
159 141 </tr>
160 142 <tr>
161   - <td>8</td>
162   - <td></td>
163   - <td></td>
164   - <td></td>
165   - <td></td>
166   - <td></td>
167   - <td></td>
168   - <td></td>
169   - <td></td>
  143 + <td width="6%">7</td>
  144 + <td width="11%"></td>
  145 + <td width="16%"></td>
  146 + <td width="16%"></td>
  147 + <td width="10%"></td>
  148 + <td width="10%"></td>
  149 + <td width="7%"></td>
  150 + <td width="11%"></td>
170 151 </tr>
171 152 </tbody>
172 153 </table>
... ... @@ -223,96 +204,41 @@
223 204 </div>
224 205 </div>
225 206 </div>
226   - <!-- 子任务信息 -->
  207 + <!-- 子任务信息 -->
227 208 <div class="custom-box" >
228   - <div class="custom-box-body sub">
229   - <div class="row">
230   - <div class="col-md-4">
231   - <span class="custom-label">序号: </span>
232   - <input class="form-control" disabled="disabled" value="1">
233   - </div>
234   - <div class="col-md-4">
235   - <span class="custom-label">开始时间: </span>
236   - <input class="form-control" value="" type="time" name="">
237   - </div>
238   - <div class="col-md-4">
239   - <span class="custom-label">结束时间:</span>
240   - <input class="form-control" value="" type="time">
241   - </div>
  209 + <div class="custom-box-body" style="border: none;">
  210 + <br>
  211 + <div class="row childTaskBtns" style="text-align: center;margin: 0;">
  212 + <div class="custom-btn blue" data-method="inParkProcess"><i class="fa fa-reply-all"></i> 回场</div>
  213 + <div class="custom-btn blue" data-method="outParkProcess"><i class="fa fa-share-square-o"></i> 出场</div>
  214 + <div class="custom-btn red" data-method="tempAddProcess"><i class="fa fa-plus-square"></i> 自定义子任务</div>
242 215 </div>
243   -
244   - <div class="row">
245   - <div class="col-md-4">
246   - <span class="custom-label">任务类型: </span>
247   - <input class="form-control" disabled="disabled" >
248   - </div>
249   - <div class="col-md-4">
250   - <span class="custom-label">起点: </span>
251   - <select class="form-control"></select>
252   - </div>
253   - <div class="col-md-4">
254   - <span class="custom-label">终点:</span>
255   - <select class="form-control"></select>
256   - </div>
257   - </div>
258   -
259   - <div class="row">
260   - <div class="col-md-4">
261   - <span class="custom-label">里程类型: </span>
262   - <input class="form-control" disabled="disabled" value="">
263   - </div>
264   - <div class="col-md-4">
265   - <span class="custom-label">里程: </span>
266   - <input class="form-control" disabled="disabled" value="">
267   - </div>
268   - <div class="col-md-4">
269   - <span class="custom-label">是否烂班:</span>
270   - <input class="form-control" >
271   - </div>
272   - </div>
273   -
274   - <div class="row">
275   - <span class="custom-label" style="margin-left: 10px">备注:</span>
276   - <textarea rows="3" placeholder="备注" class="form-control" style="width: calc(100% - 110px);"></textarea>
  216 + <div class="row addTempBtns" style="text-align: center;margin: 0;display: none;">
  217 + <div class="custom-btn blue" id="addTempSchedulBtn"><i class="fa fa-plus-square"></i> 临加班次</div>
277 218 </div>
278 219 </div>
279 220 </div>
280   -
281   - <div class="form-custom-footer" style="margin-top: 15px;">
282   - <button type="button" class="btn blue-madison confirm"> <i class="fa fa-check"></i> &nbsp;&nbsp;确&nbsp;&nbsp;定 </button>
283   - <button type="button" class="btn layui-layer-close"> 取消 </button>
284   - </div>
285   -</div>
286   -
287   -
288   -<script id="child_task_main_table_temp" type="text/html">
289   -{{each list as item i}}
290   -<tr data-id="{{item.id}}">
291   - <td width="6%">{{i + 1}}</td>
292   - <td width="9%">{{item.fcsj}}</td>
293   - <td width="9%">{{item.zdsj}}</td>
294   - <td width="14%">{{item.qdzName}}</td>
295   - <td width="14%">{{item.zdzName}}</td>
296   - <td width="6%">{{item.jhlc}}</td>
297   - <td width="10%">{{item.clZbh}}</td>
298   - <td width="9%">{{item.jName}}</td>
299   - <td width="9%">{{item.sName}}</td>
300   -</tr>
301   -{{/each}}
302   -</script>
303   -
304 221  
  222 +</div>
  223 +<script src="/pages/control/line/child_pages/js/child_task.js"></script>
305 224 <script>
  225 +
  226 +//停车场下拉框数据
  227 +var parkSelect2Data = createParkSelect2Data(),
  228 + parkSelectOps = createParkSelectOps(parkSelect2Data);
  229 +
306 230 $(function(){
307   - //线路编码和名称对照
308   - var storage = window.localStorage;
309   - var lineMap = JSON.parse(storage.getItem('lineIds'));
  231 + //var storage = window.localStorage;
  232 + var lineCodeMaps;
310 233 //线路 ——> 路牌 ——> 班次 3层映射
311 234 var scheduleLineMap;
312 235 //初始选中班次
313 236 var initSelected;
314   - //线路站点路由
315   - var stationRoute;
  237 +
  238 + //班次ID和班次映射
  239 + var scheduleIdMap;
  240 +
  241 + var _data; //data.js引用
316 242  
317 243 //滚动时固定表头
318 244 $('.custom-table-panel').on('scroll', function(){
... ... @@ -322,48 +248,85 @@ $(function(){
322 248 });
323 249  
324 250 var $table = $('.custom-table-body table');
  251 +
325 252 //主任务点击事件
326 253 $('#childTaskDiv').on('click', '.mainTable tr', function(){
327 254 $table.find('tr._active').removeClass('_active');
328 255 $(this).addClass('_active');
  256 +
329 257 //显示班次详细
330 258 $.each(this.cells, function(i,cell){
331 259 $('#mainDetailPabel input[data-cell='+i+']').val($(cell).text());
332 260 });
333   - //子任务初始值
334   -
  261 + if(!changeHandlerPanel(this))
  262 + return;
335 263  
  264 + var id = $(this).data('id');
  265 + childTaskBtn(scheduleIdMap[id].bcType);
336 266 });
337 267  
  268 + //子任务按钮
  269 + function childTaskBtn(bcType){
  270 + switch (bcType) {
  271 + case 'normal':
  272 + $('.childTaskBtns .custom-btn').show();
  273 + break;
  274 + case 'in':
  275 + case 'out':
  276 + hide();
  277 + break;
  278 + }
  279 + function hide(){
  280 + $('.custom-btn[data-method=outParkProcess]').hide();
  281 + $('.custom-btn[data-method=inParkProcess]').hide();
  282 + }
  283 + }
  284 +
  285 + function changeHandlerPanel(tr){
  286 + if($(tr).hasClass('empty')){
  287 + $('.childTaskBtns').hide();
  288 + $('.addTempBtns').show();
  289 + return false;
  290 + }
  291 + else{
  292 + $('.childTaskBtns').show();
  293 + $('.addTempBtns').hide();
  294 + return true;
  295 + }
  296 + }
  297 +
338 298 var lineSelect = $('#childTaskDiv .lineSelect');
339 299 var lpSelect = $('#childTaskDiv .LPSelect');
340 300 //线路下拉框
341 301 $('#childTaskDiv').on('init', function(e, ops ){
342   - var data = ops.data
343   - , stationRoute = ops.stationRoute
344   - , lineData = [], lineName;
  302 + _data = ops._data;
  303 + //要选中的班次
  304 + var schedul = ops.selected;
  305 + var lineData = [], lineName;
  306 + //站点路由
  307 + stationRoute = _data.getStationRouteByLine(schedul.xlBm);
  308 + //线路 ——> 路牌 ——> 班次映射
  309 + scheduleLineMap = _data.getLineLpMap();
345 310  
346   - console.log('路由', stationRoute);
347   - for(var lineCode in data ){
348   - lineName = lineMap[lineCode];
  311 + //线路下拉框数据
  312 + lineCodeMaps = _data.getLineIds();
  313 + for(var lineCode in scheduleLineMap){
  314 + lineName = lineCodeMaps[lineCode];
349 315 lineData.push({id: lineCode, text: lineName});
350 316 }
351 317  
352   - scheduleLineMap = data;
353   - initSelected = ops.selected;
354   -
355 318 initPinYinSelect2(lineSelect, lineData, function(){
356 319 //绑定change事件
357 320 lineSelect.on('change', changeLine);
358 321 //初始选中的线路
359   - lineSelect.val(initSelected.xlBm).trigger("change");
  322 + lineSelect.val(schedul.xlBm).trigger("change");
360 323  
361 324 setTimeout(function(){
362 325 //选中路牌
363   - lpSelect.val(initSelected.lpName).trigger("change");
  326 + lpSelect.val(schedul.lpName).trigger("change");
364 327  
365 328 //选中班次
366   - var $tr = $('.mainTable tr[data-id='+initSelected.id+']');
  329 + var $tr = $('.mainTable tr[data-id='+schedul.id+']');
367 330 $tr.trigger('click');
368 331 //滚动条
369 332 var cont = $('.custom-table-panel');
... ... @@ -394,11 +357,38 @@ $(function(){
394 357 * 刷新主任务列表
395 358 */
396 359 function refreshMainList(){
397   - var lineCode = lineSelect.val();
398   - var lp = lpSelect.val();
  360 + var lineCode = lineSelect.val()
  361 + ,lp = lpSelect.val()
  362 + ,scheduls = scheduleLineMap[lineCode][lp];
  363 + //保留当前列表班次的映射
  364 + scheduleIdMap = {};
  365 + $.each(scheduls, function(){
  366 + scheduleIdMap[this.id] = this;
  367 + });
  368 +
  369 + var schArray = [];
  370 + $.each(scheduls, function(){
  371 + schArray[this.fcno] = this;
  372 + });
399 373  
400   - var htmlStr = template('child_task_main_table_temp', {list: scheduleLineMap[lineCode][lp]});
  374 + var htmlStr = template('child_task_main_table_temp', {list: schArray});
401 375 $('#childTaskDiv .mainTable tbody').html(htmlStr);
402 376 }
  377 +
  378 +
  379 + $('.childTaskBtns .custom-btn').on('click', function(){
  380 + var schedul = scheduleIdMap[$('.mainTable tr._active').data('id')];
  381 + var method = $(this).data('method');
  382 + if(method)
  383 + childTaskCase[method](schedul);
  384 + });
  385 +
  386 + //临加班次
  387 + $('#addTempSchedulBtn').on('click', function(){
  388 + showChildTaskModal('schedul_tempAdd_item_temp', {},
  389 + function(layer, index){
  390 +
  391 + });
  392 + });
403 393 });
404 394 </script>
... ...
src/main/resources/static/pages/control/line/child_pages/js/child_task.js 0 → 100644
  1 +var childTaskCase = {
  2 + //回场
  3 + inParkProcess : function(schedul) {
  4 + var currRoutes = stationRoute[schedul.xlDir]//当前走向的站点路由
  5 + ,selData = createRouteSelectData(currRoutes), layerIndex;
  6 +
  7 + template.config('escape', false);//不编码html
  8 + showChildTaskModal('child_task_inpark_process_temp',
  9 + {schedul: schedul, route: selData.ops}
  10 + ,function(layero, index){
  11 + layerIndex = index;
  12 + // 停车场下拉框
  13 + initPinYinSelect2('#kongshiEndStation', parkSelect2Data , function() {
  14 + var carPark = _data.getLineInformation(schedul.xlBm).carPark;
  15 + $('#kongshiEndStation').val(carPark).change();
  16 + });
  17 + var inParkWrap = '#inParkProcess'
  18 + ,yinyun = inParkWrap + ' .yinyun'
  19 + ,kongshi = inParkWrap + ' .kongshi'
  20 + ,destroy = inParkWrap + ' .destroy';
  21 +
  22 + //烂班原因写入备注
  23 + var globalRem = $('#inParkProcess textarea[name=remarks]');
  24 + $('select[name=destroyReason]', destroy).on('change', function(){
  25 + globalRem.val(globalRem.val() + $(this).val() + ',');
  26 + });
  27 +
  28 + //营运终点 select2
  29 + var $yyunEndSelect = $('select[name="endStation"]', yinyun);
  30 + initPinYinSelect2($yyunEndSelect, selData.select2Data,
  31 + function(){
  32 + $yyunEndSelect.val(schedul.zdzCode).trigger('change');
  33 + })
  34 + //切换营运终点事件
  35 + .on('select2:select', function(e){
  36 + var item = e.params.data;
  37 + var val = $(this).val();
  38 +
  39 + //空驶起点 为营运终点
  40 + $('select[name="startStation"]', kongshi).val(val);
  41 +
  42 + //中途回场
  43 + if(item.flag === 'Z'){
  44 + //显示烂班panel
  45 + $(destroy).show();
  46 + $('select[name="startStation"]', destroy).val(val);
  47 + toCenter(layero);//居中
  48 + }
  49 + else if(item.flag === 'E'){
  50 + $(destroy).hide();
  51 + toCenter(layero); //居中
  52 + }
  53 +
  54 + //重新计算里程
  55 + //营运里程
  56 + $('input[name="mileage"]', yinyun)
  57 + .val(calcDistance(schedul.xlDir, schedul.qdzCode, $yyunEndSelect.val()));
  58 + if(!$(destroy).is(":hidden")){
  59 + //烂班里程
  60 + $('input[name="mileage"]', destroy)
  61 + .val(calcDistance(schedul.xlDir, $yyunEndSelect.val(), schedul.zdzCode));
  62 + }
  63 + //空驶里程 等有停车场坐标了再计算
  64 + });
  65 + //营运结束时间
  66 + $('input[name="endDate"]', yinyun).on('blur', function(){
  67 + var t = $(this).val();
  68 + $('input[name="startDate"]', kongshi).val(t);
  69 + $('input[name="startDate"]', destroy).val(t);
  70 + });
  71 + //默认烂班终点为班次终点
  72 + $('select[name="endStation"]', destroy).val(schedul.zdzCode);
  73 +
  74 + setTimeout(function(){
  75 + //为当前layer设置变换动画;
  76 + layero.css('transition', 'all .5s ease');
  77 + }, 500);
  78 +
  79 + //提交
  80 + var error = '#inParkProcess .alert-danger';
  81 + $('.confirm', '#inParkProcess').on('click', function(){
  82 + var fs = $('.child-task-item form:visible'), flag = true;
  83 + $.each(fs, function(i, f){
  84 + if(!customFormValidate(f))
  85 + flag = false;
  86 + });
  87 +
  88 + if(flag){
  89 + $(error).hide();
  90 + //开始提交
  91 + childTaskSubmit(fs, layerIndex);
  92 + }
  93 + else
  94 + $(error).show();
  95 + });
  96 + })
  97 + },
  98 + //出场
  99 + outParkProcess: function(schedul){
  100 + var currRoutes = stationRoute[schedul.xlDir]//当前走向的站点路由
  101 + ,selData = createRouteSelectData(currRoutes);
  102 +
  103 + template.config('escape', false);//不编码html
  104 +
  105 + showChildTaskModal('child_task_outpark_process_temp',
  106 + {schedul: schedul, route: selData.ops}
  107 + ,function(layero, index){
  108 + layerIndex = index;
  109 + // 停车场下拉框
  110 + initPinYinSelect2('#kongshiStartStation', parkSelect2Data , function() {
  111 + var carPark = _data.getLineInformation(schedul.xlBm).carPark;
  112 + $('#kongshiStartStation').val(carPark).change();
  113 + });
  114 +
  115 + var outParkWrap = '#outParkProcess'
  116 + ,yinyun = outParkWrap + ' .yinyun'
  117 + ,kongshi = outParkWrap + ' .kongshi';
  118 + //空驶终点
  119 + $('select[name="endStation"]', kongshi).val(schedul.qdzCode);
  120 +
  121 + //提交
  122 + var error = outParkWrap + ' .alert-danger';
  123 + $('.confirm', outParkWrap).on('click', function(){
  124 + var fs = $('.child-task-item form:visible'), flag = true;
  125 + $.each(fs, function(i, f){
  126 + if(!customFormValidate(f))
  127 + flag = false;
  128 + });
  129 +
  130 + if(flag){
  131 + $(error).hide();
  132 + childTaskSubmit(fs, layerIndex);
  133 + //开始提交
  134 + }
  135 + else
  136 + $(error).show();
  137 + });
  138 + })
  139 + },
  140 + //自定义
  141 + tempAddProcess: function(schedul){
  142 + var itemIndex = 0, currLayero, layerIndex;
  143 + var currRoutes = stationRoute[schedul.xlDir]//当前走向的站点路由
  144 + ,selData = createRouteSelectData(currRoutes)
  145 + ,ops = selData.ops;
  146 +
  147 + var tData = {schedul: schedul, route: selData.ops};
  148 + template.config('escape', false);//不编码html
  149 +
  150 + var carPark = _data.getLineInformation(schedul.xlBm).carPark;
  151 + showChildTaskModal('child_task_tempAdd_process_temp', {}
  152 + ,function(layero, index){
  153 + currLayero = layero;
  154 + layerIndex = index;
  155 + var tempAddWrap = '#tempAddProcess';
  156 + //默认一个子任务
  157 + addItem();
  158 + $('.add-child-task-item', tempAddWrap).on('click', addItem);
  159 +
  160 + setTimeout(function(){
  161 + //为当前layer设置变换动画;
  162 + layero.css('transition', 'all .5s ease');
  163 + }, 500);
  164 + })
  165 +
  166 + function enable(e, ops, val){
  167 + e.html(ops).removeAttr('disabled').val(val);
  168 + }
  169 +
  170 + function disable(es){
  171 + $.each(es, function(){
  172 + $(this).html('').attr('disabled', 'disabled');
  173 + })
  174 + }
  175 +
  176 + function addItem(){
  177 + tData.index = ++ itemIndex;
  178 + var htmlStr = template('child_task_tempAdd_item_temp', tData);
  179 + $('#tempAddProcess .item-list').append(htmlStr);
  180 + toCenter(currLayero);
  181 + //绑定事件
  182 + bindEvent($('#tempAddItem' + itemIndex));
  183 + calcNumber();
  184 + }
  185 + //相关选项事件绑定
  186 + function bindEvent(taskItem){
  187 + var $reason = taskItem.find('.destroy-reason-wrap');
  188 + //里程类型下拉框
  189 + var mileageTypeSel = $('select[name=mileageType]', taskItem);
  190 + //烂班icheck
  191 + $('.icheck', taskItem).iCheck({
  192 + checkboxClass: 'icheckbox_square-red',
  193 + increaseArea: '20%'
  194 + }).on('ifChanged', function(){
  195 + if(this.checked){
  196 + $reason.show();
  197 + mileageTypeSel.val('营运').attr('readonly', 'readonly');
  198 + //隐藏结束时间
  199 + hideInput($('input[name=endDate]', taskItem));
  200 + changeBadge('烂班', taskItem);
  201 + }
  202 + else{
  203 + mileageTypeSel.removeAttr('readonly').change();
  204 + //显示结束时间
  205 + showInput($('input[name=endDate]', taskItem));
  206 + $reason.val('').hide();
  207 + }
  208 + });
  209 + //烂班原因
  210 + var globalRem = $('#tempAddProcess textarea[name=remarks]');
  211 + $reason.find('select').on('change', function(){
  212 + globalRem.val(globalRem.val() + $(this).val() + ',');
  213 + });
  214 + //里程类型
  215 + mileageTypeSel.on('change', function(){
  216 + //如果已烂班
  217 + if($('.icheck', taskItem)[0].checked)
  218 + return;
  219 + changeBadge($(this).val(), taskItem);
  220 + });
  221 +
  222 + //任务类型字典下拉框
  223 + dictionaryUtils.transformDom($('.nt-dictionary', taskItem));
  224 +
  225 + $('select[name=type2]', taskItem).on('change', function(){
  226 + var t = $(this).val();
  227 +
  228 + var taskItem = $(this).parents('.child-task-item')
  229 + ,startSelect = taskItem.find('select[name=startStation]')
  230 + ,endSelect = taskItem.find('select[name=endStation]');
  231 +
  232 + switch (t) {
  233 + case '':
  234 + disable([startSelect, endSelect]);
  235 + break;
  236 + case '1':
  237 + //线路上站点间
  238 + enable(startSelect, ops, schedul.qdzCode);
  239 + enable(endSelect, ops, schedul.zdzCode);
  240 + break;
  241 + case '2':
  242 + //进场
  243 + enable(startSelect, ops, schedul.qdzCode);
  244 + enable(endSelect, parkSelectOps, carPark);
  245 + break;
  246 + case '3':
  247 + //出场
  248 + enable(startSelect, parkSelectOps, carPark);
  249 + if(schedul.bcType == 'out')
  250 + enable(endSelect, ops, schedul.zdzCode);//如果主任务是出场任务
  251 + else
  252 + enable(endSelect, ops, schedul.qdzCode);
  253 + break;
  254 + case '4':
  255 + //区间掉头
  256 + enable(startSelect, ops, schedul.qdzCode);
  257 + enable(endSelect, ops, schedul.zdzCode);
  258 + break;
  259 + }
  260 + });
  261 +
  262 + $('.task-item-close', taskItem).on('click', function(){
  263 + $(this).parents('.child-task-item').remove();
  264 + toCenter(currLayero);
  265 + calcNumber();
  266 + });
  267 + }
  268 +
  269 + function hideInput($input){
  270 + $input.val('').attr('disabled', 'disabled').removeAttr('required');
  271 + }
  272 +
  273 + function showInput($input){
  274 + $input.removeAttr('disabled').attr('required', 1);
  275 + }
  276 +
  277 + function changeBadge(t, itemWrap){
  278 +
  279 + var badge = $('.child-task-title', itemWrap)
  280 + ,no = $('.no', badge)
  281 + ,remClaszz = 'yinyun kongshi destroy', clazz;
  282 +
  283 + if(t == '营运')
  284 + clazz = 'yinyun';
  285 + else if(t == '空驶')
  286 + clazz = 'kongshi';
  287 + else if(t == '烂班')
  288 + clazz = 'destroy';
  289 +
  290 + $(badge).find('.text').remove();
  291 + if(!t){
  292 + clazz = 'yinyun';
  293 + $(badge).removeClass('show-text');
  294 + }
  295 + else{
  296 + t = '<span class="text">、' + t + '公里</span>';
  297 + $(badge).addClass('show-text');
  298 + }
  299 + $(badge).parents('.child-task-item').removeClass(remClaszz).addClass(clazz);
  300 + $(badge).append(t);
  301 + }
  302 +
  303 + function calcNumber(){
  304 + var es = $('.child-task-item');
  305 + $.each(es, function(i, e){
  306 + $(e).find('.child-task-title .no').text(i + 1);
  307 + });
  308 + }
  309 +
  310 + //确定
  311 + var error = '#tempAddProcess .alert-danger';
  312 + $('.confirm', '#tempAddProcess').on('click', function(){
  313 + var fs = $('.child-task-item form'), flag = true;
  314 + $.each(fs, function(i, f){
  315 + if(!customFormValidate(f))
  316 + flag = false;
  317 + });
  318 +
  319 + if(flag){
  320 + $(error).hide();
  321 + //开始提交
  322 + childTaskSubmit(fs, layerIndex);
  323 + }
  324 + else
  325 + $(error).show();
  326 + });
  327 + }
  328 +};
  329 +
  330 +function childTaskSubmit(fs, layerIndex){
  331 + syncSubmit(fs, function(){
  332 + layer.msg('子任务添加成功');
  333 + setTimeout(function(){
  334 + layer.close(layerIndex);
  335 + }, 700);
  336 + });
  337 +}
  338 +
  339 +/**
  340 + * 自定义子任务
  341 + * 同步提交多个表单,无事物,允许中途失败
  342 + */
  343 +function syncSubmit(fs, cb){
  344 + if(fs.length == 0) return;
  345 + //备注
  346 + var remarks = $(fs[0]).parents('.custom-anim-modal').find('textarea[name=remarks]').val();
  347 + var i = 0, len = fs.length;
  348 + (function(){
  349 + if(i == len){
  350 + cb && cb();
  351 + return;
  352 + }
  353 +
  354 + var f = arguments.callee
  355 + ,form = fs[i]
  356 + ,params = $(form).serializeJSON();
  357 +
  358 + params.remarks = remarks;
  359 + $post('/childTask', params, function(){
  360 + $(form).parent().find('.task-item-close').replaceWith('<a class="task-item-success"><i class="fa fa-check-circle" ></i></a>');
  361 + i ++;
  362 + //做一层防护,防止缺心眼出现无限循环提交
  363 + if(i == 0)
  364 + return;
  365 + f();
  366 + });
  367 + })();
  368 +}
  369 +
  370 +/**
  371 + * 自定义表单校验
  372 + */
  373 +function customFormValidate(f){
  374 + var rs = true;
  375 + //所有可见的项
  376 + var es = $('input:visible,select:visible', f);
  377 +
  378 + for(var i = 0, e; e = es[i++];){
  379 + if($(e).attr('required') && $(e).val() == ''){
  380 + $(e).addClass('custom-val-error');
  381 + rs = false;
  382 + }
  383 + else
  384 + $(e).removeClass('custom-val-error');
  385 + }
  386 + return rs;
  387 +}
  388 +
  389 +/**
  390 + * 站点下拉框数据,包括原生select和select2
  391 + */
  392 +function createRouteSelectData(routes){
  393 + var ops = '', select2Data = [], temp, op;
  394 + $.each(routes, function(){
  395 + ops += '<option value="'+this.stationCode+'" data-flag="'+this.stationMark+'">'+this.stationName+'</option>';
  396 +
  397 + temp = {id: this.stationCode, text: this.stationName, flag: this.stationMark };
  398 + if(this.stationMark === 'B')
  399 + temp.disabled = 'disabled';
  400 + select2Data.push(temp);
  401 + });
  402 +
  403 + return {ops: ops, select2Data: select2Data};
  404 +}
  405 +
  406 +function createParkSelect2Data(){
  407 + var parkData = [],
  408 + items = dictionaryUtils.getByGroup('CarPark');
  409 + for ( var code in items)
  410 + parkData.push({id : code,text : items[code]});
  411 +
  412 + return parkData;
  413 +}
  414 +
  415 +function createParkSelectOps(select2Data){
  416 + var ops = '';
  417 + $.each(select2Data, function(){
  418 + ops += '<option value="'+this.id+'">'+this.text+'</option>';
  419 + });
  420 + return ops;
  421 +}
  422 +
  423 +//将元素垂直居中,无视padding, margin等
  424 +function toCenter($e){
  425 + var h = $(document.body).height();
  426 + var eh = $e.height();
  427 + if(eh < h){
  428 + $e.css('top', (h - eh) /2);
  429 + }
  430 + else{
  431 + $e.css('top', h - eh);
  432 + layer.msg('页面高度不够了,但是并没有出现滚动条!');
  433 + }
  434 +}
  435 +
  436 +/**
  437 + * 计算站距
  438 + */
  439 +function calcDistance(upDown ,sCode, eCode){
  440 + var routes = stationRoute[upDown].slice(0)
  441 + ,num = -1;
  442 +
  443 + //下行重排路由
  444 + if(upDown == 1)
  445 + routes.sort(downSort);
  446 +
  447 + for(var i = 0, route; route=routes[i++];){
  448 + if(route.stationCode == sCode){
  449 + num = 0;
  450 + continue;
  451 + }
  452 +
  453 + if(num > -1)
  454 + num += (route.distances * 100);
  455 +
  456 + if(route.stationCode == eCode)
  457 + break;
  458 + }
  459 + return num / 100;
  460 +}
  461 +
  462 +function downSort(a , b){
  463 + return a.stationRouteCode - b.stationRouteCode;
  464 +}
  465 +
  466 +function showChildTaskModal(temp, data, cb){
  467 + layer.open({
  468 + type : 1,
  469 + title : false,
  470 + area : '870px',
  471 + closeBtn : 0,
  472 + shift : 5,
  473 + fix: false,
  474 + content : template(temp , data),
  475 + success : function(layero, index) {
  476 + cb && cb(layero, index);
  477 + }
  478 + });
  479 +}
0 480 \ No newline at end of file
... ...
src/main/resources/static/pages/control/line/css/lineControl.css
... ... @@ -1373,7 +1373,7 @@ height: 400px;
1373 1373 }
1374 1374  
1375 1375 .custom-table-body table tr._active{
1376   - background: #6db5e6;
  1376 + background: #7cccaa;
1377 1377 color: white;
1378 1378 }
1379 1379  
... ... @@ -1405,7 +1405,7 @@ height: 400px;
1405 1405 }
1406 1406  
1407 1407 .custom-box-body.sub:BEFORE{
1408   - content: "子任务信息";
  1408 + content: "新增子任务";
1409 1409 }
1410 1410  
1411 1411 .custom-box-body .row{
... ... @@ -1526,4 +1526,208 @@ label.error{
1526 1526 text-align: center;
1527 1527 font-family: arial;
1528 1528 color: #433833;
1529   -}
1530 1529 \ No newline at end of file
  1530 +}
  1531 +
  1532 +.custom-btn{
  1533 + display: inline-block;
  1534 + padding: 10px 26px;
  1535 + margin: 5px;
  1536 + color: white;
  1537 + font-size: 16px;
  1538 + cursor: pointer;
  1539 + box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12);
  1540 + border: 1px solid;
  1541 +
  1542 +}
  1543 +
  1544 +.custom-btn.blue{
  1545 + background: #3598dc;
  1546 + border-color: #3598dc;
  1547 +}
  1548 +
  1549 +.custom-btn.blue:hover{
  1550 + background: #217ebd;
  1551 + border-color: #1f78b5;
  1552 +}
  1553 +
  1554 +
  1555 +.custom-btn.red{
  1556 + background: #F24100;
  1557 + border-color: #F24100;
  1558 + opacity: 0.8;
  1559 +}
  1560 +
  1561 +.custom-btn.red:hover{
  1562 + opacity: 0.7;
  1563 +}
  1564 +.custom-btn i{
  1565 + margin-right: 5px;
  1566 +}
  1567 +
  1568 +.custom-anim-modal.wrap{
  1569 + width: 100%;
  1570 + height: 100%;
  1571 +}
  1572 +
  1573 +.custom-anim-modal.wrap .custom-box-body{
  1574 + border: 0;
  1575 + padding: 0;
  1576 +}
  1577 +
  1578 +.child-task-item{
  1579 + background: white;
  1580 + padding: 0 0 18px 0;
  1581 + width: 100%;
  1582 + margin: 0;
  1583 + border-top: 1px solid #f7f7f7;
  1584 + padding-top: 0px;
  1585 +}
  1586 +
  1587 +.custom-box-body .child-task-item input.form-control,
  1588 +.custom-box-body .child-task-item select.form-control{
  1589 + width: 180px;
  1590 +}
  1591 +
  1592 +.child-task-item span.custom-label {
  1593 + color: gray;
  1594 +}
  1595 +
  1596 +.child-task-item.yinyun .child-task-title{
  1597 + background: #32c5d2;
  1598 +}
  1599 +
  1600 +.child-task-item.kongshi .child-task-title{
  1601 + background: #999;
  1602 +}
  1603 +
  1604 +.child-task-item.destroy .child-task-title{
  1605 + background: red;
  1606 +}
  1607 +
  1608 +.child-task-title{
  1609 + color: white;
  1610 + margin: 0;
  1611 + padding: 5px 12px;
  1612 + display: inline-block;
  1613 + margin-bottom: 10px;
  1614 + font-family: 微软雅黑;
  1615 + box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12);
  1616 +
  1617 + transition: all .5s ease;
  1618 + overflow: hidden;
  1619 + height: 28px;
  1620 +}
  1621 +
  1622 +#tempAddProcess .child-task-title{
  1623 + width: 33px;
  1624 +}
  1625 +
  1626 +#tempAddProcess .child-task-title.show-text{
  1627 + width: 105px;
  1628 +}
  1629 +
  1630 +.child-task-item .row{
  1631 + margin-left: 8px;
  1632 + margin-right: 8px;
  1633 +}
  1634 +
  1635 +/* .child-task-item .yy-title{
  1636 + color: white;
  1637 + margin: 0;
  1638 + background: #32c5d2;
  1639 + padding: 5px 3px 5px 12px;
  1640 + display: inline-block;
  1641 +}
  1642 +.child-task-item .ks-title{
  1643 + color: white;
  1644 + margin: 0;
  1645 + background: #d4c68c;
  1646 + padding: 5px 3px 5px 12px;
  1647 + display: inline-block;
  1648 +}
  1649 + */
  1650 +
  1651 +/* .custom-anim-modal .child-task-item:nth-of-type(1){
  1652 +}
  1653 +.custom-anim-modal .child-task-item:nth-of-type(2){
  1654 + animation-delay: .2s;
  1655 +}
  1656 +.custom-anim-modal .child-task-item:nth-of-type(3){
  1657 + animation-delay: .4s;
  1658 +} */
  1659 +
  1660 +#inParkProcess .select2-container--bootstrap,
  1661 +#outParkProcess .select2-container--bootstrap{
  1662 + display: inline-block;
  1663 +}
  1664 +/*
  1665 +i.child_task_gps{
  1666 + color: #918d8d;
  1667 + cursor: pointer;
  1668 +}
  1669 + */
  1670 +
  1671 + .add-child-task-item{
  1672 + display: inline-block;
  1673 + width: 44px;
  1674 + height: 30px;
  1675 + background: #979191;
  1676 + background: linear-gradient(to right,#dadada, #f5f5f5);
  1677 + color: #868686;
  1678 + font-size: 18px;
  1679 + padding: 3px 0 5px 14px;
  1680 + border-radius: 0 2px 2px 0 !important;
  1681 + margin-bottom: 7px;
  1682 + box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12);
  1683 + cursor: pointer;
  1684 + transition: all .5s ease;
  1685 +}
  1686 +
  1687 +.child-task-item{
  1688 + position: relative;
  1689 +}
  1690 +
  1691 +.add-child-task-item:hover{
  1692 + box-shadow: 0 8px 17px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
  1693 +}
  1694 +
  1695 +.task-item-close{
  1696 + position: absolute;
  1697 + right: 15px;
  1698 + top: 5px;
  1699 + color: red;
  1700 + font-size: 24px;
  1701 +}
  1702 +
  1703 +a.task-item-success{
  1704 + position: absolute;
  1705 + right: 15px;
  1706 + top: 5px;
  1707 + font-size: 18px;
  1708 + color: #128f12;
  1709 +}
  1710 +
  1711 +.task-item-close:hover{
  1712 + color: #e34545;
  1713 +}
  1714 +
  1715 +select.form-control.custom-val-error,
  1716 +input.form-control.custom-val-error{
  1717 + border: 1px solid #e75555;
  1718 + color: #e75555;
  1719 +}
  1720 +
  1721 +.custom-anim-modal .alert-danger{
  1722 + margin: 10px 15px 15px;
  1723 + border-radius: 5px !important;
  1724 + padding: 10px;
  1725 + display: none;
  1726 +}
  1727 +
  1728 +tr.empty {
  1729 + background-color: #fafcfb !important;
  1730 +}
  1731 +
  1732 +tr.empty._active {
  1733 + background: #7cccaa !important;
  1734 +}
... ...
src/main/resources/static/pages/control/line/index.html
1 1 <link href="css/lineControl.css" rel="stylesheet" type="text/css" />
  2 +<link href="/metronic_v4.5.4/css/animate.min.css" rel="stylesheet" type="text/css" />
2 3  
3 4 <div class="portlet light portlet-fullscreen" style="transition: all .5s ease;padding: 0;" oncontextmenu=self.event.returnValue=false>
4 5 <div class="portlet-title" style="padding: 17px 20px 0px 20px;border-bottom: none;margin-bottom: 0;background: linear-gradient(to right ,#082F4A, #125688,#0a3f64);padding-bottom: 5px;">
... ... @@ -182,6 +183,7 @@ $(function() {
182 183 getTemp('temps/home_table_tp.html');
183 184 getTemp('temps/tooltip_tp.html');
184 185 getTemp('temps/alone_tp.html');
  186 + getTemp('temps/child_task_case_tp.html');
185 187  
186 188 function getTemp(url){
187 189 $.get(url, function(template){
... ...
src/main/resources/static/pages/control/line/js/data.js
... ... @@ -2,7 +2,6 @@
2 2 * 数据处理模块
3 3 */
4 4 var _data = (function(){
5   -
6 5 var storage = window.localStorage;
7 6  
8 7 var gpsTimer;
... ... @@ -22,11 +21,23 @@ var _data = (function(){
22 21  
23 22 //线路 ——> 路牌 ——> 班次 3层映射
24 23 var lineLpMap = {};
  24 + //线路标准信息
  25 + var lineInformations = {};
  26 +
  27 + //车辆自编号和设备号对照
  28 + var carDeviceIdMapp = {};
25 29  
26 30 var dataObject = {
27 31 getLines: function(){
28 32 return JSON.parse(storage.getItem('lineControlItems'));
29 33 },
  34 + getDeviceIdByCar: function(car){
  35 + return carDeviceIdMapp[car];
  36 + },
  37 + //获取线路标准信息
  38 + getLineInformation: function(lineCode){
  39 + return lineInformations[lineCode];
  40 + },
30 41 getLineIds: function(){
31 42 return JSON.parse(storage.getItem('lineIds'));
32 43 },
... ... @@ -114,9 +125,18 @@ var _data = (function(){
114 125 array.push(this);
115 126 });
116 127 return array;
  128 + },
  129 + //根据设备号获取GPS
  130 + getGpsByDeviceId: function(deviceId){
  131 + return allGps[deviceId];
117 132 }
118 133 };
119 134  
  135 + //初始化carDeviceIdMapp
  136 + $.get('/realSchedule/carDeviceMapp', function(rs){
  137 + carDeviceIdMapp = rs;
  138 + });
  139 +
120 140 //初始化lineCodes
121 141 $.each(dataObject.getLines(), function(i, obj){
122 142 lineCodes += (obj.lineCode + ',');
... ... @@ -129,6 +149,15 @@ var _data = (function(){
129 149 $('#tab_map #mapContainer').trigger('gps_refresh', [allGps]);
130 150 });
131 151  
  152 + //获取线路标准信息
  153 + $.get('/lineInformation/line/multi', {lineCodes: lineCodes}
  154 + ,function(rs){
  155 + $.each(rs, function(){
  156 + lineInformations[this.line.lineCode] = this;
  157 + delete this['line'];
  158 + });
  159 + });
  160 +
132 161 function refreshGpsProxy(){
133 162 refreshGps(function(add, up){
134 163 $('#tab_home,#tab_map #mapContainer').trigger('gps_refresh', [add, up]);
... ... @@ -220,7 +249,7 @@ var _data = (function(){
220 249 down.sort(downSort);
221 250 //缓存路由
222 251 if(routes.length > 0){
223   - stationRoute[routes[0].lineCode] = [up, down];
  252 + stationRoute[routes[0].lineCode] = [up.slice(0), down.slice(0)];
224 253 }
225 254  
226 255 //合并
... ...
src/main/resources/static/pages/control/line/js/rightMenu.js
... ... @@ -15,6 +15,7 @@ var _menu = (function() {
15 15 layer.alert('无法找到当前项对应的班次信息,请尝试刷新页面!', {icon: 2, title: '异常'});
16 16 return;
17 17 }
  18 +
18 19 menuObject[method](schedul);
19 20 });
20 21  
... ... @@ -138,7 +139,6 @@ var _menu = (function() {
138 139 _alone.refreshSchedule(old);
139 140 });
140 141 layer.msg('调整间隔成功!');
141   - console.log($('tr[data-id='+schedul.id+']').parents('table')[0]);
142 142 _alone.calculateLineNo($('tr[data-id='+schedul.id+']').parents('table')[0]);
143 143 });
144 144 });
... ... @@ -164,20 +164,24 @@ var _menu = (function() {
164 164 },
165 165 //子任务
166 166 childTask: function(schedul){
  167 + var layIndex = layer.msg('加载中...', {icon: 16});
167 168 $.get('/pages/control/line/child_pages/child_task.html', function(content){
  169 + layer.close(layIndex);
168 170 layer.open({
169 171 type: 1,
170   - area: ['930px', '885px'],
  172 + area: ['930px', '698px'],
171 173 maxmin: true,
172   - skin:'layui-layer-molv',
173 174 content: content,
174 175 shift: 5,
175 176 title: '子任务编辑',
176 177 success: function(){
  178 + dictionaryUtils.transformDom($('#childTaskDiv .nt-dictionary'));
177 179 $('#childTaskDiv').trigger('init', {
178   - data: _data.getLineLpMap(),
  180 + //data: _data.getLineLpMap(),
179 181 selected: schedul,
180   - stationRoute: _data.getStationRouteByLine(schedul.xlBm)
  182 + _data: _data
  183 + //stationRoute: _data.getStationRouteByLine(schedul.xlBm),
  184 + // lineInformation: _data.getLineInformation(schedul.xlBm)
181 185 });
182 186 }
183 187 });
... ...
src/main/resources/static/pages/control/line/temps/child_task_case_tp.html 0 → 100644
  1 +<!-- 子任务,临加班次模板文件 -->
  2 +<script id="child_task_main_table_temp" type="text/html">
  3 +{{each list as item i}}
  4 +{{if item == null}}
  5 + <tr class="empty">
  6 + <td width="6%" >{{i + 1}}</td>
  7 + <td width="9%" ></td>
  8 + <td width="9%" ></td>
  9 + <td width="14%" ></td>
  10 + <td width="14%" ></td>
  11 + <td width="6%" ></td>
  12 + <td width="10%" ></td>
  13 + <td width="9%" ></td>
  14 + <td width="9%" ></td>
  15 + </tr>
  16 +{{else}}
  17 +<tr data-id="{{item.id}}" >
  18 + <td width="6%" >{{i + 1}}</td>
  19 + <td width="9%" >{{item.fcsj}}</td>
  20 + <td width="9%" >{{item.zdsj}}</td>
  21 + <td width="14%" >{{item.qdzName}}</td>
  22 + <td width="14%" >{{item.zdzName}}</td>
  23 + <td width="6%" >{{item.jhlc}}</td>
  24 + <td width="10%" >{{item.clZbh}}</td>
  25 + <td width="9%" >{{item.jName}}</td>
  26 + <td width="9%" >{{item.sName}}</td>
  27 +</tr>
  28 +{{/if}}
  29 +{{/each}}
  30 +</script>
  31 +
  32 +<!-- 进场子任务 -->
  33 +<script id="child_task_inpark_process_temp" type="text/html">
  34 +<div class="custom-anim-modal wrap" id="inParkProcess">
  35 +<h2 style="text-align: center;"><a href="javascript:;">{{schedul.clZbh}}</a> 回场 </h2>
  36 +<div class="alert alert-danger">
  37 + 数据校验失败,请自行检查异常输入. </div>
  38 +<div class="custom-box-body" >
  39 + <div class="child-task-item yinyun">
  40 + <form>
  41 + <input type="hidden" value="{{schedul.id}}" name="schedule.id">
  42 + <input type="hidden" value="正常" name="type1">
  43 + <a class="task-item-close"></a>
  44 + <div class="child-task-title">正常营运</div>
  45 + <div class="row">
  46 + <div class="col-md-4">
  47 + <span class="custom-label">任务类型: </span>
  48 + <select class="form-control" readonly name="type2">
  49 + <option value="1">线路上站点间</option>
  50 + </select>
  51 + </div>
  52 + <div class="col-md-4">
  53 + <span class="custom-label">营运起点: </span>
  54 + <select class="form-control" readonly name="startStation">
  55 + <option value="{{schedul.qdzCode}}">{{schedul.qdzName}}</option>
  56 + </select>
  57 + </div>
  58 + <div class="col-md-4">
  59 + <span class="custom-label">营运终点: </span>
  60 + <select class="form-control" name="endStation"></select>
  61 + </div>
  62 + </div>
  63 + <div class="row">
  64 + <div class="col-md-4">
  65 + <span class="custom-label">营运里程:</span>
  66 + <input class="form-control" name="mileage" value="{{schedul.jhlc}}" readonly>
  67 + </div>
  68 + <div class="col-md-4">
  69 + <span class="custom-label">开始时间: </span>
  70 + <input class="form-control" value="{{schedul.fcsj}}" type="time" name="startDate" readonly>
  71 + </div>
  72 + <div class="col-md-4">
  73 + <span class="custom-label">结束时间: </span>
  74 + <input class="form-control" name="endDate" value="{{schedul.zdsj}}" type="time" required=1>
  75 + </div>
  76 + </div>
  77 + </form>
  78 + </div>
  79 +
  80 + <div class="child-task-item kongshi">
  81 + <form>
  82 + <input type="hidden" value="{{schedul.id}}" name="schedule.id">
  83 + <input type="hidden" value="正常" name="type1">
  84 + <a class="task-item-close"></a>
  85 +
  86 + <div class="child-task-title">空驶进场</div>
  87 + <div class="row">
  88 + <div class="col-md-4">
  89 + <span class="custom-label">任务类型: </span>
  90 + <select class="form-control" readonly name="type2">
  91 + <option value="2">进场</option>
  92 + </select>
  93 + </div>
  94 + <div class="col-md-4">
  95 + <span class="custom-label">空驶起点: </span>
  96 + <select class="form-control" name="startStation" readonly>{{route}}</select>
  97 + </div>
  98 + <div class="col-md-4">
  99 + <span class="custom-label">停车场: </span>
  100 + <select class="form-control" name="endStation" id="kongshiEndStation"></select>
  101 + </div>
  102 + </div>
  103 + <div class="row">
  104 + <div class="col-md-4">
  105 + <span class="custom-label">空驶里程:</span>
  106 + <input class="form-control" name="mileage" value="" type="number" required=1>
  107 + </div>
  108 + <div class="col-md-4">
  109 + <span class="custom-label">开始时间: </span>
  110 + <input class="form-control" name="startDate" value="{{schedul.zdsj}}" type="time" required=1>
  111 + </div>
  112 + <div class="col-md-4">
  113 + <span class="custom-label">结束时间: </span>
  114 + <input class="form-control" value="" name="endDate" type="time" required=1>
  115 + </div>
  116 + </div>
  117 + </form>
  118 + </div>
  119 +
  120 + <div class="child-task-item destroy animated flipInX" style="display: none;">
  121 + <form>
  122 + <input type="hidden" value="{{schedul.id}}" name="schedule.id">
  123 + <input type="hidden" value="正常" name="type1">
  124 + <input type="hidden" value="1" name="destroy">
  125 +
  126 + <a class="task-item-close"></a>
  127 + <div class="child-task-title">烂班公里</div>
  128 + <div class="row">
  129 + <div class="col-md-4">
  130 + <span class="custom-label">任务类型: </span>
  131 + <select class="form-control" readonly name="type2">
  132 + <option value="1">线路上站点间(烂班)</option>
  133 + </select>
  134 + </div>
  135 + <div class="col-md-4">
  136 + <span class="custom-label">烂班起点: </span>
  137 + <select class="form-control" name="startStation" readonly>{{route}}</select>
  138 + </div>
  139 + <div class="col-md-4">
  140 + <span class="custom-label">烂班终点: </span>
  141 + <select class="form-control" name="endStation" readonly>{{route}}</select>
  142 + </div>
  143 + </div>
  144 + <div class="row">
  145 + <div class="col-md-4">
  146 + <span class="custom-label">烂班里程:</span>
  147 + <input class="form-control" name="mileage" value="" type="number" disabled>
  148 + </div>
  149 + <div class="col-md-4">
  150 + <span class="custom-label">开始时间: </span>
  151 + <input class="form-control" name="startDate" value="{{schedul.zdsj}}" type="time" readonly>
  152 + </div>
  153 + <div class="col-md-4">
  154 + <span class="custom-label">烂班原因: </span>
  155 + <select class="form-control" name="destroyReason" required=1>
  156 + <option value="">请选择...</option>
  157 + <option value="配车">配车</option>
  158 + <option value="保养">保养</option>
  159 + <option value="故障">故障</option>
  160 + <option value="肇事">肇事</option>
  161 + <option value="路阻">路阻</option>
  162 + <option value="纠纷">纠纷</option>
  163 + <option value="缺人">缺人</option>
  164 + <option value="客稀">客稀</option>
  165 + <option value="缺车">缺车</option>
  166 + <option value="气候">气候</option>
  167 + <option value="援外">援外</option>
  168 + <option value="吊慢">吊慢</option>
  169 + <option value="抽减">抽减</option>
  170 + <option value="其他">其他</option>
  171 + </select>
  172 + </div>
  173 + </div>
  174 + </form>
  175 + </div>
  176 +
  177 + <div class="child-task-item">
  178 + <div class="row">
  179 + <span class="custom-label" style="margin-left: 13px">备注:</span>
  180 + <textarea rows="3" placeholder="备注" name="remarks" class="form-control" style="width: calc(100% - 110px);"></textarea>
  181 + </div>
  182 + </div>
  183 +
  184 + <div class="child-task-item" style="padding: 15px;">
  185 + <div class="form-custom-footer" >
  186 + <button type="button" class="btn blue-madison confirm">
  187 + <i class="fa fa-check"></i> &nbsp;&nbsp;确&nbsp;&nbsp;定
  188 + </button>
  189 + <button type="button" class="btn layui-layer-close">取消</button>
  190 + </div>
  191 + </div>
  192 +</div>
  193 +</div>
  194 +</script>
  195 +
  196 +<!-- 出场子任务 -->
  197 +<script id="child_task_outpark_process_temp" type="text/html">
  198 +<div class="custom-anim-modal wrap" id="outParkProcess">
  199 +<h2 style="text-align: center;"><a href="javascript:;">{{schedul.clZbh}}</a> 出场 </h2>
  200 +<div class="alert alert-danger">
  201 + 数据校验失败,请自行检查异常输入. </div>
  202 +<div class="custom-box-body" >
  203 + <div class="child-task-item yinyun">
  204 + <form>
  205 + <input type="hidden" value="{{schedul.id}}" name="schedule.id">
  206 + <input type="hidden" value="正常" name="type1">
  207 +
  208 + <a class="task-item-close"></a>
  209 + <div class="child-task-title">正常营运</div>
  210 + <div class="row">
  211 + <div class="col-md-4">
  212 + <span class="custom-label">任务类型: </span>
  213 + <select class="form-control" readonly name="type2">
  214 + <option value="1">线路上站点间</option>
  215 + </select>
  216 + </div>
  217 + <div class="col-md-4">
  218 + <span class="custom-label">营运起点: </span>
  219 + <select class="form-control" name="startStation" readonly>
  220 + <option value="{{schedul.qdzCode}}">{{schedul.qdzName}}</option>
  221 + </select>
  222 + </div>
  223 + <div class="col-md-4">
  224 + <span class="custom-label">营运终点: </span>
  225 + <select class="form-control" name="endStation" readonly>
  226 + <option value="{{schedul.zdzCode}}">{{schedul.zdzName}}</option>
  227 + </select>
  228 + </div>
  229 + </div>
  230 + <div class="row">
  231 + <div class="col-md-4">
  232 + <span class="custom-label">营运里程:</span>
  233 + <input class="form-control" name="mileage" value="{{schedul.jhlc}}" disabled>
  234 + </div>
  235 + <div class="col-md-4">
  236 + <span class="custom-label">开始时间: </span>
  237 + <input class="form-control" value="{{schedul.fcsj}}" name="startDate" type="time" disabled>
  238 + </div>
  239 + <div class="col-md-4">
  240 + <span class="custom-label">结束时间: </span>
  241 + <input class="form-control" name="endDate" value="{{schedul.zdsj}}" type="time" required=1>
  242 + </div>
  243 + </div>
  244 + </form>
  245 + </div>
  246 +
  247 + <div class="child-task-item kongshi">
  248 + <form>
  249 + <input type="hidden" value="{{schedul.id}}" name="schedule.id">
  250 + <input type="hidden" value="正常" name="type1">
  251 +
  252 + <a class="task-item-close"></a>
  253 + <div class="child-task-title">空驶出场</div>
  254 + <div class="row">
  255 + <div class="col-md-4">
  256 + <span class="custom-label">任务类型: </span>
  257 + <select class="form-control" readonly name="type2">
  258 + <option value="3">出场</option>
  259 + </select>
  260 + </div>
  261 + <div class="col-md-4">
  262 + <span class="custom-label">停车场: </span>
  263 + <select class="form-control" name="startStation" id="kongshiStartStation"></select>
  264 + </div>
  265 + <div class="col-md-4">
  266 + <span class="custom-label">空驶终点: </span>
  267 + <select class="form-control" name="endStation" readonly>{{route}}</select>
  268 + </div>
  269 + </div>
  270 + <div class="row">
  271 + <div class="col-md-4">
  272 + <span class="custom-label">空驶里程:</span>
  273 + <input class="form-control" name="mileage" value="" type="number" required=1>
  274 + </div>
  275 + <div class="col-md-4">
  276 + <span class="custom-label">开始时间: </span>
  277 + <input class="form-control" name="startDate" value="" type="time" required=1>
  278 + </div>
  279 + <div class="col-md-4">
  280 + <span class="custom-label">结束时间: </span>
  281 + <input class="form-control" value="{{schedul.fcsj}}" name="endDate" type="time" required=1>
  282 + </div>
  283 + </div>
  284 + </form>
  285 + </div>
  286 +
  287 + <div class="child-task-item">
  288 + <div class="row">
  289 + <span class="custom-label" style="margin-left: 13px">备注:</span>
  290 + <textarea rows="3" placeholder="备注" name="remarks" class="form-control" style="width: calc(100% - 110px);"></textarea>
  291 + </div>
  292 + </div>
  293 +
  294 + <div class="child-task-item" style="padding: 15px;">
  295 + <div class="form-custom-footer" >
  296 + <button type="button" class="btn blue-madison confirm">
  297 + <i class="fa fa-check"></i> &nbsp;&nbsp;确&nbsp;&nbsp;定
  298 + </button>
  299 + <button type="button" class="btn layui-layer-close">取消</button>
  300 + </div>
  301 + </div>
  302 +</div>
  303 +</div>
  304 +</script>
  305 +
  306 +<!-- 自定义子任务 -->
  307 +<script id="child_task_tempAdd_process_temp" type="text/html">
  308 +<div class="custom-anim-modal wrap" id="tempAddProcess">
  309 +<h2 style="text-align: center;">自定义子任务 </h2>
  310 +<div class="alert alert-danger">
  311 + 数据校验失败,请自行检查异常输入. </div>
  312 +<div class="custom-box-body" >
  313 + <div class="item-list">
  314 + </div>
  315 + <div class="add-child-task-item"><i class="fa fa-plus"></i></div>
  316 + <div class="child-task-item">
  317 + <div class="row">
  318 + <span class="custom-label" style="margin-left: 13px">备注:</span>
  319 + <textarea rows="3" placeholder="备注" name="remarks" class="form-control" style="width: calc(100% - 110px);"></textarea>
  320 + </div>
  321 + </div>
  322 +
  323 + <div class="child-task-item" style="padding: 15px;">
  324 + <div class="form-custom-footer" >
  325 + <button type="button" class="btn blue-madison confirm">
  326 + <i class="fa fa-check"></i> &nbsp;&nbsp;确&nbsp;&nbsp;定
  327 + </button>
  328 + <button type="button" class="btn layui-layer-close">取消</button>
  329 + </div>
  330 + </div>
  331 +</div>
  332 +</div>
  333 +</script>
  334 +
  335 +<script id="child_task_tempAdd_item_temp" type="text/html">
  336 +<div class="child-task-item yinyun animated fadeIn" id="tempAddItem{{index}}">
  337 +<a class="task-item-close">×</a>
  338 +<div class="child-task-title"><span class="no">{{index}}</span></div>
  339 +<form>
  340 +<input type="hidden" value="{{schedul.id}}" name="schedule.id">
  341 +<div class="row">
  342 + <div class="col-md-4">
  343 + <span class="custom-label">任务类型: </span>
  344 + <select class="form-control" style="width: 60px;padding: 6px 2px;" name="type1">
  345 + <option value="正常">正常</option>
  346 + <option value="临加">临加</option>
  347 + </select>
  348 + <select class="form-control nt-dictionary" required=1 name="type2" data-group="ChildTaskType" style="width: 115px;padding: 6px 2px;"></select>
  349 + </div>
  350 + <div class="col-md-4">
  351 + <span class="custom-label">起点: </span>
  352 + <select class="form-control" name="startStation" required=1 disabled></select>
  353 + </div>
  354 + <div class="col-md-4">
  355 + <span class="custom-label">终点: </span>
  356 + <select class="form-control" name="endStation" required=1 disabled></select>
  357 + </div>
  358 +</div>
  359 +<div class="row">
  360 + <div class="col-md-4">
  361 + <span class="custom-label">里程类型:</span>
  362 + <select class="form-control" name="mileageType" required=1>
  363 + <option value="">请选择...</option>
  364 + <option value="营运">营运</option>
  365 + <option value="空驶">空驶</option>
  366 + </select>
  367 + </div>
  368 + <div class="col-md-4">
  369 + <span class="custom-label">里程:</span>
  370 + <input class="form-control" name="mileage" value="{{schedul.jhlc}}" type="number" required=1>
  371 + </div>
  372 + <div class="col-md-4">
  373 + <span class="custom-label"></span>
  374 + <label style="height: 34px;padding-top: 10px;font-size: 13px;color: gray;font-weight: 600;">
  375 +
  376 + <div class="checker" style="display: inline-block;vertical-align: middle;">
  377 + <span><input type="checkbox" value=1 name="destroy" class="icheck" ></span>
  378 + </div>
  379 + 是否烂班
  380 + </label>
  381 + </div>
  382 +</div>
  383 +<div class="row">
  384 + <div class="col-md-4">
  385 + <span class="custom-label">开始时间: </span>
  386 + <input class="form-control" name="startDate" value="{{schedul.fcsj}}" type="time" required=1>
  387 + </div>
  388 + <div class="col-md-4">
  389 + <span class="custom-label">结束时间: </span>
  390 + <input class="form-control" name="endDate" value="{{schedul.zdsj}}" type="time" required=1>
  391 + </div>
  392 + <div class="col-md-4 destroy-reason-wrap animated flipInX" style="display:none;">
  393 + <span class="custom-label">烂班原因: </span>
  394 + <select class="form-control" name="destroyReason" required=1>
  395 + <option value="">请选择...</option>
  396 + <option value="配车">配车</option>
  397 + <option value="保养">保养</option>
  398 + <option value="故障">故障</option>
  399 + <option value="肇事">肇事</option>
  400 + <option value="路阻">路阻</option>
  401 + <option value="纠纷">纠纷</option>
  402 + <option value="缺人">缺人</option>
  403 + <option value="客稀">客稀</option>
  404 + <option value="缺车">缺车</option>
  405 + <option value="气候">气候</option>
  406 + <option value="援外">援外</option>
  407 + <option value="吊慢">吊慢</option>
  408 + <option value="抽减">抽减</option>
  409 + <option value="其他">其他</option>
  410 + </select>
  411 + </div>
  412 +</div>
  413 +</form>
  414 +</div>
  415 +</script>
  416 +
  417 +
  418 +<!-- 临加班次 -->
  419 +<script id="schedul_tempAdd_item_temp" type="text/html">
  420 +<div class="custom-anim-modal wrap" id="schTempAddModal">
  421 +<h2 style="text-align: center;">临加班次 </h2>
  422 +<div class="alert alert-danger">
  423 + 数据校验失败,请自行检查异常输入. </div>
  424 +<div class="custom-box-body" >
  425 + <div class="child-task-item yinyun">
  426 + <form>
  427 + <div class="row">
  428 + <div class="col-md-4">
  429 + <span class="custom-label">班次类型: </span>
  430 + <select class="form-control nt-dictionary" data-group="ScheduleType" name="bcType"></select>
  431 + </div>
  432 + <div class="col-md-4">
  433 + </div>
  434 + <div class="col-md-4">
  435 + <span class="custom-label">上下行: </span>
  436 + <select class="form-control nt-dictionary" data-group="LineTrend" name="xlDir" required=1 ></select>
  437 + </div>
  438 + </div>
  439 +
  440 + <div class="row">
  441 + <div class="col-md-4">
  442 + <span class="custom-label">序号: </span>
  443 + <input class="form-control" value="">
  444 + </div>
  445 + <div class="col-md-4">
  446 + <span class="custom-label">开始时间: </span>
  447 + <input class="form-control" value="" type="time" name="fcsj" required=1>
  448 + </div>
  449 + <div class="col-md-4">
  450 + <span class="custom-label">结束时间: </span>
  451 + <input class="form-control" value="" type="time" name="zdsj" required=1>
  452 + </div>
  453 + </div>
  454 +
  455 + <div class="row">
  456 + <div class="col-md-4">
  457 + <span class="custom-label">起点: </span>
  458 + <select class="form-control" name="qdzCode" required=1 ></select>
  459 + </div>
  460 + <div class="col-md-4">
  461 + <span class="custom-label">终点: </span>
  462 + <select class="form-control" name="zdzCode" required=1 ></select>
  463 + </div>
  464 + <div class="col-md-4">
  465 + <span class="custom-label">里程: </span>
  466 + <input class="form-control" value="" type="number" name="jhlc" required=1>
  467 + </div>
  468 + </div>
  469 +
  470 + <div class="row">
  471 + <div class="col-md-4">
  472 + <span class="custom-label">车辆: </span>
  473 + <select class="form-control" name="clZbh" required=1 ></select>
  474 + </div>
  475 + <div class="col-md-4">
  476 + <span class="custom-label">驾驶员: </span>
  477 + <select class="form-control" name="jGh" required=1 ></select>
  478 + </div>
  479 + <div class="col-md-4">
  480 + <span class="custom-label">售票员: </span>
  481 + <select class="form-control" name="sGh" required=1 ></select>
  482 + </div>
  483 + </div>
  484 + </form>
  485 + </div>
  486 +
  487 + <div class="child-task-item" style="padding: 15px;">
  488 + <div class="form-custom-footer" >
  489 + <button type="button" class="btn blue-madison confirm">
  490 + <i class="fa fa-check"></i> &nbsp;&nbsp;确&nbsp;&nbsp;定
  491 + </button>
  492 + <button type="button" class="btn layui-layer-close">取消</button>
  493 + </div>
  494 + </div>
  495 +</div>
  496 +</div>
  497 +</script>
0 498 \ No newline at end of file
... ...
src/main/resources/static/pages/permission/dictionary/add.html
... ... @@ -141,7 +141,7 @@ $(function(){
141 141 function submit(){
142 142 $post('/dictionary', params, function() {
143 143 layer.msg('添加成功...');
144   - //loadPage('list.html');
  144 + //刷新页面
145 145 loadPage('add.html');
146 146 });
147 147 }
... ...