RuoYi лет назад: 4
Родитель
Сommit
2e17d9c084

+ 24 - 42
ruoyi-ui/src/components/Crontab/day.vue

@@ -2,7 +2,7 @@
2 2
 	<el-form size="small">
3 3
 		<el-form-item>
4 4
 			<el-radio v-model='radioValue' :label="1">
5
-				日,允许的通配符[, - * / L M]
5
+				日,允许的通配符[, - * ? / L W]
6 6
 			</el-radio>
7 7
 		</el-form-item>
8 8
 
@@ -15,23 +15,23 @@
15 15
 		<el-form-item>
16 16
 			<el-radio v-model='radioValue' :label="3">
17 17
 				周期从
18
-				<el-input-number v-model='cycle01' :min="0" :max="31" /> -
19
-				<el-input-number v-model='cycle02' :min="0" :max="31" /> 日
18
+				<el-input-number v-model='cycle01' :min="1" :max="30" /> -
19
+				<el-input-number v-model='cycle02' :min="cycle01 ? cycle01 + 1 : 2" :max="31" /> 日
20 20
 			</el-radio>
21 21
 		</el-form-item>
22 22
 
23 23
 		<el-form-item>
24 24
 			<el-radio v-model='radioValue' :label="4">
25 25
26
-				<el-input-number v-model='average01' :min="0" :max="31" /> 号开始,每
27
-				<el-input-number v-model='average02' :min="0" :max="31" /> 日执行一次
26
+				<el-input-number v-model='average01' :min="1" :max="30" /> 号开始,每
27
+				<el-input-number v-model='average02' :min="1" :max="31 - average01 || 1" /> 日执行一次
28 28
 			</el-radio>
29 29
 		</el-form-item>
30 30
 
31 31
 		<el-form-item>
32 32
 			<el-radio v-model='radioValue' :label="5">
33 33
 				每月
34
-				<el-input-number v-model='workday' :min="0" :max="31" /> 号最近的那个工作日
34
+				<el-input-number v-model='workday' :min="1" :max="31" /> 号最近的那个工作日
35 35
 			</el-radio>
36 36
 		</el-form-item>
37 37
 
@@ -72,31 +72,22 @@ export default {
72 72
 		// 单选按钮值变化时
73 73
 		radioChange() {
74 74
 			('day rachange');
75
-			if (this.radioValue === 1) {
76
-				this.$emit('update', 'day', '*', 'day');
77
-				this.$emit('update', 'week', '?', 'day');
78
-				this.$emit('update', 'month', '*', 'day');
79
-			} else {
80
-				if (this.cron.hour === '*') {
81
-					this.$emit('update', 'hour', '0', 'day');
82
-				}
83
-				if (this.cron.min === '*') {
84
-					this.$emit('update', 'min', '0', 'day');
85
-				}
86
-				if (this.cron.second === '*') {
87
-					this.$emit('update', 'second', '0', 'day');
88
-				}
75
+			if (this.radioValue !== 2 && this.cron.week !== '?') {
76
+				this.$emit('update', 'week', '?', 'day')
89 77
 			}
90 78
 
91 79
 			switch (this.radioValue) {
80
+				case 1:
81
+					this.$emit('update', 'day', '*');
82
+					break;
92 83
 				case 2:
93 84
 					this.$emit('update', 'day', '?');
94 85
 					break;
95 86
 				case 3:
96
-					this.$emit('update', 'day', this.cycle01 + '-' + this.cycle02);
87
+					this.$emit('update', 'day', this.cycleTotal);
97 88
 					break;
98 89
 				case 4:
99
-					this.$emit('update', 'day', this.average01 + '/' + this.average02);
90
+					this.$emit('update', 'day', this.averageTotal);
100 91
 					break;
101 92
 				case 5:
102 93
 					this.$emit('update', 'day', this.workday + 'W');
@@ -125,7 +116,7 @@ export default {
125 116
 		// 最近工作日值变化时
126 117
 		workdayChange() {
127 118
 			if (this.radioValue == '5') {
128
-				this.$emit('update', 'day', this.workday + 'W');
119
+				this.$emit('update', 'day', this.workdayCheck + 'W');
129 120
 			}
130 121
 		},
131 122
 		// checkbox值变化时
@@ -133,19 +124,10 @@ export default {
133 124
 			if (this.radioValue == '7') {
134 125
 				this.$emit('update', 'day', this.checkboxString);
135 126
 			}
136
-		},
137
-		// 父组件传递的week发生变化触发
138
-		weekChange() {
139
-			//判断week值与day不能同时为“?”
140
-			if (this.cron.week == '?' && this.radioValue == '2') {
141
-				this.radioValue = '1';
142
-			} else if (this.cron.week !== '?' && this.radioValue != '2') {
143
-				this.radioValue = '2';
144
-			}
145
-		},
127
+		}
146 128
 	},
147 129
 	watch: {
148
-		"radioValue": "radioChange",
130
+		'radioValue': 'radioChange',
149 131
 		'cycleTotal': 'cycleChange',
150 132
 		'averageTotal': 'averageChange',
151 133
 		'workdayCheck': 'workdayChange',
@@ -154,20 +136,20 @@ export default {
154 136
 	computed: {
155 137
 		// 计算两个周期值
156 138
 		cycleTotal: function () {
157
-			this.cycle01 = this.checkNum(this.cycle01, 1, 31)
158
-			this.cycle02 = this.checkNum(this.cycle02, 1, 31)
159
-			return this.cycle01 + '-' + this.cycle02;
139
+			const cycle01 = this.checkNum(this.cycle01, 1, 30)
140
+			const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 2, 31, 31)
141
+			return cycle01 + '-' + cycle02;
160 142
 		},
161 143
 		// 计算平均用到的值
162 144
 		averageTotal: function () {
163
-			this.average01 = this.checkNum(this.average01, 1, 31)
164
-			this.average02 = this.checkNum(this.average02, 1, 31)
165
-			return this.average01 + '/' + this.average02;
145
+			const average01 = this.checkNum(this.average01, 1, 30)
146
+			const average02 = this.checkNum(this.average02, 1, 31 - average01 || 0)
147
+			return average01 + '/' + average02;
166 148
 		},
167 149
 		// 计算工作日格式
168 150
 		workdayCheck: function () {
169
-			this.workday = this.checkNum(this.workday, 1, 31)
170
-			return this.workday;
151
+			const workday = this.checkNum(this.workday, 1, 31)
152
+			return workday;
171 153
 		},
172 154
 		// 计算勾选的checkbox值合集
173 155
 		checkboxString: function () {

+ 16 - 24
ruoyi-ui/src/components/Crontab/hour.vue

@@ -9,16 +9,16 @@
9 9
 		<el-form-item>
10 10
 			<el-radio v-model='radioValue' :label="2">
11 11
 				周期从
12
-				<el-input-number v-model='cycle01' :min="0" :max="60" /> -
13
-				<el-input-number v-model='cycle02' :min="0" :max="60" /> 小时
12
+				<el-input-number v-model='cycle01' :min="0" :max="22" /> -
13
+				<el-input-number v-model='cycle02' :min="cycle01 ? cycle01 + 1 : 1" :max="23" /> 小时
14 14
 			</el-radio>
15 15
 		</el-form-item>
16 16
 
17 17
 		<el-form-item>
18 18
 			<el-radio v-model='radioValue' :label="3">
19 19
20
-				<el-input-number v-model='average01' :min="0" :max="60" /> 小时开始,每
21
-				<el-input-number v-model='average02' :min="0" :max="60" /> 小时执行一次
20
+				<el-input-number v-model='average01' :min="0" :max="22" /> 小时开始,每
21
+				<el-input-number v-model='average02' :min="1" :max="23 - average01 || 0" /> 小时执行一次
22 22
 			</el-radio>
23 23
 		</el-form-item>
24 24
 
@@ -51,23 +51,15 @@ export default {
51 51
 	methods: {
52 52
 		// 单选按钮值变化时
53 53
 		radioChange() {
54
-			if (this.radioValue === 1) {
55
-				this.$emit('update', 'hour', '*', 'hour');
56
-				this.$emit('update', 'day', '*', 'hour');
57
-			} else {
58
-				if (this.cron.min === '*') {
59
-					this.$emit('update', 'min', '0', 'hour');
60
-				}
61
-				if (this.cron.second === '*') {
62
-					this.$emit('update', 'second', '0', 'hour');
63
-				}
64
-			}
65 54
 			switch (this.radioValue) {
55
+				case 1:
56
+        	this.$emit('update', 'hour', '*')
57
+        	break;
66 58
 				case 2:
67
-					this.$emit('update', 'hour', this.cycle01 + '-' + this.cycle02);
59
+					this.$emit('update', 'hour', this.cycleTotal);
68 60
 					break;
69 61
 				case 3:
70
-					this.$emit('update', 'hour', this.average01 + '/' + this.average02);
62
+					this.$emit('update', 'hour', this.averageTotal);
71 63
 					break;
72 64
 				case 4:
73 65
 					this.$emit('update', 'hour', this.checkboxString);
@@ -94,7 +86,7 @@ export default {
94 86
 		}
95 87
 	},
96 88
 	watch: {
97
-		"radioValue": "radioChange",
89
+		'radioValue': 'radioChange',
98 90
 		'cycleTotal': 'cycleChange',
99 91
 		'averageTotal': 'averageChange',
100 92
 		'checkboxString': 'checkboxChange'
@@ -102,15 +94,15 @@ export default {
102 94
 	computed: {
103 95
 		// 计算两个周期值
104 96
 		cycleTotal: function () {
105
-			this.cycle01 = this.checkNum(this.cycle01, 0, 23)
106
-			this.cycle02 = this.checkNum(this.cycle02, 0, 23)
107
-			return this.cycle01 + '-' + this.cycle02;
97
+			const cycle01 = this.checkNum(this.cycle01, 0, 22)
98
+			const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 23)
99
+			return cycle01 + '-' + cycle02;
108 100
 		},
109 101
 		// 计算平均用到的值
110 102
 		averageTotal: function () {
111
-			this.average01 = this.checkNum(this.average01, 0, 23)
112
-			this.average02 = this.checkNum(this.average02, 1, 23)
113
-			return this.average01 + '/' + this.average02;
103
+			const average01 = this.checkNum(this.average01, 0, 22)
104
+			const average02 = this.checkNum(this.average02, 1, 23 - average01 || 0)
105
+			return average01 + '/' + average02;
114 106
 		},
115 107
 		// 计算勾选的checkbox值合集
116 108
 		checkboxString: function () {

+ 6 - 1
ruoyi-ui/src/components/Crontab/index.vue

@@ -2,7 +2,12 @@
2 2
   <div>
3 3
     <el-tabs type="border-card">
4 4
       <el-tab-pane label="秒" v-if="shouldHide('second')">
5
-        <CrontabSecond @update="updateCrontabValue" :check="checkNumber" ref="cronsecond" />
5
+        <CrontabSecond
6
+          @update="updateCrontabValue"
7
+          :check="checkNumber"
8
+          :cron="crontabValueObj"
9
+          ref="cronsecond"
10
+        />
6 11
       </el-tab-pane>
7 12
 
8 13
       <el-tab-pane label="分钟" v-if="shouldHide('min')">

+ 13 - 17
ruoyi-ui/src/components/Crontab/min.vue

@@ -9,16 +9,16 @@
9 9
 		<el-form-item>
10 10
 			<el-radio v-model='radioValue' :label="2">
11 11
 				周期从
12
-				<el-input-number v-model='cycle01' :min="0" :max="60" /> -
13
-				<el-input-number v-model='cycle02' :min="0" :max="60" /> 分钟
12
+				<el-input-number v-model='cycle01' :min="0" :max="58" /> -
13
+				<el-input-number v-model='cycle02' :min="cycle01 ? cycle01 + 1 : 1" :max="59" /> 分钟
14 14
 			</el-radio>
15 15
 		</el-form-item>
16 16
 
17 17
 		<el-form-item>
18 18
 			<el-radio v-model='radioValue' :label="3">
19 19
20
-				<el-input-number v-model='average01' :min="0" :max="60" /> 分钟开始,每
21
-				<el-input-number v-model='average02' :min="0" :max="60" /> 分钟执行一次
20
+				<el-input-number v-model='average01' :min="0" :max="58" /> 分钟开始,每
21
+				<el-input-number v-model='average02' :min="1" :max="59 - average01 || 0" /> 分钟执行一次
22 22
 			</el-radio>
23 23
 		</el-form-item>
24 24
 
@@ -52,19 +52,15 @@ export default {
52 52
 	methods: {
53 53
 		// 单选按钮值变化时
54 54
 		radioChange() {
55
-			if (this.radioValue !== 1 && this.cron.second === '*') {
56
-				this.$emit('update', 'second', '0', 'min');
57
-			}
58 55
 			switch (this.radioValue) {
59 56
 				case 1:
60 57
 					this.$emit('update', 'min', '*', 'min');
61
-					this.$emit('update', 'hour', '*', 'min');
62 58
 					break;
63 59
 				case 2:
64
-					this.$emit('update', 'min', this.cycle01 + '-' + this.cycle02, 'min');
60
+					this.$emit('update', 'min', this.cycleTotal, 'min');
65 61
 					break;
66 62
 				case 3:
67
-					this.$emit('update', 'min', this.average01 + '/' + this.average02, 'min');
63
+					this.$emit('update', 'min', this.averageTotal, 'min');
68 64
 					break;
69 65
 				case 4:
70 66
 					this.$emit('update', 'min', this.checkboxString, 'min');
@@ -92,7 +88,7 @@ export default {
92 88
 
93 89
 	},
94 90
 	watch: {
95
-		"radioValue": "radioChange",
91
+		'radioValue': 'radioChange',
96 92
 		'cycleTotal': 'cycleChange',
97 93
 		'averageTotal': 'averageChange',
98 94
 		'checkboxString': 'checkboxChange',
@@ -100,15 +96,15 @@ export default {
100 96
 	computed: {
101 97
 		// 计算两个周期值
102 98
 		cycleTotal: function () {
103
-			this.cycle01 = this.checkNum(this.cycle01, 0, 59)
104
-			this.cycle02 = this.checkNum(this.cycle02, 0, 59)
105
-			return this.cycle01 + '-' + this.cycle02;
99
+			const cycle01 = this.checkNum(this.cycle01, 0, 58)
100
+			const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 59)
101
+			return cycle01 + '-' + cycle02;
106 102
 		},
107 103
 		// 计算平均用到的值
108 104
 		averageTotal: function () {
109
-			this.average01 = this.checkNum(this.average01, 0, 59)
110
-			this.average02 = this.checkNum(this.average02, 1, 59)
111
-			return this.average01 + '/' + this.average02;
105
+			const average01 = this.checkNum(this.average01, 0, 58)
106
+			const average02 = this.checkNum(this.average02, 1, 59 - average01 || 0)
107
+			return average01 + '/' + average02;
112 108
 		},
113 109
 		// 计算勾选的checkbox值合集
114 110
 		checkboxString: function () {

+ 16 - 30
ruoyi-ui/src/components/Crontab/month.vue

@@ -9,16 +9,16 @@
9 9
 		<el-form-item>
10 10
 			<el-radio v-model='radioValue' :label="2">
11 11
 				周期从
12
-				<el-input-number v-model='cycle01' :min="1" :max="12" /> -
13
-				<el-input-number v-model='cycle02' :min="1" :max="12" /> 月
12
+				<el-input-number v-model='cycle01' :min="1" :max="11" /> -
13
+				<el-input-number v-model='cycle02' :min="cycle01 ? cycle01 + 1 : 2" :max="12" /> 月
14 14
 			</el-radio>
15 15
 		</el-form-item>
16 16
 
17 17
 		<el-form-item>
18 18
 			<el-radio v-model='radioValue' :label="3">
19 19
20
-				<el-input-number v-model='average01' :min="1" :max="12" /> 月开始,每
21
-				<el-input-number v-model='average02' :min="1" :max="12" /> 月月执行一次
20
+				<el-input-number v-model='average01' :min="1" :max="11" /> 月开始,每
21
+				<el-input-number v-model='average02' :min="1" :max="12 - average01 || 0" /> 月月执行一次
22 22
 			</el-radio>
23 23
 		</el-form-item>
24 24
 
@@ -51,29 +51,15 @@ export default {
51 51
 	methods: {
52 52
 		// 单选按钮值变化时
53 53
 		radioChange() {
54
-			if (this.radioValue === 1) {
55
-				this.$emit('update', 'month', '*');
56
-				this.$emit('update', 'year', '*');
57
-			} else {
58
-				if (this.cron.day === '*') {
59
-					this.$emit('update', 'day', '0', 'month');
60
-				}
61
-				if (this.cron.hour === '*') {
62
-					this.$emit('update', 'hour', '0', 'month');
63
-				}
64
-				if (this.cron.min === '*') {
65
-					this.$emit('update', 'min', '0', 'month');
66
-				}
67
-				if (this.cron.second === '*') {
68
-					this.$emit('update', 'second', '0', 'month');
69
-				}
70
-			}
71 54
 			switch (this.radioValue) {
55
+				case 1:
56
+					this.$emit('update', 'month', '*');
57
+					break;
72 58
 				case 2:
73
-					this.$emit('update', 'month', this.cycle01 + '-' + this.cycle02);
59
+					this.$emit('update', 'month', this.cycleTotal);
74 60
 					break;
75 61
 				case 3:
76
-					this.$emit('update', 'month', this.average01 + '/' + this.average02);
62
+					this.$emit('update', 'month', this.averageTotal);
77 63
 					break;
78 64
 				case 4:
79 65
 					this.$emit('update', 'month', this.checkboxString);
@@ -100,7 +86,7 @@ export default {
100 86
 		}
101 87
 	},
102 88
 	watch: {
103
-		"radioValue": "radioChange",
89
+		'radioValue': 'radioChange',
104 90
 		'cycleTotal': 'cycleChange',
105 91
 		'averageTotal': 'averageChange',
106 92
 		'checkboxString': 'checkboxChange'
@@ -108,15 +94,15 @@ export default {
108 94
 	computed: {
109 95
 		// 计算两个周期值
110 96
 		cycleTotal: function () {
111
-			this.cycle01 = this.checkNum(this.cycle01, 1, 12)
112
-			this.cycle02 = this.checkNum(this.cycle02, 1, 12)
113
-			return this.cycle01 + '-' + this.cycle02;
97
+			const cycle01 = this.checkNum(this.cycle01, 1, 11)
98
+			const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 2, 12)
99
+			return cycle01 + '-' + cycle02;
114 100
 		},
115 101
 		// 计算平均用到的值
116 102
 		averageTotal: function () {
117
-			this.average01 = this.checkNum(this.average01, 1, 12)
118
-			this.average02 = this.checkNum(this.average02, 1, 12)
119
-			return this.average01 + '/' + this.average02;
103
+			const average01 = this.checkNum(this.average01, 1, 11)
104
+			const average02 = this.checkNum(this.average02, 1, 12 - average01 || 0)
105
+			return average01 + '/' + average02;
120 106
 		},
121 107
 		// 计算勾选的checkbox值合集
122 108
 		checkboxString: function () {

+ 7 - 14
ruoyi-ui/src/components/Crontab/result.vue

@@ -179,7 +179,7 @@ export default {
179 179
 							// 获取达到条件的日期是星期X
180 180
 							let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + thisDD + ' 00:00:00'), 'week');
181 181
 							// 当星期日时
182
-							if (thisWeek == 0) {
182
+							if (thisWeek == 1) {
183 183
 								// 先找下一个日,并判断是否为月底
184 184
 								DD++;
185 185
 								thisDD = DD < 10 ? '0' + DD : DD;
@@ -187,7 +187,7 @@ export default {
187 187
 								if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
188 188
 									DD -= 3;
189 189
 								}
190
-							} else if (thisWeek == 6) {
190
+							} else if (thisWeek == 7) {
191 191
 								// 当星期6时只需判断不是1号就可进行操作
192 192
 								if (this.dayRuleSup !== 1) {
193 193
 									DD--;
@@ -200,7 +200,7 @@ export default {
200 200
 							// 获取当前日期是属于星期几
201 201
 							let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week');
202 202
 							// 校验当前星期是否在星期池(dayRuleSup)中
203
-							if (Array.indexOf(this.dayRuleSup, thisWeek) < 0) {
203
+							if (this.dayRuleSup.indexOf(thisWeek) < 0) {
204 204
 								// 如果到达最大值时
205 205
 								if (Di == DDate.length - 1) {
206 206
 									resetDay();
@@ -385,7 +385,7 @@ export default {
385 385
 				} else if (rule.indexOf('#') >= 0) {
386 386
 					this.dayRule = 'assWeek';
387 387
 					let matchRule = rule.match(/[0-9]{1}/g);
388
-					this.dayRuleSup = [Number(matchRule[0]), Number(matchRule[1])];
388
+					this.dayRuleSup = [Number(matchRule[1]), Number(matchRule[0])];
389 389
 					this.dateArr[3] = [1];
390 390
 					if (this.dayRuleSup[1] == 7) {
391 391
 						this.dayRuleSup[1] = 0;
@@ -401,14 +401,6 @@ export default {
401 401
 					this.dayRule = 'weekDay';
402 402
 					this.dayRuleSup = this.getAssignArr(rule)
403 403
 				}
404
-				// 如果weekDay时将7调整为0【week值0即是星期日】
405
-				if (this.dayRule == 'weekDay') {
406
-					for (let i = 0; i < this.dayRuleSup.length; i++) {
407
-						if (this.dayRuleSup[i] == 7) {
408
-							this.dayRuleSup[i] = 0;
409
-						}
410
-					}
411
-				}
412 404
 			}
413 405
 		},
414 406
 		// 获取"日"数组-少量为日期规则
@@ -543,14 +535,15 @@ export default {
543 535
 			if (type == undefined) {
544 536
 				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);
545 537
 			} else if (type == 'week') {
546
-				return week;
538
+				// 在quartz中 1为星期日
539
+				return week + 1;
547 540
 			}
548 541
 		},
549 542
 		// 检查日期是否存在
550 543
 		checkDate(value) {
551 544
 			let time = new Date(value);
552 545
 			let format = this.formatDate(time)
553
-			return value == format ? true : false;
546
+			return value === format;
554 547
 		}
555 548
 	},
556 549
 	watch: {

+ 13 - 29
ruoyi-ui/src/components/Crontab/second.vue

@@ -9,16 +9,16 @@
9 9
 		<el-form-item>
10 10
 			<el-radio v-model='radioValue' :label="2">
11 11
 				周期从
12
-				<el-input-number v-model='cycle01' :min="0" :max="60" /> -
13
-				<el-input-number v-model='cycle02' :min="0" :max="60" /> 秒
12
+				<el-input-number v-model='cycle01' :min="0" :max="58" /> -
13
+				<el-input-number v-model='cycle02' :min="cycle01 ? cycle01 + 1 : 1" :max="59" /> 秒
14 14
 			</el-radio>
15 15
 		</el-form-item>
16 16
 
17 17
 		<el-form-item>
18 18
 			<el-radio v-model='radioValue' :label="3">
19 19
20
-				<el-input-number v-model='average01' :min="0" :max="60" /> 秒开始,每
21
-				<el-input-number v-model='average02' :min="0" :max="60" /> 秒执行一次
20
+				<el-input-number v-model='average01' :min="0" :max="58" /> 秒开始,每
21
+				<el-input-number v-model='average02' :min="1" :max="59 - average01 || 0" /> 秒执行一次
22 22
 			</el-radio>
23 23
 		</el-form-item>
24 24
 
@@ -54,13 +54,12 @@ export default {
54 54
 			switch (this.radioValue) {
55 55
 				case 1:
56 56
 					this.$emit('update', 'second', '*', 'second');
57
-					this.$emit('update', 'min', '*', 'second');
58 57
 					break;
59 58
 				case 2:
60
-					this.$emit('update', 'second', this.cycle01 + '-' + this.cycle02);
59
+					this.$emit('update', 'second', this.cycleTotal);
61 60
 					break;
62 61
 				case 3:
63
-					this.$emit('update', 'second', this.average01 + '/' + this.average02);
62
+					this.$emit('update', 'second', this.averageTotal);
64 63
 					break;
65 64
 				case 4:
66 65
 					this.$emit('update', 'second', this.checkboxString);
@@ -84,25 +83,10 @@ export default {
84 83
 			if (this.radioValue == '4') {
85 84
 				this.$emit('update', 'second', this.checkboxString);
86 85
 			}
87
-		},
88
-		othChange() {
89
-			// 反解析
90
-			let ins = this.cron.second
91
-			('反解析 second', ins);
92
-			if (ins === '*') {
93
-				this.radioValue = 1;
94
-			} else if (ins.indexOf('-') > -1) {
95
-				this.radioValue = 2
96
-			} else if (ins.indexOf('/') > -1) {
97
-				this.radioValue = 3
98
-			} else {
99
-				this.radioValue = 4
100
-				this.checkboxList = ins.split(',')
101
-			}
102 86
 		}
103 87
 	},
104 88
 	watch: {
105
-		"radioValue": "radioChange",
89
+		'radioValue': 'radioChange',
106 90
 		'cycleTotal': 'cycleChange',
107 91
 		'averageTotal': 'averageChange',
108 92
 		'checkboxString': 'checkboxChange',
@@ -113,15 +97,15 @@ export default {
113 97
 	computed: {
114 98
 		// 计算两个周期值
115 99
 		cycleTotal: function () {
116
-			this.cycle01 = this.checkNum(this.cycle01, 0, 59)
117
-			this.cycle02 = this.checkNum(this.cycle02, 0, 59)
118
-			return this.cycle01 + '-' + this.cycle02;
100
+			const cycle01 = this.checkNum(this.cycle01, 0, 58)
101
+			const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : 1, 59)
102
+			return cycle01 + '-' + cycle02;
119 103
 		},
120 104
 		// 计算平均用到的值
121 105
 		averageTotal: function () {
122
-			this.average01 = this.checkNum(this.average01, 0, 59)
123
-			this.average02 = this.checkNum(this.average02, 1, 59)
124
-			return this.average01 + '/' + this.average02;
106
+			const average01 = this.checkNum(this.average01, 0, 58)
107
+			const average02 = this.checkNum(this.average02, 1, 59 - average01 || 0)
108
+			return average01 + '/' + average02;
125 109
 		},
126 110
 		// 计算勾选的checkbox值合集
127 111
 		checkboxString: function () {

+ 71 - 36
ruoyi-ui/src/components/Crontab/week.vue

@@ -2,7 +2,7 @@
2 2
 	<el-form size='small'>
3 3
 		<el-form-item>
4 4
 			<el-radio v-model='radioValue' :label="1">
5
-				周,允许的通配符[, - * / L #]
5
+				周,允许的通配符[, - * ? / L #]
6 6
 			</el-radio>
7 7
 		</el-form-item>
8 8
 
@@ -15,8 +15,25 @@
15 15
 		<el-form-item>
16 16
 			<el-radio v-model='radioValue' :label="3">
17 17
 				周期从星期
18
-				<el-input-number v-model='cycle01' :min="1" :max="7" /> -
19
-				<el-input-number v-model='cycle02' :min="1" :max="7" />
18
+				<el-select clearable v-model="cycle01">
19
+					<el-option
20
+						v-for="(item,index) of weekList"
21
+						:key="index"
22
+						:label="item.value"
23
+						:value="item.key"
24
+						:disabled="item.key === 1"
25
+					>{{item.value}}</el-option>
26
+				</el-select>
27
+				-
28
+				<el-select clearable v-model="cycle02">
29
+					<el-option
30
+						v-for="(item,index) of weekList"
31
+						:key="index"
32
+						:label="item.value"
33
+						:value="item.key"
34
+						:disabled="item.key < cycle01 && item.key !== 1"
35
+					>{{item.value}}</el-option>
36
+				</el-select>
20 37
 			</el-radio>
21 38
 		</el-form-item>
22 39
 
@@ -24,14 +41,18 @@
24 41
 			<el-radio v-model='radioValue' :label="4">
25 42
26 43
 				<el-input-number v-model='average01' :min="1" :max="4" /> 周的星期
27
-				<el-input-number v-model='average02' :min="1" :max="7" />
44
+				<el-select clearable v-model="average02">
45
+					<el-option v-for="(item,index) of weekList" :key="index" :label="item.value" :value="item.key">{{item.value}}</el-option>
46
+				</el-select>
28 47
 			</el-radio>
29 48
 		</el-form-item>
30 49
 
31 50
 		<el-form-item>
32 51
 			<el-radio v-model='radioValue' :label="5">
33 52
 				本月最后一个星期
34
-				<el-input-number v-model='weekday' :min="1" :max="7" />
53
+				<el-select clearable v-model="weekday">
54
+					<el-option v-for="(item,index) of weekList" :key="index" :label="item.value" :value="item.key">{{item.value}}</el-option>
55
+				</el-select>
35 56
 			</el-radio>
36 57
 		</el-form-item>
37 58
 
@@ -39,7 +60,7 @@
39 60
 			<el-radio v-model='radioValue' :label="6">
40 61
 				指定
41 62
 				<el-select clearable v-model="checkboxList" placeholder="可多选" multiple style="width:100%">
42
-					<el-option v-for="(item,index) of weekList" :key="index" :value="index+1">{{item}}</el-option>
63
+					<el-option v-for="(item,index) of weekList" :key="index" :label="item.value" :value="item.key">{{item.value}}</el-option>
43 64
 				</el-select>
44 65
 			</el-radio>
45 66
 		</el-form-item>
@@ -52,13 +73,42 @@ export default {
52 73
 	data() {
53 74
 		return {
54 75
 			radioValue: 2,
55
-			weekday: 1,
56
-			cycle01: 1,
57
-			cycle02: 2,
76
+			weekday: 2,
77
+			cycle01: 2,
78
+			cycle02: 3,
58 79
 			average01: 1,
59
-			average02: 1,
80
+			average02: 2,
60 81
 			checkboxList: [],
61
-			weekList: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
82
+			weekList: [
83
+				{
84
+					key: 2,
85
+					value: '星期一'
86
+				},
87
+				{
88
+					key: 3,
89
+					value: '星期二'
90
+				},
91
+				{
92
+					key: 4,
93
+					value: '星期三'
94
+				},
95
+				{
96
+					key: 5,
97
+					value: '星期四'
98
+				},
99
+				{
100
+					key: 6,
101
+					value: '星期五'
102
+				},
103
+				{
104
+					key: 7,
105
+					value: '星期六'
106
+				},
107
+				{
108
+					key: 1,
109
+					value: '星期日'
110
+				}
111
+			],
62 112
 			checkNum: this.$options.propsData.check
63 113
 		}
64 114
 	},
@@ -67,45 +117,30 @@ export default {
67 117
 	methods: {
68 118
 		// 单选按钮值变化时
69 119
 		radioChange() {
70
-			if (this.radioValue === 1) {
71
-				this.$emit('update', 'week', '*');
72
-				this.$emit('update', 'year', '*');
73
-			} else {
74
-				if (this.cron.month === '*') {
75
-					this.$emit('update', 'month', '0', 'week');
76
-				}
77
-				if (this.cron.day === '*') {
78
-					this.$emit('update', 'day', '0', 'week');
79
-				}
80
-				if (this.cron.hour === '*') {
81
-					this.$emit('update', 'hour', '0', 'week');
82
-				}
83
-				if (this.cron.min === '*') {
84
-					this.$emit('update', 'min', '0', 'week');
85
-				}
86
-				if (this.cron.second === '*') {
87
-					this.$emit('update', 'second', '0', 'week');
88
-				}
120
+			if (this.radioValue !== 2 && this.cron.day !== '?') {
121
+				this.$emit('update', 'day', '?', 'week');
89 122
 			}
90 123
 			switch (this.radioValue) {
124
+				case 1:
125
+					this.$emit('update', 'week', '*');
126
+					break;
91 127
 				case 2:
92 128
 					this.$emit('update', 'week', '?');
93 129
 					break;
94 130
 				case 3:
95
-					this.$emit('update', 'week', this.cycle01 + '-' + this.cycle02);
131
+					this.$emit('update', 'week', this.cycleTotal);
96 132
 					break;
97 133
 				case 4:
98
-					this.$emit('update', 'week', this.average01 + '#' + this.average02);
134
+					this.$emit('update', 'week', this.averageTotal);
99 135
 					break;
100 136
 				case 5:
101
-					this.$emit('update', 'week', this.weekday + 'L');
137
+					this.$emit('update', 'week', this.weekdayCheck + 'L');
102 138
 					break;
103 139
 				case 6:
104 140
 					this.$emit('update', 'week', this.checkboxString);
105 141
 					break;
106 142
 			}
107 143
 		},
108
-		// 根据互斥事件,更改radio的值
109 144
 
110 145
 		// 周期两个值变化时
111 146
 		cycleChange() {
@@ -133,7 +168,7 @@ export default {
133 168
 		},
134 169
 	},
135 170
 	watch: {
136
-		"radioValue": "radioChange",
171
+		'radioValue': 'radioChange',
137 172
 		'cycleTotal': 'cycleChange',
138 173
 		'averageTotal': 'averageChange',
139 174
 		'weekdayCheck': 'weekdayChange',
@@ -150,7 +185,7 @@ export default {
150 185
 		averageTotal: function () {
151 186
 			this.average01 = this.checkNum(this.average01, 1, 4)
152 187
 			this.average02 = this.checkNum(this.average02, 1, 7)
153
-			return this.average01 + '#' + this.average02;
188
+			return this.average02 + '#' + this.average01;
154 189
 		},
155 190
 		// 最近的工作日(格式)
156 191
 		weekdayCheck: function () {

+ 15 - 28
ruoyi-ui/src/components/Crontab/year.vue

@@ -15,16 +15,16 @@
15 15
 		<el-form-item>
16 16
 			<el-radio :label="3" v-model='radioValue'>
17 17
 				周期从
18
-				<el-input-number v-model='cycle01' :min='fullYear' /> -
19
-				<el-input-number v-model='cycle02' :min='fullYear' />
18
+				<el-input-number v-model='cycle01' :min='fullYear' :max="2098" /> -
19
+				<el-input-number v-model='cycle02' :min="cycle01 ? cycle01 + 1 : fullYear + 1" :max="2099" />
20 20
 			</el-radio>
21 21
 		</el-form-item>
22 22
 
23 23
 		<el-form-item>
24 24
 			<el-radio :label="4" v-model='radioValue'>
25 25
26
-				<el-input-number v-model='average01' :min='fullYear' /> 年开始,每
27
-				<el-input-number v-model='average02' :min='fullYear' /> 年执行一次
26
+				<el-input-number v-model='average01' :min='fullYear' :max="2098"/> 年开始,每
27
+				<el-input-number v-model='average02' :min="1" :max="2099 - average01 || fullYear" /> 年执行一次
28 28
 			</el-radio>
29 29
 
30 30
 		</el-form-item>
@@ -59,21 +59,6 @@ export default {
59 59
 	methods: {
60 60
 		// 单选按钮值变化时
61 61
 		radioChange() {
62
-			if (this.cron.month === '*') {
63
-				this.$emit('update', 'month', '0', 'year');
64
-			}
65
-			if (this.cron.day === '*') {
66
-				this.$emit('update', 'day', '0', 'year');
67
-			}
68
-			if (this.cron.hour === '*') {
69
-				this.$emit('update', 'hour', '0', 'year');
70
-			}
71
-			if (this.cron.min === '*') {
72
-				this.$emit('update', 'min', '0', 'year');
73
-			}
74
-			if (this.cron.second === '*') {
75
-				this.$emit('update', 'second', '0', 'year');
76
-			}
77 62
 			switch (this.radioValue) {
78 63
 				case 1:
79 64
 					this.$emit('update', 'year', '');
@@ -82,10 +67,10 @@ export default {
82 67
 					this.$emit('update', 'year', '*');
83 68
 					break;
84 69
 				case 3:
85
-					this.$emit('update', 'year', this.cycle01 + '-' + this.cycle02);
70
+					this.$emit('update', 'year', this.cycleTotal);
86 71
 					break;
87 72
 				case 4:
88
-					this.$emit('update', 'year', this.average01 + '/' + this.average02);
73
+					this.$emit('update', 'year', this.averageTotal);
89 74
 					break;
90 75
 				case 5:
91 76
 					this.$emit('update', 'year', this.checkboxString);
@@ -112,7 +97,7 @@ export default {
112 97
 		}
113 98
 	},
114 99
 	watch: {
115
-		"radioValue": "radioChange",
100
+		'radioValue': 'radioChange',
116 101
 		'cycleTotal': 'cycleChange',
117 102
 		'averageTotal': 'averageChange',
118 103
 		'checkboxString': 'checkboxChange'
@@ -120,15 +105,15 @@ export default {
120 105
 	computed: {
121 106
 		// 计算两个周期值
122 107
 		cycleTotal: function () {
123
-			this.cycle01 = this.checkNum(this.cycle01, this.fullYear, this.fullYear + 100)
124
-			this.cycle02 = this.checkNum(this.cycle02, this.fullYear + 1, this.fullYear + 101)
125
-			return this.cycle01 + '-' + this.cycle02;
108
+			const cycle01 = this.checkNum(this.cycle01, this.fullYear, 2098)
109
+			const cycle02 = this.checkNum(this.cycle02, cycle01 ? cycle01 + 1 : this.fullYear + 1, 2099)
110
+			return cycle01 + '-' + cycle02;
126 111
 		},
127 112
 		// 计算平均用到的值
128 113
 		averageTotal: function () {
129
-			this.average01 = this.checkNum(this.average01, this.fullYear, this.fullYear + 100)
130
-			this.average02 = this.checkNum(this.average02, 1, 10)
131
-			return this.average01 + '/' + this.average02;
114
+			const average01 = this.checkNum(this.average01, this.fullYear, 2098)
115
+			const average02 = this.checkNum(this.average02, 1, 2099 - average01 || this.fullYear)
116
+			return average01 + '/' + average02;
132 117
 		},
133 118
 		// 计算勾选的checkbox值合集
134 119
 		checkboxString: function () {
@@ -139,6 +124,8 @@ export default {
139 124
 	mounted: function () {
140 125
 		// 仅获取当前年份
141 126
 		this.fullYear = Number(new Date().getFullYear());
127
+		this.cycle01 = this.fullYear
128
+		this.average01 = this.fullYear
142 129
 	}
143 130
 }
144 131
 </script>