mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 00:34:28 +08:00
code refactor
This commit is contained in:
@@ -497,7 +497,6 @@ import { TransactionTemplate } from '@/models/transaction_template.ts';
|
||||
import type { TransactionPictureInfoBasicResponse } from '@/models/transaction_picture_info.ts';
|
||||
import { Transaction } from '@/models/transaction.ts';
|
||||
|
||||
import { isDefined } from '@/lib/common.ts';
|
||||
import {
|
||||
getTimezoneOffsetMinutes,
|
||||
getCurrentUnixTime
|
||||
@@ -538,9 +537,6 @@ export interface TransactionEditOptions extends SetTransactionOptions {
|
||||
template?: TransactionTemplate;
|
||||
currentTransaction?: Transaction;
|
||||
currentTemplate?: TransactionTemplate;
|
||||
time?: number;
|
||||
setAmount?: boolean;
|
||||
setTransactionTime?: boolean;
|
||||
noTransactionDraft?: boolean;
|
||||
}
|
||||
|
||||
@@ -688,6 +684,7 @@ function setTransaction(newTransaction: Transaction | null, options: SetTransact
|
||||
allTagsMap.value,
|
||||
defaultAccountId.value,
|
||||
{
|
||||
time: options.time,
|
||||
type: options.type,
|
||||
categoryId: options.categoryId,
|
||||
accountId: options.accountId,
|
||||
@@ -714,10 +711,7 @@ function open(options: TransactionEditOptions): Promise<TransactionEditResponse
|
||||
originalTransactionEditable.value = false;
|
||||
noTransactionDraft.value = options.noTransactionDraft || false;
|
||||
|
||||
if (options.setAmount) {
|
||||
initAmount.value = options.amount;
|
||||
}
|
||||
|
||||
initAmount.value = options.amount;
|
||||
initCategoryId.value = options.categoryId;
|
||||
initAccountId.value = options.accountId;
|
||||
initTagIds.value = options.tagIds;
|
||||
@@ -828,14 +822,6 @@ function open(options: TransactionEditOptions): Promise<TransactionEditResponse
|
||||
(transaction.value as TransactionTemplate).fillFrom(template);
|
||||
} else {
|
||||
setTransaction(null, options, true, true);
|
||||
|
||||
if (options.setAmount && isDefined(options.amount)) {
|
||||
transaction.value.sourceAmount = options.amount;
|
||||
}
|
||||
|
||||
if (options.setTransactionTime && isDefined(options.time)) {
|
||||
transaction.value.time = options.time;
|
||||
}
|
||||
}
|
||||
|
||||
loading.value = false;
|
||||
|
||||
Reference in New Issue
Block a user