From 42eaa4996d3565b634a00b04bbbbb7245c779a59 Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 9 Jan 2025 16:28:21 +0800 Subject: [PATCH] perf: update page height --- src/components/DataActions/index.vue | 2 + .../Form/FormFields/DateRangePicker.vue | 108 ++++++++++++++++++ .../Form/FormFields/DatetimeRangePicker.vue | 28 ++++- src/layout/components/Page/index.vue | 32 ++++-- src/layout/components/TabPage/index.vue | 43 +++++-- src/store/modules/assets.js | 14 ++- .../DatabaseCreateUpdate.vue | 12 +- .../Asset/AssetList/components/BaseList.vue | 11 +- .../assets/Platform/PlatformCreateUpdate.vue | 8 +- src/views/assets/Platform/PlatformList.vue | 5 +- src/views/pam/Account/index.vue | 1 + 11 files changed, 211 insertions(+), 53 deletions(-) create mode 100644 src/components/Form/FormFields/DateRangePicker.vue diff --git a/src/components/DataActions/index.vue b/src/components/DataActions/index.vue index 6812d574c..26bf9f6fc 100644 --- a/src/components/DataActions/index.vue +++ b/src/components/DataActions/index.vue @@ -360,6 +360,8 @@ $color-drop-menu-border: #e4e7ed; } .el-dropdown-menu__item { + padding: 0 20px; + &.is-disabled { color: var(--color-disabled); cursor: not-allowed; diff --git a/src/components/Form/FormFields/DateRangePicker.vue b/src/components/Form/FormFields/DateRangePicker.vue new file mode 100644 index 000000000..1e2d85286 --- /dev/null +++ b/src/components/Form/FormFields/DateRangePicker.vue @@ -0,0 +1,108 @@ + + + + + diff --git a/src/components/Form/FormFields/DatetimeRangePicker.vue b/src/components/Form/FormFields/DatetimeRangePicker.vue index 1e2d85286..f89d501ba 100644 --- a/src/components/Form/FormFields/DatetimeRangePicker.vue +++ b/src/components/Form/FormFields/DatetimeRangePicker.vue @@ -7,9 +7,9 @@ :picker-options="pickerOptions" :range-separator="$tc('To')" :start-placeholder="$tc('DateStart')" + :type="type" class="datepicker" size="small" - type="datetimerange" v-bind="$attrs" @change="handleDateChange" v-on="$listeners" @@ -28,6 +28,15 @@ export default { dateEnd: { type: [Number, String, Date], default: null + }, + type: { + type: String, + default: 'daterange' + // default: 'datetimerange' + }, + toMinMax: { + type: Boolean, + default: true } }, data() { @@ -35,6 +44,10 @@ export default { const endValue = this.dateEnd || this.$route.query['date_end'] const dateStart = new Date(startValue) const dateTo = new Date(endValue) + if (this.toMinMax) { + dateStart.setHours(0, 0, 0, 0) + dateTo.setHours(23, 59, 59, 999) + } return { value: [dateStart, dateTo], pickerOptions: { @@ -74,9 +87,13 @@ export default { } }, onShortcutClick(picker, day) { - const end = new Date() - const start = new Date() + let start = new Date() + let end = new Date() start.setTime(start.getTime() - 3600 * 1000 * 24 * day) + if (this.toMinMax) { + start = new Date(start.setHours(0, 0, 0, 0)) + end = new Date(end.setHours(23, 59, 59, 999)) + } picker.$emit('pick', [start, end]) } } @@ -85,8 +102,11 @@ export default {