index.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import { defHttp } from '@/config/axios'
  2. import type { JobVO } from './types'
  3. // 任务列表
  4. export const getJobPageApi = ({ params }) => {
  5. return defHttp.get<PageResult<JobVO>>({ url: '/infra/job/page', params })
  6. }
  7. // 任务详情
  8. export const getJobApi = (id: number) => {
  9. return defHttp.get<JobVO>({ url: '/infra/job/get?id=' + id })
  10. }
  11. // 新增任务
  12. export const createJobApi = (params: JobVO) => {
  13. return defHttp.post({ url: '/infra/job/create', params })
  14. }
  15. // 修改定时任务调度
  16. export const updateJobApi = (params: JobVO) => {
  17. return defHttp.put({ url: '/infra/job/update', params })
  18. }
  19. // 删除定时任务调度
  20. export const deleteJobApi = (id: number) => {
  21. return defHttp.delete({ url: '/infra/job/delete?id=' + id })
  22. }
  23. // 导出定时任务调度
  24. export const exportJobApi = (params) => {
  25. return defHttp.get({
  26. url: '/infra/job/export-excel',
  27. params,
  28. responseType: 'blob'
  29. })
  30. }
  31. // 任务状态修改
  32. export const updateJobStatusApi = (id: number, status: number) => {
  33. const data = {
  34. id,
  35. status
  36. }
  37. return defHttp.put({ url: '/infra/job/update-status', data: data })
  38. }
  39. // 定时任务立即执行一次
  40. export const runJobApi = (id: number) => {
  41. return defHttp.put({ url: '/infra/job/trigger?id=' + id })
  42. }
  43. // 获得定时任务的下 n 次执行时间
  44. export const getJobNextTimesApi = (id: number) => {
  45. return defHttp.get({ url: '/infra/job/get_next_times?id=' + id })
  46. }