forked from verdnatura/salix-front
refs #5835 refactor upsert
This commit is contained in:
parent
9388b873c6
commit
dfddde1d5c
|
@ -102,23 +102,16 @@ async function upsert() {
|
||||||
formData.append(dms.value.files[i].name, dms.value.files[i]);
|
formData.append(dms.value.files[i].name, dms.value.files[i]);
|
||||||
dms.value.hasFileAttached = true;
|
dms.value.hasFileAttached = true;
|
||||||
}
|
}
|
||||||
|
const url = !isEdit ? 'Dms/uploadFile' : `dms/${dms.value.id}/updateFile`;
|
||||||
if (!isEdit) {
|
const { data } = await axios.post(url, formData, {
|
||||||
const { data } = await axios.post('Dms/uploadFile', formData, {
|
|
||||||
params: dms.value,
|
params: dms.value,
|
||||||
});
|
});
|
||||||
if (data.length) invoiceIn.value.dmsFk = data[0].id;
|
|
||||||
createDmsRef.value.hide();
|
|
||||||
} else if (isEdit) {
|
|
||||||
const { data } = await axios.post(
|
|
||||||
`dms/${dms.value.id}/updateFile`,
|
|
||||||
formData,
|
|
||||||
{
|
|
||||||
params: dms.value,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (data.length) invoiceIn.value.dmsFk = data[0].id;
|
if (data.length) invoiceIn.value.dmsFk = data[0].id;
|
||||||
|
|
||||||
|
if (!isEdit) {
|
||||||
|
createDmsRef.value.hide();
|
||||||
|
} else if (isEdit) {
|
||||||
editDmsRef.value.hide();
|
editDmsRef.value.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue