68 lines
1.5 KiB
Vue
Raw Normal View History

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-11 11:48:12 +08:00
const { data } = await postCTWingLogInfoPage({
pageIndex: page.currentPage,
pageSize: page.pageSize,
DeviceType,
DeviceId,
FocusAddress,
...formValues,
});
// 确保返回的数据包含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>