修改代码

This commit is contained in:
ChenYi 2025-07-17 10:27:56 +08:00
parent 6019490b00
commit 8609e3198a

View File

@ -2,16 +2,16 @@
import type { VbenFormProps } from '#/adapter/form'; import type { VbenFormProps } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table'; import type { VxeGridProps } from '#/adapter/vxe-table';
import { ref, watch } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { ref, nextTick, watch } from 'vue';
import { Page } from '@vben/common-ui'; import { Page } from '@vben/common-ui';
import { useVbenVxeGrid } from '#/adapter/vxe-table'; import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { postCTWingLogInfoPage } from '#/api-client'; import { postCTWingLogInfoPage } from '#/api-client';
import { querySchema, tableSchema } from './schema';
import DeviceSelect from '../deviceData/DeviceSelect.vue'; import DeviceSelect from '../deviceData/DeviceSelect.vue';
import { querySchema, tableSchema } from './schema';
defineOptions({ defineOptions({
name: 'CTWingLog', name: 'CTWingLog',
@ -49,7 +49,14 @@ const gridOptions: VxeGridProps<any> = {
currentPage: 1, currentPage: 1,
pageSize: 10, pageSize: 10,
pageSizes: [10, 20, 100], pageSizes: [10, 20, 100],
layouts: ['PrevPage', 'JumpNumber', 'NextPage', 'FullJump', 'Sizes', 'Total'], layouts: [
'PrevPage',
'JumpNumber',
'NextPage',
'FullJump',
'Sizes',
'Total',
],
}, },
toolbarConfig: { toolbarConfig: {
custom: true, custom: true,
@ -63,23 +70,20 @@ const gridOptions: VxeGridProps<any> = {
// //
let deviceId = ''; let deviceId = '';
let systemName = ''; let systemName = '';
let deviceType = formValues?.DeviceType || ''; const deviceType = formValues?.DeviceType || '';
const finalFocusAddress = formValues.FocusAddress || '';
if (deviceSelectRef.value) { if (deviceSelectRef.value) {
const deviceInfo = deviceSelectRef.value.getSelectedDeviceInfo(); const deviceInfo = deviceSelectRef.value.getSelectedDeviceInfo();
if (deviceInfo) { if (deviceInfo) {
finalFocusAddress = deviceInfo.focusAddress || '';
systemName = deviceInfo.systemName || ''; systemName = deviceInfo.systemName || '';
// 10focusIdmeterId // 10focusIdmeterId
if (Number(deviceType) === 10) { deviceId =
deviceId = deviceInfo.focusId || ''; Number(deviceType) === 10
} else { ? deviceInfo.focusId || ''
deviceId = deviceInfo.meterId || ''; : deviceInfo.meterId || '';
} }
} }
}
// deviceInfo退DeviceId
if (!deviceId) {
deviceId = formValues?.DeviceId || '';
}
// //
const queryParams: any = { const queryParams: any = {
pageIndex: page.currentPage, pageIndex: page.currentPage,
@ -91,6 +95,7 @@ const gridOptions: VxeGridProps<any> = {
SystemName: systemName || formValues?.SystemName || '', SystemName: systemName || formValues?.SystemName || '',
StartCreationTime: formatDate(formValues?.StartCreationTime), StartCreationTime: formatDate(formValues?.StartCreationTime),
EndCreationTime: formatDate(formValues?.EndCreationTime), EndCreationTime: formatDate(formValues?.EndCreationTime),
FocusAddress: finalFocusAddress,
}; };
if (DeviceType) queryParams.DeviceType = DeviceType; if (DeviceType) queryParams.DeviceType = DeviceType;
if (DeviceId) queryParams.DeviceId = DeviceId; if (DeviceId) queryParams.DeviceId = DeviceId;
@ -147,12 +152,9 @@ watch(
<template> <template>
<Page auto-content-height> <Page auto-content-height>
<Grid> <Grid>
<template #DeviceId="{ model, field }"> <DeviceSelect <template #DeviceId="{ model, field }">
ref="deviceSelectRef" <DeviceSelect ref="deviceSelectRef" v-model:value="model[field]"
v-model:value="model[field]" :placeholder="$t('common.pleaseSelect') + $t('abp.log.deviceInfo')" allow-clear />
:placeholder="$t('common.pleaseSelect') + $t('abp.log.deviceInfo')"
allow-clear
/>
</template> </template>
</Grid> </Grid>
</Page> </Page>