diff --git a/src/components/FetchData.vue b/src/components/FetchData.vue index 4f5d7a57d..5b3dcbea7 100644 --- a/src/components/FetchData.vue +++ b/src/components/FetchData.vue @@ -59,11 +59,4 @@ async function fetch(fetchFilter = {}) { // } } - -const render = () => { - return h('div', []); -}; - diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue index 594780220..c3ca8fe98 100644 --- a/src/components/FormModel.vue +++ b/src/components/FormModel.vue @@ -59,6 +59,10 @@ const $props = defineProps({ type: Function, default: null, }, + updateType: { + type: String, + default: 'patch', + }, }); const emit = defineEmits(['onFetch', 'onDataSaved']); @@ -136,7 +140,10 @@ async function save() { response = await axios.post($props.urlCreate, body); notify('globals.dataCreated', 'positive'); } else { - response = await axios.patch($props.urlUpdate || $props.url, body); + response = await axios[$props.updateType]( + $props.urlUpdate || $props.url, + body + ); } emit('onDataSaved', formData.value, response?.data); originalData.value = JSON.parse(JSON.stringify(formData.value)); diff --git a/src/components/common/VnDms.vue b/src/components/common/VnDms.vue index cdc54b786..a3a5dab21 100644 --- a/src/components/common/VnDms.vue +++ b/src/components/common/VnDms.vue @@ -12,26 +12,58 @@ import VnInput from 'src/components/common/VnInput.vue'; const route = useRoute(); const { t } = useI18n(); +const props = defineProps({ + model: { + type: String, + required: true, + }, +}); + const warehouses = ref(); const companies = ref(); const dmsTypes = ref(); +const allowedContentTypes = ref(); +const dms = ref({}); + +function onFileChange(files) { + dms.value.hasFileAttached = !!files; + dms.value.file = files?.name; +} + +function parseDms(data) { + const defaultDms = {}; + + for (let prop in data) { + if (prop.endsWith('Fk')) data[prop.replace('Fk', 'Id')] = data[prop]; + } + console.log(data); + dms.value = data; +}