config.ts
3.54 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import { FormSchema } from '/@/components/Table';
import { FileItem } from '/@/components/Form/src/components/ApiUpload.vue';
import { createImgPreview } from '/@/components/Preview';
import { uploadThumbnail } from '/@/api/configuration/center/configurationCenter';
import { useComponentRegister } from '/@/components/Form';
import { OrgTreeSelect } from '../common/OrgTreeSelect';
useComponentRegister('OrgTreeSelect', OrgTreeSelect);
export enum Platform {
PHONE = 0,
PC = 1,
}
export enum ConfigurationPermission {
CREATE = 'api:yt:dataview:center:post',
UPDATE = 'api:yt:dataview:center:update',
DELETE = 'api:yt:dataview:center:delete',
SHARE = 'api:yt:dataview:center:share',
// DESIGN = 'api:yt:dataview:center:get_configuration_info:design',
DESIGN = 'api:yt:dataview:center:get_dataview_info:design',
PREVIEW = 'api:yt:dataview:center:get_configuration_info:preview',
DATAVIEW_PREVIEW = 'api:yt:dataview:center:get_dataview_info:preview', //大屏预览
PUBLISH = 'api:yt:dataview:center:publish',
// CANCEL_PUBLISH = 'api:yt:dataview:center:cancel_publish',
PUBLISH_INTERFACE = 'api:yt:dataview:center:public_interface',
}
export enum PublicInterface {
CREATE = 'api:yt:dataview:center:public_interface:post',
LIST = 'api:yt:dataview:center:public_interface:list',
UPDATE = 'api:yt:dataview:center:public_interface:update',
DELETE = 'api:yt:dataview:center:public_interface:delete',
PUBLISH = 'api:yt:dataview:center:public_interface:publish',
CANCEL_PUBLISH = 'api:yt:dataview:center:public_interface:cancel',
}
// 查询字段
export const searchFormSchema: FormSchema[] = [
{
field: 'name',
label: '大屏名称',
component: 'Input',
colProps: { span: 8 },
componentProps: {
maxLength: 36,
placeholder: '请输入大屏名称',
},
},
];
export const formSchema: FormSchema[] = [
{
field: 'thumbnail',
label: '缩略图',
component: 'ApiUpload',
changeEvent: 'update:fileList',
valueField: 'fileList',
componentProps: ({ formModel }) => {
return {
listType: 'picture-card',
maxFileLimit: 1,
accept: '.png,.jpg,.jpeg,.gif',
api: async (file: File) => {
try {
const formData = new FormData();
formData.set('file', file);
const { fileStaticUri, fileName } = await uploadThumbnail(formData);
return {
uid: fileStaticUri,
name: fileName,
url: fileStaticUri,
} as FileItem;
} catch (error) {
return {};
}
},
// showUploadList: true,
onDownload() {},
onPreview: (fileList: FileItem) => {
createImgPreview({ imageList: [fileList.url!] });
},
onDelete(url: string) {
formModel.deleteUrl = url!;
},
};
},
},
{
field: 'deleteUrl',
label: '',
component: 'Input',
show: false,
},
{
field: 'name',
label: '大屏名称',
required: true,
component: 'Input',
componentProps: {
placeholder: '请输入大屏名称',
maxLength: 32,
},
},
{
field: 'organizationId',
label: '所属组织',
required: true,
component: 'OrgTreeSelect',
},
{
field: 'remark',
label: '备注',
component: 'InputTextArea',
componentProps: {
placeholder: '请输入备注',
maxLength: 255,
},
},
{
field: 'id',
label: '',
component: 'Input',
show: false,
componentProps: {
maxLength: 36,
placeholder: 'id',
},
},
];