fix(查询组件): 修复下拉树切换搜索bug

This commit is contained in:
dataeaseShu 2024-07-23 15:13:56 +08:00
parent f7c15bd281
commit 50d5b80129
2 changed files with 23 additions and 12 deletions

View File

@ -790,12 +790,15 @@ const confirmClick = () => {
: curComponent.value.multiple : curComponent.value.multiple
) )
}) })
queryElement.value.propValue = cloneDeep(conditions.value) queryElement.value.propValue = []
queryElement.value.cascade = cloneDeep(cascadeArr)
cascadeArr = []
snapshotStore.recordSnapshotCache()
nextTick(() => { nextTick(() => {
emits('queryData') queryElement.value.cascade = cloneDeep(cascadeArr)
cascadeArr = []
queryElement.value.propValue = cloneDeep(conditions.value)
snapshotStore.recordSnapshotCache()
nextTick(() => {
emits('queryData')
})
}) })
} }

View File

@ -147,11 +147,12 @@ watch(
}) })
} }
) )
const showWholePath = ref(false)
watch( watch(
() => config.value.multiple, () => config.value.multiple,
val => { val => {
if (!props.isConfig) return if (!props.isConfig) return
showWholePath.value = false
if (val) { if (val) {
treeValue.value = [] treeValue.value = []
} }
@ -162,6 +163,9 @@ watch(
treeValue.value = undefined treeValue.value = undefined
}) })
} }
nextTick(() => {
showWholePath.value = true
})
}) })
} }
) )
@ -191,6 +195,7 @@ const getTreeOption = debounce(() => {
}) })
.finally(() => { .finally(() => {
loading.value = false loading.value = false
showWholePath.value = true
}) })
}, 300) }, 300)
watch( watch(
@ -215,13 +220,13 @@ const selectStyle = computed(() => {
<el-tree-select <el-tree-select
v-model="treeValue" v-model="treeValue"
:data="treeOptionList" :data="treeOptionList"
v-if="multiple && !loading"
clearable clearable
v-if="multiple && !loading"
@change="handleValueChange" @change="handleValueChange"
:render-after-expand="false" :render-after-expand="false"
show-checkbox show-checkbox
showWholePath
collapse-tags collapse-tags
:showWholePath="showWholePath"
collapse-tags-tooltip collapse-tags-tooltip
key="multipleTree" key="multipleTree"
filterable filterable
@ -233,11 +238,11 @@ const selectStyle = computed(() => {
@change="handleValueChange" @change="handleValueChange"
:data="treeOptionList" :data="treeOptionList"
check-strictly check-strictly
showWholePath
clearable clearable
:render-after-expand="false" :render-after-expand="false"
v-else-if="!loading" v-else-if="!multiple && !loading"
key="singleTree" key="singleTree"
:showWholePath="showWholePath"
:style="selectStyle" :style="selectStyle"
filterable filterable
/> />
@ -245,7 +250,6 @@ const selectStyle = computed(() => {
v-model="fakeValue" v-model="fakeValue"
v-loading="loading" v-loading="loading"
:data="[]" :data="[]"
showWholePath
:render-after-expand="false" :render-after-expand="false"
v-else v-else
key="fakeTree" key="fakeTree"
@ -253,4 +257,8 @@ const selectStyle = computed(() => {
/> />
</template> </template>
<style lang="less" scoped></style> <style lang="less" scoped>
:deep(.ed-select-tags-wrapper) {
display: inline-flex !important;
}
</style>