merchant.data.ts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. no: [required],
  10. name: [required],
  11. shortName: [required],
  12. status: [required]
  13. })
  14. // CrudSchema
  15. const crudSchemas = reactive<CrudSchema[]>([
  16. {
  17. label: t('common.index'),
  18. field: 'id',
  19. type: 'index',
  20. form: {
  21. show: false
  22. },
  23. detail: {
  24. show: false
  25. }
  26. },
  27. {
  28. label: '商户号',
  29. field: 'no',
  30. search: {
  31. show: true
  32. }
  33. },
  34. {
  35. label: '商户全称',
  36. field: 'code',
  37. search: {
  38. show: true
  39. }
  40. },
  41. {
  42. label: '商户简称',
  43. field: 'shortName',
  44. search: {
  45. show: true
  46. }
  47. },
  48. {
  49. label: t('common.status'),
  50. field: 'status',
  51. dictType: DICT_TYPE.COMMON_STATUS,
  52. search: {
  53. show: true
  54. }
  55. },
  56. {
  57. label: t('form.remark'),
  58. field: 'remark',
  59. form: {
  60. component: 'Input',
  61. componentProps: {
  62. type: 'textarea',
  63. rows: 4
  64. },
  65. colProps: {
  66. span: 24
  67. }
  68. },
  69. table: {
  70. show: false
  71. }
  72. },
  73. {
  74. label: t('common.createTime'),
  75. field: 'createTime',
  76. form: {
  77. show: false
  78. },
  79. search: {
  80. show: true,
  81. component: 'DatePicker',
  82. componentProps: {
  83. type: 'datetimerange',
  84. valueFormat: 'YYYY-MM-DD HH:mm:ss',
  85. defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]
  86. }
  87. }
  88. },
  89. {
  90. label: t('table.action'),
  91. field: 'action',
  92. width: '240px',
  93. form: {
  94. show: false
  95. },
  96. detail: {
  97. show: false
  98. }
  99. }
  100. ])
  101. export const { allSchemas } = useCrudSchemas(crudSchemas)