联动表问题修复

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

@@ -39,10 +39,11 @@ export default {
},
labelLine: {},
labelLayout: function (params) {
let points = params.labelLinePoints,
isLeft = points[2][0] < points[1][0]
points[2][0] =
points[2][0] + (params.labelRect.width + 4) * (isLeft ? -1 : 1)
let points = params.labelLinePoints
if (points) {
const isLeft = points[2][0] < points[1][0]
points[2][0] += (params.labelRect.width + 4) * (isLeft ? -1 : 1)
}
return {
labelLinePoints: points
}
@@ -65,32 +66,32 @@ export default {
return t + Number(Object.values(e)?.[1] || 0)
}, 0)
return h(
"div",
{
style: {
height: "162px",
width: "162px",
color: "#8BCCFF",
left: "50%",
top: "50%",
display: "flex",
alignItems: "center",
justifyContent: "center",
flexDirection: "column",
position: "absolute",
transform: "translate(-50%,-50%)",
backgroundImage: `url('https://cdn.cunwuyun.cn/dvcp/dv/tpl/pie2Circle.png')`,
backgroundPosition: "center"
}
},
[
h(
"span",
{style: {fontSize: "28px", color: "#fff", fontFamily: "DIN"}},
formatNum(total)
),
h("span", null, "总量")
]
"div",
{
style: {
height: "162px",
width: "162px",
color: "#8BCCFF",
left: "50%",
top: "50%",
display: "flex",
alignItems: "center",
justifyContent: "center",
flexDirection: "column",
position: "absolute",
transform: "translate(-50%,-50%)",
backgroundImage: `url('https://cdn.cunwuyun.cn/dvcp/dv/tpl/pie2Circle.png')`,
backgroundPosition: "center"
}
},
[
h(
"span",
{style: {fontSize: "28px", color: "#fff", fontFamily: "DIN"}},
formatNum(total)
),
h("span", null, "总量")
]
)
}
}

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;