设备数据表格优化

This commit is contained in:
ChenYi 2026-03-09 11:35:09 +08:00
parent 3ac2ed83e9
commit 59ab5facd5
2 changed files with 43 additions and 12 deletions

View File

@ -81,8 +81,11 @@ const { IoTDataType, DeviceAddress } = route.query;
//
const dynamicColumns = ref<any[]>([]);
// - IoTDBTreeModelDeviceDataDto
const fixedColumns = [
// Sub_Device
const showSubDeviceColumn = ref(false);
// - IoTDBTreeModelDeviceDataDto
const fixedBaseColumns = [
{ title: '序号', type: 'seq', width: 50, field: 'seq', slots: {} },
{
field: 'TimestampStr',
@ -119,23 +122,34 @@ const fixedColumns = [
showOverflow: true,
slots: {},
},
{
];
// Sub_Device
const subDeviceColumn = {
field: 'SubDevice',
title: $t('abp.IoTDBBase.SubDevice'),
minWidth: 150,
showOverflow: true,
slots: {},
},
];
};
// - 使
const allColumns = computed(() => {
//
if (!isGridInitialized.value) {
return [...fixedColumns];
const baseColumns = [...fixedBaseColumns];
if (showSubDeviceColumn.value) {
baseColumns.push(subDeviceColumn);
}
return baseColumns;
}
const columns = [...fixedColumns];
const columns = [...fixedBaseColumns];
// DeviceType Sub_Device
if (showSubDeviceColumn.value) {
columns.push(subDeviceColumn);
}
//
if (dynamicColumns.value && Array.isArray(dynamicColumns.value)) {
@ -157,6 +171,9 @@ const initDefaultColumns = () => {
if (!Array.isArray(dynamicColumns.value)) {
dynamicColumns.value = [];
}
// Sub_Device
showSubDeviceColumn.value = false;
};
//
@ -183,6 +200,14 @@ const formOptions: VbenFormProps = {
return;
}
// DeviceType Sub_Device
if (changedFields.includes('DeviceType')) {
// DeviceTypeEnum: =0, =1, =2, =3
const deviceType = values.DeviceType;
showSubDeviceColumn.value =
deviceType === 3 || deviceType === '3';
}
//
const relevantFields = new Set([
'DeviceAddress',
@ -259,7 +284,7 @@ const gridOptions: VxeGridProps<any> = {
highlight: true,
labelField: 'name',
},
columns: fixedColumns, // 使
columns: fixedBaseColumns, // 使
height: 'auto',
keepSource: true,
//

View File

@ -107,6 +107,12 @@ export const tableSchema: any = computed((): VxeGridProps['columns'] => [
minWidth: '120',
slots: {},
},
{
field: 'subDevice',
title: $t('abp.IoTDBBase.SubDevice'),
minWidth: '120',
slots: {},
},
{
field: 'messageType',
title: $t('abp.OneNETLog.MessageType'),