fix: 优化 FTP 列表分页样式 (#5283)

This commit is contained in:
ssongliu 2024-06-04 22:03:06 +08:00 committed by GitHub
parent 62beecf337
commit 0afc6242a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 11 additions and 6 deletions

View File

@ -2,6 +2,7 @@ package service
import (
"os"
"sort"
"github.com/1Panel-dev/1Panel/backend/app/dto"
"github.com/1Panel-dev/1Panel/backend/app/model"
@ -48,6 +49,9 @@ func (f *FtpService) LoadLog(req dto.FtpLogSearch) (int64, interface{}, error) {
if err != nil {
return 0, nil, err
}
sort.Slice(logItem, func(i, j int) bool {
return logItem[i].Time > logItem[j].Time
})
var logs []toolbox.FtpLog
total, start, end := len(logItem), (req.Page-1)*req.PageSize, req.Page*req.PageSize
if start > total {

View File

@ -18,10 +18,11 @@
<div class="complex-table__pagination" v-if="props.paginationConfig">
<slot name="pagination">
<fu-table-pagination
<el-pagination
v-model:current-page="paginationConfig.currentPage"
v-model:page-size="paginationConfig.pageSize"
:total="paginationConfig.total"
:page-sizes="[5, 10, 20, 50, 100]"
@size-change="sizeChange"
@current-change="currentChange"
:small="mobile"

View File

@ -184,7 +184,7 @@ const data = ref();
const paginationConfig = reactive({
cacheSizeKey: 'ftp-page-size',
currentPage: 1,
pageSize: 10,
pageSize: Number(localStorage.getItem('ftp-page-size')) || 10,
total: 0,
orderBy: 'created_at',
order: 'null',

View File

@ -17,13 +17,13 @@
<ComplexTable class="mt-2" :pagination-config="paginationConfig" :data="data" @search="search">
<el-table-column label="ip" prop="ip" show-overflow-tooltip />
<el-table-column :label="$t('commons.table.status')" show-overflow-tooltip prop="status">
<el-table-column :label="$t('commons.table.status')" min-width="50" show-overflow-tooltip prop="status">
<template #default="{ row }">
<el-tag v-if="row.status === '200'">{{ $t('commons.status.success') }}</el-tag>
<el-tag v-else type="danger">{{ $t('commons.status.failed') }}</el-tag>
</template>
</el-table-column>
<el-table-column :label="$t('commons.table.operate')" show-overflow-tooltip>
<el-table-column :label="$t('commons.table.operate')" min-width="40" show-overflow-tooltip>
<template #default="{ row }">
{{ loadOperation(row.operation) }}
</template>
@ -33,12 +33,12 @@
{{ loadFileName(row.operation) }}
</template>
</el-table-column>
<el-table-column :label="$t('file.size')" show-overflow-tooltip prop="size">
<el-table-column :label="$t('file.size')" show-overflow-tooltip prop="size" min-width="60">
<template #default="{ row }">
{{ computeSizeFromByte(Number(row.size)) }}
</template>
</el-table-column>
<el-table-column :label="$t('commons.table.date')" prop="time" show-overflow-tooltip />
<el-table-column :label="$t('commons.table.date')" prop="time" show-overflow-tooltip min-width="100" />
</ComplexTable>
<template #footer>
<span class="dialog-footer">