Merge pull request #6698 from dataease/pr@dev@feat_outerparams-adptor

feat(仪表板): 仪表板外部参数支持匹配过滤组件,兼容多选范围组件 #5891
This commit is contained in:
王嘉豪 2023-11-15 15:48:58 +08:00 committed by GitHub
commit 4b347a3f7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 13 deletions

View File

@ -472,10 +472,20 @@ const data = {
Object.keys(params).forEach(function(sourceInfo) {
// 获取外部参数的值 sourceInfo 是外部参数名称 支持数组传入
let paramValue = params[sourceInfo]
let paramValueStr = params[sourceInfo]
let operator = 'in'
if (paramValue && !Array.isArray(paramValue)) {
paramValue = [paramValue]
operator = 'eq'
} else if (paramValue && Array.isArray(paramValue)) {
paramValueStr = ''
paramValue.forEach((innerValue, index) => {
if (index === 0) {
paramValueStr = innerValue
} else {
paramValueStr = paramValueStr + ',' + innerValue
}
})
}
// 获取所有目标联动信息
const targetInfoList = trackInfo[sourceInfo] || []
@ -499,7 +509,7 @@ const data = {
currentFilters.push(condition)
}
if (element.type === 'custom' && element.id === targetViewId) { // 过滤组件处理
element.options.value = paramValue
element.options.value = paramValueStr
}
})
if (element.type === 'view') {

View File

@ -130,7 +130,7 @@
<div class="select-filed">
<el-select
v-model="targetViewInfo.targetFieldId"
:disabled="viewIdFieldArrayMap[targetViewInfo.targetViewId].length===1 && viewIdFieldArrayMap[targetViewInfo.targetViewId][0].id === 0"
:disabled="viewIdFieldArrayMap[targetViewInfo.targetViewId].length===1 && viewIdFieldArrayMap[targetViewInfo.targetViewId][0].id === 'empty'"
style="width: 100%"
size="mini"
:placeholder="$t('fu.search_bar.please_select')"
@ -190,8 +190,8 @@
round
@click="addOuterParamsField"
>{{
$t('panel.add_param_link_field')
}}
$t('panel.add_param_link_field')
}}
</el-button>
</el-row>
@ -240,12 +240,12 @@
</template>
<script>
import {detailList} from '@/api/panel/panelView'
import {mapState} from 'vuex'
import {queryWithPanelId, updateOuterParamsSet} from '@/api/panel/outerParams'
import {uuid} from 'vue-uuid'
import {deepCopy} from '@/components/canvas/utils/utils'
import {checkRepeat} from '@/utils/check'
import { detailList } from '@/api/panel/panelView'
import { mapState } from 'vuex'
import { queryWithPanelId, updateOuterParamsSet } from '@/api/panel/outerParams'
import { uuid } from 'vue-uuid'
import { deepCopy } from '@/components/canvas/utils/utils'
import { checkRepeat } from '@/utils/check'
export default {
name: 'OuterParamsSet',
@ -376,7 +376,7 @@ export default {
type: 'filter',
name: componentItem.options.attrs.title ? componentItem.options.attrs.title : '过滤组件'
})
this.viewIdFieldArrayMap[componentItem.id] = [{id: 0, name: this.$t('panel.filter_no_select')}]
this.viewIdFieldArrayMap[componentItem.id] = [{ id: 'empty', name: this.$t('panel.filter_no_select') }]
}
})
})
@ -408,8 +408,8 @@ export default {
}
},
viewInfoOnChange(targetViewInfo) {
if (this.viewIdFieldArrayMap[targetViewInfo.targetViewId].length === 1 && this.viewIdFieldArrayMap[targetViewInfo.targetViewId][0].id === 0) {
targetViewInfo.targetFieldId = 0
if (this.viewIdFieldArrayMap[targetViewInfo.targetViewId].length === 1 && this.viewIdFieldArrayMap[targetViewInfo.targetViewId][0].id === 'empty') {
targetViewInfo.targetFieldId = 'empty'
} else {
targetViewInfo.targetFieldId = null
}