|
1
|
+import { getDictList } from '/@/api/system/dict';
|
1
|
2
|
import { BasicColumn } from '/@/components/Table';
|
2
|
3
|
import { FormSchema } from '/@/components/Table';
|
3
|
4
|
import { useI18n } from '/@/hooks/web/useI18n';
|
...
|
...
|
@@ -36,26 +37,46 @@ export const columns: BasicColumn[] = [ |
36
|
37
|
];
|
37
|
38
|
|
38
|
39
|
export const searchFormSchema: FormSchema[] = [
|
|
40
|
+ // {
|
|
41
|
+ // field: 'dictName',
|
|
42
|
+ // label: t('system.dict.dictName'),
|
|
43
|
+ // component: 'Input',
|
|
44
|
+ // colProps: { span: 6 },
|
|
45
|
+ // componentProps: {
|
|
46
|
+ // maxLength: 32,
|
|
47
|
+ // },
|
|
48
|
+ // dynamicRules: () => {
|
|
49
|
+ // return [
|
|
50
|
+ // {
|
|
51
|
+ // required: false,
|
|
52
|
+ // validator: (_, value) => {
|
|
53
|
+ // if (String(value).length > 32) {
|
|
54
|
+ // return Promise.reject(t('system.dict.textRule32'));
|
|
55
|
+ // }
|
|
56
|
+ // return Promise.resolve();
|
|
57
|
+ // },
|
|
58
|
+ // },
|
|
59
|
+ // ];
|
|
60
|
+ // },
|
|
61
|
+ // },
|
39
|
62
|
{
|
40
|
63
|
field: 'dictName',
|
41
|
64
|
label: t('system.dict.dictName'),
|
42
|
|
- component: 'Input',
|
|
65
|
+ component: 'ApiSelect',
|
43
|
66
|
colProps: { span: 6 },
|
44
|
67
|
componentProps: {
|
45
|
|
- maxLength: 32,
|
46
|
|
- },
|
47
|
|
- dynamicRules: () => {
|
48
|
|
- return [
|
49
|
|
- {
|
50
|
|
- required: false,
|
51
|
|
- validator: (_, value) => {
|
52
|
|
- if (String(value).length > 32) {
|
53
|
|
- return Promise.reject(t('system.dict.textRule32'));
|
54
|
|
- }
|
55
|
|
- return Promise.resolve();
|
56
|
|
- },
|
57
|
|
- },
|
58
|
|
- ];
|
|
68
|
+ api: async () => {
|
|
69
|
+ const { data: values } = await getDictList();
|
|
70
|
+ return (values || []).map((item) => ({
|
|
71
|
+ label: t(item.dictName) ? t(item.dictName) : item.dictName,
|
|
72
|
+ value: item.dictName,
|
|
73
|
+ }));
|
|
74
|
+ },
|
|
75
|
+
|
|
76
|
+ showSearch: true,
|
|
77
|
+ filterOption: (inputValue: string, options: Record<'label', string>) => {
|
|
78
|
+ return options.label.includes(inputValue);
|
|
79
|
+ },
|
59
|
80
|
},
|
60
|
81
|
},
|
61
|
82
|
{
|
...
|
...
|
|