fixbug: 🐛 安全日志分页问题

This commit is contained in:
Bunny 2024-12-29 22:52:16 +08:00
parent 29cf554a10
commit 51156fb489
1 changed files with 20 additions and 3 deletions

View File

@ -11,8 +11,8 @@ const userLoginLogs = reactive({
loading: false, loading: false,
datalist: [], datalist: [],
currentPage: 1, currentPage: 1,
pageSize: 150, pageSize: 15,
total: 100, total: 0,
background: true, background: true,
layout: 'prev, pager, next', layout: 'prev, pager, next',
}); });
@ -23,10 +23,19 @@ const onSearchByLoginLog = async () => {
const data = await userLoginLogStore.getUserLoginLogListByLocalUser(userLoginLogs); const data = await userLoginLogStore.getUserLoginLogListByLocalUser(userLoginLogs);
userLoginLogs.datalist = data.list; userLoginLogs.datalist = data.list;
userLoginLogs.currentPage = data.pageNo;
userLoginLogs.pageSize = data.pageSize;
userLoginLogs.total = data.total;
userLoginLogs.loading = false; userLoginLogs.loading = false;
}; };
/** 当前页改变时 */
const onCurrentPageChange = async (value: number) => {
userLoginLogs.currentPage = value;
await onSearchByLoginLog();
};
onMounted(() => { onMounted(() => {
onSearchByLoginLog(); onSearchByLoginLog();
}); });
@ -35,6 +44,14 @@ onMounted(() => {
<template> <template>
<div :class="['min-w-[280px]', deviceDetection() ? 'max-w-[100%]' : 'max-w-[70%]']"> <div :class="['min-w-[280px]', deviceDetection() ? 'max-w-[100%]' : 'max-w-[70%]']">
<h3 class="my-8">{{ $t('security_log') }}</h3> <h3 class="my-8">{{ $t('security_log') }}</h3>
<pure-table :columns="columns" :data="userLoginLogs.datalist" :loading="userLoginLogs.loading" :pagination="userLoginLogs" row-key="id" table-layout="auto" /> <pure-table
:columns="columns"
:data="userLoginLogs.datalist"
:loading="userLoginLogs.loading"
:pagination="userLoginLogs"
row-key="id"
table-layout="auto"
@page-current-change="onCurrentPageChange"
/>
</div> </div>
</template> </template>