mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-16 16:07:33 +08:00
code refactor
This commit is contained in:
@@ -544,12 +544,10 @@ function updateClosingBalance(balance?: number): void {
|
||||
|
||||
if (setTransactionTime) {
|
||||
params.push(`time=${newTransactionTime}`);
|
||||
params.push('withTime=true');
|
||||
}
|
||||
|
||||
params.push(`type=${newTransactionType}`);
|
||||
params.push(`amount=${newTransactionAmount}`);
|
||||
params.push(`withAmount=true`);
|
||||
params.push(`accountId=${accountId.value}`);
|
||||
params.push(`noTransactionDraft=true`);
|
||||
|
||||
|
||||
@@ -509,7 +509,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 {
|
||||
getActualUnixTimeForStore,
|
||||
getBrowserTimezoneOffsetMinutes,
|
||||
@@ -931,6 +930,7 @@ function init(): void {
|
||||
allTagsMap.value,
|
||||
defaultAccountId.value,
|
||||
{
|
||||
time: query['time'] ? parseInt(query['time']) : undefined,
|
||||
type: queryType,
|
||||
categoryId: query['categoryId'],
|
||||
accountId: query['accountId'],
|
||||
@@ -963,14 +963,6 @@ function init(): void {
|
||||
}
|
||||
|
||||
(transaction.value as TransactionTemplate).fillFrom(template);
|
||||
} else {
|
||||
if (query['withAmount'] && query['withAmount'] === 'true' && isDefined(query['amount']) && parseInt(query['amount'])) {
|
||||
transaction.value.sourceAmount = parseInt(query['amount']);
|
||||
}
|
||||
|
||||
if (query['withTime'] && query['withTime'] === 'true' && isDefined(query['time']) && parseInt(query['time'])) {
|
||||
transaction.value.time = parseInt(query['time']);
|
||||
}
|
||||
}
|
||||
|
||||
loading.value = false;
|
||||
@@ -1234,7 +1226,7 @@ function onPageBeforeOut(): void {
|
||||
return;
|
||||
}
|
||||
|
||||
const initAmount: number | undefined = query['withAmount'] && query['withAmount'] === 'true' && query['amount'] ? parseInt(query['amount']) : undefined;
|
||||
const initAmount: number | undefined = query['amount'] ? parseInt(query['amount']) : undefined;
|
||||
|
||||
if (settingsStore.appSettings.autoSaveTransactionDraft === 'confirmation') {
|
||||
if (transactionsStore.isTransactionDraftModified(transaction.value, initAmount, query['categoryId'], query['accountId'], query['tagIds'])) {
|
||||
|
||||
@@ -1394,7 +1394,6 @@ function add(): void {
|
||||
|
||||
if (setTransactionTime) {
|
||||
params.push(`time=${newTransactionTime}`);
|
||||
params.push('withTime=true');
|
||||
}
|
||||
|
||||
if (query.value.type !== TransactionType.ModifyBalance) {
|
||||
|
||||
Reference in New Issue
Block a user