From 559b219eb34d8022a2bb85180259cb772cbaaa9e Mon Sep 17 00:00:00 2001
From: hdw <496960745@qq.com>
Date: 星期五, 09 十一月 2018 14:05:13 +0800
Subject: [PATCH] 地图图标添加功能完善

---
 gx_tieta/WebRoot/index.jsp            |   65 ++++++++++++++++++++++++++++++--
 gx_tieta/WebRoot/css/index_layout.css |    6 ++
 2 files changed, 66 insertions(+), 5 deletions(-)

diff --git a/gx_tieta/WebRoot/css/index_layout.css b/gx_tieta/WebRoot/css/index_layout.css
index d3f5bff..50163f3 100644
--- a/gx_tieta/WebRoot/css/index_layout.css
+++ b/gx_tieta/WebRoot/css/index_layout.css
@@ -469,6 +469,7 @@
 	text-align: center;
 	background-color: #CDDCFA;
 	border-bottom: 1px solid #CCCCCC;
+	cursor: pointer;
 }
 .map-info-panel-content .map-info .k-point {
 	font-weight: bold;
@@ -498,11 +499,14 @@
 .map-info-detail table td {
 	padding: 4px 0;
 }
-.map-info-detail table select, .map-info-detail table input {
+.map-info-detail table select, .map-info-detail table input[type="text"] {
 	width: 96%;
 	height: 24px;
 	border: 1px solid #CCCCCC;
 }
+.map-info-detail table input[type="radio"] {
+	vertical-align: middle;
+}
 .map-info-footer {
 	padding: 8px 0;
 	border-top: 1px solid #CCCCCC;
diff --git a/gx_tieta/WebRoot/index.jsp b/gx_tieta/WebRoot/index.jsp
index 2d3d475..33cb90f 100644
--- a/gx_tieta/WebRoot/index.jsp
+++ b/gx_tieta/WebRoot/index.jsp
@@ -114,16 +114,16 @@
 				<!-- 鍦板浘鍐呭绛涢��  -->
 				<div class="map-info-panel-left w300">
 					<div class="map-info-panel-content">
-						<div class="map-info">
+						<div class="map-info" id="showMapInfoDetail">
 							<span>鍦板浘宸ュ叿</span>
-							<span class="map-info-btn-icon" id="showMapInfoDetail" title="璇︽儏"><i class="fa fa-angle-double-down"></i></span>
+							<span class="map-info-btn-icon" title="璇︽儏"><i class="fa fa-angle-double-down"></i></span>
 						</div>
 						<div class="map-info-detail">
 							<div class="layui-collapse" lay-filter="test" lay-accordion="">
 								<div class="layui-colla-item">
 									<h2 class="layui-colla-title">娣诲姞鏈烘埧</h2>
 									<div class="layui-colla-content layui-show"">
-					                	<table>
+					                	<table id="mapToolAddHome">
 					                		<tbody>
 					                			<tr>
 					                				<td class="w4em alg-c f-bold">缁忓害:</td>
@@ -134,8 +134,16 @@
 					                				<td><input type="text" class="lat"></td>
 					                			</tr>
 					                			<tr>
+					                				<td class="w4em alg-c f-bold">绫诲瀷:</td>
+					                				<td>
+					                					<input type="radio" class="pointStyle" name="pointStyle" value="0" checked><span class="mrr8">GPS</span>
+					                					<input type="radio" class="pointStyle" name="pointStyle" value="1"><span class="mrr8">鐧惧害</span>
+					                					<input type="radio" class="pointStyle" name="pointStyle" value="2"><span class="mrr8">鑵捐/楂樺痉</span>
+					                				</td>
+					                			</tr>
+					                			<tr>
 					                				<td colspan="2" class="alg-r btn-container">
-					                					<button type="button" value="娣诲姞" id="mapToolAddHome" class="mrr8">娣诲姞</button>
+					                					<button type="button" value="娣诲姞" id="mapToolAddHomeBtn" class="mrr8">娣诲姞</button>
 					                				</td>
 					                			</tr>
 					                		</tbody>
@@ -3658,6 +3666,55 @@
 			}
 		});
 		
+		/* 鍦板浘宸ュ叿娣诲姞鍦板浘鍥炬爣 */
+		var mapToolAddHome = $('#mapToolAddHome');
+		var mapToolAddHomeBtn = $('#mapToolAddHomeBtn');
+		
+		// 鐐瑰嚮鍦板浘宸ュ叿娣诲姞鍦板浘鎸夐挳
+		mapToolAddHomeBtn.click(function() {
+			var lng = mapToolAddHome.find('.lng').val().trim();
+			var lat = mapToolAddHome.find('.lat').val().trim();
+			var pointStyles = mapToolAddHome.find('.pointStyle');
+			var pointStyle = 0;
+			pointStyles.each(function() {
+				if($(this).is(':checked')) {
+					pointStyle = $(this).val();
+				}
+			});
+			if(lng && lat) {
+				var point = getBaiduPoint(lng, lat, pointStyle);
+				var pt = new BMap.Point(point.lon, point.lat);
+				addCommonDot(map, pt);
+				map.centerAndZoom(pt, 18);	// 鐢ㄥ煄甯傚悕璁剧疆鍦板浘涓績鐐�
+			}else {
+				layer.msg('璇疯緭鍏ョ粡绾害');
+			}
+			
+		});
+		
+		// 鑾峰彇鐧惧害鍦板浘鐨勭粡绾害
+		function getBaiduPoint(lng, lat, type) {
+			var point = {};
+			lng = Number(lng);
+			lat = Number(lat);
+			var _type = Number(type);
+			switch(_type) {
+				case 0:	// GPS鍘熷鍧愭爣
+					point = GPS.wgs2bd(lat, lng);
+					break;
+				case 1:	// 鐧惧害鍦板浘鍧愭爣
+					point = {
+						lon: lng,
+						lat: lat
+					};
+					break;
+				case 2:		// 鑵捐/楂樺痉
+					point = GPS.bd_encrypt(lat, lng);
+					break;
+			}
+			
+			return point;
+		}
 	});
 	
 	// 鏇存柊鍦板浘宸ュ叿鎼滅储鏈烘埧

--
Gitblit v1.9.1