mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-20 09:44:26 +08:00
fix could not select category name via checkbox in the batch create category dialog
This commit is contained in:
@@ -41,7 +41,8 @@
|
|||||||
v-for="item in invalidItems">
|
v-for="item in invalidItems">
|
||||||
<template #prepend="{ isActive }">
|
<template #prepend="{ isActive }">
|
||||||
<v-list-item-action start>
|
<v-list-item-action start>
|
||||||
<v-checkbox-btn :model-value="isActive"></v-checkbox-btn>
|
<v-checkbox-btn :model-value="isActive"
|
||||||
|
@update:model-value="updateSelectedNames(item.name, $event)"></v-checkbox-btn>
|
||||||
</v-list-item-action>
|
</v-list-item-action>
|
||||||
</template>
|
</template>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
@@ -115,6 +116,22 @@ const selectedNames = ref<string[]>([]);
|
|||||||
let resolveFunc: ((response: BatchCreateDialogResponse) => void) | null = null;
|
let resolveFunc: ((response: BatchCreateDialogResponse) => void) | null = null;
|
||||||
let rejectFunc: ((reason?: unknown) => void) | null = null;
|
let rejectFunc: ((reason?: unknown) => void) | null = null;
|
||||||
|
|
||||||
|
function updateSelectedNames(value: string, selected: boolean | null): void {
|
||||||
|
const newSelectedNames: string[] = [];
|
||||||
|
|
||||||
|
for (const name of selectedNames.value) {
|
||||||
|
if (name !== value || selected) {
|
||||||
|
newSelectedNames.push(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selected) {
|
||||||
|
newSelectedNames.push(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
selectedNames.value = newSelectedNames;
|
||||||
|
}
|
||||||
|
|
||||||
function buildBatchCreateCategoryResponse(createdCategories: Record<number, TransactionCategory[]>): BatchCreateDialogResponse {
|
function buildBatchCreateCategoryResponse(createdCategories: Record<number, TransactionCategory[]>): BatchCreateDialogResponse {
|
||||||
const displayNameSourceItemMap: Record<string, string> = {};
|
const displayNameSourceItemMap: Record<string, string> = {};
|
||||||
const sourceTargetMap: Record<string, string> = {};
|
const sourceTargetMap: Record<string, string> = {};
|
||||||
|
|||||||
Reference in New Issue
Block a user