|
@@ -424,6 +424,7 @@ export function useDevice(tableRef: Ref) {
|
|
|
async function fetchDoorRecords() {
|
|
async function fetchDoorRecords() {
|
|
|
if (!currentDeviceId.value) return;
|
|
if (!currentDeviceId.value) return;
|
|
|
|
|
|
|
|
|
|
+ console.log('开始查询开关门记录 - deviceId:', currentDeviceId.value);
|
|
|
recordLoading.value = true;
|
|
recordLoading.value = true;
|
|
|
try {
|
|
try {
|
|
|
const res = await getDoorRecords(currentDeviceId.value, {
|
|
const res = await getDoorRecords(currentDeviceId.value, {
|
|
@@ -431,9 +432,20 @@ export function useDevice(tableRef: Ref) {
|
|
|
pageSize: recordPagination.pageSize
|
|
pageSize: recordPagination.pageSize
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- if (res.code === 0 && res.data) {
|
|
|
|
|
|
|
+ console.log('后端返回完整数据:', JSON.stringify(res, null, 2));
|
|
|
|
|
+ console.log('res.data:', res.data);
|
|
|
|
|
+ console.log('res.data.list:', res.data?.list);
|
|
|
|
|
+
|
|
|
|
|
+ // 注意:http.request 返回的数据已经在 data 字段中
|
|
|
|
|
+ // 兼容 code === 0 和 code === 200 两种格式
|
|
|
|
|
+ if ((res.code === 0 || res.code === 200) && res.data) {
|
|
|
|
|
+ // res.data 就是后端返回的 {list, total, pageSize, currentPage}
|
|
|
recordList.value = res.data.list || [];
|
|
recordList.value = res.data.list || [];
|
|
|
recordPagination.total = res.data.total || 0;
|
|
recordPagination.total = res.data.total || 0;
|
|
|
|
|
+ console.log('✅ 记录列表:', recordList.value);
|
|
|
|
|
+ console.log('✅ 总数:', recordPagination.total);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ console.warn('查询失败或无数据 - code:', res.code, 'data:', res.data);
|
|
|
}
|
|
}
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.error("查询开关门记录失败:", error);
|
|
console.error("查询开关门记录失败:", error);
|