fix: list integration

This commit is contained in:
riefive
2025-10-02 14:12:10 +07:00
parent fc3bda14f4
commit 693d8225bf
13 changed files with 91 additions and 22 deletions
+20
View File
@@ -1,6 +1,7 @@
// types
import type { MedicineGroup } from '~/models/medicine-group'
import type { MedicineMethod } from '~/models/medicine-method'
import type { Division } from '~/models/division'
import type { Installation } from '~/models/installation'
import type { Specialist } from '~/models/specialist'
import type { Uom } from '~/models/uom'
@@ -13,6 +14,7 @@ import { encounterClassCodes } from '~/lib/constants'
import { getMedicineGroups } from '~/services/medicine-group.service'
import { getMedicineMethods } from '~/services/medicine-method.service'
import { getEncounters } from '~/services/encounter.service'
import { getDivisions } from '~/services/division.service'
import { getInstallations } from '~/services/installation.service'
import { getSpecialists } from '~/services/specialist.service'
import { getUoms } from '~/services/uom.service'
@@ -22,6 +24,7 @@ import { getUnits } from '~/services/unit.service'
export const medicineGroups = ref<{ value: string; label: string }[]>([])
export const medicineMethods = ref<{ value: string; label: string }[]>([])
export const encounterClasses = ref<{ value: string; label: string }[]>([])
export const divisions = ref<{ value: string; label: string }[]>([])
export const installations = ref<{ value: string; label: string }[]>([])
export const specialists = ref<{ value: string; label: string }[]>([])
export const uoms = ref<{ value: string; label: string }[]>([])
@@ -49,6 +52,23 @@ export const getMedicineMethodList = async () => {
}
}
export const getDivisionParentList = async (isFetch = true, externalDivisions: any[] = []) => {
if (isFetch) {
const result = await getDivisions()
if (result.success) {
const currentDivisions = result.body?.data || []
divisions.value = currentDivisions.map((division: Division) => ({
value: division.code,
label: division.name,
}))
}
}
divisions.value = externalDivisions.map((division: Division) => ({
value: division.code,
label: division.name,
}))
}
export const getEncounterClassList = async () => {
const result = await getEncounters()
if (result.success) {