From 3394eb10b01689b52b2d4066f00114467986450d Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 17 Jun 2024 12:58:58 +0200 Subject: [PATCH] fix(VnFilterPanel): remove key --- src/components/VnTable/VnColumn.vue | 46 +++++++++++++++-------------- src/components/ui/VnFilterPanel.vue | 17 ++++------- src/pages/Customer/CustomerList.vue | 16 ++++++---- 3 files changed, 39 insertions(+), 40 deletions(-) diff --git a/src/components/VnTable/VnColumn.vue b/src/components/VnTable/VnColumn.vue index 9f8614fe5..6a52e0158 100644 --- a/src/components/VnTable/VnColumn.vue +++ b/src/components/VnTable/VnColumn.vue @@ -134,26 +134,28 @@ const col = computed(() => { const components = computed(() => $props.components ?? defaultComponents); diff --git a/src/components/ui/VnFilterPanel.vue b/src/components/ui/VnFilterPanel.vue index 3e892cb41..218e28600 100644 --- a/src/components/ui/VnFilterPanel.vue +++ b/src/components/ui/VnFilterPanel.vue @@ -147,7 +147,7 @@ const tagsList = computed(() => { const tagList = []; for (const key of Object.keys(params.value)) { const value = params.value[key]; - if (!value || ($props.hiddenTags || []).includes(key)) continue; + if (value == null || ($props.hiddenTags || []).includes(key)) continue; tagList.push({ label: key, value }); } return tagList; @@ -161,21 +161,14 @@ const customTags = computed(() => ); async function remove(key) { - delete params.value[key]; - delete params.value.filter?.where?.[key]; params.value[key] = undefined; - await arrayData.applyFilter({ params: params.value }); + search(); emit('remove', key); } function formatValue(value) { - if (typeof value === 'boolean') { - return value ? t('Yes') : t('No'); - } - - if (isNaN(value) && !isNaN(Date.parse(value))) { - return toDate(value); - } + if (typeof value === 'boolean') return value ? t('Yes') : t('No'); + if (isNaN(value) && !isNaN(Date.parse(value))) return toDate(value); return `"${value}"`; } @@ -236,7 +229,7 @@ function formatValue(value) {
{{ chip.label }}: - "{{ chip.value }}" + "{{ formatValue(chip.value) }}"
diff --git a/src/pages/Customer/CustomerList.vue b/src/pages/Customer/CustomerList.vue index c069810d3..7eb3cefd0 100644 --- a/src/pages/Customer/CustomerList.vue +++ b/src/pages/Customer/CustomerList.vue @@ -94,15 +94,19 @@ const columns = computed(() => [ label: t('customer.extendedList.tableVisibleColumns.phone'), name: 'phone', cardVisible: true, - after: { - component: markRaw(VnLinkPhone), - props: (prop) => ({ - 'phone-number': prop.phone, - }), + columnFilter: { + component: 'number', }, - component: 'number', columnField: { component: null, + after: { + component: markRaw(VnLinkPhone), + attrs: (prop) => { + return { + 'phone-number': prop, + }; + }, + }, }, }, {