From 333e71394f213c6e7f407b4f63d860599b544dc1 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Tue, 31 Aug 2021 14:58:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20corn=E8=A1=A8=E8=BE=BE=E5=BC=8F=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=94=99=E8=AF=AF--bug=3D1006296=20--user=3D=E9=99=88?= =?UTF-8?q?=E5=BB=BA=E6=98=9F=20=E3=80=90github#5608=E3=80=91=E5=AE=9A?= =?UTF-8?q?=E6=97=B6=E4=BB=BB=E5=8A=A1=E6=8C=87=E5=AE=9A=E6=8C=89=E5=91=A8?= =?UTF-8?q?/=E6=98=9F=E6=9C=9F=E7=9A=84=E6=9F=90=E4=B8=80=E5=A4=A9?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E4=B8=8D=E6=AD=A3=E7=A1=AE=20https://www.tap?= =?UTF-8?q?d.cn/55049933/s/1042065?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/common/cron/CrontabResult.vue | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/frontend/src/business/components/common/cron/CrontabResult.vue b/frontend/src/business/components/common/cron/CrontabResult.vue index c4dd8d4c5d..8470d336ab 100644 --- a/frontend/src/business/components/common/cron/CrontabResult.vue +++ b/frontend/src/business/components/common/cron/CrontabResult.vue @@ -221,6 +221,8 @@ //如果指定了是星期几 //获取当前日期是属于星期几 let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week'); + thisWeek++ // 星期日是第一天 + //校验当前星期是否在星期池(dayRuleSup)中 if (this.dayRuleSup.indexOf(thisWeek) < 0) { // 如果到达最大值时 @@ -234,8 +236,10 @@ } continue; } - } else if (this.dayRule == 'assWeek') { - //如果指定了是第几周的星期几 + } else if (this.dayRule == 'assWeek') { + this.dayRuleSup[1]--;// 星期日是第一天 + + //如果指定了是第几周的星期几 //获取每月1号是属于星期几 let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week'); if (this.dayRuleSup[1] >= thisWeek) { @@ -243,7 +247,9 @@ } else { DD = this.dayRuleSup[0] * 7 + this.dayRuleSup[1] - thisWeek + 1; } - } else if (this.dayRule == 'lastWeek') { + } else if (this.dayRule == 'lastWeek') { + this.dayRuleSup--;// 星期日是第一天 + //如果指定了每月最后一个星期几 //校验并调整如果是2月30号这种日期传进来时需调整至正常月底 if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { @@ -258,11 +264,11 @@ if (this.dayRuleSup < thisWeek) { DD -= thisWeek - this.dayRuleSup; } else if (this.dayRuleSup > thisWeek) { - DD -= 7 - (this.dayRuleSup - thisWeek) + DD -= 7 - (this.dayRuleSup - thisWeek) } - } - // 判断时间值是否小于10置换成“05”这种格式 - DD = DD < 10 ? '0' + DD : DD; + } + // 判断时间值是否小于10置换成“05”这种格式 + DD = DD < 10 ? '0' + DD : DD; // 循环“时”数组 goHour: for (let hi = hIdx; hi < hDate.length; hi++) {