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 deTypeMap.value = obj
listByDsIds(datasetMap.value.map(ele => ele.value.split('--')[0])) listByDsIds(datasetMap.value.map(ele => ele.value.split('--')[0]))
.then(res => { .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 optionsMap.value = res
}) })
.finally(() => { .finally(() => {
@ -248,13 +243,14 @@ defineExpose({
style="width: 300px" style="width: 300px"
> >
<el-option <el-option
v-for="item in datasetMap" v-for="itx in datasetMap"
:key="item.value" :key="itx.value"
:label="item.label" :label="itx.label"
:value="item.value" :value="itx.value"
:disabled=" :disabled="
disabledDatasetId.includes(item.value) || (disabledDatasetId.includes(itx.value) &&
(!!ele.datasetId && deTypeMap[ele.datasetId] !== item.deType) item.map(ele => ele.datasetId).includes(itx.value)) ||
(!!ele.datasetId && deTypeMap[ele.datasetId] !== itx.deType)
" "
/> />
</el-select> </el-select>

View File

@ -792,6 +792,17 @@ const confirmClick = () => {
}) })
queryElement.value.propValue = [] queryElement.value.propValue = []
nextTick(() => { 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) queryElement.value.cascade = cloneDeep(cascadeArr)
cascadeArr = [] cascadeArr = []
queryElement.value.propValue = cloneDeep(conditions.value) queryElement.value.propValue = cloneDeep(conditions.value)
@ -1379,9 +1390,11 @@ defineExpose({
<el-checkbox :label="field.componentId" <el-checkbox :label="field.componentId"
><el-icon class="component-type"> ><el-icon class="component-type">
<Icon :name="canvasViewInfo[field.componentId].type"></Icon> </el-icon <Icon :name="canvasViewInfo[field.componentId].type"></Icon> </el-icon
><span class="checkbox-name ellipsis">{{ ><span
canvasViewInfo[field.componentId].title :title="canvasViewInfo[field.componentId].title"
}}</span></el-checkbox class="checkbox-name ellipsis"
>{{ canvasViewInfo[field.componentId].title }}</span
></el-checkbox
> >
<span :title="field.name" class="dataset ellipsis">{{ field.name }}</span> <span :title="field.name" class="dataset ellipsis">{{ field.name }}</span>
<el-select <el-select

View File

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