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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
| import type { FormSchemaGetter } from '#/adapter/form';
|
| import { getPopupContainer } from '@vben/utils';
|
| import { z } from '#/adapter/form';
|
| export const formSchema: FormSchemaGetter = () => [
| {
| component: 'Divider',
| componentProps: {
| orientation: 'left',
| },
| fieldName: 'divider1',
| formItemClass: 'col-span-2',
| label: '基本信息',
| },
| {
| component: 'Input',
| fieldName: 'tableName',
| label: '表名称',
| rules: 'required',
| },
| {
| component: 'Input',
| fieldName: 'tableComment',
| label: '表描述',
| rules: 'required',
| },
| {
| component: 'Input',
| fieldName: 'className',
| label: '实体类名称',
| rules: 'required',
| },
| {
| component: 'Input',
| fieldName: 'functionAuthor',
| label: '作者',
| rules: 'required',
| },
| {
| component: 'Divider',
| componentProps: {
| orientation: 'left',
| },
| fieldName: 'divider2',
| formItemClass: 'col-span-2',
| label: '生成信息',
| },
| {
| component: 'Select',
| componentProps: {
| allowClear: false,
| getPopupContainer,
| options: [
| { label: '单表(增删改查)', value: 'crud' },
| { label: '树表(增删改查)', value: 'tree' },
| ],
| },
| defaultValue: 'crud',
| fieldName: 'tplCategory',
| label: '模板类型',
| rules: 'selectRequired',
| },
| {
| component: 'Select',
| componentProps: {
| getPopupContainer,
| },
| dependencies: {
| show: (values) => values.tplCategory === 'tree',
| triggerFields: ['tplCategory'],
| },
| fieldName: 'treeCode',
| helpMessage: '树节点显示的编码字段名, 如: dept_id (相当于id)',
| label: '树编码字段',
| rules: 'selectRequired',
| },
| {
| component: 'Select',
| componentProps: {
| allowClear: false,
| },
| dependencies: {
| show: (values) => values.tplCategory === 'tree',
| triggerFields: ['tplCategory'],
| },
| fieldName: 'treeParentCode',
| help: '树节点显示的父编码字段名, 如: parent_Id (相当于parentId)',
| label: '树父编码字段',
| rules: 'selectRequired',
| },
| {
| component: 'Select',
| componentProps: {
| allowClear: false,
| },
| dependencies: {
| show: (values) => values.tplCategory === 'tree',
| triggerFields: ['tplCategory'],
| },
| fieldName: 'treeName',
| help: '树节点的显示名称字段名, 如: dept_name (相当于label)',
| label: '树名称字段',
| rules: 'selectRequired',
| },
| {
| component: 'Input',
| fieldName: 'packageName',
| help: '生成在哪个java包下, 例如 com.ruoyi.system',
| label: '生成包路径',
| rules: 'required',
| },
| {
| component: 'Input',
| fieldName: 'moduleName',
| help: '可理解为子系统名,例如 system',
| label: '生成模块名',
| rules: 'required',
| },
| {
| component: 'Input',
| fieldName: 'businessName',
| help: '可理解为功能英文名,例如 user',
| label: '生成业务名',
| rules: 'required',
| },
| {
| component: 'Input',
| fieldName: 'functionName',
| help: '用作类描述,例如 用户',
| label: '生成功能名',
| rules: 'required',
| },
| {
| component: 'TreeSelect',
| componentProps: {
| allowClear: false,
| getPopupContainer,
| },
| defaultValue: 0,
| fieldName: 'parentMenuId',
| label: '上级菜单',
| },
| {
| component: 'RadioGroup',
| componentProps: {
| buttonStyle: 'solid',
| options: [
| { label: 'modal弹窗', value: 'modal' },
| { label: 'drawer抽屉', value: 'drawer' },
| ],
| optionType: 'button',
| },
| help: '自定义功能, 需要后端支持',
| defaultValue: 'modal',
| fieldName: 'popupComponent',
| label: '弹窗组件类型',
| },
| {
| component: 'RadioGroup',
| componentProps: {
| buttonStyle: 'solid',
| options: [
| { label: 'useVbenForm', value: 'useForm' },
| { label: 'antd原生表单', value: 'native' },
| ],
| optionType: 'button',
| },
| help: '自定义功能, 需要后端支持\n复杂(布局, 联动等)表单建议用antd原生表单',
| defaultValue: 'useForm',
| fieldName: 'formComponent',
| label: '生成表单类型',
| },
| {
| component: 'RadioGroup',
| componentProps: {
| buttonStyle: 'solid',
| options: [
| { label: 'zip压缩包', value: '0' },
| { label: '自定义路径', value: '1' },
| ],
| optionType: 'button',
| },
| defaultValue: '0',
| fieldName: 'genType',
| help: '默认为zip压缩包下载, 也可以自定义生成路径',
| label: '生成代码方式',
| },
| {
| component: 'Input',
| defaultValue: '/',
| dependencies: {
| show: (model) => model.genType === '1',
| triggerFields: ['genType'],
| },
| fieldName: 'genPath',
| help: '输入绝对路径, 不支持"./"相对路径',
| label: '代码生成路径',
| rules: z
| .string()
| .regex(/^(?:[a-z]:)?(?:\/|(?:\\|\/)[^\\/:*?"<>|\r\n]+)*(?:\\|\/)?$/i, {
| message: '请输入合法的路径',
| }),
| },
| {
| component: 'Textarea',
| fieldName: 'remark',
| formItemClass: 'col-span-2 items-baseline',
| label: '备注',
| },
| ];
|
|