mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-16 07:57:33 +08:00
support transaction pictures
This commit is contained in:
@@ -451,6 +451,7 @@ export const useTransactionsStore = defineStore('transactions', {
|
||||
destinationAmount: 0,
|
||||
hideAmount: false,
|
||||
tagIds: [],
|
||||
pictures: [],
|
||||
comment: '',
|
||||
geoLocation: null
|
||||
};
|
||||
@@ -873,7 +874,7 @@ export const useTransactionsStore = defineStore('transactions', {
|
||||
}
|
||||
}
|
||||
|
||||
transaction.pictureIds = pictureIds;
|
||||
submitTransaction.pictureIds = pictureIds;
|
||||
}
|
||||
|
||||
if (isEdit) {
|
||||
@@ -1027,6 +1028,39 @@ export const useTransactionsStore = defineStore('transactions', {
|
||||
});
|
||||
});
|
||||
},
|
||||
removeUnusedTransactionPicture({ pictureInfo }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
services.removeUnusedTransactionPicture({
|
||||
id: pictureInfo.pictureId
|
||||
}).then(response => {
|
||||
const data = response.data;
|
||||
|
||||
if (!data || !data.success || !data.result) {
|
||||
reject({ message: 'Unable to remove transaction picture' });
|
||||
return;
|
||||
}
|
||||
|
||||
resolve(data.result);
|
||||
}).catch(error => {
|
||||
logger.error('failed to remove transaction picture', error);
|
||||
|
||||
if (error.response && error.response.data && error.response.data.errorMessage) {
|
||||
reject({ error: error.response.data });
|
||||
} else if (!error.processed) {
|
||||
reject({ message: 'Unable to remove transaction picture' });
|
||||
} else {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
getTransactionPictureUrl(pictureInfo, disableBrowserCache) {
|
||||
if (!pictureInfo || !pictureInfo.originalUrl) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return services.getTransactionPictureUrlWithToken(pictureInfo.originalUrl, disableBrowserCache);
|
||||
},
|
||||
collapseMonthInTransactionList({ month, collapse }) {
|
||||
if (month) {
|
||||
month.opened = !collapse;
|
||||
|
||||
Reference in New Issue
Block a user