From ff7495d5f28158d236ea3b4604547ca4c8a704a7 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Fri, 27 May 2022 10:52:49 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BB=AA=E8=A1=A8=E6=9D=BF?= =?UTF-8?q?=E6=9C=AA=E5=8F=91=E5=B8=83=E7=8A=B6=E6=80=81=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../canvas/components/Editor/Preview.vue | 11 +++++++---- .../canvas/components/Editor/PreviewEject.vue | 4 ++++ .../canvas/components/Editor/PreviewFullScreen.vue | 4 ++++ frontend/src/views/link/view/index.vue | 9 ++++++--- .../src/views/panel/ViewSelect/multiplexing.vue | 14 +++++++++++++- frontend/src/views/panel/list/PanelViewShow.vue | 1 + 6 files changed, 35 insertions(+), 8 deletions(-) diff --git a/frontend/src/components/canvas/components/Editor/Preview.vue b/frontend/src/components/canvas/components/Editor/Preview.vue index d77573d5dd..517ca5e989 100644 --- a/frontend/src/components/canvas/components/Editor/Preview.vue +++ b/frontend/src/components/canvas/components/Editor/Preview.vue @@ -136,6 +136,10 @@ export default { type: String, required: false, default: 'NotProvided' + }, + panelInfo: { + type: Object, + required: true } }, data() { @@ -176,15 +180,14 @@ export default { }, showUnpublishedArea() { // return this.panelInfo.status === 'unpublished' - if (this.mainActiveName === 'PanelMain' && this.activeTab === 'PanelList') { + if (this.panelInfo && this.panelInfo.showType === 'view') { + return false + } else if ((this.mainActiveName === 'PanelMain' && this.activeTab === 'PanelList') || this.showPosition.includes('multiplexing')) { return this.panelInfo.status === 'unpublished' && !hasDataPermission('manage', this.panelInfo.privileges) } else { return this.panelInfo.status === 'unpublished' } }, - panelInfo() { - return this.$store.state.panel.panelInfo - }, showExportImgButton() { return this.showChartInfo.type && !this.showChartInfo.type.includes('table') }, diff --git a/frontend/src/components/canvas/components/Editor/PreviewEject.vue b/frontend/src/components/canvas/components/Editor/PreviewEject.vue index ab88eb1466..8b8e0ba301 100644 --- a/frontend/src/components/canvas/components/Editor/PreviewEject.vue +++ b/frontend/src/components/canvas/components/Editor/PreviewEject.vue @@ -5,6 +5,7 @@ :component-data="componentData" :canvas-style-data="canvasStyleData" :back-screen-shot="backScreenShot" + :panel-info="panelInfo" @mainHeightChange="mainHeightChange" /> @@ -36,6 +37,9 @@ export default { return { height: '100vh!important' } } }, + panelInfo() { + return this.$store.state.panel.panelInfo + }, ...mapState([ 'canvasStyleData', 'componentData' diff --git a/frontend/src/components/canvas/components/Editor/PreviewFullScreen.vue b/frontend/src/components/canvas/components/Editor/PreviewFullScreen.vue index e209e01746..565c5e322d 100644 --- a/frontend/src/components/canvas/components/Editor/PreviewFullScreen.vue +++ b/frontend/src/components/canvas/components/Editor/PreviewFullScreen.vue @@ -5,6 +5,7 @@ v-if="fullscreen" :component-data="componentData" :canvas-style-data="canvasStyleData" + :panel-info="panelInfo" :in-screen="!fullscreen" /> @@ -20,6 +21,9 @@ import { mapState } from 'vuex' export default { components: { Preview }, computed: { + panelInfo() { + return this.$store.state.panel.panelInfo + }, ...mapState([ 'canvasStyleData', 'componentData' diff --git a/frontend/src/views/link/view/index.vue b/frontend/src/views/link/view/index.vue index 2e4abe6614..188efc2e51 100644 --- a/frontend/src/views/link/view/index.vue +++ b/frontend/src/views/link/view/index.vue @@ -4,6 +4,7 @@ v-if="show" :component-data="componentData" :canvas-style-data="canvasStyleData" + :panel-info="panelInfo" /> @@ -33,7 +34,8 @@ export default { }, data() { return { - show: false + show: false, + panelInfo: {} } }, computed: { @@ -51,12 +53,13 @@ export default { loadResource(this.resourceId).then(res => { this.show = false let loadingCount = 0 - this.$store.dispatch('panel/setPanelInfo', { + this.panelInfo = { id: res.data.id, name: res.data.name, privileges: res.data.privileges, status: res.data.status - }) + } + this.$store.dispatch('panel/setPanelInfo', panelInfo) panelInit(JSON.parse(res.data.panelData), JSON.parse(res.data.panelStyle)) // 设置浏览器title为当前仪表板名称 diff --git a/frontend/src/views/panel/ViewSelect/multiplexing.vue b/frontend/src/views/panel/ViewSelect/multiplexing.vue index b4e2f097ec..b328154464 100644 --- a/frontend/src/views/panel/ViewSelect/multiplexing.vue +++ b/frontend/src/views/panel/ViewSelect/multiplexing.vue @@ -11,6 +11,7 @@ v-if="selectedPanel" :component-data="componentData" :canvas-style-data="canvasStyleData" + :panel-info="panelInfo" :show-position="showPosition" /> @@ -54,7 +55,8 @@ export default { msgPanelIds: null, componentData: [], canvasStyleData: {}, - selectedPanel: null + selectedPanel: null, + panelInfo: {} } }, watch: { @@ -73,6 +75,13 @@ export default { _this.panelLoading = true findOne(params.showId).then(response => { _this.panelLoading = false + this.panelInfo = { + id: response.data.id, + name: response.data.name, + privileges: response.data.privileges, + sourcePanelName: response.data.sourcePanelName, + status: response.data.status + } panelDataPrepare(JSON.parse(response.data.panelData), JSON.parse(response.data.panelStyle), function(rsp) { _this.componentData = rsp.componentData _this.canvasStyleData = rsp.componentStyle @@ -94,6 +103,9 @@ export default { 'viewId': params.showId, 'id': componentId } + this.panelInfo = { + 'showType': 'view' + } _this.$nextTick(() => { _this.componentData.push(userView) _this.selectedPanel = params diff --git a/frontend/src/views/panel/list/PanelViewShow.vue b/frontend/src/views/panel/list/PanelViewShow.vue index 58bd436229..045d58e99f 100644 --- a/frontend/src/views/panel/list/PanelViewShow.vue +++ b/frontend/src/views/panel/list/PanelViewShow.vue @@ -97,6 +97,7 @@ :active-tab="activeTab" :in-screen="!fullscreen" :show-type="'width'" + :panel-info="panelInfo" :screen-shot="dataLoading" />