mirror of
https://github.com/dataease/dataease.git
synced 2026-05-16 14:31:00 +08:00
feat(图表): 表格条件样式指标和日期字段支持空值判断 #17193
This commit is contained in:
@@ -117,6 +117,19 @@ const dateOptions = [
|
||||
label: t('chart.filter_ge')
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
options: [
|
||||
{
|
||||
value: 'null',
|
||||
label: t('chart.filter_null')
|
||||
},
|
||||
{
|
||||
value: 'not_null',
|
||||
label: t('chart.filter_not_null')
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
const valueOptions = [
|
||||
@@ -167,6 +180,19 @@ const valueOptions = [
|
||||
label: t('chart.filter_between')
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
options: [
|
||||
{
|
||||
value: 'null',
|
||||
label: t('chart.filter_null')
|
||||
},
|
||||
{
|
||||
value: 'not_null',
|
||||
label: t('chart.filter_not_null')
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
const predefineColors = COLOR_PANEL
|
||||
@@ -447,7 +473,7 @@ init()
|
||||
class="line-item"
|
||||
:gutter="12"
|
||||
>
|
||||
<el-col :span="3">
|
||||
<el-col :span="!isNotEmptyAndNull(item) ? 15 : 3">
|
||||
<el-form-item class="form-item">
|
||||
<el-select v-model="item.term" @change="changeThreshold">
|
||||
<el-option-group
|
||||
|
||||
@@ -754,6 +754,16 @@ export function mappingColor(value, defaultColor, field, type, filedValueMap?, r
|
||||
} else if (t.term === 'default') {
|
||||
color = t[type]
|
||||
flag = true
|
||||
} else if (t.term === 'null') {
|
||||
if (value === null || value === undefined || value === '') {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
} else if (t.term === 'not_null') {
|
||||
if (value !== null && value !== undefined && value !== '') {
|
||||
color = t[type]
|
||||
flag = true
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
break
|
||||
@@ -801,11 +811,25 @@ export function mappingColor(value, defaultColor, field, type, filedValueMap?, r
|
||||
color = defaultColor
|
||||
}
|
||||
} else {
|
||||
const fc = field.conditions[i]
|
||||
if (fc.term === 'null') {
|
||||
if (value === null && value === undefined && value === '') {
|
||||
color = fc[type]
|
||||
flag = true
|
||||
}
|
||||
} else if (fc.term === 'not_null') {
|
||||
if (value !== null && value !== undefined && value !== '') {
|
||||
color = fc[type]
|
||||
flag = true
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
break
|
||||
}
|
||||
// time
|
||||
if (!tv || !value) {
|
||||
break
|
||||
}
|
||||
const fc = field.conditions[i]
|
||||
tv = new Date(tv.replace(/-/g, '/') + ' GMT+8').getTime()
|
||||
const v = new Date(value.replace(/-/g, '/') + ' GMT+8').getTime()
|
||||
if (fc.term === 'eq') {
|
||||
|
||||
Reference in New Issue
Block a user