344 门诊预约挂号:未过滤过期号源,允许预约已过时的时间段

This commit is contained in:
Ranyunqiao
2026-04-09 11:06:06 +08:00
parent f439b1ffc0
commit f204e46e07
3 changed files with 39 additions and 21 deletions

View File

@@ -697,15 +697,17 @@ export default {
name: this.patientName?.trim() || null,
card: this.patientCard?.trim() || null,
phone: this.patientPhone?.trim() || null,
page,
limit: this.pageSize
page: 1,
limit: 1000 // 获取全量数据,前端过滤后再分页,避免过滤后分页错乱
};
},
buildDoctorQueryParams() {
return {
date: this.selectedDate,
type: this.selectedType === 'all' ? null : this.selectedType,
department: this.selectedDepartment === 'all' ? null : this.selectedDepartment
department: this.selectedDepartment === 'all' ? null : this.selectedDepartment,
// 传递浏览器当前时间戳,后端用这个时间过滤过期号源,保证和前端过滤一致
currentTime: new Date().getTime()
};
},
handleTicketResponse(ticketResponse) {
@@ -746,15 +748,15 @@ export default {
// 再进行状态过滤
const filteredRecords = this.applyStatusFilter(timeFilteredRecords);
const total = Number(payload.total);
this.tickets = [...filteredRecords];
// 现在我们获取了全量数据,在前端过滤完成后再分页
// 这样保证过滤后分页正确,不会出现第一页空第二页有数据
this.allTickets = [...filteredRecords];
// 当按状态筛选时,优先使用前端过滤后的数量,避免后端状态未生效导致"显示全部"
if (this.selectedStatus && this.selectedStatus !== 'all') {
this.totalTickets = this.tickets.length;
} else {
this.totalTickets = Number.isFinite(total) ? total : this.tickets.length;
}
this.totalTickets = this.allTickets.length;
// 从过滤后的全量数据中取出当前页
const start = (this.currentPage - 1) * this.pageSize;
const end = start + this.pageSize;
this.tickets = this.allTickets.slice(start, end);
},
applyStatusFilter(records = []) {
if (!Array.isArray(records) || records.length === 0) {
@@ -791,7 +793,8 @@ export default {
doctorList = data.data;
}
this.doctors = doctorList
// 初始用后端返回的数据
let initialDoctors = doctorList
.map((doctor, index) => {
const id = doctor?.id ?? doctor?.doctorId ?? index;
const available = Number(doctor?.available ?? doctor?.availableNum ?? doctor?.available_num ?? 0);
@@ -804,6 +807,8 @@ export default {
})
.filter(doctor => !!doctor.name);
this.doctors = initialDoctors;
if (this.selectedDoctorId && !this.doctors.some(d => d.id === this.selectedDoctorId)) {
this.selectedDoctorId = null;
}