fix: handle optional taskListGroup and creditNote checks in file uploads
This commit is contained in:
parent
4e8e270d62
commit
5c9c035d2b
3 changed files with 49 additions and 38 deletions
|
|
@ -674,32 +674,36 @@ onMounted(async () => {
|
|||
@upload="
|
||||
async (f) => {
|
||||
attachmentList = f;
|
||||
attachmentData = [];
|
||||
|
||||
Array.from(f).forEach((el) => {
|
||||
attachmentData.push({
|
||||
name: el.name,
|
||||
progress: 1,
|
||||
loaded: 0,
|
||||
total: el.size,
|
||||
placeholder: true,
|
||||
url: fileToUrl(el),
|
||||
if (!creditNoteData) {
|
||||
attachmentData = [];
|
||||
|
||||
Array.from(f).forEach((el) => {
|
||||
attachmentData.push({
|
||||
name: el.name,
|
||||
progress: 1,
|
||||
loaded: 0,
|
||||
total: el.size,
|
||||
placeholder: true,
|
||||
url: fileToUrl(el),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
if (!creditNoteData) return;
|
||||
|
||||
await uploadFile(creditNoteData.id, f);
|
||||
} else {
|
||||
await uploadFile(creditNoteData.id, f);
|
||||
}
|
||||
}
|
||||
"
|
||||
@remove="
|
||||
async (n) => {
|
||||
const attIndex = attachmentData.findIndex((v) => v.name === n);
|
||||
if (!creditNoteData) {
|
||||
const attIndex = attachmentData.findIndex(
|
||||
(v) => v.name === n,
|
||||
);
|
||||
|
||||
attachmentData.splice(attIndex, 1);
|
||||
|
||||
if (!creditNoteData) return;
|
||||
await remove(creditNoteData.id, n);
|
||||
attachmentData.splice(attIndex, 1);
|
||||
} else {
|
||||
await remove(creditNoteData.id, n);
|
||||
}
|
||||
}
|
||||
"
|
||||
/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue