mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-17 16:24:25 +08:00
use for-of statements to replace for and for-in
This commit is contained in:
@@ -260,7 +260,7 @@ const selectedAccount = computed<Account>(() => {
|
||||
return account.value;
|
||||
}
|
||||
|
||||
return subAccounts.value[currentAccountIndex.value];
|
||||
return subAccounts.value[currentAccountIndex.value] as Account;
|
||||
});
|
||||
|
||||
const accountAmountTitle = computed<string>(() => {
|
||||
|
||||
@@ -248,7 +248,7 @@ function updateCategorySelected(category: TransactionCategory, value: boolean |
|
||||
}
|
||||
|
||||
function updateAllSubCategoriesSelected(category: TransactionCategory, value: boolean | null): void {
|
||||
selectAllSubCategories(filterCategoryIds.value, category, !value);
|
||||
selectAllSubCategories(filterCategoryIds.value, !value, category);
|
||||
|
||||
if (props.autoSave) {
|
||||
save();
|
||||
|
||||
@@ -1888,11 +1888,11 @@ function setImportFile(event: Event): void {
|
||||
|
||||
const el = event.target as HTMLInputElement;
|
||||
|
||||
if (!el.files || !el.files.length) {
|
||||
if (!el.files || !el.files.length || !el.files[0]) {
|
||||
return;
|
||||
}
|
||||
|
||||
importFile.value = el.files[0];
|
||||
importFile.value = el.files[0] as File;
|
||||
el.value = '';
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ import { useI18n } from '@/locales/helpers.ts';
|
||||
import { useTransactionCategoriesStore } from '@/stores/transactionCategory.ts';
|
||||
import { useTransactionTagsStore } from '@/stores/transactionTag.ts';
|
||||
|
||||
import type { NameValue } from '@/core/base.ts';
|
||||
import { type NameValue, values } from '@/core/base.ts';
|
||||
import { CategoryType } from '@/core/category.ts';
|
||||
import { AUTOMATICALLY_CREATED_CATEGORY_ICON_ID } from '@/consts/icon.ts';
|
||||
import { DEFAULT_CATEGORY_COLOR } from '@/consts/color.ts';
|
||||
@@ -140,9 +140,7 @@ function buildBatchCreateCategoryResponse(createdCategories: Record<number, Tran
|
||||
displayNameSourceItemMap[item.name] = item.value;
|
||||
}
|
||||
|
||||
for (const categoryType in createdCategories) {
|
||||
const categories = createdCategories[categoryType];
|
||||
|
||||
for (const categories of values(createdCategories)) {
|
||||
for (const category of categories) {
|
||||
if (!category.subCategories || category.subCategories.length < 1) {
|
||||
continue;
|
||||
|
||||
@@ -1168,11 +1168,11 @@ function uploadPicture(event: Event): void {
|
||||
|
||||
const el = event.target as HTMLInputElement;
|
||||
|
||||
if (!el.files || !el.files.length) {
|
||||
if (!el.files || !el.files.length || !el.files[0]) {
|
||||
return;
|
||||
}
|
||||
|
||||
const pictureFile = el.files[0];
|
||||
const pictureFile = el.files[0] as File;
|
||||
|
||||
el.value = '';
|
||||
|
||||
|
||||
@@ -536,11 +536,11 @@ function updateAvatar(event: Event): void {
|
||||
|
||||
const el = event.target as HTMLInputElement;
|
||||
|
||||
if (!el.files || !el.files.length) {
|
||||
if (!el.files || !el.files.length || !el.files[0]) {
|
||||
return;
|
||||
}
|
||||
|
||||
const avatarFile = el.files[0];
|
||||
const avatarFile = el.files[0] as File;
|
||||
|
||||
el.value = '';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user