app.data.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. status: [required],
  11. payNotifyUrl: [required],
  12. refundNotifyUrl: [required],
  13. merchantId: [required]
  14. })
  15. // CrudSchema
  16. const crudSchemas = reactive<CrudSchema[]>([
  17. {
  18. label: t('common.index'),
  19. field: 'id',
  20. type: 'index',
  21. form: {
  22. show: false
  23. },
  24. detail: {
  25. show: false
  26. }
  27. },
  28. {
  29. label: '应用名',
  30. field: 'name',
  31. search: {
  32. show: true
  33. }
  34. },
  35. {
  36. label: '商户名称',
  37. field: 'payMerchant',
  38. search: {
  39. show: true
  40. }
  41. },
  42. {
  43. label: t('common.status'),
  44. field: 'status',
  45. dictType: DICT_TYPE.COMMON_STATUS,
  46. dictClass: 'number',
  47. search: {
  48. show: true
  49. }
  50. },
  51. {
  52. label: t('common.createTime'),
  53. field: 'createTime',
  54. form: {
  55. show: false
  56. },
  57. search: {
  58. show: true,
  59. component: 'DatePicker',
  60. componentProps: {
  61. type: 'datetimerange',
  62. valueFormat: 'YYYY-MM-DD HH:mm:ss',
  63. defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]
  64. }
  65. }
  66. },
  67. {
  68. label: t('table.action'),
  69. field: 'action',
  70. width: '240px',
  71. form: {
  72. show: false
  73. },
  74. detail: {
  75. show: false
  76. }
  77. }
  78. ])
  79. export const { allSchemas } = useCrudSchemas(crudSchemas)