已经成功集成百度鹰眼服务

This commit is contained in:
xuqiuyun
2025-11-24 16:10:39 +08:00
parent 0f963bf535
commit f45a57fad6
6 changed files with 1017 additions and 551 deletions

View File

@@ -377,7 +377,47 @@
</el-descriptions>
</div>
<div v-if="stayPoints.length > 0" class="staypoint-section">
<div v-if="latestPoint" class="latest-point-panel">
<h4>最新定位</h4>
<el-descriptions :column="3" border>
<el-descriptions-item label="定位时间">
{{ formatTimestamp(latestPoint.locTime) }}
</el-descriptions-item>
<el-descriptions-item label="纬度">
{{ latestPoint.lat }}
</el-descriptions-item>
<el-descriptions-item label="经度">
{{ latestPoint.lng }}
</el-descriptions-item>
<el-descriptions-item label="速度(米/秒)">
{{ latestPoint.speed ?? '--' }}
</el-descriptions-item>
<el-descriptions-item label="航向角">
{{ latestPoint.direction ?? '--' }}
</el-descriptions-item>
</el-descriptions>
</div>
<div v-if="segmentStats && segmentStats.length > 0" class="segment-stats">
<h4>轨迹查询分段{{ segmentStats.length }}</h4>
<el-table :data="segmentStats" border size="small" max-height="220">
<el-table-column label="段次" width="80" prop="index" />
<el-table-column label="开始时间" min-width="160">
<template #default="scope">
{{ formatTimestamp(scope.row.startTime) }}
</template>
</el-table-column>
<el-table-column label="结束时间" min-width="160">
<template #default="scope">
{{ formatTimestamp(scope.row.endTime) }}
</template>
</el-table-column>
<el-table-column label="轨迹点数" width="120" prop="trackCount" />
<el-table-column label="停留点数" width="120" prop="stayCount" />
</el-table>
</div>
<div v-if="stayPoints && stayPoints.length > 0" class="staypoint-section">
<h4>停留点分析15分钟</h4>
<el-table :data="stayPoints" border style="width: 100%;" size="small">
<el-table-column label="开始时间" min-width="160">
@@ -468,6 +508,8 @@ const playTimer = ref(null); // 播放定时器
const currentPlayIndex = ref(0); // 当前播放到的轨迹点索引
const trackBMapGL = ref(null); // 保存 BMapGL 实例,避免重复加载
const stayPoints = ref([]); // 停留点列表
const latestPoint = ref(null); // 最新轨迹点
const segmentStats = ref([]);
const yingyanMeta = reactive({
entityName: '',
startTime: null,
@@ -491,6 +533,11 @@ const isLocationWarning = computed(() => {
return isLocWarning;
});
const isStaticTrack = computed(() => {
const status = Number(warningData.status || 0);
return status >= 3;
});
const dialogTitle = computed(() => {
return `${warningData.warningTypeDesc || '预警'}详情`;
});
@@ -816,6 +863,25 @@ const formatDuration = (seconds) => {
return parts.join('') || `${sec}`;
};
function parseLatestPoint(point) {
if (!point) {
return null;
}
const lng = parseFloat(point.longitude ?? point.lng ?? 0);
const lat = parseFloat(point.latitude ?? point.lat ?? 0);
if (Number.isNaN(lng) || Number.isNaN(lat) || (lng === 0 && lat === 0)) {
return null;
}
return {
lng,
lat,
locTime: point.locTime ?? point.loc_time ?? null,
speed: point.speed ?? null,
direction: point.direction ?? null,
};
}
// 关闭对话框
const handleClose = () => {
// 清理地图实例
@@ -850,11 +916,17 @@ const handleTrackClick = async () => {
ElMessage.warning('运单ID不存在无法查看轨迹');
return;
}
console.info('[TRACK] 开始轨迹定位流程', {
deliveryId: warningData.deliveryId,
status: warningData.status,
estimatedDepartureTime: warningData.estimatedDepartureTime,
});
trackDialogVisible.value = true;
trackLoading.value = true;
trackMapShow.value = false;
trackPath.value = [];
latestPoint.value = null;
isPlaying.value = false;
currentPlayIndex.value = 0;
@@ -913,6 +985,8 @@ const getDeliveryStatus = async () => {
const loadYingyanTrack = async () => {
stayPoints.value = [];
trackPath.value = [];
latestPoint.value = null;
segmentStats.value = [];
trackMapShow.value = false;
yingyanMeta.entityName = '';
yingyanMeta.startTime = null;
@@ -925,7 +999,10 @@ const loadYingyanTrack = async () => {
try {
const res = await getYingyanTrack({ deliveryId: warningData.deliveryId });
console.info('[TRACK] 后端轨迹接口响应', res);
if (res.code === 200 && res.data) {
segmentStats.value = Array.isArray(res.data.segmentStats) ? res.data.segmentStats : [];
console.info('[TRACK] 分段统计', segmentStats.value);
const rawPoints = Array.isArray(res.data.trackPoints) ? res.data.trackPoints : [];
trackPath.value = rawPoints
.map(item => {
@@ -946,9 +1023,18 @@ const loadYingyanTrack = async () => {
yingyanMeta.entityName = res.data.entityName || '';
yingyanMeta.startTime = res.data.startTime || null;
yingyanMeta.endTime = res.data.endTime || null;
latestPoint.value = parseLatestPoint(res.data.latestPoint);
console.info('[TRACK] 轨迹点数量', trackPath.value.length);
if (trackPath.value.length > 0) {
trackMapShow.value = true;
} else if (latestPoint.value) {
trackPath.value.push({
lng: latestPoint.value.lng,
lat: latestPoint.value.lat,
locTime: latestPoint.value.locTime || null,
});
trackMapShow.value = true;
} else {
ElMessage.warning('暂无有效轨迹点');
}
@@ -1340,6 +1426,28 @@ defineExpose({
margin-top: 20px;
}
.latest-point-panel {
margin-top: 20px;
h4 {
margin: 0 0 10px 0;
font-size: 15px;
font-weight: 600;
color: #303133;
}
}
.segment-stats {
margin-top: 20px;
h4 {
margin: 0 0 10px 0;
font-size: 15px;
font-weight: 600;
color: #303133;
}
}
.staypoint-section {
margin-top: 20px;

File diff suppressed because it is too large Load Diff