mirror of
https://github.com/dataease/dataease.git
synced 2026-05-15 05:22:13 +08:00
committed by
xuwei-fit2cloud
parent
85d502ba27
commit
086a5156b3
@@ -200,6 +200,10 @@ const relativeToCurrentListRange = computed(() => {
|
||||
label: t('dynamic_month.last'),
|
||||
value: 'lastMonth'
|
||||
},
|
||||
{
|
||||
label: t('dynamic_time.tquarter'),
|
||||
value: 'thisQuarter'
|
||||
},
|
||||
{
|
||||
label: t('v_query.last_3_months'),
|
||||
value: 'LastThreeMonths'
|
||||
@@ -225,6 +229,10 @@ const relativeToCurrentListRange = computed(() => {
|
||||
label: t('dynamic_time.yesterday'),
|
||||
value: 'yesterday'
|
||||
},
|
||||
{
|
||||
label: t('dynamic_time.cweek'),
|
||||
value: 'thisWeek'
|
||||
},
|
||||
{
|
||||
label: t('v_query.last_3_days'),
|
||||
value: 'LastThreeDays'
|
||||
|
||||
@@ -1050,6 +1050,14 @@ const isInRange = (ele, startWindowTime, timeStamp) => {
|
||||
case 'lastMonth':
|
||||
startTime = getLastStart('month')
|
||||
break
|
||||
case 'thisQuarter':
|
||||
startTime = getThisStart('quarter')
|
||||
break
|
||||
case 'thisWeek':
|
||||
startTime = new Date(
|
||||
dayjs().startOf('week').add(1, 'day').startOf('day').format('YYYY/MM/DD HH:mm:ss')
|
||||
)
|
||||
break
|
||||
case 'today':
|
||||
startTime = getThisStart('day')
|
||||
break
|
||||
|
||||
@@ -297,6 +297,14 @@ const disabledDate = val => {
|
||||
case 'lastMonth':
|
||||
startTime = getLastStart('month')
|
||||
break
|
||||
case 'thisQuarter':
|
||||
startTime = getThisStart('quarter')
|
||||
break
|
||||
case 'thisWeek':
|
||||
startTime = new Date(
|
||||
dayjs().startOf('week').add(1, 'day').startOf('day').format('YYYY/MM/DD HH:mm:ss')
|
||||
)
|
||||
break
|
||||
case 'today':
|
||||
startTime = getThisStart('day')
|
||||
break
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import dayjs from 'dayjs'
|
||||
import type { ManipulateType } from 'dayjs'
|
||||
function getThisStart(val = 'month' as ManipulateType) {
|
||||
function getThisStart(val = 'month' as ManipulateType | 'quarter') {
|
||||
return new Date(dayjs().startOf(val).format('YYYY/MM/DD HH:mm:ss'))
|
||||
}
|
||||
|
||||
function getThisEnd(val = 'month' as ManipulateType) {
|
||||
function getThisEnd(val = 'month' as ManipulateType | 'quarter') {
|
||||
return new Date(dayjs().endOf(val).format('YYYY/MM/DD HH:mm:ss'))
|
||||
}
|
||||
|
||||
@@ -17,9 +17,19 @@ function getLastEnd(val = 'month' as ManipulateType) {
|
||||
}
|
||||
|
||||
function getAround(val = 'month' as ManipulateType, type = 'add', num = 0) {
|
||||
if (val === 'week') {
|
||||
return new Date(dayjs().endOf('week').add(1, 'day').endOf('day').format('YYYY/MM/DD HH:mm:ss'))
|
||||
}
|
||||
return new Date(dayjs()[type](num, val).startOf('day').format('YYYY/MM/DD HH:mm:ss'))
|
||||
}
|
||||
|
||||
function getThisWeek(): [Date, Date] {
|
||||
return [
|
||||
new Date(dayjs().startOf('week').add(1, 'day').startOf('day').format('YYYY/MM/DD HH:mm:ss')),
|
||||
new Date(dayjs().endOf('week').add(1, 'day').endOf('day').format('YYYY/MM/DD HH:mm:ss'))
|
||||
]
|
||||
}
|
||||
|
||||
function getCustomRange(relativeToCurrentRange: string): [Date, Date] {
|
||||
switch (relativeToCurrentRange) {
|
||||
case 'thisYear':
|
||||
@@ -30,6 +40,10 @@ function getCustomRange(relativeToCurrentRange: string): [Date, Date] {
|
||||
return [getThisStart('month'), getThisEnd('month')]
|
||||
case 'lastMonth':
|
||||
return [getLastStart('month'), getLastEnd('month')]
|
||||
case 'thisQuarter':
|
||||
return [getThisStart('quarter'), getThisEnd('quarter')]
|
||||
case 'thisWeek':
|
||||
return getThisWeek()
|
||||
case 'LastThreeMonths':
|
||||
return [
|
||||
new Date(dayjs().subtract(3, 'month').startOf('month').format('YYYY/MM/DD HH:mm:ss')),
|
||||
|
||||
@@ -376,6 +376,7 @@ export default {
|
||||
lweek: 'Last week',
|
||||
cmonth: 'This month',
|
||||
cquarter: 'This quarter',
|
||||
tquarter: 'This quarter',
|
||||
lquarter: 'Last quarter',
|
||||
cyear: 'This year'
|
||||
},
|
||||
|
||||
@@ -366,6 +366,7 @@ export default {
|
||||
lweek: '上週',
|
||||
cmonth: '本月',
|
||||
cquarter: '本季',
|
||||
tquarter: '本季',
|
||||
lquarter: '上季',
|
||||
cyear: '本年'
|
||||
},
|
||||
|
||||
@@ -367,6 +367,7 @@ export default {
|
||||
lweek: '上周',
|
||||
cmonth: '本月',
|
||||
cquarter: '本季',
|
||||
tquarter: '本季度',
|
||||
lquarter: '上季',
|
||||
cyear: '本年'
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user