From 9c36a7202d2f48a5bb83c2ec9989a4b52e687972 Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Wed, 10 Apr 2024 13:27:18 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=87=E6=A1=A3=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/components/app-table/index.vue | 12 +++++++- ui/src/stores/modules/common.ts | 7 ++--- ui/src/views/document/index.vue | 40 +++++++++++++++++++++------ 3 files changed, 46 insertions(+), 13 deletions(-) diff --git a/ui/src/components/app-table/index.vue b/ui/src/components/app-table/index.vue index 693ca395c..eac075a76 100644 --- a/ui/src/components/app-table/index.vue +++ b/ui/src/components/app-table/index.vue @@ -46,6 +46,9 @@ import { ref, nextTick, watch, computed, onMounted } from 'vue' import { MsgError } from '@/utils/message' defineOptions({ name: 'AppTable' }) +import useStore from '@/stores' +const { common } = useStore() + const props = defineProps({ paginationConfig: { type: Object, @@ -66,7 +69,8 @@ const props = defineProps({ quickCreateMaxlength: { type: Number, default: () => 0 - } + }, + storeKey: String }) const emit = defineEmits(['changePage', 'sizeChange', 'creatQuick']) @@ -109,9 +113,15 @@ function quickCreateHandel() { function handleSizeChange() { emit('sizeChange') + if (props.storeKey) { + common.savePage(props.storeKey, props.paginationConfig) + } } function handleCurrentChange() { emit('changePage') + if (props.storeKey) { + common.savePage(props.storeKey, props.paginationConfig) + } } defineExpose({}) diff --git a/ui/src/stores/modules/common.ts b/ui/src/stores/modules/common.ts index 2f36c6730..606d574f0 100644 --- a/ui/src/stores/modules/common.ts +++ b/ui/src/stores/modules/common.ts @@ -1,5 +1,4 @@ import { defineStore } from 'pinia' -import type { pageRequest } from '@/api/type/common' export interface commonTypes { breadcrumb: any @@ -12,14 +11,14 @@ const useCommonStore = defineStore({ state: (): commonTypes => ({ breadcrumb: null, // 搜索和分页缓存 - paginationConfig: null, - search: null + paginationConfig: {}, + search: {} }), actions: { saveBreadcrumb(data: any) { this.breadcrumb = data }, - savePage(val: string, data: pageRequest) { + savePage(val: string, data: any) { this.paginationConfig[val] = data }, saveCondition(val: string, data: any) { diff --git a/ui/src/views/document/index.vue b/ui/src/views/document/index.vue index d0611a5f5..027cc4875 100644 --- a/ui/src/views/document/index.vue +++ b/ui/src/views/document/index.vue @@ -48,6 +48,7 @@ @selection-change="handleSelectionChange" v-loading="loading" :row-key="(row: any) => row.id" + :storeKey="storeKey" > @@ -156,8 +157,8 @@