
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
// 新增定时任务
export const addTask = (data: any): AxiosPromise<any> => {
    return request({
        method: 'post',
        url: '/dispatch/task/add',
        data: data
    });
};

// 编辑定时任务
export const editTask = (data: any): AxiosPromise<any> => {
    return request({
        method: 'post',
        url: '/dispatch/task/edit',
        data: data
    });
};

// 删除定时任务
export const deleteTask = (id: string): AxiosPromise<any> => {

    return request({
        method: 'post',
        url: '/dispatch/task/delete',
        data: {keyId:id}
    });
};

// 暂停定时任务
export const pauseTask = (data: any): AxiosPromise<any> => {
    return request({
        method: 'post',
        url: '/dispatch/task/pause',
        data: data
    });
};

// 重启定时任务
export const resumeTask = (data: any): AxiosPromise<any> => {
    return request({
        method: 'post',
        url: '/dispatch/task/resume',
        data: data
    });
};

// 立即执行定时任务
export const triggerTask = (data: any): AxiosPromise<any> => {
    return request({
        method: 'post',
        url: '/dispatch/task/trigger',
        data: data
    });
};

// 分页获取定时任务
export const taskList = (data: any): AxiosPromise<any> => {
		return request({
			method:'post',
			url:'/dispatch/task/list',
			data:data
		})
}
