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
+18 -18
View File
@@ -36,22 +36,6 @@ import { getSourceUoms } from '~/services/uom.service'
const uoms = ref<{ value: string; label: string }[]>([])
const title = ref('')
const getToolsDetail = async (id: number | string) => {
const result = await getSourceDeviceDetail(id)
if (result.success) {
const currentDevice = result.body?.data || {}
recItem.value = currentDevice
}
}
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,
@@ -103,17 +87,33 @@ provide('rec_action', recAction)
provide('rec_item', recItem)
provide('table_data_loader', isLoading)
const getCurrentToolsDetail = async (id: number | string) => {
const result = await getSourceDeviceDetail(id)
if (result.success) {
const currentDevice = result.body?.data || {}
recItem.value = currentDevice
}
}
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
watch([recId, recAction], () => {
switch (recAction.value) {
case ActionEvents.showDetail:
getToolsDetail(recId.value)
getCurrentToolsDetail(recId.value)
title.value = 'Detail Peralatan'
isReadonly.value = true
isFormEntryDialogOpen.value = true
break
case ActionEvents.showEdit:
getToolsDetail(recId.value)
getCurrentToolsDetail(recId.value)
title.value = 'Edit Peralatan'
isReadonly.value = false
isFormEntryDialogOpen.value = true