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
| import { generateUUID } from '@/utils'
| import { localeProps, makeRequiredRule } from '@/components/FormCreate/src/utils'
|
| export const useUploadFileRule = () => {
| const label = '文件上传'
| const name = 'UploadFile'
| return {
| icon: 'icon-upload',
| label,
| name,
| rule() {
| return {
| type: name,
| field: generateUUID(),
| title: label,
| info: '',
| $required: false
| }
| },
| props(_, { t }) {
| return localeProps(t, name + '.props', [
| makeRequiredRule(),
| {
| type: 'select',
| field: 'fileType',
| 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: {
| multiple: true
| }
| },
| {
| type: 'switch',
| field: 'autoUpload',
| title: '是否在选取文件后立即进行上传',
| value: true
| },
| {
| type: 'switch',
| field: 'drag',
| title: '拖拽上传',
| value: false
| },
| {
| type: 'switch',
| field: 'isShowTip',
| title: '是否显示提示',
| value: true
| },
| {
| type: 'inputNumber',
| field: 'fileSize',
| title: '大小限制(MB)',
| value: 5,
| props: { min: 0 }
| },
| {
| type: 'inputNumber',
| field: 'limit',
| title: '数量限制',
| value: 5,
| props: { min: 0 }
| },
| {
| type: 'switch',
| field: 'disabled',
| title: '是否禁用',
| value: false
| }
| ])
| }
| }
| }
|
|