From 3ec7bbaf6c7b24eb8b4d4c57ec9418f6580248da Mon Sep 17 00:00:00 2001
From: wangjiahao <1522128093@qq.com>
Date: Wed, 18 Sep 2024 18:46:42 +0800
Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=BB=84=E4=BB=B6=E4=BA=8B?=
=?UTF-8?q?=E4=BB=B6=E6=94=AF=E6=8C=81=E9=80=89=E6=8B=A9=E8=B7=B3=E8=BD=AC?=
=?UTF-8?q?=E6=96=B9=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../canvas/ComponentWrapper.vue | 26 +++++++++++++++++--
.../custom-component/common/CommonEvent.vue | 26 ++++++++++++++++++-
.../src/custom-component/component-list.ts | 3 ++-
core/core-frontend/src/utils/canvasUtils.ts | 2 ++
4 files changed, 53 insertions(+), 4 deletions(-)
diff --git a/core/core-frontend/src/components/data-visualization/canvas/ComponentWrapper.vue b/core/core-frontend/src/components/data-visualization/canvas/ComponentWrapper.vue
index c364cf8887..8924557af0 100644
--- a/core/core-frontend/src/components/data-visualization/canvas/ComponentWrapper.vue
+++ b/core/core-frontend/src/components/data-visualization/canvas/ComponentWrapper.vue
@@ -259,10 +259,22 @@ const onWrapperClick = e => {
dvMainStore.popAreaActiveSwitch()
})
} else if (config.value.events.type === 'jump') {
+ const url = config.value.events.jump.value
+ const jumpType = config.value.events.jump.type
try {
- window.open(config.value.events.jump.value, '_blank')
+ let newWindow
+ if ('newPop' === jumpType) {
+ window.open(
+ url,
+ '_blank',
+ 'width=800,height=600,left=200,top=100,toolbar=no,scrollbars=yes,resizable=yes,location=no'
+ )
+ } else {
+ newWindow = window.open(url, jumpType)
+ }
+ initOpenHandler(newWindow)
} catch (e) {
- console.info('Something wrong when try to jump: ' + config.value.events?.jump?.value)
+ console.warn(t('visualization.url_check_error') + ':' + url)
}
} else if (config.value.events.type === 'refreshDataV') {
useEmitt().emitter.emit('componentRefresh')
@@ -276,6 +288,16 @@ const onWrapperClick = e => {
}
}
+const openHandler = ref(null)
+const initOpenHandler = newWindow => {
+ if (openHandler?.value) {
+ const pm = {
+ methodName: 'initOpenHandler',
+ args: newWindow
+ }
+ openHandler.value.invokeMethod(pm)
+ }
+}
const deepScale = computed(() => scale.value / 100)
diff --git a/core/core-frontend/src/custom-component/common/CommonEvent.vue b/core/core-frontend/src/custom-component/common/CommonEvent.vue
index 765bef6aab..31b205e2fa 100644
--- a/core/core-frontend/src/custom-component/common/CommonEvent.vue
+++ b/core/core-frontend/src/custom-component/common/CommonEvent.vue
@@ -93,8 +93,32 @@ const onJumpValueChange = () => {
@change="onJumpValueChange"
/>
+
+
+ 新开页面
+ 当前页面
+ 弹窗页面
+
+
-
+
diff --git a/core/core-frontend/src/custom-component/component-list.ts b/core/core-frontend/src/custom-component/component-list.ts
index fe1f45713e..a5307e9ce2 100644
--- a/core/core-frontend/src/custom-component/component-list.ts
+++ b/core/core-frontend/src/custom-component/component-list.ts
@@ -33,7 +33,8 @@ export const BASE_EVENTS = {
{ key: 'refreshView', label: '刷新图表' }
],
jump: {
- value: 'https://'
+ value: 'https://',
+ type: '_blank'
},
download: {
value: true
diff --git a/core/core-frontend/src/utils/canvasUtils.ts b/core/core-frontend/src/utils/canvasUtils.ts
index 7ec1e6e9c0..65d0df006b 100644
--- a/core/core-frontend/src/utils/canvasUtils.ts
+++ b/core/core-frontend/src/utils/canvasUtils.ts
@@ -190,6 +190,8 @@ export function historyItemAdaptor(
componentItem.events.type !== 'displayChange'
? componentItem.events
: deepCopy(BASE_EVENTS)
+
+ componentItem.events['jump'].type = componentItem.events['jump'].type || '_blank'
componentItem['category'] = componentItem['category'] || 'base'
if (componentItem.component === 'DeTabs') {