fix(查询组件): 选择二级级联后无法更改字段

This commit is contained in:
dataeaseShu 2024-07-30 16:45:15 +08:00
parent d8ba3a9b9b
commit a3018a79cb
3 changed files with 24 additions and 16 deletions

View File

@ -74,11 +74,6 @@ const init = (cascadeMap: cascadeMap, arr) => {
deTypeMap.value = obj
listByDsIds(datasetMap.value.map(ele => ele.value.split('--')[0]))
.then(res => {
for (let i in res || {}) {
res[i] = res[i].filter(
ele => ele.deType === Object.values(cascadeMap).find(ele => ele.datasetId === i).deType
)
}
optionsMap.value = res
})
.finally(() => {
@ -248,13 +243,14 @@ defineExpose({
style="width: 300px"
>
<el-option
v-for="item in datasetMap"
:key="item.value"
:label="item.label"
:value="item.value"
v-for="itx in datasetMap"
:key="itx.value"
:label="itx.label"
:value="itx.value"
:disabled="
disabledDatasetId.includes(item.value) ||
(!!ele.datasetId && deTypeMap[ele.datasetId] !== item.deType)
(disabledDatasetId.includes(itx.value) &&
item.map(ele => ele.datasetId).includes(itx.value)) ||
(!!ele.datasetId && deTypeMap[ele.datasetId] !== itx.deType)
"
/>
</el-select>

View File

@ -792,6 +792,17 @@ const confirmClick = () => {
})
queryElement.value.propValue = []
nextTick(() => {
conditions.value.forEach(itx => {
cascadeArr.forEach(ele => {
ele.forEach(item => {
if (item.datasetId.split('--')[1] === itx.id && itx.defaultValueCheck) {
const val = itx.mapValue
item.selectValue = Array.isArray(val) ? [...val] : val
item.currentSelectValue = Array.isArray(val) ? [...val] : val
}
})
})
})
queryElement.value.cascade = cloneDeep(cascadeArr)
cascadeArr = []
queryElement.value.propValue = cloneDeep(conditions.value)
@ -1379,9 +1390,11 @@ defineExpose({
<el-checkbox :label="field.componentId"
><el-icon class="component-type">
<Icon :name="canvasViewInfo[field.componentId].type"></Icon> </el-icon
><span class="checkbox-name ellipsis">{{
canvasViewInfo[field.componentId].title
}}</span></el-checkbox
><span
:title="canvasViewInfo[field.componentId].title"
class="checkbox-name ellipsis"
>{{ canvasViewInfo[field.componentId].title }}</span
></el-checkbox
>
<span :title="field.name" class="dataset ellipsis">{{ field.name }}</span>
<el-select

View File

@ -115,9 +115,8 @@ const setCascadeValueBack = val => {
if (item.datasetId.split('--')[1] === config.value.id) {
if (props.isConfig) {
item.selectValue = Array.isArray(val) ? [...val] : val
} else {
item.currentSelectValue = Array.isArray(val) ? [...val] : val
}
item.currentSelectValue = Array.isArray(val) ? [...val] : val
}
})
})