基本完成v1.0

This commit is contained in:
xuqiuyun
2025-10-30 16:58:39 +08:00
parent d1d0b62184
commit 4b6d14a6ec
202 changed files with 1856 additions and 17458 deletions

View File

@@ -168,8 +168,7 @@ const formItemList = reactive([
// 获取指定订单的设备数量
const getDeviceCounts = async (deliveryId) => {
try {
console.log('=== 获取订单设备数量deliveryId:', deliveryId);
// 获取所有设备类型的数据
const [hostRes, earRes, collarRes] = await Promise.all([
pageDeviceList({ pageNum: 1, pageSize: 100, deliveryId: parseInt(deliveryId), deviceType: 1 }),
@@ -182,14 +181,7 @@ const getDeviceCounts = async (deliveryId) => {
const collarCount = collarRes.code === 200 ? collarRes.data.length : 0;
const totalCount = hostCount + earCount + collarCount;
console.log('=== 设备数量统计:', {
deliveryId,
hostCount,
earCount,
collarCount,
totalCount
});
// 存储设备数量
data.deviceCounts[deliveryId] = {
host: hostCount,
@@ -244,63 +236,40 @@ const getDataList = () => {
// 处理精确的创建时间查询
if (searchParams.createTime) {
params.createTime = searchParams.createTime;
console.log('精确创建时间查询:', searchParams.createTime);
}
// 处理精确的车牌号查询
if (searchParams.licensePlate) {
params.licensePlate = searchParams.licensePlate.trim();
console.log('精确车牌号查询:', params.licensePlate);
}
console.log('查询参数:', params);
inspectionList(params)
.then(async (ret) => {
console.log('入境检疫列表返回结果:', ret);
data.rows = ret.data.rows;
data.total = ret.data.total;
dataListLoading.value = false;
// 为每个订单获取设备数量
if (ret.data.rows && ret.data.rows.length > 0) {
console.log('=== 开始为每个订单获取设备数量');
for (const row of ret.data.rows) {
if (row.id) {
await getDeviceCounts(row.id);
}
}
console.log('=== 所有订单设备数量获取完成');
}
// 调试:检查第一行数据的字段
if (ret.data.rows && ret.data.rows.length > 0) {
const firstRow = ret.data.rows[0];
console.log('入境检疫第一行数据完整字段:', firstRow);
console.log('入境检疫关键字段检查:', {
status: firstRow.status,
statusDesc: firstRow.statusDesc,
registeredJbqCount: firstRow.registeredJbqCount,
earTagCount: firstRow.earTagCount,
driverName: firstRow.driverName,
licensePlate: firstRow.licensePlate
});
// 检查Word导出所需字段
console.log('Word导出字段检查:', {
supplierName: firstRow.supplierName,
buyerName: firstRow.buyerName,
startLocation: firstRow.startLocation,
createTime: firstRow.createTime,
endLocation: firstRow.endLocation,
driverName: firstRow.driverName,
driverMobile: firstRow.driverMobile,
licensePlate: firstRow.licensePlate,
ratedQuantity: firstRow.ratedQuantity,
landingEntruckWeight: firstRow.landingEntruckWeight,
emptyWeight: firstRow.emptyWeight,
firmPrice: firstRow.firmPrice
});
}
})
.catch(() => {
@@ -346,16 +315,7 @@ const download = async (row) => {
totalAmount: totalAmount
};
console.log('生成Word文档数据:', data);
console.log('原始数据字段检查:', {
supplierName: row.supplierName,
buyerName: row.buyerName,
supplierMobile: row.supplierMobile,
buyerMobile: row.buyerMobile,
fundName: row.fundName,
fundMobile: row.fundMobile
});
// 生成HTML内容
const htmlContent = `
<!DOCTYPE html>
@@ -601,8 +561,7 @@ const viewDevices = (row) => {
// 编辑运送清单
const editDelivery = async (row) => {
try {
console.log('[EDIT-DELIVERY] 准备编辑运送清单, ID:', row.id);
// 检查编辑对话框组件是否已加载
if (!editDialogRef.value || !editDialogRef.value.open) {
ElMessage.warning('编辑功能暂不可用,请刷新页面重试');
@@ -611,8 +570,7 @@ const editDelivery = async (row) => {
// 调用 detail 接口获取完整数据(包含 supplierId, buyerId, 设备信息等)
const detailRes = await getDeliveryDetail(row.id);
console.log('[EDIT-DELIVERY] 获取到详情数据:', detailRes);
if (detailRes.code === 200 && detailRes.data) {
// 传入完整的 detail 数据给 open() 方法
editDialogRef.value.open(detailRes.data);

View File

@@ -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);

View File

@@ -172,7 +172,7 @@ const goBack = () => {
// Tab切换
const handleTabChange = (tabName) => {
console.log('切换到Tab:', tabName);
};
// 获取智能主机列表
@@ -191,7 +191,7 @@ const getHostList = async () => {
deviceType: 1,
});
console.log('主机设备API返回:', res);
if (res.code === 200) {
const hostDevices = res.data.filter(device => device.deviceType === 1 || device.deviceType === '1');
hostList.value = hostDevices || [];
@@ -223,7 +223,7 @@ const getEarList = async () => {
deviceType: 2,
});
console.log('耳标设备API返回:', res);
if (res.code === 200) {
const earDevices = res.data.filter(device => device.deviceType === 2 || device.deviceType === '2');
earList.value = earDevices || [];
@@ -255,7 +255,7 @@ const getCollarList = async () => {
deviceType: 4,
});
console.log('项圈设备API返回:', res);
if (res.code === 200) {
const collarDevices = res.data.filter(device => device.deviceType === 4 || device.deviceType === '4');
collarList.value = collarDevices || [];
@@ -310,8 +310,6 @@ const unbindDevice = (device, deviceType) => {
};
onMounted(() => {
console.log('设备管理页面初始化deliveryId:', route.query.deliveryId);
console.log('运单号:', route.query.deliveryNumber);
if (!route.query.deliveryId) {
console.warn('deliveryId为空无法加载设备列表');