定时任务支持复制

This commit is contained in:
whyour 2024-09-24 23:33:04 +08:00
parent 4c5223ba11
commit 418695c4aa
2 changed files with 10 additions and 5 deletions

View File

@ -36,6 +36,7 @@ import {
PlusOutlined,
UnorderedListOutlined,
CheckOutlined,
CopyOutlined,
} from '@ant-design/icons';
import config from '@/utils/config';
import { PageContainer } from '@ant-design/pro-layout';
@ -57,7 +58,7 @@ import { useVT } from 'virtualizedtableforantd4';
import { ICrontab, OperationName, OperationPath, CrontabStatus } from './type';
import Name from '@/components/name';
import dayjs from 'dayjs';
import { noop } from 'lodash';
import { noop, omit } from 'lodash';
const { Text, Paragraph, Link } = Typography;
const { Search } = Input;
@ -620,6 +621,7 @@ const Crontab = () => {
icon:
record.isDisabled === 1 ? <CheckCircleOutlined /> : <StopOutlined />,
},
{ label: intl.get('复制'), key: 'copy', icon: <CopyOutlined /> },
{ label: intl.get('删除'), key: 'delete', icon: <DeleteOutlined /> },
{
label: record.isPinned === 1 ? intl.get('取消置顶') : intl.get('置顶'),
@ -655,6 +657,9 @@ const Crontab = () => {
case 'edit':
editCron(record, index);
break;
case 'copy':
editCron(omit(record, 'id'), index);
break;
case 'enableOrDisable':
enabledOrDisabledCron(record, index);
break;

View File

@ -21,9 +21,9 @@ const CronModal = ({
const handleOk = async (values: any) => {
setLoading(true);
const method = cron ? 'put' : 'post';
const method = cron?.id ? 'put' : 'post';
const payload = { ...values };
if (cron) {
if (cron?.id) {
payload.id = cron.id;
}
try {
@ -34,7 +34,7 @@ const CronModal = ({
if (code === 200) {
message.success(
cron ? intl.get('更新任务成功') : intl.get('创建任务成功'),
cron?.id ? intl.get('更新任务成功') : intl.get('创建任务成功'),
);
handleCancel(data);
}
@ -50,7 +50,7 @@ const CronModal = ({
return (
<Modal
title={cron ? intl.get('编辑任务') : intl.get('创建任务')}
title={cron?.id ? intl.get('编辑任务') : intl.get('创建任务')}
open={visible}
forceRender
centered