From 14f5932f80362feae950c80c5b1fa940562b9db5 Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Mon, 18 Nov 2024 15:05:45 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=9F=A5=E8=AF=A2=E7=BB=84=E4=BB=B6):=20?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E7=BB=84=E4=BB=B6=E9=BB=98=E8=AE=A4=E5=80=BC?= =?UTF-8?q?=E5=B8=8C=E6=9C=9B=E5=A2=9E=E5=8A=A0=E6=9C=88=E5=BA=95=20#10776?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../v-query/ConditionDefaultConfiguration.vue | 8 ++++++++ .../src/custom-component/v-query/DynamicTime.vue | 4 ++++ .../v-query/QueryConditionConfiguration.vue | 8 ++++++++ .../src/custom-component/v-query/RangeFilterTime.vue | 8 ++++++++ .../src/custom-component/v-query/time-format.ts | 12 ++++++++++++ core/core-frontend/src/locales/zh-CN.ts | 1 + core/core-frontend/src/style/index.less | 2 +- 7 files changed, 42 insertions(+), 1 deletion(-) diff --git a/core/core-frontend/src/custom-component/v-query/ConditionDefaultConfiguration.vue b/core/core-frontend/src/custom-component/v-query/ConditionDefaultConfiguration.vue index 056f788416..d16c6cacb9 100644 --- a/core/core-frontend/src/custom-component/v-query/ConditionDefaultConfiguration.vue +++ b/core/core-frontend/src/custom-component/v-query/ConditionDefaultConfiguration.vue @@ -126,6 +126,10 @@ const relativeToCurrentList = computed(() => { label: t('dynamic_time.firstOfMonth'), value: 'monthBeginning' }, + { + label: t('dynamic_time.endOfMonth'), + value: 'monthEnd' + }, { label: t('dynamic_time.firstOfYear'), value: 'yearBeginning' @@ -146,6 +150,10 @@ const relativeToCurrentList = computed(() => { label: t('dynamic_time.firstOfMonth'), value: 'monthBeginning' }, + { + label: t('dynamic_time.endOfMonth'), + value: 'monthEnd' + }, { label: t('dynamic_time.firstOfYear'), value: 'yearBeginning' diff --git a/core/core-frontend/src/custom-component/v-query/DynamicTime.vue b/core/core-frontend/src/custom-component/v-query/DynamicTime.vue index cece87245b..98607b4190 100644 --- a/core/core-frontend/src/custom-component/v-query/DynamicTime.vue +++ b/core/core-frontend/src/custom-component/v-query/DynamicTime.vue @@ -10,6 +10,7 @@ import { getToday, getYesterday, getMonthBeginning, + getMonthEnd, getYearBeginning, getCustomTime } from './time-format' @@ -141,6 +142,9 @@ const init = () => { case 'monthBeginning': selectValue.value = getMonthBeginning() break + case 'monthEnd': + selectValue.value = getMonthEnd() + break case 'yearBeginning': selectValue.value = getYearBeginning() break diff --git a/core/core-frontend/src/custom-component/v-query/QueryConditionConfiguration.vue b/core/core-frontend/src/custom-component/v-query/QueryConditionConfiguration.vue index 1e483e5e18..97b5edae15 100644 --- a/core/core-frontend/src/custom-component/v-query/QueryConditionConfiguration.vue +++ b/core/core-frontend/src/custom-component/v-query/QueryConditionConfiguration.vue @@ -1873,6 +1873,10 @@ const relativeToCurrentList = computed(() => { label: t('dynamic_time.firstOfMonth'), value: 'monthBeginning' }, + { + label: t('dynamic_time.endOfMonth'), + value: 'monthEnd' + }, { label: t('dynamic_time.firstOfYear'), value: 'yearBeginning' @@ -1893,6 +1897,10 @@ const relativeToCurrentList = computed(() => { label: t('dynamic_time.firstOfMonth'), value: 'monthBeginning' }, + { + label: t('dynamic_time.endOfMonth'), + value: 'monthEnd' + }, { label: t('dynamic_time.firstOfYear'), value: 'yearBeginning' diff --git a/core/core-frontend/src/custom-component/v-query/RangeFilterTime.vue b/core/core-frontend/src/custom-component/v-query/RangeFilterTime.vue index f0ce1313ee..ebe8d02201 100644 --- a/core/core-frontend/src/custom-component/v-query/RangeFilterTime.vue +++ b/core/core-frontend/src/custom-component/v-query/RangeFilterTime.vue @@ -138,6 +138,10 @@ const relativeToCurrentList = computed(() => { label: t('dynamic_time.firstOfMonth'), value: 'monthBeginning' }, + { + label: t('dynamic_time.endOfMonth'), + value: 'monthEnd' + }, { label: t('dynamic_time.firstOfYear'), value: 'yearBeginning' @@ -158,6 +162,10 @@ const relativeToCurrentList = computed(() => { label: t('dynamic_time.firstOfMonth'), value: 'monthBeginning' }, + { + label: t('dynamic_time.endOfMonth'), + value: 'monthEnd' + }, { label: t('dynamic_time.firstOfYear'), value: 'yearBeginning' diff --git a/core/core-frontend/src/custom-component/v-query/time-format.ts b/core/core-frontend/src/custom-component/v-query/time-format.ts index de6f7eecaa..78aec5b255 100644 --- a/core/core-frontend/src/custom-component/v-query/time-format.ts +++ b/core/core-frontend/src/custom-component/v-query/time-format.ts @@ -1,4 +1,5 @@ import type { ManipulateType } from 'dayjs' +import dayjs from 'dayjs' function getThisYear() { return new Date(`${new Date().getFullYear()}/1`) } @@ -41,6 +42,10 @@ function getMonthBeginning() { return new Date(`${date.getFullYear()}/${date.getMonth() + 1}/1`) } +function getMonthEnd() { + return new Date(dayjs().endOf('month').format('YYYY/MM/DD HH:mm:ss')) +} + function getYearBeginning() { const date = new Date() return new Date(`${date.getFullYear()}/1/1`) @@ -211,6 +216,12 @@ function getDynamicRange({ isDateTime ? monthBeginningVal : monthBeginningVal + 24 * 3600 * 1000 - 1000 ] break + case 'monthEnd': + const monthEndVal = getMonthEnd().getTime() + selectValue = isDateTime + ? [monthEndVal, monthEndVal] + : [monthEndVal - 24 * 3600 * 1000 + 1000, monthEndVal] + break case 'yearBeginning': const yearBeginningVal = getYearBeginning().getTime() selectValue = [ @@ -251,6 +262,7 @@ export { getToday, getYesterday, getMonthBeginning, + getMonthEnd, getYearBeginning, getCustomTime, getDynamicRange diff --git a/core/core-frontend/src/locales/zh-CN.ts b/core/core-frontend/src/locales/zh-CN.ts index fd0f8ed76a..c3afd3c7d9 100644 --- a/core/core-frontend/src/locales/zh-CN.ts +++ b/core/core-frontend/src/locales/zh-CN.ts @@ -407,6 +407,7 @@ export default { today: '今天', yesterday: '昨天', firstOfMonth: '月初', + endOfMonth: '月底', firstOfYear: '年初', custom: '自定义', date: '日', diff --git a/core/core-frontend/src/style/index.less b/core/core-frontend/src/style/index.less index 2689efb35c..3289a8bc9c 100644 --- a/core/core-frontend/src/style/index.less +++ b/core/core-frontend/src/style/index.less @@ -605,5 +605,5 @@ strong { } .ed-message .ed-message__closeBtn:hover { - background: #ebebebe6; + background: #ebebebe6 !important; }