|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div class="map-container">
|
|
|
|
|
<div class="input-search" ref="targetElement">
|
|
|
|
|
<div class="input-search" id="targetElement">
|
|
|
|
|
<div class="search-box">
|
|
|
|
|
<input
|
|
|
|
|
type="text"
|
|
|
|
@ -150,6 +150,16 @@ export default {
|
|
|
|
|
document.addEventListener("click", this.handleClickOutside);
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
// 搜索下拉框控制
|
|
|
|
|
handleClickOutside(event) {
|
|
|
|
|
if (
|
|
|
|
|
this.show &&
|
|
|
|
|
!document.getElementById("targetElement").contains(event.target)
|
|
|
|
|
) {
|
|
|
|
|
this.show = false;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**获取车辆接口 */
|
|
|
|
|
async carPoint(isBoole) {
|
|
|
|
|
let res = await getCarPoint(this.carQuery);
|
|
|
|
@ -242,6 +252,8 @@ export default {
|
|
|
|
|
this.mapLayer.car.enabledEvent = false; // 关闭事件,大数据addGraphic时影响加载时间
|
|
|
|
|
for (let index = 0; index < this.list.length; index++) {
|
|
|
|
|
let item = this.list[index];
|
|
|
|
|
if (item.missionId) {
|
|
|
|
|
//只显示有任务的车辆
|
|
|
|
|
const graphic = new mars3d.graphic.ModelEntity({
|
|
|
|
|
id: `car${item.carId}`,
|
|
|
|
|
// position: new mars3d.LngLatPoint(
|
|
|
|
@ -280,14 +292,13 @@ export default {
|
|
|
|
|
missionType: item.missionType,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.mapLayer.car.addGraphic(graphic);
|
|
|
|
|
this.mapLayer.car.enabledEvent = true; // 恢复事件
|
|
|
|
|
graphic.bindPopup(
|
|
|
|
|
() => {
|
|
|
|
|
let html = `<div id="car${item.carId}" class="carPlate">
|
|
|
|
|
<img src="${require(`../assets/images/carType${item.missionType}.png`)}" class="carType"/>
|
|
|
|
|
${item.missionName}
|
|
|
|
|
${item.carPlate}
|
|
|
|
|
</div>`;
|
|
|
|
|
return html;
|
|
|
|
|
},
|
|
|
|
@ -351,13 +362,18 @@ export default {
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 定时更新动态位置(setInterval为演示)
|
|
|
|
|
this.changePosition(0);
|
|
|
|
|
const interval = 10;
|
|
|
|
|
this.changePosition(interval);
|
|
|
|
|
|
|
|
|
|
//生产环境开启轮询
|
|
|
|
|
if (process.env.NODE_ENV === "production") {
|
|
|
|
|
this.time = setInterval(() => {
|
|
|
|
|
this.changePosition(interval);
|
|
|
|
|
}, interval * 1000);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
async changePosition(interval) {
|
|
|
|
|