联动表问题修复

This commit is contained in:
aixianling
2023-10-09 20:08:00 +08:00
parent 6f6dc79702
commit cec6ccc78a
4 changed files with 52 additions and 39 deletions

View File

@@ -31,7 +31,7 @@ export default {
this.handleChangeChart()
},
handleChangeChart() {
const series = Array(this.plot.dimensions.length - 1).fill(this.tpl.daemon)
const series = this.tpl.series || Array(this.plot.dimensions.length - 1).fill(this.tpl.daemon)
this.chart.setOption({
tooltip: {},
xAxis: {
@@ -73,11 +73,20 @@ export default {
},
getChartData() {
return new DvCompData(this.plot.dataType, this.plot, this.instance).getData().then(source => {
const dataset = {
source,
dimensions: this.plot.dimensions.filter(Boolean) || []
if (this.tpl.series?.type == 'pie') {
let data
if (source?.length == 1) {
data = this.plot.dimensions.filter(Boolean).map(name => ({name, value: source[0][name]}))
} else {
const ds = this.plot.dimensions.filter(Boolean)
data = source.map(e => ({name: e[ds[0]], value: e[ds[1]]}))
}
this.chart.setOption({series: {data}})
} else {
const dataset = {source}
dataset.dimensions = this.plot.dimensions.filter(Boolean) || []
this.chart.setOption({dataset})
}
this.chart.setOption({dataset})
})
}
},

View File

@@ -76,7 +76,7 @@ export default {
display: flex;
position: relative;
align-items: center;
backdrop-filter: blur(1px);
backdrop-filter: blur(5px);
.right {
min-width: 90px;