From 8609e3198a2ae294c01c72fdc4734cba2140e404 Mon Sep 17 00:00:00 2001 From: ChenYi <296215406@outlook.com> Date: Thu, 17 Jul 2025 10:27:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/dataManger/ctwingLog/index.vue | 44 ++++++++++--------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/apps/web-antd/src/views/dataManger/ctwingLog/index.vue b/apps/web-antd/src/views/dataManger/ctwingLog/index.vue index 5246d35..f0128e0 100644 --- a/apps/web-antd/src/views/dataManger/ctwingLog/index.vue +++ b/apps/web-antd/src/views/dataManger/ctwingLog/index.vue @@ -2,16 +2,16 @@ import type { VbenFormProps } from '#/adapter/form'; import type { VxeGridProps } from '#/adapter/vxe-table'; +import { ref, watch } from 'vue'; import { useRoute } from 'vue-router'; -import { ref, nextTick, watch } from 'vue'; import { Page } from '@vben/common-ui'; import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { postCTWingLogInfoPage } from '#/api-client'; -import { querySchema, tableSchema } from './schema'; import DeviceSelect from '../deviceData/DeviceSelect.vue'; +import { querySchema, tableSchema } from './schema'; defineOptions({ name: 'CTWingLog', @@ -32,7 +32,7 @@ const formatDate = (date: any) => { if (typeof date === 'string') return date; if (date.toISOString) return date.format('YYYY-MM-DD HH:mm:ss'); return ''; -}; +}; const formOptions: VbenFormProps = { schema: querySchema.value, }; @@ -46,10 +46,17 @@ const gridOptions: VxeGridProps = { height: 'auto', keepSource: true, pagerConfig: { - currentPage:1, + currentPage: 1, pageSize: 10, pageSizes: [10, 20, 100], - layouts: ['PrevPage', 'JumpNumber', 'NextPage', 'FullJump', 'Sizes', 'Total'], + layouts: [ + 'PrevPage', + 'JumpNumber', + 'NextPage', + 'FullJump', + 'Sizes', + 'Total', + ], }, toolbarConfig: { custom: true, @@ -63,23 +70,20 @@ const gridOptions: VxeGridProps = { // 获取选中的设备信息 let deviceId = ''; let systemName = ''; - let deviceType = formValues?.DeviceType || ''; + const deviceType = formValues?.DeviceType || ''; + const finalFocusAddress = formValues.FocusAddress || ''; if (deviceSelectRef.value) { const deviceInfo = deviceSelectRef.value.getSelectedDeviceInfo(); if (deviceInfo) { + finalFocusAddress = deviceInfo.focusAddress || ''; systemName = deviceInfo.systemName || ''; // 设备类型为10时取focusId,其他情况取meterId - if (Number(deviceType) === 10) { - deviceId = deviceInfo.focusId || ''; - } else { - deviceId = deviceInfo.meterId || ''; - } + deviceId = + Number(deviceType) === 10 + ? deviceInfo.focusId || '' + : deviceInfo.meterId || ''; } } - // 没有deviceInfo时回退表单DeviceId - if (!deviceId) { - deviceId = formValues?.DeviceId || ''; - } // 构建查询参数 const queryParams: any = { pageIndex: page.currentPage, @@ -91,6 +95,7 @@ const gridOptions: VxeGridProps = { SystemName: systemName || formValues?.SystemName || '', StartCreationTime: formatDate(formValues?.StartCreationTime), EndCreationTime: formatDate(formValues?.EndCreationTime), + FocusAddress: finalFocusAddress, }; if (DeviceType) queryParams.DeviceType = DeviceType; if (DeviceId) queryParams.DeviceId = DeviceId; @@ -147,12 +152,9 @@ watch(