From 13b17e3b6eb1d1498c8458310cae350f2921a5f6 Mon Sep 17 00:00:00 2001 From: qianlishi <1432731663@qq.com> Date: Mon, 28 Jun 2021 17:58:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E5=B1=8F=20=E5=9B=BE=E5=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- report-ui/src/components/Dictionary/index.vue | 55 ++-- .../designer/form/customColorComponents.vue | 15 +- .../designer/form/dynamicComponents.vue | 246 ++++++++++-------- .../bigscreen/designer/form/dynamicForm.vue | 7 +- .../views/report/bigscreen/designer/index.vue | 61 +++-- 5 files changed, 220 insertions(+), 164 deletions(-) diff --git a/report-ui/src/components/Dictionary/index.vue b/report-ui/src/components/Dictionary/index.vue index 911775f2..4814d6f0 100644 --- a/report-ui/src/components/Dictionary/index.vue +++ b/report-ui/src/components/Dictionary/index.vue @@ -6,57 +6,68 @@ */ !--> diff --git a/report-ui/src/views/report/bigscreen/designer/form/dynamicForm.vue b/report-ui/src/views/report/bigscreen/designer/form/dynamicForm.vue index ddc80007..da137c85 100644 --- a/report-ui/src/views/report/bigscreen/designer/form/dynamicForm.vue +++ b/report-ui/src/views/report/bigscreen/designer/form/dynamicForm.vue @@ -104,6 +104,7 @@ 编辑 @@ -123,7 +125,7 @@ :bigscreen="{ bigscreenWidth, bigscreenHeight }" @onActivated="setOptionsOnClickWidget" @contextmenu.prevent.native="rightClick($event, index)" - @click.prevent.native="widgetsClick(index)" + @mousedown.prevent.native="widgetsClick(index)" /> @@ -197,6 +199,7 @@ export default { }, data() { return { + layerWidget: [], widgetTools: widgetTools, // 左侧工具栏的组件图标,将js变量加入到当前作用域 widthLeftForTools: 200, // 左侧工具栏宽度 widthLeftForToolsHideButton: 15, // 左侧工具栏折叠按钮宽度 @@ -292,13 +295,14 @@ export default { }, bigscreenHeightInWorkbench() { return this.getPXUnderScale(this.bigscreenHeight); - }, - layerWidget() { - const layerWidgetArr = []; - for (let i = 0; i < this.widgets.length; i++) { - layerWidgetArr.push(getToolByCode(this.widgets[i].type)); - } - return layerWidgetArr; + } + }, + watch: { + widgets: { + handler(val) { + this.handlerLayerWidget(val); + }, + deep: true } }, mounted() { @@ -310,6 +314,22 @@ export default { this.widgets = []; }, methods: { + handlerLayerWidget(val) { + const layerWidgetArr = []; + for (let i = 0; i < val.length; i++) { + console.log(getToolByCode(val[i].type)); + const obj = {}; + obj.icon = getToolByCode(val[i].type).icon; + const options = val[i].options["setup"]; + options.forEach(el => { + if (el.name == "layerName") { + obj.label = el.value; + } + }); + layerWidgetArr.push(obj); + } + this.layerWidget = layerWidgetArr; + }, async initEchartData() { const reportCode = this.$route.query.reportCode; const { code, data } = await detailDashboard(reportCode); @@ -512,7 +532,10 @@ export default { } return widgetJson; }, - + layerClick(index) { + this.widgetIndex = index; + this.widgetsClick(index); + }, // 如果是点击大屏设计器中的底层,加载大屏底层属性 setOptionsOnClickScreen() { this.screenCode = "screen"; @@ -523,6 +546,10 @@ export default { // 如果是点击某个组件,获取该组件的配置项 setOptionsOnClickWidget(obj) { + if (typeof obj == "number") { + this.widgetOptions = this.deepClone(this.widgets[obj]["options"]); + return; + } if (obj.index < 0 || obj.index >= this.widgets.length) { return; } @@ -536,7 +563,6 @@ export default { } } }); - console.log(this.widgets); }, widgetsClick(index) { const draggableArr = this.$refs.widgets; @@ -547,9 +573,9 @@ export default { this.$refs.widgets[i].$refs.draggable.setActive(false); } } + this.setOptionsOnClickWidget(index); }, handleMouseDown() { - console.log(1); const draggableArr = this.$refs.widgets; for (let i = 0; i < draggableArr.length; i++) { this.$refs.widgets[i].$refs.draggable.setActive(false); @@ -557,15 +583,6 @@ export default { }, // 将当前选中的组件,右侧属性值更新 widgetValueChanged(key, val) { - /* 更新指定 this.widgets 中第 this.widgetIndex 个组件的value - widgets: [{ - type: 'widget-text', - value: { - setup:{}, - data: {}, - position: {} - } - }]*/ if (this.screenCode == "screen") { this.dashboard = this.deepClone(val); } @@ -624,6 +641,10 @@ export default {