基本完成v1.0
This commit is contained in:
@@ -638,8 +638,7 @@ const collarLogForm = reactive({
|
||||
});
|
||||
// 查详情
|
||||
const getDetail = () => {
|
||||
console.log('查询运单详情, deliveryId:', route.query.id);
|
||||
|
||||
|
||||
if (!route.query.id) {
|
||||
console.warn('=== 警告:deliveryId为空,跳过运单详情查询');
|
||||
return;
|
||||
@@ -647,19 +646,12 @@ const getDetail = () => {
|
||||
|
||||
waybillDetail(route.query.id)
|
||||
.then((res) => {
|
||||
console.log('运单详情返回结果:', res);
|
||||
|
||||
if (res.code === 200) {
|
||||
data.baseInfo = res.data.delivery ? res.data.delivery : {};
|
||||
data.warnInfo = res.data.warningLog ? res.data.warningLog : {};
|
||||
data.serverIds = res.data.serverIds ? res.data.serverIds : [];
|
||||
console.log('基础信息:', {
|
||||
driverName: data.baseInfo.driverName,
|
||||
licensePlate: data.baseInfo.licensePlate,
|
||||
carFrontPhoto: data.baseInfo.carFrontPhoto,
|
||||
carBehindPhoto: data.baseInfo.carBehindPhoto,
|
||||
driverId: data.baseInfo.driverId
|
||||
});
|
||||
|
||||
|
||||
// 查询车辆照片
|
||||
if (data.baseInfo.licensePlate) {
|
||||
loadVehiclePhotos();
|
||||
@@ -678,10 +670,7 @@ const getDetail = () => {
|
||||
const loadVehiclePhotos = () => {
|
||||
// 后端已经从delivery/driver信息中获取了车身照片,无需额外前端查询
|
||||
// carFrontPhoto和carBehindPhoto应该已经由后端的DeliveryServiceImpl填充
|
||||
console.log('车身照片信息:', {
|
||||
carFrontPhoto: data.baseInfo.carFrontPhoto,
|
||||
carBehindPhoto: data.baseInfo.carBehindPhoto
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
// 智能主机列表查询
|
||||
@@ -700,10 +689,10 @@ const getHostList = () => {
|
||||
deviceType: 1, // 智能主机设备类型
|
||||
})
|
||||
.then((res) => {
|
||||
console.log('=== 主机设备API返回结果:', res);
|
||||
|
||||
data.hostDataListLoading = false;
|
||||
if (res.code === 200) {
|
||||
console.log('=== 主机设备数据:', res.data);
|
||||
|
||||
// 新API返回的是数组格式,过滤出智能主机设备
|
||||
const hostDevices = res.data.filter(device => device.deviceType === 1 || device.deviceType === '1');
|
||||
data.hostRows = hostDevices || [];
|
||||
@@ -712,13 +701,12 @@ const getHostList = () => {
|
||||
if (hostDevices.length > 0) {
|
||||
// 如果有主机设备,取第一个作为主要主机
|
||||
data.serverIds = hostDevices[0].deviceId || hostDevices[0].sn || '';
|
||||
console.log('=== 设置后的serverIds:', data.serverIds);
|
||||
|
||||
} else {
|
||||
data.serverIds = '';
|
||||
}
|
||||
|
||||
console.log('=== 设置后的hostRows:', data.hostRows);
|
||||
console.log('=== 设置后的hostTotal:', data.hostTotal);
|
||||
|
||||
} else {
|
||||
console.warn('获取主机设备信息失败:', res.msg);
|
||||
data.hostRows = [];
|
||||
@@ -819,16 +807,15 @@ const getEarList = () => {
|
||||
deviceType: 2, // 智能耳标设备类型
|
||||
})
|
||||
.then((res) => {
|
||||
console.log('=== 耳标设备API返回结果:', res);
|
||||
|
||||
data.dataListLoading = false;
|
||||
if (res.code === 200) {
|
||||
console.log('=== 耳标设备数据:', res.data);
|
||||
|
||||
// 新API返回的是数组格式,需要过滤出智能耳标设备
|
||||
const earDevices = res.data.filter(device => device.deviceType === 2 || device.deviceType === '2');
|
||||
data.rows = earDevices || [];
|
||||
data.total = earDevices.length || 0;
|
||||
console.log('=== 设置后的rows:', data.rows);
|
||||
console.log('=== 设置后的total:', data.total);
|
||||
|
||||
} else {
|
||||
ElMessage.error(res.msg);
|
||||
data.total = 0;
|
||||
@@ -839,9 +826,7 @@ const getEarList = () => {
|
||||
});
|
||||
};
|
||||
const earLogClick = (row) => {
|
||||
console.log('=== 智能耳标日志点击 ===');
|
||||
console.log('设备信息:', row);
|
||||
|
||||
|
||||
data.deviceId = row.deviceId || row.sn || '';
|
||||
data.earLogDialogVisible = true;
|
||||
|
||||
@@ -850,13 +835,12 @@ const earLogClick = (row) => {
|
||||
deviceId: data.deviceId,
|
||||
deliveryId: parseInt(route.query.id)
|
||||
}).then((res) => {
|
||||
console.log('=== 智能耳标日志API返回结果:', res);
|
||||
|
||||
if (res.code === 200) {
|
||||
// 新API返回的是按60分钟分组的日志数据
|
||||
data.earLogRows = res.data || [];
|
||||
data.earLogTotal = res.data.length || 0;
|
||||
console.log('=== 设置后的earLogRows:', data.earLogRows);
|
||||
console.log('=== 设置后的earLogTotal:', data.earLogTotal);
|
||||
|
||||
} else {
|
||||
ElMessage.error(res.msg || '获取智能耳标日志失败');
|
||||
data.earLogRows = [];
|
||||
@@ -872,20 +856,17 @@ const earLogClick = (row) => {
|
||||
|
||||
// 智能耳标运动轨迹
|
||||
const earTrackClick = (row) => {
|
||||
console.log('=== 智能耳标运动轨迹点击 ===');
|
||||
console.log('设备信息:', row);
|
||||
|
||||
|
||||
// 调用新的API获取60分钟间隔的轨迹数据
|
||||
getEarTagTrajectory({
|
||||
deviceId: row.deviceId || row.sn || '',
|
||||
deliveryId: parseInt(route.query.id)
|
||||
}).then((res) => {
|
||||
console.log('=== 智能耳标轨迹API返回结果:', res);
|
||||
|
||||
if (res.code === 200 && res.data && res.data.length > 0) {
|
||||
// 新API返回的是按60分钟分组的轨迹点数据
|
||||
const trajectoryPoints = res.data;
|
||||
console.log('=== 轨迹点数据:', trajectoryPoints);
|
||||
|
||||
|
||||
// 使用TrackDialog显示轨迹
|
||||
if (TrackDialogRef.value) {
|
||||
const info = {
|
||||
@@ -921,16 +902,15 @@ const getCollarList = () => {
|
||||
deviceType: 4, // 智能项圈设备类型
|
||||
})
|
||||
.then((res) => {
|
||||
console.log('=== 项圈设备API返回结果:', res);
|
||||
|
||||
data.collarDataListLoading = false;
|
||||
if (res.code === 200) {
|
||||
console.log('=== 项圈设备数据:', res.data);
|
||||
|
||||
// 新API返回的是数组格式,需要过滤出智能项圈设备
|
||||
const collarDevices = res.data.filter(device => device.deviceType === 4 || device.deviceType === '4');
|
||||
data.collarRows = collarDevices || [];
|
||||
data.collarTotal = collarDevices.length || 0;
|
||||
console.log('=== 设置后的collarRows:', data.collarRows);
|
||||
console.log('=== 设置后的collarTotal:', data.collarTotal);
|
||||
|
||||
} else {
|
||||
ElMessage.error(res.msg);
|
||||
data.collarTotal = 0;
|
||||
@@ -942,9 +922,7 @@ const getCollarList = () => {
|
||||
});
|
||||
};
|
||||
const collarLogClick = (row) => {
|
||||
console.log('=== 智能项圈日志点击 ===');
|
||||
console.log('设备信息:', row);
|
||||
|
||||
|
||||
data.sn = row.sn || row.deviceId || '';
|
||||
data.collarDialogVisible = true;
|
||||
|
||||
@@ -953,13 +931,12 @@ const collarLogClick = (row) => {
|
||||
deviceId: data.sn,
|
||||
deliveryId: parseInt(route.query.id)
|
||||
}).then((res) => {
|
||||
console.log('=== 智能项圈日志API返回结果:', res);
|
||||
|
||||
if (res.code === 200) {
|
||||
// 新API返回的是按60分钟分组的日志数据
|
||||
data.collarLogRows = res.data || [];
|
||||
data.collarLogTotal = res.data.length || 0;
|
||||
console.log('=== 设置后的collarLogRows:', data.collarLogRows);
|
||||
console.log('=== 设置后的collarLogTotal:', data.collarLogTotal);
|
||||
|
||||
} else {
|
||||
ElMessage.error(res.msg || '获取智能项圈日志失败');
|
||||
data.collarLogRows = [];
|
||||
@@ -1054,20 +1031,17 @@ const getCollarLogList = () => {
|
||||
};
|
||||
// 查看运动轨迹
|
||||
const collarTrackClick = (row) => {
|
||||
console.log('=== 智能项圈运动轨迹点击 ===');
|
||||
console.log('设备信息:', row);
|
||||
|
||||
|
||||
// 调用新的API获取60分钟间隔的轨迹数据
|
||||
getCollarTrajectory({
|
||||
deviceId: row.sn || row.deviceId || '',
|
||||
deliveryId: parseInt(route.query.id)
|
||||
}).then((res) => {
|
||||
console.log('=== 智能项圈轨迹API返回结果:', res);
|
||||
|
||||
if (res.code === 200 && res.data && res.data.length > 0) {
|
||||
// 新API返回的是按60分钟分组的轨迹点数据
|
||||
const trajectoryPoints = res.data;
|
||||
console.log('=== 轨迹点数据:', trajectoryPoints);
|
||||
|
||||
|
||||
// 使用TrackDialog显示轨迹
|
||||
if (TrackDialogRef.value) {
|
||||
const info = {
|
||||
@@ -1089,9 +1063,7 @@ const collarTrackClick = (row) => {
|
||||
|
||||
// 智能主机操作函数
|
||||
const hostLogClick = (row) => {
|
||||
console.log('=== 智能主机日志点击 ===');
|
||||
console.log('设备信息:', row);
|
||||
|
||||
|
||||
data.deviceId = row.deviceId || row.sn || '';
|
||||
data.hostLogDialogVisible = true;
|
||||
|
||||
@@ -1100,13 +1072,12 @@ const hostLogClick = (row) => {
|
||||
deviceId: data.deviceId,
|
||||
deliveryId: parseInt(route.query.id)
|
||||
}).then((res) => {
|
||||
console.log('=== 智能主机日志API返回结果:', res);
|
||||
|
||||
if (res.code === 200) {
|
||||
// 新API返回的是按60分钟分组的日志数据
|
||||
data.hostLogRows = res.data || [];
|
||||
data.hostLogTotal = res.data.length || 0;
|
||||
console.log('=== 设置后的hostLogRows:', data.hostLogRows);
|
||||
console.log('=== 设置后的hostLogTotal:', data.hostLogTotal);
|
||||
|
||||
} else {
|
||||
ElMessage.error(res.msg || '获取智能主机日志失败');
|
||||
data.hostLogRows = [];
|
||||
@@ -1121,20 +1092,17 @@ const hostLogClick = (row) => {
|
||||
};
|
||||
|
||||
const hostTrackClick = (row) => {
|
||||
console.log('=== 智能主机运动轨迹点击 ===');
|
||||
console.log('设备信息:', row);
|
||||
|
||||
|
||||
// 调用新的API获取60分钟间隔的轨迹数据
|
||||
getHostTrajectory({
|
||||
deviceId: row.deviceId || row.sn || '',
|
||||
deliveryId: parseInt(route.query.id)
|
||||
}).then((res) => {
|
||||
console.log('=== 智能主机轨迹API返回结果:', res);
|
||||
|
||||
if (res.code === 200 && res.data && res.data.length > 0) {
|
||||
// 新API返回的是按60分钟分组的轨迹点数据
|
||||
const trajectoryPoints = res.data;
|
||||
console.log('=== 轨迹点数据:', trajectoryPoints);
|
||||
|
||||
|
||||
// 使用TrackDialog显示轨迹
|
||||
if (TrackDialogRef.value) {
|
||||
const info = {
|
||||
@@ -1167,7 +1135,7 @@ const totalRegisteredDevices = computed(() => {
|
||||
const earCount = data.total || 0;
|
||||
const collarCount = data.collarTotal || 0;
|
||||
const total = hostCount + earCount + collarCount;
|
||||
console.log('=== 计算设备总数 - 主机:', hostCount, '耳标:', earCount, '项圈:', collarCount, '总计:', total);
|
||||
|
||||
return total;
|
||||
});
|
||||
|
||||
@@ -1195,9 +1163,7 @@ onMounted(() => {
|
||||
data.status = route.query.status;
|
||||
data.length = route.query.length;
|
||||
|
||||
console.log('=== 详情页面初始化,deliveryId:', route.query.id);
|
||||
console.log('=== 路由参数:', route.query);
|
||||
|
||||
|
||||
// 检查deliveryId是否存在
|
||||
if (!route.query.id) {
|
||||
console.warn('=== 警告:deliveryId为空,无法加载详情页面');
|
||||
@@ -1208,7 +1174,7 @@ onMounted(() => {
|
||||
// 检查deliveryId是否存在,存在时才测试设备关联情况
|
||||
testDeliveryDevices({ deliveryId: route.query.id })
|
||||
.then(res => {
|
||||
console.log('=== 测试设备关联结果:', res);
|
||||
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('=== 测试设备关联失败:', err);
|
||||
|
||||
Reference in New Issue
Block a user