refactor(数据大屏): 优化新建组件主题适配问题

This commit is contained in:
wangjiahao 2024-06-14 14:11:42 +08:00
parent ec31351791
commit ca02042b94
3 changed files with 7 additions and 5 deletions

View File

@ -115,10 +115,10 @@ export const copyStore = defineStore('copy', {
newComponent.canvasId = 'canvas-main' newComponent.canvasId = 'canvas-main'
} }
dvMainStore.addCopyComponent(newComponent, idMap, copyDataTemp.copyCanvasViewInfo) dvMainStore.addCopyComponent(newComponent, idMap, copyDataTemp.copyCanvasViewInfo)
if (dvMainStore.multiplexingStyleAdapt && copyDataTemp.copyFrom === 'multiplexing') {
adaptCurThemeCommonStyle(newComponent)
}
if (dvInfo.value.type === 'dashboard') { if (dvInfo.value.type === 'dashboard') {
if (dvMainStore.multiplexingStyleAdapt && copyDataTemp.copyFrom === 'multiplexing') {
adaptCurThemeCommonStyle(newComponent)
}
eventBus.emit('addDashboardItem-' + newComponent.canvasId, newComponent) eventBus.emit('addDashboardItem-' + newComponent.canvasId, newComponent)
} }
if (i === dataArray.length - 1) { if (i === dataArray.length - 1) {

View File

@ -164,7 +164,7 @@ const menuList = computed(() => {
}) })
const dvId = embeddedStore.dvId || router.currentRoute.value.query.dvId const dvId = embeddedStore.dvId || router.currentRoute.value.query.dvId
if (dvId) { if (dvId && showPosition.value === 'preview') {
selectedNodeKey.value = dvId selectedNodeKey.value = dvId
returnMounted.value = true returnMounted.value = true
} }

View File

@ -2,6 +2,7 @@
import { computed, nextTick, onBeforeMount, reactive, ref, toRefs, watch } from 'vue' import { computed, nextTick, onBeforeMount, reactive, ref, toRefs, watch } from 'vue'
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain' import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
import { getCanvasStyle } from '@/utils/style' import { getCanvasStyle } from '@/utils/style'
import EmptyBackground from '../../components/empty-background/src/EmptyBackground.vue'
const dvMainStore = dvMainStoreWithOut() const dvMainStore = dvMainStoreWithOut()
const viewShow = ref(true) const viewShow = ref(true)
@ -138,7 +139,7 @@ onBeforeMount(() => {
class="custom-tree" class="custom-tree"
menu menu
ref="multiplexInfoTree" ref="multiplexInfoTree"
:empty-text="'暂无可用图表'" :empty-text="'暂无可用组件'"
:filter-node-method="filterNodeMethod" :filter-node-method="filterNodeMethod"
:data="curMultiplexTargetComponentsInfo" :data="curMultiplexTargetComponentsInfo"
node-key="targetViewId" node-key="targetViewId"
@ -184,6 +185,7 @@ onBeforeMount(() => {
:dv-info="dvInfo" :dv-info="dvInfo"
:canvas-view-info="canvasViewInfo" :canvas-view-info="canvasViewInfo"
/> />
<empty-background v-else description="当前未选择组件" img-type="select" />
</div> </div>
</div> </div>
</el-col> </el-col>