From 381a9c6d1d82d3d0c82e88ab674fc53ac5eeaabb Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 27 Jun 2024 13:56:20 +0200 Subject: [PATCH 01/11] feat: remake vnInputDate and fix: FormModel has changes when error --- src/components/FormModel.vue | 10 +- src/components/common/VnInputDate.vue | 150 +++++++++++++------------- 2 files changed, 78 insertions(+), 82 deletions(-) diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue index f10dee61a..ab9fa921a 100644 --- a/src/components/FormModel.vue +++ b/src/components/FormModel.vue @@ -90,7 +90,7 @@ const $props = defineProps({ }); const emit = defineEmits(['onFetch', 'onDataSaved']); const modelValue = computed( - () => $props.model ?? `formModel_${route?.meta?.title ?? route.name}` + () => $props.model ?? `formModel_${route?.meta?.title ?? route.name}`, ).value; const componentIsRendered = ref(false); const arrayData = useArrayData(modelValue); @@ -137,7 +137,7 @@ onMounted(async () => { JSON.stringify(newVal) !== JSON.stringify(originalData.value); isResetting.value = false; }, - { deep: true } + { deep: true }, ); } }); @@ -145,7 +145,7 @@ onMounted(async () => { if (!$props.url) watch( () => arrayData.store.data, - (val) => updateAndEmit('onFetch', val) + (val) => updateAndEmit('onFetch', val), ); watch(formUrl, async () => { @@ -206,11 +206,11 @@ async function save() { updateAndEmit('onDataSaved', formData.value, response?.data); if ($props.reload) await arrayData.fetch({}); + hasChanges.value = false; } catch (err) { console.error(err); notify('errors.writeRequest', 'negative'); } finally { - hasChanges.value = false; isLoading.value = false; } } @@ -239,7 +239,7 @@ function filter(value, update, filterOptions) { (ref) => { ref.setOptionIndex(-1); ref.moveOptionSelection(1, true); - } + }, ); } diff --git a/src/components/common/VnInputDate.vue b/src/components/common/VnInputDate.vue index 77ab2692d..f2c6cbe60 100644 --- a/src/components/common/VnInputDate.vue +++ b/src/components/common/VnInputDate.vue @@ -1,13 +1,10 @@ From ec5eeaa30831e09f261e8d61b44665599cb1c497 Mon Sep 17 00:00:00 2001 From: Jon Date: Fri, 28 Jun 2024 10:14:24 +0200 Subject: [PATCH 02/11] fix: refs #6151 fixed filters and styles --- src/pages/Order/Card/OrderCard.vue | 9 ++---- src/pages/Order/Card/OrderCatalogFilter.vue | 35 ++++++--------------- src/pages/Order/Card/OrderCatalogItem.vue | 2 +- src/pages/Order/Card/OrderSummary.vue | 24 +++++++++----- src/pages/Order/OrderCatalog.vue | 1 + src/pages/Order/OrderList.vue | 8 +++-- 6 files changed, 38 insertions(+), 41 deletions(-) diff --git a/src/pages/Order/Card/OrderCard.vue b/src/pages/Order/Card/OrderCard.vue index 5b6896656..12b61e913 100644 --- a/src/pages/Order/Card/OrderCard.vue +++ b/src/pages/Order/Card/OrderCard.vue @@ -2,7 +2,6 @@ import VnCard from 'components/common/VnCard.vue'; import OrderDescriptor from 'pages/Order/Card/OrderDescriptor.vue'; import OrderFilter from './OrderFilter.vue'; -import OrderSearchbar from './OrderSearchbar.vue'; diff --git a/src/pages/Order/Card/OrderCatalogFilter.vue b/src/pages/Order/Card/OrderCatalogFilter.vue index fd5300122..c354ec94b 100644 --- a/src/pages/Order/Card/OrderCatalogFilter.vue +++ b/src/pages/Order/Card/OrderCatalogFilter.vue @@ -37,6 +37,10 @@ const selectedOrder = ref(null); const selectedOrderField = ref(null); const moreFields = ref([]); const moreFieldsOrder = ref([]); +const selectedTag = ref(null); +const tagValues = ref([{}]); +const tagOptions = ref([]); + const createValue = (val, done) => { if (val.length > 2) { if (!tagOptions.value.includes(val)) { @@ -95,10 +99,6 @@ function exprBuilder(param, value) { } } -const selectedTag = ref(null); -const tagValues = ref([{}]); -const tagOptions = ref([]); - const applyTagFilter = (params, search) => { if (!tagValues.value?.length) { params.tagGroups = null; @@ -139,39 +139,23 @@ const onOrderChange = (value, params) => { }; const onOrderFieldChange = (value, params) => { - const tagObj = JSON.parse(params.orderBy); // esto donde va - const fields = { - Relevancy: (value) => value + ' DESC, name', - ColorAndPrice: 'showOrder, price', - Name: 'name', - Price: 'price', - }; - let tagField = fields[value]; - if (!tagField) return; - - if (typeof tagField === 'function') tagField = tagField(value); - tagObj.field = tagField; - params.orderBy = JSON.stringify(tagObj); + const tagObj = JSON.parse(params.orderBy); switch (value) { case 'Relevancy': - tagObj.field = value + ' DESC, name'; + tagObj.name = value + ' DESC, name'; params.orderBy = JSON.stringify(tagObj); - console.log('params: ', params); break; case 'ColorAndPrice': - tagObj.field = 'showOrder, price'; + tagObj.name = 'showOrder, price'; params.orderBy = JSON.stringify(tagObj); - console.log('params: ', params); break; case 'Name': - tagObj.field = 'name'; + tagObj.name = 'name'; params.orderBy = JSON.stringify(tagObj); - console.log('params: ', params); break; case 'Price': - tagObj.field = 'price'; + tagObj.name = 'price'; params.orderBy = JSON.stringify(tagObj); - console.log('params: ', params); break; } }; @@ -312,6 +296,7 @@ const useLang = (values) => { v-model="selectedOrder" :options="moreFields" option-label="label" + option-value="way" dense outlined rounded diff --git a/src/pages/Order/Card/OrderCatalogItem.vue b/src/pages/Order/Card/OrderCatalogItem.vue index 34e22915d..8fa0bb5b9 100644 --- a/src/pages/Order/Card/OrderCatalogItem.vue +++ b/src/pages/Order/Card/OrderCatalogItem.vue @@ -27,7 +27,7 @@ const dialog = ref(null);
- +