fix: NEZ-3387 dashboard 图表数据导出 csv 失败
This commit is contained in:
@@ -546,24 +546,26 @@ export default {
|
|||||||
const data = this.series
|
const data = this.series
|
||||||
let csv = '"time","legend","value"\n'
|
let csv = '"time","legend","value"\n'
|
||||||
data.forEach((item, index) => {
|
data.forEach((item, index) => {
|
||||||
item.data.forEach(value => {
|
if (this.seriesData[index + 1]) {
|
||||||
let val = formatScientificNotation(value[1], this.$lodash.get(chartInfo, 'param.decimals', 2))
|
this.seriesData[index].forEach((value, timeIndex) => {
|
||||||
let unit = ''
|
let val = formatScientificNotation(value, this.$lodash.get(chartInfo, 'param.decimals', 2))
|
||||||
if (item.yAxisIndex) {
|
let unit = ''
|
||||||
unit = chartDataFormat.getUnit(this.$lodash.get(chartInfo, 'param.rightYAxis.unit', 2))
|
if (item.yAxisIndex) {
|
||||||
} else {
|
unit = chartDataFormat.getUnit(this.$lodash.get(chartInfo, 'param.rightYAxis.unit', 2))
|
||||||
unit = chartDataFormat.getUnit(this.$lodash.get(chartInfo, 'unit', 2))
|
} else {
|
||||||
}
|
unit = chartDataFormat.getUnit(this.$lodash.get(chartInfo, 'unit', 2))
|
||||||
val = unit.compute(val, index, -1, chartInfo.param.decimals || 2)
|
}
|
||||||
let legend = this.yasuo(this.legends[index].alias)
|
val = unit.compute(val, index, -1, chartInfo.param.decimals || 2)
|
||||||
try {
|
let legend = this.yasuo(this.legends[index].alias)
|
||||||
val = val.trim()
|
try {
|
||||||
legend = legend.trim()
|
val = val.trim()
|
||||||
} catch (e) {
|
legend = legend.trim()
|
||||||
console.log(e)
|
} catch (e) {
|
||||||
}
|
console.log(e)
|
||||||
csv += `"${this.momentTz(value[0] * 1000)}","${legend}","${val}"\n`
|
}
|
||||||
})
|
csv += `"${this.momentTz(this.seriesData[0][timeIndex] * 1000)}","${legend}","${val}"\n`
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
return csv
|
return csv
|
||||||
},
|
},
|
||||||
@@ -583,7 +585,7 @@ export default {
|
|||||||
break
|
break
|
||||||
case 'bar' :
|
case 'bar' :
|
||||||
legend = 'alias'
|
legend = 'alias'
|
||||||
keyByData = 'series[0].data'
|
keyByData = 'barData'
|
||||||
break
|
break
|
||||||
case 'pie' :
|
case 'pie' :
|
||||||
legend = 'alias'
|
legend = 'alias'
|
||||||
@@ -627,7 +629,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.$lodash.get(this, keyByData, []).forEach(item => {
|
this.$lodash.get(this, keyByData, []).forEach(item => {
|
||||||
let val = item.showValue
|
let val = item.showValue
|
||||||
let legends = this.yasuo(item[legend])
|
let legends = this.yasuo(item[legend] || item.alias)
|
||||||
try {
|
try {
|
||||||
val = val.trim()
|
val = val.trim()
|
||||||
legends = legends.trim()
|
legends = legends.trim()
|
||||||
|
|||||||
Reference in New Issue
Block a user