Explorar el Código

修改会议查询显示 已预定时间段格式

bzd_lxf hace 2 meses
padre
commit
763892f7b4
Se han modificado 1 ficheros con 19 adiciones y 3 borrados
  1. 19 3
      pm_ui/src/views/meeting/index.vue

+ 19 - 3
pm_ui/src/views/meeting/index.vue

@@ -71,8 +71,8 @@
             <p></p>
             <div v-if="meeting.usage && meeting.usage.appointTime && meeting.usage.appointTime.length > 0">
               已预订时间段:
-              <span v-for="(appointment, index) in meeting.usage.appointTime">
-                  {{ appointment.start_time }} - {{ appointment.end_time }}
+              <span v-for="(appointment, index) in [...meeting.usage.appointTime].reverse()">
+                  {{ appointment.start_time }} - {{ appointment.end_time }}<span v-if="index < meeting.usage.appointTime.length - 1">&nbsp;|&nbsp;</span>
               </span>
             </div>
             <div v-else>
@@ -84,7 +84,10 @@
         <div class="time-slots">
           <div class="slot-container">
             <div v-for="(slot, index) in timeSlots" :key="index"
-                 :class="['slot', { current: isCurrent(slot), booked: isBooked(meeting, slot) }]">
+                 :class="['slot', {
+                  current: isCurrent(slot),
+                  booked: isBookedBetween(meeting, slot, timeSlots[index+1])
+                }]">
               {{ slot }}
             </div>
           </div>
@@ -156,6 +159,19 @@ function updateAppointTime() {
   }
 }
 
+// 判断某个时间段区间是否被预订
+function isBookedBetween(meeting, startTime, endTime) {
+  if (!endTime) endTime = '24:00'; // 处理最后一个时间段
+
+  const appointments = meeting.usage?.appointTime || [];
+  return appointments.some(appointment => {
+    return (
+        (appointment.start_time < endTime) &&
+        (appointment.end_time > startTime)
+    );
+  });
+}
+
 // 搜索按钮操作
 function handleQuery() {
   queryParams.value.pageNum = 1;