Merge pull request #12929 from dataease/pr@dev-v2_st

fix(查询组件): 查询组件级联的级联状态不能重置 #12885
This commit is contained in:
dataeaseShu 2024-10-28 11:01:03 +08:00 committed by GitHub
commit c7bba8592a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -441,6 +441,11 @@ const resetData = () => {
next.conditionValueS = next.defaultConditionValueS
next.conditionValueOperatorS = next.defaultConditionValueOperatorS
if (next.displayType === '22') {
next.numValueEnd = next.defaultNumValueEnd
next.numValueStart = next.defaultNumValueStart
}
if (!next.defaultValueCheck) {
next.defaultValue = next.multiple || +next.displayType === 7 ? [] : undefined
}
@ -450,6 +455,21 @@ const resetData = () => {
? [...next.defaultMapValue]
: next.defaultMapValue
}
;(props.element.cascade || []).forEach(ele => {
ele.forEach(item => {
const comId = item.datasetId.split('--')[1]
console.log('comId', comId)
if (next.id === comId) {
item.currentSelectValue = Array.isArray(next.selectValue)
? next.selectValue
: [next.selectValue]
useEmitt().emitter.emit(`${item.datasetId.split('--')[1]}-select`)
}
})
})
const keyList = Object.entries(next.checkedFieldsMap)
.filter(ele => next.checkedFields.includes(ele[0]))
.filter(ele => !!ele[1])
@ -461,6 +481,14 @@ const resetData = () => {
}
const clearData = () => {
;(props.element.cascade || []).forEach(ele => {
ele.forEach(item => {
if (item.currentSelectValue?.length) {
useEmitt().emitter.emit(`${item.datasetId.split('--')[1]}-select`)
item.currentSelectValue = []
}
})
})
;(list.value || []).reduce((pre, next) => {
next.selectValue = next.multiple || +next.displayType === 7 ? [] : undefined
if (next.optionValueSource === 1 && next.defaultMapValue?.length) {
@ -468,6 +496,11 @@ const clearData = () => {
}
next.conditionValueF = ''
next.conditionValueS = ''
if (next.displayType === '22') {
next.numValueEnd = undefined
next.numValueStart = undefined
}
const keyList = Object.entries(next.checkedFieldsMap)
.filter(ele => next.checkedFields.includes(ele[0]))
.filter(ele => !!ele[1])