diff --git a/src/components/common/VnDms.vue b/src/components/common/VnDms.vue index a3a5dab21..169356152 100644 --- a/src/components/common/VnDms.vue +++ b/src/components/common/VnDms.vue @@ -17,12 +17,17 @@ const props = defineProps({ type: String, required: true, }, + defaultDmsCode: { + type: String, + required: true, + }, }); const warehouses = ref(); const companies = ref(); const dmsTypes = ref(); const allowedContentTypes = ref(); +const config = ref({}); const dms = ref({}); function onFileChange(files) { @@ -39,6 +44,25 @@ function parseDms(data) { console.log(data); dms.value = data; } + +function mapperDms(data) { + const formData = new FormData(); + const { files } = data; + if (files) formData.append(files?.name, files); + console.log('data', data); + delete data.files; + + const dms = { + hasFile: false, + hasFileAttached: false, + reference: data.id, + warehouseId: config.value.warehouseFk, + companyId: config.value.companyFk, + dmsTypeId: data.dmsTypeFk, + description: 'ASD', + }; + return [formData, { params: dms }]; +}