plm前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

129 lines
2.1 KiB

3 years ago
  1. import Mock from 'mockjs'
  2. // 生成数据列表
  3. var dataList = []
  4. for (let i = 0; i < Math.floor(Math.random() * 10 + 1); i++) {
  5. let name = Mock.Random.name()
  6. dataList.push(Mock.mock({
  7. 'jobId': '@increment',
  8. 'beanName': name,
  9. 'methodName': name,
  10. 'params': '-',
  11. 'cronExpression': '0 0/30 * * * ?',
  12. 'status': 1,
  13. 'remark': '@csentence',
  14. 'createTime': '@datetime'
  15. }))
  16. }
  17. // 获取定时任务列表
  18. export function list () {
  19. return {
  20. // isOpen: false,
  21. url: '/sys/schedule/list',
  22. type: 'get',
  23. data: {
  24. 'msg': 'success',
  25. 'code': 0,
  26. 'page': {
  27. 'totalCount': dataList.length,
  28. 'pageSize': 20,
  29. 'totalPage': 1,
  30. 'currPage': 1,
  31. 'list': dataList
  32. }
  33. }
  34. }
  35. }
  36. // 获取定时任务信息
  37. export function info () {
  38. return {
  39. // isOpen: false,
  40. url: '/sys/schedule/info',
  41. type: 'get',
  42. data: {
  43. 'msg': 'success',
  44. 'code': 0,
  45. 'user': dataList[0]
  46. }
  47. }
  48. }
  49. // 添加定时任务
  50. export function add () {
  51. return {
  52. // isOpen: false,
  53. url: '/sys/schedule/save',
  54. type: 'post',
  55. data: {
  56. 'msg': 'success',
  57. 'code': 0
  58. }
  59. }
  60. }
  61. // 修改定时任务
  62. export function update () {
  63. return {
  64. // isOpen: false,
  65. url: '/sys/schedule/update',
  66. type: 'post',
  67. data: {
  68. 'msg': 'success',
  69. 'code': 0
  70. }
  71. }
  72. }
  73. // 删除定时任务
  74. export function del () {
  75. return {
  76. // isOpen: false,
  77. url: '/sys/schedule/delete',
  78. type: 'post',
  79. data: {
  80. 'msg': 'success',
  81. 'code': 0
  82. }
  83. }
  84. }
  85. // 运行定时任务
  86. export function run () {
  87. return {
  88. // isOpen: false,
  89. url: '/sys/schedule/run',
  90. type: 'post',
  91. data: {
  92. 'msg': 'success',
  93. 'code': 0
  94. }
  95. }
  96. }
  97. // 暂停定时任务
  98. export function pause () {
  99. return {
  100. // isOpen: false,
  101. url: '/sys/schedule/pause',
  102. type: 'post',
  103. data: {
  104. 'msg': 'success',
  105. 'code': 0
  106. }
  107. }
  108. }
  109. // 恢复定时任务
  110. export function resume () {
  111. return {
  112. // isOpen: false,
  113. url: '/sys/schedule/resume',
  114. type: 'post',
  115. data: {
  116. 'msg': 'success',
  117. 'code': 0
  118. }
  119. }
  120. }