替换var 为const/let

删除未使用import
替换 == 为 ===
This commit is contained in:
xingyu4j
2022-11-08 13:31:08 +08:00
parent c9e11e7636
commit 011dc23699
66 changed files with 305 additions and 319 deletions

View File

@ -103,25 +103,25 @@ export default {
},
// 周期两个值变化时
cycleChange() {
if (this.radioValue == '3') {
if (this.radioValue === '3') {
this.$emit('update', 'day', this.cycleTotal);
}
},
// 平均两个值变化时
averageChange() {
if (this.radioValue == '4') {
if (this.radioValue === '4') {
this.$emit('update', 'day', this.averageTotal);
}
},
// 最近工作日值变化时
workdayChange() {
if (this.radioValue == '5') {
if (this.radioValue === '5') {
this.$emit('update', 'day', this.workdayCheck + 'W');
}
},
// checkbox值变化时
checkboxChange() {
if (this.radioValue == '7') {
if (this.radioValue === '7') {
this.$emit('update', 'day', this.checkboxString);
}
}
@ -148,13 +148,12 @@ export default {
},
// 计算工作日格式
workdayCheck: function () {
const workday = this.checkNum(this.workday, 1, 31)
return workday;
return this.checkNum(this.workday, 1, 31);
},
// 计算勾选的checkbox值合集
checkboxString: function () {
let str = this.checkboxList.join();
return str == '' ? '*' : str;
return str === '' ? '*' : str;
}
}
}

View File

@ -68,19 +68,19 @@ export default {
},
// 周期两个值变化时
cycleChange() {
if (this.radioValue == '2') {
if (this.radioValue === '2') {
this.$emit('update', 'hour', this.cycleTotal);
}
},
// 平均两个值变化时
averageChange() {
if (this.radioValue == '3') {
if (this.radioValue === '3') {
this.$emit('update', 'hour', this.averageTotal);
}
},
// checkbox值变化时
checkboxChange() {
if (this.radioValue == '4') {
if (this.radioValue === '4') {
this.$emit('update', 'hour', this.checkboxString);
}
}
@ -107,7 +107,7 @@ export default {
// 计算勾选的checkbox值合集
checkboxString: function () {
let str = this.checkboxList.join();
return str == '' ? '*' : str;
return str === '' ? '*' : str;
}
}
}

View File

@ -143,8 +143,8 @@ export default {
props: ["expression", "hideComponent"],
methods: {
shouldHide(key) {
if (this.hideComponent && this.hideComponent.includes(key)) return false;
return true;
return !(this.hideComponent && this.hideComponent.includes(key));
},
resolveExp() {
// 反解析 表达式
@ -215,10 +215,10 @@ export default {
insValue = 4;
this.$refs[refName].checkboxList = value.split(",");
}
} else if (name == "day") {
} else if (name === "day") {
if (value === "*") {
insValue = 1;
} else if (value == "?") {
} else if (value === "?") {
insValue = 2;
} else if (value.indexOf("-") > -1) {
let indexArr = value.split("-");
@ -246,10 +246,10 @@ export default {
this.$refs[refName].checkboxList = value.split(",");
insValue = 7;
}
} else if (name == "week") {
} else if (name === "week") {
if (value === "*") {
insValue = 1;
} else if (value == "?") {
} else if (value === "?") {
insValue = 2;
} else if (value.indexOf("-") > -1) {
let indexArr = value.split("-");
@ -275,10 +275,10 @@ export default {
this.$refs[refName].checkboxList = value.split(",");
insValue = 6;
}
} else if (name == "year") {
if (value == "") {
} else if (name === "year") {
if (value === "") {
insValue = 1;
} else if (value == "*") {
} else if (value === "*") {
insValue = 2;
} else if (value.indexOf("-") > -1) {
insValue = 3;
@ -343,7 +343,7 @@ export default {
obj.month +
" " +
obj.week +
(obj.year == "" ? "" : " " + obj.year);
(obj.year === "" ? "" : " " + obj.year);
return str;
},
},

View File

@ -69,19 +69,19 @@ export default {
},
// 周期两个值变化时
cycleChange() {
if (this.radioValue == '2') {
if (this.radioValue === '2') {
this.$emit('update', 'min', this.cycleTotal, 'min');
}
},
// 平均两个值变化时
averageChange() {
if (this.radioValue == '3') {
if (this.radioValue === '3') {
this.$emit('update', 'min', this.averageTotal, 'min');
}
},
// checkbox值变化时
checkboxChange() {
if (this.radioValue == '4') {
if (this.radioValue === '4') {
this.$emit('update', 'min', this.checkboxString, 'min');
}
},
@ -109,8 +109,8 @@ export default {
// 计算勾选的checkbox值合集
checkboxString: function () {
let str = this.checkboxList.join();
return str == '' ? '*' : str;
return str === '' ? '*' : str;
}
}
}
</script>
</script>

View File

@ -68,19 +68,19 @@ export default {
},
// 周期两个值变化时
cycleChange() {
if (this.radioValue == '2') {
if (this.radioValue === '2') {
this.$emit('update', 'month', this.cycleTotal);
}
},
// 平均两个值变化时
averageChange() {
if (this.radioValue == '3') {
if (this.radioValue === '3') {
this.$emit('update', 'month', this.averageTotal);
}
},
// checkbox值变化时
checkboxChange() {
if (this.radioValue == '4') {
if (this.radioValue === '4') {
this.$emit('update', 'month', this.checkboxString);
}
}
@ -107,7 +107,7 @@ export default {
// 计算勾选的checkbox值合集
checkboxString: function () {
let str = this.checkboxList.join();
return str == '' ? '*' : str;
return str === '' ? '*' : str;
}
}
}

View File

@ -126,7 +126,7 @@ export default {
// 如果到达最大值时
if (nDay > DDate[DDate.length - 1]) {
resetDay();
if (Mi == MDate.length - 1) {
if (Mi === MDate.length - 1) {
resetMonth();
continue goYear;
}
@ -141,9 +141,9 @@ export default {
// 如果到达最大值时
if (nHour > hDate[hDate.length - 1]) {
resetHour();
if (Di == DDate.length - 1) {
if (Di === DDate.length - 1) {
resetDay();
if (Mi == MDate.length - 1) {
if (Mi === MDate.length - 1) {
resetMonth();
continue goYear;
}
@ -158,7 +158,7 @@ export default {
continue goMonth;
}
// 如果日期规则中有值时
if (this.dayRule == 'lastDay') {
if (this.dayRule === 'lastDay') {
// 如果不是合法日期则需要将前将日期调到合法日期即月末最后一天
if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
@ -168,7 +168,7 @@ export default {
thisDD = DD < 10 ? '0' + DD : DD;
}
}
} else if (this.dayRule == 'workDay') {
} else if (this.dayRule === 'workDay') {
// 校验并调整如果是2月30号这种日期传进来时需调整至正常月底
if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
while (DD > 0 && this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
@ -179,7 +179,7 @@ export default {
// 获取达到条件的日期是星期X
let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + thisDD + ' 00:00:00'), 'week');
// 当星期日时
if (thisWeek == 1) {
if (thisWeek === 1) {
// 先找下一个日,并判断是否为月底
DD++;
thisDD = DD < 10 ? '0' + DD : DD;
@ -187,7 +187,7 @@ export default {
if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
DD -= 3;
}
} else if (thisWeek == 7) {
} else if (thisWeek === 7) {
// 当星期6时只需判断不是1号就可进行操作
if (this.dayRuleSup !== 1) {
DD--;
@ -195,16 +195,16 @@ export default {
DD += 2;
}
}
} else if (this.dayRule == 'weekDay') {
} else if (this.dayRule === 'weekDay') {
// 如果指定了是星期几
// 获取当前日期是属于星期几
let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week');
// 校验当前星期是否在星期池dayRuleSup
if (this.dayRuleSup.indexOf(thisWeek) < 0) {
// 如果到达最大值时
if (Di == DDate.length - 1) {
if (Di === DDate.length - 1) {
resetDay();
if (Mi == MDate.length - 1) {
if (Mi === MDate.length - 1) {
resetMonth();
continue goYear;
}
@ -212,7 +212,7 @@ export default {
}
continue;
}
} else if (this.dayRule == 'assWeek') {
} else if (this.dayRule === 'assWeek') {
// 如果指定了是第几周的星期几
// 获取每月1号是属于星期几
let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week');
@ -221,7 +221,7 @@ export default {
} else {
DD = this.dayRuleSup[0] * 7 + this.dayRuleSup[1] - thisWeek + 1;
}
} else if (this.dayRule == 'lastWeek') {
} else if (this.dayRule === 'lastWeek') {
// 如果指定了每月最后一个星期几
// 校验并调整如果是2月30号这种日期传进来时需调整至正常月底
if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
@ -249,11 +249,11 @@ export default {
// 如果到达最大值时
if (nMin > mDate[mDate.length - 1]) {
resetMin();
if (hi == hDate.length - 1) {
if (hi === hDate.length - 1) {
resetHour();
if (Di == DDate.length - 1) {
if (Di === DDate.length - 1) {
resetDay();
if (Mi == MDate.length - 1) {
if (Mi === MDate.length - 1) {
resetMonth();
continue goYear;
}
@ -270,13 +270,13 @@ export default {
// 如果到达最大值时
if (nSecond > sDate[sDate.length - 1]) {
resetSecond();
if (mi == mDate.length - 1) {
if (mi === mDate.length - 1) {
resetMin();
if (hi == hDate.length - 1) {
if (hi === hDate.length - 1) {
resetHour();
if (Di == DDate.length - 1) {
if (Di === DDate.length - 1) {
resetDay();
if (Mi == MDate.length - 1) {
if (Mi === MDate.length - 1) {
resetMonth();
continue goYear;
}
@ -297,17 +297,17 @@ export default {
nums++;
}
// 如果条数满了就退出循环
if (nums == 5) break goYear;
if (nums === 5) break goYear;
// 如果到达最大值时
if (si == sDate.length - 1) {
if (si === sDate.length - 1) {
resetSecond();
if (mi == mDate.length - 1) {
if (mi === mDate.length - 1) {
resetMin();
if (hi == hDate.length - 1) {
if (hi === hDate.length - 1) {
resetHour();
if (Di == DDate.length - 1) {
if (Di === DDate.length - 1) {
resetDay();
if (Mi == MDate.length - 1) {
if (Mi === MDate.length - 1) {
resetMonth();
continue goYear;
}
@ -326,7 +326,7 @@ export default {
}//goMonth
}
// 判断100年内的结果条数
if (resultArr.length == 0) {
if (resultArr.length === 0) {
this.resultList = ['没有达到条件的结果!'];
} else {
this.resultList = resultArr;
@ -378,23 +378,23 @@ export default {
// 获取"日"数组-主要为日期规则
getWeekArr(rule) {
// 只有当日期规则的两个值均为“”时则表达日期是有选项的
if (this.dayRule == '' && this.dayRuleSup == '') {
if (this.dayRule === '' && this.dayRuleSup === '') {
if (rule.indexOf('-') >= 0) {
this.dayRule = 'weekDay';
this.dayRuleSup = this.getCycleArr(rule, 7, false)
} else if (rule.indexOf('#') >= 0) {
this.dayRule = 'assWeek';
let matchRule = rule.match(/[0-9]{1}/g);
let matchRule = rule.match(/[0-9]/g);
this.dayRuleSup = [Number(matchRule[1]), Number(matchRule[0])];
this.dateArr[3] = [1];
if (this.dayRuleSup[1] == 7) {
if (this.dayRuleSup[1] === 7) {
this.dayRuleSup[1] = 0;
}
} else if (rule.indexOf('L') >= 0) {
this.dayRule = 'lastWeek';
this.dayRuleSup = Number(rule.match(/[0-9]{1,2}/g)[0]);
this.dateArr[3] = [31];
if (this.dayRuleSup == 7) {
if (this.dayRuleSup === 7) {
this.dayRuleSup = 0;
}
} else if (rule !== '*' && rule !== '?') {
@ -425,7 +425,7 @@ export default {
} else if (rule !== '*' && rule !== '?') {
this.dateArr[3] = this.getAssignArr(rule)
this.dayRuleSup = 'null';
} else if (rule == '*') {
} else if (rule === '*') {
this.dayRuleSup = 'null';
}
},
@ -504,7 +504,7 @@ export default {
}
for (let i = min; i <= max; i++) {
let add = 0;
if (status == false && i % limit == 0) {
if (status === false && i % limit === 0) {
add = limit;
}
arr.push(Math.round(i % limit + add))
@ -532,9 +532,9 @@ export default {
let s = time.getSeconds();
let week = time.getDay();
// 如果传递了type的话
if (type == undefined) {
if (type === undefined) {
return Y + '-' + (M < 10 ? '0' + M : M) + '-' + (D < 10 ? '0' + D : D) + ' ' + (h < 10 ? '0' + h : h) + ':' + (m < 10 ? '0' + m : m) + ':' + (s < 10 ? '0' + s : s);
} else if (type == 'week') {
} else if (type === 'week') {
// 在quartz中 1为星期日
return week + 1;
}

View File

@ -68,19 +68,19 @@ export default {
},
// 周期两个值变化时
cycleChange() {
if (this.radioValue == '2') {
if (this.radioValue === '2') {
this.$emit('update', 'second', this.cycleTotal);
}
},
// 平均两个值变化时
averageChange() {
if (this.radioValue == '3') {
if (this.radioValue === '3') {
this.$emit('update', 'second', this.averageTotal);
}
},
// checkbox值变化时
checkboxChange() {
if (this.radioValue == '4') {
if (this.radioValue === '4') {
this.$emit('update', 'second', this.checkboxString);
}
}
@ -110,7 +110,7 @@ export default {
// 计算勾选的checkbox值合集
checkboxString: function () {
let str = this.checkboxList.join();
return str == '' ? '*' : str;
return str === '' ? '*' : str;
}
}
}

View File

@ -144,25 +144,25 @@ export default {
// 周期两个值变化时
cycleChange() {
if (this.radioValue == '3') {
if (this.radioValue === '3') {
this.$emit('update', 'week', this.cycleTotal);
}
},
// 平均两个值变化时
averageChange() {
if (this.radioValue == '4') {
if (this.radioValue === '4') {
this.$emit('update', 'week', this.averageTotal);
}
},
// 最近工作日值变化时
weekdayChange() {
if (this.radioValue == '5') {
if (this.radioValue === '5') {
this.$emit('update', 'week', this.weekday + 'L');
}
},
// checkbox值变化时
checkboxChange() {
if (this.radioValue == '6') {
if (this.radioValue === '6') {
this.$emit('update', 'week', this.checkboxString);
}
},
@ -195,7 +195,7 @@ export default {
// 计算勾选的checkbox值合集
checkboxString: function () {
let str = this.checkboxList.join();
return str == '' ? '*' : str;
return str === '' ? '*' : str;
}
}
}

View File

@ -79,19 +79,19 @@ export default {
},
// 周期两个值变化时
cycleChange() {
if (this.radioValue == '3') {
if (this.radioValue === '3') {
this.$emit('update', 'year', this.cycleTotal);
}
},
// 平均两个值变化时
averageChange() {
if (this.radioValue == '4') {
if (this.radioValue === '4') {
this.$emit('update', 'year', this.averageTotal);
}
},
// checkbox值变化时
checkboxChange() {
if (this.radioValue == '5') {
if (this.radioValue === '5') {
this.$emit('update', 'year', this.checkboxString);
}
}