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
| import type { VbenFormSchema } from '#/adapter/form';
|
| import { CommonStatusEnum, DICT_TYPE } from '@vben/constants';
| import { getDictOptions } from '@vben/hooks';
|
| import { z } from '#/adapter/form';
|
| /** 新增/修改的表单 */
| export function useFormSchema(): VbenFormSchema[] {
| return [
| {
| fieldName: 'id',
| component: 'Input',
| dependencies: {
| triggerFields: [''],
| show: () => false,
| },
| },
| {
| fieldName: 'name',
| label: '表单名称',
| component: 'Input',
| componentProps: {
| placeholder: '请输入表单名称',
| },
| rules: 'required',
| },
| {
| fieldName: 'status',
| label: '状态',
| component: 'RadioGroup',
| componentProps: {
| options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
| buttonStyle: 'solid',
| optionType: 'button',
| },
| rules: z.number().default(CommonStatusEnum.ENABLE),
| },
| {
| fieldName: 'remark',
| label: '备注',
| component: 'Textarea',
| componentProps: {
| placeholder: '请输入备注',
| },
| },
| ];
| }
|
|