Commit 1fdadbf4 by 张杰

修复地图报错

1 parent 5d71032c
import 'font-awesome/css/font-awesome.min.css'
import './assets/scss/element-variables.scss'
import '@/assets/scss/element-variables.scss'
//import Vue from 'vue'
import ElementUI from 'element-ui';
import 'animate.css/animate.min.css'
import './assets/scss/style.scss'
import '@/assets/scss/style.scss'
import 'element-ui/lib/theme-chalk/index.css';
import './assets/spritesmith-generated/sprite.css'
import '@/assets/spritesmith-generated/sprite.css'
import Router from 'vue-router'
import routes from './router'
import './core/public-path';
import actions from './core/actions';
import routes from '@/router'
import '@/core/public-path';
import actions from '@/core/actions';
import vLayout from 'pages/Layout.vue'
import vFullLayout from 'pages/FullWidthLayout.vue'
import vLayout from '@/pages/Layout.vue'
import vFullLayout from '@/pages/FullWidthLayout.vue'
import store from './vuex/store.js'
import store from '@/vuex/store.js'
import App from './App.vue'
import App from '@/App.vue'
import Vue from 'vue'
......
......@@ -52,7 +52,7 @@ import remoteLoad from "utils/remoteLoad.js";
import mapService from "utils/mapService.js";
import FenceMapControll from "./FenceMapControll.vue";
const BUSINESS_SERVICE = services.business;
const mapMenu = ''
const mapMenu = "";
import { CONSTANT } from "../../constant";
export default {
props: ["fenceMapModalVisible", "init", "readonlyStatus"],
......@@ -151,42 +151,38 @@ export default {
},
bindSearch() {
const self = this;
this.auto = new AMap.Autocomplete({
input: "fenceMapSearch",
});
AMap.plugin("AMap.Autocomplete", function () {
self.auto = new AMap.Autocomplete({
input: "fenceMapSearch",
});
this.autoCenterMarker = new AMap.Marker({
icon: require("images/auto-center-marker.gif"),
map: this.mapObj,
offset: new AMap.Pixel(-12, -12),
visible: false,
});
self.autoCenterMarker = new AMap.Marker({
icon: require("images/auto-center-marker.gif"),
map: self.mapObj,
offset: new AMap.Pixel(-12, -12),
visible: false,
});
this.autoCenterMarker.on("rightclick", (e) => {
if (self.mapObj.getAllOverlays("circle").length) {
window.mapMenu.contextMenu.open(self.mapObj, e.lnglat);
self.contextMenuPositon = e.lnglat; //右键菜单位置
}
});
self.autoCenterMarker.on("rightclick", (e) => {
if (self.mapObj.getAllOverlays("circle").length) {
window.mapMenu.contextMenu.open(self.mapObj, e.lnglat);
self.contextMenuPositon = e.lnglat; //右键菜单位置
}
});
AMap.event.addListener(this.auto, "select", (e) => {
if (e.poi && e.poi.location) {
this.mapObj.setCenter(e.poi.location);
this.autoCenterMarker.setPosition(e.poi.location);
/*for(var i = 0, l = this.polygons.length; i < l; i++) {
AMap.event.addListener(self.auto, "select", (e) => {
if (e.poi && e.poi.location) {
self.mapObj.setCenter(e.poi.location);
self.autoCenterMarker.setPosition(e.poi.location);
/*for(var i = 0, l = this.polygons.length; i < l; i++) {
this.polygons[i].setMap(null);
}*/
this.autoCenterMarker.show();
this.mapObj.add(this.autoCenterMarker);
//this.form.lng = e.poi.location.lng;
//this.form.lat = e.poi.location.lat;
//this.contextMenuPositon = e.poi.location
//window.mapMenu.contextMenu.open(this.mapObj, mapService.getLngLat(e.poi.location.lng, e.poi.location.lat))
}
self.autoCenterMarker.show();
self.mapObj.add(self.autoCenterMarker);
}
this.mapObj.setZoom(14);
self.mapObj.setZoom(14);
});
});
},
bindContextMenu() {
......@@ -195,16 +191,18 @@ export default {
console.log(mapMenu);
function ContextMenu(map) {
var me = this;
var content = [];
var content = [];
this.contextMenuPositon = null;
content.push('<div class="context_menu" >')
content.push('<p onclick="mapMenu.moveCenter()"><span>设置围栏中心</span></p>')
content.push('</div>')
content.push('<div class="context_menu" >');
content.push(
'<p onclick="mapMenu.moveCenter()"><span>设置围栏中心</span></p>'
);
content.push("</div>");
this.contextMenu = new AMap.ContextMenu({
isCustom: true,
content: content.join(''),
content: content.join(""),
});
map.on("rightclick", (e) => {
if (self.mapObj.getAllOverlays("circle").length) {
......@@ -215,7 +213,7 @@ export default {
}
ContextMenu.prototype.moveCenter = function () {
console.log('6666666666')
console.log("6666666666");
self.moveCenter();
this.contextMenu.close();
};
......
......@@ -194,7 +194,7 @@ const monitor = {
});
//mapService.setFitView(MAP);
mapService.setFitView(MAP);
this.allData = this.allData.concat(data);
EventBus.$emit('uiMap.monitor.drawDone');
if(this.isCompare){
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!