mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-20 17:54:30 +08:00
add transaction pictures api
This commit is contained in:
@@ -864,6 +864,18 @@ export const useTransactionsStore = defineStore('transactions', {
|
||||
return Promise.reject('An error occurred');
|
||||
}
|
||||
|
||||
if (transaction.pictures && transaction.pictures.length > 0) {
|
||||
const pictureIds = [];
|
||||
|
||||
for (let i = 0; i < transaction.pictures.length; i++) {
|
||||
if (transaction.pictures[i].pictureId) {
|
||||
pictureIds.push(transaction.pictures[i].pictureId);
|
||||
}
|
||||
}
|
||||
|
||||
transaction.pictureIds = pictureIds;
|
||||
}
|
||||
|
||||
if (isEdit) {
|
||||
submitTransaction.id = transaction.id;
|
||||
}
|
||||
@@ -991,6 +1003,30 @@ export const useTransactionsStore = defineStore('transactions', {
|
||||
});
|
||||
});
|
||||
},
|
||||
uploadTransactionPicture({ pictureFile, clientSessionId }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
services.uploadTransactionPicture({ pictureFile, clientSessionId }).then(response => {
|
||||
const data = response.data;
|
||||
|
||||
if (!data || !data.success || !data.result) {
|
||||
reject({ message: 'Unable to upload transaction picture' });
|
||||
return;
|
||||
}
|
||||
|
||||
resolve(data.result);
|
||||
}).catch(error => {
|
||||
logger.error('Unable to upload 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 upload transaction picture' });
|
||||
} else {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
collapseMonthInTransactionList({ month, collapse }) {
|
||||
if (month) {
|
||||
month.opened = !collapse;
|
||||
|
||||
Reference in New Issue
Block a user