mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-19 01:04:25 +08:00
support using duplicate checker to prevent duplicate submissions for new transaction record
This commit is contained in:
@@ -181,6 +181,7 @@ import accountConstants from '@/consts/account.js';
|
||||
import iconConstants from '@/consts/icon.js';
|
||||
import colorConstants from '@/consts/color.js';
|
||||
import { isNumber } from '@/lib/common.js';
|
||||
import { generateRandomUUID } from '@/lib/misc.js';
|
||||
import {
|
||||
setAccountModelByAnotherAccount,
|
||||
setAccountSuitableIcon
|
||||
@@ -208,6 +209,7 @@ export default {
|
||||
showState: false,
|
||||
activeTab: 'account',
|
||||
editAccountId: null,
|
||||
clientSessionId: '',
|
||||
loading: false,
|
||||
account: newAccount,
|
||||
subAccounts: [],
|
||||
@@ -314,6 +316,7 @@ export default {
|
||||
}
|
||||
|
||||
self.editAccountId = null;
|
||||
self.clientSessionId = generateRandomUUID();
|
||||
self.loading = false;
|
||||
}
|
||||
|
||||
@@ -370,7 +373,8 @@ export default {
|
||||
self.accountsStore.saveAccount({
|
||||
account: self.account,
|
||||
subAccounts: self.subAccounts,
|
||||
isEdit: !!self.editAccountId
|
||||
isEdit: !!self.editAccountId,
|
||||
clientSessionId: self.clientSessionId
|
||||
}).then(() => {
|
||||
self.submitting = false;
|
||||
|
||||
|
||||
@@ -101,6 +101,7 @@ import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
|
||||
import categoryConstants from '@/consts/category.js';
|
||||
import iconConstants from '@/consts/icon.js';
|
||||
import colorConstants from '@/consts/color.js';
|
||||
import { generateRandomUUID } from '@/lib/misc.js';
|
||||
import {
|
||||
setCategoryModelByAnotherCategory,
|
||||
allVisiblePrimaryTransactionCategoriesByType
|
||||
@@ -121,6 +122,7 @@ export default {
|
||||
return {
|
||||
showState: false,
|
||||
editCategoryId: null,
|
||||
clientSessionId: '',
|
||||
loading: false,
|
||||
category: newTransactionCategory,
|
||||
submitting: false,
|
||||
@@ -220,6 +222,7 @@ export default {
|
||||
self.category.type = categoryType;
|
||||
self.category.parentId = options.parentId;
|
||||
|
||||
self.clientSessionId = generateRandomUUID();
|
||||
self.loading = false;
|
||||
}
|
||||
|
||||
@@ -242,7 +245,8 @@ export default {
|
||||
|
||||
self.transactionCategoriesStore.saveCategory({
|
||||
category: self.category,
|
||||
isEdit: !!self.editCategoryId
|
||||
isEdit: !!self.editCategoryId,
|
||||
clientSessionId: self.clientSessionId
|
||||
}).then(() => {
|
||||
self.submitting = false;
|
||||
|
||||
|
||||
@@ -338,6 +338,7 @@ import {
|
||||
getTimezoneOffsetMinutes,
|
||||
getCurrentUnixTime
|
||||
} from '@/lib/datetime.js';
|
||||
import { generateRandomUUID } from '@/lib/misc.js';
|
||||
import {
|
||||
getFirstAvailableCategoryId
|
||||
} from '@/lib/category.js';
|
||||
@@ -370,6 +371,7 @@ export default {
|
||||
activeTab: 'basicInfo',
|
||||
editTransactionId: null,
|
||||
originalTransactionEditable: false,
|
||||
clientSessionId: '',
|
||||
loading: true,
|
||||
transaction: newTransaction,
|
||||
geoLocationStatus: null,
|
||||
@@ -642,6 +644,10 @@ export default {
|
||||
self.transaction.type = parseInt(options.type);
|
||||
}
|
||||
|
||||
if (self.mode === 'add') {
|
||||
self.clientSessionId = generateRandomUUID();
|
||||
}
|
||||
|
||||
Promise.all(promises).then(function (responses) {
|
||||
if (self.editTransactionId && !responses[3]) {
|
||||
if (self.reject) {
|
||||
@@ -691,7 +697,8 @@ export default {
|
||||
self.transactionsStore.saveTransaction({
|
||||
transaction: self.transaction,
|
||||
defaultCurrency: self.defaultCurrency,
|
||||
isEdit: self.mode === 'edit'
|
||||
isEdit: self.mode === 'edit',
|
||||
clientSessionId: self.clientSessionId
|
||||
}).then(() => {
|
||||
self.submitting = false;
|
||||
|
||||
|
||||
@@ -428,6 +428,7 @@ import iconConstants from '@/consts/icon.js';
|
||||
import colorConstants from '@/consts/color.js';
|
||||
import transactionConstants from '@/consts/transaction.js';
|
||||
import { getNameByKeyValue } from '@/lib/common.js';
|
||||
import { generateRandomUUID } from '@/lib/misc.js';
|
||||
import {
|
||||
setAccountModelByAnotherAccount,
|
||||
setAccountSuitableIcon
|
||||
@@ -447,6 +448,7 @@ export default {
|
||||
|
||||
return {
|
||||
editAccountId: null,
|
||||
clientSessionId: '',
|
||||
loading: false,
|
||||
loadingError: null,
|
||||
account: newAccount,
|
||||
@@ -547,6 +549,7 @@ export default {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
self.clientSessionId = generateRandomUUID();
|
||||
self.loading = false;
|
||||
}
|
||||
},
|
||||
@@ -614,7 +617,8 @@ export default {
|
||||
self.accountsStore.saveAccount({
|
||||
account: self.account,
|
||||
subAccounts: self.subAccounts,
|
||||
isEdit: !!self.editAccountId
|
||||
isEdit: !!self.editAccountId,
|
||||
clientSessionId: self.clientSessionId
|
||||
}).then(() => {
|
||||
self.submitting = false;
|
||||
self.$hideLoading();
|
||||
|
||||
@@ -153,6 +153,7 @@ import categoryConstants from '@/consts/category.js';
|
||||
import iconConstants from '@/consts/icon.js';
|
||||
import colorConstants from '@/consts/color.js';
|
||||
import { getNameByKeyValue } from '@/lib/common.js';
|
||||
import { generateRandomUUID } from '@/lib/misc.js';
|
||||
import {
|
||||
setCategoryModelByAnotherCategory,
|
||||
allVisiblePrimaryTransactionCategoriesByType
|
||||
@@ -172,6 +173,7 @@ export default {
|
||||
|
||||
return {
|
||||
editCategoryId: null,
|
||||
clientSessionId: '',
|
||||
loading: false,
|
||||
loadingError: null,
|
||||
category: newTransactionCategory,
|
||||
@@ -257,6 +259,7 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
self.clientSessionId = generateRandomUUID();
|
||||
self.loading = false;
|
||||
}
|
||||
},
|
||||
@@ -280,7 +283,8 @@ export default {
|
||||
|
||||
self.transactionCategoriesStore.saveCategory({
|
||||
category: self.category,
|
||||
isEdit: !!self.editCategoryId
|
||||
isEdit: !!self.editCategoryId,
|
||||
clientSessionId: self.clientSessionId
|
||||
}).then(() => {
|
||||
self.submitting = false;
|
||||
self.$hideLoading();
|
||||
|
||||
@@ -367,6 +367,7 @@ import {
|
||||
getUtcOffsetByUtcOffsetMinutes,
|
||||
getActualUnixTimeForStore
|
||||
} from '@/lib/datetime.js';
|
||||
import { generateRandomUUID } from '@/lib/misc.js';
|
||||
import {
|
||||
getTransactionPrimaryCategoryName,
|
||||
getTransactionSecondaryCategoryName,
|
||||
@@ -389,6 +390,7 @@ export default {
|
||||
mode: 'add',
|
||||
editTransactionId: null,
|
||||
transaction: newTransaction,
|
||||
clientSessionId: '',
|
||||
loading: true,
|
||||
loadingError: null,
|
||||
geoLocationStatus: null,
|
||||
@@ -663,6 +665,10 @@ export default {
|
||||
self.transaction.type = parseInt(query.type);
|
||||
}
|
||||
|
||||
if (self.mode === 'add') {
|
||||
self.clientSessionId = generateRandomUUID();
|
||||
}
|
||||
|
||||
Promise.all(promises).then(function (responses) {
|
||||
if (query.id && !responses[3]) {
|
||||
self.$toast('Unable to retrieve transaction');
|
||||
@@ -723,7 +729,8 @@ export default {
|
||||
self.transactionsStore.saveTransaction({
|
||||
transaction: self.transaction,
|
||||
defaultCurrency: self.defaultCurrency,
|
||||
isEdit: self.mode === 'edit'
|
||||
isEdit: self.mode === 'edit',
|
||||
clientSessionId: self.clientSessionId
|
||||
}).then(() => {
|
||||
self.submitting = false;
|
||||
self.$hideLoading();
|
||||
|
||||
Reference in New Issue
Block a user