Merge pull request #10676 from dataease/pr@dev-v2@refactor_rich-text

refactor(图表): 优化富文本条件设置是否为空的显示判断
This commit is contained in:
王嘉豪 2024-07-01 22:51:39 +08:00 committed by GitHub
commit b8d22d107f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -227,14 +227,15 @@ const assignment = content => {
if (dataRowFiledName.value.includes(itm)) {
const ele = itm.slice(1, -1)
let value = dataRowNameSelect.value[ele] !== undefined ? dataRowNameSelect.value[ele] : null
if (value && thresholdStyleInfo && thresholdStyleInfo[ele]) {
let targetValue = !!value ? value : '-'
if (thresholdStyleInfo && thresholdStyleInfo[ele]) {
const thresholdStyle = thresholdStyleInfo[ele]
value = `<span style="color:${thresholdStyle.color};background-color: ${thresholdStyle.backgroundColor}">${value}</span>`
targetValue = `<span style="color:${thresholdStyle.color};background-color: ${thresholdStyle.backgroundColor}">${targetValue}</span>`
}
if (initReady.value) {
content = content.replace(itm, !!value ? value : '-')
content = content.replace(itm, targetValue)
} else {
content = content.replace(itm, !!value ? value : '[获取中...]')
content = content.replace(itm, !!value ? targetValue : '[获取中...]')
}
}
})
@ -366,6 +367,7 @@ const calcData = (view: Chart, callback) => {
const curViewInfo = canvasViewInfo.value[element.value.id]
curViewInfo['curFields'] = res.data.fields
dvMainStore.setViewDataDetails(element.value.id, state.data)
initReady.value = true
initCurFields(res)
}
callback?.()