From 5125b576634b9c829b16fb4fe41ac12e3edde5ff Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 19 Dec 2024 12:15:46 +0100 Subject: [PATCH] fix: refs #7133 handleSalesModelValue function to handle empty input --- src/pages/Customer/Card/CustomerBasicData.vue | 19 +++++++++++-------- src/pages/Customer/CustomerFilter.vue | 19 +++++++++++-------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/pages/Customer/Card/CustomerBasicData.vue b/src/pages/Customer/Card/CustomerBasicData.vue index 768c66f32..e9a349e0b 100644 --- a/src/pages/Customer/Card/CustomerBasicData.vue +++ b/src/pages/Customer/Card/CustomerBasicData.vue @@ -16,14 +16,17 @@ const { t } = useI18n(); const businessTypes = ref([]); const contactChannels = ref([]); -const handleSalesModelValue = (val) => ({ - or: [ - { id: val }, - { name: val }, - { nickname: { like: '%' + val + '%' } }, - { code: { like: `${val}%` } }, - ], -}); +const handleSalesModelValue = (val) => { + if (!val) val = ''; + return { + or: [ + { id: val }, + { name: val }, + { nickname: { like: '%' + val + '%' } }, + { code: { like: `${val}%` } }, + ], + }; +}; const exprBuilder = (param, value) => { return { diff --git a/src/pages/Customer/CustomerFilter.vue b/src/pages/Customer/CustomerFilter.vue index 96f670542..c62ec7dbb 100644 --- a/src/pages/Customer/CustomerFilter.vue +++ b/src/pages/Customer/CustomerFilter.vue @@ -12,14 +12,17 @@ defineProps({ required: true, }, }); -const handleSalesModelValue = (val) => ({ - or: [ - { id: val }, - { name: val }, - { nickname: { like: '%' + val + '%' } }, - { code: { like: `${val}%` } }, - ], -}); +const handleSalesModelValue = (val) => { + if (!val) val = ''; + return { + or: [ + { id: val }, + { name: val }, + { nickname: { like: '%' + val + '%' } }, + { code: { like: `${val}%` } }, + ], + }; +}; const exprBuilder = (param, value) => { return {