fix: update handler for unit and uom

This commit is contained in:
riefive
2025-10-06 10:14:51 +07:00
parent fe23c75aca
commit 58c0dde377
7 changed files with 60 additions and 44 deletions

No files matched your search

-18
View File
@@ -18,8 +18,6 @@ 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'
import { getUnits } from '~/services/unit.service'
// variables
export const medicineGroups = ref<{ value: string; label: string }[]>([])
@@ -110,22 +108,6 @@ export const getSpecialistsList = async () => {
}
}
export const getUnitList = async () => {
const result = await getUnits()
if (result.success) {
const currentUnits = result.body?.data || []
units.value = currentUnits.map((item: Unit) => ({ value: item.id ? Number(item.id) : item.code, label: item.name }))
}
}
export const getUomList = async () => {
const result = await getUoms()
if (result.success) {
const currentUoms = result.body?.data || []
uoms.value = currentUoms.map((uom: Uom) => ({ value: uom.code || uom.erp_id, label: uom.name }))
}
}
/**
* Convert division response (with childrens) to TreeItem[]
* @param divisions Array of division objects from API