codegen.data.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import { reactive } from 'vue'
  2. import { useI18n } from '@/hooks/web/useI18n'
  3. import { required } from '@/utils/formRules'
  4. import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
  5. const { t } = useI18n() // 国际化
  6. // 表单校验
  7. export const rules = reactive({
  8. title: [required],
  9. type: [required],
  10. status: [required]
  11. })
  12. // CrudSchema
  13. const crudSchemas = reactive<CrudSchema[]>([
  14. {
  15. label: t('common.index'),
  16. field: 'id',
  17. type: 'index',
  18. form: {
  19. show: false
  20. },
  21. detail: {
  22. show: false
  23. }
  24. },
  25. {
  26. label: '表名称',
  27. field: 'tableName',
  28. search: {
  29. show: true
  30. }
  31. },
  32. {
  33. label: '表描述',
  34. field: 'tableComment',
  35. search: {
  36. show: true
  37. }
  38. },
  39. {
  40. label: '实体',
  41. field: 'className',
  42. search: {
  43. show: true
  44. }
  45. },
  46. {
  47. label: t('common.createTime'),
  48. field: 'createTime',
  49. form: {
  50. show: false
  51. },
  52. search: {
  53. show: true,
  54. component: 'DatePicker',
  55. componentProps: {
  56. type: 'datetimerange',
  57. valueFormat: 'YYYY-MM-DD HH:mm:ss',
  58. defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]
  59. }
  60. }
  61. },
  62. {
  63. label: t('common.updateTime'),
  64. field: 'updateTime',
  65. form: {
  66. show: false
  67. }
  68. },
  69. {
  70. label: t('table.action'),
  71. field: 'action',
  72. width: '500px',
  73. form: {
  74. show: false
  75. },
  76. detail: {
  77. show: false
  78. }
  79. }
  80. ])
  81. export const { allSchemas } = useCrudSchemas(crudSchemas)