mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 00:34:28 +08:00
export transaction data based on the conditions on the transaction list page (#55)
This commit is contained in:
@@ -29,6 +29,9 @@ import {
|
||||
type ImportTransactionResponsePageWrapper,
|
||||
ImportTransaction
|
||||
} from '@/models/imported_transaction.ts';
|
||||
import {
|
||||
type ExportTransactionDataRequest
|
||||
} from '@/models/data_management.ts';
|
||||
|
||||
import {
|
||||
getUserTransactionDraft,
|
||||
@@ -780,6 +783,20 @@ export const useTransactionsStore = defineStore('transactions', () => {
|
||||
return querys.join('&');
|
||||
}
|
||||
|
||||
function getExportTransactionDataRequestByTransactionFilter(): ExportTransactionDataRequest {
|
||||
return {
|
||||
maxTime: transactionsFilter.value.maxTime,
|
||||
minTime: transactionsFilter.value.minTime,
|
||||
type: transactionsFilter.value.type,
|
||||
categoryIds: transactionsFilter.value.categoryIds,
|
||||
accountIds: transactionsFilter.value.accountIds,
|
||||
tagIds: transactionsFilter.value.tagIds,
|
||||
tagFilterType: transactionsFilter.value.tagFilterType,
|
||||
amountFilter: transactionsFilter.value.amountFilter,
|
||||
keyword: transactionsFilter.value.keyword
|
||||
};
|
||||
}
|
||||
|
||||
function loadTransactions({ reload, count, page, withCount, autoExpand, defaultCurrency }: { reload?: boolean, count?: number, page?: number, withCount?: boolean, autoExpand: boolean, defaultCurrency: string }): Promise<TransactionPageWrapper> {
|
||||
let actualMaxTime = transactionsNextTimeId.value;
|
||||
|
||||
@@ -1308,6 +1325,7 @@ export const useTransactionsStore = defineStore('transactions', () => {
|
||||
initTransactionListFilter,
|
||||
updateTransactionListFilter,
|
||||
getTransactionListPageParams,
|
||||
getExportTransactionDataRequestByTransactionFilter,
|
||||
loadTransactions,
|
||||
loadMonthlyAllTransactions,
|
||||
getTransaction,
|
||||
|
||||
+3
-2
@@ -16,6 +16,7 @@ import {
|
||||
} from '@/models/user.ts';
|
||||
|
||||
import type {
|
||||
ExportTransactionDataRequest,
|
||||
DataStatisticsResponse
|
||||
} from '@/models/data_management.ts';
|
||||
|
||||
@@ -360,9 +361,9 @@ export const useUserStore = defineStore('user', () => {
|
||||
});
|
||||
}
|
||||
|
||||
function getExportedUserData(fileType: string): Promise<Blob> {
|
||||
function getExportedUserData(fileType: string, req?: ExportTransactionDataRequest): Promise<Blob> {
|
||||
return new Promise((resolve, reject) => {
|
||||
services.getExportedUserData(fileType).then(response => {
|
||||
services.getExportedUserData(fileType, req).then(response => {
|
||||
if (response && response.headers) {
|
||||
if (fileType === 'csv' && response.headers['content-type'] !== 'text/csv') {
|
||||
reject({ message: 'Unable to retrieve exported user data' });
|
||||
|
||||
Reference in New Issue
Block a user