refactor(图表): 富文本支持同环比,优化富文本返回数据性能

This commit is contained in:
wangjiahao 2025-01-15 16:52:59 +08:00 committed by 王嘉豪
parent d7ad7ac873
commit 5571fae31b

View File

@ -535,13 +535,25 @@ const updateEmptyValue = view => {
: '-'
}
const checkCompareCalc = view => {
let compareCount = 0
view.yAxis?.forEach(item => {
if (item?.compareCalc?.type !== 'none') {
compareCount++
}
})
return compareCount > 0
}
const calcData = (view: Chart, callback) => {
isError.value = false
updateEmptyValue(view)
if (view.tableId || view['dataFrom'] === 'template') {
const v = JSON.parse(JSON.stringify(view))
v.resultCount = 1
v.resultMode = 'custom'
if (!checkCompareCalc(view)) {
v.resultCount = 1
v.resultMode = 'custom'
}
getData(v)
.then(res => {
if (res.code && res.code !== 0) {