Commit ecf5f1e8a8d5f2f3a4ecf15eb372b579a2f4ccdc
Merge branch 'master' of 192.168.168.201:panzhaov5/bsth_control
Showing
34 changed files
with
1961 additions
and
1070 deletions
pom.xml
| ... | ... | @@ -108,6 +108,11 @@ |
| 108 | 108 | <artifactId>commons-net</artifactId> |
| 109 | 109 | <version>3.5</version> |
| 110 | 110 | </dependency> |
| 111 | + <dependency> | |
| 112 | + <groupId>org.apache.commons</groupId> | |
| 113 | + <artifactId>commons-compress</artifactId> | |
| 114 | + <version>1.3</version> | |
| 115 | + </dependency> | |
| 111 | 116 | <!-- drools 6依赖 --> |
| 112 | 117 | <dependency> |
| 113 | 118 | <groupId>org.kie</groupId> |
| ... | ... | @@ -230,4 +235,4 @@ |
| 230 | 235 | <url>http://repo.spring.io/milestone</url> |
| 231 | 236 | </pluginRepository> |
| 232 | 237 | </pluginRepositories> |
| 233 | -</project> | |
| 234 | 238 | \ No newline at end of file |
| 239 | +</project> | ... | ... |
src/main/java/com/bsth/controller/CarParkController.java
| ... | ... | @@ -29,6 +29,22 @@ public class CarParkController extends BaseController<CarPark, Integer> { |
| 29 | 29 | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * 新增停车场信息 | |
| 35 | + * | |
| 36 | + * | |
| 37 | + * @param map<area:面积;bCenterPoint:中心点百度坐标;bParkPoint:多边形图形百度坐标点集合; | |
| 38 | + * | |
| 39 | + * brancheCompany:分公司;company:公司;createBy:创建人;createDate:创建日期;dbType:原坐标类型;descriptions:描述; | |
| 40 | + * | |
| 41 | + * destroy:是否撤销;gCenterPoint:WGS中心点坐标;gParkPoint:WGS多边形图形坐标集合;id:停车场ID;parkCode:停车场编码; | |
| 42 | + * | |
| 43 | + * parkName:停车名称;radius:圆半径;shapesType:图形类型;versions:版本号> | |
| 44 | + * | |
| 45 | + * @return map <SUCCESS:成功;ERROR:失败> | |
| 46 | + * | |
| 47 | + */ | |
| 32 | 48 | @RequestMapping(value="carParkSave" , method = RequestMethod.POST) |
| 33 | 49 | public Map<String, Object> stationSave(@RequestParam Map<String, Object> map) { |
| 34 | 50 | |
| ... | ... | @@ -46,6 +62,21 @@ public class CarParkController extends BaseController<CarPark, Integer> { |
| 46 | 62 | return service.findCarParkInfoFormId(map); |
| 47 | 63 | } |
| 48 | 64 | |
| 65 | + /** | |
| 66 | + * 修改停车场信息 | |
| 67 | + * | |
| 68 | + * | |
| 69 | + * @param map<area:面积;bCenterPoint:中心点百度坐标;bParkPoint:多边形图形百度坐标点集合; | |
| 70 | + * | |
| 71 | + * brancheCompany:分公司;company:公司;createBy:创建人;createDate:创建日期;dbType:原坐标类型;descriptions:描述; | |
| 72 | + * | |
| 73 | + * destroy:是否撤销;gCenterPoint:WGS中心点坐标;gParkPoint:WGS多边形图形坐标集合;id:停车场ID;parkCode:停车场编码; | |
| 74 | + * | |
| 75 | + * parkName:停车名称;radius:圆半径;shapesType:图形类型;versions:版本号> | |
| 76 | + * | |
| 77 | + * @return map <SUCCESS:成功;ERROR:失败> | |
| 78 | + * | |
| 79 | + */ | |
| 49 | 80 | @RequestMapping(value="carParkUpdate" , method = RequestMethod.POST) |
| 50 | 81 | public Map<String, Object> carParkUpdate(@RequestParam Map<String, Object> map) { |
| 51 | 82 | ... | ... |
src/main/java/com/bsth/repository/CarParkRepository.java
| ... | ... | @@ -76,11 +76,11 @@ public interface CarParkRepository extends BaseRepository<CarPark, Integer>{ |
| 76 | 76 | "park_name = ?4 , " + |
| 77 | 77 | "branche_company = ?5 , " + |
| 78 | 78 | "create_by = ?6 , " + |
| 79 | - "create_date = ?7 , " + | |
| 79 | + "create_date = str_to_date(?7,'%Y-%m-%d %H:%i:%s') , " + | |
| 80 | 80 | "descriptions = ?8 , " + |
| 81 | 81 | "destroy = ?9 , " + |
| 82 | 82 | "update_by = ?10 , " + |
| 83 | - "update_date = ?11 , " + | |
| 83 | + "update_date =str_to_date(?11,'%Y-%m-%d %H:%i:%s') , " + | |
| 84 | 84 | "versions = ?12 , " + |
| 85 | 85 | "b_center_point = ?13 , " + |
| 86 | 86 | "g_center_point = ?14 , " + | ... | ... |
src/main/java/com/bsth/service/CarParkService.java
| ... | ... | @@ -11,6 +11,22 @@ public interface CarParkService extends BaseService<CarPark, Integer> { |
| 11 | 11 | |
| 12 | 12 | List<Map<String, Object>> findCarParkInfoFormId(Map<String, Object> map); |
| 13 | 13 | |
| 14 | + | |
| 15 | + /** | |
| 16 | + * 修改停车场信息 | |
| 17 | + * | |
| 18 | + * | |
| 19 | + * @param map<area:面积;bCenterPoint:中心点百度坐标;bParkPoint:多边形图形百度坐标点集合; | |
| 20 | + * | |
| 21 | + * brancheCompany:分公司;company:公司;createBy:创建人;createDate:创建日期;dbType:原坐标类型;descriptions:描述; | |
| 22 | + * | |
| 23 | + * destroy:是否撤销;gCenterPoint:WGS中心点坐标;gParkPoint:WGS多边形图形坐标集合;id:停车场ID;parkCode:停车场编码; | |
| 24 | + * | |
| 25 | + * parkName:停车名称;radius:圆半径;shapesType:图形类型;versions:版本号> | |
| 26 | + * | |
| 27 | + * @return map <SUCCESS:成功;ERROR:失败> | |
| 28 | + * | |
| 29 | + */ | |
| 14 | 30 | Map<String, Object> carParkUpdate(Map<String, Object> map); |
| 15 | 31 | |
| 16 | 32 | } | ... | ... |
src/main/java/com/bsth/service/impl/CarParkServiceImpl.java
| ... | ... | @@ -11,6 +11,8 @@ import com.bsth.common.ResponseCode; |
| 11 | 11 | import com.bsth.entity.CarPark; |
| 12 | 12 | import com.bsth.repository.CarParkRepository; |
| 13 | 13 | import com.bsth.service.CarParkService; |
| 14 | +import com.bsth.util.TransGPS; | |
| 15 | +import com.bsth.util.TransGPS.Location; | |
| 14 | 16 | |
| 15 | 17 | import org.springframework.beans.factory.annotation.Autowired; |
| 16 | 18 | import org.springframework.stereotype.Service; |
| ... | ... | @@ -42,13 +44,64 @@ public class CarParkServiceImpl extends BaseServiceImpl<CarPark, Integer> implem |
| 42 | 44 | String bParkPoint = map.get("bParkPoint").equals("") ? "" : map.get("bParkPoint").toString(); |
| 43 | 45 | |
| 44 | 46 | // 地理位置(WGS坐标集合) |
| 45 | - String gParkPoint = map.get("gParkPoint").equals("") ? "" :map.get("gParkPoint").toString(); | |
| 47 | + // String gParkPoint = map.get("gParkPoint").equals("") ? "" :map.get("gParkPoint").toString(); | |
| 48 | + | |
| 49 | + // 多边形WGS坐标点集合 | |
| 50 | + String gParkPoint =""; | |
| 51 | + | |
| 52 | + if(!bParkPoint.equals("")) { | |
| 53 | + | |
| 54 | + String bPloygonGridArray[] = bParkPoint.split(","); | |
| 55 | + | |
| 56 | + int bLen_ = bPloygonGridArray.length; | |
| 57 | + | |
| 58 | + for(int b = 0 ;b<bLen_;b++) { | |
| 59 | + | |
| 60 | + String tempArray[]= bPloygonGridArray[b].split(" "); | |
| 61 | + | |
| 62 | + Location resultPoint = FromBDPointToWGSPoint(tempArray[0],tempArray[1]); | |
| 63 | + | |
| 64 | + if(b==0) { | |
| 65 | + | |
| 66 | + gParkPoint = resultPoint.getLng() + " " + resultPoint.getLat(); | |
| 67 | + | |
| 68 | + }else { | |
| 69 | + | |
| 70 | + gParkPoint = gParkPoint + ',' + resultPoint.getLng() + " " + resultPoint.getLat(); | |
| 71 | + | |
| 72 | + } | |
| 73 | + | |
| 74 | + } | |
| 75 | + | |
| 76 | + } | |
| 77 | + | |
| 78 | + bParkPoint = "POLYGON((" + bParkPoint +"))"; | |
| 79 | + | |
| 80 | + gParkPoint = "POLYGON((" + gParkPoint +"))"; | |
| 46 | 81 | |
| 47 | 82 | // 地理位置中心点(百度坐标) |
| 48 | 83 | String bCenterPoint = map.get("bCenterPoint").equals("") ? "" : map.get("bCenterPoint").toString(); |
| 49 | 84 | |
| 50 | 85 | // 地理位置中心点(WGS坐标) |
| 51 | - String gCenterPoint = map.get("gCenterPoint").equals("") ? "" : map.get("gCenterPoint").toString(); | |
| 86 | + // String gCenterPoint = map.get("gCenterPoint").equals("") ? "" : map.get("gCenterPoint").toString(); | |
| 87 | + | |
| 88 | + String bJwpointsArray[] =null; | |
| 89 | + | |
| 90 | + if(bCenterPoint!=null) { | |
| 91 | + | |
| 92 | + bJwpointsArray = bCenterPoint.split(" "); | |
| 93 | + | |
| 94 | + } | |
| 95 | + | |
| 96 | + String gCenterPoint = ""; | |
| 97 | + | |
| 98 | + if(bJwpointsArray.length>0) { | |
| 99 | + | |
| 100 | + Location resultPoint = FromBDPointToWGSPoint(bJwpointsArray[0],bJwpointsArray[1]); | |
| 101 | + | |
| 102 | + gCenterPoint = String.valueOf(resultPoint.getLng()) + " " + String.valueOf(resultPoint.getLat()); | |
| 103 | + | |
| 104 | + } | |
| 52 | 105 | |
| 53 | 106 | // 坐标类型 |
| 54 | 107 | String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString(); |
| ... | ... | @@ -179,7 +232,22 @@ public class CarParkServiceImpl extends BaseServiceImpl<CarPark, Integer> implem |
| 179 | 232 | |
| 180 | 233 | return resultList; |
| 181 | 234 | } |
| 182 | - | |
| 235 | + | |
| 236 | + /** | |
| 237 | + * 修改停车场信息 | |
| 238 | + * | |
| 239 | + * | |
| 240 | + * @param map<area:面积;bCenterPoint:中心点百度坐标;bParkPoint:多边形图形百度坐标点集合; | |
| 241 | + * | |
| 242 | + * brancheCompany:分公司;company:公司;createBy:创建人;createDate:创建日期;dbType:原坐标类型;descriptions:描述; | |
| 243 | + * | |
| 244 | + * destroy:是否撤销;gCenterPoint:WGS中心点坐标;gParkPoint:WGS多边形图形坐标集合;id:停车场ID;parkCode:停车场编码; | |
| 245 | + * | |
| 246 | + * parkName:停车名称;radius:圆半径;shapesType:图形类型;versions:版本号> | |
| 247 | + * | |
| 248 | + * @return map <SUCCESS:成功;ERROR:失败> | |
| 249 | + * | |
| 250 | + */ | |
| 183 | 251 | @Override |
| 184 | 252 | public Map<String, Object> carParkUpdate(Map<String, Object> map) { |
| 185 | 253 | Map<String, Object> resultMap = new HashMap<String, Object>(); |
| ... | ... | @@ -216,10 +284,61 @@ public class CarParkServiceImpl extends BaseServiceImpl<CarPark, Integer> implem |
| 216 | 284 | Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString()); |
| 217 | 285 | |
| 218 | 286 | // 中心点(WGS坐标) |
| 219 | - String gCenterPoint = map.get("gCenterPoint").equals("") ? "" : map.get("gCenterPoint").toString(); | |
| 287 | + // String gCenterPoint = map.get("gCenterPoint").equals("") ? "" : map.get("gCenterPoint").toString(); | |
| 288 | + | |
| 289 | + String bJwpointsArray[] =null; | |
| 290 | + | |
| 291 | + if(bCenterPoint!=null) { | |
| 292 | + | |
| 293 | + bJwpointsArray = bCenterPoint.split(" "); | |
| 294 | + | |
| 295 | + } | |
| 296 | + | |
| 297 | + String gCenterPoint = ""; | |
| 298 | + | |
| 299 | + if(bJwpointsArray.length>0) { | |
| 300 | + | |
| 301 | + Location resultPoint = FromBDPointToWGSPoint(bJwpointsArray[0],bJwpointsArray[1]); | |
| 302 | + | |
| 303 | + gCenterPoint = String.valueOf(resultPoint.getLng()) + " " + String.valueOf(resultPoint.getLat()); | |
| 304 | + | |
| 305 | + } | |
| 220 | 306 | |
| 221 | 307 | // 图形坐标点集合(WGS坐标) |
| 222 | - String gParkPoint = map.get("gParkPoint").equals("") ? "" : map.get("gParkPoint").toString(); | |
| 308 | + // String gParkPoint = map.get("gParkPoint").equals("") ? "" : map.get("gParkPoint").toString(); | |
| 309 | + | |
| 310 | + // 多边形WGS坐标点集合 | |
| 311 | + String gParkPoint =""; | |
| 312 | + | |
| 313 | + if(!bParkPoint.equals("")) { | |
| 314 | + | |
| 315 | + String bPloygonGridArray[] = bParkPoint.split(","); | |
| 316 | + | |
| 317 | + int bLen_ = bPloygonGridArray.length; | |
| 318 | + | |
| 319 | + for(int b = 0 ;b<bLen_;b++) { | |
| 320 | + | |
| 321 | + String tempArray[]= bPloygonGridArray[b].split(" "); | |
| 322 | + | |
| 323 | + Location resultPoint = FromBDPointToWGSPoint(tempArray[0],tempArray[1]); | |
| 324 | + | |
| 325 | + if(b==0) { | |
| 326 | + | |
| 327 | + gParkPoint = resultPoint.getLng() + " " + resultPoint.getLat(); | |
| 328 | + | |
| 329 | + }else { | |
| 330 | + | |
| 331 | + gParkPoint = gParkPoint + ',' + resultPoint.getLng() + " " + resultPoint.getLat(); | |
| 332 | + | |
| 333 | + } | |
| 334 | + | |
| 335 | + } | |
| 336 | + | |
| 337 | + } | |
| 338 | + | |
| 339 | + bParkPoint = "POLYGON((" + bParkPoint +"))"; | |
| 340 | + | |
| 341 | + gParkPoint = "POLYGON((" + gParkPoint +"))"; | |
| 223 | 342 | |
| 224 | 343 | // 编码 |
| 225 | 344 | String parkCode = map.get("parkCode").equals("") ? "" : map.get("parkCode").toString(); |
| ... | ... | @@ -267,5 +386,22 @@ public class CarParkServiceImpl extends BaseServiceImpl<CarPark, Integer> implem |
| 267 | 386 | |
| 268 | 387 | return resultMap; |
| 269 | 388 | } |
| 389 | + | |
| 390 | + /** 百度坐标转WGS坐标 */ | |
| 391 | + public Location FromBDPointToWGSPoint(String bLonx,String bLatx) { | |
| 392 | + | |
| 393 | + double lng = Double.parseDouble(bLonx); | |
| 394 | + | |
| 395 | + double lat = Double.parseDouble(bLatx); | |
| 396 | + | |
| 397 | + Location bdLoc = TransGPS.LocationMake(lng, lat); | |
| 398 | + | |
| 399 | + Location location = TransGPS.bd_decrypt(bdLoc); | |
| 400 | + | |
| 401 | + Location WGSPoint = TransGPS.transformFromGCJToWGS(location); | |
| 402 | + | |
| 403 | + return WGSPoint; | |
| 404 | + | |
| 405 | + } | |
| 270 | 406 | |
| 271 | 407 | } | ... | ... |
src/main/java/com/bsth/util/Test.java
0 → 100644
| 1 | +package com.bsth.util; | |
| 2 | + | |
| 3 | +import java.io.File; | |
| 4 | +import java.io.FileInputStream; | |
| 5 | +import java.io.FileNotFoundException; | |
| 6 | +import java.io.FileOutputStream; | |
| 7 | +import java.io.IOException; | |
| 8 | +import java.util.zip.GZIPOutputStream; | |
| 9 | + | |
| 10 | +import org.apache.commons.compress.archivers.tar.TarArchiveEntry; | |
| 11 | +import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream; | |
| 12 | +import org.apache.commons.compress.utils.IOUtils; | |
| 13 | + | |
| 14 | +public class Test { | |
| 15 | + | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * | |
| 19 | + * @Title: pack | |
| 20 | + * @Description: 将一组文件打成tar包 | |
| 21 | + * @param sources 要打包的原文件数组 | |
| 22 | + * @param target 打包后的文件 | |
| 23 | + * @return File 返回打包后的文件 | |
| 24 | + * @throws | |
| 25 | + */ | |
| 26 | + public static File pack(File[] sources, File target){ | |
| 27 | + FileOutputStream out = null; | |
| 28 | + try { | |
| 29 | + out = new FileOutputStream(target); | |
| 30 | + } catch (FileNotFoundException e1) { | |
| 31 | + e1.printStackTrace(); | |
| 32 | + } | |
| 33 | + TarArchiveOutputStream os = new TarArchiveOutputStream(out); | |
| 34 | + for (File file : sources) { | |
| 35 | + try { | |
| 36 | + os.putArchiveEntry(new TarArchiveEntry(file)); | |
| 37 | + IOUtils.copy(new FileInputStream(file), os); | |
| 38 | + os.closeArchiveEntry(); | |
| 39 | + | |
| 40 | + } catch (FileNotFoundException e) { | |
| 41 | + e.printStackTrace(); | |
| 42 | + } catch (IOException e) { | |
| 43 | + e.printStackTrace(); | |
| 44 | + } | |
| 45 | + } | |
| 46 | + if(os != null) { | |
| 47 | + try { | |
| 48 | + os.flush(); | |
| 49 | + os.close(); | |
| 50 | + } catch (IOException e) { | |
| 51 | + e.printStackTrace(); | |
| 52 | + } | |
| 53 | + } | |
| 54 | + | |
| 55 | + return target; | |
| 56 | + } | |
| 57 | + | |
| 58 | + /** | |
| 59 | + * | |
| 60 | + * @Title: compress | |
| 61 | + * @Description: 将文件用gzip压缩 | |
| 62 | + * @param source 需要压缩的文件 | |
| 63 | + * @return File 返回压缩后的文件 | |
| 64 | + * @throws | |
| 65 | + */ | |
| 66 | + public static File compress(File source) { | |
| 67 | + File target = new File(source.getName() + ".gz"); | |
| 68 | + FileInputStream in = null; | |
| 69 | + GZIPOutputStream out = null; | |
| 70 | + try { | |
| 71 | + in = new FileInputStream(source); | |
| 72 | + out = new GZIPOutputStream(new FileOutputStream(target)); | |
| 73 | + byte[] array = new byte[1024]; | |
| 74 | + int number = -1; | |
| 75 | + while((number = in.read(array, 0, array.length)) != -1) { | |
| 76 | + out.write(array, 0, number); | |
| 77 | + } | |
| 78 | + } catch (FileNotFoundException e) { | |
| 79 | + e.printStackTrace(); | |
| 80 | + return null; | |
| 81 | + } catch (IOException e) { | |
| 82 | + e.printStackTrace(); | |
| 83 | + return null; | |
| 84 | + } finally { | |
| 85 | + if(in != null) { | |
| 86 | + try { | |
| 87 | + in.close(); | |
| 88 | + } catch (IOException e) { | |
| 89 | + e.printStackTrace(); | |
| 90 | + return null; | |
| 91 | + } | |
| 92 | + } | |
| 93 | + | |
| 94 | + if(out != null) { | |
| 95 | + try { | |
| 96 | + out.close(); | |
| 97 | + } catch (IOException e) { | |
| 98 | + e.printStackTrace(); | |
| 99 | + return null; | |
| 100 | + } | |
| 101 | + } | |
| 102 | + } | |
| 103 | + return target; | |
| 104 | + } | |
| 105 | + | |
| 106 | + public static void main(String[] args) { | |
| 107 | + File[] sources = new File[] {new File("D:/test.txt"), new File("D:/test1.txt")}; | |
| 108 | + File target = new File("release_package.tar"); | |
| 109 | + File gzFile = compress(pack(sources, target)); | |
| 110 | + } | |
| 111 | +} | ... | ... |
src/main/resources/application.properties
| ... | ... | @@ -10,8 +10,11 @@ spring.jpa.database= MYSQL |
| 10 | 10 | spring.jpa.show-sql= true |
| 11 | 11 | spring.datasource.driver-class-name= com.mysql.jdbc.Driver |
| 12 | 12 | spring.datasource.url= jdbc:mysql://192.168.168.201:3306/control |
| 13 | +#spring.datasource.url= jdbc:mysql://192.168.168.201:3306/test | |
| 14 | +#spring.datasource.url= jdbc:mysql://localhost:3306/test | |
| 13 | 15 | spring.datasource.username= root |
| 14 | 16 | spring.datasource.password= 123456 |
| 17 | +#spring.datasource.password= | |
| 15 | 18 | |
| 16 | 19 | #DATASOURCE |
| 17 | 20 | spring.datasource.max-active=100 | ... | ... |
src/main/resources/static/pages/base/carpark/add.html
| ... | ... | @@ -20,6 +20,12 @@ |
| 20 | 20 | <span class="step-title"> 1 - 4 </span> |
| 21 | 21 | </span> |
| 22 | 22 | </div> |
| 23 | + | |
| 24 | + <div class="actions"> | |
| 25 | + <div class="btn-group btn-group-devided" data-toggle="buttons"> | |
| 26 | + <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> | |
| 27 | + </div> | |
| 28 | + </div> | |
| 23 | 29 | </div> |
| 24 | 30 | <div class="portlet-body form"> |
| 25 | 31 | |
| ... | ... | @@ -104,7 +110,7 @@ |
| 104 | 110 | <div class="form-group"> |
| 105 | 111 | <div class="alert alert-info font-blue-chambray" style="background-color: #2C3E50"> |
| 106 | 112 | <h5 class="block"><span class="help-block" style="color:#1bbc9b;"> * 新增方式说明: </span></h5> |
| 107 | - <p><span class="help-block" style="color:#1bbc9b;"> a)系统生成:根据站点名称自动生成以150米为半径范围的圆.</span> </p> | |
| 113 | + <p><span class="help-block" style="color:#1bbc9b;"> a)系统生成:根据站点名称自动生成以100米为半径范围的圆.</span> </p> | |
| 108 | 114 | <p><span class="help-block" style="color:#1bbc9b;"> b)手动添加:手动在地图上画出站点范围,然后双击鼠标右键保存.</span> </p> |
| 109 | 115 | </div> |
| 110 | 116 | </div> |
| ... | ... | @@ -180,16 +186,6 @@ |
| 180 | 186 | </div> |
| 181 | 187 | </div> |
| 182 | 188 | |
| 183 | - <!-- 站点WGS经纬度 --> | |
| 184 | - <div class="form-body"> | |
| 185 | - <div class="form-group"> | |
| 186 | - <label class="col-md-3 control-label">站点WGS经纬度:</label> | |
| 187 | - <div class="col-md-6"> | |
| 188 | - <input type="text" class="form-control" name="gCenterPoint" id="gCenterPointInput"> | |
| 189 | - </div> | |
| 190 | - </div> | |
| 191 | - </div> | |
| 192 | - | |
| 193 | 189 | <!-- 范围图形类型 --> |
| 194 | 190 | <div class="form-body"> |
| 195 | 191 | <div class="form-group"> |
| ... | ... | @@ -402,137 +398,18 @@ |
| 402 | 398 | |
| 403 | 399 | </div> |
| 404 | 400 | </div> |
| 401 | + | |
| 402 | +<!-- 函数方法JS类库 --> | |
| 405 | 403 | <script src="/pages/base/carpark/js/add-input-function.js"></script> |
| 404 | + | |
| 405 | +<!-- 表单向导JS类库 --> | |
| 406 | 406 | <script src="/pages/base/carpark/js/add-form-wizard.js"></script> |
| 407 | + | |
| 408 | +<!-- 地图JS类库 --> | |
| 407 | 409 | <script src="/pages/base/carpark/js/add-vmap-world.js"></script> |
| 408 | -<script type="text/javascript"> | |
| 409 | - | |
| 410 | - var mapB = ''; | |
| 411 | - | |
| 412 | - var circle = ''; | |
| 413 | - | |
| 414 | - var drawingManager = ''; | |
| 415 | - | |
| 416 | - // 定义表单 | |
| 417 | - var form = $('#submit_carpark_form'); | |
| 418 | - | |
| 419 | - // 定义表单异常 | |
| 420 | - var error = $('.alert-danger',form); | |
| 421 | - | |
| 422 | - // 定义表单成功 | |
| 423 | - var success = $('.alert-success',form); | |
| 424 | - | |
| 425 | - $(document).ready(function() { | |
| 426 | - | |
| 427 | - // 关闭左侧栏 | |
| 428 | - if (!$('body').hasClass('page-sidebar-closed')) { | |
| 429 | - | |
| 430 | - $('.menu-toggler.sidebar-toggler').click(); | |
| 431 | - | |
| 432 | - } | |
| 433 | - | |
| 434 | - setTimeout(function(){ | |
| 435 | - | |
| 436 | - FormWizard.init(); | |
| 437 | - | |
| 438 | - mapB = VmapWorlds.init(); | |
| 439 | - | |
| 440 | - PublicFunctions.getCarParkCode(function(carParkCode) { | |
| 441 | - | |
| 442 | - $('#parkCodeInput').val(carParkCode); | |
| 443 | - | |
| 444 | - }); | |
| 445 | - | |
| 446 | - $('#destroySelect').val('0'); | |
| 447 | - | |
| 448 | - PublicFunctions.getBusinessAllInfo(function(array) { | |
| 449 | - | |
| 450 | - var opGroup = '<option value="">请选择...</option><optgroup label="公司">'; | |
| 451 | - | |
| 452 | - var len_ = array.length; | |
| 453 | - | |
| 454 | - if(len_>0) { | |
| 455 | - | |
| 456 | - $.each(array, function(i, g){ | |
| 457 | - | |
| 458 | - opGroup += '<option value="'+g.businessCode+'">'+g.businessName+'</option>'; | |
| 459 | - | |
| 460 | - }); | |
| 461 | - | |
| 462 | - } | |
| 463 | - | |
| 464 | - opGroup += '</optgroup>'; | |
| 465 | - | |
| 466 | - $('#companySelect').html(opGroup).select2(); | |
| 467 | - | |
| 468 | - }); | |
| 469 | - | |
| 470 | - var htm = '<option value="">请选择...</option><optgroup label="公司">'; | |
| 471 | - | |
| 472 | - $('#brancheCompanySelect').html(htm).select2(); | |
| 473 | - | |
| 474 | - $('#companySelect').on("change", function (e) { | |
| 475 | - | |
| 476 | - // 获取公司下拉框选择值 | |
| 477 | - var businessCode = $('#companySelect').val(); | |
| 478 | - | |
| 479 | - // 分公司下拉框options属性值 | |
| 480 | - var options = '<option value="">请选择...</option><optgroup label="分公司">'; | |
| 481 | - | |
| 482 | - // 如果公司选择为空则分公司为空 ; 否则查询出所属公司下的分公司名称和相应分公司代码 | |
| 483 | - if(businessCode == null || businessCode ==''){ | |
| 484 | - | |
| 485 | - options += '</optgroup>'; | |
| 486 | - | |
| 487 | - // 填充分公司下拉框options | |
| 488 | - $('#brancheCompanySelect').html(options).select2(); | |
| 489 | - | |
| 490 | - } else { | |
| 491 | - | |
| 492 | - // 查询出所属公司下的分公司名称和相应分公司代码 | |
| 493 | - $get('/business/all', {upCode_eq: businessCode}, function(array){ | |
| 494 | - | |
| 495 | - // 遍历array | |
| 496 | - $.each(array, function(i,d){ | |
| 497 | - | |
| 498 | - options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>'; | |
| 499 | - | |
| 500 | - options += '</optgroup>'; | |
| 501 | - | |
| 502 | - }); | |
| 503 | - | |
| 504 | - // 填充分公司下拉框options | |
| 505 | - $('#brancheCompanySelect').html(options).select2(); | |
| 506 | - | |
| 507 | - }); | |
| 508 | - } | |
| 509 | - | |
| 510 | - }); | |
| 511 | - | |
| 512 | - | |
| 513 | - }, 500); | |
| 514 | - | |
| 515 | - }); | |
| 516 | - | |
| 517 | - // 提交 | |
| 518 | - $('.button-submit').on('click',function() { | |
| 519 | - | |
| 520 | - form.submit(); | |
| 521 | - | |
| 522 | - }); | |
| 523 | - | |
| 524 | - $('#oppenDrawingManager').on('click',function() { | |
| 525 | - | |
| 526 | - drawingManager.open(); | |
| 527 | - | |
| 528 | - // 设置属性 | |
| 529 | - drawingManager.setDrawingMode(BMAP_DRAWING_POLYGON); | |
| 530 | - | |
| 531 | - }); | |
| 532 | - | |
| 533 | - $('#closeDrawingManager').on('click',function() { | |
| 534 | - | |
| 535 | - drawingManager.close(); | |
| 536 | - }); | |
| 537 | - | |
| 538 | -</script> | |
| 539 | 410 | \ No newline at end of file |
| 411 | + | |
| 412 | +<!-- 表单元素事件JS类库 --> | |
| 413 | +<script src="/pages/base/carpark/js/add-form-events.js"></script> | |
| 414 | + | |
| 415 | +<!-- reload事件 --> | |
| 416 | +<script src="/pages/base/carpark/js/add-form-reload.js"></script> | |
| 540 | 417 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/carpark/edit.html
| 1 | 1 | <!-- 编辑停车场 --> |
| 2 | -<div class="modal fade" id="edit_carPark_mobal" tabindex="-1" role="basic" aria-hidden="true"> | |
| 2 | +<div class="modal fade" id="editPoitsions_carpark_mobal" tabindex="-1" role="basic" aria-hidden="true"> | |
| 3 | 3 | |
| 4 | 4 | <div class="modal-dialog"> |
| 5 | 5 | |
| ... | ... | @@ -60,16 +60,6 @@ |
| 60 | 60 | </div> |
| 61 | 61 | </div> |
| 62 | 62 | |
| 63 | - <!-- 站点WGS经纬度 --> | |
| 64 | - <div class="form-body"> | |
| 65 | - <div class="form-group"> | |
| 66 | - <label class="col-md-3 control-label">站点WGS经纬度:</label> | |
| 67 | - <div class="col-md-6"> | |
| 68 | - <input type="text" class="form-control" name="gCenterPoint" id="gCenterPointInput"> | |
| 69 | - </div> | |
| 70 | - </div> | |
| 71 | - </div> | |
| 72 | - | |
| 73 | 63 | <!-- 范围图形类型 --> |
| 74 | 64 | <div class="form-body"> |
| 75 | 65 | <div class="form-group"> |
| ... | ... | @@ -169,20 +159,32 @@ |
| 169 | 159 | </div> |
| 170 | 160 | </div> |
| 171 | 161 | <script type="text/javascript"> |
| 172 | - | |
| 173 | -$(function(){ | |
| 162 | + | |
| 163 | +$('#editPoitsions_carpark_mobal').on('editCarParkMobal_show', function(e, map,fun,carP,ajaxd){ | |
| 164 | + | |
| 165 | + /** 获取停车场信息对象 */ | |
| 166 | + var CarParkObj = carP.getEitdCarPark(); | |
| 174 | 167 | |
| 175 | - PublicFunctions.setFormValue(); | |
| 168 | + // 获取修改停车场对象ID | |
| 169 | + var carParkId = CarParkObj.carParkId; | |
| 176 | 170 | |
| 177 | - PublicFunctions.selectTemp(function() { | |
| 171 | + /** 根据修改停车场对象属性值 设值表单元素 @paran:<CarParkObj:停车场对象>*/ | |
| 172 | + fun.setFormValue(CarParkObj); | |
| 173 | + | |
| 174 | + /** 填充公司下拉框 */ | |
| 175 | + fun.selectTemp(function() { | |
| 178 | 176 | |
| 179 | - var businessCode = carParkObj[0].carParkCompany; | |
| 177 | + // 获取公司代码 | |
| 178 | + var businessCode = CarParkObj.carParkCompany; | |
| 180 | 179 | |
| 180 | + // 获取公司元素并设值 | |
| 181 | 181 | $('#companySelect').val(businessCode); |
| 182 | 182 | |
| 183 | - PublicFunctions.getbrancheCompanyValues(businessCode,function() { | |
| 183 | + /** 填充分公司下拉框 @param:<businessCode:公司代码> */ | |
| 184 | + fun.getbrancheCompanyValues(businessCode,function() { | |
| 184 | 185 | |
| 185 | - $('#brancheCompanySelect').val(carParkObj[0].carParkBrancheCompany); | |
| 186 | + // 获取分公司元素并设值 | |
| 187 | + $('#brancheCompanySelect').val(CarParkObj.carParkBrancheCompany); | |
| 186 | 188 | |
| 187 | 189 | }); |
| 188 | 190 | |
| ... | ... | @@ -225,19 +227,24 @@ $(function(){ |
| 225 | 227 | } |
| 226 | 228 | |
| 227 | 229 | // 显示mobal |
| 228 | - $('#edit_carPark_mobal').modal({show : true,backdrop: 'static',keyboard: false}); | |
| 230 | + $('#editPoitsions_carpark_mobal').modal({show : true,backdrop: 'static',keyboard: false}); | |
| 229 | 231 | |
| 230 | 232 | // 当调用 hide 实例方法时触发 |
| 231 | - $('#edit_carPark_mobal').on('hide.bs.modal', function () { | |
| 233 | + $('#editPoitsions_carpark_mobal').on('hide.bs.modal', function () { | |
| 234 | + | |
| 235 | + clearSechear(); | |
| 232 | 236 | |
| 233 | - // 清楚地图覆盖物 | |
| 234 | - mapB.clearOverlays(); | |
| 235 | - | |
| 236 | - carParkObj=''; | |
| 237 | - | |
| 238 | - PublicFunctions.initCarPark(); | |
| 239 | 237 | }); |
| 240 | 238 | |
| 239 | + function clearSechear(){ | |
| 240 | + | |
| 241 | + map.clearMarkAndOverlays(); | |
| 242 | + | |
| 243 | + carP.setEitdCarPark({}); | |
| 244 | + | |
| 245 | + fun.initCarPark(carParkId); | |
| 246 | + | |
| 247 | + } | |
| 241 | 248 | |
| 242 | 249 | // 编辑表单元素 |
| 243 | 250 | var form = $('#edit_carPark_form'); |
| ... | ... | @@ -304,17 +311,17 @@ $(function(){ |
| 304 | 311 | |
| 305 | 312 | var params = form.serializeJSON(); |
| 306 | 313 | |
| 307 | - params.createBy = carParkObj[0].carParkCreateBy; | |
| 314 | + params.createBy = CarParkObj.carParkCreateBy; | |
| 308 | 315 | |
| 309 | 316 | // 定义日期格式 |
| 310 | 317 | var fs = 'YYYY-MM-DD HH:mm:ss' |
| 311 | 318 | |
| 312 | 319 | // 设置日期 |
| 313 | - params.createDate = moment(carParkObj[0].carParkCreateDate).format(fs); | |
| 320 | + params.createDate = moment(CarParkObj.carParkCreateDate).format(fs); | |
| 314 | 321 | |
| 315 | 322 | error.hide(); |
| 316 | 323 | |
| 317 | - PublicFunctions.carParkUpdate(params,function(resuntDate) { | |
| 324 | + ajaxd.carParkUpdate(params,function(resuntDate) { | |
| 318 | 325 | |
| 319 | 326 | if(resuntDate.status=='SUCCESS') { |
| 320 | 327 | |
| ... | ... | @@ -329,7 +336,9 @@ $(function(){ |
| 329 | 336 | |
| 330 | 337 | } |
| 331 | 338 | |
| 332 | - $('#edit_carPark_mobal').modal('hide'); | |
| 339 | + clearSechear(); | |
| 340 | + | |
| 341 | + $('#editPoitsions_carpark_mobal').modal('hide'); | |
| 333 | 342 | |
| 334 | 343 | }) |
| 335 | 344 | ... | ... |
src/main/resources/static/pages/base/carpark/edit_select.html
| 1 | 1 | <!-- 选择编辑停车场方式 --> |
| 2 | -<div class="modal fade" id="edit_select_mobal" tabindex="-1" role="basic" aria-hidden="true"> | |
| 2 | +<div class="modal fade" id="editPositions_select_mobal" tabindex="-1" role="basic" aria-hidden="true"> | |
| 3 | 3 | |
| 4 | 4 | <div class="modal-dialog"> |
| 5 | 5 | |
| ... | ... | @@ -62,16 +62,18 @@ |
| 62 | 62 | </div> |
| 63 | 63 | <script type="text/javascript"> |
| 64 | 64 | |
| 65 | -$(function(){ | |
| 66 | - | |
| 65 | +$('#editPositions_select_mobal').on('editSelectMobal_show', function(e, map,fun,carParkE,ajaxd){ | |
| 66 | + | |
| 67 | 67 | // 显示选择修改方式弹出层 |
| 68 | - $('#edit_select_mobal').modal({show : true,backdrop: 'static',keyboard: false}); | |
| 68 | + $('#editPositions_select_mobal').modal({show : true,backdrop: 'static',keyboard: false}); | |
| 69 | + | |
| 70 | + var carParkObj = carParkE.getEitdCarPark(); | |
| 69 | 71 | |
| 70 | 72 | // 获取停车场名称元素并赋值 |
| 71 | - $('#carParkNameboxInput').val(carParkObj[0].carParkName); | |
| 73 | + $('#carParkNameboxInput').val(carParkObj.carParkName); | |
| 72 | 74 | |
| 73 | 75 | // 定义停车场图形类型 |
| 74 | - var stationShapesTypeV = carParkObj[0].carParkShapesType; | |
| 76 | + var stationShapesTypeV = carParkObj.carParkShapesType; | |
| 75 | 77 | |
| 76 | 78 | // 获取表单元素 |
| 77 | 79 | var form = $('#edit_select'); |
| ... | ... | @@ -139,7 +141,7 @@ $(function(){ |
| 139 | 141 | submitHandler : function(f) { |
| 140 | 142 | |
| 141 | 143 | // 隐藏弹出层 |
| 142 | - $('#edit_select_mobal').modal('hide'); | |
| 144 | + $('#editPositions_select_mobal').modal('hide'); | |
| 143 | 145 | |
| 144 | 146 | // 表单序列 |
| 145 | 147 | var params = form.serializeJSON(); |
| ... | ... | @@ -149,20 +151,14 @@ $(function(){ |
| 149 | 151 | |
| 150 | 152 | var eidtselect_ = params.editselect; |
| 151 | 153 | |
| 152 | - // 站点名称 | |
| 153 | - carParkObj[0].carParkName = editStationName; | |
| 154 | + // 设置停车场名称 | |
| 155 | + carParkE.setEitdCarParkName(editStationName); | |
| 154 | 156 | |
| 155 | 157 | if(eidtselect_==0){ |
| 156 | 158 | |
| 157 | - // 清楚地图覆盖物 | |
| 158 | - mapB.clearOverlays(); | |
| 159 | - | |
| 160 | - // 打开鼠标绘画工具 | |
| 161 | - drawingManager.open(); | |
| 162 | - | |
| 163 | - // 设置属性 | |
| 164 | - drawingManager.setDrawingMode(BMAP_DRAWING_POLYGON); | |
| 159 | + WorldsBMap.localSearchFromAdreesToPoint(editStationName); | |
| 165 | 160 | |
| 161 | + map.openDrawingManager(); | |
| 166 | 162 | |
| 167 | 163 | }else if(eidtselect_==1){ |
| 168 | 164 | |
| ... | ... | @@ -171,7 +167,7 @@ $(function(){ |
| 171 | 167 | shift: 0,time: 10000}); |
| 172 | 168 | |
| 173 | 169 | // 编辑图形 |
| 174 | - PublicFunctions.editShapes(stationShapesTypeV,mindex); | |
| 170 | + map.editShapes(stationShapesTypeV,mindex); | |
| 175 | 171 | |
| 176 | 172 | } |
| 177 | 173 | ... | ... |
src/main/resources/static/pages/base/carpark/js/add-form-events.js
0 → 100644
| 1 | +$(function(){ | |
| 2 | + | |
| 3 | + // 提交 | |
| 4 | + $('.button-submit').on('click',function() { | |
| 5 | + | |
| 6 | + // 获取表单 | |
| 7 | + var formSubm = $('#submit_carpark_form'); | |
| 8 | + | |
| 9 | + formSubm.submit(); | |
| 10 | + | |
| 11 | + }); | |
| 12 | + | |
| 13 | + $('#oppenDrawingManager').on('click',function() { | |
| 14 | + | |
| 15 | + VmapWorlds.drawingManagerOpen(); | |
| 16 | + | |
| 17 | + }); | |
| 18 | + | |
| 19 | + $('#closeDrawingManager').on('click',function() { | |
| 20 | + | |
| 21 | + VmapWorlds.drawingManagerClose(); | |
| 22 | + | |
| 23 | + }); | |
| 24 | + | |
| 25 | +}); | |
| 0 | 26 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/carpark/js/add-form-reload.js
0 → 100644
| 1 | +/** | |
| 2 | + * | |
| 3 | + * @JSName : list.js(停车场定位positions.html页面js) | |
| 4 | + * | |
| 5 | + * @Author : bsth@lq | |
| 6 | + * | |
| 7 | + * @Description : TODO(停车场定位positions.html页面js) | |
| 8 | + * | |
| 9 | + * @Data : 2016年4月28日 上午9:21:17 | |
| 10 | + * | |
| 11 | + * @Version 公交调度系统BS版 0.1 | |
| 12 | + * | |
| 13 | + */ | |
| 14 | + | |
| 15 | +(function(){ | |
| 16 | + | |
| 17 | + // 关闭左侧栏 | |
| 18 | + if (!$('body').hasClass('page-sidebar-closed')) { | |
| 19 | + | |
| 20 | + $('.menu-toggler.sidebar-toggler').click(); | |
| 21 | + | |
| 22 | + } | |
| 23 | + | |
| 24 | + setTimeout(function(){ | |
| 25 | + | |
| 26 | + FormWizard.init(); | |
| 27 | + | |
| 28 | + mapB = VmapWorlds.init(); | |
| 29 | + | |
| 30 | + PublicFunctions.getCarParkCode(function(carParkCode) { | |
| 31 | + | |
| 32 | + $('#parkCodeInput').val(carParkCode); | |
| 33 | + | |
| 34 | + }); | |
| 35 | + | |
| 36 | + $('#destroySelect').val('0'); | |
| 37 | + | |
| 38 | + PublicFunctions.getBusinessAllInfo(function(array) { | |
| 39 | + | |
| 40 | + var opGroup = '<option value="">请选择...</option><optgroup label="公司">'; | |
| 41 | + | |
| 42 | + var len_ = array.length; | |
| 43 | + | |
| 44 | + if(len_>0) { | |
| 45 | + | |
| 46 | + $.each(array, function(i, g){ | |
| 47 | + | |
| 48 | + opGroup += '<option value="'+g.businessCode+'">'+g.businessName+'</option>'; | |
| 49 | + | |
| 50 | + }); | |
| 51 | + | |
| 52 | + } | |
| 53 | + | |
| 54 | + opGroup += '</optgroup>'; | |
| 55 | + | |
| 56 | + $('#companySelect').html(opGroup).select2(); | |
| 57 | + | |
| 58 | + }); | |
| 59 | + | |
| 60 | + var htm = '<option value="">请选择...</option><optgroup label="公司">'; | |
| 61 | + | |
| 62 | + $('#brancheCompanySelect').html(htm).select2(); | |
| 63 | + | |
| 64 | + $('#companySelect').on("change", function (e) { | |
| 65 | + | |
| 66 | + // 获取公司下拉框选择值 | |
| 67 | + var businessCode = $('#companySelect').val(); | |
| 68 | + | |
| 69 | + // 分公司下拉框options属性值 | |
| 70 | + var options = '<option value="">请选择...</option><optgroup label="分公司">'; | |
| 71 | + | |
| 72 | + // 如果公司选择为空则分公司为空 ; 否则查询出所属公司下的分公司名称和相应分公司代码 | |
| 73 | + if(businessCode == null || businessCode ==''){ | |
| 74 | + | |
| 75 | + options += '</optgroup>'; | |
| 76 | + | |
| 77 | + // 填充分公司下拉框options | |
| 78 | + $('#brancheCompanySelect').html(options).select2(); | |
| 79 | + | |
| 80 | + } else { | |
| 81 | + | |
| 82 | + // 查询出所属公司下的分公司名称和相应分公司代码 | |
| 83 | + $get('/business/all', {upCode_eq: businessCode}, function(array){ | |
| 84 | + | |
| 85 | + // 遍历array | |
| 86 | + $.each(array, function(i,d){ | |
| 87 | + | |
| 88 | + options += '<option value="'+d.businessCode+'">'+d.businessName+'</option>'; | |
| 89 | + | |
| 90 | + options += '</optgroup>'; | |
| 91 | + | |
| 92 | + }); | |
| 93 | + | |
| 94 | + // 填充分公司下拉框options | |
| 95 | + $('#brancheCompanySelect').html(options).select2(); | |
| 96 | + | |
| 97 | + }); | |
| 98 | + } | |
| 99 | + | |
| 100 | + }); | |
| 101 | + | |
| 102 | + | |
| 103 | + }, 500); | |
| 104 | + | |
| 105 | +})(); | |
| 0 | 106 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/carpark/js/add-form-wizard.js
| ... | ... | @@ -17,6 +17,15 @@ var FormWizard = function() { |
| 17 | 17 | |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | + // 定义表单 | |
| 21 | + var form = $('#submit_carpark_form'); | |
| 22 | + | |
| 23 | + // 定义表单异常 | |
| 24 | + var error = $('.alert-danger',form); | |
| 25 | + | |
| 26 | + // 定义表单成功 | |
| 27 | + var success = $('.alert-success',form); | |
| 28 | + | |
| 20 | 29 | // 表单验证 |
| 21 | 30 | form.validate({ |
| 22 | 31 | |
| ... | ... | @@ -38,8 +47,43 @@ var FormWizard = function() { |
| 38 | 47 | // 必填项 |
| 39 | 48 | required : true, |
| 40 | 49 | |
| 41 | - // 最大长度 | |
| 42 | - maxlength: 20 | |
| 50 | + }, | |
| 51 | + | |
| 52 | + // 停车场名称 | |
| 53 | + 'parkName' : { | |
| 54 | + | |
| 55 | + // 必填项 | |
| 56 | + required : true, | |
| 57 | + | |
| 58 | + }, | |
| 59 | + | |
| 60 | + // 停车场编码 | |
| 61 | + 'parkCode' : { | |
| 62 | + | |
| 63 | + // 必填项 | |
| 64 | + required : true, | |
| 65 | + }, | |
| 66 | + | |
| 67 | + // 中心点坐标 | |
| 68 | + 'bCenterPoint' : { | |
| 69 | + | |
| 70 | + // 必填项 | |
| 71 | + required : true, | |
| 72 | + | |
| 73 | + }, | |
| 74 | + | |
| 75 | + // 图形类型 | |
| 76 | + 'shapesType' : { | |
| 77 | + | |
| 78 | + // 必填项 | |
| 79 | + required : true, | |
| 80 | + }, | |
| 81 | + | |
| 82 | + // 所属分公司 | |
| 83 | + 'brancheCompany' : { | |
| 84 | + | |
| 85 | + // 必填项 | |
| 86 | + required : true, | |
| 43 | 87 | } |
| 44 | 88 | |
| 45 | 89 | |
| ... | ... | @@ -106,7 +150,7 @@ var FormWizard = function() { |
| 106 | 150 | // 表单序列化 |
| 107 | 151 | var params = form.serializeJSON(); |
| 108 | 152 | |
| 109 | - return params; | |
| 153 | + console.log(params); | |
| 110 | 154 | |
| 111 | 155 | //保存站点 |
| 112 | 156 | PublicFunctions.carParkSave(params,function(data) { |
| ... | ... | @@ -215,98 +259,39 @@ var FormWizard = function() { |
| 215 | 259 | |
| 216 | 260 | if (current == 2) { |
| 217 | 261 | |
| 262 | + // 获取新增方式值 | |
| 218 | 263 | var baseResValue = $('#submit_carpark_form input[name="baseRes"]:checked').val(); |
| 219 | 264 | |
| 265 | + // 获取停车场名称值 | |
| 220 | 266 | var stationNameV = $('#parkNamebooxtInput').val(); |
| 221 | 267 | |
| 268 | + // 设置停车场名称 | |
| 222 | 269 | $('#parkNameInput').val(stationNameV); |
| 223 | 270 | |
| 224 | - VmapWorlds.localSearchFromAdreesToPoint(stationNameV,mapB,function(Points) { | |
| 225 | - | |
| 226 | - if(Points) { | |
| 227 | - | |
| 228 | - var BJwpointsArray = Points.split(' '); | |
| 229 | - | |
| 230 | - var stationNameChangePoint = new BMap.Point(BJwpointsArray[0], BJwpointsArray[1]); | |
| 231 | - | |
| 232 | - marker_stargt2 = new BMap.Marker(stationNameChangePoint); | |
| 233 | - | |
| 234 | - var PanOptions ={noAnimation :true}; | |
| 235 | - | |
| 236 | - mapB.panTo(stationNameChangePoint,PanOptions); | |
| 237 | - | |
| 238 | - mapB.panBy(0,100); | |
| 239 | - | |
| 240 | - // 将标注添加到地图中 | |
| 241 | - mapB.addOverlay(marker_stargt2); | |
| 242 | - | |
| 243 | - //跳动的动画 | |
| 244 | - marker_stargt2.setAnimation(BMAP_ANIMATION_BOUNCE); | |
| 245 | - | |
| 246 | - if(baseResValue == 0) { | |
| 247 | - | |
| 248 | - $('.leftUtils').hide(); | |
| 249 | - | |
| 250 | - //创建圆 | |
| 251 | - circle = new BMap.Circle(stationNameChangePoint,150,{strokeColor:"blue", strokeWeight:2, strokeOpacity:0.5}); | |
| 252 | - | |
| 253 | - // 百度地图添加覆盖物圆 | |
| 254 | - mapB.addOverlay(circle); | |
| 255 | - | |
| 256 | - // 开启编辑功能 | |
| 257 | - circle.enableEditing(); | |
| 258 | - | |
| 259 | - // 编辑圆监听事件 | |
| 260 | - circle.addEventListener('remove',function() { | |
| 261 | - | |
| 262 | - // 清除marker | |
| 263 | - mapB.removeOverlay(marker_stargt2); | |
| 264 | - | |
| 265 | - // 返回圆形的半径,单位为米。 | |
| 266 | - var newRadius = circle.getRadius(); | |
| 267 | - | |
| 268 | - // 返回圆形的中心点坐标。 | |
| 269 | - var newCenter = circle.getCenter().lng + ' ' + circle.getCenter().lat; | |
| 270 | - | |
| 271 | - var centre_New = [{potion:{lng:circle.getCenter().lng,lat:circle.getCenter().lat}}]; | |
| 272 | - | |
| 273 | - // 中心百度坐标转WGS坐标 | |
| 274 | - PublicFunctions.getFormPointEToWGS(centre_New,function(p) { | |
| 275 | - | |
| 276 | - // 设置修改站点参数集合 | |
| 277 | - PublicFunctions.setFormInputValue(newCenter, p[0].WGSpotion.Lng , p[0].WGSpotion.Lat,'','','r',Math.round(newRadius)); | |
| 278 | - | |
| 279 | - }); | |
| 280 | - | |
| 281 | - }); | |
| 282 | - | |
| 283 | - }else if(baseResValue ==1) { | |
| 284 | - | |
| 285 | - VmapWorlds.drawingManagerOpen(); | |
| 286 | - | |
| 287 | - } | |
| 288 | - | |
| 289 | - }else { | |
| 290 | - | |
| 291 | - // 弹出添加成功提示消息 | |
| 292 | - layer.msg('无法获取停车场【'+stationNameV+'】地理位置!'); | |
| 293 | - | |
| 294 | - } | |
| 295 | - | |
| 296 | - }); | |
| 297 | - | |
| 271 | + VmapWorlds.localSearchFromAdreesToPoint(stationNameV,function(p) { | |
| 272 | + | |
| 273 | + if(p) { | |
| 274 | + | |
| 275 | + if(baseResValue == 0) { | |
| 276 | + | |
| 277 | + debugger; | |
| 278 | + | |
| 279 | + $('.leftUtils').hide(); | |
| 280 | + | |
| 281 | + VmapWorlds.pointsCircle(p); | |
| 282 | + | |
| 283 | + }else if(baseResValue ==1) { | |
| 284 | + | |
| 285 | + $('.leftUtils').show(); | |
| 286 | + | |
| 287 | + VmapWorlds.drawingManagerOpen(); | |
| 288 | + | |
| 289 | + } | |
| 290 | + } | |
| 291 | + | |
| 292 | + }); | |
| 298 | 293 | } |
| 299 | 294 | |
| 300 | - if(current == 3){ | |
| 301 | - | |
| 302 | - mapB.clearOverlays(); | |
| 303 | - | |
| 304 | - circle = ''; | |
| 305 | - | |
| 306 | - drawingManager.close(); | |
| 307 | - | |
| 308 | - } | |
| 309 | - | |
| 310 | 295 | /** 如果为最后一步显示提交按钮,隐藏下一步按钮,否则隐藏提交按钮,显示下一步按钮 */ |
| 311 | 296 | if (current >= total) { |
| 312 | 297 | |
| ... | ... | @@ -373,9 +358,11 @@ var FormWizard = function() { |
| 373 | 358 | |
| 374 | 359 | } |
| 375 | 360 | |
| 376 | - mapB.clearOverlays(); | |
| 377 | - | |
| 378 | - circle = ''; | |
| 361 | + if(index==2) { | |
| 362 | + | |
| 363 | + VmapWorlds.clearMarkAndOverlays(); | |
| 364 | + | |
| 365 | + } | |
| 379 | 366 | |
| 380 | 367 | handleTitle(tab, navigation, index); |
| 381 | 368 | |
| ... | ... | @@ -388,11 +375,7 @@ var FormWizard = function() { |
| 388 | 375 | |
| 389 | 376 | error.hide(); |
| 390 | 377 | |
| 391 | - mapB.clearOverlays(); | |
| 392 | - | |
| 393 | - circle = ''; | |
| 394 | - | |
| 395 | - drawingManager.close(); | |
| 378 | + VmapWorlds.clearMarkAndOverlays(); | |
| 396 | 379 | |
| 397 | 380 | handleTitle(tab, navigation, index); |
| 398 | 381 | ... | ... |
src/main/resources/static/pages/base/carpark/js/add-input-function.js
| 1 | 1 | /** |
| 2 | 2 | * 函数 |
| 3 | 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 | - * - - - - - - - 》 eachSectionList:路段折线百度坐标转WGS坐标 | |
| 25 | 4 | */ |
| 26 | 5 | |
| 27 | 6 | var PublicFunctions = function () { |
| 28 | 7 | |
| 29 | 8 | var PubFun = { |
| 30 | 9 | |
| 31 | - // 原百度坐标转WGS坐标 | |
| 32 | - getFormPointEToWGS: function(points,callback) { | |
| 33 | - | |
| 34 | - // 获取长度 | |
| 35 | - var len = points.length; | |
| 36 | - | |
| 37 | - (function(){ | |
| 38 | - | |
| 39 | - if (!arguments.callee.count) { | |
| 40 | - | |
| 41 | - arguments.callee.count = 0; | |
| 42 | - | |
| 43 | - } | |
| 44 | - | |
| 45 | - arguments.callee.count++; | |
| 46 | - | |
| 47 | - var index = parseInt(arguments.callee.count) - 1; | |
| 48 | - | |
| 49 | - if (index >= len) { | |
| 50 | - | |
| 51 | - callback && callback(points); | |
| 52 | - | |
| 53 | - return; | |
| 54 | - } | |
| 55 | - | |
| 56 | - var f = arguments.callee; | |
| 57 | - | |
| 58 | - $.ajax({ | |
| 59 | - | |
| 60 | - url: 'http://api.zdoz.net/bd2wgs.aspx', | |
| 61 | - | |
| 62 | - data: {lat: points[index].potion.lat , lng: points[index].potion.lng}, | |
| 63 | - | |
| 64 | - dataType: 'jsonp', | |
| 65 | - | |
| 66 | - success: function(r){ | |
| 67 | - | |
| 68 | - if(r) { | |
| 69 | - | |
| 70 | - points[index].WGSpotion = r; | |
| 71 | - | |
| 72 | - } | |
| 73 | - | |
| 74 | - f(); | |
| 75 | - } | |
| 76 | - }); | |
| 77 | - | |
| 78 | - })(); | |
| 79 | - | |
| 80 | - }, | |
| 81 | - | |
| 82 | - /** @param points:中心点 ;gLonx:中心点WGS经度;gLaty:中心点WGS纬度;bPolygonGridValue:百度坐标点图形集合;gPolygonGridVlaue:WGS坐标点图形集合;shapesTypeValue:范围图形类型;radiusValue:圆半径 */ | |
| 83 | - setFormInputValue: function(points,gLonx,gLaty,bPolygonGridValue,gPolygonGridVlaue,shapesTypeValue,radiusValue) { | |
| 10 | + /** @param points:中心点;bPolygonGridValue:百度坐标点图形集合;shapesTypeValue:范围图形类型;radiusValue:圆半径 */ | |
| 11 | + setFormInputValue: function(points,bPolygonGridValue,shapesTypeValue,radiusValue) { | |
| 84 | 12 | |
| 85 | 13 | // 百度地图经纬度坐标中心点 |
| 86 | 14 | $('#bCenterPointInput').val(points); |
| 87 | 15 | |
| 88 | - // WGS经纬度 | |
| 89 | - $('#gCenterPointInput').val(gLonx + ' ' + gLaty); | |
| 90 | - | |
| 91 | 16 | // 百度坐标点图形集合 |
| 92 | 17 | $('#bParkPointInput').val(bPolygonGridValue); |
| 93 | 18 | |
| 94 | - // WGS坐标点图形集合 | |
| 95 | - $('#gParkPointInput').val(gPolygonGridVlaue); | |
| 96 | - | |
| 97 | 19 | // 图形类型 |
| 98 | 20 | $('#shapesTypeSelect').val(shapesTypeValue); |
| 99 | 21 | |
| ... | ... | @@ -113,8 +35,6 @@ var PublicFunctions = function () { |
| 113 | 35 | |
| 114 | 36 | }, |
| 115 | 37 | |
| 116 | - | |
| 117 | - | |
| 118 | 38 | getCarParkCode : function(callback) { |
| 119 | 39 | |
| 120 | 40 | $get('/carpark/getCarParkCode',null,function(carParkCode) { |
| ... | ... | @@ -128,6 +48,10 @@ var PublicFunctions = function () { |
| 128 | 48 | // 新增站点保存 |
| 129 | 49 | carParkSave : function(carPark,callback) { |
| 130 | 50 | |
| 51 | + console.log(carPark); | |
| 52 | + | |
| 53 | + return; | |
| 54 | + | |
| 131 | 55 | $post('/carpark/carParkSave',carPark,function(data) { |
| 132 | 56 | |
| 133 | 57 | callback && callback(data); | ... | ... |
src/main/resources/static/pages/base/carpark/js/add-vmap-world.js
| 1 | 1 | var VmapWorlds = function() { |
| 2 | 2 | |
| 3 | + var mapB = '', circle = '', drawingManager = '',circle='',marker=''; | |
| 4 | + | |
| 3 | 5 | var Bmap = { |
| 4 | 6 | |
| 5 | 7 | init : function() { |
| ... | ... | @@ -11,22 +13,22 @@ var VmapWorlds = function() { |
| 11 | 13 | var bdKey = 'IGGrr4UjwIYzatoCRFKEL8sT'; |
| 12 | 14 | |
| 13 | 15 | // 初始化百度地图 |
| 14 | - var map = new BMap.Map("bmap_basic"); | |
| 16 | + mapB = new BMap.Map("bmap_basic"); | |
| 15 | 17 | |
| 16 | 18 | //中心点和缩放级别 |
| 17 | - map.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15); | |
| 19 | + mapB.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15); | |
| 18 | 20 | |
| 19 | 21 | //启用地图拖拽事件,默认启用(可不写) |
| 20 | - map.enableDragging(); | |
| 22 | + mapB.enableDragging(); | |
| 21 | 23 | |
| 22 | 24 | //启用地图滚轮放大缩小 |
| 23 | - map.enableScrollWheelZoom(); | |
| 25 | + mapB.enableScrollWheelZoom(); | |
| 24 | 26 | |
| 25 | 27 | //禁用鼠标双击放大 |
| 26 | - map.disableDoubleClickZoom(); | |
| 28 | + mapB.disableDoubleClickZoom(); | |
| 27 | 29 | |
| 28 | 30 | //启用键盘上下左右键移动地图 |
| 29 | - map.enableKeyboard(); | |
| 31 | + mapB.enableKeyboard(); | |
| 30 | 32 | |
| 31 | 33 | var styleOptions = { |
| 32 | 34 | |
| ... | ... | @@ -51,7 +53,7 @@ var VmapWorlds = function() { |
| 51 | 53 | }; |
| 52 | 54 | |
| 53 | 55 | // 创建鼠标绘制管理类 |
| 54 | - drawingManager = new BMapLib.DrawingManager(map, { | |
| 56 | + drawingManager = new BMapLib.DrawingManager(mapB, { | |
| 55 | 57 | |
| 56 | 58 | //是否开启绘制模式 |
| 57 | 59 | isOpen : false, |
| ... | ... | @@ -82,15 +84,16 @@ var VmapWorlds = function() { |
| 82 | 84 | |
| 83 | 85 | drawingManager.close(); |
| 84 | 86 | |
| 85 | - if (e.getPath().length <= 2) { | |
| 87 | + if (e.getPath().length <= 2) { | |
| 86 | 88 | |
| 87 | 89 | // 弹出提示消息 |
| 88 | 90 | layer.msg('坐标点不能小于等于两个...'); |
| 89 | 91 | |
| 90 | 92 | // 清除地图覆盖物 |
| 91 | - map.clearOverlays(); | |
| 93 | + mapB.clearOverlays(); | |
| 92 | 94 | |
| 93 | - // 加载该线路下所有站点位置添加到地图上 | |
| 95 | + drawingManager.open(); | |
| 96 | + | |
| 94 | 97 | return false; |
| 95 | 98 | |
| 96 | 99 | }else { |
| ... | ... | @@ -100,70 +103,37 @@ var VmapWorlds = function() { |
| 100 | 103 | // 多变行质心点 |
| 101 | 104 | var addSttationPoints_ = pointE.getBounds().getCenter().lng+ ' ' + pointE.getBounds().getCenter().lat; |
| 102 | 105 | |
| 103 | - var PointsList = []; | |
| 104 | - | |
| 105 | - for ( var i = 0; i < pointE.getPath().length; i++) { | |
| 106 | - | |
| 107 | - PointsList.push({potion: {lng: pointE.getPath()[i].lng, lat: pointE.getPath()[i].lat}}); | |
| 108 | - | |
| 109 | - } | |
| 110 | - | |
| 111 | - PointsList.push({potion: {lng: pointE.getPath()[0].lng, lat: pointE.getPath()[0].lat}}); | |
| 106 | + var addPolyGonLen_ = pointE.getPath().length; | |
| 112 | 107 | |
| 113 | - var centre = [{potion:{lng:pointE.getBounds().getCenter().lng,lat:pointE.getBounds().getCenter().lat}}]; | |
| 114 | - | |
| 115 | - PublicFunctions.getFormPointEToWGS(PointsList,function(resultdata) { | |
| 116 | - | |
| 117 | - var gPloygonGrid = ''; | |
| 118 | - | |
| 119 | - var bPloygonGrid = ''; | |
| 108 | + for(var k =0;k<addPolyGonLen_;k++) { | |
| 120 | 109 | |
| 121 | - for(var k =0;k<resultdata.length;k++) { | |
| 110 | + if(k==0) { | |
| 122 | 111 | |
| 123 | - if(k==0) { | |
| 124 | - | |
| 125 | - gPloygonGrid = resultdata[k].WGSpotion.Lng + ' ' +resultdata[k].WGSpotion.Lat; | |
| 126 | - | |
| 127 | - bPloygonGrid = resultdata[k].potion.lng + ' ' +resultdata[k].potion.lat; | |
| 128 | - | |
| 129 | - }else { | |
| 130 | - | |
| 131 | - gPloygonGrid = gPloygonGrid + ',' + resultdata[k].WGSpotion.Lng + ' ' +resultdata[k].WGSpotion.Lat; | |
| 132 | - | |
| 133 | - bPloygonGrid = bPloygonGrid + ',' + resultdata[k].potion.lng + ' ' +resultdata[k].potion.lat; | |
| 134 | - | |
| 135 | - } | |
| 112 | + bPloygonGrid = pointE.getPath()[k].lng + ' ' + pointE.getPath()[k].lat; | |
| 136 | 113 | |
| 137 | - } | |
| 138 | - | |
| 139 | - gPloygonGrid = 'POLYGON((' + gPloygonGrid + '))'; | |
| 140 | - | |
| 141 | - bPloygonGrid = 'POLYGON((' + bPloygonGrid + '))'; | |
| 142 | - | |
| 143 | - PublicFunctions.getFormPointEToWGS(centre,function(p) { | |
| 144 | - | |
| 145 | - var gLonx = p[0].WGSpotion.Lng; | |
| 114 | + }else { | |
| 146 | 115 | |
| 147 | - var gLaty = p[0].WGSpotion.Lat; | |
| 148 | - | |
| 149 | - PublicFunctions.setFormInputValue(addSttationPoints_,gLonx,gLaty,bPloygonGrid,gPloygonGrid,'d',''); | |
| 150 | - | |
| 151 | - }); | |
| 152 | - | |
| 153 | - }); | |
| 116 | + bPloygonGrid = bPloygonGrid + ',' + pointE.getPath()[k].lng + ' ' + pointE.getPath()[k].lat; | |
| 117 | + | |
| 118 | + } | |
| 119 | + | |
| 120 | + } | |
| 121 | + | |
| 122 | + bPloygonGrid = bPloygonGrid + ',' + pointE.getPath()[0].lng + ' ' + pointE.getPath()[0].lat; | |
| 154 | 123 | |
| 124 | + PublicFunctions.setFormInputValue(addSttationPoints_,bPloygonGrid,'d',''); | |
| 155 | 125 | } |
| 156 | 126 | |
| 157 | 127 | }); |
| 158 | 128 | |
| 159 | - return map; | |
| 129 | + return mapB; | |
| 160 | 130 | }, |
| 161 | 131 | |
| 162 | 132 | // 根据地理名称获取百度经纬度坐标 |
| 163 | - localSearchFromAdreesToPoint: function(Address,map,callback) { | |
| 133 | + localSearchFromAdreesToPoint: function(Address,cb) { | |
| 164 | 134 | |
| 165 | 135 | // 创建一个搜索类实例 |
| 166 | - var localSearch = new BMap.LocalSearch(map); | |
| 136 | + var localSearch = new BMap.LocalSearch(mapB); | |
| 167 | 137 | |
| 168 | 138 | // 检索完成后的回调函数。 |
| 169 | 139 | localSearch.setSearchCompleteCallback(function (searchResult) { |
| ... | ... | @@ -178,19 +148,42 @@ var VmapWorlds = function() { |
| 178 | 148 | if(poi) { |
| 179 | 149 | |
| 180 | 150 | //获取经度和纬度 |
| 181 | - resultPoints = poi.point.lng + ' ' + poi.point.lat; | |
| 182 | - | |
| 183 | - return callback && callback(resultPoints); | |
| 151 | + var stationNameChangePoint = new BMap.Point( poi.point.lng, poi.point.lat); | |
| 152 | + | |
| 153 | + marker = new BMap.Marker(stationNameChangePoint); | |
| 154 | + | |
| 155 | + var PanOptions ={noAnimation :true}; | |
| 156 | + | |
| 157 | + mapB.panTo(stationNameChangePoint,PanOptions); | |
| 158 | + | |
| 159 | + // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增) | |
| 160 | + mapB.setZoom(18); | |
| 161 | + | |
| 162 | + mapB.panBy(0,-80); | |
| 163 | + | |
| 164 | + // 将标注添加到地图中 | |
| 165 | + mapB.addOverlay(marker); | |
| 166 | + | |
| 167 | + //跳动的动画 | |
| 168 | + marker.setAnimation(BMAP_ANIMATION_BOUNCE); | |
| 169 | + | |
| 170 | + cb && cb(stationNameChangePoint); | |
| 184 | 171 | |
| 185 | 172 | }else { |
| 186 | 173 | |
| 187 | - return callback && callback(false); | |
| 174 | + // 弹出添加成功提示消息 | |
| 175 | + layer.msg('无法获取停车场【'+Address+'】地理位置!'); | |
| 176 | + | |
| 177 | + cb && cb(false); | |
| 188 | 178 | |
| 189 | 179 | } |
| 190 | 180 | |
| 191 | 181 | }else { |
| 192 | 182 | |
| 193 | - return callback && callback(false); | |
| 183 | + // 弹出添加成功提示消息 | |
| 184 | + layer.msg('无法获取停车场【'+Address+'】地理位置!'); | |
| 185 | + | |
| 186 | + cb && cb(false); | |
| 194 | 187 | } |
| 195 | 188 | |
| 196 | 189 | }); |
| ... | ... | @@ -200,6 +193,42 @@ var VmapWorlds = function() { |
| 200 | 193 | |
| 201 | 194 | }, |
| 202 | 195 | |
| 196 | + // 画圆 | |
| 197 | + pointsCircle : function(stationNameChangePoint) { | |
| 198 | + | |
| 199 | + //创建圆 | |
| 200 | + circle = new BMap.Circle(stationNameChangePoint,100,{strokeColor:"blue", strokeWeight:2, strokeOpacity:0.5}); | |
| 201 | + | |
| 202 | + // 百度地图添加覆盖物圆 | |
| 203 | + mapB.addOverlay(circle); | |
| 204 | + | |
| 205 | + // 开启编辑功能 | |
| 206 | + circle.enableEditing(); | |
| 207 | + | |
| 208 | + // 编辑圆监听事件 | |
| 209 | + circle.addEventListener('remove',function() { | |
| 210 | + | |
| 211 | + // 清除marker | |
| 212 | + mapB.removeOverlay(marker); | |
| 213 | + | |
| 214 | + /*VmapWorlds.clearMarkAndOverlays();*/ | |
| 215 | + | |
| 216 | + // 返回圆形的半径,单位为米。 | |
| 217 | + var newRadius = circle.getRadius(); | |
| 218 | + | |
| 219 | + // 返回圆形的中心点坐标。 | |
| 220 | + var newCenter = circle.getCenter().lng + ' ' + circle.getCenter().lat; | |
| 221 | + | |
| 222 | + var centre_New = [{potion:{lng:circle.getCenter().lng,lat:circle.getCenter().lat}}]; | |
| 223 | + | |
| 224 | + circle = ''; | |
| 225 | + | |
| 226 | + PublicFunctions.setFormInputValue(newCenter,'','r',Math.round(newRadius)); | |
| 227 | + | |
| 228 | + }); | |
| 229 | + | |
| 230 | + }, | |
| 231 | + | |
| 203 | 232 | // 打开绘画工具 |
| 204 | 233 | drawingManagerOpen : function() { |
| 205 | 234 | |
| ... | ... | @@ -209,10 +238,21 @@ var VmapWorlds = function() { |
| 209 | 238 | // 设置属性 |
| 210 | 239 | drawingManager.setDrawingMode(BMAP_DRAWING_POLYGON); |
| 211 | 240 | |
| 241 | + }, | |
| 242 | + | |
| 243 | + drawingManagerClose : function() { | |
| 244 | + | |
| 245 | + drawingManager.close(); | |
| 246 | + | |
| 247 | + }, | |
| 248 | + | |
| 249 | + clearMarkAndOverlays : function() { | |
| 250 | + | |
| 251 | + // 清楚地图覆盖物 | |
| 252 | + mapB.clearOverlays(); | |
| 253 | + | |
| 212 | 254 | } |
| 213 | 255 | |
| 214 | - | |
| 215 | - | |
| 216 | 256 | } |
| 217 | 257 | |
| 218 | 258 | return Bmap; | ... | ... |
src/main/resources/static/pages/base/carpark/js/carpark-list-table.js
src/main/resources/static/pages/base/carpark/js/carpark-positions-ajax.js
0 → 100644
| 1 | +/** | |
| 2 | + * GetAjaxData :ajax异步请求 | |
| 3 | + * | |
| 4 | + */ | |
| 5 | + | |
| 6 | +var GetAjaxData = function(){ | |
| 7 | + | |
| 8 | + var ajaxData = { | |
| 9 | + | |
| 10 | + // 查询停车场信息 | |
| 11 | + getCarParkInfo : function(carParkId,callback){ | |
| 12 | + | |
| 13 | + $get('/carpark/findCarParkInfoFormId',{id:carParkId},function(r) { | |
| 14 | + | |
| 15 | + return callback && callback(r); | |
| 16 | + | |
| 17 | + }); | |
| 18 | + | |
| 19 | + }, | |
| 20 | + | |
| 21 | + carParkUpdate : function(params,callback){ | |
| 22 | + | |
| 23 | + $post('/carpark/carParkUpdate',params,function(data) { | |
| 24 | + | |
| 25 | + callback && callback(data); | |
| 26 | + | |
| 27 | + }); | |
| 28 | + | |
| 29 | + } | |
| 30 | + } | |
| 31 | + | |
| 32 | + return ajaxData; | |
| 33 | + | |
| 34 | +}(); | |
| 0 | 35 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/carpark/js/carpark-positions-events.js
| ... | ... | @@ -9,7 +9,13 @@ $(function(){ |
| 9 | 9 | |
| 10 | 10 | $('#edit').on('click',function() { |
| 11 | 11 | |
| 12 | - $.get('edit_select.html', function(m){$(pjaxContainer).append(m);}); | |
| 12 | + $.get('edit_select.html', function(m){ | |
| 13 | + | |
| 14 | + $(pjaxContainer).append(m); | |
| 15 | + | |
| 16 | + $('#editPositions_select_mobal').trigger('editSelectMobal_show', [WorldsBMap,PublicFunctions,EditCarParkObj,GetAjaxData]); | |
| 17 | + | |
| 18 | + }); | |
| 13 | 19 | |
| 14 | 20 | }); |
| 15 | 21 | ... | ... |
src/main/resources/static/pages/base/carpark/js/carpark-positions-function.js
| 1 | 1 | /** |
| 2 | 2 | * 函数 |
| 3 | + * | |
| 4 | + * initCarPark :停车场信息初始化 @param:<id:停车场ID> | |
| 3 | 5 | */ |
| 4 | 6 | |
| 5 | 7 | var PublicFunctions = function () { |
| 6 | 8 | |
| 7 | 9 | var PubFun = { |
| 8 | 10 | |
| 9 | - initCarPark : function() { | |
| 11 | + /** 停车场信息初始化 @param:<id:停车场ID> */ | |
| 12 | + initCarPark : function(id) { | |
| 10 | 13 | |
| 11 | - // 获取停车场信息 | |
| 12 | - PublicFunctions.getCarParkInfo(function(r) { | |
| 13 | - | |
| 14 | - console.log(r); | |
| 14 | + /** 获取停车场信息 @param:<id:停车场Id> */ | |
| 15 | + GetAjaxData.getCarParkInfo(id,function(r) { | |
| 15 | 16 | |
| 17 | + // 获取返回数据长度 | |
| 16 | 18 | var len = r.length; |
| 17 | 19 | |
| 20 | + // 如果大于零 | |
| 18 | 21 | if(len>0) { |
| 19 | 22 | |
| 20 | - carParkObj = r; | |
| 23 | + // 获取停车场信息数据 | |
| 24 | + var carParkObj = r[0]; | |
| 25 | + | |
| 26 | + /** 设置停车场对象值 @param:<carParkObj:停车场对象值> */ | |
| 27 | + EditCarParkObj.setEitdCarPark(carParkObj); | |
| 21 | 28 | |
| 29 | + // 定义图形类型 | |
| 22 | 30 | var stationShapesType = r[0].carParkShapesType; |
| 23 | 31 | |
| 32 | + // 如果为空,则添加 | |
| 24 | 33 | if(stationShapesType==null){ |
| 25 | 34 | |
| 26 | 35 | // 弹出选择框;确认则提交;取消则返回 |
| 27 | - layer.confirm('停车场位置缺失,自动延续为添加停车场位置', { | |
| 28 | - btn : [ '确认提示并提交', '取消' ] | |
| 29 | - }, function(index) { | |
| 36 | + layer.confirm('停车场位置缺失,自动延续为添加停车场位置', {btn : [ '确认提示并添加', '取消' ]}, function(index) { | |
| 30 | 37 | |
| 31 | - var stationNameV = r[0].carParkName; | |
| 32 | - | |
| 33 | - WorldsBMap.localSearchFromAdreesToPoint(stationNameV,mapB,function(Points) { | |
| 34 | - | |
| 35 | - if(Points) { | |
| 36 | - | |
| 37 | - var BJwpointsArray = Points.split(' '); | |
| 38 | - | |
| 39 | - var stationNameChangePoint = new BMap.Point(BJwpointsArray[0], BJwpointsArray[1]); | |
| 40 | - | |
| 41 | - marker_stargt2 = new BMap.Marker(stationNameChangePoint); | |
| 42 | - | |
| 43 | - var PanOptions ={noAnimation :true}; | |
| 44 | - | |
| 45 | - mapB.panTo(stationNameChangePoint,PanOptions); | |
| 46 | - | |
| 47 | - mapB.panBy(0,-200); | |
| 48 | - | |
| 49 | - // 将标注添加到地图中 | |
| 50 | - mapB.addOverlay(marker_stargt2); | |
| 51 | - | |
| 52 | - //跳动的动画 | |
| 53 | - marker_stargt2.setAnimation(BMAP_ANIMATION_BOUNCE); | |
| 54 | - | |
| 55 | - } | |
| 56 | - | |
| 57 | - }); | |
| 58 | - | |
| 59 | - // 关闭弹出层 | |
| 38 | + /** 关闭弹出层 @param:<index:当前弹出框> */ | |
| 60 | 39 | layer.close(index); |
| 61 | 40 | |
| 62 | - // 清楚地图覆盖物 | |
| 63 | - mapB.clearOverlays(); | |
| 41 | + // 停车场名称 | |
| 42 | + var nameV = r[0].carParkName; | |
| 64 | 43 | |
| 65 | - // 打开鼠标绘画工具 | |
| 66 | - drawingManager.open(); | |
| 44 | + /** 根据名称定位 */ | |
| 45 | + WorldsBMap.localSearchFromAdreesToPoint(nameV); | |
| 67 | 46 | |
| 68 | - // 设置属性 | |
| 69 | - drawingManager.setDrawingMode(BMAP_DRAWING_POLYGON); | |
| 47 | + // 打开绘制工具 | |
| 48 | + WorldsBMap.openDrawingManager(); | |
| 70 | 49 | |
| 71 | 50 | }); |
| 72 | 51 | |
| ... | ... | @@ -80,13 +59,16 @@ var PublicFunctions = function () { |
| 80 | 59 | var point = new BMap.Point(BJwpoints[0], BJwpoints[1]); |
| 81 | 60 | |
| 82 | 61 | var htm = '<HR style="border:1 dashed #987cb9" width="100%" color=#987cb9 SIZE=1>'+ |
| 83 | - '<span style="color:#DDD;font-size: 15px;">停车场名称:' + r[0].carParkName + '</span>' + | |
| 84 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">停车场编码:' + r[0].carParkCode + '</span>' + | |
| 85 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">停车场面积:' + r[0].carParkArea + '</span>' + | |
| 86 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">纬度坐标:' + r[0].stationJwpoints + '</span>' + | |
| 87 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">范围半径:' + r[0].carParkRadius + '</span>' + | |
| 88 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">版本 号:' + r[0].carParkVersions + '</span>' + | |
| 89 | - '<span class="help-block" style="width: 100%;font-size: 15px;;color:#DDD; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; " title="'+ 'ddd' +'" >说明/描述:' + 'ddd' + '</span>' ; | |
| 62 | + '<span style="color:#DDD;font-size: 15px;">停车场名称:' + r[0].carParkName + '</span>' + | |
| 63 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">停车场编码:' + r[0].carParkCode + '</span>' + | |
| 64 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">停车场面积:' + r[0].carParkArea + '</span>' + | |
| 65 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">纬度坐标:' + r[0].carParkBcenterPoint + '</span>' + | |
| 66 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">范围类型:' + r[0].carParkShapesType + '</span>' + | |
| 67 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">范围半径:' + r[0].carParkRadius + '</span>' + | |
| 68 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">所属公司:' + r[0].carParkCompany + '</span>' + | |
| 69 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">分 公司:' + r[0].carParkBrancheCompany + '</span>' + | |
| 70 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">版本 号:' + r[0].carParkVersions + '</span>' + | |
| 71 | + '<span class="help-block" style="width: 100%;font-size: 15px;;color:#DDD; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; " title="'+ r[0].carParkDescriptions +'" >说明/描述:' + r[0].carParkDescriptions + '</span>' ; | |
| 90 | 72 | |
| 91 | 73 | // 信息窗口参数属性 |
| 92 | 74 | var opts = { |
| ... | ... | @@ -98,7 +80,7 @@ var PublicFunctions = function () { |
| 98 | 80 | height : 450, |
| 99 | 81 | |
| 100 | 82 | // 信息窗位置偏移值。 |
| 101 | - offset: new BMap.Size(500,-80), | |
| 83 | + offset: new BMap.Size(500,80), | |
| 102 | 84 | |
| 103 | 85 | //标题 |
| 104 | 86 | title : '<h4 style="color:#FFFFFF">'+r[0].carParkName+'停车场详情</h4>', |
| ... | ... | @@ -115,13 +97,13 @@ var PublicFunctions = function () { |
| 115 | 97 | |
| 116 | 98 | if(stationShapesType == 'r') { |
| 117 | 99 | |
| 118 | - // 画圆 | |
| 119 | - PublicFunctions.pointsCircle(r,point,htm,opts,mapB); | |
| 100 | + /** 画圆 @param:<r:停车场信息;point:中心点;htm:信息窗口html文本;pots:信息窗口参数属性> */ | |
| 101 | + WorldsBMap.pointsCircle(r,point,htm,opts); | |
| 120 | 102 | |
| 121 | 103 | }else if(stationShapesType == 'd'){ |
| 122 | 104 | |
| 123 | - // 画多边形 | |
| 124 | - PublicFunctions.pointsPolygon(r,point,htm,opts,mapB); | |
| 105 | + /** 画多边形 @param:<r:停车场信息;point:中心点;htm:信息窗口html文本;pots:信息窗口参数属性> */ | |
| 106 | + WorldsBMap.pointsPolygon(r,point,htm,opts); | |
| 125 | 107 | |
| 126 | 108 | } |
| 127 | 109 | } |
| ... | ... | @@ -130,351 +112,27 @@ var PublicFunctions = function () { |
| 130 | 112 | |
| 131 | 113 | }, |
| 132 | 114 | |
| 133 | - // 查询停车场信息 | |
| 134 | - getCarParkInfo : function(callback){ | |
| 135 | - | |
| 136 | - $get('/carpark/findCarParkInfoFormId',{id:id},function(r) { | |
| 137 | - | |
| 138 | - return callback && callback(r); | |
| 139 | - | |
| 140 | - }); | |
| 141 | - | |
| 142 | - }, | |
| 143 | - | |
| 144 | - // 在地图上画圆 | |
| 145 | - pointsCircle : function(r,point,htm,opts,map) { | |
| 146 | - | |
| 147 | - //创建圆 | |
| 148 | - circle = new BMap.Circle(point,r[0].carParkRadius,{strokeColor:"blue", strokeWeight:2, strokeOpacity:0.5}); | |
| 149 | - | |
| 150 | - // 允许覆盖物在map.clearOverlays方法中被清除 | |
| 151 | - circle.enableMassClear(); | |
| 152 | - | |
| 153 | - // 百度地图添加覆盖物圆 | |
| 154 | - map.addOverlay(circle); | |
| 155 | - | |
| 156 | - // 创建信息窗口 | |
| 157 | - infoWindow = new BMap.InfoWindow(htm, opts); | |
| 158 | - | |
| 159 | - // 自定义标注物图片 | |
| 160 | - var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20)); | |
| 161 | - | |
| 162 | - // 创建点 | |
| 163 | - marker = new BMap.Marker(point,{icon : icon_target}); | |
| 164 | - | |
| 165 | - // 把标注添物加到地图上 | |
| 166 | - map.addOverlay(marker); | |
| 167 | - | |
| 168 | - setTimeout(function(){ | |
| 169 | - //开启信息窗口 | |
| 170 | - marker.openInfoWindow(infoWindow,point); | |
| 171 | - | |
| 172 | - },100); | |
| 173 | - | |
| 174 | - // 是否在平移过程中禁止动画。(自1.2新增) | |
| 175 | - var PanOptions_ ={noAnimation :true}; | |
| 176 | - | |
| 177 | - // 将地图的中心点更改为给定的点。 | |
| 178 | - map.panTo(point,PanOptions_); | |
| 179 | - | |
| 180 | - //map.panBy(10,-50,PanOptions_); | |
| 181 | - | |
| 182 | - // 添加标志物监听事件 | |
| 183 | - marker.addEventListener("click",function() { | |
| 184 | - | |
| 185 | - //开启信息窗口 | |
| 186 | - marker.openInfoWindow(infoWindow,point); | |
| 187 | - | |
| 188 | - }); | |
| 189 | - }, | |
| 190 | - | |
| 191 | - pointsPolygon : function(r,pointPolygon,htm,opts_polygon,map) { | |
| 192 | - | |
| 193 | - // 获取多边形坐标字符串 | |
| 194 | - var stationBPolygonGrid = r[0].carParkBparkPoint; | |
| 195 | - | |
| 196 | - // 截取多边形坐标字符串 | |
| 197 | - var stationBPolygonGridStr = stationBPolygonGrid.substring(9,stationBPolygonGrid.length-2); | |
| 198 | - | |
| 199 | - // 按逗号切割 | |
| 200 | - var pointPolygonArray = stationBPolygonGridStr.split(','); | |
| 201 | - | |
| 202 | - // 多边形坐标集合 | |
| 203 | - var polygonP = []; | |
| 204 | - | |
| 205 | - for(var v = 0;v<pointPolygonArray.length;v++) { | |
| 206 | - | |
| 207 | - polygonP.push(new BMap.Point(pointPolygonArray[v].split(" ")[0],pointPolygonArray[v].split(" ")[1])); | |
| 208 | - | |
| 209 | - } | |
| 210 | - | |
| 211 | - // 画多边形 | |
| 212 | - polygon = new BMap.Polygon(polygonP, { | |
| 213 | - | |
| 214 | - // 线条显色 | |
| 215 | - strokeColor : "blue", | |
| 216 | - | |
| 217 | - // 边线的宽度,以像素为单位。 | |
| 218 | - strokeWeight : 2, | |
| 219 | - | |
| 220 | - // 边线透明度,取值范围0 - 1。 | |
| 221 | - strokeOpacity : 0.5 | |
| 222 | - }); | |
| 223 | - | |
| 224 | - // 增加地图覆盖物多边形 | |
| 225 | - map.addOverlay(polygon); | |
| 226 | - | |
| 227 | - // 创建信息窗口 | |
| 228 | - infoWindow = new BMap.InfoWindow(htm, opts_polygon); | |
| 229 | - | |
| 230 | - // 自定义标注物图片 | |
| 231 | - var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20)); | |
| 232 | - | |
| 233 | - // 创建点 | |
| 234 | - marker = new BMap.Marker(pointPolygon,{icon : icon_target}); | |
| 235 | - | |
| 236 | - // 把标注添物加到地图上 | |
| 237 | - map.addOverlay(marker); | |
| 238 | - | |
| 239 | - // 是否在平移过程中禁止动画。(自1.2新增) | |
| 240 | - var PanOptions_ ={noAnimation :true}; | |
| 241 | - | |
| 242 | - // 将地图的中心点更改为给定的点。 | |
| 243 | - map.panTo(pointPolygon,PanOptions_); | |
| 244 | - | |
| 245 | - // 将地图在水平位置上移动x像素,垂直位置上移动y像素。 | |
| 246 | - map.panBy(10,110,PanOptions_); | |
| 247 | - | |
| 248 | - //开启信息窗口 | |
| 249 | - marker.openInfoWindow(infoWindow,pointPolygon); | |
| 250 | - | |
| 251 | - }, | |
| 252 | - | |
| 253 | - // 编辑图形 | |
| 254 | - editShapes : function(stationShapesTypeV,mindex) { | |
| 255 | - | |
| 256 | - // 关闭信息窗口 | |
| 257 | - marker.closeInfoWindow(); | |
| 258 | - | |
| 259 | - // 清除marker | |
| 260 | - mapB.removeOverlay(marker); | |
| 261 | - | |
| 262 | - // 编辑圆 | |
| 263 | - if(stationShapesTypeV =='r') { | |
| 264 | - | |
| 265 | - // 开启编辑功能 | |
| 266 | - circle.enableEditing(); | |
| 267 | - | |
| 268 | - // 编辑圆监听事件 | |
| 269 | - circle.addEventListener('dblclick',function() { | |
| 270 | - | |
| 271 | - // 关闭提示弹出层 | |
| 272 | - layer.close(mindex); | |
| 273 | - | |
| 274 | - // 返回圆形的半径,单位为米。 | |
| 275 | - var newRadius = circle.getRadius(); | |
| 276 | - | |
| 277 | - // 返回圆形的中心点坐标。 | |
| 278 | - var newCenter = circle.getCenter().lng + ' ' + circle.getCenter().lat; | |
| 279 | - | |
| 280 | - var centre_New = [{potion:{lng:circle.getCenter().lng,lat:circle.getCenter().lat}}]; | |
| 281 | - | |
| 282 | - // 中心百度坐标转WGS坐标 | |
| 283 | - PublicFunctions.getFormPointEToWGS(centre_New,function(p) { | |
| 284 | - | |
| 285 | - // 设置修改站点参数集合 | |
| 286 | - PublicFunctions.editSeteditStationParmasValue(newCenter, p[0].WGSpotion.Lng , p[0].WGSpotion.Lat,'','','r',Math.round(newRadius)); | |
| 287 | - | |
| 288 | - // 加载编辑页面 | |
| 289 | - $.get('edit.html', function(m){$(pjaxContainer).append(m);}); | |
| 290 | - | |
| 291 | - }); | |
| 292 | - | |
| 293 | - }); | |
| 294 | - | |
| 295 | - // 编辑多变行 | |
| 296 | - }else if(stationShapesTypeV =='d') { | |
| 297 | - | |
| 298 | - // 开启编辑功能(自 1.1 新增) | |
| 299 | - polygon.enableEditing(); | |
| 300 | - | |
| 301 | - // 添加多变行编辑事件 | |
| 302 | - polygon.addEventListener('dblclick',function(e) { | |
| 303 | - | |
| 304 | - // 获取编辑的多边形对象 | |
| 305 | - var edit_pointE = polygon; | |
| 306 | - | |
| 307 | - // 多边形坐标点集合 | |
| 308 | - var eidt_PointsList = []; | |
| 309 | - | |
| 310 | - for ( var i = 0; i < edit_pointE.getPath().length; i++) { | |
| 311 | - | |
| 312 | - eidt_PointsList.push({potion: {lng: edit_pointE.getPath()[i].lng, lat: edit_pointE.getPath()[i].lat}}); | |
| 313 | - | |
| 314 | - } | |
| 315 | - | |
| 316 | - eidt_PointsList.push({potion: {lng: edit_pointE.getPath()[0].lng, lat: edit_pointE.getPath()[0].lat}}); | |
| 317 | - | |
| 318 | - var edit_centre = [{potion:{lng:edit_pointE.getBounds().getCenter().lng,lat:edit_pointE.getBounds().getCenter().lat}}]; | |
| 319 | - | |
| 320 | - // 多边形中心点 | |
| 321 | - var centre_points = edit_pointE.getBounds().getCenter().lng + ' ' + edit_pointE.getBounds().getCenter().lat; | |
| 322 | - | |
| 323 | - // 多边形坐标点集合转WGS坐标 | |
| 324 | - PublicFunctions.getFormPointEToWGS(eidt_PointsList,function(resultdata) { | |
| 325 | - | |
| 326 | - // 多边形WGS坐标字符串 | |
| 327 | - var eidt_gPloygonGrid = ''; | |
| 328 | - | |
| 329 | - // 百度坐标字符串 | |
| 330 | - var edit_bPloygonGrid = ''; | |
| 331 | - | |
| 332 | - for(var k =0;k<resultdata.length;k++) { | |
| 333 | - | |
| 334 | - if(k==0) { | |
| 335 | - | |
| 336 | - eidt_gPloygonGrid = resultdata[k].WGSpotion.Lng + ' ' +resultdata[k].WGSpotion.Lat; | |
| 337 | - | |
| 338 | - edit_bPloygonGrid = resultdata[k].potion.lng + ' ' +resultdata[k].potion.lat; | |
| 339 | - | |
| 340 | - }else { | |
| 341 | - | |
| 342 | - eidt_gPloygonGrid = eidt_gPloygonGrid + ',' + resultdata[k].WGSpotion.Lng + ' ' +resultdata[k].WGSpotion.Lat; | |
| 343 | - | |
| 344 | - edit_bPloygonGrid = edit_bPloygonGrid + ',' + resultdata[k].potion.lng + ' ' +resultdata[k].potion.lat; | |
| 345 | - | |
| 346 | - } | |
| 347 | - | |
| 348 | - } | |
| 349 | - | |
| 350 | - eidt_gPloygonGrid = 'POLYGON((' + eidt_gPloygonGrid + '))'; | |
| 351 | - | |
| 352 | - edit_bPloygonGrid = 'POLYGON((' + edit_bPloygonGrid + '))'; | |
| 353 | - | |
| 354 | - // 中心点坐标转WGS坐标 | |
| 355 | - PublicFunctions.getFormPointEToWGS(edit_centre,function(p) { | |
| 356 | - | |
| 357 | - var edit_gLonx = p[0].WGSpotion.Lng; | |
| 358 | - | |
| 359 | - var edit_gLaty = p[0].WGSpotion.Lat; | |
| 360 | - | |
| 361 | - // 设置编辑站点参宿集合 | |
| 362 | - PublicFunctions.editSeteditStationParmasValue(centre_points,edit_gLonx,edit_gLaty,edit_bPloygonGrid,eidt_gPloygonGrid,'d',''); | |
| 363 | - | |
| 364 | - // 加载编辑页面 | |
| 365 | - $.get('edit.html', function(m){$(pjaxContainer).append(m);}); | |
| 366 | - | |
| 367 | - }); | |
| 368 | - | |
| 369 | - }); | |
| 370 | - }); | |
| 371 | - | |
| 372 | - } | |
| 373 | - | |
| 374 | - }, | |
| 375 | - | |
| 376 | - // 原百度坐标转WGS坐标 | |
| 377 | - getFormPointEToWGS: function(points,callback) { | |
| 378 | - | |
| 379 | - // 获取长度 | |
| 380 | - var len = points.length; | |
| 381 | - | |
| 382 | - (function(){ | |
| 383 | - | |
| 384 | - if (!arguments.callee.count) { | |
| 385 | - | |
| 386 | - arguments.callee.count = 0; | |
| 387 | - | |
| 388 | - } | |
| 389 | - | |
| 390 | - arguments.callee.count++; | |
| 391 | - | |
| 392 | - var index = parseInt(arguments.callee.count) - 1; | |
| 393 | - | |
| 394 | - if (index >= len) { | |
| 395 | - | |
| 396 | - callback && callback(points); | |
| 397 | - | |
| 398 | - return; | |
| 399 | - } | |
| 400 | - | |
| 401 | - var f = arguments.callee; | |
| 402 | - | |
| 403 | - $.ajax({ | |
| 404 | - | |
| 405 | - url: 'http://api.zdoz.net/bd2wgs.aspx', | |
| 406 | - | |
| 407 | - data: {lat: points[index].potion.lat , lng: points[index].potion.lng}, | |
| 408 | - | |
| 409 | - dataType: 'jsonp', | |
| 410 | - | |
| 411 | - success: function(r){ | |
| 412 | - | |
| 413 | - if(r) { | |
| 414 | - | |
| 415 | - points[index].WGSpotion = r; | |
| 416 | - | |
| 417 | - } | |
| 418 | - | |
| 419 | - f(); | |
| 420 | - } | |
| 421 | - }); | |
| 422 | - | |
| 423 | - })(); | |
| 424 | - | |
| 425 | - }, | |
| 426 | - | |
| 427 | - editSeteditStationParmasValue : function(points,gLonx,gLaty,bPolygonGridValue,gPolygonGridVlaue,shapesTypeValue,radiusValue) { | |
| 428 | - | |
| 429 | - // 百度地图经纬度坐标中心点 | |
| 430 | - carParkObj[0].carParkBcenterPoint = points; | |
| 431 | - | |
| 432 | - // WGS经度 | |
| 433 | - carParkObj[0].carParkGcenterPoint = gLonx + ' ' + gLaty; | |
| 434 | - | |
| 435 | - // 百度坐标点图形集合 | |
| 436 | - carParkObj[0].carParkGparkPoint = gPolygonGridVlaue; | |
| 437 | - | |
| 438 | - // WGS坐标点图形集合 | |
| 439 | - carParkObj[0].carParkBparkPoint = bPolygonGridValue; | |
| 440 | - | |
| 441 | - // 图形类型 | |
| 442 | - carParkObj[0].carParkShapesType = shapesTypeValue; | |
| 443 | - | |
| 444 | - // 圆形半径 | |
| 445 | - carParkObj[0].carParkRadius = radiusValue; | |
| 115 | + setFormValue : function(carParkObj) { | |
| 446 | 116 | |
| 447 | - }, | |
| 448 | - | |
| 449 | - setFormValue : function() { | |
| 450 | - | |
| 451 | - $('#idInput').val(carParkObj[0].carParkId); | |
| 117 | + $('#idInput').val(carParkObj.carParkId); | |
| 452 | 118 | |
| 453 | - $('#bParkPointInput').val(carParkObj[0].carParkBparkPoint); | |
| 454 | - | |
| 455 | - $('#gParkPointInput').val(carParkObj[0].carParkGparkPoint); | |
| 456 | - | |
| 457 | - $('#parkNameInput').val(carParkObj[0].carParkName); | |
| 458 | - | |
| 459 | - $('#parkCodeInput').val(carParkObj[0].carParkCode); | |
| 119 | + $('#bParkPointInput').val(carParkObj.carParkBparkPoint); | |
| 460 | 120 | |
| 461 | - $('#bCenterPointInput').val(carParkObj[0].carParkBcenterPoint); | |
| 121 | + $('#parkNameInput').val(carParkObj.carParkName); | |
| 462 | 122 | |
| 463 | - $('#gCenterPointInput').val(carParkObj[0].carParkGcenterPoint); | |
| 123 | + $('#parkCodeInput').val(carParkObj.carParkCode); | |
| 464 | 124 | |
| 465 | - $('#shapesTypeSelect').val(carParkObj[0].carParkShapesType); | |
| 125 | + $('#bCenterPointInput').val(carParkObj.carParkBcenterPoint); | |
| 466 | 126 | |
| 467 | - $('#radiusInput').val(carParkObj[0].carParkRadius); | |
| 127 | + $('#shapesTypeSelect').val(carParkObj.carParkShapesType); | |
| 468 | 128 | |
| 469 | - $('#areaInput').val(carParkObj[0].carParkArea); | |
| 129 | + $('#radiusInput').val(carParkObj.carParkRadius); | |
| 470 | 130 | |
| 471 | - /*$('#companySelect').val(carParkObj[0].carParkCompany);*/ | |
| 131 | + $('#areaInput').val(carParkObj.carParkArea); | |
| 472 | 132 | |
| 473 | - /*$('#brancheCompanySelect').val(carParkObj[0].carParkBrancheCompany);*/ | |
| 133 | + $('#destroySelect').val(carParkObj.carParkDestroy); | |
| 474 | 134 | |
| 475 | - $('#destroySelect').val(carParkObj[0].carParkDestroy); | |
| 476 | - | |
| 477 | - $('#descriptionsTextarea').val(carParkObj[0].carParkDescriptions); | |
| 135 | + $('#descriptionsTextarea').val(carParkObj.carParkDescriptions); | |
| 478 | 136 | |
| 479 | 137 | }, |
| 480 | 138 | |
| ... | ... | @@ -536,16 +194,6 @@ var PublicFunctions = function () { |
| 536 | 194 | |
| 537 | 195 | }, |
| 538 | 196 | |
| 539 | - carParkUpdate : function(params,callback){ | |
| 540 | - | |
| 541 | - $post('/carpark/carParkUpdate',params,function(data) { | |
| 542 | - | |
| 543 | - callback && callback(data); | |
| 544 | - | |
| 545 | - }); | |
| 546 | - | |
| 547 | - } | |
| 548 | - | |
| 549 | 197 | } |
| 550 | 198 | |
| 551 | 199 | return PubFun ; | ... | ... |
src/main/resources/static/pages/base/carpark/js/carpark-positions-map.js
| ... | ... | @@ -5,17 +5,12 @@ |
| 5 | 5 | |
| 6 | 6 | var WorldsBMap = function () { |
| 7 | 7 | |
| 8 | + var mapValue='',drawingManager='',marker='',circle='',polygon=''; | |
| 9 | + | |
| 8 | 10 | var Bmap = { |
| 9 | 11 | |
| 10 | 12 | init : function() { |
| 11 | 13 | |
| 12 | - // 关闭左侧栏 | |
| 13 | - if (!$('body').hasClass('page-sidebar-closed')) { | |
| 14 | - | |
| 15 | - $('.menu-toggler.sidebar-toggler').click(); | |
| 16 | - | |
| 17 | - } | |
| 18 | - | |
| 19 | 14 | // 设置中心点, |
| 20 | 15 | var CENTER_POINT = {lng : 121.528733,lat : 31.237425}; |
| 21 | 16 | |
| ... | ... | @@ -23,22 +18,22 @@ var WorldsBMap = function () { |
| 23 | 18 | var bdKey = 'IGGrr4UjwIYzatoCRFKEL8sT'; |
| 24 | 19 | |
| 25 | 20 | // 初始化百度地图 |
| 26 | - var map = new BMap.Map("bmap_basic"); | |
| 21 | + mapValue = new BMap.Map("bmap_basic"); | |
| 27 | 22 | |
| 28 | 23 | //中心点和缩放级别 |
| 29 | - map.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15); | |
| 24 | + mapValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15); | |
| 30 | 25 | |
| 31 | 26 | //启用地图拖拽事件,默认启用(可不写) |
| 32 | - map.enableDragging(); | |
| 27 | + mapValue.enableDragging(); | |
| 33 | 28 | |
| 34 | 29 | //启用地图滚轮放大缩小 |
| 35 | - map.enableScrollWheelZoom(); | |
| 30 | + mapValue.enableScrollWheelZoom(); | |
| 36 | 31 | |
| 37 | 32 | //禁用鼠标双击放大 |
| 38 | - map.disableDoubleClickZoom(); | |
| 33 | + mapValue.disableDoubleClickZoom(); | |
| 39 | 34 | |
| 40 | 35 | //启用键盘上下左右键移动地图 |
| 41 | - map.enableKeyboard(); | |
| 36 | + mapValue.enableKeyboard(); | |
| 42 | 37 | |
| 43 | 38 | var styleOptions = { |
| 44 | 39 | |
| ... | ... | @@ -63,7 +58,7 @@ var WorldsBMap = function () { |
| 63 | 58 | }; |
| 64 | 59 | |
| 65 | 60 | // 创建鼠标绘制管理类 |
| 66 | - drawingManager = new BMapLib.DrawingManager(map, { | |
| 61 | + drawingManager = new BMapLib.DrawingManager(mapValue, { | |
| 67 | 62 | |
| 68 | 63 | //是否开启绘制模式 |
| 69 | 64 | isOpen : false, |
| ... | ... | @@ -112,70 +107,67 @@ var WorldsBMap = function () { |
| 112 | 107 | // 多变行质心点 |
| 113 | 108 | var addSttationPoints_ = pointE.getBounds().getCenter().lng+ ' ' + pointE.getBounds().getCenter().lat; |
| 114 | 109 | |
| 115 | - var PointsList = []; | |
| 116 | - | |
| 117 | - for ( var i = 0; i < pointE.getPath().length; i++) { | |
| 118 | - | |
| 119 | - PointsList.push({potion: {lng: pointE.getPath()[i].lng, lat: pointE.getPath()[i].lat}}); | |
| 120 | - | |
| 121 | - } | |
| 122 | - | |
| 123 | - PointsList.push({potion: {lng: pointE.getPath()[0].lng, lat: pointE.getPath()[0].lat}}); | |
| 124 | - | |
| 125 | - var centre = [{potion:{lng:pointE.getBounds().getCenter().lng,lat:pointE.getBounds().getCenter().lat}}]; | |
| 110 | + var addPolyGonLen_ = pointE.getPath().length; | |
| 126 | 111 | |
| 127 | - PublicFunctions.getFormPointEToWGS(PointsList,function(resultdata) { | |
| 128 | - | |
| 129 | - var gPloygonGrid = ''; | |
| 130 | - | |
| 131 | - var bPloygonGrid = ''; | |
| 112 | + for(var k =0;k<addPolyGonLen_;k++) { | |
| 132 | 113 | |
| 133 | - for(var k =0;k<resultdata.length;k++) { | |
| 114 | + if(k==0) { | |
| 134 | 115 | |
| 135 | - if(k==0) { | |
| 136 | - | |
| 137 | - gPloygonGrid = resultdata[k].WGSpotion.Lng + ' ' +resultdata[k].WGSpotion.Lat; | |
| 138 | - | |
| 139 | - bPloygonGrid = resultdata[k].potion.lng + ' ' +resultdata[k].potion.lat; | |
| 140 | - | |
| 141 | - }else { | |
| 142 | - | |
| 143 | - gPloygonGrid = gPloygonGrid + ',' + resultdata[k].WGSpotion.Lng + ' ' +resultdata[k].WGSpotion.Lat; | |
| 144 | - | |
| 145 | - bPloygonGrid = bPloygonGrid + ',' + resultdata[k].potion.lng + ' ' +resultdata[k].potion.lat; | |
| 146 | - | |
| 147 | - } | |
| 116 | + bPloygonGrid = pointE.getPath()[k].lng + ' ' + pointE.getPath()[k].lat; | |
| 117 | + | |
| 118 | + }else { | |
| 119 | + | |
| 120 | + bPloygonGrid = bPloygonGrid + ',' + pointE.getPath()[k].lng + ' ' + pointE.getPath()[k].lat; | |
| 148 | 121 | |
| 149 | 122 | } |
| 123 | + | |
| 124 | + } | |
| 125 | + | |
| 126 | + bPloygonGrid = bPloygonGrid + ',' + pointE.getPath()[0].lng + ' ' + pointE.getPath()[0].lat; | |
| 127 | + | |
| 128 | + /** 设置修改停车场集合对象图形质心点属性 @param:<addSttationPoints_:多边形质心点> */ | |
| 129 | + EditCarParkObj.setCarParkBcenterPoint(addSttationPoints_); | |
| 130 | + | |
| 131 | + /** 设置修改停车场集合对象图形类型属性 @param:<shapeType:图形类型> */ | |
| 132 | + EditCarParkObj.setCarParkShapesType('d'); | |
| 133 | + | |
| 134 | + /** 设置修改停车场集合对象圆形半径属性 @param:<radius:圆形半径> */ | |
| 135 | + EditCarParkObj.setCarParkRadius(''); | |
| 136 | + | |
| 137 | + /** 设置修改停车场集合对象名称 @param:<bParkPoint:多边形图形坐标集合> */ | |
| 138 | + EditCarParkObj.setCarParkBparkPoint(bPloygonGrid); | |
| 139 | + | |
| 140 | + $.get('edit.html', function(m){ | |
| 150 | 141 | |
| 151 | - gPloygonGrid = 'POLYGON((' + gPloygonGrid + '))'; | |
| 152 | - | |
| 153 | - bPloygonGrid = 'POLYGON((' + bPloygonGrid + '))'; | |
| 142 | + $(pjaxContainer).append(m); | |
| 154 | 143 | |
| 155 | - PublicFunctions.getFormPointEToWGS(centre,function(p) { | |
| 156 | - | |
| 157 | - var gLonx = p[0].WGSpotion.Lng; | |
| 158 | - | |
| 159 | - var gLaty = p[0].WGSpotion.Lat; | |
| 160 | - | |
| 161 | - PublicFunctions.editSeteditStationParmasValue(addSttationPoints_,gLonx,gLaty,bPloygonGrid,gPloygonGrid,'d',''); | |
| 162 | - | |
| 163 | - $.get('edit.html', function(m){$(pjaxContainer).append(m);}); | |
| 164 | - | |
| 165 | - }); | |
| 144 | + $('#editPoitsions_carpark_mobal').trigger('editCarParkMobal_show', [WorldsBMap,PublicFunctions,EditCarParkObj,GetAjaxData]); | |
| 166 | 145 | |
| 167 | - }); | |
| 146 | + }); | |
| 168 | 147 | |
| 169 | 148 | } |
| 170 | 149 | |
| 171 | 150 | }); |
| 172 | - return map; | |
| 151 | + return mapValue; | |
| 173 | 152 | }, |
| 174 | 153 | |
| 175 | -localSearchFromAdreesToPoint: function(Address,map,callback) { | |
| 154 | + openDrawingManager : function() { | |
| 155 | + | |
| 156 | + // 清楚地图覆盖物 | |
| 157 | + mapValue.clearOverlays(); | |
| 158 | + | |
| 159 | + // 打开鼠标绘画工具 | |
| 160 | + drawingManager.open(); | |
| 161 | + | |
| 162 | + // 设置属性 | |
| 163 | + drawingManager.setDrawingMode(BMAP_DRAWING_POLYGON); | |
| 164 | + | |
| 165 | + }, | |
| 166 | + | |
| 167 | + localSearchFromAdreesToPoint: function(Address) { | |
| 176 | 168 | |
| 177 | 169 | // 创建一个搜索类实例 |
| 178 | - var localSearch = new BMap.LocalSearch(map); | |
| 170 | + var localSearch = new BMap.LocalSearch(mapValue); | |
| 179 | 171 | |
| 180 | 172 | // 检索完成后的回调函数。 |
| 181 | 173 | localSearch.setSearchCompleteCallback(function (searchResult) { |
| ... | ... | @@ -190,26 +182,267 @@ localSearchFromAdreesToPoint: function(Address,map,callback) { |
| 190 | 182 | if(poi) { |
| 191 | 183 | |
| 192 | 184 | //获取经度和纬度 |
| 193 | - resultPoints = poi.point.lng + ' ' + poi.point.lat; | |
| 194 | - | |
| 195 | - callback && callback(resultPoints); | |
| 185 | + var Points = poi.point.lng + ' ' + poi.point.lat; | |
| 196 | 186 | |
| 197 | - }else { | |
| 187 | + var BJwpointsArray = Points.split(' '); | |
| 188 | + | |
| 189 | + var stationNameChangePoint = new BMap.Point(BJwpointsArray[0], BJwpointsArray[1]); | |
| 190 | + | |
| 191 | + var marker_stargt2 = new BMap.Marker(stationNameChangePoint); | |
| 192 | + | |
| 193 | + var PanOptions ={noAnimation :true}; | |
| 194 | + | |
| 195 | + mapValue.panTo(stationNameChangePoint,PanOptions); | |
| 196 | + | |
| 197 | + mapValue.panBy(0,-200); | |
| 198 | + | |
| 199 | + // 将标注添加到地图中 | |
| 200 | + mapValue.addOverlay(marker_stargt2); | |
| 201 | + | |
| 202 | + //跳动的动画 | |
| 203 | + marker_stargt2.setAnimation(BMAP_ANIMATION_BOUNCE); | |
| 198 | 204 | |
| 199 | - callback && callback(false); | |
| 200 | - | |
| 201 | - } | |
| 202 | - | |
| 203 | - }else { | |
| 205 | + } | |
| 204 | 206 | |
| 205 | - callback && callback(false); | |
| 206 | - } | |
| 207 | + } | |
| 207 | 208 | |
| 208 | 209 | }); |
| 209 | 210 | |
| 210 | 211 | // 根据检索词发起检索。 |
| 211 | 212 | localSearch.search(Address); |
| 212 | 213 | |
| 214 | + }, | |
| 215 | + | |
| 216 | + /** 画圆 @param:<r:停车场信息;point:中心点;htm:信息窗口html文本;pots:信息窗口参数属性> */ | |
| 217 | + pointsCircle : function(r,point,htm,opts) { | |
| 218 | + | |
| 219 | + //创建圆 | |
| 220 | + circle = new BMap.Circle(point,r[0].carParkRadius,{strokeColor:"blue", strokeWeight:2, strokeOpacity:0.5}); | |
| 221 | + | |
| 222 | + // 允许覆盖物在map.clearOverlays方法中被清除 | |
| 223 | + circle.enableMassClear(); | |
| 224 | + | |
| 225 | + // 百度地图添加覆盖物圆 | |
| 226 | + mapValue.addOverlay(circle); | |
| 227 | + | |
| 228 | + // 创建信息窗口 | |
| 229 | + infoWindow = new BMap.InfoWindow(htm, opts); | |
| 230 | + | |
| 231 | + // 自定义标注物图片 | |
| 232 | + var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20)); | |
| 233 | + | |
| 234 | + // 创建点 | |
| 235 | + marker = new BMap.Marker(point,{icon : icon_target}); | |
| 236 | + | |
| 237 | + // 把标注添物加到地图上 | |
| 238 | + mapValue.addOverlay(marker); | |
| 239 | + | |
| 240 | + setTimeout(function(){ | |
| 241 | + //开启信息窗口 | |
| 242 | + marker.openInfoWindow(infoWindow,point); | |
| 243 | + | |
| 244 | + },100); | |
| 245 | + | |
| 246 | + // 是否在平移过程中禁止动画。(自1.2新增) | |
| 247 | + var PanOptions_ ={noAnimation :true}; | |
| 248 | + | |
| 249 | + // 将地图的中心点更改为给定的点。 | |
| 250 | + mapValue.panTo(point,PanOptions_); | |
| 251 | + | |
| 252 | + // 添加标志物监听事件 | |
| 253 | + marker.addEventListener("click",function() { | |
| 254 | + | |
| 255 | + //开启信息窗口 | |
| 256 | + marker.openInfoWindow(infoWindow,point); | |
| 257 | + | |
| 258 | + }); | |
| 259 | + }, | |
| 260 | + | |
| 261 | + /** 画多边形 @param:<r:停车场信息;point:中心点;htm:信息窗口html文本;pots:信息窗口参数属性> */ | |
| 262 | + pointsPolygon : function(r,pointPolygon,htm,opts_polygon) { | |
| 263 | + | |
| 264 | + // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增) | |
| 265 | + mapValue.setZoom(17); | |
| 266 | + | |
| 267 | + // 获取多边形坐标字符串 | |
| 268 | + var stationBPolygonGrid = r[0].carParkBparkPoint; | |
| 269 | + | |
| 270 | + // 截取多边形坐标字符串 | |
| 271 | + var stationBPolygonGridStr = stationBPolygonGrid.substring(9,stationBPolygonGrid.length-2); | |
| 272 | + | |
| 273 | + // 按逗号切割 | |
| 274 | + var pointPolygonArray = stationBPolygonGridStr.split(','); | |
| 275 | + | |
| 276 | + // 多边形坐标集合 | |
| 277 | + var polygonP = []; | |
| 278 | + | |
| 279 | + for(var v = 0;v<pointPolygonArray.length;v++) { | |
| 280 | + | |
| 281 | + polygonP.push(new BMap.Point(pointPolygonArray[v].split(" ")[0],pointPolygonArray[v].split(" ")[1])); | |
| 282 | + | |
| 283 | + } | |
| 284 | + | |
| 285 | + // 画多边形 | |
| 286 | + polygon = new BMap.Polygon(polygonP, { | |
| 287 | + | |
| 288 | + // 线条显色 | |
| 289 | + strokeColor : "blue", | |
| 290 | + | |
| 291 | + // 边线的宽度,以像素为单位。 | |
| 292 | + strokeWeight : 2, | |
| 293 | + | |
| 294 | + // 边线透明度,取值范围0 - 1。 | |
| 295 | + strokeOpacity : 0.5 | |
| 296 | + }); | |
| 297 | + | |
| 298 | + // 增加地图覆盖物多边形 | |
| 299 | + mapValue.addOverlay(polygon); | |
| 300 | + | |
| 301 | + // 创建信息窗口 | |
| 302 | + infoWindow = new BMap.InfoWindow(htm, opts_polygon); | |
| 303 | + | |
| 304 | + // 自定义标注物图片 | |
| 305 | + var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20)); | |
| 306 | + | |
| 307 | + // 创建点 | |
| 308 | + marker = new BMap.Marker(pointPolygon,{icon : icon_target}); | |
| 309 | + | |
| 310 | + // 把标注添物加到地图上 | |
| 311 | + mapValue.addOverlay(marker); | |
| 312 | + | |
| 313 | + // 是否在平移过程中禁止动画。(自1.2新增) | |
| 314 | + var PanOptions_ ={noAnimation :true}; | |
| 315 | + | |
| 316 | + // 将地图的中心点更改为给定的点。 | |
| 317 | + mapValue.panTo(pointPolygon,PanOptions_); | |
| 318 | + | |
| 319 | + // 将地图在水平位置上移动x像素,垂直位置上移动y像素。 | |
| 320 | + mapValue.panBy(10,-250,PanOptions_); | |
| 321 | + | |
| 322 | + //开启信息窗口 | |
| 323 | + marker.openInfoWindow(infoWindow,pointPolygon); | |
| 324 | + | |
| 325 | + }, | |
| 326 | + | |
| 327 | + // 编辑图形 | |
| 328 | + editShapes : function(stationShapesTypeV,mindex) { | |
| 329 | + | |
| 330 | + // 关闭信息窗口 | |
| 331 | + marker.closeInfoWindow(); | |
| 332 | + | |
| 333 | + // 清除marker | |
| 334 | + mapValue.removeOverlay(marker); | |
| 335 | + | |
| 336 | + // 编辑圆 | |
| 337 | + if(stationShapesTypeV =='r') { | |
| 338 | + | |
| 339 | + // 开启编辑功能 | |
| 340 | + circle.enableEditing(); | |
| 341 | + | |
| 342 | + // 编辑圆监听事件 | |
| 343 | + circle.addEventListener('dblclick',function() { | |
| 344 | + | |
| 345 | + // 关闭提示弹出层 | |
| 346 | + layer.close(mindex); | |
| 347 | + | |
| 348 | + // 返回圆形的半径,单位为米。 | |
| 349 | + var newRadius = circle.getRadius(); | |
| 350 | + | |
| 351 | + // 返回圆形的中心点坐标。 | |
| 352 | + var newCenter = circle.getCenter().lng + ' ' + circle.getCenter().lat; | |
| 353 | + | |
| 354 | + var centre_New = [{potion:{lng:circle.getCenter().lng,lat:circle.getCenter().lat}}]; | |
| 355 | + | |
| 356 | + /** 设置修改停车场集合对象图形质心点属性 @param:<addSttationPoints_:多边形质心点> */ | |
| 357 | + EditCarParkObj.setCarParkBcenterPoint(newCenter); | |
| 358 | + | |
| 359 | + /** 设置修改停车场集合对象图形类型属性 @param:<shapeType:图形类型> */ | |
| 360 | + EditCarParkObj.setCarParkShapesType('r'); | |
| 361 | + | |
| 362 | + /** 设置修改停车场集合对象圆形半径属性 @param:<radius:圆形半径> */ | |
| 363 | + EditCarParkObj.setCarParkRadius(Math.round(newRadius)); | |
| 364 | + | |
| 365 | + /** 设置修改停车场集合对象名称 @param:<bParkPoint:多边形图形坐标集合> */ | |
| 366 | + EditCarParkObj.setCarParkBparkPoint(''); | |
| 367 | + | |
| 368 | + // 加载编辑页面 | |
| 369 | + $.get('edit.html', function(m){ | |
| 370 | + | |
| 371 | + $(pjaxContainer).append(m); | |
| 372 | + | |
| 373 | + $('#editPoitsions_carpark_mobal').trigger('editCarParkMobal_show', [WorldsBMap,PublicFunctions,EditCarParkObj,GetAjaxData]); | |
| 374 | + | |
| 375 | + }); | |
| 376 | + | |
| 377 | + }); | |
| 378 | + | |
| 379 | + // 编辑多变行 | |
| 380 | + }else if(stationShapesTypeV =='d') { | |
| 381 | + | |
| 382 | + // 开启编辑功能(自 1.1 新增) | |
| 383 | + polygon.enableEditing(); | |
| 384 | + | |
| 385 | + // 添加多变行编辑事件 | |
| 386 | + polygon.addEventListener('dblclick',function(e) { | |
| 387 | + | |
| 388 | + // 获取编辑的多边形对象 | |
| 389 | + var edit_pointE = polygon; | |
| 390 | + | |
| 391 | + var edit_bPloygonGrid = ""; | |
| 392 | + | |
| 393 | + var editPolyGonLen_ = edit_pointE.getPath().length; | |
| 394 | + | |
| 395 | + for(var k =0;k<editPolyGonLen_;k++) { | |
| 396 | + | |
| 397 | + if(k==0) { | |
| 398 | + | |
| 399 | + edit_bPloygonGrid = edit_pointE.getPath()[k].lng + ' ' + edit_pointE.getPath()[k].lat; | |
| 400 | + | |
| 401 | + }else { | |
| 402 | + | |
| 403 | + edit_bPloygonGrid = edit_bPloygonGrid + ',' + edit_pointE.getPath()[k].lng + ' ' + edit_pointE.getPath()[k].lat; | |
| 404 | + | |
| 405 | + } | |
| 406 | + | |
| 407 | + } | |
| 408 | + | |
| 409 | + edit_bPloygonGrid = edit_bPloygonGrid + ',' + edit_pointE.getPath()[0].lng + ' ' + edit_pointE.getPath()[0].lat; | |
| 410 | + | |
| 411 | + // 多边形中心点 | |
| 412 | + var centre_points = edit_pointE.getBounds().getCenter().lng + ' ' + edit_pointE.getBounds().getCenter().lat; | |
| 413 | + | |
| 414 | + | |
| 415 | + /** 设置修改停车场集合对象图形质心点属性 @param:<addSttationPoints_:多边形质心点> */ | |
| 416 | + EditCarParkObj.setCarParkBcenterPoint(centre_points); | |
| 417 | + | |
| 418 | + /** 设置修改停车场集合对象图形类型属性 @param:<shapeType:图形类型> */ | |
| 419 | + EditCarParkObj.setCarParkShapesType('d'); | |
| 420 | + | |
| 421 | + /** 设置修改停车场集合对象圆形半径属性 @param:<radius:圆形半径> */ | |
| 422 | + EditCarParkObj.setCarParkRadius(''); | |
| 423 | + | |
| 424 | + /** 设置修改停车场集合对象名称 @param:<bParkPoint:多边形图形坐标集合> */ | |
| 425 | + EditCarParkObj.setCarParkBparkPoint(edit_bPloygonGrid); | |
| 426 | + | |
| 427 | + $.get('edit.html', function(m){ | |
| 428 | + | |
| 429 | + $(pjaxContainer).append(m); | |
| 430 | + | |
| 431 | + $('#editPoitsions_carpark_mobal').trigger('editCarParkMobal_show', [WorldsBMap,PublicFunctions,EditCarParkObj,GetAjaxData]); | |
| 432 | + | |
| 433 | + }); | |
| 434 | + | |
| 435 | + }); | |
| 436 | + | |
| 437 | + } | |
| 438 | + | |
| 439 | + }, | |
| 440 | + | |
| 441 | + clearMarkAndOverlays : function() { | |
| 442 | + | |
| 443 | + // 清楚地图覆盖物 | |
| 444 | + mapValue.clearOverlays(); | |
| 445 | + | |
| 213 | 446 | } |
| 214 | 447 | } |
| 215 | 448 | ... | ... |
src/main/resources/static/pages/base/carpark/js/carpark-positions-reload.js
| ... | ... | @@ -14,17 +14,24 @@ |
| 14 | 14 | |
| 15 | 15 | (function(){ |
| 16 | 16 | |
| 17 | - // 获取参数线路ID | |
| 17 | + // 获取参数停车场ID | |
| 18 | 18 | id = $.url().param('no'); |
| 19 | 19 | |
| 20 | + // 关闭左侧栏 | |
| 21 | + if (!$('body').hasClass('page-sidebar-closed')) { | |
| 22 | + | |
| 23 | + $('.menu-toggler.sidebar-toggler').click(); | |
| 24 | + | |
| 25 | + } | |
| 26 | + | |
| 20 | 27 | // 等候500毫秒执行 |
| 21 | 28 | setTimeout(function(){ |
| 22 | 29 | |
| 23 | 30 | // 地图初始化 |
| 24 | 31 | mapB = WorldsBMap.init(); |
| 25 | 32 | |
| 26 | - // 初始化停车场信息 | |
| 27 | - PublicFunctions.initCarPark(); | |
| 33 | + /** 停车场信息初始化 @param:<id:停车场ID> */ | |
| 34 | + PublicFunctions.initCarPark(id); | |
| 28 | 35 | |
| 29 | 36 | },200); |
| 30 | 37 | ... | ... |
src/main/resources/static/pages/base/carpark/js/positioncarpark.js
0 → 100644
| 1 | +var EditCarParkObj = function () { | |
| 2 | + | |
| 3 | + /** 定义修改停车场对象 */ | |
| 4 | + var CarPark={}; | |
| 5 | + | |
| 6 | + var CarParkObj = { | |
| 7 | + | |
| 8 | + /** 获取修改停车场集合对象 @return:<CarPark:修改停车场对象> */ | |
| 9 | + getEitdCarPark : function() { | |
| 10 | + | |
| 11 | + return CarPark; | |
| 12 | + }, | |
| 13 | + | |
| 14 | + /** 设置修改停车场集合对象 */ | |
| 15 | + setEitdCarPark : function(sc) { | |
| 16 | + | |
| 17 | + CarPark = sc; | |
| 18 | + }, | |
| 19 | + | |
| 20 | + /** 设置修改停车场集合对象名称属性 @param:<name:停车场名称> */ | |
| 21 | + setEitdCarParkName : function(name) { | |
| 22 | + | |
| 23 | + CarPark.carParkName = name; | |
| 24 | + }, | |
| 25 | + | |
| 26 | + /** 设置修改停车场集合对象图形质心点属性 @param:<center:多边形质心点> */ | |
| 27 | + setCarParkBcenterPoint : function(center) { | |
| 28 | + | |
| 29 | + CarPark.carParkBcenterPoint = center; | |
| 30 | + | |
| 31 | + }, | |
| 32 | + | |
| 33 | + /** 设置修改停车场集合对象多边形图形坐标集合属性 @param:<bParkPoint:多边形图形坐标集合> */ | |
| 34 | + setCarParkBparkPoint : function(bParkPoint) { | |
| 35 | + | |
| 36 | + CarPark.carParkBparkPoint = bParkPoint; | |
| 37 | + }, | |
| 38 | + | |
| 39 | + /** 设置修改停车场集合对象图形类型属性 @param:<shapeType:图形类型> */ | |
| 40 | + setCarParkShapesType : function(shapeType) { | |
| 41 | + | |
| 42 | + CarPark.carParkShapesType = shapeType; | |
| 43 | + }, | |
| 44 | + | |
| 45 | + /** 设置修改停车场集合对象圆形半径属性 @param:<radius:圆形半径> */ | |
| 46 | + setCarParkRadius : function(radius) { | |
| 47 | + | |
| 48 | + CarPark.carParkRadius = radius; | |
| 49 | + | |
| 50 | + } | |
| 51 | + | |
| 52 | + } | |
| 53 | + | |
| 54 | + return CarParkObj; | |
| 55 | + | |
| 56 | +}(); | ... | ... |
src/main/resources/static/pages/base/carpark/positions.html
| ... | ... | @@ -20,21 +20,21 @@ |
| 20 | 20 | </ul> |
| 21 | 21 | </div> |
| 22 | 22 | </div> |
| 23 | -<script type="text/javascript"> | |
| 24 | - | |
| 25 | - /** carParkObj:停车场对象;drawingManager:绘制工具对象;mapB地图对象;circle:圆对象; polygon:多边形对象;marker:覆盖物对象;信息窗口对象:infoWindow;id:停车场ID*/ | |
| 26 | - var carParkObj = '',drawingManager= '',mapB = '',circle = '',polygon='', polygon = '',marker = '',infoWindow = '',id=''; | |
| 27 | - | |
| 28 | -</script> | |
| 23 | + | |
| 24 | +<!-- 编辑停车场对象类 --> | |
| 25 | +<script src="/pages/base/carpark/js/positioncarpark.js"></script> | |
| 26 | + | |
| 27 | +<!-- ajax异步请求类 --> | |
| 28 | +<script src="/pages/base/carpark/js/carpark-positions-ajax.js"></script> | |
| 29 | + | |
| 30 | +<!-- 函数方法JS类库 --> | |
| 31 | +<script src="/pages/base/carpark/js/carpark-positions-function.js"></script> | |
| 29 | 32 | |
| 30 | 33 | <!-- 地图JS类库 --> |
| 31 | 34 | <script src="/pages/base/carpark/js/carpark-positions-map.js"></script> |
| 32 | 35 | |
| 33 | -<!-- 方法JS类库 --> | |
| 34 | -<script src="/pages/base/carpark/js/carpark-positions-function.js"></script> | |
| 36 | +<!-- 事件(PublicFunctions)JS类库 --> | |
| 37 | +<script src="/pages/base/carpark/js/carpark-positions-events.js"></script> | |
| 35 | 38 | |
| 36 | 39 | <!-- reloadJS类库 --> |
| 37 | -<script src="/pages/base/carpark/js/carpark-positions-reload.js"></script> | |
| 38 | - | |
| 39 | -<!-- 事件JS类库 --> | |
| 40 | -<script src="/pages/base/carpark/js/carpark-positions-events.js"></script> | |
| 41 | 40 | \ No newline at end of file |
| 41 | +<script src="/pages/base/carpark/js/carpark-positions-reload.js"></script> | |
| 42 | 42 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/section/editsection.html
0 → 100644
| 1 | +<!-- 编辑路段 --> | |
| 2 | +<div class="modal fade" id="edit_section_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="edit_section__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 | + <!-- 线路ID --> | |
| 22 | + | |
| 23 | + <input type="hidden" name="sectionId" id="sectionIdInput"> | |
| 24 | + | |
| 25 | + <input type="hidden" name="sectionRouteId" id="sectionRouteIdInput"> | |
| 26 | + | |
| 27 | + <input type="hidden" name="sectionRouteLine" id="sectionRouteLineInput"> | |
| 28 | + | |
| 29 | + <input type="hidden" name="lineCode" id="lineCodeInput"> | |
| 30 | + | |
| 31 | + <input type="hidden" name="bsectionVector" id="bsectionVectorInput" /> | |
| 32 | + | |
| 33 | + <input type="hidden" name="csectionVector" id="csectionVectorInput" value=""/> | |
| 34 | + | |
| 35 | + <input type="hidden" name="dbType" id="dbTypeInput" value="b"/> | |
| 36 | + | |
| 37 | + <!-- 路段名称 --> | |
| 38 | + <div class="form-body"> | |
| 39 | + <div class="form-group"> | |
| 40 | + <label class="control-label col-md-3"> | |
| 41 | + <span class="required"> * </span> 路段名称: | |
| 42 | + </label> | |
| 43 | + <div class="col-md-6"> | |
| 44 | + <input type="text" class="form-control" name="sectionName" id="sectionNameInput" placeholder="路段名称"> | |
| 45 | + </div> | |
| 46 | + </div> | |
| 47 | + </div> | |
| 48 | + | |
| 49 | + <!-- 路段编码 --> | |
| 50 | + <div class="form-body"> | |
| 51 | + <div class="form-group"> | |
| 52 | + <label class="control-label col-md-3"> | |
| 53 | + <span class="required"> * </span> 路段编码: | |
| 54 | + </label> | |
| 55 | + <div class="col-md-6"> | |
| 56 | + <input type="text" class="form-control" name="sectionCode" id="sectionCodeInput" placeholder="路段编码"> | |
| 57 | + </div> | |
| 58 | + </div> | |
| 59 | + </div> | |
| 60 | + | |
| 61 | + <!-- 路段序号 --> | |
| 62 | + <div class="form-body"> | |
| 63 | + <div class="form-group"> | |
| 64 | + <label class="control-label col-md-3"> | |
| 65 | + <span class="required"> * </span>上一路段: | |
| 66 | + </label> | |
| 67 | + <div class="col-md-6"> | |
| 68 | + <select name="sectionrouteCode" class="form-control" id="sectionrouteCodeSelect"></select> | |
| 69 | + <span class="help-block"> *说明:选择的路段将作为本站序号的参考,成为选择路段的下一个路段。 </span> | |
| 70 | + </div> | |
| 71 | + </div> | |
| 72 | + </div> | |
| 73 | + | |
| 74 | + <!-- 路段方向 --> | |
| 75 | + <div class="form-body"> | |
| 76 | + <div class="form-group"> | |
| 77 | + <label class="control-label col-md-3"> | |
| 78 | + <span class="required"> * </span>路段方向: | |
| 79 | + </label> | |
| 80 | + <div class="col-md-6"> | |
| 81 | + <select name="directions" class="form-control" id="directionsSection"> | |
| 82 | + <option value="">-- 请选择路段类型 --</option> | |
| 83 | + <option value="0">上行</option> | |
| 84 | + <option value="1">下行</option> | |
| 85 | + </select> | |
| 86 | + </div> | |
| 87 | + </div> | |
| 88 | + </div> | |
| 89 | + | |
| 90 | + <!-- 道路编码--> | |
| 91 | + <div class="form-body"> | |
| 92 | + <div class="form-group"> | |
| 93 | + <label class="control-label col-md-3">道路编码:</label> | |
| 94 | + <div class="col-md-6"> | |
| 95 | + <input type="text" class="form-control" name="roadCoding" id="roadCodingCodInput" placeholder="道路编码"> | |
| 96 | + </div> | |
| 97 | + </div> | |
| 98 | + </div> | |
| 99 | + | |
| 100 | + <!-- 路段限速 --> | |
| 101 | + <div class="form-body"> | |
| 102 | + <div class="form-group"> | |
| 103 | + <label class="control-label col-md-3"> | |
| 104 | + <span class="required"> * </span> 路段限速: | |
| 105 | + </label> | |
| 106 | + <div class="col-md-6"> | |
| 107 | + <input type="text" class="form-control" name="speedLimit" id="speedLimitInput" placeholder="路段限速"> | |
| 108 | + </div> | |
| 109 | + </div> | |
| 110 | + </div> | |
| 111 | + | |
| 112 | + <!-- 路段时长 --> | |
| 113 | + <div class="form-body"> | |
| 114 | + <div class="form-group"> | |
| 115 | + <label class="col-md-3 control-label">路段时长:</label> | |
| 116 | + <div class="col-md-6"> | |
| 117 | + <input type="text" class="form-control" name="sectionTime" id="sectionTimeInput" placeholder="路段时长"> | |
| 118 | + <span class="help-block">单位:分钟</span> | |
| 119 | + </div> | |
| 120 | + </div> | |
| 121 | + </div> | |
| 122 | + | |
| 123 | + <!-- 路段长度 --> | |
| 124 | + <div class="form-body"> | |
| 125 | + <div class="form-group"> | |
| 126 | + <label class="col-md-3 control-label">路段长度:</label> | |
| 127 | + <div class="col-md-6"> | |
| 128 | + <input type="text" class="form-control" name="sectionDistance" id="sectionDistanceInput" placeholder="路段长度"> | |
| 129 | + <span class="help-block">单位:公里</span> | |
| 130 | + </div> | |
| 131 | + </div> | |
| 132 | + </div> | |
| 133 | + | |
| 134 | + <!-- 版本号 --> | |
| 135 | + <div class="form-body"> | |
| 136 | + <div class="form-group"> | |
| 137 | + <label class="col-md-3 control-label">版本号:</label> | |
| 138 | + <div class="col-md-6"> | |
| 139 | + <input type="text" class="form-control" name="versions" id="versionsInput" Readonly> | |
| 140 | + </div> | |
| 141 | + </div> | |
| 142 | + </div> | |
| 143 | + | |
| 144 | + <!-- 范围图形类型 --> | |
| 145 | + <div class="form-body"> | |
| 146 | + <div class="form-group"> | |
| 147 | + <label class="col-md-3 control-label">是否撤销:</label> | |
| 148 | + <div class="col-md-6"> | |
| 149 | + <select name="destroy" class="form-control" id="destroySelect"> | |
| 150 | + <option value="">-- 请选择撤销类型 --</option> | |
| 151 | + <option value="0">否</option> | |
| 152 | + <option value="1">是</option> | |
| 153 | + </select> | |
| 154 | + </div> | |
| 155 | + </div> | |
| 156 | + </div> | |
| 157 | + | |
| 158 | + <!-- 描述/说明 --> | |
| 159 | + <div class="form-group"> | |
| 160 | + <label class="control-label col-md-3"> 描述/说明: </label> | |
| 161 | + <div class="col-md-6"> | |
| 162 | + <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="描述/说明"></textarea> | |
| 163 | + </div> | |
| 164 | + </div> | |
| 165 | + </form> | |
| 166 | + </div> | |
| 167 | + <div class="modal-footer"> | |
| 168 | + <button type="button" class="btn default" data-dismiss="modal">取消</button> | |
| 169 | + <button type="button" class="btn btn-primary" id="editSectionButton">提交数据</button> | |
| 170 | + </div> | |
| 171 | + </div> | |
| 172 | + </div> | |
| 173 | +</div> | |
| 174 | +<script type="text/javascript"> | |
| 175 | + | |
| 176 | +$('#edit_section_mobal').on('editSectionMobal_show', function(e, map_,ajaxd,section,fun){ | |
| 177 | + | |
| 178 | + var Section = section.getEitdSection(); | |
| 179 | + | |
| 180 | + | |
| 181 | + fun.setSectionFormValue(Section); | |
| 182 | + | |
| 183 | + // 方向 | |
| 184 | + var dir = Section.sectionRouteDirections; | |
| 185 | + | |
| 186 | + var lineId = Section.sectionRouteLine; | |
| 187 | + | |
| 188 | + var sectionRouteId = Section.sectionRouteId; | |
| 189 | + | |
| 190 | + // 获取路段号元素,并添加下拉属性值 | |
| 191 | + ajaxd.getStation(lineId,dir,function(treeData) { | |
| 192 | + | |
| 193 | + var options = '<option value="">请选择...</option>'; | |
| 194 | + | |
| 195 | + var dArray = treeData[0].children[1].children; | |
| 196 | + | |
| 197 | + var eq_stationRouteCode = Section.sectionRouteCode; | |
| 198 | + | |
| 199 | + for(var i = 0 ; i<dArray.length; i++){ | |
| 200 | + | |
| 201 | + var ptions_v = dArray[i].sectionrouteCode; | |
| 202 | + | |
| 203 | + // 排除本站 | |
| 204 | + if(eq_stationRouteCode == ptions_v){ | |
| 205 | + | |
| 206 | + continue; | |
| 207 | + | |
| 208 | + } | |
| 209 | + | |
| 210 | + options += '<option value="'+ ptions_v +'">'+dArray[i].sectionName+'</option>' | |
| 211 | + | |
| 212 | + } | |
| 213 | + | |
| 214 | + $('#sectionrouteCodeSelect').html(options); | |
| 215 | + | |
| 216 | + ajaxd.findUpStationRouteCode(lineId,dir,eq_stationRouteCode,function(str) { | |
| 217 | + | |
| 218 | + if(str.length>0){ | |
| 219 | + | |
| 220 | + var upStationRouteCode = str[0].sectionrouteCode | |
| 221 | + | |
| 222 | + $('#sectionrouteCodeSelect').val(upStationRouteCode); | |
| 223 | + | |
| 224 | + } | |
| 225 | + | |
| 226 | + }); | |
| 227 | + | |
| 228 | + }); | |
| 229 | + | |
| 230 | + // 显示mobal | |
| 231 | + $('#edit_section_mobal').modal({show : true,backdrop: 'static',keyboard: false}); | |
| 232 | + | |
| 233 | + // 当调用 hide 实例方法时触发 | |
| 234 | + $('#edit_section_mobal').on('hide.bs.modal', function () { | |
| 235 | + | |
| 236 | + closeMobleSetClean(); | |
| 237 | + | |
| 238 | + }); | |
| 239 | + | |
| 240 | + function closeMobleSetClean() { | |
| 241 | + | |
| 242 | + // 清除地图覆盖物 | |
| 243 | + map_.clearMarkAndOverlays(); | |
| 244 | + | |
| 245 | + /** 设置修改路段集合对象为空 */ | |
| 246 | + section.setEitdSection({}); | |
| 247 | + | |
| 248 | + $('.dropdown-toggle').removeClass('disabled'); | |
| 249 | + | |
| 250 | + /** 初始化路段信息 @return <id:路段路由ID> */ | |
| 251 | + fun.initSectionInfo(sectionRouteId); | |
| 252 | + | |
| 253 | + } | |
| 254 | + | |
| 255 | + // 编辑表单元素 | |
| 256 | + var form = $('#edit_section__form'); | |
| 257 | + | |
| 258 | + // 获取错误提示元素 | |
| 259 | + var error = $('.alert-danger', form); | |
| 260 | + | |
| 261 | + // 提交数据按钮事件 | |
| 262 | + $('#editSectionButton').on('click', function() { | |
| 263 | + | |
| 264 | + | |
| 265 | + // 表单提交 | |
| 266 | + form.submit(); | |
| 267 | + | |
| 268 | + }); | |
| 269 | + | |
| 270 | + // 表单验证 | |
| 271 | + form.validate({ | |
| 272 | + | |
| 273 | + errorElement : 'span', | |
| 274 | + | |
| 275 | + errorClass : 'help-block help-block-error', | |
| 276 | + | |
| 277 | + focusInvalid : false, | |
| 278 | + | |
| 279 | + rules : { | |
| 280 | + | |
| 281 | + // 路段名称 | |
| 282 | + 'sectionName' : { | |
| 283 | + | |
| 284 | + // 必填项 | |
| 285 | + required : true | |
| 286 | + | |
| 287 | + }, | |
| 288 | + | |
| 289 | + // 路段编码 | |
| 290 | + 'sectionCode': { | |
| 291 | + | |
| 292 | + // 必填项 | |
| 293 | + required : true, | |
| 294 | + | |
| 295 | + }, | |
| 296 | + | |
| 297 | + // 路段方向 | |
| 298 | + 'directions' : { | |
| 299 | + | |
| 300 | + // 必填项 | |
| 301 | + required : true, | |
| 302 | + | |
| 303 | + // 方向选择限制 | |
| 304 | + /* dirIs : true */ | |
| 305 | + | |
| 306 | + }, | |
| 307 | + | |
| 308 | + | |
| 309 | + // 路段限速 | |
| 310 | + 'speedLimit' : { | |
| 311 | + | |
| 312 | + // 必须输入合法的数字(负数,小数)。 | |
| 313 | + number : true | |
| 314 | + | |
| 315 | + }, | |
| 316 | + | |
| 317 | + // 路段长度 | |
| 318 | + 'sectionTime' : { | |
| 319 | + | |
| 320 | + // 必须输入合法的数字(负数,小数)。 | |
| 321 | + number : true | |
| 322 | + | |
| 323 | + }, | |
| 324 | + | |
| 325 | + // 路段时长 | |
| 326 | + 'sectionDistance' : { | |
| 327 | + | |
| 328 | + // 必须输入合法的数字(负数,小数)。 | |
| 329 | + number : true | |
| 330 | + | |
| 331 | + }, | |
| 332 | + | |
| 333 | + // 描述与说明 | |
| 334 | + 'descriptions' : { | |
| 335 | + | |
| 336 | + // 最大长度 | |
| 337 | + maxlength: 150 | |
| 338 | + | |
| 339 | + } | |
| 340 | + }, | |
| 341 | + | |
| 342 | + invalidHandler : function(event, validator) { | |
| 343 | + | |
| 344 | + error.show(); | |
| 345 | + | |
| 346 | + App.scrollTo(error, -200); | |
| 347 | + | |
| 348 | + }, | |
| 349 | + | |
| 350 | + highlight : function(element) { | |
| 351 | + | |
| 352 | + $(element).closest('.form-group').addClass('has-error'); | |
| 353 | + | |
| 354 | + }, | |
| 355 | + | |
| 356 | + unhighlight : function(element) { | |
| 357 | + | |
| 358 | + $(element).closest('.form-group').removeClass('has-error'); | |
| 359 | + | |
| 360 | + }, | |
| 361 | + | |
| 362 | + success : function(label) { | |
| 363 | + | |
| 364 | + label.closest('.form-group').removeClass('has-error'); | |
| 365 | + | |
| 366 | + }, | |
| 367 | + | |
| 368 | + submitHandler : function(f) { | |
| 369 | + | |
| 370 | + var params = form.serializeJSON(); | |
| 371 | + | |
| 372 | + error.hide(); | |
| 373 | + | |
| 374 | + ajaxd.sectionUpdate(params,function(resuntDate) { | |
| 375 | + | |
| 376 | + if(resuntDate.status=='SUCCESS') { | |
| 377 | + | |
| 378 | + // 弹出添加成功提示消息 | |
| 379 | + layer.msg('修改成功...'); | |
| 380 | + | |
| 381 | + | |
| 382 | + }else { | |
| 383 | + | |
| 384 | + // 弹出添加失败提示消息 | |
| 385 | + layer.msg('修改失败...'); | |
| 386 | + | |
| 387 | + } | |
| 388 | + | |
| 389 | + $('#edit_section_mobal').modal('hide'); | |
| 390 | + | |
| 391 | + closeMobleSetClean(); | |
| 392 | + | |
| 393 | + }); | |
| 394 | + | |
| 395 | + } | |
| 396 | + }); | |
| 397 | + | |
| 398 | + | |
| 399 | +}); | |
| 400 | +</script> | |
| 0 | 401 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/section/js/positionsection.js
0 → 100644
| 1 | +var EditSectionObj = function () { | |
| 2 | + | |
| 3 | + /** 定义修改路段对象 */ | |
| 4 | + var Section={}; | |
| 5 | + | |
| 6 | + var SectionObj = { | |
| 7 | + | |
| 8 | + /** 获取修改路段集合对象 @return:<Section:修改路段对象> */ | |
| 9 | + getEitdSection : function() { | |
| 10 | + | |
| 11 | + return Section; | |
| 12 | + }, | |
| 13 | + | |
| 14 | + /** 设置修改路段集合对象为空 */ | |
| 15 | + setEitdSection : function(sc) { | |
| 16 | + | |
| 17 | + Section = sc; | |
| 18 | + }, | |
| 19 | + | |
| 20 | + | |
| 21 | + /** 设置修改路段集合对象折线百度坐标集合属性值 @param:<bsectionVector:折线百度坐标集合) */ | |
| 22 | + setEitdBsectionVector : function(bsectionVector) { | |
| 23 | + | |
| 24 | + Section.sectionBsectionVector = bsectionVector; | |
| 25 | + } | |
| 26 | + } | |
| 27 | + | |
| 28 | + return SectionObj; | |
| 29 | + | |
| 30 | +}(); | ... | ... |
src/main/resources/static/pages/base/section/js/section-ajax-getdata.js
0 → 100644
| 1 | +/** | |
| 2 | + * GetAjaxData :ajax异步请求 | |
| 3 | + * | |
| 4 | + */ | |
| 5 | + | |
| 6 | +var GetAjaxData = function(){ | |
| 7 | + | |
| 8 | + var ajaxData = { | |
| 9 | + | |
| 10 | + getStationRouteInfo : function(sectionId,callback){ | |
| 11 | + | |
| 12 | + $get('/sectionroute/findSectionRouteInfoFormId',{id:sectionId},function(r) { | |
| 13 | + | |
| 14 | + return callback && callback(r); | |
| 15 | + | |
| 16 | + }); | |
| 17 | + | |
| 18 | + }, | |
| 19 | + | |
| 20 | + getStation : function(id_,dir_,callback) { | |
| 21 | + | |
| 22 | + var treeDateJson = []; | |
| 23 | + | |
| 24 | + $get('/stationroute/findStations',{'line.id_eq' : id_ , 'directions_eq' : dir_},function(resultdata) { | |
| 25 | + | |
| 26 | + treeDateJson = createTreeData(resultdata); | |
| 27 | + | |
| 28 | + callback && callback(treeDateJson); | |
| 29 | + | |
| 30 | + }); | |
| 31 | + | |
| 32 | + }, | |
| 33 | + | |
| 34 | + findUpStationRouteCode : function(lineId,diraction,sectionRouteCode,callback) { | |
| 35 | + | |
| 36 | + $get('/sectionroute/findUpStationRouteCode',{lineId:lineId,direction:diraction,sectionRouteCode:sectionRouteCode},function(result) { | |
| 37 | + | |
| 38 | + callback && callback(result); | |
| 39 | + | |
| 40 | + }); | |
| 41 | + | |
| 42 | + }, | |
| 43 | + | |
| 44 | + // 编辑线路走向保存 | |
| 45 | + sectionUpdate:function(section,callback) { | |
| 46 | + | |
| 47 | + $post('/section/sectionUpdate',section,function(data) { | |
| 48 | + | |
| 49 | + callback && callback(data); | |
| 50 | + | |
| 51 | + }) | |
| 52 | + | |
| 53 | + } | |
| 54 | + } | |
| 55 | + | |
| 56 | + return ajaxData; | |
| 57 | + | |
| 58 | +}(); | |
| 0 | 59 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/section/js/section-positions-events.js
0 → 100644
| 1 | +$(function(){ | |
| 2 | + | |
| 3 | + $('#backUp').on('click',function() { | |
| 4 | + | |
| 5 | + // 获取返回元素并修改url地址 | |
| 6 | + $('#backUp').attr('href','list.html?'); | |
| 7 | + | |
| 8 | + }); | |
| 9 | + | |
| 10 | + // 编辑线路走向 | |
| 11 | + $('.dropdown-menu #eidt').on('click', function(){ | |
| 12 | + | |
| 13 | + $('.dropdown-toggle').addClass('disabled'); | |
| 14 | + | |
| 15 | + // 弹出添加失败提示消息,2秒关闭(如果不配置,默认是3秒) | |
| 16 | + var yindex = layer.msg('编辑完线路走向后,请双击线路走向区域保存',{ offset: '126px',shift: 0,time: 10000}); | |
| 17 | + | |
| 18 | + WorldsBMap.editPolyUpline(); | |
| 19 | + | |
| 20 | + }); | |
| 21 | + | |
| 22 | +}); | |
| 0 | 23 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/section/js/section-positions-function.js
0 → 100644
| 1 | +/** | |
| 2 | + * 函数 | |
| 3 | + */ | |
| 4 | + | |
| 5 | +var PositionsPublicFunctions = function () { | |
| 6 | + | |
| 7 | + var PubFun = { | |
| 8 | + | |
| 9 | + initSectionInfo : function(sectionId) { | |
| 10 | + | |
| 11 | + GetAjaxData.getStationRouteInfo(sectionId,function(r) { | |
| 12 | + | |
| 13 | + var len = r.length; | |
| 14 | + | |
| 15 | + if(len>0) { | |
| 16 | + | |
| 17 | + var sectionInfo = r[0]; | |
| 18 | + | |
| 19 | + EditSectionObj.setEitdSection(sectionInfo); | |
| 20 | + | |
| 21 | + WorldsBMap.drawingUpline(r); | |
| 22 | + } | |
| 23 | + | |
| 24 | + }); | |
| 25 | + | |
| 26 | + }, | |
| 27 | + | |
| 28 | + setSectionFormValue : function(Section) { | |
| 29 | + | |
| 30 | + // 路段ID | |
| 31 | + $('#sectionIdInput').val(Section.sectionId); | |
| 32 | + | |
| 33 | + // 路段路由ID | |
| 34 | + $('#sectionRouteIdInput').val(Section.sectionRouteId); | |
| 35 | + | |
| 36 | + // 线路ID | |
| 37 | + $('#sectionRouteLineInput').val(Section.sectionRouteLine); | |
| 38 | + | |
| 39 | + // 线路编码 | |
| 40 | + $('#lineCodeInput').val(Section.sectionRouteLineCode); | |
| 41 | + | |
| 42 | + // 折线坐标集合 | |
| 43 | + $('#bsectionVectorInput').val(Section.sectionBsectionVector); | |
| 44 | + | |
| 45 | + // 路段名称 | |
| 46 | + $('#sectionNameInput').val(Section.sectionName); | |
| 47 | + | |
| 48 | + // 路段编码 | |
| 49 | + $('#sectionCodeInput').val(Section.sectionCode); | |
| 50 | + | |
| 51 | + // 路段序号 | |
| 52 | + $('#sectionrouteCodeSelect').val(Section.sectionRouteCode); | |
| 53 | + | |
| 54 | + // 路段方向 | |
| 55 | + $('#directionsSection').val(Section.sectionRouteDirections); | |
| 56 | + | |
| 57 | + // 道路编码 | |
| 58 | + $('#roadCodingCodInput').val(Section.sectionRoadCoding); | |
| 59 | + | |
| 60 | + // 道路限速 | |
| 61 | + $('#speedLimitInput').val(Section.sectionSpeedLimit); | |
| 62 | + | |
| 63 | + // 路段长度 | |
| 64 | + $('#sectionDistanceInput').val(Section.sectionDistance); | |
| 65 | + | |
| 66 | + // 时长 | |
| 67 | + $('#sectionTimeInput').val(Section.sectionTime); | |
| 68 | + | |
| 69 | + // 版本号 | |
| 70 | + $('#versionsInput').val(Section.sectionVersion); | |
| 71 | + | |
| 72 | + // 是否撤销 | |
| 73 | + $('#destroySelect').val(Section.sectionRouteDestroy); | |
| 74 | + | |
| 75 | + // 描述/说明 | |
| 76 | + $('#descriptionsTextarea').val(Section.sectionRouteDescriptions); | |
| 77 | + | |
| 78 | + } | |
| 79 | + } | |
| 80 | + | |
| 81 | + return PubFun ; | |
| 82 | + | |
| 83 | +}(); | |
| 0 | 84 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/section/js/section-positions-map.js
| ... | ... | @@ -5,17 +5,12 @@ |
| 5 | 5 | |
| 6 | 6 | var WorldsBMap = function () { |
| 7 | 7 | |
| 8 | + var mapValue = '',marker='', polyUpline=''; | |
| 9 | + | |
| 8 | 10 | var Bmap = { |
| 9 | 11 | |
| 10 | 12 | init : function() { |
| 11 | 13 | |
| 12 | - // 关闭左侧栏 | |
| 13 | - if (!$('body').hasClass('page-sidebar-closed')) { | |
| 14 | - | |
| 15 | - $('.menu-toggler.sidebar-toggler').click(); | |
| 16 | - | |
| 17 | - } | |
| 18 | - | |
| 19 | 14 | // 设置中心点, |
| 20 | 15 | var CENTER_POINT = {lng : 121.528733,lat : 31.237425}; |
| 21 | 16 | |
| ... | ... | @@ -23,13 +18,168 @@ var WorldsBMap = function () { |
| 23 | 18 | var bdKey = 'IGGrr4UjwIYzatoCRFKEL8sT'; |
| 24 | 19 | |
| 25 | 20 | // 初始化百度地图 |
| 26 | - var map = new BMap.Map("bmap_basic"); | |
| 21 | + mapValue = new BMap.Map('bmap_basic'); | |
| 27 | 22 | |
| 28 | 23 | //中心点和缩放级别 |
| 29 | - map.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15); | |
| 24 | + mapValue.centerAndZoom(new BMap.Point(CENTER_POINT.lng,CENTER_POINT.lat), 15); | |
| 25 | + | |
| 26 | + //启用地图拖拽事件,默认启用(可不写) | |
| 27 | + mapValue.enableDragging(); | |
| 28 | + | |
| 29 | + //启用地图滚轮放大缩小 | |
| 30 | + mapValue.enableScrollWheelZoom(); | |
| 31 | + | |
| 32 | + //禁用鼠标双击放大 | |
| 33 | + mapValue.disableDoubleClickZoom(); | |
| 34 | + | |
| 35 | + //启用键盘上下左右键移动地图 | |
| 36 | + mapValue.enableKeyboard(); | |
| 37 | + | |
| 38 | + return mapValue; | |
| 39 | + }, | |
| 40 | + | |
| 41 | + drawingUpline : function(r) { | |
| 42 | + | |
| 43 | + var sectionBsectionVectorStr = r[0].sectionBsectionVector; | |
| 44 | + | |
| 45 | + var tempStr = sectionBsectionVectorStr.substring(11,sectionBsectionVectorStr.length-1); | |
| 46 | + | |
| 47 | + var lineArray = tempStr.split(','); | |
| 48 | + | |
| 49 | + var polylineArray = []; | |
| 50 | + | |
| 51 | + var lineaLen = lineArray.length | |
| 52 | + | |
| 53 | + for(var i = 0;i<lineaLen;i++) { | |
| 54 | + | |
| 55 | + polylineArray.push(new BMap.Point(lineArray[i].split(' ')[0],lineArray[i].split(' ')[1])); | |
| 56 | + | |
| 57 | + } | |
| 58 | + | |
| 59 | + var centerI = Math.ceil(lineaLen/2); | |
| 60 | + | |
| 61 | + // 中心坐标点 | |
| 62 | + var point = new BMap.Point(lineArray[centerI].split(' ')[0],lineArray[centerI].split(' ')[1]); | |
| 63 | + | |
| 64 | + // 创建线路走向 | |
| 65 | + polyUpline = new BMap.Polyline(polylineArray, {strokeColor : "blue",strokeWeight : 6,strokeOpacity : 0.5}); | |
| 66 | + | |
| 67 | + // 把折线添加到地图上 | |
| 68 | + mapValue.addOverlay(polyUpline); | |
| 69 | + | |
| 70 | + // 信息窗口参数属性 | |
| 71 | + var opts = { | |
| 72 | + | |
| 73 | + // 信息窗口宽度 | |
| 74 | + width : 200, | |
| 75 | + | |
| 76 | + // 信息窗口高度 | |
| 77 | + height : 450, | |
| 78 | + | |
| 79 | + // 信息窗位置偏移值。 | |
| 80 | + offset: new BMap.Size(500,-80), | |
| 81 | + | |
| 82 | + //标题 | |
| 83 | + title : '<h4 style="color:#FFFFFF">'+r[0].sectionName+'站详情</h4>', | |
| 84 | + | |
| 85 | + //设置不允许信窗发送短息 | |
| 86 | + enableMessage : false, | |
| 87 | + | |
| 88 | + //是否开启点击地图关闭信息窗口 | |
| 89 | + enableCloseOnClick : false, | |
| 90 | + | |
| 91 | + // 是否开启信息窗口打开时地图自动移动(默认开启)。(自 1.1 新增) | |
| 92 | + enableAutoPan:true | |
| 93 | + }; | |
| 94 | + | |
| 95 | + var htm = '<HR style="border:1 dashed #987cb9" width="100%" color=#987cb9 SIZE=1>'+ | |
| 96 | + '<span style="color:#DDD;font-size: 15px;">路段名称:' + r[0].sectionName + '</span>' + | |
| 97 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">路段编码:' + r[0].sectionCode + '</span>' + | |
| 98 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">路段序号:' + r[0].sectionRouteCode + '</span>' + | |
| 99 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">限 速:' + r[0].sectionSpeedLimit + '</span>' + | |
| 100 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">路段长度:' + r[0].sectionDistance + '</span>' + | |
| 101 | + '<span class="help-block" style="color:#DDD;font-size: 15px;">路段时间:' + r[0].sectionTime + '</span>' + | |
| 102 | + '<span class="help-block" style="width: 100%;font-size: 15px;;color:#DDD; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; " title="'+ 'ddd' +'" >说明/描述:' + 'ddd' + '</span>' ; | |
| 103 | + | |
| 104 | + // 创建信息窗口 | |
| 105 | + var infoWindow_target = new BMap.InfoWindow(htm, opts); | |
| 106 | + | |
| 107 | + // 自定义标注物图片 | |
| 108 | + var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20)); | |
| 109 | + | |
| 110 | + // 创建点 | |
| 111 | + marker = new BMap.Marker(point,{icon : icon_target}); | |
| 112 | + | |
| 113 | + // 把标注添物加到地图上 | |
| 114 | + mapValue.addOverlay(marker); | |
| 115 | + | |
| 116 | + //开启信息窗口 | |
| 117 | + marker.openInfoWindow(infoWindow_target,point); | |
| 118 | + /* setTimeout(function(){ | |
| 119 | + //开启信息窗口 | |
| 120 | + marker.openInfoWindow(infoWindow_target,point); | |
| 121 | + | |
| 122 | + },100);*/ | |
| 123 | + | |
| 124 | + var PanOptions_ ={noAnimation :true}; | |
| 125 | + | |
| 126 | + mapValue.reset(); | |
| 127 | + | |
| 128 | + mapValue.panTo(point,PanOptions_); | |
| 129 | + | |
| 130 | + mapValue.panBy(500,-510,PanOptions_); | |
| 131 | + | |
| 132 | + mapValue.setZoom(14); | |
| 133 | + | |
| 134 | + }, | |
| 135 | + | |
| 136 | + editPolyUpline : function() { | |
| 137 | + | |
| 138 | + // 禁止覆盖物在map.clearOverlays方法中被清除。(自 1.1 新增) | |
| 139 | + polyUpline.disableMassClear(); | |
| 140 | + | |
| 141 | + WorldsBMap.clearMarkAndOverlays(); | |
| 142 | + | |
| 143 | + // 允许覆盖物在map.clearOverlays方法中被清除。(自 1.1 新增) | |
| 144 | + polyUpline.enableMassClear(); | |
| 145 | + | |
| 146 | + // 开启线路编辑 | |
| 147 | + polyUpline.enableEditing(); | |
| 148 | + | |
| 149 | + // 添加双击折线保存事件 | |
| 150 | + polyUpline.addEventListener('dblclick',function(e) { | |
| 151 | + | |
| 152 | + // 关闭 | |
| 153 | + layer.closeAll(); | |
| 154 | + | |
| 155 | + polyUpline.disableEditing(); | |
| 156 | + | |
| 157 | + // 获取折线坐标集合 | |
| 158 | + var editPloyLineArray = polyUpline.getPath(); | |
| 159 | + | |
| 160 | + EditSectionObj.setEitdBsectionVector(JSON.stringify(editPloyLineArray)); | |
| 161 | + | |
| 162 | + polyUpline= ''; | |
| 163 | + | |
| 164 | + // 加载修改路段弹出层mobal页面 | |
| 165 | + $.get('editsection.html', function(m){ | |
| 166 | + | |
| 167 | + $(pjaxContainer).append(m); | |
| 168 | + | |
| 169 | + $('#edit_section_mobal').trigger('editSectionMobal_show', [WorldsBMap,GetAjaxData,EditSectionObj,PositionsPublicFunctions]); | |
| 170 | + | |
| 171 | + }); | |
| 172 | + }); | |
| 173 | + }, | |
| 30 | 174 | |
| 31 | - return map; | |
| 32 | - } | |
| 175 | + clearMarkAndOverlays : function() { | |
| 176 | + | |
| 177 | + // 清楚地图覆盖物 | |
| 178 | + mapValue.clearOverlays(); | |
| 179 | + | |
| 180 | + mapValue.removeOverlay(); | |
| 181 | + | |
| 182 | + } | |
| 33 | 183 | |
| 34 | 184 | } |
| 35 | 185 | ... | ... |
src/main/resources/static/pages/base/section/js/section-positions-reload.js
| ... | ... | @@ -17,135 +17,22 @@ |
| 17 | 17 | // 获取参数线路ID |
| 18 | 18 | var id = $.url().param('no'); |
| 19 | 19 | |
| 20 | - // 等候500毫秒执行 | |
| 21 | - setTimeout(function(){ | |
| 22 | - | |
| 23 | - // 地图初始化 | |
| 24 | - var mapB = WorldsBMap.init(); | |
| 25 | - | |
| 26 | - getStationRouteInfo(function(r) { | |
| 27 | - | |
| 28 | - console.log(r); | |
| 29 | - | |
| 30 | - var len = r.length; | |
| 31 | - | |
| 32 | - if(len>0) { | |
| 33 | - | |
| 34 | - var sectionBsectionVectorStr = r[0].sectionBsectionVector; | |
| 35 | - | |
| 36 | - var tempStr = sectionBsectionVectorStr.substring(11,sectionBsectionVectorStr.length-1); | |
| 37 | - | |
| 38 | - var lineArray = tempStr.split(','); | |
| 39 | - | |
| 40 | - var polylineArray = []; | |
| 41 | - | |
| 42 | - var lineaLen = lineArray.length | |
| 43 | - | |
| 44 | - for(var i = 0;i<lineaLen;i++) { | |
| 45 | - | |
| 46 | - polylineArray.push(new BMap.Point(lineArray[i].split(' ')[0],lineArray[i].split(' ')[1])); | |
| 47 | - | |
| 48 | - } | |
| 49 | - | |
| 50 | - var centerI = Math.ceil(lineaLen/2); | |
| 51 | - | |
| 52 | - // 中心坐标点 | |
| 53 | - var point = new BMap.Point(lineArray[centerI].split(' ')[0],lineArray[centerI].split(' ')[1]); | |
| 54 | - | |
| 55 | - var htm = '<HR style="border:1 dashed #987cb9" width="100%" color=#987cb9 SIZE=1>'+ | |
| 56 | - '<span style="color:#DDD;font-size: 15px;">路段名称:' + r[0].sectionName + '</span>' + | |
| 57 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">路段编码:' + r[0].sectionCode + '</span>' + | |
| 58 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">路段序号:' + r[0].sectionRouteCode + '</span>' + | |
| 59 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">限 速:' + r[0].sectionSpeedLimit + '</span>' + | |
| 60 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">路段长度:' + r[0].sectionDistance + '</span>' + | |
| 61 | - '<span class="help-block" style="color:#DDD;font-size: 15px;">路段时间:' + r[0].sectionTime + '</span>' + | |
| 62 | - '<span class="help-block" style="width: 100%;font-size: 15px;;color:#DDD; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; " title="'+ 'ddd' +'" >说明/描述:' + 'ddd' + '</span>' ; | |
| 63 | - | |
| 64 | - // 信息窗口参数属性 | |
| 65 | - var opts = { | |
| 66 | - | |
| 67 | - // 信息窗口宽度 | |
| 68 | - width : 200, | |
| 69 | - | |
| 70 | - // 信息窗口高度 | |
| 71 | - height : 450, | |
| 72 | - | |
| 73 | - // 信息窗位置偏移值。 | |
| 74 | - offset: new BMap.Size(500,-80), | |
| 75 | - | |
| 76 | - //标题 | |
| 77 | - title : '<h4 style="color:#FFFFFF">'+r[0].sectionName+'站详情</h4>', | |
| 78 | - | |
| 79 | - //设置不允许信窗发送短息 | |
| 80 | - enableMessage : false, | |
| 81 | - | |
| 82 | - //是否开启点击地图关闭信息窗口 | |
| 83 | - enableCloseOnClick : false, | |
| 84 | - | |
| 85 | - // 是否开启信息窗口打开时地图自动移动(默认开启)。(自 1.1 新增) | |
| 86 | - enableAutoPan:true | |
| 87 | - }; | |
| 88 | - | |
| 89 | - drawingUpline(point,polylineArray,htm,opts,mapB); | |
| 90 | - } | |
| 91 | - | |
| 92 | - }); | |
| 93 | - | |
| 94 | - },200); | |
| 95 | - | |
| 96 | - function getStationRouteInfo (callback){ | |
| 20 | + // 关闭左侧栏 | |
| 21 | + if (!$('body').hasClass('page-sidebar-closed')) { | |
| 97 | 22 | |
| 98 | - $get('/sectionroute/findSectionRouteInfoFormId',{id:id},function(r) { | |
| 99 | - | |
| 100 | - return callback && callback(r); | |
| 101 | - | |
| 102 | - }); | |
| 23 | + $('.menu-toggler.sidebar-toggler').click(); | |
| 103 | 24 | |
| 104 | 25 | } |
| 105 | 26 | |
| 106 | - $('#backUp').on('click',function() { | |
| 107 | - | |
| 108 | - // 获取返回元素并修改url地址 | |
| 109 | - $('#backUp').attr('href','list.html?'); | |
| 27 | + // 等候500毫秒执行 | |
| 28 | + setTimeout(function(){ | |
| 110 | 29 | |
| 111 | - }); | |
| 112 | - | |
| 113 | - function drawingUpline(point,polylineArray,htm,opts,mapB) { | |
| 30 | + /** 初始化地图 @return <mapB:地图对象> */ | |
| 31 | + var mapB = WorldsBMap.init(); | |
| 114 | 32 | |
| 115 | - // 创建线路走向 | |
| 116 | - var polyUpline = new BMap.Polyline(polylineArray, {strokeColor : "blue",strokeWeight : 6,strokeOpacity : 0.5}); | |
| 117 | - | |
| 118 | - // 把折线添加到地图上 | |
| 119 | - mapB.addOverlay(polyUpline); | |
| 120 | - | |
| 121 | - // 创建信息窗口 | |
| 122 | - var infoWindow_target = new BMap.InfoWindow(htm, opts); | |
| 123 | - | |
| 124 | - // 自定义标注物图片 | |
| 125 | - var icon_target = new BMap.Icon('/pages/base/stationroute/css/img/cz.png',new BMap.Size(20, 20)); | |
| 126 | - | |
| 127 | - // 创建点 | |
| 128 | - var marker = new BMap.Marker(point,{icon : icon_target}); | |
| 129 | - | |
| 130 | - // 把标注添物加到地图上 | |
| 131 | - mapB.addOverlay(marker); | |
| 132 | - | |
| 133 | - setTimeout(function(){ | |
| 134 | - //开启信息窗口 | |
| 135 | - marker.openInfoWindow(infoWindow_target,point); | |
| 136 | - | |
| 137 | - },100); | |
| 138 | - | |
| 139 | - var PanOptions_ ={noAnimation :true}; | |
| 140 | - | |
| 141 | - mapB.reset(); | |
| 142 | - | |
| 143 | - mapB.panTo(point,PanOptions_); | |
| 144 | - | |
| 145 | - mapB.panBy(500,-510,PanOptions_); | |
| 146 | - | |
| 147 | - mapB.setZoom(14); | |
| 33 | + /** 初始化路段信息 @return <id:路段路由ID> */ | |
| 34 | + PositionsPublicFunctions.initSectionInfo(id); | |
| 148 | 35 | |
| 149 | - } | |
| 36 | + },200); | |
| 150 | 37 | |
| 151 | 38 | })(); |
| 152 | 39 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/section/positions.html
| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | </a> |
| 10 | 10 | <ul class="dropdown-menu pull-right" style="min-width:100px"> |
| 11 | 11 | <li> |
| 12 | - <a href="javascript:;"><i class="fa fa-pencil"></i> 修改 </a> | |
| 12 | + <a href="javascript:;" id = "eidt"><i class="fa fa-pencil"></i> 修改 </a> | |
| 13 | 13 | </li> |
| 14 | 14 | <li> |
| 15 | 15 | <a href="javascript:;" id = "backUp"> <i class="fa fa-reply"></i> 返回 </a> |
| ... | ... | @@ -18,5 +18,20 @@ |
| 18 | 18 | </ul> |
| 19 | 19 | </div> |
| 20 | 20 | </div> |
| 21 | +<!-- 编辑路段对象类 --> | |
| 22 | +<script src="/pages/base/section/js/positionsection.js"></script> | |
| 23 | + | |
| 24 | +<!-- ajax异步请求类 --> | |
| 25 | +<script src="/pages/base/section/js/section-ajax-getdata.js"></script> | |
| 26 | + | |
| 27 | +<!-- 函数方法类 --> | |
| 28 | +<script src="/pages/base/section/js/section-positions-function.js"></script> | |
| 29 | + | |
| 30 | +<!-- 地图类 --> | |
| 21 | 31 | <script src="/pages/base/section/js/section-positions-map.js"></script> |
| 32 | + | |
| 33 | +<!-- 事件类 --> | |
| 34 | +<script src="/pages/base/section/js/section-positions-events.js"></script> | |
| 35 | + | |
| 36 | +<!-- reload类 --> | |
| 22 | 37 | <script src="/pages/base/section/js/section-positions-reload.js"></script> |
| 23 | 38 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/base/station/edit_select.html
| ... | ... | @@ -173,11 +173,13 @@ $('#editPositions_select_mobal').on('editSelectMobal_show', function(e, map,drm, |
| 173 | 173 | |
| 174 | 174 | if(eidtselect_==0){ |
| 175 | 175 | |
| 176 | + // 清除地图覆盖物 | |
| 176 | 177 | StationPositionsWorldsBMap.clearMarkAndOverlays(); |
| 177 | 178 | |
| 178 | 179 | // 打开绘制工具 |
| 179 | 180 | PositionsDrawingManagerObj.openDrawingManager(); |
| 180 | 181 | |
| 182 | + // 根据站点位置在地图定位 | |
| 181 | 183 | StationPositionsWorldsBMap.localtionPoint(editStationName); |
| 182 | 184 | |
| 183 | 185 | ... | ... |
src/main/resources/static/pages/base/station/js/add-vmap-world.js
src/main/resources/static/pages/base/station/js/station-positions-reload.js
| ... | ... | @@ -42,12 +42,13 @@ |
| 42 | 42 | // 等候500毫秒执行 |
| 43 | 43 | setTimeout(function(){ |
| 44 | 44 | |
| 45 | - // 地图初始化 | |
| 45 | + // 初始化地图 | |
| 46 | 46 | var map_ = StationPositionsWorldsBMap.init(); |
| 47 | 47 | |
| 48 | 48 | // 初始化绘制工具类 |
| 49 | 49 | var drawingManager_ = PositionsDrawingManagerObj.init(map_,styleOptions); |
| 50 | 50 | |
| 51 | + // 初始化站点信息 | |
| 51 | 52 | PositionsPublicFunctions.initStationInfo(id); |
| 52 | 53 | |
| 53 | 54 | },200); | ... | ... |