|
|
@ -2,13 +2,27 @@
|
|
|
|
<div class="map-container">
|
|
|
|
<div class="map-container">
|
|
|
|
<div class="input-search" ref="targetElement">
|
|
|
|
<div class="input-search" ref="targetElement">
|
|
|
|
<div class="search-box">
|
|
|
|
<div class="search-box">
|
|
|
|
<input type="text" placeholder="请输入路线或者临时任务名称" />
|
|
|
|
<input
|
|
|
|
<div class="search-btn" @click="show = !show">搜索</div>
|
|
|
|
type="text"
|
|
|
|
|
|
|
|
v-model="searchQuery.carPlate"
|
|
|
|
|
|
|
|
placeholder="请输入正确的车牌号"
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
<i
|
|
|
|
|
|
|
|
class="el-icon-error icon-close"
|
|
|
|
|
|
|
|
v-show="searchQuery.carPlate"
|
|
|
|
|
|
|
|
@click="inputClear()"
|
|
|
|
|
|
|
|
></i>
|
|
|
|
|
|
|
|
<div class="search-btn" @click="handleSearch()">搜索</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<el-collapse-transition>
|
|
|
|
<el-collapse-transition>
|
|
|
|
<div v-show="show" class="search-list">
|
|
|
|
<div v-show="show" class="search-list">
|
|
|
|
<div class="list-item" v-for="(item, index) in 5" :key="index">
|
|
|
|
<div
|
|
|
|
002号线_01_维护_守押085_苏E
|
|
|
|
class="list-item"
|
|
|
|
|
|
|
|
v-for="item in searchList"
|
|
|
|
|
|
|
|
:key="item.carId"
|
|
|
|
|
|
|
|
@click="handelLookCar(item)"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
{{ item.carName }}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</el-collapse-transition>
|
|
|
|
</el-collapse-transition>
|
|
|
@ -33,20 +47,26 @@
|
|
|
|
{{ item }}
|
|
|
|
{{ item }}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- <div class="video-list" v-show="showVideo">
|
|
|
|
|
|
|
|
<grids></grids>
|
|
|
|
|
|
|
|
</div> -->
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
import MarsMap from "@/components/mars-map";
|
|
|
|
import MarsMap from "@/components/mars-map";
|
|
|
|
// import grids from "@/components/grids.vue";
|
|
|
|
|
|
|
|
import { getCarPoint } from "@/api/yunkun/yunkun.js";
|
|
|
|
import { getCarPoint, getCarByCarplate } from "@/api/yunkun/yunkun.js";
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
data() {
|
|
|
|
const basePathUrl = window.basePathUrl || "";
|
|
|
|
const basePathUrl = window.basePathUrl || "";
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
|
|
|
|
searchList: [],
|
|
|
|
|
|
|
|
searchQuery: {
|
|
|
|
|
|
|
|
carPlate: undefined, //车牌
|
|
|
|
|
|
|
|
plateColor: undefined, //车辆颜色
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
carQuery: {
|
|
|
|
|
|
|
|
teamId: "", //该参数表示获取指定车队下所有层级子车队的车辆定位,该参数优先级别高于carIds参数,
|
|
|
|
|
|
|
|
carIds: "", //车辆id 多个用逗号分开,优先级低于teamId
|
|
|
|
|
|
|
|
},
|
|
|
|
list: [],
|
|
|
|
list: [],
|
|
|
|
multipleList: ["营运线路", "维护线路", "临时任务"],
|
|
|
|
multipleList: ["营运线路", "维护线路", "临时任务"],
|
|
|
|
selectedItems: [],
|
|
|
|
selectedItems: [],
|
|
|
@ -116,39 +136,77 @@ export default {
|
|
|
|
document.addEventListener("click", this.handleClickOutside);
|
|
|
|
document.addEventListener("click", this.handleClickOutside);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
/**输入框清除 */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inputClear() {
|
|
|
|
|
|
|
|
this.map.flyHome();
|
|
|
|
|
|
|
|
if (this.timer) clearInterval(this.timer);
|
|
|
|
|
|
|
|
this.searchList = [];
|
|
|
|
|
|
|
|
this.searchQuery.carPlate = undefined;
|
|
|
|
|
|
|
|
this.carQuery.carIds = undefined;
|
|
|
|
|
|
|
|
this.show = false;
|
|
|
|
|
|
|
|
this.getCarPoint();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**根据车牌号查询车辆实时定位 */
|
|
|
|
|
|
|
|
async handleSearch() {
|
|
|
|
|
|
|
|
if (!this.searchQuery.carPlate) return;
|
|
|
|
|
|
|
|
// 清除轮询定时器
|
|
|
|
|
|
|
|
if (this.timer) clearInterval(this.timer);
|
|
|
|
|
|
|
|
const result = await getCarByCarplate(this.searchQuery);
|
|
|
|
|
|
|
|
this.searchList = result.list;
|
|
|
|
|
|
|
|
this.show = true;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handelLookCar(item) {
|
|
|
|
|
|
|
|
this.list = [item];
|
|
|
|
|
|
|
|
this.carQuery.carIds = item.carId;
|
|
|
|
|
|
|
|
this.map.flyToPoint(
|
|
|
|
|
|
|
|
new mars3d.LngLatPoint(parseFloat(item.lng), parseFloat(item.lat))
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
this.createCar("active");
|
|
|
|
|
|
|
|
this.show = false;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 获取车辆实时定位(可查全部)
|
|
|
|
|
|
|
|
*/
|
|
|
|
async getCarPoint() {
|
|
|
|
async getCarPoint() {
|
|
|
|
this.list = await this.carPoint();
|
|
|
|
this.list = await this.carPoint();
|
|
|
|
this.createCar();
|
|
|
|
this.createCar();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
async carPoint() {
|
|
|
|
async carPoint() {
|
|
|
|
let res = await getCarPoint({
|
|
|
|
let res = await getCarPoint(this.carQuery);
|
|
|
|
// carIds: "23,78",
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
res.list = res.list.filter(
|
|
|
|
res.list = res.list.filter(
|
|
|
|
(item) =>
|
|
|
|
(item) =>
|
|
|
|
item.carPlate.includes("苏E") ||
|
|
|
|
item.carPlate.includes("苏E") ||
|
|
|
|
(item.carPlate.includes("苏U") && item.stateCn.includes("在线-行驶"))
|
|
|
|
(item.carPlate.includes("苏U") && item.stateCn.includes("在线-行驶"))
|
|
|
|
);
|
|
|
|
);
|
|
|
|
return res.list.slice(0, 100);
|
|
|
|
return res.list.slice(0, 50);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 创建车辆图标
|
|
|
|
* 创建车辆图标
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
createCar() {
|
|
|
|
createCar(type) {
|
|
|
|
|
|
|
|
let _this = this;
|
|
|
|
this.graphicLayer.clear();
|
|
|
|
this.graphicLayer.clear();
|
|
|
|
this.graphicLayer.enabledEvent = false; // 关闭事件,大数据addGraphic时影响加载时间
|
|
|
|
this.graphicLayer.enabledEvent = false; // 关闭事件,大数据addGraphic时影响加载时间
|
|
|
|
// 设置动态位置
|
|
|
|
// 设置动态位置
|
|
|
|
for (let i = 0; i < this.list.length; i++) {
|
|
|
|
for (let i = 0; i < this.list.length; i++) {
|
|
|
|
let item = this.list[i];
|
|
|
|
const item = this.list[i];
|
|
|
|
const graphic = new mars3d.graphic.ModelPrimitive({
|
|
|
|
let graphic = new mars3d.graphic.ModelPrimitive({
|
|
|
|
id: item.carId,
|
|
|
|
id: item.carId,
|
|
|
|
style: {
|
|
|
|
style: {
|
|
|
|
// heading: parseInt(item.drct),
|
|
|
|
|
|
|
|
url: this.carUrl,
|
|
|
|
url: this.carUrl,
|
|
|
|
scale: 3,
|
|
|
|
scale: 3,
|
|
|
|
minimumPixelSize: 20,
|
|
|
|
minimumPixelSize: 20,
|
|
|
|
|
|
|
|
silhouette: true,
|
|
|
|
|
|
|
|
silhouetteColor: "#0084ff",
|
|
|
|
|
|
|
|
silhouetteSize: 2,
|
|
|
|
|
|
|
|
pitch: 0,
|
|
|
|
|
|
|
|
roll: 0,
|
|
|
|
label: {
|
|
|
|
label: {
|
|
|
|
text: item.carName,
|
|
|
|
text: item.carName,
|
|
|
|
font_size: 14,
|
|
|
|
font_size: 14,
|
|
|
@ -156,31 +214,39 @@ export default {
|
|
|
|
outline: true,
|
|
|
|
outline: true,
|
|
|
|
outlineColor: "#000000",
|
|
|
|
outlineColor: "#000000",
|
|
|
|
pixelOffsetY: -30,
|
|
|
|
pixelOffsetY: -30,
|
|
|
|
|
|
|
|
visibleDepth: false,
|
|
|
|
distanceDisplayCondition: true,
|
|
|
|
distanceDisplayCondition: true,
|
|
|
|
distanceDisplayCondition_far: 50000,
|
|
|
|
distanceDisplayCondition_far: 50000,
|
|
|
|
distanceDisplayCondition_near: 0,
|
|
|
|
distanceDisplayCondition_near: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// frameRateHeight: 30, // 控制贴模型的效率,多少帧计算一次
|
|
|
|
// autoMiddleDynamicPosition: true, //如果中间缺少数据时是否自动添加中间点
|
|
|
|
|
|
|
|
frameRateHeight: 30, // 控制贴模型的效率,多少帧计算一次
|
|
|
|
});
|
|
|
|
});
|
|
|
|
this.graphicLayer.addGraphic(graphic);
|
|
|
|
this.graphicLayer.addGraphic(graphic);
|
|
|
|
this.graphicLayer.enabledEvent = true; // 恢复事件
|
|
|
|
this.graphicLayer.enabledEvent = true; // 恢复事件
|
|
|
|
// graphic.bindHighlight({
|
|
|
|
|
|
|
|
// type: mars3d.EventType.click,
|
|
|
|
if (type) {
|
|
|
|
// silhouette: true,
|
|
|
|
graphic.openHighlight({
|
|
|
|
// silhouetteColor: "#FAAC51",
|
|
|
|
scale: 5,
|
|
|
|
// silhouetteSize: 2,
|
|
|
|
silhouette: true,
|
|
|
|
// label: {
|
|
|
|
silhouetteColor: "#FAAC51",
|
|
|
|
// outlineColor: "#FAAC51",
|
|
|
|
silhouetteSize: 2,
|
|
|
|
// },
|
|
|
|
label: {
|
|
|
|
// });
|
|
|
|
outlineColor: "#FAAC51",
|
|
|
|
// graphic.on(mars3d.EventType.click, function (e) {
|
|
|
|
},
|
|
|
|
// _this.$router.push({ path: "/carInfo" });
|
|
|
|
});
|
|
|
|
// });
|
|
|
|
}
|
|
|
|
|
|
|
|
graphic.on(mars3d.EventType.click, function (e) {
|
|
|
|
|
|
|
|
_this.$router.push({
|
|
|
|
|
|
|
|
path: "/carInfo",
|
|
|
|
|
|
|
|
query: { carId: e.target.id },
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.changePosition(0);
|
|
|
|
this.changePosition(0);
|
|
|
|
// 定时更新动态位置(setInterval为演示)
|
|
|
|
// 定时更新动态位置(setInterval为演示)
|
|
|
|
const interval = 10;
|
|
|
|
const interval = 15;
|
|
|
|
this.changePosition(interval);
|
|
|
|
this.changePosition(interval);
|
|
|
|
this.time = setInterval(() => {
|
|
|
|
this.time = setInterval(() => {
|
|
|
|
this.changePosition(interval);
|
|
|
|
this.changePosition(interval);
|
|
|
@ -191,36 +257,17 @@ export default {
|
|
|
|
async changePosition(interval) {
|
|
|
|
async changePosition(interval) {
|
|
|
|
let list = await this.carPoint();
|
|
|
|
let list = await this.carPoint();
|
|
|
|
this.graphicLayer.eachGraphic((graphic) => {
|
|
|
|
this.graphicLayer.eachGraphic((graphic) => {
|
|
|
|
for (let i = 0; i < list.length; i++) {
|
|
|
|
let carItam = list.filter((car) => car.carId == graphic.id);
|
|
|
|
let item = list[i];
|
|
|
|
if (carItam.length > 0) {
|
|
|
|
if (graphic.id == item.carId) {
|
|
|
|
|
|
|
|
// graphic.setOptions({
|
|
|
|
|
|
|
|
// style: {
|
|
|
|
|
|
|
|
// heading: parseInt(item.drct),
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
let position = Cesium.Cartesian3.fromDegrees(
|
|
|
|
let position = Cesium.Cartesian3.fromDegrees(
|
|
|
|
parseFloat(item.lng),
|
|
|
|
parseFloat(carItam[0].lng),
|
|
|
|
parseFloat(item.lat),
|
|
|
|
parseFloat(carItam[0].lat),
|
|
|
|
30
|
|
|
|
30
|
|
|
|
);
|
|
|
|
);
|
|
|
|
graphic.addDynamicPosition(position, interval); // 按time秒运动至指定位置
|
|
|
|
graphic.addDynamicPosition(position, interval); // 按time秒运动至指定位置
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
// 取区域内的随机点
|
|
|
|
|
|
|
|
randomPoint() {
|
|
|
|
|
|
|
|
const jd = this.random(117.207666 * 1000, 117.287241 * 1000) / 1000;
|
|
|
|
|
|
|
|
const wd = this.random(31.817099 * 1000, 31.876848 * 1000) / 1000;
|
|
|
|
|
|
|
|
return Cesium.Cartesian3.fromDegrees(jd, wd, 30);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
random(min, max) {
|
|
|
|
|
|
|
|
return Math.floor(Math.random() * (max - min + 1) + min);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handleClickOutside(event) {
|
|
|
|
handleClickOutside(event) {
|
|
|
|
// 判断点击的元素是否在目标元素外部
|
|
|
|
// 判断点击的元素是否在目标元素外部
|
|
|
|
if (this.show && !this.$refs.targetElement.contains(event.target)) {
|
|
|
|
if (this.show && !this.$refs.targetElement.contains(event.target)) {
|
|
|
@ -247,7 +294,7 @@ export default {
|
|
|
|
this.graphicLayer = new mars3d.layer.GraphicLayer();
|
|
|
|
this.graphicLayer = new mars3d.layer.GraphicLayer();
|
|
|
|
map.addLayer(this.graphicLayer);
|
|
|
|
map.addLayer(this.graphicLayer);
|
|
|
|
// this.initTilesetLayer();
|
|
|
|
// this.initTilesetLayer();
|
|
|
|
// this.getCarPoint();
|
|
|
|
this.getCarPoint();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -272,9 +319,7 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
this.map.addLayer(tiles3dLayer);
|
|
|
|
this.map.addLayer(tiles3dLayer);
|
|
|
|
|
|
|
|
|
|
|
|
if (process.env.NODE_ENV === "production") this.chkShadows(true);
|
|
|
|
if (process.env.NODE_ENV === "production") this.chkShadows(true);
|
|
|
|
|
|
|
|
|
|
|
|
tiles3dLayer.on(mars3d.EventType.load, function (event) {
|
|
|
|
tiles3dLayer.on(mars3d.EventType.load, function (event) {
|
|
|
|
_this.getCarLocation();
|
|
|
|
_this.getCarLocation();
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -302,9 +347,17 @@ export default {
|
|
|
|
z-index: 100;
|
|
|
|
z-index: 100;
|
|
|
|
|
|
|
|
|
|
|
|
.search-box {
|
|
|
|
.search-box {
|
|
|
|
|
|
|
|
position: relative;
|
|
|
|
display: flex;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
align-items: center;
|
|
|
|
height: 32px;
|
|
|
|
height: 32px;
|
|
|
|
|
|
|
|
.icon-close {
|
|
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
|
|
left: 260px;
|
|
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
|
|
color: #0084ff;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.search-btn {
|
|
|
|
.search-btn {
|
|
|
|
cursor: pointer;
|
|
|
|
cursor: pointer;
|
|
|
@ -340,6 +393,7 @@ export default {
|
|
|
|
border: 1px solid #0084ff;
|
|
|
|
border: 1px solid #0084ff;
|
|
|
|
border-top: 0;
|
|
|
|
border-top: 0;
|
|
|
|
& > div {
|
|
|
|
& > div {
|
|
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
font-size: 14px;
|
|
|
|
font-size: 14px;
|
|
|
|
padding: 10px;
|
|
|
|
padding: 10px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|