From fd57b113c099025df65c53d47997db6802911c10 Mon Sep 17 00:00:00 2001 From: xlsea Date: Thu, 24 Oct 2024 14:36:28 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=89=A7=E8=A1=8C=E6=89=B9=E6=AC=A1?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E6=9F=A5=E8=AF=A2=E4=B8=80=E5=91=A8=E5=86=85?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/common.ts | 9 ++++++++- src/views/job/batch/index.vue | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) 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,