From e07236ed1c8d03f0f2e36468af5345380a4c6542 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Thu, 5 Oct 2023 01:42:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E2=80=9C=E5=B2=97?= =?UTF-8?q?=E4=BD=8D=E7=AE=A1=E7=90=86=E2=80=9D-=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E9=87=8D=E7=BD=AE=E3=80=81=E6=9F=A5=E8=AF=A2=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E6=97=B6=E8=AE=BE=E7=BD=AE=E8=A1=A8=E6=A0=BC=E5=88=B0=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E6=8E=92=E5=BA=8F=EF=BC=8C=E5=B9=B6=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E6=95=B0=E6=8D=AE=EF=BC=8C=E4=BD=BF=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E4=B8=8A=E7=9A=84=E5=88=97=E6=8E=92=E5=BA=8F=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E4=BF=9D=E6=8C=81=E2=80=9C=E9=BB=98=E8=AE=A4=3D?= =?UTF-8?q?=E5=B2=97=E4=BD=8D=E7=BC=96=E7=A0=81=E5=8D=87=E5=BA=8F=E2=80=9D?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/post/utils/hook.tsx | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/views/system/post/utils/hook.tsx b/src/views/system/post/utils/hook.tsx index 264c9fe..ca20ec7 100644 --- a/src/views/system/post/utils/hook.tsx +++ b/src/views/system/post/utils/hook.tsx @@ -121,21 +121,14 @@ export function usePostHook() { } async function onSearch(tableRef) { - // 点击搜索的时候,需要重置分页 - pagination.currentPage = 1; - // 点击搜索的时候,需要清空表格上列的排序 - tableRef.getTableRef().clearSort(); - // 使用默认排序发起请求 - getPostList(); + // 点击搜索的时候,需要重置排序,重新排序的时候会重置分页并发起查询请求 + tableRef.getTableRef().sort("postSort", "ascending"); } function resetForm(formEl, tableRef) { if (!formEl) return; // 清空查询参数 formEl.resetFields(); - // 清空排序 - searchFormParams.orderColumn = undefined; - searchFormParams.orderDirection = undefined; // 清空时间查询 TODO 这块有点繁琐 有可以优化的地方吗? // Form组件的resetFields方法无法清除datepicker里面的数据。 searchFormParams.beginTime = undefined;