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
| // import zhCN from '@/locales/zh-CN/model.js'
| // import enUS from '@/locales/en-US/model.js'
|
| // const Formdict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS
|
| /**
| * @description 获取图表视图配置表单
| * @param {object} card // 图表对象
| */
| export function getBaseForm (card) {
| let appType = sessionStorage.getItem('appType')
| let roleList = sessionStorage.getItem('sysRoles')
| if (roleList) {
| try {
| roleList = JSON.parse(roleList)
| } catch (e) {
| roleList = []
| }
| } else {
| roleList = []
| }
|
| return [
| {
| type: 'text',
| key: 'title',
| label: '标题',
| initVal: card.title,
| required: false
| },
| {
| type: 'text',
| key: 'name',
| label: '组件名称',
| initVal: card.name,
| tooltip: '用于组件间的区分。',
| required: true
| },
| {
| type: 'number',
| key: 'width',
| label: '宽度',
| initVal: card.width,
| tooltip: '栅格布局,每行等分为24列。',
| min: 1,
| max: 24,
| decimal: 0,
| required: true
| },
| {
| type: 'number',
| key: 'height',
| label: '高度',
| initVal: card.height,
| min: 100,
| max: 1000,
| decimal: 0,
| required: true
| },
| {
| type: 'select',
| key: 'blacklist',
| label: '黑名单',
| initVal: card.blacklist || [],
| multi: true,
| required: false,
| options: roleList,
| forbid: !!appType
| }
| ]
| }
| /**
| * @description 获取图表视图配置表单
| * @param {object} card // 图表对象
| * @param {Array} columns // 显示列
| */
| export function getOptionForm (card, columns) {
| let yfields = columns.filter(item => /^(Int|Decimal)/ig.test(item.datatype))
|
| return [
| {
| type: 'text',
| key: 'label',
| label: '指标名称',
| initVal: card.label || '',
| required: false
| },
| {
| type: 'select',
| key: 'valueField',
| label: '显示值',
| initVal: card.valueField || '',
| required: true,
| options: yfields
| },
| {
| type: 'number',
| key: 'maxValue',
| label: '最大值',
| initVal: card.maxValue || 100,
| tooltip: '仪表盘最大刻度值',
| min: 0,
| max: 999999,
| decimal: 1,
| required: true
| },
| {
| type: 'number',
| key: 'tickInterval',
| label: '间隔',
| initVal: card.tickInterval || 10,
| tooltip: '仪表盘刻度间隔值。',
| min: 0,
| max: 999999,
| decimal: 1,
| required: true
| },
| {
| type: 'radio',
| key: 'percent',
| label: '百分率',
| initVal: card.percent || 'true',
| required: false,
| options: [{
| value: 'true',
| text: '使用'
| }, {
| value: 'false',
| text: '不使用'
| }]
| },
| {
| type: 'color',
| key: 'tickColor',
| label: '刻度线',
| initVal: card.tickColor || '#CBCBCB',
| required: false
| },
| {
| type: 'color',
| key: 'labelColor',
| label: '指标颜色',
| initVal: card.labelColor || '#545454',
| required: false
| }
| ]
| }
|
| /**
| * @description 获取图表视图配置表单
| * @param {object} card // 图表对象
| * @param {Array} columns // 显示列
| */
| export function getRadioOptionForm (card, columns) {
| let xfields = columns.filter(item => /^Nvarchar/ig.test(item.datatype))
| let yfields = columns.filter(item => /^(Int|Decimal)/ig.test(item.datatype))
|
| return [
| {
| type: 'select',
| key: 'labelField',
| label: '指标',
| initVal: card.labelField || '',
| required: true,
| options: xfields
| },
| {
| type: 'select',
| key: 'valueField',
| label: '值',
| initVal: card.valueField || '',
| required: true,
| options: yfields
| },
| {
| type: 'number',
| key: 'maxValue',
| label: '最大值',
| initVal: card.maxValue || 100,
| min: 0,
| max: 999999,
| decimal: 1,
| required: true
| },
| {
| type: 'number',
| key: 'radius',
| label: '外环',
| initVal: card.radius || 75,
| tooltip: '图形所占区域的百分率。',
| min: 30,
| max: 100,
| decimal: 0,
| required: true
| },
| {
| type: 'number',
| key: 'fontSize',
| label: '字体大小',
| initVal: card.fontSize || 28,
| min: 12,
| max: 200,
| decimal: 0,
| required: true
| },
| {
| type: 'radio',
| key: 'percent',
| label: '百分率',
| initVal: card.percent || 'true',
| required: false,
| options: [{
| value: 'true',
| text: '使用'
| }, {
| value: 'false',
| text: '不使用'
| }]
| },
| {
| type: 'color',
| key: 'backColor',
| label: '背景色',
| initVal: card.backColor || '#ebedf0',
| required: false
| },
| {
| type: 'color',
| key: 'labelColor',
| label: '字体颜色',
| initVal: card.labelColor || '#8c8c8c',
| required: false
| }
| ]
| }
|
|