mirror of
https://github.com/dataease/dataease.git
synced 2026-05-14 21:12:33 +08:00
fix(图表): 修复表格条件样式时分秒格式的组件输入不正确的问题
This commit is contained in:
committed by
jianneng-fit2cloud
parent
e5443c8b08
commit
dcab06e7f6
@@ -273,6 +273,9 @@ const changeThreshold = () => {
|
||||
|
||||
const addConditions = item => {
|
||||
const newCondition = JSON.parse(JSON.stringify(thresholdCondition))
|
||||
if (item.field.dateStyle === 'H_m_s') {
|
||||
newCondition.value = '00:00:00'
|
||||
}
|
||||
// 获取单元格默认背景颜色
|
||||
const tableCell = props.chart?.customAttr?.tableCell
|
||||
if (tableCell) {
|
||||
@@ -542,12 +545,26 @@ init()
|
||||
/>
|
||||
<el-date-picker
|
||||
v-model="item.value"
|
||||
v-else-if="[1].includes(fieldItem.field.deType)"
|
||||
v-else-if="
|
||||
[1].includes(fieldItem.field.deType) && fieldItem.field.dateStyle !== 'H_m_s'
|
||||
"
|
||||
:type="datePickerType(fieldItem.field)"
|
||||
:placeholder="t('chart.drag_block_label_value')"
|
||||
:format="datePickerFormat(fieldItem.field)"
|
||||
:value-format="datePickerFormat(fieldItem.field)"
|
||||
key="start-time-filt"
|
||||
size="default"
|
||||
class="value-item"
|
||||
@change="changeThreshold"
|
||||
style="width: 100%"
|
||||
/>
|
||||
<el-time-picker
|
||||
v-model="item.value"
|
||||
v-else-if="
|
||||
[1].includes(fieldItem.field.deType) && fieldItem.field.dateStyle === 'H_m_s'
|
||||
"
|
||||
:placeholder="t('chart.drag_block_label_value')"
|
||||
:format="datePickerFormat(fieldItem.field)"
|
||||
:value-format="datePickerFormat(fieldItem.field)"
|
||||
size="default"
|
||||
class="value-item"
|
||||
@change="changeThreshold"
|
||||
|
||||
@@ -18,6 +18,8 @@ export function transDateFormat(dateStyle: string, datePattern: string): string
|
||||
return `YYYY${split}MM${split}DD HH:mm`
|
||||
case 'y_M_d_H_m_s':
|
||||
return `YYYY${split}MM${split}DD HH:mm:ss`
|
||||
case 'H_m_s':
|
||||
return 'HH:mm:ss'
|
||||
default:
|
||||
return 'YYYY-MM-DD HH:mm:ss'
|
||||
}
|
||||
|
||||
@@ -830,8 +830,17 @@ export function mappingColor(value, defaultColor, field, type, filedValueMap?, r
|
||||
if (!tv || !value) {
|
||||
break
|
||||
}
|
||||
tv = new Date(tv.replace(/-/g, '/') + ' GMT+8').getTime()
|
||||
const v = new Date(value.replace(/-/g, '/') + ' GMT+8').getTime()
|
||||
// 特殊时间格式不转换, 包含时或者包含时、分时(不包含秒), 直接比较字符串,因为new Date转换会有误差
|
||||
const isSpecialTimeFormat = (dateStyle?: string) =>
|
||||
dateStyle === 'H_m_s' || (dateStyle && dateStyle.length > 5 && dateStyle.length < 11)
|
||||
|
||||
let v: number | string
|
||||
if (isSpecialTimeFormat(field?.field?.dateStyle)) {
|
||||
v = value
|
||||
} else {
|
||||
v = new Date(value.replace(/-/g, '/') + ' GMT+8').getTime()
|
||||
tv = new Date(tv.replace(/-/g, '/') + ' GMT+8').getTime()
|
||||
}
|
||||
if (fc.term === 'eq') {
|
||||
if (v === tv) {
|
||||
color = fc[type]
|
||||
|
||||
Reference in New Issue
Block a user