From 696f6b4c05aa4a14ea48db004feda34ff4c326dd Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 27 May 2024 09:27:14 +0200 Subject: [PATCH 1/2] feat(VnTable): refs #6825 addInWhere --- src/components/VnTable/VnFilter.vue | 10 +++++-- .../ExtendedList/CustomerExtendedList.vue | 28 ++++++++++++++++++- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/src/components/VnTable/VnFilter.vue b/src/components/VnTable/VnFilter.vue index 000683670..ba573f612 100644 --- a/src/components/VnTable/VnFilter.vue +++ b/src/components/VnTable/VnFilter.vue @@ -89,11 +89,15 @@ const components = { async function addFilter(value) { if (value && typeof value === 'object') value = model.value; - value = value === '' ? null : value; + value = value === '' ? undefined : value; let field = columnFilter.value?.name ?? $props.column.name; - const toFilter = { [field]: value }; - await arrayData.addFilter({ params: toFilter }); + let params = { [field]: value }; + if (columnFilter.value?.inWhere) { + if (columnFilter.value.prefix) field = columnFilter.value.prefix + '.' + field; + params = { filter: { where: params } }; + } + await arrayData.addFilter({ params }); } function alignRow() { diff --git a/src/pages/Customer/ExtendedList/CustomerExtendedList.vue b/src/pages/Customer/ExtendedList/CustomerExtendedList.vue index f857abf4c..e865c7224 100644 --- a/src/pages/Customer/ExtendedList/CustomerExtendedList.vue +++ b/src/pages/Customer/ExtendedList/CustomerExtendedList.vue @@ -75,11 +75,17 @@ const columns = computed(() => [ align: 'left', label: t('customer.extendedList.tableVisibleColumns.credit'), name: 'credit', + columnFilter: { + inWhere: true, + }, }, { align: 'left', label: t('customer.extendedList.tableVisibleColumns.creditInsurance'), name: 'creditInsurance', + columnFilter: { + inWhere: true, + }, }, { align: 'left', @@ -98,6 +104,9 @@ const columns = computed(() => [ label: t('customer.extendedList.tableVisibleColumns.mobile'), name: 'mobile', cardVisible: true, + columnFilter: { + inWhere: true, + }, }, { align: 'left', @@ -108,12 +117,29 @@ const columns = computed(() => [ { align: 'left', label: t('customer.extendedList.tableVisibleColumns.countryFk'), - name: 'country', + name: 'countryFk', + columnFilter: { + component: 'select', + inWhere: true, + prefix: 'c', + attrs: { + url: 'Countries', + }, + }, + format: (row, dashIfEmpty) => dashIfEmpty(row.country), }, { align: 'left', label: t('customer.extendedList.tableVisibleColumns.provinceFk'), name: 'provinceFk', + component: 'select', + attrs: { + url: 'Provinces', + }, + columnField: { + component: null, + }, + format: (row, dashIfEmpty) => dashIfEmpty(row.province), }, { align: 'left', From 88c2af555cbf3583d248f7b13c5612bcd23c8d99 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 27 May 2024 09:28:04 +0200 Subject: [PATCH 2/2] fix(ArrayData): refs #6825 router.replace and use filter.where --- src/components/VnTable/VnTable.vue | 6 +- src/components/ui/VnFilterPanel.vue | 55 +- src/composables/useArrayData.js | 16 +- .../CustomerExtendedListBackup.vue | 571 ------------------ 4 files changed, 46 insertions(+), 602 deletions(-) delete mode 100644 src/pages/Customer/ExtendedList/CustomerExtendedListBackup.vue diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index 703b24c48..044444c44 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -148,6 +148,7 @@ defineExpose({ :data-key="$attrs['data-key']" :search-button="true" v-model="params" + :disable-submit-event="true" >