job.data.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
  6. // 国际化
  7. const { t } = useI18n()
  8. // 表单校验
  9. export const rules = reactive({
  10. name: [required],
  11. handlerName: [required],
  12. cronExpression: [required],
  13. retryCount: [required],
  14. retryInterval: [required]
  15. })
  16. // CrudSchema
  17. const crudSchemas = reactive<CrudSchema[]>([
  18. {
  19. label: t('common.index'),
  20. field: 'id',
  21. type: 'index',
  22. form: {
  23. show: false
  24. },
  25. detail: {
  26. show: false
  27. }
  28. },
  29. {
  30. label: '任务名称',
  31. field: 'name',
  32. search: {
  33. show: true
  34. }
  35. },
  36. {
  37. label: t('common.status'),
  38. field: 'status',
  39. dictType: DICT_TYPE.INFRA_JOB_STATUS
  40. },
  41. {
  42. label: '处理器的名字',
  43. field: 'handlerName',
  44. search: {
  45. show: true
  46. }
  47. },
  48. {
  49. label: '处理器的参数',
  50. field: 'handlerParam',
  51. table: {
  52. show: false
  53. }
  54. },
  55. {
  56. label: 'CRON 表达式',
  57. field: 'cronExpression'
  58. },
  59. {
  60. label: '重试次数',
  61. field: 'retryCount',
  62. table: {
  63. show: false
  64. }
  65. },
  66. {
  67. label: '重试间隔',
  68. field: 'retryInterval',
  69. table: {
  70. show: false
  71. }
  72. },
  73. {
  74. label: '监控超时时间',
  75. field: 'monitorTimeout',
  76. table: {
  77. show: false
  78. }
  79. },
  80. {
  81. field: 'action',
  82. width: '500px',
  83. label: t('table.action'),
  84. form: {
  85. show: false
  86. },
  87. detail: {
  88. show: false
  89. }
  90. }
  91. ])
  92. export const { allSchemas } = useCrudSchemas(crudSchemas)