add time and type parameter to link in statistics page
This commit is contained in:
@@ -111,7 +111,7 @@
|
||||
</f7-list-item>
|
||||
<f7-list-item v-for="(data, idx) in statisticsData.items" :key="idx"
|
||||
class="statistics-list-item"
|
||||
:link="`/transaction/list?${data.type}Id=${data.id}`">
|
||||
:link="data | itemLinkUrl(query, $constants.statistics.allChartDataTypes)">
|
||||
<div slot="media" class="display-flex no-padding-horizontal">
|
||||
<div class="display-flex align-items-center statistics-icon">
|
||||
<f7-icon v-if="data.icon"
|
||||
@@ -665,6 +665,27 @@ export default {
|
||||
}
|
||||
|
||||
return 'Statistics';
|
||||
},
|
||||
itemLinkUrl(item, query, allChartDataTypes) {
|
||||
const querys = [];
|
||||
|
||||
if (query.chartDataType === allChartDataTypes.IncomeByAccount || query.chartDataType === allChartDataTypes.IncomeByPrimaryCategory || query.chartDataType === allChartDataTypes.IncomeBySecondaryCategory) {
|
||||
querys.push('type=2');
|
||||
} else if (query.chartDataType === allChartDataTypes.ExpenseByAccount || query.chartDataType === allChartDataTypes.ExpenseByPrimaryCategory || query.chartDataType === allChartDataTypes.ExpenseBySecondaryCategory) {
|
||||
querys.push('type=3');
|
||||
}
|
||||
|
||||
if (query.chartDataType === allChartDataTypes.IncomeByAccount || query.chartDataType === allChartDataTypes.ExpenseByAccount) {
|
||||
querys.push('accountId=' + item.id);
|
||||
} else if (query.chartDataType === allChartDataTypes.IncomeByPrimaryCategory || query.chartDataType === allChartDataTypes.IncomeBySecondaryCategory || query.chartDataType === allChartDataTypes.ExpenseByPrimaryCategory || query.chartDataType === allChartDataTypes.ExpenseBySecondaryCategory) {
|
||||
querys.push('categoryId=' + item.id);
|
||||
}
|
||||
|
||||
querys.push('dateType=' + query.dateType);
|
||||
querys.push('minTime=' + query.startTime);
|
||||
querys.push('maxTime=' + query.endTime);
|
||||
|
||||
return '/transaction/list?' + querys.join('&');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -396,13 +396,23 @@ export default {
|
||||
const self = this;
|
||||
const query = self.$f7route.query;
|
||||
|
||||
const dateParam = self.$utilities.getDateRangeByDateType(query.dateType ? parseInt(query.dateType) : undefined);
|
||||
let dateParam = self.$utilities.getDateRangeByDateType(query.dateType ? parseInt(query.dateType) : undefined);
|
||||
|
||||
if (!dateParam &&
|
||||
query.dateType === self.$constants.datetime.allDateRanges.Custom.type.toString() &&
|
||||
parseInt(query.maxTime) > 0 && parseInt(query.minTime) > 0) {
|
||||
dateParam = {
|
||||
dateType: parseInt(query.dateType),
|
||||
maxTime: parseInt(query.maxTime),
|
||||
minTime: parseInt(query.minTime)
|
||||
};
|
||||
}
|
||||
|
||||
this.$store.dispatch('initTransactionListFilter', {
|
||||
dateType: dateParam ? dateParam.dateType : undefined,
|
||||
maxTime: dateParam ? dateParam.maxTime : undefined,
|
||||
minTime: dateParam ? dateParam.minTime : undefined,
|
||||
type: query.type,
|
||||
type: parseInt(query.type) > 0 ? parseInt(query.type) : undefined,
|
||||
categoryId: query.categoryId,
|
||||
accountId: query.accountId
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user