Merge pull request #12632 from dataease/pr@dev-v2@chart-table-dynamic-style-fix

fix(图表): 修复表格图表文本类型设置动态条件样式失效的问题
This commit is contained in:
jianneng-fit2cloud 2024-10-11 11:45:17 +08:00 committed by GitHub
commit f49ba03cf5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 17 deletions

View File

@ -299,7 +299,18 @@ const getConditionsFields = (fieldItem, conditionItem, conditionItemField) => {
conditionItem.fieldId = null
conditionItemField.fieldId = null
}
const result = state.fields.filter(item => item.deType === fieldItemDeType) ?? []
const result =
state.fields.filter(item => {
// boole
if ([0, 1, 4, 5].includes(fieldItemDeType)) {
return item.deType === fieldItemDeType
} else if ([2, 3].includes(fieldItemDeType)) {
//
return item.deType === 2 || item.deType === 3
} else {
return false
}
}) ?? []
if (!result.find(ele => ele.id === conditionItemField.fieldId)) {
conditionItemField.fieldId = result[0]?.id
addField(conditionItem)

View File

@ -578,23 +578,24 @@ export function mappingColor(value, defaultColor, field, type, filedValueMap?, r
for (let i = 0; i < field.conditions.length; i++) {
let flag = false
const t = field.conditions[i]
if (field.field.deType === 2 || field.field.deType === 3 || field.field.deType === 4) {
let tv, max, min
if (t.type === 'dynamic') {
if (t.term === 'between') {
max = parseFloat(getValue(t.dynamicMaxField, filedValueMap, rowData))
min = parseFloat(getValue(t.dynamicMinField, filedValueMap, rowData))
} else {
tv = parseFloat(getValue(t.dynamicField, filedValueMap, rowData))
}
let tv, max, min
if (t.type === 'dynamic') {
if (t.term === 'between') {
max = parseFloat(getValue(t.dynamicMaxField, filedValueMap, rowData))
min = parseFloat(getValue(t.dynamicMinField, filedValueMap, rowData))
} else {
if (t.term === 'between') {
min = parseFloat(t.min)
max = parseFloat(t.max)
} else {
tv = parseFloat(t.value)
}
tv = getValue(t.dynamicField, filedValueMap, rowData)
}
} else {
if (t.term === 'between') {
min = parseFloat(t.min)
max = parseFloat(t.max)
} else {
tv = t.value
}
}
if (field.field.deType === 2 || field.field.deType === 3 || field.field.deType === 4) {
tv = parseFloat(tv)
if (t.term === 'eq') {
if (value === tv) {
color = t[type]
@ -640,7 +641,6 @@ export function mappingColor(value, defaultColor, field, type, filedValueMap?, r
color = defaultColor
}
} else if (field.field.deType === 0 || field.field.deType === 5) {
const tv = t.value
if (t.term === 'eq') {
if (value === tv) {
color = t[type]