feat: 缓存页面分页条数 (#2337)

Refs #2159 #1765
This commit is contained in:
ssongliu 2023-09-18 17:20:25 +08:00 committed by GitHub
parent 5ff7085f29
commit 88a4ea3513
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 47 additions and 2 deletions

View File

@ -63,6 +63,7 @@ const loading = ref();
const data = ref();
const paginationConfig = reactive({
cacheSizeKey: 'backup-page-size',
currentPage: 1,
pageSize: 10,
total: 0,

View File

@ -32,7 +32,7 @@
</div>
</template>
<script setup lang="ts">
import { ref, computed } from 'vue';
import { ref, computed, onMounted } from 'vue';
import { GlobalStore } from '@/store';
defineOptions({ name: 'ComplexTable' });
@ -60,6 +60,7 @@ function currentChange() {
function sizeChange() {
props.paginationConfig.currentPage = 1;
localStorage.setItem(props.paginationConfig.cacheSizeKey, props.paginationConfig.pageSize);
emit('search');
}
@ -78,6 +79,13 @@ defineExpose({
clearSelects,
sort,
});
onMounted(() => {
let itemSize = Number(localStorage.getItem(props.paginationConfig.cacheSizeKey));
if (itemSize) {
props.paginationConfig.pageSize = itemSize;
}
});
</script>
<style lang="scss">

View File

@ -100,6 +100,7 @@ const baseDir = ref();
const data = ref();
const title = ref();
const paginationConfig = reactive({
cacheSizeKey: 'upload-page-size',
currentPage: 1,
pageSize: 10,
total: 0,

View File

@ -155,6 +155,7 @@ const mobile = computed(() => {
const language = useI18n().locale.value;
const paginationConfig = reactive({
cacheSizeKey: 'app-page-size',
currentPage: 1,
pageSize: 60,
total: 0,

View File

@ -295,6 +295,7 @@ const loading = ref(false);
const syncLoading = ref(false);
let timer: NodeJS.Timer | null = null;
const paginationConfig = reactive({
cacheSizeKey: 'app-installed-page-size',
currentPage: 1,
pageSize: 20,
total: 0,

View File

@ -154,6 +154,7 @@ const acceptParams = (props: DialogProps): void => {
const data = ref();
const selects = ref<any>([]);
const paginationConfig = reactive({
cacheSizeKey: 'container-page-size',
currentPage: 1,
pageSize: 10,
total: 0,

View File

@ -112,6 +112,7 @@ const isOnDetail = ref(false);
const baseDir = ref();
const paginationConfig = reactive({
cacheSizeKey: 'container-compose-page-size',
currentPage: 1,
pageSize: 10,
total: 0,

View File

@ -220,6 +220,7 @@ const loading = ref();
const data = ref();
const selects = ref<any>([]);
const paginationConfig = reactive({
cacheSizeKey: 'container-page-size',
currentPage: 1,
pageSize: 10,
total: 0,

View File

@ -121,6 +121,7 @@ const loading = ref(false);
const data = ref();
const repos = ref();
const paginationConfig = reactive({
cacheSizeKey: 'container-image-page-size',
currentPage: 1,
pageSize: 10,
total: 0,

View File

@ -118,6 +118,7 @@ const codemirror = ref();
const data = ref();
const selects = ref<any>([]);
const paginationConfig = reactive({
cacheSizeKey: 'container-network-page-size',
currentPage: 1,
pageSize: 10,
total: 0,

View File

@ -89,6 +89,7 @@ const loading = ref();
const data = ref();
const selects = ref<any>([]);
const paginationConfig = reactive({
cacheSizeKey: 'image-repo-page-size',
currentPage: 1,
pageSize: 10,
total: 0,

View File

@ -80,6 +80,7 @@ const data = ref();
const selects = ref<any>([]);
const paginationConfig = reactive({
cacheSizeKey: 'compose-template-page-size',
currentPage: 1,
pageSize: 10,
total: 0,

View File

@ -120,6 +120,7 @@ const codemirror = ref();
const data = ref();
const selects = ref<any>([]);
const paginationConfig = reactive({
cacheSizeKey: 'container-volume-page-size',
currentPage: 1,
pageSize: 10,
total: 0,

View File

@ -183,6 +183,7 @@ const isRecordShow = ref();
const data = ref();
const paginationConfig = reactive({
cacheSizeKey: 'cronjob-page-size',
currentPage: 1,
pageSize: 10,
total: 0,

View File

@ -412,6 +412,11 @@ const delLoading = ref();
const cleanData = ref();
const acceptParams = async (params: DialogProps): Promise<void> => {
let itemSize = Number(localStorage.getItem(searchInfo.cacheSizeKey));
if (itemSize) {
searchInfo.pageSize = itemSize;
}
recordShow.value = true;
dialogData.value = params;
if (dialogData.value.rowData.type === 'database') {
@ -442,6 +447,7 @@ const acceptParams = async (params: DialogProps): Promise<void> => {
const handleSizeChange = (val: number) => {
searchInfo.pageSize = val;
localStorage.setItem(searchInfo.cacheSizeKey, val + '');
search();
};
const handleCurrentChange = (val: number) => {
@ -509,6 +515,7 @@ const timeRangeLoad = ref<[Date, Date]>([
new Date(new Date().setHours(23, 59, 59, 999)),
]);
const searchInfo = reactive({
cacheSizeKey: 'cronjob-record-page-size',
page: 1,
pageSize: 8,
recordTotal: 0,

View File

@ -267,6 +267,7 @@ const dialogPortJumpRef = ref();
const data = ref();
const paginationConfig = reactive({
cacheSizeKey: 'mysql-page-size',
currentPage: 1,
pageSize: 10,
total: 0,

View File

@ -106,6 +106,7 @@ const dialogRef = ref();
const data = ref();
const paginationConfig = reactive({
cacheSizeKey: 'mysql-remote-page-size',
currentPage: 1,
pageSize: 10,
total: 0,

View File

@ -158,6 +158,7 @@ const selects = ref<any>([]);
const currentRow = ref();
const confirmDialogRef = ref();
const paginationConfig = reactive({
cacheSizeKey: 'redis-backup-page-size',
currentPage: 1,
pageSize: 10,
total: 0,

View File

@ -276,6 +276,7 @@ const deleteRef = ref();
const { searchableStatus, searchablePath, searchableInputRef, searchableInputBlur } = useSearchable(paths);
const paginationConfig = reactive({
cacheSizeKey: 'file-page-size',
currentPage: 1,
pageSize: 100,
total: 0,

View File

@ -155,6 +155,7 @@ const fireStatuRef = ref();
const data = ref();
const paginationConfig = reactive({
cacheSizeKey: 'firewall-ip-page-size',
currentPage: 1,
pageSize: 10,
total: 0,

View File

@ -194,6 +194,7 @@ const fireStatuRef = ref();
const data = ref();
const paginationConfig = reactive({
cacheSizeKey: 'firewall-port-page-size',
currentPage: 1,
pageSize: 10,
total: 0,

View File

@ -93,6 +93,7 @@ import i18n from '@/lang';
const loading = ref();
const data = ref();
const paginationConfig = reactive({
cacheSizeKey: 'ssh-log-page-size',
currentPage: 1,
pageSize: 10,
total: 0,
@ -118,7 +119,7 @@ function select2address(): string {
const onDeny = async () => {
let address = select2address();
if (!address) return;
await operateIPRule({ operation: 'add', address: address, strategy: 'drop' }).then(() => {
await operateIPRule({ operation: 'add', address: address, strategy: 'drop', description: '' }).then(() => {
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
search();
});

View File

@ -90,6 +90,7 @@ const loading = ref();
const data = ref();
const selects = ref<any>([]);
const paginationConfig = reactive({
cacheSizeKey: 'terminal-command-page-size',
currentPage: 1,
pageSize: 10,
total: 0,

View File

@ -93,6 +93,7 @@ const data = ref();
const groupList = ref();
const selects = ref<any>([]);
const paginationConfig = reactive({
cacheSizeKey: 'terminal-host-page-size',
currentPage: 1,
pageSize: 10,
total: 0,

View File

@ -92,6 +92,7 @@ const loading = ref();
const data = ref();
const confirmDialogRef = ref();
const paginationConfig = reactive({
cacheSizeKey: 'login-log-page-size',
currentPage: 1,
pageSize: 10,
total: 0,

View File

@ -122,6 +122,7 @@ const loading = ref();
const data = ref();
const confirmDialogRef = ref();
const paginationConfig = reactive({
cacheSizeKey: 'operation-log-page-size',
currentPage: 1,
pageSize: 10,
total: 0,

View File

@ -164,6 +164,7 @@ const loading = ref(false);
const data = ref();
const selects = ref<any>([]);
const paginationConfig = reactive({
cacheSizeKey: 'snapshot-page-size',
currentPage: 1,
pageSize: 10,
total: 0,

View File

@ -80,6 +80,7 @@ import i18n from '@/lang';
import { useDeleteData } from '@/hooks/use-delete-data';
const paginationConfig = reactive({
cacheSizeKey: 'runtime-page-size',
currentPage: 1,
pageSize: 10,
total: 0,

View File

@ -35,6 +35,7 @@ let loading = ref(false);
let data = ref();
let createRef = ref();
const paginationConfig = reactive({
cacheSizeKey: 'acme-account-page-size',
currentPage: 1,
pageSize: 20,
total: 0,

View File

@ -38,6 +38,7 @@ import i18n from '@/lang';
import { useDeleteData } from '@/hooks/use-delete-data';
const paginationConfig = reactive({
cacheSizeKey: 'dns-account-page-size',
currentPage: 1,
pageSize: 20,
total: 0,

View File

@ -100,6 +100,7 @@ import { GlobalStore } from '@/store';
const globalStore = GlobalStore();
const paginationConfig = reactive({
cacheSizeKey: 'ssl-page-size',
currentPage: 1,
pageSize: 10,
total: 0,

View File

@ -246,6 +246,7 @@ let dateRefs: Map<number, any> = new Map();
let groups = ref<Group.GroupInfo[]>([]);
const paginationConfig = reactive({
cacheSizeKey: 'website-page-size',
currentPage: 1,
pageSize: 10,
total: 0,