sjsbTask.js 1.95 KB
/*
 * @Description  :定时任务的相关api文件
 * @Autor        : miaofang
 * @LastEditTime : 2023-05-17 10:53:00
 */
import request from '@/utils/request'
let SERVER = window.config ? window.config : JSON.parse(localStorage.getItem('ApiUrl'))

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