diff --git a/ruoyi-ui/src/components/Crontab/day.vue b/ruoyi-ui/src/components/Crontab/day.vue index bccd1d7..fe3eaf0 100644 --- a/ruoyi-ui/src/components/Crontab/day.vue +++ b/ruoyi-ui/src/components/Crontab/day.vue @@ -2,7 +2,7 @@ - 日,允许的通配符[, - * / L M] + 日,允许的通配符[, - * ? / L W] @@ -15,23 +15,23 @@ 周期从 - - - 日 + - + 从 - 号开始,每 - 日执行一次 + 号开始,每 + 日执行一次 每月 - 号最近的那个工作日 + 号最近的那个工作日 @@ -84,10 +84,10 @@ export default { this.$emit('update', 'day', '?'); break; case 3: - this.$emit('update', 'day', this.cycle01 + '-' + this.cycle02); + this.$emit('update', 'day', this.cycleTotal); break; case 4: - this.$emit('update', 'day', this.average01 + '/' + this.average02); + this.$emit('update', 'day', this.averageTotal); break; case 5: this.$emit('update', 'day', this.workday + 'W'); @@ -116,7 +116,7 @@ export default { // 最近工作日值变化时 workdayChange() { if (this.radioValue == '5') { - this.$emit('update', 'day', this.workday + 'W'); + this.$emit('update', 'day', this.workdayCheck + 'W'); } }, // checkbox值变化时 @@ -124,19 +124,10 @@ export default { if (this.radioValue == '7') { this.$emit('update', 'day', this.checkboxString); } - }, - // 父组件传递的week发生变化触发 - weekChange() { - //判断week值与day不能同时为“?” - if (this.cron.week == '?' && this.radioValue == '2') { - this.radioValue = '1'; - } else if (this.cron.week !== '?' && this.radioValue != '2') { - this.radioValue = '2'; - } - }, + } }, watch: { - "radioValue": "radioChange", + 'radioValue': 'radioChange', 'cycleTotal': 'cycleChange', 'averageTotal': 'averageChange', 'workdayCheck': 'workdayChange', @@ -145,20 +136,20 @@ export default { computed: { // 计算两个周期值 cycleTotal: function () { - this.cycle01 = this.checkNum(this.cycle01, 1, 31) - this.cycle02 = this.checkNum(this.cycle02, 1, 31) - return this.cycle01 + '-' + this.cycle02; + const cycle01 = this.checkNum(this.cycle01, 1, 30) + const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 2, 31, 31) + return cycle01 + '-' + cycle02; }, // 计算平均用到的值 averageTotal: function () { - this.average01 = this.checkNum(this.average01, 1, 31) - this.average02 = this.checkNum(this.average02, 1, 31) - return this.average01 + '/' + this.average02; + const average01 = this.checkNum(this.average01, 1, 30) + const average02 = this.checkNum(this.average02, 1, 31 - average01 || 0) + return average01 + '/' + average02; }, // 计算工作日格式 workdayCheck: function () { - this.workday = this.checkNum(this.workday, 1, 31) - return this.workday; + const workday = this.checkNum(this.workday, 1, 31) + return workday; }, // 计算勾选的checkbox值合集 checkboxString: function () { diff --git a/ruoyi-ui/src/components/Crontab/hour.vue b/ruoyi-ui/src/components/Crontab/hour.vue index 131edc9..29b8891 100644 --- a/ruoyi-ui/src/components/Crontab/hour.vue +++ b/ruoyi-ui/src/components/Crontab/hour.vue @@ -9,16 +9,16 @@ 周期从 - - - 小时 + - + 小时 从 - 小时开始,每 - 小时执行一次 + 小时开始,每 + 小时执行一次 @@ -56,10 +56,10 @@ export default { this.$emit('update', 'hour', '*') break; case 2: - this.$emit('update', 'hour', this.cycle01 + '-' + this.cycle02); + this.$emit('update', 'hour', this.cycleTotal); break; case 3: - this.$emit('update', 'hour', this.average01 + '/' + this.average02); + this.$emit('update', 'hour', this.averageTotal); break; case 4: this.$emit('update', 'hour', this.checkboxString); @@ -86,7 +86,7 @@ export default { } }, watch: { - "radioValue": "radioChange", + 'radioValue': 'radioChange', 'cycleTotal': 'cycleChange', 'averageTotal': 'averageChange', 'checkboxString': 'checkboxChange' @@ -94,15 +94,15 @@ export default { computed: { // 计算两个周期值 cycleTotal: function () { - this.cycle01 = this.checkNum(this.cycle01, 0, 23) - this.cycle02 = this.checkNum(this.cycle02, 0, 23) - return this.cycle01 + '-' + this.cycle02; + const cycle01 = this.checkNum(this.cycle01, 0, 22) + const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 23) + return cycle01 + '-' + cycle02; }, // 计算平均用到的值 averageTotal: function () { - this.average01 = this.checkNum(this.average01, 0, 23) - this.average02 = this.checkNum(this.average02, 1, 23) - return this.average01 + '/' + this.average02; + const average01 = this.checkNum(this.average01, 0, 22) + const average02 = this.checkNum(this.average02, 1, 23 - average01 || 0) + return average01 + '/' + average02; }, // 计算勾选的checkbox值合集 checkboxString: function () { diff --git a/ruoyi-ui/src/components/Crontab/min.vue b/ruoyi-ui/src/components/Crontab/min.vue index 79e435b..0a106ce 100644 --- a/ruoyi-ui/src/components/Crontab/min.vue +++ b/ruoyi-ui/src/components/Crontab/min.vue @@ -9,16 +9,16 @@ 周期从 - - - 分钟 + - + 分钟 从 - 分钟开始,每 - 分钟执行一次 + 分钟开始,每 + 分钟执行一次 @@ -57,10 +57,10 @@ export default { this.$emit('update', 'min', '*', 'min'); break; case 2: - this.$emit('update', 'min', this.cycle01 + '-' + this.cycle02, 'min'); + this.$emit('update', 'min', this.cycleTotal, 'min'); break; case 3: - this.$emit('update', 'min', this.average01 + '/' + this.average02, 'min'); + this.$emit('update', 'min', this.averageTotal, 'min'); break; case 4: this.$emit('update', 'min', this.checkboxString, 'min'); @@ -88,7 +88,7 @@ export default { }, watch: { - "radioValue": "radioChange", + 'radioValue': 'radioChange', 'cycleTotal': 'cycleChange', 'averageTotal': 'averageChange', 'checkboxString': 'checkboxChange', @@ -96,15 +96,15 @@ export default { computed: { // 计算两个周期值 cycleTotal: function () { - this.cycle01 = this.checkNum(this.cycle01, 0, 59) - this.cycle02 = this.checkNum(this.cycle02, 0, 59) - return this.cycle01 + '-' + this.cycle02; + const cycle01 = this.checkNum(this.cycle01, 0, 58) + const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 59) + return cycle01 + '-' + cycle02; }, // 计算平均用到的值 averageTotal: function () { - this.average01 = this.checkNum(this.average01, 0, 59) - this.average02 = this.checkNum(this.average02, 1, 59) - return this.average01 + '/' + this.average02; + const average01 = this.checkNum(this.average01, 0, 58) + const average02 = this.checkNum(this.average02, 1, 59 - average01 || 0) + return average01 + '/' + average02; }, // 计算勾选的checkbox值合集 checkboxString: function () { diff --git a/ruoyi-ui/src/components/Crontab/month.vue b/ruoyi-ui/src/components/Crontab/month.vue index a7e52e1..fd0ac38 100644 --- a/ruoyi-ui/src/components/Crontab/month.vue +++ b/ruoyi-ui/src/components/Crontab/month.vue @@ -9,16 +9,16 @@ 周期从 - - - 月 + - + 从 - 月开始,每 - 月月执行一次 + 月开始,每 + 月月执行一次 @@ -56,10 +56,10 @@ export default { this.$emit('update', 'month', '*'); break; case 2: - this.$emit('update', 'month', this.cycle01 + '-' + this.cycle02); + this.$emit('update', 'month', this.cycleTotal); break; case 3: - this.$emit('update', 'month', this.average01 + '/' + this.average02); + this.$emit('update', 'month', this.averageTotal); break; case 4: this.$emit('update', 'month', this.checkboxString); @@ -86,7 +86,7 @@ export default { } }, watch: { - "radioValue": "radioChange", + 'radioValue': 'radioChange', 'cycleTotal': 'cycleChange', 'averageTotal': 'averageChange', 'checkboxString': 'checkboxChange' @@ -94,15 +94,15 @@ export default { computed: { // 计算两个周期值 cycleTotal: function () { - this.cycle01 = this.checkNum(this.cycle01, 1, 12) - this.cycle02 = this.checkNum(this.cycle02, 1, 12) - return this.cycle01 + '-' + this.cycle02; + const cycle01 = this.checkNum(this.cycle01, 1, 11) + const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 2, 12) + return cycle01 + '-' + cycle02; }, // 计算平均用到的值 averageTotal: function () { - this.average01 = this.checkNum(this.average01, 1, 12) - this.average02 = this.checkNum(this.average02, 1, 12) - return this.average01 + '/' + this.average02; + const average01 = this.checkNum(this.average01, 1, 11) + const average02 = this.checkNum(this.average02, 1, 12 - average01 || 0) + return average01 + '/' + average02; }, // 计算勾选的checkbox值合集 checkboxString: function () { diff --git a/ruoyi-ui/src/components/Crontab/second.vue b/ruoyi-ui/src/components/Crontab/second.vue index 40815fb..e7b7761 100644 --- a/ruoyi-ui/src/components/Crontab/second.vue +++ b/ruoyi-ui/src/components/Crontab/second.vue @@ -9,16 +9,16 @@ 周期从 - - - 秒 + - + 从 - 秒开始,每 - 秒执行一次 + 秒开始,每 + 秒执行一次 @@ -56,10 +56,10 @@ export default { this.$emit('update', 'second', '*', 'second'); break; case 2: - this.$emit('update', 'second', this.cycle01 + '-' + this.cycle02); + this.$emit('update', 'second', this.cycleTotal); break; case 3: - this.$emit('update', 'second', this.average01 + '/' + this.average02); + this.$emit('update', 'second', this.averageTotal); break; case 4: this.$emit('update', 'second', this.checkboxString); @@ -83,25 +83,10 @@ export default { if (this.radioValue == '4') { this.$emit('update', 'second', this.checkboxString); } - }, - othChange() { - // 反解析 - let ins = this.cron.second - ('反解析 second', ins); - if (ins === '*') { - this.radioValue = 1; - } else if (ins.indexOf('-') > -1) { - this.radioValue = 2 - } else if (ins.indexOf('/') > -1) { - this.radioValue = 3 - } else { - this.radioValue = 4 - this.checkboxList = ins.split(',') - } } }, watch: { - "radioValue": "radioChange", + 'radioValue': 'radioChange', 'cycleTotal': 'cycleChange', 'averageTotal': 'averageChange', 'checkboxString': 'checkboxChange', @@ -112,15 +97,15 @@ export default { computed: { // 计算两个周期值 cycleTotal: function () { - this.cycle01 = this.checkNum(this.cycle01, 0, 59) - this.cycle02 = this.checkNum(this.cycle02, 0, 59) - return this.cycle01 + '-' + this.cycle02; + const cycle01 = this.checkNum(this.cycle01, 0, 58) + const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 59) + return cycle01 + '-' + cycle02; }, // 计算平均用到的值 averageTotal: function () { - this.average01 = this.checkNum(this.average01, 0, 59) - this.average02 = this.checkNum(this.average02, 1, 59) - return this.average01 + '/' + this.average02; + const average01 = this.checkNum(this.average01, 0, 58) + const average02 = this.checkNum(this.average02, 1, 59 - average01 || 0) + return average01 + '/' + average02; }, // 计算勾选的checkbox值合集 checkboxString: function () { diff --git a/ruoyi-ui/src/components/Crontab/week.vue b/ruoyi-ui/src/components/Crontab/week.vue index 4485bc4..ae389a7 100644 --- a/ruoyi-ui/src/components/Crontab/week.vue +++ b/ruoyi-ui/src/components/Crontab/week.vue @@ -2,7 +2,7 @@ - 周,允许的通配符[, - * / L #] + 周,允许的通配符[, - * ? / L #] @@ -128,13 +128,13 @@ export default { this.$emit('update', 'week', '?'); break; case 3: - this.$emit('update', 'week', this.cycle01 + '-' + this.cycle02); + this.$emit('update', 'week', this.cycleTotal); break; case 4: - this.$emit('update', 'week', this.average02 + '#' + this.average01); + this.$emit('update', 'week', this.averageTotal); break; case 5: - this.$emit('update', 'week', this.weekday + 'L'); + this.$emit('update', 'week', this.weekdayCheck + 'L'); break; case 6: this.$emit('update', 'week', this.checkboxString); @@ -168,7 +168,7 @@ export default { }, }, watch: { - "radioValue": "radioChange", + 'radioValue': 'radioChange', 'cycleTotal': 'cycleChange', 'averageTotal': 'averageChange', 'weekdayCheck': 'weekdayChange', diff --git a/ruoyi-ui/src/components/Crontab/year.vue b/ruoyi-ui/src/components/Crontab/year.vue index 16a2b04..5487a6c 100644 --- a/ruoyi-ui/src/components/Crontab/year.vue +++ b/ruoyi-ui/src/components/Crontab/year.vue @@ -15,16 +15,16 @@ 周期从 - - - + - + 从 - 年开始,每 - 年执行一次 + 年开始,每 + 年执行一次 @@ -67,10 +67,10 @@ export default { this.$emit('update', 'year', '*'); break; case 3: - this.$emit('update', 'year', this.cycle01 + '-' + this.cycle02); + this.$emit('update', 'year', this.cycleTotal); break; case 4: - this.$emit('update', 'year', this.average01 + '/' + this.average02); + this.$emit('update', 'year', this.averageTotal); break; case 5: this.$emit('update', 'year', this.checkboxString); @@ -97,7 +97,7 @@ export default { } }, watch: { - "radioValue": "radioChange", + 'radioValue': 'radioChange', 'cycleTotal': 'cycleChange', 'averageTotal': 'averageChange', 'checkboxString': 'checkboxChange' @@ -105,15 +105,15 @@ export default { computed: { // 计算两个周期值 cycleTotal: function () { - this.cycle01 = this.checkNum(this.cycle01, this.fullYear, this.fullYear + 100) - this.cycle02 = this.checkNum(this.cycle02, this.fullYear + 1, this.fullYear + 101) - return this.cycle01 + '-' + this.cycle02; + const cycle01 = this.checkNum(this.cycle01, this.fullYear, 2098) + const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : this.fullYear + 1, 2099) + return cycle01 + '-' + cycle02; }, // 计算平均用到的值 averageTotal: function () { - this.average01 = this.checkNum(this.average01, this.fullYear, this.fullYear + 100) - this.average02 = this.checkNum(this.average02, 1, 10) - return this.average01 + '/' + this.average02; + const average01 = this.checkNum(this.average01, this.fullYear, 2098) + const average02 = this.checkNum(this.average02, 1, 2099 - average01 || this.fullYear) + return average01 + '/' + average02; }, // 计算勾选的checkbox值合集 checkboxString: function () { @@ -124,6 +124,8 @@ export default { mounted: function () { // 仅获取当前年份 this.fullYear = Number(new Date().getFullYear()); + this.cycle01 = this.fullYear + this.average01 = this.fullYear } }