From bf4ac3ad7a20fadd5aaa92ea0b6abde452c232ee Mon Sep 17 00:00:00 2001 From: 若依 <yzz_ivy@163.com> Date: 星期二, 30 十一月 2021 11:03:08 +0800 Subject: [PATCH] !378 fix: crontab组件bug Merge pull request !378 from fuzui/fix_cron_tool --- ruoyi-ui/src/components/Crontab/result.vue | 21 +++++++-------------- 1 files changed, 7 insertions(+), 14 deletions(-) diff --git a/ruoyi-ui/src/components/Crontab/result.vue b/ruoyi-ui/src/components/Crontab/result.vue index 07b963b..aea6e0e 100644 --- a/ruoyi-ui/src/components/Crontab/result.vue +++ b/ruoyi-ui/src/components/Crontab/result.vue @@ -179,7 +179,7 @@ // 鑾峰彇杈惧埌鏉′欢鐨勬棩鏈熸槸鏄熸湡X let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + thisDD + ' 00:00:00'), 'week'); // 褰撴槦鏈熸棩鏃� - if (thisWeek == 0) { + if (thisWeek == 1) { // 鍏堟壘涓嬩竴涓棩锛屽苟鍒ゆ柇鏄惁涓烘湀搴� DD++; thisDD = DD < 10 ? '0' + DD : DD; @@ -187,7 +187,7 @@ if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { DD -= 3; } - } else if (thisWeek == 6) { + } else if (thisWeek == 7) { // 褰撴槦鏈�6鏃跺彧闇�鍒ゆ柇涓嶆槸1鍙峰氨鍙繘琛屾搷浣� if (this.dayRuleSup !== 1) { DD--; @@ -200,7 +200,7 @@ // 鑾峰彇褰撳墠鏃ユ湡鏄睘浜庢槦鏈熷嚑 let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week'); // 鏍¢獙褰撳墠鏄熸湡鏄惁鍦ㄦ槦鏈熸睜锛坉ayRuleSup锛変腑 - if (Array.indexOf(this.dayRuleSup, thisWeek) < 0) { + if (this.dayRuleSup.indexOf(thisWeek) < 0) { // 濡傛灉鍒拌揪鏈�澶у�兼椂 if (Di == DDate.length - 1) { resetDay(); @@ -385,7 +385,7 @@ } else if (rule.indexOf('#') >= 0) { this.dayRule = 'assWeek'; let matchRule = rule.match(/[0-9]{1}/g); - this.dayRuleSup = [Number(matchRule[0]), Number(matchRule[1])]; + this.dayRuleSup = [Number(matchRule[1]), Number(matchRule[0])]; this.dateArr[3] = [1]; if (this.dayRuleSup[1] == 7) { this.dayRuleSup[1] = 0; @@ -400,14 +400,6 @@ } else if (rule !== '*' && rule !== '?') { this.dayRule = 'weekDay'; this.dayRuleSup = this.getAssignArr(rule) - } - // 濡傛灉weekDay鏃跺皢7璋冩暣涓�0銆恮eek鍊�0鍗虫槸鏄熸湡鏃ャ�� - if (this.dayRule == 'weekDay') { - for (let i = 0; i < this.dayRuleSup.length; i++) { - if (this.dayRuleSup[i] == 7) { - this.dayRuleSup[i] = 0; - } - } } } }, @@ -543,14 +535,15 @@ if (type == undefined) { return Y + '-' + (M < 10 ? '0' + M : M) + '-' + (D < 10 ? '0' + D : D) + ' ' + (h < 10 ? '0' + h : h) + ':' + (m < 10 ? '0' + m : m) + ':' + (s < 10 ? '0' + s : s); } else if (type == 'week') { - return week; + // 鍦╭uartz涓� 1涓烘槦鏈熸棩 + return week + 1; } }, // 妫�鏌ユ棩鏈熸槸鍚﹀瓨鍦� checkDate(value) { let time = new Date(value); let format = this.formatDate(time) - return value == format ? true : false; + return value === format; } }, watch: { -- Gitblit v1.9.3