作者 fuzui

fix: crontab组件中规范数据范围、冗余代码去除以及部分通配符说明

@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <el-form size="small"> 2 <el-form size="small">
3 <el-form-item> 3 <el-form-item>
4 <el-radio v-model='radioValue' :label="1"> 4 <el-radio v-model='radioValue' :label="1">
5 - 日,允许的通配符[, - * / L M] 5 + 日,允许的通配符[, - * ? / L W]
6 </el-radio> 6 </el-radio>
7 </el-form-item> 7 </el-form-item>
8 8
@@ -15,23 +15,23 @@ @@ -15,23 +15,23 @@
15 <el-form-item> 15 <el-form-item>
16 <el-radio v-model='radioValue' :label="3"> 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 </el-radio> 20 </el-radio>
21 </el-form-item> 21 </el-form-item>
22 22
23 <el-form-item> 23 <el-form-item>
24 <el-radio v-model='radioValue' :label="4"> 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 </el-radio> 28 </el-radio>
29 </el-form-item> 29 </el-form-item>
30 30
31 <el-form-item> 31 <el-form-item>
32 <el-radio v-model='radioValue' :label="5"> 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 </el-radio> 35 </el-radio>
36 </el-form-item> 36 </el-form-item>
37 37
@@ -84,10 +84,10 @@ export default { @@ -84,10 +84,10 @@ export default {
84 this.$emit('update', 'day', '?'); 84 this.$emit('update', 'day', '?');
85 break; 85 break;
86 case 3: 86 case 3:
87 - this.$emit('update', 'day', this.cycle01 + '-' + this.cycle02); 87 + this.$emit('update', 'day', this.cycleTotal);
88 break; 88 break;
89 case 4: 89 case 4:
90 - this.$emit('update', 'day', this.average01 + '/' + this.average02); 90 + this.$emit('update', 'day', this.averageTotal);
91 break; 91 break;
92 case 5: 92 case 5:
93 this.$emit('update', 'day', this.workday + 'W'); 93 this.$emit('update', 'day', this.workday + 'W');
@@ -116,7 +116,7 @@ export default { @@ -116,7 +116,7 @@ export default {
116 // 最近工作日值变化时 116 // 最近工作日值变化时
117 workdayChange() { 117 workdayChange() {
118 if (this.radioValue == '5') { 118 if (this.radioValue == '5') {
119 - this.$emit('update', 'day', this.workday + 'W'); 119 + this.$emit('update', 'day', this.workdayCheck + 'W');
120 } 120 }
121 }, 121 },
122 // checkbox值变化时 122 // checkbox值变化时
@@ -124,19 +124,10 @@ export default { @@ -124,19 +124,10 @@ export default {
124 if (this.radioValue == '7') { 124 if (this.radioValue == '7') {
125 this.$emit('update', 'day', this.checkboxString); 125 this.$emit('update', 'day', this.checkboxString);
126 } 126 }
127 - },  
128 - // 父组件传递的week发生变化触发  
129 - weekChange() {  
130 - //判断week值与day不能同时为“?”  
131 - if (this.cron.week == '?' && this.radioValue == '2') {  
132 - this.radioValue = '1';  
133 - } else if (this.cron.week !== '?' && this.radioValue != '2') {  
134 - this.radioValue = '2';  
135 } 127 }
136 }, 128 },
137 - },  
138 watch: { 129 watch: {
139 - "radioValue": "radioChange", 130 + 'radioValue': 'radioChange',
140 'cycleTotal': 'cycleChange', 131 'cycleTotal': 'cycleChange',
141 'averageTotal': 'averageChange', 132 'averageTotal': 'averageChange',
142 'workdayCheck': 'workdayChange', 133 'workdayCheck': 'workdayChange',
@@ -145,20 +136,20 @@ export default { @@ -145,20 +136,20 @@ export default {
145 computed: { 136 computed: {
146 // 计算两个周期值 137 // 计算两个周期值
147 cycleTotal: function () { 138 cycleTotal: function () {
148 - this.cycle01 = this.checkNum(this.cycle01, 1, 31)  
149 - this.cycle02 = this.checkNum(this.cycle02, 1, 31)  
150 - 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;
151 }, 142 },
152 // 计算平均用到的值 143 // 计算平均用到的值
153 averageTotal: function () { 144 averageTotal: function () {
154 - this.average01 = this.checkNum(this.average01, 1, 31)  
155 - this.average02 = this.checkNum(this.average02, 1, 31)  
156 - 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;
157 }, 148 },
158 // 计算工作日格式 149 // 计算工作日格式
159 workdayCheck: function () { 150 workdayCheck: function () {
160 - this.workday = this.checkNum(this.workday, 1, 31)  
161 - return this.workday; 151 + const workday = this.checkNum(this.workday, 1, 31)
  152 + return workday;
162 }, 153 },
163 // 计算勾选的checkbox值合集 154 // 计算勾选的checkbox值合集
164 checkboxString: function () { 155 checkboxString: function () {
@@ -9,16 +9,16 @@ @@ -9,16 +9,16 @@
9 <el-form-item> 9 <el-form-item>
10 <el-radio v-model='radioValue' :label="2"> 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 </el-radio> 14 </el-radio>
15 </el-form-item> 15 </el-form-item>
16 16
17 <el-form-item> 17 <el-form-item>
18 <el-radio v-model='radioValue' :label="3"> 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 </el-radio> 22 </el-radio>
23 </el-form-item> 23 </el-form-item>
24 24
@@ -56,10 +56,10 @@ export default { @@ -56,10 +56,10 @@ export default {
56 this.$emit('update', 'hour', '*') 56 this.$emit('update', 'hour', '*')
57 break; 57 break;
58 case 2: 58 case 2:
59 - this.$emit('update', 'hour', this.cycle01 + '-' + this.cycle02); 59 + this.$emit('update', 'hour', this.cycleTotal);
60 break; 60 break;
61 case 3: 61 case 3:
62 - this.$emit('update', 'hour', this.average01 + '/' + this.average02); 62 + this.$emit('update', 'hour', this.averageTotal);
63 break; 63 break;
64 case 4: 64 case 4:
65 this.$emit('update', 'hour', this.checkboxString); 65 this.$emit('update', 'hour', this.checkboxString);
@@ -86,7 +86,7 @@ export default { @@ -86,7 +86,7 @@ export default {
86 } 86 }
87 }, 87 },
88 watch: { 88 watch: {
89 - "radioValue": "radioChange", 89 + 'radioValue': 'radioChange',
90 'cycleTotal': 'cycleChange', 90 'cycleTotal': 'cycleChange',
91 'averageTotal': 'averageChange', 91 'averageTotal': 'averageChange',
92 'checkboxString': 'checkboxChange' 92 'checkboxString': 'checkboxChange'
@@ -94,15 +94,15 @@ export default { @@ -94,15 +94,15 @@ export default {
94 computed: { 94 computed: {
95 // 计算两个周期值 95 // 计算两个周期值
96 cycleTotal: function () { 96 cycleTotal: function () {
97 - this.cycle01 = this.checkNum(this.cycle01, 0, 23)  
98 - this.cycle02 = this.checkNum(this.cycle02, 0, 23)  
99 - 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;
100 }, 100 },
101 // 计算平均用到的值 101 // 计算平均用到的值
102 averageTotal: function () { 102 averageTotal: function () {
103 - this.average01 = this.checkNum(this.average01, 0, 23)  
104 - this.average02 = this.checkNum(this.average02, 1, 23)  
105 - 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;
106 }, 106 },
107 // 计算勾选的checkbox值合集 107 // 计算勾选的checkbox值合集
108 checkboxString: function () { 108 checkboxString: function () {
@@ -9,16 +9,16 @@ @@ -9,16 +9,16 @@
9 <el-form-item> 9 <el-form-item>
10 <el-radio v-model='radioValue' :label="2"> 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 </el-radio> 14 </el-radio>
15 </el-form-item> 15 </el-form-item>
16 16
17 <el-form-item> 17 <el-form-item>
18 <el-radio v-model='radioValue' :label="3"> 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 </el-radio> 22 </el-radio>
23 </el-form-item> 23 </el-form-item>
24 24
@@ -57,10 +57,10 @@ export default { @@ -57,10 +57,10 @@ export default {
57 this.$emit('update', 'min', '*', 'min'); 57 this.$emit('update', 'min', '*', 'min');
58 break; 58 break;
59 case 2: 59 case 2:
60 - this.$emit('update', 'min', this.cycle01 + '-' + this.cycle02, 'min'); 60 + this.$emit('update', 'min', this.cycleTotal, 'min');
61 break; 61 break;
62 case 3: 62 case 3:
63 - this.$emit('update', 'min', this.average01 + '/' + this.average02, 'min'); 63 + this.$emit('update', 'min', this.averageTotal, 'min');
64 break; 64 break;
65 case 4: 65 case 4:
66 this.$emit('update', 'min', this.checkboxString, 'min'); 66 this.$emit('update', 'min', this.checkboxString, 'min');
@@ -88,7 +88,7 @@ export default { @@ -88,7 +88,7 @@ export default {
88 88
89 }, 89 },
90 watch: { 90 watch: {
91 - "radioValue": "radioChange", 91 + 'radioValue': 'radioChange',
92 'cycleTotal': 'cycleChange', 92 'cycleTotal': 'cycleChange',
93 'averageTotal': 'averageChange', 93 'averageTotal': 'averageChange',
94 'checkboxString': 'checkboxChange', 94 'checkboxString': 'checkboxChange',
@@ -96,15 +96,15 @@ export default { @@ -96,15 +96,15 @@ export default {
96 computed: { 96 computed: {
97 // 计算两个周期值 97 // 计算两个周期值
98 cycleTotal: function () { 98 cycleTotal: function () {
99 - this.cycle01 = this.checkNum(this.cycle01, 0, 59)  
100 - this.cycle02 = this.checkNum(this.cycle02, 0, 59)  
101 - 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;
102 }, 102 },
103 // 计算平均用到的值 103 // 计算平均用到的值
104 averageTotal: function () { 104 averageTotal: function () {
105 - this.average01 = this.checkNum(this.average01, 0, 59)  
106 - this.average02 = this.checkNum(this.average02, 1, 59)  
107 - 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;
108 }, 108 },
109 // 计算勾选的checkbox值合集 109 // 计算勾选的checkbox值合集
110 checkboxString: function () { 110 checkboxString: function () {
@@ -9,16 +9,16 @@ @@ -9,16 +9,16 @@
9 <el-form-item> 9 <el-form-item>
10 <el-radio v-model='radioValue' :label="2"> 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 </el-radio> 14 </el-radio>
15 </el-form-item> 15 </el-form-item>
16 16
17 <el-form-item> 17 <el-form-item>
18 <el-radio v-model='radioValue' :label="3"> 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 </el-radio> 22 </el-radio>
23 </el-form-item> 23 </el-form-item>
24 24
@@ -56,10 +56,10 @@ export default { @@ -56,10 +56,10 @@ export default {
56 this.$emit('update', 'month', '*'); 56 this.$emit('update', 'month', '*');
57 break; 57 break;
58 case 2: 58 case 2:
59 - this.$emit('update', 'month', this.cycle01 + '-' + this.cycle02); 59 + this.$emit('update', 'month', this.cycleTotal);
60 break; 60 break;
61 case 3: 61 case 3:
62 - this.$emit('update', 'month', this.average01 + '/' + this.average02); 62 + this.$emit('update', 'month', this.averageTotal);
63 break; 63 break;
64 case 4: 64 case 4:
65 this.$emit('update', 'month', this.checkboxString); 65 this.$emit('update', 'month', this.checkboxString);
@@ -86,7 +86,7 @@ export default { @@ -86,7 +86,7 @@ export default {
86 } 86 }
87 }, 87 },
88 watch: { 88 watch: {
89 - "radioValue": "radioChange", 89 + 'radioValue': 'radioChange',
90 'cycleTotal': 'cycleChange', 90 'cycleTotal': 'cycleChange',
91 'averageTotal': 'averageChange', 91 'averageTotal': 'averageChange',
92 'checkboxString': 'checkboxChange' 92 'checkboxString': 'checkboxChange'
@@ -94,15 +94,15 @@ export default { @@ -94,15 +94,15 @@ export default {
94 computed: { 94 computed: {
95 // 计算两个周期值 95 // 计算两个周期值
96 cycleTotal: function () { 96 cycleTotal: function () {
97 - this.cycle01 = this.checkNum(this.cycle01, 1, 12)  
98 - this.cycle02 = this.checkNum(this.cycle02, 1, 12)  
99 - 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;
100 }, 100 },
101 // 计算平均用到的值 101 // 计算平均用到的值
102 averageTotal: function () { 102 averageTotal: function () {
103 - this.average01 = this.checkNum(this.average01, 1, 12)  
104 - this.average02 = this.checkNum(this.average02, 1, 12)  
105 - 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;
106 }, 106 },
107 // 计算勾选的checkbox值合集 107 // 计算勾选的checkbox值合集
108 checkboxString: function () { 108 checkboxString: function () {
@@ -9,16 +9,16 @@ @@ -9,16 +9,16 @@
9 <el-form-item> 9 <el-form-item>
10 <el-radio v-model='radioValue' :label="2"> 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 </el-radio> 14 </el-radio>
15 </el-form-item> 15 </el-form-item>
16 16
17 <el-form-item> 17 <el-form-item>
18 <el-radio v-model='radioValue' :label="3"> 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 </el-radio> 22 </el-radio>
23 </el-form-item> 23 </el-form-item>
24 24
@@ -56,10 +56,10 @@ export default { @@ -56,10 +56,10 @@ export default {
56 this.$emit('update', 'second', '*', 'second'); 56 this.$emit('update', 'second', '*', 'second');
57 break; 57 break;
58 case 2: 58 case 2:
59 - this.$emit('update', 'second', this.cycle01 + '-' + this.cycle02); 59 + this.$emit('update', 'second', this.cycleTotal);
60 break; 60 break;
61 case 3: 61 case 3:
62 - this.$emit('update', 'second', this.average01 + '/' + this.average02); 62 + this.$emit('update', 'second', this.averageTotal);
63 break; 63 break;
64 case 4: 64 case 4:
65 this.$emit('update', 'second', this.checkboxString); 65 this.$emit('update', 'second', this.checkboxString);
@@ -83,25 +83,10 @@ export default { @@ -83,25 +83,10 @@ export default {
83 if (this.radioValue == '4') { 83 if (this.radioValue == '4') {
84 this.$emit('update', 'second', this.checkboxString); 84 this.$emit('update', 'second', this.checkboxString);
85 } 85 }
86 - },  
87 - othChange() {  
88 - // 反解析  
89 - let ins = this.cron.second  
90 - ('反解析 second', ins);  
91 - if (ins === '*') {  
92 - this.radioValue = 1;  
93 - } else if (ins.indexOf('-') > -1) {  
94 - this.radioValue = 2  
95 - } else if (ins.indexOf('/') > -1) {  
96 - this.radioValue = 3  
97 - } else {  
98 - this.radioValue = 4  
99 - this.checkboxList = ins.split(',')  
100 - }  
101 } 86 }
102 }, 87 },
103 watch: { 88 watch: {
104 - "radioValue": "radioChange", 89 + 'radioValue': 'radioChange',
105 'cycleTotal': 'cycleChange', 90 'cycleTotal': 'cycleChange',
106 'averageTotal': 'averageChange', 91 'averageTotal': 'averageChange',
107 'checkboxString': 'checkboxChange', 92 'checkboxString': 'checkboxChange',
@@ -112,15 +97,15 @@ export default { @@ -112,15 +97,15 @@ export default {
112 computed: { 97 computed: {
113 // 计算两个周期值 98 // 计算两个周期值
114 cycleTotal: function () { 99 cycleTotal: function () {
115 - this.cycle01 = this.checkNum(this.cycle01, 0, 59)  
116 - this.cycle02 = this.checkNum(this.cycle02, 0, 59)  
117 - 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;
118 }, 103 },
119 // 计算平均用到的值 104 // 计算平均用到的值
120 averageTotal: function () { 105 averageTotal: function () {
121 - this.average01 = this.checkNum(this.average01, 0, 59)  
122 - this.average02 = this.checkNum(this.average02, 1, 59)  
123 - 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;
124 }, 109 },
125 // 计算勾选的checkbox值合集 110 // 计算勾选的checkbox值合集
126 checkboxString: function () { 111 checkboxString: function () {
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <el-form size='small'> 2 <el-form size='small'>
3 <el-form-item> 3 <el-form-item>
4 <el-radio v-model='radioValue' :label="1"> 4 <el-radio v-model='radioValue' :label="1">
5 - 周,允许的通配符[, - * / L #] 5 + 周,允许的通配符[, - * ? / L #]
6 </el-radio> 6 </el-radio>
7 </el-form-item> 7 </el-form-item>
8 8
@@ -128,13 +128,13 @@ export default { @@ -128,13 +128,13 @@ export default {
128 this.$emit('update', 'week', '?'); 128 this.$emit('update', 'week', '?');
129 break; 129 break;
130 case 3: 130 case 3:
131 - this.$emit('update', 'week', this.cycle01 + '-' + this.cycle02); 131 + this.$emit('update', 'week', this.cycleTotal);
132 break; 132 break;
133 case 4: 133 case 4:
134 - this.$emit('update', 'week', this.average02 + '#' + this.average01); 134 + this.$emit('update', 'week', this.averageTotal);
135 break; 135 break;
136 case 5: 136 case 5:
137 - this.$emit('update', 'week', this.weekday + 'L'); 137 + this.$emit('update', 'week', this.weekdayCheck + 'L');
138 break; 138 break;
139 case 6: 139 case 6:
140 this.$emit('update', 'week', this.checkboxString); 140 this.$emit('update', 'week', this.checkboxString);
@@ -168,7 +168,7 @@ export default { @@ -168,7 +168,7 @@ export default {
168 }, 168 },
169 }, 169 },
170 watch: { 170 watch: {
171 - "radioValue": "radioChange", 171 + 'radioValue': 'radioChange',
172 'cycleTotal': 'cycleChange', 172 'cycleTotal': 'cycleChange',
173 'averageTotal': 'averageChange', 173 'averageTotal': 'averageChange',
174 'weekdayCheck': 'weekdayChange', 174 'weekdayCheck': 'weekdayChange',
@@ -15,16 +15,16 @@ @@ -15,16 +15,16 @@
15 <el-form-item> 15 <el-form-item>
16 <el-radio :label="3" v-model='radioValue'> 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 </el-radio> 20 </el-radio>
21 </el-form-item> 21 </el-form-item>
22 22
23 <el-form-item> 23 <el-form-item>
24 <el-radio :label="4" v-model='radioValue'> 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 </el-radio> 28 </el-radio>
29 29
30 </el-form-item> 30 </el-form-item>
@@ -67,10 +67,10 @@ export default { @@ -67,10 +67,10 @@ export default {
67 this.$emit('update', 'year', '*'); 67 this.$emit('update', 'year', '*');
68 break; 68 break;
69 case 3: 69 case 3:
70 - this.$emit('update', 'year', this.cycle01 + '-' + this.cycle02); 70 + this.$emit('update', 'year', this.cycleTotal);
71 break; 71 break;
72 case 4: 72 case 4:
73 - this.$emit('update', 'year', this.average01 + '/' + this.average02); 73 + this.$emit('update', 'year', this.averageTotal);
74 break; 74 break;
75 case 5: 75 case 5:
76 this.$emit('update', 'year', this.checkboxString); 76 this.$emit('update', 'year', this.checkboxString);
@@ -97,7 +97,7 @@ export default { @@ -97,7 +97,7 @@ export default {
97 } 97 }
98 }, 98 },
99 watch: { 99 watch: {
100 - "radioValue": "radioChange", 100 + 'radioValue': 'radioChange',
101 'cycleTotal': 'cycleChange', 101 'cycleTotal': 'cycleChange',
102 'averageTotal': 'averageChange', 102 'averageTotal': 'averageChange',
103 'checkboxString': 'checkboxChange' 103 'checkboxString': 'checkboxChange'
@@ -105,15 +105,15 @@ export default { @@ -105,15 +105,15 @@ export default {
105 computed: { 105 computed: {
106 // 计算两个周期值 106 // 计算两个周期值
107 cycleTotal: function () { 107 cycleTotal: function () {
108 - this.cycle01 = this.checkNum(this.cycle01, this.fullYear, this.fullYear + 100)  
109 - this.cycle02 = this.checkNum(this.cycle02, this.fullYear + 1, this.fullYear + 101)  
110 - 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;
111 }, 111 },
112 // 计算平均用到的值 112 // 计算平均用到的值
113 averageTotal: function () { 113 averageTotal: function () {
114 - this.average01 = this.checkNum(this.average01, this.fullYear, this.fullYear + 100)  
115 - this.average02 = this.checkNum(this.average02, 1, 10)  
116 - 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;
117 }, 117 },
118 // 计算勾选的checkbox值合集 118 // 计算勾选的checkbox值合集
119 checkboxString: function () { 119 checkboxString: function () {
@@ -124,6 +124,8 @@ export default { @@ -124,6 +124,8 @@ export default {
124 mounted: function () { 124 mounted: function () {
125 // 仅获取当前年份 125 // 仅获取当前年份
126 this.fullYear = Number(new Date().getFullYear()); 126 this.fullYear = Number(new Date().getFullYear());
  127 + this.cycle01 = this.fullYear
  128 + this.average01 = this.fullYear
127 } 129 }
128 } 130 }
129 </script> 131 </script>