From 5b6a526932b0bdc232fd8ac8a05f5c0da378f9c3 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 29 Jan 2024 15:12:30 +0100 Subject: [PATCH 001/106] refs #5509 feat: VnDms feat: EntryDms --- src/components/FormModel.vue | 2 +- src/components/common/VnDms.vue | 75 ++++++++++++++++++++++++++++++ src/components/ui/VnRow.vue | 8 +++- src/components/ui/VnSubToolbar.vue | 2 +- src/i18n/en/index.js | 4 ++ src/i18n/es/index.js | 4 ++ src/pages/Entry/Card/EntryDms.vue | 6 +++ src/router/modules/entry.js | 11 ++++- 8 files changed, 107 insertions(+), 5 deletions(-) create mode 100644 src/components/common/VnDms.vue create mode 100644 src/pages/Entry/Card/EntryDms.vue diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue index 4ad566bf8..153c086bb 100644 --- a/src/components/FormModel.vue +++ b/src/components/FormModel.vue @@ -128,7 +128,7 @@ async function save() { try { const body = $props.mapper ? $props.mapper(formData.value) : formData.value; - let response + let response; if ($props.urlCreate) { response = await axios.post($props.urlCreate, body); notify('globals.dataCreated', 'positive'); diff --git a/src/components/common/VnDms.vue b/src/components/common/VnDms.vue new file mode 100644 index 000000000..cdc54b786 --- /dev/null +++ b/src/components/common/VnDms.vue @@ -0,0 +1,75 @@ + + + diff --git a/src/components/ui/VnRow.vue b/src/components/ui/VnRow.vue index c3c951528..e13730e62 100644 --- a/src/components/ui/VnRow.vue +++ b/src/components/ui/VnRow.vue @@ -1,12 +1,16 @@ diff --git a/src/components/ui/VnSubToolbar.vue b/src/components/ui/VnSubToolbar.vue index 81a1820f1..b314716ce 100644 --- a/src/components/ui/VnSubToolbar.vue +++ b/src/components/ui/VnSubToolbar.vue @@ -1,5 +1,5 @@ + diff --git a/src/router/modules/entry.js b/src/router/modules/entry.js index 8d25a8e0c..3ac12d953 100644 --- a/src/router/modules/entry.js +++ b/src/router/modules/entry.js @@ -11,7 +11,7 @@ export default { redirect: { name: 'EntryMain' }, menus: { main: ['EntryList'], - card: ['EntryBasicData', 'EntryBuys', 'EntryNotes', 'EntryLog'], + card: ['EntryBasicData', 'EntryBuys', 'EntryNotes', 'EntryDms', 'EntryLog'], }, children: [ { @@ -86,6 +86,15 @@ export default { }, component: () => import('src/pages/Entry/Card/EntryNotes.vue'), }, + { + path: 'dms', + name: 'EntryDms', + meta: { + title: 'dms', + icon: 'cloud_upload', + }, + component: () => import('src/pages/Entry/Card/EntryDms.vue'), + }, { path: 'log', name: 'EntryLog', From 64b7a07d4199353861e86fbd3e8bf119e2a77fea Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 5 Feb 2024 15:04:13 +0100 Subject: [PATCH 002/106] refs #5509 feat: VnDms FormModel --- src/components/FetchData.vue | 7 --- src/components/FormModel.vue | 9 +++- src/components/common/VnDms.vue | 89 ++++++++++++++++++++++++++----- src/pages/Entry/Card/EntryDms.vue | 3 +- 4 files changed, 86 insertions(+), 22 deletions(-) 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; +}