From 60f56c909c68096191061db4a7c658fb12436fee Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Wed, 10 Apr 2024 10:14:48 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=85=8D=E7=BD=AE=E9=A1=B9=EF=BC=8C=E4=B8=8B=E9=92=BB?= =?UTF-8?q?=E5=92=8C=E8=81=94=E5=8A=A8=E5=8F=AF=E5=90=8C=E6=97=B6=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=20#8701?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/visualization/LinkageSet.vue | 13 +++- .../visualization/LinkageSetOption.vue | 59 +++++++++++++++++++ .../src/custom-component/component-list.ts | 5 ++ core/core-frontend/src/utils/canvasUtils.ts | 5 ++ 4 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 core/core-frontend/src/components/visualization/LinkageSetOption.vue diff --git a/core/core-frontend/src/components/visualization/LinkageSet.vue b/core/core-frontend/src/components/visualization/LinkageSet.vue index 38ef3e2788..77dd692e3b 100644 --- a/core/core-frontend/src/components/visualization/LinkageSet.vue +++ b/core/core-frontend/src/components/visualization/LinkageSet.vue @@ -8,6 +8,10 @@ top="10vh" trigger="click" > +
@@ -198,8 +202,11 @@ import { import { getDatasetDetails } from '@/api/dataset' import { findAllViewsId } from '@/utils/canvasUtils' import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot' +import LinkageSetOption from '@/components/visualization/LinkageSetOption.vue' +import { deepCopy } from '@/utils/utils' +import { ACTION_SELECTION } from '@/custom-component/component-list' const dvMainStore = dvMainStoreWithOut() -const { dvInfo, canvasViewInfo, componentData } = storeToRefs(dvMainStore) +const { dvInfo, canvasViewInfo, componentData, curComponent } = storeToRefs(dvMainStore) const linkageInfoTree = ref(null) const { t } = useI18n() const dialogShow = ref(false) @@ -221,6 +228,8 @@ const state = reactive({ linkageInfo: null }) +const customLinkageActive = ref(deepCopy(ACTION_SELECTION)) + const dialogInit = viewItem => { state.showSelected = false dialogShow.value = true @@ -277,6 +286,7 @@ const init = viewItem => { state.curDatasetInfo = res || {} }) } + customLinkageActive.value = curComponent.value.actionSelection linkageSetting(state.viewId) } @@ -314,6 +324,7 @@ const saveLinkageSetting = () => { loading.value = true saveLinkage(request) .then(() => { + curComponent.value.actionSelection.linkageActive = customLinkageActive.value.linkageActive snapshotStore.recordSnapshotCache() ElMessage.success('保存成功') // 刷新联动信息 diff --git a/core/core-frontend/src/components/visualization/LinkageSetOption.vue b/core/core-frontend/src/components/visualization/LinkageSetOption.vue new file mode 100644 index 0000000000..c96b9ce83c --- /dev/null +++ b/core/core-frontend/src/components/visualization/LinkageSetOption.vue @@ -0,0 +1,59 @@ + + + + diff --git a/core/core-frontend/src/custom-component/component-list.ts b/core/core-frontend/src/custom-component/component-list.ts index 823b5647c2..fc47aca5f6 100644 --- a/core/core-frontend/src/custom-component/component-list.ts +++ b/core/core-frontend/src/custom-component/component-list.ts @@ -30,6 +30,10 @@ export const defaultStyleValue = { headFontActiveColor: '#000000' } +export const ACTION_SELECTION = { + linkageActive: 'custom' +} + export const COMMON_COMPONENT_BACKGROUND_BASE = { backgroundColorSelect: true, backgroundImageEnable: false, @@ -134,6 +138,7 @@ const list = [ innerType: 'bar', editing: false, canvasActive: false, + actionSelection: ACTION_SELECTION, x: 1, y: 1, sizeX: 18, diff --git a/core/core-frontend/src/utils/canvasUtils.ts b/core/core-frontend/src/utils/canvasUtils.ts index 1857783079..75b88ad309 100644 --- a/core/core-frontend/src/utils/canvasUtils.ts +++ b/core/core-frontend/src/utils/canvasUtils.ts @@ -1,5 +1,6 @@ import { cloneDeep } from 'lodash-es' import componentList, { + ACTION_SELECTION, COMMON_COMPONENT_BACKGROUND_DARK, COMMON_COMPONENT_BACKGROUND_LIGHT } from '@/custom-component/component-list' @@ -16,6 +17,7 @@ import { getPanelAllLinkageInfo } from '@/api/visualization/linkage' import { queryVisualizationJumpInfo } from '@/api/visualization/linkJump' import { getViewConfig } from '@/views/chart/components/editor/util/chart' import { snapshotStoreWithOut } from '@/store/modules/data-visualization/snapshot' +import { deepCopy } from '@/utils/utils' const dvMainStore = dvMainStoreWithOut() const { curBatchOptComponents, dvInfo, canvasStyleData, componentData, canvasViewInfo } = storeToRefs(dvMainStore) @@ -118,6 +120,9 @@ export function initCanvasDataPrepare(dvId, busiFlag, callBack) { } componentItem['maintainRadio'] = componentItem['maintainRadio'] || false componentItem['aspectRatio'] = componentItem['aspectRatio'] || 1 + if (componentItem.component === 'UserView') { + componentItem.actionSelection = componentItem.actionSelection || deepCopy(ACTION_SELECTION) + } }) const curPreviewGap = dvInfo.type === 'dashboard' && canvasStyleResult['dashboard'].gap === 'yes'