完善 自动选中最优号源

main
yanzai 3 months ago
parent cd9d537441
commit 6bf0412460

@ -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
]);
}
//开始预约占用名额

@ -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='确定改约至此时间吗?'

Loading…
Cancel
Save