From cd253983bb56e3ffddf8ab85e49c7d6f8ea1bfd1 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Thu, 4 Aug 2022 04:52:15 -0400 Subject: [PATCH] =?UTF-8?q?feat(=E4=BB=AA=E8=A1=A8=E6=9D=BF-=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E8=8C=83=E5=9B=B4=E8=BF=87=E6=BB=A4=E5=99=A8):=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=B6=E5=88=86=E7=A7=92=E7=B2=BE=E5=BA=A6?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/widget/DeWidget/DeDate.vue | 6 +++--- .../serviceImpl/TimeDateRangeServiceImpl.js | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/widget/DeWidget/DeDate.vue b/frontend/src/components/widget/DeWidget/DeDate.vue index 9d2944983e..73d97c5127 100644 --- a/frontend/src/components/widget/DeWidget/DeDate.vue +++ b/frontend/src/components/widget/DeWidget/DeDate.vue @@ -62,7 +62,7 @@ export default { }, computed: { 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 '' @@ -89,7 +89,7 @@ export default { componentType() { let result = this.element.options.attrs.type || 'date' if (this.isTimeWidget && this.element.options.attrs.showTime) { - result = 'datetime' + result = this.element.serviceName === 'timeDateWidget' ? 'datetime' : 'datetimerange' } return result }, @@ -127,7 +127,7 @@ export default { this.dateChange(this.values) }, 'labelFormat': function(val, old) { - if(val !== old) { + if (val !== old) { this.show = false this.$nextTick(() => { this.show = true diff --git a/frontend/src/components/widget/serviceImpl/TimeDateRangeServiceImpl.js b/frontend/src/components/widget/serviceImpl/TimeDateRangeServiceImpl.js index 372ecb68ba..6fcd7d1cd5 100644 --- a/frontend/src/components/widget/serviceImpl/TimeDateRangeServiceImpl.js +++ b/frontend/src/components/widget/serviceImpl/TimeDateRangeServiceImpl.js @@ -29,7 +29,9 @@ const dialogPanel = { eDynamicPrefix: 1, eDynamicInfill: 'day', eDynamicSuffix: 'after' - } + }, + showTime: false, + accuracy: 'HH:mm' }, value: '', manualModify: false @@ -279,9 +281,18 @@ class TimeDateRangeServiceImpl extends WidgetService { return results } else { 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() export default timeDateRangeServiceImpl