You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
303 lines
9.1 KiB
303 lines
9.1 KiB
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
|
|
<%
|
|
String path = request.getContextPath();
|
|
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
|
|
%>
|
|
<%@ include file="/common/ctx.jsp" %>
|
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
|
|
<style type="text/css">
|
|
body, html, #allmap {
|
|
width: 100%;
|
|
height: 100%;
|
|
overflow: hidden;
|
|
margin: 0;
|
|
font-family: "微软雅黑";
|
|
}
|
|
|
|
</style>
|
|
<script src="${ctx}/js/jquery-3.7.0.min.js"></script>
|
|
<!-- <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=YCimUSFO0aRYOMOOhMQRBlaQQz6YpyVy"></script> -->
|
|
|
|
<!-- 高德地图js和css -->
|
|
<script src="https://webapi.amap.com/maps?v=1.4.12&key=8ccbf0076c5d6202725eb9c4b3cec772"></script>
|
|
<link rel="stylesheet" href="https://a.amap.com/jsapi_demos/static/demo-center/css/demo-center.css" />
|
|
<link rel="stylesheet" href="https://cache.amap.com/lbs/static/main1119.css"/>
|
|
<script type="text/javascript" src="https://cache.amap.com/lbs/static/addToolbar.js"></script>
|
|
|
|
|
|
<link href="${ctx}/hbcyjc/resourceNew/css/cjy_style.css" rel="stylesheet"/>
|
|
|
|
|
|
|
|
<title>浏览器定位</title>
|
|
|
|
<style type="text/css">
|
|
body, html {
|
|
width: 100%;
|
|
height: 98%;
|
|
margin: 0;
|
|
font-family: "微软雅黑";
|
|
}
|
|
|
|
#allmap {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
.tangram-suggestion-main {
|
|
display: block;
|
|
}
|
|
|
|
.tangram-suggestion {
|
|
z-index: 99999999;
|
|
}
|
|
|
|
.anchorBL {
|
|
display: none;
|
|
}
|
|
.form_input input {
|
|
display: block;
|
|
width: 100%;
|
|
height: 30px;
|
|
line-height: 30px;
|
|
background: none;
|
|
outline: none;
|
|
color: white;
|
|
border: 1px solid #71c2de;
|
|
}
|
|
.amap-sug-result {
|
|
position: absolute;
|
|
z-index: 1024;
|
|
background-color: #020585;
|
|
border: 1px solid #d1d1d1;
|
|
bottom: auto;
|
|
}
|
|
|
|
.dbtn .bttn {
|
|
width: 90px;
|
|
position: absolute;
|
|
top: 0px;
|
|
right: 0px;
|
|
margin: 0px;
|
|
}
|
|
|
|
.bttn_dw {
|
|
background: #04489D;
|
|
}
|
|
|
|
.bttn {
|
|
display: inline-block;
|
|
background: rgba(0,169,246,0.1);
|
|
border: 1px solid #04489D;
|
|
padding: 0px 10px;
|
|
height: 30px;
|
|
line-height: 30px;
|
|
border-radius: 3px;
|
|
margin: 2px;
|
|
cursor: pointer;
|
|
outline: none;
|
|
}
|
|
|
|
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="exampleModalLabel">
|
|
<b>地图坐标</b>
|
|
</h5>
|
|
</div>
|
|
<div style="padding-left:25px;padding-top: 20px ">
|
|
<table border="0" cellspacing="0" cellpadding="0">
|
|
<tr>
|
|
<td>
|
|
<div class="form_hpzs">
|
|
<label class="form_label">搜索:</label>
|
|
<div class="form_input" style="width: 110px;">
|
|
<input type="text" id="suggestId" name="suggestId"/>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
<td> (输入地区关键字,拾取更迅速) </td>
|
|
<td>
|
|
<button id="btn-search" type="button" class="bttn" <%-- onclick="select();"--%> >搜索</button>
|
|
</td>
|
|
<td>
|
|
<button type="button" class="bttn" onclick="windowclose();">确定</button>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div id="allmap" style="width:95%;height:99%;margin-left: 2.5%;margin-top: 2%"></div>
|
|
</body>
|
|
</html>
|
|
<script type="text/javascript">
|
|
var map;
|
|
var sysdept = "${ctx_sysDept.dname}";
|
|
var lng = "${param.lon}";
|
|
var lat = "${param.lat}";
|
|
|
|
|
|
if(lng == "" || lat == ""){
|
|
// 如果为空
|
|
var str = '${region.gdlnglat}';
|
|
if (str){
|
|
var arr = str.split(',');
|
|
lng = arr[0];
|
|
lat = arr[1];
|
|
}
|
|
}
|
|
|
|
var cslon;
|
|
var cslat;
|
|
if(lng != "" && lng != null && lat != "" && lat != null){
|
|
cslon = lng;
|
|
cslat = lat;
|
|
}
|
|
|
|
|
|
$(function(){
|
|
//初始化地图
|
|
initMap();
|
|
})
|
|
|
|
function initMap(){
|
|
// 创建一个 Marker 实例用于地图打点标注:
|
|
var marker = new AMap.Marker({
|
|
position: new AMap.LngLat(116.397631,39.908602)
|
|
});
|
|
|
|
//没有经纬度
|
|
if(lng == "" || lng == null || lat == "" || lat == null){
|
|
map = new AMap.Map('allmap', {
|
|
resizeEnable: true, //是否监控地图容器尺寸变化
|
|
zoom:15 //初始化地图层级
|
|
});
|
|
gotoCity(sysdept);
|
|
}else{
|
|
map = new AMap.Map('allmap', {
|
|
resizeEnable: true, //是否监控地图容器尺寸变化
|
|
zoom:15, //初始化地图层级
|
|
center: [lng, lat] //初始化地图中心点
|
|
});
|
|
marker = new AMap.Marker({
|
|
position: new AMap.LngLat(lng, lat)
|
|
});
|
|
map.add(marker); //添加标注
|
|
}
|
|
|
|
|
|
|
|
AMap.service('AMap.DistrictSearch',function(){//回调函数
|
|
var clickHandler = function(e) {
|
|
// alert('您在[ '+e.lnglat.getLng()+','+e.lnglat.getLat()+' ]的位置点击了地图!');
|
|
lng = e.lnglat.getLng();
|
|
lat = e.lnglat.getLat();
|
|
map.clearMap(); //清除地图
|
|
marker = new AMap.Marker({
|
|
position: new AMap.LngLat(lng, lat)
|
|
});
|
|
map.add(marker); //添加标注
|
|
};
|
|
// 绑定事件
|
|
map.on('click', clickHandler);
|
|
//加载查询功能
|
|
selegn();
|
|
})
|
|
}
|
|
|
|
function get_url_param(name) {
|
|
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)","i");
|
|
var r = window.location.search.substr(1).match(reg);
|
|
if (r!=null) return (r[2]); return null;
|
|
}
|
|
|
|
//点击关闭窗口执行
|
|
function windowclose() {
|
|
var id = get_url_param('frame_id');
|
|
if(id){
|
|
var jqFrame = $(parent.frames[id].contentWindow.document);
|
|
if (lng != null && lng != "" && lat != null && lat != "") {
|
|
jqFrame.find("#jingdu").val(lng);
|
|
jqFrame.find("#weidu").val(lat);
|
|
} else {
|
|
jqFrame.find("#jingdu").val(lng);
|
|
jqFrame.find("#weidu").val(lat);
|
|
}
|
|
}
|
|
else{
|
|
if (lng != null && lng != "" && lat != null && lat != "") {
|
|
parent.$("#jingdu").val(lng);
|
|
parent.$("#weidu").val(lat);
|
|
} else {
|
|
parent.$("#jingdu").val(lng);
|
|
parent.$("#weidu").val(lat);
|
|
}
|
|
}
|
|
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
|
|
parent.layer.close(index);
|
|
}
|
|
|
|
|
|
|
|
//显示到传入的位置为空显示北京市
|
|
//例:gotoCity("石家庄市");
|
|
function gotoCity(val) {
|
|
if (val == "" || val == null) {
|
|
val = "北京市";
|
|
}
|
|
map.setCity(val);
|
|
}
|
|
|
|
|
|
|
|
//实现搜索功能
|
|
function selegn(){
|
|
AMap.plugin(['AMap.Autocomplete','AMap.PlaceSearch'],function(){
|
|
var autoOptions = {
|
|
// 城市,默认全国
|
|
//city: "北京",
|
|
// 使用联想输入的input的id
|
|
input: "suggestId"
|
|
}
|
|
var autocomplete= new AMap.Autocomplete(autoOptions)
|
|
var placeSearch = new AMap.PlaceSearch({
|
|
city:'北京',
|
|
map:map
|
|
})
|
|
AMap.event.addListener(autocomplete, 'select', function(e){
|
|
// 针对选中的poi实现自己的功能
|
|
// alter by Zero.
|
|
if(e != null && e.poi != null && e.poi.location != null){
|
|
var location = e.poi.location;
|
|
lng = location.lng;
|
|
lat = location.lat;
|
|
var lngLat = new AMap.LngLat(location.lng, location.lat);
|
|
map.clearMap(); //清除地图
|
|
marker = new AMap.Marker({
|
|
position: lngLat
|
|
});
|
|
map.add(marker); //添加标注
|
|
map.setCenter(lngLat);
|
|
} else {
|
|
if(e != null){
|
|
placeSearch.search(e.poi.name)
|
|
}
|
|
}
|
|
|
|
|
|
});
|
|
// 搜索 button 绑定事件
|
|
$('#btn-search').click(function () {
|
|
placeSearch.search($('#suggestId').val())
|
|
})
|
|
})
|
|
}
|
|
|
|
|
|
</script>
|
|
|