code refactor

This commit is contained in:
MaysWind
2021-05-04 22:50:06 +08:00
parent d2d2babf0b
commit ec19a18fc2
10 changed files with 91 additions and 143 deletions
+1 -14
View File
@@ -4,7 +4,7 @@
<f7-nav-left :back-link="$t('Back')"></f7-nav-left>
<f7-nav-title>
<f7-link popover-open=".chart-data-type-popover-menu">
<span>{{ query.chartDataType | chartDataTypeName(allChartDataTypes) | localized }}</span>
<span>{{ query.chartDataType | optionName(allChartDataTypes, 'type', 'name', 'Statistics') | localized }}</span>
<f7-icon size="14px" :f7="showChartDataTypePopover ? 'arrowtriangle_up_fill' : 'arrowtriangle_down_fill'"></f7-icon>
</f7-link>
</f7-nav-title>
@@ -622,19 +622,6 @@ export default {
return amount;
},
chartDataTypeName(dataType, allChartDataTypes) {
for (let chartDataTypeField in allChartDataTypes) {
if (!Object.prototype.hasOwnProperty.call(allChartDataTypes, chartDataTypeField)) {
return;
}
if (allChartDataTypes[chartDataTypeField].type === dataType) {
return allChartDataTypes[chartDataTypeField].name;
}
}
return 'Statistics';
},
totalAmountName(dataType, allChartDataTypes) {
if (dataType === allChartDataTypes.IncomeByAccount.type || dataType === allChartDataTypes.IncomeByPrimaryCategory.type || dataType === allChartDataTypes.IncomeBySecondaryCategory.type) {
return 'Total Income';