Commit baa91c5d by xuwenhao
parents a170ee91 29b98245
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
<!--tr 行 --> <!--tr 行 -->
<tr v-for="(timeSlot, index) in timeSlots" :key="index"> <tr v-for="(timeSlot, index) in timeSlots" :key="index">
<!-- td 列 --> <!-- td 列 -->
<!-- 第一列 --> <!-- 第一列,节次 -->
<td>{{ timeSlot }}</td> <td>{{ timeSlot }}</td>
<!-- <td v-for="(day, dayIndex) in days" :key="dayIndex" :class="{--> <!-- <td v-for="(day, dayIndex) in days" :key="dayIndex" :class="{-->
<!-- occupied: isOccupied(day, index),--> <!-- occupied: isOccupied(day, index),-->
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
<!-- @mouseenter="handleMouseEnter(day, index)" @click="handleCellClick(day, index)">--> <!-- @mouseenter="handleMouseEnter(day, index)" @click="handleCellClick(day, index)">-->
<!-- {{ isOccupied(day, index) ? "占用" : "" }}--> <!-- {{ isOccupied(day, index) ? "占用" : "" }}-->
<!-- </td>--> <!-- </td>-->
<!-- 第二列往后循环 --> <!-- 第二列往后循环日期,拿到day日期和节次index索引值 -->
<td style="cursor: pointer" v-for="(day, dayIndex) in days" :key="dayIndex" :class="{ <td style="cursor: pointer" v-for="(day, dayIndex) in days" :key="dayIndex" :class="{
occupied: isOccupied(day, index), occupied: isOccupied(day, index),
selected: isSelected(day, index), selected: isSelected(day, index),
...@@ -170,6 +170,7 @@ export default { ...@@ -170,6 +170,7 @@ export default {
if (this.isOccupied(day, index)) { if (this.isOccupied(day, index)) {
return false return false
} else { } else {
console.log('this.selectedTimeSlots',this.selectedTimeSlots)
// 检查时间段是否已选中 // 检查时间段是否已选中
return this.selectedTimeSlots.some((selectedSlot) => { return this.selectedTimeSlots.some((selectedSlot) => {
// console.log('selectedSlot',selectedSlot) // console.log('selectedSlot',selectedSlot)
...@@ -179,8 +180,10 @@ export default { ...@@ -179,8 +180,10 @@ export default {
}, },
//表格点击事件 //表格点击事件
handleCellClick(day, index) { handleCellClick(day, index) {
console.log('day',day) //思路:1.判断仅点击了占用的并且没有选中可选的,直接return出去
console.log('index',index+1) // 2.如果选中的数组长度为0,就可以push第一个点击的数据
// 3.选中的数组长度不为0了,就需要判断点击的是否有重复的,二次点击是取消,没有重复的才可以push
// 4.每一次都要跟第一次的day比较,看是否跨天,如果跨天直接return出去
//占用点击不生效 //占用点击不生效
if (this.isOccupied(day, index) && this.selectedTimeSlots.length == 0) { if (this.isOccupied(day, index) && this.selectedTimeSlots.length == 0) {
this.remark = false this.remark = false
...@@ -196,12 +199,13 @@ export default { ...@@ -196,12 +199,13 @@ export default {
return; return;
} else { } else {
this.remark = true this.remark = true
//筛选出符合条件的对象 //筛选出符合条件的对象,selectObj有值说明重复点击了
const selectObj = this.selectedTimeSlots.find((item) => { const selectObj = this.selectedTimeSlots.find((item) => {
console.log('find', item.day == day && item.index == index) console.log('find', item.day == day && item.index == index)
return item.day == day && item.index == index return item.day == day && item.index == index
}) })
console.log('selectObj', selectObj) console.log('selectObj', selectObj)
//selectObj没有值的时候是undefined,selectObj有值说明重复点击了,需要把点击的过滤掉
if (selectObj != undefined) { if (selectObj != undefined) {
this.remark = true this.remark = true
this.selectedTimeSlots = this.selectedTimeSlots.filter(item => item.index != index) this.selectedTimeSlots = this.selectedTimeSlots.filter(item => item.index != index)
...@@ -383,6 +387,7 @@ export default { ...@@ -383,6 +387,7 @@ export default {
// this.successDialogVisible = true; // this.successDialogVisible = true;
// } // }
}, },
//确定提交按钮
confirmBooking() { confirmBooking() {
// 弹窗确定按钮的点击事件处理程序 // 弹窗确定按钮的点击事件处理程序
// 在这里,你可以处理预约操作,例如发送请求进行录播室预约操作 // 在这里,你可以处理预约操作,例如发送请求进行录播室预约操作
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment