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
| import { buildUUID } from '../../../packages/utils/src';
|
| import {
| localeProps,
| makeRequiredRule,
| } from '#/components/form-create/helpers';
|
| export function useUploadFileRule() {
| const label = '文件上传';
| const name = 'FileUpload';
| return {
| icon: 'icon-upload',
| label,
| name,
| rule() {
| return {
| type: name,
| field: buildUUID(),
| title: label,
| info: '',
| $required: false,
| };
| },
| props(_: any, { t }: any) {
| return localeProps(t, `${name}.props`, [
| makeRequiredRule(),
| {
| type: 'select',
| field: 'accept',
| title: '文件类型',
| value: ['doc', 'xls', 'ppt', 'txt', 'pdf'],
| options: [
| { label: 'doc', value: 'doc' },
| { label: 'xls', value: 'xls' },
| { label: 'ppt', value: 'ppt' },
| { label: 'txt', value: 'txt' },
| { label: 'pdf', value: 'pdf' },
| ],
| props: {
| mode: 'multiple',
| },
| },
| {
| type: 'switch',
| field: 'drag',
| title: '拖拽上传',
| value: false,
| },
| {
| type: 'switch',
| field: 'showDescription',
| title: '是否显示提示',
| value: true,
| },
| {
| type: 'inputNumber',
| field: 'maxSize',
| title: '大小限制(MB)',
| value: 5,
| props: { min: 0 },
| },
| {
| type: 'inputNumber',
| field: 'maxNumber',
| title: '数量限制',
| value: 5,
| props: { min: 1 },
| },
| {
| type: 'switch',
| field: 'disabled',
| title: '是否禁用',
| value: false,
| },
| ]);
| },
| };
| }
|
|