From 6f9cd7fe15ab965a5d30c8ccff257e7b66486627 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 26 Aug 2024 12:47:05 +0200 Subject: [PATCH 1/4] fix: refs #7323 auto fill bic --- src/components/common/VnSelect.vue | 17 ++++++++++++++--- src/pages/Worker/WorkerCreate.vue | 23 ++++++++++++++++------- src/pages/Worker/WorkerList.vue | 23 ++++++++++++++++------- 3 files changed, 46 insertions(+), 17 deletions(-) diff --git a/src/components/common/VnSelect.vue b/src/components/common/VnSelect.vue index 63a3f088fa..420e977b98 100644 --- a/src/components/common/VnSelect.vue +++ b/src/components/common/VnSelect.vue @@ -73,6 +73,10 @@ const $props = defineProps({ type: Boolean, default: true, }, + params: { + type: Object, + default: null, + }, }); const { t } = useI18n(); @@ -153,9 +157,15 @@ async function fetchFilter(val) { ? optionValue.value : optionFilter.value ?? optionLabel.value); - const defaultWhere = $props.useLike - ? { [key]: { like: `%${val}%` } } - : { [key]: val }; + let defaultWhere = {}; + if ($props.filterOptions.length) { + defaultWhere = $props.filterOptions.reduce((obj, prop) => { + if (!obj.or) obj.or = []; + obj.or.push({ [prop]: { like: `%${val}%` } }); + return obj; + }, {}); + } else + defaultWhere = $props.useLike ? { [key]: { like: `%${val}%` } } : { [key]: val }; const where = { ...(val ? defaultWhere : {}), ...$props.where }; const fetchOptions = { where, include, limit }; if (fields) fetchOptions.fields = fields; @@ -205,6 +215,7 @@ function nullishToTrue(value) { :limit="limit" :sort-by="sortBy" :fields="fields" + :params="params" />