删除废弃文件

main
许宏杰 5 months ago
parent f634422644
commit 6cc5341de3

@ -1,452 +0,0 @@
<template>
<div class="map-container">
<div class="input-search" ref="targetElement">
<div class="search-box">
<input
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>
<el-collapse-transition>
<div v-show="show" class="search-list">
<div
class="list-item"
v-for="item in searchList"
:key="item.carId"
@click="handelLookCar(item)"
>
{{ item.carName }}
</div>
</div>
</el-collapse-transition>
</div>
<mars-map @mapLoad="mapLoad" :options="options"></mars-map>
<div class="multiple">
<div
@click="toggleSelection(item)"
:class="{ checkbox: true, checked: isSelected(item) }"
v-for="(item, index) in multipleList"
:key="index"
>
<img
:src="require(`../assets/images/${item}.png`)"
alt=""
class="btn-icon"
/>
{{ item }}
</div>
</div>
</div>
</template>
<script>
import MarsMap from "@/components/mars-map";
import { getCarPoint, getCarByCarplate } from "@/api/yunkun/yunkun.js";
export default {
data() {
const basePathUrl = window.basePathUrl || "";
return {
searchList: [],
searchQuery: {
carPlate: undefined, //
plateColor: undefined, //
},
carQuery: {
teamId: "", //carIds,
carIds: "", //id teamId
},
list: [],
multipleList: ["营运线路", "维护线路", "临时任务"],
selectedItems: [],
graphicLayer: null,
baseUrl: basePathUrl + "lib/geoJson/tileset.json",
carUrl: basePathUrl + "lib/qiche.gltf",
map: null,
options: {
scene: {
// center: {
// lat: 31.754913,
// lng: 117.248572,
// alt: 6220,
// heading: 357,
// pitch: -31,
// },
center: {
lat: 31.212805,
lng: 120.607156,
alt: 5096.4,
heading: 357.9,
pitch: -31.5,
},
fog: false,
fxaa: false,
removeDblClick: true,
requestRenderMode: false,
scene3DOnly: false,
sceneMode: 3,
shadows: false,
showMoon: false,
showSkyAtmosphere: false,
showSkyBox: false,
showSun: false,
},
control: {
contextmenu: { preventDefault: false, hasDefault: false },
},
basemaps: [
{
name: "mapbox影像图",
icon: "img/basemaps/mapboxSatellite.png",
type: "mapbox",
username: "sharealex",
styleId: "cly5i21fn00e901prgq643t4r",
token:
"pk.eyJ1Ijoic2hhcmVhbGV4IiwiYSI6ImNsaXNhZmRjbTFhbnczZmxib3h1OW05YXYifQ.PhlKv60ar3K359d8x2yBPw",
tilesize: 256,
scaleFactor: false,
show: false,
},
],
},
show: false,
showVideo: true,
};
},
components: { MarsMap },
beforeDestroy() {
clearInterval(this.timer);
//
document.removeEventListener("click", this.handleClickOutside);
},
mounted() {
// mounted
document.addEventListener("click", this.handleClickOutside);
},
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() {
this.list = await this.carPoint();
this.createCar();
},
async carPoint() {
let res = await getCarPoint(this.carQuery);
res.list = res.list.filter(
(item) =>
item.carPlate.includes("苏E") ||
(item.carPlate.includes("苏U") && item.stateCn.includes("在线-行驶"))
);
return res.list.slice(0, 100);
},
/**
* 创建车辆图标
*/
createCar(type) {
let _this = this;
this.graphicLayer.clear();
this.graphicLayer.enabledEvent = false; // addGraphic
//
for (let i = 0; i < this.list.length; i++) {
const item = this.list[i];
let graphic = new mars3d.graphic.ModelPrimitive({
id: item.carId,
style: {
url: this.carUrl,
scale: 3,
minimumPixelSize: 20,
silhouette: true,
silhouetteColor: "#0084ff",
silhouetteSize: 2,
pitch: 0,
roll: 0,
label: {
text: item.carPlate,
font_size: 14,
color: "#ffffff",
outline: true,
outlineColor: "#000000",
pixelOffsetY: -30,
visibleDepth: false,
distanceDisplayCondition: true,
distanceDisplayCondition_far: 50000,
distanceDisplayCondition_near: 0,
},
},
// autoMiddleDynamicPosition: true, //
frameRateHeight: 30, //
});
this.graphicLayer.addGraphic(graphic);
this.graphicLayer.enabledEvent = true; //
if (type) {
graphic.openHighlight({
scale: 5,
silhouette: true,
silhouetteColor: "#FAAC51",
silhouetteSize: 2,
label: {
outlineColor: "#FAAC51",
},
});
}
graphic.on(mars3d.EventType.click, function (e) {
_this.$router.push({
path: "/carInfo",
query: { carId: e.target.id },
});
});
}
this.changePosition(0);
// setInterval
const interval = 15;
this.changePosition(interval);
this.time = setInterval(() => {
this.changePosition(interval);
}, interval * 1000);
},
//
async changePosition(interval) {
let list = await this.carPoint();
this.graphicLayer.eachGraphic((graphic) => {
let carItam = list.filter((car) => car.carId == graphic.id);
if (carItam.length > 0) {
let position = Cesium.Cartesian3.fromDegrees(
parseFloat(carItam[0].lng),
parseFloat(carItam[0].lat),
30
);
graphic.addDynamicPosition(position, interval); // time
}
});
},
handleClickOutside(event) {
//
if (this.show && !this.$refs.targetElement.contains(event.target)) {
this.show = false;
}
},
toggleSelection(item) {
//
if (this.isSelected(item)) {
this.selectedItems = this.selectedItems.filter(
(selectedItem) => selectedItem !== item
);
} else {
this.selectedItems.push(item);
}
},
isSelected(item) {
//
return this.selectedItems.includes(item);
},
mapLoad(map) {
this.map = map;
this.graphicLayer = new mars3d.layer.GraphicLayer();
map.addLayer(this.graphicLayer);
// this.initTilesetLayer();
this.getCarPoint();
},
/**
* 加载姑苏区三维图层
*/
initTilesetLayer() {
let _this = this;
// ;
const tiles3dLayer = new mars3d.layer.TilesetLayer({
name: "姑苏区建筑物",
url: "https://www.jichuanglanhai.com:88/3dtiles/yunkun/tileset.json",
maximumScreenSpaceError: 16,
maximumMemoryUsage: 1024 / 2,
dynamicScreenSpaceError: false,
skipLevelOfDetail: true,
preferLeaves: true,
flyTo: false,
style: {
color: {
conditions: [["true", `color("rgba(42, 160, 224, 1)")`]],
},
},
});
this.map.addLayer(tiles3dLayer);
if (process.env.NODE_ENV === "production") this.chkShadows(true);
tiles3dLayer.on(mars3d.EventType.load, function (event) {
_this.getCarLocation();
});
},
chkShadows(val) {
let _this = this;
this.map.viewer.shadows = val;
if (val) {
setTimeout(function () {
// 沿
_this.map.scene.shadowMap._lightCamera = _this.map.scene.camera;
}, 1500);
}
},
},
};
</script>
<style lang="scss" scoped>
.input-search {
position: absolute;
top: 100px;
left: 50%;
transform: translateX(-50%);
z-index: 100;
.search-box {
position: relative;
display: flex;
align-items: center;
height: 32px;
.icon-close {
cursor: pointer;
position: absolute;
left: 260px;
font-size: 14px;
color: #0084ff;
}
}
.search-btn {
cursor: pointer;
line-height: 32px;
background: #0084ff;
color: #ffffff;
font-size: 14px;
padding: 0 10px;
height: 100%;
border-radius: 0 3px 3px 0;
}
input {
font-size: 14px;
width: 280px;
height: 100%;
border: 1px solid #0084ff;
border-right: 0;
background: #032b57;
padding-left: 6px;
color: #ffffff;
}
input::placeholder {
color: #7c91a8;
}
input:focus-visible {
outline: none;
}
.search-list {
width: 280px;
background: #032b57;
color: #fff;
border: 1px solid #0084ff;
border-top: 0;
& > div {
cursor: pointer;
font-size: 14px;
padding: 10px;
}
& > div:hover {
background: #0084ff;
}
}
}
.video-list {
position: absolute;
bottom: 25px;
left: 50%;
transform: translateX(-50%);
z-index: 50;
padding: 10px;
display: flex;
align-items: center;
border: 1px solid #415367;
border-radius: 10px;
background: rgba(28, 31, 34, 0.6);
}
.multiple {
position: absolute;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
z-index: 100;
width: 880px;
height: 80px;
display: flex;
align-items: center;
justify-content: space-between;
background: url("../assets/images/multipleList.png");
background-size: 100% 100%;
padding: 0 220px;
.checkbox {
cursor: pointer;
width: 112px;
height: 32px;
line-height: 32px;
text-align: center;
font-size: 14px;
color: #ffffff;
background: linear-gradient(180deg, #072853 0%, #0079ff 100%);
border: 1px solid #0084ff;
border-radius: 16px;
display: flex;
align-items: center;
justify-content: center;
opacity: 1;
}
.checked {
opacity: 0.5;
}
.btn-icon {
width: 15px;
height: 16px;
margin-right: 10px;
}
}
</style>

@ -1,403 +0,0 @@
<template>
<div class="map-container">
<div class="container-top">
<div class="next-stand">
<img src="../assets/images/next.png" alt="" />
<span>0</span>
</div>
<div class="real-time">
<img src="../assets/images/realTime.png" alt="" />
<span>{{ mileData.mile ? ileData.mile : 0 }}</span>
</div>
</div>
<mars-map @mapLoad="mapLoad" :options="options"></mars-map>
<div class="video-list">
<grids></grids>
</div>
</div>
</template>
<script>
import MarsMap from "@/components/mars-map";
import grids from "@/components/grids.vue";
import { getCarIdInfo } from "@/api/yunkun/index.js";
import { historyLine, carMidle } from "@/api/yunkun/yunkun.js";
export default {
data() {
const basePathUrl = window.basePathUrl || "";
return {
list: [],
mileData: {
mile: "", //
},
queryParams: {
startTime: undefined,
endTime: undefined,
},
graphicLayer: null,
baseUrl: basePathUrl + "lib/geoJson/tileset.json",
map: null,
options: {
scene: {
center: {
lat: 31.212805,
lng: 120.607156,
alt: 5096.4,
heading: 357.9,
pitch: -31.5,
},
},
terrain: {
show: false,
},
control: {
contextmenu: { preventDefault: false, hasDefault: false },
},
},
carUrl: basePathUrl + "lib/qiche.gltf",
};
},
components: { MarsMap, grids },
beforeDestroy() {},
mounted() {
const { startOfDay, endOfDay } = this.getStartAndEndOfDayFormatted(true);
this.queryParams = {
carId: this.$route.query.carId,
startTime: startOfDay,
endTime: endOfDay,
};
this.getCarMidle();
},
methods: {
mapLoad(map) {
this.map = map;
this.graphicLayer = new mars3d.layer.GraphicLayer();
map.addLayer(this.graphicLayer);
// this.initTilesetLayer();
this.getCarHistoryLine();
},
/**根据车辆的id获取车辆的历史轨迹 */
async getCarHistoryLine() {
let result = await historyLine(this.queryParams);
result.list.map((item) => {
this.list.push([parseFloat(item.lng), parseFloat(item.lat)]);
});
this.historyLine();
this.createCar(result.countData.avg_speed);
},
historyLine() {
const firstPoint = this.list[0];
const divGraphic = new mars3d.graphic.DivGraphic({
position: firstPoint,
style: {
html: `<div class="mars-four-color mars3d-animation">
<div class="four-color_name">起点</div>
</div>`,
horizontalOrigin: Cesium.HorizontalOrigin.CENTER, //
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
distanceDisplayCondition: true,
clampToGround: true,
visibleDepth: true,
},
});
this.graphicLayer.addGraphic(divGraphic);
const graphic = new mars3d.graphic.PolylineEntity({
positions: this.list,
style: {
width: 10,
color: "#00F7AC",
outline: true,
outlineColor: "#008DF8",
outlineWidth: 5,
clampToGround: true,
},
});
this.graphicLayer.addGraphic(graphic);
},
/**获取车辆天里程 */
async getCarMidle() {
const { startOfDay, endOfDay } = this.getStartAndEndOfDayFormatted();
let result = await carMidle({
carId: this.queryParams.carId,
startDate: startOfDay,
endDate: endOfDay,
});
this.mileData.mile = result.mile;
},
getStartAndEndOfDayFormatted(boole) {
const now = new Date();
const startOfDay = new Date(
now.getFullYear(),
now.getMonth(),
now.getDate(),
0,
0,
0
);
const endOfDay = new Date(
now.getFullYear(),
now.getMonth(),
now.getDate(),
23,
59,
59,
999
);
return {
startOfDay: this.formatDate(startOfDay, boole),
endOfDay: this.formatDate(endOfDay, boole),
};
},
formatDate(date, boole) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, "0"); // 01
const day = String(date.getDate()).padStart(2, "0");
const hours = String(date.getHours()).padStart(2, "0");
const minutes = String(date.getMinutes()).padStart(2, "0");
const seconds = String(date.getSeconds()).padStart(2, "0");
if (boole) {
return `${year}${month}${day}${hours}${minutes}${seconds}`;
} else {
return `${year}${month}${day}`;
}
},
/**
* 加载姑苏区三维图层
*/
initTilesetLayer() {
let _this = this;
// ;
let tiles3dLayer = new mars3d.layer.TilesetLayer({
name: "姑苏区建筑物",
url: "https://www.jichuanglanhai.com:88/3dtiles/yunkun/tileset.json",
maximumScreenSpaceError: 16,
maximumMemoryUsage: 1024 / 2,
dynamicScreenSpaceError: false,
skipLevelOfDetail: true,
preferLeaves: true,
flyTo: false,
style: {
color: {
conditions: [["true", `color("rgba(42, 160, 224, 1)")`]],
},
},
});
this.map.addLayer(tiles3dLayer);
tiles3dLayer.on(mars3d.EventType.load, function (event) {
_this.createCar();
});
},
/**
* 生成车辆实时点位
*/
async createCar(avg_speed) {
let _this = this;
const lastPoint = this.list[this.list.length - 1];
// let res = await getCarIdInfo("1328CC51-C858-4FFA-8714-4F354BB49CF8");
const fixedRoute = new mars3d.graphic.FixedRoute({
name: "贴模型表面漫游",
speed: avg_speed, //
positions: [lastPoint],
camera: {
type: "gs",
heading: 90,
radius: 500,
},
model: {
show: true,
url: _this.carUrl,
scale: 0.3,
minimumPixelSize: 55,
silhouette: true,
silhouetteColor: "#fff",
silhouetteSize: 1,
silhouetteAlpha: 0.19,
clampToGround: true,
},
// billboard: {
// image: require("../assets/images/car-active.png"),
// width: 210,
// height: 100,
// horizontalOrigin: Cesium.HorizontalOrigin.CENTER, //
// verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
// distanceDisplayCondition: true,
// clampToGround: true,
// visibleDepth: true,
// label: {
// text: "001线_01__001_E",
// color: "#fff",
// font_size: 13,
// pixelOffsetY: -81,
// pixelOffsetX: 10,
// horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
// distanceDisplayCondition: true,
// visibleDepth: false,
// },
// },
circle: {
radius: 500,
materialType: mars3d.MaterialType.CircleWave,
materialOptions: {
color: "#FAAC51",
count: 2,
speed: 10,
},
clampToTileset: true,
},
// polyline: {
// // lastMaterialType: "LineTrail",
// width: 10,
// // closure: true,
// color: "#00F7AC",
// outline: true,
// outlineColor: "#008DF8",
// outlineWidth: 5,
// clampToGround: true,
// // materialOptions: {
// // color: "#008BFA",
// // materialType: "LineTrail",
// // speed: 0,
// // },
// // materialType: "LineTrail",
// // },
// },
});
this.graphicLayer.addGraphic(fixedRoute);
//
// this.bindPopup(fixedRoute, res.data);
//
// fixedRoute.start();
//
// fixedRoute.openPopup();
// // //
},
bindPopup(fixedRoute, data) {
const userList = data.userList.map((item) => {
return `<div class="popup-item">
<div class="popup-lable">${item.name}</div>
<div class="popup-value">${item.ename}</div>
</div>`;
});
const zbList = data.zbList.map((item) => {
return `<div class="popup-item">
<div class="popup-lable">${item.thingType}</div>
<div class="popup-value">${item.type}</div>
</div>`;
});
let html = `<div class="diy-popup">
<div class="popup-title">001号线_01_早送_守押<br/>
001_苏E12345
</div>
<div class="popup-item">
<div class="popup-lable">线路类型</div>
<div class="popup-value">${data.lineType}</div>
</div>
<div class="sub-title">装备信息</div>
<div class="popup-grid">
${zbList.join("")}
</div>
<div class="sub-title">人员信息</div>
<div class="popup-grid">
${userList.join("")}
</div>
<div class="sub-title">标的物信息</div>
<div class="popup-grid">
<div class="popup-item">
<div class="popup-lable">标的物总数</div>
<div class="popup-value">${data.bdwInfo.count}</div>
</div>
</div>
</div>`;
fixedRoute.bindPopup(html, {
className: "carPopup",
offsetX: 280,
offsetY: 20,
// closeButton: false,
});
},
chkShadows(val) {
let _this = this;
this.map.viewer.shadows = val;
if (val) {
setTimeout(function () {
// 沿
_this.map.scene.shadowMap._lightCamera = _this.map.scene.camera;
}, 1500);
}
},
},
};
</script>
<style lang="scss" scoped>
.container-top {
position: fixed;
top: 100px;
left: 50%;
transform: translateX(-50%);
z-index: 100;
display: flex;
align-items: center;
justify-content: center;
.next-stand {
margin-right: 40px;
}
& > div {
width: 200px;
img {
height: 38px;
width: 100%;
display: block;
margin-bottom: 10px;
}
span {
display: block;
font-size: 40px;
color: #ffffff;
line-height: 51px;
letter-spacing: 1px;
text-align: center;
font-style: normal;
background: linear-gradient(270deg, #00e5ff 0%, #d8d8d8 100%);
/* 将背景限制在文字区域内 */
-webkit-background-clip: text;
background-clip: text;
/* 设置文字颜色,会被背景图像遮住 */
color: transparent;
font-family: "DIN-Regular-2";
}
}
}
.video-list {
position: absolute;
bottom: 25px;
left: 50%;
transform: translateX(-50%);
z-index: 100;
padding: 10px;
display: flex;
align-items: center;
border: 1px solid #415367;
border-radius: 10px;
background: rgba(28, 31, 34, 0.6);
}
</style>
Loading…
Cancel
Save