From 6bf0412460abac8a34744069deaa1d9cec264399 Mon Sep 17 00:00:00 2001 From: yanzai Date: Sat, 13 Sep 2025 16:32:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=20=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E6=9C=80=E4=BC=98=E5=8F=B7=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/Admin/YeWu/PlanListService.php | 23 ++++++++++++++++++- .../src/components/Yewu/YuYue202506.vue | 9 ++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/Laravel/app/Services/Admin/YeWu/PlanListService.php b/Laravel/app/Services/Admin/YeWu/PlanListService.php index f80f279..a76cb8e 100644 --- a/Laravel/app/Services/Admin/YeWu/PlanListService.php +++ b/Laravel/app/Services/Admin/YeWu/PlanListService.php @@ -148,14 +148,35 @@ WHERE //过期的排在后面 $time = $p->date . ' ' . $p->end_time; if ($time > $nowtime) { + $p->plan_enable=true; $pl1[] = $p; } else { + $p->plan_enable=false; $pl2[] = $p; } } + + usort($pl1, function($a, $b) { + $timeA = $a->date . ' ' . ($a->start_time ?? $a->end_time); // 兼容性处理 + $timeB = $b->date . ' ' . ($b->start_time ?? $b->end_time); + return $timeA <=> $timeB; + }); + +// 取出时间最早的那一个(未过期) + $earliestPlan = !empty($pl1) ? $pl1[0]->id : null; //最早的号源id + $pp = array_merge($pl1, $pl2); - return \Yz::Return(true, '查询完成', ['today_date' => date("Y-m-d"), 'appointment_date' => $appointment_date, 'weekname' => Tools::GetWeekName($appointment_date), 'mainInfo' => $info, 'plan_list' => $pp,'zhanWeiCount'=>$zhanweiCount]); + + return \Yz::Return(true, '查询完成', [ + 'today_date' => date("Y-m-d"), + 'appointment_date' => $appointment_date, + 'weekname' => Tools::GetWeekName($appointment_date), + 'mainInfo' => $info, + 'plan_list' => $pp, + 'zhanWeiCount'=>$zhanweiCount, + 'earliestPlan'=>$earliestPlan + ]); } //开始预约占用名额 diff --git a/YiJi-admin/src/components/Yewu/YuYue202506.vue b/YiJi-admin/src/components/Yewu/YuYue202506.vue index bc96b39..17ce816 100644 --- a/YiJi-admin/src/components/Yewu/YuYue202506.vue +++ b/YiJi-admin/src/components/Yewu/YuYue202506.vue @@ -430,8 +430,12 @@ ); let plan_enable = false if (matchingPlan) { - if (matchingPlan.count - matchingPlan.used_count >= zhanWeiCount ) { + if (matchingPlan.count - matchingPlan.used_count >= zhanWeiCount && matchingPlan.plan_enable===true) { plan_enable = true + if(selectedPlanId.value == 0 || selectedPlanId.value == '' || selectedPlanId.value==null && matchingPlan.id==res.data.earliestPlan){ + selectedPlanId.value=matchingPlan.id + } + } row[date] = { use_count: `${matchingPlan.used_count}/${matchingPlan.count}`, @@ -534,10 +538,11 @@ ElMessage.error("请选择检查项目") return false; } - if (selectedPlanId.value == 0 || selectedPlanId.value == '') { + if (selectedPlanId.value == 0 || selectedPlanId.value == '' || selectedPlanId.value==null) { ElMessage.error("请选择号源") return false; } + let msg='确定预约此时间吗?' if(type==2){ msg='确定改约至此时间吗?'