接口对接完

main
许宏杰 15 hours ago
parent d1c75bf9e9
commit 8c00aab826

@ -5,4 +5,6 @@ VUE_APP_TITLE = 云坤地图
ENV = 'production'
# 云坤地图/生产环境
VUE_APP_BASE_API = 'http://39.101.188.84:9066'
VUE_APP_BASE_API = 'http://192.168.0.77:9066'
VUE_APP_BASE_API2 = 'http://192.168.0.77/map'
VUE_APP_BASE_API_YUNKUN = 'http://192.168.0.91/gps-web/api'

@ -1,5 +1,5 @@
import request from "@/utils/request-yunkun.js";
const sessionId = localStorage.getItem("SESSION_ID");
// 登录
export function lgoin(query) {
return request({
@ -12,7 +12,7 @@ export function lgoin(query) {
// 查询车辆明细列表
export function getCarList(query) {
query.sessionId = sessionId;
query.sessionId = localStorage.getItem("SESSION_ID");
return request({
url: "/get_car_list.jsp",
method: "GET",
@ -23,7 +23,7 @@ export function getCarList(query) {
//车辆点位查询
export function getCarPoint(query) {
query.sessionId = localStorage.getItem("SESSION_ID"); //无感获取sessionID是异步的与setInterval使用防止没有取到或者不是最新的
query.sessionId = localStorage.getItem("SESSION_ID");
return request({
url: "/get_gps_r.jsp",
method: "GET",
@ -33,7 +33,7 @@ export function getCarPoint(query) {
// 车辆实时定位查询(根据车牌号)
export function getCarByCarplate(query) {
query.sessionId = sessionId;
query.sessionId = localStorage.getItem("SESSION_ID");
return request({
url: "/get_gps_r_plate.jsp",
method: "GET",
@ -43,7 +43,7 @@ export function getCarByCarplate(query) {
// 查看车辆历史轨迹
export function historyLine(query) {
query.sessionId = sessionId;
query.sessionId = localStorage.getItem("SESSION_ID");
return request({
url: "/get_gps_h.jsp",
method: "GET",
@ -53,7 +53,7 @@ export function historyLine(query) {
// 按天查询车辆里程
export function carMidle(query) {
query.sessionId = sessionId;
query.sessionId = localStorage.getItem("SESSION_ID");
return request({
url: "get_gps_mile_day.jsp",
method: "GET",

@ -157,8 +157,23 @@
width: 260px;
background: url("../images/diy-popup.png");
background-size: 100% 100%;
padding: 20px 25px;
// overflow-y: auto;
padding: 15px 12px 14px 23px;
& > div {
height: 100%;
width: 100%;
overflow-y: auto;
}
::-webkit-scrollbar {
width: 3px; /* 滚动条宽度 */
}
::-webkit-scrollbar-track {
background: transparent; /* 滚动条轨道背景 */
}
::-webkit-scrollbar-thumb {
background: #032b57; /* 滚动条颜色 */
}
.pointer {
position: absolute;
left: -145px;

@ -145,7 +145,7 @@ export default {
handleTimeUpdate(event, index) {
const currentTime = event.target.currentTime;
// == 300
if (currentTime >= 15) {
if (currentTime >= 300) {
this.toclose(index);
if (index == "0521") {
this.dialogSate = false;

@ -113,7 +113,7 @@ service.interceptors.response.use(
noToke = res.data.rspDesc.includes("登录会话");
}
// console.log(res.data.rspCode);
if (res.data.rspCode == 0 && !isRefreshRequest(res.config)) {
if (res.data.rspCode == 0 && noToke && !isRefreshRequest(res.config)) {
const isSucceed = await refreshToken();
if (isSucceed) {
//重新给接口中的sessionId赋值

@ -56,12 +56,12 @@
import MarsMap from "@/components/mars-map";
import { getfindByPlateNums } from "@/api/yunkun/index.js";
import { getCarPoint, getCarByCarplate } from "@/api/yunkun/yunkun.js";
import { adjustCanvasSize, changeBorderColor } from "@/utils/carCanvas.js";
export default {
data() {
const basePathUrl = window.basePathUrl || "";
return {
timer: null,
searchList: [],
searchText: "",
searchQuery: {
@ -104,6 +104,9 @@ export default {
control: {
contextmenu: { preventDefault: false, hasDefault: false },
},
terrain: {
show: false,
},
basemaps: [
{
name: "影像地图",
@ -172,6 +175,7 @@ export default {
...{
missionName: missionItem[0].name,
missionType: missionType,
missionId: missionItem[0].id,
},
};
} else {
@ -180,6 +184,7 @@ export default {
...{
missionName: "未识别",
missionType: 1,
missionId: null,
},
};
}
@ -228,7 +233,7 @@ export default {
this.map.addLayer(this.mapLayer.car);
this.createCar();
},
/**创建车辆 */
/**创建车辆 苏E17360*/
async createCar(type) {
this.list = await this.carPoint(true);
@ -246,7 +251,7 @@ export default {
style: {
url: this.carUrl,
scale: 0.5,
minimumPixelSize: 35,
minimumPixelSize: 32,
silhouette: true,
silhouetteColor: "#008cff",
pitch: 0, //
@ -269,10 +274,12 @@ export default {
},
attr: {
index: item.carId,
missionId: item.missionId,
missionName: item.missionName,
missionType: item.missionType,
},
});
console.log(item.missionType, "类型");
this.mapLayer.car.addGraphic(graphic);
this.mapLayer.car.enabledEvent = true; //
graphic.bindPopup(
@ -294,7 +301,6 @@ export default {
);
graphic.openPopup();
graphic.on(mars3d.EventType.highlightOpen, (e) => {
console.log(e.target.attr, "ssss");
e.target.setOptions({
//
circle: {
@ -329,19 +335,28 @@ export default {
});
graphic.on(mars3d.EventType.click, (e) => {
const attr = e.target.attr;
if (!attr.missionId) {
this.$modal.msgError("该车辆暂无任务!");
return;
}
this.$router.push({
path: "/carInfo",
query: { carId: e.target.attr.index },
query: {
carId: e.target.attr.index,
missionId: attr.missionId,
missionName: item.missionName,
},
});
});
}
// setInterval
this.changePosition(0);
// const interval = 15;
// this.changePosition(interval);
// this.time = setInterval(() => {
// this.changePosition(interval);
// }, interval * 1000);
const interval = 10;
this.changePosition(interval);
this.time = setInterval(() => {
this.changePosition(interval);
}, interval * 1000);
},
async changePosition(interval) {
@ -372,11 +387,18 @@ export default {
},
/**根据车牌号查询车辆实时定位 */
async handleSearch() {
if (!this.searchQuery.carPlate) return;
if (!this.searchQuery.carPlate) {
this.inputClear();
return;
}
//
if (this.timer) clearInterval(this.timer);
const result = await getCarByCarplate(this.searchQuery);
if (result.list) {
if (result.list[0].stateCn.includes("离线")) {
this.$modal.msgError(`该车${result.list[0].stateCn}!`);
return;
}
this.searchList = result.list;
} else {
this.searchText = result.rspDesc;
@ -398,7 +420,6 @@ export default {
* 清除操作
*/
inputClear() {
if (!this.searchQuery.carPlate) return;
if (this.timer) clearInterval(this.timer);
this.searchList = [];
this.searchText = "";
@ -429,27 +450,32 @@ export default {
this.selectedItems.push(item);
}
if (this.selectedItems.length > 0) {
this.selectedItems.forEach((item) => {
let type = item == "营运线路" ? 1 : item == "维护线路" ? 2 : 3;
if (this.selectedItems.length == 0) {
this.mapLayer.car.eachGraphic((graphic) => {
if (graphic.attr.missionType == type) {
graphic.show = false;
graphic.closePopup();
} else {
if (graphic.show) return;
graphic.show = true;
graphic.openPopup();
}
});
});
} else {
return;
}
this.mapLayer.car.eachGraphic((graphic) => {
let missionTetx =
graphic.attr.missionType == 1
? "营运线路"
: graphic.attr.missionType == 2
? "维护线路"
: "临时任务";
if (this.selectedItems.includes(missionTetx)) {
if (!graphic.show) return;
graphic.show = false;
graphic.closePopup();
} else {
if (graphic.show) return;
graphic.show = true;
graphic.openPopup();
});
}
});
},
isSelected(item) {
//

@ -47,6 +47,9 @@ export default {
pitch: -31.5,
},
},
terrain: {
show: false,
},
control: {
contextmenu: { preventDefault: false, hasDefault: false },
},

@ -7,7 +7,7 @@
</div>
<div class="real-time">
<img src="../assets/images/realTime.png" alt="" />
<span>{{ mileData.mile ? ileData.mile : 0 }}</span>
<span>{{ mileData.mile }}</span>
</div>
</div>
<div class="albuginea backBtn" @click="initTilesetLayer()">
@ -18,7 +18,7 @@
</div>
<mars-map @mapLoad="mapLoad" :options="options"></mars-map>
<div class="video-list">
<!-- <grids></grids> -->
<grids></grids>
</div>
</div>
</template>
@ -26,16 +26,15 @@
<script>
import MarsMap from "@/components/mars-map";
import grids from "@/components/grids.vue";
import { getfindByPlateNum } from "@/api/yunkun/index.js";
import { getCarIdInfo } from "@/api/yunkun/index.js";
import { historyLine, carMidle, getCarPoint } from "@/api/yunkun/yunkun.js";
import { historyLine, getCarPoint, carMidle } from "@/api/yunkun/yunkun.js";
export default {
data() {
const basePathUrl = window.basePathUrl || "";
return {
missionId: null, //id
missionData: {}, //id
mileData: {
mile: "", //
mile: 0, //
},
queryParams: {
startTime: undefined,
@ -83,6 +82,7 @@ export default {
},
Line: [],
carUrl: basePathUrl + "static/qiche.gltf",
timer: null,
};
},
components: { MarsMap, grids },
@ -92,16 +92,30 @@ export default {
this.mapLayer.car = null;
},
created() {
this.missionId = this.$route.query.missionId;
this.missionData = {
missionId: this.$route.query.missionId,
missionName: this.$route.query.missionName,
};
const { startOfDay, endOfDay } = this.getStartAndEndOfDayFormatted(true);
this.queryParams = {
carId: this.$route.query.carId,
startTime: startOfDay,
endTime: endOfDay,
};
this.getCarMidle();
},
methods: {
/**获取车辆天里程 */
async getCarMidle() {
const { startOfDay, endOfDay } = this.getStartAndEndOfDayFormatted();
let result = await carMidle({
carId: this.queryParams.carId,
startDate: startOfDay,
endDate: endOfDay,
});
this.mileData.mile = result.mile;
},
/**地图渲染完毕 */
mapLoad(map) {
map.set;
@ -192,11 +206,11 @@ export default {
id: this.queryParams.carId,
name: "漫游对象",
// positions: [[parseFloat(lastPoint.lng), parseFloat(lastPoint.lat)]],
// camera: {
// type: "gs",
// heading: 0,
// radius: 3000,
// },
camera: {
type: "gs",
heading: 0,
radius: 3000,
},
model: {
show: true,
url: this.carUrl,
@ -206,6 +220,7 @@ export default {
silhouetteColor: "#FFB200",
pitch: 0,
roll: 0,
clampToGround: true,
// heading: parseFloat(lastPoint.drct),
},
circle: {
@ -227,16 +242,17 @@ export default {
},
});
this.mapLayer.car.addGraphic(car);
// let res = await getCarIdInfo("4289f2c2ea0d4d7cb5853e6d4095918d");
// this.bindPopup(car, res.data);
// car.openPopup();
// car.start();
let res = await getCarIdInfo(this.missionData.missionId);
console.log(this.missionData);
this.bindPopup(car, res.data);
car.openPopup();
car.start();
const interval = 15;
this.changePosition(interval);
// this.time = setInterval(() => {
// this.changePosition(interval);
// }, interval * 1000);
this.timer = setInterval(() => {
this.changePosition(interval);
}, interval * 1000);
},
async changePosition(interval) {
let list = await this.carPoint();
@ -246,6 +262,7 @@ export default {
//StyleOptions({
// heading:parseFloat(list[0].drct)
// })
this.mileData.mile = list[0].preMile;
let position = Cesium.Cartesian3.fromDegrees(
parseFloat(list[0].lng),
parseFloat(list[0].lat),
@ -278,9 +295,10 @@ export default {
});
let html = `<div class="diy-popup">
<div>
<div class="pointer"></div>
<div class="popup-title">001号线_01_早送_守押<br/>
001_苏E12345
<div class="popup-title">${this.missionData.missionName}<br/>
</div>
<div class="popup-item">
<div class="popup-lable">线路类型</div>
@ -301,6 +319,7 @@ export default {
<div class="popup-value">${data.bdwInfo.count}</div>
</div>
</div>
</div>
</div>`;
fixedRoute.bindPopup(html, {

@ -41,7 +41,9 @@ export default {
control: {
contextmenu: { preventDefault: false, hasDefault: false },
},
terrain: {
show: false,
},
basemaps: [
{
name: "影像地图",

@ -1,390 +0,0 @@
<template>
<div class="map-container">
<div class="extend-box">
<div class="sub-title"></div>
<div class="data-total">{{ total }}</div>
</div>
<mars-map @mapLoad="mapLoad" :options="options"></mars-map>
</div>
</template>
<script>
import point1 from "@/assets/images/levelcity.png";
import point2 from "@/assets/images/province.png";
import linePoint1 from "@/assets/images/linePoint1.png";
import linePoint2 from "@/assets/images/linePoint2.png";
import MarsMap from "@/components/mars-map";
// import province from "@/assets/images/province.png";
import { getProvince } from "@/api/yunkun/index.js";
export default {
data() {
const basePathUrl = window.basePathUrl || "";
return {
cityAttr: {},
total: 0,
options: {
scene: {
center: {
lat: -9.65789,
lng: 110.718514,
alt: 13807610.5,
heading: 351.3,
pitch: -73,
},
showSun: false,
showMoon: false,
showSkyBox: false,
showSkyAtmosphere: false,
fog: false,
sceneMode: 1,
backgroundColor: "rgba(0,0,0,0)",
backgroundImage: `url(${require("../assets/images/big_bg.png")})`,
orderIndependentTranslucency: false,
contextOptions: { webgl: { antialias: mars3d.Util.isPCBroswer() } },
globe: {
show: false, //
showGroundAtmosphere: false,
enableLighting: 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,
},
],
},
map: null,
mapLayer: {},
chinaUrl: basePathUrl + "lib/geoJson/json/china.json",
};
},
methods: {
mapLoad(map) {
this.map = map;
map.setSceneOptions({
cameraController: {
// enableZoom: false,
// enableTranslate: false,
// enableRotate: false,
// enableTilt: false,
},
});
this.mapLayer.china = new mars3d.layer.GraphicLayer({
zIndex: 10,
});
map.addLayer(this.mapLayer.china);
//
this.initChina();
},
initChina() {
mars3d.Util.fetchJson({ url: this.chinaUrl }).then((res) => {
const arr = mars3d.Util.geoJsonToGraphics(res);
arr.map((item, index) => {
this.cityAttr[item.attr.name] = item.attr;
const polygonEntity = new mars3d.graphic.PolygonEntity({
positions: item.positions,
style: {
fill: true,
lastMaterialType: "Image",
materialOptions: {
materialType: "Image",
image: require("../assets/images/map-bg.jpg"),
opacity: 1,
repeat_x: 1,
repeat_y: 1,
transparent: false,
},
materialType: "Image",
opacity: 1,
outline: true,
outlineWidth: 1.5,
outlineColor: "#00BEFF",
setHeight: 1000000,
},
});
const wall = new mars3d.graphic.WallPrimitive({
positions: item.positions,
style: {
setHeight: -20000,
diffHeight: 1000000, //
width: 15,
materialType: mars3d.MaterialType.Image2,
materialOptions: {
image: require("../assets/images/fence-top.png"),
color: "#0064F8",
},
},
});
this.mapLayer.china.addGraphic(polygonEntity);
this.mapLayer.china.addGraphic(wall);
});
this.createEchartsLayer();
});
},
async createEchartsLayer() {
const options = await this.getEchartsOption();
const echartsLayer = new mars3d.layer.EchartsLayer(options);
this.map.addLayer(echartsLayer);
//
window.addEventListener("resize", function () {
echartsLayer.resize();
});
},
async getEchartsOption() {
let res = await getProvince();
this.total = res.data.length;
const items = res.data.map((item, index) => {
if (index == 0) {
item = {
level: 1,
name: item.city,
label: item.city,
value: this.cityAttr[item.city].center,
symbol: "",
symbolSize: [65, 65],
};
} else {
item = {
level: 2,
symbol: "",
name: item.city,
label: item.city,
category: 0,
active: true,
speed: 6,
value: this.cityAttr[item.city].center,
belong: res.data[0].city,
symbolSize: [40, 40],
};
}
return item;
});
// const items = [
// {
// level: 1,
// name: "",
// label: "jiangsu",
// value: [118.767413, 32.041544],
// symbol: "",
// symbolSize: [30, 30],
// },
// {
// level: 2,
// symbol: "",
// name: "",
// label: "anhui",
// category: 0,
// active: true,
// speed: 6,
// value: [117.283042, 31.86119],
// belong: "",
// },
// {
// level: 2,
// symbol: "",
// name: "",
// category: 0,
// active: true,
// speed: 6,
// value: [120.153576, 30.287459],
// belong: "",
// },
// {
// level: 2,
// symbol: "",
// name: "",
// category: 0,
// active: true,
// speed: 6,
// value: [102.712251, 25.040609],
// belong: "",
// },
// {
// level: 2,
// symbol: "",
// name: "",
// category: 0,
// active: true,
// speed: 6,
// value: [101.778916, 36.623178],
// belong: "",
// },
// {
// level: 2,
// symbol: "",
// name: "",
// category: 0,
// active: true,
// speed: 6,
// value: [111.670801, 40.818311],
// belong: "",
// },
// ];
const lineColor = ["#fff", "#7BF7AD", "#00fcff"];
//
const symbolList = ["image://" + point1, "image://" + point2];
// 线
const pointSymbol = ["image://" + linePoint1, "image://" + linePoint2];
// level = 1
items.forEach((el) => {
el.symbol = symbolList[el.level - 1];
});
const dataArr = [[], [], []];
items.forEach((el) => {
if (el.belong) {
items.forEach((element) => {
if (el.belong === element.name) {
console.log(dataArr[el.level - 1]);
dataArr[el.level - 1].push([
{
coord: element.value,
},
{
coord: el.value,
},
]);
}
});
}
});
const seriesOne = [
{
type: "effectScatter",
layout: "none",
showEffectOn: "emphasis",
// coordinateSystem: "cartesian2d",
coordinateSystem: "mars3dMap",
symbolSize: [20, 20],
symbolOffset: [0, -10],
zlevel: 3,
circular: {
rotateLabel: true,
},
label: {
normal: {
show: true,
position: "bottom",
formatter: function (e) {
return e.data.level == 1 ? "" : e.name;
},
fontSize: 12,
color: "#fff",
textBorderColor: "#2aa4e8",
offset: [0, 0],
},
},
itemStyle: {
normal: {
shadowColor: "none",
},
},
data: items,
},
];
//线
const lineSeries = [];
dataArr.forEach((el, index) => {
lineSeries.push({
name: "",
type: "lines",
// coordinateSystem: "cartesian2d",
coordinateSystem: "mars3dMap",
zlevel: 1,
effect: {
show: true,
smooth: false,
trailLength: 0,
symbol: pointSymbol[index],
symbolSize: [10, 30],
period: 4,
},
lineStyle: {
width: 2,
color: lineColor[index],
curveness: -0.2,
},
data: el,
});
});
const seriesData = seriesOne.concat(lineSeries);
const option = {
animation: false,
// backgroundColor: '#000',
fixedHeight: 900009,
series: seriesData,
};
return option;
},
},
components: {
MarsMap,
},
};
</script>
<style lang="scss" scoped>
.extend-box {
position: absolute;
left: 50%;
top: 103px;
z-index: 60;
transform: translateX(-50%);
display: flex;
flex-direction: column;
align-items: center;
.sub-title {
width: 200px;
height: 38px;
background: url("../assets/images/extend.png");
background-size: 100% 100%;
margin-bottom: 8px;
}
.data-total {
font-size: 40px;
color: #ffffff;
letter-spacing: 1px;
text-align: center;
font-weight: bold;
background-image: linear-gradient(0deg, #00e5ff 0%, #d8d8d8 100%);
-webkit-background-clip: text; /* 使用-webkit-前缀兼容WebKit内核浏览器 */
background-clip: text;
color: transparent;
}
}
</style>

@ -18,7 +18,8 @@ module.exports = {
// 部署生产环境和开发环境下的URL。
// 默认情况下Vue CLI 会假设你的应用是被部署在一个域名的根路径上
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
publicPath: process.env.NODE_ENV === "production" ? "/demo/yunkunPc" : "/",
// publicPath: process.env.NODE_ENV === "production" ? "/demo/yunkunPc" : "/",
publicPath: process.env.NODE_ENV === "production" ? "/yunkunPc" : "/",
// 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和 baseUrl 的生产环境路径一致默认dist
outputDir: "dist",
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
@ -33,6 +34,12 @@ module.exports = {
port: port,
open: true,
proxy: {
"/map": {
target: `http://192.168.0.77/map`,
pathRewrite: {
"^/map": "",
},
},
// detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: {
target: `http://192.168.0.77:9066`,
@ -41,13 +48,6 @@ module.exports = {
["^" + process.env.VUE_APP_BASE_API]: "",
},
},
"/map": {
target: `http://192.168.0.77/map`,
pathRewrite: {
"^/map": "",
},
},
},
disableHostCheck: true,
},

Loading…
Cancel
Save