修改代码
This commit is contained in:
parent
6019490b00
commit
8609e3198a
@ -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',
|
||||
@ -46,10 +46,17 @@ const gridOptions: VxeGridProps<any> = {
|
||||
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<any> = {
|
||||
// 获取选中的设备信息
|
||||
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<any> = {
|
||||
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(
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<Grid>
|
||||
<template #DeviceId="{ model, field }"> <DeviceSelect
|
||||
ref="deviceSelectRef"
|
||||
v-model:value="model[field]"
|
||||
:placeholder="$t('common.pleaseSelect') + $t('abp.log.deviceInfo')"
|
||||
allow-clear
|
||||
/>
|
||||
<template #DeviceId="{ model, field }">
|
||||
<DeviceSelect ref="deviceSelectRef" v-model:value="model[field]"
|
||||
:placeholder="$t('common.pleaseSelect') + $t('abp.log.deviceInfo')" allow-clear />
|
||||
</template>
|
||||
</Grid>
|
||||
</Page>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user