|
@@ -355,24 +355,29 @@ export default {
|
|
|
this.updateUseTime()
|
|
|
// this.$emit('setUserTime', this.useTime, this.type)
|
|
|
},
|
|
|
+ addData(startDate, dayOfWeek) {
|
|
|
+ let num;
|
|
|
+ let dayjs = this.$helpers.dayjs
|
|
|
+ let date = dayjs(startDate).toDate();
|
|
|
+ dayOfWeek - date.getDay() >= 0
|
|
|
+ ? (num = dayOfWeek - date.getDay())
|
|
|
+ : (num = dayOfWeek - date.getDay() + 7);
|
|
|
+ return num
|
|
|
+ },
|
|
|
updateEndTime(row) {
|
|
|
- console.log(row.dayOfWeek, row.startDate, row.holiday)
|
|
|
if (row.dayOfWeek && row.startDate && typeof row.holiday === 'boolean') {
|
|
|
- let num;
|
|
|
- let dayjs = this.$helpers.dayjs
|
|
|
- let date = dayjs(row.startDate).toDate();
|
|
|
- row.dayOfWeek - date.getDay() >= 0
|
|
|
- ? (num = row.dayOfWeek - date.getDay())
|
|
|
- : (num = row.dayOfWeek - date.getDay() + 7);
|
|
|
+ const num = this.addData(row.startDate, row.dayOfWeek)
|
|
|
const exp = Math.max(row.expectCourseNum - 1, 0)
|
|
|
let end = dayjs(row.startDate).add(num + (exp*7), 'day')
|
|
|
if (row.holiday) {
|
|
|
for (const d of this.holidays) {
|
|
|
if (dayjs(d).isBetween(row.startDate, end.format('YYYY-MM-DD'), null, '[]')) {
|
|
|
- end = end.add(7, 'day')
|
|
|
+ end = end.add(1, 'day')
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ const enumd = this.addData(end.format('YYYY-MM-DD'), row.dayOfWeek)
|
|
|
+ end = end.add(enumd, 'day')
|
|
|
this.$set(
|
|
|
row,
|
|
|
"endDate",
|