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

fix(仪表板): 过滤组件下拉树切换时间字段显示异常
This commit is contained in:
dataeaseShu 2024-07-16 17:51:02 +08:00 committed by GitHub
commit 47e0f43c82
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -245,11 +245,10 @@ const setTreeDefault = () => {
}) })
if (checkId && tableId) { if (checkId && tableId) {
const componentObj = fields.value.find(ele => ele.componentId === comId) const componentObj = fields.value.find(ele => ele.componentId === comId)
const fieldArr = ( const fieldArr =
curComponent.value.optionValueSource === 0 curComponent.value.optionValueSource === 0
? componentObj?.fields?.dimensionList ? componentObj?.fields?.dimensionList
: curComponent.value.dataset?.fields : (fields.value.find(itx => itx.id === tableId) || {}).fields?.dimensionList
).filter(ele => ele.deType === +curComponent.value.field.deType)
fields.value.forEach(ele => { fields.value.forEach(ele => {
if (curComponent.value.checkedFields.includes(ele.componentId)) { if (curComponent.value.checkedFields.includes(ele.componentId)) {
if (datasetFieldList.value.find(itx => itx.id === ele.componentId)?.tableId === tableId) { if (datasetFieldList.value.find(itx => itx.id === ele.componentId)?.tableId === tableId) {
@ -258,12 +257,14 @@ const setTreeDefault = () => {
} }
}) })
const fieldObj = fieldArr.find(element => element.id === checkId) const fieldObj = fieldArr.find(element => element.id === checkId)
console.log(fieldObj, 'fieldObj', fieldArr, checkId)
if (!!curComponent.value.treeFieldList.length) { if (!!curComponent.value.treeFieldList.length) {
const [fir] = curComponent.value.treeFieldList const [fir] = curComponent.value.treeFieldList
if (fir.field !== checkId) { if (fir && fir.field !== checkId) {
curComponent.value.treeFieldList = [fieldObj] curComponent.value.treeFieldList = [fieldObj]
} }
} else { } else if (fieldObj) {
curComponent.value.treeFieldList = [fieldObj] curComponent.value.treeFieldList = [fieldObj]
} }
} }
@ -1484,7 +1485,10 @@ defineExpose({
value="8" value="8"
/> />
<el-option <el-option
:disabled="!['0', '8', '9'].includes(curComponent.displayType)" :disabled="
!['0', '8', '9'].includes(curComponent.displayType) ||
!!curComponent.parameters.length
"
label="下拉树" label="下拉树"
value="9" value="9"
/> />