修改定时任务pageSize,增加全部展示为一页

This commit is contained in:
whyour 2022-08-25 23:12:12 +08:00
parent 3e88314d0a
commit bc281ee4d7

View File

@ -122,7 +122,7 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => {
</> </>
), ),
sorter: { sorter: {
compare: (a: any, b: any) => a.name.localeCompare(b.name), compare: (a: any, b: any) => a?.name?.localeCompare(b?.name),
multiple: 2, multiple: 2,
}, },
}, },
@ -382,31 +382,15 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => {
.then((_data: any) => { .then((_data: any) => {
const { data, total } = _data.data; const { data, total } = _data.data;
setValue( setValue(
data data.map((x) => {
.sort((a: any, b: any) => { return {
const sortA = ...x,
a.isPinned && a.status !== 0 nextRunTime: cron_parser
? 5 .parseExpression(x.schedule)
: a.isDisabled && a.status !== 0 .next()
? 4 .toDate(),
: a.status; };
const sortB = }),
b.isPinned && b.status !== 0
? 5
: b.isDisabled && b.status !== 0
? 4
: b.status;
return CrontabSort[sortA] - CrontabSort[sortB];
})
.map((x) => {
return {
...x,
nextRunTime: cron_parser
.parseExpression(x.schedule)
.next()
.toDate(),
};
}),
); );
setTotal(total); setTotal(total);
}) })
@ -748,11 +732,6 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => {
const rowSelection = { const rowSelection = {
selectedRowIds, selectedRowIds,
onChange: onSelectChange, onChange: onSelectChange,
selections: [
Table.SELECTION_ALL,
Table.SELECTION_INVERT,
Table.SELECTION_NONE,
],
}; };
const delCrons = () => { const delCrons = () => {
@ -927,7 +906,9 @@ const Crontab = ({ headerStyle, isPhone, theme }: any) => {
total, total,
showTotal: (total: number, range: number[]) => showTotal: (total: number, range: number[]) =>
`${range[0]}-${range[1]} 条/总共 ${total}`, `${range[0]}-${range[1]} 条/总共 ${total}`,
pageSizeOptions: [20, 100, 500, 1000] as any, pageSizeOptions: [10, 20, 50, 100, 200, 500, total || 10000].sort(
(a, b) => a - b,
),
}} }}
onRow={(record) => { onRow={(record) => {
return { return {