modify field name

This commit is contained in:
MaysWind
2023-08-02 00:24:59 +08:00
parent 2463f06ba1
commit 54ccdc57bf
+9 -9
View File
@@ -5,7 +5,7 @@
<f7-nav-title :title="$t(title)"></f7-nav-title> <f7-nav-title :title="$t(title)"></f7-nav-title>
<f7-nav-right class="navbar-compact-icons"> <f7-nav-right class="navbar-compact-icons">
<f7-link icon-f7="ellipsis" v-if="!sortable && this.categories.length" @click="showMoreActionSheet = true"></f7-link> <f7-link icon-f7="ellipsis" v-if="!sortable && this.categories.length" @click="showMoreActionSheet = true"></f7-link>
<f7-link :href="'/category/add?type=' + categoryType + '&parentId=' + categoryId" icon-f7="plus" v-if="!sortable"></f7-link> <f7-link :href="'/category/add?type=' + categoryType + '&parentId=' + primaryCategoryId" icon-f7="plus" v-if="!sortable"></f7-link>
<f7-link :text="$t('Done')" :class="{ 'disabled': displayOrderSaving }" @click="saveSortResult" v-else-if="sortable"></f7-link> <f7-link :text="$t('Done')" :class="{ 'disabled': displayOrderSaving }" @click="saveSortResult" v-else-if="sortable"></f7-link>
</f7-nav-right> </f7-nav-right>
</f7-navbar> </f7-navbar>
@@ -102,7 +102,7 @@ export default {
return { return {
hasSubCategories: false, hasSubCategories: false,
categoryType: 0, categoryType: 0,
categoryId: '', primaryCategoryId: '',
loading: true, loading: true,
loadingError: null, loadingError: null,
showHidden: false, showHidden: false,
@@ -117,18 +117,18 @@ export default {
computed: { computed: {
...mapStores(useTransactionCategoriesStore), ...mapStores(useTransactionCategoriesStore),
categories() { categories() {
if (!this.categoryId || this.categoryId === '' || this.categoryId === '0') { if (!this.primaryCategoryId || this.primaryCategoryId === '' || this.primaryCategoryId === '0') {
if (!this.transactionCategoriesStore.allTransactionCategories || !this.transactionCategoriesStore.allTransactionCategories[this.categoryType]) { if (!this.transactionCategoriesStore.allTransactionCategories || !this.transactionCategoriesStore.allTransactionCategories[this.categoryType]) {
return []; return [];
} }
return this.transactionCategoriesStore.allTransactionCategories[this.categoryType]; return this.transactionCategoriesStore.allTransactionCategories[this.categoryType];
} else if (this.categoryId && this.categoryId !== '' && this.categoryId !== '0') { } else if (this.primaryCategoryId && this.primaryCategoryId !== '' && this.primaryCategoryId !== '0') {
if (!this.transactionCategoriesStore.allTransactionCategoriesMap || !this.transactionCategoriesStore.allTransactionCategoriesMap[this.categoryId]) { if (!this.transactionCategoriesStore.allTransactionCategoriesMap || !this.transactionCategoriesStore.allTransactionCategoriesMap[this.primaryCategoryId]) {
return []; return [];
} }
return this.transactionCategoriesStore.allTransactionCategoriesMap[this.categoryId].subCategories; return this.transactionCategoriesStore.allTransactionCategoriesMap[this.primaryCategoryId].subCategories;
} else { } else {
return []; return [];
} }
@@ -208,10 +208,10 @@ export default {
} }
if (query.id && query.id !== '0') { if (query.id && query.id !== '0') {
self.categoryId = query.id; self.primaryCategoryId = query.id;
self.hasSubCategories = false; self.hasSubCategories = false;
} else { } else {
self.categoryId = '0'; self.primaryCategoryId = '0';
self.hasSubCategories = true; self.hasSubCategories = true;
} }
@@ -315,7 +315,7 @@ export default {
self.transactionCategoriesStore.updateCategoryDisplayOrders({ self.transactionCategoriesStore.updateCategoryDisplayOrders({
type: self.categoryType, type: self.categoryType,
parentId: self.categoryId, parentId: self.primaryCategoryId,
}).then(() => { }).then(() => {
self.displayOrderSaving = false; self.displayOrderSaving = false;
self.$hideLoading(); self.$hideLoading();