Commit a91847c1 by 张杰

仲利需求

1 parent 455c4141
This diff could not be displayed because it is too large.
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
"animate.css": "^3.7.0", "animate.css": "^3.7.0",
"axios": "^0.18.0", "axios": "^0.18.0",
"calendar-months": "^1.0.1", "calendar-months": "^1.0.1",
"caniuse-lite": "^1.0.30001292",
"chart.js": "^2.7.2", "chart.js": "^2.7.2",
"clipboard": "^2.0.4", "clipboard": "^2.0.4",
"downloadjs": "^1.4.7", "downloadjs": "^1.4.7",
...@@ -21,7 +22,9 @@ ...@@ -21,7 +22,9 @@
"es6-promise": "^4.2.4", "es6-promise": "^4.2.4",
"font-awesome": "^4.7.0", "font-awesome": "^4.7.0",
"moment": "^2.22.0", "moment": "^2.22.0",
"node-sass": "^7.0.0",
"qs": "^6.5.1", "qs": "^6.5.1",
"sass": "^1.45.1",
"vue": "^2.5.11", "vue": "^2.5.11",
"vue-infinite-loading": "^2.3.1", "vue-infinite-loading": "^2.3.1",
"vue-router": "^3.0.1", "vue-router": "^3.0.1",
...@@ -36,8 +39,7 @@ ...@@ -36,8 +39,7 @@
"devDependencies": { "devDependencies": {
"autoprefixer": "^9.1.5", "autoprefixer": "^9.1.5",
"babel-core": "^6.26.0", "babel-core": "^6.26.0",
"browserslist": "^4.16.6", "browserslist": "^4.19.1",
"caniuse-lite": "^1.0.30001228",
"clean-webpack-plugin": "^0.1.19", "clean-webpack-plugin": "^0.1.19",
"cross-env": "^5.0.5", "cross-env": "^5.0.5",
"css-loader": "^0.28.7", "css-loader": "^0.28.7",
...@@ -48,7 +50,6 @@ ...@@ -48,7 +50,6 @@
"html-webpack-plugin": "^3.2.0", "html-webpack-plugin": "^3.2.0",
"http-proxy-middleware": "^0.18.0", "http-proxy-middleware": "^0.18.0",
"mini-css-extract-plugin": "^0.4.0", "mini-css-extract-plugin": "^0.4.0",
"node-sass": "^6.0.1",
"optimize-css-assets-webpack-plugin": "^4.0.0", "optimize-css-assets-webpack-plugin": "^4.0.0",
"postcss-loader": "^3.0.0", "postcss-loader": "^3.0.0",
"sass-loader": "^6.0.6", "sass-loader": "^6.0.6",
......
<template>
<v-full-layout class="active_location">
<template slot="breadcrumb">
<el-breadcrumb-item>激活位置</el-breadcrumb-item>
</template>
<template slot="main">
<div id="map" class="map-container"></div>
</template>
</v-full-layout>
</template>
<script>
import mapService from 'utils/mapService.js'
import "utils/mapEvent.js";
import EventBus from '../../event-bus'
import remoteLoad from "utils/remoteLoad.js";
import {CONSTANT} from '../../constant'
export default {
data() {
return {
AMap: null,
mapObj: null,
checkLoadedTimeoutId: "",
};
},
created() {
console.log(history.state)
if (window.AMap) {
this.initMap();
} else {
remoteLoad(`${CONSTANT.AMAP_URL}`).then(() => {
remoteLoad(`https://webapi.amap.com/ui/1.0/main.js?v=1.0.11`).then(
() => {
this.initMap();
}
);
});
}
},
methods: {
// 初始化地图
initMap() {
let check = () => {
if (this.checkLoadedTimeoutId) {
window.clearTimeout(this.checkLoadedTimeoutId);
}
return setTimeout(() => {
if (
"AMap" in window &&
typeof AMap.Map == "function" &&
!this.mapObj
) {
window.AMap = AMap;
this.mapObj = mapService.init("map");
this.isInitMap = true;
let o = history.state;
if (o.lng) {
o.elat = o.lat;
o.elng = o.lng;
this.addLocation(o);
}
} else {
this.checkLoadedTimeoutId = check();
}
}, 100);
};
this.checkLoadedTimeoutId = check();
},
// 添加位置点
addLocation(row) {
let drawData = row;
EventBus.$emit("uiMap.monitor.drawMaker", drawData, true);
},
},
};
</script>
<style lang="scss" scoped>
.active_location {
.full-width {
position: absolute;
top: 0px;
height: 100%;
left: 0;
width: 100%;
bottom: 0;
.map-container {
width: 100%;
height: 100%;
z-index: 100;
position: absolute;
top: 0px;
left: 0;
bottom: 0;
overflow: hidden;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -249,6 +249,12 @@ const routes = [ ...@@ -249,6 +249,12 @@ const routes = [
name: 'compareLocation', name: 'compareLocation',
meta: {title:'位置对比'}, meta: {title:'位置对比'},
component: compareLocation component: compareLocation
},{
path: 'activeLocation',
name: 'activeLocation',
meta: {title:'设备激活位置'},
component: () => import('pages/monitor/activeLocation.vue'),
notMenu: true,
}] }]
}, },
{ {
......
...@@ -661,6 +661,7 @@ MapService.prototype = { ...@@ -661,6 +661,7 @@ MapService.prototype = {
<p><i class="icon icon-info_stop"></i> 驻留时长: <span class="des">${info.totalDurationString}</span></p> <p><i class="icon icon-info_stop"></i> 驻留时长: <span class="des">${info.totalDurationString}</span></p>
</div>`; </div>`;
}, },
clearMap: function(map){ clearMap: function(map){
this.map.clearMap(); this.map.clearMap();
}, },
...@@ -669,7 +670,49 @@ MapService.prototype = { ...@@ -669,7 +670,49 @@ MapService.prototype = {
}, },
bindClickEvent(){ bindClickEvent(){
} },
// 创建位置点弹框
createActiveInfo(info) {
return `<h3 class="map-infowindow-title">${info.name}/${info.standNo}</h3>
<div class="map-infowindow-ct">
<p><i class="icon icon-info_device"></i> 设备号: <span class="des">${info.sn} (${info.source == 1?'有线':'无线'})</span></p>
<p><i class="icon icon-info_time"></i>激活时间: <span class="des">${info.time}</span></p>
<p><i class="icon icon-info_location"></i> 激活地址: <span class="des">${info.address}</span></p>
</div>`
},
// 位置点弹框
bindActiveLocationInfoWindow(marker, map, info) {
var self = this
var infoDiv = document.createElement('div')
infoDiv.innerHTML = self.createActiveInfo(info)
return this.createActiveInfoWindow(marker, map, infoDiv)
},
// 创建位置点弹框
createActiveInfoWindow(marker, map, div, isInfoOpen, isInfoAutoMove) {
var infoWindow = new AMap.InfoWindow({
offset: new AMap.Pixel(0, 0),
content: div,
autoMove: !!isInfoAutoMove,
})
console.log(infoWindow)
marker.infoWindow = infoWindow
if (isInfoOpen) {
infoWindow.open(map, marker.getPosition())
}
//给Marker绑定单击事件
marker.on('click', markerClick)
function markerClick(e) {
//infoWindow.setContent(e.target.content);
infoWindow.open(map, e.target.getPosition())
}
return infoWindow
},
} }
const mapService = new MapService(); const mapService = new MapService();
......
...@@ -134,7 +134,10 @@ const monitor = { ...@@ -134,7 +134,10 @@ const monitor = {
} }
EventBus.$emit('uiMap.monitor.drawDone'); EventBus.$emit('uiMap.monitor.drawDone');
}) })
}) }),
// 激活位置点
EventBus.$on("uiMap.monitor.drawMaker", this.drawMaker);
}, },
draw(data, autoOpenLastInfoWindow){ draw(data, autoOpenLastInfoWindow){
const MAP = mapService.map; const MAP = mapService.map;
...@@ -274,7 +277,43 @@ const monitor = { ...@@ -274,7 +277,43 @@ const monitor = {
item && window.clearTimeout(item); item && window.clearTimeout(item);
}); });
this.timeoutIds = [] this.timeoutIds = []
},
// 激活位置
drawMaker(data, autoOpenLastInfoWindow) {
const MAP = mapService.map
const marker = mapService.createCarMarker(
[parseFloat(data.lng), parseFloat(data.lat)],
MAP
)
const infoWindow = mapService.bindActiveLocationInfoWindow(
marker,
MAP,
data,
true
)
// this.markers[tag] = marker;
// this.infowins[tag] = infoWindow;
// 设置图标
mapService.setDefaultIcon(marker, data.vehicleIcon)
if (autoOpenLastInfoWindow) {
// /EventBus.$emit("uiMap.monitor.openInfoWindow");
monitor.openActiveInfoWindow(marker, infoWindow)
} }
// mapService.setFitView(MAP);
EventBus.$emit('uiMap.monitor.drawDone')
},
// 打开激活位置点弹框
openActiveInfoWindow(makers, infoWindow) {
const MAP = mapService.map
const lnglat = makers.getPosition()
infoWindow.open(MAP, lnglat)
MAP.setZoomAndCenter(MAP.getZoom(), lnglat)
}
} }
export default monitor; export default monitor;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!