|
|
@ -12,13 +12,11 @@ const columns: ProColumns<API.PoemBo>[] = [ |
|
|
|
{ |
|
|
|
dataIndex: 'id', |
|
|
|
title: 'id', |
|
|
|
hideInSearch: true, |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '标题', |
|
|
|
dataIndex: 'title', |
|
|
|
ellipsis: true, |
|
|
|
hideInSearch: true, |
|
|
|
tip: '标题过长会自动收缩', |
|
|
|
formItemProps: { |
|
|
|
rules: [ |
|
|
@ -51,7 +49,7 @@ const columns: ProColumns<API.PoemBo>[] = [ |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '作者', |
|
|
|
dataIndex: 'author', |
|
|
|
dataIndex: 'authorId', |
|
|
|
hideInTable: true, |
|
|
|
formItemProps: { |
|
|
|
rules: [ |
|
|
@ -79,7 +77,7 @@ const columns: ProColumns<API.PoemBo>[] = [ |
|
|
|
/>, |
|
|
|
<Popconfirm |
|
|
|
title="确定删除吗?" |
|
|
|
key={record.id} |
|
|
|
key={'delete' + record.id} |
|
|
|
onConfirm={async () => { |
|
|
|
await savePoemUsingPOST({ id: record.id, status: -1 }); |
|
|
|
action?.reload(); |
|
|
@ -91,7 +89,7 @@ const columns: ProColumns<API.PoemBo>[] = [ |
|
|
|
</Popconfirm>, |
|
|
|
<Popconfirm |
|
|
|
title="确定标记吗?" |
|
|
|
key={record.id} |
|
|
|
key={'mark_' + record.id} |
|
|
|
onConfirm={async () => { |
|
|
|
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, |
|
|
|