add keyword parameters to the URL when searching for transaction descriptions in the desktop transaction list

This commit is contained in:
MaysWind
2024-06-29 10:43:20 +08:00
parent 768b005200
commit 640f74c612
3 changed files with 18 additions and 6 deletions
+2 -1
View File
@@ -99,7 +99,8 @@ const router = createRouter({
initMinTime: route.query.minTime, initMinTime: route.query.minTime,
initType: route.query.type, initType: route.query.type,
initCategoryId: route.query.categoryId, initCategoryId: route.query.categoryId,
initAccountId: route.query.accountId initAccountId: route.query.accountId,
initKeyword: route.query.keyword
}) })
}, },
{ {
+4
View File
@@ -473,6 +473,10 @@ export const useTransactionsStore = defineStore('transactions', {
querys.push('minTime=' + this.transactionsFilter.minTime); querys.push('minTime=' + this.transactionsFilter.minTime);
} }
if (this.transactionsFilter.keyword) {
querys.push('keyword=' + encodeURIComponent(this.transactionsFilter.keyword));
}
return querys.join('&'); return querys.join('&');
}, },
loadTransactions({ reload, count, page, withCount, autoExpand, defaultCurrency }) { loadTransactions({ reload, count, page, withCount, autoExpand, defaultCurrency }) {
+12 -5
View File
@@ -405,7 +405,8 @@ export default {
'initMinTime', 'initMinTime',
'initType', 'initType',
'initCategoryId', 'initCategoryId',
'initAccountId' 'initAccountId',
'initKeyword'
], ],
data() { data() {
const { mdAndUp } = useDisplay(); const { mdAndUp } = useDisplay();
@@ -636,7 +637,8 @@ export default {
maxTime: this.initMaxTime, maxTime: this.initMaxTime,
type: this.initType, type: this.initType,
categoryId: this.initCategoryId, categoryId: this.initCategoryId,
accountId: this.initAccountId accountId: this.initAccountId,
keyword: this.initKeyword
}); });
}, },
setup() { setup() {
@@ -663,7 +665,8 @@ export default {
maxTime: to.query.maxTime, maxTime: to.query.maxTime,
type: to.query.type, type: to.query.type,
categoryId: to.query.categoryId, categoryId: to.query.categoryId,
accountId: to.query.accountId accountId: to.query.accountId,
keyword: to.query.keyword
}); });
} }
}, },
@@ -688,9 +691,11 @@ export default {
type: parseInt(query.type) > 0 ? parseInt(query.type) : undefined, type: parseInt(query.type) > 0 ? parseInt(query.type) : undefined,
categoryId: query.categoryId, categoryId: query.categoryId,
accountId: query.accountId, accountId: query.accountId,
keyword: this.searchKeyword keyword: query.keyword || ''
}); });
this.searchKeyword = query.keyword || '';
this.currentPage = 1; this.currentPage = 1;
this.reload(false); this.reload(false);
}, },
@@ -874,7 +879,9 @@ export default {
}); });
this.currentPage = 1; this.currentPage = 1;
this.reload(false); this.currentPageTransactions = [];
this.transactionsStore.clearTransactions();
this.$router.push(this.getFilterLinkUrl());
}, },
add() { add() {
const self = this; const self = this;