lw-cdp-ui 1.3.31 → 1.3.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/lwBiChart/charts/AreaChart.vue +2 -0
- package/dist/components/lwBiChart/charts/BarChart.vue +181 -49
- package/dist/components/lwBiChart/charts/FunnelChart.vue +2 -0
- package/dist/components/lwBiChart/charts/GaugeChart.vue +2 -0
- package/dist/components/lwBiChart/charts/LineChart.vue +2 -0
- package/dist/components/lwBiChart/charts/MapChart.vue +2 -0
- package/dist/components/lwBiChart/charts/MetricCard.vue +18 -20
- package/dist/components/lwBiChart/charts/PieChart.vue +2 -0
- package/dist/components/lwBiChart/charts/RadarChart.vue +2 -0
- package/dist/components/lwBiChart/charts/ReportTable.vue +3 -1
- package/dist/components/lwBiChart/charts/ScatterChart.vue +2 -0
- package/dist/lw-cdp-ui.esm.js +11026 -5938
- package/dist/lw-cdp-ui.umd.js +20 -20
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -49,8 +49,7 @@ export default {
|
|
|
49
49
|
if (this.chart) {
|
|
50
50
|
this.chart.dispose()
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
this.chart = markRaw(markRaw(this.echarts.init(this.$refs.chartRef)))
|
|
52
|
+
this.chart = markRaw(this.echarts.init(this.$refs.chartRef))
|
|
54
53
|
this.updateChart()
|
|
55
54
|
|
|
56
55
|
window.addEventListener('resize', () => {
|
|
@@ -62,19 +61,20 @@ export default {
|
|
|
62
61
|
updateChart() {
|
|
63
62
|
if (!this.chart || !this.rawData) return
|
|
64
63
|
|
|
65
|
-
const {setting, dataSet} = this.rawData
|
|
66
|
-
const {tables} = dataSet
|
|
67
|
-
if (!tables || tables.length === 0) return
|
|
64
|
+
const {setting = {}, dataSet} = this.rawData
|
|
65
|
+
const {tables = []} = dataSet || {}
|
|
68
66
|
|
|
69
67
|
this.option = {
|
|
70
68
|
title: this.getTitleOption(setting),
|
|
71
69
|
legend: this.getLegendOption(setting, tables),
|
|
72
|
-
grid: setting
|
|
73
|
-
tooltip: setting
|
|
74
|
-
|
|
70
|
+
grid: this.getGridOption(setting),
|
|
71
|
+
tooltip: this.getTooltipOption(setting),
|
|
72
|
+
toolbox: this.getToolboxOption(setting),
|
|
73
|
+
color: setting.useThemeColor ? undefined : setting.color || this.getDefaultColors(),
|
|
75
74
|
xAxis: this.getXAxisOption(setting, tables),
|
|
76
|
-
yAxis: this.getYAxisOption(setting),
|
|
77
|
-
series: this.getSeries(setting, tables)
|
|
75
|
+
yAxis: this.getYAxisOption(setting, tables),
|
|
76
|
+
series: this.getSeries(setting, tables),
|
|
77
|
+
dataZoom: this.getDataZoomOption(setting)
|
|
78
78
|
}
|
|
79
79
|
this.chart.setOption(this.option)
|
|
80
80
|
setTimeout(() => {
|
|
@@ -82,65 +82,195 @@ export default {
|
|
|
82
82
|
}, 10)
|
|
83
83
|
},
|
|
84
84
|
|
|
85
|
+
// 配置项方法(保持与AreaChart一致的逻辑结构)
|
|
85
86
|
getTitleOption(setting) {
|
|
86
87
|
return {
|
|
87
|
-
show: setting.title?.show
|
|
88
|
+
show: setting.title?.show !== false,
|
|
88
89
|
text: setting.title?.text || '',
|
|
89
|
-
textStyle:
|
|
90
|
+
textStyle: {
|
|
91
|
+
fontSize: 16,
|
|
92
|
+
fontWeight: 'bold',
|
|
93
|
+
color: '#333',
|
|
94
|
+
...setting.title?.textStyle
|
|
95
|
+
},
|
|
90
96
|
left: setting.title?.left || 'center',
|
|
97
|
+
top: setting.title?.top || 'top',
|
|
91
98
|
padding: setting.title?.padding || [5, 5, 5, 5]
|
|
92
99
|
}
|
|
93
100
|
},
|
|
94
101
|
|
|
95
102
|
getLegendOption(setting, tables) {
|
|
96
103
|
return {
|
|
97
|
-
|
|
98
|
-
data: tables.map(table => table.metricName)
|
|
104
|
+
show: setting.legend?.show !== false,
|
|
105
|
+
data: tables.map(table => table.metricName),
|
|
106
|
+
type: setting.legend?.type || 'scroll',
|
|
107
|
+
orient: setting.legend?.orient || 'horizontal',
|
|
108
|
+
left: setting.legend?.left || 'center',
|
|
109
|
+
top: setting.legend?.top || 'bottom',
|
|
110
|
+
itemGap: setting.legend?.itemGap || 10,
|
|
111
|
+
itemWidth: setting.legend?.itemWidth || 25,
|
|
112
|
+
itemHeight: setting.legend?.itemHeight || 14,
|
|
113
|
+
textStyle: {
|
|
114
|
+
fontSize: 12,
|
|
115
|
+
...setting.legend?.textStyle
|
|
116
|
+
}
|
|
99
117
|
}
|
|
100
118
|
},
|
|
101
119
|
|
|
102
|
-
|
|
103
|
-
return
|
|
104
|
-
|
|
105
|
-
:
|
|
106
|
-
|
|
107
|
-
|
|
120
|
+
getGridOption(setting) {
|
|
121
|
+
return {
|
|
122
|
+
left: setting.grid?.left || '3%',
|
|
123
|
+
right: setting.grid?.right || '4%',
|
|
124
|
+
top: setting.grid?.top || '15%',
|
|
125
|
+
bottom: setting.grid?.bottom || (setting.legend?.show !== false ? '15%' : '3%'),
|
|
126
|
+
containLabel: setting.grid?.containLabel !== false
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
getTooltipOption(setting) {
|
|
131
|
+
return {
|
|
132
|
+
trigger: 'axis',
|
|
133
|
+
axisPointer: {
|
|
134
|
+
type: setting.tooltip?.axisPointer?.type || 'shadow',
|
|
135
|
+
label: {
|
|
136
|
+
backgroundColor: setting.tooltip?.axisPointer?.label?.backgroundColor || '#6a7985'
|
|
108
137
|
}
|
|
138
|
+
},
|
|
139
|
+
formatter: params => {
|
|
140
|
+
if (setting.tooltip?.formatter) return setting.tooltip.formatter(params)
|
|
141
|
+
return params.map(item => `${item.marker} ${item.seriesName}: ${item.value}`).join('<br/>')
|
|
142
|
+
}
|
|
143
|
+
}
|
|
109
144
|
},
|
|
110
145
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
146
|
+
getToolboxOption(setting) {
|
|
147
|
+
if (setting.toolbox?.show === false) return {show: false}
|
|
148
|
+
|
|
149
|
+
return {
|
|
150
|
+
right: 10,
|
|
151
|
+
top: 0,
|
|
152
|
+
feature: {
|
|
153
|
+
saveAsImage: {
|
|
154
|
+
show: setting.toolbox?.features?.saveAsImage?.show !== false,
|
|
155
|
+
title: '保存为图片',
|
|
156
|
+
pixelRatio: 2
|
|
157
|
+
},
|
|
158
|
+
dataView: {
|
|
159
|
+
show: setting.toolbox?.features?.dataView?.show !== false,
|
|
160
|
+
readOnly: true,
|
|
161
|
+
title: '数据视图'
|
|
162
|
+
},
|
|
163
|
+
magicType: {
|
|
164
|
+
show: setting.toolbox?.features?.magicType?.show !== false,
|
|
165
|
+
title: {line: '折线图', bar: '柱状图'},
|
|
166
|
+
type: ['line', 'bar']
|
|
167
|
+
},
|
|
168
|
+
restore: {
|
|
169
|
+
show: setting.toolbox?.features?.restore?.show !== false,
|
|
170
|
+
title: '还原'
|
|
116
171
|
}
|
|
117
|
-
|
|
172
|
+
}
|
|
173
|
+
}
|
|
118
174
|
},
|
|
119
175
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
176
|
+
getXAxisOption(setting, tables) {
|
|
177
|
+
const isCategory = !setting.revertAxis
|
|
178
|
+
return {
|
|
179
|
+
type: isCategory ? 'category' : 'value',
|
|
180
|
+
data: isCategory ? tables[0]?.headers : undefined,
|
|
181
|
+
axisLabel: {
|
|
182
|
+
show: setting.xAxis?.axisLabel?.show !== false,
|
|
183
|
+
rotate: setting.xAxis?.axisLabel?.rotate || 0,
|
|
184
|
+
interval: setting.xAxis?.axisLabel?.interval || 0,
|
|
185
|
+
formatter: setting.xAxis?.axisLabel?.formatter
|
|
186
|
+
},
|
|
187
|
+
axisTick: {
|
|
188
|
+
show: setting.xAxis?.axisTick?.show !== false,
|
|
189
|
+
alignWithLabel: true
|
|
190
|
+
},
|
|
191
|
+
axisLine: {
|
|
192
|
+
show: setting.xAxis?.axisLine?.show !== false
|
|
193
|
+
},
|
|
194
|
+
splitLine: {
|
|
195
|
+
show: setting.xAxis?.splitLine?.show || false
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
|
|
200
|
+
getYAxisOption(setting, tables) {
|
|
201
|
+
const isValue = !setting.revertAxis
|
|
202
|
+
return {
|
|
203
|
+
type: isValue ? 'value' : 'category',
|
|
204
|
+
data: isValue ? undefined : tables[0]?.headers,
|
|
205
|
+
axisLabel: {
|
|
206
|
+
show: setting.yAxis?.axisLabel?.show !== false,
|
|
207
|
+
formatter: isValue
|
|
208
|
+
? setting.yAxis?.axisLabel?.formatter || (val => (val >= 10000 ? `${(val / 10000).toFixed(1)}万` : val))
|
|
209
|
+
: undefined
|
|
210
|
+
},
|
|
211
|
+
axisTick: {
|
|
212
|
+
show: setting.yAxis?.axisTick?.show !== false
|
|
213
|
+
},
|
|
214
|
+
axisLine: {
|
|
215
|
+
show: setting.yAxis?.axisLine?.show !== false
|
|
216
|
+
},
|
|
217
|
+
splitLine: {
|
|
218
|
+
show: setting.yAxis?.splitLine?.show !== false,
|
|
219
|
+
lineStyle: {
|
|
220
|
+
type: 'dashed'
|
|
142
221
|
}
|
|
143
|
-
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
|
|
226
|
+
getSeries(setting, tables) {
|
|
227
|
+
const visibleTables = setting.displayMetrics
|
|
228
|
+
? tables.filter(table => setting.displayMetrics.includes(`${table.name}.${table.metricId}`))
|
|
229
|
+
: tables
|
|
230
|
+
|
|
231
|
+
return visibleTables.map(table => ({
|
|
232
|
+
name: table.metricName,
|
|
233
|
+
type: 'bar',
|
|
234
|
+
// barWidth: setting.barWidth || '60%',
|
|
235
|
+
barGap: setting.barGap || '30%',
|
|
236
|
+
barCategoryGap: setting.barCategoryGap || '30%',
|
|
237
|
+
data: table.rows[0].values.map((value, idx) => ({
|
|
238
|
+
value,
|
|
239
|
+
name: table.headers[idx]
|
|
240
|
+
})),
|
|
241
|
+
label: {
|
|
242
|
+
show: setting.label?.show || false,
|
|
243
|
+
position: setting.label?.position || 'top',
|
|
244
|
+
formatter: setting.label?.formatter || '{@value}',
|
|
245
|
+
fontSize: setting.label?.fontSize || 12
|
|
246
|
+
},
|
|
247
|
+
itemStyle: {
|
|
248
|
+
borderRadius: setting.itemStyle?.borderRadius || 0,
|
|
249
|
+
opacity: setting.itemStyle?.opacity || 1
|
|
250
|
+
},
|
|
251
|
+
showBackground: setting.showBackground || false,
|
|
252
|
+
backgroundStyle: {
|
|
253
|
+
color: 'rgba(180, 180, 180, 0.2)'
|
|
254
|
+
}
|
|
255
|
+
}))
|
|
256
|
+
},
|
|
257
|
+
|
|
258
|
+
getDataZoomOption(setting) {
|
|
259
|
+
if (!setting.dataZoom?.show) return undefined
|
|
260
|
+
|
|
261
|
+
return [
|
|
262
|
+
{
|
|
263
|
+
type: 'slider',
|
|
264
|
+
show: true,
|
|
265
|
+
start: setting.dataZoom?.start || 0,
|
|
266
|
+
end: setting.dataZoom?.end || 100,
|
|
267
|
+
...setting.dataZoom
|
|
268
|
+
}
|
|
269
|
+
]
|
|
270
|
+
},
|
|
271
|
+
|
|
272
|
+
getDefaultColors() {
|
|
273
|
+
return ['#5470c6', '#91cc75', '#fac858', '#ee6666', '#73c0de', '#3ba272', '#fc8452', '#9a60b4', '#ea7ccc']
|
|
144
274
|
}
|
|
145
275
|
}
|
|
146
276
|
}
|
|
@@ -148,6 +278,8 @@ export default {
|
|
|
148
278
|
|
|
149
279
|
<style scoped>
|
|
150
280
|
.chart {
|
|
281
|
+
background-color: var(--el-bg-color-overlay);
|
|
282
|
+
box-shadow: 0 0 30px rgba(0, 0, 0, 0.0509803922);
|
|
151
283
|
width: 100%;
|
|
152
284
|
height: 100%;
|
|
153
285
|
}
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
</el-tooltip>
|
|
15
15
|
|
|
16
16
|
<strong class="title"
|
|
17
|
-
style="{ color: item.color }">{{ item.index }}</strong>
|
|
17
|
+
:style="{ color: item.color }">{{ item.index }}</strong>
|
|
18
18
|
</div>
|
|
19
19
|
</template>
|
|
20
20
|
</el-statistic>
|
|
21
21
|
|
|
22
|
-
<div class="statistic-footer">
|
|
22
|
+
<!-- <div class="statistic-footer">
|
|
23
23
|
<span>{{ item.subtitle }}</span>
|
|
24
24
|
<div :style="{ color: item.percentage >= 0 ? '#BF1220' : '#00B78B' }">
|
|
25
25
|
<el-icon v-if="item.percentage >= 0"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
class="icon-down"><el-icon-bottom /></el-icon>
|
|
29
29
|
{{ Math.abs(item.percentage) }}%
|
|
30
30
|
</div>
|
|
31
|
-
</div>
|
|
31
|
+
</div> -->
|
|
32
32
|
</div>
|
|
33
33
|
</template>
|
|
34
34
|
|
|
@@ -57,7 +57,7 @@ export default {
|
|
|
57
57
|
tables.forEach((table, index) => {
|
|
58
58
|
table.headers.forEach((x, xIndex) => {
|
|
59
59
|
result.push({
|
|
60
|
-
title: setting?.title?.text || table.metricName
|
|
60
|
+
title: `${setting?.title?.text || table.metricName} ${table?.unitName ? `(${table.unitName})` : ''}`,
|
|
61
61
|
index: x,
|
|
62
62
|
color: setting.color[xIndex],
|
|
63
63
|
subtitle: '环比上期',
|
|
@@ -83,33 +83,31 @@ export default {
|
|
|
83
83
|
</script>
|
|
84
84
|
|
|
85
85
|
<style lang="scss" scoped>
|
|
86
|
-
|
|
87
|
-
|
|
88
86
|
.chart-title-card {
|
|
89
|
-
padding:
|
|
90
|
-
|
|
87
|
+
padding: 15px;
|
|
88
|
+
flex: 1;
|
|
91
89
|
border-radius: 5px;
|
|
92
|
-
min-height:
|
|
90
|
+
min-height: 110px;
|
|
93
91
|
height: 100%;
|
|
94
|
-
max-height:
|
|
95
|
-
max-width: 300px;
|
|
92
|
+
max-height: 110px;
|
|
93
|
+
// max-width: 300px;
|
|
96
94
|
width: 100%;
|
|
97
|
-
min-width:
|
|
95
|
+
min-width: 30%;
|
|
98
96
|
display: flex;
|
|
99
97
|
flex-direction: column;
|
|
100
|
-
justify-content: space-between
|
|
101
|
-
|
|
102
|
-
:
|
|
103
|
-
background-color: var(--el-fill-color) !important;
|
|
98
|
+
justify-content: space-between;
|
|
99
|
+
background-color: var(--el-bg-color-overlay);
|
|
100
|
+
box-shadow: 0 0 30px rgba(0, 0, 0, 0.0509803922);
|
|
104
101
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
102
|
+
:deep(.el-statistic__number) {
|
|
103
|
+
line-height: 50px;
|
|
104
|
+
font-size: 40px;
|
|
108
105
|
}
|
|
109
106
|
.title-container {
|
|
110
107
|
position: relative;
|
|
108
|
+
font-size: 14px;
|
|
111
109
|
.title {
|
|
112
|
-
font-size:
|
|
110
|
+
font-size: 17px;
|
|
113
111
|
position: absolute;
|
|
114
112
|
right: 0;
|
|
115
113
|
}
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
<el-pagination :current-page="currentPage"
|
|
30
30
|
:page-sizes="pageSizes"
|
|
31
31
|
:page-size="pageSize"
|
|
32
|
+
size="small"
|
|
32
33
|
layout="total, sizes, prev, pager, next, jumper"
|
|
33
34
|
:total="total"
|
|
34
35
|
@size-change="handleSizeChange"
|
|
@@ -128,8 +129,9 @@ export default {
|
|
|
128
129
|
width: 100%;
|
|
129
130
|
}
|
|
130
131
|
.pagination-container {
|
|
131
|
-
margin-top:
|
|
132
|
+
margin-top: 10px;
|
|
132
133
|
display: flex;
|
|
133
134
|
justify-content: flex-end;
|
|
135
|
+
padding-right: 10px;
|
|
134
136
|
}
|
|
135
137
|
</style>
|