From 7358dab1d00632aa6bc6ff86d16e5a4d60f8f84e Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 10 Sep 2024 00:16:01 +0200 Subject: [PATCH 1/5] fix: call upsert when crudModel haschanges --- src/components/VnTable/VnTable.vue | 1 + src/pages/Item/ItemFixedPrice.vue | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 6745a2f49..899e4d000 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -296,6 +296,7 @@ defineExpose({ reload, redirect: redirectFn, selected, + CrudModelRef, }); function handleOnDataSaved(_, res) { diff --git a/src/pages/Item/ItemFixedPrice.vue b/src/pages/Item/ItemFixedPrice.vue index 59a3e74db..16091d473 100644 --- a/src/pages/Item/ItemFixedPrice.vue +++ b/src/pages/Item/ItemFixedPrice.vue @@ -262,10 +262,13 @@ const updateMinPrice = async (value, props) => { }); }; -const upsertPrice = async ({ row }, resetMinPrice = false) => { +const upsertPrice = async (props, resetMinPrice = false) => { try { - if (resetMinPrice) row.hasMinPrice = 0; - row = await upsertFixedPrice(row); + const { row } = props; + if (tableRef.value.CrudModelRef.getChanges().updates.length > 0) { + if (resetMinPrice) row.hasMinPrice = 0; + await upsertFixedPrice(row); + } } catch (err) { console.error('Error editing price', err); } -- 2.40.1 From 9c86fd0ed50a6bc1821d2ab622cc08965bda7149 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 10 Sep 2024 00:17:13 +0200 Subject: [PATCH 2/5] perf: order by --- src/pages/Item/ItemFixedPrice.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Item/ItemFixedPrice.vue b/src/pages/Item/ItemFixedPrice.vue index 16091d473..4f78bd6ce 100644 --- a/src/pages/Item/ItemFixedPrice.vue +++ b/src/pages/Item/ItemFixedPrice.vue @@ -462,7 +462,7 @@ function handleOnDataSave({ CrudModelRef }) { :default-save="false" data-key="ItemFixedPrices" url="FixedPrices/filter" - :order="['name ASC', 'itemFk DESC']" + :order="['itemFk ASC']" save-url="FixedPrices/crud" :user-params="{ warehouseFk: user.warehouseFk }" ref="tableRef" -- 2.40.1 From 41939315be61ef17a5108ff61410d4b11b124239 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Tue, 10 Sep 2024 00:17:39 +0200 Subject: [PATCH 3/5] style: show subName value --- src/pages/Item/ItemFixedPrice.vue | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/pages/Item/ItemFixedPrice.vue b/src/pages/Item/ItemFixedPrice.vue index 4f78bd6ce..a195bc615 100644 --- a/src/pages/Item/ItemFixedPrice.vue +++ b/src/pages/Item/ItemFixedPrice.vue @@ -519,16 +519,12 @@ function handleOnDataSave({ CrudModelRef }) {