config.ts
2.36 KB
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
import { h } from 'vue';
import { findDictItemByCode } from '/@/api/system/dict';
import { FormSchema } from '/@/components/Form';
import { DictEnum } from '/@/enums/dictEnum';
import { useI18n } from '/@/hooks/web/useI18n';
import HelpMessage from '../HelpMessage.vue';
export enum FormFieldsEnum {
NAME = 'name',
CATEGORY_NAME = 'classify',
INTERFACE_ADDRESS = 'uri',
REQUEST_METHOD = 'requestMethod',
INTERFACE_PARAMS = 'param',
DOCUMENT_URL = 'documentUrl',
}
const { t } = useI18n();
export const formSchema: FormSchema[] = [
{
field: FormFieldsEnum.NAME,
label: t('application.api.text.name'),
component: 'Input',
required: true,
componentProps: {
maxLength: 255,
placeholder: t('application.api.search.apiNamePlaceholder'),
},
},
{
field: FormFieldsEnum.CATEGORY_NAME,
label: t('application.api.text.categoryName'),
component: 'ApiSelect',
required: true,
componentProps() {
return {
api: findDictItemByCode,
params: {
dictCode: DictEnum.OPEN_API_CLASSIFY,
},
labelField: 'itemText',
valueField: 'itemValue',
getPopupContainer: () => document.body,
};
},
},
{
field: FormFieldsEnum.REQUEST_METHOD,
label: t('application.api.text.requestMethod'),
component: 'ApiSelect',
required: true,
componentProps() {
return {
options: [
{ label: 'GET', value: 'GET' },
{ label: 'POST', value: 'POST' },
{ label: 'PUT', value: 'PUT' },
{ label: 'DELETE', value: 'DELETE' },
],
getPopupContainer: () => document.body,
};
},
},
{
field: FormFieldsEnum.INTERFACE_ADDRESS,
label: h(HelpMessage) as unknown as string,
component: 'Input',
required: true,
componentProps: {
maxLength: 255,
placeholder: t('application.api.search.interfaceAddressPlaceholder'),
},
},
{
field: FormFieldsEnum.INTERFACE_PARAMS,
label: t('application.api.text.interfaceParams'),
component: 'Input',
required: true,
slot: 'interfaceParamsSlot',
},
// {
// field: FormFieldsEnum.DOCUMENT_URL,
// label: t('application.api.text.documentUrl'),
// component: 'InputTextArea',
// componentProps: {
// maxLength: 255,
// placeholder: t('application.api.search.documentUrlPlaceholder'),
// },
// },
];