From 8702f3f542a898a0d4298def19898c7716d29084 Mon Sep 17 00:00:00 2001 From: xlsea Date: Tue, 4 Jun 2024 15:24:16 +0800 Subject: [PATCH] =?UTF-8?q?fix(sj=5F1.0.0=5Fbeta4):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E6=90=9C=E7=B4=A2=E5=88=86=E9=A1=B5=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/search-form.vue | 4 +++- src/hooks/common/table.ts | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/common/search-form.vue b/src/components/common/search-form.vue index 615347b..16ef179 100644 --- a/src/components/common/search-form.vue +++ b/src/components/common/search-form.vue @@ -12,7 +12,7 @@ interface Props { model: Record; } -defineProps(); +const props = defineProps(); interface Emits { (e: 'reset'): void; @@ -29,11 +29,13 @@ const { formRef, validate, restoreValidation } = useNaiveForm(); async function reset() { await restoreValidation(); + Object.assign(props.model, { ...props.model, page: 1 }); emit('reset'); } async function search() { await validate(); + Object.assign(props.model, { ...props.model, page: 1 }); emit('search'); } diff --git a/src/hooks/common/table.ts b/src/hooks/common/table.ts index 74a11f2..962deaf 100644 --- a/src/hooks/common/table.ts +++ b/src/hooks/common/table.ts @@ -32,7 +32,7 @@ export function useTable(config: NaiveUI.NaiveTabl getData, searchParams, updateSearchParams, - resetSearchParams + resetSearchParams: resetSearchParams0 } = useHookTable, TableColumn>>>({ apiFn, apiParams, @@ -172,6 +172,11 @@ export function useTable(config: NaiveUI.NaiveTabl scope.stop(); }); + const resetSearchParams = () => { + resetSearchParams0(); + getData(); + }; + return { loading, empty,