From 8655dfc12d0b7af5e453795dbbf479a400936081 Mon Sep 17 00:00:00 2001 From: nili Date: Thu, 7 Apr 2022 13:17:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E4=BA=9B=E7=AD=9B=E9=80=89=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/PoemPage/index.tsx | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/pages/PoemPage/index.tsx b/src/pages/PoemPage/index.tsx index 2fe85c9..033a9c7 100644 --- a/src/pages/PoemPage/index.tsx +++ b/src/pages/PoemPage/index.tsx @@ -12,13 +12,11 @@ const columns: ProColumns[] = [ { dataIndex: 'id', title: 'id', - hideInSearch: true, }, { title: '标题', dataIndex: 'title', ellipsis: true, - hideInSearch: true, tip: '标题过长会自动收缩', formItemProps: { rules: [ @@ -51,7 +49,7 @@ const columns: ProColumns[] = [ }, { title: '作者', - dataIndex: 'author', + dataIndex: 'authorId', hideInTable: true, formItemProps: { rules: [ @@ -79,7 +77,7 @@ const columns: ProColumns[] = [ />, { await savePoemUsingPOST({ id: record.id, status: -1 }); action?.reload(); @@ -91,7 +89,7 @@ const columns: ProColumns[] = [ , { await savePoemUsingPOST({ id: record.id, status: record.status == 0 ? 1 : 0 }); action?.reload(); @@ -115,16 +113,13 @@ export default () => { cardBordered request={async (params = {}) => { const query: API.QueryParam[] = []; - if (params.author) { - let author = params.author; - if (typeof params.author == 'string') { - author = JSON.parse(params.author); + const allowedKey = ['authorId', 'title', 'status', 'id']; + Object.keys(params).forEach((x) => { + if (allowedKey.includes(x) && params[x]) { + query.push({ key: x, val: params[x] }); } - query.push({ key: 'authorId', val: author }); - } - if (params.status) { - query.push({ key: 'status', val: params.status }); - } + }); + const response = await poemListUsingPOST({ current: params.current, pageSize: params.pageSize,