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

+25 -6
View File
@@ -1,5 +1,11 @@
import { createCrudHandler } from '~/handlers/_handler'
import { create, update, remove } from '~/services/uom.service'
// Handlers
import { genCrudHandler } from '~/handlers/_handler'
// Services
import { getList, create, update, remove } from '~/services/uom.service'
// Types
import type { Uom } from '~/models/uom'
export const {
recId,
@@ -14,8 +20,21 @@ export const {
handleActionEdit,
handleActionRemove,
handleCancelForm,
} = createCrudHandler({
post: create,
patch: update,
remove: remove,
} = genCrudHandler({
create,
update,
remove,
})
export async function getValueLabelList(params: any = null): Promise<{ value: string; label: string }[]> {
let data: { value: string; label: string }[] = []
const result = await getList(params)
if (result.success) {
const resultData = result.body?.data || []
data = resultData.map((item: Uom) => ({
value: item.code || item.erp_id,
label: item.name,
}))
}
return data
}