forked from github/dataease
Merge pull request #12632 from dataease/pr@dev-v2@chart-table-dynamic-style-fix
fix(图表): 修复表格图表文本类型设置动态条件样式失效的问题
This commit is contained in:
commit
f49ba03cf5
@ -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)
|
||||
|
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user