fix: refetch doctor by specialist

This commit is contained in:
riefive
2025-10-28 10:42:29 +07:00
parent 99c5266f2b
commit 2239b94632
3 changed files with 4 additions and 7 deletions
+1 -4
View File
@@ -122,7 +122,7 @@ async function handleFetchDoctors(subSpecialistId: string) {
const isSub = isSubspecialist(subSpecialistId, specialistsTree.value)
// Build filter based on selection type
const filterParams: any = { 'page-size': 100 }
const filterParams: any = { 'page-size': 100, includes: 'employee-Person' }
if (isSub) {
// If selected is subspecialist, filter by subspecialist-id
@@ -132,11 +132,8 @@ async function handleFetchDoctors(subSpecialistId: string) {
filterParams['specialist-id'] = subSpecialistId
}
console.log('Fetching doctors with filter:', filterParams)
const doctors = await getDoctorValueLabelList(filterParams)
doctorsList.value = doctors
console.log('Fetched doctors:', doctors)
} catch (error) {
console.error('Error fetching doctors:', error)
doctorsList.value = []
+1 -1
View File
@@ -33,7 +33,7 @@ export async function getValueLabelList(params: any = null): Promise<{ value: st
if (result.success) {
const resultData = result.body?.data || []
data = resultData.map((item: Doctor) => ({
value: item.id ? Number(item.id) : item.id,
value: item.id ? String(item.id) : item.id,
label: item.employee?.person?.name || '',
}))
}
+2 -2
View File
@@ -14,11 +14,11 @@ export function getList(params: any = null) {
url += `/${params.serviceDate}`
delete params.serviceDate
}
if (params?.specialistCode) {
if (params?.specialistCode || (Number(params.specialistCode) === 0)) {
url += `/${params.specialistCode}`
delete params.specialistCode
}
return base.getList(path, params, name)
return base.getList(url, params, name)
}
export async function getValueLabelList(params: any = null): Promise<{ value: string; label: string }[]> {