dev: hotfix, consultation

This commit is contained in:
2025-12-02 14:50:10 +07:00
parent e6ac4bbadd
commit 9a8ee9d90f
5 changed files with 24 additions and 27 deletions

No files matched your search

+4 -7
View File
@@ -27,17 +27,14 @@ export function remove(id: number | string) {
return base.remove(path, id, name)
}
export async function getValueLabelList(params: any = null, useCodeAsValue = false): Promise<{ value: string; label: string }[]> {
export async function getValueLabelList(params: any = null, useId = false): 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: useCodeAsValue ? item.code
: item.id ? Number(item.id)
: item.code,
label: item.name,
}))
data = !useId ?
resultData.map((item: Unit) => ({ value: item.code, label: item.name })) :
resultData.map((item: Unit) => ({ value: item.id, label: item.name }))
}
return data
}