From 1a161393ef707272bcd534c7cfffd7ea0e60b866 Mon Sep 17 00:00:00 2001
From: jxdnsong <592566207@qq.com>
Date: Sat, 27 Feb 2021 15:54:44 +0800
Subject: [PATCH] 实时报警定位功能完善
---
src/views/realTimePolice/real.vue | 2 +-
public/map/widgets/clientManagement/ClientManagement.js | 9 ++-------
public/map/widgets/map/MapWidget.js | 3 ++-
public/map/index.html | 38 ++++++++++++++------------------------
4 files changed, 19 insertions(+), 33 deletions(-)
diff --git a/public/map/index.html b/public/map/index.html
index cb5f408..b246857 100644
--- a/public/map/index.html
+++ b/public/map/index.html
@@ -34,13 +34,12 @@
<script>
var _framework = null;
var _AppEvent = null;
- var locationObj = null
- function init(openId) {
- if (openId && _AppEvent != null) {
- showFun(openId);
- return;
- }
+ function getQueryStringByKey(key) {
+ return (document.location.search.match(new RegExp("(?:^\\?|&)" + key + "=(.*?)(?=&|$)")) || ['', null])[1];
+ }
+
+ function init(openId,locationObj) {
$.divselect("#divselect", "#inputselect");
require(["base/framework", "base/AppEvent"],
function (framework, AppEvent) {
@@ -48,7 +47,14 @@
_framework.onSiderContainerShow();
_framework.resize();
_AppEvent = AppEvent;
- _AppEvent.addAppEventListener("mapLoad", mapLoad);
+
+ _AppEvent.addAppEventListener("mapLoad", function(map){
+ if (locationObj && locationObj != null) {
+ map.centerAndZoom(new esri.geometry.Point(locationObj.x,locationObj.y, new esri.SpatialReference({ wkid: 4326 })), 14);
+ }
+ });
+
+ var openId = getQueryStringByKey('openid');
if (openId) showFun(openId);
}
);
@@ -58,16 +64,11 @@
_AppEvent.dispatchAppEvent(_AppEvent.RUN_WIDGET, id);
}
- function mapLoad(map) {
- // if(locationObj) {
- // map.centerAndZoom(new esri.geometry.Point(locationObj.x,locationObj.y, new esri.SpatialReference({ wkid: 4326 })), 14);
- // }
- }
</script>
</head>
-<body onload="init()">
+<body>
<div class="map_content">
@@ -99,16 +100,5 @@
</body>
<script src="./js/monitor.js"></script>
<script src="./js/forestry-map.js"></script>
-
-<script>
- var openId = getQueryStringByKey('openid');
- if (openId && openId != '') {
- init(openId)
- }
-
- function getQueryStringByKey(key) {
- return (document.location.search.match(new RegExp("(?:^\\?|&)" + key + "=(.*?)(?=&|$)")) || ['', null])[1];
- }
-</script>
</html>
diff --git a/public/map/widgets/clientManagement/ClientManagement.js b/public/map/widgets/clientManagement/ClientManagement.js
index 8bc8202..9c2b659 100644
--- a/public/map/widgets/clientManagement/ClientManagement.js
+++ b/public/map/widgets/clientManagement/ClientManagement.js
@@ -3,8 +3,8 @@
* @Version: 1.0
* @Author: yangsx
* @Date: 2019-12-09 19:01:40
- * @LastEditors: yangsx
- * @LastEditTime: 2019-12-14 14:44:57
+ * @LastEditors: song
+ * @LastEditTime: 2021-02-25 13:59:29
*/
define([
"dojo",
@@ -248,11 +248,6 @@
//var data = DataManager.getData();
that.clusterLayer.addData(datas);
-
-
- if(window.locationObj) {
- that._map.centerAndZoom(new esri.geometry.Point(window.locationObj.x,window.locationObj.y, new esri.SpatialReference({ wkid: 4326 })), 14);
- }
}
, clearLayer: function () {
diff --git a/public/map/widgets/map/MapWidget.js b/public/map/widgets/map/MapWidget.js
index a7e1d18..9a19124 100644
--- a/public/map/widgets/map/MapWidget.js
+++ b/public/map/widgets/map/MapWidget.js
@@ -121,6 +121,7 @@
AppEvent.addAppEventListener(AppEvent.ADD_TOP_MOST_LAYER, lang.hitch(this, this.onAddTopMostLayer));
},
onload: function () {
+ AppEvent.dispatchAppEvent("mapLoad",this.map);
//var listNode = this.map.attribution.listNode;
var listNode = this.domNode;
var scalebar = new Scalebar({
@@ -236,7 +237,7 @@
}
}
}))
- AppEvent.dispatchAppEvent("mapLoad", this.map);
+
return this.map
},
appendToolHandler: function (data) {
diff --git a/src/views/realTimePolice/real.vue b/src/views/realTimePolice/real.vue
index da5754f..18106aa 100644
--- a/src/views/realTimePolice/real.vue
+++ b/src/views/realTimePolice/real.vue
@@ -804,7 +804,7 @@
this.showMap = true;
this.$nextTick(() => {
this.$refs.mapDiv.onload = () => {
- window.frames[0].locationObj = {x: row.jd, y: row.wd};
+ window.frames[0].init(null,{x: row.jd, y: row.wd});
};
})
},
--
Gitblit v1.9.3