perf(仪表板-日期范围过滤器): 优化时分秒精度设置

This commit is contained in:
fit2cloud-chenyw
2022-08-05 03:05:56 -04:00
parent 7a650c49b4
commit 8b616deb94
3 changed files with 35 additions and 14 deletions

View File

@@ -230,8 +230,9 @@ export default {
}
let start = values[0]
let end = values[1]
start = timeSection(start, 'date')[0]
end = timeSection(end, 'date')[1]
start = timeSection(start, 'datetime', this.labelFormat)[0]
end = timeSection(end, 'datetime', this.labelFormat)[1]
const results = [start, end]
return results
} else {
@@ -264,9 +265,6 @@ export default {
.coustom-date-picker {
border:1px solid var(--BrDateColor, #dfe4ed) !important;
background: var(--BgDateColor, #FFFFFF) !important;
// .popper__arrow::after{
// border-bottom-color: var(--BgDateColor, #FFFFFF) !important;
// }
.popper__arrow,
.popper__arrow::after {

View File

@@ -269,23 +269,24 @@ class TimeDateRangeServiceImpl extends WidgetService {
if (!values || values.length === 0) {
return []
}
const componentType = element.options.attrs.showTime ? 'datetimerange' : 'daterange'
let labelFormat = 'yyyy-MM-dd'
if (element.options.attrs.showTime && element.options.attrs.accuracy) {
labelFormat = labelFormat + ' ' + element.options.attrs.accuracy
}
if (element.options.attrs.type === 'daterange') {
if (values.length !== 2) {
return null
}
let start = values[0]
let end = values[1]
start = timeSection(start, 'date')[0]
end = timeSection(end, 'date')[1]
start = timeSection(start, 'datetime', labelFormat)[0]
end = timeSection(end, 'datetime', labelFormat)[1]
const results = [start, end]
return results
} else {
const value = values[0]
const componentType = element.options.attrs.showTime ? 'datetimerange' : 'daterange'
let labelFormat = 'yyyy-MM-dd'
if (element.options.attrs.showTime && element.options.attrs.accuracy) {
labelFormat = labelFormat + ' ' + element.options.attrs.accuracy
}
return timeSection(parseFloat(value), componentType || element.options.attrs.type, labelFormat)
}