|
|
@@ -13,223 +13,234 @@ import { getDictOptions } from '#/utils/dict';
|
|
13
|
13
|
import { menuTypeOptions, yesNoOptions } from './table-data';
|
|
14
|
14
|
|
|
15
|
15
|
const emit = defineEmits<{ reload: [] }>();
|
|
|
16
|
+const currentSource = ref<number>(0); // 默认PC端
|
|
16
|
17
|
// 侧拉内置容器 Form表单的配置项
|
|
17
|
|
-const [Form, FormApi] = useVbenForm({
|
|
18
|
|
- // 不显示提交和重置按钮
|
|
19
|
|
- showDefaultActions: false,
|
|
20
|
|
- // 垂直布局,label和input在不同行,值为vertical
|
|
21
|
|
- // 水平布局,label和input在同一行
|
|
22
|
|
- layout: 'horizontal',
|
|
23
|
|
- schema: [
|
|
24
|
|
- {
|
|
25
|
|
- component: 'Input',
|
|
26
|
|
- fieldName: 'menuId',
|
|
27
|
|
- dependencies: {
|
|
28
|
|
- show: () => false,
|
|
29
|
|
- triggerFields: [''],
|
|
30
|
|
- },
|
|
|
18
|
+// 动态生成图标组件配置
|
|
|
19
|
+const getIconComponentConfig = () => {
|
|
|
20
|
+ return {
|
|
|
21
|
+ component: currentSource.value === 1 ? 'Input' : 'IconPicker',
|
|
|
22
|
+ componentProps: currentSource.value === 1 ? {
|
|
|
23
|
+ maxlength: 50,
|
|
|
24
|
+ } : {
|
|
|
25
|
+ prefix: 'carbon',
|
|
31
|
26
|
},
|
|
32
|
|
- {
|
|
33
|
|
- component: 'ApiTreeSelect',
|
|
34
|
|
- componentProps: {
|
|
35
|
|
- api: async () => {
|
|
36
|
|
- const menuArray = await menuList();
|
|
37
|
|
- // support i18n
|
|
38
|
|
- menuArray.forEach((item) => {
|
|
39
|
|
- item.menuName = $t(item.menuName);
|
|
40
|
|
- });
|
|
41
|
|
- // const folderArray = menuArray.filter((item) => item.menuType === 'M');
|
|
42
|
|
- /**
|
|
43
|
|
- * 这里需要过滤掉按钮类型
|
|
44
|
|
- * 不允许在按钮下添加数据
|
|
45
|
|
- */
|
|
46
|
|
- const filteredList = menuArray.filter(
|
|
47
|
|
- (item) => item.menuType !== 'F',
|
|
48
|
|
- );
|
|
49
|
|
- const menuTree = listToTree(filteredList, {
|
|
50
|
|
- id: 'menuId',
|
|
51
|
|
- pid: 'parentId',
|
|
52
|
|
- });
|
|
53
|
|
- const fullMenuTree = [
|
|
54
|
|
- {
|
|
55
|
|
- menuId: 0,
|
|
56
|
|
- menuName: $t('menu.root'),
|
|
57
|
|
- children: menuTree,
|
|
58
|
|
- },
|
|
59
|
|
- ];
|
|
60
|
|
- addFullName(fullMenuTree, 'menuName', ' / ');
|
|
61
|
|
- return fullMenuTree;
|
|
62
|
|
- },
|
|
63
|
|
- getPopupContainer,
|
|
64
|
|
- labelField: 'menuName',
|
|
65
|
|
- valueField: 'menuId',
|
|
66
|
|
- childrenField: 'children',
|
|
67
|
|
- checkStrictly: true,
|
|
|
27
|
+ dependencies: {
|
|
|
28
|
+ show: (values) => {
|
|
|
29
|
+ return values.menuType !== 'F';
|
|
68
|
30
|
},
|
|
69
|
|
- defaultValue: 0,
|
|
70
|
|
- rules: 'selectRequired',
|
|
71
|
|
- fieldName: 'parentId',
|
|
72
|
|
- label: $t('menus.parentId'),
|
|
|
31
|
+ triggerFields: ['menuType'],
|
|
73
|
32
|
},
|
|
74
|
|
- {
|
|
75
|
|
- component: 'RadioGroup',
|
|
76
|
|
- fieldName: 'menuType',
|
|
77
|
|
- label: $t('menus.menu-type'),
|
|
78
|
|
- defaultValue: 'M',
|
|
79
|
|
- componentProps: {
|
|
80
|
|
- buttonStyle: 'solid',
|
|
81
|
|
- isButton: true,
|
|
82
|
|
- options: menuTypeOptions,
|
|
83
|
|
- optionType: 'button',
|
|
84
|
|
- },
|
|
|
33
|
+ fieldName: 'icon',
|
|
|
34
|
+ label: $t('menus.icon'),
|
|
|
35
|
+ };
|
|
|
36
|
+};
|
|
|
37
|
+
|
|
|
38
|
+// 定义表单schema
|
|
|
39
|
+const formSchema = ref([
|
|
|
40
|
+ {
|
|
|
41
|
+ component: 'Input',
|
|
|
42
|
+ fieldName: 'menuId',
|
|
|
43
|
+ dependencies: {
|
|
|
44
|
+ show: () => false,
|
|
|
45
|
+ triggerFields: [''],
|
|
85
|
46
|
},
|
|
86
|
|
- {
|
|
87
|
|
- component: 'IconPicker',
|
|
88
|
|
- componentProps: {
|
|
89
|
|
- prefix: 'carbon',
|
|
90
|
|
- },
|
|
91
|
|
- dependencies: {
|
|
92
|
|
- show: (values) => {
|
|
93
|
|
- return values.menuType !== 'F';
|
|
94
|
|
- },
|
|
95
|
|
- triggerFields: ['menuType'],
|
|
|
47
|
+ },
|
|
|
48
|
+ {
|
|
|
49
|
+ component: 'ApiTreeSelect',
|
|
|
50
|
+ componentProps: {
|
|
|
51
|
+ api: async () => {
|
|
|
52
|
+ const menuArray = await menuList();
|
|
|
53
|
+ // support i18n
|
|
|
54
|
+ menuArray.forEach((item) => {
|
|
|
55
|
+ item.menuName = $t(item.menuName);
|
|
|
56
|
+ });
|
|
|
57
|
+ // const folderArray = menuArray.filter((item) => item.menuType === 'M');
|
|
|
58
|
+ /**
|
|
|
59
|
+ * 这里需要过滤掉按钮类型
|
|
|
60
|
+ * 不允许在按钮下添加数据
|
|
|
61
|
+ */
|
|
|
62
|
+ const filteredList = menuArray.filter(
|
|
|
63
|
+ (item) => item.menuType !== 'F',
|
|
|
64
|
+ );
|
|
|
65
|
+ const menuTree = listToTree(filteredList, {
|
|
|
66
|
+ id: 'menuId',
|
|
|
67
|
+ pid: 'parentId',
|
|
|
68
|
+ });
|
|
|
69
|
+ const fullMenuTree = [
|
|
|
70
|
+ {
|
|
|
71
|
+ menuId: 0,
|
|
|
72
|
+ menuName: $t('menu.root'),
|
|
|
73
|
+ children: menuTree,
|
|
|
74
|
+ },
|
|
|
75
|
+ ];
|
|
|
76
|
+ addFullName(fullMenuTree, 'menuName', ' / ');
|
|
|
77
|
+ return fullMenuTree;
|
|
96
|
78
|
},
|
|
97
|
|
- fieldName: 'icon',
|
|
98
|
|
- label: $t('menus.icon'),
|
|
|
79
|
+ getPopupContainer,
|
|
|
80
|
+ labelField: 'menuName',
|
|
|
81
|
+ valueField: 'menuId',
|
|
|
82
|
+ childrenField: 'children',
|
|
|
83
|
+ checkStrictly: true,
|
|
99
|
84
|
},
|
|
100
|
|
- {
|
|
101
|
|
- component: 'Input',
|
|
102
|
|
- fieldName: 'menuName',
|
|
103
|
|
- componentProps: {
|
|
104
|
|
- maxlength: 50,
|
|
105
|
|
- },
|
|
106
|
|
- label: $t('menus.menu-name'),
|
|
107
|
|
- rules: 'required',
|
|
|
85
|
+ defaultValue: 0,
|
|
|
86
|
+ rules: 'selectRequired',
|
|
|
87
|
+ fieldName: 'parentId',
|
|
|
88
|
+ label: $t('menus.parentId'),
|
|
|
89
|
+ },
|
|
|
90
|
+ {
|
|
|
91
|
+ component: 'RadioGroup',
|
|
|
92
|
+ fieldName: 'menuType',
|
|
|
93
|
+ label: $t('menus.menu-type'),
|
|
|
94
|
+ defaultValue: 'M',
|
|
|
95
|
+ componentProps: {
|
|
|
96
|
+ buttonStyle: 'solid',
|
|
|
97
|
+ isButton: true,
|
|
|
98
|
+ options: menuTypeOptions,
|
|
|
99
|
+ optionType: 'button',
|
|
108
|
100
|
},
|
|
109
|
|
- {
|
|
110
|
|
- component: 'InputNumber',
|
|
111
|
|
- fieldName: 'orderNum',
|
|
112
|
|
- componentProps: {
|
|
113
|
|
- max: 9999,
|
|
114
|
|
- },
|
|
115
|
|
- defaultValue: 0,
|
|
116
|
|
- label: $t('menus.order-num'),
|
|
117
|
|
- rules: 'required',
|
|
|
101
|
+ },
|
|
|
102
|
+ getIconComponentConfig(),
|
|
|
103
|
+ {
|
|
|
104
|
+ component: 'Input',
|
|
|
105
|
+ fieldName: 'menuName',
|
|
|
106
|
+ componentProps: {
|
|
|
107
|
+ maxlength: 50,
|
|
118
|
108
|
},
|
|
119
|
|
- {
|
|
120
|
|
- component: 'Input',
|
|
121
|
|
- dependencies: {
|
|
122
|
|
- show: (values) => {
|
|
123
|
|
- return values.menuType !== 'F';
|
|
124
|
|
- },
|
|
125
|
|
- triggerFields: ['menuType'],
|
|
126
|
|
- },
|
|
127
|
|
- fieldName: 'path',
|
|
128
|
|
- componentProps: {
|
|
129
|
|
- maxlength: 200,
|
|
130
|
|
- },
|
|
131
|
|
- label: $t('menus.path'),
|
|
132
|
|
- rules: 'required',
|
|
|
109
|
+ label: $t('menus.menu-name'),
|
|
|
110
|
+ rules: 'required',
|
|
|
111
|
+ },
|
|
|
112
|
+ {
|
|
|
113
|
+ component: 'InputNumber',
|
|
|
114
|
+ fieldName: 'orderNum',
|
|
|
115
|
+ componentProps: {
|
|
|
116
|
+ max: 9999,
|
|
133
|
117
|
},
|
|
134
|
|
- {
|
|
135
|
|
- component: 'Input',
|
|
136
|
|
- dependencies: {
|
|
137
|
|
- show: (values) => {
|
|
138
|
|
- return values.menuType !== 'F';
|
|
139
|
|
- },
|
|
140
|
|
- triggerFields: ['menuType'],
|
|
141
|
|
- },
|
|
142
|
|
- fieldName: 'query',
|
|
143
|
|
- componentProps: {
|
|
144
|
|
- maxlength: 200,
|
|
145
|
|
- placeholder: '请输入路由参数',
|
|
|
118
|
+ defaultValue: 0,
|
|
|
119
|
+ label: $t('menus.order-num'),
|
|
|
120
|
+ rules: 'required',
|
|
|
121
|
+ },
|
|
|
122
|
+ {
|
|
|
123
|
+ component: 'Input',
|
|
|
124
|
+ dependencies: {
|
|
|
125
|
+ show: (values) => {
|
|
|
126
|
+ return values.menuType !== 'F' && currentSource.value !== 1;
|
|
146
|
127
|
},
|
|
147
|
|
- label: $t('menus.query'),
|
|
|
128
|
+ triggerFields: ['menuType'],
|
|
148
|
129
|
},
|
|
149
|
|
- {
|
|
150
|
|
- component: 'Input',
|
|
151
|
|
- dependencies: {
|
|
152
|
|
- show: (values) => {
|
|
153
|
|
- return values.menuType === 'C';
|
|
154
|
|
- },
|
|
155
|
|
- triggerFields: ['menuType'],
|
|
156
|
|
- },
|
|
157
|
|
- fieldName: 'component',
|
|
158
|
|
- componentProps: {
|
|
159
|
|
- maxlength: 255,
|
|
160
|
|
- },
|
|
161
|
|
- label: $t('menus.component'),
|
|
162
|
|
- rules: 'required',
|
|
|
130
|
+ fieldName: 'path',
|
|
|
131
|
+ componentProps: {
|
|
|
132
|
+ maxlength: 200,
|
|
163
|
133
|
},
|
|
164
|
|
- {
|
|
165
|
|
- component: 'Input',
|
|
166
|
|
- dependencies: {
|
|
167
|
|
- show: (values) => {
|
|
168
|
|
- return values.menuType !== 'M';
|
|
169
|
|
- },
|
|
170
|
|
- triggerFields: ['menuType'],
|
|
171
|
|
- },
|
|
172
|
|
- fieldName: 'perms',
|
|
173
|
|
- componentProps: {
|
|
174
|
|
- maxlength: 100,
|
|
|
134
|
+ label: $t('menus.path'),
|
|
|
135
|
+ rules: currentSource.value !== 1 ? 'required' : '',
|
|
|
136
|
+ },
|
|
|
137
|
+ {
|
|
|
138
|
+ component: 'Input',
|
|
|
139
|
+ dependencies: {
|
|
|
140
|
+ show: (values) => {
|
|
|
141
|
+ return values.menuType !== 'F' && currentSource.value !== 1;
|
|
175
|
142
|
},
|
|
176
|
|
- label: $t('menus.perms'),
|
|
|
143
|
+ triggerFields: ['menuType'],
|
|
177
|
144
|
},
|
|
178
|
|
- {
|
|
179
|
|
- component: 'RadioGroup',
|
|
180
|
|
- dependencies: {
|
|
181
|
|
- show: (values) => {
|
|
182
|
|
- return values.menuType !== 'F';
|
|
183
|
|
- },
|
|
184
|
|
- triggerFields: ['menuType'],
|
|
185
|
|
- },
|
|
186
|
|
- fieldName: 'isFrame',
|
|
187
|
|
- label: $t('menus.is-frame'),
|
|
188
|
|
- defaultValue: '1',
|
|
189
|
|
- componentProps: {
|
|
190
|
|
- buttonStyle: 'solid',
|
|
191
|
|
- isButton: true,
|
|
192
|
|
- options: yesNoOptions,
|
|
193
|
|
- optionType: 'button',
|
|
|
145
|
+ fieldName: 'query',
|
|
|
146
|
+ componentProps: {
|
|
|
147
|
+ maxlength: 200,
|
|
|
148
|
+ placeholder: '请输入路由参数',
|
|
|
149
|
+ },
|
|
|
150
|
+ label: $t('menus.query'),
|
|
|
151
|
+ },
|
|
|
152
|
+ {
|
|
|
153
|
+ component: 'Input',
|
|
|
154
|
+ dependencies: {
|
|
|
155
|
+ show: (values) => {
|
|
|
156
|
+ return values.menuType === 'C';
|
|
194
|
157
|
},
|
|
|
158
|
+ triggerFields: ['menuType'],
|
|
195
|
159
|
},
|
|
196
|
|
- {
|
|
197
|
|
- component: 'RadioGroup',
|
|
198
|
|
- dependencies: {
|
|
199
|
|
- show: (values) => {
|
|
200
|
|
- return values.menuType !== 'F';
|
|
201
|
|
- },
|
|
202
|
|
- triggerFields: ['menuType'],
|
|
|
160
|
+ fieldName: 'component',
|
|
|
161
|
+ componentProps: {
|
|
|
162
|
+ maxlength: 255,
|
|
|
163
|
+ },
|
|
|
164
|
+ label: $t('menus.component'),
|
|
|
165
|
+ rules: 'required',
|
|
|
166
|
+ },
|
|
|
167
|
+ {
|
|
|
168
|
+ component: 'Input',
|
|
|
169
|
+ dependencies: {
|
|
|
170
|
+ show: (values) => {
|
|
|
171
|
+ return values.menuType !== 'M';
|
|
203
|
172
|
},
|
|
204
|
|
- fieldName: 'visible',
|
|
205
|
|
- label: $t('menus.is-visible'),
|
|
206
|
|
- defaultValue: '0',
|
|
207
|
|
- componentProps: {
|
|
208
|
|
- buttonStyle: 'solid',
|
|
209
|
|
- isButton: true,
|
|
210
|
|
- options: getDictOptions(DictEnum.SYS_SHOW_HIDE),
|
|
211
|
|
- optionType: 'button',
|
|
|
173
|
+ triggerFields: ['menuType'],
|
|
|
174
|
+ },
|
|
|
175
|
+ fieldName: 'perms',
|
|
|
176
|
+ componentProps: {
|
|
|
177
|
+ maxlength: 100,
|
|
|
178
|
+ },
|
|
|
179
|
+ label: $t('menus.perms'),
|
|
|
180
|
+ },
|
|
|
181
|
+ {
|
|
|
182
|
+ component: 'RadioGroup',
|
|
|
183
|
+ dependencies: {
|
|
|
184
|
+ show: (values) => {
|
|
|
185
|
+ return values.menuType !== 'F';
|
|
212
|
186
|
},
|
|
|
187
|
+ triggerFields: ['menuType'],
|
|
213
|
188
|
},
|
|
214
|
|
- {
|
|
215
|
|
- component: 'RadioGroup',
|
|
216
|
|
- dependencies: {
|
|
217
|
|
- show: (values) => {
|
|
218
|
|
- return values.menuType !== 'F';
|
|
219
|
|
- },
|
|
220
|
|
- triggerFields: ['menuType'],
|
|
|
189
|
+ fieldName: 'isFrame',
|
|
|
190
|
+ label: $t('menus.is-frame'),
|
|
|
191
|
+ defaultValue: '1',
|
|
|
192
|
+ componentProps: {
|
|
|
193
|
+ buttonStyle: 'solid',
|
|
|
194
|
+ isButton: true,
|
|
|
195
|
+ options: yesNoOptions,
|
|
|
196
|
+ optionType: 'button',
|
|
|
197
|
+ },
|
|
|
198
|
+ },
|
|
|
199
|
+ {
|
|
|
200
|
+ component: 'RadioGroup',
|
|
|
201
|
+ dependencies: {
|
|
|
202
|
+ show: (values) => {
|
|
|
203
|
+ return values.menuType !== 'F';
|
|
221
|
204
|
},
|
|
222
|
|
- fieldName: 'status',
|
|
223
|
|
- label: $t('menus.status'),
|
|
224
|
|
- defaultValue: '0',
|
|
225
|
|
- componentProps: {
|
|
226
|
|
- buttonStyle: 'solid',
|
|
227
|
|
- isButton: true,
|
|
228
|
|
- options: getDictOptions(DictEnum.SYS_NORMAL_DISABLE),
|
|
229
|
|
- optionType: 'button',
|
|
|
205
|
+ triggerFields: ['menuType'],
|
|
|
206
|
+ },
|
|
|
207
|
+ fieldName: 'visible',
|
|
|
208
|
+ label: $t('menus.is-visible'),
|
|
|
209
|
+ defaultValue: '0',
|
|
|
210
|
+ componentProps: {
|
|
|
211
|
+ buttonStyle: 'solid',
|
|
|
212
|
+ isButton: true,
|
|
|
213
|
+ options: getDictOptions(DictEnum.SYS_SHOW_HIDE),
|
|
|
214
|
+ optionType: 'button',
|
|
|
215
|
+ },
|
|
|
216
|
+ },
|
|
|
217
|
+ {
|
|
|
218
|
+ component: 'RadioGroup',
|
|
|
219
|
+ dependencies: {
|
|
|
220
|
+ show: (values) => {
|
|
|
221
|
+ return values.menuType !== 'F';
|
|
230
|
222
|
},
|
|
|
223
|
+ triggerFields: ['menuType'],
|
|
|
224
|
+ },
|
|
|
225
|
+ fieldName: 'status',
|
|
|
226
|
+ label: $t('menus.status'),
|
|
|
227
|
+ defaultValue: '0',
|
|
|
228
|
+ componentProps: {
|
|
|
229
|
+ buttonStyle: 'solid',
|
|
|
230
|
+ isButton: true,
|
|
|
231
|
+ options: getDictOptions(DictEnum.SYS_NORMAL_DISABLE),
|
|
|
232
|
+ optionType: 'button',
|
|
231
|
233
|
},
|
|
232
|
|
- ],
|
|
|
234
|
+ },
|
|
|
235
|
+]);
|
|
|
236
|
+
|
|
|
237
|
+const [Form, FormApi] = useVbenForm({
|
|
|
238
|
+ // 不显示提交和重置按钮
|
|
|
239
|
+ showDefaultActions: false,
|
|
|
240
|
+ // 垂直布局,label和input在不同行,值为vertical
|
|
|
241
|
+ // 水平布局,label和input在同一行
|
|
|
242
|
+ layout: 'horizontal',
|
|
|
243
|
+ schema: formSchema,
|
|
233
|
244
|
});
|
|
234
|
245
|
interface ModalProps {
|
|
235
|
246
|
id?: number | string;
|
|
|
@@ -238,7 +249,7 @@ interface ModalProps {
|
|
238
|
249
|
}
|
|
239
|
250
|
// 新增还是修改的标识
|
|
240
|
251
|
const isUpdate = ref<boolean>(false);
|
|
241
|
|
-const currentSource = ref<number>(0); // 默认PC端
|
|
|
252
|
+
|
|
242
|
253
|
|
|
243
|
254
|
const [Drawer, DrawerApi] = useVbenDrawer({
|
|
244
|
255
|
// 点击侧拉的确定按钮执行逻辑
|
|
|
@@ -276,6 +287,205 @@ const [Drawer, DrawerApi] = useVbenDrawer({
|
|
276
|
287
|
const { id, update, source } = DrawerApi.getData() as ModalProps;
|
|
277
|
288
|
isUpdate.value = update;
|
|
278
|
289
|
currentSource.value = source; // 保存当前source值
|
|
|
290
|
+
|
|
|
291
|
+ // 重新生成完整的表单schema以更新所有字段的配置
|
|
|
292
|
+ formSchema.value = [
|
|
|
293
|
+ {
|
|
|
294
|
+ component: 'Input',
|
|
|
295
|
+ fieldName: 'menuId',
|
|
|
296
|
+ dependencies: {
|
|
|
297
|
+ show: () => false,
|
|
|
298
|
+ triggerFields: [''],
|
|
|
299
|
+ },
|
|
|
300
|
+ },
|
|
|
301
|
+ {
|
|
|
302
|
+ component: 'ApiTreeSelect',
|
|
|
303
|
+ componentProps: {
|
|
|
304
|
+ api: async () => {
|
|
|
305
|
+ const menuArray = await menuList();
|
|
|
306
|
+ // support i18n
|
|
|
307
|
+ menuArray.forEach((item) => {
|
|
|
308
|
+ item.menuName = $t(item.menuName);
|
|
|
309
|
+ });
|
|
|
310
|
+ /**
|
|
|
311
|
+ * 这里需要过滤掉按钮类型
|
|
|
312
|
+ * 不允许在按钮下添加数据
|
|
|
313
|
+ */
|
|
|
314
|
+ const filteredList = menuArray.filter(
|
|
|
315
|
+ (item) => item.menuType !== 'F',
|
|
|
316
|
+ );
|
|
|
317
|
+ const menuTree = listToTree(filteredList, {
|
|
|
318
|
+ id: 'menuId',
|
|
|
319
|
+ pid: 'parentId',
|
|
|
320
|
+ });
|
|
|
321
|
+ const fullMenuTree = [
|
|
|
322
|
+ {
|
|
|
323
|
+ menuId: 0,
|
|
|
324
|
+ menuName: $t('menu.root'),
|
|
|
325
|
+ children: menuTree,
|
|
|
326
|
+ },
|
|
|
327
|
+ ];
|
|
|
328
|
+ addFullName(fullMenuTree, 'menuName', ' / ');
|
|
|
329
|
+ return fullMenuTree;
|
|
|
330
|
+ },
|
|
|
331
|
+ getPopupContainer,
|
|
|
332
|
+ labelField: 'menuName',
|
|
|
333
|
+ valueField: 'menuId',
|
|
|
334
|
+ childrenField: 'children',
|
|
|
335
|
+ checkStrictly: true,
|
|
|
336
|
+ },
|
|
|
337
|
+ defaultValue: 0,
|
|
|
338
|
+ rules: 'selectRequired',
|
|
|
339
|
+ fieldName: 'parentId',
|
|
|
340
|
+ label: $t('menus.parentId'),
|
|
|
341
|
+ },
|
|
|
342
|
+ {
|
|
|
343
|
+ component: 'RadioGroup',
|
|
|
344
|
+ fieldName: 'menuType',
|
|
|
345
|
+ label: $t('menus.menu-type'),
|
|
|
346
|
+ defaultValue: 'M',
|
|
|
347
|
+ componentProps: {
|
|
|
348
|
+ buttonStyle: 'solid',
|
|
|
349
|
+ isButton: true,
|
|
|
350
|
+ options: menuTypeOptions,
|
|
|
351
|
+ optionType: 'button',
|
|
|
352
|
+ },
|
|
|
353
|
+ },
|
|
|
354
|
+ getIconComponentConfig(),
|
|
|
355
|
+ {
|
|
|
356
|
+ component: 'Input',
|
|
|
357
|
+ fieldName: 'menuName',
|
|
|
358
|
+ componentProps: {
|
|
|
359
|
+ maxlength: 50,
|
|
|
360
|
+ },
|
|
|
361
|
+ label: $t('menus.menu-name'),
|
|
|
362
|
+ rules: 'required',
|
|
|
363
|
+ },
|
|
|
364
|
+ {
|
|
|
365
|
+ component: 'InputNumber',
|
|
|
366
|
+ fieldName: 'orderNum',
|
|
|
367
|
+ componentProps: {
|
|
|
368
|
+ max: 9999,
|
|
|
369
|
+ },
|
|
|
370
|
+ defaultValue: 0,
|
|
|
371
|
+ label: $t('menus.order-num'),
|
|
|
372
|
+ rules: 'required',
|
|
|
373
|
+ },
|
|
|
374
|
+ {
|
|
|
375
|
+ component: 'Input',
|
|
|
376
|
+ dependencies: {
|
|
|
377
|
+ show: (values) => {
|
|
|
378
|
+ return values.menuType !== 'F' && currentSource.value !== 1;
|
|
|
379
|
+ },
|
|
|
380
|
+ triggerFields: ['menuType'],
|
|
|
381
|
+ },
|
|
|
382
|
+ fieldName: 'path',
|
|
|
383
|
+ componentProps: {
|
|
|
384
|
+ maxlength: 200,
|
|
|
385
|
+ },
|
|
|
386
|
+ label: $t('menus.path'),
|
|
|
387
|
+ rules: currentSource.value !== 1 ? 'required' : '',
|
|
|
388
|
+ },
|
|
|
389
|
+ {
|
|
|
390
|
+ component: 'Input',
|
|
|
391
|
+ dependencies: {
|
|
|
392
|
+ show: (values) => {
|
|
|
393
|
+ return values.menuType !== 'F' && currentSource.value !== 1;
|
|
|
394
|
+ },
|
|
|
395
|
+ triggerFields: ['menuType'],
|
|
|
396
|
+ },
|
|
|
397
|
+ fieldName: 'query',
|
|
|
398
|
+ componentProps: {
|
|
|
399
|
+ maxlength: 200,
|
|
|
400
|
+ placeholder: '请输入路由参数',
|
|
|
401
|
+ },
|
|
|
402
|
+ label: $t('menus.query'),
|
|
|
403
|
+ },
|
|
|
404
|
+ {
|
|
|
405
|
+ component: 'Input',
|
|
|
406
|
+ dependencies: {
|
|
|
407
|
+ show: (values) => {
|
|
|
408
|
+ return values.menuType === 'C';
|
|
|
409
|
+ },
|
|
|
410
|
+ triggerFields: ['menuType'],
|
|
|
411
|
+ },
|
|
|
412
|
+ fieldName: 'component',
|
|
|
413
|
+ componentProps: {
|
|
|
414
|
+ maxlength: 255,
|
|
|
415
|
+ },
|
|
|
416
|
+ label: $t('menus.component'),
|
|
|
417
|
+ rules: 'required',
|
|
|
418
|
+ },
|
|
|
419
|
+ {
|
|
|
420
|
+ component: 'Input',
|
|
|
421
|
+ dependencies: {
|
|
|
422
|
+ show: (values) => {
|
|
|
423
|
+ return values.menuType !== 'M';
|
|
|
424
|
+ },
|
|
|
425
|
+ triggerFields: ['menuType'],
|
|
|
426
|
+ },
|
|
|
427
|
+ fieldName: 'perms',
|
|
|
428
|
+ componentProps: {
|
|
|
429
|
+ maxlength: 100,
|
|
|
430
|
+ },
|
|
|
431
|
+ label: $t('menus.perms'),
|
|
|
432
|
+ },
|
|
|
433
|
+ {
|
|
|
434
|
+ component: 'RadioGroup',
|
|
|
435
|
+ dependencies: {
|
|
|
436
|
+ show: (values) => {
|
|
|
437
|
+ return values.menuType !== 'F' && currentSource.value !== 1;
|
|
|
438
|
+ },
|
|
|
439
|
+ triggerFields: ['menuType'],
|
|
|
440
|
+ },
|
|
|
441
|
+ fieldName: 'isFrame',
|
|
|
442
|
+ label: $t('menus.is-frame'),
|
|
|
443
|
+ defaultValue: '1',
|
|
|
444
|
+ componentProps: {
|
|
|
445
|
+ buttonStyle: 'solid',
|
|
|
446
|
+ isButton: true,
|
|
|
447
|
+ options: yesNoOptions,
|
|
|
448
|
+ optionType: 'button',
|
|
|
449
|
+ },
|
|
|
450
|
+ },
|
|
|
451
|
+ {
|
|
|
452
|
+ component: 'RadioGroup',
|
|
|
453
|
+ dependencies: {
|
|
|
454
|
+ show: (values) => {
|
|
|
455
|
+ return values.menuType !== 'F';
|
|
|
456
|
+ },
|
|
|
457
|
+ triggerFields: ['menuType'],
|
|
|
458
|
+ },
|
|
|
459
|
+ fieldName: 'visible',
|
|
|
460
|
+ label: $t('menus.is-visible'),
|
|
|
461
|
+ defaultValue: '0',
|
|
|
462
|
+ componentProps: {
|
|
|
463
|
+ buttonStyle: 'solid',
|
|
|
464
|
+ isButton: true,
|
|
|
465
|
+ options: getDictOptions(DictEnum.SYS_SHOW_HIDE),
|
|
|
466
|
+ optionType: 'button',
|
|
|
467
|
+ },
|
|
|
468
|
+ },
|
|
|
469
|
+ {
|
|
|
470
|
+ component: 'RadioGroup',
|
|
|
471
|
+ dependencies: {
|
|
|
472
|
+ show: (values) => {
|
|
|
473
|
+ return values.menuType !== 'F';
|
|
|
474
|
+ },
|
|
|
475
|
+ triggerFields: ['menuType'],
|
|
|
476
|
+ },
|
|
|
477
|
+ fieldName: 'status',
|
|
|
478
|
+ label: $t('menus.status'),
|
|
|
479
|
+ defaultValue: '0',
|
|
|
480
|
+ componentProps: {
|
|
|
481
|
+ buttonStyle: 'solid',
|
|
|
482
|
+ isButton: true,
|
|
|
483
|
+ options: getDictOptions(DictEnum.SYS_NORMAL_DISABLE),
|
|
|
484
|
+ optionType: 'button',
|
|
|
485
|
+ },
|
|
|
486
|
+ },
|
|
|
487
|
+ ];
|
|
|
488
|
+
|
|
279
|
489
|
if (id) {
|
|
280
|
490
|
await FormApi.setFieldValue('parentId', id);
|
|
281
|
491
|
if (update) {
|