job.data.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. action: true,
  20. actionWidth: '500px',
  21. columns: [
  22. {
  23. title: '任务名称',
  24. field: 'name',
  25. search: {
  26. show: true
  27. }
  28. },
  29. {
  30. title: t('common.status'),
  31. field: 'status',
  32. dictType: DICT_TYPE.INFRA_JOB_STATUS,
  33. dictClass: 'number',
  34. isForm: false
  35. },
  36. {
  37. title: '处理器的名字',
  38. field: 'handlerName',
  39. isSearch: true
  40. },
  41. {
  42. title: '处理器的参数',
  43. field: 'handlerParam',
  44. isTable: false
  45. },
  46. {
  47. title: 'CRON 表达式',
  48. field: 'cronExpression'
  49. },
  50. {
  51. title: '重试次数',
  52. field: 'retryCount',
  53. isTable: false
  54. },
  55. {
  56. title: '重试间隔',
  57. field: 'retryInterval',
  58. isTable: false
  59. },
  60. {
  61. title: '监控超时时间',
  62. field: 'monitorTimeout',
  63. isTable: false
  64. }
  65. ]
  66. })
  67. export const { allSchemas } = useVxeCrudSchemas(crudSchemas)