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 @@