You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.3 KiB
64 lines
1.3 KiB
<script setup lang="ts">
|
|
|
|
/**
|
|
* 页面主入口
|
|
*/
|
|
|
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
|
import { columns } from './data';
|
|
import { {{entity}}Api } from '#/api/{{entity}}';
|
|
|
|
|
|
console.log('=== columns 配置 ===', columns)
|
|
const [Grid, gridApi] = useVbenVxeGrid({
|
|
|
|
columns,
|
|
|
|
gridOptions: {
|
|
proxyConfig: {
|
|
ajax: {
|
|
query: async ({ page }) => {
|
|
try {
|
|
console.log('=== 请求参数 ===', page)
|
|
|
|
const res = await userApi.page({
|
|
pageNum: page?.currentPage || 1,
|
|
pageSize: page?.pageSize || 10,
|
|
})
|
|
|
|
console.log('=== API 返回的数据 ===', res)
|
|
const data = res.error?.result || res.result || res
|
|
const result = {
|
|
items: data.records,
|
|
total: data.total
|
|
}
|
|
console.log('=== 转换后的数据 ===', result)
|
|
return result
|
|
|
|
} catch (error) {
|
|
console.error('查询用户列表失败:', error)
|
|
throw error
|
|
}
|
|
}
|
|
}
|
|
},
|
|
pagerConfig: {
|
|
enabled: true,
|
|
},
|
|
},
|
|
})
|
|
|
|
|
|
|
|
</script>
|
|
|
|
<template>
|
|
<div>
|
|
<Grid table-title="用户列表">
|
|
<template #toolbar-tools>
|
|
<button @click="() => gridApi.reload()">刷新</button>
|
|
</template>
|
|
</Grid>
|
|
</div>
|
|
|
|
</template>
|
|
|