feat/consultation-82: done

This commit is contained in:
2025-10-05 03:30:22 +07:00
parent ce785f2092
commit 427d97c29f
10 changed files with 554 additions and 0 deletions
+38
View File
@@ -1,5 +1,43 @@
import { xfetch } from '~/composables/useXfetch'
import * as base from './_crud-base'
import type { Unit } from '~/models/unit'
const path = '/api/v1/unit'
export function create(data: any) {
return base.create(path, data)
}
export function getList(params: any = null) {
return base.getList(path, params)
}
export function getDetail(id: number | string) {
return base.getDetail(path, id)
}
export function update(id: number | string, data: any) {
return base.update(path, id, data)
}
export function remove(id: number | string) {
return base.remove(path, id)
}
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: Unit) => ({
value: item.id,
label: item.name,
}))
}
return data;
}
//////////////////////// WILL BE LEGACY
const mainUrl = '/api/v1/unit'
export async function getUnits(params: any = null) {