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,