diff --git a/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue b/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue index 4cbcb52e6f..52de4496e4 100644 --- a/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue +++ b/core/core-frontend/src/components/data-visualization/canvas/CanvasCore.vue @@ -920,9 +920,11 @@ function removeItemComponent(item) { }) } if (!!checkedFields.length) { - Array.from(new Set(checkedFields)).forEach(ele => { - emitter.emit(`query-data-${ele}`) - }) + setTimeout(() => { + Array.from(new Set(checkedFields)).forEach(ele => { + emitter.emit(`query-data-${ele}`) + }) + }, 300) } snapshotStore.recordSnapshotCache('removeItem') } 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 d56fd107bb..540eb110d9 100644 --- a/core/core-frontend/src/custom-component/v-query/Component.vue +++ b/core/core-frontend/src/custom-component/v-query/Component.vue @@ -16,6 +16,7 @@ import { reactive, ref, toRefs, + unref, watch, computed, onMounted, @@ -593,10 +594,27 @@ const addCriteriaConfigOut = () => { queryConfig.value.setConditionOut() } +const reRenderAll = (oldArr, newArr) => { + const newArrIds = newArr.map(ele => ele.id) + const emitterList = (oldArr || []).reduce((pre, next) => { + if (newArrIds.includes(next.id)) return pre + const keyList = getKeyList(next) + pre = [...new Set([...keyList, ...pre])] + return pre + }, []) + if (!emitterList.length) return + emitterList.forEach(ele => { + console.log('`query-data-${ele}`', `query-data-${ele}`) + emitter.emit(`query-data-${ele}`) + }) +} + const delQueryConfig = index => { + const com = cloneDeep(unref(list)) list.value.splice(index, 1) element.value.propValue = [...list.value] snapshotStore.recordSnapshotCache('delQueryConfig') + reRenderAll(com, cloneDeep(unref(list))) } const resetData = () => { @@ -939,6 +957,7 @@ const autoStyle = computed(() => { :query-element="element" @queryData="queryData" ref="queryConfig" + @reRenderAll="reRenderAll" > 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 bd2577d17b..97df2583b4 100644 --- a/core/core-frontend/src/custom-component/v-query/QueryConditionConfiguration.vue +++ b/core/core-frontend/src/custom-component/v-query/QueryConditionConfiguration.vue @@ -1441,6 +1441,17 @@ const validate = () => { } } + if (ele.displayType === '2') { + if (!ele.defaultValueCheck) return false + if ( + (Array.isArray(ele.defaultValue) && !ele.defaultValue.length) || + (!Array.isArray(ele.defaultValue) && isNaN(ele.defaultValue)) + ) { + ElMessage.error(t('v_query.cannot_be_empty_de')) + return true + } + } + if (+ele.displayType === 7) { if (!ele.defaultValueCheck) return false if (ele.timeType === 'fixed') { @@ -1544,7 +1555,7 @@ const handleBeforeClose = () => { relationshipChartIndex.value = 0 dialogVisible.value = false } -const emits = defineEmits(['queryData']) +const emits = defineEmits(['queryData', 'reRenderAll']) const confirmClick = () => { if (validate()) return defaultConfigurationRef.value?.mult() @@ -1559,6 +1570,7 @@ const confirmClick = () => { : curComponent.value.multiple ) }) + const oldArr = cloneDeep(unref(queryElement.value.propValue)) queryElement.value.propValue = [] nextTick(() => { conditions.value.forEach(itx => { @@ -1579,6 +1591,7 @@ const confirmClick = () => { curComponent.value.id = '' relationshipChartIndex.value = 0 nextTick(() => { + emits('reRenderAll', oldArr, cloneDeep(unref(conditions))) emits('queryData') }) })