提交 ee52c62a authored 作者: chengye's avatar chengye

修复地图显示bug

上级 90241e29
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="f51c1393-9404-4c81-be85-d91ed40531b3" name="默认更改列表" comment=""> <list default="true" id="f51c1393-9404-4c81-be85-d91ed40531b3" name="默认更改列表" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/application/admin/view/basestation/base_map.html" beforeDir="false" afterPath="$PROJECT_DIR$/application/admin/view/basestation/base_map.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/application/admin/controller/Basestation.php" beforeDir="false" afterPath="$PROJECT_DIR$/application/admin/controller/Basestation.php" afterDir="false" />
</list> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
...@@ -43,11 +42,23 @@ ...@@ -43,11 +42,23 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file pinned="false" current-in-tab="true"> <file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/application/admin/controller/Basestation.php"> <entry file="file://$PROJECT_DIR$/application/admin/controller/Basestation.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="295"> <state relative-caret-position="388">
<caret line="735" column="42" lean-forward="true" selection-start-line="735" selection-start-column="42" selection-end-line="735" selection-end-column="42" /> <caret line="738" column="34" lean-forward="true" selection-start-line="738" selection-start-column="34" selection-end-line="738" selection-end-column="34" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/application/admin/view/basestation/base_map.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="512">
<caret line="132" column="9" selection-start-line="132" selection-start-column="9" selection-end-line="132" selection-end-column="9" />
<folding>
<element signature="n#style#0;n#p#0;n#!!top" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
...@@ -84,6 +95,7 @@ ...@@ -84,6 +95,7 @@
<option value="$PROJECT_DIR$/application/em/controller/Invoice.php" /> <option value="$PROJECT_DIR$/application/em/controller/Invoice.php" />
<option value="$PROJECT_DIR$/application/em/model/EmInvoice.php" /> <option value="$PROJECT_DIR$/application/em/model/EmInvoice.php" />
<option value="$PROJECT_DIR$/application/admin/controller/Basestation.php" /> <option value="$PROJECT_DIR$/application/admin/controller/Basestation.php" />
<option value="$PROJECT_DIR$/application/admin/view/basestation/base_map.html" />
</list> </list>
</option> </option>
</component> </component>
...@@ -132,7 +144,15 @@ ...@@ -132,7 +144,15 @@
<item name="E:\master\Jz-Php" type="442cc68d:ScopeViewTreeModel$RootNode" /> <item name="E:\master\Jz-Php" type="442cc68d:ScopeViewTreeModel$RootNode" />
<item name="application" type="9f88c78c:ScopeViewTreeModel$FileNode" /> <item name="application" type="9f88c78c:ScopeViewTreeModel$FileNode" />
<item name="admin" type="9f88c78c:ScopeViewTreeModel$FileNode" /> <item name="admin" type="9f88c78c:ScopeViewTreeModel$FileNode" />
<item name="controller" type="9f88c78c:ScopeViewTreeModel$FileNode" /> <item name="view" type="9f88c78c:ScopeViewTreeModel$FileNode" />
</path>
<path>
<item name="Jz-Php" type="3d21c010:ScopeViewTreeModel$ProjectNode" />
<item name="E:\master\Jz-Php" type="442cc68d:ScopeViewTreeModel$RootNode" />
<item name="application" type="9f88c78c:ScopeViewTreeModel$FileNode" />
<item name="admin" type="9f88c78c:ScopeViewTreeModel$FileNode" />
<item name="view" type="9f88c78c:ScopeViewTreeModel$FileNode" />
<item name="basestation" type="9f88c78c:ScopeViewTreeModel$FileNode" />
</path> </path>
<path> <path>
<item name="Jz-Php" type="3d21c010:ScopeViewTreeModel$ProjectNode" /> <item name="Jz-Php" type="3d21c010:ScopeViewTreeModel$ProjectNode" />
...@@ -195,18 +215,18 @@ ...@@ -195,18 +215,18 @@
<workItem from="1578972376079" duration="9405000" /> <workItem from="1578972376079" duration="9405000" />
<workItem from="1579059424177" duration="1050000" /> <workItem from="1579059424177" duration="1050000" />
<workItem from="1579079847870" duration="1330000" /> <workItem from="1579079847870" duration="1330000" />
<workItem from="1579164336952" duration="60000" /> <workItem from="1579164336952" duration="142000" />
</task> </task>
<servers /> <servers />
</component> </component>
<component name="TimeTrackingManager"> <component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="17792000" /> <option name="totallyTimeSpent" value="17874000" />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="1358" y="-125" width="1936" height="1056" extended-state="6" /> <frame x="1358" y="-125" width="1936" height="1056" extended-state="6" />
<editor active="true" /> <editor active="true" />
<layout> <layout>
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.15601704" /> <window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.15601704" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" /> <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Favorites" order="2" side_tool="true" /> <window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" /> <window_info anchor="bottom" id="Message" order="0" />
...@@ -219,7 +239,7 @@ ...@@ -219,7 +239,7 @@
<window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" /> <window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
<window_info anchor="bottom" id="Database Changes" order="8" /> <window_info anchor="bottom" id="Database Changes" order="8" />
<window_info anchor="bottom" id="Version Control" order="9" /> <window_info anchor="bottom" id="Version Control" order="9" />
<window_info anchor="bottom" id="Terminal" order="10" visible="true" weight="0.2771739" /> <window_info active="true" anchor="bottom" id="Terminal" order="10" visible="true" weight="0.2771739" />
<window_info anchor="bottom" id="Event Log" order="11" side_tool="true" /> <window_info anchor="bottom" id="Event Log" order="11" side_tool="true" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" /> <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" /> <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
...@@ -342,8 +362,18 @@ ...@@ -342,8 +362,18 @@
</entry> </entry>
<entry file="file://$PROJECT_DIR$/application/admin/controller/Basestation.php"> <entry file="file://$PROJECT_DIR$/application/admin/controller/Basestation.php">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="295"> <state relative-caret-position="388">
<caret line="735" column="42" lean-forward="true" selection-start-line="735" selection-start-column="42" selection-end-line="735" selection-end-column="42" /> <caret line="738" column="34" lean-forward="true" selection-start-line="738" selection-start-column="34" selection-end-line="738" selection-end-column="34" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/application/admin/view/basestation/base_map.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="512">
<caret line="132" column="9" selection-start-line="132" selection-start-column="9" selection-end-line="132" selection-end-column="9" />
<folding>
<element signature="n#style#0;n#p#0;n#!!top" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
......
...@@ -5,129 +5,129 @@ ...@@ -5,129 +5,129 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css"> <style type="text/css">
body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";} body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";}
.BMap_cpyCtrl { .BMap_cpyCtrl {
display: none; display: none;
} }
.anchorBL { .anchorBL {
display: none; display: none;
} }
</style> </style>
<link rel="stylesheet" href="__STATIC__/xadmin/css/font.css"> <link rel="stylesheet" href="__STATIC__/xadmin/css/font.css">
<link rel="stylesheet" href="__STATIC__/xadmin/css/xadmin.css"> <link rel="stylesheet" href="__STATIC__/xadmin/css/xadmin.css">
<link rel="stylesheet" href="__STATIC__/xadmin/css/theme10.css"> <link rel="stylesheet" href="__STATIC__/xadmin/css/theme10.css">
<link rel="stylesheet" href="__STATIC__/font_1220417_290/iconfont.css"> <link rel="stylesheet" href="__STATIC__/font_1220417_290/iconfont.css">
<link rel="stylesheet" href="__STATIC__/admin/css/style.css"> <link rel="stylesheet" href="__STATIC__/admin/css/style.css">
<script src="__STATIC__/xadmin/lib/layui/layui.js" charset="utf-8"></script> <script src="__STATIC__/xadmin/lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="__STATIC__/xadmin/js/xadmin.js"></script> <script type="text/javascript" src="__STATIC__/xadmin/js/xadmin.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=rhvOB6ZbAVXOb0yjajc6WOLFSCAsGGVC"></script> <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=rhvOB6ZbAVXOb0yjajc6WOLFSCAsGGVC"></script>
<title>地图展示</title> <title>地图展示</title>
</head> </head>
<body> <body>
<input type="hidden" name="station_id" id="station_id" value="{$data}"> <input type="hidden" name="station_id" id="station_id" value="{$data}">
<div id="allmap"></div> <div id="allmap"></div>
</body> </body>
</html> </html>
<script type="text/javascript"> <script type="text/javascript">
layui.use(['layer'], function(){ layui.use(['layer'], function(){
$ = layui.jquery; $ = layui.jquery;
var station_id = $('#station_id').val(); var station_id = $('#station_id').val();
$.get("/basestation_region",{station_id:station_id}, function(result){ $.get("/basestation_region",{station_id:station_id}, function(result){
region(result[0]['station_id'],result[0]['longitude'],result[0]['latitude'],result[0]['station_name'],result[0]['proj_number']); region(result['jz_code'],result['jz_longitude'],result['jz_latitude'],result['jz_name'],result['project_code']);
function region(id, lng, lat,station_name,proj_number) {
if(!lng){
layer.open({
content: "暂无数据",
btn: ['确定'],
yes: function() {
layer.closeAll();
// window.location.reload();
}
});
}
//初始化地图对象
var bm = new BMap.Map("allmap", { enableMapClick: false });
//转化GPS坐标到百度坐标
var point = { function region(code,lng, lat,jz_name,project_code) {
lng: lng, if(!lng){
lat: lat layer.open({
} content: "暂无数据",
var opts = { btn: ['确定'],
width : 200, // 信息窗口宽度 yes: function() {
height: 80, // 信息窗口高度 layer.closeAll();
title : "" , // 信息窗口标题 // window.location.reload();
enableMessage:true//设置允许信息窗发送短息
}; }
});
var content= null; }
//初始化地图对象
setTimeout(function() { var bm = new BMap.Map("allmap", { enableMapClick: false });
var convertor = new BMap.Convertor();
var pointArr = []; //转化GPS坐标到百度坐标
pointArr.push(point); var point = {
convertor.translate(pointArr, 1, 5, transCallBack) lng: lng,
}, 500) lat: lat
}
function transCallBack(data) { var opts = {
if (data.status === 0) { width : 250, // 信息窗口宽度
bm.centerAndZoom(data.points[0], 15); height: 80, // 信息窗口高度
var mk = drawPoint(data.points[0], bm) title : "" , // 信息窗口标题
bm.enableScrollWheelZoom(true); //启用滚轮放大缩小 enableMessage:true//设置允许信息窗发送短息
};
content = "<p style= 'width: 200px;overflow: hidden;display: inline-block;text-overflow: ellipsis;white-space: nowrap;'>基站名称:"+ station_name +"<br/>项目编号:"+ proj_number +"<br/><a onclick=xadmin.add_tab('地图显示','/base_detai?id="+id+"',true,true)>查看详情</a></p>";
addClickHandler(content,mk); var content= null;
}
} setTimeout(function() {
var convertor = new BMap.Convertor();
var pointArr = [];
pointArr.push(point);
convertor.translate(pointArr, 1, 5, transCallBack)
}, 500)
function transCallBack(data) {
if (data.status === 0) {
bm.centerAndZoom(data.points[0], 15);
var mk = drawPoint(data.points[0], bm)
bm.enableScrollWheelZoom(true); //启用滚轮放大缩小
content = "<p style= 'width: 250px;overflow: hidden;display: inline-block;text-overflow: ellipsis;white-space: nowrap;'>基站号:"+ code +"<br/>基站名称:"+ jz_name +"<br/>项目编号:"+ project_code +"<br/></p>";
addClickHandler(content,mk);
}
}
// //
//绘制坐标点 //绘制坐标点
function drawPoint(point, bm, animation) { function drawPoint(point, bm, animation) {
var marker = new BMap.Marker(point); //设置标注的经纬度 var marker = new BMap.Marker(point); //设置标注的经纬度
bm.addOverlay(marker); //把标注添加到地图上 bm.addOverlay(marker); //把标注添加到地图上
if (animation !== undefined) { if (animation !== undefined) {
marker.setAnimation(BMAP_ANIMATION_BOUNCE) marker.setAnimation(BMAP_ANIMATION_BOUNCE)
} }
return marker return marker
} }
// 从GPS转换到BD // 从GPS转换到BD
function gpsToBd(point) { function gpsToBd(point) {
var convertor = new BMap.Convertor(); var convertor = new BMap.Convertor();
var pointArr = []; var pointArr = [];
pointArr.push(point); pointArr.push(point);
convertor.translate(pointArr, 3, 5, transCallBack) convertor.translate(pointArr, 3, 5, transCallBack)
} }
// 从bd转GPS // 从bd转GPS
function bdToGps(point) { function bdToGps(point) {
var bd09togcj02 = coordtransform.bd09togcj02(point.lng, point.lat); var bd09togcj02 = coordtransform.bd09togcj02(point.lng, point.lat);
var gps = coordtransform.gcj02towgs84(bd09togcj02[0], bd09togcj02[1]); var gps = coordtransform.gcj02towgs84(bd09togcj02[0], bd09togcj02[1]);
return { lng: gps[0], lat: gps[1] } return { lng: gps[0], lat: gps[1] }
} }
function addClickHandler(content,marker){ function addClickHandler(content,marker){
marker.addEventListener("mouseover",function(e){ marker.addEventListener("mouseover",function(e){
openInfo(content,e)} openInfo(content,e)}
); );
} }
function openInfo(content,e){ function openInfo(content,e){
var p = e.target; var p = e.target;
var point = new BMap.Point(p.getPosition().lng, p.getPosition().lat); var point = new BMap.Point(p.getPosition().lng, p.getPosition().lat);
var infoWindow = new BMap.InfoWindow(content,opts); // 创建信息窗口对象 var infoWindow = new BMap.InfoWindow(content,opts); // 创建信息窗口对象
bm.openInfoWindow(infoWindow,point); //开启信息窗口 bm.openInfoWindow(infoWindow,point); //开启信息窗口
} }
}
});
} });
}); </script>
\ No newline at end of file
});
</script>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论