form.data.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. import { DICT_TYPE } from '@/utils/dict'
  6. const { t } = useI18n() // 国际化
  7. // 表单校验
  8. export const rules = reactive({
  9. name: [required]
  10. })
  11. // CrudSchema
  12. const crudSchemas = reactive<CrudSchema[]>([
  13. {
  14. label: t('common.index'),
  15. field: 'id',
  16. type: 'index',
  17. form: {
  18. show: false
  19. },
  20. detail: {
  21. show: false
  22. }
  23. },
  24. {
  25. label: '表单名',
  26. field: 'name',
  27. search: {
  28. show: true
  29. }
  30. },
  31. {
  32. label: t('common.status'),
  33. field: 'status',
  34. dictType: DICT_TYPE.COMMON_STATUS,
  35. dictClass: 'number'
  36. },
  37. {
  38. label: '备注',
  39. field: 'remark'
  40. },
  41. {
  42. label: t('common.createTime'),
  43. field: 'createTime',
  44. form: {
  45. show: false
  46. }
  47. },
  48. {
  49. label: t('table.action'),
  50. field: 'action',
  51. width: '240px',
  52. form: {
  53. show: false
  54. },
  55. detail: {
  56. show: false
  57. }
  58. }
  59. ])
  60. export const { allSchemas } = useCrudSchemas(crudSchemas)