diff --git a/src/utils/common.ts b/src/utils/common.ts index fc28f14..637171e 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -147,6 +147,13 @@ export function monthRangeISO8601(months: number = 1, startOf: dayjs.OpUnitType ] as [string, string]; } +export function weekRangeISO8601(weeks: number = 1, startOf: dayjs.OpUnitType = 'day') { + return [ + dayjs().subtract(weeks, 'week').startOf(startOf).format('YYYY-MM-DDTHH:mm:ss'), + dayjs().endOf('day').format('YYYY-MM-DDTHH:mm:ss') + ] as [string, string]; +} + export function isNotNull(value: any) { return value !== undefined && value !== null && value !== '' && value !== 'undefined'; } @@ -190,7 +197,7 @@ export function stringToContent( if (typeof jsonString === 'string') { try { parsedObj = JSON.parse(jsonString); - } catch (e) { + } catch { return []; } } diff --git a/src/views/job/batch/index.vue b/src/views/job/batch/index.vue index bf03233..7e22fac 100644 --- a/src/views/job/batch/index.vue +++ b/src/views/job/batch/index.vue @@ -14,7 +14,7 @@ import { $t } from '@/locales'; import { useAppStore } from '@/store/modules/app'; import { useTable, useTableOperate } from '@/hooks/common/table'; import { operationReasonRecord, taskBatchStatusRecord, taskTypeRecord } from '@/constants/business'; -import { monthRangeISO8601, tagColor } from '@/utils/common'; +import { tagColor, weekRangeISO8601 } from '@/utils/common'; import SvgIcon from '@/components/custom/svg-icon.vue'; import JobBatchSearch from './modules/job-batch-search.vue'; import JobBatchDetailDrawer from './modules/job-batch-detail-drawer.vue'; @@ -38,7 +38,7 @@ const { columnChecks, columns, data, getData, loading, mobilePagination, searchP jobName: null, taskBatchStatus: null, jobId: null, - datetimeRange: monthRangeISO8601() + datetimeRange: weekRangeISO8601() }, searchParams: { jobId,