From f1afd92d35e2064fe1381c58b4b387be2ed5ab0e Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Wed, 17 Apr 2024 11:14:36 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E6=A1=86=E6=94=AF=E6=8C=81=E6=98=BE=E7=A4=BA=E5=80=BC?= =?UTF-8?q?=E5=92=8C=E7=BB=91=E5=AE=9A=E5=80=BC=20#7343?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom-component/v-query/Component.vue | 50 ++++++++++++++++++- .../v-query/QueryConditionConfiguration.vue | 1 + .../src/custom-component/v-query/Select.vue | 41 +++++++++++++-- .../src/custom-component/v-query/options.ts | 1 + core/core-frontend/src/hooks/web/useFilter.ts | 11 ++-- 5 files changed, 96 insertions(+), 8 deletions(-) diff --git a/core/core-frontend/src/custom-component/v-query/Component.vue b/core/core-frontend/src/custom-component/v-query/Component.vue index 23e3b86535..74c6ce67bb 100644 --- a/core/core-frontend/src/custom-component/v-query/Component.vue +++ b/core/core-frontend/src/custom-component/v-query/Component.vue @@ -13,7 +13,10 @@ import { watch, computed, onMounted, - CSSProperties + onBeforeMount, + CSSProperties, + shallowRef, + provide } from 'vue' import { storeToRefs } from 'pinia' import { useI18n } from '@/hooks/web/useI18n' @@ -156,7 +159,52 @@ const onComponentClick = () => { } const { emitter } = useEmitt() +const unMountSelect = shallowRef([]) +onBeforeMount(() => { + unMountSelect.value = list.value.map(ele => ele.id) +}) +const releaseSelect = id => { + unMountSelect.value = unMountSelect.value.filter(ele => ele !== id) +} + +const queryDataForId = id => { + let requiredName = '' + const emitterList = (element.value.propValue || []) + .filter(ele => ele.id === id) + .reduce((pre, next) => { + if (next.required) { + if (!next.defaultValueCheck) { + requiredName = next.name + } + + if ( + (Array.isArray(next.selectValue) && !next.selectValue.length) || + (next.selectValue !== 0 && !next.selectValue) + ) { + requiredName = next.name + } + } + const keyList = Object.entries(next.checkedFieldsMap) + .filter(ele => next.checkedFields.includes(ele[0])) + .filter(ele => !!ele[1]) + .map(ele => ele[0]) + pre = [...new Set([...keyList, ...pre])] + return pre + }, []) + if (!!requiredName) { + ElMessage.error(`【${requiredName}】查询条件是必填项,请设置选项值后,再进行查询!`) + return + } + if (!emitterList.length) return + emitterList.forEach(ele => { + emitter.emit(`query-data-${ele}`) + }) +} + +provide('unmount-select', unMountSelect) +provide('release-unmount-select', releaseSelect) +provide('query-data-for-id', queryDataForId) onBeforeUnmount(() => { emitter.off(`addQueryCriteria${element.value.id}`) emitter.off(`editQueryCriteria${element.value.id}`) diff --git a/core/core-frontend/src/custom-component/v-query/QueryConditionConfiguration.vue b/core/core-frontend/src/custom-component/v-query/QueryConditionConfiguration.vue index 03e5b1a53d..2e12e7e5ed 100644 --- a/core/core-frontend/src/custom-component/v-query/QueryConditionConfiguration.vue +++ b/core/core-frontend/src/custom-component/v-query/QueryConditionConfiguration.vue @@ -675,6 +675,7 @@ const parameterCompletion = () => { timeType: 'fixed', required: false, defaultMapValue: [], + mapValue: [], parametersStart: null, conditionType: 0, conditionValueOperatorF: 'eq', diff --git a/core/core-frontend/src/custom-component/v-query/Select.vue b/core/core-frontend/src/custom-component/v-query/Select.vue index dededc3fcb..7b447292dc 100644 --- a/core/core-frontend/src/custom-component/v-query/Select.vue +++ b/core/core-frontend/src/custom-component/v-query/Select.vue @@ -1,11 +1,23 @@