解决子设备信息展示异常以及设备地址过滤查询未生效的问题
This commit is contained in:
parent
a384201b78
commit
c33670251d
@ -35,9 +35,11 @@ const options = ref<any[]>([]);
|
||||
const query = ref({
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
deviceAddress: '', // 搜索关键词
|
||||
});
|
||||
const total = ref(0);
|
||||
const loading = ref<boolean>(false);
|
||||
const searchInput = ref<string>('');
|
||||
|
||||
// 最大页码
|
||||
const maxPage = computed(() => {
|
||||
@ -60,7 +62,8 @@ const fetchData = async () => {
|
||||
body: {
|
||||
pageIndex: query.value.pageIndex,
|
||||
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: 上一页
|
||||
@ -100,6 +112,8 @@ watch(
|
||||
() => props.ioTDataType,
|
||||
(newVal) => {
|
||||
query.value.pageIndex = 1;
|
||||
query.value.deviceAddress = ''; // 重置搜索关键词
|
||||
searchInput.value = '';
|
||||
if (newVal) {
|
||||
fetchData();
|
||||
} else {
|
||||
@ -146,7 +160,9 @@ defineExpose({
|
||||
:disabled="disabled || !ioTDataType"
|
||||
:allow-clear="allowClear"
|
||||
:loading="loading"
|
||||
:search-value="searchInput"
|
||||
@change="handleValueChange"
|
||||
@search="handleSearch"
|
||||
>
|
||||
<template #dropdownRender="{ menuNode: menu }">
|
||||
<v-nodes :vnodes="menu" />
|
||||
|
||||
@ -35,9 +35,11 @@ const options = ref<any[]>([]);
|
||||
const query = ref({
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
deviceAddress: '', // 搜索关键词
|
||||
});
|
||||
const total = ref(0);
|
||||
const loading = ref<boolean>(false);
|
||||
const searchInput = ref<string>('');
|
||||
|
||||
// 最大页码
|
||||
const maxPage = computed(() => {
|
||||
@ -60,7 +62,8 @@ const fetchData = async () => {
|
||||
body: {
|
||||
pageIndex: query.value.pageIndex,
|
||||
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: 上一页
|
||||
@ -100,6 +112,8 @@ watch(
|
||||
() => props.ioTDataType,
|
||||
(newVal) => {
|
||||
query.value.pageIndex = 1;
|
||||
query.value.deviceAddress = ''; // 重置搜索关键词
|
||||
searchInput.value = '';
|
||||
if (newVal) {
|
||||
fetchData();
|
||||
} else {
|
||||
@ -146,7 +160,9 @@ defineExpose({
|
||||
:disabled="disabled || !ioTDataType"
|
||||
:allow-clear="allowClear"
|
||||
:loading="loading"
|
||||
:search-value="searchInput"
|
||||
@change="handleValueChange"
|
||||
@search="handleSearch"
|
||||
>
|
||||
<template #dropdownRender="{ menuNode: menu }">
|
||||
<v-nodes :vnodes="menu" />
|
||||
|
||||
@ -18,8 +18,8 @@ export const fieldNameMapping: FieldMapping = {
|
||||
// ProjectName: '项目名称',
|
||||
IoTDataType: 'IoT数据类型',
|
||||
DataType: '测点数据类型',
|
||||
DeviceType: '设备类型',
|
||||
DeviceAddress: '设备ID',
|
||||
// SubDevice: '子设备', // 已在固定列中定义
|
||||
// Timestamps: '时间戳', // 已隐藏,使用TimestampStr替代
|
||||
// 可以根据需要添加更多映射
|
||||
};
|
||||
@ -42,14 +42,13 @@ export const fieldTypeConfig: FieldTypeConfig = {
|
||||
// 固定字段列表 - 这些字段已经在固定列中定义,不需要在动态列中重复生成
|
||||
const FIXED_FIELDS = [
|
||||
// 'DataBaseName',
|
||||
'DeviceType',
|
||||
'IoTDataType',
|
||||
'DataType',
|
||||
'SubDevice',
|
||||
'TimestampStr',
|
||||
'FormattedTimestamps',
|
||||
'Timestamps', // 添加Timestamps到固定字段列表,确保它被隐藏
|
||||
'DeviceAddress',
|
||||
'SubDevice',
|
||||
];
|
||||
|
||||
// 动态生成表格列
|
||||
|
||||
@ -60,13 +60,6 @@ const fixedBaseColumns = [
|
||||
showOverflow: true,
|
||||
slots: {},
|
||||
},
|
||||
{
|
||||
field: 'DeviceType',
|
||||
title: $t('abp.IoTDBBase.DeviceType'),
|
||||
minWidth: 150,
|
||||
showOverflow: true,
|
||||
slots: {},
|
||||
},
|
||||
{
|
||||
field: 'IoTDataType',
|
||||
title: $t('abp.IoTDBBase.IoTDataType'),
|
||||
@ -81,6 +74,13 @@ const fixedBaseColumns = [
|
||||
showOverflow: true,
|
||||
slots: {},
|
||||
},
|
||||
{
|
||||
field: 'SubDevice',
|
||||
title: $t('abp.IoTDBBase.SubDevice'),
|
||||
minWidth: 150,
|
||||
showOverflow: true,
|
||||
slots: {},
|
||||
},
|
||||
];
|
||||
|
||||
// 合并固定列和动态列 - 使用计算属性确保响应式
|
||||
|
||||
@ -85,11 +85,6 @@ export const tableSchema: any = computed((): VxeGridProps['columns'] => [
|
||||
title: $t('abp.IoTDBBase.Timestamps'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'DeviceType',
|
||||
title: $t('abp.IoTDBBase.DeviceType'),
|
||||
minWidth: '150',
|
||||
},
|
||||
{
|
||||
field: 'IoTDataType',
|
||||
title: $t('abp.IoTDBBase.IoTDataType'),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user