mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-22 02:34:26 +08:00
code refactor
This commit is contained in:
@@ -196,7 +196,7 @@ const noSelectionText = computed<string>(() => props.noItemText ? props.noItemTe
|
|||||||
const selectionPrimaryItemText = computed<string>(() => {
|
const selectionPrimaryItemText = computed<string>(() => {
|
||||||
if (props.primaryValueField && props.primaryTitleField) {
|
if (props.primaryValueField && props.primaryTitleField) {
|
||||||
if (currentPrimaryValue.value) {
|
if (currentPrimaryValue.value) {
|
||||||
return getNameByKeyValue(props.items as Record<string, unknown>[] | Record<string, Record<string, unknown>>, currentPrimaryValue.value, props.primaryValueField, props.primaryTitleField, noSelectionText.value) as string;
|
return getNameByKeyValue(props.items as Record<string, string>[] | Record<string, Record<string, string>>, currentPrimaryValue.value, props.primaryValueField, props.primaryTitleField, noSelectionText.value) as string;
|
||||||
} else {
|
} else {
|
||||||
return noSelectionText.value;
|
return noSelectionText.value;
|
||||||
}
|
}
|
||||||
@@ -208,7 +208,7 @@ const selectionPrimaryItemText = computed<string>(() => {
|
|||||||
const selectionSecondaryItemText = computed<string>(() => {
|
const selectionSecondaryItemText = computed<string>(() => {
|
||||||
if (props.secondaryValueField && props.secondaryTitleField) {
|
if (props.secondaryValueField && props.secondaryTitleField) {
|
||||||
if (currentSecondaryValue.value && selectedPrimaryItem.value && (selectedPrimaryItem.value as Record<string, unknown>)[props.primarySubItemsField]) {
|
if (currentSecondaryValue.value && selectedPrimaryItem.value && (selectedPrimaryItem.value as Record<string, unknown>)[props.primarySubItemsField]) {
|
||||||
return getNameByKeyValue((selectedPrimaryItem.value as Record<string, unknown>)[props.primarySubItemsField] as Record<string, unknown>[] | Record<string, Record<string, unknown>>, currentSecondaryValue.value, props.secondaryValueField, props.secondaryTitleField, noSelectionText.value) as string;
|
return getNameByKeyValue((selectedPrimaryItem.value as Record<string, unknown>)[props.primarySubItemsField] as Record<string, string>[] | Record<string, Record<string, string>>, currentSecondaryValue.value, props.secondaryValueField, props.secondaryTitleField, noSelectionText.value) as string;
|
||||||
} else {
|
} else {
|
||||||
return noSelectionText.value;
|
return noSelectionText.value;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user