chore: modify service and hanler

This commit is contained in:
riefive
2025-09-26 14:03:44 +07:00
parent 34a4fc11d0
commit 5d41e4e60d
9 changed files with 116 additions and 62 deletions
+5 -5
View File
@@ -30,8 +30,8 @@ import {
} from '~/handlers/device.handler'
// Services
import { getSourceDevices, getSourceDeviceDetail } from '~/services/device.service'
import { getSourceUoms } from '~/services/uom.service'
import { getDevices, getDeviceDetail } from '~/services/device.service'
import { getUoms } from '~/services/uom.service'
const uoms = ref<{ value: string; label: string }[]>([])
const title = ref('')
@@ -46,7 +46,7 @@ const {
fetchData: getToolsList,
} = usePaginatedList({
fetchFn: async ({ page }) => {
const result = await getSourceDevices({ search: searchInput.value, page })
const result = await getDevices({ search: searchInput.value, page })
return { success: result.success || false, body: result.body || {} }
},
entityName: 'device',
@@ -88,7 +88,7 @@ provide('rec_item', recItem)
provide('table_data_loader', isLoading)
const getCurrentToolsDetail = async (id: number | string) => {
const result = await getSourceDeviceDetail(id)
const result = await getDeviceDetail(id)
if (result.success) {
const currentDevice = result.body?.data || {}
recItem.value = currentDevice
@@ -96,7 +96,7 @@ const getCurrentToolsDetail = async (id: number | string) => {
}
const getUomList = async () => {
const result = await getSourceUoms()
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 }))