修复设备数据重复查询的问题

This commit is contained in:
ChenYi 2026-07-09 16:46:16 +08:00
parent fb2f3a1da1
commit 61a3e7e594
2 changed files with 22 additions and 2 deletions

View File

@ -104,6 +104,10 @@ const fetchData = async () => {
}
};
// ioTDataType props.value immediate fetchData
// DevicePatchListAsync query
const scheduleFetch = useDebounceFn(() => fetchData(), 100);
/**
* 处理搜索输入
*/
@ -145,7 +149,7 @@ watch(
searchInput.value = '';
pendingAutoSelectFirst.value = !!props.value;
if (newVal) {
fetchData();
scheduleFetch();
} else {
options.value = [];
total.value = 0;
@ -172,7 +176,7 @@ watch(
query.value.pageIndex = 1;
query.value.deviceAddress = newVal;
pendingAutoSelectFirst.value = true;
fetchData();
scheduleFetch();
},
{ immediate: true },
);

View File

@ -111,12 +111,25 @@ const isInitializing = ref(false);
//
//
//
//
// DeviceDataInfoPage
const lastReloadSig = ref<string>('');
const debouncedReload = useDebounceFn(async () => {
if (!gridApi?.formApi) {
return;
}
const values = await gridApi.formApi.getValues();
if (values.DeviceAddress && values.IoTDataType) {
const sig = [
values.IoTDataType,
values.DeviceAddress,
values.StartCreationTime,
values.EndCreationTime,
].join('|');
if (sig === lastReloadSig.value) {
return;
}
lastReloadSig.value = sig;
gridApi.reload(values);
}
}, 200);
@ -193,6 +206,9 @@ const gridOptions: VxeGridProps<any> = {
showOverflow: true,
showHeaderOverflow: true,
proxyConfig: {
//
// DevicePath 204
autoLoad: false,
ajax: {
query: async ({ page, sorts, filters }, formValues) => {
// page