Merge pull request #6750 from dataease/pr@dev-v2@refactor_view-manage

refactor: 仪表板、数据大屏中的图表联动字段使用图表制作中参与的字段
This commit is contained in:
王嘉豪 2023-11-17 17:27:30 +08:00 committed by GitHub
commit 0d2d245653
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -101,7 +101,7 @@
style="width: 100%"
>
<el-option
v-for="item in state.sourceLinkageInfo.targetViewFields"
v-for="item in sourceLinkageInfoFilter"
:key="item.id"
:label="item.name"
:value="item.id"
@ -184,7 +184,7 @@
<script lang="ts" setup>
import { queryVisualizationJumpInfo } from '@/api/visualization/linkJump'
import { reactive, ref, nextTick, watch } from 'vue'
import { reactive, ref, nextTick, watch, computed } from 'vue'
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { storeToRefs } from 'pinia'
import { ElMessage } from 'element-plus-secondary'
@ -379,6 +379,22 @@ const linkageFieldAdaptor = async data => {
}
}
}
const sourceLinkageInfoFilter = computed(() => {
if (state.sourceLinkageInfo.targetViewFields) {
const curCheckAllAxisStr =
JSON.stringify(state.curLinkageViewInfo.xAxis) +
JSON.stringify(state.curLinkageViewInfo.xAxisExt) +
JSON.stringify(state.curLinkageViewInfo.yAxis) +
JSON.stringify(state.curLinkageViewInfo.yAxisExt)
return state.sourceLinkageInfo.targetViewFields.filter(item =>
curCheckAllAxisStr.includes(item.id)
)
} else {
return []
}
})
const targetViewCheckedChange = data => {
nextTick(() => {
linkageInfoTree.value.setCurrentKey(data.targetViewId)