解决子设备信息展示异常以及设备地址过滤查询未生效的问题

This commit is contained in:
ChenYi 2026-05-20 10:48:25 +08:00
parent a384201b78
commit c33670251d
5 changed files with 43 additions and 17 deletions

View File

@ -35,9 +35,11 @@ const options = ref<any[]>([]);
const query = ref({ const query = ref({
pageIndex: 1, pageIndex: 1,
pageSize: 10, pageSize: 10,
deviceAddress: '', //
}); });
const total = ref(0); const total = ref(0);
const loading = ref<boolean>(false); const loading = ref<boolean>(false);
const searchInput = ref<string>('');
// //
const maxPage = computed(() => { const maxPage = computed(() => {
@ -60,7 +62,8 @@ const fetchData = async () => {
body: { body: {
pageIndex: query.value.pageIndex, pageIndex: query.value.pageIndex,
pageSize: query.value.pageSize, pageSize: query.value.pageSize,
IoTDataType: props.ioTDataType, ioTDataType: props.ioTDataType,
deviceAddress: query.value.deviceAddress || undefined,
}, },
}); });
@ -79,6 +82,15 @@ const fetchData = async () => {
} }
}; };
/**
* 处理搜索输入
*/
const handleSearch = useDebounceFn((value: string) => {
query.value.deviceAddress = value;
query.value.pageIndex = 1; //
fetchData();
}, 300);
/** /**
* 上下页 * 上下页
* @param type 1: 下一页, 0: 上一页 * @param type 1: 下一页, 0: 上一页
@ -100,6 +112,8 @@ watch(
() => props.ioTDataType, () => props.ioTDataType,
(newVal) => { (newVal) => {
query.value.pageIndex = 1; query.value.pageIndex = 1;
query.value.deviceAddress = ''; //
searchInput.value = '';
if (newVal) { if (newVal) {
fetchData(); fetchData();
} else { } else {
@ -146,7 +160,9 @@ defineExpose({
:disabled="disabled || !ioTDataType" :disabled="disabled || !ioTDataType"
:allow-clear="allowClear" :allow-clear="allowClear"
:loading="loading" :loading="loading"
:search-value="searchInput"
@change="handleValueChange" @change="handleValueChange"
@search="handleSearch"
> >
<template #dropdownRender="{ menuNode: menu }"> <template #dropdownRender="{ menuNode: menu }">
<v-nodes :vnodes="menu" /> <v-nodes :vnodes="menu" />

View File

@ -35,9 +35,11 @@ const options = ref<any[]>([]);
const query = ref({ const query = ref({
pageIndex: 1, pageIndex: 1,
pageSize: 10, pageSize: 10,
deviceAddress: '', //
}); });
const total = ref(0); const total = ref(0);
const loading = ref<boolean>(false); const loading = ref<boolean>(false);
const searchInput = ref<string>('');
// //
const maxPage = computed(() => { const maxPage = computed(() => {
@ -60,7 +62,8 @@ const fetchData = async () => {
body: { body: {
pageIndex: query.value.pageIndex, pageIndex: query.value.pageIndex,
pageSize: query.value.pageSize, pageSize: query.value.pageSize,
IoTDataType: props.ioTDataType, ioTDataType: props.ioTDataType,
deviceAddress: query.value.deviceAddress || undefined,
}, },
}); });
@ -79,6 +82,15 @@ const fetchData = async () => {
} }
}; };
/**
* 处理搜索输入
*/
const handleSearch = useDebounceFn((value: string) => {
query.value.deviceAddress = value;
query.value.pageIndex = 1; //
fetchData();
}, 300);
/** /**
* 上下页 * 上下页
* @param type 1: 下一页, 0: 上一页 * @param type 1: 下一页, 0: 上一页
@ -100,6 +112,8 @@ watch(
() => props.ioTDataType, () => props.ioTDataType,
(newVal) => { (newVal) => {
query.value.pageIndex = 1; query.value.pageIndex = 1;
query.value.deviceAddress = ''; //
searchInput.value = '';
if (newVal) { if (newVal) {
fetchData(); fetchData();
} else { } else {
@ -146,7 +160,9 @@ defineExpose({
:disabled="disabled || !ioTDataType" :disabled="disabled || !ioTDataType"
:allow-clear="allowClear" :allow-clear="allowClear"
:loading="loading" :loading="loading"
:search-value="searchInput"
@change="handleValueChange" @change="handleValueChange"
@search="handleSearch"
> >
<template #dropdownRender="{ menuNode: menu }"> <template #dropdownRender="{ menuNode: menu }">
<v-nodes :vnodes="menu" /> <v-nodes :vnodes="menu" />

View File

@ -18,8 +18,8 @@ export const fieldNameMapping: FieldMapping = {
// ProjectName: '项目名称', // ProjectName: '项目名称',
IoTDataType: 'IoT数据类型', IoTDataType: 'IoT数据类型',
DataType: '测点数据类型', DataType: '测点数据类型',
DeviceType: '设备类型',
DeviceAddress: '设备ID', DeviceAddress: '设备ID',
// SubDevice: '子设备', // 已在固定列中定义
// Timestamps: '时间戳', // 已隐藏使用TimestampStr替代 // Timestamps: '时间戳', // 已隐藏使用TimestampStr替代
// 可以根据需要添加更多映射 // 可以根据需要添加更多映射
}; };
@ -42,14 +42,13 @@ export const fieldTypeConfig: FieldTypeConfig = {
// 固定字段列表 - 这些字段已经在固定列中定义,不需要在动态列中重复生成 // 固定字段列表 - 这些字段已经在固定列中定义,不需要在动态列中重复生成
const FIXED_FIELDS = [ const FIXED_FIELDS = [
// 'DataBaseName', // 'DataBaseName',
'DeviceType',
'IoTDataType', 'IoTDataType',
'DataType', 'DataType',
'SubDevice',
'TimestampStr', 'TimestampStr',
'FormattedTimestamps', 'FormattedTimestamps',
'Timestamps', // 添加Timestamps到固定字段列表确保它被隐藏 'Timestamps', // 添加Timestamps到固定字段列表确保它被隐藏
'DeviceAddress', 'DeviceAddress',
'SubDevice',
]; ];
// 动态生成表格列 // 动态生成表格列

View File

@ -60,13 +60,6 @@ const fixedBaseColumns = [
showOverflow: true, showOverflow: true,
slots: {}, slots: {},
}, },
{
field: 'DeviceType',
title: $t('abp.IoTDBBase.DeviceType'),
minWidth: 150,
showOverflow: true,
slots: {},
},
{ {
field: 'IoTDataType', field: 'IoTDataType',
title: $t('abp.IoTDBBase.IoTDataType'), title: $t('abp.IoTDBBase.IoTDataType'),
@ -81,6 +74,13 @@ const fixedBaseColumns = [
showOverflow: true, showOverflow: true,
slots: {}, slots: {},
}, },
{
field: 'SubDevice',
title: $t('abp.IoTDBBase.SubDevice'),
minWidth: 150,
showOverflow: true,
slots: {},
},
]; ];
// - 使 // - 使

View File

@ -85,11 +85,6 @@ export const tableSchema: any = computed((): VxeGridProps['columns'] => [
title: $t('abp.IoTDBBase.Timestamps'), title: $t('abp.IoTDBBase.Timestamps'),
minWidth: '150', minWidth: '150',
}, },
{
field: 'DeviceType',
title: $t('abp.IoTDBBase.DeviceType'),
minWidth: '150',
},
{ {
field: 'IoTDataType', field: 'IoTDataType',
title: $t('abp.IoTDBBase.IoTDataType'), title: $t('abp.IoTDBBase.IoTDataType'),