support setting timezone type for the time range of statistical data

This commit is contained in:
MaysWind
2024-04-12 09:51:01 +08:00
parent 14f6de8af1
commit ea32bfa5fc
18 changed files with 398 additions and 31 deletions
+4
View File
@@ -1,5 +1,6 @@
import { defineStore } from 'pinia';
import { useSettingsStore } from '@/stores/setting.js';
import { useUserStore } from './user.js';
import { useExchangeRatesStore } from './exchangeRates.js';
@@ -219,6 +220,8 @@ export const useOverviewStore = defineStore('overview', {
this.transactionOverviewStateInvalid = true;
},
loadTransactionOverview({ force, loadLast11Months }) {
const settingsStore = useSettingsStore();
const self = this;
let dateChanged = false;
let rangeChanged = false;
@@ -239,6 +242,7 @@ export const useOverviewStore = defineStore('overview', {
}
const requestParams = {
useTransactionTimezone: settingsStore.appSettings.timezoneUsedForStatisticsInHomePage,
today: self.transactionDataRange.today,
thisWeek: self.transactionDataRange.thisWeek,
thisMonth: self.transactionDataRange.thisMonth,
+10
View File
@@ -17,6 +17,7 @@ export const useSettingsStore = defineStore('settings', {
thousandsSeparator: settings.isEnableThousandsSeparator(),
currencyDisplayMode: settings.getCurrencyDisplayMode(),
showAmountInHomePage: settings.isShowAmountInHomePage(),
timezoneUsedForStatisticsInHomePage: settings.getTimezoneUsedForStatisticsInHomePage(),
itemsCountInTransactionListPage: settings.getItemsCountInTransactionListPage(),
showTotalAmountInTransactionListPage: settings.isShowTotalAmountInTransactionListPage(),
showAccountBalance: settings.isShowAccountBalance(),
@@ -24,6 +25,7 @@ export const useSettingsStore = defineStore('settings', {
defaultChartType: settings.getStatisticsDefaultChartType(),
defaultChartDataType: settings.getStatisticsDefaultChartDataType(),
defaultDataRangeType: settings.getStatisticsDefaultDateRange(),
defaultTimezoneType: settings.getStatisticsDefaultTimezoneType(),
defaultAccountFilter: settings.getStatisticsDefaultAccountFilter(),
defaultTransactionCategoryFilter: settings.getStatisticsDefaultTransactionCategoryFilter(),
defaultSortingType: settings.getStatisticsSortingType()
@@ -76,6 +78,10 @@ export const useSettingsStore = defineStore('settings', {
settings.setShowAmountInHomePage(value);
this.appSettings.showAmountInHomePage = value;
},
setTimezoneUsedForStatisticsInHomePage(value) {
settings.setTimezoneUsedForStatisticsInHomePage(value);
this.appSettings.timezoneUsedForStatisticsInHomePage = value;
},
setItemsCountInTransactionListPage(value) {
settings.setItemsCountInTransactionListPage(value);
this.appSettings.itemsCountInTransactionListPage = value;
@@ -100,6 +106,10 @@ export const useSettingsStore = defineStore('settings', {
settings.setStatisticsDefaultDateRange(value);
this.appSettings.statistics.defaultDataRangeType = value;
},
setStatisticsDefaultTimezoneType(value) {
settings.setStatisticsDefaultTimezoneType(value);
this.appSettings.statistics.defaultTimezoneType = value;
},
setStatisticsDefaultAccountFilter(value) {
settings.setStatisticsDefaultAccountFilter(value);
this.appSettings.statistics.defaultAccountFilter = value;
+3 -1
View File
@@ -580,11 +580,13 @@ export const useStatisticsStore = defineStore('statistics', {
},
loadTransactionStatistics({ force }) {
const self = this;
const settingsStore = useSettingsStore();
return new Promise((resolve, reject) => {
services.getTransactionStatistics({
startTime: self.transactionStatisticsFilter.startTime,
endTime: self.transactionStatisticsFilter.endTime
endTime: self.transactionStatisticsFilter.endTime,
useTransactionTimezone: settingsStore.appSettings.statistics.defaultTimezoneType
}).then(response => {
const data = response.data;