作者 若依
提交者 Gitee

!309 修正单词拼写错误

Merge pull request !309 from 稚屿/master
@@ -75,7 +75,7 @@ export default { @@ -75,7 +75,7 @@ export default {
75 if (this.radioValue === 1) { 75 if (this.radioValue === 1) {
76 this.$emit('update', 'day', '*', 'day'); 76 this.$emit('update', 'day', '*', 'day');
77 this.$emit('update', 'week', '?', 'day'); 77 this.$emit('update', 'week', '?', 'day');
78 - this.$emit('update', 'mouth', '*', 'day'); 78 + this.$emit('update', 'month', '*', 'day');
79 } else { 79 } else {
80 if (this.cron.hour === '*') { 80 if (this.cron.hour === '*') {
81 this.$emit('update', 'hour', '0', 'day'); 81 this.$emit('update', 'hour', '0', 'day');
@@ -2,59 +2,59 @@ @@ -2,59 +2,59 @@
2 <div> 2 <div>
3 <el-tabs type="border-card"> 3 <el-tabs type="border-card">
4 <el-tab-pane label="秒" v-if="shouldHide('second')"> 4 <el-tab-pane label="秒" v-if="shouldHide('second')">
5 - <CrontabSecond @update="updateContabValue" :check="checkNumber" ref="cronsecond" /> 5 + <CrontabSecond @update="updateCrontabValue" :check="checkNumber" ref="cronsecond" />
6 </el-tab-pane> 6 </el-tab-pane>
7 7
8 <el-tab-pane label="分钟" v-if="shouldHide('min')"> 8 <el-tab-pane label="分钟" v-if="shouldHide('min')">
9 <CrontabMin 9 <CrontabMin
10 - @update="updateContabValue" 10 + @update="updateCrontabValue"
11 :check="checkNumber" 11 :check="checkNumber"
12 - :cron="contabValueObj" 12 + :cron="crontabValueObj"
13 ref="cronmin" 13 ref="cronmin"
14 /> 14 />
15 </el-tab-pane> 15 </el-tab-pane>
16 16
17 <el-tab-pane label="小时" v-if="shouldHide('hour')"> 17 <el-tab-pane label="小时" v-if="shouldHide('hour')">
18 <CrontabHour 18 <CrontabHour
19 - @update="updateContabValue" 19 + @update="updateCrontabValue"
20 :check="checkNumber" 20 :check="checkNumber"
21 - :cron="contabValueObj" 21 + :cron="crontabValueObj"
22 ref="cronhour" 22 ref="cronhour"
23 /> 23 />
24 </el-tab-pane> 24 </el-tab-pane>
25 25
26 <el-tab-pane label="日" v-if="shouldHide('day')"> 26 <el-tab-pane label="日" v-if="shouldHide('day')">
27 <CrontabDay 27 <CrontabDay
28 - @update="updateContabValue" 28 + @update="updateCrontabValue"
29 :check="checkNumber" 29 :check="checkNumber"
30 - :cron="contabValueObj" 30 + :cron="crontabValueObj"
31 ref="cronday" 31 ref="cronday"
32 /> 32 />
33 </el-tab-pane> 33 </el-tab-pane>
34 34
35 - <el-tab-pane label="月" v-if="shouldHide('mouth')">  
36 - <CrontabMouth  
37 - @update="updateContabValue" 35 + <el-tab-pane label="月" v-if="shouldHide('month')">
  36 + <CrontabMonth
  37 + @update="updateCrontabValue"
38 :check="checkNumber" 38 :check="checkNumber"
39 - :cron="contabValueObj"  
40 - ref="cronmouth" 39 + :cron="crontabValueObj"
  40 + ref="cronmonth"
41 /> 41 />
42 </el-tab-pane> 42 </el-tab-pane>
43 43
44 <el-tab-pane label="周" v-if="shouldHide('week')"> 44 <el-tab-pane label="周" v-if="shouldHide('week')">
45 <CrontabWeek 45 <CrontabWeek
46 - @update="updateContabValue" 46 + @update="updateCrontabValue"
47 :check="checkNumber" 47 :check="checkNumber"
48 - :cron="contabValueObj" 48 + :cron="crontabValueObj"
49 ref="cronweek" 49 ref="cronweek"
50 /> 50 />
51 </el-tab-pane> 51 </el-tab-pane>
52 52
53 <el-tab-pane label="年" v-if="shouldHide('year')"> 53 <el-tab-pane label="年" v-if="shouldHide('year')">
54 <CrontabYear 54 <CrontabYear
55 - @update="updateContabValue" 55 + @update="updateCrontabValue"
56 :check="checkNumber" 56 :check="checkNumber"
57 - :cron="contabValueObj" 57 + :cron="crontabValueObj"
58 ref="cronyear" 58 ref="cronyear"
59 /> 59 />
60 </el-tab-pane> 60 </el-tab-pane>
@@ -70,33 +70,33 @@ @@ -70,33 +70,33 @@
70 </thead> 70 </thead>
71 <tbody> 71 <tbody>
72 <td> 72 <td>
73 - <span>{{contabValueObj.second}}</span> 73 + <span>{{crontabValueObj.second}}</span>
74 </td> 74 </td>
75 <td> 75 <td>
76 - <span>{{contabValueObj.min}}</span> 76 + <span>{{crontabValueObj.min}}</span>
77 </td> 77 </td>
78 <td> 78 <td>
79 - <span>{{contabValueObj.hour}}</span> 79 + <span>{{crontabValueObj.hour}}</span>
80 </td> 80 </td>
81 <td> 81 <td>
82 - <span>{{contabValueObj.day}}</span> 82 + <span>{{crontabValueObj.day}}</span>
83 </td> 83 </td>
84 <td> 84 <td>
85 - <span>{{contabValueObj.mouth}}</span> 85 + <span>{{crontabValueObj.month}}</span>
86 </td> 86 </td>
87 <td> 87 <td>
88 - <span>{{contabValueObj.week}}</span> 88 + <span>{{crontabValueObj.week}}</span>
89 </td> 89 </td>
90 <td> 90 <td>
91 - <span>{{contabValueObj.year}}</span> 91 + <span>{{crontabValueObj.year}}</span>
92 </td> 92 </td>
93 <td> 93 <td>
94 - <span>{{contabValueString}}</span> 94 + <span>{{crontabValueString}}</span>
95 </td> 95 </td>
96 </tbody> 96 </tbody>
97 </table> 97 </table>
98 </div> 98 </div>
99 - <CrontabResult :ex="contabValueString"></CrontabResult> 99 + <CrontabResult :ex="crontabValueString"></CrontabResult>
100 100
101 <div class="pop_btn"> 101 <div class="pop_btn">
102 <el-button size="small" type="primary" @click="submitFill">确定</el-button> 102 <el-button size="small" type="primary" @click="submitFill">确定</el-button>
@@ -112,7 +112,7 @@ import CrontabSecond from "./second.vue"; @@ -112,7 +112,7 @@ import CrontabSecond from "./second.vue";
112 import CrontabMin from "./min.vue"; 112 import CrontabMin from "./min.vue";
113 import CrontabHour from "./hour.vue"; 113 import CrontabHour from "./hour.vue";
114 import CrontabDay from "./day.vue"; 114 import CrontabDay from "./day.vue";
115 -import CrontabMouth from "./mouth.vue"; 115 +import CrontabMonth from "./month.vue";
116 import CrontabWeek from "./week.vue"; 116 import CrontabWeek from "./week.vue";
117 import CrontabYear from "./year.vue"; 117 import CrontabYear from "./year.vue";
118 import CrontabResult from "./result.vue"; 118 import CrontabResult from "./result.vue";
@@ -123,12 +123,12 @@ export default { @@ -123,12 +123,12 @@ export default {
123 tabTitles: ["秒", "分钟", "小时", "日", "月", "周", "年"], 123 tabTitles: ["秒", "分钟", "小时", "日", "月", "周", "年"],
124 tabActive: 0, 124 tabActive: 0,
125 myindex: 0, 125 myindex: 0,
126 - contabValueObj: { 126 + crontabValueObj: {
127 second: "*", 127 second: "*",
128 min: "*", 128 min: "*",
129 hour: "*", 129 hour: "*",
130 day: "*", 130 day: "*",
131 - mouth: "*", 131 + month: "*",
132 week: "?", 132 week: "?",
133 year: "", 133 year: "",
134 }, 134 },
@@ -142,7 +142,7 @@ export default { @@ -142,7 +142,7 @@ export default {
142 return true; 142 return true;
143 }, 143 },
144 resolveExp() { 144 resolveExp() {
145 - //反解析 表达式 145 + // 反解析 表达式
146 if (this.expression) { 146 if (this.expression) {
147 let arr = this.expression.split(" "); 147 let arr = this.expression.split(" ");
148 if (arr.length >= 6) { 148 if (arr.length >= 6) {
@@ -152,11 +152,11 @@ export default { @@ -152,11 +152,11 @@ export default {
152 min: arr[1], 152 min: arr[1],
153 hour: arr[2], 153 hour: arr[2],
154 day: arr[3], 154 day: arr[3],
155 - mouth: arr[4], 155 + month: arr[4],
156 week: arr[5], 156 week: arr[5],
157 year: arr[6] ? arr[6] : "", 157 year: arr[6] ? arr[6] : "",
158 }; 158 };
159 - this.contabValueObj = { 159 + this.crontabValueObj = {
160 ...obj, 160 ...obj,
161 }; 161 };
162 for (let i in obj) { 162 for (let i in obj) {
@@ -164,7 +164,7 @@ export default { @@ -164,7 +164,7 @@ export default {
164 } 164 }
165 } 165 }
166 } else { 166 } else {
167 - //没有传入的表达式 则还原 167 + // 没有传入的表达式 则还原
168 this.clearCron(); 168 this.clearCron();
169 } 169 }
170 }, 170 },
@@ -173,122 +173,122 @@ export default { @@ -173,122 +173,122 @@ export default {
173 this.tabActive = index; 173 this.tabActive = index;
174 }, 174 },
175 // 由子组件触发,更改表达式组成的字段值 175 // 由子组件触发,更改表达式组成的字段值
176 - updateContabValue(name, value, from) {  
177 - "updateContabValue", name, value, from;  
178 - this.contabValueObj[name] = value; 176 + updateCrontabValue(name, value, from) {
  177 + "updateCrontabValue", name, value, from;
  178 + this.crontabValueObj[name] = value;
179 if (from && from !== name) { 179 if (from && from !== name) {
180 console.log(`来自组件 ${from} 改变了 ${name} ${value}`); 180 console.log(`来自组件 ${from} 改变了 ${name} ${value}`);
181 this.changeRadio(name, value); 181 this.changeRadio(name, value);
182 } 182 }
183 }, 183 },
184 - //赋值到组件 184 + // 赋值到组件
185 changeRadio(name, value) { 185 changeRadio(name, value) {
186 - let arr = ["second", "min", "hour", "mouth"], 186 + let arr = ["second", "min", "hour", "month"],
187 refName = "cron" + name, 187 refName = "cron" + name,
188 - insVlaue; 188 + insValue;
189 189
190 if (!this.$refs[refName]) return; 190 if (!this.$refs[refName]) return;
191 191
192 if (arr.includes(name)) { 192 if (arr.includes(name)) {
193 if (value === "*") { 193 if (value === "*") {
194 - insVlaue = 1; 194 + insValue = 1;
195 } else if (value.indexOf("-") > -1) { 195 } else if (value.indexOf("-") > -1) {
196 let indexArr = value.split("-"); 196 let indexArr = value.split("-");
197 isNaN(indexArr[0]) 197 isNaN(indexArr[0])
198 ? (this.$refs[refName].cycle01 = 0) 198 ? (this.$refs[refName].cycle01 = 0)
199 : (this.$refs[refName].cycle01 = indexArr[0]); 199 : (this.$refs[refName].cycle01 = indexArr[0]);
200 this.$refs[refName].cycle02 = indexArr[1]; 200 this.$refs[refName].cycle02 = indexArr[1];
201 - insVlaue = 2; 201 + insValue = 2;
202 } else if (value.indexOf("/") > -1) { 202 } else if (value.indexOf("/") > -1) {
203 let indexArr = value.split("/"); 203 let indexArr = value.split("/");
204 isNaN(indexArr[0]) 204 isNaN(indexArr[0])
205 ? (this.$refs[refName].average01 = 0) 205 ? (this.$refs[refName].average01 = 0)
206 : (this.$refs[refName].average01 = indexArr[0]); 206 : (this.$refs[refName].average01 = indexArr[0]);
207 this.$refs[refName].average02 = indexArr[1]; 207 this.$refs[refName].average02 = indexArr[1];
208 - insVlaue = 3; 208 + insValue = 3;
209 } else { 209 } else {
210 - insVlaue = 4; 210 + insValue = 4;
211 this.$refs[refName].checkboxList = value.split(","); 211 this.$refs[refName].checkboxList = value.split(",");
212 } 212 }
213 } else if (name == "day") { 213 } else if (name == "day") {
214 if (value === "*") { 214 if (value === "*") {
215 - insVlaue = 1; 215 + insValue = 1;
216 } else if (value == "?") { 216 } else if (value == "?") {
217 - insVlaue = 2; 217 + insValue = 2;
218 } else if (value.indexOf("-") > -1) { 218 } else if (value.indexOf("-") > -1) {
219 let indexArr = value.split("-"); 219 let indexArr = value.split("-");
220 isNaN(indexArr[0]) 220 isNaN(indexArr[0])
221 ? (this.$refs[refName].cycle01 = 0) 221 ? (this.$refs[refName].cycle01 = 0)
222 : (this.$refs[refName].cycle01 = indexArr[0]); 222 : (this.$refs[refName].cycle01 = indexArr[0]);
223 this.$refs[refName].cycle02 = indexArr[1]; 223 this.$refs[refName].cycle02 = indexArr[1];
224 - insVlaue = 3; 224 + insValue = 3;
225 } else if (value.indexOf("/") > -1) { 225 } else if (value.indexOf("/") > -1) {
226 let indexArr = value.split("/"); 226 let indexArr = value.split("/");
227 isNaN(indexArr[0]) 227 isNaN(indexArr[0])
228 ? (this.$refs[refName].average01 = 0) 228 ? (this.$refs[refName].average01 = 0)
229 : (this.$refs[refName].average01 = indexArr[0]); 229 : (this.$refs[refName].average01 = indexArr[0]);
230 this.$refs[refName].average02 = indexArr[1]; 230 this.$refs[refName].average02 = indexArr[1];
231 - insVlaue = 4; 231 + insValue = 4;
232 } else if (value.indexOf("W") > -1) { 232 } else if (value.indexOf("W") > -1) {
233 let indexArr = value.split("W"); 233 let indexArr = value.split("W");
234 isNaN(indexArr[0]) 234 isNaN(indexArr[0])
235 ? (this.$refs[refName].workday = 0) 235 ? (this.$refs[refName].workday = 0)
236 : (this.$refs[refName].workday = indexArr[0]); 236 : (this.$refs[refName].workday = indexArr[0]);
237 - insVlaue = 5; 237 + insValue = 5;
238 } else if (value === "L") { 238 } else if (value === "L") {
239 - insVlaue = 6; 239 + insValue = 6;
240 } else { 240 } else {
241 this.$refs[refName].checkboxList = value.split(","); 241 this.$refs[refName].checkboxList = value.split(",");
242 - insVlaue = 7; 242 + insValue = 7;
243 } 243 }
244 } else if (name == "week") { 244 } else if (name == "week") {
245 if (value === "*") { 245 if (value === "*") {
246 - insVlaue = 1; 246 + insValue = 1;
247 } else if (value == "?") { 247 } else if (value == "?") {
248 - insVlaue = 2; 248 + insValue = 2;
249 } else if (value.indexOf("-") > -1) { 249 } else if (value.indexOf("-") > -1) {
250 let indexArr = value.split("-"); 250 let indexArr = value.split("-");
251 isNaN(indexArr[0]) 251 isNaN(indexArr[0])
252 ? (this.$refs[refName].cycle01 = 0) 252 ? (this.$refs[refName].cycle01 = 0)
253 : (this.$refs[refName].cycle01 = indexArr[0]); 253 : (this.$refs[refName].cycle01 = indexArr[0]);
254 this.$refs[refName].cycle02 = indexArr[1]; 254 this.$refs[refName].cycle02 = indexArr[1];
255 - insVlaue = 3; 255 + insValue = 3;
256 } else if (value.indexOf("#") > -1) { 256 } else if (value.indexOf("#") > -1) {
257 let indexArr = value.split("#"); 257 let indexArr = value.split("#");
258 isNaN(indexArr[0]) 258 isNaN(indexArr[0])
259 ? (this.$refs[refName].average01 = 1) 259 ? (this.$refs[refName].average01 = 1)
260 : (this.$refs[refName].average01 = indexArr[0]); 260 : (this.$refs[refName].average01 = indexArr[0]);
261 this.$refs[refName].average02 = indexArr[1]; 261 this.$refs[refName].average02 = indexArr[1];
262 - insVlaue = 4; 262 + insValue = 4;
263 } else if (value.indexOf("L") > -1) { 263 } else if (value.indexOf("L") > -1) {
264 let indexArr = value.split("L"); 264 let indexArr = value.split("L");
265 isNaN(indexArr[0]) 265 isNaN(indexArr[0])
266 ? (this.$refs[refName].weekday = 1) 266 ? (this.$refs[refName].weekday = 1)
267 : (this.$refs[refName].weekday = indexArr[0]); 267 : (this.$refs[refName].weekday = indexArr[0]);
268 - insVlaue = 5; 268 + insValue = 5;
269 } else { 269 } else {
270 this.$refs[refName].checkboxList = value.split(","); 270 this.$refs[refName].checkboxList = value.split(",");
271 - insVlaue = 7; 271 + insValue = 7;
272 } 272 }
273 } else if (name == "year") { 273 } else if (name == "year") {
274 if (value == "") { 274 if (value == "") {
275 - insVlaue = 1; 275 + insValue = 1;
276 } else if (value == "*") { 276 } else if (value == "*") {
277 - insVlaue = 2; 277 + insValue = 2;
278 } else if (value.indexOf("-") > -1) { 278 } else if (value.indexOf("-") > -1) {
279 - insVlaue = 3; 279 + insValue = 3;
280 } else if (value.indexOf("/") > -1) { 280 } else if (value.indexOf("/") > -1) {
281 - insVlaue = 4; 281 + insValue = 4;
282 } else { 282 } else {
283 this.$refs[refName].checkboxList = value.split(","); 283 this.$refs[refName].checkboxList = value.split(",");
284 - insVlaue = 5; 284 + insValue = 5;
285 } 285 }
286 } 286 }
287 - this.$refs[refName].radioValue = insVlaue; 287 + this.$refs[refName].radioValue = insValue;
288 }, 288 },
289 // 表单选项的子组件校验数字格式(通过-props传递) 289 // 表单选项的子组件校验数字格式(通过-props传递)
290 checkNumber(value, minLimit, maxLimit) { 290 checkNumber(value, minLimit, maxLimit) {
291 - //检查必须为整数 291 + // 检查必须为整数
292 value = Math.floor(value); 292 value = Math.floor(value);
293 if (value < minLimit) { 293 if (value < minLimit) {
294 value = minLimit; 294 value = minLimit;
@@ -303,29 +303,29 @@ export default { @@ -303,29 +303,29 @@ export default {
303 }, 303 },
304 // 填充表达式 304 // 填充表达式
305 submitFill() { 305 submitFill() {
306 - this.$emit("fill", this.contabValueString); 306 + this.$emit("fill", this.crontabValueString);
307 this.hidePopup(); 307 this.hidePopup();
308 }, 308 },
309 clearCron() { 309 clearCron() {
310 // 还原选择项 310 // 还原选择项
311 ("准备还原"); 311 ("准备还原");
312 - this.contabValueObj = { 312 + this.crontabValueObj = {
313 second: "*", 313 second: "*",
314 min: "*", 314 min: "*",
315 hour: "*", 315 hour: "*",
316 day: "*", 316 day: "*",
317 - mouth: "*", 317 + month: "*",
318 week: "?", 318 week: "?",
319 year: "", 319 year: "",
320 }; 320 };
321 - for (let j in this.contabValueObj) {  
322 - this.changeRadio(j, this.contabValueObj[j]); 321 + for (let j in this.crontabValueObj) {
  322 + this.changeRadio(j, this.crontabValueObj[j]);
323 } 323 }
324 }, 324 },
325 }, 325 },
326 computed: { 326 computed: {
327 - contabValueString: function() {  
328 - let obj = this.contabValueObj; 327 + crontabValueString: function() {
  328 + let obj = this.crontabValueObj;
329 let str = 329 let str =
330 obj.second + 330 obj.second +
331 " " + 331 " " +
@@ -335,7 +335,7 @@ export default { @@ -335,7 +335,7 @@ export default {
335 " " + 335 " " +
336 obj.day + 336 obj.day +
337 " " + 337 " " +
338 - obj.mouth + 338 + obj.month +
339 " " + 339 " " +
340 obj.week + 340 obj.week +
341 (obj.year == "" ? "" : " " + obj.year); 341 (obj.year == "" ? "" : " " + obj.year);
@@ -347,7 +347,7 @@ export default { @@ -347,7 +347,7 @@ export default {
347 CrontabMin, 347 CrontabMin,
348 CrontabHour, 348 CrontabHour,
349 CrontabDay, 349 CrontabDay,
350 - CrontabMouth, 350 + CrontabMonth,
351 CrontabWeek, 351 CrontabWeek,
352 CrontabYear, 352 CrontabYear,
353 CrontabResult, 353 CrontabResult,
@@ -46,56 +46,56 @@ export default { @@ -46,56 +46,56 @@ export default {
46 checkNum: this.check 46 checkNum: this.check
47 } 47 }
48 }, 48 },
49 - name: 'crontab-mouth', 49 + name: 'crontab-month',
50 props: ['check', 'cron'], 50 props: ['check', 'cron'],
51 methods: { 51 methods: {
52 // 单选按钮值变化时 52 // 单选按钮值变化时
53 radioChange() { 53 radioChange() {
54 if (this.radioValue === 1) { 54 if (this.radioValue === 1) {
55 - this.$emit('update', 'mouth', '*'); 55 + this.$emit('update', 'month', '*');
56 this.$emit('update', 'year', '*'); 56 this.$emit('update', 'year', '*');
57 } else { 57 } else {
58 if (this.cron.day === '*') { 58 if (this.cron.day === '*') {
59 - this.$emit('update', 'day', '0', 'mouth'); 59 + this.$emit('update', 'day', '0', 'month');
60 } 60 }
61 if (this.cron.hour === '*') { 61 if (this.cron.hour === '*') {
62 - this.$emit('update', 'hour', '0', 'mouth'); 62 + this.$emit('update', 'hour', '0', 'month');
63 } 63 }
64 if (this.cron.min === '*') { 64 if (this.cron.min === '*') {
65 - this.$emit('update', 'min', '0', 'mouth'); 65 + this.$emit('update', 'min', '0', 'month');
66 } 66 }
67 if (this.cron.second === '*') { 67 if (this.cron.second === '*') {
68 - this.$emit('update', 'second', '0', 'mouth'); 68 + this.$emit('update', 'second', '0', 'month');
69 } 69 }
70 } 70 }
71 switch (this.radioValue) { 71 switch (this.radioValue) {
72 case 2: 72 case 2:
73 - this.$emit('update', 'mouth', this.cycle01 + '-' + this.cycle02); 73 + this.$emit('update', 'month', this.cycle01 + '-' + this.cycle02);
74 break; 74 break;
75 case 3: 75 case 3:
76 - this.$emit('update', 'mouth', this.average01 + '/' + this.average02); 76 + this.$emit('update', 'month', this.average01 + '/' + this.average02);
77 break; 77 break;
78 case 4: 78 case 4:
79 - this.$emit('update', 'mouth', this.checkboxString); 79 + this.$emit('update', 'month', this.checkboxString);
80 break; 80 break;
81 } 81 }
82 }, 82 },
83 // 周期两个值变化时 83 // 周期两个值变化时
84 cycleChange() { 84 cycleChange() {
85 if (this.radioValue == '2') { 85 if (this.radioValue == '2') {
86 - this.$emit('update', 'mouth', this.cycleTotal); 86 + this.$emit('update', 'month', this.cycleTotal);
87 } 87 }
88 }, 88 },
89 // 平均两个值变化时 89 // 平均两个值变化时
90 averageChange() { 90 averageChange() {
91 if (this.radioValue == '3') { 91 if (this.radioValue == '3') {
92 - this.$emit('update', 'mouth', this.averageTotal); 92 + this.$emit('update', 'month', this.averageTotal);
93 } 93 }
94 }, 94 },
95 // checkbox值变化时 95 // checkbox值变化时
96 checkboxChange() { 96 checkboxChange() {
97 if (this.radioValue == '4') { 97 if (this.radioValue == '4') {
98 - this.$emit('update', 'mouth', this.checkboxString); 98 + this.$emit('update', 'month', this.checkboxString);
99 } 99 }
100 } 100 }
101 }, 101 },
@@ -37,7 +37,7 @@ export default { @@ -37,7 +37,7 @@ export default {
37 // 获取当前时间精确至[年、月、日、时、分、秒] 37 // 获取当前时间精确至[年、月、日、时、分、秒]
38 let nTime = new Date(); 38 let nTime = new Date();
39 let nYear = nTime.getFullYear(); 39 let nYear = nTime.getFullYear();
40 - let nMouth = nTime.getMonth() + 1; 40 + let nMonth = nTime.getMonth() + 1;
41 let nDay = nTime.getDate(); 41 let nDay = nTime.getDate();
42 let nHour = nTime.getHours(); 42 let nHour = nTime.getHours();
43 let nMin = nTime.getMinutes(); 43 let nMin = nTime.getMinutes();
@@ -47,7 +47,7 @@ export default { @@ -47,7 +47,7 @@ export default {
47 this.getMinArr(ruleArr[1]); 47 this.getMinArr(ruleArr[1]);
48 this.getHourArr(ruleArr[2]); 48 this.getHourArr(ruleArr[2]);
49 this.getDayArr(ruleArr[3]); 49 this.getDayArr(ruleArr[3]);
50 - this.getMouthArr(ruleArr[4]); 50 + this.getMonthArr(ruleArr[4]);
51 this.getWeekArr(ruleArr[5]); 51 this.getWeekArr(ruleArr[5]);
52 this.getYearArr(ruleArr[6], nYear); 52 this.getYearArr(ruleArr[6], nYear);
53 // 将获取到的数组赋值-方便使用 53 // 将获取到的数组赋值-方便使用
@@ -62,7 +62,7 @@ export default { @@ -62,7 +62,7 @@ export default {
62 let mIdx = this.getIndex(mDate, nMin); 62 let mIdx = this.getIndex(mDate, nMin);
63 let hIdx = this.getIndex(hDate, nHour); 63 let hIdx = this.getIndex(hDate, nHour);
64 let DIdx = this.getIndex(DDate, nDay); 64 let DIdx = this.getIndex(DDate, nDay);
65 - let MIdx = this.getIndex(MDate, nMouth); 65 + let MIdx = this.getIndex(MDate, nMonth);
66 let YIdx = this.getIndex(YDate, nYear); 66 let YIdx = this.getIndex(YDate, nYear);
67 // 重置月日时分秒的函数(后面用的比较多) 67 // 重置月日时分秒的函数(后面用的比较多)
68 const resetSecond = function () { 68 const resetSecond = function () {
@@ -84,17 +84,17 @@ export default { @@ -84,17 +84,17 @@ export default {
84 nDay = DDate[DIdx] 84 nDay = DDate[DIdx]
85 resetHour(); 85 resetHour();
86 } 86 }
87 - const resetMouth = function () { 87 + const resetMonth = function () {
88 MIdx = 0; 88 MIdx = 0;
89 - nMouth = MDate[MIdx] 89 + nMonth = MDate[MIdx]
90 resetDay(); 90 resetDay();
91 } 91 }
92 // 如果当前年份不为数组中当前值 92 // 如果当前年份不为数组中当前值
93 if (nYear !== YDate[YIdx]) { 93 if (nYear !== YDate[YIdx]) {
94 - resetMouth(); 94 + resetMonth();
95 } 95 }
96 // 如果当前月份不为数组中当前值 96 // 如果当前月份不为数组中当前值
97 - if (nMouth !== MDate[MIdx]) { 97 + if (nMonth !== MDate[MIdx]) {
98 resetDay(); 98 resetDay();
99 } 99 }
100 // 如果当前“日”不为数组中当前值 100 // 如果当前“日”不为数组中当前值
@@ -114,12 +114,12 @@ export default { @@ -114,12 +114,12 @@ export default {
114 goYear: for (let Yi = YIdx; Yi < YDate.length; Yi++) { 114 goYear: for (let Yi = YIdx; Yi < YDate.length; Yi++) {
115 let YY = YDate[Yi]; 115 let YY = YDate[Yi];
116 // 如果到达最大值时 116 // 如果到达最大值时
117 - if (nMouth > MDate[MDate.length - 1]) {  
118 - resetMouth(); 117 + if (nMonth > MDate[MDate.length - 1]) {
  118 + resetMonth();
119 continue; 119 continue;
120 } 120 }
121 // 循环月份数组 121 // 循环月份数组
122 - goMouth: for (let Mi = MIdx; Mi < MDate.length; Mi++) { 122 + goMonth: for (let Mi = MIdx; Mi < MDate.length; Mi++) {
123 // 赋值、方便后面运算 123 // 赋值、方便后面运算
124 let MM = MDate[Mi]; 124 let MM = MDate[Mi];
125 MM = MM < 10 ? '0' + MM : MM; 125 MM = MM < 10 ? '0' + MM : MM;
@@ -127,7 +127,7 @@ export default { @@ -127,7 +127,7 @@ export default {
127 if (nDay > DDate[DDate.length - 1]) { 127 if (nDay > DDate[DDate.length - 1]) {
128 resetDay(); 128 resetDay();
129 if (Mi == MDate.length - 1) { 129 if (Mi == MDate.length - 1) {
130 - resetMouth(); 130 + resetMonth();
131 continue goYear; 131 continue goYear;
132 } 132 }
133 continue; 133 continue;
@@ -144,10 +144,10 @@ export default { @@ -144,10 +144,10 @@ export default {
144 if (Di == DDate.length - 1) { 144 if (Di == DDate.length - 1) {
145 resetDay(); 145 resetDay();
146 if (Mi == MDate.length - 1) { 146 if (Mi == MDate.length - 1) {
147 - resetMouth(); 147 + resetMonth();
148 continue goYear; 148 continue goYear;
149 } 149 }
150 - continue goMouth; 150 + continue goMonth;
151 } 151 }
152 continue; 152 continue;
153 } 153 }
@@ -155,11 +155,11 @@ export default { @@ -155,11 +155,11 @@ export default {
155 // 判断日期的合法性,不合法的话也是跳出当前循环 155 // 判断日期的合法性,不合法的话也是跳出当前循环
156 if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true && this.dayRule !== 'workDay' && this.dayRule !== 'lastWeek' && this.dayRule !== 'lastDay') { 156 if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true && this.dayRule !== 'workDay' && this.dayRule !== 'lastWeek' && this.dayRule !== 'lastDay') {
157 resetDay(); 157 resetDay();
158 - continue goMouth; 158 + continue goMonth;
159 } 159 }
160 // 如果日期规则中有值时 160 // 如果日期规则中有值时
161 if (this.dayRule == 'lastDay') { 161 if (this.dayRule == 'lastDay') {
162 - //如果不是合法日期则需要将前将日期调到合法日期即月末最后一天 162 + // 如果不是合法日期则需要将前将日期调到合法日期即月末最后一天
163 163
164 if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { 164 if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
165 while (DD > 0 && this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { 165 while (DD > 0 && this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
@@ -169,7 +169,7 @@ export default { @@ -169,7 +169,7 @@ export default {
169 } 169 }
170 } 170 }
171 } else if (this.dayRule == 'workDay') { 171 } else if (this.dayRule == 'workDay') {
172 - //校验并调整如果是2月30号这种日期传进来时需调整至正常月底 172 + // 校验并调整如果是2月30号这种日期传进来时需调整至正常月底
173 if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { 173 if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
174 while (DD > 0 && this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { 174 while (DD > 0 && this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
175 DD--; 175 DD--;
@@ -180,15 +180,15 @@ export default { @@ -180,15 +180,15 @@ export default {
180 let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + thisDD + ' 00:00:00'), 'week'); 180 let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + thisDD + ' 00:00:00'), 'week');
181 // 当星期日时 181 // 当星期日时
182 if (thisWeek == 0) { 182 if (thisWeek == 0) {
183 - //先找下一个日,并判断是否为月底 183 + // 先找下一个日,并判断是否为月底
184 DD++; 184 DD++;
185 thisDD = DD < 10 ? '0' + DD : DD; 185 thisDD = DD < 10 ? '0' + DD : DD;
186 - //判断下一日已经不是合法日期 186 + // 判断下一日已经不是合法日期
187 if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { 187 if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
188 DD -= 3; 188 DD -= 3;
189 } 189 }
190 } else if (thisWeek == 6) { 190 } else if (thisWeek == 6) {
191 - //当星期6时只需判断不是1号就可进行操作 191 + // 当星期6时只需判断不是1号就可进行操作
192 if (this.dayRuleSup !== 1) { 192 if (this.dayRuleSup !== 1) {
193 DD--; 193 DD--;
194 } else { 194 } else {
@@ -196,25 +196,25 @@ export default { @@ -196,25 +196,25 @@ export default {
196 } 196 }
197 } 197 }
198 } else if (this.dayRule == 'weekDay') { 198 } else if (this.dayRule == 'weekDay') {
199 - //如果指定了是星期几  
200 - //获取当前日期是属于星期几 199 + // 如果指定了是星期几
  200 + // 获取当前日期是属于星期几
201 let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week'); 201 let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week');
202 - //校验当前星期是否在星期池(dayRuleSup)中 202 + // 校验当前星期是否在星期池(dayRuleSup)中
203 if (Array.indexOf(this.dayRuleSup, thisWeek) < 0) { 203 if (Array.indexOf(this.dayRuleSup, thisWeek) < 0) {
204 // 如果到达最大值时 204 // 如果到达最大值时
205 if (Di == DDate.length - 1) { 205 if (Di == DDate.length - 1) {
206 resetDay(); 206 resetDay();
207 if (Mi == MDate.length - 1) { 207 if (Mi == MDate.length - 1) {
208 - resetMouth(); 208 + resetMonth();
209 continue goYear; 209 continue goYear;
210 } 210 }
211 - continue goMouth; 211 + continue goMonth;
212 } 212 }
213 continue; 213 continue;
214 } 214 }
215 } else if (this.dayRule == 'assWeek') { 215 } else if (this.dayRule == 'assWeek') {
216 - //如果指定了是第几周的星期几  
217 - //获取每月1号是属于星期几 216 + // 如果指定了是第几周的星期几
  217 + // 获取每月1号是属于星期几
218 let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week'); 218 let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week');
219 if (this.dayRuleSup[1] >= thisWeek) { 219 if (this.dayRuleSup[1] >= thisWeek) {
220 DD = (this.dayRuleSup[0] - 1) * 7 + this.dayRuleSup[1] - thisWeek + 1; 220 DD = (this.dayRuleSup[0] - 1) * 7 + this.dayRuleSup[1] - thisWeek + 1;
@@ -222,17 +222,17 @@ export default { @@ -222,17 +222,17 @@ export default {
222 DD = this.dayRuleSup[0] * 7 + this.dayRuleSup[1] - thisWeek + 1; 222 DD = this.dayRuleSup[0] * 7 + this.dayRuleSup[1] - thisWeek + 1;
223 } 223 }
224 } else if (this.dayRule == 'lastWeek') { 224 } else if (this.dayRule == 'lastWeek') {
225 - //如果指定了每月最后一个星期几  
226 - //校验并调整如果是2月30号这种日期传进来时需调整至正常月底 225 + // 如果指定了每月最后一个星期几
  226 + // 校验并调整如果是2月30号这种日期传进来时需调整至正常月底
227 if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { 227 if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
228 while (DD > 0 && this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { 228 while (DD > 0 && this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
229 DD--; 229 DD--;
230 thisDD = DD < 10 ? '0' + DD : DD; 230 thisDD = DD < 10 ? '0' + DD : DD;
231 } 231 }
232 } 232 }
233 - //获取月末最后一天是星期几 233 + // 获取月末最后一天是星期几
234 let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + thisDD + ' 00:00:00'), 'week'); 234 let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + thisDD + ' 00:00:00'), 'week');
235 - //找到要求中最近的那个星期几 235 + // 找到要求中最近的那个星期几
236 if (this.dayRuleSup < thisWeek) { 236 if (this.dayRuleSup < thisWeek) {
237 DD -= thisWeek - this.dayRuleSup; 237 DD -= thisWeek - this.dayRuleSup;
238 } else if (this.dayRuleSup > thisWeek) { 238 } else if (this.dayRuleSup > thisWeek) {
@@ -254,10 +254,10 @@ export default { @@ -254,10 +254,10 @@ export default {
254 if (Di == DDate.length - 1) { 254 if (Di == DDate.length - 1) {
255 resetDay(); 255 resetDay();
256 if (Mi == MDate.length - 1) { 256 if (Mi == MDate.length - 1) {
257 - resetMouth(); 257 + resetMonth();
258 continue goYear; 258 continue goYear;
259 } 259 }
260 - continue goMouth; 260 + continue goMonth;
261 } 261 }
262 continue goDay; 262 continue goDay;
263 } 263 }
@@ -277,10 +277,10 @@ export default { @@ -277,10 +277,10 @@ export default {
277 if (Di == DDate.length - 1) { 277 if (Di == DDate.length - 1) {
278 resetDay(); 278 resetDay();
279 if (Mi == MDate.length - 1) { 279 if (Mi == MDate.length - 1) {
280 - resetMouth(); 280 + resetMonth();
281 continue goYear; 281 continue goYear;
282 } 282 }
283 - continue goMouth; 283 + continue goMonth;
284 } 284 }
285 continue goDay; 285 continue goDay;
286 } 286 }
@@ -296,9 +296,9 @@ export default { @@ -296,9 +296,9 @@ export default {
296 resultArr.push(YY + '-' + MM + '-' + DD + ' ' + hh + ':' + mm + ':' + ss) 296 resultArr.push(YY + '-' + MM + '-' + DD + ' ' + hh + ':' + mm + ':' + ss)
297 nums++; 297 nums++;
298 } 298 }
299 - //如果条数满了就退出循环 299 + // 如果条数满了就退出循环
300 if (nums == 5) break goYear; 300 if (nums == 5) break goYear;
301 - //如果到达最大值时 301 + // 如果到达最大值时
302 if (si == sDate.length - 1) { 302 if (si == sDate.length - 1) {
303 resetSecond(); 303 resetSecond();
304 if (mi == mDate.length - 1) { 304 if (mi == mDate.length - 1) {
@@ -308,10 +308,10 @@ export default { @@ -308,10 +308,10 @@ export default {
308 if (Di == DDate.length - 1) { 308 if (Di == DDate.length - 1) {
309 resetDay(); 309 resetDay();
310 if (Mi == MDate.length - 1) { 310 if (Mi == MDate.length - 1) {
311 - resetMouth(); 311 + resetMonth();
312 continue goYear; 312 continue goYear;
313 } 313 }
314 - continue goMouth; 314 + continue goMonth;
315 } 315 }
316 continue goDay; 316 continue goDay;
317 } 317 }
@@ -323,7 +323,7 @@ export default { @@ -323,7 +323,7 @@ export default {
323 } //goMin 323 } //goMin
324 }//goHour 324 }//goHour
325 }//goDay 325 }//goDay
326 - }//goMouth 326 + }//goMonth
327 } 327 }
328 // 判断100年内的结果条数 328 // 判断100年内的结果条数
329 if (resultArr.length == 0) { 329 if (resultArr.length == 0) {
@@ -339,7 +339,7 @@ export default { @@ -339,7 +339,7 @@ export default {
339 339
340 340
341 }, 341 },
342 - //用于计算某位数字在数组中的索引 342 + // 用于计算某位数字在数组中的索引
343 getIndex(arr, value) { 343 getIndex(arr, value) {
344 if (value <= arr[0] || value > arr[arr.length - 1]) { 344 if (value <= arr[0] || value > arr[arr.length - 1]) {
345 return 0; 345 return 0;
@@ -365,7 +365,7 @@ export default { @@ -365,7 +365,7 @@ export default {
365 } 365 }
366 }, 366 },
367 // 获取"月"数组 367 // 获取"月"数组
368 - getMouthArr(rule) { 368 + getMonthArr(rule) {
369 this.dateArr[4] = this.getOrderArr(1, 12); 369 this.dateArr[4] = this.getOrderArr(1, 12);
370 if (rule.indexOf('-') >= 0) { 370 if (rule.indexOf('-') >= 0) {
371 this.dateArr[4] = this.getCycleArr(rule, 12, false) 371 this.dateArr[4] = this.getCycleArr(rule, 12, false)
@@ -377,7 +377,7 @@ export default { @@ -377,7 +377,7 @@ export default {
377 }, 377 },
378 // 获取"日"数组-主要为日期规则 378 // 获取"日"数组-主要为日期规则
379 getWeekArr(rule) { 379 getWeekArr(rule) {
380 - //只有当日期规则的两个值均为“”时则表达日期是有选项的 380 + // 只有当日期规则的两个值均为“”时则表达日期是有选项的
381 if (this.dayRule == '' && this.dayRuleSup == '') { 381 if (this.dayRule == '' && this.dayRuleSup == '') {
382 if (rule.indexOf('-') >= 0) { 382 if (rule.indexOf('-') >= 0) {
383 this.dayRule = 'weekDay'; 383 this.dayRule = 'weekDay';
@@ -401,7 +401,7 @@ export default { @@ -401,7 +401,7 @@ export default {
401 this.dayRule = 'weekDay'; 401 this.dayRule = 'weekDay';
402 this.dayRuleSup = this.getAssignArr(rule) 402 this.dayRuleSup = this.getAssignArr(rule)
403 } 403 }
404 - //如果weekDay时将7调整为0【week值0即是星期日】 404 + // 如果weekDay时将7调整为0【week值0即是星期日】
405 if (this.dayRule == 'weekDay') { 405 if (this.dayRule == 'weekDay') {
406 for (let i = 0; i < this.dayRuleSup.length; i++) { 406 for (let i = 0; i < this.dayRuleSup.length; i++) {
407 if (this.dayRuleSup[i] == 7) { 407 if (this.dayRuleSup[i] == 7) {
@@ -502,7 +502,7 @@ export default { @@ -502,7 +502,7 @@ export default {
502 }, 502 },
503 // 根据规则返回一个具有周期性的数组 503 // 根据规则返回一个具有周期性的数组
504 getCycleArr(rule, limit, status) { 504 getCycleArr(rule, limit, status) {
505 - //status--表示是否从0开始(则从1开始) 505 + // status--表示是否从0开始(则从1开始)
506 let arr = []; 506 let arr = [];
507 let cycleArr = rule.split('-'); 507 let cycleArr = rule.split('-');
508 let min = Number(cycleArr[0]); 508 let min = Number(cycleArr[0]);
@@ -520,7 +520,7 @@ export default { @@ -520,7 +520,7 @@ export default {
520 arr.sort(this.compare) 520 arr.sort(this.compare)
521 return arr; 521 return arr;
522 }, 522 },
523 - //比较数字大小(用于Array.sort) 523 + // 比较数字大小(用于Array.sort)
524 compare(value1, value2) { 524 compare(value1, value2) {
525 if (value2 - value1 > 0) { 525 if (value2 - value1 > 0) {
526 return -1; 526 return -1;
@@ -86,7 +86,7 @@ export default { @@ -86,7 +86,7 @@ export default {
86 } 86 }
87 }, 87 },
88 othChange() { 88 othChange() {
89 - //反解析 89 + // 反解析
90 let ins = this.cron.second 90 let ins = this.cron.second
91 ('反解析 second', ins); 91 ('反解析 second', ins);
92 if (ins === '*') { 92 if (ins === '*') {
@@ -71,8 +71,8 @@ export default { @@ -71,8 +71,8 @@ export default {
71 this.$emit('update', 'week', '*'); 71 this.$emit('update', 'week', '*');
72 this.$emit('update', 'year', '*'); 72 this.$emit('update', 'year', '*');
73 } else { 73 } else {
74 - if (this.cron.mouth === '*') {  
75 - this.$emit('update', 'mouth', '0', 'week'); 74 + if (this.cron.month === '*') {
  75 + this.$emit('update', 'month', '0', 'week');
76 } 76 }
77 if (this.cron.day === '*') { 77 if (this.cron.day === '*') {
78 this.$emit('update', 'day', '0', 'week'); 78 this.$emit('update', 'day', '0', 'week');
@@ -55,12 +55,12 @@ export default { @@ -55,12 +55,12 @@ export default {
55 } 55 }
56 }, 56 },
57 name: 'crontab-year', 57 name: 'crontab-year',
58 - props: ['check', 'mouth', 'cron'], 58 + props: ['check', 'month', 'cron'],
59 methods: { 59 methods: {
60 // 单选按钮值变化时 60 // 单选按钮值变化时
61 radioChange() { 61 radioChange() {
62 - if (this.cron.mouth === '*') {  
63 - this.$emit('update', 'mouth', '0', 'year'); 62 + if (this.cron.month === '*') {
  63 + this.$emit('update', 'month', '0', 'year');
64 } 64 }
65 if (this.cron.day === '*') { 65 if (this.cron.day === '*') {
66 this.$emit('update', 'day', '0', 'year'); 66 this.$emit('update', 'day', '0', 'year');