70 lines
1.6 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-10 10:52:19 +08:00
import { postTreeModelDeviceDataInfoPage } from '#/api-client';
2025-06-25 17:29:57 +08:00
import { querySchema, tableSchema } from './schema';
defineOptions({
2025-07-09 17:07:25 +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,
};
const gridOptions: VxeGridProps<any> = {
checkboxConfig: {
highlight: true,
labelField: 'name',
},
columns: tableSchema.value,
height: 'auto',
keepSource: true,
pagerConfig: {},
toolbarConfig: {
custom: true,
},
customConfig: {
storage: true,
},
proxyConfig: {
ajax: {
query: async ({ page }, formValues) => {
2025-07-09 17:07:25 +08:00
const { data } = await postTreeModelDeviceDataInfoPage({
2025-06-25 17:29:57 +08:00
body: {
...formValues,
pageIndex: page.currentPage,
pageSize: page.pageSize,
DeviceType,
DeviceId,
FocusAddress,
},
});
2025-07-10 10:52:19 +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
},
},
},
};
const [Grid] = useVbenVxeGrid({ formOptions, gridOptions });
</script>
<template>
<Page auto-content-height>
<Grid />
</Page>
</template>