From d55e939e845538ccda90b26f92c720a2e401c3c1 Mon Sep 17 00:00:00 2001 From: ChenYi <296215406@outlook.com> Date: Thu, 17 Jul 2025 08:48:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=86=E9=A1=B5=E5=A4=B1?= =?UTF-8?q?=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/dataManger/deviceData/index.vue | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/web-antd/src/views/dataManger/deviceData/index.vue b/apps/web-antd/src/views/dataManger/deviceData/index.vue index 507f822..25d8d64 100644 --- a/apps/web-antd/src/views/dataManger/deviceData/index.vue +++ b/apps/web-antd/src/views/dataManger/deviceData/index.vue @@ -219,20 +219,22 @@ const gridOptions: VxeGridProps = { if (!page) { return { items: [], totalCount: 0 }; } + // 获取当前表单值,如果formValues为空则从表单API获取 + const currentFormValues = formValues || (gridApi?.formApi ? await gridApi.formApi.getValues() : {}) || {}; // 处理DeviceType和IoTDataType,确保传递数字类型 - const deviceTypeValue = formValues.DeviceType || DeviceType; + const deviceTypeValue = currentFormValues.DeviceType || DeviceType; const deviceTypeNumber = deviceTypeValue ? Number(deviceTypeValue) : undefined; - const ioTDataTypeValue = formValues.IoTDataType; + const ioTDataTypeValue = currentFormValues.IoTDataType; // 处理DeviceId,当设备类型为集中器(10)时,使用focusId - let finalDeviceId = formValues.DeviceId || DeviceId || ''; - let finalFocusAddress = formValues.FocusAddress || ''; + let finalDeviceId = currentFormValues.DeviceId || DeviceId || ''; + let finalFocusAddress = currentFormValues.FocusAddress || ''; // 优先使用选中的设备信息 - const deviceInfo = selectedDeviceInfo.value || (formValues.DeviceId && deviceOptions.value.length > 0 ? getDeviceInfoById(formValues.DeviceId) : null); + const deviceInfo = selectedDeviceInfo.value || (currentFormValues.DeviceId && deviceOptions.value.length > 0 ? getDeviceInfoById(currentFormValues.DeviceId) : null); if (deviceInfo) { finalFocusAddress = deviceInfo.focusAddress || ''; @@ -259,7 +261,7 @@ const gridOptions: VxeGridProps = { DeviceId: finalDeviceId ? finalDeviceId.toString() : '', FocusAddress: finalFocusAddress || FocusAddress || '', // 添加其他表单参数 - SystemName: formValues.SystemName || SystemName || '', + SystemName: currentFormValues.SystemName || SystemName || '', IoTDataType: ioTDataTypeValue || undefined, }, });