完善日志查询
This commit is contained in:
parent
3b3cb9ff34
commit
e4fcf728b8
@ -3197,6 +3197,6 @@ export const postCTWingLogInfoPage = <ThrowOnError extends boolean = false>(
|
|||||||
ThrowOnError
|
ThrowOnError
|
||||||
>({
|
>({
|
||||||
...options,
|
...options,
|
||||||
url: '/TableModel/OneNETLogInfo',
|
url: '/TableModel/CTWingLogInfo',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@ -5096,6 +5096,7 @@ export type IoTDBTreeModelDeviceDataDto = {
|
|||||||
|
|
||||||
export type IoTDBTreeModelDeviceDataPageListResultDto = {
|
export type IoTDBTreeModelDeviceDataPageListResultDto = {
|
||||||
items?: Array<IoTDBTreeModelDeviceDataDto> | null;
|
items?: Array<IoTDBTreeModelDeviceDataDto> | null;
|
||||||
|
totalCount?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type IoTDBTreeModelDeviceDataPageAllResponse =
|
export type IoTDBTreeModelDeviceDataPageAllResponse =
|
||||||
@ -5145,6 +5146,7 @@ export type IoTDBOneNETLogInfoPageListInput = {
|
|||||||
};
|
};
|
||||||
export type IoTDBOneNETLogInfoPageListResult = {
|
export type IoTDBOneNETLogInfoPageListResult = {
|
||||||
items?: Array<OneNETLogInfoDto> | null;
|
items?: Array<OneNETLogInfoDto> | null;
|
||||||
|
totalCount?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CTWingLogInfoDto = {
|
export type CTWingLogInfoDto = {
|
||||||
@ -5195,4 +5197,5 @@ export type IoTDBCTWingLogInfoDtoPageListInput = {
|
|||||||
};
|
};
|
||||||
export type IoTDBCTWingLogInfoDtoPageListResult = {
|
export type IoTDBCTWingLogInfoDtoPageListResult = {
|
||||||
items?: Array<CTWingLogInfoDto> | null;
|
items?: Array<CTWingLogInfoDto> | null;
|
||||||
|
totalCount?: number;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -62,11 +62,6 @@ export const tableSchema: any = computed((): VxeGridProps['columns'] => [
|
|||||||
title: $t('abp.IoTDBBase.DeviceId'),
|
title: $t('abp.IoTDBBase.DeviceId'),
|
||||||
minWidth: 150,
|
minWidth: 150,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
field: 'devicePath',
|
|
||||||
title: $t('abp.IoTDBBase.DevicePath'),
|
|
||||||
minWidth: 200,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
field: 'platformTenantId',
|
field: 'platformTenantId',
|
||||||
title: $t('abp.CTWingLog.PlatformTenantId'),
|
title: $t('abp.CTWingLog.PlatformTenantId'),
|
||||||
@ -90,7 +85,7 @@ export const tableSchema: any = computed((): VxeGridProps['columns'] => [
|
|||||||
{
|
{
|
||||||
field: 'messageType',
|
field: 'messageType',
|
||||||
title: $t('abp.CTWingLog.MessageType'),
|
title: $t('abp.CTWingLog.MessageType'),
|
||||||
minWidth: 120,
|
minWidth: 180,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'protocol',
|
field: 'protocol',
|
||||||
@ -111,13 +106,11 @@ export const tableSchema: any = computed((): VxeGridProps['columns'] => [
|
|||||||
field: 'rawMessage',
|
field: 'rawMessage',
|
||||||
title: $t('abp.CTWingLog.RawMessage'),
|
title: $t('abp.CTWingLog.RawMessage'),
|
||||||
minWidth: 200,
|
minWidth: 200,
|
||||||
showOverflow: false,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'receivedPayload',
|
field: 'receivedPayload',
|
||||||
title: $t('abp.CTWingLog.ReceivedPayload'),
|
title: $t('abp.CTWingLog.ReceivedPayload'),
|
||||||
minWidth: 200,
|
minWidth: 200,
|
||||||
showOverflow: false,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'receivedTime',
|
field: 'receivedTime',
|
||||||
|
|||||||
@ -2,16 +2,16 @@
|
|||||||
import type { VbenFormProps } from '#/adapter/form';
|
import type { VbenFormProps } from '#/adapter/form';
|
||||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||||
|
|
||||||
|
import { computed, nextTick, ref, watch } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { nextTick, watch, ref, computed } from 'vue';
|
|
||||||
|
|
||||||
import { Page } from '@vben/common-ui';
|
import { Page } from '@vben/common-ui';
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import { postTreeModelDeviceDataInfoPage } from '#/api-client';
|
import { postTreeModelDeviceDataInfoPage } from '#/api-client';
|
||||||
|
|
||||||
import { querySchema, tableSchema } from './schema';
|
|
||||||
import { generateDynamicColumns } from './dynamicColumns';
|
import { generateDynamicColumns } from './dynamicColumns';
|
||||||
|
import { querySchema } from './schema';
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'DeviceData',
|
name: 'DeviceData',
|
||||||
@ -29,19 +29,16 @@ const actualTotalCount = ref<number>(0);
|
|||||||
// 固定列定义(始终显示)- 基于 IoTDBTreeModelDeviceDataDto 类型
|
// 固定列定义(始终显示)- 基于 IoTDBTreeModelDeviceDataDto 类型
|
||||||
const fixedColumns = [
|
const fixedColumns = [
|
||||||
{ title: '序号', type: 'seq', width: 50 },
|
{ title: '序号', type: 'seq', width: 50 },
|
||||||
|
{ field: 'Timestamps', title: '时间戳', minWidth: 150 },
|
||||||
{ field: 'SystemName', title: '系统名称', minWidth: 150 },
|
{ field: 'SystemName', title: '系统名称', minWidth: 150 },
|
||||||
{ field: 'ProjectId', title: '项目ID', minWidth: 150 },
|
{ field: 'ProjectId', title: '项目ID', minWidth: 150 },
|
||||||
{ field: 'DeviceType', title: '设备类型', minWidth: 150 },
|
{ field: 'DeviceType', title: '设备类型', minWidth: 150 },
|
||||||
{ field: 'IoTDataType', title: 'IoT数据类型', minWidth: 150 },
|
{ field: 'IoTDataType', title: 'IoT数据类型', minWidth: 150 },
|
||||||
{ field: 'DeviceId', title: '设备ID', minWidth: 150 },
|
{ field: 'DeviceId', title: '设备ID', minWidth: 150 },
|
||||||
{ field: 'Timestamps', title: '时间戳', minWidth: 150 },
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// 合并固定列和动态列 - 使用计算属性确保响应式
|
// 合并固定列和动态列 - 使用计算属性确保响应式
|
||||||
const allColumns = computed(() => [
|
const allColumns = computed(() => [...fixedColumns, ...dynamicColumns.value]);
|
||||||
...fixedColumns,
|
|
||||||
...dynamicColumns.value,
|
|
||||||
]);
|
|
||||||
|
|
||||||
// 初始化默认列(防止表格空白)
|
// 初始化默认列(防止表格空白)
|
||||||
const initDefaultColumns = () => {
|
const initDefaultColumns = () => {
|
||||||
@ -103,7 +100,6 @@ const gridOptions: VxeGridProps<any> = {
|
|||||||
},
|
},
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
custom: true,
|
custom: true,
|
||||||
search: true,
|
|
||||||
},
|
},
|
||||||
customConfig: {
|
customConfig: {
|
||||||
storage: true,
|
storage: true,
|
||||||
@ -115,7 +111,13 @@ const gridOptions: VxeGridProps<any> = {
|
|||||||
ajax: {
|
ajax: {
|
||||||
query: async ({ page }, formValues) => {
|
query: async ({ page }, formValues) => {
|
||||||
console.log('=== API调用开始 ===');
|
console.log('=== API调用开始 ===');
|
||||||
console.log('请求参数:', { page, formValues, DeviceType, DeviceId, FocusAddress });
|
console.log('请求参数:', {
|
||||||
|
page,
|
||||||
|
formValues,
|
||||||
|
DeviceType,
|
||||||
|
DeviceId,
|
||||||
|
FocusAddress,
|
||||||
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { data } = await postTreeModelDeviceDataInfoPage({
|
const { data } = await postTreeModelDeviceDataInfoPage({
|
||||||
@ -131,16 +133,25 @@ const gridOptions: VxeGridProps<any> = {
|
|||||||
|
|
||||||
console.log('API返回的原始数据:', data);
|
console.log('API返回的原始数据:', data);
|
||||||
console.log('数据类型:', typeof data);
|
console.log('数据类型:', typeof data);
|
||||||
console.log('data是否为null/undefined:', data === null || data === undefined);
|
console.log(
|
||||||
|
'data是否为null/undefined:',
|
||||||
|
data === null || data === undefined,
|
||||||
|
);
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
console.log('data.items存在:', !!data.items);
|
console.log('data.items存在:', !!data.items);
|
||||||
console.log('data.items类型:', Array.isArray(data.items) ? 'Array' : typeof data.items);
|
console.log(
|
||||||
|
'data.items类型:',
|
||||||
|
Array.isArray(data.items) ? 'Array' : typeof data.items,
|
||||||
|
);
|
||||||
if (data.items) {
|
if (data.items) {
|
||||||
console.log('data.items长度:', data.items.length);
|
console.log('data.items长度:', data.items.length);
|
||||||
if (data.items.length > 0) {
|
if (data.items.length > 0) {
|
||||||
console.log('第一条数据:', data.items[0]);
|
console.log('第一条数据:', data.items[0]);
|
||||||
console.log('第一条数据的所有字段:', Object.keys(data.items[0]));
|
console.log(
|
||||||
|
'第一条数据的所有字段:',
|
||||||
|
Object.keys(data.items[0]),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -189,15 +200,20 @@ const gridOptions: VxeGridProps<any> = {
|
|||||||
// 不是第一页,使用更准确的逻辑
|
// 不是第一页,使用更准确的逻辑
|
||||||
if (currentItemsCount === currentPageSize) {
|
if (currentItemsCount === currentPageSize) {
|
||||||
// 当前页满了,说明可能还有更多数据
|
// 当前页满了,说明可能还有更多数据
|
||||||
estimatedTotalCount = page.currentPage * currentPageSize + currentPageSize;
|
estimatedTotalCount =
|
||||||
|
page.currentPage * currentPageSize + currentPageSize;
|
||||||
} else {
|
} else {
|
||||||
// 当前页没满,说明这是最后一页
|
// 当前页没满,说明这是最后一页
|
||||||
estimatedTotalCount = (page.currentPage - 1) * currentPageSize + currentItemsCount;
|
estimatedTotalCount =
|
||||||
|
(page.currentPage - 1) * currentPageSize + currentItemsCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确保总数至少等于当前页的数据量
|
// 确保总数至少等于当前页的数据量
|
||||||
estimatedTotalCount = Math.max(estimatedTotalCount, currentItemsCount);
|
estimatedTotalCount = Math.max(
|
||||||
|
estimatedTotalCount,
|
||||||
|
currentItemsCount,
|
||||||
|
);
|
||||||
|
|
||||||
// 如果当前页数据量小于页面大小,说明这是最后一页,更新缓存
|
// 如果当前页数据量小于页面大小,说明这是最后一页,更新缓存
|
||||||
if (currentItemsCount < currentPageSize) {
|
if (currentItemsCount < currentPageSize) {
|
||||||
@ -210,8 +226,16 @@ const gridOptions: VxeGridProps<any> = {
|
|||||||
totalCount: estimatedTotalCount,
|
totalCount: estimatedTotalCount,
|
||||||
};
|
};
|
||||||
console.log('返回给表格的数据:', result);
|
console.log('返回给表格的数据:', result);
|
||||||
console.log('估算总数:', result.totalCount, '当前页数据量:', result.items.length);
|
console.log(
|
||||||
console.log('分页信息:', { currentPage: page.currentPage, pageSize: currentPageSize });
|
'估算总数:',
|
||||||
|
result.totalCount,
|
||||||
|
'当前页数据量:',
|
||||||
|
result.items.length,
|
||||||
|
);
|
||||||
|
console.log('分页信息:', {
|
||||||
|
currentPage: page.currentPage,
|
||||||
|
pageSize: currentPageSize,
|
||||||
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,11 +256,16 @@ const gridOptions: VxeGridProps<any> = {
|
|||||||
const [Grid, gridApi] = useVbenVxeGrid({ formOptions, gridOptions });
|
const [Grid, gridApi] = useVbenVxeGrid({ formOptions, gridOptions });
|
||||||
|
|
||||||
// 监听分页器状态变化
|
// 监听分页器状态变化
|
||||||
watch(() => gridApi?.pagerApi?.currentPage, (newPage, oldPage) => {
|
watch(
|
||||||
|
() => gridApi?.pagerApi?.currentPage,
|
||||||
|
(newPage, oldPage) => {
|
||||||
console.log('当前页变化:', { newPage, oldPage });
|
console.log('当前页变化:', { newPage, oldPage });
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
watch(() => gridApi?.pagerApi?.pageSize, (newSize, oldSize) => {
|
watch(
|
||||||
|
() => gridApi?.pagerApi?.pageSize,
|
||||||
|
(newSize, oldSize) => {
|
||||||
console.log('页面大小变化:', { newSize, oldSize });
|
console.log('页面大小变化:', { newSize, oldSize });
|
||||||
if (newSize !== oldSize && oldSize) {
|
if (newSize !== oldSize && oldSize) {
|
||||||
console.log('页面大小从', oldSize, '变为', newSize, ',重置到第一页');
|
console.log('页面大小从', oldSize, '变为', newSize, ',重置到第一页');
|
||||||
@ -248,7 +277,8 @@ watch(() => gridApi?.pagerApi?.pageSize, (newSize, oldSize) => {
|
|||||||
// 重置到第一页
|
// 重置到第一页
|
||||||
gridApi.pagerApi.currentPage = 1;
|
gridApi.pagerApi.currentPage = 1;
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user