index.js
3.03 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/*
* @Descripttion: 主文件
* @version:
* @Author: qianlishi
* @Date: 2021-08-29 06:43:07
* @LastEditors: qianlishi
* @LastEditTime: 2022-03-11 10:35:35
*/
import { widgetTool } from "./main";
const screenConfig = {
code: "screen",
type: "screen",
label: "大屏设置",
icon: "",
options: {
setup: [
{
type: "el-input-number",
label: "大屏宽度",
name: "width",
required: false,
placeholder: "px",
value: "1920"
},
{
type: "el-input-number",
label: "大屏高度",
name: "height",
required: false,
placeholder: "px",
value: "1080"
},
{
type: "el-input-text",
label: "标题",
name: "title",
require: false,
placeholder: "",
value: "大屏"
},
{
type: "el-input-textarea",
label: "大屏简介",
name: "description",
required: false,
placeholder: ""
},
{
type: "vue-color",
label: "背景颜色",
name: "backgroundColor",
required: false,
placeholder: "",
value: "#000"
},
{
type: "custom-upload",
label: "图片地址",
name: "backgroundImage",
required: false,
placeholder: "",
value:
"https://ajreport.beliefteam.cn/file/download/bf566e48-ccad-40e1-8ee9-228427e5466b"
}
],
data: [],
position: []
}
};
const widgetTools = [...widgetTool];
const getToolByCode = function(code) {
// 获取大屏底层设置属性
if (code == "screen") {
return screenConfig;
}
// 获取组件
let item = widgetTools.find(function(item, index, arrs) {
return item.code === code;
});
return item;
};
console.log(widgetTools);
const getWidgetToolsGroup = () => {
let [
chartGroup,
decorateGroup,
textGroup,
gridGroup,
mediaGroup,
otherGroup
] = [[], [], [], [], [], []];
for (const item of widgetTools) {
switch (item.group || item.type) {
case "chart":
chartGroup.push(item);
break;
case "decorate":
decorateGroup.push(item);
break;
case "text":
textGroup.push(item);
break;
case "grid":
gridGroup.push(item);
break;
case "media":
mediaGroup.push(item);
break;
default:
otherGroup.push(item);
break;
}
}
return [
{
groupType: "chart",
groupName: "图表",
data: chartGroup
},
{
groupType: "decorate",
groupName: "装饰",
data: decorateGroup
},
{
groupType: "text",
groupName: "文字",
data: textGroup
},
{
groupType: "grid",
groupName: "表格",
data: gridGroup
},
{
groupType: "media",
groupName: "媒体",
data: mediaGroup
},
{
groupType: "other",
groupName: "其他",
data: otherGroup
}
];
};
export { widgetTools, getToolByCode, getWidgetToolsGroup };