From 668ece6490831b2e194cbe85924351994f170aff Mon Sep 17 00:00:00 2001 From: MaysWind Date: Mon, 5 Apr 2021 23:00:01 +0800 Subject: [PATCH] don't show account balance when account balance is set to hidden --- src/components/mobile/PieChart.vue | 3 ++- src/views/mobile/statistics/Transaction.vue | 23 ++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/components/mobile/PieChart.vue b/src/components/mobile/PieChart.vue index a635e717..9e779850 100644 --- a/src/components/mobile/PieChart.vue +++ b/src/components/mobile/PieChart.vue @@ -59,7 +59,7 @@ Name {{ selectedItem.name }} Value - {{ selectedItem.value | currency(selectedItem.currency || defaultCurrency) }} + {{ selectedItem.value | currency(selectedItem.currency || defaultCurrency) }} @@ -101,6 +101,7 @@ export default { 'hiddenField', 'minValidPercent', 'defaultCurrency', + 'showValue', 'showCenterText', 'showSelectedItemInfo', 'enableClickItem', diff --git a/src/views/mobile/statistics/Transaction.vue b/src/views/mobile/statistics/Transaction.vue index eac2ed28..ba4de4df 100644 --- a/src/views/mobile/statistics/Transaction.vue +++ b/src/views/mobile/statistics/Transaction.vue @@ -40,6 +40,7 @@ - {{ statisticsData.totalAmount | currency(defaultCurrency) | textLimit(16) }} + {{ statisticsData.totalAmount | currency(defaultCurrency) | finalAmount(showAccountBalance, query.chartDataType, allChartDataTypes) | textLimit(16) }} {{ $t('No data') }} @@ -146,7 +147,7 @@
- {{ statisticsData.totalAmount | currency(defaultCurrency) }} + {{ statisticsData.totalAmount | currency(defaultCurrency) | finalAmount(showAccountBalance, query.chartDataType, allChartDataTypes) }}
- {{ item.totalAmount | currency(item.currency || defaultCurrency) }} + {{ item.totalAmount | currency(item.currency || defaultCurrency) | finalAmount(showAccountBalance, query.chartDataType, allChartDataTypes) }}
@@ -255,6 +256,7 @@ export default { loading: true, loadingError: null, sortBy: self.$settings.getStatisticsSortingType(), + showAccountBalance: self.$settings.isShowAccountBalance(), showChartDataTypePopover: false, showDatePopover: false, showCustomDateRangeSheet: false, @@ -355,6 +357,14 @@ export default { totalAmount: combinedData.totalAmount, items: allStatisticsItems }; + }, + showAmountInChart() { + if (!this.showAccountBalance + && (this.query.chartDataType === this.allChartDataTypes.AccountTotalAssets.type || this.query.chartDataType === this.allChartDataTypes.AccountTotalLiabilities.type)) { + return false; + } + + return true; } }, created() { @@ -605,6 +615,13 @@ export default { } }, filters: { + finalAmount(amount, isShowAccountBalance, dataType, allChartDataTypes) { + if (!isShowAccountBalance && (dataType === allChartDataTypes.AccountTotalAssets.type || dataType === allChartDataTypes.AccountTotalLiabilities.type)) { + return '***'; + } + + return amount; + }, chartDataTypeName(dataType, allChartDataTypes) { for (let chartDataTypeField in allChartDataTypes) { if (!Object.prototype.hasOwnProperty.call(allChartDataTypes, chartDataTypeField)) {