Browse Source

!187 大屏设计图层栏定位问题以及图层上移下移置顶置底操作后的组件选中聚焦问题
Merge pull request !187 from JiangHH/dev

Foming 7 tháng trước cách đây
mục cha
commit
6a8f47e863

+ 10 - 0
report-ui/src/utils/screenMixins.js

@@ -9,6 +9,7 @@ const mixin = {
       uploadUrl: process.env.BASE_API + "/reportDashboard/import/" + this.$route.query.reportCode,
       revoke: null, //处理历史记录
       rightClickIndex: -1,
+      rightClickWidget: null,
     }
   },
   computed: {
@@ -249,6 +250,7 @@ const mixin = {
     // 右键
     rightClick(event, index) {
       this.rightClickIndex = index;
+      this.rightClickWidget = this.widgets[index];
       const left = event.clientX;
       const top = event.clientY;
       if (left || top) {
@@ -310,12 +312,16 @@ const mixin = {
         const temp = this.widgets.splice(this.rightClickIndex, 1)[0];
         this.widgets.push(temp);
       }
+      this.widgetIndex = this.widgets.indexOf(this.rightClickWidget);
+      this.widgetsClickFocus(this.widgetIndex);
     },
     // 置底
     setlowLayer() {
       if (this.rightClickIndex != 0) {
         this.widgets.unshift(this.widgets.splice(this.rightClickIndex, 1)[0]);
       }
+      this.widgetIndex = this.widgets.indexOf(this.rightClickWidget);
+      this.widgetsClickFocus(this.widgetIndex);
     },
     // 上移一层
     moveupLayer() {
@@ -328,6 +334,8 @@ const mixin = {
       } else {
         this.widgets.push(this.widgets.shift());
       }
+      this.widgetIndex = this.widgets.indexOf(this.rightClickWidget);
+      this.widgetsClickFocus(this.widgetIndex);
     },
     // 下移一层
     movedownLayer() {
@@ -340,6 +348,8 @@ const mixin = {
       } else {
         this.widgets.unshift(this.widgets.splice(this.rightClickIndex, 1)[0]);
       }
+      this.widgetIndex = this.widgets.indexOf(this.rightClickWidget);
+      this.widgetsClickFocus(this.widgetIndex);
     },
     //对齐
     alignment(align) {

+ 7 - 0
report-ui/src/views/bigscreenDesigner/designer/components/dynamicComponents.vue

@@ -150,6 +150,13 @@ export default {
       const chartProperties = this.deepClone(val.chartProperties);
       this.chartProperties = chartProperties;
       if (this.userNameList.length > 0) {
+        for (let i = 0; i < this.userNameList.length; i++) {
+          const item = this.userNameList[i];
+          //处理默认值
+          if(item.paramName in val.contextData){
+            this.userNameList[i].sampleItem= val.contextData[item.paramName];
+          }
+        }
       }
       if (this.setParamList.length > 0) {
         for (let i = 0; i < this.setParamList.length; i++) {

+ 34 - 26
report-ui/src/views/bigscreenDesigner/designer/index.vue

@@ -681,36 +681,44 @@ export default {
       console.log("widgetsClick");
       //判断是否按住了Ctrl按钮,表示Ctrl多选
       let _this = this;
-      let eventWidget = event.currentTarget.__vue__.$parent;//vue3已经弃用__vue__
-      if(event.ctrlKey){ //Ctrl左键选中或者取消选中
-        if(this.selectedWidgets.includes(eventWidget)){
-          this.selectedWidgets = this.selectedWidgets.filter(w=> w!== eventWidget);
-          this.$refs.widgets.forEach(w=>{
-            if(eventWidget.value.widgetId === w.value.widgetId){
-              setTimeout(function (){
-                _this.$refs.widgets[index].$refs.draggable.setActive(false);
-                console.log("触发取消选中, eventWidget.value.widgetId = " + eventWidget.value.widgetId +", w.value.widgetId= "+ w.value.widgetId);
-              },200); //设置超时,防止效果被覆盖
-            }
-          })
+      let eventWidget = null;
+      if(event.currentTarget.__vue__ != null) { // //解决图层栏点击组件定位问题(批量移动改造导致的问题)
+        eventWidget = event.currentTarget.__vue__.$parent;//vue3已经弃用__vue__
+      }
+      if(eventWidget != null){
+        if(event.ctrlKey){ //Ctrl左键选中或者取消选中
+          if(this.selectedWidgets.includes(eventWidget)){
+            this.selectedWidgets = this.selectedWidgets.filter(w=> w!== eventWidget);
+            this.$refs.widgets.forEach(w=>{
+              if(eventWidget.value.widgetId === w.value.widgetId){
+                setTimeout(function (){
+                  _this.$refs.widgets[index].$refs.draggable.setActive(false);
+                  console.log("触发取消选中, eventWidget.value.widgetId = " + eventWidget.value.widgetId +", w.value.widgetId= "+ w.value.widgetId);
+                },200); //设置超时,防止效果被覆盖
+              }
+            })
+            return;
+          }
+          this.widgetsClickAndCtrl(event, index);
           return;
         }
-        this.widgetsClickAndCtrl(event, index);
-        return;
-      }
-      if(this.selectedWidgets.includes(eventWidget)){  //右键点击菜单的时候 , 批量拖拽的时候
-        this.openMulDrag = true;
-        this.moveWidgets = {};
-        for (let i = 0; i < this.$refs.widgets.length; i++) {
-          let widget = {
-            left: this.$refs.widgets[i].value.position.left,
-            top: this.$refs.widgets[i].value.position.top
-          };
-          this.moveWidgets[this.$refs.widgets[i].value.widgetId] = widget;
+        if(this.selectedWidgets.includes(eventWidget)){  //右键点击菜单的时候 , 批量拖拽的时候
+          this.openMulDrag = true;
+          this.moveWidgets = {};
+          for (let i = 0; i < this.$refs.widgets.length; i++) {
+            let widget = {
+              left: this.$refs.widgets[i].value.position.left,
+              top: this.$refs.widgets[i].value.position.top
+            };
+            this.moveWidgets[this.$refs.widgets[i].value.widgetId] = widget;
+          }
+          this.calculateMousePosition(event, true);
+          return;
         }
-        this.calculateMousePosition(event, true);
-        return;
       }
+      this.widgetsClickFocus(index);
+    },
+    widgetsClickFocus(index){
       this.selectedWidgets = []; //单选的时候需要清空
       this.selectedWidgets.push(this.$refs.widgets[index]); //确保第一个选中的组件添加到集合,不需要按住Ctrl键
       const draggableArr = this.$refs.widgets;