From 1e21d6815720309c4efbc8980a02349e87027c80 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Tue, 23 Mar 2021 17:16:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BB=AA=E8=A1=A8=E6=9D=BF=E7=BC=96?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/utils/bus.js | 3 + .../src/views/panel/DrawingBoard/index.vue | 44 +++--- frontend/src/views/panel/ViewSelect/index.vue | 11 +- frontend/src/views/panel/edit/index.vue | 8 ++ frontend/src/views/panel/list/PanelList.vue | 1 + .../src/views/panel/list/PanelViewShow.vue | 130 ++---------------- 6 files changed, 60 insertions(+), 137 deletions(-) create mode 100644 frontend/src/utils/bus.js diff --git a/frontend/src/utils/bus.js b/frontend/src/utils/bus.js new file mode 100644 index 0000000000..13fea0b6fd --- /dev/null +++ b/frontend/src/utils/bus.js @@ -0,0 +1,3 @@ +import Vue from 'vue' +const bus = new Vue() +export default bus diff --git a/frontend/src/views/panel/DrawingBoard/index.vue b/frontend/src/views/panel/DrawingBoard/index.vue index fc75575d13..f4ab3f04c5 100644 --- a/frontend/src/views/panel/DrawingBoard/index.vue +++ b/frontend/src/views/panel/DrawingBoard/index.vue @@ -2,15 +2,15 @@
- + @@ -24,9 +24,9 @@ import { post, get } from '@/api/panel/panel' import ChartComponent from '@/views/chart/components/ChartComponent' import VueDragResizeRotate from '@/components/vue-drag-resize-rotate' import { uuid } from 'vue-uuid' - +import bus from '@/utils/bus' export default { - name: 'PanelViewShow', + name: 'DrawingBoard', components: { ChartComponent, VueDragResizeRotate }, data() { return { @@ -56,17 +56,27 @@ export default { this.panelDesign(newVal.id) } }, - created() { - // this.get(this.$store.state.chart.viewId); - }, + mounted() { const panelId = this.$store.state.panel.panelInfo.id if (panelId) { this.panelDesign(panelId) } + + bus.$on('panel-drawing-load', (panelId) => { + panelId && this.panelDesign(panelId) + }) + bus.$on('panel-view-add', (view) => { + view && this.panelViewAdd(view) + }) + bus.$on('panel-drawing-save', () => { + this.savePanel() + }) + bus.$on('panel-drawing-preview', () => { + this.preViewShow() + }) }, - activated() { - }, + methods: { // 加载公共组件 @@ -97,20 +107,12 @@ export default { } }) }, - // removeView(panelDesignId) { - // this.panelDetails.panelDesigns.forEach(function(panelDesign, index) { - // if (panelDesign.id === panelDesignId) { - // panelDesign.keepFlag = false - // } - // }) - // }, + newStyle(viewId, newStyleInfo) { this.$nextTick(() => { this.$refs[viewId][0].chartResize() }) this.panelInfo.preStyle = JSON.stringify(newStyleInfo) - console.log(viewId) - console.log(JSON.stringify(newStyleInfo)) }, // 左边往右边拖动时的事件 diff --git a/frontend/src/views/panel/ViewSelect/index.vue b/frontend/src/views/panel/ViewSelect/index.vue index a6f084c48e..327c01ed6b 100644 --- a/frontend/src/views/panel/ViewSelect/index.vue +++ b/frontend/src/views/panel/ViewSelect/index.vue @@ -33,6 +33,7 @@