mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-20 09:44:26 +08:00
fix not show selected transaction category / account / tag
This commit is contained in:
+5
-5
@@ -303,7 +303,7 @@ export function getItemByKeyValue<T>(src: Record<string, T>[] | Record<string, R
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getNameByKeyValue<T>(src: Record<string, T>[] | Record<string, Record<string, T>>, value: T, keyField: string, nameField: string, defaultName: T): T {
|
export function getNameByKeyValue<T>(src: Record<string, T>[] | Record<string, Record<string, T>>, value: T, keyField: string | null, nameField: string, defaultName: T): T {
|
||||||
if (isArray(src)) {
|
if (isArray(src)) {
|
||||||
const arr = src as Record<string, T>[];
|
const arr = src as Record<string, T>[];
|
||||||
|
|
||||||
@@ -339,11 +339,11 @@ export function getNameByKeyValue<T>(src: Record<string, T>[] | Record<string, R
|
|||||||
return option[nameField];
|
return option[nameField];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (isNumber(value)) {
|
} else if (isString(value)) {
|
||||||
const index = value as number;
|
const key = value as string;
|
||||||
|
|
||||||
if (obj[index]) {
|
if (obj[key]) {
|
||||||
const option = obj[index];
|
const option = obj[key];
|
||||||
|
|
||||||
return option[nameField];
|
return option[nameField];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user