Commit b2ed1902ecbce92c236d50bcb1c57980148fd248

Authored by 廖磊
2 parents c9c64ac7 8f6b2e0f

Merge branch 'pudong' of http://222.66.0.204:8090/panzhaov5/bsth_control

into pudong
Showing 66 changed files with 5375 additions and 2058 deletions
src/main/java/com/bsth/controller/LineVersionsController.java 0 → 100644
  1 +package com.bsth.controller;
  2 +
  3 +import java.text.ParseException;
  4 +import java.text.SimpleDateFormat;
  5 +import java.util.Date;
  6 +import java.util.List;
  7 +import java.util.Map;
  8 +
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.web.bind.annotation.RequestMapping;
  11 +import org.springframework.web.bind.annotation.RequestMethod;
  12 +import org.springframework.web.bind.annotation.RequestParam;
  13 +import org.springframework.web.bind.annotation.RestController;
  14 +
  15 +import com.alibaba.fastjson.JSON;
  16 +import com.alibaba.fastjson.JSONObject;
  17 +import com.alibaba.fastjson.TypeReference;
  18 +import com.bsth.data.LineVersionsData;
  19 +import com.bsth.entity.Line;
  20 +import com.bsth.entity.LineVersions;
  21 +import com.bsth.entity.LsStationRoute;
  22 +import com.bsth.entity.StationRoute;
  23 +import com.bsth.repository.LineRepository;
  24 +import com.bsth.repository.LsStationRouteRepository;
  25 +import com.bsth.service.LineVersionsService;
  26 +
  27 +/**
  28 + *
  29 + * @ClassName: LineController(线路版本控制器)
  30 + *
  31 + * @Extends : BaseController
  32 + *
  33 + * @Description: TODO(线路版本版控制层)
  34 + *
  35 + * @Author bsth@lq
  36 + *
  37 + * @Version 公交调度系统BS版 0.1
  38 + *
  39 + */
  40 +@RestController
  41 +@RequestMapping("lineVersions")
  42 +public class LineVersionsController extends BaseController<LineVersions, Integer> {
  43 +
  44 + @Autowired
  45 + private LineVersionsService service;
  46 +
  47 + @Autowired
  48 + LineRepository lineRepository;
  49 + @Autowired
  50 + LsStationRouteRepository lsStationRouteRepository ;
  51 + /**
  52 + * 获取线路所有版本
  53 + *
  54 + */
  55 + @RequestMapping(value = "findByLineId", method = RequestMethod.GET)
  56 + public List<LineVersions> getLineCode(@RequestParam(defaultValue = "lineId") int lineId) {
  57 + return service.findByLineCode(lineId);
  58 + }
  59 +
  60 + /**
  61 + * 根据id查询线路版本信息
  62 + *
  63 + */
  64 + @RequestMapping(value = "findById", method = RequestMethod.GET)
  65 + public LineVersions findOne(@RequestParam(defaultValue = "id") int id) {
  66 + service.lineUpdate();
  67 + return service.findById(id);
  68 + }
  69 +
  70 + /**
  71 + * 根据id修改线路版本信息
  72 + *
  73 + */
  74 + @RequestMapping(value = "update", method = RequestMethod.POST)
  75 + public Map<String, Object> update(@RequestParam Map<String, Object> map) {
  76 + return service.update(map);
  77 + }
  78 +
  79 + @RequestMapping(value = "add", method = RequestMethod.POST)
  80 + public Map<String, Object> add(@RequestParam Map<String, Object> map) {
  81 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  82 +
  83 + LineVersions lineVersions = new LineVersions();
  84 + try {
  85 + Date startDate = simpleDateFormat.parse(map.get("startDate").toString());
  86 + Date endDate = simpleDateFormat.parse(map.get("endDate").toString());
  87 + Line line = lineRepository.findOne(Integer.valueOf(map.get("lineId").toString()));
  88 + lineVersions.setLine(line);
  89 + lineVersions.setLineCode(map.get("lineCode").toString());
  90 + lineVersions.setStartDate(new java.sql.Date(startDate.getTime()));
  91 + lineVersions.setEndDate(new java.sql.Date(endDate.getTime()));
  92 + lineVersions.setVersions(Integer.valueOf(map.get("versions").toString()));
  93 + lineVersions.setStatus(Integer.valueOf(map.get("status").toString()));
  94 + lineVersions.setRemark(map.get("remark").toString());
  95 + } catch (ParseException e) {
  96 + // TODO Auto-generated catch block
  97 + e.printStackTrace();
  98 + }
  99 + return service.save(lineVersions);
  100 + }
  101 +
  102 +}
src/main/java/com/bsth/controller/SectionController.java
@@ -74,6 +74,24 @@ public class SectionController extends BaseController&lt;Section, Integer&gt; { @@ -74,6 +74,24 @@ public class SectionController extends BaseController&lt;Section, Integer&gt; {
74 } 74 }
75 75
76 /** 76 /**
  77 + * @Description :TODO(编辑线路走向保存到线路历史表)
  78 + *
  79 + * @param map <sectionId:路段ID; sectionJSON:路段信息>
  80 + *
  81 + * @return Map<String, Object> <SUCCESS ; ERROR>
  82 + */
  83 + @RequestMapping(value="sectionCutSaveLineLS" , method = RequestMethod.POST)
  84 + public Map<String, Object> sectionCutSaveLineLS(@RequestParam Map<String, Object> map) {
  85 +
  86 + map.put("updateBy", "");
  87 +
  88 + map.put("createBy", "");
  89 +
  90 + return service.sectionCutSaveLineLS(map);
  91 +
  92 + }
  93 +
  94 + /**
77 * @Description :TODO(编辑线路走向) 95 * @Description :TODO(编辑线路走向)
78 * 96 *
79 * @param map <sectionId:路段ID; sectionJSON:路段信息> 97 * @param map <sectionId:路段ID; sectionJSON:路段信息>
src/main/java/com/bsth/data/LineVersionsData.java 0 → 100644
  1 +package com.bsth.data;
  2 +
  3 +import java.util.HashMap;
  4 +import java.util.List;
  5 +import java.util.Map;
  6 +
  7 +import org.slf4j.Logger;
  8 +import org.slf4j.LoggerFactory;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.boot.CommandLineRunner;
  11 +import org.springframework.core.annotation.Order;
  12 +import org.springframework.stereotype.Component;
  13 +
  14 +import com.bsth.entity.LineVersions;
  15 +import com.bsth.service.LineVersionsService;
  16 +import com.bsth.service.StationRouteService;
  17 +
  18 +/**
  19 + * @ClassName: LineVersionsData
  20 + * @Description: TODO(线路版本数据管理)
  21 + */
  22 +@Component
  23 +@Order(20)
  24 +public class LineVersionsData implements CommandLineRunner {
  25 +
  26 + static Logger logger = LoggerFactory.getLogger(LineVersionsData.class);
  27 +
  28 +
  29 + @Autowired
  30 + LineVersionsService lineVersionsService;
  31 +
  32 + @Autowired
  33 + StationRouteService stationRouteService;
  34 +
  35 + @Override
  36 + public void run(String... arg0) throws Exception {
  37 +
  38 +
  39 + try {
  40 + List<LineVersions> list = lineVersionsService.lineUpdate();
  41 + for (LineVersions lineVersions : list) {
  42 + Integer lineId = lineVersions.getLine().getId();
  43 + // 更新线路文件
  44 + Map<String, Object> map = new HashMap<>();
  45 + map.put("lineId", lineId);
  46 + stationRouteService.usingSingle(map);
  47 + }
  48 + } catch (Exception e) {
  49 + // TODO Auto-generated catch block
  50 + e.printStackTrace();
  51 + }
  52 + }
  53 +}
src/main/java/com/bsth/data/utils/ListFilterUtils.java
1 -package com.bsth.data.utils;  
2 -  
3 -import org.apache.commons.lang3.StringUtils;  
4 -import org.slf4j.Logger;  
5 -import org.slf4j.LoggerFactory;  
6 -  
7 -import java.lang.reflect.Field;  
8 -import java.util.ArrayList;  
9 -import java.util.Collection;  
10 -import java.util.List;  
11 -import java.util.Map;  
12 -  
13 -/**  
14 - * 集合搜索过滤  
15 - * Created by panzhao on 2017/8/2.  
16 - */  
17 -public class ListFilterUtils {  
18 -  
19 - static Logger logger = LoggerFactory.getLogger(ListFilterUtils.class);  
20 -  
21 - public static List filter(Collection all, Map<String, Object> map, Class clazz) {  
22 - List rs = new ArrayList();  
23 - Field[] fields = clazz.getDeclaredFields();  
24 -  
25 - //参与过滤的字段  
26 - List<Field> fs = new ArrayList<>();  
27 - for (Field f : fields) {  
28 - f.setAccessible(true);  
29 - if (map.containsKey(f.getName()))  
30 - fs.add(f);  
31 - }  
32 -  
33 - //过滤数据  
34 - for (Object obj : all) {  
35 - if (fieldEquals(fs, obj, map))  
36 - rs.add(obj);  
37 - }  
38 - return rs;  
39 - }  
40 -  
41 - public static boolean fieldEquals(List<Field> fs, Object obj, Map<String, Object> map) {  
42 - try {  
43 - for (Field f : fs) {  
44 - if (StringUtils.isEmpty(map.get(f.getName()).toString()))  
45 - continue;  
46 -  
47 - if (f.get(obj) == null || f.get(obj).toString().indexOf(map.get(f.getName()).toString()) == -1)  
48 - return false;  
49 - }  
50 - } catch (Exception e) {  
51 - logger.error("", e);  
52 - return false;  
53 - }  
54 - return true;  
55 - }  
56 -} 1 +package com.bsth.data.utils;
  2 +
  3 +import org.apache.commons.lang3.StringUtils;
  4 +import org.slf4j.Logger;
  5 +import org.slf4j.LoggerFactory;
  6 +
  7 +import java.lang.reflect.Field;
  8 +import java.util.ArrayList;
  9 +import java.util.Collection;
  10 +import java.util.List;
  11 +import java.util.Map;
  12 +
  13 +/**
  14 + * 集合搜索过滤
  15 + * Created by panzhao on 2017/8/2.
  16 + */
  17 +public class ListFilterUtils {
  18 +
  19 + static Logger logger = LoggerFactory.getLogger(ListFilterUtils.class);
  20 +
  21 + public static List filter(Collection all, Map<String, Object> map, Class clazz) {
  22 + List rs = new ArrayList();
  23 + Field[] fields = clazz.getDeclaredFields();
  24 +
  25 + //参与过滤的字段
  26 + List<Field> fs = new ArrayList<>();
  27 + for (Field f : fields) {
  28 + f.setAccessible(true);
  29 + if (map.containsKey(f.getName()))
  30 + fs.add(f);
  31 + }
  32 +
  33 + //过滤数据
  34 + for (Object obj : all) {
  35 + if (fieldEquals(fs, obj, map))
  36 + rs.add(obj);
  37 + }
  38 + return rs;
  39 + }
  40 +
  41 + public static boolean fieldEquals(List<Field> fs, Object obj, Map<String, Object> map) {
  42 + try {
  43 + for (Field f : fs) {
  44 + if (StringUtils.isEmpty(map.get(f.getName()).toString()))
  45 + continue;
  46 +
  47 + if (f.get(obj) == null || f.get(obj).toString().indexOf(map.get(f.getName()).toString()) == -1)
  48 + return false;
  49 + }
  50 + } catch (Exception e) {
  51 + logger.error("", e);
  52 + return false;
  53 + }
  54 + return true;
  55 + }
  56 +}
src/main/java/com/bsth/data/utils/ListPageQueryUtils.java
1 -package com.bsth.data.utils;  
2 -  
3 -import java.util.ArrayList;  
4 -import java.util.List;  
5 -  
6 -/**  
7 - * 集合分页工具  
8 - * Created by panzhao on 2017/8/2.  
9 - */  
10 -public class ListPageQueryUtils {  
11 -  
12 - public static List paging(List all, int page, int pageSize) {  
13 - List rs = new ArrayList(pageSize);  
14 -  
15 - int s = page * pageSize;  
16 - int e = (page + 1) * pageSize;  
17 -  
18 - int size = all.size();  
19 -  
20 - if (e > size)  
21 - e = size;  
22 -  
23 - if (s > size)  
24 - return rs;  
25 -  
26 - for (; s < e; s++) {  
27 - rs.add(all.get(s));  
28 - }  
29 - return rs;  
30 - }  
31 -} 1 +package com.bsth.data.utils;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.List;
  5 +
  6 +/**
  7 + * 集合分页工具
  8 + * Created by panzhao on 2017/8/2.
  9 + */
  10 +public class ListPageQueryUtils {
  11 +
  12 + public static List paging(List all, int page, int pageSize) {
  13 + List rs = new ArrayList(pageSize);
  14 +
  15 + int s = page * pageSize;
  16 + int e = (page + 1) * pageSize;
  17 +
  18 + int size = all.size();
  19 +
  20 + if (e > size)
  21 + e = size;
  22 +
  23 + if (s > size)
  24 + return rs;
  25 +
  26 + for (; s < e; s++) {
  27 + rs.add(all.get(s));
  28 + }
  29 + return rs;
  30 + }
  31 +}
src/main/java/com/bsth/entity/LineVersions.java 0 → 100644
  1 +package com.bsth.entity;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.Column;
  6 +import javax.persistence.Entity;
  7 +import javax.persistence.GeneratedValue;
  8 +import javax.persistence.GenerationType;
  9 +import javax.persistence.Id;
  10 +import javax.persistence.ManyToOne;
  11 +import javax.persistence.Table;
  12 +
  13 +
  14 +/**
  15 + *
  16 + * @ClassName: LineVersions(线路版本实体类)
  17 + *
  18 + * @Description: TODO(线路版本)
  19 + *
  20 + * @Author bsth@lq
  21 + *
  22 + * @Version 公交调度系统BS版 0.1
  23 + *
  24 + */
  25 +
  26 +@Entity
  27 +@Table(name = "bsth_c_line_versions")
  28 +public class LineVersions{
  29 +
  30 + @Id
  31 + @GeneratedValue(strategy = GenerationType.IDENTITY)
  32 + /** ID 主键(唯一标识符) int length(11) */
  33 + private Integer id;
  34 +
  35 + /** 线路ID int length(11) */
  36 + @ManyToOne
  37 + private Line line;
  38 +
  39 + /** 线路编码 varchar length(50) */
  40 + private String lineCode;
  41 +
  42 + /** 版本号 int length(11) */
  43 + private int versions;
  44 +
  45 + /** 启用日期 timestamp */
  46 + private Date startDate;
  47 +
  48 + /** 终止日期 timestamp */
  49 + private Date endDate;
  50 +
  51 + /** 创建日期 timestamp */
  52 + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
  53 + private Date createDate;
  54 +
  55 + /** 修改日期 timestamp */
  56 + @Column(name = "update_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
  57 + private Date updateDate;
  58 +
  59 + /** 备注 varchar length(50) */
  60 + private String remark;
  61 +
  62 + /** 版本状态 int length(11)
  63 + * 0(历史版本),1(当前版本),2(待更新版本)
  64 + */
  65 + private int status;
  66 +
  67 + public Integer getId() {
  68 + return id;
  69 + }
  70 +
  71 + public void setId(Integer id) {
  72 + this.id = id;
  73 + }
  74 +
  75 + public Line getLine() {
  76 + return line;
  77 + }
  78 +
  79 + public void setLine(Line line) {
  80 + this.line = line;
  81 + }
  82 +
  83 + public String getLineCode() {
  84 + return lineCode;
  85 + }
  86 +
  87 + public void setLineCode(String lineCode) {
  88 + this.lineCode = lineCode;
  89 + }
  90 +
  91 + public int getVersions() {
  92 + return versions;
  93 + }
  94 +
  95 + public void setVersions(int versions) {
  96 + this.versions = versions;
  97 + }
  98 +
  99 + public Date getStartDate() {
  100 + return startDate;
  101 + }
  102 +
  103 + public void setStartDate(Date startDate) {
  104 + this.startDate = startDate;
  105 + }
  106 +
  107 + public Date getEndDate() {
  108 + return endDate;
  109 + }
  110 +
  111 + public void setEndDate(Date endDate) {
  112 + this.endDate = endDate;
  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 Date getUpdateDate() {
  124 + return updateDate;
  125 + }
  126 +
  127 + public void setUpdateDate(Date updateDate) {
  128 + this.updateDate = updateDate;
  129 + }
  130 +
  131 + public String getRemark() {
  132 + return remark;
  133 + }
  134 +
  135 + public void setRemark(String remark) {
  136 + this.remark = remark;
  137 + }
  138 +
  139 + public int getStatus() {
  140 + return status;
  141 + }
  142 +
  143 + public void setStatus(int status) {
  144 + this.status = status;
  145 + }
  146 +
  147 +}
0 \ No newline at end of file 148 \ No newline at end of file
src/main/java/com/bsth/entity/LsSectionRoute.java 0 → 100644
  1 +package com.bsth.entity;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.Column;
  6 +import javax.persistence.Entity;
  7 +import javax.persistence.GeneratedValue;
  8 +import javax.persistence.GenerationType;
  9 +import javax.persistence.Id;
  10 +import javax.persistence.ManyToOne;
  11 +import javax.persistence.OneToOne;
  12 +import javax.persistence.Table;
  13 +
  14 +
  15 +/**
  16 + *
  17 + * @ClassName : SectionRoute(历史路段路由实体类)
  18 + *
  19 + * @Author : bsth@lq
  20 + *
  21 + * @Description : TODO(历史路段路由)
  22 + *
  23 + * @Version 公交调度系统BS版 0.1
  24 + *
  25 + */
  26 +
  27 +@Entity
  28 +@Table(name = "bsth_c_ls_sectionroute")
  29 +public class LsSectionRoute {
  30 +
  31 + @Id
  32 + @GeneratedValue(strategy = GenerationType.IDENTITY)
  33 + private Integer id;
  34 +
  35 + // 路段路由序号
  36 + private Integer sectionrouteCode;
  37 +
  38 + // 线路编号
  39 + private String lineCode;
  40 +
  41 + // 路段编号
  42 + private String sectionCode;
  43 +
  44 + // 路段路由方向
  45 + private Integer directions;
  46 +
  47 + // 版本号
  48 + private Integer versions;
  49 +
  50 + // 是否撤销
  51 + private Integer destroy;
  52 +
  53 + /** 是否有路段限速数据 <0:分段;1:未分段>*/
  54 + private Integer isRoadeSpeed;
  55 +
  56 + // 描述
  57 + private String descriptions;
  58 +
  59 + // 创建人
  60 + private Integer createBy;
  61 +
  62 + // 修改人
  63 + private Integer updateBy;
  64 +
  65 + // 创建日期
  66 + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
  67 + private Date createDate;
  68 +
  69 + // 修改日期
  70 + @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
  71 + private Date updateDate;
  72 +
  73 + // 路段信息
  74 + @OneToOne
  75 + private Section section;
  76 +
  77 + // 线路信息
  78 + @ManyToOne
  79 + private Line line;
  80 +
  81 + public Integer getIsRoadeSpeed() {
  82 + return isRoadeSpeed;
  83 + }
  84 +
  85 + public void setIsRoadeSpeed(Integer isRoadeSpeed) {
  86 + this.isRoadeSpeed = isRoadeSpeed;
  87 + }
  88 +
  89 + public Integer getId() {
  90 + return id;
  91 + }
  92 +
  93 + public void setId(Integer id) {
  94 + this.id = id;
  95 + }
  96 +
  97 + public Integer getSectionrouteCode() {
  98 + return sectionrouteCode;
  99 + }
  100 +
  101 + public void setSectionrouteCode(Integer sectionrouteCode) {
  102 + this.sectionrouteCode = sectionrouteCode;
  103 + }
  104 +
  105 + public String getLineCode() {
  106 + return lineCode;
  107 + }
  108 +
  109 + public void setLineCode(String lineCode) {
  110 + this.lineCode = lineCode;
  111 + }
  112 +
  113 + public String getSectionCode() {
  114 + return sectionCode;
  115 + }
  116 +
  117 + public void setSectionCode(String sectionCode) {
  118 + this.sectionCode = sectionCode;
  119 + }
  120 +
  121 + public Integer getDirections() {
  122 + return directions;
  123 + }
  124 +
  125 + public void setDirections(Integer directions) {
  126 + this.directions = directions;
  127 + }
  128 +
  129 + public Integer getVersions() {
  130 + return versions;
  131 + }
  132 +
  133 + public void setVersions(Integer versions) {
  134 + this.versions = versions;
  135 + }
  136 +
  137 + public Integer getDestroy() {
  138 + return destroy;
  139 + }
  140 +
  141 + public void setDestroy(Integer destroy) {
  142 + this.destroy = destroy;
  143 + }
  144 +
  145 + public String getDescriptions() {
  146 + return descriptions;
  147 + }
  148 +
  149 + public void setDescriptions(String descriptions) {
  150 + this.descriptions = descriptions;
  151 + }
  152 +
  153 + public Integer getCreateBy() {
  154 + return createBy;
  155 + }
  156 +
  157 + public void setCreateBy(Integer createBy) {
  158 + this.createBy = createBy;
  159 + }
  160 +
  161 + public Integer getUpdateBy() {
  162 + return updateBy;
  163 + }
  164 +
  165 + public void setUpdateBy(Integer updateBy) {
  166 + this.updateBy = updateBy;
  167 + }
  168 +
  169 + public Date getCreateDate() {
  170 + return createDate;
  171 + }
  172 +
  173 + public void setCreateDate(Date createDate) {
  174 + this.createDate = createDate;
  175 + }
  176 +
  177 + public Date getUpdateDate() {
  178 + return updateDate;
  179 + }
  180 +
  181 + public void setUpdateDate(Date updateDate) {
  182 + this.updateDate = updateDate;
  183 + }
  184 +
  185 + public Section getSection() {
  186 + return section;
  187 + }
  188 +
  189 + public void setSection(Section section) {
  190 + this.section = section;
  191 + }
  192 +
  193 + public Line getLine() {
  194 + return line;
  195 + }
  196 +
  197 + public void setLine(Line line) {
  198 + this.line = line;
  199 + }
  200 +}
src/main/java/com/bsth/entity/LsStationRoute.java 0 → 100644
  1 +package com.bsth.entity;
  2 +
  3 +import javax.persistence.*;
  4 +import java.util.Date;
  5 +
  6 +/**
  7 + *
  8 + * @ClassName : StationRoute(历史站点路由实体类)
  9 + *
  10 + * @Author : bsth@lq
  11 + *
  12 + * @Description : TODO(历史站点路由)
  13 + *
  14 + * @Version 公交调度系统BS版 0.1
  15 + *
  16 + */
  17 +
  18 +@Entity
  19 +@Table(name = "bsth_c_ls_stationroute")
  20 +@NamedEntityGraphs({
  21 + @NamedEntityGraph(name = "ls_stationRoute_station", attributeNodes = {
  22 + @NamedAttributeNode("station"),
  23 + @NamedAttributeNode("line")
  24 + })
  25 +})
  26 +public class LsStationRoute {
  27 +
  28 + //站点路由ID
  29 + @Id
  30 + @GeneratedValue(strategy = GenerationType.IDENTITY)
  31 + private Integer id;
  32 +
  33 + // 站点路由序号
  34 + private Integer stationRouteCode;
  35 +
  36 + // 站点编码
  37 + private String stationCode;
  38 +
  39 + // 站点名称
  40 + private String stationName;
  41 +
  42 + // 线路编码
  43 + private String lineCode;
  44 +
  45 + /**
  46 + * 站点类型
  47 + *
  48 + * ------ B:起点站
  49 + *
  50 + * ------ Z:中途站
  51 + *
  52 + * ------ E:终点站
  53 + *
  54 + * ------ T:停车场
  55 + *
  56 + */
  57 + private String stationMark;
  58 +
  59 + // 站点路由出站序号
  60 + private Integer outStationNmber;
  61 +
  62 + // 站点路由到站距离
  63 + private Double distances;
  64 +
  65 + // 站点路由到站时间
  66 + private Double toTime;
  67 +
  68 + // 首班时间
  69 + private String firstTime;
  70 +
  71 + // 末班时间
  72 + private String endTime;
  73 +
  74 + // 站点路由方向
  75 + private Integer directions;
  76 +
  77 + // 版本号
  78 + private Integer versions;
  79 +
  80 + // 是否撤销
  81 + private Integer destroy;
  82 +
  83 + // 描述
  84 + private String descriptions;
  85 +
  86 + // 创建人
  87 + private Integer createBy;
  88 +
  89 + // 修改人
  90 + private Integer updateBy;
  91 +
  92 + // 创建日期
  93 + @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
  94 + private Date createDate;
  95 +
  96 + // 修改日期
  97 + @Column(name = "update_date", columnDefinition = "timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
  98 + private Date updateDate;
  99 +
  100 + // 站点信息
  101 + @ManyToOne(fetch = FetchType.LAZY)
  102 + private Station station;
  103 +
  104 + // 线路信息
  105 + @ManyToOne
  106 + private Line line;
  107 +
  108 + public Integer getId() {
  109 + return id;
  110 + }
  111 +
  112 + public void setId(Integer id) {
  113 + this.id = id;
  114 + }
  115 +
  116 + public Integer getStationRouteCode() {
  117 + return stationRouteCode;
  118 + }
  119 +
  120 + public void setStationRouteCode(Integer stationRouteCode) {
  121 + this.stationRouteCode = stationRouteCode;
  122 + }
  123 +
  124 + public String getStationCode() {
  125 + return stationCode;
  126 + }
  127 +
  128 + public void setStationCode(String stationCode) {
  129 + this.stationCode = stationCode;
  130 + }
  131 +
  132 + public String getStationName() {
  133 + return stationName;
  134 + }
  135 +
  136 + public void setStationName(String stationName) {
  137 + this.stationName = stationName;
  138 + }
  139 +
  140 + public String getLineCode() {
  141 + return lineCode;
  142 + }
  143 +
  144 + public void setLineCode(String lineCode) {
  145 + this.lineCode = lineCode;
  146 + }
  147 +
  148 + public String getStationMark() {
  149 + return stationMark;
  150 + }
  151 +
  152 + public void setStationMark(String stationMark) {
  153 + this.stationMark = stationMark;
  154 + }
  155 +
  156 + public Integer getOutStationNmber() {
  157 + return outStationNmber;
  158 + }
  159 +
  160 + public void setOutStationNmber(Integer outStationNmber) {
  161 + this.outStationNmber = outStationNmber;
  162 + }
  163 +
  164 + public Double getDistances() {
  165 + return distances;
  166 + }
  167 +
  168 + public void setDistances(Double distances) {
  169 + this.distances = distances;
  170 + }
  171 +
  172 + public Double getToTime() {
  173 + return toTime;
  174 + }
  175 +
  176 + public void setToTime(Double toTime) {
  177 + this.toTime = toTime;
  178 + }
  179 +
  180 + public String getFirstTime() {
  181 + return firstTime;
  182 + }
  183 +
  184 + public void setFirstTime(String firstTime) {
  185 + this.firstTime = firstTime;
  186 + }
  187 +
  188 + public String getEndTime() {
  189 + return endTime;
  190 + }
  191 +
  192 + public void setEndTime(String endTime) {
  193 + this.endTime = endTime;
  194 + }
  195 +
  196 + public Integer getDirections() {
  197 + return directions;
  198 + }
  199 +
  200 + public void setDirections(Integer directions) {
  201 + this.directions = directions;
  202 + }
  203 +
  204 + public Integer getVersions() {
  205 + return versions;
  206 + }
  207 +
  208 + public void setVersions(Integer versions) {
  209 + this.versions = versions;
  210 + }
  211 +
  212 + public Integer getDestroy() {
  213 + return destroy;
  214 + }
  215 +
  216 + public void setDestroy(Integer destroy) {
  217 + this.destroy = destroy;
  218 + }
  219 +
  220 + public String getDescriptions() {
  221 + return descriptions;
  222 + }
  223 +
  224 + public void setDescriptions(String descriptions) {
  225 + this.descriptions = descriptions;
  226 + }
  227 +
  228 + public Integer getCreateBy() {
  229 + return createBy;
  230 + }
  231 +
  232 + public void setCreateBy(Integer createBy) {
  233 + this.createBy = createBy;
  234 + }
  235 +
  236 + public Integer getUpdateBy() {
  237 + return updateBy;
  238 + }
  239 +
  240 + public void setUpdateBy(Integer updateBy) {
  241 + this.updateBy = updateBy;
  242 + }
  243 +
  244 + public Date getCreateDate() {
  245 + return createDate;
  246 + }
  247 +
  248 + public void setCreateDate(Date createDate) {
  249 + this.createDate = createDate;
  250 + }
  251 +
  252 + public Date getUpdateDate() {
  253 + return updateDate;
  254 + }
  255 +
  256 + public void setUpdateDate(Date updateDate) {
  257 + this.updateDate = updateDate;
  258 + }
  259 +
  260 + public Station getStation() {
  261 + return station;
  262 + }
  263 +
  264 + public void setStation(Station station) {
  265 + this.station = station;
  266 + }
  267 +
  268 + public Line getLine() {
  269 + return line;
  270 + }
  271 +
  272 + public void setLine(Line line) {
  273 + this.line = line;
  274 + }
  275 +}
0 \ No newline at end of file 276 \ No newline at end of file
src/main/java/com/bsth/entity/schedule/SchedulePlanInfo.java
@@ -4,7 +4,6 @@ import com.bsth.entity.Line; @@ -4,7 +4,6 @@ import com.bsth.entity.Line;
4 import com.bsth.service.schedule.rules.rerun.RerunRule_input; 4 import com.bsth.service.schedule.rules.rerun.RerunRule_input;
5 import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; 5 import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output;
6 import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type; 6 import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type;
7 -import org.apache.commons.lang3.StringUtils;  
8 7
9 import javax.persistence.*; 8 import javax.persistence.*;
10 import java.sql.PreparedStatement; 9 import java.sql.PreparedStatement;
@@ -181,28 +180,28 @@ public class SchedulePlanInfo extends BEntity { @@ -181,28 +180,28 @@ public class SchedulePlanInfo extends BEntity {
181 } 180 }
182 181
183 this.j = employeeConfigInfo.getJsy().getId(); 182 this.j = employeeConfigInfo.getJsy().getId();
184 -// this.jGh = employeeConfigInfo.getJsy().getJobCode();  
185 - if (StringUtils.isNotEmpty(employeeConfigInfo.getJsy().getJobCode())) {  
186 - String[] jsy_temp = employeeConfigInfo.getJsy().getJobCode().split("-");  
187 - if (jsy_temp.length > 1) {  
188 - this.jGh = jsy_temp[1];  
189 - } else {  
190 - this.jGh = jsy_temp[0];  
191 - }  
192 - } 183 + this.jGh = employeeConfigInfo.getJsy().getJobCodeori();
  184 +// if (StringUtils.isNotEmpty(employeeConfigInfo.getJsy().getJobCode())) {
  185 +// String[] jsy_temp = employeeConfigInfo.getJsy().getJobCode().split("-");
  186 +// if (jsy_temp.length > 1) {
  187 +// this.jGh = jsy_temp[1];
  188 +// } else {
  189 +// this.jGh = jsy_temp[0];
  190 +// }
  191 +// }
193 this.jName = employeeConfigInfo.getJsy().getPersonnelName(); 192 this.jName = employeeConfigInfo.getJsy().getPersonnelName();
194 // 关联的售票员 193 // 关联的售票员
195 if (employeeConfigInfo.getSpy() != null) { 194 if (employeeConfigInfo.getSpy() != null) {
196 this.s = employeeConfigInfo.getSpy().getId(); 195 this.s = employeeConfigInfo.getSpy().getId();
197 -// this.sGh = employeeConfigInfo.getSpy().getJobCode();  
198 - if (StringUtils.isNotEmpty(employeeConfigInfo.getSpy().getJobCode())) {  
199 - String[] spy_temp = employeeConfigInfo.getSpy().getJobCode().split("-");  
200 - if (spy_temp.length > 1) {  
201 - this.sGh = spy_temp[1];  
202 - } else {  
203 - this.sGh = spy_temp[0];  
204 - }  
205 - } 196 + this.sGh = employeeConfigInfo.getSpy().getJobCodeori();
  197 +// if (StringUtils.isNotEmpty(employeeConfigInfo.getSpy().getJobCode())) {
  198 +// String[] spy_temp = employeeConfigInfo.getSpy().getJobCode().split("-");
  199 +// if (spy_temp.length > 1) {
  200 +// this.sGh = spy_temp[1];
  201 +// } else {
  202 +// this.sGh = spy_temp[0];
  203 +// }
  204 +// }
206 205
207 this.sName = employeeConfigInfo.getSpy().getPersonnelName(); 206 this.sName = employeeConfigInfo.getSpy().getPersonnelName();
208 } 207 }
@@ -230,28 +229,28 @@ public class SchedulePlanInfo extends BEntity { @@ -230,28 +229,28 @@ public class SchedulePlanInfo extends BEntity {
230 } 229 }
231 230
232 this.j = employeeConfigInfo.getJsy().getId(); 231 this.j = employeeConfigInfo.getJsy().getId();
233 -// this.jGh = employeeConfigInfo.getJsy().getJobCode();  
234 - if (StringUtils.isNotEmpty(employeeConfigInfo.getJsy().getJobCode())) {  
235 - String[] jsy_temp = employeeConfigInfo.getJsy().getJobCode().split("-");  
236 - if (jsy_temp.length > 1) {  
237 - this.jGh = jsy_temp[1];  
238 - } else {  
239 - this.jGh = jsy_temp[0];  
240 - }  
241 - } 232 + this.jGh = employeeConfigInfo.getJsy().getJobCodeori();
  233 +// if (StringUtils.isNotEmpty(employeeConfigInfo.getJsy().getJobCode())) {
  234 +// String[] jsy_temp = employeeConfigInfo.getJsy().getJobCode().split("-");
  235 +// if (jsy_temp.length > 1) {
  236 +// this.jGh = jsy_temp[1];
  237 +// } else {
  238 +// this.jGh = jsy_temp[0];
  239 +// }
  240 +// }
242 this.jName = employeeConfigInfo.getJsy().getPersonnelName(); 241 this.jName = employeeConfigInfo.getJsy().getPersonnelName();
243 // 关联的售票员 242 // 关联的售票员
244 if (employeeConfigInfo.getSpy() != null) { 243 if (employeeConfigInfo.getSpy() != null) {
245 this.s = employeeConfigInfo.getSpy().getId(); 244 this.s = employeeConfigInfo.getSpy().getId();
246 -// this.sGh = employeeConfigInfo.getSpy().getJobCode();  
247 - if (StringUtils.isNotEmpty(employeeConfigInfo.getSpy().getJobCode())) {  
248 - String[] spy_temp = employeeConfigInfo.getSpy().getJobCode().split("-");  
249 - if (spy_temp.length > 1) {  
250 - this.sGh = spy_temp[1];  
251 - } else {  
252 - this.sGh = spy_temp[0];  
253 - }  
254 - } 245 + this.sGh = employeeConfigInfo.getSpy().getJobCodeori();
  246 +// if (StringUtils.isNotEmpty(employeeConfigInfo.getSpy().getJobCode())) {
  247 +// String[] spy_temp = employeeConfigInfo.getSpy().getJobCode().split("-");
  248 +// if (spy_temp.length > 1) {
  249 +// this.sGh = spy_temp[1];
  250 +// } else {
  251 +// this.sGh = spy_temp[0];
  252 +// }
  253 +// }
255 254
256 this.sName = employeeConfigInfo.getSpy().getPersonnelName(); 255 this.sName = employeeConfigInfo.getSpy().getPersonnelName();
257 } 256 }
@@ -316,28 +315,28 @@ public class SchedulePlanInfo extends BEntity { @@ -316,28 +315,28 @@ public class SchedulePlanInfo extends BEntity {
316 } 315 }
317 316
318 this.j = employeeConfigInfo.getJsy().getId(); 317 this.j = employeeConfigInfo.getJsy().getId();
319 -// this.jGh = employeeConfigInfo.getJsy().getJobCode();  
320 - if (StringUtils.isNotEmpty(employeeConfigInfo.getJsy().getJobCode())) {  
321 - String[] jsy_temp = employeeConfigInfo.getJsy().getJobCode().split("-");  
322 - if (jsy_temp.length > 1) {  
323 - this.jGh = jsy_temp[1];  
324 - } else {  
325 - this.jGh = jsy_temp[0];  
326 - }  
327 - } 318 + this.jGh = employeeConfigInfo.getJsy().getJobCodeori();
  319 +// if (StringUtils.isNotEmpty(employeeConfigInfo.getJsy().getJobCode())) {
  320 +// String[] jsy_temp = employeeConfigInfo.getJsy().getJobCode().split("-");
  321 +// if (jsy_temp.length > 1) {
  322 +// this.jGh = jsy_temp[1];
  323 +// } else {
  324 +// this.jGh = jsy_temp[0];
  325 +// }
  326 +// }
328 this.jName = employeeConfigInfo.getJsy().getPersonnelName(); 327 this.jName = employeeConfigInfo.getJsy().getPersonnelName();
329 // 关联的售票员 328 // 关联的售票员
330 if (employeeConfigInfo.getSpy() != null) { 329 if (employeeConfigInfo.getSpy() != null) {
331 this.s = employeeConfigInfo.getSpy().getId(); 330 this.s = employeeConfigInfo.getSpy().getId();
332 -// this.sGh = employeeConfigInfo.getSpy().getJobCode();  
333 - if (StringUtils.isNotEmpty(employeeConfigInfo.getSpy().getJobCode())) {  
334 - String[] spy_temp = employeeConfigInfo.getSpy().getJobCode().split("-");  
335 - if (spy_temp.length > 1) {  
336 - this.sGh = spy_temp[1];  
337 - } else {  
338 - this.sGh = spy_temp[0];  
339 - }  
340 - } 331 + this.sGh = employeeConfigInfo.getSpy().getJobCodeori();
  332 +// if (StringUtils.isNotEmpty(employeeConfigInfo.getSpy().getJobCode())) {
  333 +// String[] spy_temp = employeeConfigInfo.getSpy().getJobCode().split("-");
  334 +// if (spy_temp.length > 1) {
  335 +// this.sGh = spy_temp[1];
  336 +// } else {
  337 +// this.sGh = spy_temp[0];
  338 +// }
  339 +// }
341 340
342 this.sName = employeeConfigInfo.getSpy().getPersonnelName(); 341 this.sName = employeeConfigInfo.getSpy().getPersonnelName();
343 } 342 }
src/main/java/com/bsth/repository/LineVersionsRepository.java 0 → 100644
  1 +package com.bsth.repository;
  2 +
  3 +import java.util.Date;
  4 +import java.util.List;
  5 +
  6 +import org.springframework.data.jpa.repository.Modifying;
  7 +import org.springframework.data.jpa.repository.Query;
  8 +import org.springframework.stereotype.Repository;
  9 +import org.springframework.transaction.annotation.Transactional;
  10 +
  11 +import com.bsth.entity.Line;
  12 +import com.bsth.entity.LineVersions;
  13 +
  14 +/**
  15 + *
  16 + * @Interface: LineVersionsRepository(线路Repository数据持久层接口)
  17 + *
  18 + * @Extends : BaseRepository
  19 + *
  20 + * @Description: TODO(线路版本Repository数据持久层接口)
  21 + *
  22 + * @Author bsth@lq
  23 + *
  24 + * @Version 公交调度系统BS版 0.1
  25 + *
  26 + */
  27 +@Repository
  28 +public interface LineVersionsRepository extends BaseRepository<LineVersions, Integer> {
  29 +
  30 + /**
  31 + * 获取线路所有版本
  32 + */
  33 + @Query(value = " SELECT lv FROM LineVersions lv where lv.line.id = ?1")
  34 + public List<LineVersions> findBylineCode(int lineId);
  35 +
  36 + @Transactional
  37 + @Modifying
  38 + @Query(value = "UPDATE LineVersions lv set lv.line=?2, lv.lineCode=?3, lv.startDate=?4, lv.endDate=?5, "
  39 + + "lv.versions=?6, lv.status=?7, lv.remark=?8 where lv.id=?1")
  40 + public int update(Integer id, Line line, String lineCode, Date startDate, Date endDate, Integer versions, Integer status,
  41 + String remark);
  42 +
  43 + /**
  44 + * 查询待更新线路的线路版本
  45 + */
  46 + @Query(value = "SELECT lv FROM LineVersions lv where lv.status = 2 and lv.startDate<sysdate() and lv.endDate > sysdate()")
  47 + public List<LineVersions> findupdated();
  48 +
  49 + /**
  50 + * 更改为历史版本
  51 + */
  52 + @Modifying
  53 + @Query(value = "UPDATE LineVersions lv set lv.status=0 where lv.line.id=?1 and lv.lineCode=?2 and lv.status=1")
  54 + public void updateOdlVersions(Integer lineId, String lineCode);
  55 +
  56 + /**
  57 + * 更改为当前版本
  58 + */
  59 + @Modifying
  60 + @Query(value = "UPDATE LineVersions lv set lv.status=1 where lv.line.id=?1 and lv.lineCode=?2 and lv.versions=?3")
  61 + public void updateNewVersions(Integer lineId, String lineCode, Integer versions);
  62 +
  63 +}
src/main/java/com/bsth/repository/LsSectionRouteRepository.java 0 → 100644
  1 +package com.bsth.repository;
  2 +
  3 +import java.util.List;
  4 +
  5 +import org.springframework.data.jpa.repository.Modifying;
  6 +import org.springframework.data.jpa.repository.Query;
  7 +import org.springframework.stereotype.Repository;
  8 +
  9 +import com.bsth.entity.LsSectionRoute;
  10 +
  11 +/**
  12 + *
  13 + * @Interface: SectionRouteRepository(路段路由Repository数据持久层接口)
  14 + *
  15 + * @Extends : BaseRepository
  16 + *
  17 + * @Description: TODO(路段路由Repository数据持久层接口)
  18 + *
  19 + * @Author bsth@lq
  20 + *
  21 + * @Version 公交调度系统BS版 0.1
  22 + *
  23 + */
  24 +
  25 +@Repository
  26 +public interface LsSectionRouteRepository extends BaseRepository<LsSectionRoute, Integer> {
  27 +
  28 + /**
  29 + * 查询待更新线路的路段路由
  30 + */
  31 + @Query(value = "SELECT sr FROM LsSectionRoute sr where sr.line.id =?1 and sr.lineCode=?2 and sr.versions=?3")
  32 + public List<LsSectionRoute> findupdated(Integer lineId,String lineCode,Integer versions);
  33 +
  34 + /**
  35 + * 更新路线前删除线路版本下历史原有路段路由
  36 + */
  37 + @Modifying
  38 + @Query(value="DELETE from bsth_c_ls_sectionroute where line = ?1 and directions = ?2 and versions=?3", nativeQuery=true)
  39 + public void batchDelete(Integer line, Integer dir, Integer versions);
  40 +}
src/main/java/com/bsth/repository/LsStationRouteRepository.java 0 → 100644
  1 +package com.bsth.repository;
  2 +
  3 +import java.util.List;
  4 +
  5 +import org.springframework.data.jpa.repository.EntityGraph;
  6 +import org.springframework.data.jpa.repository.Modifying;
  7 +import org.springframework.data.jpa.repository.Query;
  8 +import org.springframework.stereotype.Repository;
  9 +
  10 +import com.bsth.entity.LsStationRoute;
  11 +
  12 +/**
  13 + *
  14 + * @Interface: StationRouteRepository(站点路由Repository数据持久层接口)
  15 + *
  16 + * @Extends : BaseRepository
  17 + *
  18 + * @Description: TODO(站点路由Repository数据持久层接口)
  19 + *
  20 + * @Author bsth@lq
  21 + *
  22 + * @Version 公交调度系统BS版 0.1
  23 + *
  24 + */
  25 +
  26 +@Repository
  27 +public interface LsStationRouteRepository extends BaseRepository<LsStationRoute, Integer> {
  28 +
  29 + /**
  30 + * 查询待更新线路的站点路由
  31 + */
  32 + @EntityGraph(value = "ls_stationRoute_station", type = EntityGraph.EntityGraphType.FETCH)
  33 + @Query(value = "SELECT DISTINCT sr FROM LsStationRoute sr where sr.line.id =?1 and sr.lineCode=?2 and sr.versions=?3")
  34 + List<LsStationRoute> findupdated(Integer lineId, String lineCode, Integer versions);
  35 +
  36 + /**
  37 + * 更新路线前删除线路版本号历史原有站点路由
  38 + *
  39 + * @param line
  40 + * @param dir
  41 + */
  42 + @Modifying
  43 + @Query(value="DELETE from bsth_c_ls_stationroute where line = ?1 and directions = ?2 and versions = ?3", nativeQuery=true)
  44 + public void batchDelete(Integer line,Integer dir, Integer versions);
  45 +}
src/main/java/com/bsth/repository/SectionRouteRepository.java
@@ -192,4 +192,14 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int @@ -192,4 +192,14 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int
192 @Modifying 192 @Modifying
193 @Query(value="update bsth_c_sectionroute set directions = case directions when 1 then 0 when 0 then 1 end where line_code = ?1 ", nativeQuery=true) 193 @Query(value="update bsth_c_sectionroute set directions = case directions when 1 then 0 when 0 then 1 end where line_code = ?1 ", nativeQuery=true)
194 public void sectionRouteDir(Integer line); 194 public void sectionRouteDir(Integer line);
  195 +
  196 + // 更具线路批量撤销
  197 + @Modifying
  198 + @Query(value="UPDATE SectionRoute sr set sr.destroy = 1 where sr.line.id = ?1 and sr.lineCode = ?2")
  199 + public void batchUpdate(Integer lineId, String lineCode);
  200 +
  201 + // 批量删除
  202 + @Modifying
  203 + @Query(value="delete from SectionRoute sr where sr.line.id = ?1 and sr.lineCode = ?2")
  204 + public void batchDelete(Integer lineId, String lineCode);
195 } 205 }
src/main/java/com/bsth/repository/StationRouteRepository.java
@@ -313,7 +313,7 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int @@ -313,7 +313,7 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
313 public void stationRouteIsDestroyUpdBatch(Integer ids); 313 public void stationRouteIsDestroyUpdBatch(Integer ids);
314 314
315 /** 315 /**
316 - * 更新路线前撤销线路原有站点 316 + *
317 * 317 *
318 * @param line 318 * @param line
319 * @param dir 319 * @param dir
@@ -321,4 +321,14 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int @@ -321,4 +321,14 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
321 @Modifying 321 @Modifying
322 @Query(value="insert into (select * from bsth_c_stationroute_cache where line = ?1 and directions = ?2) bsth_c_stationroute", nativeQuery=true) 322 @Query(value="insert into (select * from bsth_c_stationroute_cache where line = ?1 and directions = ?2) bsth_c_stationroute", nativeQuery=true)
323 public void stationRouteUpdate(Integer line,Integer dir); 323 public void stationRouteUpdate(Integer line,Integer dir);
  324 +
  325 + // 更具线路批量撤销
  326 + @Modifying
  327 + @Query(value="UPDATE StationRoute sr set sr.destroy = 1 where sr.line.id = ?1 and sr.lineCode = ?2")
  328 + void batchUpdate(Integer lineId, String lineCode);
  329 +
  330 + // 批量删除
  331 + @Modifying
  332 + @Query(value="delete from StationRoute sr where sr.line.id = ?1 and sr.lineCode = ?2")
  333 + void batchDelete(Integer lineId, String lineCode);
324 } 334 }
src/main/java/com/bsth/service/LineVersionsService.java 0 → 100644
  1 +package com.bsth.service;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import com.bsth.entity.LineVersions;
  7 +
  8 +/**
  9 + *
  10 + * @Interface: LineVersionsService(线路版本service业务层实现接口)
  11 + *
  12 + * @extends : BaseService
  13 + *
  14 + * @Description: TODO(线路版本service业务层实现接口)
  15 + *
  16 + * @Author bsth@lq
  17 + *
  18 + * @Version 公交调度系统BS版 0.1
  19 + *
  20 + */
  21 +public interface LineVersionsService extends BaseService<LineVersions, Integer> {
  22 +
  23 + /**
  24 + * 获取线路版本
  25 + *
  26 + */
  27 + List<LineVersions> findByLineCode(int lineId);
  28 +
  29 + Map<String, Object> update(Map<String, Object> map);
  30 +
  31 + List<LineVersions> findupdated();
  32 +
  33 + List<LineVersions> lineUpdate();
  34 +
  35 +}
src/main/java/com/bsth/service/SectionRouteService.java
@@ -62,5 +62,7 @@ public interface SectionRouteService extends BaseService&lt;SectionRoute, Integer&gt; @@ -62,5 +62,7 @@ public interface SectionRouteService extends BaseService&lt;SectionRoute, Integer&gt;
62 List<Map<String, Object>> findUpSectionRouteCode(Map<String, Object> map); 62 List<Map<String, Object>> findUpSectionRouteCode(Map<String, Object> map);
63 63
64 Map<String, Object> quoteSection(Map<String, Object> map); 64 Map<String, Object> quoteSection(Map<String, Object> map);
  65 +
  66 + void batchUpdate(Integer lineId, String lineCode);
65 67
66 } 68 }
src/main/java/com/bsth/service/SectionService.java
@@ -35,4 +35,6 @@ public interface SectionService extends BaseService&lt;Section, Integer&gt; { @@ -35,4 +35,6 @@ public interface SectionService extends BaseService&lt;Section, Integer&gt; {
35 Map<String, Object> sectionCut(Map<String, Object> map); 35 Map<String, Object> sectionCut(Map<String, Object> map);
36 36
37 Map<String, Object> sectionCacheUpdate(Map<String, Object> map); 37 Map<String, Object> sectionCacheUpdate(Map<String, Object> map);
  38 +
  39 + Map<String, Object> sectionCutSaveLineLS(Map<String, Object> map);
38 } 40 }
src/main/java/com/bsth/service/StationRouteService.java
@@ -112,5 +112,7 @@ public interface StationRouteService extends BaseService&lt;StationRoute, Integer&gt; @@ -112,5 +112,7 @@ public interface StationRouteService extends BaseService&lt;StationRoute, Integer&gt;
112 * @return 112 * @return
113 */ 113 */
114 Map<String, Object> getSectionRouteExport(Integer id, HttpServletResponse resp); 114 Map<String, Object> getSectionRouteExport(Integer id, HttpServletResponse resp);
  115 +
  116 + void batchUpdate(Integer lineId, String lineCode);
115 117
116 } 118 }
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
@@ -958,6 +958,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -958,6 +958,8 @@ public class BusIntervalServiceImpl implements BusIntervalService {
958 if(tsSet.contains(schedule2.getId()) || schedule2.getBcType().toString().equals("in") || schedule2.getBcType().toString().equals("out")){ 958 if(tsSet.contains(schedule2.getId()) || schedule2.getBcType().toString().equals("in") || schedule2.getBcType().toString().equals("out")){
959 fcsj2 = schedule1.getZdsjT(); 959 fcsj2 = schedule1.getZdsjT();
960 } 960 }
  961 + if(fcsj2 < fcsj1)
  962 + fcsj2 += 1440l;
961 if(sfqr == 1 && time1 > fcsj1){ 963 if(sfqr == 1 && time1 > fcsj1){
962 jhyysj += fcsj2 - time1; 964 jhyysj += fcsj2 - time1;
963 }else if(sfqr == 1 && time2 < fcsj2){ 965 }else if(sfqr == 1 && time2 < fcsj2){
@@ -966,7 +968,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -966,7 +968,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
966 jhyysj += fcsj2 - fcsj1; 968 jhyysj += fcsj2 - fcsj1;
967 } 969 }
968 if(jhyysj < 0){ 970 if(jhyysj < 0){
969 - System.out.println(fcsj2 + " - " + fcsj1); 971 + System.out.println(fcsj2 + " - " + fcsj1 + " = " + (fcsj2 - fcsj1));
970 } 972 }
971 jhyysj1 += fcsj2 - fcsj1; 973 jhyysj1 += fcsj2 - fcsj1;
972 } 974 }
@@ -1010,7 +1012,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1010,7 +1012,8 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1010 List<ChildTaskPlan> cTasks = cMap.get(schedule.getId()); 1012 List<ChildTaskPlan> cTasks = cMap.get(schedule.getId());
1011 for(ChildTaskPlan childTaskPlan : cTasks){ 1013 for(ChildTaskPlan childTaskPlan : cTasks){
1012 Map<String, Object> temp = new HashMap<String, Object>(); 1014 Map<String, Object> temp = new HashMap<String, Object>();
1013 - if(childTaskPlan.getMileageType().equals("empty") || childTaskPlan.isDestroy()){ 1015 + if(!childTaskPlan.getMileageType().equals("service") || childTaskPlan.isDestroy()
  1016 + || !childTaskPlan.getType1().equals("正常") || childTaskPlan.getCcId() != null){
1014 temp.put("lc", null); 1017 temp.put("lc", null);
1015 temp.put("fcsj", null); 1018 temp.put("fcsj", null);
1016 temp.put("zdsj", null); 1019 temp.put("zdsj", null);
@@ -1071,6 +1074,9 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -1071,6 +1074,9 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1071 } else if(i == keyList.size() - 1){ 1074 } else if(i == keyList.size() - 1){
1072 fcsj2 = Long.valueOf(m2.get("zdsj").toString()); 1075 fcsj2 = Long.valueOf(m2.get("zdsj").toString());
1073 } 1076 }
  1077 + if(fcsj2 < fcsj1){
  1078 + fcsj2 += 1440l;
  1079 + }
1074 if(sfqr == 1 && time1 > fcsj1){ 1080 if(sfqr == 1 && time1 > fcsj1){
1075 sjyysj += fcsj2 - time1; 1081 sjyysj += fcsj2 - time1;
1076 }else if(sfqr == 1 && time2 < fcsj2){ 1082 }else if(sfqr == 1 && time2 < fcsj2){
src/main/java/com/bsth/service/impl/LineVersionsServiceImpl.java 0 → 100644
  1 +package com.bsth.service.impl;
  2 +
  3 +import java.sql.PreparedStatement;
  4 +import java.sql.SQLException;
  5 +import java.text.ParseException;
  6 +import java.text.SimpleDateFormat;
  7 +import java.util.Date;
  8 +import java.util.HashMap;
  9 +import java.util.List;
  10 +import java.util.Map;
  11 +
  12 +import org.drools.core.time.impl.PseudoClockScheduler;
  13 +import org.springframework.beans.factory.annotation.Autowired;
  14 +import org.springframework.jdbc.core.BatchPreparedStatementSetter;
  15 +import org.springframework.jdbc.core.JdbcTemplate;
  16 +import org.springframework.stereotype.Service;
  17 +import org.springframework.transaction.annotation.Transactional;
  18 +
  19 +import com.alibaba.fastjson.JSON;
  20 +import com.alibaba.fastjson.JSONArray;
  21 +import com.bsth.common.ResponseCode;
  22 +import com.bsth.entity.Line;
  23 +import com.bsth.entity.LineVersions;
  24 +import com.bsth.entity.LsSectionRoute;
  25 +import com.bsth.entity.LsStationRoute;
  26 +import com.bsth.entity.SectionRoute;
  27 +import com.bsth.entity.StationRoute;
  28 +import com.bsth.repository.LineRepository;
  29 +import com.bsth.repository.LineVersionsRepository;
  30 +import com.bsth.repository.LsSectionRouteRepository;
  31 +import com.bsth.repository.LsStationRouteRepository;
  32 +import com.bsth.service.LineVersionsService;
  33 +import com.bsth.service.SectionRouteService;
  34 +import com.bsth.service.StationRouteService;
  35 +
  36 +/**
  37 + *
  38 + * @ClassName: LineVersionsServiceImpl(线路service业务层实现类)
  39 + *
  40 + * @Extends : BaseService
  41 + *
  42 + * @Description: TODO(线路service业务层)
  43 + *
  44 + * @Author bsth@lq
  45 + *
  46 + * @Version 公交调度系统BS版 0.1
  47 + *
  48 + */
  49 +
  50 +@Service
  51 +public class LineVersionsServiceImpl extends BaseServiceImpl<LineVersions, Integer> implements LineVersionsService{
  52 +
  53 + @Autowired
  54 + private LineVersionsRepository repository;
  55 +
  56 + @Autowired
  57 + LineRepository lineRepository;
  58 +
  59 + @Autowired
  60 + SectionRouteService sectionRouteService;
  61 +
  62 + @Autowired
  63 + StationRouteService stationRouteService;
  64 +
  65 + @Autowired
  66 + com.bsth.repository.SectionRouteRepository sectionRouteRepository ;
  67 +
  68 + @Autowired
  69 + com.bsth.repository.StationRouteRepository stationRouteRepository ;
  70 +
  71 + @Autowired
  72 + LsSectionRouteRepository lsSectionRouteRepository ;
  73 +
  74 + @Autowired
  75 + LsStationRouteRepository lsStationRouteRepository ;
  76 +
  77 + @Override
  78 + public List<LineVersions> findByLineCode(int lineId) {
  79 + return repository.findBylineCode(lineId);
  80 + }
  81 +
  82 + @Override
  83 + public Map<String, Object> update(Map<String, Object> map) {
  84 + Map<String, Object> resultMap = new HashMap<>();
  85 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  86 + try {
  87 + Date startDate = simpleDateFormat.parse(map.get("startDate").toString());
  88 + Date endDate = simpleDateFormat.parse(map.get("endDate").toString());
  89 + Integer id = Integer.valueOf(map.get("Id").toString());
  90 + Integer lineid = Integer.valueOf(map.get("lineId").toString());
  91 + String lineCode = map.get("lineCode").toString();
  92 + Integer versions = Integer.valueOf(map.get("versions").toString());
  93 + Integer status = Integer.valueOf(map.get("status").toString());
  94 + String remark = map.get("remark").toString();
  95 +
  96 + Line line = lineRepository.findOne(lineid);
  97 +
  98 + int statu = repository.update(id,line,lineCode,new java.sql.Date(startDate.getTime()),
  99 + new java.sql.Date(endDate.getTime()),versions,status,remark);
  100 + if (statu==1) {
  101 + resultMap.put("status", ResponseCode.SUCCESS);
  102 + } else {
  103 + resultMap.put("status", ResponseCode.ERROR);
  104 + }
  105 + } catch (ParseException e) {
  106 + // TODO Auto-generated catch block
  107 + e.printStackTrace();
  108 + resultMap.put("status", ResponseCode.ERROR);
  109 + return resultMap;
  110 + }
  111 + return resultMap;
  112 + }
  113 +
  114 + @Override
  115 + public List<LineVersions> findupdated() {
  116 + return repository.findupdated();
  117 + }
  118 +
  119 + @Autowired
  120 + JdbcTemplate jdbcTemplate;
  121 +
  122 + // 线路更新
  123 + @Transactional
  124 + @Override
  125 + public List<LineVersions> lineUpdate() {
  126 + List<LineVersions> list = findupdated();
  127 + for (LineVersions lineVersions : list) {
  128 + Integer lineId = lineVersions.getLine().getId();
  129 + String lineCode = lineVersions.getLineCode();
  130 + Integer versions = lineVersions.getVersions();
  131 + // 需要更新线路的路由
  132 + List<LsSectionRoute> lsSectionRoutes = lsSectionRouteRepository.findupdated(lineId, lineCode, versions);
  133 + List<LsStationRoute> lsStationRoutes = lsStationRouteRepository.findupdated(lineId, lineCode, versions);
  134 + if (lsSectionRoutes.size() != 0 && lsStationRoutes.size() != 0) {
  135 + // 更新
  136 + final List<SectionRoute> sectionRoutes = JSONArray.parseArray(JSON.toJSONString(lsSectionRoutes), SectionRoute.class);
  137 + final List<StationRoute> stationRoutes = JSONArray.parseArray(JSON.toJSONString(lsStationRoutes), StationRoute.class);
  138 + //sectionRouteService.batchUpdate(lineId, lineCode);
  139 + //sectionRouteRepository.batchDelete(lineId, lineCode);
  140 +
  141 + jdbcTemplate.update("delete from bsth_c_stationroute where line = ? and line_code = ?", lineId, lineCode);
  142 +
  143 + String stationSql ="insert into bsth_c_stationroute(id,line,station,station_name,station_route_code,"
  144 + + "line_code,station_code,station_mark,out_station_nmber,directions,distances,"
  145 + + "to_time,first_time,end_time,descriptions,destroy,versions,create_by,create_date,"
  146 + + "update_by,update_date) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  147 + jdbcTemplate.batchUpdate(stationSql, new BatchPreparedStatementSetter() {
  148 +
  149 + @Override
  150 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  151 + StationRoute sRoute = stationRoutes.get(i);
  152 + sRoute.getStationRouteCode();
  153 + ps.setInt(1, sRoute.getId());
  154 + ps.setInt(2, sRoute.getLine().getId());
  155 + ps.setInt(3, sRoute.getStation().getId());
  156 + ps.setString(4, sRoute.getStationName());
  157 + ps.setInt(5, sRoute.getStationRouteCode());
  158 + ps.setString(6, sRoute.getLineCode());
  159 + ps.setString(7, sRoute.getStationCode());
  160 + ps.setString(8, sRoute.getStationMark());
  161 + ps.setInt(9, sRoute.getOutStationNmber()==null ? 0:sRoute.getOutStationNmber());
  162 + ps.setInt(10, sRoute.getDirections());
  163 + ps.setDouble(11, sRoute.getDistances());
  164 + ps.setDouble(12, sRoute.getToTime());
  165 + ps.setString(13, sRoute.getFirstTime()==null ? "":sRoute.getFirstTime());
  166 + ps.setString(14, sRoute.getEndTime()==null ? "":sRoute.getEndTime());
  167 + ps.setString(15, sRoute.getDescriptions()==null ? "":sRoute.getDescriptions());
  168 + ps.setInt(16, sRoute.getDestroy());
  169 + ps.setInt(17, sRoute.getVersions());
  170 + ps.setInt(18, sRoute.getCreateBy()==null ? 0:sRoute.getCreateBy());
  171 + ps.setDate(19, new java.sql.Date(sRoute.getCreateDate().getTime()));
  172 + ps.setInt(20, sRoute.getUpdateBy()==null ? 0:sRoute.getUpdateBy());
  173 + ps.setDate(21, new java.sql.Date(sRoute.getUpdateDate().getTime()));
  174 + }
  175 +
  176 + @Override
  177 + public int getBatchSize() {
  178 + // TODO Auto-generated method stub
  179 + return stationRoutes.size();
  180 + }
  181 + } );
  182 + jdbcTemplate.update("delete from bsth_c_sectionroute where line = ? and line_code = ?", lineId, lineCode);
  183 +
  184 + String sectionSql ="insert into bsth_c_sectionroute(id,line_code,section_code,sectionroute_code,"
  185 + + "directions,line,section,descriptions,create_by,create_date,update_by,update_date,versions,"
  186 + + "destroy,is_roade_speed) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  187 + jdbcTemplate.batchUpdate(sectionSql, new BatchPreparedStatementSetter() {
  188 +
  189 + @Override
  190 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  191 + SectionRoute sRoute = sectionRoutes.get(i);
  192 + ps.setInt(1, sRoute.getId());
  193 + ps.setString(2, sRoute.getLineCode());
  194 + ps.setString(3, sRoute.getSectionCode());
  195 + ps.setInt(4, sRoute.getSectionrouteCode());
  196 + ps.setInt(5, sRoute.getDirections());
  197 + ps.setInt(6, sRoute.getLine().getId());
  198 + ps.setInt(7, sRoute.getSection().getId());
  199 + ps.setString(8, sRoute.getDescriptions()==null ? "":sRoute.getDescriptions());
  200 + ps.setInt(9, sRoute.getCreateBy()==null ? 0:sRoute.getCreateBy());
  201 + ps.setDate(10, new java.sql.Date(sRoute.getCreateDate().getTime()));
  202 + ps.setInt(11, sRoute.getUpdateBy()==null ? 0:sRoute.getUpdateBy());
  203 + ps.setDate(12, new java.sql.Date(sRoute.getUpdateDate().getTime()));
  204 + ps.setInt(13, sRoute.getVersions());
  205 + ps.setInt(14, sRoute.getDestroy());
  206 + ps.setInt(15, sRoute.getIsRoadeSpeed()==null ? 0:sRoute.getIsRoadeSpeed());
  207 + }
  208 +
  209 + @Override
  210 + public int getBatchSize() {
  211 + // TODO Auto-generated method stub
  212 + return sectionRoutes.size();
  213 + }
  214 + } );
  215 + /*for (SectionRoute sectionRoute : sectionRoutes) {
  216 + sectionRouteService.save(sectionRoute);
  217 + }*/
  218 +// sectionRouteService.bulkSave(sectionRoutes);
  219 + //List<StationRoute> stationRoutes = JSONArray.parseArray(JSON.toJSONString(lsStationRoutes), StationRoute.class);
  220 +// stationRouteService.batchUpdate(lineId, lineCode);
  221 +
  222 + //stationRouteRepository.batchDelete(lineId, lineCode);
  223 + /*for (StationRoute stationRoute : stationRoutes) {
  224 + stationRouteService.save(stationRoute);
  225 + }*/
  226 +// stationRouteService.bulkSave(stationRoutes);
  227 + // 更新线路版本
  228 + repository.updateOdlVersions(lineId, lineCode);
  229 + repository.updateNewVersions(lineId,lineCode,versions);
  230 + }
  231 + }
  232 + return list;
  233 + }
  234 +
  235 +}
src/main/java/com/bsth/service/impl/SectionRouteServiceImpl.java
@@ -385,4 +385,10 @@ public class SectionRouteServiceImpl extends BaseServiceImpl&lt;SectionRoute, Integ @@ -385,4 +385,10 @@ public class SectionRouteServiceImpl extends BaseServiceImpl&lt;SectionRoute, Integ
385 } 385 }
386 return resultMap; 386 return resultMap;
387 } 387 }
  388 +
  389 + // 更具线路批量撤销
  390 + @Override
  391 + public void batchUpdate(Integer lineId, String lineCode) {
  392 + repository.batchUpdate(lineId,lineCode);
  393 + }
388 } 394 }
389 \ No newline at end of file 395 \ No newline at end of file
src/main/java/com/bsth/service/impl/SectionServiceImpl.java
@@ -17,12 +17,18 @@ import com.alibaba.fastjson.JSONArray; @@ -17,12 +17,18 @@ import com.alibaba.fastjson.JSONArray;
17 import com.alibaba.fastjson.JSONObject; 17 import com.alibaba.fastjson.JSONObject;
18 import com.bsth.common.ResponseCode; 18 import com.bsth.common.ResponseCode;
19 import com.bsth.entity.Line; 19 import com.bsth.entity.Line;
  20 +import com.bsth.entity.LineVersions;
  21 +import com.bsth.entity.LsSectionRoute;
  22 +import com.bsth.entity.LsStationRoute;
20 import com.bsth.entity.Section; 23 import com.bsth.entity.Section;
21 import com.bsth.entity.SectionRoute; 24 import com.bsth.entity.SectionRoute;
22 import com.bsth.entity.SectionRouteCache; 25 import com.bsth.entity.SectionRouteCache;
23 import com.bsth.entity.StationRoute; 26 import com.bsth.entity.StationRoute;
24 import com.bsth.entity.StationRouteCache; 27 import com.bsth.entity.StationRouteCache;
25 import com.bsth.repository.LineRepository; 28 import com.bsth.repository.LineRepository;
  29 +import com.bsth.repository.LineVersionsRepository;
  30 +import com.bsth.repository.LsSectionRouteRepository;
  31 +import com.bsth.repository.LsStationRouteRepository;
26 import com.bsth.repository.SectionRepository; 32 import com.bsth.repository.SectionRepository;
27 import com.bsth.repository.SectionRouteCacheRepository; 33 import com.bsth.repository.SectionRouteCacheRepository;
28 import com.bsth.repository.SectionRouteRepository; 34 import com.bsth.repository.SectionRouteRepository;
@@ -62,15 +68,24 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem @@ -62,15 +68,24 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
62 LineRepository lineRepository; 68 LineRepository lineRepository;
63 69
64 @Autowired 70 @Autowired
  71 + LineVersionsRepository lineVersionsRepository;
  72 +
  73 + @Autowired
65 SectionRouteRepository routeRepository; 74 SectionRouteRepository routeRepository;
66 75
67 @Autowired 76 @Autowired
  77 + LsSectionRouteRepository lsRouteRepository;
  78 +
  79 + @Autowired
68 SectionRouteCacheRepository routeCacheRepository; 80 SectionRouteCacheRepository routeCacheRepository;
69 81
70 @Autowired 82 @Autowired
71 StationRouteRepository stationRouteRepository; 83 StationRouteRepository stationRouteRepository;
72 84
73 @Autowired 85 @Autowired
  86 + LsStationRouteRepository lsStationRouteRepository;
  87 +
  88 + @Autowired
74 StationRouteCacheRepository stationRouteCacheRepository; 89 StationRouteCacheRepository stationRouteCacheRepository;
75 90
76 /** 91 /**
@@ -88,119 +103,12 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem @@ -88,119 +103,12 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
88 // 路段点List 103 // 路段点List
89 List<Point> bPointsList = new ArrayList<>(); 104 List<Point> bPointsList = new ArrayList<>();
90 // 截取路段点List 105 // 截取路段点List
91 - List<Point> bPointsCutList = new ArrayList<>(); 106 +// List<Point> bPointsCutList = new ArrayList<>();
92 // 截取后的路段 107 // 截取后的路段
93 List<Map<String, String>> sectionArrayList = new ArrayList<>(); 108 List<Map<String, String>> sectionArrayList = new ArrayList<>();
94 String bsectionVector = map.get("sectionBsectionVector").equals("") ? "" :map.get("sectionBsectionVector").toString(); 109 String bsectionVector = map.get("sectionBsectionVector").equals("") ? "" :map.get("sectionBsectionVector").toString();
95 String bsectionVectorCutList = map.get("cutSectionList").equals("") ? "" :map.get("cutSectionList").toString(); 110 String bsectionVectorCutList = map.get("cutSectionList").equals("") ? "" :map.get("cutSectionList").toString();
96 - if(!bsectionVector.equals("")) {  
97 - // 转换成JSON数组  
98 - JSONArray sectionsArray = JSONArray.parseArray(bsectionVector);  
99 - // 遍历  
100 - for(int s = 0 ;s<sectionsArray.size();s++) {  
101 - String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString();  
102 - String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString();  
103 - bPointsList.add(new Point(Double.parseDouble(pointsLngStr), Double.parseDouble(pointsLatStr)));  
104 - }  
105 - }  
106 - if(!bsectionVectorCutList.equals("")) {  
107 - // 转换成JSON数组  
108 - JSONArray sectionsArrayList = JSONArray.parseArray(bsectionVectorCutList);  
109 - // 截取路段在总路段中的下表  
110 - int firstTemp = 0;  
111 - int lastTemp = 0;  
112 - // 每个截取的路段去总路段中获取  
113 - for (int i = 0; i < sectionsArrayList.size(); i++) {  
114 - // 切点列表  
115 - JSONObject sectionsArray = sectionsArrayList.getJSONObject(i);  
116 - String sectionName = sectionsArray.get("name").toString();  
117 - JSONArray sectionPoints = sectionsArray.getJSONArray("section");  
118 - // 用两个坐标点去截取总路段  
119 - if (i == 0) {  
120 - for(int s = 0 ;s<sectionPoints.size();s++) {  
121 - String bpointsLngStr = sectionPoints.getJSONObject(s).get("lng").toString();  
122 - String bpointsLatStr = sectionPoints.getJSONObject(s).get("lat").toString();  
123 - Point bPointcut = new Point(Double.parseDouble(bpointsLngStr), Double.parseDouble(bpointsLatStr));  
124 - double distance = 0;  
125 - // 寻找最近点  
126 - for (int index = firstTemp; index < bPointsList.size(); index++) {  
127 - if (index == firstTemp) {  
128 - distance = GeoUtils.getDistance(bPointcut,bPointsList.get(index));  
129 - } else {  
130 - double distanceTemp = GeoUtils.getDistance(bPointcut,bPointsList.get(index));  
131 - if(distance > distanceTemp) {  
132 - distance = distanceTemp;  
133 - lastTemp = index;  
134 - }  
135 - }  
136 - }  
137 - if (s == 0) {  
138 - // 第一个点作为路段的起点  
139 - firstTemp = lastTemp;  
140 - }  
141 - // 用切点替换最近点  
142 - if(lastTemp == firstTemp) {  
143 - bPointsList.add(++lastTemp, bPointcut);  
144 - } else {  
145 - bPointsList.set(lastTemp, bPointcut);  
146 - }  
147 - }  
148 - } else {  
149 - String bpointsLngStr = sectionPoints.getJSONObject(1).get("lng").toString();  
150 - String bpointsLatStr = sectionPoints.getJSONObject(1).get("lat").toString();  
151 - Point bPointcut = new Point(Double.parseDouble(bpointsLngStr), Double.parseDouble(bpointsLatStr));  
152 - double distance = 0;  
153 - // 寻找最近点  
154 - for (int index = firstTemp; index < bPointsList.size(); index++) {  
155 - if (index == firstTemp) {  
156 - distance = GeoUtils.getDistance(bPointcut,bPointsList.get(index));  
157 - } else {  
158 - double distanceTemp = GeoUtils.getDistance(bPointcut,bPointsList.get(index));  
159 - if(distance > distanceTemp) {  
160 - distance = distanceTemp;  
161 - lastTemp = index;  
162 - }  
163 - }  
164 - }  
165 - // 用切点替换最近点  
166 - if(lastTemp == firstTemp) {  
167 - bPointsList.add(++lastTemp, bPointcut);  
168 - } else {  
169 - bPointsList.set(lastTemp, bPointcut);  
170 - }  
171 - }  
172 - // 切路段  
173 - if (sectionName != "" && sectionName != null ) {  
174 - // 原始线状图形坐标集合  
175 - String sectionsBpoints = "";  
176 - // WGS线状图形坐标集合  
177 - String sectionsWJPpoints = "";  
178 - for (int j = firstTemp; j <= lastTemp; j++) {  
179 - Point point = bPointsList.get(j);  
180 - String pointsLngStr = String.valueOf(point.getLon());  
181 - String pointsLatStr = String.valueOf(point.getLat());  
182 - /** to WGS坐标 */  
183 - Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr);  
184 - String WGSLngStr = String.valueOf(resultPoint.getLng());  
185 - String WGSLatStr = String.valueOf(resultPoint.getLat());  
186 - if(j == firstTemp) {  
187 - sectionsBpoints = pointsLngStr + " " + pointsLatStr;  
188 - sectionsWJPpoints = WGSLngStr + " " + WGSLatStr;  
189 - }else {  
190 - sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr;  
191 - sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr;  
192 - }  
193 - }  
194 - Map<String, String> sectionCutMap = new HashMap<String, String>();  
195 - sectionCutMap.put("sectionName", sectionName);  
196 - sectionCutMap.put("sectionsBpoints", sectionsBpoints);  
197 - sectionCutMap.put("sectionsWJPpoints", sectionsWJPpoints);  
198 - sectionArrayList.add(sectionCutMap);  
199 - }  
200 - // 上一个路段的终点作为下一个路段的起点  
201 - firstTemp = lastTemp;  
202 - }  
203 - } 111 + sectionListCut(bPointsList, sectionArrayList, bsectionVector, bsectionVectorCutList);
204 112
205 // 原坐标类型 113 // 原坐标类型
206 String dbType = map.get("sectiondbType").equals("") ? "" : map.get("sectiondbType").toString(); 114 String dbType = map.get("sectiondbType").equals("") ? "" : map.get("sectiondbType").toString();
@@ -217,7 +125,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem @@ -217,7 +125,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
217 // 路段长度 125 // 路段长度
218 Double sectionDistance = 0.0; 126 Double sectionDistance = 0.0;
219 // 路段路由Id 127 // 路段路由Id
220 - Integer sectionRouteId = map.get("sectionrouteId").equals("") ? null : Integer.valueOf(map.get("sectionrouteId").toString()); 128 +// Integer sectionRouteId = map.get("sectionrouteId").equals("") ? null : Integer.valueOf(map.get("sectionrouteId").toString());
221 // 线路编码 129 // 线路编码
222 String lineCode =map.get("sectionrouteLineCode").equals("") ? "" : map.get("sectionrouteLineCode").toString(); 130 String lineCode =map.get("sectionrouteLineCode").equals("") ? "" : map.get("sectionrouteLineCode").toString();
223 // 路段时长 131 // 路段时长
@@ -227,7 +135,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem @@ -227,7 +135,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
227 // 限速 135 // 限速
228 Double speedLimit = map.get("sectionSpeedLimet").equals("") ? null : Double.valueOf(map.get("sectionSpeedLimet").toString()); 136 Double speedLimit = map.get("sectionSpeedLimet").equals("") ? null : Double.valueOf(map.get("sectionSpeedLimet").toString());
229 // 版本 137 // 版本
230 - Integer version = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString()); 138 + Integer versions = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString());
231 139
232 Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString()); 140 Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString());
233 String createDate = map.get("createDate").equals("") ? null : map.get("createDate").toString(); 141 String createDate = map.get("createDate").equals("") ? null : map.get("createDate").toString();
@@ -243,8 +151,8 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem @@ -243,8 +151,8 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
243 String middleNode=""; 151 String middleNode="";
244 String sectionType=""; 152 String sectionType="";
245 String csectionVector=""; 153 String csectionVector="";
246 - // 撤销原有路段  
247 - routeRepository.sectionRouteUpdDestroy(Integer.parseInt(lineCode),directions); 154 + // 撤销原有路段路由
  155 + routeRepository.sectionRouteUpdDestroy(sectionRouteLine,directions);
248 // 路段保存 156 // 路段保存
249 for (int i = 0; i < sectionArrayList.size(); i++) { 157 for (int i = 0; i < sectionArrayList.size(); i++) {
250 long sectionMaxId = GetUIDAndCode.getSectionId(); 158 long sectionMaxId = GetUIDAndCode.getSectionId();
@@ -263,7 +171,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem @@ -263,7 +171,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
263 String bsectionVectorS = null; 171 String bsectionVectorS = null;
264 if(!sectionsBpoints.equals("")) 172 if(!sectionsBpoints.equals(""))
265 bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")"; 173 bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")";
266 - repository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, gsectionVector, bsectionVectorS, sectionType, csectionVector, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, version, sectionId); 174 + repository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, gsectionVector, bsectionVectorS, sectionType, csectionVector, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, versions, sectionId);
267 SectionRoute route = new SectionRoute(); 175 SectionRoute route = new SectionRoute();
268 Line line = lineRepository.findOne(sectionRouteLine); 176 Line line = lineRepository.findOne(sectionRouteLine);
269 Section section = repository.findOne(sectionId); 177 Section section = repository.findOne(sectionId);
@@ -271,7 +179,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem @@ -271,7 +179,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
271 route.setLineCode(lineCode); 179 route.setLineCode(lineCode);
272 route.setSectionCode(sectionCode); 180 route.setSectionCode(sectionCode);
273 route.setDirections(directions); 181 route.setDirections(directions);
274 - route.setVersions(version); 182 + route.setVersions(versions);
275 route.setDestroy(destroy); 183 route.setDestroy(destroy);
276 route.setDescriptions(descriptions); 184 route.setDescriptions(descriptions);
277 route.setCreateBy(createBy); 185 route.setCreateBy(createBy);
@@ -282,9 +190,9 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem @@ -282,9 +190,9 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
282 routeRepository.save(route); 190 routeRepository.save(route);
283 } 191 }
284 // 删除缓存路段 192 // 删除缓存路段
285 - routeCacheRepository.sectionRouteCacheDel(Integer.parseInt(lineCode),directions);  
286 - // 撤销原有站点  
287 - stationRouteRepository.stationRouteUpdDestroy(Integer.parseInt(lineCode),directions); 193 + routeCacheRepository.sectionRouteCacheDel(sectionRouteLine,directions);
  194 + // 撤销原有站点路由
  195 + stationRouteRepository.stationRouteUpdDestroy(sectionRouteLine,directions);
288 // 站点保存 196 // 站点保存
289 List<StationRouteCache> stationRouteList = stationRouteCacheRepository.findstationRoute(lineCode,directions); 197 List<StationRouteCache> stationRouteList = stationRouteCacheRepository.findstationRoute(lineCode,directions);
290 for(int i=0; i < stationRouteList.size(); i++) { 198 for(int i=0; i < stationRouteList.size(); i++) {
@@ -305,7 +213,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem @@ -305,7 +213,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
305 stationRoute.setEndTime(stationRouteCache.getEndTime()); 213 stationRoute.setEndTime(stationRouteCache.getEndTime());
306 stationRoute.setDescriptions(stationRouteCache.getDescriptions()); 214 stationRoute.setDescriptions(stationRouteCache.getDescriptions());
307 stationRoute.setDestroy(stationRouteCache.getDestroy()); 215 stationRoute.setDestroy(stationRouteCache.getDestroy());
308 - stationRoute.setVersions(stationRouteCache.getVersions()); 216 + stationRoute.setVersions(versions);
309 stationRoute.setCreateBy(stationRouteCache.getCreateBy()); 217 stationRoute.setCreateBy(stationRouteCache.getCreateBy());
310 stationRoute.setCreateDate(stationRouteCache.getCreateDate()); 218 stationRoute.setCreateDate(stationRouteCache.getCreateDate());
311 stationRoute.setUpdateBy(stationRouteCache.getCreateBy()); 219 stationRoute.setUpdateBy(stationRouteCache.getCreateBy());
@@ -313,7 +221,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem @@ -313,7 +221,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
313 stationRouteRepository.save(stationRoute); 221 stationRouteRepository.save(stationRoute);
314 } 222 }
315 // 删除缓存站点 223 // 删除缓存站点
316 - stationRouteCacheRepository.stationRouteCacheDel(Integer.parseInt(lineCode),directions); 224 + stationRouteCacheRepository.stationRouteCacheDel(sectionRouteLine,directions);
317 225
318 resultMap.put("status", ResponseCode.SUCCESS); 226 resultMap.put("status", ResponseCode.SUCCESS);
319 } catch (Exception e) { 227 } catch (Exception e) {
@@ -324,6 +232,251 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem @@ -324,6 +232,251 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
324 } 232 }
325 233
326 /** 234 /**
  235 + * @Description :TODO(编辑线路走向保存到线路历史表)
  236 + *
  237 + * @param map <sectionId:路段ID; sectionJSON:路段信息>
  238 + *
  239 + * @return Map<String, Object> <SUCCESS ; ERROR>
  240 + */
  241 + @Override
  242 + @Transactional
  243 + public Map<String, Object> sectionCutSaveLineLS(Map<String, Object> map) {
  244 + Map<String, Object> resultMap = new HashMap<String, Object>();
  245 + try {
  246 + // 路段点List
  247 + List<Point> bPointsList = new ArrayList<>();
  248 + // 截取后的路段
  249 + List<Map<String, String>> sectionArrayList = new ArrayList<>();
  250 + String bsectionVector = map.get("sectionBsectionVector").equals("") ? "" :map.get("sectionBsectionVector").toString();
  251 + String bsectionVectorCutList = map.get("cutSectionList").equals("") ? "" :map.get("cutSectionList").toString();
  252 + sectionListCut(bPointsList, sectionArrayList, bsectionVector, bsectionVectorCutList);
  253 +
  254 + // 原坐标类型
  255 + String dbType = map.get("sectiondbType").equals("") ? "" : map.get("sectiondbType").toString();
  256 + // 说明
  257 + String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString();
  258 + // 是否撤销
  259 + Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString());
  260 + // 方向
  261 + Integer directions = map.get("sectionrouteDirections").equals("") ? null : Integer.parseInt(map.get("sectionrouteDirections").toString());
  262 + // 线路ID
  263 + Integer sectionRouteLine = map.get("sectionrouteLine").equals("") ? null : Integer.parseInt(map.get("sectionrouteLine").toString());
  264 + // 道路编码
  265 + String roadCoding = map.get("sectionRoadCoding").equals("") ? "" : map.get("sectionRoadCoding").toString();
  266 + // 路段长度
  267 + Double sectionDistance = 0.0;
  268 + // 线路编码
  269 + String lineCode =map.get("sectionrouteLineCode").equals("") ? "" : map.get("sectionrouteLineCode").toString();
  270 + // 路段时长
  271 + Double sectionTime = 0.0;
  272 + // 路段路由
  273 + Integer sectionrouteCode = map.get("sectionrouteCode").equals("") ? null : Integer.valueOf(map.get("sectionrouteCode").toString());
  274 + // 限速
  275 + Double speedLimit = map.get("sectionSpeedLimet").equals("") ? null : Double.valueOf(map.get("sectionSpeedLimet").toString());
  276 + // 版本
  277 + Integer versions = map.get("versions").equals("") ? null : Integer.valueOf(map.get("versions").toString());
  278 +
  279 + Integer createBy = map.get("createBy").equals("") ? null : Integer.valueOf(map.get("createBy").toString());
  280 + Integer updateBy = map.get("updateBy").equals("") ?null : Integer.valueOf(map.get("updateBy").toString());
  281 + Integer isRoadeSpeed = map.get("isRoadeSpeed").equals("") ? null : Integer.valueOf(map.get("isRoadeSpeed").toString());
  282 + String crosesRoad="";
  283 + String endNode="";
  284 + String startNode="";
  285 + String middleNode="";
  286 + String sectionType="";
  287 + String csectionVector="";
  288 + // 删除原有历史版本路段路由
  289 + lsRouteRepository.batchDelete(sectionRouteLine,directions,versions);
  290 + // 路段保存
  291 + for (int i = 0; i < sectionArrayList.size(); i++) {
  292 + long sectionMaxId = GetUIDAndCode.getSectionId();
  293 + // 路段编码
  294 + String sectionCode = String.valueOf(sectionMaxId);
  295 + // 路段ID
  296 + int sectionId = (int)sectionMaxId;
  297 + String sectionName = sectionArrayList.get(i).get("sectionName").toString();
  298 + String sectionsBpoints = sectionArrayList.get(i).get("sectionsBpoints").toString();
  299 + String sectionsWJPpoints = sectionArrayList.get(i).get("sectionsWJPpoints").toString();
  300 + // WGS坐标点集合
  301 + String gsectionVector = null;
  302 + if(!sectionsWJPpoints.equals(""))
  303 + gsectionVector = "LINESTRING(" + sectionsWJPpoints +")";
  304 + // 原坐标点集合
  305 + String bsectionVectorS = null;
  306 + if(!sectionsBpoints.equals(""))
  307 + bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")";
  308 + repository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, gsectionVector, bsectionVectorS, sectionType, csectionVector, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, 1, sectionId);
  309 + LsSectionRoute route = new LsSectionRoute();
  310 + Line line = lineRepository.findOne(sectionRouteLine);
  311 + Section section = repository.findOne(sectionId);
  312 + route.setSectionrouteCode(sectionrouteCode+i*100);
  313 + route.setLineCode(lineCode);
  314 + route.setSectionCode(sectionCode);
  315 + route.setDirections(directions);
  316 + route.setVersions(versions);
  317 + route.setDestroy(destroy);
  318 + route.setDescriptions(descriptions);
  319 + route.setCreateBy(createBy);
  320 + route.setUpdateBy(updateBy);
  321 + route.setLine(line);
  322 + route.setSection(section);
  323 + route.setIsRoadeSpeed(isRoadeSpeed);
  324 + lsRouteRepository.save(route);
  325 + }
  326 + // 删除缓存路段
  327 + routeCacheRepository.sectionRouteCacheDel(sectionRouteLine,directions);
  328 + // 删除原有历史表站点路由
  329 + lsStationRouteRepository.batchDelete(sectionRouteLine,directions,versions);
  330 + // 站点保存
  331 + List<StationRouteCache> stationRouteList = stationRouteCacheRepository.findstationRoute(lineCode,directions);
  332 + for(int i=0; i < stationRouteList.size(); i++) {
  333 + StationRouteCache stationRouteCache = stationRouteList.get(i);
  334 + LsStationRoute stationRoute = new LsStationRoute();
  335 + stationRoute.setLine(stationRouteCache.getLine());
  336 + stationRoute.setStation(stationRouteCache.getStation());
  337 + stationRoute.setStationName(stationRouteCache.getStationName());
  338 + stationRoute.setStationRouteCode(stationRouteCache.getStationRouteCode());
  339 + stationRoute.setLineCode(stationRouteCache.getLineCode());
  340 + stationRoute.setStationCode(stationRouteCache.getStationCode());
  341 + stationRoute.setStationMark(stationRouteCache.getStationMark());
  342 + stationRoute.setOutStationNmber(stationRouteCache.getOutStationNmber());
  343 + stationRoute.setDirections(stationRouteCache.getDirections());
  344 + stationRoute.setDistances(stationRouteCache.getDistances());
  345 + stationRoute.setToTime(stationRouteCache.getToTime());
  346 + stationRoute.setFirstTime(stationRouteCache.getFirstTime());
  347 + stationRoute.setEndTime(stationRouteCache.getEndTime());
  348 + stationRoute.setDescriptions(stationRouteCache.getDescriptions());
  349 + stationRoute.setDestroy(stationRouteCache.getDestroy());
  350 + stationRoute.setVersions(versions);
  351 + stationRoute.setCreateBy(stationRouteCache.getCreateBy());
  352 + stationRoute.setCreateDate(stationRouteCache.getCreateDate());
  353 + stationRoute.setUpdateBy(stationRouteCache.getCreateBy());
  354 + stationRoute.setUpdateDate(stationRouteCache.getUpdateDate());
  355 + lsStationRouteRepository.save(stationRoute);
  356 + }
  357 + // 删除缓存站点
  358 + stationRouteCacheRepository.stationRouteCacheDel(sectionRouteLine,directions);
  359 + resultMap.put("status", ResponseCode.SUCCESS);
  360 + } catch (Exception e) {
  361 + resultMap.put("status", ResponseCode.ERROR);
  362 + logger.error("save erro.", e);
  363 + }
  364 + return resultMap;
  365 + }
  366 +
  367 + private void sectionListCut(List<Point> bPointsList, List<Map<String, String>> sectionArrayList,
  368 + String bsectionVector, String bsectionVectorCutList) {
  369 + if(!bsectionVector.equals("")) {
  370 + // 转换成JSON数组
  371 + JSONArray sectionsArray = JSONArray.parseArray(bsectionVector);
  372 + // 遍历
  373 + for(int s = 0 ;s<sectionsArray.size();s++) {
  374 + String pointsLngStr = sectionsArray.getJSONObject(s).get("lng").toString();
  375 + String pointsLatStr = sectionsArray.getJSONObject(s).get("lat").toString();
  376 + bPointsList.add(new Point(Double.parseDouble(pointsLngStr), Double.parseDouble(pointsLatStr)));
  377 + }
  378 + }
  379 + if(!bsectionVectorCutList.equals("")) {
  380 + // 转换成JSON数组
  381 + JSONArray sectionsArrayList = JSONArray.parseArray(bsectionVectorCutList);
  382 + // 截取路段在总路段中的下表
  383 + int firstTemp = 0;
  384 + int lastTemp = 0;
  385 + // 每个截取的路段去总路段中获取
  386 + for (int i = 0; i < sectionsArrayList.size(); i++) {
  387 + // 切点列表
  388 + JSONObject sectionsArray = sectionsArrayList.getJSONObject(i);
  389 + String sectionName = sectionsArray.get("name").toString();
  390 + JSONArray sectionPoints = sectionsArray.getJSONArray("section");
  391 + // 用两个坐标点去截取总路段
  392 + if (i == 0) {
  393 + for(int s = 0 ;s<sectionPoints.size();s++) {
  394 + String bpointsLngStr = sectionPoints.getJSONObject(s).get("lng").toString();
  395 + String bpointsLatStr = sectionPoints.getJSONObject(s).get("lat").toString();
  396 + Point bPointcut = new Point(Double.parseDouble(bpointsLngStr), Double.parseDouble(bpointsLatStr));
  397 + double distance = 0;
  398 + // 寻找最近点
  399 + for (int index = firstTemp; index < bPointsList.size(); index++) {
  400 + if (index == firstTemp) {
  401 + distance = GeoUtils.getDistance(bPointcut,bPointsList.get(index));
  402 + } else {
  403 + double distanceTemp = GeoUtils.getDistance(bPointcut,bPointsList.get(index));
  404 + if(distance > distanceTemp) {
  405 + distance = distanceTemp;
  406 + lastTemp = index;
  407 + }
  408 + }
  409 + }
  410 + if (s == 0) {
  411 + // 第一个点作为路段的起点
  412 + firstTemp = lastTemp;
  413 + }
  414 + // 用切点替换最近点
  415 + if(lastTemp == firstTemp) {
  416 + bPointsList.add(++lastTemp, bPointcut);
  417 + } else {
  418 + bPointsList.set(lastTemp, bPointcut);
  419 + }
  420 + }
  421 + } else {
  422 + String bpointsLngStr = sectionPoints.getJSONObject(1).get("lng").toString();
  423 + String bpointsLatStr = sectionPoints.getJSONObject(1).get("lat").toString();
  424 + Point bPointcut = new Point(Double.parseDouble(bpointsLngStr), Double.parseDouble(bpointsLatStr));
  425 + double distance = 0;
  426 + // 寻找最近点
  427 + for (int index = firstTemp; index < bPointsList.size(); index++) {
  428 + if (index == firstTemp) {
  429 + distance = GeoUtils.getDistance(bPointcut,bPointsList.get(index));
  430 + } else {
  431 + double distanceTemp = GeoUtils.getDistance(bPointcut,bPointsList.get(index));
  432 + if(distance > distanceTemp) {
  433 + distance = distanceTemp;
  434 + lastTemp = index;
  435 + }
  436 + }
  437 + }
  438 + // 用切点替换最近点
  439 + if(lastTemp == firstTemp) {
  440 + bPointsList.add(++lastTemp, bPointcut);
  441 + } else {
  442 + bPointsList.set(lastTemp, bPointcut);
  443 + }
  444 + }
  445 + // 切路段
  446 + if (sectionName != "" && sectionName != null ) {
  447 + // 原始线状图形坐标集合
  448 + String sectionsBpoints = "";
  449 + // WGS线状图形坐标集合
  450 + String sectionsWJPpoints = "";
  451 + for (int j = firstTemp; j <= lastTemp; j++) {
  452 + Point point = bPointsList.get(j);
  453 + String pointsLngStr = String.valueOf(point.getLon());
  454 + String pointsLatStr = String.valueOf(point.getLat());
  455 + /** to WGS坐标 */
  456 + Location resultPoint = FromBDPointToWGSPoint(pointsLngStr,pointsLatStr);
  457 + String WGSLngStr = String.valueOf(resultPoint.getLng());
  458 + String WGSLatStr = String.valueOf(resultPoint.getLat());
  459 + if(j == firstTemp) {
  460 + sectionsBpoints = pointsLngStr + " " + pointsLatStr;
  461 + sectionsWJPpoints = WGSLngStr + " " + WGSLatStr;
  462 + }else {
  463 + sectionsBpoints = sectionsBpoints + "," + pointsLngStr + " " + pointsLatStr;
  464 + sectionsWJPpoints = sectionsWJPpoints + "," + WGSLngStr + " " + WGSLatStr;
  465 + }
  466 + }
  467 + Map<String, String> sectionCutMap = new HashMap<String, String>();
  468 + sectionCutMap.put("sectionName", sectionName);
  469 + sectionCutMap.put("sectionsBpoints", sectionsBpoints);
  470 + sectionCutMap.put("sectionsWJPpoints", sectionsWJPpoints);
  471 + sectionArrayList.add(sectionCutMap);
  472 + }
  473 + // 上一个路段的终点作为下一个路段的起点
  474 + firstTemp = lastTemp;
  475 + }
  476 + }
  477 + }
  478 +
  479 + /**
327 * @Description :TODO(编辑线路走向) 480 * @Description :TODO(编辑线路走向)
328 * 481 *
329 * @param map <sectionId:路段ID; sectionJSON:路段信息> 482 * @param map <sectionId:路段ID; sectionJSON:路段信息>
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
@@ -84,7 +84,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ @@ -84,7 +84,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
84 List<String> title = new ArrayList<String>(); 84 List<String> title = new ArrayList<String>();
85 title.add("线路ID"); 85 title.add("线路ID");
86 title.add("方向"); 86 title.add("方向");
87 - title.add("站点ID"); 87 + title.add("站点编码");
88 title.add("站点顺序号"); 88 title.add("站点顺序号");
89 title.add("站点备注"); 89 title.add("站点备注");
90 title.add("站点名称"); 90 title.add("站点名称");
@@ -1268,4 +1268,10 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ @@ -1268,4 +1268,10 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
1268 } 1268 }
1269 return rs; 1269 return rs;
1270 } 1270 }
  1271 +
  1272 + // 更具线路批量撤销
  1273 + @Override
  1274 + public void batchUpdate(Integer lineId, String lineCode) {
  1275 + repository.batchUpdate(lineId,lineCode);
  1276 + }
1271 } 1277 }
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -60,6 +60,9 @@ import com.bsth.service.schedule.SchedulePlanInfoService; @@ -60,6 +60,9 @@ import com.bsth.service.schedule.SchedulePlanInfoService;
60 import com.bsth.service.sys.DutyEmployeeService; 60 import com.bsth.service.sys.DutyEmployeeService;
61 import com.bsth.util.*; 61 import com.bsth.util.*;
62 import com.bsth.websocket.handler.SendUtils; 62 import com.bsth.websocket.handler.SendUtils;
  63 +import com.github.stuxuhai.jpinyin.PinyinException;
  64 +import com.github.stuxuhai.jpinyin.PinyinFormat;
  65 +import com.github.stuxuhai.jpinyin.PinyinHelper;
63 import com.google.common.base.Splitter; 66 import com.google.common.base.Splitter;
64 import com.google.common.collect.Lists; 67 import com.google.common.collect.Lists;
65 import org.apache.commons.lang3.StringEscapeUtils; 68 import org.apache.commons.lang3.StringEscapeUtils;
@@ -2464,6 +2467,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2464,6 +2467,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2464 Map<String, Object> map = new HashMap<String, Object>(); 2467 Map<String, Object> map = new HashMap<String, Object>();
2465 if(list.size()>0){ 2468 if(list.size()>0){
2466 map.put("xlName", list.get(0).getXlName()); 2469 map.put("xlName", list.get(0).getXlName());
  2470 + try {
  2471 + map.put("xlNamePy", PinyinHelper.convertToPinyinString(list.get(0).getXlName(), "" , PinyinFormat.WITHOUT_TONE));
  2472 + } catch (PinyinException e) {
  2473 + // TODO Auto-generated catch block
  2474 + e.printStackTrace();
  2475 + }
2467 double jhyygl=culateService.culateJhgl(list);//计划营运公里 2476 double jhyygl=culateService.culateJhgl(list);//计划营运公里
2468 double jhjcclc= culateService.culateJhJccgl(list);//计划进出场公里(计划空驶公里) 2477 double jhjcclc= culateService.culateJhJccgl(list);//计划进出场公里(计划空驶公里)
2469 map.put("jhlc", jhyygl); 2478 map.put("jhlc", jhyygl);
@@ -2480,8 +2489,17 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2480,8 +2489,17 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2480 map.put("sjzgl", Arith.add(zyygl, zksgl)); 2489 map.put("sjzgl", Arith.add(zyygl, zksgl));
2481 map.put("sjgl",zyygl); 2490 map.put("sjgl",zyygl);
2482 map.put("sjksgl", zksgl); 2491 map.put("sjksgl", zksgl);
2483 -  
2484 - map.put("ssgl", culateService.culateLbgl(list)); 2492 + double ssgl= culateService.culateLbgl(list);
  2493 + map.put("ssgl", ssgl);
  2494 +
  2495 + //计划+临加-少驶=实驶
  2496 + double jl=Arith.add(jhyygl, ljgl);
  2497 + if(Arith.sub(jl, ssgl)==sjyygl){
  2498 + map.put("zt", 0);
  2499 + }else{
  2500 + map.put("zt", 1);
  2501 + }
  2502 +
2485 map.put("ssgl_lz", culateService.culateCJLC(list, "路阻")); 2503 map.put("ssgl_lz", culateService.culateCJLC(list, "路阻"));
2486 map.put("ssgl_dm", culateService.culateCJLC(list, "吊慢")); 2504 map.put("ssgl_dm", culateService.culateCJLC(list, "吊慢"));
2487 map.put("ssgl_gz", culateService.culateCJLC(list, "故障")); 2505 map.put("ssgl_gz", culateService.culateCJLC(list, "故障"));
@@ -2568,7 +2586,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2568,7 +2586,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2568 } 2586 }
2569 } 2587 }
2570 } 2588 }
2571 - 2589 +
  2590 + Collections.sort(lMap,new AccountXlbm());
2572 Map<String, Object> map = new HashMap<String, Object>(); 2591 Map<String, Object> map = new HashMap<String, Object>();
2573 map.put("xlName", "合计"); 2592 map.put("xlName", "合计");
2574 double jhyygl=culateService.culateJhgl(list);//计划营运公里 2593 double jhyygl=culateService.culateJhgl(list);//计划营运公里
@@ -2587,7 +2606,16 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2587,7 +2606,16 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2587 map.put("sjzgl", Arith.add(zyygl, zksgl)); 2606 map.put("sjzgl", Arith.add(zyygl, zksgl));
2588 map.put("sjgl",zyygl); 2607 map.put("sjgl",zyygl);
2589 map.put("sjksgl", zksgl); 2608 map.put("sjksgl", zksgl);
2590 - map.put("ssgl", culateService.culateLbgl(list)); 2609 +
  2610 + double ssgl= culateService.culateLbgl(list);
  2611 + map.put("ssgl", ssgl);
  2612 + //计划+临加-少驶=实驶
  2613 + double jl=Arith.add(jhyygl, ljgl);
  2614 + if(Arith.sub(jl, ssgl)==sjyygl){
  2615 + map.put("zt", 0);
  2616 + }else{
  2617 + map.put("zt", 1);
  2618 + }
2591 map.put("ssgl_lz", culateService.culateCJLC(list, "路阻")); 2619 map.put("ssgl_lz", culateService.culateCJLC(list, "路阻"));
2592 map.put("ssgl_dm", culateService.culateCJLC(list, "吊慢")); 2620 map.put("ssgl_dm", culateService.culateCJLC(list, "吊慢"));
2593 map.put("ssgl_gz", culateService.culateCJLC(list, "故障")); 2621 map.put("ssgl_gz", culateService.culateCJLC(list, "故障"));
@@ -4949,3 +4977,14 @@ class AccountMap2 implements Comparator&lt;Map&lt;String, Object&gt;&gt;{ @@ -4949,3 +4977,14 @@ class AccountMap2 implements Comparator&lt;Map&lt;String, Object&gt;&gt;{
4949 return o2.get("clZbh").toString().compareTo(o1.get("clZbh").toString()); 4977 return o2.get("clZbh").toString().compareTo(o1.get("clZbh").toString());
4950 } 4978 }
4951 } 4979 }
  4980 +
  4981 +class AccountXlbm implements Comparator<Map<String, Object>>{
  4982 + @Override
  4983 + public int compare(Map<String, Object> o1, Map<String, Object> o2) {
  4984 + // TODO Auto-generated method stub
  4985 +// PinyinHelper.convertToPinyinString(ppy.getName(),
  4986 +// "" , PinyinFormat.WITHOUT_TONE)
  4987 + return o1.get("xlNamePy").toString().compareTo(
  4988 + o2.get("xlNamePy").toString());
  4989 + }
  4990 +}
src/main/java/com/bsth/service/report/impl/CulateMileageServiceImpl.java
@@ -882,7 +882,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{ @@ -882,7 +882,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{
882 else if(isInOut(sch)) 882 else if(isInOut(sch))
883 continue; 883 continue;
884 //主任务烂班 884 //主任务烂班
885 - else if(sch.getStatus() == -1){ 885 + else if(sch.getStatus() == -1 && !sch.isCcService()){
886 if(sch.getAdjustExps().equals(item) || 886 if(sch.getAdjustExps().equals(item) ||
887 (StringUtils.isEmpty(sch.getAdjustExps()) && item.equals("其他"))){ 887 (StringUtils.isEmpty(sch.getAdjustExps()) && item.equals("其他"))){
888 sum = Arith.add(sum, sch.getJhlcOrig()); 888 sum = Arith.add(sum, sch.getJhlcOrig());
src/main/resources/application-prod.properties
1 -server.port=9088  
2 -management.port= 9001  
3 -management.address= 127.0.0.1  
4 -  
5 -spring.jpa.hibernate.ddl-auto= none  
6 -spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy  
7 -#DATABASE  
8 -spring.jpa.database= MYSQL  
9 -spring.jpa.show-sql= false  
10 -spring.datasource.driver-class-name= com.mysql.jdbc.Driver  
11 -spring.datasource.url= jdbc:mysql://10.10.150.20:3306/control?useUnicode=true&characterEncoding=utf-8&useSSL=false  
12 -spring.datasource.username= root  
13 -spring.datasource.password= root2jsp@JSP  
14 -#DATASOURCE  
15 -spring.datasource.max-active=100  
16 -spring.datasource.max-idle=8  
17 -spring.datasource.min-idle=8  
18 -spring.datasource.initial-size=5  
19 -  
20 -spring.datasource.test-on-borrow=true  
21 -spring.datasource.test-on-connect=true  
22 -spring.datasource.test-on-return=true  
23 -spring.datasource.test-while-idle=true  
24 -spring.datasource.validation-query=select 1  
25 -  
26 -## gps client data  
27 -http.gps.real.cache.url= http://10.10.150.24:12580/realGps/all  
28 -## gateway real data  
29 -http.gps.real.url= http://10.10.150.21:8080/transport_server/rtgps/  
30 -## gateway send directive 1 +server.port=9088
  2 +management.port= 9001
  3 +management.address= 127.0.0.1
  4 +
  5 +spring.jpa.hibernate.ddl-auto= none
  6 +spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy
  7 +#DATABASE
  8 +spring.jpa.database= MYSQL
  9 +spring.jpa.show-sql= false
  10 +spring.datasource.driver-class-name= com.mysql.jdbc.Driver
  11 +spring.datasource.url= jdbc:mysql://10.10.150.20:3306/control?useUnicode=true&characterEncoding=utf-8&useSSL=false
  12 +spring.datasource.username= root
  13 +spring.datasource.password= root2jsp@JSP
  14 +#DATASOURCE
  15 +spring.datasource.max-active=100
  16 +spring.datasource.max-idle=8
  17 +spring.datasource.min-idle=8
  18 +spring.datasource.initial-size=5
  19 +
  20 +spring.datasource.test-on-borrow=true
  21 +spring.datasource.test-on-connect=true
  22 +spring.datasource.test-on-return=true
  23 +spring.datasource.test-while-idle=true
  24 +spring.datasource.validation-query=select 1
  25 +
  26 +## gps client data
  27 +http.gps.real.cache.url= http://10.10.150.24:12580/realGps/all
  28 +## gateway real data
  29 +http.gps.real.url= http://10.10.150.21:8080/transport_server/rtgps/
  30 +## gateway send directive
31 http.send.directive = http://10.10.150.21:8080/transport_server/message/ 31 http.send.directive = http://10.10.150.21:8080/transport_server/message/
32 \ No newline at end of file 32 \ No newline at end of file
src/main/resources/static/pages/base/line/editRoute.html
1 <!-- 手动添加站点 --> 1 <!-- 手动添加站点 -->
2 -<div class="modal fade" id="edit_route_mobal" tabindex="-1" role="basic" aria-hidden="true">  
3 - 2 +<div class="modal fade" id="edit_route_mobal" tabindex="-1" role="basic"
  3 + aria-hidden="true">
  4 +
4 <div class="modal-dialog"> 5 <div class="modal-dialog">
5 - 6 +
6 <div class="modal-content"> 7 <div class="modal-content">
7 - 8 +
8 <div class="modal-header"> 9 <div class="modal-header">
9 - <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> 10 + <button type="button" class="close" data-dismiss="modal"
  11 + aria-hidden="true"></button>
10 <h4 class="modal-title">生成路线(站点和路段)</h4> 12 <h4 class="modal-title">生成路线(站点和路段)</h4>
11 </div> 13 </div>
12 - 14 +
13 <div class="modal-body"> 15 <div class="modal-body">
14 -  
15 - <form class="form-horizontal" role="form" id="save_route_template_form" action="" method="">  
16 -  
17 - <div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button> 16 +
  17 + <form class="form-horizontal" role="form"
  18 + id="save_route_template_form" action="" method="">
  19 +
  20 + <div class="alert alert-danger display-hide">
  21 + <button class="close" data-close="alert"></button>
18 您的输入有误,请检查下面的输入项 22 您的输入有误,请检查下面的输入项
19 </div> 23 </div>
20 - 24 +
21 <!-- 站点名称 --> 25 <!-- 站点名称 -->
22 <div class="form-body"> 26 <div class="form-body">
23 - 27 +
24 <div class="form-group"> 28 <div class="form-group">
25 - <label class="control-label col-md-2">  
26 - <span class="required"> * </span> 坐标:  
27 - </label> 29 + <label class="control-label col-md-2"> <span
  30 + class="required"> * </span> 坐标:
  31 + </label>
28 <div class="col-md-10"> 32 <div class="col-md-10">
29 - <textarea class="form-control" rows="12" name="points" id="pointInput" placeholder="坐标点"></textarea> 33 + <textarea class="form-control" rows="12" name="points"
  34 + id="pointInput" placeholder="坐标点"></textarea>
30 </div> 35 </div>
31 - </div> 36 + </div>
32 </div> 37 </div>
33 <div class="form-group"> 38 <div class="form-group">
34 <label class="col-md-3 control-label">选择方向:</label> 39 <label class="col-md-3 control-label">选择方向:</label>
35 <div class="col-md-9"> 40 <div class="col-md-9">
36 <div class="icheck-list"> 41 <div class="icheck-list">
37 - <label>  
38 - <input type="radio" class="icheck" name="dirCheck" value='0' checked> 上行  
39 - </label>  
40 - <label>  
41 - <input type="radio" class="icheck" name="dirCheck" value='1' > 下行 42 + <label> <input type="radio" class="icheck"
  43 + name="dirCheck" value='0' checked> 上行
  44 + </label> <label> <input type="radio" class="icheck"
  45 + name="dirCheck" value='1'> 下行
42 </label> 46 </label>
43 </div> 47 </div>
44 </div> 48 </div>
45 </div> 49 </div>
46 - <div class="form-group">  
47 - <div class="alert alert-info font-blue-chambray" style="background-color: #2C3E50">  
48 - <h5 class="block"><span class="help-block" style="color:#1bbc9b;"> * 坐标生成路线规划说明: </span></h5>  
49 - <p>  
50 - <span class="help-block" style="color:#1bbc9b;">  
51 - &nbsp;请在文本域中按顺序依次输坐标点(如果是站点,请将在坐标后面用【Tab】键隔开后加(站点名/stop);没有(站点名/stop)默认是路段点),每输入完一个坐标时请按回车键【Enter】换行.  
52 - 例如:<br>  
53 - 121.715623 31.224058 042408.000<br>  
54 - 121.715623 31.224065 042409.000 Stop<br>  
55 - 121.715623 31.224065 042410.000<br>  
56 - </span>  
57 - </p>  
58 - </div>  
59 - </div> 50 + <div class="form-group">
  51 + <div class="alert alert-info font-blue-chambray"
  52 + style="background-color: #2C3E50">
  53 + <h5 class="block">
  54 + <span class="help-block" style="color: #1bbc9b;"> *
  55 + 坐标生成路线规划说明: </span>
  56 + </h5>
  57 + <p>
  58 + <span class="help-block" style="color: #1bbc9b;">
  59 + &nbsp;请在文本域中按顺序依次输坐标点,每行中的数据之间用【Tab】键隔开(如果是站点,请将在坐标后面加 stop;没有
  60 + stop默认是路段点),每输入完一个坐标时请按回车键【Enter】换行. 例如:<!-- <br> 121.715623
  61 + 31.224058 042408.000<br> 121.715623 31.224065 042409.000
  62 + Stop<br> 121.715623 31.224065 042410.000<br> -->
  63 + <br>121.511870 31.180638 043703.000
  64 + <br>121.511870 31.180643 043705.000
  65 + <br>121.511870 31.180648 043706.000 Stop
  66 + <br>121.511872 31.180653 043707.000
  67 + <br>121.511873 31.180658 043708.000
  68 + </span>
  69 + </p>
  70 + </div>
  71 + </div>
60 </form> 72 </form>
61 </div> 73 </div>
62 <div class="modal-footer"> 74 <div class="modal-footer">
63 - <button type="button" class="btn default" data-dismiss="modal" id="addMobalHiden">取消</button> 75 + <button type="button" class="btn default" data-dismiss="modal"
  76 + id="addMobalHiden">取消</button>
64 <button type="button" class="btn btn-primary" id="templateSaveData">提交数据</button> 77 <button type="button" class="btn btn-primary" id="templateSaveData">提交数据</button>
65 </div> 78 </div>
66 </div> 79 </div>
@@ -139,20 +152,21 @@ $(&#39;#edit_route_mobal&#39;).on(&#39;editRouteMobal.show&#39;, function(e,transGPS,editRoute,m @@ -139,20 +152,21 @@ $(&#39;#edit_route_mobal&#39;).on(&#39;editRouteMobal.show&#39;, function(e,transGPS,editRoute,m
139 var directionData = $("input[name='dirCheck']:checked").val(); 152 var directionData = $("input[name='dirCheck']:checked").val();
140 editRoute.setLineDir(directionData); 153 editRoute.setLineDir(directionData);
141 // 弹出正在加载层 154 // 弹出正在加载层
142 - var i = layer.load(0,{offset:['200px', '280px']}); 155 + var i = layer.load(2);
143 // 表单序列化 156 // 表单序列化
144 var paramsForm = form.serializeJSON(); 157 var paramsForm = form.serializeJSON();
145 // 切割坐标点 158 // 切割坐标点
146 var array = paramsForm.points.split('\r\n'); 159 var array = paramsForm.points.split('\r\n');
147 // 把坐标点转换为站点或路段 160 // 把坐标点转换为站点或路段
148 var arrayFormat = inputStationValueFormat(array); 161 var arrayFormat = inputStationValueFormat(array);
149 - var stationList = arrayFormat.stationList; 162 + var stationList = arrayFormat.stationList;
150 var sectionListTemp = arrayFormat.sectionList; 163 var sectionListTemp = arrayFormat.sectionList;
151 var sectionList = []; 164 var sectionList = [];
152 // 隔30个取一个点(相当于30s) 165 // 隔30个取一个点(相当于30s)
153 for(var i = 0; i*30 < sectionListTemp.length; i++) { 166 for(var i = 0; i*30 < sectionListTemp.length; i++) {
154 sectionList[i] = sectionListTemp[i*30]; 167 sectionList[i] = sectionListTemp[i*30];
155 } 168 }
  169 + sectionList[sectionList.length] = sectionListTemp[sectionListTemp.length-1];
156 170
157 var sectionListFinal = []; 171 var sectionListFinal = [];
158 sectionListFinal.push({sectionName : lineNameV, points : sectionList}); 172 sectionListFinal.push({sectionName : lineNameV, points : sectionList});
@@ -227,7 +241,7 @@ $(&#39;#edit_route_mobal&#39;).on(&#39;editRouteMobal.show&#39;, function(e,transGPS,editRoute,m @@ -227,7 +241,7 @@ $(&#39;#edit_route_mobal&#39;).on(&#39;editRouteMobal.show&#39;, function(e,transGPS,editRoute,m
227 } 241 }
228 for(var i = 0 ;i<sectionList.length;i++) { 242 for(var i = 0 ;i<sectionList.length;i++) {
229 if(sectionList[i] == "" || typeof(sectionList[i]) == "undefined" || sectionList[i] == null) { 243 if(sectionList[i] == "" || typeof(sectionList[i]) == "undefined" || sectionList[i] == null) {
230 - sectionList.splice(i,1); 244 + sectionList.splice(i,1);//删除数组中下表i-i+1之间的值
231 i= i-1; 245 i= i-1;
232 } 246 }
233 247
src/main/resources/static/pages/base/line/js/line-add-form.js
@@ -94,13 +94,13 @@ $(function(){ @@ -94,13 +94,13 @@ $(function(){
94 // 需要验证的表单元素 94 // 需要验证的表单元素
95 rules : { 95 rules : {
96 'name' : {required : true,maxlength: 30},// 线路名称 必填项、 最大长度. 96 'name' : {required : true,maxlength: 30},// 线路名称 必填项、 最大长度.
97 - 'lineCode' : {required : true,maxlength: 6,digits:true ,remote:{type: 'GET',  
98 - url: '/line/lineCodeVerification',  
99 - data:{'lineCode':function(){ return $("#lineCodeInput").val();}},  
100 - dataFilter: function (data,type) {  
101 - return data; //要返回data 否则会影响到后续验证 并且阻碍提交【即使验证通过】,也不会提交  
102 - },  
103 - delay: 2000}},// 线路编码 必填项、最大长度. 97 + 'lineCode' : {required : true,maxlength: 6,digits:true ,
  98 + remote:{type: 'GET',
  99 + url: '/line/lineCodeVerification',
  100 + cache:false,
  101 + async:false,
  102 + data:{'lineCode':function(){ return $("#lineCodeInput").val();}}
  103 + }},// 线路编码 必填项、最大长度.
104 'company' : {required : true,maxlength: 30},// 所属公司 必填项、最大长度. 104 'company' : {required : true,maxlength: 30},// 所属公司 必填项、最大长度.
105 'brancheCompany' : {required : true,maxlength: 30},// 所属分公司 必填项、最大长度. 105 'brancheCompany' : {required : true,maxlength: 30},// 所属分公司 必填项、最大长度.
106 'level' : {required : true,maxlength: 30},// 线路等级 必填项、最大长度. 106 'level' : {required : true,maxlength: 30},// 线路等级 必填项、最大长度.
src/main/resources/static/pages/base/line/js/line-list-map.js
@@ -120,7 +120,6 @@ var WorldsBMapLine = function () { @@ -120,7 +120,6 @@ var WorldsBMapLine = function () {
120 var index = parseInt(arguments.callee.count) - 1; 120 var index = parseInt(arguments.callee.count) - 1;
121 121
122 if (index >= len-1) { 122 if (index >= len-1) {
123 -  
124 callback && callback(points); 123 callback && callback(points);
125 124
126 return; 125 return;
src/main/resources/static/pages/base/line/js/line-list-table.js
@@ -347,27 +347,14 @@ @@ -347,27 +347,14 @@
347 return ; 347 return ;
348 }else { 348 }else {
349 id = arrChk.data('id'); 349 id = arrChk.data('id');
350 - /*$('#uploadRoute').on('click', function() {  
351 - EditRoute.setLineId(id);  
352 - EditRoute.setLineDir(direction);  
353 - $.get('editRoute.html', function(m){  
354 - $(pjaxContainer).append(m);  
355 - $('#edit_route_mobal').trigger('editRouteMobal.show',[TransGPS,EditRoute,WorldsBMapLine,DrawingManagerObj,GetAjaxData,PublicFunctions]);  
356 - });  
357 - // 更新section_table 和缓存中的一切过的点数  
358 - WorldsBMapLine.initCutSectionPoint();  
359 - WorldsBMapLine.setPointIndex(0);  
360 - });*/  
361 - // 设置路线的线路id  
362 - //var a = EditRoute.setLineId(id);  
363 - // 显示地图  
364 - /*var param = {};  
365 - var list = [1,2,3];  
366 - param.id = id;  
367 - param.list = list;  
368 -  
369 - $get('/pages/base/line/map.html',param);*/  
370 - window.location.href = "/pages/base/line/map.html?no="+id; 350 + $.get('/lineVersions/findByLineId',{'lineId':id},function(lineVersions){
  351 + if(lineVersions != null && lineVersions != "") {
  352 + window.location.href = "/pages/base/line/map.html?no="+id;
  353 + } else {
  354 + layer.msg('此线路没有线路版本,请先到线路版本信息页面添加改线路版本!');
  355 + return ;
  356 + }
  357 + });
371 } 358 }
372 }); 359 });
373 360
src/main/resources/static/pages/base/line/list.html
@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 <a href="javascript:;" data-action="1" id="editRoute" class="tool-action"> <i class="fa fa-level-up"></i>上传GPS生成路线</a> 41 <a href="javascript:;" data-action="1" id="editRoute" class="tool-action"> <i class="fa fa-level-up"></i>上传GPS生成路线</a>
42 </li> 42 </li>
43 <li> 43 <li>
44 - <a href="javascript:;" data-action="2" id="exportStation" class="tool-action"> <i class="fa fa-level-up"></i>导出线路站点Excel</a> 44 + <a href="javascript:;" data-action="2" id="exportStation" class="tool-action"> <i class="fa fa-level-down"></i>导出线路站点Excel</a>
45 </li> 45 </li>
46 <!-- <li><a href="javascript:;" data-action="0" class="tool-action"> <i class="fa fa-print"></i> 打印 46 <!-- <li><a href="javascript:;" data-action="0" class="tool-action"> <i class="fa fa-print"></i> 打印
47 </a></li> 47 </a></li>
src/main/resources/static/pages/base/line/map.html
1 -< <link href="/pages/base/line/css/bmap_base.css" rel="stylesheet" type="text/css" /> 1 +<
  2 +<link href="/pages/base/line/css/bmap_base.css" rel="stylesheet"
  3 + type="text/css" />
2 <div class="portlet-body"> 4 <div class="portlet-body">
3 <!-- 地图 --> 5 <!-- 地图 -->
4 - <div id="bmap_basic" class="bmaps"></div> 6 + <div id="bmap_basic" class="bmaps"></div>
5 <!-- 右边显示栏 --> 7 <!-- 右边显示栏 -->
6 <div class="cut-section" id="scrllmouseEvent_div"> 8 <div class="cut-section" id="scrllmouseEvent_div">
7 - <div class="portlet-title" >  
8 - <div class="caption" >  
9 - 途径站点 9 + <div class="portlet-title">
  10 + <div class="caption">途径站点</div>
  11 + </div>
  12 + <div class="portlet-body">
  13 + <div class="table-toolbar" style="text-align: center;" id="upload">
  14 + <button class="btn btn-circle blue" id="uploadRoute">
  15 + <i class="fa fa-plus"></i> 生成路线
  16 + </button>
10 </div> 17 </div>
11 - </div>  
12 - <div class="portlet-body">  
13 - <div class="table-toolbar" style="text-align:center;" id="upload">  
14 - <button class="btn btn-circle blue" id="uploadRoute" ><i class="fa fa-plus"></i> 生成路线 </button>  
15 - </div>  
16 - <div class="portlet-body hidden" id="upload_show">  
17 - <div class="defeat-scroll" style="height: auto;max-height:600px;overflow-y:auto; border-left: 10px;">  
18 - <table class="table table-bordered table-hover table-checkable " id="section_table" style="color:#B7B7B7;"> 18 + <div class="portlet-body hidden" id="upload_show">
  19 + <div class="defeat-scroll"
  20 + style="height: auto; max-height: 600px; overflow-y: auto; border-left: 10px;">
  21 + <table class="table table-bordered table-hover table-checkable "
  22 + id="section_table" style="color: #B7B7B7;">
19 <thead> 23 <thead>
20 <tr role="row" class="heading"> 24 <tr role="row" class="heading">
21 - <th >截取路段</th> 25 + <th>截取路段</th>
22 </tr> 26 </tr>
23 </thead> 27 </thead>
24 <tbody></tbody> 28 <tbody></tbody>
25 </table> 29 </table>
26 </div> 30 </div>
27 - <div class="table-toolbar" style="text-align:center;">  
28 - <button class="btn btn-circle blue" id="cutSection">提交路段</button>  
29 - <button class="btn btn-circle blue" id="Undo">撤销切点</button>  
30 - </div>  
31 - </div> 31 + <div class="table-toolbar" style="text-align: center;">
  32 + <button class="btn btn-circle blue" id="cutSection">提交选项</button>
  33 + <button class="btn btn-circle blue" id="Undo">撤销切点</button>
  34 + </div>
  35 + </div>
32 </div> 36 </div>
33 </div> 37 </div>
34 </div> 38 </div>
@@ -45,8 +49,9 @@ @@ -45,8 +49,9 @@
45 </tr> 49 </tr>
46 {{/if}} 50 {{/if}}
47 </script> 51 </script>
48 -<!--上传GPS坐标生成路线监听事件 -->  
49 -<<script type="text/javascript"> 52 +<!--上传GPS坐标生成路线监听事件 -->
  53 +<
  54 +<script type="text/javascript">
50 $(function(){ 55 $(function(){
51 // 关闭左侧栏 56 // 关闭左侧栏
52 if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();} 57 if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();}
@@ -111,7 +116,16 @@ $(function(){ @@ -111,7 +116,16 @@ $(function(){
111 // 提交截取事件 116 // 提交截取事件
112 $('#cutSection').on('click', function() { 117 $('#cutSection').on('click', function() {
113 if(WorldsBMapLine.getPointIndex() > 0) { 118 if(WorldsBMapLine.getPointIndex() > 0) {
114 - layer.confirm('提交会把原有的站点和路段覆盖,您确定要提交吗?', { 119 + var sectionList = WorldsBMapLine.getSectionList();
  120 + var data = {};
  121 + var section = EditSectionObj.getEitdSection();
  122 + var josnSectionList = JSON.stringify(sectionList);
  123 + section.cutSectionList = josnSectionList;
  124 + $.get('submit_select.html', function(m){
  125 + $(pjaxContainer).append(m);
  126 + $('#submit_select_mobal').trigger('submitSelectMobal.show',[section,EditRoute]);
  127 + });
  128 + /* layer.confirm('提交会把原有的站点和路段覆盖,您确定要提交吗?', {
115 btn: ['提交','取消'] //按钮 129 btn: ['提交','取消'] //按钮
116 }, function(){ 130 }, function(){
117 var sectionList = WorldsBMapLine.getSectionList(); 131 var sectionList = WorldsBMapLine.getSectionList();
@@ -131,7 +145,7 @@ $(function(){ @@ -131,7 +145,7 @@ $(function(){
131 layer.msg('提交失败...'); 145 layer.msg('提交失败...');
132 } 146 }
133 }); 147 });
134 - }); 148 + }); */
135 } else { 149 } else {
136 layer.msg("请先截取路段!!!"); 150 layer.msg("请先截取路段!!!");
137 } 151 }
@@ -170,11 +184,11 @@ $(function(){ @@ -170,11 +184,11 @@ $(function(){
170 }).on('mouseleave',function() { 184 }).on('mouseleave',function() {
171 $('.defeat-scroll').css('overflow','hidden'); 185 $('.defeat-scroll').css('overflow','hidden');
172 }); 186 });
173 -}); 187 +});
174 </script> 188 </script>
175 <!--编辑路线类 --> 189 <!--编辑路线类 -->
176 <script src="/pages/base/line/js/editRoute.js"></script> 190 <script src="/pages/base/line/js/editRoute.js"></script>
177 - <!--坐标转换类 --> 191 +<!--坐标转换类 -->
178 <script src="/pages/base/line/js/transGPS.js"></script> 192 <script src="/pages/base/line/js/transGPS.js"></script>
179 <!-- 地图类 --> 193 <!-- 地图类 -->
180 <script src="/pages/base/line/js/line-list-map.js"></script> 194 <script src="/pages/base/line/js/line-list-map.js"></script>
src/main/resources/static/pages/base/line/submit_select.html 0 → 100644
  1 +<!-- 提交选项 -->
  2 +<div class="modal fade" id="submit_select_mobal" tabindex="-1"
  3 + role="basic" aria-hidden="true">
  4 + <div class="modal-dialog">
  5 + <div class="modal-content">
  6 + <div class="modal-header">
  7 + <button type="button" class="close" data-dismiss="modal"
  8 + aria-hidden="true"></button>
  9 + <h4 class="modal-title">
  10 + 提交选项
  11 + </h4>
  12 + </div>
  13 + <div class="modal-body">
  14 + <form class="form-horizontal" action="/" method="post"
  15 + id="formBootbox" role="form">
  16 +
  17 + <div class="form-group">
  18 + <label class="col-md-3 control-label">选择版本:</label>
  19 + <div class="col-md-9">
  20 + <select class="form-control" name="lineVersions" id="lineVersions" style="width: 370px;"></select>
  21 + </div>
  22 + </div>
  23 + </form>
  24 + </div>
  25 + <div class="modal-footer">
  26 + <button type="button" class="btn default" data-dismiss="modal">取消</button>
  27 + <button type="button" class="btn btn-primary"
  28 + id="submitSelectnextButton">提交</button>
  29 + </div>
  30 + </div>
  31 + </div>
  32 +</div>
  33 +<script type="text/javascript">
  34 + $('#submit_select_mobal').on('submitSelectMobal.show',function(e,section) {
  35 + // 加载显示mobal
  36 + $('#submit_select_mobal').modal({
  37 + show : true,
  38 + backdrop : 'static',
  39 + keyboard : false
  40 + });
  41 + // 给版本号下拉框赋值
  42 + $.get('/lineVersions/findByLineId',{'lineId':section.sectionrouteLine},function(lineVersions){
  43 + var options = "";
  44 + $.each(lineVersions, function () {
  45 + var startDate;
  46 + if(this.startDate != "" && this.startDate != null){
  47 + startDate = moment(this.startDate).format('YYYY-MM-DD HH:mm:ss');
  48 + } else {
  49 + startDate = "无";
  50 + }
  51 + if(this.status==1){
  52 + //当前版本为默认
  53 + options += '<option value="'+this.versions+','+this.status+','+startDate+'" > 版本'+this.versions+' 启用时间:'+startDate+' 当前版本</option>';
  54 + } else if(this.status==2){
  55 + options += '<option value="'+this.versions+','+this.status+','+startDate+'" selected = "selected"> 版本'+this.versions+' 启用时间:'+startDate+' 待更新版本</option>';
  56 + }
  57 + });
  58 + $('#lineVersions').html(options);
  59 + });
  60 +
  61 + // 获取表单元素
  62 + var form = $('#formBootbox');
  63 + // 下一步点击事件
  64 + $('#submitSelectnextButton').on('click', function() {
  65 + // 表单提交
  66 + form.submit();
  67 + });
  68 + // 表单验证
  69 + form.validate({
  70 + // 表单序列化
  71 + submitHandler : function(f) {
  72 + var lineVersions = $('#lineVersions').val();
  73 + var line = lineVersions.split(",");
  74 + // 即时更新
  75 + if(line[1] == 1) {
  76 + section.versions = line[0];
  77 + // 隐藏选项mobal
  78 + $('#submit_select_mobal').modal('hide');
  79 + layer.confirm('提交马上会把原有的站点和路段覆盖,您确定要提交吗?', {
  80 + btn: ['提交','取消'] //按钮
  81 + }, function(){
  82 + $.post('/section/sectionCut', section, function(resuntDate){
  83 + if(resuntDate.status=='SUCCESS') {
  84 + // 弹出添加成功提示消息
  85 + layer.msg('提交成功,跳转到线路详情页面!');
  86 + window.location.href = "/pages/base/stationroute/list.html?no="+section.sectionrouteLine+","+section.sectionrouteDirections;
  87 + }else {
  88 + // 弹出添加失败提示消息
  89 + layer.msg('提交失败...');
  90 + }
  91 + });
  92 + });
  93 + // 定时更新
  94 + } else if(line[1] == 2) {
  95 + section.versions = line[0];
  96 + // 隐藏选项mobal
  97 + $('#submit_select_mobal').modal('hide');
  98 + layer.confirm('提交后线路将在'+line[2]+'时间以后启用您提交的版本:'+line[0], {
  99 + btn: ['提交','取消'] //按钮
  100 + }, function(rs){
  101 + $.post('/section/sectionCutSaveLineLS', section, function(resuntDate){
  102 + if(resuntDate.status=='SUCCESS') {
  103 + // 关闭提示弹出层
  104 + layer.close(rs);
  105 + // 弹出添加成功提示消息
  106 + layer.msg('提交成功!');
  107 + // 返回线路list页面
  108 + loadPage('/pages/base/line/list.html');
  109 +// window.location.href = "/pages/base/stationroute/list.html?no="+section.sectionrouteLine+","+section.sectionrouteDirections;
  110 + }else {
  111 + // 弹出添加失败提示消息
  112 + layer.msg('提交失败...');
  113 + }
  114 + });
  115 + });
  116 + }
  117 + }
  118 + });
  119 + });
  120 +</script>
0 \ No newline at end of file 121 \ No newline at end of file
src/main/resources/static/pages/base/lineversions/add.html 0 → 100644
  1 +<!-- 片段标题 START -->
  2 +<div class="page-head">
  3 + <div class="page-title">
  4 + <h1>修改添加信息</h1>
  5 + </div>
  6 +</div>
  7 +<!-- 片段标题 END -->
  8 +
  9 +<!-- 线路信息导航栏组件 START -->
  10 +<ul class="page-breadcrumb breadcrumb">
  11 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  12 + <li><span class="active">基础信息</span> <i class="fa fa-circle"></i></li>
  13 + <li><a href="/pages/base/line/list.html" data-pjax>线路信息</a> <i class="fa fa-circle"></i></li>
  14 + <li><span class="active">修改添加信息</span></li>
  15 +</ul>
  16 +<!-- 线路信息导航栏组件 END -->
  17 +
  18 +<!-- 信息容器组件 START -->
  19 +<div class="portlet light bordered">
  20 +
  21 + <!-- 信息容器组件标题 START -->
  22 + <div class="portlet-title">
  23 + <div class="caption">
  24 + <i class="icon-equalizer font-red-sunglo"></i>
  25 + <span class="caption-subject font-red-sunglo bold uppercase">添加线路信息</span>
  26 + </div>
  27 + </div>
  28 + <!-- 信息容器组件标题 END -->
  29 +
  30 + <!-- 表单容器组件 START -->
  31 + <div class="portlet-body form" id="lineEditForm">
  32 +
  33 + <!-- START FORM -->
  34 + <form action="/lineVersions" class="form-horizontal" id="lineVersions_add_form" >
  35 +
  36 + <!-- 错误提示信息组件 START -->
  37 + <div class="alert alert-danger display-hide">
  38 + <button class="close" data-close="alert"></button>
  39 + 您的输入有误,请检查下面的输入项
  40 + </div>
  41 + <!-- 错误提示信息组件 END -->
  42 +
  43 + <!-- 表单内容 START -->
  44 + <div class="form-body">
  45 + <input type="hidden" name="lineId" id="lineIdInput" />
  46 + <input type="hidden" name="lineCode" id="lineCodeInput" />
  47 +
  48 + <!-- 表单分组组件 form-group START -->
  49 + <div class="form-group">
  50 + <label class="control-label col-md-5">
  51 + <span class="required"> * </span>线路名称&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  52 + </label>
  53 + <div class="col-md-4">
  54 + <select name="line" class="form-control" style="width:100%" id="lineSelect"></select>
  55 + </div>
  56 + </div>
  57 + <!-- 表单分组组件 form-group END -->
  58 +
  59 + <!-- 表单分组组件 form-group START -->
  60 + <div class="form-group">
  61 + <label class="control-label col-md-5">
  62 + <span class="required"> * </span>启用时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  63 + </label>
  64 + <div class="col-md-4">
  65 + <input type="text" class="form-control" name="startDate" id="startDateInput" />
  66 + </div>
  67 + </div>
  68 + <!-- 表单分组组件 form-group END -->
  69 +
  70 + <!-- 表单分组组件 form-group START -->
  71 + <div class="form-group">
  72 + <label class="control-label col-md-5">
  73 + <span class="required"> * </span>终止时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  74 + </label>
  75 + <div class="col-md-4">
  76 + <input type="text" class="form-control" name="endDate" id="endDateInput" />
  77 + </div>
  78 + </div>
  79 + <!-- 表单分组组件 form-group END -->
  80 +
  81 + <!-- 表单分组组件 form-group START -->
  82 + <div class="form-group">
  83 + <label class="control-label col-md-5">
  84 + <span class="required"> * </span>线路版本&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  85 + </label>
  86 + <div class="col-md-4">
  87 + <input type="text" class="form-control" name="versions" id="versionsInput" placeholder="线路版本" />
  88 + </div>
  89 + </div>
  90 + <!-- 表单分组组件 form-group END -->
  91 +
  92 + <div class="form-group">
  93 + <label class="control-label col-md-5">
  94 + <span class="required"> * </span>线路版本状态&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  95 + </label>
  96 + <div class="col-md-4">
  97 + <select name="status" class="form-control" id="statusInput">
  98 + <option value="">请选择...</option>
  99 + <option value="1">当前版本</option>
  100 + <option value="2">待更新版本</option>
  101 + <option value="0">历史版本</option>
  102 + </select>
  103 + </div>
  104 + </div>
  105 +
  106 + <!-- 表单分组组件 form-group START -->
  107 + <div class="form-group">
  108 + <label class="control-label col-md-5"> 描述/说明&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  109 + <div class="col-md-4">
  110 + <textarea class="form-control" rows="3" name="remark" id="remarkTextarea" placeholder="请填写更换版本原因,方便排班人员操作!"></textarea>
  111 + </div>
  112 + </div>
  113 + <!-- 表单分组组件 form-group END -->
  114 + </div>
  115 +
  116 + <!-- 表单按钮组件 START -->
  117 + <div class="form-actions">
  118 + <div class="row">
  119 + <div class="col-md-offset-5 col-md-7">
  120 + <button type="submit" class="btn green" ><i class="fa fa-check"></i> 提交</button>
  121 + <a type="button" class="btn default" href="list.html" data-pjax><i class="fa fa-times"></i> 取消</a>
  122 + </div>
  123 + </div>
  124 + </div>
  125 + <!-- 表单按钮组件 END -->
  126 + </form>
  127 + <!-- END FORM-->
  128 + </div>
  129 + <!-- 表单组件 END -->
  130 +</div>
  131 +<!-- 信息容器组件 END -->
  132 +
  133 +<!-- 线路信息添加片段JS模块 -->
  134 +<script src="/pages/base/lineversions/js/lineversions-add-from.js"></script>
0 \ No newline at end of file 135 \ No newline at end of file
src/main/resources/static/pages/base/lineversions/edit.html 0 → 100644
  1 +<!-- 片段标题 START -->
  2 +<div class="page-head">
  3 + <div class="page-title">
  4 + <h1>修改线路信息</h1>
  5 + </div>
  6 +</div>
  7 +<!-- 片段标题 END -->
  8 +
  9 +<!-- 线路信息导航栏组件 START -->
  10 +<ul class="page-breadcrumb breadcrumb">
  11 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  12 + <li><span class="active">基础信息</span> <i class="fa fa-circle"></i></li>
  13 + <li><a href="/pages/base/line/list.html" data-pjax>线路信息</a> <i class="fa fa-circle"></i></li>
  14 + <li><span class="active">修改线路信息</span></li>
  15 +</ul>
  16 +<!-- 线路信息导航栏组件 END -->
  17 +
  18 +<!-- 信息容器组件 START -->
  19 +<div class="portlet light bordered">
  20 +
  21 + <!-- 信息容器组件标题 START -->
  22 + <div class="portlet-title">
  23 + <div class="caption">
  24 + <i class="icon-equalizer font-red-sunglo"></i>
  25 + <span class="caption-subject font-red-sunglo bold uppercase">修改线路信息</span>
  26 + </div>
  27 + </div>
  28 + <!-- 信息容器组件标题 END -->
  29 +
  30 + <!-- 表单容器组件 START -->
  31 + <div class="portlet-body form" id="lineEditForm">
  32 +
  33 + <!-- START FORM -->
  34 + <form action="/lineVersions" class="form-horizontal" id="lineVersions_edit_form" >
  35 +
  36 + <!-- 错误提示信息组件 START -->
  37 + <div class="alert alert-danger display-hide">
  38 + <button class="close" data-close="alert"></button>
  39 + 您的输入有误,请检查下面的输入项
  40 + </div>
  41 + <!-- 错误提示信息组件 END -->
  42 +
  43 + <!-- 表单内容 START -->
  44 + <div class="form-body">
  45 + <input type="hidden" name="lineId" id="lineIdInput" />
  46 + <input type="hidden" name="lineCode" id="lineCodeInput" />
  47 +
  48 + <!-- 表单分组组件 form-group START -->
  49 + <div class="form-group">
  50 + <label class="control-label col-md-5">
  51 + <span class="required"> * </span>线路版本Id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  52 + </label>
  53 + <div class="col-md-4">
  54 + <input type="text" class="form-control" name="Id" id="IdInput" readonly="readonly" />
  55 + </div>
  56 + </div>
  57 + <!-- 表单分组组件 form-group END -->
  58 +
  59 + <!-- 表单分组组件 form-group START -->
  60 + <div class="form-group">
  61 + <label class="control-label col-md-5">
  62 + <span class="required"> * </span>线路名称&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  63 + </label>
  64 + <div class="col-md-4">
  65 + <select name="line" class="form-control" style="width:100%" id="lineSelect"></select>
  66 + </div>
  67 + </div>
  68 + <!-- 表单分组组件 form-group END -->
  69 +
  70 + <!-- 表单分组组件 form-group START -->
  71 + <div class="form-group">
  72 + <label class="control-label col-md-5">
  73 + <span class="required"> * </span>启用时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  74 + </label>
  75 + <div class="col-md-4">
  76 + <input type="text" class="form-control" name="startDate" id="startDateInput" />
  77 + </div>
  78 + </div>
  79 + <!-- 表单分组组件 form-group END -->
  80 +
  81 + <!-- 表单分组组件 form-group START -->
  82 + <div class="form-group">
  83 + <label class="control-label col-md-5">
  84 + <span class="required"> * </span>终止时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  85 + </label>
  86 + <div class="col-md-4">
  87 + <input type="text" class="form-control" name="endDate" id="endDateInput" />
  88 + </div>
  89 + </div>
  90 + <!-- 表单分组组件 form-group END -->
  91 +
  92 + <!-- 表单分组组件 form-group START -->
  93 + <div class="form-group">
  94 + <label class="control-label col-md-5">
  95 + <span class="required"> * </span>线路版本&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  96 + </label>
  97 + <div class="col-md-4">
  98 + <input type="text" class="form-control" name="versions" id="versionsInput" placeholder="线路版本" />
  99 + </div>
  100 + </div>
  101 + <!-- 表单分组组件 form-group END -->
  102 +
  103 + <div class="form-group">
  104 + <label class="control-label col-md-5">
  105 + <span class="required"> * </span>线路版本状态&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  106 + </label>
  107 + <div class="col-md-4">
  108 + <select name="status" class="form-control" id="statusInput">
  109 + <option value="">请选择...</option>
  110 + <option value="1">当前版本</option>
  111 + <option value="2">待更新版本</option>
  112 + <option value="0">历史版本</option>
  113 + </select>
  114 + </div>
  115 + </div>
  116 +
  117 + <!-- 表单分组组件 form-group START -->
  118 + <div class="form-group">
  119 + <label class="control-label col-md-5"> 描述/说明&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  120 + <div class="col-md-4">
  121 + <textarea class="form-control" rows="3" name="remark" id="remarkTextarea" placeholder="请填写更换版本原因,方便排班人员操作!"></textarea>
  122 + </div>
  123 + </div>
  124 + <!-- 表单分组组件 form-group END -->
  125 + </div>
  126 +
  127 + <!-- 表单按钮组件 START -->
  128 + <div class="form-actions">
  129 + <div class="row">
  130 + <div class="col-md-offset-5 col-md-7">
  131 + <button type="submit" class="btn green" ><i class="fa fa-check"></i> 提交</button>
  132 + <a type="button" class="btn default" href="list.html" data-pjax><i class="fa fa-times"></i> 取消</a>
  133 + </div>
  134 + </div>
  135 + </div>
  136 + <!-- 表单按钮组件 END -->
  137 + </form>
  138 + <!-- END FORM-->
  139 + </div>
  140 + <!-- 表单组件 END -->
  141 +</div>
  142 +<!-- 信息容器组件 END -->
  143 +
  144 +<!-- 线路信息修改片段JS模块 -->
  145 +<script src="/pages/base/lineversions/js/lineversions-edit-from.js"></script>
0 \ No newline at end of file 146 \ No newline at end of file
src/main/resources/static/pages/base/lineversions/js/lineversions-add-from.js 0 → 100644
  1 +// 线路版本添加js
  2 +(function(){
  3 + //获取参数ID
  4 + var id = $.url().param('no');
  5 +
  6 + $("#startDateInput").datetimepicker({
  7 + format : 'YYYY-MM-DD HH:mm:ss',
  8 + locale : 'zh-cn'
  9 + });
  10 +
  11 + $("#endDateInput").datetimepicker({
  12 + format : 'YYYY-MM-DD HH:mm:ss',
  13 + locale : 'zh-cn'
  14 + });
  15 + // 初始化线路名称select
  16 + lineAllInfo();
  17 +
  18 + function getComp (cb) {
  19 + $.get('/user/companyData',null,function(rs) {
  20 + var params = {};
  21 + if(rs.length>0) {
  22 + var compA = new Array();
  23 + for(var c = 0 ; c<rs.length;c++) {
  24 + var comC = rs[c].companyCode;
  25 + var child = rs[c].children;
  26 + if(child.length>0) {
  27 + for(var d = 0 ;d< child.length;d++) {
  28 + compA.push(comC + '_' + child[d].code);
  29 + }
  30 + }else {
  31 + compA.push(comC);
  32 + }
  33 + }
  34 + params.cgsbm_in = compA.toString();
  35 + }
  36 + return cb && cb(params);
  37 + });
  38 + }
  39 +
  40 + // 填充公司下拉框选择值
  41 + function lineAllInfo(){
  42 + getComp(function(params) {
  43 + $get('/line/all', params, function(array){
  44 + // get请求获取公司
  45 + $get('/business/all', {upCode_eq: '88'}, function(compD){
  46 + var len_ = array.length,paramsD = new Array();
  47 + if(len_>0) {
  48 + $.each(array, function(i, g){
  49 + if(g.name!='' || g.name != null) {
  50 + paramsD.push({'id':g.id + '_' + g.lineCode,
  51 + 'text':g.name + gsdmTogsName(compD,g.company)});
  52 + }
  53 + });
  54 + if($('span').hasClass('select2-selection'))
  55 + $('span .select2-selection').remove();
  56 + initPinYinSelect2($('#lineSelect'),paramsD,function(selector) {
  57 + selector.select2("val", splitxlName(window.localStorage.xlName_AgursData));
  58 + });
  59 + }
  60 + });
  61 + });
  62 + });
  63 + }
  64 +
  65 + // 监听线路名称下拉框值改变事件.
  66 + $('#lineSelect').on("change", function (e) {
  67 + var lineSelectValue = $('#lineSelect').val();// 获取线路名称值.
  68 + if(lineSelectValue=='' || lineSelectValue==null) {
  69 + $('#lineCodeInput').val('');// 设值线路编码.
  70 + $('#lineIdInput').val('');// 设值线路ID.
  71 + }else {
  72 + var lineSelectValueArray = lineSelectValue.split('_');// 切割线路名称值.
  73 + $('#lineIdInput').val(lineSelectValueArray[0]);// 设值线路编码.
  74 + $('#lineCodeInput').val(lineSelectValueArray[1]);// 设值线路ID.
  75 + }
  76 + });
  77 +
  78 + function gsdmTogsName(gsD,code) {
  79 + var rsStr = '';
  80 + for(var s = 0 ; s < gsD.length; s++) {
  81 + if(gsD[s].businessCode == code) {
  82 + rsStr = rsStr + '(' + gsD[s].businessName.replace('公司','') + ')';
  83 + break;
  84 + }
  85 + }
  86 + return rsStr;
  87 + }
  88 +
  89 + // 切割线路名称值.获取线路ID及编码.
  90 + function splitxlName(str) {
  91 + var rsStr = '';
  92 + if(str) {
  93 + var strArray = str.split('_');
  94 + rsStr = strArray[0];
  95 + }
  96 + return rsStr;
  97 + }
  98 +
  99 + // 定义表单
  100 + var form = $('#lineVersions_add_form');
  101 + // 定义表单异常
  102 + var error = $('.alert-danger',form);
  103 + // 表单验证
  104 + form.validate({
  105 + // 错误提示元素span对象
  106 + errorElement : 'span',
  107 + // 错误提示元素class名称
  108 + errorClass : 'help-block help-block-error',
  109 + // 验证错误获取焦点
  110 + focusInvalid : true,
  111 + // 需要验证的表单元素
  112 + rules : {
  113 + 'line' : {required : true,maxlength: 30},// 线路名称 必填项、最大长度.
  114 + 'startDate' : {required : true},// 启用时间 不为空.
  115 + 'endDate' : {required : true},// 结束时间.
  116 + 'versions' : {required : true, digits : true, maxlength: 10},// 版本号 必填项、数字、最大长度10.
  117 + 'status' : {required : true, digits : true, maxlength: 10},// 版本状态 必填项、数字、最大长度10.
  118 + },
  119 +
  120 + /**
  121 + * 类型:Callback。当未通过验证的表单提交时,可以在该回调函数中处理一些事情。
  122 + *
  123 + * 参数:该回调函数有两个参数:第一个为一个事件对象,第二个为验证器(validator)
  124 + */
  125 + invalidHandler : function(event, validator) {
  126 + // 显示表单未通过提示信息
  127 + error.show();
  128 + // 把提示信息放到指定的位置。
  129 + App.scrollTo(error, -200);
  130 + },
  131 +
  132 + /**
  133 + * 类型:Callback。
  134 + *
  135 + * 默认:添加errorClass("has-error")到表单元素。将未通过验证的表单元素设置高亮。
  136 + */
  137 + highlight : function(element) {
  138 + // 添加errorClass("has-error")到表单元素
  139 + $(element).closest('.form-group').addClass('has-error');
  140 + },
  141 +
  142 + /**
  143 + * 类型:Callback。
  144 + *
  145 + * 默认:移除errorClass("has-error")。与highlight操作相反
  146 + */
  147 + unhighlight : function(element) {
  148 + // 移除errorClass("has-error")
  149 + $(element).closest('.form-group').removeClass('has-error');
  150 + },
  151 +
  152 + /**
  153 + * 类型:String,Callback。
  154 + *
  155 + * 如果指定它,当验证通过时显示一个消息。
  156 + *
  157 + * 如果是String类型的,则添加该样式到标签中;
  158 + *
  159 + * 如果是一个回调函数,则将标签作为其唯一的参数。
  160 + */
  161 + success : function(label) {
  162 + // 当验证通过时,移除errorClass("has-error")
  163 + label.closest('.form-group').removeClass('has-error');
  164 +
  165 + },
  166 + /**
  167 + * 类型:Callback。
  168 + *
  169 + * 默认:default (native) form submit;当表单通过验证,提交表单。回调函数有个默认参数form
  170 + */
  171 + submitHandler : function(f) {
  172 + // 隐藏错误提示
  173 + error.hide();
  174 + // 表单序列化
  175 + var params = form.serializeJSON();
  176 + submit();
  177 + // 提交
  178 + function submit() {
  179 + // 添加数据
  180 + $post('/lineVersions/add', params, function(result) {
  181 + // 如果返回结果不为空
  182 + if(result){
  183 + // 返回状态码为"SUCCESS" ,则添加成功;返回状态码为"ERROR" ,则添加失败
  184 + if(result.status=='SUCCESS') {
  185 + // 弹出添加成功提示消息
  186 + layer.msg('添加成功...');
  187 + } else if(result.status=='ERROR') {
  188 + // 弹出添加失败提示消息
  189 + layer.msg('添加失败...');
  190 + }
  191 + }
  192 + // 返回list.html页面
  193 + loadPage('list.html');
  194 + });
  195 + }
  196 + }
  197 + });
  198 +})();
0 \ No newline at end of file 199 \ No newline at end of file
src/main/resources/static/pages/base/lineversions/js/lineversions-edit-from.js 0 → 100644
  1 +// 线路版本修改js
  2 +(function(){
  3 + //获取参数ID
  4 + var id = $.url().param('no');
  5 +
  6 + $("#startDateInput").datetimepicker({
  7 + format : 'YYYY-MM-DD HH:mm:ss',
  8 + locale : 'zh-cn'
  9 + });
  10 +
  11 + $("#endDateInput").datetimepicker({
  12 + format : 'YYYY-MM-DD HH:mm:ss',
  13 + locale : 'zh-cn'
  14 + });
  15 + // 初始化线路名称select
  16 + lineAllInfo();
  17 +
  18 + function getComp (cb) {
  19 + $.get('/user/companyData',null,function(rs) {
  20 + var params = {};
  21 + if(rs.length>0) {
  22 + var compA = new Array();
  23 + for(var c = 0 ; c<rs.length;c++) {
  24 + var comC = rs[c].companyCode;
  25 + var child = rs[c].children;
  26 + if(child.length>0) {
  27 + for(var d = 0 ;d< child.length;d++) {
  28 + compA.push(comC + '_' + child[d].code);
  29 + }
  30 + }else {
  31 + compA.push(comC);
  32 + }
  33 + }
  34 + params.cgsbm_in = compA.toString();
  35 + }
  36 + return cb && cb(params);
  37 + });
  38 + }
  39 +
  40 + // 填充公司下拉框选择值
  41 + function lineAllInfo(){
  42 + getComp(function(params) {
  43 + $get('/line/all', params, function(array){
  44 + // get请求获取公司
  45 + $get('/business/all', {upCode_eq: '88'}, function(compD){
  46 + var len_ = array.length,paramsD = new Array();
  47 + if(len_>0) {
  48 + $.each(array, function(i, g){
  49 + if(g.name!='' || g.name != null) {
  50 + paramsD.push({'id':g.id + '_' + g.lineCode,
  51 + 'text':g.name + gsdmTogsName(compD,g.company)});
  52 + }
  53 + });
  54 + if($('span').hasClass('select2-selection'))
  55 + $('span .select2-selection').remove();
  56 + initPinYinSelect2($('#lineSelect'),paramsD,function(selector) {
  57 + selector.select2("val", splitxlName(window.localStorage.xlName_AgursData));
  58 + });
  59 + }
  60 + });
  61 + });
  62 + });
  63 + }
  64 +
  65 + // 监听线路名称下拉框值改变事件.
  66 + $('#lineSelect').on("change", function (e) {
  67 + var lineSelectValue = $('#lineSelect').val();// 获取线路名称值.
  68 + if(lineSelectValue=='' || lineSelectValue==null) {
  69 + $('#lineCodeInput').val('');// 设值线路编码.
  70 + $('#lineIdInput').val('');// 设值线路ID.
  71 + }else {
  72 + var lineSelectValueArray = lineSelectValue.split('_');// 切割线路名称值.
  73 + $('#lineIdInput').val(lineSelectValueArray[0]);// 设值线路编码.
  74 + $('#lineCodeInput').val(lineSelectValueArray[1]);// 设值线路ID.
  75 + }
  76 + });
  77 +
  78 + // 如果参数ID不为空
  79 + if(id) {
  80 + setTimeout(function(){
  81 + /** 根据ID查询详细信息 */
  82 + $get('/lineVersions/findById',{'id':id}, function(result){
  83 + // 如果不为空
  84 + if(result) {
  85 + $("#IdInput").val(result.id);
  86 + $("#lineIdInput").val(result.line);
  87 + $("#lineCodeInput").val(result.lineCode);
  88 + $("#lineSelect").val();
  89 + $("#lineSelect").val(result.line.id+"_"+result.lineCode).trigger("change");
  90 + $("#startDateInput").val(moment(result.startDate).format('YYYY-MM-DD HH:mm:ss'));
  91 + $("#endDateInput").val(moment(result.endDate).format('YYYY-MM-DD HH:mm:ss'));
  92 + $("#versionsInput").val(result.versions);
  93 + $("#statusInput").val(result.status);
  94 + $("#remarkTextarea").val(result.remark);
  95 + }
  96 +
  97 + });
  98 + }, 500);
  99 +
  100 + } else {
  101 + // 缺少ID
  102 + layer.confirm('【ID缺失,请点击返回,重新进行修改操作】', {btn : [ '返回' ],icon: 3, title:'提示'}, function(index){
  103 + // 关闭弹出层
  104 + layer.close(index);
  105 + // 跳转到list页面
  106 + loadPage('list.html');
  107 + });
  108 + }
  109 +
  110 + function gsdmTogsName(gsD,code) {
  111 + var rsStr = '';
  112 + for(var s = 0 ; s < gsD.length; s++) {
  113 + if(gsD[s].businessCode == code) {
  114 + rsStr = rsStr + '(' + gsD[s].businessName.replace('公司','') + ')';
  115 + break;
  116 + }
  117 + }
  118 + return rsStr;
  119 + }
  120 +
  121 + // 切割线路名称值.获取线路ID及编码.
  122 + function splitxlName(str) {
  123 + var rsStr = '';
  124 + if(str) {
  125 + var strArray = str.split('_');
  126 + rsStr = strArray[0];
  127 + }
  128 + return rsStr;
  129 + }
  130 +
  131 + // 定义表单
  132 + var form = $('#lineVersions_edit_form');
  133 + // 定义表单异常
  134 + var error = $('.alert-danger',form);
  135 + // 表单验证
  136 + form.validate({
  137 + // 错误提示元素span对象
  138 + errorElement : 'span',
  139 + // 错误提示元素class名称
  140 + errorClass : 'help-block help-block-error',
  141 + // 验证错误获取焦点
  142 + focusInvalid : true,
  143 + // 需要验证的表单元素
  144 + rules : {
  145 + 'line' : {required : true,maxlength: 30},// 线路名称 必填项、最大长度.
  146 + 'startDate' : {required : true},// 启用时间 不为空.
  147 + 'endDate' : {required : true},// 结束时间.
  148 + 'versions' : {required : true, digits : true, maxlength: 10},// 版本号 必填项、数字、最大长度10.
  149 + 'status' : {required : true, digits : true, maxlength: 10},// 版本状态 必填项、数字、最大长度10.
  150 + },
  151 +
  152 + /**
  153 + * 类型:Callback。当未通过验证的表单提交时,可以在该回调函数中处理一些事情。
  154 + *
  155 + * 参数:该回调函数有两个参数:第一个为一个事件对象,第二个为验证器(validator)
  156 + */
  157 + invalidHandler : function(event, validator) {
  158 + // 显示表单未通过提示信息
  159 + error.show();
  160 + // 把提示信息放到指定的位置。
  161 + App.scrollTo(error, -200);
  162 + },
  163 +
  164 + /**
  165 + * 类型:Callback。
  166 + *
  167 + * 默认:添加errorClass("has-error")到表单元素。将未通过验证的表单元素设置高亮。
  168 + */
  169 + highlight : function(element) {
  170 + // 添加errorClass("has-error")到表单元素
  171 + $(element).closest('.form-group').addClass('has-error');
  172 + },
  173 +
  174 + /**
  175 + * 类型:Callback。
  176 + *
  177 + * 默认:移除errorClass("has-error")。与highlight操作相反
  178 + */
  179 + unhighlight : function(element) {
  180 + // 移除errorClass("has-error")
  181 + $(element).closest('.form-group').removeClass('has-error');
  182 + },
  183 +
  184 + /**
  185 + * 类型:String,Callback。
  186 + *
  187 + * 如果指定它,当验证通过时显示一个消息。
  188 + *
  189 + * 如果是String类型的,则添加该样式到标签中;
  190 + *
  191 + * 如果是一个回调函数,则将标签作为其唯一的参数。
  192 + */
  193 + success : function(label) {
  194 + // 当验证通过时,移除errorClass("has-error")
  195 + label.closest('.form-group').removeClass('has-error');
  196 +
  197 + },
  198 + /**
  199 + * 类型:Callback。
  200 + *
  201 + * 默认:default (native) form submit;当表单通过验证,提交表单。回调函数有个默认参数form
  202 + */
  203 + submitHandler : function(f) {
  204 + // 隐藏错误提示
  205 + error.hide();
  206 + // 表单序列化
  207 + var params = form.serializeJSON();
  208 + submit();
  209 + // 提交
  210 + function submit() {
  211 + // 添加数据
  212 + $post('/lineVersions/update', params, function(result) {
  213 + // 如果返回结果不为空
  214 + if(result){
  215 + // 返回状态码为"SUCCESS" ,则添加成功;返回状态码为"ERROR" ,则添加失败
  216 + if(result.status=='SUCCESS') {
  217 + // 弹出添加成功提示消息
  218 + layer.msg('修改成功...');
  219 + } else if(result.status=='ERROR') {
  220 + // 弹出添加失败提示消息
  221 + layer.msg('修改失败...');
  222 + }
  223 + }
  224 + // 返回list.html页面
  225 + loadPage('list.html');
  226 + });
  227 + }
  228 + }
  229 + });
  230 +})();
0 \ No newline at end of file 231 \ No newline at end of file
src/main/resources/static/pages/base/lineversions/js/lineversions-list-table.js 0 → 100644
  1 +/**
  2 + *
  3 + * @JSName : lineversions-list-table.js(线路版本信息list.html页面js)
  4 + * @Description : TOOD(线路信息list.html页面js)
  5 + */
  6 +
  7 +(function(){
  8 + // 关闭左侧栏
  9 + if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();}
  10 + // 定义 page : 当前页;initPag ; icheckOptions:选择框
  11 + var page = 0,
  12 + initPag,
  13 + icheckOptions = {checkboxClass: 'icheckbox_flat-blue',increaseArea: '20%'},
  14 + storage = window.localStorage;
  15 + if(storage.xlName_AgursData!=null && storage.xlName_AgursData !='') {
  16 + $('.tipso-animation').children().remove();
  17 + // 延迟加载
  18 + setTimeout(function(){
  19 + $('.tipso-animation').tipso({
  20 + speed : 400,
  21 + background : '#0ed0e8',
  22 + color : '#ffffff',
  23 + position :'bottom',
  24 + width : 400,
  25 + delay : 100,
  26 + animationIn : 'fadeInDownBig',
  27 + animationOut : 'fadeOut',
  28 + offsetX : -50,
  29 + offsetY : -195,
  30 + content :'您可以通过点击重置按钮来清除对线路名称的记忆哦!',
  31 +
  32 + });
  33 + $('.tipso-animation').tipso('show');
  34 + setTimeout(function(){$('.tipso-animation').tipso('hide');},4000);
  35 + },200);
  36 + }
  37 + initCompanySelect2(function(array) {
  38 + // 公司下拉options属性值
  39 + var options = '<option value="">请选择...</option>';
  40 + // 遍历array
  41 + $.each(array, function(i,d){
  42 + options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>';
  43 + });
  44 + // 初始化公司下拉框并监听值改变事件.
  45 + $('#companySelect').html(options).on('change', setBrancheCompanySelectOptions);
  46 + // 初始化分公司下拉框.
  47 + setBrancheCompanySelectOptions();
  48 + initLineSelect2(array);
  49 + /** 表格数据分页加载 @param:<null:搜索参数;true:是否重新分页> */
  50 + loadTableDate({'line.name_like':splitxlName(storage.xlName_AgursData)},true);
  51 + });
  52 +
  53 + function initLineSelect2(compD) {
  54 + getComp(function(rs) {
  55 + var params = {};
  56 + if(rs.length>0) {
  57 + var compA = new Array();
  58 + for(var c = 0 ; c<rs.length;c++) {
  59 + var comC = rs[c].companyCode;
  60 + var child = rs[c].children;
  61 + if(child.length>0) {
  62 + for(var d = 0 ;d< child.length;d++) {
  63 + compA.push(comC + '_' + child[d].code);
  64 + }
  65 + }else {
  66 + compA.push(comC);
  67 + }
  68 + }
  69 + params.cgsbm_in = compA.toString();
  70 + }
  71 + // 填充线路拉框选择值
  72 + $get('/line/all', params, function(array){
  73 + var len_ = array.length,paramsD = new Array();
  74 + if(len_>0) {
  75 + $.each(array, function(i, g){
  76 + if(g.name!='' || g.name != null) {
  77 + paramsD.push({'id':g.name + '_' + g.id + '_' + g.lineCode ,'text':g.name + gsdmTogsName(compD,g.company)});
  78 + }
  79 + });
  80 + if($('span').hasClass('select2-selection'))
  81 + $('span .select2-selection').remove();
  82 + initPinYinSelect2($('#lineSelect'),paramsD,function(selector) {
  83 + selector.select2("val", storage.xlName_AgursData);
  84 + });
  85 + }
  86 + });
  87 + });
  88 + }
  89 +
  90 + function gsdmTogsName(gsD,code) {
  91 + var rsStr = '';
  92 + for(var s = 0 ; s < gsD.length; s++) {
  93 + if(gsD[s].businessCode == code) {
  94 + rsStr = rsStr + '(' + gsD[s].businessName.replace('公司','') + ')';
  95 + break;
  96 + }
  97 + }
  98 + return rsStr;
  99 + }
  100 +
  101 + function initCompanySelect2(cb) {
  102 + // get请求获取公司
  103 + $get('/business/all', {upCode_eq: '88'}, function(gs_d){
  104 + return cb && cb(gs_d);
  105 + });
  106 + }
  107 + function getComp(cb) {
  108 + $.get('/user/companyData',null,function(rs) {
  109 + return cb && cb(rs);
  110 + });
  111 + }
  112 + function getParams() {
  113 + // cells 集合返回表格中所有(列)单元格的一个数组
  114 + var cells = $('tr.filter')[0].cells;
  115 + // 搜索参数集合
  116 + var params = {};
  117 + // 搜索字段名称
  118 + var name;
  119 + // 遍历cells数组
  120 + $.each(cells, function(i, cell){
  121 + // 获取第i列的input或者select集合
  122 + var items = $('input,select', cell);
  123 + // 遍历items集合
  124 + for(var j = 0, item; item = items[j++];){
  125 + // 获取字段名称
  126 + name = $(item).attr('name');
  127 + if(name){
  128 + // 赋取相对应的值
  129 + params[name] = $(item).val();
  130 + }
  131 + }
  132 + });
  133 + return params;
  134 + }
  135 +
  136 + /** 表格数据分页加载事件 @param:<param : 查询参数;isPon : 是否重新分页> */
  137 + function loadTableDate(param,isPon){
  138 + // 搜索参数
  139 + var params = {};
  140 + if(param) {
  141 + params = param;
  142 + }
  143 + // 排序(按方向与序号)
  144 + params['order'] = 'lineCode,versions';
  145 + // 排序方向.
  146 + params['direction'] = 'ASC,ASC';
  147 + // 记录当前页数
  148 + params['page'] = page;
  149 + // 弹出正在加载层
  150 + var i = layer.load(2);
  151 + // 异步请求获取表格数据
  152 + $.get('/lineVersions',params,function(result){
  153 + // 添加序号
  154 + result.content.page = page;
  155 + // 把数据填充到模版中
  156 + $.each(result.content, function(){
  157 + this.startDateStr=moment(this.startDate).format('YYYY-MM-DD HH:mm:ss');
  158 + this.endDateStr=moment(this.endDate).format('YYYY-MM-DD HH:mm:ss');
  159 + })
  160 +
  161 + var tbodyHtml = template('lineversions_list_temp',{list:result.content});
  162 + $('#datatable_lineversions tbody').html(tbodyHtml);
  163 + // 是重新分页且返回数据长度大于0
  164 + if(isPon && result.content.length > 0){
  165 + // 重新分页
  166 + initPag = true;
  167 + // 分页栏
  168 + showPagination(result);
  169 + }
  170 + // 关闭弹出加载层
  171 + layer.close(i);
  172 + });
  173 + }
  174 +
  175 +
  176 + function toDate(timestamp){
  177 + var date = new Date(parseInt(timestamp).toLocaleString());
  178 + return date;
  179 + }
  180 +
  181 + /** 复选框组件 */
  182 + function iCheckChange(){
  183 + // 获取当前的父节点tr
  184 + var tr = $(this).parents('tr');
  185 + // 判断当前是否选中
  186 + if(this.checked) {
  187 + // 选中,则增添父节点tr的样式
  188 + tr.addClass('row-active');
  189 + }else {
  190 + // 未选中,则删除父节点tr的样式
  191 + tr.removeClass('row-active');
  192 + }
  193 + }
  194 +
  195 + /** 分页栏组件 */
  196 + function showPagination(data){
  197 + // 分页组件
  198 + $('#pagination').jqPaginator({
  199 + // 总页数
  200 + totalPages: data.totalPages,
  201 + // 中间显示页数
  202 + visiblePages: 6,
  203 + // 当前页
  204 + currentPage: page + 1,
  205 + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
  206 + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>',
  207 + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>',
  208 + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>',
  209 + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
  210 + onPageChange: function (num, type) {
  211 + if(initPag){
  212 + initPag = false;
  213 + return;
  214 + }
  215 + var pData = getParams();
  216 + pData['line.name_like'] = splitxlName(pData['line.name_like']);
  217 + page = num - 1;
  218 + loadTableDate(pData, false);
  219 + }
  220 + });
  221 + }
  222 + /** 填充分公司下拉框选择值 */
  223 + function setBrancheCompanySelectOptions(){
  224 + // 获取公司下拉框选择值
  225 + var businessCode = $('#companySelect').val();
  226 + // 分公司下拉框options属性值
  227 + var options = '<option value="">请选择...</option>';
  228 + // 如果公司选择为空则分公司为空 ; 否则查询出所属公司下的分公司名称和相应分公司代码
  229 + if(businessCode == null || businessCode ==''){
  230 + // 填充分公司下拉框options
  231 + $('#brancheCompanySelect').html(options);
  232 + } else {
  233 + /** 查询出所属公司下的分公司名称和相应分公司代码 @param:<upCode_eq:公司代码> */
  234 + $get('/business/all', {upCode_eq: businessCode}, function(array){
  235 + // 遍历array
  236 + $.each(array, function(i,d){
  237 + options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>';
  238 + // 填充分公司下拉框options
  239 + $('#brancheCompanySelect').html(options);
  240 + });
  241 + });
  242 + }
  243 + }
  244 +
  245 + /** 重置按钮事件 */
  246 + $('tr.filter .filter-cancel').on('click',function() {
  247 + // 清空搜索框值
  248 + $('tr.filter input,select').val('').change();
  249 + $('.tipso-animation').tipso('hide');
  250 + storage.setItem('xlName_AgursData','');
  251 + /** 表格数据分页加载 @param:<null:搜索参数;true:是否重新分页> */
  252 + loadTableDate(null,true);
  253 + });
  254 +
  255 + function splitxlName(str) {
  256 + var rsStr = '';
  257 + if(str) {
  258 + var strArray = str.split('_');
  259 + rsStr = strArray[0];
  260 + }
  261 + return rsStr;
  262 + }
  263 +
  264 + /** 搜索按钮事件 */
  265 + $('tr.filter .filter-submit').on('click',function(){
  266 + var params = getParams();
  267 + if(params['line.name_like']!='' && params['line.name_like'] != null) {
  268 + storage.setItem('xlName_AgursData',params['line.name_like']);
  269 + }
  270 + params['line.name_like'] = splitxlName(params['line.name_like']);
  271 + page = 0;
  272 + /** 表格数据分页加载 @param:<params:搜索参数;true:是否重新分页> */
  273 + loadTableDate(params,true);
  274 + });
  275 +
  276 +})();
0 \ No newline at end of file 277 \ No newline at end of file
src/main/resources/static/pages/base/lineversions/list.html 0 → 100644
  1 +<!-- 片段标题 START -->
  2 +<div class="page-head">
  3 + <div class="page-title">
  4 + <h1>线路版本信息</h1>
  5 + </div>
  6 +</div>
  7 +<!-- 片段标题 END -->
  8 +
  9 +<!-- 线路信息导航栏组件 START -->
  10 +<ul class="page-breadcrumb breadcrumb">
  11 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  12 + <li><span class="active">基础信息</span> <i class="fa fa-circle"></i></li>
  13 + <li><span class="active">线路版本信息</span></li>
  14 +</ul>
  15 +<!-- 线路信息导航栏组件 END -->
  16 +
  17 +<div class="row">
  18 + <div class="col-md-12">
  19 + <div class="portlet light porttlet-fit bordered">
  20 + <div class="portlet-title">
  21 + <div class="tipso-animation">
  22 + </div>
  23 + <div class="caption">
  24 + <i class="fa fa-info-circle font-dark"></i>
  25 + <span class="caption-subject font-dark sbold uppercase">线路版本信息</span>
  26 + </div>
  27 + <div class="actions">
  28 + <div class="btn-group btn-group-devided" data-toggle="buttons">
  29 + <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加线路版本</a>
  30 + </div>
  31 + </div>
  32 + </div>
  33 + <div class="portlet-body">
  34 + <div class="table-container" style="margin-top: 10px">
  35 + <table class="table table-striped table-bordered table-hover table-checkable" id="datatable_lineversions">
  36 + <thead>
  37 + <tr role="row" class="heading">
  38 + <th width="4%">序号</th>
  39 + <th width="5%">线路编码</th>
  40 + <th width="8%">线路名称</th>
  41 + <th width="8%">所属公司</th>
  42 + <th width="9%">所属分公司</th>
  43 + <th width="8%">启用时间</th>
  44 + <th width="8%">终止时间</th>
  45 + <th width="6%">版本号</th>
  46 + <th width="6%">版本状态</th>
  47 + <th width="6%">描述</th>
  48 + <th width="12%">操作</th>
  49 + </tr>
  50 + <tr role="row" class="filter">
  51 + <td>#</td>
  52 + <td>
  53 + <input type="text" class="form-control form-filter input-sm" name="lineCode_eq">
  54 + </td>
  55 + <td>
  56 + <select name="line.name_like" class="form-control" style="width:100%" id="lineSelect"></select>
  57 + <!-- <input type="text" class="form-control form-filter input-sm" name="name_like"> -->
  58 + </td>
  59 + <td>
  60 + <!-- 公司这里没使用字典表,暂时查的公司表 -->
  61 + <select name="line.company_eq" class="form-control" id="companySelect"></select>
  62 + </td>
  63 + <!-- 闵行没有下属公司,这里暂时注释掉 -->
  64 + <td>
  65 + <select name="line.brancheCompany_eq" class="form-control" id="brancheCompanySelect"></select>
  66 + </td>
  67 + <td>
  68 +<!-- <input type="text" class="form-control form-filter input-sm" name="shanghaiLinecode_eq"> -->
  69 + </td>
  70 + <td>
  71 +<!-- <input type="text" class="form-control form-filter input-sm" name="shanghaiLinecode_eq"> -->
  72 + </td>
  73 + <td>
  74 + <input type="text" class="form-control form-filter input-sm" name="versions_eq">
  75 +
  76 + </td>
  77 + <td>
  78 + <select name="status_eq" class="form-control" id="statusSelect">
  79 + <option value="">请选择...</option>
  80 + <option value="1">当前版本</option>
  81 + <option value="2">待更新版本</option>
  82 + <option value="0">历史版本</option>
  83 + </select>
  84 + </td>
  85 + <td></td>
  86 + <td>
  87 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" >
  88 + <i class="fa fa-search"></i> 搜索
  89 + </button>
  90 +
  91 + <button class="btn btn-sm red btn-outline filter-cancel" id="notification-trigger">
  92 + <i class="fa fa-times"></i> 重置
  93 + </button>
  94 + </td>
  95 + </tr>
  96 + </thead>
  97 + <tbody></tbody>
  98 + </table>
  99 + <div style="text-align: right;">
  100 + <ul id="pagination" class="pagination"></ul>
  101 + </div>
  102 + </div>
  103 + </div>
  104 + </div>
  105 + </div>
  106 +</div>
  107 +
  108 +<script type="text/html" id="lineversions_list_temp">
  109 + {{each list as obj i }}
  110 + <tr>
  111 + <td style="vertical-align: middle;">
  112 + {{(list.page*10)+(i+1)}}
  113 + </td>
  114 + <td>
  115 + {{obj.lineCode}}
  116 + </td>
  117 + <td>
  118 + {{obj.line.name}}
  119 + </td>
  120 + <td>
  121 + {{if obj.line.company == '55'}}
  122 + 上南公司
  123 + {{else if obj.line.company == '22'}}
  124 + 金高公司
  125 + {{else if obj.line.company == '05'}}
  126 + 杨高公司
  127 + {{else if obj.line.company == '26'}}
  128 + 南汇公司
  129 + {{else if obj.line.company == '77'}}
  130 + 闵行公司
  131 + {{/if}}
  132 + </td>
  133 + <td>
  134 + {{if obj.line.company == '55'}}
  135 +
  136 + {{if obj.line.brancheCompany == '1'}}
  137 + 上南二分公司
  138 + {{else if obj.line.brancheCompany == '2'}}
  139 + 上南三分公司
  140 + {{else if obj.line.brancheCompany == '3'}}
  141 + 上南六分公司
  142 + {{else if obj.line.brancheCompany == '4'}}
  143 + 上南一分公司
  144 + {{/if}}
  145 +
  146 + {{else if obj.company == '22'}}
  147 +
  148 + {{if obj.line.brancheCompany == '1'}}
  149 + 四分公司
  150 + {{else if obj.line.brancheCompany == '2'}}
  151 + 二分公司
  152 + {{else if obj.line.brancheCompany == '3'}}
  153 + 三分公司
  154 + {{else if obj.line.brancheCompany == '5'}}
  155 + 一分公司
  156 + {{/if}}
  157 +
  158 + {{else if obj.line.company == '05'}}
  159 +
  160 + {{if obj.line.brancheCompany == '1'}}
  161 + 川沙分公司
  162 + {{else if obj.line.brancheCompany == '2'}}
  163 + 金桥分公司
  164 + {{else if obj.line.brancheCompany == '3'}}
  165 + 芦潮港分公司
  166 + {{else if obj.line.brancheCompany == '5'}}
  167 + 杨高分公司
  168 + {{else if obj.line.brancheCompany == '6'}}
  169 + 周浦分公司
  170 + {{/if}}
  171 +
  172 + {{else if obj.line.company == '26'}}
  173 +
  174 + {{if obj.line.brancheCompany == '1'}}
  175 + 南汇一分
  176 + {{else if obj.line.brancheCompany == '2'}}
  177 + 南汇二分
  178 + {{else if obj.line.brancheCompany == '3'}}
  179 + 南汇三分
  180 + {{else if obj.line.brancheCompany == '4'}}
  181 + 南汇维修公司
  182 + {{else if obj.line.brancheCompany == '5'}}
  183 + 南汇公司
  184 + {{/if}}
  185 +
  186 + {{/if}}
  187 + </td>
  188 + <td>
  189 + {{obj.startDateStr}}
  190 + </td>
  191 + <td>
  192 + {{obj.endDateStr}}
  193 + </td>
  194 + <td>
  195 + {{obj.versions}}
  196 + </td>
  197 + <td>
  198 + {{if obj.status == '0'}}
  199 + 历史版本
  200 + {{else if obj.status == '1'}}
  201 + 当前版本
  202 + {{else if obj.status == '2'}}
  203 + 待更新版本
  204 + {{/if}}
  205 + </td>
  206 + <td>
  207 + {{obj.remark}}
  208 + </td>
  209 + <td>
  210 + <a href="edit.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 修改 </a>
  211 + </td>
  212 + </tr>
  213 + {{/each}}
  214 + {{if list.length == 0}}
  215 + <tr>
  216 + <td colspan=13><h6 class="muted">没有找到相关数据</h6></td>
  217 + </tr>
  218 + {{/if}}
  219 +</script>
  220 +<!-- 线路信息片段JS模块 -->
  221 +<script src="/pages/base/lineversions/js/lineversions-list-table.js"></script>
0 \ No newline at end of file 222 \ No newline at end of file
src/main/resources/static/pages/base/section/add.html
@@ -245,7 +245,7 @@ @@ -245,7 +245,7 @@
245 <div class="form-group"> 245 <div class="form-group">
246 <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;:</label> 246 <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;:</label>
247 <div class="col-md-6"> 247 <div class="col-md-6">
248 - <input type="text" class="form-control" name="versions" value='1' Readonly> 248 + <input type="text" class="form-control" name="versions" id="versionsInput" Readonly>
249 </div> 249 </div>
250 </div> 250 </div>
251 </div> 251 </div>
src/main/resources/static/pages/base/section/js/add-form-events.js
@@ -6,13 +6,22 @@ $(function(){ @@ -6,13 +6,22 @@ $(function(){
6 // 监听线路名称下拉框值改变事件. 6 // 监听线路名称下拉框值改变事件.
7 $('#lineSelect').on("change", function (e) { 7 $('#lineSelect').on("change", function (e) {
8 var lineSelectValue = $('#lineSelect').val();// 获取线路名称值. 8 var lineSelectValue = $('#lineSelect').val();// 获取线路名称值.
9 - if(lineSelectValue=='') { 9 + if(lineSelectValue=='' || lineSelectValue==null) {
10 $('#lineCodeInput').val('');// 设值线路编码. 10 $('#lineCodeInput').val('');// 设值线路编码.
11 $('#lineIdInput').val('');// 设值线路ID. 11 $('#lineIdInput').val('');// 设值线路ID.
12 }else { 12 }else {
  13 + debugger
13 var lineSelectValueArray = lineSelectValue.split('_');// 切割线路名称值. 14 var lineSelectValueArray = lineSelectValue.split('_');// 切割线路名称值.
14 $('#lineIdInput').val(lineSelectValueArray[0]);// 设值线路编码. 15 $('#lineIdInput').val(lineSelectValueArray[0]);// 设值线路编码.
15 $('#lineCodeInput').val(lineSelectValueArray[1]);// 设值线路ID. 16 $('#lineCodeInput').val(lineSelectValueArray[1]);// 设值线路ID.
  17 + // 版本号赋值
  18 + $.get('/lineVersions/findByLineId',{'lineId':lineSelectValueArray[0]},function(lineVersions){
  19 + $.each(lineVersions,function(){
  20 + if (this.status == 1) {
  21 + $('#versionsInput').val(this.versions);
  22 + }
  23 + })
  24 + });
16 // 获取该线路下的路段路由. 25 // 获取该线路下的路段路由.
17 PublicFunctions.getSectionRouteInfo(lineSelectValueArray[0],function(array) { 26 PublicFunctions.getSectionRouteInfo(lineSelectValueArray[0],function(array) {
18 // 定义路段路由长度、渲染拼音检索下拉框格式数据. 27 // 定义路段路由长度、渲染拼音检索下拉框格式数据.
src/main/resources/static/pages/base/section/js/add-form-reload.js
@@ -27,6 +27,7 @@ @@ -27,6 +27,7 @@
27 // 线路下拉框初始化. 27 // 线路下拉框初始化.
28 PublicFunctions.getLineAllInfo(function(array,compD) { 28 PublicFunctions.getLineAllInfo(function(array,compD) {
29 var len_ = array.length,paramsD = new Array(); 29 var len_ = array.length,paramsD = new Array();
  30 +// paramsD.push({'id':'','text':'请选择...'});
30 if(len_>0) { 31 if(len_>0) {
31 $.each(array, function(i, g){ 32 $.each(array, function(i, g){
32 if(g.name!='' || g.name != null) { 33 if(g.name!='' || g.name != null) {
src/main/resources/static/pages/base/section/js/section-positions-function.js
@@ -33,7 +33,7 @@ var PositionsPublicFunctions = function () { @@ -33,7 +33,7 @@ var PositionsPublicFunctions = function () {
33 $('#speedLimitInput').val(Section.sectionSpeedLimit);// 道路限速 33 $('#speedLimitInput').val(Section.sectionSpeedLimit);// 道路限速
34 $('#sectionDistanceInput').val(Section.sectionDistance);// 路段长度 34 $('#sectionDistanceInput').val(Section.sectionDistance);// 路段长度
35 $('#sectionTimeInput').val(Section.sectionTime);// 路段长度 35 $('#sectionTimeInput').val(Section.sectionTime);// 路段长度
36 - $('#versionsInput').val(Section.sectionVersion);// 版本号 36 + $('#versionsInput').val(Section.sectionRouteVersions);// 版本号
37 $('#destroySelect').val(Section.sectionRouteDestroy);// 是否撤销 37 $('#destroySelect').val(Section.sectionRouteDestroy);// 是否撤销
38 $('#descriptionsTextarea').val(Section.sectionRouteDescriptions);// 描述/说明 38 $('#descriptionsTextarea').val(Section.sectionRouteDescriptions);// 描述/说明
39 $('#isRoadeSpeedInput').val(Section.isRoadeSpeed);// 是否有路段限速数据 <0:分段;1:未分段> 39 $('#isRoadeSpeedInput').val(Section.isRoadeSpeed);// 是否有路段限速数据 <0:分段;1:未分段>
src/main/resources/static/pages/base/station/add.html
@@ -288,7 +288,7 @@ @@ -288,7 +288,7 @@
288 <div class="form-group"> 288 <div class="form-group">
289 <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label> 289 <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
290 <div class="col-md-6"> 290 <div class="col-md-6">
291 - <input type="text" class="form-control" name="versions" value='1' Readonly> 291 + <input type="text" class="form-control" name="versions" id="versionsInput" Readonly>
292 </div> 292 </div>
293 </div> 293 </div>
294 </div> 294 </div>
src/main/resources/static/pages/base/station/edit.html
@@ -184,7 +184,7 @@ @@ -184,7 +184,7 @@
184 <div class="form-group"> 184 <div class="form-group">
185 <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label> 185 <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
186 <div class="col-md-6"> 186 <div class="col-md-6">
187 - <input type="text" class="form-control" name="versions" value='1' Readonly> 187 + <input type="text" class="form-control" name="versions" id='versionsInput' Readonly>
188 </div> 188 </div>
189 </div> 189 </div>
190 </div> 190 </div>
@@ -253,7 +253,7 @@ $(&#39;#editPoitsions_station_mobal&#39;).on(&#39;editStationMobal_show&#39;, function(e, map,fu @@ -253,7 +253,7 @@ $(&#39;#editPoitsions_station_mobal&#39;).on(&#39;editStationMobal_show&#39;, function(e, map,fu
253 'stationMark' : {required : true},// 站点类型 必填项 253 'stationMark' : {required : true},// 站点类型 必填项
254 'bJwpoints' : {required : true},// 经纬度坐标点 必填项 254 'bJwpoints' : {required : true},// 经纬度坐标点 必填项
255 'shapesType' : {required : true},// 几何图形类型 必填项 255 'shapesType' : {required : true},// 几何图形类型 必填项
256 - 'radius' : {required : true},// 圆形半径 必填项 256 + 'radius' : {required : true, number : true,},// 圆形半径 必填项
257 'destroy' : {required : true},// 是否撤销 必填项 257 'destroy' : {required : true},// 是否撤销 必填项
258 'toTime' : {number : true},// 到站时间 必须输入合法的数字(负数,小数)。 258 'toTime' : {number : true},// 到站时间 必须输入合法的数字(负数,小数)。
259 'distances' : {number : true},// 到站距离 // 到站距离 259 'distances' : {number : true},// 到站距离 // 到站距离
src/main/resources/static/pages/base/station/js/add-form-events.js
@@ -14,7 +14,7 @@ $(function(){ @@ -14,7 +14,7 @@ $(function(){
14 // 监听线路名称值改变事件. 14 // 监听线路名称值改变事件.
15 $('#lineSelect').on("change", function (e) { 15 $('#lineSelect').on("change", function (e) {
16 var lineSelectValue = $(this).val(); 16 var lineSelectValue = $(this).val();
17 - if(lineSelectValue=='' && lineSelectValue ==null) { 17 + if(lineSelectValue=='' || lineSelectValue ==null) {
18 $('#lineCodeInput').val(''); 18 $('#lineCodeInput').val('');
19 $('#lineIdInput').val(''); 19 $('#lineIdInput').val('');
20 }else { 20 }else {
@@ -23,6 +23,14 @@ $(function(){ @@ -23,6 +23,14 @@ $(function(){
23 $('#lineIdInput').val(lineSelectValueArray[0]); 23 $('#lineIdInput').val(lineSelectValueArray[0]);
24 $('#lineCodeInput').val(lineSelectValueArray[1]); 24 $('#lineCodeInput').val(lineSelectValueArray[1]);
25 var params = {'lineCode_eq':lineSelectValueArray[1],'destroy_eq':0,'directions_eq':dir}; 25 var params = {'lineCode_eq':lineSelectValueArray[1],'destroy_eq':0,'directions_eq':dir};
  26 + // 版本号赋值
  27 + $.get('/lineVersions/findByLineId',{'lineId':lineSelectValueArray[0]},function(lineVersions){
  28 + $.each(lineVersions,function(){
  29 + if (this.status == 1) {
  30 + $('#versionsInput').val(this.versions);
  31 + }
  32 + })
  33 + });
26 initSelect(params); 34 initSelect(params);
27 } 35 }
28 }); 36 });
@@ -58,8 +66,8 @@ $(function(){ @@ -58,8 +66,8 @@ $(function(){
58 PublicFunctions.getStationRouteInfo(p,function(array) { 66 PublicFunctions.getStationRouteInfo(p,function(array) {
59 // 定义路段路由长度、渲染拼音检索下拉框格式数据. 67 // 定义路段路由长度、渲染拼音检索下拉框格式数据.
60 var len_ = array.length,paramsD = new Array(); 68 var len_ = array.length,paramsD = new Array();
  69 +// paramsD.push({'id':'','text':'请选择...'});
61 if(len_>0) { 70 if(len_>0) {
62 - paramsD.push({'id':'','text':'请选择...'});  
63 // 遍历. 71 // 遍历.
64 $.each(array, function(i, g){ 72 $.each(array, function(i, g){
65 // 判断. 73 // 判断.
src/main/resources/static/pages/base/station/js/add-form-reload.js
@@ -25,6 +25,7 @@ @@ -25,6 +25,7 @@
25 $('#destroySelect').val('0'); 25 $('#destroySelect').val('0');
26 PublicFunctions.getLineAllInfo(function(array,compD) { 26 PublicFunctions.getLineAllInfo(function(array,compD) {
27 var len_ = array.length,paramsD = new Array(); 27 var len_ = array.length,paramsD = new Array();
  28 +// paramsD.push({'id':'','text':'请选择...'});
28 if(len_>0) { 29 if(len_>0) {
29 $.each(array, function(i, g){ 30 $.each(array, function(i, g){
30 if(g.name!='' || g.name != null) { 31 if(g.name!='' || g.name != null) {
src/main/resources/static/pages/base/station/js/add-form-wizard.js
@@ -36,7 +36,7 @@ var FormWizard = function() { @@ -36,7 +36,7 @@ var FormWizard = function() {
36 'directions' : {required : true,},// 站点方向 必填项 36 'directions' : {required : true,},// 站点方向 必填项
37 'bJwpoints' : {required : true,},// 经纬度坐标点 必填项 37 'bJwpoints' : {required : true,},// 经纬度坐标点 必填项
38 'shapesType' : {required : true,},// 范围图形类型 必填项 38 'shapesType' : {required : true,},// 范围图形类型 必填项
39 - 'radius': {required : true,},// 圆形半径 39 + 'radius': {required : true, number : true,},// 圆形半径
40 'destroy' : {required : true,},// 是否撤销 必填项. 40 'destroy' : {required : true,},// 是否撤销 必填项.
41 'toTime' : {number : true,},// 路段时长 必须输入合法的数字(负数,小数)。 41 'toTime' : {number : true,},// 路段时长 必须输入合法的数字(负数,小数)。
42 'distances' : {number : true,},// 路段时长 必须输入合法的数字(负数,小数)。 42 'distances' : {number : true,},// 路段时长 必须输入合法的数字(负数,小数)。
src/main/resources/static/pages/base/station/js/station-list-edit.js
@@ -54,7 +54,7 @@ @@ -54,7 +54,7 @@
54 'stationRouteCode' : {isStart : true},// 站点序号 54 'stationRouteCode' : {isStart : true},// 站点序号
55 'bJwpoints' : {required : true},// 经纬度坐标点 必填项 55 'bJwpoints' : {required : true},// 经纬度坐标点 必填项
56 'shapesType' : {required : true},// 几何图形类型 必填项 56 'shapesType' : {required : true},// 几何图形类型 必填项
57 - 'radius' : {required : true},// 圆形半径 必填项 57 + 'radius' : {required : true, number : true,},// 圆形半径 必填项
58 'destroy' : {required : true},// 是否撤销 必填项 58 'destroy' : {required : true},// 是否撤销 必填项
59 'toTime' : {number : true},// 到站时间 必须输入合法的数字(负数,小数)。 59 'toTime' : {number : true},// 到站时间 必须输入合法的数字(负数,小数)。
60 'distances' : {number : true},// 到站距离 // 到站距离 60 'distances' : {number : true},// 到站距离 // 到站距离
src/main/resources/static/pages/base/station/js/station-positions-function.js
@@ -150,6 +150,8 @@ var PositionsPublicFunctions = function () { @@ -150,6 +150,8 @@ var PositionsPublicFunctions = function () {
150 $('#toTimeInput').val(stationObj.stationRouteToTime); 150 $('#toTimeInput').val(stationObj.stationRouteToTime);
151 // 到站距离 151 // 到站距离
152 $('#distancesInput').val(stationObj.stationRouteDistances); 152 $('#distancesInput').val(stationObj.stationRouteDistances);
  153 + // 版本号
  154 + $('#versionsInput').val(stationObj.stationRouteVersions);
153 // 描述/说明 155 // 描述/说明
154 $('#descriptionsTextarea').val(stationObj.stationRouteDescriptions); 156 $('#descriptionsTextarea').val(stationObj.stationRouteDescriptions);
155 }, 157 },
@@ -194,6 +196,8 @@ var PositionsPublicFunctions = function () { @@ -194,6 +196,8 @@ var PositionsPublicFunctions = function () {
194 $('#toTimeInput').val(stationObj.stationRouteToTime); 196 $('#toTimeInput').val(stationObj.stationRouteToTime);
195 // 到站距离 197 // 到站距离
196 $('#distancesInput').val(stationObj.stationRouteDistances); 198 $('#distancesInput').val(stationObj.stationRouteDistances);
  199 + // 版本号
  200 + $('#versionsInput').val(stationObj.stationRouteVersions);
197 // 描述/说明 201 // 描述/说明
198 $('#descriptionsTextarea').val(stationObj.stationRouteDescriptions); 202 $('#descriptionsTextarea').val(stationObj.stationRouteDescriptions);
199 }, 203 },
src/main/resources/static/pages/base/station/list_edit.html
@@ -241,7 +241,7 @@ @@ -241,7 +241,7 @@
241 <label class="control-label col-md-5"><span class="required"> </span> 版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: 241 <label class="control-label col-md-5"><span class="required"> </span> 版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
242 </label> 242 </label>
243 <div class="col-md-4"> 243 <div class="col-md-4">
244 - <input type="text" class="form-control" name="versions" > 244 + <input type="text" class="form-control" name="versions" id="versionsInput" Readonly>
245 </div> 245 </div>
246 </div> 246 </div>
247 </div> 247 </div>
src/main/resources/static/pages/base/stationroute/add.html
@@ -173,7 +173,7 @@ @@ -173,7 +173,7 @@
173 <div class="form-group"> 173 <div class="form-group">
174 <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label> 174 <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
175 <div class="col-md-6"> 175 <div class="col-md-6">
176 - <input type="text" class="form-control" name="versions" value='1' Readonly> 176 + <input type="text" class="form-control" name="versions" id='versionsInput' Readonly>
177 </div> 177 </div>
178 </div> 178 </div>
179 </div> 179 </div>
@@ -236,6 +236,15 @@ $(&#39;#add_station_mobal&#39;).on(&#39;AddStationMobal.show&#39;, function(e, addMap,ajaxd,stao @@ -236,6 +236,15 @@ $(&#39;#add_station_mobal&#39;).on(&#39;AddStationMobal.show&#39;, function(e, addMap,ajaxd,stao
236 $('#radiusInput').val(Station.radius); 236 $('#radiusInput').val(Station.radius);
237 // 是否撤销 237 // 是否撤销
238 $('#destroySelect').val(0); 238 $('#destroySelect').val(0);
  239 + // 版本号
  240 + $.get('/lineVersions/findByLineId',{'lineId':Line.id},function(lineVersions){
  241 + $.each(lineVersions,function(){
  242 + if (this.status == 1) {
  243 + $('#versionsInput').val(this.versions);
  244 + }
  245 + })
  246 + });
  247 +
239 var initzdlyP = {'line.id_eq':Line.id,'destroy_eq':0,'directions_eq':Station.dir}; 248 var initzdlyP = {'line.id_eq':Line.id,'destroy_eq':0,'directions_eq':Station.dir};
240 initSelect(initzdlyP); 249 initSelect(initzdlyP);
241 }); 250 });
src/main/resources/static/pages/base/stationroute/edit.html
@@ -171,7 +171,7 @@ @@ -171,7 +171,7 @@
171 <div class="form-group"> 171 <div class="form-group">
172 <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label> 172 <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
173 <div class="col-md-6"> 173 <div class="col-md-6">
174 - <input type="text" class="form-control" name="versions" value='1' Readonly> 174 + <input type="text" class="form-control" name="versions" id='versionsInput' Readonly>
175 </div> 175 </div>
176 </div> 176 </div>
177 </div> 177 </div>
src/main/resources/static/pages/base/stationroute/js/stationroute-list-function.js
@@ -277,7 +277,6 @@ var PublicFunctions = function () { @@ -277,7 +277,6 @@ var PublicFunctions = function () {
277 277
278 /** @param directionV_ :方向 */ 278 /** @param directionV_ :方向 */
279 stationRevoke : function(directionV_) { 279 stationRevoke : function(directionV_) {
280 - debugger  
281 // 获取树选中节点对象 280 // 获取树选中节点对象
282 var obj = PublicFunctions.getCurrSelNode(directionV_); 281 var obj = PublicFunctions.getCurrSelNode(directionV_);
283 // 是否选中,选中节点是否为站点 282 // 是否选中,选中节点是否为站点
@@ -377,6 +376,8 @@ var PublicFunctions = function () { @@ -377,6 +376,8 @@ var PublicFunctions = function () {
377 $('#toTimeInput').val(editStationParmas.stationRouteToTime); 376 $('#toTimeInput').val(editStationParmas.stationRouteToTime);
378 // 到站距离 377 // 到站距离
379 $('#distancesInput').val(editStationParmas.stationRouteDistances); 378 $('#distancesInput').val(editStationParmas.stationRouteDistances);
  379 + // 线路版本号
  380 + $('#versionsInput').val(editStationParmas.stationRouteVersions);
380 // 描述/说明 381 // 描述/说明
381 $('#descriptionsTextarea').val(editStationParmas.stationRouteDescriptions); 382 $('#descriptionsTextarea').val(editStationParmas.stationRouteDescriptions);
382 }, 383 },
src/main/resources/static/pages/base/timesmodel/gantt.html
@@ -121,7 +121,7 @@ @@ -121,7 +121,7 @@
121 <script src="/pages/base/timesmodel/js/base-fun.js"></script> 121 <script src="/pages/base/timesmodel/js/base-fun.js"></script>
122 <script src="/pages/base/timesmodel/js/v2/ParameterObj.js"></script> 122 <script src="/pages/base/timesmodel/js/v2/ParameterObj.js"></script>
123 <script src="/pages/base/timesmodel/js/v2/core/InternalBcObj.js"></script> 123 <script src="/pages/base/timesmodel/js/v2/core/InternalBcObj.js"></script>
124 -<script src="/pages/base/timesmodel/js/v2/core/InternalGroupBcObj.js"></script> 124 +<script src="/pages/base/timesmodel/js/v2/core/InternalGroupObj.js"></script>
125 <script src="/pages/base/timesmodel/js/v2/core/InternalLpObj.js"></script> 125 <script src="/pages/base/timesmodel/js/v2/core/InternalLpObj.js"></script>
126 <script src="/pages/base/timesmodel/js/v2/core/InternalScheduleObj.js"></script> 126 <script src="/pages/base/timesmodel/js/v2/core/InternalScheduleObj.js"></script>
127 <script src="/pages/base/timesmodel/js/v2/main_v2.js"></script> 127 <script src="/pages/base/timesmodel/js/v2/main_v2.js"></script>
src/main/resources/static/pages/base/timesmodel/js/base-fun.js
@@ -797,44 +797,44 @@ var BaseFun = function() { @@ -797,44 +797,44 @@ var BaseFun = function() {
797 var temp = []; 797 var temp = [];
798 temp.push(allLMapBc[0]); 798 temp.push(allLMapBc[0]);
799 console.log(temp); 799 console.log(temp);
800 - return {'json':temp,'bxrcgs':null}; 800 + //return {'json':temp,'bxrcgs':null};
801 801
802 - //// 第二步 纵向调整  
803 - //baseF.evenStartDepartSpace(allLMapBc , dataMap);  
804 - ////return {'json':allLMapBc,'bxrcgs':null};  
805 - //  
806 - //// 第三步 剔除首末班车以外的班次,并确认首末班车.  
807 - //var markArray = baseF.markFirstAndLastBusAlsoDietNotInRangeBc(allLMapBc , dataMap);  
808 - ////return {'json':markArray,'bxrcgs':null};  
809 - //// 第四步 横向调整  
810 - //baseF.resizeByPitStopTime(cara , markArray , dataMap); 802 + // 第二步 纵向调整
  803 + baseF.evenStartDepartSpace(allLMapBc , dataMap);
  804 + //return {'json':allLMapBc,'bxrcgs':null};
  805 +
  806 + // 第三步 剔除首末班车以外的班次,并确认首末班车.
  807 + var markArray = baseF.markFirstAndLastBusAlsoDietNotInRangeBc(allLMapBc , dataMap);
  808 + //return {'json':markArray,'bxrcgs':null};
  809 + // 第四步 横向调整
  810 + baseF.resizeByPitStopTime(cara , markArray , dataMap);
  811 + //return {'json':markArray,'bxrcgs':null};
  812 + /**
  813 + * 第五步 把班型合理的分配到各个路牌上.
  814 + *
  815 + * 切割班型/人次/配车数 字符串 为 数组对象.
  816 + *
  817 + * 把班型分配到对应的具体路牌上.
  818 + */
  819 + // 切割班型/人次/配车数 字符串 为 数组对象.
  820 + var list = baseF.getBxRcListCollection(map.bxrc);
  821 + // 把班型分配到对应的具体路牌上.
  822 + baseF.bxAlloTotLp(list,cara);
811 ////return {'json':markArray,'bxrcgs':null}; 823 ////return {'json':markArray,'bxrcgs':null};
812 - ///**  
813 - // * 第五步 把班型合理的分配到各个路牌上.  
814 - // *  
815 - // * 切割班型/人次/配车数 字符串 为 数组对象.  
816 - // *  
817 - // * 把班型分配到对应的具体路牌上.  
818 - // */  
819 - //// 切割班型/人次/配车数 字符串 为 数组对象.  
820 - //var list = baseF.getBxRcListCollection(map.bxrc);  
821 - //// 把班型分配到对应的具体路牌上.  
822 - //baseF.bxAlloTotLp(list,cara);  
823 - //////return {'json':markArray,'bxrcgs':null};  
824 - ////  
825 - ////  
826 - //// 第六步 抽车来满足工时.  
827 - //var tempA = baseF.abstractCar(list , markArray , cara , saa , dataMap , map);  
828 - ////return {'json':tempA,'bxrcgs':null};  
829 - //// 第七步 确定吃饭时间.  
830 - //if (map.cfdd) { // NEW,没有选择吃饭地点,不设定吃饭班次  
831 - // baseF.markeEatTime(list , tempA , cara , saa , dataMap ,map);  
832 - //}  
833 - //baseF.resizeByPitStopTime(cara , tempA , dataMap);  
834 - //baseF.updfcno01(tempA,0);  
835 - ////return {'json':tempA,'bxrcgs':null};  
836 - //// 确定进出场、早晚例保时间.并返回班次数组集合  
837 - //return {'json':baseF.addInOutFieldBc(cara,tempA,dataMap,saa,map),'bxrcgs':null}; 824 + //
  825 + //
  826 + // 第六步 抽车来满足工时.
  827 + var tempA = baseF.abstractCar(list , markArray , cara , saa , dataMap , map);
  828 + //return {'json':tempA,'bxrcgs':null};
  829 + // 第七步 确定吃饭时间.
  830 + if (map.cfdd) { // NEW,没有选择吃饭地点,不设定吃饭班次
  831 + baseF.markeEatTime(list , tempA , cara , saa , dataMap ,map);
  832 + }
  833 + baseF.resizeByPitStopTime(cara , tempA , dataMap);
  834 + baseF.updfcno01(tempA,0);
  835 + //return {'json':tempA,'bxrcgs':null};
  836 + // 确定进出场、早晚例保时间.并返回班次数组集合
  837 + return {'json':baseF.addInOutFieldBc(cara,tempA,dataMap,saa,map),'bxrcgs':null};
838 }, 838 },
839 839
840 markeEatTime : function(list , markArray , cara , saa , dataMap ,map) { 840 markeEatTime : function(list , markArray , cara , saa , dataMap ,map) {
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalBcObj.js
1 /** 1 /**
2 * 内部班次对象。 2 * 内部班次对象。
3 - * @constructor 3 + * @param lpObj 内部路牌对象
  4 + * @param groupObj 内部圈对象
  5 + * @param otherParamObj 其他参数对象
  6 + * @constructor InternalBcObj
4 */ 7 */
5 var InternalBcObj = function( 8 var InternalBcObj = function(
6 - bcType, // 班次类型(normal,in,out等)  
7 - isUp, // boolean是否上下行  
8 - lp, // 路牌标识符  
9 - fcno, // 发车顺序号  
10 - fcTimeObj, // 发车时间对象  
11 - bclc, // 班次里程  
12 - bcsj, // 班次历时  
13 - arrtime, // 到达时间对象  
14 - stoptime, // 停站时间  
15 - tccid, // 停车场id  
16 - ttinfoid, // 时刻表id  
17 - xl, // 线路id  
18 - qdzid, // 起点站id  
19 - zdzid // 终点站id 9 + lpObj, // InternalLpObj路牌对象
  10 + otherParamObj // 班次其他参数对象
20 ) { 11 ) {
  12 + // 简单验证
  13 + if (!lpObj) {
  14 + throw "new InternalBcObj 路牌对象为空";
  15 + }
  16 + if (!otherParamObj) {
  17 + throw "new InternalBcObj 其他参数对象为空"
  18 + }
  19 +
  20 + // 内部重要属性
  21 + this._$$_internal_lp_obj = lpObj; // 班次所属的路牌对象(横轴)
  22 + // 之后会设定
  23 + this._$$_internal_group_obj; // 班次所属的圈对象(纵轴)
  24 +
21 // 属性重新复制一遍,加前缀 _$_ 表示内部属性,不要直接访问k 25 // 属性重新复制一遍,加前缀 _$_ 表示内部属性,不要直接访问k
22 // 外部函数使用 prototype 方式 26 // 外部函数使用 prototype 方式
23 - this._$_bcType = bcType;  
24 - this._$_isUp = isUp;  
25 - this._$_lp = lp;  
26 - this._$_fcno = fcno;  
27 - this._$_fcsjObj = moment(fcTimeObj);  
28 - this._$_bclc = bclc;  
29 - this._$_bcsj = bcsj;  
30 - this._$_arrtime = arrtime;  
31 - this._$_stoptime = stoptime;  
32 - this._$_tccid = tccid;  
33 - this._$_ttinfoid = ttinfoid;  
34 - this._$_xlid = xl;  
35 - this._$_qdzid = qdzid;  
36 - this._$_zdzid = zdzid; 27 + this._$_bcType = otherParamObj.bcType; // 班次类型(normal,in,out等)
  28 + this._$_isUp = otherParamObj.isUp; // boolean是否上下行
  29 + this._$_fcno = otherParamObj.fcno; // 发车顺序号
  30 + this._$_fcsjObj = moment(otherParamObj.fcTimeObj); // 发车时间对象
  31 + this._$_bclc = otherParamObj.bclc; // 班次里程
  32 + this._$_bcsj = otherParamObj.bcsj; // 班次历时
  33 + this._$_arrtime = otherParamObj.arrtime; // 到达时间对象
  34 + this._$_stoptime = otherParamObj.stoptime; // 停站时间
  35 + this._$_tccid = otherParamObj.tccid; // 停车场id
  36 + this._$_ttinfoid = otherParamObj.ttinfoid; // 时刻表id
  37 + this._$_xlid = otherParamObj.xl; // 线路id
  38 + this._$_qdzid = otherParamObj.qdzid; // 起点站id
  39 + this._$_zdzid = otherParamObj.zdzid; // 终点站id
37 40
38 }; 41 };
39 42
  43 +//------------------- get/set 方法 -------------------//
  44 +
  45 +/**
  46 + * 设置路牌对象。
  47 + * @param lpObj InternalLpObj路牌对象
  48 + */
  49 +InternalBcObj.prototype.setLp = function(lpObj) {
  50 + this._$$_internal_lp_obj = lpObj;
  51 +};
40 /** 52 /**
41 - * 设置路牌标号。  
42 - * @param lpNo 53 + * 设置圈对象。
  54 + * @param groupObj
43 */ 55 */
44 -InternalBcObj.prototype.setLp = function(lpNo) {  
45 - this._$_lp = lpNo; 56 +InternalBcObj.prototype.setGroup = function(groupObj) {
  57 + this._$$_internal_group_obj = groupObj;
46 }; 58 };
47 59
48 /** 60 /**
@@ -80,16 +92,19 @@ InternalBcObj.prototype.getBcTime = function() { @@ -80,16 +92,19 @@ InternalBcObj.prototype.getBcTime = function() {
80 InternalBcObj.prototype.getStopTime = function() { 92 InternalBcObj.prototype.getStopTime = function() {
81 return this._$_stoptime; 93 return this._$_stoptime;
82 }; 94 };
  95 +
  96 +//---------------------- 其他方法 -------------------------//
  97 +
83 /** 98 /**
84 * 转换成显示用班次对象。 99 * 转换成显示用班次对象。
85 * @returns {{}} 100 * @returns {{}}
86 */ 101 */
87 InternalBcObj.prototype.toGanttBcObj = function() { 102 InternalBcObj.prototype.toGanttBcObj = function() {
88 var _bcObj = { 103 var _bcObj = {
89 - parent: this._$_lp,  
90 - lpNo: this._$_lp, 104 + parent: this._$$_internal_lp_obj.getLpNo(),
  105 + lpNo: this._$$_internal_lp_obj.getLpNo(),
91 lp: null, 106 lp: null,
92 - lpName: this._$_lp, 107 + lpName: this._$$_internal_lp_obj.getLpName(),
93 lpType: '普通路牌', 108 lpType: '普通路牌',
94 bcType: this._$_bcType, 109 bcType: this._$_bcType,
95 fcno: this._$_fcno, 110 fcno: this._$_fcno,
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalGroupBcObj.js renamed to src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalGroupObj.js
@@ -4,11 +4,15 @@ @@ -4,11 +4,15 @@
4 * 一定是从第1圈开始,第0圈表示中标线的第一个班次,是下行班次,则第0圈的上行班次就是空的。 4 * 一定是从第1圈开始,第0圈表示中标线的第一个班次,是下行班次,则第0圈的上行班次就是空的。
5 * @constructor 5 * @constructor
6 */ 6 */
7 -var InternalGroupBcObj = function( 7 +var InternalGroupObj = function(
  8 + lpObj, // 所属 InternalLpObj 路牌对象
8 isUp, // 是否上行,就是圈以上行开始,还是下行开始 9 isUp, // 是否上行,就是圈以上行开始,还是下行开始
9 bc1, // 第一班次 10 bc1, // 第一班次
10 bc2 // 第二个班次 11 bc2 // 第二个班次
11 ) { 12 ) {
  13 + // 所属内部路牌对象
  14 + this._$$_internal_lp_obj = lpObj;
  15 +
12 this._$_isUp = isUp; 16 this._$_isUp = isUp;
13 17
14 this._$_internalBcArray = []; 18 this._$_internalBcArray = [];
@@ -16,26 +20,39 @@ var InternalGroupBcObj = function( @@ -16,26 +20,39 @@ var InternalGroupBcObj = function(
16 this._$_internalBcArray.push(bc2); 20 this._$_internalBcArray.push(bc2);
17 }; 21 };
18 22
19 -InternalGroupBcObj.prototype.getBc1 = function() { 23 +//------------------------ get/set 方法 ------------------------//
  24 +
  25 +InternalGroupObj.prototype.getBc1 = function() {
20 return this._$_internalBcArray[0]; 26 return this._$_internalBcArray[0];
21 }; 27 };
22 -InternalGroupBcObj.prototype.getBc2 = function() { 28 +InternalGroupObj.prototype.getBc2 = function() {
23 return this._$_internalBcArray[1]; 29 return this._$_internalBcArray[1];
24 }; 30 };
25 31
26 -InternalGroupBcObj.prototype.setBc1 = function(bc) { 32 +InternalGroupObj.prototype.setBc1 = function(bc) {
27 this._$_internalBcArray[0] = bc; 33 this._$_internalBcArray[0] = bc;
28 }; 34 };
29 -InternalGroupBcObj.prototype.setBc2 = function(bc) { 35 +InternalGroupObj.prototype.removeBc1 = function() {
  36 + this._$_internalBcArray[0] = undefined;
  37 +};
  38 +InternalGroupObj.prototype.setBc2 = function(bc) {
30 this._$_internalBcArray[1] = bc; 39 this._$_internalBcArray[1] = bc;
31 }; 40 };
32 -InternalGroupBcObj.prototype.setLp = function(lp) { 41 +InternalGroupObj.prototype.removeBc2 = function() {
  42 + this._$_internalBcArray[1] = undefined;
  43 +};
  44 +InternalGroupObj.prototype.setLp = function(lpObj) {
  45 + this._$$_internal_lp_obj = lpObj; // InternalLpObj 对象
  46 +
33 var bc1 = this._$_internalBcArray[0]; 47 var bc1 = this._$_internalBcArray[0];
34 var bc2 = this._$_internalBcArray[1]; 48 var bc2 = this._$_internalBcArray[1];
35 if (bc1) { 49 if (bc1) {
36 - bc1.setLp(lp); 50 + bc1.setLp(lpObj);
37 } 51 }
38 if (bc2) { 52 if (bc2) {
39 - bc2.setLp(lp); 53 + bc2.setLp(lpObj);
40 } 54 }
41 -};  
42 \ No newline at end of file 55 \ No newline at end of file
  56 +};
  57 +
  58 +
  59 +
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalLpObj.js
@@ -3,11 +3,13 @@ @@ -3,11 +3,13 @@
3 * @constructor 3 * @constructor
4 */ 4 */
5 var InternalLpObj = function( 5 var InternalLpObj = function(
6 - lp, // 路牌编号 6 + orilpObj, // 原始路牌对象
7 qCount, // 总共多少圈 7 qCount, // 总共多少圈
8 isUp // 圈是以上行开始还是下行开始 8 isUp // 圈是以上行开始还是下行开始
9 ) { 9 ) {
10 - this._$_lp = lp; 10 + // TODO:原始路牌对象(这个路牌是对接外部gantt图像,以后有机会改了)
  11 + this._$$_orign_lp_obj = orilpObj;
  12 +
11 this._$_isUp = isUp; 13 this._$_isUp = isUp;
12 14
13 // 距离上一个路牌的最小发车间隔时间 15 // 距离上一个路牌的最小发车间隔时间
@@ -26,19 +28,85 @@ var InternalLpObj = function( @@ -26,19 +28,85 @@ var InternalLpObj = function(
26 28
27 var i; 29 var i;
28 for (i = 0; i < this._$_qCount; i++) { 30 for (i = 0; i < this._$_qCount; i++) {
29 - this._$_groupBcArray[i] = new InternalGroupBcObj(  
30 - this._$_isUp, undefined, undefined); 31 + this._$_groupBcArray[i] = new InternalGroupObj(
  32 + this, this._$_isUp, undefined, undefined);
31 } 33 }
32 34
33 // 班型的相关变量 35 // 班型的相关变量
34 this._$_bx_isLb = false; // 是否连班 36 this._$_bx_isLb = false; // 是否连班
35 this._$_bx_isfb = false; // 是否分班 37 this._$_bx_isfb = false; // 是否分班
36 this._$_bx_isfb_5_2 = false; // 是否5休2分班 38 this._$_bx_isfb_5_2 = false; // 是否5休2分班
  39 + this._$_bx_desc; // 班型描述(默认为路牌编号)
37 40
38 // TODO: 41 // TODO:
39 42
40 }; 43 };
41 44
  45 +//------------------- get/set 方法 -------------------//
  46 +
  47 +/**
  48 + * 获取圈
  49 + * @param qIndex 圈index
  50 + */
  51 +InternalLpObj.prototype.getGroup = function(qIndex) {
  52 + return this._$_groupBcArray[qIndex];
  53 +};
  54 +
  55 +/**
  56 + * 获取班次。
  57 + * @param qIndex 第几圈
  58 + * @param bcIndex 第几个班次
  59 + */
  60 +InternalLpObj.prototype.getBc = function(qIndex, bcIndex) {
  61 + var group = this._$_groupBcArray[qIndex];
  62 + var bc;
  63 + if (bcIndex == 0) {
  64 + bc = group.getBc1();
  65 + } else if (bcIndex == 1) {
  66 + bc = group.getBc2();
  67 + }
  68 + return bc;
  69 +};
  70 +
  71 +/**
  72 + * 在具体位置设置班次。
  73 + * @param qIndex 第几圈
  74 + * @param bcIndex 第几个班次
  75 + * @param bc 班次对象
  76 + */
  77 +InternalLpObj.prototype.setBc = function(qIndex, bcIndex, bc) {
  78 + var group = this._$_groupBcArray[qIndex];
  79 + if (bcIndex == 0) {
  80 + group.setBc1(bc);
  81 + bc.setGroup(group);
  82 + } else if (bcIndex == 1) {
  83 + group.setBc2(bc);
  84 + bc.setGroup(group);
  85 + }
  86 +};
  87 +
  88 +/**
  89 + * 设置原始路牌对象。
  90 + * @param lpObj 原始路牌对象
  91 + */
  92 +InternalLpObj.prototype.setLp = function(lpObj) {
  93 + this._$$_orign_lp_obj = lpObj;
  94 + var i;
  95 + var group;
  96 + for (i = 0; i < this._$_groupBcArray.length; i++) {
  97 + group = this._$_groupBcArray[i];
  98 + if (group) {
  99 + group.setLp(this); // 圈和班次保存都是 InternalLpObj 对象
  100 + }
  101 + }
  102 +};
  103 +
  104 +InternalLpObj.prototype.getLpNo = function() {
  105 + return this._$$_orign_lp_obj.lpNo;
  106 +};
  107 +InternalLpObj.prototype.getLpName = function() {
  108 + return this._$$_orign_lp_obj.lpName;
  109 +};
42 InternalLpObj.prototype.setBxFb5_2 = function(fb) { 110 InternalLpObj.prototype.setBxFb5_2 = function(fb) {
43 this._$_bx_isfb_5_2 = fb; 111 this._$_bx_isfb_5_2 = fb;
44 }; 112 };
@@ -60,6 +128,24 @@ InternalLpObj.prototype.isBxFb = function() { @@ -60,6 +128,24 @@ InternalLpObj.prototype.isBxFb = function() {
60 }; 128 };
61 129
62 /** 130 /**
  131 + * 设置路牌的班型描述(最终是设置班次的路牌名字)。
  132 + * @param desc 描述
  133 + */
  134 +InternalLpObj.prototype.setBxDesc = function(desc) {
  135 + // 最终原始路牌的名字
  136 + this._$$_orign_lp_obj.lpName = desc + "_" + this._$$_orign_lp_obj.lpNo;
  137 + // 内部对象的班型描述
  138 + this._$_bx_desc = desc;
  139 +};
  140 +/**
  141 + * 获取版型描述
  142 + * @returns string
  143 + */
  144 +InternalLpObj.prototype.getBxDesc = function() {
  145 + return this._$_bx_desc;
  146 +};
  147 +
  148 +/**
63 * 设置纵向最小发车间隔时间。 149 * 设置纵向最小发车间隔时间。
64 * @param v 150 * @param v
65 */ 151 */
@@ -75,6 +161,8 @@ InternalLpObj.prototype.getVerticalMinIntervalTime = function() { @@ -75,6 +161,8 @@ InternalLpObj.prototype.getVerticalMinIntervalTime = function() {
75 return this._$_minVerticalIntervalTime; 161 return this._$_minVerticalIntervalTime;
76 }; 162 };
77 163
  164 +//-------------------- 班次操作方法(查询,统计,删除) -----------------------//
  165 +
78 /** 166 /**
79 * 返回总共班次数。 167 * 返回总共班次数。
80 */ 168 */
@@ -98,38 +186,6 @@ InternalLpObj.prototype.getBcCount = function() { @@ -98,38 +186,6 @@ InternalLpObj.prototype.getBcCount = function() {
98 }; 186 };
99 187
100 /** 188 /**
101 - * 获取最小(最早)班次对象。  
102 - * @return [{圈index},{班次index}]  
103 - */  
104 -InternalLpObj.prototype.getMinBcObjPosition = function() {  
105 - var i;  
106 - var bIndex = [];  
107 - for (i = 0; i < this._$_groupBcArray.length; i++) {  
108 - if (this._$_groupBcArray[i].getBc1()) {  
109 - bIndex.push(i);  
110 - bIndex.push(0);  
111 - break;  
112 - }  
113 - if (this._$_groupBcArray[i].getBc2()) {  
114 - bIndex.push(i);  
115 - bIndex.push(1);  
116 - break;  
117 - }  
118 - }  
119 - return bIndex;  
120 -};  
121 -  
122 -// TODO  
123 -  
124 -/**  
125 - *  
126 - *  
127 - */  
128 -InternalLpObj.prototype.calcuLpBx = function() {  
129 -  
130 -};  
131 -  
132 -/**  
133 * 返回班次列表,过滤空的班次,将所有存在的班次连成连续的对象数组返回。 189 * 返回班次列表,过滤空的班次,将所有存在的班次连成连续的对象数组返回。
134 * @returns arrays (InternalBcObj) 190 * @returns arrays (InternalBcObj)
135 */ 191 */
@@ -149,149 +205,60 @@ InternalLpObj.prototype.getBcArray = function() { @@ -149,149 +205,60 @@ InternalLpObj.prototype.getBcArray = function() {
149 }; 205 };
150 206
151 /** 207 /**
152 - * 从指定开始时间到结束时间创建不间断班次(连班),并初始化路牌  
153 - * 注意,之前有班次会删除后再创建。  
154 - * @param startTime 开始时间  
155 - * @param endTime 结束时间  
156 - * @param isUp 第一个班次是上行还是下行  
157 - * @param fromQ 从第几圈开始加入  
158 - * @param paramObj 参数对象  
159 - * @param factory 工厂对象  
160 - */  
161 -InternalLpObj.prototype.initDataFromTimeToTime = function(  
162 - startTime,  
163 - endTime,  
164 - isUp,  
165 - fromQ,  
166 - paramObj,  
167 - factory) {  
168 -  
169 - var bcData = []; // 班次数组  
170 - var bcObj;  
171 - var kssj = startTime;  
172 - var fcno = 1; // 发车顺序号  
173 - var bcCount = 1; // 班次数  
174 - do {  
175 - bcObj = factory.createBcObj(  
176 - "normal", isUp, this._$_lp, fcno, kssj, paramObj);  
177 - bcData.push(bcObj);  
178 -  
179 - kssj = paramObj.addMinute(kssj, bcObj.getBcTime() + bcObj.getStopTime());  
180 - fcno ++;  
181 - bcCount ++;  
182 - isUp = !isUp;  
183 - } while(kssj.isBefore(endTime));  
184 - bcCount--;  
185 -  
186 - if (bcCount > 0 && bcData[bcCount - 1].getArrTimeObj().isAfter(endTime)) {  
187 - // 如果最后一个班次的到达时间超过结束时间,也要去除  
188 - bcData.splice(bcCount - 1, 1);  
189 - }  
190 -  
191 - this.initDataFromLbBcArray(bcData, fromQ);  
192 -  
193 -};  
194 -  
195 -/**  
196 - * 使用连班的班次数组初始化路牌。  
197 - * @param bcArray 连班班次数组  
198 - * @param fromQ 从第几圈开始加入 208 + * 获取最小(最早)班次对象。
  209 + * @returns [{圈index},{班次index}]
199 */ 210 */
200 -InternalLpObj.prototype.initDataFromLbBcArray = function(  
201 - bcArray,  
202 - fromQ  
203 -) {  
204 - // 第一班次是上行还是下行  
205 - var isUp = bcArray[0].isUp();  
206 -  
207 - if (bcArray.length > 0 && fromQ < this._$_qCount) {  
208 - // 构造圈数  
209 - if (isUp != this._$_isUp) {  
210 - // 如果方向不一致,意味着第一个班次是半圈  
211 - // 加半圈,并加在bc2上  
212 - this._$_groupBcArray[fromQ] =  
213 - new InternalGroupBcObj(  
214 - this._$_isUp,  
215 - undefined,  
216 - bcArray.slice(0, 1)[0]  
217 - );  
218 - bcArray.splice(0, 1);  
219 - fromQ ++; 211 +InternalLpObj.prototype.getMinBcObjPosition = function() {
  212 + var i;
  213 + var bIndex = [];
  214 + for (i = 0; i < this._$_groupBcArray.length; i++) {
  215 + if (this._$_groupBcArray[i].getBc1()) {
  216 + bIndex.push(i);
  217 + bIndex.push(0);
  218 + break;
220 } 219 }
221 -  
222 - var qCount1 = Math.floor(bcArray.length / 2); // 需要添加多少圈  
223 - var qCount2 = bcArray.length % 2; // 最后是否有半圈  
224 -  
225 - while (fromQ < this._$_qCount) {  
226 - if (qCount1 > 0) {  
227 - this._$_groupBcArray[fromQ] =  
228 - new InternalGroupBcObj(  
229 - this._$_isUp,  
230 - bcArray.slice(0, 1)[0],  
231 - bcArray.slice(1, 2)[0]  
232 - );  
233 - bcArray.splice(0, 2);  
234 - qCount1 --;  
235 - } else if (qCount2 > 0) {  
236 - // 加半圈,并加在bc1上  
237 - this._$_groupBcArray[fromQ] =  
238 - new InternalGroupBcObj(  
239 - this._$_isUp,  
240 - bcArray.slice(0, 1)[0],  
241 - undefined  
242 - );  
243 - } else {  
244 - break;  
245 - }  
246 -  
247 - fromQ ++; 220 + if (this._$_groupBcArray[i].getBc2()) {
  221 + bIndex.push(i);
  222 + bIndex.push(1);
  223 + break;
248 } 224 }
249 } 225 }
  226 + return bIndex;
250 }; 227 };
251 228
252 /** 229 /**
253 - * 获取班次。  
254 - * @param qIndex 第几圈  
255 - * @param bcIndex 第几个班次 230 + * 获取最大(最晚)班次对象。
  231 + * @returns [{圈index},{班次index}]
256 */ 232 */
257 -InternalLpObj.prototype.getBc = function(qIndex, bcIndex) {  
258 - var group = this._$_groupBcArray[qIndex];  
259 - var bc;  
260 - if (bcIndex == 0) {  
261 - bc = group.getBc1();  
262 - } else if (bcIndex == 1) {  
263 - bc = group.getBc2(); 233 +InternalLpObj.prototype.getMaxBcObjPosition = function() {
  234 + var i;
  235 + var bIndex = [];
  236 + for (i = this._$_groupBcArray.length - 1; i >= 0; i--) {
  237 + if (this._$_groupBcArray[i].getBc2()) {
  238 + bIndex.push(i);
  239 + bIndex.push(1);
  240 + break;
  241 + }
  242 + if (this._$_groupBcArray[i].getBc1()) {
  243 + bIndex.push(i);
  244 + bIndex.push(0);
  245 + break;
  246 + }
264 } 247 }
265 - return bc; 248 + return bIndex;
266 }; 249 };
267 250
268 /** 251 /**
269 - * 再具体位置设置班次。 252 + * 在具体位置移除班次。
270 * @param qIndex 第几圈 253 * @param qIndex 第几圈
271 * @param bcIndex 第几个班次 254 * @param bcIndex 第几个班次
272 - * @param bc 班次对象  
273 */ 255 */
274 -InternalLpObj.prototype.setBc = function(qIndex, bcIndex, bc) { 256 +InternalLpObj.prototype.removeBc = function(qIndex, bcIndex) {
275 var group = this._$_groupBcArray[qIndex]; 257 var group = this._$_groupBcArray[qIndex];
276 if (bcIndex == 0) { 258 if (bcIndex == 0) {
277 - group.setBc1(bc); 259 + group.removeBc1();
278 } else if (bcIndex == 1) { 260 } else if (bcIndex == 1) {
279 - group.setBc2(bc);  
280 - }  
281 -};  
282 -  
283 -/**  
284 - * 设置班次的路牌编号。  
285 - * @param lpNo  
286 - */  
287 -InternalLpObj.prototype.setLp = function(lpNo) {  
288 - var i;  
289 - var group;  
290 - for (i = 0; i < this._$_groupBcArray.length; i++) {  
291 - group = this._$_groupBcArray[i];  
292 - if (group) {  
293 - group.setLp(lpNo);  
294 - } 261 + group.removeBc2();
295 } 262 }
296 }; 263 };
297 264
@@ -389,3 +356,142 @@ InternalLpObj.prototype.getQBcIndexWithFcTime = function( @@ -389,3 +356,142 @@ InternalLpObj.prototype.getQBcIndexWithFcTime = function(
389 return this.getgetQBcIndexWithFcTimeFromGroupArray(fctime, this._$_groupBcArray); 356 return this.getgetQBcIndexWithFcTimeFromGroupArray(fctime, this._$_groupBcArray);
390 }; 357 };
391 358
  359 +//---------------------- 内部数据初始化方法(不同于构造函数)---------------------//
  360 +
  361 +/**
  362 + * 从指定开始时间到结束时间创建不间断班次(连班),并初始化路牌
  363 + * 注意,之前有班次会删除后再创建。
  364 + * @param startTime 开始时间
  365 + * @param endTime 结束时间
  366 + * @param isUp 第一个班次是上行还是下行
  367 + * @param fromQ 从第几圈开始加入
  368 + * @param paramObj 参数对象
  369 + * @param factory 工厂对象
  370 + */
  371 +InternalLpObj.prototype.initDataFromTimeToTime = function(
  372 + startTime,
  373 + endTime,
  374 + isUp,
  375 + fromQ,
  376 + paramObj,
  377 + factory) {
  378 +
  379 + var bcData = []; // 班次数组
  380 + var bcObj;
  381 + var kssj = startTime;
  382 + var fcno = 1; // 发车顺序号
  383 + var bcCount = 1; // 班次数
  384 + do {
  385 + bcObj = factory.createBcObj(
  386 + this, "normal", isUp, fcno, kssj, paramObj); // this就是所属路牌对象
  387 + bcData.push(bcObj);
  388 +
  389 + kssj = paramObj.addMinute(kssj, bcObj.getBcTime() + bcObj.getStopTime());
  390 + fcno ++;
  391 + bcCount ++;
  392 + isUp = !isUp;
  393 + } while(kssj.isBefore(endTime));
  394 + bcCount--;
  395 +
  396 + if (bcCount > 0 && bcData[bcCount - 1].getArrTimeObj().isAfter(endTime)) {
  397 + // 如果最后一个班次的到达时间超过结束时间,也要去除
  398 + bcData.splice(bcCount - 1, 1);
  399 + }
  400 +
  401 + this._initDataFromLbBcArray(bcData, fromQ);
  402 +
  403 +};
  404 +
  405 +/**
  406 + * 使用连班的班次数组初始化路牌(相应的圈会被覆盖)。
  407 + * @param bcArray 连班班次数组
  408 + * @param fromQ 从第几圈开始加入
  409 + */
  410 +InternalLpObj.prototype._initDataFromLbBcArray = function(
  411 + bcArray,
  412 + fromQ
  413 +) {
  414 + var _bc1Obj;
  415 + var _bc2Obj;
  416 + var _qObj;
  417 +
  418 + // 第一班次是上行还是下行
  419 + var isUp = bcArray[0].isUp();
  420 +
  421 + if (bcArray.length > 0 && fromQ < this._$_qCount) {
  422 + // 构造圈数
  423 + if (isUp != this._$_isUp) {
  424 + // 如果方向不一致,意味着第一个班次是半圈
  425 + // 加半圈,并加在bc2上
  426 + _bc2Obj = bcArray.slice(0, 1)[0];
  427 + _qObj = new InternalGroupObj(
  428 + this,
  429 + this._$_isUp,
  430 + undefined,
  431 + _bc2Obj
  432 + );
  433 + _bc2Obj.setGroup(_qObj);
  434 + this._$_groupBcArray[fromQ] = _qObj;
  435 +
  436 + bcArray.splice(0, 1);
  437 + fromQ ++;
  438 + }
  439 +
  440 + var qCount1 = Math.floor(bcArray.length / 2); // 需要添加多少圈
  441 + var qCount2 = bcArray.length % 2; // 最后是否有半圈
  442 +
  443 + while (fromQ < this._$_qCount) {
  444 + if (qCount1 > 0) {
  445 + _bc1Obj = bcArray.slice(0, 1)[0];
  446 + _bc2Obj = bcArray.slice(1, 2)[0];
  447 + _qObj = new InternalGroupObj(
  448 + this,
  449 + this._$_isUp,
  450 + _bc1Obj,
  451 + _bc2Obj
  452 + );
  453 + _bc1Obj.setGroup(_qObj);
  454 + _bc2Obj.setGroup(_qObj);
  455 + this._$_groupBcArray[fromQ] = _qObj;
  456 +
  457 + bcArray.splice(0, 2);
  458 + qCount1 --;
  459 + } else if (qCount2 > 0) {
  460 + // 加半圈,并加在bc1上
  461 + _bc1Obj = bcArray.slice(0, 1)[0];
  462 + _qObj = new InternalGroupObj(
  463 + this,
  464 + this._$_isUp,
  465 + _bc1Obj,
  466 + undefined
  467 + );
  468 + _bc1Obj.setGroup(_qObj);
  469 + this._$_groupBcArray[fromQ] = _qObj;
  470 + } else {
  471 + break;
  472 + }
  473 +
  474 + fromQ ++;
  475 + }
  476 + }
  477 +};
  478 +
  479 +//-------------------------- 其他方法 ----------------------------//
  480 +
  481 +
  482 +// TODO
  483 +
  484 +/**
  485 + *
  486 + *
  487 + */
  488 +InternalLpObj.prototype.calcuLpBx = function() {
  489 +
  490 +};
  491 +
  492 +
  493 +
  494 +
  495 +
  496 +
  497 +
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalScheduleObj.js
@@ -16,6 +16,9 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -16,6 +16,9 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
16 var _internalLpArray = []; // 内部对象数组 16 var _internalLpArray = []; // 内部对象数组
17 17
18 var _initFun1 = function() { // 初始化方法1 18 var _initFun1 = function() { // 初始化方法1
  19 +
  20 + //----------------------- 1、确定上标线的方向,圈的方向 -------------------//
  21 +
19 // 确定_qIsUp,哪个方向的首班车晚就用哪个 22 // 确定_qIsUp,哪个方向的首班车晚就用哪个
20 _qIsUp = _paramObj.getUpFirstDTimeObj().isBefore( 23 _qIsUp = _paramObj.getUpFirstDTimeObj().isBefore(
21 _paramObj.getDownFirstDTimeObj()) ? false : true; 24 _paramObj.getDownFirstDTimeObj()) ? false : true;
@@ -33,27 +36,33 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -33,27 +36,33 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
33 et_IsUp = true; 36 et_IsUp = true;
34 } 37 }
35 38
36 - // 以开始时间,结束时间,构造上标线用连班班次  
37 - var bcData = []; // 班次数组  
38 - var bcObj; 39 + //------------------------ 2、计算总共有多少圈 ------------------------//
  40 +
  41 +
  42 +
  43 + // 以开始时间,结束时间,构造上标线用连班班次发车时间
  44 + var bcFcsjArrays = []; // 班次发车时间对象数组
  45 + var bcArsjArrays = []; // 班次到达时间对象数组
39 var isUp = _qIsUp; // 方向 46 var isUp = _qIsUp; // 方向
40 - var kssj = st;  
41 - var fcno = 1; // 发车顺序号  
42 var bcCount = 1; // 班次数 47 var bcCount = 1; // 班次数
43 - do {  
44 - bcObj = _factory.createBcObj(  
45 - "normal", isUp, _lpArray[0].lpNo, fcno, kssj, paramObj);  
46 - bcData.push(bcObj);  
47 48
48 - kssj = paramObj.addMinute(kssj, bcObj.getBcTime() + bcObj.getStopTime());  
49 - fcno ++; 49 + var _kssj = st; // 开始时间
  50 + var _bcsj = paramObj.calcuTravelTime(_kssj, isUp); // 班次历时
  51 + var _arrsj = paramObj.addMinute(_kssj, _bcsj); // 到达时间
  52 + var _stoptime = paramObj.calcuFixedStopNumber(_arrsj, !isUp); // 停站时间
  53 +
  54 + do {
  55 + bcFcsjArrays.push(_kssj);
  56 + bcArsjArrays.push(_arrsj);
  57 + _kssj = paramObj.addMinute(_kssj, _bcsj + _stoptime);
50 bcCount ++; 58 bcCount ++;
51 isUp = !isUp; 59 isUp = !isUp;
52 - } while(kssj.isBefore(et)); 60 + } while(_kssj.isBefore(et));
53 bcCount--; // 因为先做do,所以总的班次要减1 61 bcCount--; // 因为先做do,所以总的班次要减1
54 - if (bcCount > 0 && bcData[bcCount - 1].getArrTimeObj().isAfter(et)) { 62 + if (bcCount > 0 && bcArsjArrays[bcCount - 1].isAfter(et)) {
55 // 如果最后一个班次的到达时间超过结束时间,也要去除 63 // 如果最后一个班次的到达时间超过结束时间,也要去除
56 - bcData.splice(bcCount - 1, 1); 64 + bcFcsjArrays.splice(bcCount - 1, 1);
  65 + bcArsjArrays.splice(bcCount - 1, 1);
57 bcCount--; 66 bcCount--;
58 } 67 }
59 var _qCount_p1 = Math.floor(bcCount / 2); // 2个班次一圈 68 var _qCount_p1 = Math.floor(bcCount / 2); // 2个班次一圈
@@ -81,13 +90,15 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -81,13 +90,15 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
81 } 90 }
82 } 91 }
83 92
  93 + //------------------------ 3、根据路牌数,圈数创建路牌对象 ----------------------//
  94 +
84 // 创建内部的路牌数组,并把之前的连班路牌添加进上标线路牌中 95 // 创建内部的路牌数组,并把之前的连班路牌添加进上标线路牌中
85 var i; 96 var i;
86 for (i = 0; i < _lpArray.length; i++) { 97 for (i = 0; i < _lpArray.length; i++) {
87 - _internalLpArray.push(  
88 - new InternalLpObj(_lpArray[i].lpNo, _qCount, _qIsUp)); 98 + _internalLpArray.push(new InternalLpObj(_lpArray[i], _qCount, _qIsUp));
89 } 99 }
90 - _internalLpArray[0].initDataFromLbBcArray(bcData, 1); // 上标线从第1圈开始放班次 100 + // 初始化上标线,从第1圈开始
  101 + _internalLpArray[0].initDataFromTimeToTime(bcFcsjArrays[0], et, _qIsUp, 1, _paramObj, _factory);
91 102
92 console.log("//---------------- 行车计划,初始化方法1 start ----------------//"); 103 console.log("//---------------- 行车计划,初始化方法1 start ----------------//");
93 console.log("上行首班车时间:" + _paramObj.getUpFirstDTimeObj().format("HH:mm") + 104 console.log("上行首班车时间:" + _paramObj.getUpFirstDTimeObj().format("HH:mm") +
@@ -101,16 +112,18 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -101,16 +112,18 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
101 }; 112 };
102 113
103 //------------------ 初始化方法2,以及计算关联的内部变量 ----------------// 114 //------------------ 初始化方法2,以及计算关联的内部变量 ----------------//
104 - var _zgfQIndex; // 早高峰车辆从第几圈开始全部发出  
105 - var _zgfBIndex; // 早高峰车辆从第几圈第几个班次全部发出  
106 - var _wgfQIndex; // 晚高峰车辆从第几圈开始全部发出  
107 - var _wgfBIndex; // 晚高峰车辆从第几圈第几个班次全部发出 115 + var _approximate_zgfQIndex; // 预估早高峰车辆从第几圈开始全部发出
  116 + var _approximate_zgfBIndex; // 预估早高峰车辆从第几圈第几个班次开始全部发出(上行或下行)
  117 + var _approximate_wgfQIndex; // 预估晚高峰车辆从第几圈开始全部发出
  118 + var _approximate_wgfBIndex; // 预估晚高峰车辆从第几圈第几个班次开始全部发出(上行或下行)
108 119
109 // 同一圈同一方向班次发车间隔的最小值 120 // 同一圈同一方向班次发车间隔的最小值
110 // 注意:这个值就是用来添加班次的时间增加单位,在后面相关的方法里会具体说明 121 // 注意:这个值就是用来添加班次的时间增加单位,在后面相关的方法里会具体说明
111 var _qbcMinIntervalValue; 122 var _qbcMinIntervalValue;
112 123
113 var _initFun2 = function() { // 初始化方法2 124 var _initFun2 = function() { // 初始化方法2
  125 + //------------------------ 1、预估早高峰全部出车第几圈第几个班次全部出车,计算路牌之间的发车间隔 ------------------//
  126 +
114 // 以上标线为标准,查找离早高峰开始时间最近的班次作为早高峰开始班次 127 // 以上标线为标准,查找离早高峰开始时间最近的班次作为早高峰开始班次
115 // 以这个班次为早高峰起点,全部出车策略 128 // 以这个班次为早高峰起点,全部出车策略
116 var qbcIndexArray = _internalLpArray[0].getQBcIndexWithFcTime( 129 var qbcIndexArray = _internalLpArray[0].getQBcIndexWithFcTime(
@@ -132,11 +145,11 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -132,11 +145,11 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
132 qIndex, 145 qIndex,
133 bIndex, 146 bIndex,
134 _factory.createBcObj( 147 _factory.createBcObj(
  148 + _internalLpArray[i - 1],
135 "normal", startbc.isUp(), 149 "normal", startbc.isUp(),
136 - _lpArray[i - 1].lpNo,  
137 1, _kssj, paramObj) 150 1, _kssj, paramObj)
138 ); 151 );
139 - // 使用早高峰的发车间隔最为路牌纵向最小发车间隔 152 + // 使用早高峰的发车间隔最为路牌纵向最小发车间隔,不能整除的话,小的放在前面的路牌
140 _internalLpArray[i - 1].setVerticalMinIntervalTime(_c1); 153 _internalLpArray[i - 1].setVerticalMinIntervalTime(_c1);
141 } 154 }
142 for (i = 1; i <= _c2; i++) { 155 for (i = 1; i <= _c2; i++) {
@@ -145,16 +158,18 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -145,16 +158,18 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
145 qIndex, 158 qIndex,
146 bIndex, 159 bIndex,
147 _factory.createBcObj( 160 _factory.createBcObj(
  161 + _internalLpArray[_clCount - _c2 + i - 1],
148 "normal", startbc.isUp(), 162 "normal", startbc.isUp(),
149 - _lpArray[_clCount - _c2 + i - 1].lpNo,  
150 1, _kssj, paramObj) 163 1, _kssj, paramObj)
151 ); 164 );
152 - // 使用早高峰的发车间隔最为路牌纵向最小发车间隔 165 + // 使用早高峰的发车间隔最为路牌纵向最小发车间隔,,不能整除的话,大的放在后面的路牌
153 _internalLpArray[_clCount - _c2 + i - 1].setVerticalMinIntervalTime(_c1); 166 _internalLpArray[_clCount - _c2 + i - 1].setVerticalMinIntervalTime(_c1);
154 } 167 }
155 168
156 - _zgfQIndex = qIndex;  
157 - _zgfBIndex = bIndex; 169 + _approximate_zgfQIndex = qIndex;
  170 + _approximate_zgfBIndex = bIndex;
  171 +
  172 + //------------------------ 2、预估晚高峰全部出车第几圈第几个班次全部出车,计算路牌之间的发车间隔 ------------------//
158 173
159 // 以上标线为标准,查找离晚高峰开始时间最近的班次作为晚高峰开始班次 174 // 以上标线为标准,查找离晚高峰开始时间最近的班次作为晚高峰开始班次
160 // 以这个班次为早高峰起点,全部出车策略 175 // 以这个班次为早高峰起点,全部出车策略
@@ -176,8 +191,8 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -176,8 +191,8 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
176 qIndex, 191 qIndex,
177 bIndex, 192 bIndex,
178 _factory.createBcObj( 193 _factory.createBcObj(
  194 + _internalLpArray[i - 1],
179 "normal", startbc.isUp(), 195 "normal", startbc.isUp(),
180 - _lpArray[i - 1].lpNo,  
181 1, _kssj, _paramObj) 196 1, _kssj, _paramObj)
182 ); 197 );
183 } 198 }
@@ -187,20 +202,20 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -187,20 +202,20 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
187 qIndex, 202 qIndex,
188 bIndex, 203 bIndex,
189 _factory.createBcObj( 204 _factory.createBcObj(
  205 + _internalLpArray[_clCount - _c2 + i - 1],
190 "normal", startbc.isUp(), 206 "normal", startbc.isUp(),
191 - _lpArray[_clCount - _c2 + i - 1].lpNo,  
192 1, _kssj, _paramObj) 207 1, _kssj, _paramObj)
193 ); 208 );
194 } 209 }
195 210
196 - _wgfQIndex = qIndex;  
197 - _wgfBIndex = bIndex; 211 + _approximate_wgfQIndex = qIndex;
  212 + _approximate_wgfBIndex = bIndex;
198 _qbcMinIntervalValue = _c1; 213 _qbcMinIntervalValue = _c1;
199 214
200 console.log("//---------------- 行车计划,初始化方法2 start ----------------//"); 215 console.log("//---------------- 行车计划,初始化方法2 start ----------------//");
201 - console.log("早高峰第" + _zgfQIndex + "(index)圈,第" + _zgfBIndex + "(index)班次车辆全部发出");  
202 - console.log("晚高峰第" + _wgfQIndex + "(index)圈,第" + _wgfBIndex + "(index)班次车辆全部发出");  
203 - console.log("同圈同方向班次最小间隔(分钟):" + _qbcMinIntervalValue); 216 + console.log("预估早高峰第" + _approximate_zgfQIndex + "(index)圈,第" + _approximate_zgfBIndex + "(index)班次车辆全部发出");
  217 + console.log("预估晚高峰第" + _approximate_wgfQIndex + "(index)圈,第" + _approximate_wgfBIndex + "(index)班次车辆全部发出");
  218 + console.log("预估同圈同方向班次最小间隔(分钟):" + _qbcMinIntervalValue);
204 console.log("//---------------- 行车计划,初始化方法2 end ----------------//"); 219 console.log("//---------------- 行车计划,初始化方法2 end ----------------//");
205 }; 220 };
206 221
@@ -208,6 +223,8 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -208,6 +223,8 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
208 var _zbx_lpIndex; // 中标线对应第几个路牌 223 var _zbx_lpIndex; // 中标线对应第几个路牌
209 224
210 var _initFun3 = function() { // 初始化方法3 225 var _initFun3 = function() { // 初始化方法3
  226 + //---------------------------- 1、模拟一个中标线,使用临时路牌 ----------------------//
  227 +
211 // 构造中标线 228 // 构造中标线
212 // 中标线开始时间,就是方向的首班车时间 229 // 中标线开始时间,就是方向的首班车时间
213 var st = !_qIsUp ? _paramObj.getUpFirstDTimeObj() : _paramObj.getDownFirstDTimeObj(); 230 var st = !_qIsUp ? _paramObj.getUpFirstDTimeObj() : _paramObj.getDownFirstDTimeObj();
@@ -221,7 +238,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -221,7 +238,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
221 et = _paramObj.getUpLastDtimeObj(); 238 et = _paramObj.getUpLastDtimeObj();
222 } 239 }
223 240
224 - var tempLpObj = new InternalLpObj(-999, _qCount, _qIsUp); 241 + var tempLpObj = new InternalLpObj({lpNo: -999, lpName: "-999"}, _qCount, _qIsUp);
225 tempLpObj.initDataFromTimeToTime( 242 tempLpObj.initDataFromTimeToTime(
226 st, 243 st,
227 et, 244 et,
@@ -231,8 +248,12 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -231,8 +248,12 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
231 _factory 248 _factory
232 ); 249 );
233 250
  251 + //------------------------ 2、找出中标线的早高峰班次,计算应该插在当前路牌数组的那个位置 ----------------//
  252 + // TODO:中标线的早高峰发车班次,和插入位置的早高分班次的时间会有误差的
  253 + // TODO:这里是直接把中标线班次覆盖,没有根据误差调整,以后改
  254 +
234 // 找出中标线对应的早高峰的班次对象 255 // 找出中标线对应的早高峰的班次对象
235 - var _zb_bcobj = tempLpObj.getBc(_zgfQIndex, _zgfBIndex); 256 + var _zb_bcobj = tempLpObj.getBc(_approximate_zgfQIndex, _approximate_zgfBIndex);
236 257
237 // 把所有高峰班次重新构造成一个一个的圈数组,计算对应中标线最近的是第几个路牌 258 // 把所有高峰班次重新构造成一个一个的圈数组,计算对应中标线最近的是第几个路牌
238 var _tempq_array = []; 259 var _tempq_array = [];
@@ -240,11 +261,11 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -240,11 +261,11 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
240 var _temp_bc; 261 var _temp_bc;
241 var i; 262 var i;
242 for (i = 0; i < _internalLpArray.length; i++) { 263 for (i = 0; i < _internalLpArray.length; i++) {
243 - _temp_bc = _internalLpArray[i].getBc(_zgfQIndex, _zgfBIndex); 264 + _temp_bc = _internalLpArray[i].getBc(_approximate_zgfQIndex, _approximate_zgfBIndex);
244 if (_temp_bc.isUp() == _qIsUp) { 265 if (_temp_bc.isUp() == _qIsUp) {
245 - _temp_group = new InternalGroupBcObj(_qIsUp, _temp_bc, undefined); 266 + _temp_group = new InternalGroupObj(_internalLpArray[i], _qIsUp, _temp_bc, undefined);
246 } else { 267 } else {
247 - _temp_group = new InternalGroupBcObj(_qIsUp, undefined, _temp_bc); 268 + _temp_group = new InternalGroupObj(_internalLpArray[i], _qIsUp, undefined, _temp_bc);
248 } 269 }
249 _tempq_array.push(_temp_group); 270 _tempq_array.push(_temp_group);
250 } 271 }
@@ -254,7 +275,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -254,7 +275,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
254 _tempq_array 275 _tempq_array
255 ); 276 );
256 _zbx_lpIndex = _ttindex_[0]; // 中标线放在第几个路牌 277 _zbx_lpIndex = _ttindex_[0]; // 中标线放在第几个路牌
257 - tempLpObj.setLp(_lpArray[_zbx_lpIndex].lpNo); 278 + tempLpObj.setLp(_lpArray[_zbx_lpIndex]); // 设置原始路牌对象
258 tempLpObj.setVerticalMinIntervalTime( // 设置纵向最小发车间隔 279 tempLpObj.setVerticalMinIntervalTime( // 设置纵向最小发车间隔
259 _internalLpArray[_zbx_lpIndex].getVerticalMinIntervalTime() 280 _internalLpArray[_zbx_lpIndex].getVerticalMinIntervalTime()
260 ); 281 );
@@ -309,6 +330,200 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -309,6 +330,200 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
309 console.log("//---------------- 行车计划,初始化方法4 end ----------------//"); 330 console.log("//---------------- 行车计划,初始化方法4 end ----------------//");
310 }; 331 };
311 332
  333 + //-------------------- 重要的内部方法 -----------------------//
  334 + /**
  335 + * 在指定位置生成班次(内部重要方法)。
  336 + * @param lpIndex 第几个路牌
  337 + * @param qIndex 第几圈
  338 + * @param bcIndex 第几个班次
  339 + * @returns InternalBcObj
  340 + */
  341 + var _generateBc = function(lpIndex, qIndex, bcIndex) {
  342 + // 在初始化布局后使用,否则没有参照班次加不了
  343 + // 初始化布局后,相当于把时刻表比作一个围棋棋盘,行为路牌数,列为圈数
  344 + // 上标线,中标线,早晚高峰已经布局在棋盘上,其余的空格可以创建班次
  345 +
  346 + // 这个生成班次是以上一班次时间,以发车间隔为基础添加的,纵向加
  347 + // 和生成标线时那种一直往后加班次时不一样,那种是以前一个班次为基础,横向加
  348 +
  349 + // 1、生成的班次以同一圈同一个方向里离它最早的班次的发车时间为基础
  350 + // 2、以每个路牌的纵向最小发车间隔时间为计算发车间隔
  351 + // 3、如果班次发车时间越界不管,有其余方法排除这种情况
  352 +
  353 + // 1、查找同圈同方向里最近的班次,找不到报错(因为有标线存在是不可能找不到的)
  354 + var _i;
  355 + var _bcObj;
  356 + for (_i = lpIndex - 1; _i >= 0; _i--) {
  357 + _bcObj = _internalLpArray[_i].getBc(qIndex, bcIndex);
  358 + if (_bcObj) {
  359 + break;
  360 + }
  361 + }
  362 + if (!_bcObj) {
  363 + return false;
  364 + //alert("无法在指定位置生成班次");
  365 + //throw "无法在路牌index=" + lpIndex + ",圈index=" + qIndex + ",班次index=" + bcIndex + "生成班次";
  366 + }
  367 +
  368 + // 2、计算发车间隔
  369 + var _intervalTime = 0;
  370 + for (_i = _i + 1; _i <= lpIndex; _i++) {
  371 + _intervalTime += _internalLpArray[_i].getVerticalMinIntervalTime();
  372 + }
  373 +
  374 + // 3、计算班次并添加班次
  375 + var _kssj = _paramObj.addMinute(_bcObj.getFcTimeObj(), _intervalTime);
  376 + _bcObj = _factory.createBcObj(
  377 + _internalLpArray[lpIndex],
  378 + "normal", _bcObj.isUp(),
  379 + 1, _kssj, _paramObj);
  380 + _bcObj.setGroup(_internalLpArray[lpIndex].getGroup(qIndex));
  381 +
  382 + return _bcObj;
  383 +
  384 + // TODO:这种添加班次的方法,可能造成相邻班次的停站时间问题
  385 + // TODO:主要是由于中标线的问题,但是误差不会很大,
  386 + // TODO:后面有方法直接调整停站时间(所谓的平滑过度时间)
  387 + };
  388 +
  389 + /**
  390 + * 在指定位置生成班次并添加到路牌指定位置中。
  391 + * @param lpIndex 第几个路牌
  392 + * @param qIndex 第几圈
  393 + * @param bcIndex 第几个班次
  394 + */
  395 + var _generateBcAndSetBc = function(lpIndex, qIndex, bcIndex) {
  396 + var _bcObj = _generateBc(lpIndex, qIndex, bcIndex);
  397 + _internalLpArray[lpIndex].setBc(qIndex, bcIndex, _bcObj);
  398 +
  399 + };
  400 +
  401 + /**
  402 + * 查找离指定时间最近的前面的班次索引信息
  403 + * @param timeObj 查找时间
  404 + * @param isUp 是否上行
  405 + * @returns [{路牌index},{圈index},{班次index}]
  406 + */
  407 + var _findUpClosedBcIndexWithTime = function(timeObj, isUp) {
  408 + var _lpObj;
  409 + var _groupObj;
  410 + var _bcObj;
  411 + var _i;
  412 + var _j;
  413 + var timediff; // 时间差取绝对值
  414 +
  415 + var _lpIndex;
  416 + var _up_qIndex;
  417 + var _up_bIndex;
  418 +
  419 + for (_i = 0; _i < _qCount; _i++) {
  420 + for (_j = 0; _j < _internalLpArray.length; _j++) {
  421 + _lpObj = _internalLpArray[_j];
  422 + _groupObj = _lpObj.getGroup(_i);
  423 + _bcObj = isUp ? _groupObj.getBc1() : _groupObj.getBc2();
  424 + if (!_bcObj) { // 没有班次动态生成一个,可能生成不出的
  425 + _bcObj = _generateBc(_j, _i, isUp == _qIsUp ? 0 : 1);
  426 + }
  427 + if (_bcObj) {
  428 + if (timeObj.diff(_bcObj.getFcTimeObj()) >= 0) {
  429 + if (!timediff) {
  430 + timediff = timeObj.diff(_bcObj.getFcTimeObj());
  431 + _lpIndex = _j;
  432 + _up_qIndex = _i;
  433 + _up_bIndex = isUp == _qIsUp ? 0 : 1;
  434 + } else {
  435 + if (timeObj.diff(_bcObj.getFcTimeObj()) < timediff) {
  436 + timediff = timeObj.diff(_bcObj.getFcTimeObj());
  437 + _lpIndex = _j;
  438 + _up_qIndex = _i;
  439 + _up_bIndex = isUp == _qIsUp ? 0 : 1;
  440 + }
  441 + }
  442 + }
  443 + }
  444 + }
  445 + }
  446 +
  447 + if (_lpIndex == undefined) {
  448 + return false;
  449 + }
  450 +
  451 + var bcindex = [];
  452 + bcindex.push(_lpIndex);
  453 + bcindex.push(_up_qIndex);
  454 + bcindex.push(_up_bIndex);
  455 +
  456 + return bcindex;
  457 + };
  458 +
  459 + /**
  460 + * 查找离指定时间最近的后面的班次索引信息
  461 + * @param timeObj 查找时间
  462 + * @param isUp 是否上行
  463 + * @returns [{路牌index},{圈index},{班次index}]
  464 + */
  465 + var _findDownClosedBcIndexWithTime = function(timeObj, isUp) {
  466 + var _lpObj;
  467 + var _groupObj;
  468 + var _bcObj;
  469 + var _i;
  470 + var _j;
  471 + var timediff; // 时间差取绝对值
  472 +
  473 + var _lpIndex;
  474 + var _down_qIndex;
  475 + var _down_bIndex;
  476 +
  477 + var flag;
  478 +
  479 + for (_i = 0; _i < _qCount; _i++) {
  480 + for (_j = 0; _j < _internalLpArray.length; _j++) {
  481 + _lpObj = _internalLpArray[_j];
  482 + _groupObj = _lpObj.getGroup(_i);
  483 + _bcObj = isUp ? _groupObj.getBc1() : _groupObj.getBc2();
  484 + if (!_bcObj) { // 没有班次动态生成一个,可能生成不出的
  485 + _bcObj = _generateBc(_j, _i, isUp == _qIsUp ? 0 : 1);
  486 + }
  487 + if (_bcObj) {
  488 + //console.log("timeobj -> bcobj diff flag " +
  489 + // timeObj.format("HH:mm") + "->" +
  490 + // _bcObj.getFcTimeObj().format("HH:mm") +
  491 + // timeObj.diff(_bcObj.getFcTimeObj()) +
  492 + // (timeObj.diff(_bcObj.getFcTimeObj()) <= 0)
  493 + //);
  494 +
  495 + flag = (timeObj.diff(_bcObj.getFcTimeObj())) <= 0;
  496 +
  497 + if (flag) {
  498 + if (!timediff) {
  499 + timediff = timeObj.diff(_bcObj.getFcTimeObj());
  500 + _lpIndex = _j;
  501 + _down_qIndex = _i;
  502 + _down_bIndex = isUp == _qIsUp ? 0 : 1;
  503 + } else {
  504 + if ((timeObj.diff(_bcObj.getFcTimeObj())) > timediff) {
  505 + timediff = timeObj.diff(_bcObj.getFcTimeObj());
  506 + _lpIndex = _j;
  507 + _down_qIndex = _i;
  508 + _down_bIndex = isUp == _qIsUp ? 0 : 1;
  509 + }
  510 + }
  511 + }
  512 + }
  513 + }
  514 + }
  515 +
  516 + if (_lpIndex == undefined) {
  517 + return false;
  518 + }
  519 +
  520 + var bcindex = [];
  521 + bcindex.push(_lpIndex);
  522 + bcindex.push(_down_qIndex);
  523 + bcindex.push(_down_bIndex);
  524 +
  525 + return bcindex;
  526 + };
312 527
313 return { 528 return {
314 //------------- 布局初始化方法 ------------// 529 //------------- 布局初始化方法 ------------//
@@ -347,6 +562,13 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -347,6 +562,13 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
347 //this._generateBc(17, 1, 1); 562 //this._generateBc(17, 1, 1);
348 //this._generateBc(18, 1, 1); 563 //this._generateBc(18, 1, 1);
349 564
  565 + // 6:31 8:30
  566 + // 16:01 18:00
  567 +
  568 + // 测试找上界
  569 + console.log("上界:" + _findUpClosedBcIndexWithTime(_paramObj.getMPeakStartTimeObj(), false));
  570 + console.log("下界:" + _findDownClosedBcIndexWithTime(_paramObj.getMPeakEndTimeObj(), false));
  571 +
350 // TODO: 572 // TODO:
351 573
352 // 测试时间判定 574 // 测试时间判定
@@ -364,13 +586,138 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -364,13 +586,138 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
364 // _factory 586 // _factory
365 //); 587 //);
366 588
  589 + // TODO:问题
  590 + // 1、中标线是直接赋值在具体位置的,没有修正班次时间
  591 + // 2、路牌间隔时间需要修正的
  592 +
367 }, 593 },
368 594
369 // TODO: 595 // TODO:
370 596
371 /** 597 /**
372 - * 根据每个路牌的连班班型补充班次。  
373 - * 补充连班的班次,参照上标线,中标线补充不足的班次 598 + * 调整高峰班次,
  599 + * 初始化生成早高峰,晚高峰班次并不准确,因为根据高峰时间段,并不在一个完整圈内,应该是在两个或多个圈之间
  600 + * 当初始化定好布局后(上标线,中标线),然后确定每个路牌的班型(连班,分班,5休2分班)后
  601 + * 然后重新计算框在高峰时间段内的班次索引,不足的添加,之前多加的删除(只删除分班路牌上的)
  602 + * @param isZgf 是否早高峰
  603 + * @param isUp 是否上行
  604 + */
  605 + adjustGfbc : function(isZgf, isUp) {
  606 + var startTime; // 开始时间
  607 + var endTime; // 结束时间
  608 + var startBcIndex; // 开始班次索引
  609 + var endBcIndex; // 结束班次索引
  610 +
  611 + startTime = isZgf ? _paramObj.getMPeakStartTimeObj() : _paramObj.getEPeakStartTimeObj();
  612 + endTime = isZgf ? _paramObj.getMPeakEndTimeObj() : _paramObj.getEPeakEndTimeObj();
  613 +
  614 + startBcIndex = _findUpClosedBcIndexWithTime(startTime, isUp);
  615 + endBcIndex = _findDownClosedBcIndexWithTime(endTime, isUp);
  616 +
  617 + var _lpIndex;
  618 + var _qIndex;
  619 + var _bcIndex;
  620 + var _qInternelCount; // 高峰时间段中间包含的圈数
  621 + var i;
  622 + var j;
  623 +
  624 + var _lp;
  625 +
  626 + if (startBcIndex && endBcIndex) {
  627 + _lpIndex = startBcIndex[0];
  628 + _qIndex = startBcIndex[1];
  629 + _bcIndex = startBcIndex[2];
  630 +
  631 + // 处理头
  632 + // 删除头部多余班次
  633 + for (j = 0; j < _lpIndex; j++) {
  634 + _lp = _internalLpArray[j];
  635 + if (_lp.isBxFb() && _lp.getBc(_qIndex, _bcIndex)) {
  636 + _lp.removeBc(_qIndex, _bcIndex);
  637 + }
  638 + }
  639 +
  640 + for (j = _lpIndex; j < _internalLpArray.length; j++) {
  641 + _lp = _internalLpArray[j];
  642 + if (!_lp.getBc(_qIndex, _bcIndex)) {
  643 + _generateBcAndSetBc(j, _qIndex, _bcIndex);
  644 + }
  645 + }
  646 +
  647 + // 处理中间
  648 + _qInternelCount = endBcIndex[1] - startBcIndex[1] - 1;
  649 + for (i = 1; i <= _qInternelCount; i++) {
  650 + _lp = _internalLpArray[_qIndex + i];
  651 + if (!_lp.getBc(_qIndex + i, _bcIndex)) {
  652 + _generateBcAndSetBc(i, _qIndex + i, _bcIndex);
  653 + }
  654 + }
  655 +
  656 + // 处理尾部
  657 + _lpIndex = endBcIndex[0];
  658 + _qIndex = endBcIndex[1];
  659 + _bcIndex = endBcIndex[2];
  660 + for (j = 0; j < _lpIndex; j++) {
  661 + _lp = _internalLpArray[j];
  662 + if (!_lp.getBc(_qIndex, _bcIndex)) {
  663 + _generateBcAndSetBc(j, _qIndex, _bcIndex);
  664 + }
  665 + }
  666 + // 删除尾部多余的班次
  667 + for (j = _lpIndex; j < _internalLpArray.length; j++) {
  668 + _lp = _internalLpArray[j];
  669 + if (_lp.isBxFb() && _lp.getBc(_qIndex, _bcIndex)) {
  670 + _lp.removeBc(_qIndex, _bcIndex);
  671 + }
  672 + }
  673 + }
  674 +
  675 + },
  676 +
  677 + /**
  678 + * 补充做5休2的班型班次。
  679 + * 1、做5休2的路牌总工时不能超过7个小时
  680 + * 2、5休2的路牌全部从早晚高峰班次开始往前补充1个班次,组成早晚2圈
  681 + * 3、再根据余下工时及早晚高峰开始时间,确定向前或者向后加班次
  682 + */
  683 + calcuLpBx_5_2: function() {
  684 + // 1、先在早晚高峰班次前加1个班次压压惊
  685 + var i;
  686 + var _lp;
  687 + var _zgfbcpos; // 早高峰班次位置
  688 + var _wgfbcpos; // 晚高峰班次位置
  689 + var _qIndex;
  690 + var _bIndex;
  691 +
  692 + //for (i = 0; i < _internalLpArray.length; i++) {
  693 + // _lp = _internalLpArray[i];
  694 + // if (_lp.isBxFb5_2()) {
  695 + // _zgfbcpos = _lp.getMinBcObjPosition();
  696 + // _wgfbcpos = _lp.getMaxBcObjPosition();
  697 + //
  698 + // // TODO:测试向前添加一个班次
  699 + // _qIndex = _zgfbcpos[0];
  700 + // _bIndex = _zgfbcpos[1];
  701 + // _bIndex == 0 ?
  702 + // _generateBcAndSetBc(i, _qIndex - 1, 1) :
  703 + // _generateBcAndSetBc(i, _qIndex, 0);
  704 + //
  705 + // _qIndex = _wgfbcpos[0];
  706 + // _bIndex = _wgfbcpos[1];
  707 + // _bIndex == 0 ?
  708 + // _generateBcAndSetBc(i, _qIndex - 1, 1) :
  709 + // _generateBcAndSetBc(i, _qIndex, 0);
  710 + //
  711 + // }
  712 + //}
  713 +
  714 + // 2、
  715 + },
  716 +
  717 + /**
  718 + * 补充连班路牌班次。
  719 + * 1、上标线,中标线中间的连班路牌班次从早高峰班次一直拉到底,从早高峰班次向上标线起始班次靠拢
  720 + * 2、中标线以下的连班路牌班次从早高峰班次一直拉到底,从早高峰班次向中标线起始班次靠拢
374 */ 721 */
375 calcuLpBx_lb: function() { 722 calcuLpBx_lb: function() {
376 // 补充连班的班次,参照上标线,中标线补充不足的班次 723 // 补充连班的班次,参照上标线,中标线补充不足的班次
@@ -419,10 +766,10 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -419,10 +766,10 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
419 if (_bIndex == 0) { 766 if (_bIndex == 0) {
420 _qIndex --; 767 _qIndex --;
421 _bIndex = 1; 768 _bIndex = 1;
422 - this._generateBc(i, _qIndex, _bIndex); 769 + _generateBcAndSetBc(i, _qIndex, _bIndex);
423 } else if (_bIndex == 1) { 770 } else if (_bIndex == 1) {
424 _bIndex --; 771 _bIndex --;
425 - this._generateBc(i, _qIndex, _bIndex); 772 + _generateBcAndSetBc(i, _qIndex, _bIndex);
426 } 773 }
427 } 774 }
428 } 775 }
@@ -439,10 +786,10 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -439,10 +786,10 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
439 if (_bIndex == 0) { 786 if (_bIndex == 0) {
440 _qIndex --; 787 _qIndex --;
441 _bIndex = 1; 788 _bIndex = 1;
442 - this._generateBc(i, _qIndex, _bIndex); 789 + _generateBcAndSetBc(i, _qIndex, _bIndex);
443 } else if (_bIndex == 1) { 790 } else if (_bIndex == 1) {
444 _bIndex --; 791 _bIndex --;
445 - this._generateBc(i, _qIndex, _bIndex); 792 + _generateBcAndSetBc(i, _qIndex, _bIndex);
446 } 793 }
447 } 794 }
448 } 795 }
@@ -458,6 +805,9 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -458,6 +805,9 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
458 */ 805 */
459 calcuLpBx_fg: function() { 806 calcuLpBx_fg: function() {
460 // 间隔法 807 // 间隔法
  808 +
  809 + //--------------------------- 1、间隔法分隔连班路牌 ----------------------//
  810 +
461 // 除去上标线,中标线的连班路牌个数 811 // 除去上标线,中标线的连班路牌个数
462 var _lblbcount = _bx_lb_lpcount - 2; 812 var _lblbcount = _bx_lb_lpcount - 2;
463 // 计算由标线隔开的两个区域的路牌数比率 813 // 计算由标线隔开的两个区域的路牌数比率
@@ -478,10 +828,12 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -478,10 +828,12 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
478 var _c2_start_index; 828 var _c2_start_index;
479 for (i = 1; i <= _count - _c2; i++) { 829 for (i = 1; i <= _count - _c2; i++) {
480 _internalLpArray[(i - 1) * _c1].setBxLb(true); 830 _internalLpArray[(i - 1) * _c1].setBxLb(true);
  831 + _internalLpArray[(i - 1) * _c1].setBxDesc("连班");
481 _c2_start_index = (i - 1) * _c1; 832 _c2_start_index = (i - 1) * _c1;
482 } 833 }
483 for (i = 1; i <= _c2; i++) { 834 for (i = 1; i <= _c2; i++) {
484 _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxLb(true); 835 _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxLb(true);
  836 + _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxDesc("连班");
485 } 837 }
486 838
487 // 设定第二个区域的连班路牌 839 // 设定第二个区域的连班路牌
@@ -492,14 +844,18 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -492,14 +844,18 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
492 _internalLpArray[(i - 1) * _c1 + _zbx_lpIndex].setBxLb(true); 844 _internalLpArray[(i - 1) * _c1 + _zbx_lpIndex].setBxLb(true);
493 _internalLpArray[(i - 1) * _c1 + _zbx_lpIndex].setBxFb(false); 845 _internalLpArray[(i - 1) * _c1 + _zbx_lpIndex].setBxFb(false);
494 _internalLpArray[(i - 1) * _c1 + _zbx_lpIndex].setBxFb5_2(false); 846 _internalLpArray[(i - 1) * _c1 + _zbx_lpIndex].setBxFb5_2(false);
  847 + _internalLpArray[(i - 1) * _c1 + _zbx_lpIndex].setBxDesc("连班");
495 _c2_start_index = (i - 1) * _c1 + _zbx_lpIndex; 848 _c2_start_index = (i - 1) * _c1 + _zbx_lpIndex;
496 } 849 }
497 for (i = 1; i <= _c2; i++) { 850 for (i = 1; i <= _c2; i++) {
498 _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxLb(true); 851 _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxLb(true);
499 _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxFb(false); 852 _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxFb(false);
500 _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxFb5_2(false); 853 _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxFb5_2(false);
  854 + _internalLpArray[_c2_start_index + i * (_c1 + 1)].setBxDesc("连班");
501 } 855 }
502 856
  857 + //---------------------------- 2、分隔法,分隔分班路牌 -------------------------//
  858 +
503 // 设定分班路牌 859 // 设定分班路牌
504 var notlbIndexes = []; // 去除连班的路牌index列表 860 var notlbIndexes = []; // 去除连班的路牌index列表
505 for (i = 0; i < _internalLpArray.length; i++) { 861 for (i = 0; i < _internalLpArray.length; i++) {
@@ -507,18 +863,66 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -507,18 +863,66 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
507 notlbIndexes.push(i); 863 notlbIndexes.push(i);
508 } 864 }
509 } 865 }
510 - // 先把全部放置分班路牌,在全部放置5休2路牌  
511 - for (i = 0; i < _bx_other_fb_lpcount; i++) {  
512 - _internalLpArray[notlbIndexes[i]].setBxFb(false);  
513 - _internalLpArray[notlbIndexes[i]].setBxFb(true);  
514 - _internalLpArray[notlbIndexes[i]].setBxFb5_2(false); 866 + // 获取离中标线最近的分班路牌索引
  867 + var _temp_fg_index;
  868 + for (i = 0; i < notlbIndexes.length; i++) {
  869 + if (notlbIndexes[i] == _zbx_lpIndex - 1) {
  870 + _temp_fg_index = i;
  871 + break;
  872 + }
515 } 873 }
516 - while (i < _bx_other_fb_lpcount + _bx_5_2_fb_lpcount) {  
517 - _internalLpArray[notlbIndexes[i]].setBxFb(false);  
518 - _internalLpArray[notlbIndexes[i]].setBxFb(true);  
519 - _internalLpArray[notlbIndexes[i]].setBxFb5_2(true);  
520 874
521 - i++; 875 + // 使用上面的分隔比率,分隔5休2班型
  876 + _p1_lpcount = _bx_5_2_fb_lpcount * _p1;
  877 + _p2_lpcount = _bx_5_2_fb_lpcount * _p2;
  878 + if (parseInt(_p1_lpcount) != _p1_lpcount) { // 没有整除
  879 + _p1_lpcount = Math.floor(_p1_lpcount);
  880 + _p2_lpcount = Math.floor(_p2_lpcount) + 1;
  881 + }
  882 + // 第一个区域
  883 + _count = _p1_lpcount;
  884 + _c1 = Math.floor(_temp_fg_index / _count);
  885 + _c2 = _temp_fg_index % _count;
  886 + for (i = 1; i <= _count - _c2; i++) {
  887 + _internalLpArray[notlbIndexes[(i - 1) * _c1]].setBxLb(false);
  888 + _internalLpArray[notlbIndexes[(i - 1) * _c1]].setBxFb(true);
  889 + _internalLpArray[notlbIndexes[(i - 1) * _c1]].setBxFb5_2(true);
  890 + _internalLpArray[notlbIndexes[(i - 1) * _c1]].setBxDesc("5休2分班");
  891 + _c2_start_index = (i - 1) * _c1;
  892 + }
  893 + for (i = 1; i <= _c2; i++) {
  894 + _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxLb(false);
  895 + _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxLb(true);
  896 + _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxFb5_2(true);
  897 + _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxDesc("5休2分班");
  898 + }
  899 + // 第二个区域
  900 + _count = _p2_lpcount;
  901 + _c1 = Math.floor((notlbIndexes.length - _temp_fg_index - 1) / _count);
  902 + _c2 = (notlbIndexes.length - _temp_fg_index - 1) % _count;
  903 + for (i = 1; i <= _count - _c2; i++) {
  904 + _internalLpArray[notlbIndexes[(i - 1) * _c1 + _temp_fg_index + 1]].setBxLb(false);
  905 + _internalLpArray[notlbIndexes[(i - 1) * _c1 + _temp_fg_index + 1]].setBxFb(true);
  906 + _internalLpArray[notlbIndexes[(i - 1) * _c1 + _temp_fg_index + 1]].setBxFb5_2(true);
  907 + _internalLpArray[notlbIndexes[(i - 1) * _c1 + _temp_fg_index + 1]].setBxDesc("5休2分班");
  908 + _c2_start_index = (i - 1) * _c1 + _temp_fg_index + 1;
  909 + }
  910 + for (i = 1; i <= _c2; i++) {
  911 + _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxLb(false);
  912 + _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxFb(true);
  913 + _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxFb5_2(true);
  914 + _internalLpArray[notlbIndexes[_c2_start_index + i * (_c1 + 1)]].setBxDesc("5休2分班");
  915 + }
  916 +
  917 + //-------------------------- 3、余下班次就是其他分班类型 ----------------------//
  918 +
  919 + for (i = 0; i < notlbIndexes.length; i++) {
  920 + if (!_internalLpArray[notlbIndexes[i]].isBxFb5_2()) {
  921 + _internalLpArray[notlbIndexes[i]].setBxLb(false);
  922 + _internalLpArray[notlbIndexes[i]].setBxFb(true);
  923 + _internalLpArray[notlbIndexes[i]].setBxFb5_2(false);
  924 + _internalLpArray[notlbIndexes[i]].setBxDesc("其他分班");
  925 + }
522 } 926 }
523 927
524 // 测试打印 928 // 测试打印
@@ -547,65 +951,12 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) { @@ -547,65 +951,12 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
547 console.log("5休2分班路牌indexes=" + _5_2_fbIndexes); 951 console.log("5休2分班路牌indexes=" + _5_2_fbIndexes);
548 }, 952 },
549 953
550 - /**  
551 - * 在指定位置生成班次(内部重要方法)。  
552 - * @param lpIndex 第几个路牌  
553 - * @param qIndex 第几圈  
554 - * @param bcIndex 第几个班次  
555 - */  
556 - _generateBc: function(lpIndex, qIndex, bcIndex) {  
557 - // 在初始化布局后使用,否则没有参照班次加不了  
558 - // 初始化布局后,相当于把时刻表比作一个围棋棋盘,行为路牌数,列为圈数  
559 - // 上标线,中标线,早晚高峰已经布局在棋盘上,其余的空格可以创建班次  
560 -  
561 - // 这个生成班次是以上一班次时间,以发车间隔为基础添加的,纵向加  
562 - // 和生成标线时那种一直往后加班次时不一样,那种是以前一个班次为基础,横向加  
563 -  
564 - // 1、生成的班次以同一圈同一个方向里离它最早的班次的发车时间为基础  
565 - // 2、以每个路牌的纵向最小发车间隔时间为计算发车间隔  
566 - // 3、如果班次发车时间越界不管,有其余方法排除这种情况  
567 -  
568 - // 1、查找同圈同方向里最近的班次,找不到报错(因为有标线存在是不可能找不到的)  
569 - var _i;  
570 - var _bcObj;  
571 - for (_i = lpIndex - 1; _i >= 0; _i--) {  
572 - _bcObj = _internalLpArray[_i].getBc(qIndex, bcIndex);  
573 - if (_bcObj) {  
574 - break;  
575 - }  
576 - }  
577 - if (!_bcObj) {  
578 - alert("无法在指定位置生成班次");  
579 - throw "无法在路牌index=" + lpIndex + ",圈index=" + qIndex + ",班次index=" + bcIndex + "生成班次";  
580 - }  
581 -  
582 - // 2、计算发车间隔  
583 - var _intervalTime = 0;  
584 - for (_i = _i + 1; _i <= lpIndex; _i++) {  
585 - _intervalTime += _internalLpArray[_i].getVerticalMinIntervalTime();  
586 - }  
587 -  
588 - // 3、计算班次并添加班次  
589 - var _kssj = _paramObj.addMinute(_bcObj.getFcTimeObj(), _intervalTime);  
590 - _bcObj = _factory.createBcObj(  
591 - "normal", _bcObj.isUp(),  
592 - _lpArray[lpIndex].lpNo,  
593 - 1, _kssj, _paramObj);  
594 -  
595 - _internalLpArray[lpIndex].setBc(qIndex, bcIndex, _bcObj);  
596 -  
597 - // TODO:这种添加班次的方法,可能造成相邻班次的停站时间问题  
598 - // TODO:主要是由于中标线的问题,但是误差不会很大,  
599 - // TODO:后面有方法直接调整停站时间(所谓的平滑过度时间)  
600 - },  
601 -  
602 //------------- 其他方法 -------------// 954 //------------- 其他方法 -------------//
603 /** 955 /**
604 * 内部数据转化成显示用的班次数组。 956 * 内部数据转化成显示用的班次数组。
605 */ 957 */
606 toGanttBcArray: function() { 958 toGanttBcArray: function() {
607 var bcData = []; 959 var bcData = [];
608 - var i;  
609 var lpObj; 960 var lpObj;
610 for (i = 0; i < _internalLpArray.length; i++) { 961 for (i = 0; i < _internalLpArray.length; i++) {
611 lpObj = _internalLpArray[i]; 962 lpObj = _internalLpArray[i];
src/main/resources/static/pages/base/timesmodel/js/v2/main_v2.js
@@ -12,7 +12,7 @@ var Main_v2 = function() { @@ -12,7 +12,7 @@ var Main_v2 = function() {
12 return paramObj; 12 return paramObj;
13 }, 13 },
14 // 创建班次对象 14 // 创建班次对象
15 - createBcObj: function(bcType, isUp, lp, fcno, fcTimeObj, paramObj) { 15 + createBcObj: function(lpObj, bcType, isUp, fcno, fcTimeObj, paramObj) {
16 var _bclc = paramObj.calcuTravelLcNumber(isUp, bcType); 16 var _bclc = paramObj.calcuTravelLcNumber(isUp, bcType);
17 var _bcsj = paramObj.calcuTravelTime(fcTimeObj, isUp); 17 var _bcsj = paramObj.calcuTravelTime(fcTimeObj, isUp);
18 var _arrsj = paramObj.addMinute(fcTimeObj, _bcsj); 18 var _arrsj = paramObj.addMinute(fcTimeObj, _bcsj);
@@ -23,22 +23,22 @@ var Main_v2 = function() { @@ -23,22 +23,22 @@ var Main_v2 = function() {
23 var _qdz = isUp ? paramObj.getUpQdzObj().id : paramObj.getDownQdzObj().id; 23 var _qdz = isUp ? paramObj.getUpQdzObj().id : paramObj.getDownQdzObj().id;
24 var _zdz = isUp ? paramObj.getUpZdzObj().id : paramObj.getDownZdzObj().id; 24 var _zdz = isUp ? paramObj.getUpZdzObj().id : paramObj.getDownZdzObj().id;
25 25
26 - return new InternalBcObj(  
27 - bcType, // 班次类型(normal,in,out等)  
28 - isUp, // boolean是否上下行  
29 - lp, // 路牌标识符  
30 - fcno, // 发车顺序号  
31 - fcTimeObj, // 发车时间对象  
32 - _bclc, // 班次里程  
33 - _bcsj, // 班次历时  
34 - _arrsj, // 到达时间对象  
35 - _stoptime, // 停站时间  
36 - _tccid, // 停车场id  
37 - _ttinfoid, // 时刻表id  
38 - _xl, // 线路id  
39 - _qdz, // 起点站id  
40 - _zdz // 终点站id  
41 - ); 26 + var bcParamObj = {};
  27 + bcParamObj.bcType = bcType; // 班次类型(normal,in,out等)
  28 + bcParamObj.isUp = isUp; // boolean是否上下行
  29 + bcParamObj.fcno = fcno; // 发车顺序号
  30 + bcParamObj.fcTimeObj = fcTimeObj; // 发车时间对象
  31 + bcParamObj.bclc = _bclc; // 班次里程
  32 + bcParamObj.bcsj = _bcsj; // 班次历时
  33 + bcParamObj.arrtime = _arrsj; // 到达时间对象
  34 + bcParamObj.stoptime = _stoptime; // 停站时间
  35 + bcParamObj.tccid = _tccid; // 停车场id
  36 + bcParamObj.ttinfoid = _ttinfoid; // 时刻表id
  37 + bcParamObj.xl = _xl; // 线路id
  38 + bcParamObj.qdzid = _qdz; // 起点站id
  39 + bcParamObj.zdzid = _zdz; // 终点站id
  40 +
  41 + return new InternalBcObj(lpObj, bcParamObj);
42 } 42 }
43 }; 43 };
44 }; 44 };
@@ -81,16 +81,25 @@ var Main_v2 = function() { @@ -81,16 +81,25 @@ var Main_v2 = function() {
81 // 1、初始化行车计划 81 // 1、初始化行车计划
82 var schedule = new InternalScheduleObj(_paramObj, lpArray, _factory); 82 var schedule = new InternalScheduleObj(_paramObj, lpArray, _factory);
83 schedule.initDataWithBxLayout(); 83 schedule.initDataWithBxLayout();
84 -  
85 // 2、计算每个路牌的班型及对应工时 84 // 2、计算每个路牌的班型及对应工时
86 schedule.calcuLpBx_fg(); 85 schedule.calcuLpBx_fg();
87 -  
88 - // 3、根据班型补充所有的不足班次 86 + // 3、将连班路牌的班次补足
89 schedule.calcuLpBx_lb(); 87 schedule.calcuLpBx_lb();
90 88
91 - // TODO:4、确定末班车 89 + // 4、修正针对初始化时生成的高峰班次,之前不足的补上,多余的删除
  90 + schedule.adjustGfbc(true, true); // 修正上行早高峰
  91 + schedule.adjustGfbc(true, false); // 修正下行早高峰
  92 + schedule.adjustGfbc(false, true); // 修正上行晚高峰
  93 + schedule.adjustGfbc(false, false); // 修正下行晚高峰
  94 +
  95 + // 5、TODO:根据班型补充所有的不足班次
  96 + schedule.calcuLpBx_5_2();
  97 +
  98 + // TODO:6、确定末班车
  99 +
  100 + // TODO:8、修正不准确的停站时间,微调发车间隔
92 101
93 - // TODO:5、补进出场班次 102 + // TODO:9、补进出场报道班次
94 103
95 104
96 //-------------------- 输出ganut图上的班次,班型描述 ----------------------// 105 //-------------------- 输出ganut图上的班次,班型描述 ----------------------//
src/main/resources/static/pages/base/timesmodel/tepms/fcjx_temp.html
@@ -231,7 +231,7 @@ @@ -231,7 +231,7 @@
231 231
232 <div class="col-md-6"> 232 <div class="col-md-6">
233 <label class="control-label col-md-5"> 233 <label class="control-label col-md-5">
234 - <span class="required"> * </span> 高峰建议配车数 :</label> 234 + <span class="required"> * </span> 建议高峰配车数 :</label>
235 <div class="col-md-5"> 235 <div class="col-md-5">
236 <input type="text" class="form-control" placeholder="车辆数" name="gfjypcs" id="gfjypcsInput" min="1"> 236 <input type="text" class="form-control" placeholder="车辆数" name="gfjypcs" id="gfjypcsInput" min="1">
237 </div> 237 </div>
@@ -477,7 +477,7 @@ @@ -477,7 +477,7 @@
477 </div> 477 </div>
478 478
479 <div class="col-md-6"> 479 <div class="col-md-6">
480 - <label class="control-label col-md-5"> 高峰建议配车数 : </label> 480 + <label class="control-label col-md-5"> 建议高峰配车数 : </label>
481 <div class="col-md-4"> 481 <div class="col-md-4">
482 <p class="form-control-static" data-display="gfjypcs"> </p> 482 <p class="form-control-static" data-display="gfjypcs"> </p>
483 </div> 483 </div>
src/main/resources/static/pages/forms/statement/scheduleDaily.html
@@ -427,7 +427,7 @@ @@ -427,7 +427,7 @@
427 layer.msg("请选择时间"); 427 layer.msg("请选择时间");
428 return; 428 return;
429 } 429 }
430 - $("#xlmc").html(xlName); 430 + $("#xlmc").html(xlName+" "+date+" ");
431 // $("#ddrbBody").height($(window).height()-300); 431 // $("#ddrbBody").height($(window).height()-300);
432 $("c").html("全日"); 432 $("c").html("全日");
433 $("#export").removeAttr("disabled"); 433 $("#export").removeAttr("disabled");
src/main/resources/static/pages/forms/statement/statisticsDaily.html
@@ -316,7 +316,7 @@ @@ -316,7 +316,7 @@
316 </script> 316 </script>
317 <script type="text/html" id="statisticsDaily"> 317 <script type="text/html" id="statisticsDaily">
318 {{each list as obj i}} 318 {{each list as obj i}}
319 - <tr> 319 + <tr {{if obj.zt==1}}style='color: red'{{/if}}>
320 <td>{{obj.xlName}}</td> 320 <td>{{obj.xlName}}</td>
321 <td>{{obj.jhzlc}}</td> 321 <td>{{obj.jhzlc}}</td>
322 <td>{{obj.jhlc}}</td> 322 <td>{{obj.jhlc}}</td>
src/main/resources/static/real_control_v2/assets/plugins/layer3.0.3/layer.js
1 -/**  
2 -  
3 - @Name:layer v3.0.3 Web弹层组件  
4 - @Author:贤心  
5 - @Site:http://layer.layui.com  
6 - @License:MIT  
7 -  
8 - */  
9 -  
10 -;!function(window, undefined){  
11 - "use strict";  
12 -  
13 - var isLayui = window.layui && layui.define, $, win, ready = {  
14 - getPath: function(){  
15 - var js = document.scripts, script = js[js.length - 1], jsPath = script.src;  
16 - if(script.getAttribute('merge')) return;  
17 - return jsPath.substring(0, jsPath.lastIndexOf("/") + 1);  
18 - }(),  
19 -  
20 - config: {}, end: {}, minIndex: 0, minLeft: [],  
21 - btn: ['&#x786E;&#x5B9A;', '&#x53D6;&#x6D88;'],  
22 -  
23 - //五种原始层模式  
24 - type: ['dialog', 'page', 'iframe', 'loading', 'tips']  
25 - };  
26 -  
27 -//默认内置方法。  
28 - var layer = {  
29 - v: '3.0.3',  
30 - ie: function(){ //ie版本  
31 - var agent = navigator.userAgent.toLowerCase();  
32 - return (!!window.ActiveXObject || "ActiveXObject" in window) ? (  
33 - (agent.match(/msie\s(\d+)/) || [])[1] || '11' //由于ie11并没有msie的标识  
34 - ) : false;  
35 - }(),  
36 - index: (window.layer && window.layer.v) ? 100000 : 0,  
37 - path: ready.getPath,  
38 - config: function(options, fn){  
39 - options = options || {};  
40 - layer.cache = ready.config = $.extend({}, ready.config, options);  
41 - layer.path = ready.config.path || layer.path;  
42 - typeof options.extend === 'string' && (options.extend = [options.extend]);  
43 -  
44 - if(ready.config.path) layer.ready();  
45 -  
46 - if(!options.extend) return this;  
47 -  
48 - isLayui  
49 - ? layui.addcss('modules/layer/' + options.extend)  
50 - : layer.link('skin/' + options.extend);  
51 -  
52 - return this;  
53 - },  
54 -  
55 - //载入CSS配件  
56 - link: function(href, fn, cssname){  
57 -  
58 - //未设置路径,则不主动加载css  
59 - if(!layer.path) return;  
60 -  
61 - var head = $('head')[0], link = document.createElement('link');  
62 - if(typeof fn === 'string') cssname = fn;  
63 - var app = (cssname || href).replace(/\.|\//g, '');  
64 - var id = 'layuicss-'+app, timeout = 0;  
65 -  
66 - link.rel = 'stylesheet';  
67 - link.href = layer.path + href;  
68 - link.id = id;  
69 -  
70 - if(!$('#'+ id)[0]){  
71 - head.appendChild(link);  
72 - }  
73 -  
74 - if(typeof fn !== 'function') return;  
75 -  
76 - //轮询css是否加载完毕  
77 - /* (function poll() {  
78 - if(++timeout > 8 * 1000 / 100){  
79 - return window.console && console.error('layer.css: Invalid');  
80 - };  
81 - parseInt($('#'+id).css('width')) === 1989 ? fn() : setTimeout(poll, 100);  
82 - }());*/  
83 - },  
84 -  
85 - ready: function(callback){  
86 - /*var cssname = 'skinlayercss', ver = '303';  
87 - isLayui ? layui.addcss('modules/layer/default/layer.css?v='+layer.v+ver, callback, cssname)  
88 - : layer.link('skin/default/layer.css?v='+layer.v+ver, callback, cssname);*/  
89 - return this;  
90 - },  
91 -  
92 - //各种快捷引用  
93 - alert: function(content, options, yes){  
94 - var type = typeof options === 'function';  
95 - if(type) yes = options;  
96 - return layer.open($.extend({  
97 - content: content,  
98 - yes: yes  
99 - }, type ? {} : options));  
100 - },  
101 -  
102 - confirm: function(content, options, yes, cancel){  
103 - var type = typeof options === 'function';  
104 - if(type){  
105 - cancel = yes;  
106 - yes = options;  
107 - }  
108 - return layer.open($.extend({  
109 - content: content,  
110 - btn: ready.btn,  
111 - yes: yes,  
112 - btn2: cancel  
113 - }, type ? {} : options));  
114 - },  
115 -  
116 - msg: function(content, options, end){ //最常用提示层  
117 - var type = typeof options === 'function', rskin = ready.config.skin;  
118 - var skin = (rskin ? rskin + ' ' + rskin + '-msg' : '')||'layui-layer-msg';  
119 - var anim = doms.anim.length - 1;  
120 - if(type) end = options;  
121 - return layer.open($.extend({  
122 - content: content,  
123 - time: 3000,  
124 - shade: false,  
125 - skin: skin,  
126 - title: false,  
127 - closeBtn: false,  
128 - btn: false,  
129 - resize: false,  
130 - end: end  
131 - }, (type && !ready.config.skin) ? {  
132 - skin: skin + ' layui-layer-hui',  
133 - anim: anim  
134 - } : function(){  
135 - options = options || {};  
136 - if(options.icon === -1 || options.icon === undefined && !ready.config.skin){  
137 - options.skin = skin + ' ' + (options.skin||'layui-layer-hui');  
138 - }  
139 - return options;  
140 - }()));  
141 - },  
142 -  
143 - load: function(icon, options){  
144 - return layer.open($.extend({  
145 - type: 3,  
146 - icon: icon || 0,  
147 - resize: false,  
148 - shade: 0.01  
149 - }, options));  
150 - },  
151 -  
152 - tips: function(content, follow, options){  
153 - return layer.open($.extend({  
154 - type: 4,  
155 - content: [content, follow],  
156 - closeBtn: false,  
157 - time: 3000,  
158 - shade: false,  
159 - resize: false,  
160 - fixed: false,  
161 - maxWidth: 210  
162 - }, options));  
163 - }  
164 - };  
165 -  
166 - var Class = function(setings){  
167 - var that = this;  
168 - that.index = ++layer.index;  
169 - that.config = $.extend({}, that.config, ready.config, setings);  
170 - document.body ? that.creat() : setTimeout(function(){  
171 - that.creat();  
172 - }, 30);  
173 - };  
174 -  
175 - Class.pt = Class.prototype;  
176 -  
177 -//缓存常用字符  
178 - var doms = ['layui-layer', '.layui-layer-title', '.layui-layer-main', '.layui-layer-dialog', 'layui-layer-iframe', 'layui-layer-content', 'layui-layer-btn', 'layui-layer-close'];  
179 - doms.anim = ['layer-anim', 'layer-anim-01', 'layer-anim-02', 'layer-anim-03', 'layer-anim-04', 'layer-anim-05', 'layer-anim-06'];  
180 -  
181 -//默认配置  
182 - Class.pt.config = {  
183 - type: 0,  
184 - shade: 0.3,  
185 - fixed: true,  
186 - move: doms[1],  
187 - title: '&#x4FE1;&#x606F;',  
188 - offset: 'auto',  
189 - area: 'auto',  
190 - closeBtn: 1,  
191 - time: 0, //0表示不自动关闭  
192 - zIndex: 19891014,  
193 - maxWidth: 360,  
194 - anim: 0,  
195 - isOutAnim: true,  
196 - icon: -1,  
197 - moveType: 1,  
198 - resize: true,  
199 - scrollbar: true, //是否允许浏览器滚动条  
200 - tips: 2  
201 - };  
202 -  
203 -//容器  
204 - Class.pt.vessel = function(conType, callback){  
205 - var that = this, times = that.index, config = that.config;  
206 - var zIndex = config.zIndex + times, titype = typeof config.title === 'object';  
207 - var ismax = config.maxmin && (config.type === 1 || config.type === 2);  
208 - var titleHTML = (config.title ? '<div class="layui-layer-title" style="'+ (titype ? config.title[1] : '') +'">'  
209 - + (titype ? config.title[0] : config.title)  
210 - + '</div>' : '');  
211 -  
212 - config.zIndex = zIndex;  
213 - callback([  
214 - //遮罩  
215 - config.shade ? ('<div class="layui-layer-shade" id="layui-layer-shade'+ times +'" times="'+ times +'" style="'+ ('z-index:'+ (zIndex-1) +'; background-color:'+ (config.shade[1]||'#000') +'; opacity:'+ (config.shade[0]||config.shade) +'; filter:alpha(opacity='+ (config.shade[0]*100||config.shade*100) +');') +'"></div>') : '',  
216 -  
217 - //主体  
218 - '<div class="'+ doms[0] + (' layui-layer-'+ready.type[config.type]) + (((config.type == 0 || config.type == 2) && !config.shade) ? ' layui-layer-border' : '') + ' ' + (config.skin||'') +'" id="'+ doms[0] + times +'" type="'+ ready.type[config.type] +'" times="'+ times +'" showtime="'+ config.time +'" conType="'+ (conType ? 'object' : 'string') +'" style="z-index: '+ zIndex +'; width:'+ config.area[0] + ';height:' + config.area[1] + (config.fixed ? '' : ';position:absolute;') +'">'  
219 - + (conType && config.type != 2 ? '' : titleHTML)  
220 - + '<div id="'+ (config.id||'') +'" class="layui-layer-content'+ ((config.type == 0 && config.icon !== -1) ? ' layui-layer-padding' :'') + (config.type == 3 ? ' layui-layer-loading'+config.icon : '') +'">'  
221 - + (config.type == 0 && config.icon !== -1 ? '<i class="layui-layer-ico layui-layer-ico'+ config.icon +'"></i>' : '')  
222 - + (config.type == 1 && conType ? '' : (config.content||''))  
223 - + '</div>'  
224 - + '<span class="layui-layer-setwin">'+ function(){  
225 - var closebtn = ismax ? '<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>' : '';  
226 - config.closeBtn && (closebtn += '<a class="layui-layer-ico '+ doms[7] +' '+ doms[7] + (config.title ? config.closeBtn : (config.type == 4 ? '1' : '2')) +'" href="javascript:;"></a>');  
227 - return closebtn;  
228 - }() + '</span>'  
229 - + (config.btn ? function(){  
230 - var button = '';  
231 - typeof config.btn === 'string' && (config.btn = [config.btn]);  
232 - for(var i = 0, len = config.btn.length; i < len; i++){  
233 - button += '<a class="'+ doms[6] +''+ i +'">'+ config.btn[i] +'</a>'  
234 - }  
235 - return '<div class="'+ doms[6] + (config.btnAlign ? (' layui-layer-btn-' + config.btnAlign) : '') +'">'+ button +'</div>'  
236 - }() : '')  
237 - + (config.resize ? '<span class="layui-layer-resize"></span>' : '')  
238 - + '</div>'  
239 - ], titleHTML, $('<div class="layui-layer-move"></div>'));  
240 - return that;  
241 - };  
242 -  
243 -//创建骨架  
244 - Class.pt.creat = function(){  
245 - var that = this  
246 - ,config = that.config  
247 - ,times = that.index, nodeIndex  
248 - ,content = config.content  
249 - ,conType = typeof content === 'object'  
250 - ,body = $('body');  
251 -  
252 - if(config.id && $('#'+config.id)[0]) return;  
253 -  
254 - if(typeof config.area === 'string'){  
255 - config.area = config.area === 'auto' ? ['', ''] : [config.area, ''];  
256 - }  
257 -  
258 - //anim兼容旧版shift  
259 - if(config.shift){  
260 - config.anim = config.shift;  
261 - }  
262 -  
263 - if(layer.ie == 6){  
264 - config.fixed = false;  
265 - }  
266 -  
267 - switch(config.type){  
268 - case 0:  
269 - config.btn = ('btn' in config) ? config.btn : ready.btn[0];  
270 - layer.closeAll('dialog');  
271 - break;  
272 - case 2:  
273 - var content = config.content = conType ? config.content : [config.content, 'auto'];  
274 - config.content = '<iframe scrolling="'+ (config.content[1]||'auto') +'" allowtransparency="true" id="'+ doms[4] +''+ times +'" name="'+ doms[4] +''+ times +'" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="' + config.content[0] + '"></iframe>';  
275 - break;  
276 - case 3:  
277 - delete config.title;  
278 - delete config.closeBtn;  
279 - config.icon === -1 && (config.icon === 0);  
280 - layer.closeAll('loading');  
281 - break;  
282 - case 4:  
283 - conType || (config.content = [config.content, 'body']);  
284 - config.follow = config.content[1];  
285 - config.content = config.content[0] + '<i class="layui-layer-TipsG"></i>';  
286 - delete config.title;  
287 - config.tips = typeof config.tips === 'object' ? config.tips : [config.tips, true];  
288 - config.tipsMore || layer.closeAll('tips');  
289 - break;  
290 - }  
291 -  
292 - //建立容器  
293 - that.vessel(conType, function(html, titleHTML, moveElem){  
294 - body.append(html[0]);  
295 - conType ? function(){  
296 - (config.type == 2 || config.type == 4) ? function(){  
297 - $('body').append(html[1]);  
298 - }() : function(){  
299 - if(!content.parents('.'+doms[0])[0]){  
300 - content.data('display', content.css('display')).show().addClass('layui-layer-wrap').wrap(html[1]);  
301 - $('#'+ doms[0] + times).find('.'+doms[5]).before(titleHTML);  
302 - }  
303 - }();  
304 - }() : body.append(html[1]);  
305 - $('.layui-layer-move')[0] || body.append(ready.moveElem = moveElem);  
306 - that.layero = $('#'+ doms[0] + times);  
307 - config.scrollbar || doms.html.css('overflow', 'hidden').attr('layer-full', times);  
308 - }).auto(times);  
309 -  
310 - config.type == 2 && layer.ie == 6 && that.layero.find('iframe').attr('src', content[0]);  
311 -  
312 - //坐标自适应浏览器窗口尺寸  
313 - config.type == 4 ? that.tips() : that.offset();  
314 - if(config.fixed){  
315 - win.on('resize', function(){  
316 - that.offset();  
317 - (/^\d+%$/.test(config.area[0]) || /^\d+%$/.test(config.area[1])) && that.auto(times);  
318 - config.type == 4 && that.tips();  
319 - });  
320 - }  
321 -  
322 - config.time <= 0 || setTimeout(function(){  
323 - layer.close(that.index)  
324 - }, config.time);  
325 - that.move().callback();  
326 -  
327 - //为兼容jQuery3.0的css动画影响元素尺寸计算  
328 - if(doms.anim[config.anim]){  
329 - that.layero.addClass(doms.anim[config.anim]);  
330 - };  
331 -  
332 - //记录关闭动画  
333 - if(config.isOutAnim){  
334 - that.layero.data('isOutAnim', true);  
335 - }  
336 - };  
337 -  
338 -//自适应  
339 - Class.pt.auto = function(index){  
340 - var that = this, config = that.config, layero = $('#'+ doms[0] + index);  
341 - if(config.area[0] === '' && config.maxWidth > 0){  
342 - //为了修复IE7下一个让人难以理解的bug  
343 - if(layer.ie && layer.ie < 8 && config.btn){  
344 - layero.width(layero.innerWidth());  
345 - }  
346 - layero.outerWidth() > config.maxWidth && layero.width(config.maxWidth);  
347 - }  
348 - var area = [layero.innerWidth(), layero.innerHeight()];  
349 - var titHeight = layero.find(doms[1]).outerHeight() || 0;  
350 - var btnHeight = layero.find('.'+doms[6]).outerHeight() || 0;  
351 - function setHeight(elem){  
352 - elem = layero.find(elem);  
353 - elem.height(area[1] - titHeight - btnHeight - 2*(parseFloat(elem.css('padding-top'))|0));  
354 - }  
355 - switch(config.type){  
356 - case 2:  
357 - setHeight('iframe');  
358 - break;  
359 - default:  
360 - if(config.area[1] === ''){  
361 - if(config.fixed && area[1] >= win.height()){  
362 - area[1] = win.height();  
363 - setHeight('.'+doms[5]);  
364 - }  
365 - } else {  
366 - setHeight('.'+doms[5]);  
367 - }  
368 - break;  
369 - }  
370 - return that;  
371 - };  
372 -  
373 -//计算坐标  
374 - Class.pt.offset = function(){  
375 - var that = this, config = that.config, layero = that.layero;  
376 - var area = [layero.outerWidth(), layero.outerHeight()];  
377 - var type = typeof config.offset === 'object';  
378 - that.offsetTop = (win.height() - area[1])/2;  
379 - that.offsetLeft = (win.width() - area[0])/2;  
380 -  
381 - if(type){  
382 - that.offsetTop = config.offset[0];  
383 - that.offsetLeft = config.offset[1]||that.offsetLeft;  
384 - } else if(config.offset !== 'auto'){  
385 -  
386 - if(config.offset === 't'){ //上  
387 - that.offsetTop = 0;  
388 - } else if(config.offset === 'r'){ //右  
389 - that.offsetLeft = win.width() - area[0];  
390 - } else if(config.offset === 'b'){ //下  
391 - that.offsetTop = win.height() - area[1];  
392 - } else if(config.offset === 'l'){ //左  
393 - that.offsetLeft = 0;  
394 - } else if(config.offset === 'lt'){ //左上角  
395 - that.offsetTop = 0;  
396 - that.offsetLeft = 0;  
397 - } else if(config.offset === 'lb'){ //左下角  
398 - that.offsetTop = win.height() - area[1];  
399 - that.offsetLeft = 0;  
400 - } else if(config.offset === 'rt'){ //右上角  
401 - that.offsetTop = 0;  
402 - that.offsetLeft = win.width() - area[0];  
403 - } else if(config.offset === 'rb'){ //右下角  
404 - that.offsetTop = win.height() - area[1];  
405 - that.offsetLeft = win.width() - area[0];  
406 - } else {  
407 - that.offsetTop = config.offset;  
408 - }  
409 -  
410 - }  
411 -  
412 - if(!config.fixed){  
413 - that.offsetTop = /%$/.test(that.offsetTop) ?  
414 - win.height()*parseFloat(that.offsetTop)/100  
415 - : parseFloat(that.offsetTop);  
416 - that.offsetLeft = /%$/.test(that.offsetLeft) ?  
417 - win.width()*parseFloat(that.offsetLeft)/100  
418 - : parseFloat(that.offsetLeft);  
419 - that.offsetTop += win.scrollTop();  
420 - that.offsetLeft += win.scrollLeft();  
421 - }  
422 -  
423 - if(layero.attr('minLeft')){  
424 - that.offsetTop = win.height() - (layero.find(doms[1]).outerHeight() || 0);  
425 - that.offsetLeft = layero.css('left');  
426 - }  
427 -  
428 - layero.css({top: that.offsetTop, left: that.offsetLeft});  
429 - };  
430 -  
431 -//Tips  
432 - Class.pt.tips = function(){  
433 - var that = this, config = that.config, layero = that.layero;  
434 - var layArea = [layero.outerWidth(), layero.outerHeight()], follow = $(config.follow);  
435 - if(!follow[0]) follow = $('body');  
436 - var goal = {  
437 - width: follow.outerWidth(),  
438 - height: follow.outerHeight(),  
439 - top: follow.offset().top,  
440 - left: follow.offset().left  
441 - }, tipsG = layero.find('.layui-layer-TipsG');  
442 -  
443 - var guide = config.tips[0];  
444 - config.tips[1] || tipsG.remove();  
445 -  
446 - goal.autoLeft = function(){  
447 - if(goal.left + layArea[0] - win.width() > 0){  
448 - goal.tipLeft = goal.left + goal.width - layArea[0];  
449 - tipsG.css({right: 12, left: 'auto'});  
450 - } else {  
451 - goal.tipLeft = goal.left;  
452 - };  
453 - };  
454 -  
455 - //辨别tips的方位  
456 - goal.where = [function(){ //上  
457 - goal.autoLeft();  
458 - goal.tipTop = goal.top - layArea[1] - 10;  
459 - tipsG.removeClass('layui-layer-TipsB').addClass('layui-layer-TipsT').css('border-right-color', config.tips[1]);  
460 - }, function(){ //右  
461 - goal.tipLeft = goal.left + goal.width + 10;  
462 - goal.tipTop = goal.top;  
463 - tipsG.removeClass('layui-layer-TipsL').addClass('layui-layer-TipsR').css('border-bottom-color', config.tips[1]);  
464 - }, function(){ //下  
465 - goal.autoLeft();  
466 - goal.tipTop = goal.top + goal.height + 10;  
467 - tipsG.removeClass('layui-layer-TipsT').addClass('layui-layer-TipsB').css('border-right-color', config.tips[1]);  
468 - }, function(){ //左  
469 - goal.tipLeft = goal.left - layArea[0] - 10;  
470 - goal.tipTop = goal.top;  
471 - tipsG.removeClass('layui-layer-TipsR').addClass('layui-layer-TipsL').css('border-bottom-color', config.tips[1]);  
472 - }];  
473 - goal.where[guide-1]();  
474 -  
475 - /* 8*2为小三角形占据的空间 */  
476 - if(guide === 1){  
477 - goal.top - (win.scrollTop() + layArea[1] + 8*2) < 0 && goal.where[2]();  
478 - } else if(guide === 2){  
479 - win.width() - (goal.left + goal.width + layArea[0] + 8*2) > 0 || goal.where[3]()  
480 - } else if(guide === 3){  
481 - (goal.top - win.scrollTop() + goal.height + layArea[1] + 8*2) - win.height() > 0 && goal.where[0]();  
482 - } else if(guide === 4){  
483 - layArea[0] + 8*2 - goal.left > 0 && goal.where[1]()  
484 - }  
485 -  
486 - layero.find('.'+doms[5]).css({  
487 - 'background-color': config.tips[1],  
488 - 'padding-right': (config.closeBtn ? '30px' : '')  
489 - });  
490 - layero.css({  
491 - left: goal.tipLeft - (config.fixed ? win.scrollLeft() : 0),  
492 - top: goal.tipTop - (config.fixed ? win.scrollTop() : 0)  
493 - });  
494 - }  
495 -  
496 -//拖拽层  
497 - Class.pt.move = function(){  
498 - var that = this  
499 - ,config = that.config  
500 - ,_DOC = $(document)  
501 - ,layero = that.layero  
502 - ,moveElem = layero.find(config.move)  
503 - ,resizeElem = layero.find('.layui-layer-resize')  
504 - ,dict = {};  
505 -  
506 - if(config.move){  
507 - moveElem.css('cursor', 'move');  
508 - }  
509 -  
510 - moveElem.on('mousedown', function(e){  
511 - e.preventDefault();  
512 - if(config.move){  
513 - dict.moveStart = true;  
514 - dict.offset = [  
515 - e.clientX - parseFloat(layero.css('left'))  
516 - ,e.clientY - parseFloat(layero.css('top'))  
517 - ];  
518 - ready.moveElem.css('cursor', 'move').show();  
519 - }  
520 - });  
521 -  
522 - resizeElem.on('mousedown', function(e){  
523 - e.preventDefault();  
524 - dict.resizeStart = true;  
525 - dict.offset = [e.clientX, e.clientY];  
526 - dict.area = [  
527 - layero.outerWidth()  
528 - ,layero.outerHeight()  
529 - ];  
530 - ready.moveElem.css('cursor', 'se-resize').show();  
531 - });  
532 -  
533 - _DOC.on('mousemove', function(e){  
534 -  
535 - //拖拽移动  
536 - if(dict.moveStart){  
537 - var X = e.clientX - dict.offset[0]  
538 - ,Y = e.clientY - dict.offset[1]  
539 - ,fixed = layero.css('position') === 'fixed';  
540 -  
541 - e.preventDefault();  
542 -  
543 - dict.stX = fixed ? 0 : win.scrollLeft();  
544 - dict.stY = fixed ? 0 : win.scrollTop();  
545 -  
546 - //控制元素不被拖出窗口外  
547 - if(!config.moveOut){  
548 - var setRig = win.width() - layero.outerWidth() + dict.stX  
549 - ,setBot = win.height() - layero.outerHeight() + dict.stY;  
550 - X < dict.stX && (X = dict.stX);  
551 - X > setRig && (X = setRig);  
552 - Y < dict.stY && (Y = dict.stY);  
553 - Y > setBot && (Y = setBot);  
554 - }  
555 -  
556 - layero.css({  
557 - left: X  
558 - ,top: Y  
559 - });  
560 - }  
561 -  
562 - //Resize  
563 - if(config.resize && dict.resizeStart){  
564 - var X = e.clientX - dict.offset[0]  
565 - ,Y = e.clientY - dict.offset[1];  
566 -  
567 - e.preventDefault();  
568 -  
569 - layer.style(that.index, {  
570 - width: dict.area[0] + X  
571 - ,height: dict.area[1] + Y  
572 - })  
573 - dict.isResize = true;  
574 - config.resizing && config.resizing(layero);  
575 - }  
576 - }).on('mouseup', function(e){  
577 - if(dict.moveStart){  
578 - delete dict.moveStart;  
579 - ready.moveElem.hide();  
580 - config.moveEnd && config.moveEnd(layero);  
581 - }  
582 - if(dict.resizeStart){  
583 - delete dict.resizeStart;  
584 - ready.moveElem.hide();  
585 - }  
586 - });  
587 -  
588 - return that;  
589 - };  
590 -  
591 - Class.pt.callback = function(){  
592 - var that = this, layero = that.layero, config = that.config;  
593 - that.openLayer();  
594 - if(config.success){  
595 - if(config.type == 2){  
596 - layero.find('iframe').on('load', function(){  
597 - config.success(layero, that.index);  
598 - });  
599 - } else {  
600 - config.success(layero, that.index);  
601 - }  
602 - }  
603 - layer.ie == 6 && that.IE6(layero);  
604 -  
605 - //按钮  
606 - layero.find('.'+ doms[6]).children('a').on('click', function(){  
607 - var index = $(this).index();  
608 - if(index === 0){  
609 - if(config.yes){  
610 - config.yes(that.index, layero)  
611 - } else if(config['btn1']){  
612 - config['btn1'](that.index, layero)  
613 - } else {  
614 - layer.close(that.index);  
615 - }  
616 - } else {  
617 - var close = config['btn'+(index+1)] && config['btn'+(index+1)](that.index, layero);  
618 - close === false || layer.close(that.index);  
619 - }  
620 - });  
621 -  
622 - //取消  
623 - function cancel(){  
624 - var close = config.cancel && config.cancel(that.index, layero);  
625 - close === false || layer.close(that.index);  
626 - }  
627 -  
628 - //右上角关闭回调  
629 - layero.find('.'+ doms[7]).on('click', cancel);  
630 -  
631 - //点遮罩关闭  
632 - if(config.shadeClose){  
633 - $('#layui-layer-shade'+ that.index).on('click', function(){  
634 - layer.close(that.index);  
635 - });  
636 - }  
637 -  
638 - //最小化  
639 - layero.find('.layui-layer-min').on('click', function(){  
640 - var min = config.min && config.min(layero);  
641 - min === false || layer.min(that.index, config);  
642 - });  
643 -  
644 - //全屏/还原  
645 - layero.find('.layui-layer-max').on('click', function(){  
646 - if($(this).hasClass('layui-layer-maxmin')){  
647 - layer.restore(that.index);  
648 - config.restore && config.restore(layero);  
649 - } else {  
650 - layer.full(that.index, config);  
651 - setTimeout(function(){  
652 - config.full && config.full(layero);  
653 - }, 100);  
654 - }  
655 - });  
656 -  
657 - config.end && (ready.end[that.index] = config.end);  
658 - };  
659 -  
660 -//for ie6 恢复select  
661 - ready.reselect = function(){  
662 - $.each($('select'), function(index , value){  
663 - var sthis = $(this);  
664 - if(!sthis.parents('.'+doms[0])[0]){  
665 - (sthis.attr('layer') == 1 && $('.'+doms[0]).length < 1) && sthis.removeAttr('layer').show();  
666 - }  
667 - sthis = null;  
668 - });  
669 - };  
670 -  
671 - Class.pt.IE6 = function(layero){  
672 - //隐藏select  
673 - $('select').each(function(index , value){  
674 - var sthis = $(this);  
675 - if(!sthis.parents('.'+doms[0])[0]){  
676 - sthis.css('display') === 'none' || sthis.attr({'layer' : '1'}).hide();  
677 - }  
678 - sthis = null;  
679 - });  
680 - };  
681 -  
682 -//需依赖原型的对外方法  
683 - Class.pt.openLayer = function(){  
684 - var that = this;  
685 -  
686 - //置顶当前窗口  
687 - layer.zIndex = that.config.zIndex;  
688 - layer.setTop = function(layero){  
689 - var setZindex = function(){  
690 - layer.zIndex++;  
691 - layero.css('z-index', layer.zIndex + 1);  
692 - };  
693 - layer.zIndex = parseInt(layero[0].style.zIndex);  
694 - layero.on('mousedown', setZindex);  
695 - return layer.zIndex;  
696 - };  
697 - };  
698 -  
699 - ready.record = function(layero){  
700 - var area = [  
701 - layero.width(),  
702 - layero.height(),  
703 - layero.position().top,  
704 - layero.position().left + parseFloat(layero.css('margin-left'))  
705 - ];  
706 - layero.find('.layui-layer-max').addClass('layui-layer-maxmin');  
707 - layero.attr({area: area});  
708 - };  
709 -  
710 - ready.rescollbar = function(index){  
711 - if(doms.html.attr('layer-full') == index){  
712 - if(doms.html[0].style.removeProperty){  
713 - doms.html[0].style.removeProperty('overflow');  
714 - } else {  
715 - doms.html[0].style.removeAttribute('overflow');  
716 - }  
717 - doms.html.removeAttr('layer-full');  
718 - }  
719 - };  
720 -  
721 - /** 内置成员 */  
722 -  
723 - window.layer = layer;  
724 -  
725 -//获取子iframe的DOM  
726 - layer.getChildFrame = function(selector, index){  
727 - index = index || $('.'+doms[4]).attr('times');  
728 - return $('#'+ doms[0] + index).find('iframe').contents().find(selector);  
729 - };  
730 -  
731 -//得到当前iframe层的索引,子iframe时使用  
732 - layer.getFrameIndex = function(name){  
733 - return $('#'+ name).parents('.'+doms[4]).attr('times');  
734 - };  
735 -  
736 -//iframe层自适应宽高  
737 - layer.iframeAuto = function(index){  
738 - if(!index) return;  
739 - var heg = layer.getChildFrame('html', index).outerHeight();  
740 - var layero = $('#'+ doms[0] + index);  
741 - var titHeight = layero.find(doms[1]).outerHeight() || 0;  
742 - var btnHeight = layero.find('.'+doms[6]).outerHeight() || 0;  
743 - layero.css({height: heg + titHeight + btnHeight});  
744 - layero.find('iframe').css({height: heg});  
745 - };  
746 -  
747 -//重置iframe url  
748 - layer.iframeSrc = function(index, url){  
749 - $('#'+ doms[0] + index).find('iframe').attr('src', url);  
750 - };  
751 -  
752 -//设定层的样式  
753 - layer.style = function(index, options, limit){  
754 - var layero = $('#'+ doms[0] + index)  
755 - ,contElem = layero.find('.layui-layer-content')  
756 - ,type = layero.attr('type')  
757 - ,titHeight = layero.find(doms[1]).outerHeight() || 0  
758 - ,btnHeight = layero.find('.'+doms[6]).outerHeight() || 0  
759 - ,minLeft = layero.attr('minLeft');  
760 -  
761 - if(type === ready.type[3] || type === ready.type[4]){  
762 - return;  
763 - }  
764 -  
765 - if(!limit){  
766 - if(parseFloat(options.width) <= 260){  
767 - options.width = 260;  
768 - };  
769 -  
770 - if(parseFloat(options.height) - titHeight - btnHeight <= 64){  
771 - options.height = 64 + titHeight + btnHeight;  
772 - };  
773 - }  
774 -  
775 - layero.css(options);  
776 - btnHeight = layero.find('.'+doms[6]).outerHeight();  
777 -  
778 - if(type === ready.type[2]){  
779 - layero.find('iframe').css({  
780 - height: parseFloat(options.height) - titHeight - btnHeight  
781 - });  
782 - } else {  
783 - contElem.css({  
784 - height: parseFloat(options.height) - titHeight - btnHeight  
785 - - parseFloat(contElem.css('padding-top'))  
786 - - parseFloat(contElem.css('padding-bottom'))  
787 - })  
788 - }  
789 - };  
790 -  
791 -//最小化  
792 - layer.min = function(index, options){  
793 - var layero = $('#'+ doms[0] + index)  
794 - ,titHeight = layero.find(doms[1]).outerHeight() || 0  
795 - ,left = layero.attr('minLeft') || (181*ready.minIndex)+'px'  
796 - ,position = layero.css('position');  
797 -  
798 - ready.record(layero);  
799 -  
800 - if(ready.minLeft[0]){  
801 - left = ready.minLeft[0];  
802 - ready.minLeft.shift();  
803 - }  
804 -  
805 - layero.attr('position', position);  
806 -  
807 - layer.style(index, {  
808 - width: 180  
809 - ,height: titHeight  
810 - ,left: left  
811 - ,top: win.height() - titHeight  
812 - ,position: 'fixed'  
813 - ,overflow: 'hidden'  
814 - }, true);  
815 -  
816 - layero.find('.layui-layer-min').hide();  
817 - layero.attr('type') === 'page' && layero.find(doms[4]).hide();  
818 - ready.rescollbar(index);  
819 -  
820 - if(!layero.attr('minLeft')){  
821 - ready.minIndex++;  
822 - }  
823 - layero.attr('minLeft', left);  
824 - };  
825 -  
826 -//还原  
827 - layer.restore = function(index){  
828 - var layero = $('#'+ doms[0] + index), area = layero.attr('area').split(',');  
829 - var type = layero.attr('type');  
830 - layer.style(index, {  
831 - width: parseFloat(area[0]),  
832 - height: parseFloat(area[1]),  
833 - top: parseFloat(area[2]),  
834 - left: parseFloat(area[3]),  
835 - position: layero.attr('position'),  
836 - overflow: 'visible'  
837 - }, true);  
838 - layero.find('.layui-layer-max').removeClass('layui-layer-maxmin');  
839 - layero.find('.layui-layer-min').show();  
840 - layero.attr('type') === 'page' && layero.find(doms[4]).show();  
841 - ready.rescollbar(index);  
842 - };  
843 -  
844 -//全屏  
845 - layer.full = function(index){  
846 - var layero = $('#'+ doms[0] + index), timer;  
847 - ready.record(layero);  
848 - if(!doms.html.attr('layer-full')){  
849 - doms.html.css('overflow','hidden').attr('layer-full', index);  
850 - }  
851 - clearTimeout(timer);  
852 - timer = setTimeout(function(){  
853 - var isfix = layero.css('position') === 'fixed';  
854 - layer.style(index, {  
855 - top: isfix ? 0 : win.scrollTop(),  
856 - left: isfix ? 0 : win.scrollLeft(),  
857 - width: win.width(),  
858 - height: win.height()  
859 - }, true);  
860 - layero.find('.layui-layer-min').hide();  
861 - }, 100);  
862 - };  
863 -  
864 -//改变title  
865 - layer.title = function(name, index){  
866 - var title = $('#'+ doms[0] + (index||layer.index)).find(doms[1]);  
867 - title.html(name);  
868 - };  
869 -  
870 -//关闭layer总方法  
871 - layer.close = function(index){  
872 - var layero = $('#'+ doms[0] + index), type = layero.attr('type'), closeAnim = 'layer-anim-close';  
873 - if(!layero[0]) return;  
874 - var WRAP = 'layui-layer-wrap', remove = function(){  
875 - if(type === ready.type[1] && layero.attr('conType') === 'object'){  
876 - layero.children(':not(.'+ doms[5] +')').remove();  
877 - var wrap = layero.find('.'+WRAP);  
878 - for(var i = 0; i < 2; i++){  
879 - wrap.unwrap();  
880 - }  
881 - wrap.css('display', wrap.data('display')).removeClass(WRAP);  
882 - } else {  
883 - //低版本IE 回收 iframe  
884 - if(type === ready.type[2]){  
885 - try {  
886 - var iframe = $('#'+doms[4]+index)[0];  
887 - iframe.contentWindow.document.write('');  
888 - iframe.contentWindow.close();  
889 - layero.find('.'+doms[5])[0].removeChild(iframe);  
890 - } catch(e){}  
891 - }  
892 - layero[0].innerHTML = '';  
893 - layero.remove();  
894 - }  
895 - typeof ready.end[index] === 'function' && ready.end[index]();  
896 - delete ready.end[index];  
897 - };  
898 -  
899 - if(layero.data('isOutAnim')){  
900 - layero.addClass(closeAnim);  
901 - }  
902 -  
903 - $('#layui-layer-moves, #layui-layer-shade' + index).remove();  
904 - layer.ie == 6 && ready.reselect();  
905 - ready.rescollbar(index);  
906 - if(layero.attr('minLeft')){  
907 - ready.minIndex--;  
908 - ready.minLeft.push(layero.attr('minLeft'));  
909 - }  
910 -  
911 - if((layer.ie && layer.ie < 10) || !layero.data('isOutAnim')){  
912 - remove()  
913 - } else {  
914 - setTimeout(function(){  
915 - remove();  
916 - }, 200);  
917 - }  
918 - };  
919 -  
920 -//关闭所有层  
921 - layer.closeAll = function(type){  
922 - $.each($('.'+doms[0]), function(){  
923 - var othis = $(this);  
924 - var is = type ? (othis.attr('type') === type) : 1;  
925 - is && layer.close(othis.attr('times'));  
926 - is = null;  
927 - });  
928 - };  
929 -  
930 - /**  
931 -  
932 - 拓展模块,layui开始合并在一起  
933 -  
934 - */  
935 -  
936 - var cache = layer.cache||{}, skin = function(type){  
937 - return (cache.skin ? (' ' + cache.skin + ' ' + cache.skin + '-'+type) : '');  
938 - };  
939 -  
940 -//仿系统prompt  
941 - layer.prompt = function(options, yes){  
942 - var style = '';  
943 - options = options || {};  
944 -  
945 - if(typeof options === 'function') yes = options;  
946 -  
947 - if(options.area){  
948 - var area = options.area;  
949 - style = 'style="width: '+ area[0] +'; height: '+ area[1] + ';"';  
950 - delete options.area;  
951 - }  
952 - var prompt, content = options.formType == 2 ? '<textarea class="layui-layer-input"' + style +'>' + (options.value||'') +'</textarea>' : function(){  
953 - return '<input type="'+ (options.formType == 1 ? 'password' : 'text') +'" class="layui-layer-input" value="'+ (options.value||'') +'">';  
954 - }();  
955 -  
956 - var success = options.success;  
957 - delete options.success;  
958 -  
959 - return layer.open($.extend({  
960 - type: 1  
961 - ,btn: ['&#x786E;&#x5B9A;','&#x53D6;&#x6D88;']  
962 - ,content: content  
963 - ,skin: 'layui-layer-prompt' + skin('prompt')  
964 - ,maxWidth: win.width()  
965 - ,success: function(layero){  
966 - prompt = layero.find('.layui-layer-input');  
967 - prompt.focus();  
968 - typeof success === 'function' && success(layero);  
969 - }  
970 - ,resize: false  
971 - ,yes: function(index){  
972 - var value = prompt.val();  
973 - if(value === ''){  
974 - prompt.focus();  
975 - } else if(value.length > (options.maxlength||500)) {  
976 - layer.tips('&#x6700;&#x591A;&#x8F93;&#x5165;'+ (options.maxlength || 500) +'&#x4E2A;&#x5B57;&#x6570;', prompt, {tips: 1});  
977 - } else {  
978 - yes && yes(value, index, prompt);  
979 - }  
980 - }  
981 - }, options));  
982 - };  
983 -  
984 -//tab层  
985 - layer.tab = function(options){  
986 - options = options || {};  
987 -  
988 - var tab = options.tab || {}  
989 - ,success = options.success;  
990 -  
991 - delete options.success;  
992 -  
993 - return layer.open($.extend({  
994 - type: 1,  
995 - skin: 'layui-layer-tab' + skin('tab'),  
996 - resize: false,  
997 - title: function(){  
998 - var len = tab.length, ii = 1, str = '';  
999 - if(len > 0){  
1000 - str = '<span class="layui-layer-tabnow">'+ tab[0].title +'</span>';  
1001 - for(; ii < len; ii++){  
1002 - str += '<span>'+ tab[ii].title +'</span>';  
1003 - }  
1004 - }  
1005 - return str;  
1006 - }(),  
1007 - content: '<ul class="layui-layer-tabmain">'+ function(){  
1008 - var len = tab.length, ii = 1, str = '';  
1009 - if(len > 0){  
1010 - str = '<li class="layui-layer-tabli xubox_tab_layer">'+ (tab[0].content || 'no content') +'</li>';  
1011 - for(; ii < len; ii++){  
1012 - str += '<li class="layui-layer-tabli">'+ (tab[ii].content || 'no content') +'</li>';  
1013 - }  
1014 - }  
1015 - return str;  
1016 - }() +'</ul>',  
1017 - success: function(layero){  
1018 - var btn = layero.find('.layui-layer-title').children();  
1019 - var main = layero.find('.layui-layer-tabmain').children();  
1020 - btn.on('mousedown', function(e){  
1021 - e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true;  
1022 - var othis = $(this), index = othis.index();  
1023 - othis.addClass('layui-layer-tabnow').siblings().removeClass('layui-layer-tabnow');  
1024 - main.eq(index).show().siblings().hide();  
1025 - typeof options.change === 'function' && options.change(index);  
1026 - });  
1027 - typeof success === 'function' && success(layero);  
1028 - }  
1029 - }, options));  
1030 - };  
1031 -  
1032 -//相册层  
1033 - layer.photos = function(options, loop, key){  
1034 - var dict = {};  
1035 - options = options || {};  
1036 - if(!options.photos) return;  
1037 - var type = options.photos.constructor === Object;  
1038 - var photos = type ? options.photos : {}, data = photos.data || [];  
1039 - var start = photos.start || 0;  
1040 - dict.imgIndex = (start|0) + 1;  
1041 -  
1042 - options.img = options.img || 'img';  
1043 -  
1044 - var success = options.success;  
1045 - delete options.success;  
1046 -  
1047 - if(!type){ //页面直接获取  
1048 - var parent = $(options.photos), pushData = function(){  
1049 - data = [];  
1050 - parent.find(options.img).each(function(index){  
1051 - var othis = $(this);  
1052 - othis.attr('layer-index', index);  
1053 - data.push({  
1054 - alt: othis.attr('alt'),  
1055 - pid: othis.attr('layer-pid'),  
1056 - src: othis.attr('layer-src') || othis.attr('src'),  
1057 - thumb: othis.attr('src')  
1058 - });  
1059 - })  
1060 - };  
1061 -  
1062 - pushData();  
1063 -  
1064 - if (data.length === 0) return;  
1065 -  
1066 - loop || parent.on('click', options.img, function(){  
1067 - var othis = $(this), index = othis.attr('layer-index');  
1068 - layer.photos($.extend(options, {  
1069 - photos: {  
1070 - start: index,  
1071 - data: data,  
1072 - tab: options.tab  
1073 - },  
1074 - full: options.full  
1075 - }), true);  
1076 - pushData();  
1077 - })  
1078 -  
1079 - //不直接弹出  
1080 - if(!loop) return;  
1081 -  
1082 - } else if (data.length === 0){  
1083 - return layer.msg('&#x6CA1;&#x6709;&#x56FE;&#x7247;');  
1084 - }  
1085 -  
1086 - //上一张  
1087 - dict.imgprev = function(key){  
1088 - dict.imgIndex--;  
1089 - if(dict.imgIndex < 1){  
1090 - dict.imgIndex = data.length;  
1091 - }  
1092 - dict.tabimg(key);  
1093 - };  
1094 -  
1095 - //下一张  
1096 - dict.imgnext = function(key,errorMsg){  
1097 - dict.imgIndex++;  
1098 - if(dict.imgIndex > data.length){  
1099 - dict.imgIndex = 1;  
1100 - if (errorMsg) {return};  
1101 - }  
1102 - dict.tabimg(key)  
1103 - };  
1104 -  
1105 - //方向键  
1106 - dict.keyup = function(event){  
1107 - if(!dict.end){  
1108 - var code = event.keyCode;  
1109 - event.preventDefault();  
1110 - if(code === 37){  
1111 - dict.imgprev(true);  
1112 - } else if(code === 39) {  
1113 - dict.imgnext(true);  
1114 - } else if(code === 27) {  
1115 - layer.close(dict.index);  
1116 - }  
1117 - }  
1118 - }  
1119 -  
1120 - //切换  
1121 - dict.tabimg = function(key){  
1122 - if(data.length <= 1) return;  
1123 - photos.start = dict.imgIndex - 1;  
1124 - layer.close(dict.index);  
1125 - return layer.photos(options, true, key);  
1126 - setTimeout(function(){  
1127 - layer.photos(options, true, key);  
1128 - }, 200);  
1129 - }  
1130 -  
1131 - //一些动作  
1132 - dict.event = function(){  
1133 - dict.bigimg.hover(function(){  
1134 - dict.imgsee.show();  
1135 - }, function(){  
1136 - dict.imgsee.hide();  
1137 - });  
1138 -  
1139 - dict.bigimg.find('.layui-layer-imgprev').on('click', function(event){  
1140 - event.preventDefault();  
1141 - dict.imgprev();  
1142 - });  
1143 -  
1144 - dict.bigimg.find('.layui-layer-imgnext').on('click', function(event){  
1145 - event.preventDefault();  
1146 - dict.imgnext();  
1147 - });  
1148 -  
1149 - $(document).on('keyup', dict.keyup);  
1150 - };  
1151 -  
1152 - //图片预加载  
1153 - function loadImage(url, callback, error) {  
1154 - var img = new Image();  
1155 - img.src = url;  
1156 - if(img.complete){  
1157 - return callback(img);  
1158 - }  
1159 - img.onload = function(){  
1160 - img.onload = null;  
1161 - callback(img);  
1162 - };  
1163 - img.onerror = function(e){  
1164 - img.onerror = null;  
1165 - error(e);  
1166 - };  
1167 - };  
1168 -  
1169 - dict.loadi = layer.load(1, {  
1170 - shade: 'shade' in options ? false : 0.9,  
1171 - scrollbar: false  
1172 - });  
1173 -  
1174 - loadImage(data[start].src, function(img){  
1175 - layer.close(dict.loadi);  
1176 - dict.index = layer.open($.extend({  
1177 - type: 1,  
1178 - id: 'layui-layer-photos',  
1179 - area: function(){  
1180 - var imgarea = [img.width, img.height];  
1181 - var winarea = [$(window).width() - 100, $(window).height() - 100];  
1182 -  
1183 - //如果 实际图片的宽或者高比 屏幕大(那么进行缩放)  
1184 - if(!options.full && (imgarea[0]>winarea[0]||imgarea[1]>winarea[1])){  
1185 - var wh = [imgarea[0]/winarea[0],imgarea[1]/winarea[1]];//取宽度缩放比例、高度缩放比例  
1186 - if(wh[0] > wh[1]){//取缩放比例最大的进行缩放  
1187 - imgarea[0] = imgarea[0]/wh[0];  
1188 - imgarea[1] = imgarea[1]/wh[0];  
1189 - } else if(wh[0] < wh[1]){  
1190 - imgarea[0] = imgarea[0]/wh[1];  
1191 - imgarea[1] = imgarea[1]/wh[1];  
1192 - }  
1193 - }  
1194 -  
1195 - return [imgarea[0]+'px', imgarea[1]+'px'];  
1196 - }(),  
1197 - title: false,  
1198 - shade: 0.9,  
1199 - shadeClose: true,  
1200 - closeBtn: false,  
1201 - move: '.layui-layer-phimg img',  
1202 - moveType: 1,  
1203 - scrollbar: false,  
1204 - moveOut: true,  
1205 - //anim: Math.random()*5|0,  
1206 - isOutAnim: false,  
1207 - skin: 'layui-layer-photos' + skin('photos'),  
1208 - content: '<div class="layui-layer-phimg">'  
1209 - +'<img src="'+ data[start].src +'" alt="'+ (data[start].alt||'') +'" layer-pid="'+ data[start].pid +'">'  
1210 - +'<div class="layui-layer-imgsee">'  
1211 - +(data.length > 1 ? '<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>' : '')  
1212 - +'<div class="layui-layer-imgbar" style="display:'+ (key ? 'block' : '') +'"><span class="layui-layer-imgtit"><a href="javascript:;">'+ (data[start].alt||'') +'</a><em>'+ dict.imgIndex +'/'+ data.length +'</em></span></div>'  
1213 - +'</div>'  
1214 - +'</div>',  
1215 - success: function(layero, index){  
1216 - dict.bigimg = layero.find('.layui-layer-phimg');  
1217 - dict.imgsee = layero.find('.layui-layer-imguide,.layui-layer-imgbar');  
1218 - dict.event(layero);  
1219 - options.tab && options.tab(data[start], layero);  
1220 - typeof success === 'function' && success(layero);  
1221 - }, end: function(){  
1222 - dict.end = true;  
1223 - $(document).off('keyup', dict.keyup);  
1224 - }  
1225 - }, options));  
1226 - }, function(){  
1227 - layer.close(dict.loadi);  
1228 - layer.msg('&#x5F53;&#x524D;&#x56FE;&#x7247;&#x5730;&#x5740;&#x5F02;&#x5E38;<br>&#x662F;&#x5426;&#x7EE7;&#x7EED;&#x67E5;&#x770B;&#x4E0B;&#x4E00;&#x5F20;&#xFF1F;', {  
1229 - time: 30000,  
1230 - btn: ['&#x4E0B;&#x4E00;&#x5F20;', '&#x4E0D;&#x770B;&#x4E86;'],  
1231 - yes: function(){  
1232 - data.length > 1 && dict.imgnext(true,true);  
1233 - }  
1234 - });  
1235 - });  
1236 - };  
1237 -  
1238 -//主入口  
1239 - ready.run = function(_$){  
1240 - $ = _$;  
1241 - win = $(window);  
1242 - doms.html = $('html');  
1243 - layer.open = function(deliver){  
1244 - var o = new Class(deliver);  
1245 - return o.index;  
1246 - };  
1247 - };  
1248 -  
1249 -//加载方式  
1250 - window.layui && layui.define ? (  
1251 - layer.ready()  
1252 - ,layui.define('jquery', function(exports){ //layui加载  
1253 - layer.path = layui.cache.dir;  
1254 - ready.run(layui.jquery);  
1255 -  
1256 - //暴露模块  
1257 - window.layer = layer;  
1258 - exports('layer', layer);  
1259 - })  
1260 - ) : (  
1261 - (typeof define === 'function' && define.amd) ? define(['jquery'], function(){ //requirejs加载  
1262 - ready.run(window.jQuery);  
1263 - return layer;  
1264 - }) : function(){ //普通script标签加载  
1265 - ready.run(window.jQuery);  
1266 - layer.ready();  
1267 - }()  
1268 - );  
1269 - 1 +/**
  2 +
  3 + @Name:layer v3.0.3 Web弹层组件
  4 + @Author:贤心
  5 + @Site:http://layer.layui.com
  6 + @License:MIT
  7 +
  8 + */
  9 +
  10 +;!function(window, undefined){
  11 + "use strict";
  12 +
  13 + var isLayui = window.layui && layui.define, $, win, ready = {
  14 + getPath: function(){
  15 + var js = document.scripts, script = js[js.length - 1], jsPath = script.src;
  16 + if(script.getAttribute('merge')) return;
  17 + return jsPath.substring(0, jsPath.lastIndexOf("/") + 1);
  18 + }(),
  19 +
  20 + config: {}, end: {}, minIndex: 0, minLeft: [],
  21 + btn: ['&#x786E;&#x5B9A;', '&#x53D6;&#x6D88;'],
  22 +
  23 + //五种原始层模式
  24 + type: ['dialog', 'page', 'iframe', 'loading', 'tips']
  25 + };
  26 +
  27 +//默认内置方法。
  28 + var layer = {
  29 + v: '3.0.3',
  30 + ie: function(){ //ie版本
  31 + var agent = navigator.userAgent.toLowerCase();
  32 + return (!!window.ActiveXObject || "ActiveXObject" in window) ? (
  33 + (agent.match(/msie\s(\d+)/) || [])[1] || '11' //由于ie11并没有msie的标识
  34 + ) : false;
  35 + }(),
  36 + index: (window.layer && window.layer.v) ? 100000 : 0,
  37 + path: ready.getPath,
  38 + config: function(options, fn){
  39 + options = options || {};
  40 + layer.cache = ready.config = $.extend({}, ready.config, options);
  41 + layer.path = ready.config.path || layer.path;
  42 + typeof options.extend === 'string' && (options.extend = [options.extend]);
  43 +
  44 + if(ready.config.path) layer.ready();
  45 +
  46 + if(!options.extend) return this;
  47 +
  48 + isLayui
  49 + ? layui.addcss('modules/layer/' + options.extend)
  50 + : layer.link('skin/' + options.extend);
  51 +
  52 + return this;
  53 + },
  54 +
  55 + //载入CSS配件
  56 + link: function(href, fn, cssname){
  57 +
  58 + //未设置路径,则不主动加载css
  59 + if(!layer.path) return;
  60 +
  61 + var head = $('head')[0], link = document.createElement('link');
  62 + if(typeof fn === 'string') cssname = fn;
  63 + var app = (cssname || href).replace(/\.|\//g, '');
  64 + var id = 'layuicss-'+app, timeout = 0;
  65 +
  66 + link.rel = 'stylesheet';
  67 + link.href = layer.path + href;
  68 + link.id = id;
  69 +
  70 + if(!$('#'+ id)[0]){
  71 + head.appendChild(link);
  72 + }
  73 +
  74 + if(typeof fn !== 'function') return;
  75 +
  76 + //轮询css是否加载完毕
  77 + /* (function poll() {
  78 + if(++timeout > 8 * 1000 / 100){
  79 + return window.console && console.error('layer.css: Invalid');
  80 + };
  81 + parseInt($('#'+id).css('width')) === 1989 ? fn() : setTimeout(poll, 100);
  82 + }());*/
  83 + },
  84 +
  85 + ready: function(callback){
  86 + /*var cssname = 'skinlayercss', ver = '303';
  87 + isLayui ? layui.addcss('modules/layer/default/layer.css?v='+layer.v+ver, callback, cssname)
  88 + : layer.link('skin/default/layer.css?v='+layer.v+ver, callback, cssname);*/
  89 + return this;
  90 + },
  91 +
  92 + //各种快捷引用
  93 + alert: function(content, options, yes){
  94 + var type = typeof options === 'function';
  95 + if(type) yes = options;
  96 + return layer.open($.extend({
  97 + content: content,
  98 + yes: yes
  99 + }, type ? {} : options));
  100 + },
  101 +
  102 + confirm: function(content, options, yes, cancel){
  103 + var type = typeof options === 'function';
  104 + if(type){
  105 + cancel = yes;
  106 + yes = options;
  107 + }
  108 + return layer.open($.extend({
  109 + content: content,
  110 + btn: ready.btn,
  111 + yes: yes,
  112 + btn2: cancel
  113 + }, type ? {} : options));
  114 + },
  115 +
  116 + msg: function(content, options, end){ //最常用提示层
  117 + var type = typeof options === 'function', rskin = ready.config.skin;
  118 + var skin = (rskin ? rskin + ' ' + rskin + '-msg' : '')||'layui-layer-msg';
  119 + var anim = doms.anim.length - 1;
  120 + if(type) end = options;
  121 + return layer.open($.extend({
  122 + content: content,
  123 + time: 3000,
  124 + shade: false,
  125 + skin: skin,
  126 + title: false,
  127 + closeBtn: false,
  128 + btn: false,
  129 + resize: false,
  130 + end: end
  131 + }, (type && !ready.config.skin) ? {
  132 + skin: skin + ' layui-layer-hui',
  133 + anim: anim
  134 + } : function(){
  135 + options = options || {};
  136 + if(options.icon === -1 || options.icon === undefined && !ready.config.skin){
  137 + options.skin = skin + ' ' + (options.skin||'layui-layer-hui');
  138 + }
  139 + return options;
  140 + }()));
  141 + },
  142 +
  143 + load: function(icon, options){
  144 + return layer.open($.extend({
  145 + type: 3,
  146 + icon: icon || 0,
  147 + resize: false,
  148 + shade: 0.01
  149 + }, options));
  150 + },
  151 +
  152 + tips: function(content, follow, options){
  153 + return layer.open($.extend({
  154 + type: 4,
  155 + content: [content, follow],
  156 + closeBtn: false,
  157 + time: 3000,
  158 + shade: false,
  159 + resize: false,
  160 + fixed: false,
  161 + maxWidth: 210
  162 + }, options));
  163 + }
  164 + };
  165 +
  166 + var Class = function(setings){
  167 + var that = this;
  168 + that.index = ++layer.index;
  169 + that.config = $.extend({}, that.config, ready.config, setings);
  170 + document.body ? that.creat() : setTimeout(function(){
  171 + that.creat();
  172 + }, 30);
  173 + };
  174 +
  175 + Class.pt = Class.prototype;
  176 +
  177 +//缓存常用字符
  178 + var doms = ['layui-layer', '.layui-layer-title', '.layui-layer-main', '.layui-layer-dialog', 'layui-layer-iframe', 'layui-layer-content', 'layui-layer-btn', 'layui-layer-close'];
  179 + doms.anim = ['layer-anim', 'layer-anim-01', 'layer-anim-02', 'layer-anim-03', 'layer-anim-04', 'layer-anim-05', 'layer-anim-06'];
  180 +
  181 +//默认配置
  182 + Class.pt.config = {
  183 + type: 0,
  184 + shade: 0.3,
  185 + fixed: true,
  186 + move: doms[1],
  187 + title: '&#x4FE1;&#x606F;',
  188 + offset: 'auto',
  189 + area: 'auto',
  190 + closeBtn: 1,
  191 + time: 0, //0表示不自动关闭
  192 + zIndex: 19891014,
  193 + maxWidth: 360,
  194 + anim: 0,
  195 + isOutAnim: true,
  196 + icon: -1,
  197 + moveType: 1,
  198 + resize: true,
  199 + scrollbar: true, //是否允许浏览器滚动条
  200 + tips: 2
  201 + };
  202 +
  203 +//容器
  204 + Class.pt.vessel = function(conType, callback){
  205 + var that = this, times = that.index, config = that.config;
  206 + var zIndex = config.zIndex + times, titype = typeof config.title === 'object';
  207 + var ismax = config.maxmin && (config.type === 1 || config.type === 2);
  208 + var titleHTML = (config.title ? '<div class="layui-layer-title" style="'+ (titype ? config.title[1] : '') +'">'
  209 + + (titype ? config.title[0] : config.title)
  210 + + '</div>' : '');
  211 +
  212 + config.zIndex = zIndex;
  213 + callback([
  214 + //遮罩
  215 + config.shade ? ('<div class="layui-layer-shade" id="layui-layer-shade'+ times +'" times="'+ times +'" style="'+ ('z-index:'+ (zIndex-1) +'; background-color:'+ (config.shade[1]||'#000') +'; opacity:'+ (config.shade[0]||config.shade) +'; filter:alpha(opacity='+ (config.shade[0]*100||config.shade*100) +');') +'"></div>') : '',
  216 +
  217 + //主体
  218 + '<div class="'+ doms[0] + (' layui-layer-'+ready.type[config.type]) + (((config.type == 0 || config.type == 2) && !config.shade) ? ' layui-layer-border' : '') + ' ' + (config.skin||'') +'" id="'+ doms[0] + times +'" type="'+ ready.type[config.type] +'" times="'+ times +'" showtime="'+ config.time +'" conType="'+ (conType ? 'object' : 'string') +'" style="z-index: '+ zIndex +'; width:'+ config.area[0] + ';height:' + config.area[1] + (config.fixed ? '' : ';position:absolute;') +'">'
  219 + + (conType && config.type != 2 ? '' : titleHTML)
  220 + + '<div id="'+ (config.id||'') +'" class="layui-layer-content'+ ((config.type == 0 && config.icon !== -1) ? ' layui-layer-padding' :'') + (config.type == 3 ? ' layui-layer-loading'+config.icon : '') +'">'
  221 + + (config.type == 0 && config.icon !== -1 ? '<i class="layui-layer-ico layui-layer-ico'+ config.icon +'"></i>' : '')
  222 + + (config.type == 1 && conType ? '' : (config.content||''))
  223 + + '</div>'
  224 + + '<span class="layui-layer-setwin">'+ function(){
  225 + var closebtn = ismax ? '<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>' : '';
  226 + config.closeBtn && (closebtn += '<a class="layui-layer-ico '+ doms[7] +' '+ doms[7] + (config.title ? config.closeBtn : (config.type == 4 ? '1' : '2')) +'" href="javascript:;"></a>');
  227 + return closebtn;
  228 + }() + '</span>'
  229 + + (config.btn ? function(){
  230 + var button = '';
  231 + typeof config.btn === 'string' && (config.btn = [config.btn]);
  232 + for(var i = 0, len = config.btn.length; i < len; i++){
  233 + button += '<a class="'+ doms[6] +''+ i +'">'+ config.btn[i] +'</a>'
  234 + }
  235 + return '<div class="'+ doms[6] + (config.btnAlign ? (' layui-layer-btn-' + config.btnAlign) : '') +'">'+ button +'</div>'
  236 + }() : '')
  237 + + (config.resize ? '<span class="layui-layer-resize"></span>' : '')
  238 + + '</div>'
  239 + ], titleHTML, $('<div class="layui-layer-move"></div>'));
  240 + return that;
  241 + };
  242 +
  243 +//创建骨架
  244 + Class.pt.creat = function(){
  245 + var that = this
  246 + ,config = that.config
  247 + ,times = that.index, nodeIndex
  248 + ,content = config.content
  249 + ,conType = typeof content === 'object'
  250 + ,body = $('body');
  251 +
  252 + if(config.id && $('#'+config.id)[0]) return;
  253 +
  254 + if(typeof config.area === 'string'){
  255 + config.area = config.area === 'auto' ? ['', ''] : [config.area, ''];
  256 + }
  257 +
  258 + //anim兼容旧版shift
  259 + if(config.shift){
  260 + config.anim = config.shift;
  261 + }
  262 +
  263 + if(layer.ie == 6){
  264 + config.fixed = false;
  265 + }
  266 +
  267 + switch(config.type){
  268 + case 0:
  269 + config.btn = ('btn' in config) ? config.btn : ready.btn[0];
  270 + layer.closeAll('dialog');
  271 + break;
  272 + case 2:
  273 + var content = config.content = conType ? config.content : [config.content, 'auto'];
  274 + config.content = '<iframe scrolling="'+ (config.content[1]||'auto') +'" allowtransparency="true" id="'+ doms[4] +''+ times +'" name="'+ doms[4] +''+ times +'" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="' + config.content[0] + '"></iframe>';
  275 + break;
  276 + case 3:
  277 + delete config.title;
  278 + delete config.closeBtn;
  279 + config.icon === -1 && (config.icon === 0);
  280 + layer.closeAll('loading');
  281 + break;
  282 + case 4:
  283 + conType || (config.content = [config.content, 'body']);
  284 + config.follow = config.content[1];
  285 + config.content = config.content[0] + '<i class="layui-layer-TipsG"></i>';
  286 + delete config.title;
  287 + config.tips = typeof config.tips === 'object' ? config.tips : [config.tips, true];
  288 + config.tipsMore || layer.closeAll('tips');
  289 + break;
  290 + }
  291 +
  292 + //建立容器
  293 + that.vessel(conType, function(html, titleHTML, moveElem){
  294 + body.append(html[0]);
  295 + conType ? function(){
  296 + (config.type == 2 || config.type == 4) ? function(){
  297 + $('body').append(html[1]);
  298 + }() : function(){
  299 + if(!content.parents('.'+doms[0])[0]){
  300 + content.data('display', content.css('display')).show().addClass('layui-layer-wrap').wrap(html[1]);
  301 + $('#'+ doms[0] + times).find('.'+doms[5]).before(titleHTML);
  302 + }
  303 + }();
  304 + }() : body.append(html[1]);
  305 + $('.layui-layer-move')[0] || body.append(ready.moveElem = moveElem);
  306 + that.layero = $('#'+ doms[0] + times);
  307 + config.scrollbar || doms.html.css('overflow', 'hidden').attr('layer-full', times);
  308 + }).auto(times);
  309 +
  310 + config.type == 2 && layer.ie == 6 && that.layero.find('iframe').attr('src', content[0]);
  311 +
  312 + //坐标自适应浏览器窗口尺寸
  313 + config.type == 4 ? that.tips() : that.offset();
  314 + if(config.fixed){
  315 + win.on('resize', function(){
  316 + that.offset();
  317 + (/^\d+%$/.test(config.area[0]) || /^\d+%$/.test(config.area[1])) && that.auto(times);
  318 + config.type == 4 && that.tips();
  319 + });
  320 + }
  321 +
  322 + config.time <= 0 || setTimeout(function(){
  323 + layer.close(that.index)
  324 + }, config.time);
  325 + that.move().callback();
  326 +
  327 + //为兼容jQuery3.0的css动画影响元素尺寸计算
  328 + if(doms.anim[config.anim]){
  329 + that.layero.addClass(doms.anim[config.anim]);
  330 + };
  331 +
  332 + //记录关闭动画
  333 + if(config.isOutAnim){
  334 + that.layero.data('isOutAnim', true);
  335 + }
  336 + };
  337 +
  338 +//自适应
  339 + Class.pt.auto = function(index){
  340 + var that = this, config = that.config, layero = $('#'+ doms[0] + index);
  341 + if(config.area[0] === '' && config.maxWidth > 0){
  342 + //为了修复IE7下一个让人难以理解的bug
  343 + if(layer.ie && layer.ie < 8 && config.btn){
  344 + layero.width(layero.innerWidth());
  345 + }
  346 + layero.outerWidth() > config.maxWidth && layero.width(config.maxWidth);
  347 + }
  348 + var area = [layero.innerWidth(), layero.innerHeight()];
  349 + var titHeight = layero.find(doms[1]).outerHeight() || 0;
  350 + var btnHeight = layero.find('.'+doms[6]).outerHeight() || 0;
  351 + function setHeight(elem){
  352 + elem = layero.find(elem);
  353 + elem.height(area[1] - titHeight - btnHeight - 2*(parseFloat(elem.css('padding-top'))|0));
  354 + }
  355 + switch(config.type){
  356 + case 2:
  357 + setHeight('iframe');
  358 + break;
  359 + default:
  360 + if(config.area[1] === ''){
  361 + if(config.fixed && area[1] >= win.height()){
  362 + area[1] = win.height();
  363 + setHeight('.'+doms[5]);
  364 + }
  365 + } else {
  366 + setHeight('.'+doms[5]);
  367 + }
  368 + break;
  369 + }
  370 + return that;
  371 + };
  372 +
  373 +//计算坐标
  374 + Class.pt.offset = function(){
  375 + var that = this, config = that.config, layero = that.layero;
  376 + var area = [layero.outerWidth(), layero.outerHeight()];
  377 + var type = typeof config.offset === 'object';
  378 + that.offsetTop = (win.height() - area[1])/2;
  379 + that.offsetLeft = (win.width() - area[0])/2;
  380 +
  381 + if(type){
  382 + that.offsetTop = config.offset[0];
  383 + that.offsetLeft = config.offset[1]||that.offsetLeft;
  384 + } else if(config.offset !== 'auto'){
  385 +
  386 + if(config.offset === 't'){ //上
  387 + that.offsetTop = 0;
  388 + } else if(config.offset === 'r'){ //右
  389 + that.offsetLeft = win.width() - area[0];
  390 + } else if(config.offset === 'b'){ //下
  391 + that.offsetTop = win.height() - area[1];
  392 + } else if(config.offset === 'l'){ //左
  393 + that.offsetLeft = 0;
  394 + } else if(config.offset === 'lt'){ //左上角
  395 + that.offsetTop = 0;
  396 + that.offsetLeft = 0;
  397 + } else if(config.offset === 'lb'){ //左下角
  398 + that.offsetTop = win.height() - area[1];
  399 + that.offsetLeft = 0;
  400 + } else if(config.offset === 'rt'){ //右上角
  401 + that.offsetTop = 0;
  402 + that.offsetLeft = win.width() - area[0];
  403 + } else if(config.offset === 'rb'){ //右下角
  404 + that.offsetTop = win.height() - area[1];
  405 + that.offsetLeft = win.width() - area[0];
  406 + } else {
  407 + that.offsetTop = config.offset;
  408 + }
  409 +
  410 + }
  411 +
  412 + if(!config.fixed){
  413 + that.offsetTop = /%$/.test(that.offsetTop) ?
  414 + win.height()*parseFloat(that.offsetTop)/100
  415 + : parseFloat(that.offsetTop);
  416 + that.offsetLeft = /%$/.test(that.offsetLeft) ?
  417 + win.width()*parseFloat(that.offsetLeft)/100
  418 + : parseFloat(that.offsetLeft);
  419 + that.offsetTop += win.scrollTop();
  420 + that.offsetLeft += win.scrollLeft();
  421 + }
  422 +
  423 + if(layero.attr('minLeft')){
  424 + that.offsetTop = win.height() - (layero.find(doms[1]).outerHeight() || 0);
  425 + that.offsetLeft = layero.css('left');
  426 + }
  427 +
  428 + layero.css({top: that.offsetTop, left: that.offsetLeft});
  429 + };
  430 +
  431 +//Tips
  432 + Class.pt.tips = function(){
  433 + var that = this, config = that.config, layero = that.layero;
  434 + var layArea = [layero.outerWidth(), layero.outerHeight()], follow = $(config.follow);
  435 + if(!follow[0]) follow = $('body');
  436 + var goal = {
  437 + width: follow.outerWidth(),
  438 + height: follow.outerHeight(),
  439 + top: follow.offset().top,
  440 + left: follow.offset().left
  441 + }, tipsG = layero.find('.layui-layer-TipsG');
  442 +
  443 + var guide = config.tips[0];
  444 + config.tips[1] || tipsG.remove();
  445 +
  446 + goal.autoLeft = function(){
  447 + if(goal.left + layArea[0] - win.width() > 0){
  448 + goal.tipLeft = goal.left + goal.width - layArea[0];
  449 + tipsG.css({right: 12, left: 'auto'});
  450 + } else {
  451 + goal.tipLeft = goal.left;
  452 + };
  453 + };
  454 +
  455 + //辨别tips的方位
  456 + goal.where = [function(){ //上
  457 + goal.autoLeft();
  458 + goal.tipTop = goal.top - layArea[1] - 10;
  459 + tipsG.removeClass('layui-layer-TipsB').addClass('layui-layer-TipsT').css('border-right-color', config.tips[1]);
  460 + }, function(){ //右
  461 + goal.tipLeft = goal.left + goal.width + 10;
  462 + goal.tipTop = goal.top;
  463 + tipsG.removeClass('layui-layer-TipsL').addClass('layui-layer-TipsR').css('border-bottom-color', config.tips[1]);
  464 + }, function(){ //下
  465 + goal.autoLeft();
  466 + goal.tipTop = goal.top + goal.height + 10;
  467 + tipsG.removeClass('layui-layer-TipsT').addClass('layui-layer-TipsB').css('border-right-color', config.tips[1]);
  468 + }, function(){ //左
  469 + goal.tipLeft = goal.left - layArea[0] - 10;
  470 + goal.tipTop = goal.top;
  471 + tipsG.removeClass('layui-layer-TipsR').addClass('layui-layer-TipsL').css('border-bottom-color', config.tips[1]);
  472 + }];
  473 + goal.where[guide-1]();
  474 +
  475 + /* 8*2为小三角形占据的空间 */
  476 + if(guide === 1){
  477 + goal.top - (win.scrollTop() + layArea[1] + 8*2) < 0 && goal.where[2]();
  478 + } else if(guide === 2){
  479 + win.width() - (goal.left + goal.width + layArea[0] + 8*2) > 0 || goal.where[3]()
  480 + } else if(guide === 3){
  481 + (goal.top - win.scrollTop() + goal.height + layArea[1] + 8*2) - win.height() > 0 && goal.where[0]();
  482 + } else if(guide === 4){
  483 + layArea[0] + 8*2 - goal.left > 0 && goal.where[1]()
  484 + }
  485 +
  486 + layero.find('.'+doms[5]).css({
  487 + 'background-color': config.tips[1],
  488 + 'padding-right': (config.closeBtn ? '30px' : '')
  489 + });
  490 + layero.css({
  491 + left: goal.tipLeft - (config.fixed ? win.scrollLeft() : 0),
  492 + top: goal.tipTop - (config.fixed ? win.scrollTop() : 0)
  493 + });
  494 + }
  495 +
  496 +//拖拽层
  497 + Class.pt.move = function(){
  498 + var that = this
  499 + ,config = that.config
  500 + ,_DOC = $(document)
  501 + ,layero = that.layero
  502 + ,moveElem = layero.find(config.move)
  503 + ,resizeElem = layero.find('.layui-layer-resize')
  504 + ,dict = {};
  505 +
  506 + if(config.move){
  507 + moveElem.css('cursor', 'move');
  508 + }
  509 +
  510 + moveElem.on('mousedown', function(e){
  511 + e.preventDefault();
  512 + if(config.move){
  513 + dict.moveStart = true;
  514 + dict.offset = [
  515 + e.clientX - parseFloat(layero.css('left'))
  516 + ,e.clientY - parseFloat(layero.css('top'))
  517 + ];
  518 + ready.moveElem.css('cursor', 'move').show();
  519 + }
  520 + });
  521 +
  522 + resizeElem.on('mousedown', function(e){
  523 + e.preventDefault();
  524 + dict.resizeStart = true;
  525 + dict.offset = [e.clientX, e.clientY];
  526 + dict.area = [
  527 + layero.outerWidth()
  528 + ,layero.outerHeight()
  529 + ];
  530 + ready.moveElem.css('cursor', 'se-resize').show();
  531 + });
  532 +
  533 + _DOC.on('mousemove', function(e){
  534 +
  535 + //拖拽移动
  536 + if(dict.moveStart){
  537 + var X = e.clientX - dict.offset[0]
  538 + ,Y = e.clientY - dict.offset[1]
  539 + ,fixed = layero.css('position') === 'fixed';
  540 +
  541 + e.preventDefault();
  542 +
  543 + dict.stX = fixed ? 0 : win.scrollLeft();
  544 + dict.stY = fixed ? 0 : win.scrollTop();
  545 +
  546 + //控制元素不被拖出窗口外
  547 + if(!config.moveOut){
  548 + var setRig = win.width() - layero.outerWidth() + dict.stX
  549 + ,setBot = win.height() - layero.outerHeight() + dict.stY;
  550 + X < dict.stX && (X = dict.stX);
  551 + X > setRig && (X = setRig);
  552 + Y < dict.stY && (Y = dict.stY);
  553 + Y > setBot && (Y = setBot);
  554 + }
  555 +
  556 + layero.css({
  557 + left: X
  558 + ,top: Y
  559 + });
  560 + }
  561 +
  562 + //Resize
  563 + if(config.resize && dict.resizeStart){
  564 + var X = e.clientX - dict.offset[0]
  565 + ,Y = e.clientY - dict.offset[1];
  566 +
  567 + e.preventDefault();
  568 +
  569 + layer.style(that.index, {
  570 + width: dict.area[0] + X
  571 + ,height: dict.area[1] + Y
  572 + })
  573 + dict.isResize = true;
  574 + config.resizing && config.resizing(layero);
  575 + }
  576 + }).on('mouseup', function(e){
  577 + if(dict.moveStart){
  578 + delete dict.moveStart;
  579 + ready.moveElem.hide();
  580 + config.moveEnd && config.moveEnd(layero);
  581 + }
  582 + if(dict.resizeStart){
  583 + delete dict.resizeStart;
  584 + ready.moveElem.hide();
  585 + }
  586 + });
  587 +
  588 + return that;
  589 + };
  590 +
  591 + Class.pt.callback = function(){
  592 + var that = this, layero = that.layero, config = that.config;
  593 + that.openLayer();
  594 + if(config.success){
  595 + if(config.type == 2){
  596 + layero.find('iframe').on('load', function(){
  597 + config.success(layero, that.index);
  598 + });
  599 + } else {
  600 + config.success(layero, that.index);
  601 + }
  602 + }
  603 + layer.ie == 6 && that.IE6(layero);
  604 +
  605 + //按钮
  606 + layero.find('.'+ doms[6]).children('a').on('click', function(){
  607 + var index = $(this).index();
  608 + if(index === 0){
  609 + if(config.yes){
  610 + config.yes(that.index, layero)
  611 + } else if(config['btn1']){
  612 + config['btn1'](that.index, layero)
  613 + } else {
  614 + layer.close(that.index);
  615 + }
  616 + } else {
  617 + var close = config['btn'+(index+1)] && config['btn'+(index+1)](that.index, layero);
  618 + close === false || layer.close(that.index);
  619 + }
  620 + });
  621 +
  622 + //取消
  623 + function cancel(){
  624 + var close = config.cancel && config.cancel(that.index, layero);
  625 + close === false || layer.close(that.index);
  626 + }
  627 +
  628 + //右上角关闭回调
  629 + layero.find('.'+ doms[7]).on('click', cancel);
  630 +
  631 + //点遮罩关闭
  632 + if(config.shadeClose){
  633 + $('#layui-layer-shade'+ that.index).on('click', function(){
  634 + layer.close(that.index);
  635 + });
  636 + }
  637 +
  638 + //最小化
  639 + layero.find('.layui-layer-min').on('click', function(){
  640 + var min = config.min && config.min(layero);
  641 + min === false || layer.min(that.index, config);
  642 + });
  643 +
  644 + //全屏/还原
  645 + layero.find('.layui-layer-max').on('click', function(){
  646 + if($(this).hasClass('layui-layer-maxmin')){
  647 + layer.restore(that.index);
  648 + config.restore && config.restore(layero);
  649 + } else {
  650 + layer.full(that.index, config);
  651 + setTimeout(function(){
  652 + config.full && config.full(layero);
  653 + }, 100);
  654 + }
  655 + });
  656 +
  657 + config.end && (ready.end[that.index] = config.end);
  658 + };
  659 +
  660 +//for ie6 恢复select
  661 + ready.reselect = function(){
  662 + $.each($('select'), function(index , value){
  663 + var sthis = $(this);
  664 + if(!sthis.parents('.'+doms[0])[0]){
  665 + (sthis.attr('layer') == 1 && $('.'+doms[0]).length < 1) && sthis.removeAttr('layer').show();
  666 + }
  667 + sthis = null;
  668 + });
  669 + };
  670 +
  671 + Class.pt.IE6 = function(layero){
  672 + //隐藏select
  673 + $('select').each(function(index , value){
  674 + var sthis = $(this);
  675 + if(!sthis.parents('.'+doms[0])[0]){
  676 + sthis.css('display') === 'none' || sthis.attr({'layer' : '1'}).hide();
  677 + }
  678 + sthis = null;
  679 + });
  680 + };
  681 +
  682 +//需依赖原型的对外方法
  683 + Class.pt.openLayer = function(){
  684 + var that = this;
  685 +
  686 + //置顶当前窗口
  687 + layer.zIndex = that.config.zIndex;
  688 + layer.setTop = function(layero){
  689 + var setZindex = function(){
  690 + layer.zIndex++;
  691 + layero.css('z-index', layer.zIndex + 1);
  692 + };
  693 + layer.zIndex = parseInt(layero[0].style.zIndex);
  694 + layero.on('mousedown', setZindex);
  695 + return layer.zIndex;
  696 + };
  697 + };
  698 +
  699 + ready.record = function(layero){
  700 + var area = [
  701 + layero.width(),
  702 + layero.height(),
  703 + layero.position().top,
  704 + layero.position().left + parseFloat(layero.css('margin-left'))
  705 + ];
  706 + layero.find('.layui-layer-max').addClass('layui-layer-maxmin');
  707 + layero.attr({area: area});
  708 + };
  709 +
  710 + ready.rescollbar = function(index){
  711 + if(doms.html.attr('layer-full') == index){
  712 + if(doms.html[0].style.removeProperty){
  713 + doms.html[0].style.removeProperty('overflow');
  714 + } else {
  715 + doms.html[0].style.removeAttribute('overflow');
  716 + }
  717 + doms.html.removeAttr('layer-full');
  718 + }
  719 + };
  720 +
  721 + /** 内置成员 */
  722 +
  723 + window.layer = layer;
  724 +
  725 +//获取子iframe的DOM
  726 + layer.getChildFrame = function(selector, index){
  727 + index = index || $('.'+doms[4]).attr('times');
  728 + return $('#'+ doms[0] + index).find('iframe').contents().find(selector);
  729 + };
  730 +
  731 +//得到当前iframe层的索引,子iframe时使用
  732 + layer.getFrameIndex = function(name){
  733 + return $('#'+ name).parents('.'+doms[4]).attr('times');
  734 + };
  735 +
  736 +//iframe层自适应宽高
  737 + layer.iframeAuto = function(index){
  738 + if(!index) return;
  739 + var heg = layer.getChildFrame('html', index).outerHeight();
  740 + var layero = $('#'+ doms[0] + index);
  741 + var titHeight = layero.find(doms[1]).outerHeight() || 0;
  742 + var btnHeight = layero.find('.'+doms[6]).outerHeight() || 0;
  743 + layero.css({height: heg + titHeight + btnHeight});
  744 + layero.find('iframe').css({height: heg});
  745 + };
  746 +
  747 +//重置iframe url
  748 + layer.iframeSrc = function(index, url){
  749 + $('#'+ doms[0] + index).find('iframe').attr('src', url);
  750 + };
  751 +
  752 +//设定层的样式
  753 + layer.style = function(index, options, limit){
  754 + var layero = $('#'+ doms[0] + index)
  755 + ,contElem = layero.find('.layui-layer-content')
  756 + ,type = layero.attr('type')
  757 + ,titHeight = layero.find(doms[1]).outerHeight() || 0
  758 + ,btnHeight = layero.find('.'+doms[6]).outerHeight() || 0
  759 + ,minLeft = layero.attr('minLeft');
  760 +
  761 + if(type === ready.type[3] || type === ready.type[4]){
  762 + return;
  763 + }
  764 +
  765 + if(!limit){
  766 + if(parseFloat(options.width) <= 260){
  767 + options.width = 260;
  768 + };
  769 +
  770 + if(parseFloat(options.height) - titHeight - btnHeight <= 64){
  771 + options.height = 64 + titHeight + btnHeight;
  772 + };
  773 + }
  774 +
  775 + layero.css(options);
  776 + btnHeight = layero.find('.'+doms[6]).outerHeight();
  777 +
  778 + if(type === ready.type[2]){
  779 + layero.find('iframe').css({
  780 + height: parseFloat(options.height) - titHeight - btnHeight
  781 + });
  782 + } else {
  783 + contElem.css({
  784 + height: parseFloat(options.height) - titHeight - btnHeight
  785 + - parseFloat(contElem.css('padding-top'))
  786 + - parseFloat(contElem.css('padding-bottom'))
  787 + })
  788 + }
  789 + };
  790 +
  791 +//最小化
  792 + layer.min = function(index, options){
  793 + var layero = $('#'+ doms[0] + index)
  794 + ,titHeight = layero.find(doms[1]).outerHeight() || 0
  795 + ,left = layero.attr('minLeft') || (181*ready.minIndex)+'px'
  796 + ,position = layero.css('position');
  797 +
  798 + ready.record(layero);
  799 +
  800 + if(ready.minLeft[0]){
  801 + left = ready.minLeft[0];
  802 + ready.minLeft.shift();
  803 + }
  804 +
  805 + layero.attr('position', position);
  806 +
  807 + layer.style(index, {
  808 + width: 180
  809 + ,height: titHeight
  810 + ,left: left
  811 + ,top: win.height() - titHeight
  812 + ,position: 'fixed'
  813 + ,overflow: 'hidden'
  814 + }, true);
  815 +
  816 + layero.find('.layui-layer-min').hide();
  817 + layero.attr('type') === 'page' && layero.find(doms[4]).hide();
  818 + ready.rescollbar(index);
  819 +
  820 + if(!layero.attr('minLeft')){
  821 + ready.minIndex++;
  822 + }
  823 + layero.attr('minLeft', left);
  824 + };
  825 +
  826 +//还原
  827 + layer.restore = function(index){
  828 + var layero = $('#'+ doms[0] + index), area = layero.attr('area').split(',');
  829 + var type = layero.attr('type');
  830 + layer.style(index, {
  831 + width: parseFloat(area[0]),
  832 + height: parseFloat(area[1]),
  833 + top: parseFloat(area[2]),
  834 + left: parseFloat(area[3]),
  835 + position: layero.attr('position'),
  836 + overflow: 'visible'
  837 + }, true);
  838 + layero.find('.layui-layer-max').removeClass('layui-layer-maxmin');
  839 + layero.find('.layui-layer-min').show();
  840 + layero.attr('type') === 'page' && layero.find(doms[4]).show();
  841 + ready.rescollbar(index);
  842 + };
  843 +
  844 +//全屏
  845 + layer.full = function(index){
  846 + var layero = $('#'+ doms[0] + index), timer;
  847 + ready.record(layero);
  848 + if(!doms.html.attr('layer-full')){
  849 + doms.html.css('overflow','hidden').attr('layer-full', index);
  850 + }
  851 + clearTimeout(timer);
  852 + timer = setTimeout(function(){
  853 + var isfix = layero.css('position') === 'fixed';
  854 + layer.style(index, {
  855 + top: isfix ? 0 : win.scrollTop(),
  856 + left: isfix ? 0 : win.scrollLeft(),
  857 + width: win.width(),
  858 + height: win.height()
  859 + }, true);
  860 + layero.find('.layui-layer-min').hide();
  861 + }, 100);
  862 + };
  863 +
  864 +//改变title
  865 + layer.title = function(name, index){
  866 + var title = $('#'+ doms[0] + (index||layer.index)).find(doms[1]);
  867 + title.html(name);
  868 + };
  869 +
  870 +//关闭layer总方法
  871 + layer.close = function(index){
  872 + var layero = $('#'+ doms[0] + index), type = layero.attr('type'), closeAnim = 'layer-anim-close';
  873 + if(!layero[0]) return;
  874 + var WRAP = 'layui-layer-wrap', remove = function(){
  875 + if(type === ready.type[1] && layero.attr('conType') === 'object'){
  876 + layero.children(':not(.'+ doms[5] +')').remove();
  877 + var wrap = layero.find('.'+WRAP);
  878 + for(var i = 0; i < 2; i++){
  879 + wrap.unwrap();
  880 + }
  881 + wrap.css('display', wrap.data('display')).removeClass(WRAP);
  882 + } else {
  883 + //低版本IE 回收 iframe
  884 + if(type === ready.type[2]){
  885 + try {
  886 + var iframe = $('#'+doms[4]+index)[0];
  887 + iframe.contentWindow.document.write('');
  888 + iframe.contentWindow.close();
  889 + layero.find('.'+doms[5])[0].removeChild(iframe);
  890 + } catch(e){}
  891 + }
  892 + layero[0].innerHTML = '';
  893 + layero.remove();
  894 + }
  895 + typeof ready.end[index] === 'function' && ready.end[index]();
  896 + delete ready.end[index];
  897 + };
  898 +
  899 + if(layero.data('isOutAnim')){
  900 + layero.addClass(closeAnim);
  901 + }
  902 +
  903 + $('#layui-layer-moves, #layui-layer-shade' + index).remove();
  904 + layer.ie == 6 && ready.reselect();
  905 + ready.rescollbar(index);
  906 + if(layero.attr('minLeft')){
  907 + ready.minIndex--;
  908 + ready.minLeft.push(layero.attr('minLeft'));
  909 + }
  910 +
  911 + if((layer.ie && layer.ie < 10) || !layero.data('isOutAnim')){
  912 + remove()
  913 + } else {
  914 + setTimeout(function(){
  915 + remove();
  916 + }, 200);
  917 + }
  918 + };
  919 +
  920 +//关闭所有层
  921 + layer.closeAll = function(type){
  922 + $.each($('.'+doms[0]), function(){
  923 + var othis = $(this);
  924 + var is = type ? (othis.attr('type') === type) : 1;
  925 + is && layer.close(othis.attr('times'));
  926 + is = null;
  927 + });
  928 + };
  929 +
  930 + /**
  931 +
  932 + 拓展模块,layui开始合并在一起
  933 +
  934 + */
  935 +
  936 + var cache = layer.cache||{}, skin = function(type){
  937 + return (cache.skin ? (' ' + cache.skin + ' ' + cache.skin + '-'+type) : '');
  938 + };
  939 +
  940 +//仿系统prompt
  941 + layer.prompt = function(options, yes){
  942 + var style = '';
  943 + options = options || {};
  944 +
  945 + if(typeof options === 'function') yes = options;
  946 +
  947 + if(options.area){
  948 + var area = options.area;
  949 + style = 'style="width: '+ area[0] +'; height: '+ area[1] + ';"';
  950 + delete options.area;
  951 + }
  952 + var prompt, content = options.formType == 2 ? '<textarea class="layui-layer-input"' + style +'>' + (options.value||'') +'</textarea>' : function(){
  953 + return '<input type="'+ (options.formType == 1 ? 'password' : 'text') +'" class="layui-layer-input" value="'+ (options.value||'') +'">';
  954 + }();
  955 +
  956 + var success = options.success;
  957 + delete options.success;
  958 +
  959 + return layer.open($.extend({
  960 + type: 1
  961 + ,btn: ['&#x786E;&#x5B9A;','&#x53D6;&#x6D88;']
  962 + ,content: content
  963 + ,skin: 'layui-layer-prompt' + skin('prompt')
  964 + ,maxWidth: win.width()
  965 + ,success: function(layero){
  966 + prompt = layero.find('.layui-layer-input');
  967 + prompt.focus();
  968 + typeof success === 'function' && success(layero);
  969 + }
  970 + ,resize: false
  971 + ,yes: function(index){
  972 + var value = prompt.val();
  973 + if(value === ''){
  974 + prompt.focus();
  975 + } else if(value.length > (options.maxlength||500)) {
  976 + layer.tips('&#x6700;&#x591A;&#x8F93;&#x5165;'+ (options.maxlength || 500) +'&#x4E2A;&#x5B57;&#x6570;', prompt, {tips: 1});
  977 + } else {
  978 + yes && yes(value, index, prompt);
  979 + }
  980 + }
  981 + }, options));
  982 + };
  983 +
  984 +//tab层
  985 + layer.tab = function(options){
  986 + options = options || {};
  987 +
  988 + var tab = options.tab || {}
  989 + ,success = options.success;
  990 +
  991 + delete options.success;
  992 +
  993 + return layer.open($.extend({
  994 + type: 1,
  995 + skin: 'layui-layer-tab' + skin('tab'),
  996 + resize: false,
  997 + title: function(){
  998 + var len = tab.length, ii = 1, str = '';
  999 + if(len > 0){
  1000 + str = '<span class="layui-layer-tabnow">'+ tab[0].title +'</span>';
  1001 + for(; ii < len; ii++){
  1002 + str += '<span>'+ tab[ii].title +'</span>';
  1003 + }
  1004 + }
  1005 + return str;
  1006 + }(),
  1007 + content: '<ul class="layui-layer-tabmain">'+ function(){
  1008 + var len = tab.length, ii = 1, str = '';
  1009 + if(len > 0){
  1010 + str = '<li class="layui-layer-tabli xubox_tab_layer">'+ (tab[0].content || 'no content') +'</li>';
  1011 + for(; ii < len; ii++){
  1012 + str += '<li class="layui-layer-tabli">'+ (tab[ii].content || 'no content') +'</li>';
  1013 + }
  1014 + }
  1015 + return str;
  1016 + }() +'</ul>',
  1017 + success: function(layero){
  1018 + var btn = layero.find('.layui-layer-title').children();
  1019 + var main = layero.find('.layui-layer-tabmain').children();
  1020 + btn.on('mousedown', function(e){
  1021 + e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true;
  1022 + var othis = $(this), index = othis.index();
  1023 + othis.addClass('layui-layer-tabnow').siblings().removeClass('layui-layer-tabnow');
  1024 + main.eq(index).show().siblings().hide();
  1025 + typeof options.change === 'function' && options.change(index);
  1026 + });
  1027 + typeof success === 'function' && success(layero);
  1028 + }
  1029 + }, options));
  1030 + };
  1031 +
  1032 +//相册层
  1033 + layer.photos = function(options, loop, key){
  1034 + var dict = {};
  1035 + options = options || {};
  1036 + if(!options.photos) return;
  1037 + var type = options.photos.constructor === Object;
  1038 + var photos = type ? options.photos : {}, data = photos.data || [];
  1039 + var start = photos.start || 0;
  1040 + dict.imgIndex = (start|0) + 1;
  1041 +
  1042 + options.img = options.img || 'img';
  1043 +
  1044 + var success = options.success;
  1045 + delete options.success;
  1046 +
  1047 + if(!type){ //页面直接获取
  1048 + var parent = $(options.photos), pushData = function(){
  1049 + data = [];
  1050 + parent.find(options.img).each(function(index){
  1051 + var othis = $(this);
  1052 + othis.attr('layer-index', index);
  1053 + data.push({
  1054 + alt: othis.attr('alt'),
  1055 + pid: othis.attr('layer-pid'),
  1056 + src: othis.attr('layer-src') || othis.attr('src'),
  1057 + thumb: othis.attr('src')
  1058 + });
  1059 + })
  1060 + };
  1061 +
  1062 + pushData();
  1063 +
  1064 + if (data.length === 0) return;
  1065 +
  1066 + loop || parent.on('click', options.img, function(){
  1067 + var othis = $(this), index = othis.attr('layer-index');
  1068 + layer.photos($.extend(options, {
  1069 + photos: {
  1070 + start: index,
  1071 + data: data,
  1072 + tab: options.tab
  1073 + },
  1074 + full: options.full
  1075 + }), true);
  1076 + pushData();
  1077 + })
  1078 +
  1079 + //不直接弹出
  1080 + if(!loop) return;
  1081 +
  1082 + } else if (data.length === 0){
  1083 + return layer.msg('&#x6CA1;&#x6709;&#x56FE;&#x7247;');
  1084 + }
  1085 +
  1086 + //上一张
  1087 + dict.imgprev = function(key){
  1088 + dict.imgIndex--;
  1089 + if(dict.imgIndex < 1){
  1090 + dict.imgIndex = data.length;
  1091 + }
  1092 + dict.tabimg(key);
  1093 + };
  1094 +
  1095 + //下一张
  1096 + dict.imgnext = function(key,errorMsg){
  1097 + dict.imgIndex++;
  1098 + if(dict.imgIndex > data.length){
  1099 + dict.imgIndex = 1;
  1100 + if (errorMsg) {return};
  1101 + }
  1102 + dict.tabimg(key)
  1103 + };
  1104 +
  1105 + //方向键
  1106 + dict.keyup = function(event){
  1107 + if(!dict.end){
  1108 + var code = event.keyCode;
  1109 + event.preventDefault();
  1110 + if(code === 37){
  1111 + dict.imgprev(true);
  1112 + } else if(code === 39) {
  1113 + dict.imgnext(true);
  1114 + } else if(code === 27) {
  1115 + layer.close(dict.index);
  1116 + }
  1117 + }
  1118 + }
  1119 +
  1120 + //切换
  1121 + dict.tabimg = function(key){
  1122 + if(data.length <= 1) return;
  1123 + photos.start = dict.imgIndex - 1;
  1124 + layer.close(dict.index);
  1125 + return layer.photos(options, true, key);
  1126 + setTimeout(function(){
  1127 + layer.photos(options, true, key);
  1128 + }, 200);
  1129 + }
  1130 +
  1131 + //一些动作
  1132 + dict.event = function(){
  1133 + dict.bigimg.hover(function(){
  1134 + dict.imgsee.show();
  1135 + }, function(){
  1136 + dict.imgsee.hide();
  1137 + });
  1138 +
  1139 + dict.bigimg.find('.layui-layer-imgprev').on('click', function(event){
  1140 + event.preventDefault();
  1141 + dict.imgprev();
  1142 + });
  1143 +
  1144 + dict.bigimg.find('.layui-layer-imgnext').on('click', function(event){
  1145 + event.preventDefault();
  1146 + dict.imgnext();
  1147 + });
  1148 +
  1149 + $(document).on('keyup', dict.keyup);
  1150 + };
  1151 +
  1152 + //图片预加载
  1153 + function loadImage(url, callback, error) {
  1154 + var img = new Image();
  1155 + img.src = url;
  1156 + if(img.complete){
  1157 + return callback(img);
  1158 + }
  1159 + img.onload = function(){
  1160 + img.onload = null;
  1161 + callback(img);
  1162 + };
  1163 + img.onerror = function(e){
  1164 + img.onerror = null;
  1165 + error(e);
  1166 + };
  1167 + };
  1168 +
  1169 + dict.loadi = layer.load(1, {
  1170 + shade: 'shade' in options ? false : 0.9,
  1171 + scrollbar: false
  1172 + });
  1173 +
  1174 + loadImage(data[start].src, function(img){
  1175 + layer.close(dict.loadi);
  1176 + dict.index = layer.open($.extend({
  1177 + type: 1,
  1178 + id: 'layui-layer-photos',
  1179 + area: function(){
  1180 + var imgarea = [img.width, img.height];
  1181 + var winarea = [$(window).width() - 100, $(window).height() - 100];
  1182 +
  1183 + //如果 实际图片的宽或者高比 屏幕大(那么进行缩放)
  1184 + if(!options.full && (imgarea[0]>winarea[0]||imgarea[1]>winarea[1])){
  1185 + var wh = [imgarea[0]/winarea[0],imgarea[1]/winarea[1]];//取宽度缩放比例、高度缩放比例
  1186 + if(wh[0] > wh[1]){//取缩放比例最大的进行缩放
  1187 + imgarea[0] = imgarea[0]/wh[0];
  1188 + imgarea[1] = imgarea[1]/wh[0];
  1189 + } else if(wh[0] < wh[1]){
  1190 + imgarea[0] = imgarea[0]/wh[1];
  1191 + imgarea[1] = imgarea[1]/wh[1];
  1192 + }
  1193 + }
  1194 +
  1195 + return [imgarea[0]+'px', imgarea[1]+'px'];
  1196 + }(),
  1197 + title: false,
  1198 + shade: 0.9,
  1199 + shadeClose: true,
  1200 + closeBtn: false,
  1201 + move: '.layui-layer-phimg img',
  1202 + moveType: 1,
  1203 + scrollbar: false,
  1204 + moveOut: true,
  1205 + //anim: Math.random()*5|0,
  1206 + isOutAnim: false,
  1207 + skin: 'layui-layer-photos' + skin('photos'),
  1208 + content: '<div class="layui-layer-phimg">'
  1209 + +'<img src="'+ data[start].src +'" alt="'+ (data[start].alt||'') +'" layer-pid="'+ data[start].pid +'">'
  1210 + +'<div class="layui-layer-imgsee">'
  1211 + +(data.length > 1 ? '<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>' : '')
  1212 + +'<div class="layui-layer-imgbar" style="display:'+ (key ? 'block' : '') +'"><span class="layui-layer-imgtit"><a href="javascript:;">'+ (data[start].alt||'') +'</a><em>'+ dict.imgIndex +'/'+ data.length +'</em></span></div>'
  1213 + +'</div>'
  1214 + +'</div>',
  1215 + success: function(layero, index){
  1216 + dict.bigimg = layero.find('.layui-layer-phimg');
  1217 + dict.imgsee = layero.find('.layui-layer-imguide,.layui-layer-imgbar');
  1218 + dict.event(layero);
  1219 + options.tab && options.tab(data[start], layero);
  1220 + typeof success === 'function' && success(layero);
  1221 + }, end: function(){
  1222 + dict.end = true;
  1223 + $(document).off('keyup', dict.keyup);
  1224 + }
  1225 + }, options));
  1226 + }, function(){
  1227 + layer.close(dict.loadi);
  1228 + layer.msg('&#x5F53;&#x524D;&#x56FE;&#x7247;&#x5730;&#x5740;&#x5F02;&#x5E38;<br>&#x662F;&#x5426;&#x7EE7;&#x7EED;&#x67E5;&#x770B;&#x4E0B;&#x4E00;&#x5F20;&#xFF1F;', {
  1229 + time: 30000,
  1230 + btn: ['&#x4E0B;&#x4E00;&#x5F20;', '&#x4E0D;&#x770B;&#x4E86;'],
  1231 + yes: function(){
  1232 + data.length > 1 && dict.imgnext(true,true);
  1233 + }
  1234 + });
  1235 + });
  1236 + };
  1237 +
  1238 +//主入口
  1239 + ready.run = function(_$){
  1240 + $ = _$;
  1241 + win = $(window);
  1242 + doms.html = $('html');
  1243 + layer.open = function(deliver){
  1244 + var o = new Class(deliver);
  1245 + return o.index;
  1246 + };
  1247 + };
  1248 +
  1249 +//加载方式
  1250 + window.layui && layui.define ? (
  1251 + layer.ready()
  1252 + ,layui.define('jquery', function(exports){ //layui加载
  1253 + layer.path = layui.cache.dir;
  1254 + ready.run(layui.jquery);
  1255 +
  1256 + //暴露模块
  1257 + window.layer = layer;
  1258 + exports('layer', layer);
  1259 + })
  1260 + ) : (
  1261 + (typeof define === 'function' && define.amd) ? define(['jquery'], function(){ //requirejs加载
  1262 + ready.run(window.jQuery);
  1263 + return layer;
  1264 + }) : function(){ //普通script标签加载
  1265 + ready.run(window.jQuery);
  1266 + layer.ready();
  1267 + }()
  1268 + );
  1269 +
1270 }(window); 1270 }(window);
1271 \ No newline at end of file 1271 \ No newline at end of file
src/main/resources/static/real_control_v2/fragments/north/nav/line_config/line_config_entity.html
@@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
36 <div> 36 <div>
37 <div> 37 <div>
38 <label> 38 <label>
39 - <input type="checkbox" id="enableAutoExec"> 启用自动班次执行 39 + <input type="checkbox" id="enableAutoExec" {{autoExec?"checked":""}}> 启用自动班次执行
40 </label> 40 </label>
41 </div> 41 </div>
42 <ul class="uk-list"> 42 <ul class="uk-list">