Commit c2213be693d2ebe3fe0ed5cab76727f01a5ba92c

Authored by 王通
1 parent f9e8fc2c

1.'分公司'改'线队'

Too many changes to show.

To preserve performance only 13 of 32 files are displayed.

src/main/java/com/bsth/service/schedule/impl/CarConfigInfoServiceImpl.java
1   -package com.bsth.service.schedule.impl;
2   -
3   -import com.bsth.entity.Cars;
4   -import com.bsth.entity.schedule.CarConfigInfo;
5   -import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
6   -import com.bsth.entity.sys.CompanyAuthority;
7   -import com.bsth.service.schedule.CarConfigInfoService;
8   -import com.bsth.service.schedule.CarsService;
9   -import com.bsth.service.schedule.ScheduleRule1FlatService;
10   -import com.bsth.service.schedule.exception.ScheduleException;
11   -import com.bsth.service.schedule.utils.DataToolsFile;
12   -import com.bsth.service.schedule.utils.DataToolsService;
13   -import org.springframework.beans.factory.annotation.Autowired;
14   -import org.springframework.beans.factory.annotation.Qualifier;
15   -import org.springframework.stereotype.Service;
16   -import org.springframework.transaction.annotation.Transactional;
17   -import org.springframework.util.CollectionUtils;
18   -
19   -import java.io.File;
20   -import java.util.HashMap;
21   -import java.util.List;
22   -import java.util.Map;
23   -
24   -/**
25   - * Created by xu on 16/5/9.
26   - */
27   -@Service
28   -public class CarConfigInfoServiceImpl extends BServiceImpl<CarConfigInfo, Long> implements CarConfigInfoService {
29   - @Autowired
30   - private ScheduleRule1FlatService scheduleRule1FlatService;
31   - @Autowired
32   - private CarsService carsService;
33   -
34   - @Autowired
35   - @Qualifier(value = "carConfig_dataTool")
36   - private DataToolsService dataToolsService;
37   -
38   - @Override
39   - public DataToolsFile uploadFile(String filename, byte[] filedata) throws ScheduleException {
40   - return dataToolsService.uploadFile(filename, filedata);
41   - }
42   -
43   - @Override
44   - public void importData(File file, Map<String, Object> params) throws ScheduleException {
45   - dataToolsService.importData(file, params);
46   - }
47   -
48   - @Override
49   - public DataToolsFile exportData(Map<String, Object> params) throws ScheduleException {
50   - return dataToolsService.exportData(params);
51   - }
52   -
53   - @Override
54   - public void validate_cars_gs(CarConfigInfo carConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException {
55   - if (CollectionUtils.isEmpty(companyAuthorityList)) {
56   - throw new ScheduleException("当前用户没有公司权限!");
57   - }
58   -
59   - boolean isFind = false;
60   - Cars cars = carsService.findById(carConfigInfo.getCl().getId());
61   - for (CompanyAuthority companyAuthority : companyAuthorityList) {
62   - if (companyAuthority.getCompanyCode().equals(cars.getBusinessCode())) {
63   - isFind = true;
64   - break;
65   - }
66   - }
67   - if (!isFind) {
68   - throw new ScheduleException("当前车辆不在用户所属公司中!");
69   - }
70   - }
71   -
72   - @Override
73   - public void validate_cars_fgs(CarConfigInfo carConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException {
74   - if (CollectionUtils.isEmpty(companyAuthorityList)) {
75   - throw new ScheduleException("当前用户没有分公司权限!");
76   - }
77   -
78   - boolean isFind = false;
79   - Cars cars = carsService.findById(carConfigInfo.getCl().getId());
80   - for (CompanyAuthority companyAuthority : companyAuthorityList) {
81   - if (companyAuthority.getCompanyCode().equals(cars.getBusinessCode())) {
82   - isFind = true;
83   - break;
84   - }
85   - }
86   - if (!isFind) {
87   - // 如果没有公司权限,验证通过
88   - return;
89   - }
90   -
91   - isFind = false;
92   - for (CompanyAuthority companyAuthority : companyAuthorityList) {
93   - if (companyAuthority.getCompanyCode().equals(cars.getBusinessCode()) &&
94   - companyAuthority.getSubCompanyCode().equals(cars.getBrancheCompanyCode())) {
95   - isFind = true;
96   - break;
97   - }
98   - }
99   - if (!isFind) {
100   - throw new ScheduleException("当前车辆不在用户所属分公司中!");
101   - }
102   - }
103   -
104   - @Transactional
105   - public void validate_cars(CarConfigInfo carConfigInfo) throws ScheduleException {
106   - // 相同车辆不能同时配置
107   - Map<String, Object> param = new HashMap<>();
108   - if (carConfigInfo.getId() != null) {
109   - param.put("id_ne", carConfigInfo.getId());
110   - }
111   -
112   - if (carConfigInfo.getXl() == null ||
113   - carConfigInfo.getXl().getId() == null ||
114   - carConfigInfo.getXl().getName() == null) {
115   - throw new ScheduleException("线路未选择");
116   - } else {
117   -// param.put("xl.id_eq", carConfigInfo.getXl().getId());
118   - param.put("isCancel_eq", false);
119   - if (carConfigInfo.getCl() == null || carConfigInfo.getCl().getId() == null) {
120   - throw new ScheduleException("车辆未选择");
121   - } else {
122   - param.put("cl.id_eq", carConfigInfo.getCl().getId());
123   - List<CarConfigInfo> carConfigInfos = list(param);
124   - if (!CollectionUtils.isEmpty(carConfigInfos)) {
125   - throw new ScheduleException("车辆已经配置在" + carConfigInfos.get(0).getXl().getName() + "线路中!");
126   - }
127   - }
128   - }
129   -
130   - }
131   -
132   - @Override
133   - public void validate_cars(Integer xlId, Integer clId) throws ScheduleException {
134   - Map<String, Object> param = new HashMap<>();
135   - param.put("cl.id_eq", clId);
136   - param.put("isCancel_eq", false);
137   - List<CarConfigInfo> carConfigInfos = list(param);
138   - for (CarConfigInfo carConfigInfo : carConfigInfos) {
139   - if (!carConfigInfo.getXl().getId().equals(xlId)) {
140   - throw new ScheduleException("车辆不配置在当前线路下,配置在" + carConfigInfo.getXl().getName() + "线路中!");
141   - }
142   - }
143   - }
144   -
145   - @Override
146   - public void validate_cars_config(CarConfigInfo carConfigInfo) throws ScheduleException {
147   - Map<String, Object> param = new HashMap<>();
148   - param.put("xl.id_eq", carConfigInfo.getXl().getId());
149   - param.put("cl.id_eq", carConfigInfo.getCl().getId());
150   - param.put("isCancel_eq", false);
151   - List<CarConfigInfo> carConfigInfos = list(param);
152   - if (CollectionUtils.isEmpty(carConfigInfos)) {
153   - throw new ScheduleException("当前车辆没有配置在当前线路中,不属于当前线路!");
154   - }
155   - }
156   -
157   - @Transactional
158   - @Override
159   - public void delete(Long aLong) throws ScheduleException {
160   - toggleCancel(aLong);
161   - }
162   -
163   - @Transactional
164   - public void toggleCancel(Long id) throws ScheduleException {
165   - CarConfigInfo carConfigInfo = findById(id);
166   - Map<String, Object> param = new HashMap<>();
167   - if (carConfigInfo.getIsCancel()) {
168   - validate_cars(carConfigInfo);
169   - carConfigInfo.setIsCancel(false);
170   - } else {
171   - param.clear();
172   - param.put("carConfigInfo.id_eq", carConfigInfo.getId());
173   - List<ScheduleRule1Flat> scheduleRule1Flats = (List<ScheduleRule1Flat>) scheduleRule1FlatService.list(param);
174   - if (CollectionUtils.isEmpty(scheduleRule1Flats)) {
175   - carConfigInfo.setIsCancel(true);
176   - } else {
177   - throw new ScheduleException("车辆配置已被规则使用,不能作废,请先修改规则!");
178   - }
179   - }
180   - }
181   -
182   -}
  1 +package com.bsth.service.schedule.impl;
  2 +
  3 +import com.bsth.entity.Cars;
  4 +import com.bsth.entity.schedule.CarConfigInfo;
  5 +import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
  6 +import com.bsth.entity.sys.CompanyAuthority;
  7 +import com.bsth.service.schedule.CarConfigInfoService;
  8 +import com.bsth.service.schedule.CarsService;
  9 +import com.bsth.service.schedule.ScheduleRule1FlatService;
  10 +import com.bsth.service.schedule.exception.ScheduleException;
  11 +import com.bsth.service.schedule.utils.DataToolsFile;
  12 +import com.bsth.service.schedule.utils.DataToolsService;
  13 +import org.springframework.beans.factory.annotation.Autowired;
  14 +import org.springframework.beans.factory.annotation.Qualifier;
  15 +import org.springframework.stereotype.Service;
  16 +import org.springframework.transaction.annotation.Transactional;
  17 +import org.springframework.util.CollectionUtils;
  18 +
  19 +import java.io.File;
  20 +import java.util.HashMap;
  21 +import java.util.List;
  22 +import java.util.Map;
  23 +
  24 +/**
  25 + * Created by xu on 16/5/9.
  26 + */
  27 +@Service
  28 +public class CarConfigInfoServiceImpl extends BServiceImpl<CarConfigInfo, Long> implements CarConfigInfoService {
  29 + @Autowired
  30 + private ScheduleRule1FlatService scheduleRule1FlatService;
  31 + @Autowired
  32 + private CarsService carsService;
  33 +
  34 + @Autowired
  35 + @Qualifier(value = "carConfig_dataTool")
  36 + private DataToolsService dataToolsService;
  37 +
  38 + @Override
  39 + public DataToolsFile uploadFile(String filename, byte[] filedata) throws ScheduleException {
  40 + return dataToolsService.uploadFile(filename, filedata);
  41 + }
  42 +
  43 + @Override
  44 + public void importData(File file, Map<String, Object> params) throws ScheduleException {
  45 + dataToolsService.importData(file, params);
  46 + }
  47 +
  48 + @Override
  49 + public DataToolsFile exportData(Map<String, Object> params) throws ScheduleException {
  50 + return dataToolsService.exportData(params);
  51 + }
  52 +
  53 + @Override
  54 + public void validate_cars_gs(CarConfigInfo carConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException {
  55 + if (CollectionUtils.isEmpty(companyAuthorityList)) {
  56 + throw new ScheduleException("当前用户没有公司权限!");
  57 + }
  58 +
  59 + boolean isFind = false;
  60 + Cars cars = carsService.findById(carConfigInfo.getCl().getId());
  61 + for (CompanyAuthority companyAuthority : companyAuthorityList) {
  62 + if (companyAuthority.getCompanyCode().equals(cars.getBusinessCode())) {
  63 + isFind = true;
  64 + break;
  65 + }
  66 + }
  67 + if (!isFind) {
  68 + throw new ScheduleException("当前车辆不在用户所属公司中!");
  69 + }
  70 + }
  71 +
  72 + @Override
  73 + public void validate_cars_fgs(CarConfigInfo carConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException {
  74 + if (CollectionUtils.isEmpty(companyAuthorityList)) {
  75 + throw new ScheduleException("当前用户没有线队权限!");
  76 + }
  77 +
  78 + boolean isFind = false;
  79 + Cars cars = carsService.findById(carConfigInfo.getCl().getId());
  80 + for (CompanyAuthority companyAuthority : companyAuthorityList) {
  81 + if (companyAuthority.getCompanyCode().equals(cars.getBusinessCode())) {
  82 + isFind = true;
  83 + break;
  84 + }
  85 + }
  86 + if (!isFind) {
  87 + // 如果没有公司权限,验证通过
  88 + return;
  89 + }
  90 +
  91 + isFind = false;
  92 + for (CompanyAuthority companyAuthority : companyAuthorityList) {
  93 + if (companyAuthority.getCompanyCode().equals(cars.getBusinessCode()) &&
  94 + companyAuthority.getSubCompanyCode().equals(cars.getBrancheCompanyCode())) {
  95 + isFind = true;
  96 + break;
  97 + }
  98 + }
  99 + if (!isFind) {
  100 + throw new ScheduleException("当前车辆不在用户所属线队中!");
  101 + }
  102 + }
  103 +
  104 + @Transactional
  105 + public void validate_cars(CarConfigInfo carConfigInfo) throws ScheduleException {
  106 + // 相同车辆不能同时配置
  107 + Map<String, Object> param = new HashMap<>();
  108 + if (carConfigInfo.getId() != null) {
  109 + param.put("id_ne", carConfigInfo.getId());
  110 + }
  111 +
  112 + if (carConfigInfo.getXl() == null ||
  113 + carConfigInfo.getXl().getId() == null ||
  114 + carConfigInfo.getXl().getName() == null) {
  115 + throw new ScheduleException("线路未选择");
  116 + } else {
  117 +// param.put("xl.id_eq", carConfigInfo.getXl().getId());
  118 + param.put("isCancel_eq", false);
  119 + if (carConfigInfo.getCl() == null || carConfigInfo.getCl().getId() == null) {
  120 + throw new ScheduleException("车辆未选择");
  121 + } else {
  122 + param.put("cl.id_eq", carConfigInfo.getCl().getId());
  123 + List<CarConfigInfo> carConfigInfos = list(param);
  124 + if (!CollectionUtils.isEmpty(carConfigInfos)) {
  125 + throw new ScheduleException("车辆已经配置在" + carConfigInfos.get(0).getXl().getName() + "线路中!");
  126 + }
  127 + }
  128 + }
  129 +
  130 + }
  131 +
  132 + @Override
  133 + public void validate_cars(Integer xlId, Integer clId) throws ScheduleException {
  134 + Map<String, Object> param = new HashMap<>();
  135 + param.put("cl.id_eq", clId);
  136 + param.put("isCancel_eq", false);
  137 + List<CarConfigInfo> carConfigInfos = list(param);
  138 + for (CarConfigInfo carConfigInfo : carConfigInfos) {
  139 + if (!carConfigInfo.getXl().getId().equals(xlId)) {
  140 + throw new ScheduleException("车辆不配置在当前线路下,配置在" + carConfigInfo.getXl().getName() + "线路中!");
  141 + }
  142 + }
  143 + }
  144 +
  145 + @Override
  146 + public void validate_cars_config(CarConfigInfo carConfigInfo) throws ScheduleException {
  147 + Map<String, Object> param = new HashMap<>();
  148 + param.put("xl.id_eq", carConfigInfo.getXl().getId());
  149 + param.put("cl.id_eq", carConfigInfo.getCl().getId());
  150 + param.put("isCancel_eq", false);
  151 + List<CarConfigInfo> carConfigInfos = list(param);
  152 + if (CollectionUtils.isEmpty(carConfigInfos)) {
  153 + throw new ScheduleException("当前车辆没有配置在当前线路中,不属于当前线路!");
  154 + }
  155 + }
  156 +
  157 + @Transactional
  158 + @Override
  159 + public void delete(Long aLong) throws ScheduleException {
  160 + toggleCancel(aLong);
  161 + }
  162 +
  163 + @Transactional
  164 + public void toggleCancel(Long id) throws ScheduleException {
  165 + CarConfigInfo carConfigInfo = findById(id);
  166 + Map<String, Object> param = new HashMap<>();
  167 + if (carConfigInfo.getIsCancel()) {
  168 + validate_cars(carConfigInfo);
  169 + carConfigInfo.setIsCancel(false);
  170 + } else {
  171 + param.clear();
  172 + param.put("carConfigInfo.id_eq", carConfigInfo.getId());
  173 + List<ScheduleRule1Flat> scheduleRule1Flats = (List<ScheduleRule1Flat>) scheduleRule1FlatService.list(param);
  174 + if (CollectionUtils.isEmpty(scheduleRule1Flats)) {
  175 + carConfigInfo.setIsCancel(true);
  176 + } else {
  177 + throw new ScheduleException("车辆配置已被规则使用,不能作废,请先修改规则!");
  178 + }
  179 + }
  180 + }
  181 +
  182 +}
... ...
src/main/java/com/bsth/service/schedule/impl/EmployeeConfigInfoServiceImpl.java
1   -package com.bsth.service.schedule.impl;
2   -
3   -import com.bsth.entity.Personnel;
4   -import com.bsth.entity.schedule.EmployeeConfigInfo;
5   -import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
6   -import com.bsth.entity.sys.CompanyAuthority;
7   -import com.bsth.entity.sys.Module;
8   -import com.bsth.repository.PersonnelRepository;
9   -import com.bsth.service.schedule.EmployeeConfigInfoService;
10   -import com.bsth.service.schedule.EmployeeService;
11   -import com.bsth.service.schedule.ScheduleRule1FlatService;
12   -import com.bsth.service.schedule.exception.ScheduleException;
13   -import com.bsth.service.schedule.utils.DataToolsFile;
14   -import com.bsth.service.schedule.utils.DataToolsService;
15   -import com.bsth.service.sys.ModuleService;
16   -import com.bsth.util.DateUtils;
17   -import org.apache.commons.lang3.time.DateFormatUtils;
18   -import org.springframework.beans.factory.annotation.Autowired;
19   -import org.springframework.beans.factory.annotation.Qualifier;
20   -import org.springframework.dao.DataAccessException;
21   -import org.springframework.jdbc.core.JdbcTemplate;
22   -import org.springframework.jdbc.core.ResultSetExtractor;
23   -import org.springframework.jdbc.core.RowMapper;
24   -import org.springframework.stereotype.Service;
25   -import org.springframework.transaction.annotation.Transactional;
26   -import org.springframework.util.CollectionUtils;
27   -
28   -import java.io.File;
29   -import java.sql.ResultSet;
30   -import java.sql.SQLException;
31   -import java.util.*;
32   -
33   -/**
34   - * Created by xu on 16/5/10.
35   - */
36   -@Service
37   -public class EmployeeConfigInfoServiceImpl extends BServiceImpl<EmployeeConfigInfo, Long> implements EmployeeConfigInfoService {
38   - @Autowired
39   - private ScheduleRule1FlatService scheduleRule1FlatService;
40   - @Autowired
41   - private EmployeeService employeeService;
42   -
43   - @Autowired
44   - private PersonnelRepository personnelRepository;
45   -
46   - @Autowired
47   - @Qualifier(value = "employeeConfig_dataTool")
48   - private DataToolsService dataToolsService;
49   -
50   - @Autowired
51   - private JdbcTemplate jdbcTemplate;
52   -
53   - @Override
54   - public DataToolsFile uploadFile(String filename, byte[] filedata) throws ScheduleException {
55   - return dataToolsService.uploadFile(filename, filedata);
56   - }
57   -
58   - @Override
59   - public void importData(File file, Map<String, Object> params) throws ScheduleException {
60   - dataToolsService.importData(file, params);
61   - }
62   -
63   - @Override
64   - public DataToolsFile exportData(Map<String, Object> params) throws ScheduleException {
65   - return dataToolsService.exportData(params);
66   - }
67   -
68   - @Override
69   - public Long getMaxDbbm(Integer xlId) {
70   - String sql = "select max(dbbm + 0) as maxdbbm from bsth_c_s_ecinfo where xl = ?";
71   -
72   - Long maxBM = jdbcTemplate.query(sql, new ResultSetExtractor<Long>() {
73   - @Override
74   - public Long extractData(ResultSet rs) throws SQLException, DataAccessException {
75   - if (rs.next()) {
76   - return rs.getLong("maxdbbm");
77   - } else {
78   - return 0L;
79   - }
80   -
81   - }
82   - }, xlId);
83   -
84   - return maxBM + 1;
85   - }
86   -
87   - @Transactional
88   - @Override
89   - public void validate_jsy_destroy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException {
90   - Personnel jsy = this.personnelRepository.findById(employeeConfigInfo.getJsy().getId()).get();
91   - if (jsy.getDestroy() != null && jsy.getDestroy() == 1) {
92   - throw new ScheduleException("当前驾驶员已经停用!");
93   - }
94   - }
95   - @Transactional
96   - @Override
97   - public void validate_spy_destroy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException {
98   - Personnel spy = this.personnelRepository.findById(employeeConfigInfo.getSpy().getId()).get();
99   - if (spy.getDestroy() != null && spy.getDestroy() == 1) {
100   - throw new ScheduleException("当前售票员已经停用!");
101   - }
102   - }
103   -
104   - @Transactional
105   - @Override
106   - public void validate_jsy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException {
107   - // 驾驶员不能重复配置
108   - Map<String, Object> param = new HashMap<>();
109   - if (employeeConfigInfo.getId() != null) {
110   - param.put("id_ne", employeeConfigInfo.getId());
111   - }
112   -
113   - if (employeeConfigInfo.getXl() == null ||
114   - employeeConfigInfo.getXl().getId() == null ||
115   - employeeConfigInfo.getXl().getName() == null) {
116   - throw new ScheduleException("线路未选择");
117   - } else {
118   -// param.put("xl.id_eq", employeeConfigInfo.getXl().getId());
119   - param.put("isCancel_eq", false); // 未作废的人员配置
120   -
121   - if (employeeConfigInfo.getJsy() == null || employeeConfigInfo.getJsy().getId() == null) {
122   - throw new ScheduleException("驾驶员未选择");
123   - } else {
124   - // 检测人员是否已经配置在其他线路的驾驶员列表中
125   - param.put("jsy.id_eq", employeeConfigInfo.getJsy().getId());
126   - List<EmployeeConfigInfo> employeeConfigInfos = list(param);
127   - if (!CollectionUtils.isEmpty(list(param))) {
128   - throw new ScheduleException("人员已经配置在线路[" + employeeConfigInfos.get(0).getXl().getName() + "]驾驶员列表中!");
129   - }
130   -
131   - // 检测人员是否已经配置在其他线路的售票员列表中
132   - param.remove("jsy.id_eq");
133   - param.put("spy.id_eq", employeeConfigInfo.getJsy().getId());
134   - employeeConfigInfos = list(param);
135   - if (!CollectionUtils.isEmpty(list(param))) {
136   - throw new ScheduleException("人员已经配置在线路[" + employeeConfigInfos.get(0).getXl().getName() + "]售票员列表中!");
137   - }
138   -
139   - }
140   - }
141   - }
142   -
143   - @Transactional
144   - @Override
145   - public void validate_jsy_config(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException {
146   - Map<String, Object> param = new HashMap<>();
147   - param.put("xl.id_eq", employeeConfigInfo.getXl().getId());
148   - param.put("jsy.id_eq", employeeConfigInfo.getJsy().getId());
149   - List<EmployeeConfigInfo> employeeConfigInfos = list(param);
150   - if (CollectionUtils.isEmpty(employeeConfigInfos)) {
151   - throw new ScheduleException("驾驶员没有配置在当前线路中,不属于当前线路!");
152   - }
153   - }
154   -
155   - @Override
156   - public void validate_jsy_gs(EmployeeConfigInfo employeeConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException {
157   - if (CollectionUtils.isEmpty(companyAuthorityList)) {
158   - throw new ScheduleException("当前用户没有公司权限!");
159   - }
160   -
161   - boolean isFind = false;
162   - Personnel personnel = employeeService.findById(employeeConfigInfo.getJsy().getId());
163   - for (CompanyAuthority companyAuthority : companyAuthorityList) {
164   - if (companyAuthority.getCompanyCode().equals(personnel.getCompanyCode())) {
165   - isFind = true;
166   - break;
167   - }
168   - }
169   - if (!isFind) {
170   - throw new ScheduleException("当前驾驶员不在用户所属公司中!");
171   - }
172   - }
173   -
174   - @Override
175   - public void validate_jsy_fgs(EmployeeConfigInfo employeeConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException {
176   - if (CollectionUtils.isEmpty(companyAuthorityList)) {
177   - throw new ScheduleException("当前用户没有分公司权限!");
178   - }
179   -
180   - boolean isFind = false;
181   - Personnel personnel = employeeService.findById(employeeConfigInfo.getJsy().getId());
182   - for (CompanyAuthority companyAuthority : companyAuthorityList) {
183   - if (companyAuthority.getCompanyCode().equals(personnel.getCompanyCode())) {
184   - isFind = true;
185   - break;
186   - }
187   - }
188   - if (!isFind) {
189   - // 如果没有公司权限,验证通过
190   - return;
191   - }
192   -
193   - isFind = false;
194   - for (CompanyAuthority companyAuthority : companyAuthorityList) {
195   - if (companyAuthority.getCompanyCode().equals(personnel.getCompanyCode()) &&
196   - companyAuthority.getSubCompanyCode().equals(personnel.getBrancheCompanyCode())) {
197   - isFind = true;
198   - break;
199   - }
200   - }
201   - if (!isFind) {
202   - throw new ScheduleException("当前驾驶员不在用户所属分公司中!");
203   - }
204   - }
205   -
206   - @Transactional
207   - @Override
208   - public void validate_spy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException {
209   - // 售票员不能重复配置
210   - Map<String, Object> param = new HashMap<>();
211   - if (employeeConfigInfo.getId() != null) {
212   - param.put("id_ne", employeeConfigInfo.getId());
213   - }
214   -
215   - if (employeeConfigInfo.getXl() == null ||
216   - employeeConfigInfo.getXl().getId() == null ||
217   - employeeConfigInfo.getXl().getName() == null) {
218   - throw new ScheduleException("线路未选择");
219   - } else {
220   -// param.put("xl.id_eq", employeeConfigInfo.getXl().getId());
221   - param.put("isCancel_eq", false); // 未作废的人员配置
222   -
223   - if (employeeConfigInfo.getSpy() == null || employeeConfigInfo.getSpy().getId() == null) {
224   - throw new ScheduleException("售票员未选择");
225   - } else {
226   - // 检测人员是否已经配置在其他线路售票员列表中
227   - param.put("spy.id_eq", employeeConfigInfo.getSpy().getId());
228   - List<EmployeeConfigInfo> employeeConfigInfos = list(param);
229   - if (!CollectionUtils.isEmpty(list(param))) {
230   - throw new ScheduleException("人员已经配置在线路[" + employeeConfigInfos.get(0).getXl().getName() + "]售票员列表中!");
231   - }
232   -
233   - // 检测人员是否已经配置在其他线路的驾驶员列表中
234   - param.remove("spy.id_eq");
235   - param.put("jsy.id_eq", employeeConfigInfo.getSpy().getId());
236   - employeeConfigInfos = list(param);
237   - if (!CollectionUtils.isEmpty(list(param))) {
238   - throw new ScheduleException("人员已经配置在线路[" + employeeConfigInfos.get(0).getXl().getName() + "]驾驶员列表中!");
239   - }
240   -
241   - }
242   - }
243   - }
244   -
245   - @Override
246   - public void validate_spy_gs(EmployeeConfigInfo employeeConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException {
247   - if (CollectionUtils.isEmpty(companyAuthorityList)) {
248   - throw new ScheduleException("当前用户没有公司权限!");
249   - }
250   -
251   - boolean isFind = false;
252   - Personnel personnel = employeeService.findById(employeeConfigInfo.getSpy().getId());
253   - for (CompanyAuthority companyAuthority : companyAuthorityList) {
254   - if (companyAuthority.getCompanyCode().equals(personnel.getCompanyCode())) {
255   - isFind = true;
256   - break;
257   - }
258   - }
259   - if (!isFind) {
260   - throw new ScheduleException("当前售票员不在用户所属公司中!");
261   - }
262   - }
263   -
264   - @Override
265   - public void validate_spy_fgs(EmployeeConfigInfo employeeConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException {
266   - if (CollectionUtils.isEmpty(companyAuthorityList)) {
267   - throw new ScheduleException("当前用户没有分公司权限!");
268   - }
269   -
270   - boolean isFind = false;
271   - Personnel personnel = employeeService.findById(employeeConfigInfo.getSpy().getId());
272   - for (CompanyAuthority companyAuthority : companyAuthorityList) {
273   - if (companyAuthority.getCompanyCode().equals(personnel.getCompanyCode())) {
274   - isFind = true;
275   - break;
276   - }
277   - }
278   - if (!isFind) {
279   - // 如果没有公司权限,验证通过
280   - return;
281   - }
282   -
283   - isFind = false;
284   - for (CompanyAuthority companyAuthority : companyAuthorityList) {
285   - if (companyAuthority.getCompanyCode().equals(personnel.getCompanyCode()) &&
286   - companyAuthority.getSubCompanyCode().equals(personnel.getBrancheCompanyCode())) {
287   - isFind = true;
288   - break;
289   - }
290   - }
291   - if (!isFind) {
292   - throw new ScheduleException("当前售票员不在用户所属分公司中!");
293   - }
294   - }
295   -
296   - @Transactional
297   - @Override
298   - public void validate_spy_config(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException {
299   - Map<String, Object> param = new HashMap<>();
300   - param.put("xl.id_eq", employeeConfigInfo.getXl().getId());
301   - param.put("spy.id_eq", employeeConfigInfo.getSpy().getId());
302   - List<EmployeeConfigInfo> employeeConfigInfos = list(param);
303   - if (CollectionUtils.isEmpty(employeeConfigInfos)) {
304   - throw new ScheduleException("售票员没有配置在当前线路中,不属于当前线路!");
305   - }
306   - }
307   -
308   - @Autowired
309   - private ModuleService moduleService;
310   - @Transactional
311   - @Override
312   - public List<String> validate_get_destory_info() {
313   - // 1、查找当前用户是否有运营计划管理,没有的话不分析是否有停用人员信息
314   - List<Module> moduleList = this.moduleService.findByCurrentUser();
315   - boolean hasPlanModule = false;
316   - for (Module module : moduleList) {
317   - if ("运营计划管理".equals(module.getName())) {
318   - hasPlanModule = true;
319   - break;
320   - }
321   - }
322   - if (!hasPlanModule) {
323   - return null;
324   - }
325   -
326   - // 2、计算从当前时间开始的排班计划中是否有停用人员
327   - String sql =
328   - "select distinct " +
329   - "plan.xl_name xlName " +
330   - ", plan.schedule_date scheduleDate " +
331   - "from bsth_c_s_sp_info plan " +
332   - "left join bsth_c_personnel jsy on jsy.id = plan.j " +
333   - "left join bsth_c_personnel spy on spy.id = plan.s " +
334   - "where plan.schedule_date >= ? " +
335   - "and (jsy.destroy = 1 || spy.destroy = 1) " +
336   - "group by plan.xl_name, plan.schedule_date " +
337   - "order by plan.xl_name, plan.schedule_date ";
338   -
339   -// String sql =
340   -// "select distinct " +
341   -// "pinfo.xl_name xlName " +
342   -// ", pinfo.schedule_date scheduleDate " +
343   -// "from " +
344   -// "(" +
345   -// "select plan.xl_name, plan.schedule_date " +
346   -// "from bsth_c_s_sp_info plan " +
347   -// "left join bsth_c_personnel jsy on plan.j = jsy.id " +
348   -// "left join bsth_c_personnel spy on plan.s = spy.id " +
349   -// "where schedule_date >= ? " +
350   -// "and (jsy.destroy = 1 || spy.destroy = 1) " +
351   -// "order by plan.xl_name asc, plan.schedule_date asc " +
352   -// ") pinfo " +
353   -// "group by pinfo.xl_name, pinfo.schedule_date ";
354   -
355   -
356   - Date currentDate = new Date(DateUtils.getTimestamp());
357   - System.out.println(currentDate);
358   - String info_format = "线路[%s][%s]排班中有人员已经停用,请及时处理!";
359   - List<String> infoList = this.jdbcTemplate.query(sql, new Object[] {currentDate}, new RowMapper<String>() {
360   - @Override
361   - public String mapRow(ResultSet resultSet, int i) throws SQLException {
362   - String xlName = resultSet.getString("xlName");
363   - Date scheduleDate = new Date(resultSet.getDate("scheduleDate").getTime());
364   - return String.format(info_format, xlName, DateFormatUtils.format(scheduleDate, "yyyy年MM月dd日"));
365   - }
366   - });
367   -
368   - return infoList;
369   - }
370   -
371   - @Transactional
372   - @Override
373   - public void delete(Long aLong) throws ScheduleException {
374   - toggleCancel(aLong);
375   - }
376   -
377   - @Transactional
378   - @Override
379   - public void toggleCancel(Long id) throws ScheduleException {
380   - EmployeeConfigInfo employeeConfigInfo = findById(id);
381   - Map<String, Object> param = new HashMap<>();
382   - if (employeeConfigInfo.getIsCancel()) {
383   - validate_jsy(employeeConfigInfo);
384   - if (employeeConfigInfo.getSpy() != null) {
385   - validate_spy(employeeConfigInfo);
386   - }
387   - employeeConfigInfo.setIsCancel(false);
388   - } else {
389   - param.clear();
390   - param.put("xl.id_eq", employeeConfigInfo.getXl().getId());
391   - List<ScheduleRule1Flat> scheduleRule1Flats = (List<ScheduleRule1Flat>) scheduleRule1FlatService.list(param);
392   - List<String> ryConfigIds = new ArrayList<>();
393   - for (ScheduleRule1Flat scheduleRule1Flat : scheduleRule1Flats) {
394   - ryConfigIds.addAll(Arrays.asList(scheduleRule1Flat.getRyConfigIds().split(",")));
395   - }
396   -
397   - if (ryConfigIds.contains(String.valueOf(id))) {
398   - throw new ScheduleException("人员配置已被规则使用,不能作废,请先修改规则!");
399   - } else {
400   - employeeConfigInfo.setIsCancel(true);
401   - }
402   - }
403   - }
404   -
405   -}
  1 +package com.bsth.service.schedule.impl;
  2 +
  3 +import com.bsth.entity.Personnel;
  4 +import com.bsth.entity.schedule.EmployeeConfigInfo;
  5 +import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
  6 +import com.bsth.entity.sys.CompanyAuthority;
  7 +import com.bsth.entity.sys.Module;
  8 +import com.bsth.repository.PersonnelRepository;
  9 +import com.bsth.service.schedule.EmployeeConfigInfoService;
  10 +import com.bsth.service.schedule.EmployeeService;
  11 +import com.bsth.service.schedule.ScheduleRule1FlatService;
  12 +import com.bsth.service.schedule.exception.ScheduleException;
  13 +import com.bsth.service.schedule.utils.DataToolsFile;
  14 +import com.bsth.service.schedule.utils.DataToolsService;
  15 +import com.bsth.service.sys.ModuleService;
  16 +import com.bsth.util.DateUtils;
  17 +import org.apache.commons.lang3.time.DateFormatUtils;
  18 +import org.springframework.beans.factory.annotation.Autowired;
  19 +import org.springframework.beans.factory.annotation.Qualifier;
  20 +import org.springframework.dao.DataAccessException;
  21 +import org.springframework.jdbc.core.JdbcTemplate;
  22 +import org.springframework.jdbc.core.ResultSetExtractor;
  23 +import org.springframework.jdbc.core.RowMapper;
  24 +import org.springframework.stereotype.Service;
  25 +import org.springframework.transaction.annotation.Transactional;
  26 +import org.springframework.util.CollectionUtils;
  27 +
  28 +import java.io.File;
  29 +import java.sql.ResultSet;
  30 +import java.sql.SQLException;
  31 +import java.util.*;
  32 +
  33 +/**
  34 + * Created by xu on 16/5/10.
  35 + */
  36 +@Service
  37 +public class EmployeeConfigInfoServiceImpl extends BServiceImpl<EmployeeConfigInfo, Long> implements EmployeeConfigInfoService {
  38 + @Autowired
  39 + private ScheduleRule1FlatService scheduleRule1FlatService;
  40 + @Autowired
  41 + private EmployeeService employeeService;
  42 +
  43 + @Autowired
  44 + private PersonnelRepository personnelRepository;
  45 +
  46 + @Autowired
  47 + @Qualifier(value = "employeeConfig_dataTool")
  48 + private DataToolsService dataToolsService;
  49 +
  50 + @Autowired
  51 + private JdbcTemplate jdbcTemplate;
  52 +
  53 + @Override
  54 + public DataToolsFile uploadFile(String filename, byte[] filedata) throws ScheduleException {
  55 + return dataToolsService.uploadFile(filename, filedata);
  56 + }
  57 +
  58 + @Override
  59 + public void importData(File file, Map<String, Object> params) throws ScheduleException {
  60 + dataToolsService.importData(file, params);
  61 + }
  62 +
  63 + @Override
  64 + public DataToolsFile exportData(Map<String, Object> params) throws ScheduleException {
  65 + return dataToolsService.exportData(params);
  66 + }
  67 +
  68 + @Override
  69 + public Long getMaxDbbm(Integer xlId) {
  70 + String sql = "select max(dbbm + 0) as maxdbbm from bsth_c_s_ecinfo where xl = ?";
  71 +
  72 + Long maxBM = jdbcTemplate.query(sql, new ResultSetExtractor<Long>() {
  73 + @Override
  74 + public Long extractData(ResultSet rs) throws SQLException, DataAccessException {
  75 + if (rs.next()) {
  76 + return rs.getLong("maxdbbm");
  77 + } else {
  78 + return 0L;
  79 + }
  80 +
  81 + }
  82 + }, xlId);
  83 +
  84 + return maxBM + 1;
  85 + }
  86 +
  87 + @Transactional
  88 + @Override
  89 + public void validate_jsy_destroy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException {
  90 + Personnel jsy = this.personnelRepository.findById(employeeConfigInfo.getJsy().getId()).get();
  91 + if (jsy.getDestroy() != null && jsy.getDestroy() == 1) {
  92 + throw new ScheduleException("当前驾驶员已经停用!");
  93 + }
  94 + }
  95 + @Transactional
  96 + @Override
  97 + public void validate_spy_destroy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException {
  98 + Personnel spy = this.personnelRepository.findById(employeeConfigInfo.getSpy().getId()).get();
  99 + if (spy.getDestroy() != null && spy.getDestroy() == 1) {
  100 + throw new ScheduleException("当前售票员已经停用!");
  101 + }
  102 + }
  103 +
  104 + @Transactional
  105 + @Override
  106 + public void validate_jsy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException {
  107 + // 驾驶员不能重复配置
  108 + Map<String, Object> param = new HashMap<>();
  109 + if (employeeConfigInfo.getId() != null) {
  110 + param.put("id_ne", employeeConfigInfo.getId());
  111 + }
  112 +
  113 + if (employeeConfigInfo.getXl() == null ||
  114 + employeeConfigInfo.getXl().getId() == null ||
  115 + employeeConfigInfo.getXl().getName() == null) {
  116 + throw new ScheduleException("线路未选择");
  117 + } else {
  118 +// param.put("xl.id_eq", employeeConfigInfo.getXl().getId());
  119 + param.put("isCancel_eq", false); // 未作废的人员配置
  120 +
  121 + if (employeeConfigInfo.getJsy() == null || employeeConfigInfo.getJsy().getId() == null) {
  122 + throw new ScheduleException("驾驶员未选择");
  123 + } else {
  124 + // 检测人员是否已经配置在其他线路的驾驶员列表中
  125 + param.put("jsy.id_eq", employeeConfigInfo.getJsy().getId());
  126 + List<EmployeeConfigInfo> employeeConfigInfos = list(param);
  127 + if (!CollectionUtils.isEmpty(list(param))) {
  128 + throw new ScheduleException("人员已经配置在线路[" + employeeConfigInfos.get(0).getXl().getName() + "]驾驶员列表中!");
  129 + }
  130 +
  131 + // 检测人员是否已经配置在其他线路的售票员列表中
  132 + param.remove("jsy.id_eq");
  133 + param.put("spy.id_eq", employeeConfigInfo.getJsy().getId());
  134 + employeeConfigInfos = list(param);
  135 + if (!CollectionUtils.isEmpty(list(param))) {
  136 + throw new ScheduleException("人员已经配置在线路[" + employeeConfigInfos.get(0).getXl().getName() + "]售票员列表中!");
  137 + }
  138 +
  139 + }
  140 + }
  141 + }
  142 +
  143 + @Transactional
  144 + @Override
  145 + public void validate_jsy_config(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException {
  146 + Map<String, Object> param = new HashMap<>();
  147 + param.put("xl.id_eq", employeeConfigInfo.getXl().getId());
  148 + param.put("jsy.id_eq", employeeConfigInfo.getJsy().getId());
  149 + List<EmployeeConfigInfo> employeeConfigInfos = list(param);
  150 + if (CollectionUtils.isEmpty(employeeConfigInfos)) {
  151 + throw new ScheduleException("驾驶员没有配置在当前线路中,不属于当前线路!");
  152 + }
  153 + }
  154 +
  155 + @Override
  156 + public void validate_jsy_gs(EmployeeConfigInfo employeeConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException {
  157 + if (CollectionUtils.isEmpty(companyAuthorityList)) {
  158 + throw new ScheduleException("当前用户没有公司权限!");
  159 + }
  160 +
  161 + boolean isFind = false;
  162 + Personnel personnel = employeeService.findById(employeeConfigInfo.getJsy().getId());
  163 + for (CompanyAuthority companyAuthority : companyAuthorityList) {
  164 + if (companyAuthority.getCompanyCode().equals(personnel.getCompanyCode())) {
  165 + isFind = true;
  166 + break;
  167 + }
  168 + }
  169 + if (!isFind) {
  170 + throw new ScheduleException("当前驾驶员不在用户所属公司中!");
  171 + }
  172 + }
  173 +
  174 + @Override
  175 + public void validate_jsy_fgs(EmployeeConfigInfo employeeConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException {
  176 + if (CollectionUtils.isEmpty(companyAuthorityList)) {
  177 + throw new ScheduleException("当前用户没有线队权限!");
  178 + }
  179 +
  180 + boolean isFind = false;
  181 + Personnel personnel = employeeService.findById(employeeConfigInfo.getJsy().getId());
  182 + for (CompanyAuthority companyAuthority : companyAuthorityList) {
  183 + if (companyAuthority.getCompanyCode().equals(personnel.getCompanyCode())) {
  184 + isFind = true;
  185 + break;
  186 + }
  187 + }
  188 + if (!isFind) {
  189 + // 如果没有公司权限,验证通过
  190 + return;
  191 + }
  192 +
  193 + isFind = false;
  194 + for (CompanyAuthority companyAuthority : companyAuthorityList) {
  195 + if (companyAuthority.getCompanyCode().equals(personnel.getCompanyCode()) &&
  196 + companyAuthority.getSubCompanyCode().equals(personnel.getBrancheCompanyCode())) {
  197 + isFind = true;
  198 + break;
  199 + }
  200 + }
  201 + if (!isFind) {
  202 + throw new ScheduleException("当前驾驶员不在用户所属线队中!");
  203 + }
  204 + }
  205 +
  206 + @Transactional
  207 + @Override
  208 + public void validate_spy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException {
  209 + // 售票员不能重复配置
  210 + Map<String, Object> param = new HashMap<>();
  211 + if (employeeConfigInfo.getId() != null) {
  212 + param.put("id_ne", employeeConfigInfo.getId());
  213 + }
  214 +
  215 + if (employeeConfigInfo.getXl() == null ||
  216 + employeeConfigInfo.getXl().getId() == null ||
  217 + employeeConfigInfo.getXl().getName() == null) {
  218 + throw new ScheduleException("线路未选择");
  219 + } else {
  220 +// param.put("xl.id_eq", employeeConfigInfo.getXl().getId());
  221 + param.put("isCancel_eq", false); // 未作废的人员配置
  222 +
  223 + if (employeeConfigInfo.getSpy() == null || employeeConfigInfo.getSpy().getId() == null) {
  224 + throw new ScheduleException("售票员未选择");
  225 + } else {
  226 + // 检测人员是否已经配置在其他线路售票员列表中
  227 + param.put("spy.id_eq", employeeConfigInfo.getSpy().getId());
  228 + List<EmployeeConfigInfo> employeeConfigInfos = list(param);
  229 + if (!CollectionUtils.isEmpty(list(param))) {
  230 + throw new ScheduleException("人员已经配置在线路[" + employeeConfigInfos.get(0).getXl().getName() + "]售票员列表中!");
  231 + }
  232 +
  233 + // 检测人员是否已经配置在其他线路的驾驶员列表中
  234 + param.remove("spy.id_eq");
  235 + param.put("jsy.id_eq", employeeConfigInfo.getSpy().getId());
  236 + employeeConfigInfos = list(param);
  237 + if (!CollectionUtils.isEmpty(list(param))) {
  238 + throw new ScheduleException("人员已经配置在线路[" + employeeConfigInfos.get(0).getXl().getName() + "]驾驶员列表中!");
  239 + }
  240 +
  241 + }
  242 + }
  243 + }
  244 +
  245 + @Override
  246 + public void validate_spy_gs(EmployeeConfigInfo employeeConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException {
  247 + if (CollectionUtils.isEmpty(companyAuthorityList)) {
  248 + throw new ScheduleException("当前用户没有公司权限!");
  249 + }
  250 +
  251 + boolean isFind = false;
  252 + Personnel personnel = employeeService.findById(employeeConfigInfo.getSpy().getId());
  253 + for (CompanyAuthority companyAuthority : companyAuthorityList) {
  254 + if (companyAuthority.getCompanyCode().equals(personnel.getCompanyCode())) {
  255 + isFind = true;
  256 + break;
  257 + }
  258 + }
  259 + if (!isFind) {
  260 + throw new ScheduleException("当前售票员不在用户所属公司中!");
  261 + }
  262 + }
  263 +
  264 + @Override
  265 + public void validate_spy_fgs(EmployeeConfigInfo employeeConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException {
  266 + if (CollectionUtils.isEmpty(companyAuthorityList)) {
  267 + throw new ScheduleException("当前用户没有线队权限!");
  268 + }
  269 +
  270 + boolean isFind = false;
  271 + Personnel personnel = employeeService.findById(employeeConfigInfo.getSpy().getId());
  272 + for (CompanyAuthority companyAuthority : companyAuthorityList) {
  273 + if (companyAuthority.getCompanyCode().equals(personnel.getCompanyCode())) {
  274 + isFind = true;
  275 + break;
  276 + }
  277 + }
  278 + if (!isFind) {
  279 + // 如果没有公司权限,验证通过
  280 + return;
  281 + }
  282 +
  283 + isFind = false;
  284 + for (CompanyAuthority companyAuthority : companyAuthorityList) {
  285 + if (companyAuthority.getCompanyCode().equals(personnel.getCompanyCode()) &&
  286 + companyAuthority.getSubCompanyCode().equals(personnel.getBrancheCompanyCode())) {
  287 + isFind = true;
  288 + break;
  289 + }
  290 + }
  291 + if (!isFind) {
  292 + throw new ScheduleException("当前售票员不在用户所属线队中!");
  293 + }
  294 + }
  295 +
  296 + @Transactional
  297 + @Override
  298 + public void validate_spy_config(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException {
  299 + Map<String, Object> param = new HashMap<>();
  300 + param.put("xl.id_eq", employeeConfigInfo.getXl().getId());
  301 + param.put("spy.id_eq", employeeConfigInfo.getSpy().getId());
  302 + List<EmployeeConfigInfo> employeeConfigInfos = list(param);
  303 + if (CollectionUtils.isEmpty(employeeConfigInfos)) {
  304 + throw new ScheduleException("售票员没有配置在当前线路中,不属于当前线路!");
  305 + }
  306 + }
  307 +
  308 + @Autowired
  309 + private ModuleService moduleService;
  310 + @Transactional
  311 + @Override
  312 + public List<String> validate_get_destory_info() {
  313 + // 1、查找当前用户是否有运营计划管理,没有的话不分析是否有停用人员信息
  314 + List<Module> moduleList = this.moduleService.findByCurrentUser();
  315 + boolean hasPlanModule = false;
  316 + for (Module module : moduleList) {
  317 + if ("运营计划管理".equals(module.getName())) {
  318 + hasPlanModule = true;
  319 + break;
  320 + }
  321 + }
  322 + if (!hasPlanModule) {
  323 + return null;
  324 + }
  325 +
  326 + // 2、计算从当前时间开始的排班计划中是否有停用人员
  327 + String sql =
  328 + "select distinct " +
  329 + "plan.xl_name xlName " +
  330 + ", plan.schedule_date scheduleDate " +
  331 + "from bsth_c_s_sp_info plan " +
  332 + "left join bsth_c_personnel jsy on jsy.id = plan.j " +
  333 + "left join bsth_c_personnel spy on spy.id = plan.s " +
  334 + "where plan.schedule_date >= ? " +
  335 + "and (jsy.destroy = 1 || spy.destroy = 1) " +
  336 + "group by plan.xl_name, plan.schedule_date " +
  337 + "order by plan.xl_name, plan.schedule_date ";
  338 +
  339 +// String sql =
  340 +// "select distinct " +
  341 +// "pinfo.xl_name xlName " +
  342 +// ", pinfo.schedule_date scheduleDate " +
  343 +// "from " +
  344 +// "(" +
  345 +// "select plan.xl_name, plan.schedule_date " +
  346 +// "from bsth_c_s_sp_info plan " +
  347 +// "left join bsth_c_personnel jsy on plan.j = jsy.id " +
  348 +// "left join bsth_c_personnel spy on plan.s = spy.id " +
  349 +// "where schedule_date >= ? " +
  350 +// "and (jsy.destroy = 1 || spy.destroy = 1) " +
  351 +// "order by plan.xl_name asc, plan.schedule_date asc " +
  352 +// ") pinfo " +
  353 +// "group by pinfo.xl_name, pinfo.schedule_date ";
  354 +
  355 +
  356 + Date currentDate = new Date(DateUtils.getTimestamp());
  357 + System.out.println(currentDate);
  358 + String info_format = "线路[%s][%s]排班中有人员已经停用,请及时处理!";
  359 + List<String> infoList = this.jdbcTemplate.query(sql, new Object[] {currentDate}, new RowMapper<String>() {
  360 + @Override
  361 + public String mapRow(ResultSet resultSet, int i) throws SQLException {
  362 + String xlName = resultSet.getString("xlName");
  363 + Date scheduleDate = new Date(resultSet.getDate("scheduleDate").getTime());
  364 + return String.format(info_format, xlName, DateFormatUtils.format(scheduleDate, "yyyy年MM月dd日"));
  365 + }
  366 + });
  367 +
  368 + return infoList;
  369 + }
  370 +
  371 + @Transactional
  372 + @Override
  373 + public void delete(Long aLong) throws ScheduleException {
  374 + toggleCancel(aLong);
  375 + }
  376 +
  377 + @Transactional
  378 + @Override
  379 + public void toggleCancel(Long id) throws ScheduleException {
  380 + EmployeeConfigInfo employeeConfigInfo = findById(id);
  381 + Map<String, Object> param = new HashMap<>();
  382 + if (employeeConfigInfo.getIsCancel()) {
  383 + validate_jsy(employeeConfigInfo);
  384 + if (employeeConfigInfo.getSpy() != null) {
  385 + validate_spy(employeeConfigInfo);
  386 + }
  387 + employeeConfigInfo.setIsCancel(false);
  388 + } else {
  389 + param.clear();
  390 + param.put("xl.id_eq", employeeConfigInfo.getXl().getId());
  391 + List<ScheduleRule1Flat> scheduleRule1Flats = (List<ScheduleRule1Flat>) scheduleRule1FlatService.list(param);
  392 + List<String> ryConfigIds = new ArrayList<>();
  393 + for (ScheduleRule1Flat scheduleRule1Flat : scheduleRule1Flats) {
  394 + ryConfigIds.addAll(Arrays.asList(scheduleRule1Flat.getRyConfigIds().split(",")));
  395 + }
  396 +
  397 + if (ryConfigIds.contains(String.valueOf(id))) {
  398 + throw new ScheduleException("人员配置已被规则使用,不能作废,请先修改规则!");
  399 + } else {
  400 + employeeConfigInfo.setIsCancel(true);
  401 + }
  402 + }
  403 + }
  404 +
  405 +}
... ...
src/main/resources/application-dev.properties
... ... @@ -14,7 +14,7 @@ spring.jpa.properties.hibernate.dialect= org.hibernate.spatial.dialect.mysql.MyS
14 14  
15 15 #DATABASE
16 16 spring.datasource.driver-class-name= com.mysql.jdbc.Driver
17   -spring.datasource.url= jdbc:mysql://192.168.168.152/control_lg?useUnicode=true&characterEncoding=utf-8&useSSL=false
  17 +spring.datasource.url= jdbc:mysql://192.168.168.242/control_pd?useUnicode=true&characterEncoding=utf-8&useSSL=false
18 18 spring.datasource.username= root
19 19 spring.datasource.password= root2jsp
20 20 spring.datasource.type= com.zaxxer.hikari.HikariDataSource
... ...
src/main/resources/static/pages/base/carpark/add.html
1   -<link href="/pages/base/carpark/css/carpark-add.css" rel="stylesheet" type="text/css" />
2   -<div class="page-head">
3   - <div class="page-title">
4   - <h1>添加停车场</h1>
5   - </div>
6   -</div>
7   -
8   -<ul class="page-breadcrumb breadcrumb">
9   - <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
10   - <li><span class="active">基础信息</span> <i class="fa fa-circle"></i></li>
11   - <li><a href="/pages/base/carpark/list.html" data-pjax>停车场信息</a> <i class="fa fa-circle"></i></li>
12   - <li><span class="active">添加停车场</span></li>
13   -</ul>
14   -
15   -<div class="portlet light bordered" id="form-wizard-info">
16   - <div class="portlet-title">
17   - <div class="caption">
18   - <i class="icon-equalizer font-red-sunglo"></i>
19   - <span class="caption-subject font-red-sunglo bold uppercase">添加停车场
20   - <span class="step-title"> 1 - 4 </span>
21   - <i class="fa fa-question-circle tipso-animation" style="color: rgba(158, 158, 158, 0.49);"></i>
22   - </span>
23   - </div>
24   -
25   - <div class="actions">
26   - <div class="btn-group btn-group-devided" data-toggle="buttons">
27   - <a class="btn btn-circle default" href="/pages/base/carpark/list.html" style="float: right;padding: 4px 23px;" data-pjax=""><i class="fa fa-reply"></i> 退出</a>
28   - </div>
29   - </div>
30   - </div>
31   - <div class="portlet-body form">
32   -
33   - <!-- START FORM -->
34   - <form class="form-horizontal" id="submit_carpark_form" action="/" method="POST" novalidate="novalidate">
35   - <div class="form-wizard">
36   - <div class="form-body">
37   - <ul class="nav nav-pills nav-justified steps">
38   - <li class="active">
39   - <a href="#tab1" data-toggle="tab" class="step" aria-expanded="true">
40   - <span class="number"> 1 </span>
41   - <span class="desc">
42   - <i class="fa fa-check"></i> 获取停车场位置方式 </span>
43   - </a>
44   - </li>
45   - <li>
46   - <a href="#tab2" data-toggle="tab" class="step">
47   - <span class="number"> 2 </span>
48   - <span class="desc">
49   - <i class="fa fa-check"></i> 确定停车场位置 </span>
50   - </a>
51   - </li>
52   - <li>
53   - <a href="#tab3" data-toggle="tab" class="step active">
54   - <span class="number"> 3 </span>
55   - <span class="desc">
56   - <i class="fa fa-check"></i> 填写停车场信息 </span>
57   - </a>
58   - </li>
59   - <li>
60   - <a href="#tab4" data-toggle="tab" class="step">
61   - <span class="number"> 4 </span>
62   - <span class="desc">
63   - <i class="fa fa-check"></i> 确认并提交 </span>
64   - </a>
65   - </li>
66   - </ul>
67   -
68   - <!-- 进度条 -->
69   - <div id="bar" class="progress progress-striped" role="progressbar">
70   - <div class="progress-bar progress-bar-success" style="width: 25%;"></div>
71   - </div>
72   -
73   - <div class="tab-content">
74   - <div class="alert alert-danger display-hide">
75   - <button class="close" data-close="alert"></button>
76   - 您的输入有误,请检查下面的输入项
77   - </div>
78   - <div class="alert alert-success display-none">
79   - <button class="close" data-dismiss="alert"></button>
80   - Your form validation is successful!
81   - </div>
82   -
83   - <!-- 选择添加站点方式 -->
84   - <div class="tab-pane active" id="tab1">
85   - <h3 class="block"> 获取停车场位置方式 </h3>
86   - <!--停车场名称 -->
87   - <div class="form-group" id="formRequ">
88   - <label class="col-md-3 control-label"><span class="required"> * </span>停车场名称&nbsp;&nbsp;&nbsp;:</label>
89   - <div class="col-md-9">
90   - <input type="text" class="form-control input-medium" id="parkNamebooxtInput" name="parkNamebooxt" placeholder="请输入停车场名称">
91   - </div>
92   - </div>
93   - <!-- 新增方式 -->
94   - <div class="form-group">
95   - <label class="col-md-3 control-label"><span class="required"> * </span>选择获取方式:</label>
96   - <div class="col-md-9">
97   - <div class="icheck-list">
98   - <label>
99   - <input type="radio" class="icheck" name="baseRes" value=0 checked> 系统生成
100   - </label>
101   - <label >
102   - <input type="radio" class="icheck" name="baseRes" value=1 > 手动绘制
103   - </label>
104   - </div>
105   - </div>
106   - </div>
107   - </div>
108   - <!--停车场位置 -->
109   - <div class="tab-pane" id="tab2">
110   - <h3 class="block"> 停车场位置 </h3>
111   - <div id="addCarParkbmap_basic"></div>
112   - <div class="leftUtils">
113   - <div class="btn-group" style="left: 100px;">
114   - <a class="btn btn-sm green-seagreen dropdown-toggle" style="width: 98px;" href="javascript:;" data-toggle="dropdown" aria-expanded="false"> 绘制工具
115   - <i class="fa fa-angle-down"></i>
116   - </a>
117   - <ul class="dropdown-menu pull-right" style="min-width:100px">
118   - <li>
119   - <a href="javascript:;" id="oppenDrawingManager"><i class="fa fa-pencil"></i> 打开 </a>
120   - </li>
121   - <li>
122   - <a href="javascript:;" id = "closeDrawingManager"> <i class="fa fa-reply"></i> 关闭 </a>
123   - </li>
124   -
125   - </ul>
126   - </div>
127   - </div>
128   - </div>
129   - <!--停车场信息 -->
130   - <div class="tab-pane" id="tab3">
131   - <h3 class="block"> 停车场信息 </h3>
132   - <input type="hidden" name="bParkPoint" id="bParkPointInput" />
133   - <input type="hidden" name="gParkPoint" id="gParkPointInput" />
134   - <input type="hidden" name="dbType" id="dbTypeInput" value="b"/>
135   - <!-- 停车场名称 -->
136   - <div class="form-body">
137   - <div class="form-group">
138   - <label class="control-label col-md-3">
139   - <span class="required"> * </span> 停车场名称&nbsp;&nbsp;&nbsp; :
140   - </label>
141   - <div class="col-md-6">
142   - <input type="text" class="form-control" name="parkName" id="parkNameInput" placeholder="请输入站点名称" readonly="readonly">
143   - </div>
144   - </div>
145   - </div>
146   - <!-- 停车场编码 -->
147   - <div class="form-body">
148   - <div class="form-group">
149   - <label class="control-label col-md-3">
150   - <span class="required"> * </span>停车场编码&nbsp;&nbsp;&nbsp;:
151   - </label>
152   - <div class="col-md-6">
153   - <input type="text" class="form-control" name="parkCode" id="parkCodeInput" placeholder="请输入停车场编码">
154   - </div>
155   - </div>
156   - </div>
157   - <!-- 经纬度坐标点 -->
158   - <div class="form-body">
159   - <div class="form-group">
160   - <label class="col-md-3 control-label"><span class="required"> * </span>经纬度坐标点:</label>
161   - <div class="col-md-6">
162   - <input type="text" class="form-control" name="bCenterPoint" id="bCenterPointInput" readonly="readonly" placeholder="请输入经纬度坐标点">
163   - </div>
164   - </div>
165   - </div>
166   -
167   - <!-- 几何图形类型 -->
168   - <div class="form-body">
169   - <div class="form-group">
170   - <label class="col-md-3 control-label"><span class="required"> * </span>几何图形类型:</label>
171   - <div class="col-md-6">
172   - <input type="text" class="form-control" name="shapesType" id="shapesTypeSelect" readonly="readonly" placeholder="请输入几何图形类型">
173   - </div>
174   - </div>
175   - </div>
176   - <!-- 圆形半径 -->
177   - <div class="form-body" id="radiusGroup">
178   - <div class="form-group">
179   - <label class="col-md-3 control-label"><span class="required"> * </span> 圆形半径&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
180   - <div class="col-md-6">
181   - <input type="text" class="form-control" name="radius" id="radiusInput" placeholder="请输入圆形半径">
182   - </div>
183   - </div>
184   - </div>
185   - <!-- 是否撤销 -->
186   - <div class="form-body">
187   - <div class="form-group">
188   - <label class="col-md-3 control-label"><span class="required"> * </span>是否撤销&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
189   - <div class="col-md-6">
190   - <select name="destroy" class="form-control" id="destroySelect">
191   - <option value="">-- 请选择撤销类型 --</option>
192   - <option value="0">否</option>
193   - <option value="1">是</option>
194   - </select>
195   - </div>
196   - </div>
197   - </div>
198   - <!-- 面积 -->
199   - <div class="form-body">
200   - <div class="form-group">
201   - <label class="col-md-3 control-label">面积&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
202   - <div class="col-md-6">
203   - <input type="text" class="form-control" name="area" id="areaInput" placeholder="请输入面积">
204   - <span class="help-block">单位:平方米(㎡)</span>
205   - </div>
206   - </div>
207   - </div>
208   - <!-- 所属公司 -->
209   - <div class="form-body">
210   - <div class="form-group">
211   - <label class="col-md-3 control-label"><span class="required"> * </span>所属公司&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
212   - <div class="col-md-6">
213   - <select name="company" class="form-control" style="width:100%" id="companySelect"></select>
214   - </div>
215   - </div>
216   - </div>
217   - <!-- 所属分公司 -->
218   - <div class="form-body">
219   - <div class="form-group">
220   - <label class="col-md-3 control-label"><span class="required"> * </span>所属分公司&nbsp;&nbsp;&nbsp;:</label>
221   - <div class="col-md-6">
222   - <select name="brancheCompany" class="form-control" style="width:100%" id="brancheCompanySelect">
223   - </select>
224   - </div>
225   - </div>
226   - </div>
227   - <!-- 版本号 -->
228   - <div class="form-body">
229   - <div class="form-group">
230   - <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
231   - <div class="col-md-6">
232   - <input type="text" class="form-control" name="versions" value='1' Readonly placeholder="请输入版本号">
233   - </div>
234   - </div>
235   - </div>
236   - <!-- 描述/说明 -->
237   - <div class="form-group">
238   - <label class="control-label col-md-3"> 描述/说明&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
239   - <div class="col-md-6">
240   - <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="请输入描述/说明"></textarea>
241   - </div>
242   - </div>
243   -
244   - </div>
245   - <!-- 确定提交资料信息 -->
246   - <div class="tab-pane" id="tab4">
247   - <h3 class="block"> 确认您提交的停车场信息 </h3>
248   - <h4 class="form-section"> 地理位置 </h4>
249   - <div class="form-group">
250   - <label class="control-label col-md-3"> 几何图形类型: </label>
251   - <div class="col-md-4">
252   - <p class="form-control-static" data-display="shapesType"> </p>
253   - </div>
254   - </div>
255   - <div class="form-group">
256   - <label class="control-label col-md-3"> 圆形半径&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
257   - <div class="col-md-4">
258   - <p class="form-control-static" data-display="radius"> </p>
259   - </div>
260   - </div>
261   -
262   - <div class="form-group">
263   - <label class="control-label col-md-3"> 经纬度坐标点: </label>
264   - <div class="col-md-4">
265   - <p class="form-control-static" data-display="bCenterPoint"> </p>
266   - </div>
267   - </div>
268   - <h4 class="form-section"> 停车场信息 </h4>
269   - <div class="form-group">
270   - <label class="control-label col-md-3">停车场名称&nbsp;&nbsp;&nbsp;:</label>
271   - <div class="col-md-4">
272   - <p class="form-control-static" data-display="parkName"> </p>
273   - </div>
274   - </div>
275   - <div class="form-group">
276   - <label class="control-label col-md-3">停车场编码&nbsp;&nbsp;&nbsp;:</label>
277   - <div class="col-md-4">
278   - <p class="form-control-static" data-display="parkCode"> </p>
279   - </div>
280   - </div>
281   - <div class="form-group">
282   - <label class="control-label col-md-3">是否撤销&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
283   - <div class="col-md-4">
284   - <p class="form-control-static" data-display="destroy"> </p>
285   - </div>
286   - </div>
287   - <div class="form-group">
288   - <label class="control-label col-md-3">面积&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
289   - <div class="col-md-4">
290   - <p class="form-control-static" data-display="area"> </p>
291   - </div>
292   - </div>
293   - <div class="form-group">
294   - <label class="control-label col-md-3">所属公司&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
295   - <div class="col-md-4">
296   - <p class="form-control-static" data-display="company"> </p>
297   - </div>
298   - </div>
299   - <div class="form-group">
300   - <label class="control-label col-md-3">分公司&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
301   - <div class="col-md-4">
302   - <p class="form-control-static" data-display="brancheCompany"> </p>
303   - </div>
304   - </div>
305   - <div class="form-group">
306   - <label class="control-label col-md-3">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
307   - <div class="col-md-4">
308   - <p class="form-control-static" data-display="versions"> </p>
309   - </div>
310   - </div>
311   - <div class="form-group">
312   - <label class="control-label col-md-3">描述/说明&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
313   - <div class="col-md-4">
314   - <p class="form-control-static" data-display="descriptions"> </p>
315   - </div>
316   - </div>
317   - </div>
318   - </div>
319   - </div>
320   - <div class="form-actions">
321   - <div class="row">
322   - <div class="col-md-offset-3 col-md-9">
323   - <a href="javascript:;" class="btn default button-previous disabled" style="display: none;">
324   - <i class="fa fa-angle-left"></i> 返回 </a>
325   - <a href="javascript:;" class="btn btn-outline green button-next"> 下一步
326   - <i class="fa fa-angle-right"></i>
327   - </a>
328   - <a href="javascript:;" class="btn green button-submit" style="display: none;" id="submintBtn"> 提交
329   - <i class="fa fa-check"></i>
330   - </a>
331   - </div>
332   - </div>
333   - </div>
334   - </div>
335   - </form>
336   - <!-- END FORM-->
337   - </div>
338   -</div>
339   -<!-- 函数方法JS类库 -->
340   -<script src="/pages/base/carpark/js/add-input-function.js"></script>
341   -<!-- 表单向导JS类库 -->
342   -<script src="/pages/base/carpark/js/add-form-wizard.js"></script>
343   -<!-- reload事件 -->
344   -<script src="/pages/base/carpark/js/add-form-reload.js"></script>
345   -<!-- 地图JS类库 -->
346   -<script src="/pages/base/carpark/js/add-vmap-world.js"></script>
347   -<!-- 表单元素事件JS类库 -->
  1 +<link href="/pages/base/carpark/css/carpark-add.css" rel="stylesheet" type="text/css" />
  2 +<div class="page-head">
  3 + <div class="page-title">
  4 + <h1>添加停车场</h1>
  5 + </div>
  6 +</div>
  7 +
  8 +<ul class="page-breadcrumb breadcrumb">
  9 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  10 + <li><span class="active">基础信息</span> <i class="fa fa-circle"></i></li>
  11 + <li><a href="/pages/base/carpark/list.html" data-pjax>停车场信息</a> <i class="fa fa-circle"></i></li>
  12 + <li><span class="active">添加停车场</span></li>
  13 +</ul>
  14 +
  15 +<div class="portlet light bordered" id="form-wizard-info">
  16 + <div class="portlet-title">
  17 + <div class="caption">
  18 + <i class="icon-equalizer font-red-sunglo"></i>
  19 + <span class="caption-subject font-red-sunglo bold uppercase">添加停车场
  20 + <span class="step-title"> 1 - 4 </span>
  21 + <i class="fa fa-question-circle tipso-animation" style="color: rgba(158, 158, 158, 0.49);"></i>
  22 + </span>
  23 + </div>
  24 +
  25 + <div class="actions">
  26 + <div class="btn-group btn-group-devided" data-toggle="buttons">
  27 + <a class="btn btn-circle default" href="/pages/base/carpark/list.html" style="float: right;padding: 4px 23px;" data-pjax=""><i class="fa fa-reply"></i> 退出</a>
  28 + </div>
  29 + </div>
  30 + </div>
  31 + <div class="portlet-body form">
  32 +
  33 + <!-- START FORM -->
  34 + <form class="form-horizontal" id="submit_carpark_form" action="/" method="POST" novalidate="novalidate">
  35 + <div class="form-wizard">
  36 + <div class="form-body">
  37 + <ul class="nav nav-pills nav-justified steps">
  38 + <li class="active">
  39 + <a href="#tab1" data-toggle="tab" class="step" aria-expanded="true">
  40 + <span class="number"> 1 </span>
  41 + <span class="desc">
  42 + <i class="fa fa-check"></i> 获取停车场位置方式 </span>
  43 + </a>
  44 + </li>
  45 + <li>
  46 + <a href="#tab2" data-toggle="tab" class="step">
  47 + <span class="number"> 2 </span>
  48 + <span class="desc">
  49 + <i class="fa fa-check"></i> 确定停车场位置 </span>
  50 + </a>
  51 + </li>
  52 + <li>
  53 + <a href="#tab3" data-toggle="tab" class="step active">
  54 + <span class="number"> 3 </span>
  55 + <span class="desc">
  56 + <i class="fa fa-check"></i> 填写停车场信息 </span>
  57 + </a>
  58 + </li>
  59 + <li>
  60 + <a href="#tab4" data-toggle="tab" class="step">
  61 + <span class="number"> 4 </span>
  62 + <span class="desc">
  63 + <i class="fa fa-check"></i> 确认并提交 </span>
  64 + </a>
  65 + </li>
  66 + </ul>
  67 +
  68 + <!-- 进度条 -->
  69 + <div id="bar" class="progress progress-striped" role="progressbar">
  70 + <div class="progress-bar progress-bar-success" style="width: 25%;"></div>
  71 + </div>
  72 +
  73 + <div class="tab-content">
  74 + <div class="alert alert-danger display-hide">
  75 + <button class="close" data-close="alert"></button>
  76 + 您的输入有误,请检查下面的输入项
  77 + </div>
  78 + <div class="alert alert-success display-none">
  79 + <button class="close" data-dismiss="alert"></button>
  80 + Your form validation is successful!
  81 + </div>
  82 +
  83 + <!-- 选择添加站点方式 -->
  84 + <div class="tab-pane active" id="tab1">
  85 + <h3 class="block"> 获取停车场位置方式 </h3>
  86 + <!--停车场名称 -->
  87 + <div class="form-group" id="formRequ">
  88 + <label class="col-md-3 control-label"><span class="required"> * </span>停车场名称&nbsp;&nbsp;&nbsp;:</label>
  89 + <div class="col-md-9">
  90 + <input type="text" class="form-control input-medium" id="parkNamebooxtInput" name="parkNamebooxt" placeholder="请输入停车场名称">
  91 + </div>
  92 + </div>
  93 + <!-- 新增方式 -->
  94 + <div class="form-group">
  95 + <label class="col-md-3 control-label"><span class="required"> * </span>选择获取方式:</label>
  96 + <div class="col-md-9">
  97 + <div class="icheck-list">
  98 + <label>
  99 + <input type="radio" class="icheck" name="baseRes" value=0 checked> 系统生成
  100 + </label>
  101 + <label >
  102 + <input type="radio" class="icheck" name="baseRes" value=1 > 手动绘制
  103 + </label>
  104 + </div>
  105 + </div>
  106 + </div>
  107 + </div>
  108 + <!--停车场位置 -->
  109 + <div class="tab-pane" id="tab2">
  110 + <h3 class="block"> 停车场位置 </h3>
  111 + <div id="addCarParkbmap_basic"></div>
  112 + <div class="leftUtils">
  113 + <div class="btn-group" style="left: 100px;">
  114 + <a class="btn btn-sm green-seagreen dropdown-toggle" style="width: 98px;" href="javascript:;" data-toggle="dropdown" aria-expanded="false"> 绘制工具
  115 + <i class="fa fa-angle-down"></i>
  116 + </a>
  117 + <ul class="dropdown-menu pull-right" style="min-width:100px">
  118 + <li>
  119 + <a href="javascript:;" id="oppenDrawingManager"><i class="fa fa-pencil"></i> 打开 </a>
  120 + </li>
  121 + <li>
  122 + <a href="javascript:;" id = "closeDrawingManager"> <i class="fa fa-reply"></i> 关闭 </a>
  123 + </li>
  124 +
  125 + </ul>
  126 + </div>
  127 + </div>
  128 + </div>
  129 + <!--停车场信息 -->
  130 + <div class="tab-pane" id="tab3">
  131 + <h3 class="block"> 停车场信息 </h3>
  132 + <input type="hidden" name="bParkPoint" id="bParkPointInput" />
  133 + <input type="hidden" name="gParkPoint" id="gParkPointInput" />
  134 + <input type="hidden" name="dbType" id="dbTypeInput" value="b"/>
  135 + <!-- 停车场名称 -->
  136 + <div class="form-body">
  137 + <div class="form-group">
  138 + <label class="control-label col-md-3">
  139 + <span class="required"> * </span> 停车场名称&nbsp;&nbsp;&nbsp; :
  140 + </label>
  141 + <div class="col-md-6">
  142 + <input type="text" class="form-control" name="parkName" id="parkNameInput" placeholder="请输入站点名称" readonly="readonly">
  143 + </div>
  144 + </div>
  145 + </div>
  146 + <!-- 停车场编码 -->
  147 + <div class="form-body">
  148 + <div class="form-group">
  149 + <label class="control-label col-md-3">
  150 + <span class="required"> * </span>停车场编码&nbsp;&nbsp;&nbsp;:
  151 + </label>
  152 + <div class="col-md-6">
  153 + <input type="text" class="form-control" name="parkCode" id="parkCodeInput" placeholder="请输入停车场编码">
  154 + </div>
  155 + </div>
  156 + </div>
  157 + <!-- 经纬度坐标点 -->
  158 + <div class="form-body">
  159 + <div class="form-group">
  160 + <label class="col-md-3 control-label"><span class="required"> * </span>经纬度坐标点:</label>
  161 + <div class="col-md-6">
  162 + <input type="text" class="form-control" name="bCenterPoint" id="bCenterPointInput" readonly="readonly" placeholder="请输入经纬度坐标点">
  163 + </div>
  164 + </div>
  165 + </div>
  166 +
  167 + <!-- 几何图形类型 -->
  168 + <div class="form-body">
  169 + <div class="form-group">
  170 + <label class="col-md-3 control-label"><span class="required"> * </span>几何图形类型:</label>
  171 + <div class="col-md-6">
  172 + <input type="text" class="form-control" name="shapesType" id="shapesTypeSelect" readonly="readonly" placeholder="请输入几何图形类型">
  173 + </div>
  174 + </div>
  175 + </div>
  176 + <!-- 圆形半径 -->
  177 + <div class="form-body" id="radiusGroup">
  178 + <div class="form-group">
  179 + <label class="col-md-3 control-label"><span class="required"> * </span> 圆形半径&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  180 + <div class="col-md-6">
  181 + <input type="text" class="form-control" name="radius" id="radiusInput" placeholder="请输入圆形半径">
  182 + </div>
  183 + </div>
  184 + </div>
  185 + <!-- 是否撤销 -->
  186 + <div class="form-body">
  187 + <div class="form-group">
  188 + <label class="col-md-3 control-label"><span class="required"> * </span>是否撤销&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  189 + <div class="col-md-6">
  190 + <select name="destroy" class="form-control" id="destroySelect">
  191 + <option value="">-- 请选择撤销类型 --</option>
  192 + <option value="0">否</option>
  193 + <option value="1">是</option>
  194 + </select>
  195 + </div>
  196 + </div>
  197 + </div>
  198 + <!-- 面积 -->
  199 + <div class="form-body">
  200 + <div class="form-group">
  201 + <label class="col-md-3 control-label">面积&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  202 + <div class="col-md-6">
  203 + <input type="text" class="form-control" name="area" id="areaInput" placeholder="请输入面积">
  204 + <span class="help-block">单位:平方米(㎡)</span>
  205 + </div>
  206 + </div>
  207 + </div>
  208 + <!-- 所属公司 -->
  209 + <div class="form-body">
  210 + <div class="form-group">
  211 + <label class="col-md-3 control-label"><span class="required"> * </span>所属公司&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  212 + <div class="col-md-6">
  213 + <select name="company" class="form-control" style="width:100%" id="companySelect"></select>
  214 + </div>
  215 + </div>
  216 + </div>
  217 + <!-- 所属分公司 -->
  218 + <div class="form-body">
  219 + <div class="form-group">
  220 + <label class="col-md-3 control-label"><span class="required"> * </span>所属线队&nbsp;&nbsp;&nbsp;:</label>
  221 + <div class="col-md-6">
  222 + <select name="brancheCompany" class="form-control" style="width:100%" id="brancheCompanySelect">
  223 + </select>
  224 + </div>
  225 + </div>
  226 + </div>
  227 + <!-- 版本号 -->
  228 + <div class="form-body">
  229 + <div class="form-group">
  230 + <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  231 + <div class="col-md-6">
  232 + <input type="text" class="form-control" name="versions" value='1' Readonly placeholder="请输入版本号">
  233 + </div>
  234 + </div>
  235 + </div>
  236 + <!-- 描述/说明 -->
  237 + <div class="form-group">
  238 + <label class="control-label col-md-3"> 描述/说明&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  239 + <div class="col-md-6">
  240 + <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="请输入描述/说明"></textarea>
  241 + </div>
  242 + </div>
  243 +
  244 + </div>
  245 + <!-- 确定提交资料信息 -->
  246 + <div class="tab-pane" id="tab4">
  247 + <h3 class="block"> 确认您提交的停车场信息 </h3>
  248 + <h4 class="form-section"> 地理位置 </h4>
  249 + <div class="form-group">
  250 + <label class="control-label col-md-3"> 几何图形类型: </label>
  251 + <div class="col-md-4">
  252 + <p class="form-control-static" data-display="shapesType"> </p>
  253 + </div>
  254 + </div>
  255 + <div class="form-group">
  256 + <label class="control-label col-md-3"> 圆形半径&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  257 + <div class="col-md-4">
  258 + <p class="form-control-static" data-display="radius"> </p>
  259 + </div>
  260 + </div>
  261 +
  262 + <div class="form-group">
  263 + <label class="control-label col-md-3"> 经纬度坐标点: </label>
  264 + <div class="col-md-4">
  265 + <p class="form-control-static" data-display="bCenterPoint"> </p>
  266 + </div>
  267 + </div>
  268 + <h4 class="form-section"> 停车场信息 </h4>
  269 + <div class="form-group">
  270 + <label class="control-label col-md-3">停车场名称&nbsp;&nbsp;&nbsp;:</label>
  271 + <div class="col-md-4">
  272 + <p class="form-control-static" data-display="parkName"> </p>
  273 + </div>
  274 + </div>
  275 + <div class="form-group">
  276 + <label class="control-label col-md-3">停车场编码&nbsp;&nbsp;&nbsp;:</label>
  277 + <div class="col-md-4">
  278 + <p class="form-control-static" data-display="parkCode"> </p>
  279 + </div>
  280 + </div>
  281 + <div class="form-group">
  282 + <label class="control-label col-md-3">是否撤销&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  283 + <div class="col-md-4">
  284 + <p class="form-control-static" data-display="destroy"> </p>
  285 + </div>
  286 + </div>
  287 + <div class="form-group">
  288 + <label class="control-label col-md-3">面积&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  289 + <div class="col-md-4">
  290 + <p class="form-control-static" data-display="area"> </p>
  291 + </div>
  292 + </div>
  293 + <div class="form-group">
  294 + <label class="control-label col-md-3">所属公司&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  295 + <div class="col-md-4">
  296 + <p class="form-control-static" data-display="company"> </p>
  297 + </div>
  298 + </div>
  299 + <div class="form-group">
  300 + <label class="control-label col-md-3">分公司&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  301 + <div class="col-md-4">
  302 + <p class="form-control-static" data-display="brancheCompany"> </p>
  303 + </div>
  304 + </div>
  305 + <div class="form-group">
  306 + <label class="control-label col-md-3">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  307 + <div class="col-md-4">
  308 + <p class="form-control-static" data-display="versions"> </p>
  309 + </div>
  310 + </div>
  311 + <div class="form-group">
  312 + <label class="control-label col-md-3">描述/说明&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  313 + <div class="col-md-4">
  314 + <p class="form-control-static" data-display="descriptions"> </p>
  315 + </div>
  316 + </div>
  317 + </div>
  318 + </div>
  319 + </div>
  320 + <div class="form-actions">
  321 + <div class="row">
  322 + <div class="col-md-offset-3 col-md-9">
  323 + <a href="javascript:;" class="btn default button-previous disabled" style="display: none;">
  324 + <i class="fa fa-angle-left"></i> 返回 </a>
  325 + <a href="javascript:;" class="btn btn-outline green button-next"> 下一步
  326 + <i class="fa fa-angle-right"></i>
  327 + </a>
  328 + <a href="javascript:;" class="btn green button-submit" style="display: none;" id="submintBtn"> 提交
  329 + <i class="fa fa-check"></i>
  330 + </a>
  331 + </div>
  332 + </div>
  333 + </div>
  334 + </div>
  335 + </form>
  336 + <!-- END FORM-->
  337 + </div>
  338 +</div>
  339 +<!-- 函数方法JS类库 -->
  340 +<script src="/pages/base/carpark/js/add-input-function.js"></script>
  341 +<!-- 表单向导JS类库 -->
  342 +<script src="/pages/base/carpark/js/add-form-wizard.js"></script>
  343 +<!-- reload事件 -->
  344 +<script src="/pages/base/carpark/js/add-form-reload.js"></script>
  345 +<!-- 地图JS类库 -->
  346 +<script src="/pages/base/carpark/js/add-vmap-world.js"></script>
  347 +<!-- 表单元素事件JS类库 -->
348 348 <script src="/pages/base/carpark/js/add-form-events.js"></script>
349 349 \ No newline at end of file
... ...
src/main/resources/static/pages/base/carpark/edit.html
1   -<!-- 编辑停车场 -->
2   -<div class="modal fade" id="editPoitsions_carpark_mobal" tabindex="-1" role="basic" aria-hidden="true">
3   - <div class="modal-dialog">
4   - <div class="modal-content">
5   - <div class="modal-header">
6   - <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
7   - <h4 class="modal-title">编辑停车场</h4>
8   - </div>
9   - <div class="modal-body">
10   -
11   - <form class="form-horizontal" role="form" id="edit_carPark_form" action="/module" method="post">
12   -
13   - <div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button>
14   - 您的输入有误,请检查下面的输入项
15   - </div>
16   - <input type="hidden" name="id" id="idInput" />
17   - <input type="hidden" name="bParkPoint" id="bParkPointInput" />
18   - <input type="hidden" name="gParkPoint" id="gParkPointInput" />
19   - <input type="hidden" name="dbType" id="dbTypeInput" value="b"/>
20   - <!-- 停车场名称 -->
21   - <div class="form-body">
22   - <div class="form-group">
23   - <label class="control-label col-md-3">
24   - <span class="required"> * </span> 停车场名称&nbsp;&nbsp;&nbsp; :
25   - </label>
26   - <div class="col-md-6">
27   - <input type="text" class="form-control" name="parkName" id="parkNameInput" placeholder="请输入停车场名称">
28   - </div>
29   - </div>
30   - </div>
31   - <!-- 停车场编码 -->
32   - <div class="form-body">
33   - <div class="form-group">
34   - <label class="control-label col-md-3">
35   - <span class="required"> * </span>停车场编码&nbsp;&nbsp;&nbsp;:
36   - </label>
37   - <div class="col-md-6">
38   - <input type="text" class="form-control" name="parkCode" id="parkCodeInput" readonly="readonly" placeholder="请输入停车场编码">
39   - </div>
40   - </div>
41   - </div>
42   - <!-- 经纬度坐标点 -->
43   - <div class="form-body">
44   - <div class="form-group">
45   - <label class="col-md-3 control-label"><span class="required"> * </span>经纬度坐标点:</label>
46   - <div class="col-md-6">
47   - <input type="text" class="form-control" name="bCenterPoint" id="bCenterPointInput" readonly="readonly" placeholder="请输入经纬度坐标点">
48   - </div>
49   - </div>
50   - </div>
51   -
52   - <!-- 几何图形类型 -->
53   - <div class="form-body">
54   - <div class="form-group">
55   - <label class="col-md-3 control-label"><span class="required"> * </span>几何图形类型:</label>
56   - <div class="col-md-6">
57   - <input type="text" class="form-control" name="shapesType" id="shapesTypeSelect" readonly="readonly" placeholder="请输入几何图形类型">
58   - </div>
59   - </div>
60   - </div>
61   -
62   - <!-- 圆形半径 -->
63   - <div class="form-body" id="radiusGroup">
64   - <div class="form-group">
65   - <label class="col-md-3 control-label"><span class="required"> * </span>圆形半径&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
66   - <div class="col-md-6">
67   - <input type="text" class="form-control" name="radius" id="radiusInput" placeholder="请输入圆形半径">
68   - </div>
69   - </div>
70   - </div>
71   - <!-- 是否撤销 -->
72   - <div class="form-body">
73   - <div class="form-group">
74   - <label class="col-md-3 control-label"><span class="required"> * </span>是否撤销&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
75   - <div class="col-md-6">
76   - <select name="destroy" class="form-control" id="destroySelect">
77   - <option value="">-- 请选择撤销类型 --</option>
78   - <option value="0">否</option>
79   - <option value="1">是</option>
80   - </select>
81   - </div>
82   - </div>
83   - </div>
84   - <!-- 面积 -->
85   - <div class="form-body">
86   - <div class="form-group">
87   - <label class="col-md-3 control-label">面积&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
88   - <div class="col-md-6">
89   - <input type="text" class="form-control" name="area" id="areaInput" >
90   - <span class="help-block">单位:平方米(㎡)</span>
91   - </div>
92   - </div>
93   - </div>
94   -
95   - <!-- 所属公司 -->
96   - <div class="form-body">
97   - <div class="form-group">
98   - <label class="col-md-3 control-label">所属公司&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
99   - <div class="col-md-6">
100   - <select name="company" class="form-control" style="width:100%" id="companySelect">
101   -
102   - </select>
103   - </div>
104   - </div>
105   - </div>
106   -
107   - <!-- 所属分公司 -->
108   - <div class="form-body">
109   - <div class="form-group">
110   - <label class="col-md-3 control-label">所属分公司&nbsp;&nbsp;&nbsp;:</label>
111   - <div class="col-md-6">
112   - <select name="brancheCompany" class="form-control" style="width:100%" id="brancheCompanySelect">
113   - </select>
114   - </div>
115   - </div>
116   - </div>
117   -
118   - <!-- 版本号 -->
119   - <div class="form-body">
120   - <div class="form-group">
121   - <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
122   - <div class="col-md-6">
123   - <input type="text" class="form-control" name="versions" value='1' Readonly placeholder="请输入版本号">
124   - </div>
125   - </div>
126   - </div>
127   -
128   - <!-- 描述/说明 -->
129   - <div class="form-group">
130   - <label class="control-label col-md-3"> 描述/说明&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
131   - <div class="col-md-6">
132   - <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="请输入描述/说明"></textarea>
133   - </div>
134   - </div>
135   - </form>
136   - </div>
137   - <div class="modal-footer">
138   - <button type="button" class="btn default" data-dismiss="modal">取消</button>
139   - <button type="button" class="btn btn-primary" id="editStationButton">提交数据</button>
140   - </div>
141   - </div>
142   - </div>
143   -</div>
144   -<script type="text/javascript">
145   -
146   -$('#editPoitsions_carpark_mobal').on('editCarParkMobal_show', function(e, map,fun,carP,ajaxd){
147   - /** 获取停车场信息对象 */
148   - var CarParkObj = carP.getEitdCarPark();
149   - // 获取修改停车场对象ID
150   - var carParkId = CarParkObj.carParkId;
151   - /** 根据修改停车场对象属性值 设值表单元素 @paran:<CarParkObj:停车场对象>*/
152   - fun.setFormValue(CarParkObj);
153   - /** 填充公司下拉框 */
154   - fun.selectTemp(function() {
155   - // 获取公司代码
156   - var businessCode = CarParkObj.carParkCompany;
157   - // 获取公司元素并设值
158   - $('#companySelect').val(businessCode);
159   - /** 填充分公司下拉框 @param:<businessCode:公司代码> */
160   - fun.getbrancheCompanyValues(businessCode,function() {
161   - // 获取分公司元素并设值
162   - $('#brancheCompanySelect').val(CarParkObj.carParkBrancheCompany);
163   - });
164   - });
165   - // 公司值改变事件
166   - $('#companySelect').on('change',companySelectChangeSetBrancheValue);
167   - function companySelectChangeSetBrancheValue() {
168   - // 获取公司下拉框选择值
169   - var businessCode = $('#companySelect').val();
170   - // 分公司下拉框options属性值
171   - var options = '<option value="">-- 请选择分公司 --</option>';
172   - // 如果公司选择为空则分公司为空 ; 否则查询出所属公司下的分公司名称和相应分公司代码
173   - if(businessCode == null || businessCode ==''){
174   - // 填充分公司下拉框options
175   - $('#brancheCompanySelect').html(options);
176   - } else {
177   - // 查询出所属公司下的分公司名称和相应分公司代码
178   - $get('/business/all', {upCode_eq: businessCode}, function(array){
179   - // 遍历array
180   - $.each(array, function(i,d){
181   - options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>';
182   - });
183   - // 填充分公司下拉框options
184   - $('#brancheCompanySelect').html(options);
185   - });
186   - }
187   - }
188   - // 显示mobal
189   - $('#editPoitsions_carpark_mobal').modal({show : true,backdrop: 'static',keyboard: false});
190   - // 当调用 hide 实例方法时触发
191   - $('#editPoitsions_carpark_mobal').on('hide.bs.modal', function () {
192   - clearSechear();
193   - });
194   - function clearSechear(){
195   - map.clearMarkAndOverlays();
196   - carP.setEitdCarPark({});
197   - fun.initCarPark(carParkId);
198   - }
199   - // 编辑表单元素
200   - var form = $('#edit_carPark_form');
201   - // 获取错误提示元素
202   - var error = $('.alert-danger', form);
203   - // 提交数据按钮事件
204   - $('#editStationButton').on('click', function() {
205   - // 表单提交
206   - form.submit();
207   - });
208   - // 表单验证
209   - form.validate({
210   -
211   - errorElement : 'span',
212   -
213   - errorClass : 'help-block help-block-error',
214   -
215   - focusInvalid : false,
216   -
217   - rules : {
218   - 'parkName' : {required : true,},// 停车场名称 必填项
219   - 'parkCode' : {required : true},// 停车场编码 必填项
220   - 'bCenterPoint' : {required : true,},// 经纬度坐标点 必填项
221   - 'shapesType' : {required : true,},// 几何图形类型 必填项
222   - 'radius' : {required : true,digits:true},// 圆形半径 必填项
223   - 'destroy' : {required : true,},// 是否撤销 必填项
224   - 'area' : {number:true,},// 面积 数字
225   - 'descriptions' : {maxlength: 200,},// 描述/说明 最大长度200
226   - },
227   - invalidHandler : function(event, validator) {
228   - error.show();
229   - App.scrollTo(error, -200);
230   - },
231   - highlight : function(element) {
232   - $(element).closest('.form-group').addClass('has-error');
233   - },
234   - unhighlight : function(element) {
235   - $(element).closest('.form-group').removeClass('has-error');
236   - },
237   - success : function(label) {
238   - label.closest('.form-group').removeClass('has-error');
239   - },
240   - submitHandler : function(f) {
241   - var params = form.serializeJSON();
242   - params.createBy = CarParkObj.carParkCreateBy;
243   - // 定义日期格式
244   - var fs = 'YYYY-MM-DD HH:mm:ss'
245   - // 设置日期
246   - params.createDate = moment(CarParkObj.carParkCreateDate).format(fs);
247   - params.createBy = 35;
248   - error.hide();
249   - if(params.shapesType=='多边形')
250   - params.shapesType = 'd';
251   - else if(params.shapesType=='圆形')
252   - params.shapesType = 'r';
253   - ajaxd.carParkUpdate(params,function(resuntDate) {
254   - if(resuntDate.status=='SUCCESS') {
255   - // 弹出添加成功提示消息
256   - layer.msg('修改成功...');
257   - }else {
258   - // 弹出添加失败提示消息
259   - layer.msg('修改失败...');
260   - }
261   - clearSechear();
262   - $('#editPoitsions_carpark_mobal').modal('hide');
263   - })
264   - }
265   - });
266   -});
  1 +<!-- 编辑停车场 -->
  2 +<div class="modal fade" id="editPoitsions_carpark_mobal" tabindex="-1" role="basic" aria-hidden="true">
  3 + <div class="modal-dialog">
  4 + <div class="modal-content">
  5 + <div class="modal-header">
  6 + <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
  7 + <h4 class="modal-title">编辑停车场</h4>
  8 + </div>
  9 + <div class="modal-body">
  10 +
  11 + <form class="form-horizontal" role="form" id="edit_carPark_form" action="/module" method="post">
  12 +
  13 + <div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button>
  14 + 您的输入有误,请检查下面的输入项
  15 + </div>
  16 + <input type="hidden" name="id" id="idInput" />
  17 + <input type="hidden" name="bParkPoint" id="bParkPointInput" />
  18 + <input type="hidden" name="gParkPoint" id="gParkPointInput" />
  19 + <input type="hidden" name="dbType" id="dbTypeInput" value="b"/>
  20 + <!-- 停车场名称 -->
  21 + <div class="form-body">
  22 + <div class="form-group">
  23 + <label class="control-label col-md-3">
  24 + <span class="required"> * </span> 停车场名称&nbsp;&nbsp;&nbsp; :
  25 + </label>
  26 + <div class="col-md-6">
  27 + <input type="text" class="form-control" name="parkName" id="parkNameInput" placeholder="请输入停车场名称">
  28 + </div>
  29 + </div>
  30 + </div>
  31 + <!-- 停车场编码 -->
  32 + <div class="form-body">
  33 + <div class="form-group">
  34 + <label class="control-label col-md-3">
  35 + <span class="required"> * </span>停车场编码&nbsp;&nbsp;&nbsp;:
  36 + </label>
  37 + <div class="col-md-6">
  38 + <input type="text" class="form-control" name="parkCode" id="parkCodeInput" readonly="readonly" placeholder="请输入停车场编码">
  39 + </div>
  40 + </div>
  41 + </div>
  42 + <!-- 经纬度坐标点 -->
  43 + <div class="form-body">
  44 + <div class="form-group">
  45 + <label class="col-md-3 control-label"><span class="required"> * </span>经纬度坐标点:</label>
  46 + <div class="col-md-6">
  47 + <input type="text" class="form-control" name="bCenterPoint" id="bCenterPointInput" readonly="readonly" placeholder="请输入经纬度坐标点">
  48 + </div>
  49 + </div>
  50 + </div>
  51 +
  52 + <!-- 几何图形类型 -->
  53 + <div class="form-body">
  54 + <div class="form-group">
  55 + <label class="col-md-3 control-label"><span class="required"> * </span>几何图形类型:</label>
  56 + <div class="col-md-6">
  57 + <input type="text" class="form-control" name="shapesType" id="shapesTypeSelect" readonly="readonly" placeholder="请输入几何图形类型">
  58 + </div>
  59 + </div>
  60 + </div>
  61 +
  62 + <!-- 圆形半径 -->
  63 + <div class="form-body" id="radiusGroup">
  64 + <div class="form-group">
  65 + <label class="col-md-3 control-label"><span class="required"> * </span>圆形半径&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  66 + <div class="col-md-6">
  67 + <input type="text" class="form-control" name="radius" id="radiusInput" placeholder="请输入圆形半径">
  68 + </div>
  69 + </div>
  70 + </div>
  71 + <!-- 是否撤销 -->
  72 + <div class="form-body">
  73 + <div class="form-group">
  74 + <label class="col-md-3 control-label"><span class="required"> * </span>是否撤销&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  75 + <div class="col-md-6">
  76 + <select name="destroy" class="form-control" id="destroySelect">
  77 + <option value="">-- 请选择撤销类型 --</option>
  78 + <option value="0">否</option>
  79 + <option value="1">是</option>
  80 + </select>
  81 + </div>
  82 + </div>
  83 + </div>
  84 + <!-- 面积 -->
  85 + <div class="form-body">
  86 + <div class="form-group">
  87 + <label class="col-md-3 control-label">面积&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  88 + <div class="col-md-6">
  89 + <input type="text" class="form-control" name="area" id="areaInput" >
  90 + <span class="help-block">单位:平方米(㎡)</span>
  91 + </div>
  92 + </div>
  93 + </div>
  94 +
  95 + <!-- 所属公司 -->
  96 + <div class="form-body">
  97 + <div class="form-group">
  98 + <label class="col-md-3 control-label">所属公司&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  99 + <div class="col-md-6">
  100 + <select name="company" class="form-control" style="width:100%" id="companySelect">
  101 +
  102 + </select>
  103 + </div>
  104 + </div>
  105 + </div>
  106 +
  107 + <!-- 所属分公司 -->
  108 + <div class="form-body">
  109 + <div class="form-group">
  110 + <label class="col-md-3 control-label">所属线队&nbsp;&nbsp;&nbsp;:</label>
  111 + <div class="col-md-6">
  112 + <select name="brancheCompany" class="form-control" style="width:100%" id="brancheCompanySelect">
  113 + </select>
  114 + </div>
  115 + </div>
  116 + </div>
  117 +
  118 + <!-- 版本号 -->
  119 + <div class="form-body">
  120 + <div class="form-group">
  121 + <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  122 + <div class="col-md-6">
  123 + <input type="text" class="form-control" name="versions" value='1' Readonly placeholder="请输入版本号">
  124 + </div>
  125 + </div>
  126 + </div>
  127 +
  128 + <!-- 描述/说明 -->
  129 + <div class="form-group">
  130 + <label class="control-label col-md-3"> 描述/说明&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  131 + <div class="col-md-6">
  132 + <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="请输入描述/说明"></textarea>
  133 + </div>
  134 + </div>
  135 + </form>
  136 + </div>
  137 + <div class="modal-footer">
  138 + <button type="button" class="btn default" data-dismiss="modal">取消</button>
  139 + <button type="button" class="btn btn-primary" id="editStationButton">提交数据</button>
  140 + </div>
  141 + </div>
  142 + </div>
  143 +</div>
  144 +<script type="text/javascript">
  145 +
  146 +$('#editPoitsions_carpark_mobal').on('editCarParkMobal_show', function(e, map,fun,carP,ajaxd){
  147 + /** 获取停车场信息对象 */
  148 + var CarParkObj = carP.getEitdCarPark();
  149 + // 获取修改停车场对象ID
  150 + var carParkId = CarParkObj.carParkId;
  151 + /** 根据修改停车场对象属性值 设值表单元素 @paran:<CarParkObj:停车场对象>*/
  152 + fun.setFormValue(CarParkObj);
  153 + /** 填充公司下拉框 */
  154 + fun.selectTemp(function() {
  155 + // 获取公司代码
  156 + var businessCode = CarParkObj.carParkCompany;
  157 + // 获取公司元素并设值
  158 + $('#companySelect').val(businessCode);
  159 + /** 填充分公司下拉框 @param:<businessCode:公司代码> */
  160 + fun.getbrancheCompanyValues(businessCode,function() {
  161 + // 获取分公司元素并设值
  162 + $('#brancheCompanySelect').val(CarParkObj.carParkBrancheCompany);
  163 + });
  164 + });
  165 + // 公司值改变事件
  166 + $('#companySelect').on('change',companySelectChangeSetBrancheValue);
  167 + function companySelectChangeSetBrancheValue() {
  168 + // 获取公司下拉框选择值
  169 + var businessCode = $('#companySelect').val();
  170 + // 分公司下拉框options属性值
  171 + var options = '<option value="">-- 请选择分公司 --</option>';
  172 + // 如果公司选择为空则分公司为空 ; 否则查询出所属公司下的分公司名称和相应分公司代码
  173 + if(businessCode == null || businessCode ==''){
  174 + // 填充分公司下拉框options
  175 + $('#brancheCompanySelect').html(options);
  176 + } else {
  177 + // 查询出所属公司下的分公司名称和相应分公司代码
  178 + $get('/business/all', {upCode_eq: businessCode}, function(array){
  179 + // 遍历array
  180 + $.each(array, function(i,d){
  181 + options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>';
  182 + });
  183 + // 填充分公司下拉框options
  184 + $('#brancheCompanySelect').html(options);
  185 + });
  186 + }
  187 + }
  188 + // 显示mobal
  189 + $('#editPoitsions_carpark_mobal').modal({show : true,backdrop: 'static',keyboard: false});
  190 + // 当调用 hide 实例方法时触发
  191 + $('#editPoitsions_carpark_mobal').on('hide.bs.modal', function () {
  192 + clearSechear();
  193 + });
  194 + function clearSechear(){
  195 + map.clearMarkAndOverlays();
  196 + carP.setEitdCarPark({});
  197 + fun.initCarPark(carParkId);
  198 + }
  199 + // 编辑表单元素
  200 + var form = $('#edit_carPark_form');
  201 + // 获取错误提示元素
  202 + var error = $('.alert-danger', form);
  203 + // 提交数据按钮事件
  204 + $('#editStationButton').on('click', function() {
  205 + // 表单提交
  206 + form.submit();
  207 + });
  208 + // 表单验证
  209 + form.validate({
  210 +
  211 + errorElement : 'span',
  212 +
  213 + errorClass : 'help-block help-block-error',
  214 +
  215 + focusInvalid : false,
  216 +
  217 + rules : {
  218 + 'parkName' : {required : true,},// 停车场名称 必填项
  219 + 'parkCode' : {required : true},// 停车场编码 必填项
  220 + 'bCenterPoint' : {required : true,},// 经纬度坐标点 必填项
  221 + 'shapesType' : {required : true,},// 几何图形类型 必填项
  222 + 'radius' : {required : true,digits:true},// 圆形半径 必填项
  223 + 'destroy' : {required : true,},// 是否撤销 必填项
  224 + 'area' : {number:true,},// 面积 数字
  225 + 'descriptions' : {maxlength: 200,},// 描述/说明 最大长度200
  226 + },
  227 + invalidHandler : function(event, validator) {
  228 + error.show();
  229 + App.scrollTo(error, -200);
  230 + },
  231 + highlight : function(element) {
  232 + $(element).closest('.form-group').addClass('has-error');
  233 + },
  234 + unhighlight : function(element) {
  235 + $(element).closest('.form-group').removeClass('has-error');
  236 + },
  237 + success : function(label) {
  238 + label.closest('.form-group').removeClass('has-error');
  239 + },
  240 + submitHandler : function(f) {
  241 + var params = form.serializeJSON();
  242 + params.createBy = CarParkObj.carParkCreateBy;
  243 + // 定义日期格式
  244 + var fs = 'YYYY-MM-DD HH:mm:ss'
  245 + // 设置日期
  246 + params.createDate = moment(CarParkObj.carParkCreateDate).format(fs);
  247 + params.createBy = 35;
  248 + error.hide();
  249 + if(params.shapesType=='多边形')
  250 + params.shapesType = 'd';
  251 + else if(params.shapesType=='圆形')
  252 + params.shapesType = 'r';
  253 + ajaxd.carParkUpdate(params,function(resuntDate) {
  254 + if(resuntDate.status=='SUCCESS') {
  255 + // 弹出添加成功提示消息
  256 + layer.msg('修改成功...');
  257 + }else {
  258 + // 弹出添加失败提示消息
  259 + layer.msg('修改失败...');
  260 + }
  261 + clearSechear();
  262 + $('#editPoitsions_carpark_mobal').modal('hide');
  263 + })
  264 + }
  265 + });
  266 +});
267 267 </script>
268 268 \ No newline at end of file
... ...
src/main/resources/static/pages/base/carpark/list.html
1   -<div class="page-head">
2   - <div class="page-title">
3   - <h1>停车场信息</h1>
4   - </div>
5   -</div>
6   -
7   -<ul class="page-breadcrumb breadcrumb">
8   - <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
9   - <li><span class="active">基础信息</span> <i class="fa fa-circle"></i></li>
10   - <li><span class="active">停车场信息</span></li>
11   -</ul>
12   -
13   -<div class="row">
14   - <div class="col-md-12">
15   - <div class="portlet light porttlet-fit bordered">
16   - <div class="portlet-title">
17   - <div class="caption">
18   - <i class="fa fa-info-circle font-dark"></i>
19   - <span class="caption-subject font-dark sbold uppercase">停车场信息</span>
20   - </div>
21   - <div class="actions">
22   - <div class="btn-group btn-group-devided" data-toggle="buttons">
23   - <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加停车场</a>
24   - </div>
25   - </div>
26   - </div>
27   - <div class="portlet-body">
28   - <div class="table-container" style="margin-top: 10px">
29   - <table class="table table-striped table-bordered table-hover table-checkable" id="datatable_carpark">
30   - <thead>
31   - <tr role="row" class="heading">
32   - <th width="3%">序号</th>
33   - <th width="12%">停车场名称</th>
34   - <th width="8%">停车场编码</th>
35   - <th width="8%">地理位置</th>
36   - <th width="6%">面积(㎡)</th>
37   - <th width="8%">所属公司</th>
38   - <th width="8%">所属分公司</th>
39   - <th width="6%">版本号</th>
40   - <th width="6%">是否撤销</th>
41   - <th width="10%">操作</th>
42   - </tr>
43   - <tr role="row" class="filter">
44   - <td>#</td>
45   - <td>
46   - <!-- <input type="text" class="form-control form-filter input-sm" name="parkName_like" > -->
47   - <select name="parkName_like" class="form-control" style="width:100%" id="parkNameSelect"></select>
48   - </td>
49   - <td>
50   - <input type="text" class="form-control form-filter input-sm" name="parkCode_like" id="parkCodeInput">
51   -
52   - </td>
53   - <td>
54   - <input type="text" class="form-control form-filter input-sm" name="gCenterPoint_like">
55   - </td>
56   - <td>
57   - <input type="text" class="form-control form-filter input-sm" name="area_eq">
58   - </td>
59   - <td>
60   - <select name="company_eq" class="form-control" id="companySelect"></select>
61   - </td>
62   - <td>
63   - <select name="brancheCompany_eq" class="form-control" id="brancheCompanySelect"></select>
64   - <!-- <input type="text" class="form-control form-filter input-sm" name="brancheCompany_eq" id="brancheCompanySelect"> -->
65   - </td>
66   - <td>
67   - <input type="text" class="form-control form-filter input-sm" name="versions_eq">
68   - </td>
69   - <td>
70   - <select class="form-control form-filter " name="destroy_eq">
71   - <option value="">请选择...</option>
72   - <option value="0">运营</option>
73   - <option value="1">撤销</option>
74   - </select>
75   - </td>
76   - <td>
77   - <button class="btn btn-sm green btn-outline filter-submit margin-bottom" >
78   - <i class="fa fa-search"></i> 搜索
79   - </button>
80   -
81   - <button class="btn btn-sm red btn-outline filter-cancel">
82   - <i class="fa fa-times"></i> 重置
83   - </button>
84   - </td>
85   - </tr>
86   - </thead>
87   - <tbody></tbody>
88   - </table>
89   - <div style="text-align: right;">
90   - <ul id="pagination" class="pagination"></ul>
91   - </div>
92   - </div>
93   - </div>
94   - </div>
95   - </div>
96   -</div>
97   -
98   -<script type="text/html" id="carpark_list_table_temp">
99   - {{each list as obj i }}
100   - <tr>
101   - <td style="vertical-align: middle;">
102   - {{(list.page*10)+(i+1)}}
103   - </td>
104   - <td>
105   - {{obj.parkName}}
106   - </td>
107   - <td>
108   - {{obj.parkCode}}
109   - </td>
110   - <td>
111   - {{obj.bCenterPoint}}
112   - </td>
113   - <td>
114   - {{obj.area}}
115   - </td>
116   - <td>
117   - {{obj.gsmc}}
118   - </td>
119   - <td>
120   - {{obj.fgsmc}}
121   - </td>
122   - <td>
123   - {{obj.versions}}
124   - </td>
125   - <td>
126   - {{if obj.destroy == 1}}
127   - <span style="font-weight: bold; color: red; padding: 5px; background-color: #FFE4E1; margin: 5px; font-size: 9px;border-radius: 4px;">撤销</span>
128   - {{else if obj.destroy == 0}}
129   - <span style="font-weight: bold; color: #07824e; padding: 5px; background-color: #FFE4E1; margin: 5px; font-size: 9px;border-radius: 4px;">运营</span>
130   - {{/if}}
131   - </td>
132   - <td>
133   - <a href="positions.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 定位 </a>
134   - </td>
135   - </tr>
136   - {{/each}}
137   - {{if list.length == 0}}
138   - <tr>
139   - <td colspan=10><h6 class="muted">没有找到相关数据</h6></td>
140   - </tr>
141   - {{/if}}
142   -</script>
  1 +<div class="page-head">
  2 + <div class="page-title">
  3 + <h1>停车场信息</h1>
  4 + </div>
  5 +</div>
  6 +
  7 +<ul class="page-breadcrumb breadcrumb">
  8 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  9 + <li><span class="active">基础信息</span> <i class="fa fa-circle"></i></li>
  10 + <li><span class="active">停车场信息</span></li>
  11 +</ul>
  12 +
  13 +<div class="row">
  14 + <div class="col-md-12">
  15 + <div class="portlet light porttlet-fit bordered">
  16 + <div class="portlet-title">
  17 + <div class="caption">
  18 + <i class="fa fa-info-circle font-dark"></i>
  19 + <span class="caption-subject font-dark sbold uppercase">停车场信息</span>
  20 + </div>
  21 + <div class="actions">
  22 + <div class="btn-group btn-group-devided" data-toggle="buttons">
  23 + <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加停车场</a>
  24 + </div>
  25 + </div>
  26 + </div>
  27 + <div class="portlet-body">
  28 + <div class="table-container" style="margin-top: 10px">
  29 + <table class="table table-striped table-bordered table-hover table-checkable" id="datatable_carpark">
  30 + <thead>
  31 + <tr role="row" class="heading">
  32 + <th width="3%">序号</th>
  33 + <th width="12%">停车场名称</th>
  34 + <th width="8%">停车场编码</th>
  35 + <th width="8%">地理位置</th>
  36 + <th width="6%">面积(㎡)</th>
  37 + <th width="8%">所属公司</th>
  38 + <th width="8%">所属线队</th>
  39 + <th width="6%">版本号</th>
  40 + <th width="6%">是否撤销</th>
  41 + <th width="10%">操作</th>
  42 + </tr>
  43 + <tr role="row" class="filter">
  44 + <td>#</td>
  45 + <td>
  46 + <!-- <input type="text" class="form-control form-filter input-sm" name="parkName_like" > -->
  47 + <select name="parkName_like" class="form-control" style="width:100%" id="parkNameSelect"></select>
  48 + </td>
  49 + <td>
  50 + <input type="text" class="form-control form-filter input-sm" name="parkCode_like" id="parkCodeInput">
  51 +
  52 + </td>
  53 + <td>
  54 + <input type="text" class="form-control form-filter input-sm" name="gCenterPoint_like">
  55 + </td>
  56 + <td>
  57 + <input type="text" class="form-control form-filter input-sm" name="area_eq">
  58 + </td>
  59 + <td>
  60 + <select name="company_eq" class="form-control" id="companySelect"></select>
  61 + </td>
  62 + <td>
  63 + <select name="brancheCompany_eq" class="form-control" id="brancheCompanySelect"></select>
  64 + <!-- <input type="text" class="form-control form-filter input-sm" name="brancheCompany_eq" id="brancheCompanySelect"> -->
  65 + </td>
  66 + <td>
  67 + <input type="text" class="form-control form-filter input-sm" name="versions_eq">
  68 + </td>
  69 + <td>
  70 + <select class="form-control form-filter " name="destroy_eq">
  71 + <option value="">请选择...</option>
  72 + <option value="0">运营</option>
  73 + <option value="1">撤销</option>
  74 + </select>
  75 + </td>
  76 + <td>
  77 + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" >
  78 + <i class="fa fa-search"></i> 搜索
  79 + </button>
  80 +
  81 + <button class="btn btn-sm red btn-outline filter-cancel">
  82 + <i class="fa fa-times"></i> 重置
  83 + </button>
  84 + </td>
  85 + </tr>
  86 + </thead>
  87 + <tbody></tbody>
  88 + </table>
  89 + <div style="text-align: right;">
  90 + <ul id="pagination" class="pagination"></ul>
  91 + </div>
  92 + </div>
  93 + </div>
  94 + </div>
  95 + </div>
  96 +</div>
  97 +
  98 +<script type="text/html" id="carpark_list_table_temp">
  99 + {{each list as obj i }}
  100 + <tr>
  101 + <td style="vertical-align: middle;">
  102 + {{(list.page*10)+(i+1)}}
  103 + </td>
  104 + <td>
  105 + {{obj.parkName}}
  106 + </td>
  107 + <td>
  108 + {{obj.parkCode}}
  109 + </td>
  110 + <td>
  111 + {{obj.bCenterPoint}}
  112 + </td>
  113 + <td>
  114 + {{obj.area}}
  115 + </td>
  116 + <td>
  117 + {{obj.gsmc}}
  118 + </td>
  119 + <td>
  120 + {{obj.fgsmc}}
  121 + </td>
  122 + <td>
  123 + {{obj.versions}}
  124 + </td>
  125 + <td>
  126 + {{if obj.destroy == 1}}
  127 + <span style="font-weight: bold; color: red; padding: 5px; background-color: #FFE4E1; margin: 5px; font-size: 9px;border-radius: 4px;">撤销</span>
  128 + {{else if obj.destroy == 0}}
  129 + <span style="font-weight: bold; color: #07824e; padding: 5px; background-color: #FFE4E1; margin: 5px; font-size: 9px;border-radius: 4px;">运营</span>
  130 + {{/if}}
  131 + </td>
  132 + <td>
  133 + <a href="positions.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 定位 </a>
  134 + </td>
  135 + </tr>
  136 + {{/each}}
  137 + {{if list.length == 0}}
  138 + <tr>
  139 + <td colspan=10><h6 class="muted">没有找到相关数据</h6></td>
  140 + </tr>
  141 + {{/if}}
  142 +</script>
143 143 <script src="/pages/base/carpark/js/carpark-list-table.js"></script>
144 144 \ No newline at end of file
... ...
src/main/resources/static/pages/base/line/add.html
... ... @@ -86,7 +86,7 @@
86 86 <!-- 所属分公司 START 在片段线路添加JS模块里初始化select(options值查询的公司表) -->
87 87 <div class="col-md-6">
88 88 <label class="control-label col-md-5">
89   - <span class="required"> * </span>所属分公司&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  89 + <span class="required"> * </span>所属线队&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
90 90 </label>
91 91 <div class="col-md-4">
92 92 <select name="brancheCompany" class="form-control" id="brancheCompanySelect"></select>
... ...
src/main/resources/static/pages/base/line/details.html
... ... @@ -80,7 +80,7 @@
80 80 <!-- 所属分公司 START 在片段线路添加JS模块里初始化select(options值查询的公司表) -->
81 81 <div class="col-md-6">
82 82 <label class="control-label col-md-5">
83   - <span class="required"> * </span>所属分公司&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  83 + <span class="required"> * </span>所属线队&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
84 84 </label>
85 85 <div class="col-md-4">
86 86 <select name="brancheCompany" class="form-control" id="brancheCompanySelect"></select>
... ...
src/main/resources/static/pages/base/line/edit.html
... ... @@ -94,7 +94,7 @@
94 94 <!-- 所属分公司 START 在片段线路添加JS模块里初始化select(options值查询的公司表) -->
95 95 <div class="col-md-6">
96 96 <label class="control-label col-md-5">
97   - <span class="required"> * </span>所属分公司&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  97 + <span class="required"> * </span>所属线队&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
98 98 </label>
99 99 <div class="col-md-4">
100 100 <select name="brancheCompany" class="form-control" id="brancheCompanySelect"></select>
... ...
src/main/resources/static/pages/base/line/js/line-add-form.js
1   -/**
2   - * @description TODO(线路信息添加片段JS模块)
3   - *
4   - * @author bsth@lq
5   - *
6   - * @date 二〇一六年十月十八日 13:31:58
7   - *
8   - */
9   -
10   -$(function(){
11   - /** 获取线路编码 @param cb <回调函数> */
12   - /*function getLineCode(cb) {
13   - *//** get请求获取线路编码。返回线路编码值 *//*
14   - $.get('/line/getLineCode',function(lineCode){
15   - return cb && cb(lineCode);
16   - });
17   - }*/
18   - /** 填充分公司下拉框选择值 */
19   - function setbrancheCompanySelectOptions(){
20   - // 获取公司下拉框选择值
21   - var businessCode = $('#companySelect').val();
22   - // 分公司下拉框options属性值
23   - var options = '<option value="">-- 请选择分公司 --</option>';
24   - // 如果公司选择为空则分公司为空 ; 否则查询出所属公司下的分公司名称和相应分公司代码
25   - if(businessCode == null || businessCode ==''){
26   - // 填充分公司下拉框options
27   - $('#brancheCompanySelect').html(options);
28   - } else {
29   - // 查询出所属公司下的分公司名称和相应分公司代码
30   - $get('/business/all', {upCode_eq: businessCode}, function(array){
31   - // 遍历array
32   - $.each(array, function(i,d){
33   - options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>';
34   - });
35   -
36   - // 填充分公司下拉框options
37   - $('#brancheCompanySelect').html(options);
38   - });
39   - }
40   - }
41   - /** 根据线路名称值设置英文名称值和线路简称 */
42   - function setPinYin(){
43   - /** 获取线路名称值 */
44   - var val = $('#nameInput').val();
45   - /** 汉字转换为拼音 设置英文名称值 */
46   - $('#esInput').val(pinyin.getFullChars(val));
47   - /** 汉字转换为拼音将每一个字的拼音的首字母提取出来并大写 设置线路简称值 */
48   - $('#shortNameInput').val(pinyin.getCamelChars(val));
49   - }
50   -
51   - /** 获取线路编码元素并设值 @param 匿名函数 *//*
52   - getLineCode(function(result){
53   - // 设置线路编码值
54   - $('#lineCodeInput').val(result);
55   - })*/
56   - /** 输入线路名称,自动生成英文名称和线路简称 */
57   - $('#nameInput').on('keyup', setPinYin);
58   - /** 开辟日期 日期控件 <format:日期控件时间格式;locale:语言> */
59   - $('#openDateInput').datetimepicker({format : 'YYYY-MM-DD', locale: 'zh-cn'});
60   - /** 起始站首班时间 日期控件 <format:日期控件时间格式;locale:语言> */
61   - $('#startStationFirstTimeInput').datetimepicker({format : 'HH:mm', locale: 'zh-cn'});
62   - /** 起始站末班时间 日期控件 <format:日期控件时间格式;locale:语言> */
63   - $('#endTimeInput').datetimepicker({format : 'HH:mm', locale: 'zh-cn'});
64   - /** 终点站首班时间 日期控件 <format:日期控件时间格式;locale:语言> */
65   - $('#endStationFirstTimeInput').datetimepicker({format : 'HH:mm', locale: 'zh-cn'});
66   - /** 终点站末班时间 日期控件 <format:日期控件时间格式;locale:语言> */
67   - $('#endStationEndTimeInput').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
68   - /** get请求获取公司表数据并填充公司下拉框选择值 */
69   - $get('/business/all', {upCode_eq: '88'}, function(array){
70   - /** 公司下拉options属性值 */
71   - var options = '<option value="">-- 请选择公司 --</option>';
72   - /** 遍历array */
73   - $.each(array, function(i,d){
74   - options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>';
75   - });
76   - /** 填充公司下拉框options,并添加公司下拉框值改变事件setbrancheCompanySelectOptions */
77   - $('#companySelect').html(options).on('change', setbrancheCompanySelectOptions);
78   - });
79   -
80   - /** 填充分公司下拉框 */
81   - setbrancheCompanySelectOptions();
82   - // 定义表单
83   - var form = $('#line_add_form');
84   - // 定义表单异常
85   - var error = $('.alert-danger',form);
86   - // 表单验证
87   - form.validate({
88   - // 错误提示元素span对象
89   - errorElement : 'span',
90   - // 错误提示元素class名称
91   - errorClass : 'help-block help-block-error',
92   - // 验证错误获取焦点
93   - focusInvalid : true,
94   - // 需要验证的表单元素
95   - rules : {
96   - 'name' : {required : true,maxlength: 30},// 线路名称 必填项、 最大长度.
97   - 'lineCode' : {required : true,maxlength: 6,digits:true ,isLineCode: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},// 所属公司 必填项、最大长度.
105   - 'brancheCompany' : {required : true,maxlength: 30},// 所属分公司 必填项、最大长度.
106   - 'level' : {required : true,maxlength: 30},// 线路等级 必填项、最大长度.
107   - 'nature' : {required : true,maxlength: 30},// 线路性质 必填项、最大长度.
108   - 'startStationName' : {required : true,maxlength: 30},// 起始站名称 必填项、最大长度.
109   - 'endStationName' : {required : true,maxlength: 30},// 终点站名称 必填项、最大长度.
110   - 'startStationFirstTime' : {required : true,maxlength: 30},// 起始站首班时间 必填项、最大长度.
111   - 'StartStationEndTime' : {required : true,maxlength: 30},// 起始站末班时间 必填项、最大长度.
112   - 'endStationFirstTime' : {required : true,maxlength: 30},// 终点站首班时间 必填项、最大长度.
113   - 'endStationEndTime' : {required : true,maxlength: 30},// 终点站末班时间 必填项、最大长度.
114   - 'linePlayType' : {required : true,maxlength: 30},// 线路规划类型 <0:双向;1:环线> 必填项、最大长度.
115   - 'openDate' : {date : true,dateISO:true},// 开辟日期 正确格式的日期(日期校验 ie6 出错,慎用。)必须输入正确格式的日期(ISO),例如:2009-06-23,1998/01/22。只验证格式,不验证有效性。
116   - 'es' : {maxlength: 30},// 英文名称 最大长度.
117   - 'shortName' : {maxlength: 30},// 线路简称 最大长度.
118   - 'shanghaiLinecode' : {maxlength: 30},// 上海市线路编码 最大长度.
119   - 'eqLinecode' : {maxlength: 30},// 设备线路编码 最大长度.
120   - 'startPhone' : {number : true,digits : true,isPhone : true,maxlength: 30},// 起始站调度电话 必须输入合法的数字(负数,小数)。必须输入整数。电话号码格式 最大长度
121   - 'endPhone' : {number : true,digits : true,isPhone : true,maxlength: 30},// 终点站调度电话 必须输入合法的数字(负数,小数)。必须输入整数。电话号码格式 、最大长度
122   - 'carSumNumber' : {number : true,digits : true,maxlength: 8},// 车辆总数 必须输入合法的数字(负数,小数)。必须输入整数。最大长度.
123   - 'hvacCarNumber' : {number : true,digits : true,maxlength: 8},// 空调车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。 最大长度.
124   - 'ordCarNumber' : {number : true,digits : true,maxlength: 8},// 普通车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。最大长度.
125   - 'history' : {maxlength: 200},// 线路沿革 输入长度最多是 200 的字符串(汉字算一个字符)。
126   - 'descriptions' : {maxlength: 200},// 描述/说明 输入长度最多是 200 的字符串(汉字算一个字符)。
127   - 'region' : {required : true}// 线路区域必选
128   - },
129   - messages:{
130   - 'lineCode':{
131   - remote: '此线路编码已存在!'
132   - }
133   - },
134   - /**
135   - * 类型:Callback。当未通过验证的表单提交时,可以在该回调函数中处理一些事情。
136   - *
137   - * 参数:该回调函数有两个参数:第一个为一个事件对象,第二个为验证器(validator)
138   - */
139   - invalidHandler : function(event, validator) {
140   -
141   - // 显示表单未通过提示信息
142   - error.show();
143   -
144   - // 把提示信息放到指定的位置。
145   - App.scrollTo(error, -200);
146   - },
147   -
148   - /**
149   - * 类型:Callback。
150   - *
151   - * 默认:添加errorClass("has-error")到表单元素。将未通过验证的表单元素设置高亮。
152   - */
153   - highlight : function(element) {
154   -
155   - // 添加errorClass("has-error")到表单元素
156   - $(element).closest('.form-group').addClass('has-error');
157   -
158   - },
159   -
160   - /**
161   - * 类型:Callback。
162   - *
163   - * 默认:移除errorClass("has-error")。与highlight操作相反
164   - */
165   - unhighlight : function(element) {
166   -
167   - // 移除errorClass("has-error")
168   - $(element).closest('.form-group').removeClass('has-error');
169   -
170   - },
171   -
172   - /**
173   - * 类型:String,Callback。
174   - *
175   - * 如果指定它,当验证通过时显示一个消息。
176   - *
177   - * 如果是String类型的,则添加该样式到标签中;
178   - *
179   - * 如果是一个回调函数,则将标签作为其唯一的参数。
180   - */
181   - success : function(label) {
182   -
183   - // 当验证通过时,移除errorClass("has-error")
184   - label.closest('.form-group').removeClass('has-error');
185   -
186   - },
187   -
188   - /**
189   - * 类型:Callback。
190   - *
191   - * 默认:default (native) form submit;当表单通过验证,提交表单。回调函数有个默认参数form
192   - */
193   - submitHandler : function(f) {
194   -
195   - // 隐藏错误提示
196   - error.hide();
197   - // 表单序列化
198   - var params = form.serializeJSON();
199   - submit();
200   -
201   - // 查询线路编码的顺延号
202   - /*$get('/line/all', {lineCode_eq: params.lineCode},function(lineCode){
203   -
204   - // 定义返回值的长度
205   - var len = lineCode.length;
206   -
207   - // 如果大于零,则已存在录入的线路编码;否则不存在
208   - if(len > 0) {
209   -
210   - // 定义已有的线路编码
211   - var oldCode = params.lineCode;
212   -
213   - // 自动获取线路编码
214   - getLineCode(function(result) {
215   -
216   - // 重新设置提交参数线路编码值
217   - params.lineCode = result;
218   -
219   - // 弹出选择框;确认则提交;取消则返回
220   - layer.confirm('线路编码【'+oldCode+'】已存在!自动顺延为如下:<br>线路编码:'+result, {
221   - btn : [ '确认提示并提交', '取消' ]
222   - }, submit);
223   -
224   - });
225   - layer.open({
226   - title: '消息提示'
227   - ,content: '线路编码【'+params.lineCode+'】已存在,请重新输入编码!'
228   - });
229   - } else {
230   -
231   - // 提交
232   - submit();
233   -
234   - }
235   - });*/
236   -
237   -
238   - // 提交
239   - function submit() {
240   -
241   - // 防止用户多次提交
242   - $("#submintBtn").addClass("disabled");
243   -
244   - // 添加数据
245   - $post('/line', params, function(result) {
246   - // 如果返回结果不为空
247   - if(result){
248   -
249   - // 返回状态码为"SUCCESS" ,则添加成功;返回状态码为"ERROR" ,则添加失败
250   - if(result.status=='SUCCESS') {
251   -
252   - // 弹出添加成功提示消息
253   - layer.msg('添加成功,并已自动为您生成线路原始版本,可以在线路版本信息下查看!', {time: 7000});
254   -
255   - } else if(result.status=='ERROR') {
256   -
257   - // 弹出添加失败提示消息
258   - layer.msg('添加失败...');
259   -
260   - }
261   - }
262   -
263   - // 返回list.html页面
264   - loadPage('list.html');
265   - });
266   - }
267   - }
268   - });
269   -
270   - // 线路编码不能0开头
271   - $.validator.addMethod("isLineCode", function(value,element) {
272   - // 线路编码正则表达式
273   - var lineCode = /^([1-9])/;
274   - return lineCode.test(value);
275   - }, "线路编码不能以0开头");
276   -
277   - // 联系电话(手机/电话皆可)验证
278   - $.validator.addMethod("isPhone", function(value,element) {
279   - // 长度
280   - var length = value.length;
281   - // 手机正则表达式
282   - var mobile = /^(((13[0-9]{1})|(15[0-9]{1}))+\d{8})$/;
283   - // 固定电话正则表达式
284   - var tel = /^\d{3,4}-?\d{7,9}$/;
285   - return this.optional(element) || (tel.test(value) || mobile.test(value));
286   - }, "请正确填写您的联系电话");
  1 +/**
  2 + * @description TODO(线路信息添加片段JS模块)
  3 + *
  4 + * @author bsth@lq
  5 + *
  6 + * @date 二〇一六年十月十八日 13:31:58
  7 + *
  8 + */
  9 +
  10 +$(function(){
  11 + /** 获取线路编码 @param cb <回调函数> */
  12 + /*function getLineCode(cb) {
  13 + *//** get请求获取线路编码。返回线路编码值 *//*
  14 + $.get('/line/getLineCode',function(lineCode){
  15 + return cb && cb(lineCode);
  16 + });
  17 + }*/
  18 + /** 填充线队下拉框选择值 */
  19 + function setbrancheCompanySelectOptions(){
  20 + // 获取公司下拉框选择值
  21 + var businessCode = $('#companySelect').val();
  22 + // 线队下拉框options属性值
  23 + var options = '<option value="">-- 请选择线队 --</option>';
  24 + // 如果公司选择为空则线队为空 ; 否则查询出所属公司下的线队名称和相应线队代码
  25 + if(businessCode == null || businessCode ==''){
  26 + // 填充线队下拉框options
  27 + $('#brancheCompanySelect').html(options);
  28 + } else {
  29 + // 查询出所属公司下的线队名称和相应线队代码
  30 + $get('/business/all', {upCode_eq: businessCode}, function(array){
  31 + // 遍历array
  32 + $.each(array, function(i,d){
  33 + options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>';
  34 + });
  35 +
  36 + // 填充线队下拉框options
  37 + $('#brancheCompanySelect').html(options);
  38 + });
  39 + }
  40 + }
  41 + /** 根据线路名称值设置英文名称值和线路简称 */
  42 + function setPinYin(){
  43 + /** 获取线路名称值 */
  44 + var val = $('#nameInput').val();
  45 + /** 汉字转换为拼音 设置英文名称值 */
  46 + $('#esInput').val(pinyin.getFullChars(val));
  47 + /** 汉字转换为拼音将每一个字的拼音的首字母提取出来并大写 设置线路简称值 */
  48 + $('#shortNameInput').val(pinyin.getCamelChars(val));
  49 + }
  50 +
  51 + /** 获取线路编码元素并设值 @param 匿名函数 *//*
  52 + getLineCode(function(result){
  53 + // 设置线路编码值
  54 + $('#lineCodeInput').val(result);
  55 + })*/
  56 + /** 输入线路名称,自动生成英文名称和线路简称 */
  57 + $('#nameInput').on('keyup', setPinYin);
  58 + /** 开辟日期 日期控件 <format:日期控件时间格式;locale:语言> */
  59 + $('#openDateInput').datetimepicker({format : 'YYYY-MM-DD', locale: 'zh-cn'});
  60 + /** 起始站首班时间 日期控件 <format:日期控件时间格式;locale:语言> */
  61 + $('#startStationFirstTimeInput').datetimepicker({format : 'HH:mm', locale: 'zh-cn'});
  62 + /** 起始站末班时间 日期控件 <format:日期控件时间格式;locale:语言> */
  63 + $('#endTimeInput').datetimepicker({format : 'HH:mm', locale: 'zh-cn'});
  64 + /** 终点站首班时间 日期控件 <format:日期控件时间格式;locale:语言> */
  65 + $('#endStationFirstTimeInput').datetimepicker({format : 'HH:mm', locale: 'zh-cn'});
  66 + /** 终点站末班时间 日期控件 <format:日期控件时间格式;locale:语言> */
  67 + $('#endStationEndTimeInput').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
  68 + /** get请求获取公司表数据并填充公司下拉框选择值 */
  69 + $get('/business/all', {upCode_eq: '88'}, function(array){
  70 + /** 公司下拉options属性值 */
  71 + var options = '<option value="">-- 请选择公司 --</option>';
  72 + /** 遍历array */
  73 + $.each(array, function(i,d){
  74 + options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>';
  75 + });
  76 + /** 填充公司下拉框options,并添加公司下拉框值改变事件setbrancheCompanySelectOptions */
  77 + $('#companySelect').html(options).on('change', setbrancheCompanySelectOptions);
  78 + });
  79 +
  80 + /** 填充线队下拉框 */
  81 + setbrancheCompanySelectOptions();
  82 + // 定义表单
  83 + var form = $('#line_add_form');
  84 + // 定义表单异常
  85 + var error = $('.alert-danger',form);
  86 + // 表单验证
  87 + form.validate({
  88 + // 错误提示元素span对象
  89 + errorElement : 'span',
  90 + // 错误提示元素class名称
  91 + errorClass : 'help-block help-block-error',
  92 + // 验证错误获取焦点
  93 + focusInvalid : true,
  94 + // 需要验证的表单元素
  95 + rules : {
  96 + 'name' : {required : true,maxlength: 30},// 线路名称 必填项、 最大长度.
  97 + 'lineCode' : {required : true,maxlength: 6,digits:true ,isLineCode: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},// 所属公司 必填项、最大长度.
  105 + 'brancheCompany' : {required : true,maxlength: 30},// 所属线队 必填项、最大长度.
  106 + 'level' : {required : true,maxlength: 30},// 线路等级 必填项、最大长度.
  107 + 'nature' : {required : true,maxlength: 30},// 线路性质 必填项、最大长度.
  108 + 'startStationName' : {required : true,maxlength: 30},// 起始站名称 必填项、最大长度.
  109 + 'endStationName' : {required : true,maxlength: 30},// 终点站名称 必填项、最大长度.
  110 + 'startStationFirstTime' : {required : true,maxlength: 30},// 起始站首班时间 必填项、最大长度.
  111 + 'StartStationEndTime' : {required : true,maxlength: 30},// 起始站末班时间 必填项、最大长度.
  112 + 'endStationFirstTime' : {required : true,maxlength: 30},// 终点站首班时间 必填项、最大长度.
  113 + 'endStationEndTime' : {required : true,maxlength: 30},// 终点站末班时间 必填项、最大长度.
  114 + 'linePlayType' : {required : true,maxlength: 30},// 线路规划类型 <0:双向;1:环线> 必填项、最大长度.
  115 + 'openDate' : {date : true,dateISO:true},// 开辟日期 正确格式的日期(日期校验 ie6 出错,慎用。)必须输入正确格式的日期(ISO),例如:2009-06-23,1998/01/22。只验证格式,不验证有效性。
  116 + 'es' : {maxlength: 30},// 英文名称 最大长度.
  117 + 'shortName' : {maxlength: 30},// 线路简称 最大长度.
  118 + 'shanghaiLinecode' : {maxlength: 30},// 上海市线路编码 最大长度.
  119 + 'eqLinecode' : {maxlength: 30},// 设备线路编码 最大长度.
  120 + 'startPhone' : {number : true,digits : true,isPhone : true,maxlength: 30},// 起始站调度电话 必须输入合法的数字(负数,小数)。必须输入整数。电话号码格式 最大长度
  121 + 'endPhone' : {number : true,digits : true,isPhone : true,maxlength: 30},// 终点站调度电话 必须输入合法的数字(负数,小数)。必须输入整数。电话号码格式 、最大长度
  122 + 'carSumNumber' : {number : true,digits : true,maxlength: 8},// 车辆总数 必须输入合法的数字(负数,小数)。必须输入整数。最大长度.
  123 + 'hvacCarNumber' : {number : true,digits : true,maxlength: 8},// 空调车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。 最大长度.
  124 + 'ordCarNumber' : {number : true,digits : true,maxlength: 8},// 普通车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。最大长度.
  125 + 'history' : {maxlength: 200},// 线路沿革 输入长度最多是 200 的字符串(汉字算一个字符)。
  126 + 'descriptions' : {maxlength: 200},// 描述/说明 输入长度最多是 200 的字符串(汉字算一个字符)。
  127 + 'region' : {required : true}// 线路区域必选
  128 + },
  129 + messages:{
  130 + 'lineCode':{
  131 + remote: '此线路编码已存在!'
  132 + }
  133 + },
  134 + /**
  135 + * 类型:Callback。当未通过验证的表单提交时,可以在该回调函数中处理一些事情。
  136 + *
  137 + * 参数:该回调函数有两个参数:第一个为一个事件对象,第二个为验证器(validator)
  138 + */
  139 + invalidHandler : function(event, validator) {
  140 +
  141 + // 显示表单未通过提示信息
  142 + error.show();
  143 +
  144 + // 把提示信息放到指定的位置。
  145 + App.scrollTo(error, -200);
  146 + },
  147 +
  148 + /**
  149 + * 类型:Callback。
  150 + *
  151 + * 默认:添加errorClass("has-error")到表单元素。将未通过验证的表单元素设置高亮。
  152 + */
  153 + highlight : function(element) {
  154 +
  155 + // 添加errorClass("has-error")到表单元素
  156 + $(element).closest('.form-group').addClass('has-error');
  157 +
  158 + },
  159 +
  160 + /**
  161 + * 类型:Callback。
  162 + *
  163 + * 默认:移除errorClass("has-error")。与highlight操作相反
  164 + */
  165 + unhighlight : function(element) {
  166 +
  167 + // 移除errorClass("has-error")
  168 + $(element).closest('.form-group').removeClass('has-error');
  169 +
  170 + },
  171 +
  172 + /**
  173 + * 类型:String,Callback。
  174 + *
  175 + * 如果指定它,当验证通过时显示一个消息。
  176 + *
  177 + * 如果是String类型的,则添加该样式到标签中;
  178 + *
  179 + * 如果是一个回调函数,则将标签作为其唯一的参数。
  180 + */
  181 + success : function(label) {
  182 +
  183 + // 当验证通过时,移除errorClass("has-error")
  184 + label.closest('.form-group').removeClass('has-error');
  185 +
  186 + },
  187 +
  188 + /**
  189 + * 类型:Callback。
  190 + *
  191 + * 默认:default (native) form submit;当表单通过验证,提交表单。回调函数有个默认参数form
  192 + */
  193 + submitHandler : function(f) {
  194 +
  195 + // 隐藏错误提示
  196 + error.hide();
  197 + // 表单序列化
  198 + var params = form.serializeJSON();
  199 + submit();
  200 +
  201 + // 查询线路编码的顺延号
  202 + /*$get('/line/all', {lineCode_eq: params.lineCode},function(lineCode){
  203 +
  204 + // 定义返回值的长度
  205 + var len = lineCode.length;
  206 +
  207 + // 如果大于零,则已存在录入的线路编码;否则不存在
  208 + if(len > 0) {
  209 +
  210 + // 定义已有的线路编码
  211 + var oldCode = params.lineCode;
  212 +
  213 + // 自动获取线路编码
  214 + getLineCode(function(result) {
  215 +
  216 + // 重新设置提交参数线路编码值
  217 + params.lineCode = result;
  218 +
  219 + // 弹出选择框;确认则提交;取消则返回
  220 + layer.confirm('线路编码【'+oldCode+'】已存在!自动顺延为如下:<br>线路编码:'+result, {
  221 + btn : [ '确认提示并提交', '取消' ]
  222 + }, submit);
  223 +
  224 + });
  225 + layer.open({
  226 + title: '消息提示'
  227 + ,content: '线路编码【'+params.lineCode+'】已存在,请重新输入编码!'
  228 + });
  229 + } else {
  230 +
  231 + // 提交
  232 + submit();
  233 +
  234 + }
  235 + });*/
  236 +
  237 +
  238 + // 提交
  239 + function submit() {
  240 +
  241 + // 防止用户多次提交
  242 + $("#submintBtn").addClass("disabled");
  243 +
  244 + // 添加数据
  245 + $post('/line', params, function(result) {
  246 + // 如果返回结果不为空
  247 + if(result){
  248 +
  249 + // 返回状态码为"SUCCESS" ,则添加成功;返回状态码为"ERROR" ,则添加失败
  250 + if(result.status=='SUCCESS') {
  251 +
  252 + // 弹出添加成功提示消息
  253 + layer.msg('添加成功,并已自动为您生成线路原始版本,可以在线路版本信息下查看!', {time: 7000});
  254 +
  255 + } else if(result.status=='ERROR') {
  256 +
  257 + // 弹出添加失败提示消息
  258 + layer.msg('添加失败...');
  259 +
  260 + }
  261 + }
  262 +
  263 + // 返回list.html页面
  264 + loadPage('list.html');
  265 + });
  266 + }
  267 + }
  268 + });
  269 +
  270 + // 线路编码不能0开头
  271 + $.validator.addMethod("isLineCode", function(value,element) {
  272 + // 线路编码正则表达式
  273 + var lineCode = /^([1-9])/;
  274 + return lineCode.test(value);
  275 + }, "线路编码不能以0开头");
  276 +
  277 + // 联系电话(手机/电话皆可)验证
  278 + $.validator.addMethod("isPhone", function(value,element) {
  279 + // 长度
  280 + var length = value.length;
  281 + // 手机正则表达式
  282 + var mobile = /^(((13[0-9]{1})|(15[0-9]{1}))+\d{8})$/;
  283 + // 固定电话正则表达式
  284 + var tel = /^\d{3,4}-?\d{7,9}$/;
  285 + return this.optional(element) || (tel.test(value) || mobile.test(value));
  286 + }, "请正确填写您的联系电话");
287 287 });
288 288 \ No newline at end of file
... ...
src/main/resources/static/pages/base/line/js/line-edit-form.js
1   -/**
2   - * @description TODO(线路信息修改片段JS模块)
3   - *
4   - * @author bsth@lq
5   - *
6   - * @date 二〇一六年十月十八日 13:31:58
7   - *
8   - */
9   -
10   -
11   -!function(){
12   - // 关闭左侧栏
13   - if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();}
14   - /** 开辟日期 日期控件 <format:日期控件时间格式;locale:语言> */
15   - $('#openDateInput').datetimepicker({format : 'YYYY-MM-DD', locale: 'zh-cn'});
16   - $('#revokeDateInput').datetimepicker({format : 'YYYY-MM-DD', locale: 'zh-cn'});
17   - /** 起始站首班时间 日期控件 <format:日期控件时间格式;locale:语言> */
18   - $('#startStationFirstTimeInput').datetimepicker({format : 'HH:mm', locale: 'zh-cn'});
19   - /** 起始站末班时间 日期控件 <format:日期控件时间格式;locale:语言> */
20   - $('#endTimeInput').datetimepicker({format : 'HH:mm', locale: 'zh-cn'});
21   - /** 终点站首班时间 日期控件 <format:日期控件时间格式;locale:语言> */
22   - $('#endStationFirstTimeInput').datetimepicker({format : 'HH:mm', locale: 'zh-cn'});
23   - /** 终点站末班时间 日期控件 <format:日期控件时间格式;locale:语言> */
24   - $('#endStationEndTimeInput').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
25   - /** 根据线路名称值设置英文名称值和线路简称 */
26   - function setPinYin(){
27   - // 获取线路名称值
28   - var val = $('#nameInput').val();
29   - // 设置英文名称值
30   - $('#esInput').val(pinyin.getFullChars(val));
31   - // 设置线路简称值
32   - $('#shortNameInput').val(pinyin.getCamelChars(val));
33   - }
34   -
35   - /** 公司下拉框 @param:<callback:回调函数> */
36   - function selectTemp(callback) {
37   - // 填充公司下拉框选择值
38   - $.get('/business/all', {upCode_eq: '88'}, function(array){
39   - // 公司下拉options属性值
40   - var options = '<option value="">-- 请选择公司 --</option>';
41   - // 遍历array
42   - $.each(array, function(i,d){
43   - options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>';
44   - });
45   - // 填充公司下拉框options
46   - $('#companySelect').html(options);
47   - return callback && callback();
48   - });
49   - }
50   -
51   - // 填充分公司下拉框选择值
52   - function getbrancheCompanyValues(businessCode,cb){
53   - // 分公司下拉框options属性值
54   - var options = '<option value="">-- 请选择分公司 --</option>';
55   - if(businessCode) {
56   - $get('/business/all', {upCode_eq: businessCode}, function(brancheCompany){
57   - // 遍历brancheCompany
58   - $.each(brancheCompany, function(i,d){
59   - options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>';
60   - });
61   - // 填充分公司下拉框options
62   - $('#brancheCompanySelect').html(options);
63   - return cb && cb();
64   - });
65   - } else {
66   - // 填充分公司下拉框options
67   - $('#brancheCompanySelect').html(options);
68   - return cb && cb();
69   - }
70   - }
71   -
72   - function companySelectChangeSetBrancheValue() {
73   - // 获取公司下拉框选择值
74   - var businessCode = $('#companySelect').val();
75   - // 分公司下拉框options属性值
76   - var options = '<option value="">-- 请选择分公司 --</option>';
77   - // 如果公司选择为空则分公司为空 ; 否则查询出所属公司下的分公司名称和相应分公司代码
78   - if(businessCode == null || businessCode ==''){
79   - // 填充分公司下拉框options
80   - $('#brancheCompanySelect').html(options);
81   - } else {
82   - // 查询出所属公司下的分公司名称和相应分公司代码
83   - $get('/business/all', {upCode_eq: businessCode}, function(array){
84   - // 遍历array
85   - $.each(array, function(i,d){
86   - options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>';
87   - });
88   - // 填充分公司下拉框options
89   - $('#brancheCompanySelect').html(options);
90   - });
91   - }
92   - }
93   -
94   - // 获取参数ID
95   - var lineId = $.url().param('no');
96   -
97   - // 如果参数ID不为空
98   - if(lineId) {
99   - // 获取线路Id元素并设值
100   - $('#lineId').val(lineId);
101   - // 初始化公司下拉框
102   - selectTemp(function(){
103   - /** 根据ID查询详细信息 */
104   - $get('/line/' + lineId ,null, function(result){
105   - // 如果不为空
106   - if(result) {
107   - // 定义日期格式
108   - var fs = 'YYYY-MM-DD';
109   - // 设置inUse
110   - $('#inUseInput').val(result.inUse);
111   - // 设置日期
112   - result.openDate = moment(result.openDate).format(fs);
113   - result.revokeDate = moment(result.revokeDate).format(fs);
114   - /** 填充修改线路表单元素值 @param:<result:数据结果集;line_edit_form:表单元素> */
115   - putFormData(result, '#line_edit_form');
116   - // 设置公司值
117   - $('#companySelect').val(result.company);
118   - // 填充分公司下拉框选择值
119   - getbrancheCompanyValues(result.company,function(){
120   - // 设置分公司
121   - $('#brancheCompanySelect').val(result.brancheCompany);
122   - });
123   -
124   - }
125   -
126   - });
127   - })
128   -
129   - } else {
130   - // 缺少ID
131   - layer.confirm('【ID缺失,请点击返回,重新进行修改操作】', {btn : [ '返回' ],icon: 3, title:'提示'}, function(index){
132   - // 关闭弹出层
133   - layer.close(index);
134   - // 跳转到list页面
135   - loadPage('list.html');
136   - });
137   - }
138   - // 输入线路名称,自动生成英文名称和线路简称
139   - $('#nameInput').on('keyup', setPinYin);
140   - // 公司值改变事件
141   - $('#companySelect').on('change',companySelectChangeSetBrancheValue);
142   - // 定义表单
143   - var form = $('#line_edit_form');
144   - // 定义表单异常
145   - var error = $('.alert-danger',form);
146   - // 表单验证
147   - form.validate({
148   - // 错误提示元素span对象
149   - errorElement : 'span',
150   - // 错误提示元素class名称
151   - errorClass : 'help-block help-block-error',
152   - // 验证错误获取焦点
153   - focusInvalid : true,
154   - // 需要验证的表单元素
155   - rules : {
156   - 'name' : {required : true,maxlength: 30},// 线路名称 必填项、 最大长度.
157   - 'ticketPrice' : {required : true},
158   - 'lineCode' : {required : true,maxlength: 6},// 线路编码 必填项、最大长度.
159   - 'company' : {required : true,maxlength: 30},// 所属公司 必填项、最大长度.
160   - 'brancheCompany' : {required : true,maxlength: 30},// 所属分公司 必填项、最大长度.
161   - 'level' : {required : true,maxlength: 30},// 线路等级 必填项、最大长度.
162   - 'nature' : {required : true,maxlength: 30},// 线路性质 必填项、最大长度.
163   - 'startStationName' : {required : true,maxlength: 30},// 起始站名称 必填项、最大长度.
164   - 'endStationName' : {required : true,maxlength: 30},// 终点站名称 必填项、最大长度.
165   - 'startStationFirstTime' : {required : true,maxlength: 30},// 起始站首班时间 必填项、最大长度.
166   - 'StartStationEndTime' : {required : true,maxlength: 30},// 起始站末班时间 必填项、最大长度.
167   - 'endStationFirstTime' : {required : true,maxlength: 30},// 终点站首班时间 必填项、最大长度.
168   - 'endStationEndTime' : {required : true,maxlength: 30},// 终点站末班时间 必填项、最大长度.
169   - 'linePlayType' : {required : true,maxlength: 30},// 线路规划类型 <0:双向;1:环线> 必填项、最大长度.
170   - 'openDate' : {date : true,dateISO:true},// 开辟日期 正确格式的日期(日期校验 ie6 出错,慎用。)必须输入正确格式的日期(ISO),例如:2009-06-23,1998/01/22。只验证格式,不验证有效性。
171   - 'revokeDate' : {date : true,dateISO:true},
172   - 'es' : {maxlength: 30},// 英文名称 最大长度.
173   - 'shortName' : {maxlength: 30},// 线路简称 最大长度.
174   - 'shanghaiLinecode' : {maxlength: 30},// 上海市线路编码 最大长度.
175   - 'eqLinecode' : {maxlength: 30},// 设备线路编码 最大长度.
176   - 'startPhone' : {number : true,digits : true,isPhone : true,maxlength: 30},// 起始站调度电话 必须输入合法的数字(负数,小数)。必须输入整数。电话号码格式 最大长度
177   - 'endPhone' : {number : true,digits : true,isPhone : true,maxlength: 30},// 终点站调度电话 必须输入合法的数字(负数,小数)。必须输入整数。电话号码格式 、最大长度
178   - 'carSumNumber' : {number : true,digits : true,maxlength: 8},// 车辆总数 必须输入合法的数字(负数,小数)。必须输入整数。最大长度.
179   - 'hvacCarNumber' : {number : true,digits : true,maxlength: 8},// 空调车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。 最大长度.
180   - 'ordCarNumber' : {number : true,digits : true,maxlength: 8},// 普通车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。最大长度.
181   - 'history' : {maxlength: 200},// 线路沿革 输入长度最多是 200 的字符串(汉字算一个字符)。
182   - 'descriptions' : {maxlength: 200},// 描述/说明 输入长度最多是 200 的字符串(汉字算一个字符)。
183   - 'region' : {required : true}// 线路区域必选
184   - },
185   -
186   - /**
187   - * 类型:Callback。当未通过验证的表单提交时,可以在该回调函数中处理一些事情。
188   - *
189   - * 参数:该回调函数有两个参数:第一个为一个事件对象,第二个为验证器(validator)
190   - */
191   - invalidHandler : function(event, validator) {
192   - // 显示表单未通过提示信息
193   - error.show();
194   - // 把提示信息放到指定的位置。
195   - App.scrollTo(error, -200);
196   - },
197   -
198   - /**
199   - * 类型:Callback。
200   - *
201   - * 默认:添加errorClass("has-error")到表单元素。将未通过验证的表单元素设置高亮。
202   - */
203   - highlight : function(element) {
204   - // 添加errorClass("has-error")到表单元素
205   - $(element).closest('.form-group').addClass('has-error');
206   - },
207   -
208   - /**
209   - * 类型:Callback。
210   - *
211   - * 默认:移除errorClass("has-error")。与highlight操作相反
212   - */
213   - unhighlight : function(element) {
214   - // 移除errorClass("has-error")
215   - $(element).closest('.form-group').removeClass('has-error');
216   - },
217   -
218   - /**
219   - * 类型:String,Callback。
220   - *
221   - * 如果指定它,当验证通过时显示一个消息。
222   - *
223   - * 如果是String类型的,则添加该样式到标签中;
224   - *
225   - * 如果是一个回调函数,则将标签作为其唯一的参数。
226   - */
227   - success : function(label) {
228   - // 当验证通过时,移除errorClass("has-error")
229   - label.closest('.form-group').removeClass('has-error');
230   -
231   - },
232   - /**
233   - * 类型:Callback。
234   - *
235   - * 默认:default (native) form submit;当表单通过验证,提交表单。回调函数有个默认参数form
236   - */
237   - submitHandler : function(f) {
238   - // 隐藏错误提示
239   - error.hide();
240   - // 表单序列化
241   - var params = form.serializeJSON();
242   - // 查询线路编码的顺延号
243   - $get('/line/all', {lineCode_eq: params.lineCode},function(lineCode){
244   - // 定义返回值的长度
245   - var len = lineCode.length;
246   - // 如果大于零,则已存在录入的线路编码;否则不存在
247   - if(len > 0) {
248   - // 如果id相等则为同一条数据的线路编码。
249   - if(lineCode[0].id == lineId) {
250   - // 提交
251   - submit();
252   - }
253   - } else {
254   - // 提交
255   - submit();
256   - }
257   - });
258   - // 提交
259   - function submit() {
260   - // 添加数据
261   - $post('/line/update', params, function(result) {
262   - // 如果返回结果不为空
263   - if(result){
264   - // 返回状态码为"SUCCESS" ,则添加成功;返回状态码为"ERROR" ,则添加失败
265   - if(result.status=='SUCCESS') {
266   - // 弹出添加成功提示消息
267   - layer.msg('修改成功...');
268   - } else if(result.status=='ERROR') {
269   - // 弹出添加失败提示消息
270   - layer.msg('修改失败...');
271   - }
272   - }
273   - // 返回list.html页面
274   - loadPage('list.html');
275   - });
276   - }
277   - }
278   - });
279   -
280   - /** 联系电话(手机/电话皆可)验证 */
281   - $.validator.addMethod("isPhone", function(value,element) {
282   - // 长度
283   - var length = value.length;
284   - // 手机正则表达式
285   - var mobile = /^(((13[0-9]{1})|(15[0-9]{1}))+\d{8})$/;
286   - // 固定电话正则表达式
287   - var tel = /^\d{3,4}-?\d{7,9}$/;
288   - return this.optional(element) || (tel.test(value) || mobile.test(value));
289   - }, "请正确填写您的联系电话");
290   -
  1 +/**
  2 + * @description TODO(线路信息修改片段JS模块)
  3 + *
  4 + * @author bsth@lq
  5 + *
  6 + * @date 二〇一六年十月十八日 13:31:58
  7 + *
  8 + */
  9 +
  10 +
  11 +!function(){
  12 + // 关闭左侧栏
  13 + if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();}
  14 + /** 开辟日期 日期控件 <format:日期控件时间格式;locale:语言> */
  15 + $('#openDateInput').datetimepicker({format : 'YYYY-MM-DD', locale: 'zh-cn'});
  16 + $('#revokeDateInput').datetimepicker({format : 'YYYY-MM-DD', locale: 'zh-cn'});
  17 + /** 起始站首班时间 日期控件 <format:日期控件时间格式;locale:语言> */
  18 + $('#startStationFirstTimeInput').datetimepicker({format : 'HH:mm', locale: 'zh-cn'});
  19 + /** 起始站末班时间 日期控件 <format:日期控件时间格式;locale:语言> */
  20 + $('#endTimeInput').datetimepicker({format : 'HH:mm', locale: 'zh-cn'});
  21 + /** 终点站首班时间 日期控件 <format:日期控件时间格式;locale:语言> */
  22 + $('#endStationFirstTimeInput').datetimepicker({format : 'HH:mm', locale: 'zh-cn'});
  23 + /** 终点站末班时间 日期控件 <format:日期控件时间格式;locale:语言> */
  24 + $('#endStationEndTimeInput').datetimepicker({format : 'HH:mm',locale: 'zh-cn'});
  25 + /** 根据线路名称值设置英文名称值和线路简称 */
  26 + function setPinYin(){
  27 + // 获取线路名称值
  28 + var val = $('#nameInput').val();
  29 + // 设置英文名称值
  30 + $('#esInput').val(pinyin.getFullChars(val));
  31 + // 设置线路简称值
  32 + $('#shortNameInput').val(pinyin.getCamelChars(val));
  33 + }
  34 +
  35 + /** 公司下拉框 @param:<callback:回调函数> */
  36 + function selectTemp(callback) {
  37 + // 填充公司下拉框选择值
  38 + $.get('/business/all', {upCode_eq: '88'}, function(array){
  39 + // 公司下拉options属性值
  40 + var options = '<option value="">-- 请选择公司 --</option>';
  41 + // 遍历array
  42 + $.each(array, function(i,d){
  43 + options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>';
  44 + });
  45 + // 填充公司下拉框options
  46 + $('#companySelect').html(options);
  47 + return callback && callback();
  48 + });
  49 + }
  50 +
  51 + // 填充线队下拉框选择值
  52 + function getbrancheCompanyValues(businessCode,cb){
  53 + // 线队下拉框options属性值
  54 + var options = '<option value="">-- 请选择线队 --</option>';
  55 + if(businessCode) {
  56 + $get('/business/all', {upCode_eq: businessCode}, function(brancheCompany){
  57 + // 遍历brancheCompany
  58 + $.each(brancheCompany, function(i,d){
  59 + options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>';
  60 + });
  61 + // 填充线队下拉框options
  62 + $('#brancheCompanySelect').html(options);
  63 + return cb && cb();
  64 + });
  65 + } else {
  66 + // 填充线队下拉框options
  67 + $('#brancheCompanySelect').html(options);
  68 + return cb && cb();
  69 + }
  70 + }
  71 +
  72 + function companySelectChangeSetBrancheValue() {
  73 + // 获取公司下拉框选择值
  74 + var businessCode = $('#companySelect').val();
  75 + // 线队下拉框options属性值
  76 + var options = '<option value="">-- 请选择线队 --</option>';
  77 + // 如果公司选择为空则线队为空 ; 否则查询出所属公司下的线队名称和相应线队代码
  78 + if(businessCode == null || businessCode ==''){
  79 + // 填充线队下拉框options
  80 + $('#brancheCompanySelect').html(options);
  81 + } else {
  82 + // 查询出所属公司下的线队名称和相应线队代码
  83 + $get('/business/all', {upCode_eq: businessCode}, function(array){
  84 + // 遍历array
  85 + $.each(array, function(i,d){
  86 + options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>';
  87 + });
  88 + // 填充线队下拉框options
  89 + $('#brancheCompanySelect').html(options);
  90 + });
  91 + }
  92 + }
  93 +
  94 + // 获取参数ID
  95 + var lineId = $.url().param('no');
  96 +
  97 + // 如果参数ID不为空
  98 + if(lineId) {
  99 + // 获取线路Id元素并设值
  100 + $('#lineId').val(lineId);
  101 + // 初始化公司下拉框
  102 + selectTemp(function(){
  103 + /** 根据ID查询详细信息 */
  104 + $get('/line/' + lineId ,null, function(result){
  105 + // 如果不为空
  106 + if(result) {
  107 + // 定义日期格式
  108 + var fs = 'YYYY-MM-DD';
  109 + // 设置inUse
  110 + $('#inUseInput').val(result.inUse);
  111 + // 设置日期
  112 + result.openDate = moment(result.openDate).format(fs);
  113 + result.revokeDate = moment(result.revokeDate).format(fs);
  114 + /** 填充修改线路表单元素值 @param:<result:数据结果集;line_edit_form:表单元素> */
  115 + putFormData(result, '#line_edit_form');
  116 + // 设置公司值
  117 + $('#companySelect').val(result.company);
  118 + // 填充线队下拉框选择值
  119 + getbrancheCompanyValues(result.company,function(){
  120 + // 设置线队
  121 + $('#brancheCompanySelect').val(result.brancheCompany);
  122 + });
  123 +
  124 + }
  125 +
  126 + });
  127 + })
  128 +
  129 + } else {
  130 + // 缺少ID
  131 + layer.confirm('【ID缺失,请点击返回,重新进行修改操作】', {btn : [ '返回' ],icon: 3, title:'提示'}, function(index){
  132 + // 关闭弹出层
  133 + layer.close(index);
  134 + // 跳转到list页面
  135 + loadPage('list.html');
  136 + });
  137 + }
  138 + // 输入线路名称,自动生成英文名称和线路简称
  139 + $('#nameInput').on('keyup', setPinYin);
  140 + // 公司值改变事件
  141 + $('#companySelect').on('change',companySelectChangeSetBrancheValue);
  142 + // 定义表单
  143 + var form = $('#line_edit_form');
  144 + // 定义表单异常
  145 + var error = $('.alert-danger',form);
  146 + // 表单验证
  147 + form.validate({
  148 + // 错误提示元素span对象
  149 + errorElement : 'span',
  150 + // 错误提示元素class名称
  151 + errorClass : 'help-block help-block-error',
  152 + // 验证错误获取焦点
  153 + focusInvalid : true,
  154 + // 需要验证的表单元素
  155 + rules : {
  156 + 'name' : {required : true,maxlength: 30},// 线路名称 必填项、 最大长度.
  157 + 'ticketPrice' : {required : true},
  158 + 'lineCode' : {required : true,maxlength: 6},// 线路编码 必填项、最大长度.
  159 + 'company' : {required : true,maxlength: 30},// 所属公司 必填项、最大长度.
  160 + 'brancheCompany' : {required : true,maxlength: 30},// 所属线队 必填项、最大长度.
  161 + 'level' : {required : true,maxlength: 30},// 线路等级 必填项、最大长度.
  162 + 'nature' : {required : true,maxlength: 30},// 线路性质 必填项、最大长度.
  163 + 'startStationName' : {required : true,maxlength: 30},// 起始站名称 必填项、最大长度.
  164 + 'endStationName' : {required : true,maxlength: 30},// 终点站名称 必填项、最大长度.
  165 + 'startStationFirstTime' : {required : true,maxlength: 30},// 起始站首班时间 必填项、最大长度.
  166 + 'StartStationEndTime' : {required : true,maxlength: 30},// 起始站末班时间 必填项、最大长度.
  167 + 'endStationFirstTime' : {required : true,maxlength: 30},// 终点站首班时间 必填项、最大长度.
  168 + 'endStationEndTime' : {required : true,maxlength: 30},// 终点站末班时间 必填项、最大长度.
  169 + 'linePlayType' : {required : true,maxlength: 30},// 线路规划类型 <0:双向;1:环线> 必填项、最大长度.
  170 + 'openDate' : {date : true,dateISO:true},// 开辟日期 正确格式的日期(日期校验 ie6 出错,慎用。)必须输入正确格式的日期(ISO),例如:2009-06-23,1998/01/22。只验证格式,不验证有效性。
  171 + 'revokeDate' : {date : true,dateISO:true},
  172 + 'es' : {maxlength: 30},// 英文名称 最大长度.
  173 + 'shortName' : {maxlength: 30},// 线路简称 最大长度.
  174 + 'shanghaiLinecode' : {maxlength: 30},// 上海市线路编码 最大长度.
  175 + 'eqLinecode' : {maxlength: 30},// 设备线路编码 最大长度.
  176 + 'startPhone' : {number : true,digits : true,isPhone : true,maxlength: 30},// 起始站调度电话 必须输入合法的数字(负数,小数)。必须输入整数。电话号码格式 最大长度
  177 + 'endPhone' : {number : true,digits : true,isPhone : true,maxlength: 30},// 终点站调度电话 必须输入合法的数字(负数,小数)。必须输入整数。电话号码格式 、最大长度
  178 + 'carSumNumber' : {number : true,digits : true,maxlength: 8},// 车辆总数 必须输入合法的数字(负数,小数)。必须输入整数。最大长度.
  179 + 'hvacCarNumber' : {number : true,digits : true,maxlength: 8},// 空调车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。 最大长度.
  180 + 'ordCarNumber' : {number : true,digits : true,maxlength: 8},// 普通车辆数 必须输入合法的数字(负数,小数)。 必须输入整数。最大长度.
  181 + 'history' : {maxlength: 200},// 线路沿革 输入长度最多是 200 的字符串(汉字算一个字符)。
  182 + 'descriptions' : {maxlength: 200},// 描述/说明 输入长度最多是 200 的字符串(汉字算一个字符)。
  183 + 'region' : {required : true}// 线路区域必选
  184 + },
  185 +
  186 + /**
  187 + * 类型:Callback。当未通过验证的表单提交时,可以在该回调函数中处理一些事情。
  188 + *
  189 + * 参数:该回调函数有两个参数:第一个为一个事件对象,第二个为验证器(validator)
  190 + */
  191 + invalidHandler : function(event, validator) {
  192 + // 显示表单未通过提示信息
  193 + error.show();
  194 + // 把提示信息放到指定的位置。
  195 + App.scrollTo(error, -200);
  196 + },
  197 +
  198 + /**
  199 + * 类型:Callback。
  200 + *
  201 + * 默认:添加errorClass("has-error")到表单元素。将未通过验证的表单元素设置高亮。
  202 + */
  203 + highlight : function(element) {
  204 + // 添加errorClass("has-error")到表单元素
  205 + $(element).closest('.form-group').addClass('has-error');
  206 + },
  207 +
  208 + /**
  209 + * 类型:Callback。
  210 + *
  211 + * 默认:移除errorClass("has-error")。与highlight操作相反
  212 + */
  213 + unhighlight : function(element) {
  214 + // 移除errorClass("has-error")
  215 + $(element).closest('.form-group').removeClass('has-error');
  216 + },
  217 +
  218 + /**
  219 + * 类型:String,Callback。
  220 + *
  221 + * 如果指定它,当验证通过时显示一个消息。
  222 + *
  223 + * 如果是String类型的,则添加该样式到标签中;
  224 + *
  225 + * 如果是一个回调函数,则将标签作为其唯一的参数。
  226 + */
  227 + success : function(label) {
  228 + // 当验证通过时,移除errorClass("has-error")
  229 + label.closest('.form-group').removeClass('has-error');
  230 +
  231 + },
  232 + /**
  233 + * 类型:Callback。
  234 + *
  235 + * 默认:default (native) form submit;当表单通过验证,提交表单。回调函数有个默认参数form
  236 + */
  237 + submitHandler : function(f) {
  238 + // 隐藏错误提示
  239 + error.hide();
  240 + // 表单序列化
  241 + var params = form.serializeJSON();
  242 + // 查询线路编码的顺延号
  243 + $get('/line/all', {lineCode_eq: params.lineCode},function(lineCode){
  244 + // 定义返回值的长度
  245 + var len = lineCode.length;
  246 + // 如果大于零,则已存在录入的线路编码;否则不存在
  247 + if(len > 0) {
  248 + // 如果id相等则为同一条数据的线路编码。
  249 + if(lineCode[0].id == lineId) {
  250 + // 提交
  251 + submit();
  252 + }
  253 + } else {
  254 + // 提交
  255 + submit();
  256 + }
  257 + });
  258 + // 提交
  259 + function submit() {
  260 + // 添加数据
  261 + $post('/line/update', params, function(result) {
  262 + // 如果返回结果不为空
  263 + if(result){
  264 + // 返回状态码为"SUCCESS" ,则添加成功;返回状态码为"ERROR" ,则添加失败
  265 + if(result.status=='SUCCESS') {
  266 + // 弹出添加成功提示消息
  267 + layer.msg('修改成功...');
  268 + } else if(result.status=='ERROR') {
  269 + // 弹出添加失败提示消息
  270 + layer.msg('修改失败...');
  271 + }
  272 + }
  273 + // 返回list.html页面
  274 + loadPage('list.html');
  275 + });
  276 + }
  277 + }
  278 + });
  279 +
  280 + /** 联系电话(手机/电话皆可)验证 */
  281 + $.validator.addMethod("isPhone", function(value,element) {
  282 + // 长度
  283 + var length = value.length;
  284 + // 手机正则表达式
  285 + var mobile = /^(((13[0-9]{1})|(15[0-9]{1}))+\d{8})$/;
  286 + // 固定电话正则表达式
  287 + var tel = /^\d{3,4}-?\d{7,9}$/;
  288 + return this.optional(element) || (tel.test(value) || mobile.test(value));
  289 + }, "请正确填写您的联系电话");
  290 +
291 291 }();
292 292 \ No newline at end of file
... ...
src/main/resources/static/pages/base/line/list.html
... ... @@ -69,7 +69,7 @@
69 69 <th width="8%">线路名称</th>
70 70 <th width="8%">所属公司</th>
71 71 <!-- 闵行没有下属公司,这里暂时注释掉 -->
72   - <th width="9%">所属分公司</th>
  72 + <th width="9%">所属线队</th>
73 73 <th width="6%">线路性质</th>
74 74 <th width="6%">线路等级</th>
75 75 <th width="9%">上海市线路编码</th>
... ...
src/main/resources/static/pages/base/lineversions/list.html
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="6%">线路名称</th>
41   - <th width="6%">所属公司</th>
42   - <th width="6%">所属分公司</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" id="lineCodeInput">
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   - {{obj.gsmc}}
122   - </td>
123   - <td>
124   - {{obj.fgsmc}}
125   - </td>
126   - <td>
127   - {{obj.startDateStr}}
128   - </td>
129   - <td>
130   - {{obj.endDateStr}}
131   - </td>
132   - <td>
133   - {{obj.versions}}
134   - </td>
135   - <td>
136   - {{if obj.status == '0'}}
137   - 历史版本
138   - {{else if obj.status == '1'}}
139   - 当前版本
140   - {{else if obj.status == '2'}}
141   - 待更新版本
142   - {{/if}}
143   - </td>
144   - <td>
145   - {{obj.remark}}
146   - </td>
147   - <td>
148   - {{if obj.status != '0'}}
149   - <a href="edit.html?no={{obj.id}}" class="btn btn-info btn-sm" data-pjax> 修改 </a>
150   - {{/if}}
151   - {{if obj.status == '2'}}
152   - <a class="update_delete_btn btn btn-danger btn-sm" data-id="{{obj.id}}" data-pjax> 删除 </a>
153   - <!--<a class="update_versions_route_btn btn btn-info btn-sm" data-lineid="{{obj.line.id}}" data-pjax> 编辑版本路线 </a>-->
154   - {{/if}}
155   - <!--{{if obj.status == '2' && obj.isupdate!=1}}
156   - <a class="issue_btn btn btn-danger btn-sm" data-id="{{obj.id}}" data-pjax>发布</a>
157   - {{else if obj.status == '2' && obj.isupdate==1}}
158   - <a class="btn btn-danger btn-sm disabled">数据同步中</a>
159   - {{/if}}-->
160   - </td>
161   - </tr>
162   - {{/each}}
163   - {{if list.length == 0}}
164   - <tr>
165   - <td colspan=13><h6 class="muted">没有找到相关数据</h6></td>
166   - </tr>
167   - {{/if}}
168   -</script>
169   -<!-- 线路信息片段JS模块 -->
  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="6%">线路名称</th>
  41 + <th width="6%">所属公司</th>
  42 + <th width="6%">所属线队</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" id="lineCodeInput">
  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 + {{obj.gsmc}}
  122 + </td>
  123 + <td>
  124 + {{obj.fgsmc}}
  125 + </td>
  126 + <td>
  127 + {{obj.startDateStr}}
  128 + </td>
  129 + <td>
  130 + {{obj.endDateStr}}
  131 + </td>
  132 + <td>
  133 + {{obj.versions}}
  134 + </td>
  135 + <td>
  136 + {{if obj.status == '0'}}
  137 + 历史版本
  138 + {{else if obj.status == '1'}}
  139 + 当前版本
  140 + {{else if obj.status == '2'}}
  141 + 待更新版本
  142 + {{/if}}
  143 + </td>
  144 + <td>
  145 + {{obj.remark}}
  146 + </td>
  147 + <td>
  148 + {{if obj.status != '0'}}
  149 + <a href="edit.html?no={{obj.id}}" class="btn btn-info btn-sm" data-pjax> 修改 </a>
  150 + {{/if}}
  151 + {{if obj.status == '2'}}
  152 + <a class="update_delete_btn btn btn-danger btn-sm" data-id="{{obj.id}}" data-pjax> 删除 </a>
  153 + <!--<a class="update_versions_route_btn btn btn-info btn-sm" data-lineid="{{obj.line.id}}" data-pjax> 编辑版本路线 </a>-->
  154 + {{/if}}
  155 + <!--{{if obj.status == '2' && obj.isupdate!=1}}
  156 + <a class="issue_btn btn btn-danger btn-sm" data-id="{{obj.id}}" data-pjax>发布</a>
  157 + {{else if obj.status == '2' && obj.isupdate==1}}
  158 + <a class="btn btn-danger btn-sm disabled">数据同步中</a>
  159 + {{/if}}-->
  160 + </td>
  161 + </tr>
  162 + {{/each}}
  163 + {{if list.length == 0}}
  164 + <tr>
  165 + <td colspan=13><h6 class="muted">没有找到相关数据</h6></td>
  166 + </tr>
  167 + {{/if}}
  168 +</script>
  169 +<!-- 线路信息片段JS模块 -->
170 170 <script src="/pages/base/lineversions/js/lineversions-list-table.js"></script>
171 171 \ No newline at end of file
... ...