feat(仪表板-日期范围过滤器): 增加时分秒精度设置

This commit is contained in:
fit2cloud-chenyw 2022-08-04 04:52:15 -04:00
parent 75e38914d5
commit cd253983bb
2 changed files with 16 additions and 5 deletions

View File

@ -62,7 +62,7 @@ export default {
}, },
computed: { computed: {
extPoperClass() { extPoperClass() {
if(this.labelFormat && this.labelFormat.includes('HH') && !this.labelFormat.includes('HH:mm')) { if (this.labelFormat && this.labelFormat.includes('HH') && !this.labelFormat.includes('HH:mm')) {
return 'de-no-minite' return 'de-no-minite'
} }
return '' return ''
@ -89,7 +89,7 @@ export default {
componentType() { componentType() {
let result = this.element.options.attrs.type || 'date' let result = this.element.options.attrs.type || 'date'
if (this.isTimeWidget && this.element.options.attrs.showTime) { if (this.isTimeWidget && this.element.options.attrs.showTime) {
result = 'datetime' result = this.element.serviceName === 'timeDateWidget' ? 'datetime' : 'datetimerange'
} }
return result return result
}, },
@ -127,7 +127,7 @@ export default {
this.dateChange(this.values) this.dateChange(this.values)
}, },
'labelFormat': function(val, old) { 'labelFormat': function(val, old) {
if(val !== old) { if (val !== old) {
this.show = false this.show = false
this.$nextTick(() => { this.$nextTick(() => {
this.show = true this.show = true

View File

@ -29,7 +29,9 @@ const dialogPanel = {
eDynamicPrefix: 1, eDynamicPrefix: 1,
eDynamicInfill: 'day', eDynamicInfill: 'day',
eDynamicSuffix: 'after' eDynamicSuffix: 'after'
} },
showTime: false,
accuracy: 'HH:mm'
}, },
value: '', value: '',
manualModify: false manualModify: false
@ -279,9 +281,18 @@ class TimeDateRangeServiceImpl extends WidgetService {
return results return results
} else { } else {
const value = values[0] const value = values[0]
return timeSection(parseFloat(value), element.options.attrs.type) 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)
} }
} }
isTimeWidget() {
return true
}
} }
const timeDateRangeServiceImpl = new TimeDateRangeServiceImpl() const timeDateRangeServiceImpl = new TimeDateRangeServiceImpl()
export default timeDateRangeServiceImpl export default timeDateRangeServiceImpl