Commit aa87c809395bf70ac711e4bd65d057247bec9bf6

Authored by 李强
1 parent 555e96c6

基础数据功能完善

src/main/java/com/bsth/controller/StationController.java
... ... @@ -36,6 +36,14 @@ public class StationController extends BaseController<Station, Integer> {
36 36 @Autowired
37 37 private StationService service;
38 38  
  39 + /**
  40 + * @Description :TODO(系统规划保存数据)
  41 + *
  42 + *
  43 + *
  44 + * @param map
  45 + * @return
  46 + */
39 47 @RequestMapping(value="collectionSave" , method = RequestMethod.POST)
40 48 public Map<String, Object> collectionSave(@RequestParam Map<String, Object> map) {
41 49  
... ...
src/main/resources/static/pages/base/stationroute/add.html
... ... @@ -255,7 +255,13 @@ $(function(){
255 255  
256 256 mapB.clearOverlays();
257 257  
258   - linePanlThree(id,dir);
  258 + var add_direction_v = $('#stationdirSelect').val();
  259 +
  260 + GetAjaxData.getSectionRouteInfo(id,add_direction_v,function(data) {
  261 +
  262 + linePanlThree(data,add_direction_v);
  263 +
  264 + });
259 265  
260 266 });
261 267  
... ... @@ -288,7 +294,7 @@ $(function(){
288 294 $('#shapesTypeSelect').val(addStaitonParmas.shapesTypeInput).attr('Readonly','Readonly');
289 295  
290 296 // 获取方向元素,并添加值
291   - $('#stationdirSelect').val(dir).attr('Readonly','Readonly');
  297 + $('#stationdirSelect').val(addStaitonParmas.dir).attr('Readonly','Readonly');
292 298  
293 299 // 获取方向元素,并添加值
294 300 $('#radiusSelect').val(addStaitonParmas.radiusInput).attr('Readonly','Readonly');
... ... @@ -483,7 +489,11 @@ $(function(){
483 489 // 刷行左边树
484 490 resjtreeDate(id,params.directions);
485 491  
486   - linePanlThree(id,params.directions);
  492 + GetAjaxData.getSectionRouteInfo(id,params.directions,function(data) {
  493 +
  494 + linePanlThree(data,params.directions);
  495 +
  496 + });
487 497  
488 498 }else {
489 499  
... ...
src/main/resources/static/pages/base/stationroute/add_select.html
... ... @@ -66,16 +66,7 @@
66 66 $(function(){
67 67  
68 68 // 加载显示mobal
69   - $('#add_select_mobal').modal({
70   -
71   - show : true,
72   -
73   - backdrop: 'static',
74   -
75   - keyboard: false
76   -
77   -
78   - });
  69 + $('#add_select_mobal').modal({show : true,backdrop: 'static', keyboard: false});
79 70  
80 71 // 站点名称改变事件
81 72 $('#stationNamebootbox').on('change',function() {
... ...
src/main/resources/static/pages/base/stationroute/edit.html
... ... @@ -228,76 +228,12 @@
228 228 <script type="text/javascript">
229 229 $(function(){
230 230  
231   - console.log(editStationParmas);
232   -
233   - function setFormValue() {
234   -
235   - // 站点ID
236   - $('#stationIdInput').val(editStationParmas.editUp_stationId);
237   -
238   - // 站点路由ID
239   - $('#stationRouteIdInput').val(editStationParmas.stationRouteId);
240   -
241   - // 站点路由线路Id
242   - $('#stationRouteLineInput').val(editStationParmas.stationRouteLine);
243   -
244   - // 线路编码
245   - $('#lineCodeInput').val(editStationParmas.stationRouteLineCode);
246   -
247   - // WGS坐标点图形集合
248   - $('#bPolygonGridInput').val(editStationParmas.bPolygonGridInput);
249   -
250   - // 百度坐标点图形集合
251   - $('#gPolygonGridInput').val(editStationParmas.gPolygonGridInput);
252   -
253   - // 获取站点名称元素设值
254   - $('#stationNameInput').val(editStationParmas.stationNamebootbox);
255   -
256   - // 获取站点编码元素设值
257   - $('#stationCodInput').val(editStationParmas.editUp_stationStationCod);
258   -
259   - // 获取站点类型元素设值
260   - $('#stationMarkSelect').val(editStationParmas.stationRouteStationMark);
261   -
262   - // 获取站点方向元素设值
263   - $('#stationdirSelect').val(editStationParmas.stationRouteDirections);
264   -
265   - // 获取站点道路编码元素设值
266   - $('#roadCodingCodInput').val(editStationParmas.stationRoadCoding);
267   -
268   - // 百度地图经纬度坐标中心点
269   - $('#bJwpointsInput').val(editStationParmas.stationPointInput);
270   -
271   - // WGS经纬度
272   - $('#gJwpointsInput').val(editStationParmas.gLonx + ' ' + editStationParmas.gLaty);
273   -
274   - // 获取图形类型元素,并添加值
275   - $('#shapesTypeSelect').val(editStationParmas.shapesTypeInput);
276   -
277   - // 获取方向元素,并添加值
278   - $('#stationdirSelect').val(editStationParmas.stationRouteDirections);
279   -
280   - // 获取半径元素,并添加值
281   - $('#radiusInput').val(editStationParmas.radiusInput);
282   -
283   - // 是否撤销
284   - $('#destroySelect').val(editStationParmas.destroyInput);
285   -
286   - // 到站时间
287   - $('#toTimeInput').val(editStationParmas.stationRouteToTime);
288   -
289   - // 到站距离
290   - $('#distancesInput').val(editStationParmas.stationRouteToTime);
291   -
292   - // 描述/说明
293   - $('#descriptionsTextarea').val(editStationParmas.stationRouteDescriptions);
294   -
295   - }
296   -
297 231 setFormValue();
298 232  
  233 + var edit_direction_v = editStationParmas.stationRouteDirections;
  234 +
299 235 // 获取站点序号元素,并添加下拉属性值
300   - GetAjaxData.getStation(id,dir,function(treeData) {
  236 + GetAjaxData.getStation(id,edit_direction_v,function(treeData) {
301 237  
302 238 var options = '<option value="">请选择...</option>';
303 239  
... ... @@ -334,7 +270,6 @@ $(function(){
334 270  
335 271 });
336 272  
337   -
338 273 });
339 274  
340 275 // 显示mobal
... ... @@ -345,12 +280,16 @@ $(function(){
345 280  
346 281 var diractionV = $('#stationdirSelect').val();
347 282  
348   - linePanlThree(id,diractionV);
349   -
350 283 editStationParmas = {};
351 284  
352 285 mapB.clearOverlays();
353 286  
  287 + GetAjaxData.getSectionRouteInfo(id,diractionV,function(data) {
  288 +
  289 + linePanlThree(data,diractionV);
  290 +
  291 + });
  292 +
354 293 });
355 294  
356 295  
... ... @@ -491,7 +430,11 @@ $(function(){
491 430 // 刷行左边树
492 431 resjtreeDate(id,params.directions);
493 432  
494   - linePanlThree(id,params.directions);
  433 + GetAjaxData.getSectionRouteInfo(id,params.directions,function(data) {
  434 +
  435 + linePanlThree(data,params.directions);
  436 +
  437 + });
495 438  
496 439 }else {
497 440  
... ...
src/main/resources/static/pages/base/stationroute/edit_select.html
... ... @@ -72,16 +72,16 @@ $(function(){
72 72 $('#edit_select_mobal').modal({show : true,backdrop: 'static',keyboard: false});
73 73  
74 74 // 获取选中站点
75   - var sel = getCurrSelNode(dir);
  75 + // var sel = getCurrSelNode(dir);
76 76  
77 77 // 设值修改时的参数集合
78   - editSetStationParmas(sel);
  78 + // editSetStationParmas(sel);
79 79  
80 80 // 获取站点名称元素并赋值
81   - $('#stationNamebootbox').val(sel[0].original.stationStationName);
  81 + $('#stationNamebootbox').val(editStationParmas.stationNamebootbox);
82 82  
83 83 // 定义站点图形
84   - var stationShapesTypeV = sel[0].original.stationShapesType;
  84 + var stationShapesTypeV = editStationParmas.shapesTypeInput;
85 85  
86 86 // 获取表单元素
87 87 var form = $('#edit_select');
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-ajax-getdata.js
  1 +/**
  2 + * GetAjaxData :ajax异步请求
  3 + *
  4 + * - - - - - -》 collectionSave :系统规划保存请求
  5 + *
  6 + *
  7 + *
  8 + */
  9 +
1 10 var GetAjaxData = function(){
2 11  
3   -
4 12 var ajaxData = {
5 13  
  14 + collectionSave : function (params,callback) {
  15 +
  16 + // 保存
  17 + $post('/station/collectionSave',params,function(rd) {
  18 +
  19 + callback && callback(rd);
  20 +
  21 + });
  22 +
  23 + },
  24 +
6 25 getStation : function(id_,dir_,callback) {
7 26  
8 27 var treeDateJson = [];
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-list-events.js
1   -/** 树选择事件 */
2   -function getCurrSelNode(diraction){
  1 +$(function(){
3 2  
4   - var array = [];
  3 + // 上行方向(0:上行;1:下行)
  4 + var directionUpValue = $('#stationUp').data('direction');
5 5  
6   - try {
7   -
8   - if(diraction=='0'){
9   -
10   - array = $.jstree.reference("#station_Up_tree").get_selected(true);
11   -
12   - }else if(diraction=='1'){
13   -
14   - array = $.jstree.reference("#station_Down_tree").get_selected(true);
15   -
16   - }
  6 + // 下行方向 (0:上行;1:下行)
  7 + var directionDownValue = $('.downSystem').data('direction');
  8 +
  9 + // 系统规划上行站点点击事件
  10 + $('.upSystem').on('click',function() {
17 11  
  12 + // 隐藏上行规划
  13 + $('#upToolsMobal').hide();
18 14  
19   - } catch (e) {
  15 + // 弹出正在加载层
  16 + var i = layer.load(0,{offset:['200px', '280px']});
20 17  
21   - console.log(e);
  18 + // 线路名称是否为区间
  19 + lineNameIsHaveInterval(directionUpValue);
22 20  
23   - }
24   -
25   - return array;
26   -
27   -}
28   -
29   -function resjtreeDate(id,directionData){
  21 + });
30 22  
31   - // 刷新表格数据
32   - GetAjaxData.getStation(id,directionData,function(treeDateJson) {
  23 + // 上行站点其它规划点击事件
  24 + $('.upManual').on('click',function() {
33 25  
34   - var len = treeDateJson[0].children.length;
  26 + // 加载其它规划选择弹出层mobal页面
  27 + $.get('add_manual_select.html', function(m){$(pjaxContainer).append(m);});
35 28  
36   - // 上行
37   - if(directionData==0){
38   -
39   - if(len>0) {
40   -
41   - $('#upToolsMobal').hide();
42   -
43   - $('#uptreeMobal').show();
44   -
45   - }else {
46   -
47   - $('#upToolsMobal').show();
48   -
49   - $('#uptreeMobal').hide();
50   -
51   - }
52   -
53   - StationTreeData.upreloadeTree(treeDateJson);
  29 + });
  30 +
  31 + // 上行站点新增事件
  32 + $('.module_tools #addUpStation').on('click', function() {
54 33  
55   - // 下行
56   - }else if(directionData==1){
57   -
58   - if(len>0) {
59   -
60   - $('#downToolsMobal').hide();
61   -
62   - $('#DowntreeMobal').show();
63   -
64   - }else {
65   -
66   - $('#downToolsMobal').show();
67   -
68   - $('#DowntreeMobal').hide();
69   -
70   - }
71   -
72   - StationTreeData.dwonreloadeTree(treeDateJson);
73   -
74   - }
  34 + // 设置方向
  35 + addStaitonParmas.dir = directionUpValue;
  36 +
  37 + // 加载选择新增方式mobal
  38 + $.get('add_select.html', function(m){$(pjaxContainer).append(m);});
75 39  
76 40 });
77 41  
78   -}
79   -
80   -
81   -function editSetStationParmas(sel) {
82   -
83   - // 站点名称
84   - editStationParmas.stationNamebootbox = sel[0].original.stationStationName;
85   -
86   - // 百度地图经纬度坐标中心点
87   - editStationParmas.stationPointInput = sel[0].original.stationBJwpoints;
88   -
89   - // 站点WGS经度
90   - editStationParmas.gLonx = sel[0].original.stationGLonx;
91   -
92   - // WGS纬度
93   - editStationParmas.gLaty = sel[0].original.stationGLaty;
94   -
95   - // WGS图形坐标
96   - editStationParmas.gPolygonGridInput = sel[0].original.stationGPolygonGrid;
97   -
98   - // 百度图形坐标
99   - editStationParmas.bPolygonGridInput = sel[0].original.stationBPolygonGrid;
100   -
101   - // 站点图形类型
102   - editStationParmas.shapesTypeInput = sel[0].original.stationShapesType;
103   -
104   - // 半径
105   - editStationParmas.radiusInput = sel[0].original.stationRadius;
106   -
107   - // 是否撤销
108   - editStationParmas.destroyInput = sel[0].original.stationDestroy;
109   -
110   - // 站点ID
111   - editStationParmas.editUp_stationId = sel[0].original.stationId;
112   -
113   - // 站点编码
114   - editStationParmas.editUp_stationStationCod = sel[0].original.stationStationCod;
115   -
116   - // 坐标类型
117   - editStationParmas.editUp_stationDbType = sel[0].original.stationDbType;
118   -
119   - // 站点描述说明
120   - editStationParmas.editUp_stationDescriptions = sel[0].original.stationDescriptions;
121   -
122   - // 站点是否撤销
123   - editStationParmas.editUp_stationDestroy = sel[0].original.stationDestroy;
124   -
125   - // 站点道路编码
126   - editStationParmas.stationRoadCoding = sel[0].original.stationRoadCoding;
127   -
128   - // 站点路由方向
129   - editStationParmas.stationRouteDirections = sel[0].original.stationRouteDirections;
130   -
131   - // 站点路由距离
132   - editStationParmas.stationRouteDistances = sel[0].original.stationRouteDistances;
133   -
134   - // 站点路由时间
135   - editStationParmas.stationRouteToTime = sel[0].original.stationRouteToTime;
136   -
137   - // 站点路由ID
138   - editStationParmas.stationRouteId = sel[0].original.stationRouteId;
139   -
140   - // 站点路由线路ID
141   - editStationParmas.stationRouteLine = sel[0].original.stationRouteLine;
142   -
143   - // 站点路由线路编码
144   - editStationParmas.stationRouteLineCode = sel[0].original.stationRouteLineCode;
145   -
146   - // 站点路由站点Id
147   - editStationParmas.stationRouteStation = sel[0].original.stationRouteStation;
148   -
149   - // 站点路由类型
150   - editStationParmas.stationRouteStationMark = sel[0].original.stationRouteStationMark;
151   -
152   - // 站点路由站点名称
153   - editStationParmas.stationRouteStationName = sel[0].original.stationRouteStationName;
154   -
155   - // 站点路由序号
156   - editStationParmas.stationRouteStationRouteCode = sel[0].original.stationRouteStationRouteCode;
157   -
158   - // 站点路由版本
159   - editStationParmas.stationRouteVersions = sel[0].original.stationRouteVersions;
160   -
161   - // 站点编码
162   - editStationParmas.stationStationCod = sel[0].original.stationStationCod;
163   -
164   - // 站点版本
165   - editStationParmas.stationVersions = sel[0].original.stationVersions;
166   -
167   - // 站点路由说明
168   - editStationParmas.stationRouteDescriptions = sel[0].original.stationRouteDescriptions;
169   -
170   -}
171   -
172   -function setFormInputValue(points,gLonx,gLaty,bPolygonGridValue,gPolygonGridVlaue,shapesTypeValue,radiusValue) {
173   -
174   - // 百度地图经纬度坐标中心点
175   - addStaitonParmas.stationPointInput = points;
176   -
177   - // WGS经度
178   - addStaitonParmas.gLonx = gLonx;
179   -
180   - // WGS经度
181   - addStaitonParmas.gLaty = gLaty;
182   -
183   - // 百度坐标点图形集合
184   - addStaitonParmas.bPolygonGridInput = bPolygonGridValue;
185   -
186   - // WGS坐标点图形集合
187   - addStaitonParmas.gPolygonGridInput = gPolygonGridVlaue;
188   -
189   - // 图形类型
190   - addStaitonParmas.shapesTypeInput = shapesTypeValue;
191   -
192   - // 圆形半径
193   - addStaitonParmas.radiusInput = radiusValue;
194   -
195   - // 是否撤销
196   - addStaitonParmas.destroyInput = 0;
197   -
198   -}
199   -
200   -
201   -function editSeteditStationParmasValue(points,gLonx,gLaty,bPolygonGridValue,gPolygonGridVlaue,shapesTypeValue,radiusValue) {
202   -
203   - // 百度地图经纬度坐标中心点
204   - editStationParmas.stationPointInput = points;
205   -
206   - // WGS经度
207   - editStationParmas.gLonx = gLonx;
208   -
209   - // WGS经度
210   - editStationParmas.gLaty = gLaty;
211   -
212   - // 百度坐标点图形集合
213   - editStationParmas.bPolygonGridInput = bPolygonGridValue;
214   -
215   - // WGS坐标点图形集合
216   - editStationParmas.gPolygonGridInput = gPolygonGridVlaue;
217   -
218   - // 图形类型
219   - editStationParmas.shapesTypeInput = shapesTypeValue;
220   -
221   - // 圆形半径
222   - editStationParmas.radiusInput = radiusValue;
223   -
224   - // 是否撤销
225   - editStationParmas.destroyInput = 0;
226   -}
227   -
228   -function systemLineStation(lineNameV,directionData) {
229   -
230   - // 从百度地图获取线路信息
231   - WorldsBMap.lineInfoPanl(lineNameV,directionData,mapB,function(BusLine){
  42 + // 修改上行站点mobal页面
  43 + $('.module_tools #editUpStation').on('click', function(){
232 44  
233   - // 如果线路信息不为空
234   - if(BusLine) {
235   -
236   - // 获取公交线几何对象, 仅当结果自动添加到地图上时有效
237   - var Polygon = BusLine.getPolyline();
238   -
239   - // 返回多边型的点数组(自1.2新增)
240   - var polyGonArray = Polygon.getPath();
241   -
242   - // 获取公交站点个数(自 1.2 新增)
243   - var stationNumber = BusLine.getNumBusStations();
244   -
245   - // 定义线路信息集合
246   - var stationInfo = [];
247   -
248   - // 遍历
249   - for(var k = 0 ; k < stationNumber; k++) {
250   -
251   - // 定义线路信息集合
252   - var tempM = {};
253   -
254   - // 添加站点名称
255   - tempM.name = BusLine.getBusStation(k).name;
256   -
257   - // 添加站点坐标
258   - tempM.potion = BusLine.getBusStation(k).position;
259   -
260   - // 添加
261   - stationInfo.push(tempM);
262   -
263   - }
  45 + var sel = getCurrSelNode(directionUpValue);
  46 +
  47 + if(sel.length==0 || sel[0].original.chaildredType !='station'){
264 48  
265   - // 百度站点坐标获取WGS坐标
266   - GetAjaxData.getFormPointEToWGS(stationInfo,function(result) {
267   -
268   - if(result) {
269   -
270   - GetAjaxData.BpolyGonArrayToWGS(polyGonArray,function(arraydata) {
271   - WorldsBMap.getDistanceAndDuration(result,function(json) {
272   -
273   - // console.log(arraydata);
274   -
275   - json[0].distance = '';
276   -
277   - json[0].duration = '';
278   -
279   - // 定义站点信息JSON字符串
280   - var stationJSON = JSON.stringify(json);
281   -
282   - // 定义路段信息字符串
283   - var sectionJSON = JSON.stringify(arraydata);
284   -
285   - // 参数集合
286   - var params = {};
287   -
288   - // 站点信息JSON字符串
289   - params.stationJSON = stationJSON;
290   -
291   - // 线路ID
292   - params.lineId = id;
293   -
294   - // 方向
295   - params.directions = directionData;
296   -
297   - // 原始坐标类型
298   - params.dbType = 'b';
299   -
300   - // 圆形半径
301   - params.radius = '300';
302   -
303   - // 图形类型(r:圆形;p:多边形)
304   - params.shapesType = 'r';
305   -
306   - // destroy:是否撤销
307   - params.destroy = '0';
308   -
309   - // versions:版本号
310   - params.versions = '1';
311   -
312   - // 路段信息JSON字符串
313   - params.sectionJSON = sectionJSON;
314   -
315   - // 限速
316   - params.speedLimit = '60';
317   -
318   - // console.log(params);
319   -
320   - // 保存
321   - $post('/station/collectionSave',params,function(rd) {
322   -
323   - if(rd.status='SUCCESS') {
324   -
325   - // 关闭弹出层
326   - layer.closeAll();
327   -
328   - // 显示表格
329   - $('#hide_table').show();
330   -
331   - // 刷新树
332   - resjtreeDate(id,directionData);
333   -
334   - }else {
335   -
336   - // 保存失败
337   -
338   -
339   - }
340   -
341   - });
342   -
343   - });
344   -
345   - });
346   -
347   - }
348   -
349   - });
  49 + layer.msg('请先选择要编辑的上行站点!');
350 50  
  51 + return;
351 52 }
  53 + editSetStationParmas(sel);
  54 +
  55 + $.get('edit_select.html', function(m){$(pjaxContainer).append(m);});
352 56  
353 57 });
354 58  
355   -}
356   -
357   -$(function(){
358   -
359   - // 系统规划上行站点
360   - $('.upSystem').on('click',function() {
361   -
362   - // 获取方向 (0:上行;1:下行)
363   - var directionData = $('.upSystem').data('direction');
364   -
365   - $('#upToolsMobal').hide();
366   -
367   - // 弹出正在加载层
368   - var i = layer.load(0,{offset:['200px', '280px']});
369   -
370   - systemSaveStation(directionData);
  59 + // 撤销上行站点
  60 + $('.module_tools #deleteUpStation').on('click', function() {
371 61  
  62 + stationRevoke(directionUpValue);
  63 +
372 64 });
373 65  
374   - // 系统规划下行站点
375   - $('.downSystem').on('click',function() {
376   - // 获取方向 (0:上行;1:下行)
377   - var directionData = $('.downSystem').data('direction');
  66 + // 编辑线路上行走向
  67 + $('.module_tools #editUplineTrend').on('click', function() {
378 68  
379   - $('#downToolsMobal').hide();
380   -
381   - // 弹出正在加载层
382   - var i = layer.load(0,{offset:['200px', '280px']});
383   -
384   - systemSaveStation(directionData);
  69 + editLinePlan(directionUpValue);
385 70  
386 71 });
387 72  
388   - function systemSaveStation(directionData) {
  73 + // 线路上行
  74 + $('#leftUpOrDown #upLine').on('click', function(){
389 75  
390   - // 定义线路名称
391   - var lineNameV = $('.portlet-title .caption').text();
  76 + mapB.clearOverlays();
392 77  
393   - if(lineNameV.indexOf('区间')>0){
394   -
395   - var lineNameNew = lineNameV.replace('区间','');
  78 + GetAjaxData.getSectionRouteInfo(id,directionUpValue,function(data) {
396 79  
397   - layer.confirm('系统无法生成该线路【'+lineNameV+'】的站点与路段!自动修改为如下线路名称【'+lineNameNew+'】生成', {
398   - btn : [ '确认提示并提交', '取消' ]
399   - }, function(index) {
400   -
401   - layer.close(index);
402   -
403   - lineNameV = lineNameNew;
404   -
405   - systemLineStation(lineNameV,directionData);
406   - },function(){
407   -
408   - layer.closeAll();
409   -
410   - if(directionData==0){
411   -
412   - $('#upToolsMobal').show();
413   -
414   - }else if(directionData==1){
415   -
416   - $('#downToolsMobal').show();
417   -
418   - }
419   -
420   -
421   - });
422   - }else {
  80 + linePanlThree(data,directionUpValue);
423 81  
424   - systemLineStation(lineNameV,directionData);
425   -
426   - }
427   -
428   - }
429   -
430   -
431   - // 手动规划上行站点
432   - $('.upManual').on('click',function() {
433   -
434   - $.get('add_manual_select.html', function(m){$(pjaxContainer).append(m);});
  82 + });
435 83  
436 84 });
437 85  
438   - // 上行站点新增事件
439   - $('.module_tools #addUpStation').on('click', function() {
  86 + // 系统规划下行站点
  87 + $('.downSystem').on('click',function() {
  88 +
  89 + // 隐藏下行规划
  90 + $('#downToolsMobal').hide();
440 91  
441   - // 线路方向
442   - dir = $('#stationUp').data('direction');
  92 + // 弹出正在加载层
  93 + var i = layer.load(0,{offset:['200px', '280px']});
443 94  
444   - // 加载选择新增方式mobal
445   - $.get('add_select.html', function(m){$(pjaxContainer).append(m);});
  95 + // 线路名称是否为区间
  96 + lineNameIsHaveInterval(directionDownValue);
446 97  
447 98 });
448 99  
449 100 // 下行站点新增事件
450 101 $('.module_tools #addDownStation').on('click', function() {
451 102  
452   - // 线路方向
453   - dir = $('#stationDown').data('direction');
  103 + // 设置方向
  104 + addStaitonParmas.dir = directionDownValue;
454 105  
455 106 // 加载选择新增方式mobal
456 107 $.get('add_select.html', function(m){$(pjaxContainer).append(m);});
457 108  
458 109 });
459 110  
460   - // 撤销
461   - $('.module_tools #deleteUpStation').on('click', function(){
462   -
463   - var obj = getCurrSelNode('0');
464   -
465   - if(obj.length == 0 || obj[0].original.chaildredType !='station'){
466   - layer.msg('请先选择要删除的站点!');
467   - return;
468   - }
469   - console.log(obj);
470   - layer.confirm('你确定要撤销【'+obj[0].text+'】站点吗?', {btn : [ '确定撤销','返回' ],icon: 3, title:'提示' }, function(index){
471   -
472   - var stationRouteId = obj[0].original.stationRouteId;
473   -
474   - var params = {stationRouteId:stationRouteId,destroy:'1'};
475   -
476   - var stationRouteDirections = obj[0].original.stationRouteDirections;
477   -
478   - GetAjaxData.stationRouteIsDestroy(params,function(result) {
479   -
480   - layer.close(index);
481   -
482   - if(result.status=='SUCCESS'){
483   -
484   - layer.msg('撤销上行站点【'+obj[0].text+'】成功!');
485   -
486   - mapB.clearOverlays();
487   - GetAjaxData.getSectionRouteInfo(id,stationRouteDirections,function(data) {
488   -
489   - // 刷新树
490   - resjtreeDate(id,stationRouteDirections);
491   -
492   - // linePanlThree(data,stationRouteDirections);
493   -
494   - });
495   -
496   -
497   - }else{
498   -
499   - layer.msg('撤销上行站点【'+obj[0].text+'】失败!');
500   -
501   - }
502   -
503   - });
504   -
505   - });
506   -
507   - });
508   -
509   - // 修改上行站点mobal页面
510   - $('.module_tools #editUpStation').on('click', function(){
511   -
512   - dir = '0';
513   -
514   - var sel = getCurrSelNode(dir);
515   -
516   - if(sel.length==0 || sel[0].original.chaildredType !='station'){
517   -
518   - layer.msg('请先选择要编辑的上行站点!');
519   -
520   - return;
521   - }
522   -
523   - $.get('edit_select.html', function(m){$(pjaxContainer).append(m);});
524   -
525   - });
526   -
527 111 // 修改下行站点mobal页面
528 112 $('.module_tools #editDownStation').on('click', function(){
529 113  
530   - dir = '1';
531   -
532   - var sel = getCurrSelNode(dir);
  114 + var sel = getCurrSelNode(directionDownValue);
533 115  
534 116 if(sel.length==0 || sel[0].original.chaildredType !='station'){
535 117  
... ... @@ -537,107 +119,34 @@ $(function(){
537 119  
538 120 return;
539 121 }
  122 + editSetStationParmas(sel);
540 123  
541 124 $.get('edit_select.html', function(m){$(pjaxContainer).append(m);});
542 125  
543 126 });
544 127  
545   -
546   - // 编辑线路走向
547   - $('.module_tools #editUplineTrend').on('click', function(){
548   -
549   - var sel = getCurrSelNode(dir);
550   -
551   - if(sel.length==0 || sel[0].original.chaildredType !='section'){
552   -
553   - layer.msg('请先选中要编辑的上行路段!');
554   -
555   - return;
556   - }
557   -
558   - var sectionId = sel[0].original.sectionId;
559   -
560   -
561   - var sectionrouteDirections = sel[0].original.sectionrouteDirections;
562   -
563   - // 开启线路编辑
564   - polyUpline.enableEditing();
565   -
566   - // 弹出添加失败提示消息,2秒关闭(如果不配置,默认是3秒)
567   - var yindex = layer.msg('编辑完线路走向后,请双击线路走向区域保存',{ offset: '126px',shift: 0,time: 10000});
568   -
569   - // 添加双击折线保存事件
570   - polyUpline.addEventListener('dblclick',function(e) {
571   -
572   - // 关闭
573   - layer.close(yindex);
574   -
575   - polyUpline.disableEditing();
576   -
577   - // 弹出正在加载层
578   - var i = layer.load(0,{title :'我是标题'});
579   -
580   - // 获取折线坐标集合
581   - var editPloyLineArray = polyUpline.getPath();
582   -
583   - // 坐标转换WGS坐标
584   - GetAjaxData.BpolyGonArrayToWGS(editPloyLineArray,function(arraydata) {
585   -
586   - // 定义路段信息字符串
587   - var sectionJSON = JSON.stringify(arraydata);
588   -
589   - var params = {sectionId:sectionId,sectionJSON:sectionJSON}
590   -
591   - GetAjaxData.sectionUpdate(params,function(result) {
592   -
593   - layer.close(i);
594   -
595   - if(result.status=='SUCCESS'){
596   -
597   - layer.msg('修改上行路段成功!');
598   -
599   - }else{
600   -
601   - layer.msg('修改上行路段失败!');
602   -
603   - }
604   - mapB.clearOverlays();
605   - GetAjaxData.getSectionRouteInfo(id,sectionrouteDirections,function(data) {
606   -
607   - // 刷新树
608   - resjtreeDate(id,sectionrouteDirections);
609   -
610   - linePanlThree(data,sectionrouteDirections);
611   -
612   - });
613   - });
614   -
615   - });
616   -
617   - });
  128 + // 撤销下行站点
  129 + $('.module_tools #deleteDownStation').on('click', function() {
618 130  
  131 + stationRevoke(directionDownValue);
  132 +
619 133 });
620 134  
621   - // 线路上行
622   - $('#leftUpOrDown #upLine').on('click', function(){
  135 + // 编辑线路下行走向
  136 + $('.module_tools #editDownlineTrend').on('click', function() {
623 137  
624   - mapB.clearOverlays();
625   -
626   - GetAjaxData.getSectionRouteInfo(id,'0',function(data) {
627   -
628   - linePanlThree(data,'0');
629   -
630   - });
  138 + editLinePlan(directionDownValue);
631 139  
632 140 });
633 141  
634 142 // 线路下行
635 143 $('#leftUpOrDown #downLine').on('click', function(){
  144 +
636 145 mapB.clearOverlays();
637 146  
638   - GetAjaxData.getSectionRouteInfo(id,'1',function(data) {
  147 + GetAjaxData.getSectionRouteInfo(id,directionDownValue,function(data) {
639 148  
640   - linePanlThree(data,'1');
  149 + linePanlThree(data,directionDownValue);
641 150  
642 151 });
643 152  
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-list-function.js 0 → 100644
  1 +/**
  2 + * 函数
  3 + *
  4 + * - - - - - - - 》 getCurrSelNode : 获取选中树节点数据函数
  5 + *
  6 + * - - - - - - - 》 resjtreeDate : 刷新树函数函数
  7 + *
  8 + * - - - - - - - 》 setFormInputValue : 新增站点参数集合赋值函数
  9 + *
  10 + * - - - - - - - 》 editSetStationParmas : 编辑站点参数集合赋值函数
  11 + *
  12 + * - - - - - - - 》 editSeteditStationParmasValue:编辑站点范围图形参数集合赋值函数
  13 + *
  14 + * - - - - - - - 》 lineNameIsHaveInterval : 系统规划时线路名称是否为区间
  15 + *
  16 + * - - - - - - - 》 systemLineStation:系统规划保存函数
  17 + *
  18 + * - - - - - - - 》 stationRevoke :撤销站点
  19 + *
  20 + * - - - - - - - 》 editLinePlan :编辑线路走向
  21 + *
  22 + * - - - - - - - 》 setFormValue :编辑站点设置表单元素值
  23 + */
  24 +
  25 +/** @param diraction 方向 @return array */
  26 +function getCurrSelNode(diraction){
  27 +
  28 + // 定义Obj
  29 + var array = [];
  30 +
  31 + try {
  32 +
  33 + // 上行
  34 + if(diraction=='0'){
  35 +
  36 + // 获取上行选中节点
  37 + array = $.jstree.reference("#station_Up_tree").get_selected(true);
  38 +
  39 + // 下行
  40 + }else if(diraction=='1'){
  41 +
  42 + // 获取下行选中节点
  43 + array = $.jstree.reference("#station_Down_tree").get_selected(true);
  44 +
  45 + }
  46 +
  47 +
  48 + } catch (e) {
  49 +
  50 + console.log(e);
  51 +
  52 + }
  53 +
  54 + // 返回Obj
  55 + return array;
  56 +}
  57 +
  58 +/** @param id:线路ID ;directionData:方向 */
  59 +function resjtreeDate(id,directionData){
  60 +
  61 + // 获取树数据
  62 + GetAjaxData.getStation(id,directionData,function(treeDateJson) {
  63 +
  64 + // 获取数据长度
  65 + var len = treeDateJson[0].children.length;
  66 +
  67 + // 上行
  68 + if(directionData==0){
  69 +
  70 + // 长度大于零
  71 + if(len>0) {
  72 +
  73 + // 隐藏上行规划
  74 + $('#upToolsMobal').hide();
  75 +
  76 + // 显示树
  77 + $('#uptreeMobal').show();
  78 +
  79 + // 刷新树
  80 + StationTreeData.upreloadeTree(treeDateJson);
  81 +
  82 + }else {
  83 +
  84 + // 显示上行规划
  85 + $('#upToolsMobal').show();
  86 +
  87 + // 隐藏上行树
  88 + $('#uptreeMobal').hide();
  89 +
  90 + }
  91 +
  92 + // 下行
  93 + }else if(directionData==1){
  94 +
  95 + // 如果长度大于
  96 + if(len>0) {
  97 +
  98 + // 隐藏下行规划
  99 + $('#downToolsMobal').hide();
  100 +
  101 + // 显示下行树
  102 + $('#DowntreeMobal').show();
  103 +
  104 + // 跟新树
  105 + StationTreeData.dwonreloadeTree(treeDateJson);
  106 +
  107 + }else {
  108 +
  109 + // 显示下行规划
  110 + $('#downToolsMobal').show();
  111 +
  112 + // 隐藏下行树
  113 + $('#DowntreeMobal').hide();
  114 +
  115 + }
  116 +
  117 + }
  118 +
  119 + });
  120 +
  121 +}
  122 +
  123 +/** @param sel 编辑树节点站点Obj */
  124 +function editSetStationParmas(sel) {
  125 +
  126 + // 站点名称
  127 + editStationParmas.stationNamebootbox = sel[0].original.stationStationName;
  128 +
  129 + // 百度地图经纬度坐标中心点
  130 + editStationParmas.stationPointInput = sel[0].original.stationBJwpoints;
  131 +
  132 + // 站点WGS经度
  133 + editStationParmas.gLonx = sel[0].original.stationGLonx;
  134 +
  135 + // WGS纬度
  136 + editStationParmas.gLaty = sel[0].original.stationGLaty;
  137 +
  138 + // WGS图形坐标
  139 + editStationParmas.gPolygonGridInput = sel[0].original.stationGPolygonGrid;
  140 +
  141 + // 百度图形坐标
  142 + editStationParmas.bPolygonGridInput = sel[0].original.stationBPolygonGrid;
  143 +
  144 + // 站点图形类型
  145 + editStationParmas.shapesTypeInput = sel[0].original.stationShapesType;
  146 +
  147 + // 半径
  148 + editStationParmas.radiusInput = sel[0].original.stationRadius;
  149 +
  150 + // 是否撤销
  151 + editStationParmas.destroyInput = sel[0].original.stationDestroy;
  152 +
  153 + // 站点ID
  154 + editStationParmas.editUp_stationId = sel[0].original.stationId;
  155 +
  156 + // 站点编码
  157 + editStationParmas.editUp_stationStationCod = sel[0].original.stationStationCod;
  158 +
  159 + // 坐标类型
  160 + editStationParmas.editUp_stationDbType = sel[0].original.stationDbType;
  161 +
  162 + // 站点描述说明
  163 + editStationParmas.editUp_stationDescriptions = sel[0].original.stationDescriptions;
  164 +
  165 + // 站点是否撤销
  166 + editStationParmas.editUp_stationDestroy = sel[0].original.stationDestroy;
  167 +
  168 + // 站点道路编码
  169 + editStationParmas.stationRoadCoding = sel[0].original.stationRoadCoding;
  170 +
  171 + // 站点路由方向
  172 + editStationParmas.stationRouteDirections = sel[0].original.stationRouteDirections;
  173 +
  174 + // 站点路由距离
  175 + editStationParmas.stationRouteDistances = sel[0].original.stationRouteDistances;
  176 +
  177 + // 站点路由时间
  178 + editStationParmas.stationRouteToTime = sel[0].original.stationRouteToTime;
  179 +
  180 + // 站点路由ID
  181 + editStationParmas.stationRouteId = sel[0].original.stationRouteId;
  182 +
  183 + // 站点路由线路ID
  184 + editStationParmas.stationRouteLine = sel[0].original.stationRouteLine;
  185 +
  186 + // 站点路由线路编码
  187 + editStationParmas.stationRouteLineCode = sel[0].original.stationRouteLineCode;
  188 +
  189 + // 站点路由站点Id
  190 + editStationParmas.stationRouteStation = sel[0].original.stationRouteStation;
  191 +
  192 + // 站点路由类型
  193 + editStationParmas.stationRouteStationMark = sel[0].original.stationRouteStationMark;
  194 +
  195 + // 站点路由站点名称
  196 + editStationParmas.stationRouteStationName = sel[0].original.stationRouteStationName;
  197 +
  198 + // 站点路由序号
  199 + editStationParmas.stationRouteStationRouteCode = sel[0].original.stationRouteStationRouteCode;
  200 +
  201 + // 站点路由版本
  202 + editStationParmas.stationRouteVersions = sel[0].original.stationRouteVersions;
  203 +
  204 + // 站点编码
  205 + editStationParmas.stationStationCod = sel[0].original.stationStationCod;
  206 +
  207 + // 站点版本
  208 + editStationParmas.stationVersions = sel[0].original.stationVersions;
  209 +
  210 + // 站点路由说明
  211 + editStationParmas.stationRouteDescriptions = sel[0].original.stationRouteDescriptions;
  212 +
  213 +}
  214 +
  215 +/** @param points:中心点 ;gLonx:中心点WGS经度;gLaty:中心点WGS纬度;bPolygonGridValue:百度坐标点图形集合;gPolygonGridVlaue:WGS坐标点图形集合;shapesTypeValue:范围图形类型;radiusValue:圆半径 */
  216 +function setFormInputValue(points,gLonx,gLaty,bPolygonGridValue,gPolygonGridVlaue,shapesTypeValue,radiusValue) {
  217 +
  218 + // 百度地图经纬度坐标中心点
  219 + addStaitonParmas.stationPointInput = points;
  220 +
  221 + // WGS经度
  222 + addStaitonParmas.gLonx = gLonx;
  223 +
  224 + // WGS经度
  225 + addStaitonParmas.gLaty = gLaty;
  226 +
  227 + // 百度坐标点图形集合
  228 + addStaitonParmas.bPolygonGridInput = bPolygonGridValue;
  229 +
  230 + // WGS坐标点图形集合
  231 + addStaitonParmas.gPolygonGridInput = gPolygonGridVlaue;
  232 +
  233 + // 图形类型
  234 + addStaitonParmas.shapesTypeInput = shapesTypeValue;
  235 +
  236 + // 圆形半径
  237 + addStaitonParmas.radiusInput = radiusValue;
  238 +
  239 + // 是否撤销
  240 + addStaitonParmas.destroyInput = 0;
  241 +
  242 +}
  243 +
  244 +/** @param points:中心点 ;gLonx:中心点WGS经度;gLaty:中心点WGS纬度;bPolygonGridValue:百度坐标点图形集合;gPolygonGridVlaue:WGS坐标点图形集合;shapesTypeValue:范围图形类型;radiusValue:圆半径 */
  245 +function editSeteditStationParmasValue(points,gLonx,gLaty,bPolygonGridValue,gPolygonGridVlaue,shapesTypeValue,radiusValue) {
  246 +
  247 + // 百度地图经纬度坐标中心点
  248 + editStationParmas.stationPointInput = points;
  249 +
  250 + // WGS经度
  251 + editStationParmas.gLonx = gLonx;
  252 +
  253 + // WGS经度
  254 + editStationParmas.gLaty = gLaty;
  255 +
  256 + // 百度坐标点图形集合
  257 + editStationParmas.bPolygonGridInput = bPolygonGridValue;
  258 +
  259 + // WGS坐标点图形集合
  260 + editStationParmas.gPolygonGridInput = gPolygonGridVlaue;
  261 +
  262 + // 图形类型
  263 + editStationParmas.shapesTypeInput = shapesTypeValue;
  264 +
  265 + // 圆形半径
  266 + editStationParmas.radiusInput = radiusValue;
  267 +
  268 + // 是否撤销
  269 + editStationParmas.destroyInput = 0;
  270 +}
  271 +
  272 +
  273 +/** @param directionData:方向 */
  274 +function lineNameIsHaveInterval(directionData) {
  275 +
  276 + // 定义线路名称
  277 + var lineNameV = $('.portlet-title .caption').text();
  278 +
  279 + // 线路名称是否为区间线路
  280 + if(lineNameV.indexOf('区间')>0){
  281 +
  282 + // 截去区间
  283 + var lineNameNew = lineNameV.replace('区间','');
  284 +
  285 + // 是否继续弹出层
  286 + layer.confirm('系统无法生成该线路【'+lineNameV+'】的站点与路段!自动修改为如下线路名称【'+lineNameNew+'】生成', {
  287 + btn : [ '确认提示并提交', '取消' ]
  288 + }, function(index) {
  289 +
  290 + // 关闭弹出层
  291 + layer.close(index);
  292 +
  293 + // 线路名称去掉区间
  294 + lineNameV = lineNameNew;
  295 +
  296 + // 保存
  297 + systemLineStation(lineNameV,directionData);
  298 +
  299 + },function(){
  300 +
  301 + // 关闭弹出层
  302 + layer.closeAll();
  303 +
  304 + // 上行
  305 + if(directionData==0){
  306 +
  307 + // 显示上行规划
  308 + $('#upToolsMobal').show();
  309 +
  310 + // 下行
  311 + }else if(directionData==1){
  312 +
  313 + // 显示下行规划
  314 + $('#downToolsMobal').show();
  315 +
  316 + }
  317 +
  318 + });
  319 +
  320 + }else {
  321 +
  322 + // 直接保存
  323 + systemLineStation(lineNameV,directionData);
  324 +
  325 + }
  326 +
  327 +}
  328 +
  329 +/** @param lineNameV:线路名称 ; directionData:方向 */
  330 +function systemLineStation(lineNameV,directionData) {
  331 +
  332 + // 从百度地图获取线路信息
  333 + WorldsBMap.lineInfoPanl(lineNameV,directionData,mapB,function(BusLine){
  334 +
  335 + // 如果线路信息不为空
  336 + if(BusLine) {
  337 +
  338 + // 获取公交线几何对象, 仅当结果自动添加到地图上时有效
  339 + var Polygon = BusLine.getPolyline();
  340 +
  341 + // 返回多边型的点数组(自1.2新增)
  342 + var polyGonArray = Polygon.getPath();
  343 +
  344 + // 获取公交站点个数(自 1.2 新增)
  345 + var stationNumber = BusLine.getNumBusStations();
  346 +
  347 + // 定义线路信息集合
  348 + var stationInfo = [];
  349 +
  350 + // 遍历
  351 + for(var k = 0 ; k < stationNumber; k++) {
  352 +
  353 + // 定义线路信息集合
  354 + var tempM = {};
  355 +
  356 + // 添加站点名称
  357 + tempM.name = BusLine.getBusStation(k).name;
  358 +
  359 + // 添加站点坐标
  360 + tempM.potion = BusLine.getBusStation(k).position;
  361 +
  362 + // 添加
  363 + stationInfo.push(tempM);
  364 +
  365 + }
  366 +
  367 + // 百度站点坐标获取WGS坐标
  368 + GetAjaxData.getFormPointEToWGS(stationInfo,function(result) {
  369 +
  370 + // 如果不为空
  371 + if(result) {
  372 +
  373 + // 折线覆盖物对象坐标点集合转WGS坐标
  374 + GetAjaxData.BpolyGonArrayToWGS(polyGonArray,function(arraydata) {
  375 +
  376 + // 获取站点之间的距离与时间
  377 + WorldsBMap.getDistanceAndDuration(result,function(json) {
  378 +
  379 + // 设置第一个站的距离
  380 + json[0].distance = '';
  381 +
  382 + // 设置第一个站的时间
  383 + json[0].duration = '';
  384 +
  385 + // 定义站点信息JSON字符串
  386 + var stationJSON = JSON.stringify(json);
  387 +
  388 + // 定义路段信息字符串
  389 + var sectionJSON = JSON.stringify(arraydata);
  390 +
  391 + // 参数集合
  392 + var params = {};
  393 +
  394 + // 站点信息JSON字符串
  395 + params.stationJSON = stationJSON;
  396 +
  397 + // 线路ID
  398 + params.lineId = id;
  399 +
  400 + // 方向
  401 + params.directions = directionData;
  402 +
  403 + // 原始坐标类型
  404 + params.dbType = 'b';
  405 +
  406 + // 圆形半径
  407 + params.radius = '300';
  408 +
  409 + // 图形类型(r:圆形;p:多边形)
  410 + params.shapesType = 'r';
  411 +
  412 + // destroy:是否撤销
  413 + params.destroy = '0';
  414 +
  415 + // versions:版本号
  416 + params.versions = '1';
  417 +
  418 + // 路段信息JSON字符串
  419 + params.sectionJSON = sectionJSON;
  420 +
  421 + // 限速
  422 + params.speedLimit = '60';
  423 +
  424 + // 保存
  425 + GetAjaxData.collectionSave(params,function(rd) {
  426 +
  427 + if(rd.status='SUCCESS') {
  428 +
  429 + // 关闭弹出层
  430 + layer.closeAll();
  431 +
  432 + layer.msg('保存成功!');
  433 +
  434 + // 刷新树
  435 + resjtreeDate(id,directionData);
  436 +
  437 + }else {
  438 +
  439 + // 保存失败
  440 + layer.msg('保存失败!');
  441 + }
  442 +
  443 + });
  444 +
  445 + });
  446 +
  447 + });
  448 +
  449 + }
  450 +
  451 + });
  452 +
  453 + }
  454 +
  455 + });
  456 +
  457 +}
  458 +
  459 +/** @param directionV_ :方向 */
  460 +function stationRevoke(directionV_) {
  461 +
  462 + // 获取树选中节点对象
  463 + var obj = getCurrSelNode(directionV_);
  464 +
  465 + // 是否选中,选中节点是否为站点
  466 + if(obj.length == 0 || obj[0].original.chaildredType !='station'){
  467 +
  468 + // 弹出提示层
  469 + layer.msg('请先选择要删除的站点!');
  470 +
  471 + return;
  472 + }
  473 +
  474 + // 弹出是否撤销提示框
  475 + layer.confirm('你确定要撤销【'+obj[0].text+'】站点吗?', {btn : [ '确定撤销','返回' ],icon: 3, title:'提示' }, function(index){
  476 +
  477 + // 站点路由ID
  478 + var stationRouteId = obj[0].original.stationRouteId;
  479 +
  480 + // 撤销参数集合
  481 + var params = {stationRouteId:stationRouteId,destroy:'1'};
  482 +
  483 + // 方向
  484 + var stationRouteDirections = obj[0].original.stationRouteDirections;
  485 +
  486 + // 撤销
  487 + GetAjaxData.stationRouteIsDestroy(params,function(result) {
  488 +
  489 + // 关闭弹出框
  490 + layer.close(index);
  491 +
  492 + if(result.status=='SUCCESS'){
  493 +
  494 + layer.msg('撤销上行站点【'+obj[0].text+'】成功!');
  495 +
  496 + mapB.clearOverlays();
  497 + GetAjaxData.getSectionRouteInfo(id,stationRouteDirections,function(data) {
  498 +
  499 + // 刷新树
  500 + resjtreeDate(id,stationRouteDirections);
  501 +
  502 + linePanlThree(data,stationRouteDirections);
  503 +
  504 + });
  505 +
  506 +
  507 + }else{
  508 +
  509 + layer.msg('撤销上行站点【'+obj[0].text+'】失败!');
  510 +
  511 + }
  512 +
  513 + });
  514 +
  515 + });
  516 +}
  517 +
  518 +/** @param direction_ :方向 */
  519 +function editLinePlan(direction_) {
  520 +
  521 + var sel = getCurrSelNode(direction_);
  522 +
  523 + if(sel.length==0 || sel[0].original.chaildredType !='section'){
  524 +
  525 + layer.msg('请先选中要编辑的上行路段!');
  526 +
  527 + return;
  528 + }
  529 +
  530 + var sectionId = sel[0].original.sectionId;
  531 +
  532 + var sectionrouteDirections = sel[0].original.sectionrouteDirections;
  533 +
  534 + // 开启线路编辑
  535 + polyUpline.enableEditing();
  536 +
  537 + // 弹出添加失败提示消息,2秒关闭(如果不配置,默认是3秒)
  538 + var yindex = layer.msg('编辑完线路走向后,请双击线路走向区域保存',{ offset: '126px',shift: 0,time: 10000});
  539 +
  540 + // 添加双击折线保存事件
  541 + polyUpline.addEventListener('dblclick',function(e) {
  542 +
  543 + // 关闭
  544 + layer.close(yindex);
  545 +
  546 + polyUpline.disableEditing();
  547 +
  548 + // 弹出正在加载层
  549 + var i = layer.load(0,{title :'我是标题'});
  550 +
  551 + // 获取折线坐标集合
  552 + var editPloyLineArray = polyUpline.getPath();
  553 +
  554 + // 坐标转换WGS坐标
  555 + GetAjaxData.BpolyGonArrayToWGS(editPloyLineArray,function(arraydata) {
  556 +
  557 + // 定义路段信息字符串
  558 + var sectionJSON = JSON.stringify(arraydata);
  559 +
  560 + var params = {sectionId:sectionId,sectionJSON:sectionJSON}
  561 +
  562 + GetAjaxData.sectionUpdate(params,function(result) {
  563 +
  564 + layer.close(i);
  565 +
  566 + if(result.status=='SUCCESS'){
  567 +
  568 + layer.msg('修改上行路段成功!');
  569 +
  570 + }else{
  571 +
  572 + layer.msg('修改上行路段失败!');
  573 +
  574 + }
  575 + mapB.clearOverlays();
  576 + GetAjaxData.getSectionRouteInfo(id,sectionrouteDirections,function(data) {
  577 +
  578 + // 刷新树
  579 + resjtreeDate(id,sectionrouteDirections);
  580 +
  581 + linePanlThree(data,sectionrouteDirections);
  582 +
  583 + });
  584 + });
  585 +
  586 + });
  587 +
  588 + });
  589 +}
  590 +
  591 +function setFormValue() {
  592 +
  593 + // 站点ID
  594 + $('#stationIdInput').val(editStationParmas.editUp_stationId);
  595 +
  596 + // 站点路由ID
  597 + $('#stationRouteIdInput').val(editStationParmas.stationRouteId);
  598 +
  599 + // 站点路由线路Id
  600 + $('#stationRouteLineInput').val(editStationParmas.stationRouteLine);
  601 +
  602 + // 线路编码
  603 + $('#lineCodeInput').val(editStationParmas.stationRouteLineCode);
  604 +
  605 + // WGS坐标点图形集合
  606 + $('#bPolygonGridInput').val(editStationParmas.bPolygonGridInput);
  607 +
  608 + // 百度坐标点图形集合
  609 + $('#gPolygonGridInput').val(editStationParmas.gPolygonGridInput);
  610 +
  611 + // 获取站点名称元素设值
  612 + $('#stationNameInput').val(editStationParmas.stationNamebootbox);
  613 +
  614 + // 获取站点编码元素设值
  615 + $('#stationCodInput').val(editStationParmas.editUp_stationStationCod);
  616 +
  617 + // 获取站点类型元素设值
  618 + $('#stationMarkSelect').val(editStationParmas.stationRouteStationMark);
  619 +
  620 + // 获取站点方向元素设值
  621 + $('#stationdirSelect').val(editStationParmas.stationRouteDirections);
  622 +
  623 + // 获取站点道路编码元素设值
  624 + $('#roadCodingCodInput').val(editStationParmas.stationRoadCoding);
  625 +
  626 + // 百度地图经纬度坐标中心点
  627 + $('#bJwpointsInput').val(editStationParmas.stationPointInput);
  628 +
  629 + // WGS经纬度
  630 + $('#gJwpointsInput').val(editStationParmas.gLonx + ' ' + editStationParmas.gLaty);
  631 +
  632 + // 获取图形类型元素,并添加值
  633 + $('#shapesTypeSelect').val(editStationParmas.shapesTypeInput);
  634 +
  635 + // 获取方向元素,并添加值
  636 + $('#stationdirSelect').val(editStationParmas.stationRouteDirections);
  637 +
  638 + // 获取半径元素,并添加值
  639 + $('#radiusInput').val(editStationParmas.radiusInput);
  640 +
  641 + // 是否撤销
  642 + $('#destroySelect').val(editStationParmas.destroyInput);
  643 +
  644 + // 到站时间
  645 + $('#toTimeInput').val(editStationParmas.stationRouteToTime);
  646 +
  647 + // 到站距离
  648 + $('#distancesInput').val(editStationParmas.stationRouteToTime);
  649 +
  650 + // 描述/说明
  651 + $('#descriptionsTextarea').val(editStationParmas.stationRouteDescriptions);
  652 +
  653 +}
0 654 \ No newline at end of file
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-list-reload.js
... ... @@ -47,9 +47,7 @@ function TreeUpOrDown(lineId,diraction) {
47 47 // 上行
48 48 if(diraction == 0) {
49 49  
50   - var stationUpTree = $('#station_Up_tree');
51   -
52   - StationTreeData.upInit(treeDateJson,stationUpTree,mapB);
  50 + StationTreeData.upInit(treeDateJson);
53 51  
54 52 if(len>0) {
55 53  
... ... @@ -71,7 +69,7 @@ function TreeUpOrDown(lineId,diraction) {
71 69  
72 70 var stationDownTree = $('#station_Down_tree');
73 71  
74   - StationTreeData.downInit(treeDateJson,stationDownTree,mapB);
  72 + StationTreeData.downInit(treeDateJson);
75 73  
76 74 if(len>0) {
77 75  
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-list-treedata.js
  1 +/**
  2 + *
  3 + * 左边树Obj : StationTreeData
  4 + *
  5 + * - - - - - - 》 upInit : 初始化上行树
  6 + *
  7 + * - - - - - - 》 downInit : 初始化下行树
  8 + *
  9 + * - - - - - - 》 upreloadeTree : 刷行上行树
  10 + *
  11 + * - - - - - - 》 dwonreloadeTree : 刷行下行树
  12 + */
  13 +
1 14 var StationTreeData = function(){
2 15  
3 16 var stationTree = {
4 17  
5   - upInit : function(treeDateJson,station_tree,map) {
  18 + upInit : function(treeDateJson) {
6 19  
  20 + // 如果不为空
7 21 if(treeDateJson) {
8 22  
  23 + // 加载树load事件
9 24 $('#station_Up_tree').on('loaded.jstree', function(e, data){
10 25  
  26 + // 展开树
11 27 $.jstree.reference("#station_Up_tree").open_all();
12 28  
13 29 }).jstree({
14 30  
15 31 'core' : {
  32 +
16 33 'themes' : {
  34 +
17 35 'responsive': false
  36 +
18 37 },
  38 +
19 39 'data': treeDateJson,
  40 +
20 41 'multiple':false
  42 +
21 43 },
  44 +
22 45 'types' : {
  46 +
23 47 "default" : {
  48 +
24 49 "icon" : false
  50 +
25 51 },
  52 +
26 53 'enable_true' : {
  54 +
27 55 "icon" : 'fa fa-check icon-lg'
  56 +
28 57 },
  58 +
29 59 'enable_false' : {
  60 +
30 61 'icon' : 'fa fa-close icon-lg'
  62 +
31 63 },
  64 +
32 65 'group':{
  66 +
33 67 'icon' : 'fa fa-object-group icon-lg'
  68 +
34 69 }
35 70 },
  71 +
36 72 'plugins': ['types']
  73 +
  74 + // 树节点单击事件
37 75 }).bind('click.jstree', function(event) {
38 76  
  77 + // 关闭弹出层
39 78 layer.closeAll();
40 79  
  80 + // 获取选中树节点
41 81 var treeOjb = $.jstree.reference("#station_Up_tree").get_selected(true);
42 82  
  83 + // 节点个数
43 84 var len = treeOjb.length;
44 85  
45   -
  86 + // 如果选中
46 87 if(len>0) {
47 88  
  89 + // 获取数据
48 90 var objStation = treeOjb[0].original;
49 91  
  92 + // 选中的节点类型
50 93 var chaildredType = objStation.chaildredType;
  94 +
  95 + // 选中的是站点
51 96 if(chaildredType =='station') {
52 97  
  98 + // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增)
53 99 mapB.setZoom(16);
54   -
  100 +
  101 + // 站点范围类型
55 102 var shapesTypeT = treeOjb[0].original.stationShapesType;
56 103  
  104 + // 节点数据
57 105 var objStation = treeOjb[0].original;
58 106  
59 107 // 如果是圆
60 108 if(shapesTypeT =='r') {
61 109  
62   -
63   - WorldsBMap.pointsCircle(objStation,map);
64   -
  110 + // 百度地图画圆
  111 + WorldsBMap.pointsCircle(objStation,mapB);
  112 +
  113 + // 如果是多变行
65 114 }else if(shapesTypeT == 'd') {
66 115  
67   - WorldsBMap.pointsPolygon(objStation,map);
  116 + // 百度地图画多边形
  117 + WorldsBMap.pointsPolygon(objStation,mapB);
68 118  
69 119 }
70 120  
  121 + // 选中的是路段
71 122 }else if(chaildredType =='section'){
72 123  
  124 + // 选中节点数据
73 125 var objSection = treeOjb[0].original.sectionBsectionVector;
74 126  
  127 + // 路段矢量坐标点
75 128 var polylineArray = [];
76 129  
77 130 polylineArray.push(treeOjb[0].original);
78 131  
  132 + // 路段方向
79 133 var dire_ = treeOjb[0].original.sectionrouteDirections;
80 134  
  135 + // 清除地图覆盖物
81 136 mapB.clearOverlays();
82 137  
  138 + // 百度地图画路段
83 139 linePanlThree(polylineArray,dire_);
84   -
  140 +
  141 + // 选中的其它节点
85 142 }else if(chaildredType ==null){
86 143  
87   - return;
  144 + return;
88 145  
89 146 }
90 147  
... ... @@ -94,65 +151,135 @@ var StationTreeData = function(){
94 151 }
95 152 },
96 153  
97   - downInit : function(treeDateJson,station_tree,map) {
  154 + downInit : function(treeDateJson) {
98 155  
  156 + // 如果不为空
99 157 if(treeDateJson) {
100 158  
  159 + // 树初始化load事件
101 160 $('#station_Down_tree').on('loaded.jstree', function(e, data){
102 161  
  162 + // 展开树
103 163 $.jstree.reference("#station_Down_tree").open_all();
104 164  
105 165 }).jstree({
106 166  
107 167 'core' : {
  168 +
108 169 'themes' : {
  170 +
109 171 'responsive': false
  172 +
110 173 },
  174 +
111 175 'data': treeDateJson,
  176 +
112 177 'multiple':false
  178 +
113 179 },
  180 +
114 181 'types' : {
  182 +
115 183 "default" : {
  184 +
116 185 "icon" : false
  186 +
117 187 },
  188 +
118 189 'enable_true' : {
  190 +
119 191 "icon" : 'fa fa-check icon-lg'
  192 +
120 193 },
  194 +
121 195 'enable_false' : {
  196 +
122 197 'icon' : 'fa fa-close icon-lg'
  198 +
123 199 },
  200 +
124 201 'group':{
  202 +
125 203 'icon' : 'fa fa-object-group icon-lg'
  204 +
126 205 }
127 206 },
  207 +
128 208 'plugins': ['types']
  209 +
  210 + // 树节点单击事件
129 211 }).bind('click.jstree', function(event) {
130 212  
131   - //单击事件
132   -
  213 + // 关闭弹出层
133 214 layer.closeAll();
134 215  
  216 + // 获取选中节点
135 217 var treeOjb = $.jstree.reference("#station_Down_tree").get_selected(true);
136 218  
  219 + // 选择节点个数
137 220 var len = treeOjb.length;
138 221  
  222 + // 如果选中
139 223 if(len>0) {
140 224  
141   - var shapesTypeT = treeOjb[0].original.stationShapesType;
142   -
  225 + // 获取数据
143 226 var objStation = treeOjb[0].original;
144 227  
145   - // 如果是圆
146   - if(shapesTypeT =='r') {
147   -
148   - WorldsBMap.pointsCircle(objStation,map);
  228 + // 选中的节点类型
  229 + var chaildredType = objStation.chaildredType;
  230 +
  231 + // 选中的是站点
  232 + if(chaildredType =='station') {
149 233  
150   - }else if(shapesTypeT == 'd') {
  234 + // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增)
  235 + mapB.setZoom(16);
151 236  
152   - WorldsBMap.pointsPolygon(objStation,map);
  237 + // 站点范围类型
  238 + var shapesTypeT = treeOjb[0].original.stationShapesType;
153 239  
154   - }
  240 + // 节点数据
  241 + var objStation = treeOjb[0].original;
  242 +
  243 + // 如果是圆
  244 + if(shapesTypeT =='r') {
  245 +
  246 + // 百度地图画圆
  247 + WorldsBMap.pointsCircle(objStation,mapB);
  248 +
  249 + // 如果是多变行
  250 + }else if(shapesTypeT == 'd') {
  251 +
  252 + // 百度地图画多边形
  253 + WorldsBMap.pointsPolygon(objStation,mapB);
  254 +
  255 + }
  256 +
  257 + // 选中的是路段
  258 + }else if(chaildredType =='section'){
  259 +
  260 + // 选中节点数据
  261 + var objSection = treeOjb[0].original.sectionBsectionVector;
  262 +
  263 + // 路段矢量坐标点
  264 + var polylineArray = [];
  265 +
  266 + polylineArray.push(treeOjb[0].original);
  267 +
  268 + // 路段方向
  269 + var dire_ = treeOjb[0].original.sectionrouteDirections;
  270 +
  271 + // 清除地图覆盖物
  272 + mapB.clearOverlays();
  273 +
  274 + // 百度地图画路段
  275 + linePanlThree(polylineArray,dire_);
155 276  
  277 + // 选中的其它节点
  278 + }else if(chaildredType ==null){
  279 +
  280 + return;
  281 +
  282 + }
156 283  
157 284 }
158 285 });
... ... @@ -161,10 +288,13 @@ var StationTreeData = function(){
161 288  
162 289 upreloadeTree : function (treeDateJson) {
163 290  
  291 + // 获取上行树
164 292 var tree = $.jstree.reference('#station_Up_tree');
165 293  
  294 + // 赋值数据
166 295 tree.settings.core.data = treeDateJson;
167 296  
  297 + // 刷新上行树
168 298 tree.refresh();
169 299  
170 300  
... ... @@ -172,13 +302,15 @@ var StationTreeData = function(){
172 302  
173 303 dwonreloadeTree : function (treeDateJson) {
174 304  
  305 + // 获取下行树
175 306 var tree = $.jstree.reference('#station_Down_tree');
176 307  
  308 + // 赋值数据
177 309 tree.settings.core.data = treeDateJson;
178 310  
  311 + // 刷行下行树
179 312 tree.refresh();
180 313  
181   -
182 314 }
183 315  
184 316 }
... ...
src/main/resources/static/pages/base/stationroute/list.html
... ... @@ -239,6 +239,7 @@
239 239  
240 240  
241 241 </script>
  242 +<script src="/pages/base/stationroute/js/stationroute-list-function.js"></script>
242 243 <script src="/pages/base/stationroute/js/stationroute-ajax-getdata.js"></script>
243 244 <script src="/pages/base/stationroute/js/stationroute-list-treedata.js"></script>
244 245 <script src="/pages/base/stationroute/js/stationroute-list-map.js"></script>
... ...