mirror of https://github.com/1Panel-dev/1Panel
fix: 优化 FTP 列表分页样式 (#5283)
parent
62beecf337
commit
0afc6242a2
|
@ -2,6 +2,7 @@ package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
"sort"
|
||||||
|
|
||||||
"github.com/1Panel-dev/1Panel/backend/app/dto"
|
"github.com/1Panel-dev/1Panel/backend/app/dto"
|
||||||
"github.com/1Panel-dev/1Panel/backend/app/model"
|
"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 {
|
if err != nil {
|
||||||
return 0, nil, err
|
return 0, nil, err
|
||||||
}
|
}
|
||||||
|
sort.Slice(logItem, func(i, j int) bool {
|
||||||
|
return logItem[i].Time > logItem[j].Time
|
||||||
|
})
|
||||||
var logs []toolbox.FtpLog
|
var logs []toolbox.FtpLog
|
||||||
total, start, end := len(logItem), (req.Page-1)*req.PageSize, req.Page*req.PageSize
|
total, start, end := len(logItem), (req.Page-1)*req.PageSize, req.Page*req.PageSize
|
||||||
if start > total {
|
if start > total {
|
||||||
|
|
|
@ -18,10 +18,11 @@
|
||||||
|
|
||||||
<div class="complex-table__pagination" v-if="props.paginationConfig">
|
<div class="complex-table__pagination" v-if="props.paginationConfig">
|
||||||
<slot name="pagination">
|
<slot name="pagination">
|
||||||
<fu-table-pagination
|
<el-pagination
|
||||||
v-model:current-page="paginationConfig.currentPage"
|
v-model:current-page="paginationConfig.currentPage"
|
||||||
v-model:page-size="paginationConfig.pageSize"
|
v-model:page-size="paginationConfig.pageSize"
|
||||||
:total="paginationConfig.total"
|
:total="paginationConfig.total"
|
||||||
|
:page-sizes="[5, 10, 20, 50, 100]"
|
||||||
@size-change="sizeChange"
|
@size-change="sizeChange"
|
||||||
@current-change="currentChange"
|
@current-change="currentChange"
|
||||||
:small="mobile"
|
:small="mobile"
|
||||||
|
|
|
@ -184,7 +184,7 @@ const data = ref();
|
||||||
const paginationConfig = reactive({
|
const paginationConfig = reactive({
|
||||||
cacheSizeKey: 'ftp-page-size',
|
cacheSizeKey: 'ftp-page-size',
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
pageSize: 10,
|
pageSize: Number(localStorage.getItem('ftp-page-size')) || 10,
|
||||||
total: 0,
|
total: 0,
|
||||||
orderBy: 'created_at',
|
orderBy: 'created_at',
|
||||||
order: 'null',
|
order: 'null',
|
||||||
|
|
|
@ -17,13 +17,13 @@
|
||||||
|
|
||||||
<ComplexTable class="mt-2" :pagination-config="paginationConfig" :data="data" @search="search">
|
<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="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 }">
|
<template #default="{ row }">
|
||||||
<el-tag v-if="row.status === '200'">{{ $t('commons.status.success') }}</el-tag>
|
<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>
|
<el-tag v-else type="danger">{{ $t('commons.status.failed') }}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</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 }">
|
<template #default="{ row }">
|
||||||
{{ loadOperation(row.operation) }}
|
{{ loadOperation(row.operation) }}
|
||||||
</template>
|
</template>
|
||||||
|
@ -33,12 +33,12 @@
|
||||||
{{ loadFileName(row.operation) }}
|
{{ loadFileName(row.operation) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</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 }">
|
<template #default="{ row }">
|
||||||
{{ computeSizeFromByte(Number(row.size)) }}
|
{{ computeSizeFromByte(Number(row.size)) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</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>
|
</ComplexTable>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
|
|
Loading…
Reference in New Issue