物联网问题解决,只差最后测试完善
This commit is contained in:
@@ -214,8 +214,35 @@
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
<div class="host-box" v-if="data.serverIds != ''">
|
||||
<!-- <div class="ear-box">
|
||||
<div class="title">智能主机</div>
|
||||
<el-table
|
||||
:data="data.collarRows"
|
||||
border
|
||||
v-loading="data.collarDataListLoading"
|
||||
element-loading-text="数据加载中..."
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-table-column label="智能主机编号" prop="deviceId"></el-table-column>
|
||||
<el-table-column label="设备电量" prop="battery">
|
||||
<template #default="scope"> {{ scope.row.battery || scope.row.deviceVoltage || '-' }}% </template>
|
||||
</el-table-column>
|
||||
<el-table-column label="步数" prop="steps">
|
||||
<template #default="scope"> {{ scope.row.steps || scope.row.walkSteps || '-' }}步</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="设备温度" prop="temperature">
|
||||
<template #default="scope"> {{ scope.row.temperature || scope.row.deviceTemp || '-' }}℃ </template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数据最后更新时间" prop="time">
|
||||
<template #default="scope"> {{ scope.row.time || scope.row.updateTime || scope.row.createTime || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" prop="">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" @click="collarLogClick(scope.row)">日志</el-button>
|
||||
<el-button link type="primary" @click="collarTrackClick(scope.row)">运动轨迹</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-descriptions :column="1">
|
||||
<el-descriptions-item label="主机编号:">
|
||||
{{ data.serverIds }}
|
||||
@@ -227,7 +254,7 @@
|
||||
>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="ear-box">
|
||||
<div class="title">智能项圈</div>
|
||||
<el-table
|
||||
@@ -237,17 +264,19 @@
|
||||
element-loading-text="数据加载中..."
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-table-column label="智能项圈编号" prop="sn"></el-table-column>
|
||||
<el-table-column label="智能项圈编号" prop="deviceId"></el-table-column>
|
||||
<el-table-column label="设备电量" prop="battery">
|
||||
<template #default="scope"> {{ scope.row.battery }}% </template>
|
||||
<template #default="scope"> {{ scope.row.battery || scope.row.deviceVoltage || '-' }}% </template>
|
||||
</el-table-column>
|
||||
<el-table-column label="步数" prop="steps">
|
||||
<template #default="scope"> {{ scope.row.steps }}步</template>
|
||||
<template #default="scope"> {{ scope.row.steps || scope.row.walkSteps || '-' }}步</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="设备温度" prop="temperature">
|
||||
<template #default="scope"> {{ scope.row.temperature }}/℃ </template>
|
||||
<template #default="scope"> {{ scope.row.temperature || scope.row.deviceTemp || '-' }}℃ </template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数据最后更新时间" prop="time">
|
||||
<template #default="scope"> {{ scope.row.time || scope.row.updateTime || scope.row.createTime || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数据最后更新时间" prop="time"></el-table-column>
|
||||
<el-table-column label="操作" prop="">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" @click="collarLogClick(scope.row)">日志</el-button>
|
||||
@@ -267,15 +296,17 @@
|
||||
<el-table :data="data.rows" border v-loading="data.dataListLoading" element-loading-text="数据加载中..." style="width: 100%">
|
||||
<el-table-column label="智能耳标编号" prop="deviceId"></el-table-column>
|
||||
<el-table-column label="设备电量" prop="deviceVoltage">
|
||||
<template #default="scope"> {{ scope.row.deviceVoltage }}% </template>
|
||||
<template #default="scope"> {{ scope.row.deviceVoltage || scope.row.battery || '-' }}% </template>
|
||||
</el-table-column>
|
||||
<el-table-column label="步数" prop="walkSteps">
|
||||
<template #default="scope"> {{ scope.row.walkSteps }}步</template>
|
||||
<template #default="scope"> {{ scope.row.walkSteps || scope.row.steps || '-' }}步</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="设备温度" prop="deviceTemp">
|
||||
<template #default="scope"> {{ scope.row.deviceTemp }}/℃ </template>
|
||||
<template #default="scope"> {{ scope.row.deviceTemp || scope.row.temperature || '-' }}℃ </template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数据最后更新时间" prop="updateTime">
|
||||
<template #default="scope"> {{ scope.row.updateTime || scope.row.createTime || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数据最后更新时间" prop="updateTime"></el-table-column>
|
||||
<el-table-column label="操作" prop="">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" @click="earLogClick(scope.row)">日志</el-button>
|
||||
@@ -387,15 +418,17 @@
|
||||
<el-table :data="data.earLogRows" border v-loading="data.logListLoading" element-loading-text="数据加载中..." style="width: 100%">
|
||||
<el-table-column label="智能耳标编号" prop="deviceId"></el-table-column>
|
||||
<el-table-column label="设备电量" prop="deviceVoltage">
|
||||
<template #default="scope"> {{ scope.row.deviceVoltage }}% </template>
|
||||
<template #default="scope"> {{ scope.row.deviceVoltage || scope.row.battery || '-' }}% </template>
|
||||
</el-table-column>
|
||||
<el-table-column label="步数" prop="walkSteps">
|
||||
<template #default="scope"> {{ scope.row.walkSteps }}步</template>
|
||||
<template #default="scope"> {{ scope.row.walkSteps || scope.row.steps || '-' }}步</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="设备温度" prop="deviceTemp">
|
||||
<template #default="scope"> {{ scope.row.deviceTemp }}/℃ </template>
|
||||
<template #default="scope"> {{ scope.row.deviceTemp || scope.row.temperature || '-' }}℃ </template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数据最后更新时间" prop="updateTime" width="200">
|
||||
<template #default="scope"> {{ scope.row.updateTime || scope.row.createTime || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数据最后更新时间" prop="updateTime" width="200"></el-table-column>
|
||||
<el-table-column label="操作" prop="">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" @click="locateClick(scope.row)">定位</el-button>
|
||||
@@ -409,15 +442,17 @@
|
||||
<el-table :data="data.collarLogRows" border v-loading="data.logListLoading" element-loading-text="数据加载中..." style="width: 100%">
|
||||
<el-table-column label="智能项圈编号" prop="sn"></el-table-column>
|
||||
<el-table-column label="设备电量" prop="battery">
|
||||
<template #default="scope"> {{ scope.row.battery }}% </template>
|
||||
<template #default="scope"> {{ scope.row.battery || scope.row.deviceVoltage || '-' }}% </template>
|
||||
</el-table-column>
|
||||
<el-table-column label="步数" prop="steps">
|
||||
<template #default="scope"> {{ scope.row.steps }}步</template>
|
||||
<template #default="scope"> {{ scope.row.steps || scope.row.walkSteps || '-' }}步</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="设备温度" prop="temperature">
|
||||
<template #default="scope"> {{ scope.row.temperature }}/℃ </template>
|
||||
<template #default="scope"> {{ scope.row.temperature || scope.row.deviceTemp || '-' }}℃ </template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数据最后更新时间" prop="time" width="200">
|
||||
<template #default="scope"> {{ scope.row.time || scope.row.updateTime || scope.row.createTime || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="数据最后更新时间" prop="time" width="200"></el-table-column>
|
||||
<el-table-column label="操作" prop="">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" @click="collarlocateClick(scope.row)">定位</el-button>
|
||||
@@ -440,7 +475,7 @@
|
||||
import { ref, reactive, onMounted } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { earList, hostLocation, hostTrack, waybillDetail, collarList, collarLogList, earLogList, testDeliveryDevices } from '@/api/abroad.js';
|
||||
import { earList, hostLocation, hostTrack, waybillDetail, collarList, collarLogList, earLogList, testDeliveryDevices, pageDeviceList } from '@/api/abroad.js';
|
||||
import startIcon from '../../assets/images/qi.png';
|
||||
import endIcon from '../../assets/images/zhong.png';
|
||||
import TrackDialog from '../hardware/trackDialog.vue';
|
||||
@@ -548,6 +583,9 @@ const getDetail = () => {
|
||||
carBehindPhoto: data.baseInfo.carBehindPhoto,
|
||||
driverId: data.baseInfo.driverId
|
||||
});
|
||||
|
||||
// 使用新的统一API获取智能主机信息
|
||||
getHostDeviceInfo();
|
||||
} else {
|
||||
ElMessage.error(res.msg);
|
||||
}
|
||||
@@ -555,6 +593,43 @@ const getDetail = () => {
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
// 获取智能主机信息
|
||||
const getHostDeviceInfo = () => {
|
||||
if (!route.query.id) {
|
||||
console.warn('=== 警告:deliveryId为空,跳过主机设备查询');
|
||||
return;
|
||||
}
|
||||
|
||||
pageDeviceList({
|
||||
pageNum: 1,
|
||||
pageSize: 100, // 获取所有主机设备
|
||||
deliveryId: parseInt(route.query.id),
|
||||
deviceType: 1, // 智能主机设备类型
|
||||
})
|
||||
.then((res) => {
|
||||
console.log('=== 主机设备API返回结果:', res);
|
||||
if (res.code === 200) {
|
||||
console.log('=== 主机设备数据:', res.data);
|
||||
// 新API返回的是数组格式,过滤出智能主机设备
|
||||
const hostDevices = res.data.filter(device => device.deviceType === 1 || device.deviceType === '1');
|
||||
if (hostDevices.length > 0) {
|
||||
// 如果有主机设备,取第一个作为主要主机
|
||||
data.serverIds = hostDevices[0].deviceId || hostDevices[0].sn || '';
|
||||
console.log('=== 设置后的serverIds:', data.serverIds);
|
||||
} else {
|
||||
data.serverIds = '';
|
||||
}
|
||||
} else {
|
||||
console.warn('获取主机设备信息失败:', res.msg);
|
||||
data.serverIds = '';
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error('获取主机设备信息异常:', err);
|
||||
data.serverIds = '';
|
||||
});
|
||||
};
|
||||
|
||||
// 查看主机定位
|
||||
const locationClick = (item) => {
|
||||
getHostLocation(item);
|
||||
@@ -626,18 +701,21 @@ const getEarList = () => {
|
||||
}
|
||||
|
||||
data.dataListLoading = true;
|
||||
earList({
|
||||
pageDeviceList({
|
||||
pageNum: form.pageNum,
|
||||
pageSize: form.pageSize,
|
||||
deliveryId: route.query.id,
|
||||
deliveryId: parseInt(route.query.id),
|
||||
deviceType: 2, // 智能耳标设备类型
|
||||
})
|
||||
.then((res) => {
|
||||
console.log('=== 耳标设备API返回结果:', res);
|
||||
data.dataListLoading = false;
|
||||
if (res.code === 200) {
|
||||
console.log('=== 耳标设备数据:', res.data);
|
||||
data.rows = res.data.rows || [];
|
||||
data.total = res.data.total || 0;
|
||||
// 新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 {
|
||||
@@ -650,7 +728,7 @@ const getEarList = () => {
|
||||
});
|
||||
};
|
||||
const earLogClick = (row) => {
|
||||
data.deviceId = row.deviceId;
|
||||
data.deviceId = row.deviceId || row.sn || '';
|
||||
data.earLogDialogVisible = true;
|
||||
getEarLogList();
|
||||
};
|
||||
@@ -663,18 +741,21 @@ const getCollarList = () => {
|
||||
}
|
||||
|
||||
data.collarDataListLoading = true;
|
||||
collarList({
|
||||
pageDeviceList({
|
||||
pageNum: collarForm.pageNum,
|
||||
pageSize: collarForm.pageSize,
|
||||
deliveryId: route.query.id,
|
||||
deliveryId: parseInt(route.query.id),
|
||||
deviceType: 4, // 智能项圈设备类型
|
||||
})
|
||||
.then((res) => {
|
||||
console.log('=== 项圈设备API返回结果:', res);
|
||||
data.collarDataListLoading = false;
|
||||
if (res.code === 200) {
|
||||
console.log('=== 项圈设备数据:', res.data);
|
||||
data.collarRows = res.data.rows || [];
|
||||
data.collarTotal = res.data.total || 0;
|
||||
// 新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 {
|
||||
@@ -688,7 +769,7 @@ const getCollarList = () => {
|
||||
});
|
||||
};
|
||||
const collarLogClick = (row) => {
|
||||
data.sn = row.sn;
|
||||
data.sn = row.sn || row.deviceId || '';
|
||||
data.collarDialogVisible = true;
|
||||
getCollarLogList();
|
||||
};
|
||||
@@ -716,14 +797,14 @@ const goToList = () => {
|
||||
const locateClick = (row) => {
|
||||
data.center.lng = row.longitude;
|
||||
data.center.lat = row.latitude;
|
||||
data.updateTime = row.updateTime;
|
||||
data.updateTime = row.updateTime || row.createTime || '';
|
||||
data.dialogVisible = true;
|
||||
};
|
||||
//
|
||||
const collarlocateClick = (row) => {
|
||||
data.center.lng = row.longitude;
|
||||
data.center.lat = row.latitude;
|
||||
data.updateTime = row.time;
|
||||
data.updateTime = row.time || row.updateTime || row.createTime || '';
|
||||
data.dialogVisible = true;
|
||||
};
|
||||
// 耳标日志列表
|
||||
@@ -777,7 +858,7 @@ const collarTrackClick = (row) => {
|
||||
if (TrackDialogRef.value) {
|
||||
const info = {
|
||||
deliveryId: route.query.id,
|
||||
deviceId: row.sn,
|
||||
deviceId: row.sn || row.deviceId || '',
|
||||
type: 'order',
|
||||
};
|
||||
TrackDialogRef.value.onShowTrackDialog(info);
|
||||
|
||||
Reference in New Issue
Block a user