From 2d8112738506dbe84937a66de943c9acef5d35d7 Mon Sep 17 00:00:00 2001 From: "wu.jian2" Date: Mon, 25 Sep 2023 10:11:23 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=A0=B9=E6=8D=AE=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=84=8F=E8=A7=81=E8=B0=83=E6=95=B4=E6=97=B6=E9=97=B4=E3=80=81?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E6=97=B6=E9=97=B4=E9=80=89=E6=8B=A9=E5=99=A8?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E9=85=8D=E7=BD=AE=EF=BC=8C=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E6=95=B0=E6=8D=AE=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E4=B8=BA=E8=87=AA=E5=AE=9A=E4=B9=89=EF=BC=8C=E5=8E=BB=E9=99=A4?= =?UTF-8?q?Date=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BasicComponents/CurrentTime/index.vue | 4 ++-- .../BasicComponents/DateTimePicker/index.vue | 6 +++++- .../BasicComponents/DateTimePicker/setting.vue | 17 +++++++++++------ .../DateTimePicker/settingConfig.js | 6 +++--- .../BasicComponents/TimePicker/index.vue | 11 ++++++++++- .../BasicComponents/TimePicker/setting.vue | 17 ++++++++--------- .../BasicComponents/TimePicker/settingConfig.js | 6 +++--- .../packages/js/utils/getComponentConfig.js | 2 +- 8 files changed, 43 insertions(+), 26 deletions(-) diff --git a/data-room-ui/packages/BasicComponents/CurrentTime/index.vue b/data-room-ui/packages/BasicComponents/CurrentTime/index.vue index ea09a316..f3aea7b0 100644 --- a/data-room-ui/packages/BasicComponents/CurrentTime/index.vue +++ b/data-room-ui/packages/BasicComponents/CurrentTime/index.vue @@ -31,8 +31,8 @@ import moment from 'moment' import paramsMixins from 'data-room-ui/js/mixins/paramsMixins' import { settingToTheme } from 'data-room-ui/js/utils/themeFormatting' -import cloneDeep from "lodash/cloneDeep"; -import {mapMutations, mapState} from 'vuex' +import cloneDeep from 'lodash/cloneDeep' +import { mapMutations, mapState } from 'vuex' export default { name: 'CurrentTime', mixins: [paramsMixins], diff --git a/data-room-ui/packages/BasicComponents/DateTimePicker/index.vue b/data-room-ui/packages/BasicComponents/DateTimePicker/index.vue index 17b51ce6..cd43e446 100644 --- a/data-room-ui/packages/BasicComponents/DateTimePicker/index.vue +++ b/data-room-ui/packages/BasicComponents/DateTimePicker/index.vue @@ -52,7 +52,7 @@ export default { if (val && val.customize && val.customize.formatType === 'custom') { // 解决时间格式化类型为自定义时,时间格式化类型和时间格式化值数据类型不匹配的问题 this.$nextTick(() => { - this.value = toString(this.value) + this.config.customize.value = toString(this.config.customize.value) }) } }, @@ -65,6 +65,10 @@ export default { document.querySelector(`.date-picker-${this.config.code}`).style.pointerEvents = 'none' } this.changeStyle(this.config) + // 将config.customize.value设置值为当前时间 : + if (this.config.customize.value === '') { + this.config.customize.value = new Date() + } }, beforeDestroy () { }, diff --git a/data-room-ui/packages/BasicComponents/DateTimePicker/setting.vue b/data-room-ui/packages/BasicComponents/DateTimePicker/setting.vue index ff6a547b..8f52700e 100644 --- a/data-room-ui/packages/BasicComponents/DateTimePicker/setting.vue +++ b/data-room-ui/packages/BasicComponents/DateTimePicker/setting.vue @@ -137,13 +137,22 @@ /> +
+ 时间格式示例:
+ yyyy:表示年份,
+ MM:表示月份,
+ dd:表示日期,
+ HH:表示小时(24小时制),
+ mm:表示分钟,
+ ss:表示秒,
+ 具体可参考Element-UI官网的日期选择器的时间格式化部分。 +
@@ -193,7 +202,6 @@ export default { second: 'ss', // 时间格式化类型选项 formatTypeOptions: [ - { label: 'Date 对象', value: 'default' }, { label: '时间戳', value: 'timestamp' }, { label: '自定义', value: 'custom' } ], @@ -213,10 +221,7 @@ export default { mounted () {}, methods: { selectFormatType (type) { - if (type === 'default') { - this.config.customize.value = '' - this.config.customize.valueFormat = '' - } else if (type === 'timestamp') { + if (type === 'timestamp') { this.config.customize.value = 0 this.config.customize.valueFormat = 'timestamp' } else if (type === 'custom') { diff --git a/data-room-ui/packages/BasicComponents/DateTimePicker/settingConfig.js b/data-room-ui/packages/BasicComponents/DateTimePicker/settingConfig.js index aeb80e2d..fc580d74 100644 --- a/data-room-ui/packages/BasicComponents/DateTimePicker/settingConfig.js +++ b/data-room-ui/packages/BasicComponents/DateTimePicker/settingConfig.js @@ -31,10 +31,10 @@ const customConfig = { fontSize: 20, // 显示类型 year/month/date/week/ datetime/datetimerange/daterange type: 'datetime', - // 时间格式化类型:Date 对象(default),时间戳(timestamp),自定义(custom) - formatType: 'default', + // 时间格式化类型:时间戳(timestamp),自定义(custom) + formatType: 'custom', // 绑定值的格式 - valueFormat: '', + valueFormat: 'yyyy-MM-dd HH:mm:ss', // 下拉框 dropDownBox: { // 下拉框背景颜色 diff --git a/data-room-ui/packages/BasicComponents/TimePicker/index.vue b/data-room-ui/packages/BasicComponents/TimePicker/index.vue index 67fd912c..9fac689d 100644 --- a/data-room-ui/packages/BasicComponents/TimePicker/index.vue +++ b/data-room-ui/packages/BasicComponents/TimePicker/index.vue @@ -14,6 +14,7 @@