feat(视图): ECharts 汇总表导出包含合计数据 #7593 #8148

This commit is contained in:
wisonic-s 2024-04-26 16:50:53 +08:00
parent 9da4050b71
commit af4a5f83ae
2 changed files with 13 additions and 7 deletions

View File

@ -993,14 +993,11 @@ export default {
if (this.chart.type === 'map' && this.scaleCoefficientType === 'mobile') {
customAttrChart.label.show = false
}
const data = this.chart.data
delete this.chart.data
this.chart = {
...this.chart,
customAttr: JSON.stringify(customAttrChart),
customStyle: JSON.stringify(customStyleChart)
}
this.chart.data = data
},
getData(id, cache = true, dataBroadcast = false) {
if (this.requestStatus === 'waiting') {
@ -1060,12 +1057,8 @@ export default {
try {
// echart
if (response.success) {
const data = response.data.data
delete response.data.data
this.chart = response.data
this.view = response.data
this.chart.data = data
this.view.data = data
this.$store.commit('setLastViewRequestInfo', { viewId: id, requestInfo: requestInfo })
this.buildInnerRefreshTimer(this.chart.refreshViewEnable, this.chart.refreshUnit, this.chart.refreshTime)
this.$emit('fill-chart-2-parent', this.chart)

View File

@ -504,6 +504,19 @@ export function exportExcelDownload(chart, snapshot, width, height, loadingWrapp
})
})
}
if (chart.render === 'echarts' && chart.type === 'table-normal') {
const initTotal = fields.map(i => [2, 3].includes(i.deType) ? 0 : undefined)
initTotal[0] = '合计'
tableRow.reduce((p, n) => {
p.forEach((v, i) => {
if (!isNaN(v)) {
p[i] = v + n[excelHeaderKeys[i]]
}
})
return p
}, initTotal)
excelData.push(initTotal)
}
const request = {
proxy: null,
viewId: chart.id,