|
@@ -107,7 +107,9 @@
|
|
},
|
|
},
|
|
baseKey: '',
|
|
baseKey: '',
|
|
keyWatch: '',
|
|
keyWatch: '',
|
|
- dateList:[]
|
|
|
|
|
|
+ dateList:[],
|
|
|
|
+ endTime:'',
|
|
|
|
+ timeSlots:[], //开始时间与结束时间之间的时间点
|
|
}
|
|
}
|
|
},
|
|
},
|
|
MeetingRoom:null,
|
|
MeetingRoom:null,
|
|
@@ -294,18 +296,36 @@
|
|
throw new Error()
|
|
throw new Error()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (this.commonJS.isNotEmpty(this.inputForm.startTime)){
|
|
|
|
- console.log('this.dateList',this.dateList)
|
|
|
|
- for (let i = 0; i <this.dateList.length ; i++) {
|
|
|
|
- if (this.dateList[i].disabled === true && this.dateList[i].value === this.inputForm.startTime){
|
|
|
|
- this.loading = false
|
|
|
|
- this.$message.error('会议室当前无空余,请选择其他时间')
|
|
|
|
- throw new Error()
|
|
|
|
|
|
+ if (this.commonJS.isNotEmpty(this.inputForm.startTime)) {
|
|
|
|
+ this.calculateEndTime(); // 计算结束时间
|
|
|
|
+ console.log('this.dateList', this.dateList);
|
|
|
|
+ console.log('this.endTime', this.endTime);
|
|
|
|
+ console.log('this.inputForm.startTime', this.inputForm.startTime);
|
|
|
|
+
|
|
|
|
+ // 检查时间点
|
|
|
|
+ for (let i = 0; i < this.dateList.length; i++) {
|
|
|
|
+ const startTimeDisabled = this.dateList[i].disabled && this.dateList[i].value === this.inputForm.startTime;
|
|
|
|
+ const endTimeDisabled = this.dateList[i].disabled && this.dateList[i].value === this.endTime;
|
|
|
|
+
|
|
|
|
+ if (startTimeDisabled || endTimeDisabled) {
|
|
|
|
+ this.loading = false;
|
|
|
|
+ this.$message.error('会议室当前无空余,请选择其他时间');
|
|
|
|
+ throw new Error();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 检查每个时间点是否被禁用
|
|
|
|
+ for (const time of this.timeSlots) {
|
|
|
|
+ if (this.dateList[i].disabled && this.dateList[i].value === time) {
|
|
|
|
+ this.loading = false;
|
|
|
|
+ this.$message.error('会议室当前无空余,请选择其他时间');
|
|
|
|
+ throw new Error();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
// 送审 待审核
|
|
// 送审 待审核
|
|
this.inputForm.status = '2'
|
|
this.inputForm.status = '2'
|
|
} else if (status === 'agree') {
|
|
} else if (status === 'agree') {
|
|
@@ -487,6 +507,30 @@
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ },
|
|
|
|
+ calculateEndTime() {
|
|
|
|
+ if (this.inputForm.startTime && this.inputForm.duration) {
|
|
|
|
+ const startTimeParts = this.inputForm.startTime.split(':');
|
|
|
|
+ const startHours = parseInt(startTimeParts[0]);
|
|
|
|
+ const startMinutes = parseInt(startTimeParts[1]);
|
|
|
|
+ const durationInMinutes = parseInt(this.inputForm.duration) * (this.inputForm.duration === '1' ? 60 : 30);
|
|
|
|
+
|
|
|
|
+ // 计算结束时间
|
|
|
|
+ let totalMinutes = startHours * 60 + startMinutes + durationInMinutes;
|
|
|
|
+ const endHours = Math.floor(totalMinutes / 60) % 24; // 考虑24小时制
|
|
|
|
+ const endMinutes = totalMinutes % 60;
|
|
|
|
+
|
|
|
|
+ // 格式化结束时间
|
|
|
|
+ this.endTime = `${endHours.toString().padStart(2, '0')}:${endMinutes.toString().padStart(2, '0')}:00`;
|
|
|
|
+ // 生成每隔半小时的时间点
|
|
|
|
+ this.timeSlots = [];
|
|
|
|
+ for (let m = 0; m <= totalMinutes; m += 30) {
|
|
|
|
+ const currentTotalMinutes = startHours * 60 + startMinutes + m;
|
|
|
|
+ const hours = Math.floor(currentTotalMinutes / 60) % 24; // 24小时制
|
|
|
|
+ const minutes = currentTotalMinutes % 60;
|
|
|
|
+ this.timeSlots.push(`${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:00`);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|