Commit cbb132c03352d275f0c0804c27d62aaea7fef9d8

Authored by youxiw2000
1 parent 4de38ce8

1

src/main/resources/static/pages/base/stationroute/addstationstemplate.html
1   -<!-- 手动添加站点 -->
2   -<div class="modal fade" id="add_station_template_mobal" tabindex="-1" role="basic" aria-hidden="true">
3   -
4   - <div class="modal-dialog">
5   -
6   - <div class="modal-content">
7   -
8   - <div class="modal-header">
9   - <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
10   - <h4 class="modal-title">手动添加站点</h4>
11   - </div>
12   -
13   - <div class="modal-body">
14   -
15   - <form class="form-horizontal" role="form" id="save_station_template_form" action="/module" method="post">
16   -
17   - <div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button>
18   - 您的输入有误,请检查下面的输入项
19   - </div>
20   -
21   - <!-- 站点名称 -->
22   - <div class="form-body">
23   -
24   - <div class="form-group">
25   - <label class="control-label col-md-3">
26   - <span class="required"> * </span> 站点名称:
27   - </label>
28   - <div class="col-md-9">
29   - <textarea class="form-control" rows="12" name="stations" id="stationsInput" placeholder="站点名称"></textarea>
30   - </div>
31   - </div>
32   -
33   - </div>
34   -
35   - <div class="form-group">
36   - <label class="col-md-3 control-label">坐标系类型:</label>
37   - <div class="col-md-9">
38   - <div class="icheck-list">
39   - <label>
40   - <input type="radio" class="icheck" name="baseRes" value='No'> 暂无坐标系
41   - </label>
42   - <label>
43   - <input type="radio" class="icheck" name="baseRes" value='GCJ02' > 火星坐标系
44   - </label>
45   - <label >
46   - <input type="radio" class="icheck" name="baseRes" value='BD09'> 百度坐标系
47   - </label>
48   - <label >
49   - <input type="radio" class="icheck" name="baseRes" value='WGS84' checked> WGS84坐标系
50   - </label>
51   - </div>
52   - </div>
53   - </div>
54   - <!-- 版本号 -->
55   - <div class="form-body">
56   - <div class="form-group">
57   - <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
58   - <div class="col-md-6">
59   - <input type="text" class="form-control" name="versions" id='versionsInput' Readonly>
60   - </div>
61   - </div>
62   - </div>
63   - <div class="form-group">
64   - <div class="alert alert-info font-blue-chambray" style="background-color: #2C3E50">
65   - <h5 class="block"><span class="help-block" style="color:#1bbc9b;"> * 手动添加站点规划说明: </span></h5>
66   - <p>
67   - <span class="help-block" style="color:#1bbc9b;">
68   - &nbsp;请在文本域中按站点顺序依次输入站点名称(如果已有站点GPS坐标(坐标点也用【Tab】键隔开),请将坐标跟在站点名称后面用【Tab】键隔开),每输入完一个站名时请按回车键【Enter】换行.
69   - 例如:<br><br>
70   - 浦东大道金桥路 121.496612 31.238960<br>
71   - 浦东大道居家桥路 121.496618 31.238957<br>
72   - 浦东大道德平路 121.496622 31.238948<br>
73   - </span>
74   - </p>
75   - </div>
76   - </div>
77   - </form>
78   - </div>
79   - <div class="modal-footer">
80   - <button type="button" class="btn default" data-dismiss="modal" id="addMobalHiden">取消</button>
81   - <button type="button" class="btn btn-primary" id="templateSaveData">提交数据</button>
82   - </div>
83   - </div>
84   - </div>
85   -</div>
86   -<script type="text/javascript">
87   -
88   -$('#add_station_template_mobal').on('AddStationTempMobal.show', function(e,map,ajaxd,dir,line,fun){
89   -
90   -
91   -
92   - // 延迟加载显示mobal
93   - setTimeout(function(){$('#add_station_template_mobal').modal({show : true,backdrop: 'static', keyboard: false});},200);
94   -
95   - // 获取表单元素
96   - var form = $('#save_station_template_form');
97   -
98   - $('#versionsInput').val($("#versions").val());
99   -
100   - // 获取错误提示信息元素
101   - var error = $('.alert-danger', form);
102   -
103   - // 提交数据点击事件
104   - $('.modal-footer #templateSaveData').on('click',function() {
105   -
106   - // 表单提交
107   - form.submit();
108   -
109   - });
110   -
111   - // 表单验证
112   - form.validate({
113   -
114   - errorElement : 'span',
115   -
116   - errorClass : 'help-block help-block-error',
117   -
118   - focusInvalid : false,
119   -
120   - rules : {
121   -
122   - 'stations' : {
123   -
124   - required : true,
125   -
126   - }
127   -
128   - },
129   -
130   - invalidHandler : function(event, validator) {
131   -
132   - error.show();
133   -
134   - App.scrollTo(error, -200);
135   -
136   - },
137   -
138   - highlight : function(element) {
139   -
140   - $(element).closest('.form-group').addClass('has-error');
141   -
142   - },
143   -
144   - unhighlight : function(element) {
145   -
146   - $(element).closest('.form-group').removeClass('has-error');
147   -
148   - },
149   -
150   - success : function(label) {
151   -
152   - label.closest('.form-group').removeClass('has-error');
153   -
154   - },
155   -
156   - submitHandler : function(f) {
157   - // 隐藏手动规划弹出层
158   - $('#add_station_template_mobal').modal('hide');
159   - var directionData = dir;
160   - // 定义线路名称
161   - var lineNameV = $('.portlet-title .caption').text();
162   - var dirStr = '';
163   - // 上行
164   - if(directionData==0){
165   - dirStr = '上行路段';
166   - // 隐藏上行规划
167   - $('#upToolsMobal').hide();
168   - // 下行
169   - }else if(directionData==1){
170   - dirStr = '下行路段';
171   - // 隐藏上行规划
172   - $('#downToolsMobal').hide();
173   - }
174   - // 弹出正在加载层
175   - var i = layer.load(0,{offset:['200px', '280px']});
176   - // 表单序列化
177   - var paramsForm = form.serializeJSON();
178   - var baseResValue = paramsForm.baseRes;
179   - // 站点名称字符串切割
180   - var array = paramsForm.stations.split('\r\n');
181   - var arrayFormat = inputStationValueFormat(array);
182   - // 根据站点名称获取百度坐标
183   - map.stationsNameToPoints(arrayFormat,function(resultJson) {
184   - // 根据坐标点获取两点之间的时间与距离
185   - map.getDistanceAndDuration(resultJson,function(stationdataList) {
186   - // 设置第一个站的距离
187   - stationdataList[0].distance = '';
188   - // 设置第一个站的时间
189   - stationdataList[0].duration = '';
190   - // 定义站点信息JSON字符串
191   - var stationJSON = JSON.stringify(stationdataList);
192   - var addLine = line.getLineObj();
193   - // 参数集合
194   - var params = {};
195   - params.baseRes = baseResValue;
196   - // 站点信息JSON字符串
197   - params.stationJSON = stationJSON;
198   - // 线路ID
199   - params.lineId = addLine.id;
200   - // 方向
201   - params.directions = directionData;
202   - // 原始坐标类型
203   - params.dbType = 'b';
204   - // 圆形半径
205   - params.radius = '100';
206   - // 限速
207   - params.speedLimit = '60';
208   - // 图形类型(r:圆形;p:多边形)
209   - params.shapesType = 'r';
210   - // destroy:是否撤销
211   - params.destroy = '0';
212   - // versions:版本号
213   - params.versions = '1';
214   - map.lineInfoPanl(lineNameV,directionData,function(BusLine){
215   - // 如果线路信息不为空
216   - if(BusLine){
217   - // 获取公交线几何对象, 仅当结果自动添加到地图上时有效
218   - var Polygon = BusLine.getPolyline();
219   - // 返回多边型的点数组(自1.2新增)
220   - var polyGonArray = Polygon.getPath();
221   - var jsonArray = [{sectionName:lineNameV+dirStr,points:polyGonArray}];
222   - // 定义路段信息字符串
223   - var sectionJSON = JSON.stringify(jsonArray);
224   - // 路段信息JSON字符串
225   - // if(sectionJSON != null && sectionJSON != "") {
226   - params.sectionJSON = sectionJSON;
227   - addSave(params,addLine.id,directionData);
228   - /* } else {
229   - layer.msg('百度地图上没有此线路的相应路段,请更换方式规划!!!');
230   - } */
231   - }else {
232   - // 根据坐标点获取两点之间的折线路段
233   - map.getSectionListPlonly(stationdataList,function(sectiondata) {
234   - // 定义路段信息字符串
235   - var sectionJSON = JSON.stringify(sectiondata);
236   - // 路段信息JSON字符串
237   - //if(sectionJSON != null && sectionJSON != "") {
238   - params.sectionJSON = sectionJSON;
239   - addSave(params,addLine.id,directionData);
240   - /* } else {
241   - layer.msg('无法生成路段,请重试!');
242   - return;
243   - } */
244   - });
245   - }
246   - });
247   -
248   - });
249   -
250   - });
251   -
252   - }
253   -
254   - });
255   -
256   - function inputStationValueFormat(paramsStationsArray) {
257   - var stationList = [];
258   - var len = paramsStationsArray.length;
259   - for(var k =0;k<len;k++) {
260   - if(paramsStationsArray[k]=="")
261   - continue;
262   - var tempStr = paramsStationsArray[k].split('\t');
263   - if(tempStr.length<2){
264   - stationList.push({name:paramsStationsArray[k]+"公交车站",wgs:{x:'',y:''}});
265   - }else {
266   - stationList.push({name:tempStr[0]+"公交车站",wgs:{x:tempStr[1], y:tempStr[2]}});
267   - }
268   - }
269   - return stationList;
270   - }
271   -
272   - function addSave(params,lineid,directionData) {
273   -
274   -
275   - var version = $("#versions").val();
276   - params.versions = version;
277   - // 保存
278   - ajaxd.manualSave(params,function(rd) {
279   - // 关闭弹出层
280   - layer.closeAll();
281   - if(rd.status='SUCCESS') {
282   - layer.msg('保存成功!');
283   - var stationD = rd.stationData,isNullStr = '';
284   - for(var t = 0 ;t<stationD.length;t++) {
285   - if(stationD[t].potion.lat =='' || stationD[t].potion.lat ==null ||
286   - stationD[t].potion.lng =='' || stationD[t].potion.lng ==null)
287   - isNullStr = isNullStr + stationD[t].name + ' , ';
288   - }
289   - if(isNullStr!='') {
290   - layer.open({
291   - title: '提示',
292   - content:'【' + isNullStr + '】' + '地址系统无法解析!,请手动调整位置!'
293   - });
294   - }
295   - }else {
296   - layer.msg('保存失败!');
297   - }
298   - // 清除地图覆盖物
299   - map.clearMarkAndOverlays();
300   - // 刷新树
301   - fun.resjtreeDate(lineid,directionData,version);
302   -
303   -
304   - //PublicFunctions.resjtreeDate(lineid,directionData,version);
305   - // 查询上行路段信息
306   - //ajaxd.getSectionRouteInfo(lineid,directionData,version,function(data) {
307   - // // 在地图上画出线路走向
308   - // fun.linePanlThree(lineid,data,directionData,version);
309   - //});
310   - });
311   - }
312   -});
  1 +<!-- 手动添加站点 -->
  2 +<div class="modal fade" id="add_station_template_mobal" tabindex="-1" role="basic" aria-hidden="true">
  3 +
  4 + <div class="modal-dialog">
  5 +
  6 + <div class="modal-content">
  7 +
  8 + <div class="modal-header">
  9 + <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
  10 + <h4 class="modal-title">手动添加站点</h4>
  11 + </div>
  12 +
  13 + <div class="modal-body">
  14 +
  15 + <form class="form-horizontal" role="form" id="save_station_template_form" action="/module" method="post">
  16 +
  17 + <div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button>
  18 + 您的输入有误,请检查下面的输入项
  19 + </div>
  20 +
  21 + <!-- 站点名称 -->
  22 + <div class="form-body">
  23 +
  24 + <div class="form-group">
  25 + <label class="control-label col-md-3">
  26 + <span class="required"> * </span> 站点名称:
  27 + </label>
  28 + <div class="col-md-9">
  29 + <textarea class="form-control" rows="12" name="stations" id="stationsInput" placeholder="站点名称"></textarea>
  30 + </div>
  31 + </div>
  32 +
  33 + </div>
  34 +
  35 + <div class="form-group">
  36 + <label class="col-md-3 control-label">坐标系类型:</label>
  37 + <div class="col-md-9">
  38 + <div class="icheck-list">
  39 + <label>
  40 + <input type="radio" class="icheck" name="baseRes" value='No'> 暂无坐标系
  41 + </label>
  42 + <label>
  43 + <input type="radio" class="icheck" name="baseRes" value='GCJ02' > 火星坐标系
  44 + </label>
  45 + <label >
  46 + <input type="radio" class="icheck" name="baseRes" value='BD09'> 百度坐标系
  47 + </label>
  48 + <label >
  49 + <input type="radio" class="icheck" name="baseRes" value='WGS84' checked> WGS84坐标系
  50 + </label>
  51 + </div>
  52 + </div>
  53 + </div>
  54 + <!-- 版本号 -->
  55 + <div class="form-body">
  56 + <div class="form-group">
  57 + <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  58 + <div class="col-md-6">
  59 + <input type="text" class="form-control" name="versions" id='versionsInput' Readonly>
  60 + </div>
  61 + </div>
  62 + </div>
  63 + <div class="form-group">
  64 + <div class="alert alert-info font-blue-chambray" style="background-color: #2C3E50">
  65 + <h5 class="block"><span class="help-block" style="color:#1bbc9b;"> * 手动添加站点规划说明: </span></h5>
  66 + <p>
  67 + <span class="help-block" style="color:#1bbc9b;">
  68 + &nbsp;请在文本域中按站点顺序依次输入站点名称(如果已有站点GPS坐标(坐标点也用【Tab】键隔开),请将坐标跟在站点名称后面用【Tab】键隔开),每输入完一个站名时请按回车键【Enter】换行.
  69 + 例如:<br><br>
  70 + 浦东大道金桥路 121.496612 31.238960<br>
  71 + 浦东大道居家桥路 121.496618 31.238957<br>
  72 + 浦东大道德平路 121.496622 31.238948<br>
  73 + </span>
  74 + </p>
  75 + </div>
  76 + </div>
  77 + </form>
  78 + </div>
  79 + <div class="modal-footer">
  80 + <button type="button" class="btn default" data-dismiss="modal" id="addMobalHiden">取消</button>
  81 + <button type="button" class="btn btn-primary" id="templateSaveData">提交数据</button>
  82 + </div>
  83 + </div>
  84 + </div>
  85 +</div>
  86 +<script type="text/javascript">
  87 +
  88 +$('#add_station_template_mobal').on('AddStationTempMobal.show', function(e,map,ajaxd,dir,line,fun){
  89 +
  90 +
  91 +
  92 + // 延迟加载显示mobal
  93 + setTimeout(function(){$('#add_station_template_mobal').modal({show : true,backdrop: 'static', keyboard: false});},200);
  94 +
  95 + // 获取表单元素
  96 + var form = $('#save_station_template_form');
  97 +
  98 + $('#versionsInput').val($("#versions").val());
  99 +
  100 + // 获取错误提示信息元素
  101 + var error = $('.alert-danger', form);
  102 +
  103 + // 提交数据点击事件
  104 + $('.modal-footer #templateSaveData').on('click',function() {
  105 +
  106 + // 表单提交
  107 + form.submit();
  108 +
  109 + });
  110 +
  111 + // 表单验证
  112 + form.validate({
  113 +
  114 + errorElement : 'span',
  115 +
  116 + errorClass : 'help-block help-block-error',
  117 +
  118 + focusInvalid : false,
  119 +
  120 + rules : {
  121 +
  122 + 'stations' : {
  123 +
  124 + required : true,
  125 +
  126 + }
  127 +
  128 + },
  129 +
  130 + invalidHandler : function(event, validator) {
  131 +
  132 + error.show();
  133 +
  134 + App.scrollTo(error, -200);
  135 +
  136 + },
  137 +
  138 + highlight : function(element) {
  139 +
  140 + $(element).closest('.form-group').addClass('has-error');
  141 +
  142 + },
  143 +
  144 + unhighlight : function(element) {
  145 +
  146 + $(element).closest('.form-group').removeClass('has-error');
  147 +
  148 + },
  149 +
  150 + success : function(label) {
  151 +
  152 + label.closest('.form-group').removeClass('has-error');
  153 +
  154 + },
  155 +
  156 + submitHandler : function(f) {
  157 + // 隐藏手动规划弹出层
  158 + $('#add_station_template_mobal').modal('hide');
  159 + var directionData = dir;
  160 + // 定义线路名称
  161 + var lineNameV = $('.portlet-title .caption').text();
  162 + var dirStr = '';
  163 + // 上行
  164 + if(directionData==0){
  165 + dirStr = '上行路段';
  166 + // 隐藏上行规划
  167 + $('#upToolsMobal').hide();
  168 + // 下行
  169 + }else if(directionData==1){
  170 + dirStr = '下行路段';
  171 + // 隐藏上行规划
  172 + $('#downToolsMobal').hide();
  173 + }
  174 + // 弹出正在加载层
  175 + var i = layer.load(0,{offset:['200px', '280px']});
  176 + // 表单序列化
  177 + var paramsForm = form.serializeJSON();
  178 + var baseResValue = paramsForm.baseRes;
  179 + // 站点名称字符串切割
  180 + var array = paramsForm.stations.split('\r\n');
  181 + var arrayFormat = inputStationValueFormat(array);
  182 + // 根据站点名称获取百度坐标
  183 + map.stationsNameToPoints(arrayFormat,function(resultJson) {
  184 + // 根据坐标点获取两点之间的时间与距离
  185 + map.getDistanceAndDuration(resultJson,function(stationdataList) {
  186 + // 设置第一个站的距离
  187 + stationdataList[0].distance = '';
  188 + // 设置第一个站的时间
  189 + stationdataList[0].duration = '';
  190 + // 定义站点信息JSON字符串
  191 + var stationJSON = JSON.stringify(stationdataList);
  192 + var addLine = line.getLineObj();
  193 + // 参数集合
  194 + var params = {};
  195 + params.baseRes = baseResValue;
  196 + // 站点信息JSON字符串
  197 + params.stationJSON = stationJSON;
  198 + // 线路ID
  199 + params.lineId = addLine.id;
  200 + // 方向
  201 + params.directions = directionData;
  202 + // 原始坐标类型
  203 + params.dbType = 'b';
  204 + // 圆形半径
  205 + params.radius = '100';
  206 + // 限速
  207 + params.speedLimit = '60';
  208 + // 图形类型(r:圆形;p:多边形)
  209 + params.shapesType = 'r';
  210 + // destroy:是否撤销
  211 + params.destroy = '0';
  212 + // versions:版本号
  213 + params.versions = '1';
  214 + map.lineInfoPanl(lineNameV,directionData,function(BusLine){
  215 + // 如果线路信息不为空
  216 + if(BusLine && Polygon){
  217 + // 获取公交线几何对象, 仅当结果自动添加到地图上时有效
  218 + var Polygon = BusLine.getPolyline();
  219 + // 返回多边型的点数组(自1.2新增)
  220 + var polyGonArray = Polygon.getPath();
  221 + var jsonArray = [{sectionName:lineNameV+dirStr,points:polyGonArray}];
  222 + // 定义路段信息字符串
  223 + var sectionJSON = JSON.stringify(jsonArray);
  224 + // 路段信息JSON字符串
  225 + // if(sectionJSON != null && sectionJSON != "") {
  226 + params.sectionJSON = sectionJSON;
  227 + addSave(params,addLine.id,directionData);
  228 + /* } else {
  229 + layer.msg('百度地图上没有此线路的相应路段,请更换方式规划!!!');
  230 + } */
  231 + }else {
  232 + // 根据坐标点获取两点之间的折线路段
  233 + map.getSectionListPlonly(stationdataList,function(sectiondata) {
  234 + // 定义路段信息字符串
  235 + var sectionJSON = JSON.stringify(sectiondata);
  236 + // 路段信息JSON字符串
  237 + //if(sectionJSON != null && sectionJSON != "") {
  238 + params.sectionJSON = sectionJSON;
  239 + addSave(params,addLine.id,directionData);
  240 + /* } else {
  241 + layer.msg('无法生成路段,请重试!');
  242 + return;
  243 + } */
  244 + });
  245 + }
  246 + });
  247 +
  248 + });
  249 +
  250 + });
  251 +
  252 + }
  253 +
  254 + });
  255 +
  256 + function inputStationValueFormat(paramsStationsArray) {
  257 + var stationList = [];
  258 + var len = paramsStationsArray.length;
  259 + for(var k =0;k<len;k++) {
  260 + if(paramsStationsArray[k]=="")
  261 + continue;
  262 + var tempStr = paramsStationsArray[k].split('\t');
  263 + if(tempStr.length<2){
  264 + stationList.push({name:paramsStationsArray[k]+"公交车站",wgs:{x:'',y:''}});
  265 + }else {
  266 + stationList.push({name:tempStr[0]+"公交车站",wgs:{x:tempStr[1], y:tempStr[2]}});
  267 + }
  268 + }
  269 + return stationList;
  270 + }
  271 +
  272 + function addSave(params,lineid,directionData) {
  273 +
  274 +
  275 + var version = $("#versions").val();
  276 + params.versions = version;
  277 + // 保存
  278 + ajaxd.manualSave(params,function(rd) {
  279 + // 关闭弹出层
  280 + layer.closeAll();
  281 + if(rd.status='SUCCESS') {
  282 + layer.msg('保存成功!');
  283 + var stationD = rd.stationData,isNullStr = '';
  284 + for(var t = 0 ;t<stationD.length;t++) {
  285 + if(stationD[t].potion.lat =='' || stationD[t].potion.lat ==null ||
  286 + stationD[t].potion.lng =='' || stationD[t].potion.lng ==null)
  287 + isNullStr = isNullStr + stationD[t].name + ' , ';
  288 + }
  289 + if(isNullStr!='') {
  290 + layer.open({
  291 + title: '提示',
  292 + content:'【' + isNullStr + '】' + '地址系统无法解析!,请手动调整位置!'
  293 + });
  294 + }
  295 + }else {
  296 + layer.msg('保存失败!');
  297 + }
  298 + // 清除地图覆盖物
  299 + map.clearMarkAndOverlays();
  300 + // 刷新树
  301 + fun.resjtreeDate(lineid,directionData,version);
  302 +
  303 +
  304 + //PublicFunctions.resjtreeDate(lineid,directionData,version);
  305 + // 查询上行路段信息
  306 + //ajaxd.getSectionRouteInfo(lineid,directionData,version,function(data) {
  307 + // // 在地图上画出线路走向
  308 + // fun.linePanlThree(lineid,data,directionData,version);
  309 + //});
  310 + });
  311 + }
  312 +});
313 313 </script>
314 314 \ No newline at end of file
... ...