job.data.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import { reactive } from 'vue'
  2. import { DICT_TYPE } from '@/utils/dict'
  3. import { required } from '@/utils/formRules'
  4. import { useI18n } from '@/hooks/web/useI18n'
  5. import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
  6. const { t } = useI18n() // 国际化
  7. // 表单校验
  8. export const rules = reactive({
  9. name: [required],
  10. handlerName: [required],
  11. cronExpression: [required],
  12. retryCount: [required],
  13. retryInterval: [required]
  14. })
  15. // CrudSchema
  16. const crudSchemas = reactive<VxeCrudSchema>({
  17. primaryKey: 'id',
  18. primaryType: 'seq',
  19. primaryTitle: '任务编号',
  20. action: true,
  21. actionWidth: '500px',
  22. columns: [
  23. {
  24. title: '任务名称',
  25. field: 'name',
  26. search: {
  27. show: true
  28. }
  29. },
  30. {
  31. title: t('common.status'),
  32. field: 'status',
  33. dictType: DICT_TYPE.INFRA_JOB_STATUS,
  34. dictClass: 'number',
  35. isForm: false
  36. },
  37. {
  38. title: '处理器的名字',
  39. field: 'handlerName',
  40. isSearch: true
  41. },
  42. {
  43. title: '处理器的参数',
  44. field: 'handlerParam',
  45. isTable: false
  46. },
  47. {
  48. title: 'CRON 表达式',
  49. field: 'cronExpression'
  50. },
  51. {
  52. title: '后续执行时间',
  53. field: 'nextTimes',
  54. isTable: false,
  55. isForm: false
  56. },
  57. {
  58. title: '重试次数',
  59. field: 'retryCount',
  60. isTable: false
  61. },
  62. {
  63. title: '重试间隔',
  64. field: 'retryInterval',
  65. isTable: false
  66. },
  67. {
  68. title: '监控超时时间',
  69. field: 'monitorTimeout',
  70. isTable: false
  71. }
  72. ]
  73. })
  74. export const { allSchemas } = useVxeCrudSchemas(crudSchemas)