2025-06-25 17:29:57 +08:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import type { VbenFormProps } from '#/adapter/form';
|
|
|
|
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
|
|
|
|
|
|
|
|
|
import { useRoute } from 'vue-router';
|
|
|
|
|
|
|
|
|
|
import { Page } from '@vben/common-ui';
|
|
|
|
|
|
|
|
|
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
2025-07-11 11:48:12 +08:00
|
|
|
import { postCTWingLogInfoPage } from '#/api-client';
|
2025-06-25 17:29:57 +08:00
|
|
|
|
|
|
|
|
import { querySchema, tableSchema } from './schema';
|
|
|
|
|
|
|
|
|
|
defineOptions({
|
2025-07-11 11:48:12 +08:00
|
|
|
name: 'CTWingLog',
|
2025-06-25 17:29:57 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
const { DeviceType, DeviceId, FocusAddress } = route.query;
|
|
|
|
|
const formOptions: VbenFormProps = {
|
|
|
|
|
schema: querySchema.value,
|
|
|
|
|
};
|
2025-07-11 11:48:12 +08:00
|
|
|
const gridOptions: VxeGridProps<any> = {
|
2025-06-25 17:29:57 +08:00
|
|
|
checkboxConfig: {
|
|
|
|
|
highlight: true,
|
|
|
|
|
labelField: 'name',
|
|
|
|
|
},
|
2025-07-11 11:48:12 +08:00
|
|
|
columns: tableSchema.value,
|
2025-06-25 17:29:57 +08:00
|
|
|
height: 'auto',
|
|
|
|
|
keepSource: true,
|
2025-07-11 11:48:12 +08:00
|
|
|
pagerConfig: {},
|
2025-06-25 17:29:57 +08:00
|
|
|
toolbarConfig: {
|
|
|
|
|
custom: true,
|
|
|
|
|
},
|
|
|
|
|
customConfig: {
|
|
|
|
|
storage: true,
|
|
|
|
|
},
|
|
|
|
|
proxyConfig: {
|
|
|
|
|
ajax: {
|
|
|
|
|
query: async ({ page }, formValues) => {
|
2025-07-14 16:04:42 +08:00
|
|
|
// 构建查询参数
|
|
|
|
|
const queryParams: any = {
|
2025-07-11 11:48:12 +08:00
|
|
|
pageIndex: page.currentPage,
|
|
|
|
|
pageSize: page.pageSize,
|
2025-07-14 16:04:42 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 如果有表单值,添加到查询参数中
|
|
|
|
|
if (formValues) {
|
|
|
|
|
Object.assign(queryParams, formValues);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 添加路由参数
|
|
|
|
|
if (DeviceType) queryParams.DeviceType = DeviceType;
|
|
|
|
|
if (DeviceId) queryParams.DeviceId = DeviceId;
|
|
|
|
|
if (FocusAddress) queryParams.FocusAddress = FocusAddress;
|
|
|
|
|
|
|
|
|
|
const { data } = await postCTWingLogInfoPage({
|
|
|
|
|
body: queryParams,
|
2025-07-11 11:48:12 +08:00
|
|
|
});
|
2025-07-14 16:04:42 +08:00
|
|
|
|
2025-07-11 11:48:12 +08:00
|
|
|
// 确保返回的数据包含totalCount字段
|
|
|
|
|
const result = {
|
|
|
|
|
items: data.items || [],
|
|
|
|
|
totalCount: data.totalCount || (data.items ? data.items.length : 0),
|
|
|
|
|
};
|
|
|
|
|
return result;
|
2025-06-25 17:29:57 +08:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
2025-07-11 11:48:12 +08:00
|
|
|
const [Grid] = useVbenVxeGrid({ formOptions, gridOptions });
|
2025-06-25 17:29:57 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<Page auto-content-height>
|
2025-07-11 11:48:12 +08:00
|
|
|
<Grid />
|
2025-06-25 17:29:57 +08:00
|
|
|
</Page>
|
|
|
|
|
</template>
|