fix(仪表板): 删除过滤规则没有对数据进行更新

This commit is contained in:
dataeaseShu
2025-06-20 17:27:12 +08:00
committed by dataeaseShu
parent 66a1251852
commit 66d9da3fc6
3 changed files with 38 additions and 4 deletions

View File

@@ -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')
}

View File

@@ -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"
></QueryConditionConfiguration>
</Teleport>
</template>

View File

@@ -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')
})
})