1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
| import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
| import { dateFormatter2 } from '@/utils/formatTime'
|
| // TODO @zhangshai:
| // 表单校验
| export const rules = reactive({
| spuId: [required],
| name: [required],
| startTime: [required],
| endTime: [required],
| discountType: [required]
| })
|
| // CrudSchema https://doc.iocoder.cn/vue3/crud-schema/
| const crudSchemas = reactive<CrudSchema[]>([
| {
| label: '活动名称',
| field: 'name',
| isSearch: true,
| form: {
| colProps: {
| span: 24
| }
| },
| table: {
| width: 120
| }
| },
| {
| label: '活动开始时间',
| field: 'startTime',
| formatter: dateFormatter2,
| isSearch: true,
| search: {
| component: 'DatePicker',
| componentProps: {
| valueFormat: 'YYYY-MM-DD',
| type: 'daterange'
| }
| },
| form: {
| component: 'DatePicker',
| componentProps: {
| type: 'date',
| valueFormat: 'x'
| }
| },
| table: {
| width: 120
| }
| },
| {
| label: '活动结束时间',
| field: 'endTime',
| formatter: dateFormatter2,
| isSearch: true,
| search: {
| component: 'DatePicker',
| componentProps: {
| valueFormat: 'YYYY-MM-DD',
| type: 'daterange'
| }
| },
| form: {
| component: 'DatePicker',
| componentProps: {
| type: 'date',
| valueFormat: 'x'
| }
| },
| table: {
| width: 120
| }
| },
| {
| label: '优惠类型',
| field: 'discountType',
| dictType: DICT_TYPE.PROMOTION_DISCOUNT_TYPE,
| dictClass: 'number',
| isSearch: true,
| form: {
| component: 'Radio',
| value: 1
| }
| },
| {
| label: '活动商品',
| field: 'spuId',
| isTable: true,
| isSearch: false,
| form: {
| colProps: {
| span: 24
| }
| },
| table: {
| width: 300
| }
| },
| {
| label: '备注',
| field: 'remark',
| isSearch: false,
| form: {
| component: 'Input',
| componentProps: {
| type: 'textarea',
| rows: 4
| },
| colProps: {
| span: 24
| }
| },
| table: {
| width: 300
| }
| }
| ])
| export const { allSchemas } = useCrudSchemas(crudSchemas)
|
|