feat(medicine-group): refactor + integrate

This commit is contained in:
riefive
2025-09-26 13:02:08 +07:00
parent a6122b9d39
commit 539629f9a8
7 changed files with 280 additions and 134 deletions

No files matched your search

+19 -19
View File
@@ -36,23 +36,6 @@ import { getSourceUoms } from '~/services/uom.service'
const uoms = ref<{ value: string; label: string }[]>([])
const title = ref('')
const getEquipmentDetail = async (id: number | string) => {
const result = await getSourceMaterialDetail(id)
if (result.success) {
const currentMaterial = result.body?.data || {}
recItem.value = currentMaterial
isFormEntryDialogOpen.value = true
}
}
const getUomList = async () => {
const result = await getSourceUoms()
if (result.success) {
const currentUoms = result.body?.data || []
uoms.value = currentUoms.map((uom: Uom) => ({ value: uom.code || uom.erp_id, label: uom.name }))
}
}
const {
data,
isLoading,
@@ -104,16 +87,33 @@ provide('rec_action', recAction)
provide('rec_item', recItem)
provide('table_data_loader', isLoading)
const getCurrentMaterialDetail = async (id: number | string) => {
const result = await getSourceMaterialDetail(id)
if (result.success) {
const currentMaterial = result.body?.data || {}
recItem.value = currentMaterial
isFormEntryDialogOpen.value = true
}
}
const getUomList = async () => {
const result = await getSourceUoms()
if (result.success) {
const currentUoms = result.body?.data || []
uoms.value = currentUoms.map((uom: Uom) => ({ value: uom.code || uom.erp_id, label: uom.name }))
}
}
// Watch for row actions when recId or recAction changes
watch([recId, recAction], () => {
switch (recAction.value) {
case ActionEvents.showDetail:
getEquipmentDetail(recId.value)
getCurrentMaterialDetail(recId.value)
title.value = 'Detail Perlengkapan'
isReadonly.value = true
break
case ActionEvents.showEdit:
getEquipmentDetail(recId.value)
getCurrentMaterialDetail(recId.value)
title.value = 'Edit Perlengkapan'
isReadonly.value = false
break