修改定时任务支持的排序顺序

This commit is contained in:
whyour 2025-11-11 01:02:36 +08:00
parent 1deb264913
commit 8fdc69421c

View File

@ -247,8 +247,8 @@ const Crontab = () => {
> >
{record.last_execution_time {record.last_execution_time
? dayjs(record.last_execution_time * 1000).format( ? dayjs(record.last_execution_time * 1000).format(
'YYYY-MM-DD HH:mm:ss', 'YYYY-MM-DD HH:mm:ss',
) )
: '-'} : '-'}
</span> </span>
); );
@ -361,11 +361,10 @@ const Crontab = () => {
const getCrons = () => { const getCrons = () => {
setLoading(true); setLoading(true);
const { page, size, sorter, filters } = pageConf; const { page, size, sorter, filters } = pageConf;
let url = `${ let url = `${config.apiPrefix
config.apiPrefix }crons?searchValue=${searchText}&page=${page}&size=${size}&filters=${JSON.stringify(
}crons?searchValue=${searchText}&page=${page}&size=${size}&filters=${JSON.stringify( filters,
filters, )}`;
)}`;
if (sorter && sorter.column && sorter.order) { if (sorter && sorter.column && sorter.order) {
url += `&sorter=${JSON.stringify({ url += `&sorter=${JSON.stringify({
field: sorter.column.key, field: sorter.column.key,
@ -523,9 +522,8 @@ const Crontab = () => {
const enabledOrDisabledCron = (record: any, index: number) => { const enabledOrDisabledCron = (record: any, index: number) => {
Modal.confirm({ Modal.confirm({
title: `确认${ title: `确认${record.isDisabled === 1 ? intl.get('启用') : intl.get('禁用')
record.isDisabled === 1 ? intl.get('启用') : intl.get('禁用') }`,
}`,
content: ( content: (
<> <>
{intl.get('确认')} {intl.get('确认')}
@ -540,8 +538,7 @@ const Crontab = () => {
onOk() { onOk() {
request request
.put( .put(
`${config.apiPrefix}crons/${ `${config.apiPrefix}crons/${record.isDisabled === 1 ? 'enable' : 'disable'
record.isDisabled === 1 ? 'enable' : 'disable'
}`, }`,
[record.id], [record.id],
) )
@ -565,9 +562,8 @@ const Crontab = () => {
const pinOrUnPinCron = (record: any, index: number) => { const pinOrUnPinCron = (record: any, index: number) => {
Modal.confirm({ Modal.confirm({
title: `确认${ title: `确认${record.isPinned === 1 ? intl.get('取消置顶') : intl.get('置顶')
record.isPinned === 1 ? intl.get('取消置顶') : intl.get('置顶') }`,
}`,
content: ( content: (
<> <>
{intl.get('确认')} {intl.get('确认')}
@ -582,8 +578,7 @@ const Crontab = () => {
onOk() { onOk() {
request request
.put( .put(
`${config.apiPrefix}crons/${ `${config.apiPrefix}crons/${record.isPinned === 1 ? 'unpin' : 'pin'
record.isPinned === 1 ? 'unpin' : 'pin'
}`, }`,
[record.id], [record.id],
) )
@ -1014,6 +1009,7 @@ const Crontab = () => {
)} )}
<Table <Table
columns={columns} columns={columns}
sortDirections={['descend', 'ascend']}
pagination={{ pagination={{
current: pageConf.page, current: pageConf.page,
pageSize: pageConf.size, pageSize: pageConf.size,