预警一条数据卡顿问题O4默认入侵
This commit is contained in:
parent
999ac04b25
commit
d4d7b467ae
|
|
@ -1,3 +1,3 @@
|
|||
NODE_ENV = 'development'
|
||||
VUE_APP_API_URL = 'http://114.66.57.139:5002'
|
||||
VUE_APP_API_URL = 'http://114.66.57.139:8088'
|
||||
VUE_APP_MESSAGE_SDK_DEBUG = true
|
||||
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
<script>
|
||||
"use script";
|
||||
import moment from "moment";
|
||||
export default {
|
||||
name: "myMars",
|
||||
props: {
|
||||
|
|
@ -98,6 +99,18 @@ export default {
|
|||
}, 100);
|
||||
},
|
||||
onProcessTraceability(mapList) {
|
||||
let newMapList = (mapList = mapList.filter(
|
||||
(item) => Number(item.lon) !== 0 && Number(item.lat) !== 0
|
||||
));
|
||||
console.log(newMapList, "newMapList");
|
||||
if (newMapList.length === 0) {
|
||||
this.clearDraw();
|
||||
this.$message({
|
||||
message: "暂无数据",
|
||||
type: "warning"
|
||||
});
|
||||
return;
|
||||
}
|
||||
// eslint-disable-next-line no-undef
|
||||
const property = new Cesium.SampledPositionProperty();
|
||||
// eslint-disable-next-line no-undef
|
||||
|
|
@ -109,43 +122,56 @@ export default {
|
|||
|
||||
let start;
|
||||
let stop;
|
||||
|
||||
// 如果数据只有一条,复制并调整时间
|
||||
if (newMapList.length === 1) {
|
||||
const firstItem = newMapList[0];
|
||||
const secondItem = { ...firstItem };
|
||||
|
||||
// 增加1秒到 createTime
|
||||
const firstTime = moment(firstItem.createTime); // 使用 moment.js 来处理时间
|
||||
secondItem.createTime = firstTime
|
||||
.add(1, "seconds")
|
||||
.format("YYYY-MM-DD HH:mm:ss");
|
||||
|
||||
newMapList.push(secondItem); // 将新的第二条数据加入到列表
|
||||
}
|
||||
|
||||
for (let i = 0, len = mapList.length; i < len; i++) {
|
||||
const item = mapList[i];
|
||||
const lng = Number(item.lon); // 经度
|
||||
const lat = Number(item.lat); // 纬度
|
||||
|
||||
const app_lng = Number(item.app_lon); // 经度
|
||||
const app_lat = Number(item.app_lat); // 纬度
|
||||
const height = item.alt || 5; // 高度5 是避免与geojson高度冲突
|
||||
const height = item.alt || 5; // 高度5 是避免与 geojson 高度冲突
|
||||
const outputDate = item.createTime.replace(" ", "T");
|
||||
|
||||
const time = outputDate; // 时间
|
||||
let position = null;
|
||||
let app_position = null;
|
||||
if (lng !== 0 && lat !== 0) {
|
||||
if (lng && lat) {
|
||||
// eslint-disable-next-line no-undef
|
||||
position = Cesium.Cartesian3.fromDegrees(lng, lat, height);
|
||||
app_position = Cesium.Cartesian3.fromDegrees(app_lng, app_lat, 0);
|
||||
}
|
||||
let juliaDate = null;
|
||||
if (time) {
|
||||
// eslint-disable-next-line no-undef
|
||||
juliaDate = Cesium.JulianDate.fromIso8601(time);
|
||||
}
|
||||
if (position && juliaDate) {
|
||||
property.addSample(juliaDate, position);
|
||||
}
|
||||
if (app_position && juliaDate) {
|
||||
app_property.addSample(juliaDate, app_position);
|
||||
}
|
||||
if (lng && lat) {
|
||||
// eslint-disable-next-line no-undef
|
||||
position = Cesium.Cartesian3.fromDegrees(lng, lat, height);
|
||||
app_position = Cesium.Cartesian3.fromDegrees(app_lng, app_lat, 0);
|
||||
}
|
||||
|
||||
if (i === 0) {
|
||||
start = juliaDate;
|
||||
} else if (i === len - 1) {
|
||||
stop = juliaDate;
|
||||
}
|
||||
} else {
|
||||
console.log("经纬度为0,忽略该数据");
|
||||
let juliaDate = null;
|
||||
if (time) {
|
||||
// eslint-disable-next-line no-undef
|
||||
juliaDate = Cesium.JulianDate.fromIso8601(time);
|
||||
}
|
||||
if (position && juliaDate) {
|
||||
property.addSample(juliaDate, position);
|
||||
}
|
||||
if (app_position && juliaDate) {
|
||||
app_property.addSample(juliaDate, app_position);
|
||||
}
|
||||
|
||||
if (i === 0) {
|
||||
start = juliaDate;
|
||||
} else if (i === len - 1) {
|
||||
stop = juliaDate;
|
||||
}
|
||||
}
|
||||
// 设置时钟属性
|
||||
|
|
@ -170,6 +196,7 @@ export default {
|
|||
// });
|
||||
this.clearDraw();
|
||||
// 创建无人机对象
|
||||
console.log(property, "property");
|
||||
let pathEntity = this.graphicLayer.getGraphicById("pathIdsss");
|
||||
if (!pathEntity) {
|
||||
pathEntity = new mars3d.graphic.ModelEntity({
|
||||
|
|
|
|||
|
|
@ -236,8 +236,14 @@ export default {
|
|||
alarmList(params).then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.tableData = res.data.items.map((item) => {
|
||||
const { isWhitelist, duration, frequency, alarmLevel, ...rest } =
|
||||
item;
|
||||
const {
|
||||
isWhitelist,
|
||||
duration,
|
||||
frequency,
|
||||
model,
|
||||
alarmLevel,
|
||||
...rest
|
||||
} = JSON.parse(JSON.stringify(item));
|
||||
|
||||
let flyStatus = "";
|
||||
if (isWhitelist) {
|
||||
|
|
@ -245,8 +251,12 @@ export default {
|
|||
} else {
|
||||
flyStatus = alarmLevel === 0 ? "防区外" : "入侵";
|
||||
}
|
||||
if (model === "O4") {
|
||||
flyStatus = "入侵";
|
||||
}
|
||||
return {
|
||||
...rest,
|
||||
model: model,
|
||||
isattacked: item.isattacked ? "是" : "否", // 保留你原本的逻辑
|
||||
duration: String(item.duration),
|
||||
frequency: String(item.frequency),
|
||||
|
|
|
|||
Loading…
Reference in New Issue