From 6a6a47bc82f03bb5a0b1dec94519a656b5a5cc69 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 6 May 2024 15:26:57 +0200 Subject: [PATCH] feat: refs #6825 right filter panel --- src/components/common/VnSelect.vue | 13 +++- src/components/common/VnTable.vue | 76 +++++++++++++++---- src/components/common/VnTableFilter.vue | 38 +++++++--- src/components/ui/VnFilterPanel.vue | 39 +++++++--- .../ExtendedList/CustomerExtendedList.vue | 10 +-- 5 files changed, 132 insertions(+), 44 deletions(-) diff --git a/src/components/common/VnSelect.vue b/src/components/common/VnSelect.vue index 05c74f00a..0fea2180b 100644 --- a/src/components/common/VnSelect.vue +++ b/src/components/common/VnSelect.vue @@ -16,11 +16,11 @@ const $props = defineProps({ }, optionLabel: { type: [String], - default: '', + default: 'name', }, optionValue: { type: String, - default: '', + default: 'id', }, url: { type: String, @@ -108,11 +108,18 @@ async function fetchFilter(val) { const { fields, sortBy, limit } = $props; let key = optionLabel.value; + console.log('key: ', key); if (new RegExp(/\d/g).test(val)) key = optionValue.value; + console.log('key: ', key); const where = { [key]: { like: `%${val}%` } }; - return dataRef.value.fetch({ fields, where, order: sortBy, limit }); + const fetchOptions = { where, order: sortBy, limit }; + console.log('where: ', where); + console.log('fields: ', fields); + if (fields) fetchOptions.fields = fields; + console.log('fetchOptions: ', fetchOptions); + return dataRef.value.fetch(fetchOptions); } async function filterHandler(val, update) { diff --git a/src/components/common/VnTable.vue b/src/components/common/VnTable.vue index 66296311f..b18f34779 100644 --- a/src/components/common/VnTable.vue +++ b/src/components/common/VnTable.vue @@ -168,9 +168,9 @@ function columnsCard(cols) {