fix: quotation => upload additional file

This commit is contained in:
puriphatt 2024-11-26 15:37:50 +07:00
parent d12acef602
commit 2e825e373f
2 changed files with 6 additions and 5 deletions

View file

@ -37,7 +37,7 @@ const fileData = defineModel<
const file = ref<File[]>([]); const file = ref<File[]>([]);
const refQFile = ref<InstanceType<typeof QFile>>(); const refQFile = ref<InstanceType<typeof QFile>>();
async function triggerViewSlip(url: string) { async function triggerViewFile(url: string) {
window.open( window.open(
props.transformUrl ? await props.transformUrl(url) : `${baseUrl}/${url}`, props.transformUrl ? await props.transformUrl(url) : `${baseUrl}/${url}`,
'_blank', '_blank',
@ -93,7 +93,7 @@ function pickFile() {
color="hsl(var(--text-mute))" color="hsl(var(--text-mute))"
clickable clickable
:closeable="!readonly" :closeable="!readonly"
@click="triggerViewSlip(d.url || '')" @click="triggerViewFile(d.url || '')"
@close="$emit('close', d.name)" @close="$emit('close', d.name)"
/> />
</div> </div>

View file

@ -812,6 +812,7 @@ async function uploadAttachment(file?: File) {
progress: e.progress || 0, progress: e.progress || 0,
loaded: e.loaded, loaded: e.loaded,
total: e.total || 0, total: e.total || 0,
url: `quotation/${quotationFormData.value.id || ''}/attachment/${file.name}`,
}; };
}, },
}); });
@ -851,7 +852,7 @@ onMounted(async () => {
await fetchStatus(); await fetchStatus();
if (quotationFormState.value.mode === 'edit') { if (quotationFormState.value.mode !== 'create') {
await getAttachment(); await getAttachment();
} }
@ -1463,10 +1464,10 @@ async function getWorkerFromCriteria(
<div class="surface-1 q-pa-md full-width"> <div class="surface-1 q-pa-md full-width">
<UploadFileSection <UploadFileSection
:readonly=" :readonly="
quotationFormState.mode !== 'edit' ||
(view !== View.Quotation && view !== View.Invoice) || (view !== View.Quotation && view !== View.Invoice) ||
(quotationFormData.quotationStatus !== 'Issued' && (quotationFormData.quotationStatus !== 'Issued' &&
quotationFormData.quotationStatus !== 'Accepted') || quotationFormData.quotationStatus !== 'Accepted')
quotationFormState.mode === 'info'
" "
v-model:file-data="attachmentData" v-model:file-data="attachmentData"
:label=" :label="