修复叫号显示屏跳转异常问题

This commit is contained in:
chenjinyang
2026-01-14 10:44:35 +08:00
parent d8c4348341
commit e8783d9f8f

View File

@@ -31,20 +31,22 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<template v-for="(group, doctorName) in groupedPatients" :key="doctorName"> <template v-for="doctorName in paginatedDoctors" :key="doctorName">
<!-- 医生分组标题 --> <template v-if="groupedPatients[doctorName]">
<tr class="doctor-header"> <!-- 医生分组标题 -->
<td colspan="4">{{ doctorName }} 医生 (诊室: {{ getDoctorRoom(doctorName) }})</td> <tr class="doctor-header">
</tr> <td colspan="4">{{ doctorName }} 医生 (诊室: {{ getDoctorRoom(doctorName) }})</td>
<!-- 患者列表 --> </tr>
<tr v-for="(patient, index) in group" :key="patient.id"> <!-- 患者列表 -->
<td>{{ index + 1 }}</td> <tr v-for="(patient, index) in groupedPatients[doctorName]" :key="patient.id">
<td>{{ formatPatientName(patient.name) }}</td> <td>{{ index + 1 }}</td>
<td>{{ getDoctorRoom(doctorName) }}</td> <td>{{ formatPatientName(patient.name) }}</td>
<td :style="{ color: index === 0 ? '#e74c3c' : '#27ae60' }"> <td>{{ getDoctorRoom(doctorName) }}</td>
{{ index === 0 ? '就诊中' : '等待' }} <td :style="{ color: index === 0 ? '#e74c3c' : '#27ae60' }">
</td> {{ index === 0 ? '就诊中' : '等待' }}
</tr> </td>
</tr>
</template>
</template> </template>
</tbody> </tbody>
</table> </table>
@@ -126,9 +128,29 @@ const waitingCount = computed(() => {
return count return count
}) })
// 获取排序后的医生列表
const sortedDoctors = computed(() => {
return Object.keys(groupedPatients.value).sort()
})
// 按医生分组的分页逻辑
const paginatedDoctors = computed(() => {
const startIndex = (currentPage.value - 1) * 1 // 每页显示1个医生组
const endIndex = startIndex + 1
return sortedDoctors.value.slice(startIndex, endIndex)
})
// 获取当前页的患者
const currentPatients = computed(() => {
const result = {}
paginatedDoctors.value.forEach(doctor => {
result[doctor] = groupedPatients.value[doctor]
})
return result
})
const totalPages = computed(() => { const totalPages = computed(() => {
const totalPatients = patients.value.length return Math.ceil(sortedDoctors.value.length) || 1
return Math.ceil(totalPatients / patientsPerPage) || 1
}) })
// 方法 // 方法