combinationActivity.data.ts 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
  2. import { dateFormatter2 } from '@/utils/formatTime'
  3. // 表单校验
  4. export const rules = reactive({
  5. name: [required],
  6. totalLimitCount: [required],
  7. singleLimitCount: [required],
  8. startTime: [required],
  9. endTime: [required],
  10. userSize: [required],
  11. limitDuration: [required]
  12. })
  13. // CrudSchema https://doc.iocoder.cn/vue3/crud-schema/
  14. const crudSchemas = reactive<CrudSchema[]>([
  15. {
  16. label: '拼团名称',
  17. field: 'name',
  18. isSearch: true,
  19. isTable: false,
  20. form: {
  21. colProps: {
  22. span: 24
  23. }
  24. }
  25. },
  26. {
  27. label: '活动开始时间',
  28. field: 'startTime',
  29. formatter: dateFormatter2,
  30. isSearch: true,
  31. search: {
  32. component: 'DatePicker',
  33. componentProps: {
  34. valueFormat: 'YYYY-MM-DD',
  35. type: 'daterange'
  36. }
  37. },
  38. form: {
  39. component: 'DatePicker',
  40. componentProps: {
  41. type: 'date',
  42. valueFormat: 'x'
  43. }
  44. },
  45. table: {
  46. width: 120
  47. }
  48. },
  49. {
  50. label: '活动结束时间',
  51. field: 'endTime',
  52. formatter: dateFormatter2,
  53. isSearch: true,
  54. search: {
  55. component: 'DatePicker',
  56. componentProps: {
  57. valueFormat: 'YYYY-MM-DD',
  58. type: 'daterange'
  59. }
  60. },
  61. form: {
  62. component: 'DatePicker',
  63. componentProps: {
  64. type: 'date',
  65. valueFormat: 'x'
  66. }
  67. },
  68. table: {
  69. width: 120
  70. }
  71. },
  72. {
  73. label: '参与人数',
  74. field: 'userSize',
  75. isSearch: false,
  76. form: {
  77. component: 'InputNumber',
  78. labelMessage: '参与人数不能少于两人',
  79. value: 2
  80. }
  81. },
  82. {
  83. label: '限制时长',
  84. field: 'limitDuration',
  85. isSearch: false,
  86. isTable: false,
  87. form: {
  88. component: 'InputNumber',
  89. labelMessage: '限制时长(小时)',
  90. componentProps: {
  91. placeholder: '请输入限制时长(小时)'
  92. }
  93. }
  94. },
  95. {
  96. label: '总限购数量',
  97. field: 'totalLimitCount',
  98. isSearch: false,
  99. isTable: false,
  100. form: {
  101. component: 'InputNumber',
  102. value: 0
  103. }
  104. },
  105. {
  106. label: '单次限购数量',
  107. field: 'singleLimitCount',
  108. isSearch: false,
  109. isTable: false,
  110. form: {
  111. component: 'InputNumber',
  112. value: 0
  113. }
  114. },
  115. {
  116. label: '购买人数',
  117. field: 'userSize',
  118. isSearch: false,
  119. isForm: false
  120. },
  121. {
  122. label: '开团组数',
  123. field: 'totalCount',
  124. isSearch: false,
  125. isForm: false
  126. },
  127. {
  128. label: '成团组数',
  129. field: 'successCount',
  130. isSearch: false,
  131. isForm: false
  132. },
  133. {
  134. label: '活动状态',
  135. field: 'status',
  136. dictType: DICT_TYPE.COMMON_STATUS,
  137. dictClass: 'number',
  138. isSearch: true,
  139. isForm: false
  140. },
  141. {
  142. label: '拼团商品',
  143. field: 'spuId',
  144. isSearch: false,
  145. form: {
  146. colProps: {
  147. span: 24
  148. }
  149. }
  150. },
  151. {
  152. label: '操作',
  153. field: 'action',
  154. isForm: false
  155. }
  156. ])
  157. export const { allSchemas } = useCrudSchemas(crudSchemas)