mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 16:54:25 +08:00
migrate to typescript
This commit is contained in:
@@ -105,10 +105,10 @@
|
||||
</template>
|
||||
</v-list-item>
|
||||
|
||||
<v-divider v-if="(showHidden || !account.hidden) && account.type === allAccountTypes.MultiSubAccounts && ((showHidden && accountCategory.allSubAccounts[account.id]) || accountCategory.allVisibleSubAccountCounts[account.id])"/>
|
||||
<v-divider v-if="(showHidden || !account.hidden) && account.type === allAccountTypes.MultiSubAccounts.type && ((showHidden && accountCategory.allSubAccounts[account.id]) || accountCategory.allVisibleSubAccountCounts[account.id])"/>
|
||||
|
||||
<v-list rounded density="comfortable" class="pa-0 ml-4"
|
||||
v-if="(showHidden || !account.hidden) && account.type === allAccountTypes.MultiSubAccounts && ((showHidden && accountCategory.allSubAccounts[account.id]) || accountCategory.allVisibleSubAccountCounts[account.id])">
|
||||
v-if="(showHidden || !account.hidden) && account.type === allAccountTypes.MultiSubAccounts.type && ((showHidden && accountCategory.allSubAccounts[account.id]) || accountCategory.allVisibleSubAccountCounts[account.id])">
|
||||
<template :key="subAccount.id"
|
||||
v-for="(subAccount, subIdx) in accountCategory.allSubAccounts[account.id]">
|
||||
<v-divider v-if="showHidden ? subIdx > 0 : (!subAccount.hidden ? subIdx > accountCategory.allFirstVisibleSubAccountIndexes[account.id] : false)"/>
|
||||
@@ -152,8 +152,8 @@ import { useAccountsStore } from '@/stores/account.js';
|
||||
import { useTransactionsStore } from '@/stores/transaction.js';
|
||||
import { useStatisticsStore } from '@/stores/statistics.js';
|
||||
|
||||
import accountConstants from '@/consts/account.js';
|
||||
import { copyObjectTo } from '@/lib/common.js';
|
||||
import { AccountType, AccountCategory } from '@/core/account.ts';
|
||||
import { copyObjectTo } from '@/lib/common.ts';
|
||||
import {
|
||||
getCategorizedAccountsWithVisibleCount,
|
||||
selectAccountOrSubAccounts,
|
||||
@@ -185,7 +185,7 @@ export default {
|
||||
data: function () {
|
||||
return {
|
||||
loading: true,
|
||||
expandAccountCategories: accountConstants.allCategories.map(category => category.id),
|
||||
expandAccountCategories: AccountCategory.values().map(category => category.type),
|
||||
filterAccountIds: {},
|
||||
showHidden: false,
|
||||
icons: {
|
||||
@@ -215,7 +215,7 @@ export default {
|
||||
}
|
||||
},
|
||||
allAccountTypes() {
|
||||
return accountConstants.allAccountTypes;
|
||||
return AccountType.all();
|
||||
},
|
||||
allCategorizedAccounts() {
|
||||
return getCategorizedAccountsWithVisibleCount(this.accountsStore.allCategorizedAccountsMap);
|
||||
@@ -241,7 +241,7 @@ export default {
|
||||
|
||||
const allAccountIds = {};
|
||||
|
||||
for (let accountId in self.accountsStore.allAccountsMap) {
|
||||
for (const accountId in self.accountsStore.allAccountsMap) {
|
||||
if (!Object.prototype.hasOwnProperty.call(self.accountsStore.allAccountsMap, accountId)) {
|
||||
continue;
|
||||
}
|
||||
@@ -260,7 +260,7 @@ export default {
|
||||
} else if (self.type === 'statisticsCurrent') {
|
||||
self.filterAccountIds = copyObjectTo(self.statisticsStore.transactionStatisticsFilter.filterAccountIds, allAccountIds);
|
||||
} else if (self.type === 'transactionListCurrent') {
|
||||
for (let accountId in self.transactionsStore.allFilterAccountIds) {
|
||||
for (const accountId in self.transactionsStore.allFilterAccountIds) {
|
||||
if (!Object.prototype.hasOwnProperty.call(self.transactionsStore.allFilterAccountIds, accountId)) {
|
||||
continue;
|
||||
}
|
||||
@@ -292,7 +292,7 @@ export default {
|
||||
let finalAccountIds = '';
|
||||
let changed = true;
|
||||
|
||||
for (let accountId in self.filterAccountIds) {
|
||||
for (const accountId in self.filterAccountIds) {
|
||||
if (!Object.prototype.hasOwnProperty.call(self.filterAccountIds, accountId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -149,8 +149,8 @@ import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
|
||||
import { useTransactionsStore } from '@/stores/transaction.js';
|
||||
import { useStatisticsStore } from '@/stores/statistics.js';
|
||||
|
||||
import categoryConstants from '@/consts/category.js';
|
||||
import { copyObjectTo, arrayItemToObjectField } from '@/lib/common.js';
|
||||
import { CategoryType } from '@/core/category.ts';
|
||||
import { copyObjectTo, arrayItemToObjectField } from '@/lib/common.ts';
|
||||
import {
|
||||
allTransactionCategoriesWithVisibleCount,
|
||||
hasAnyAvailableCategory,
|
||||
@@ -187,9 +187,9 @@ export default {
|
||||
return {
|
||||
loading: true,
|
||||
expandCategoryTypes: [
|
||||
categoryConstants.allCategoryTypes.Income.toString(),
|
||||
categoryConstants.allCategoryTypes.Expense.toString(),
|
||||
categoryConstants.allCategoryTypes.Transfer.toString()
|
||||
CategoryType.Income.toString(),
|
||||
CategoryType.Expense.toString(),
|
||||
CategoryType.Transfer.toString()
|
||||
],
|
||||
filterCategoryIds: {},
|
||||
showHidden: false,
|
||||
@@ -245,7 +245,7 @@ export default {
|
||||
|
||||
const allCategoryIds = {};
|
||||
|
||||
for (let categoryId in self.transactionCategoriesStore.allTransactionCategoriesMap) {
|
||||
for (const categoryId in self.transactionCategoriesStore.allTransactionCategoriesMap) {
|
||||
if (!Object.prototype.hasOwnProperty.call(self.transactionCategoriesStore.allTransactionCategoriesMap, categoryId)) {
|
||||
continue;
|
||||
}
|
||||
@@ -268,7 +268,7 @@ export default {
|
||||
} else if (self.type === 'statisticsCurrent') {
|
||||
self.filterCategoryIds = copyObjectTo(self.statisticsStore.transactionStatisticsFilter.filterCategoryIds, allCategoryIds);
|
||||
} else if (self.type === 'transactionListCurrent') {
|
||||
for (let categoryId in self.transactionsStore.allFilterCategoryIds) {
|
||||
for (const categoryId in self.transactionsStore.allFilterCategoryIds) {
|
||||
if (!Object.prototype.hasOwnProperty.call(self.transactionsStore.allFilterCategoryIds, categoryId)) {
|
||||
continue;
|
||||
}
|
||||
@@ -303,7 +303,7 @@ export default {
|
||||
let finalCategoryIds = '';
|
||||
let changed = true;
|
||||
|
||||
for (let categoryId in self.filterCategoryIds) {
|
||||
for (const categoryId in self.filterCategoryIds) {
|
||||
if (!Object.prototype.hasOwnProperty.call(self.filterCategoryIds, categoryId)) {
|
||||
continue;
|
||||
}
|
||||
@@ -388,11 +388,11 @@ export default {
|
||||
},
|
||||
getCategoryTypeName(categoryType) {
|
||||
switch (categoryType) {
|
||||
case categoryConstants.allCategoryTypes.Income.toString():
|
||||
case CategoryType.Income.toString():
|
||||
return this.$t('Income Categories');
|
||||
case categoryConstants.allCategoryTypes.Expense.toString():
|
||||
case CategoryType.Expense.toString():
|
||||
return this.$t('Expense Categories');
|
||||
case categoryConstants.allCategoryTypes.Transfer.toString():
|
||||
case CategoryType.Transfer.toString():
|
||||
return this.$t('Transfer Categories');
|
||||
default:
|
||||
return this.$t('Transaction Categories');
|
||||
|
||||
@@ -136,13 +136,13 @@ import { useTransactionTagsStore } from '@/stores/transactionTag.js';
|
||||
import { useTransactionsStore } from '@/stores/transaction.js';
|
||||
import { useStatisticsStore } from '@/stores/statistics.js';
|
||||
|
||||
import transactionConstants from '@/consts/transaction.js';
|
||||
import { TransactionTagFilterType } from '@/core/transaction.ts';
|
||||
|
||||
import {
|
||||
selectAll,
|
||||
selectNone,
|
||||
selectInvert
|
||||
} from '@/lib/common.js';
|
||||
} from '@/lib/common.ts';
|
||||
|
||||
import {
|
||||
mdiSelectAll,
|
||||
@@ -169,7 +169,7 @@ export default {
|
||||
loading: true,
|
||||
expandTagCategories: [ 'default' ],
|
||||
filterTagIds: {},
|
||||
tagFilterType: transactionConstants.defaultTransactionTagFilterType.type,
|
||||
tagFilterType: TransactionTagFilterType.Default.type,
|
||||
showHidden: false,
|
||||
icons: {
|
||||
selectAll: mdiSelectAll,
|
||||
@@ -218,7 +218,7 @@ export default {
|
||||
|
||||
const allTransactionTagIds = {};
|
||||
|
||||
for (let transactionTagId in self.transactionTagsStore.allTransactionTagsMap) {
|
||||
for (const transactionTagId in self.transactionTagsStore.allTransactionTagsMap) {
|
||||
if (!Object.prototype.hasOwnProperty.call(self.transactionTagsStore.allTransactionTagsMap, transactionTagId)) {
|
||||
continue;
|
||||
}
|
||||
@@ -228,7 +228,7 @@ export default {
|
||||
}
|
||||
|
||||
if (self.type === 'statisticsCurrent') {
|
||||
let transactionTagIds = self.statisticsStore.transactionStatisticsFilter.tagIds ? self.statisticsStore.transactionStatisticsFilter.tagIds.split(',') : [];
|
||||
const transactionTagIds = self.statisticsStore.transactionStatisticsFilter.tagIds ? self.statisticsStore.transactionStatisticsFilter.tagIds.split(',') : [];
|
||||
|
||||
for (let i = 0; i < transactionTagIds.length; i++) {
|
||||
const transactionTagId = transactionTagIds[i];
|
||||
@@ -241,7 +241,7 @@ export default {
|
||||
self.filterTagIds = allTransactionTagIds;
|
||||
self.tagFilterType = self.statisticsStore.transactionStatisticsFilter.tagFilterType;
|
||||
} else if (self.type === 'transactionListCurrent') {
|
||||
for (let transactionTagId in self.transactionsStore.allFilterTagIds) {
|
||||
for (const transactionTagId in self.transactionsStore.allFilterTagIds) {
|
||||
if (!Object.prototype.hasOwnProperty.call(self.transactionsStore.allFilterTagIds, transactionTagId)) {
|
||||
continue;
|
||||
}
|
||||
@@ -272,7 +272,7 @@ export default {
|
||||
let finalTagIds = '';
|
||||
let changed = true;
|
||||
|
||||
for (let transactionTagId in self.filterTagIds) {
|
||||
for (const transactionTagId in self.filterTagIds) {
|
||||
if (!Object.prototype.hasOwnProperty.call(self.filterTagIds, transactionTagId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user