sjsbTask.js 1.54 KB
/*
 * @Description  :定时任务api文件
 * @Autor        : miaofang
 * @LastEditTime : 2023-05-17 16:40:57
 */
import request from '@/utils/request'
let SERVER = window.config ? window.config : JSON.parse(localStorage.getItem('ApiUrl'))

class sjsbTask {
  // 定时任务
  // 定时任务查询接口
  async getTaskListByName (data) {
    return request({
      url: SERVER.SERVERAPI + '/rest/schedule/getScheduleList',
      method: 'get',
      params: {
        jobName: data.jobName,
        pageNo: data.currentPage,
        pageSize: data.pageSize
      }
    })
  }
  // 定时任务新增接口
  async sjsbTaskSave (data) {
    return request({
      url: SERVER.SERVERAPI + '/rest/schedule/add',
      method: 'post',
      data
    })
  }
  // 修改定时任务执行时间接口
  async updateCron (data) {
    return request({
      url: SERVER.SERVERAPI + '/rest/schedule/update',
      method: 'post',
      data
    })
  }
  // 定时任务删除接口
  async sjsbTaskRemove (id) {
    return request({
      url: SERVER.SERVERAPI + '/rest/schedule/delete',
      method: 'get',
      params: {
        jobId: id
      }
    })
  }
  // 恢复任务接口
  async recover (id) {
    return request({
      url: SERVER.SERVERAPI + '/rest/schedule/recover',
      method: 'get',
      params: {
        jobId: id
      }
    })
  }
  // 激活任务接口
  async active (id) {
    return request({
      url: SERVER.SERVERAPI + '/rest/schedule/active',
      method: 'get',
      params: {
        jobId: id
      }
    })
  }
}
export default new sjsbTask()