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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
| import zhCN from '@/locales/zh-CN/model.js'
| import enUS from '@/locales/en-US/model.js'
|
| const Formdict = localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS
|
| /**
| * @description 获取按钮表单配置信息
| * @param {*} card 编辑按钮
| * @param {*} type 按钮类型,用于区分可选的打开方式
| */
| export function getCardCellForm (card, type) {
| let _options = [
| { value: 'text', text: '文本'},
| { value: 'number', text: '数值'},
| { value: 'picture', text: '图片'},
| { value: 'video', text: '视频'},
| { value: 'icon', text: '图标'},
| { value: 'slider', text: '进度条'},
| { value: 'splitline', text: '分割线'},
| { value: 'barcode', text: '条形码'},
| { value: 'qrcode', text: '二维码'},
| { value: 'currentDate', text: '当前时间'},
| ]
|
| if (type === 'table') {
| _options.push({value: 'sequence', text: '序号'})
| }
|
| let forms = [
| {
| type: 'select',
| key: 'eleType',
| label: '元素类型',
| initVal: card.eleType,
| required: true,
| options: _options
| },
| {
| type: 'select',
| key: 'icon',
| label: '图标',
| initVal: card.icon,
| required: true,
| options: [
| { value: 'question-circle', text: 'question-circle'},
| { value: 'alert', text: 'alert'},
| { value: 'cloud', text: 'cloud'},
| { value: 'eye', text: 'eye'},
| { value: 'eye-invisible', text: 'eye-invisible'},
| { value: 'android', text: 'android'},
| { value: 'apple', text: 'apple'},
| { value: 'windows', text: 'windows'},
| { value: 'ie', text: 'ie'},
| { value: 'chrome', text: 'chrome'},
| { value: 'github', text: 'github'},
| { value: 'aliwangwang', text: 'aliwangwang'},
| { value: 'dingding', text: 'dingding'},
| { value: 'wechat', text: 'wechat'},
| { value: 'alipay', text: 'alipay'},
| { value: 'weibo-square', text: 'weibo-square'},
| { value: 'weibo-circle', text: 'weibo-circle'},
| { value: 'taobao-circle', text: 'taobao-circle'},
| { value: 'weibo', text: 'weibo'},
| { value: 'twitter', text: 'twitter'},
| { value: 'youtube', text: 'youtube'},
| { value: 'alipay-circle', text: 'alipay-circle'},
| { value: 'taobao', text: 'taobao'},
| { value: 'skype', text: 'skype'},
| { value: 'qq', text: 'qq'},
| { value: 'gitlab', text: 'gitlab'},
| { value: 'zhihu', text: 'zhihu'},
| { value: 'slack', text: 'slack'},
| { value: 'sketch', text: 'sketch'},
| { value: 'yahoo', text: 'yahoo'},
| { value: 'reddit', text: 'reddit'},
| { value: 'dribbble', text: 'dribbble'},
| ]
| },
| {
| type: 'radio',
| key: 'datatype',
| label: '数据类型',
| initVal: card.datatype || 'static',
| required: true,
| options: [
| { value: 'dynamic', text: '动态' },
| { value: 'static', text: '静态' }
| ]
| },
| {
| type: 'select',
| key: 'field',
| label: '字段',
| initVal: card.field || '',
| required: true,
| options: []
| },
| {
| type: 'text',
| key: 'value',
| min: 0,
| label: '内容',
| initVal: card.value || '',
| required: true
| },
| {
| type: 'file',
| key: 'url',
| label: '图片/文件',
| initVal: card.url || '',
| maxfile: 1,
| required: true
| },
| {
| type: 'radio',
| key: 'autoPlay',
| label: '自动播放',
| initVal: card.autoPlay || 'false',
| required: false,
| options: [
| { value: 'true', text: '是' },
| { value: 'false', text: '否' }
| ]
| },
| {
| type: 'radio',
| key: 'loop',
| label: '循环播放',
| initVal: card.loop || 'false',
| required: false,
| options: [
| { value: 'true', text: '是' },
| { value: 'false', text: '否' }
| ]
| },
| {
| type: 'radio',
| key: 'link',
| label: '链接',
| initVal: card.link || '',
| required: false,
| options: [
| { value: '', text: '无' },
| { value: 'dynamic', text: '动态' },
| { value: 'static', text: '静态' }
| ]
| },
| {
| type: 'select',
| key: 'linkurl',
| label: '链接地址',
| initVal: card.linkurl || '',
| required: true,
| options: []
| },
| {
| type: 'select',
| key: 'format',
| label: '格式化',
| initVal: card.format || '',
| required: false,
| options: [],
| oriOptions: [
| { value: '', text: '无' },
| { value: 'percent', text: '百分数' },
| { value: 'thdSeparator', text: '千分位' },
| { value: 'YYYY-MM-DD', text: 'YYYY-MM-DD' }
| ]
| },
| {
| type: 'select',
| key: 'dateFormat',
| label: '格式化',
| initVal: card.dateFormat || 'YYYY-MM-DD',
| required: true,
| options: [
| { value: 'YYYY-MM-DD', text: 'YYYY-MM-DD' },
| { value: 'YYYY', text: 'YYYY' },
| { value: 'YYYY-MM', text: 'YYYY-MM' },
| { value: 'YYYY-MM-DD HH:mm', text: 'YYYY-MM-DD HH:mm' },
| { value: 'YYYY-MM-DD HH:mm:ss', text: 'YYYY-MM-DD HH:mm:ss' },
| ]
| },
| {
| type: 'text',
| key: 'prefix',
| label: '前缀',
| initVal: card.prefix || '',
| required: false
| },
| {
| type: 'text',
| key: 'postfix',
| label: '后缀',
| initVal: card.postfix || '',
| required: false
| },
| {
| type: 'text',
| key: 'tooltip',
| label: '提示信息',
| initVal: card.tooltip || '',
| tooltip: '鼠标悬浮时显示。',
| required: false
| },
| {
| type: 'color',
| key: 'color',
| label: '颜色',
| initVal: card.color || 'rgba(0, 0, 0, 0.85)',
| required: true
| },
| {
| type: 'number',
| key: 'maxValue',
| min: 1,
| label: '最大值',
| initVal: card.maxValue || 100,
| tooltip: '即进度为100%时的值。',
| required: true,
| },
| {
| type: 'number',
| key: 'width',
| min: 1,
| max: 24,
| precision: 0,
| label: '元素宽度',
| initVal: card.width || 12,
| tooltip: '栅格布局,每行等分为24列。',
| required: true
| },
| {
| type: 'number',
| key: 'height',
| min: 1,
| max: 10,
| label: '高度(行)',
| initVal: card.height,
| tooltip: '内容显示行数,值为空时高度自适应,注:自适应高度仅在设置卡片高度后有效。',
| required: false
| },
| {
| type: 'number',
| key: 'barHeight',
| min: 5,
| max: 50,
| label: '高度',
| initVal: card.barHeight || 25,
| required: true,
| },
| {
| type: 'number',
| key: 'qrWidth',
| min: 5,
| max: 500,
| label: '宽度',
| initVal: card.qrWidth || 50,
| required: true,
| },
| {
| type: 'number',
| key: 'interval',
| min: 0.1,
| max: 10,
| precision: 1,
| label: '线条间隔',
| initVal: card.interval || 1,
| required: true,
| },
| {
| type: 'radio',
| key: 'displayValue',
| label: '显示值',
| initVal: card.displayValue || 'false',
| required: false,
| options: [
| { value: 'true', text: '是' },
| { value: 'false', text: '否' }
| ]
| },
| {
| type: 'number',
| key: 'borderWidth',
| min: 0,
| max: 50,
| label: '线宽',
| initVal: card.borderWidth || 1,
| required: true
| },
| {
| type: 'select',
| key: 'lenWidRadio',
| label: '长宽比',
| initVal: card.lenWidRadio || '1:1',
| required: true,
| options: [
| { value: '1:1', text: '1:1' },
| { value: '3:2', text: '3:2' },
| { value: '4:3', text: '4:3' },
| { value: '16:9', text: '16:9' }
| ]
| },
| {
| type: 'select',
| key: 'aspectRatio',
| label: '长宽比',
| initVal: card.aspectRatio || '16:9',
| required: true,
| options: [
| { value: '4:3', text: '4:3' },
| { value: '16:9', text: '16:9' }
| ]
| },
| {
| type: 'radio',
| key: 'joint',
| label: Formdict['model.form.paramJoint'],
| initVal: card.joint || 'true',
| required: false,
| options: [{
| value: 'true',
| text: Formdict['model.true']
| }, {
| value: 'false',
| text: Formdict['model.false']
| }]
| },
| ]
|
| return forms
| }
|
|