fix: resolve list organization source
This commit is contained in:
@@ -1,19 +1,28 @@
|
||||
// types
|
||||
import type { MedicineGroup } from '~/models/medicine-group'
|
||||
import type { MedicineMethod } from '~/models/medicine-method'
|
||||
import type { Installation } from "~/models/installation"
|
||||
import type { Specialist } from '~/models/specialist'
|
||||
import type { Uom } from '~/models/uom'
|
||||
import type { Unit } from '~/models/unit'
|
||||
|
||||
// services
|
||||
import { getMedicineGroups } from '~/services/medicine-group.service'
|
||||
import { getMedicineMethods } from '~/services/medicine-method.service'
|
||||
import { getUoms } from '~/services/uom.service'
|
||||
import { getEncounters } from '~/services/encounter.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 }[]>([])
|
||||
export const medicineMethods = ref<{ value: string; label: string }[]>([])
|
||||
export const uoms = ref<{ value: string; label: string }[]>([])
|
||||
export const encounterClasses = 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 }[]>([])
|
||||
export const units = ref<{ value: string; label: string }[]>([])
|
||||
|
||||
export const getMedicineGroupList = async () => {
|
||||
const result = await getMedicineGroups()
|
||||
@@ -37,14 +46,6 @@ export const getMedicineMethodList = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
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 }))
|
||||
}
|
||||
}
|
||||
|
||||
export const getEncounterClassList = async () => {
|
||||
const result = await getEncounters()
|
||||
if (result.success) {
|
||||
@@ -52,3 +53,41 @@ export const getEncounterClassList = async () => {
|
||||
encounterClasses.value = currentValues.map((item: any) => ({ value: item.code || item.id, label: item.name }))
|
||||
}
|
||||
}
|
||||
|
||||
export const getInstallationList = async () => {
|
||||
const result = await getInstallations()
|
||||
if (result.success) {
|
||||
const currentInstallations = result.body?.data || []
|
||||
installations.value = currentInstallations.map((item: Installation) => ({
|
||||
value: item.id ? Number(item.id) : item.code,
|
||||
label: item.name,
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
export const getSpecialistsList = async () => {
|
||||
const result = await getSpecialists()
|
||||
if (result.success) {
|
||||
const currentSpecialists = result.body?.data || []
|
||||
specialists.value = currentSpecialists.map((item: Specialist) => ({
|
||||
value: item.id ? Number(item.id) : item.code,
|
||||
label: item.name,
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
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 }))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user