Browse Source

优化报表组件拖拽

rsbi 3 years ago
parent
commit
6659578226
3 changed files with 23 additions and 7 deletions
  1. 3 2
      src/view/portal/LayoutLeft.vue
  2. 11 4
      src/view/portal/LayoutOptarea.vue
  3. 9 1
      src/view/portal/Utils.js

+ 3 - 2
src/view/portal/LayoutLeft.vue

@@ -37,6 +37,7 @@ import {baseUrl, ajax} from '@/common/biConfig'
 import $ from 'jquery'
 import "jstree";
 import "jstree/dist/themes/default/style.min.css";
+import * as utils from './Utils'
 
 export default {
   components:{
@@ -103,14 +104,14 @@ export default {
                         return false;
                     }
                     if(node.li_attr.tp == 'comp'){
-                        //resetWindows('min');
+                        utils.resetWindows('min');
                     }
                     return true;
                 },
                 stop:function(e){
                     var ref = $('#'+treeDiv).jstree(true),node = ref.get_node(this);
                     if(node.li_attr.tp == 'comp'){
-                        //resetWindows('max');
+                        utils.resetWindows('max');
                     }
                     $(".indicator").hide();
                 }

+ 11 - 4
src/view/portal/LayoutOptarea.vue

@@ -370,7 +370,7 @@ export default {
                   }
                 });
               }
-            ts.$nextTick(()=>ts.bindCompEvent(comp));
+             ts.$nextTick(()=>ts.bindAllCompsEvent());
          }
 
           $(".indicator").hide();
@@ -438,6 +438,11 @@ export default {
         }
       });
     },
+    bindAllCompsEvent(){
+      utils.findAllComps(this.pageInfo).forEach(e=>{
+        this.bindCompEvent(e)
+      });
+    },
     //绑定组件拖拽事件
     bindCompEvent(obj){
       let ts = this;
@@ -457,12 +462,12 @@ export default {
           return "<div class=\"vakata-dnd\"><span class=\"miconcancel glyphicon glyphicon-remove\"></span>"+id+"</div>";
         },
         start:function(e){
-          //resetWindows('min');
+         utils.resetWindows('min');
           //$(this).hide();
         },
         stop:function(e){
           $(".indicator").hide();
-          //resetWindows('max');
+          utils.resetWindows('max');
           //$(this).show();
         }
       });
@@ -479,8 +484,9 @@ export default {
           });
         },
         out:function(e, ui){
-          var source = ui.draggable[0];
           curTmpInfo.mouseOnDiv = false;
+          /**
+          var source = ui.draggable[0];
           var obj = $(this).parent();
           var last = obj.children().last();
           if(last.attr("id") ==  $(source).attr("id")){
@@ -501,6 +507,7 @@ export default {
               top:last.offset().top + last.height()
             });
           }	
+           */
         },
         drop:function(e, ui){
           //alert(ui); 

+ 9 - 1
src/view/portal/Utils.js

@@ -307,4 +307,12 @@ export const exportReport = (tp, reportId, paramViewForm, pageInfo)=>{
 	}
 	$("#expff #picinfo").val(strs);
 	$("#expff").submit().remove();
-  }
+  }
+
+  export const resetWindows = (tp)=>{
+	if(tp == 'min'){
+	  $("div.cctx").hide();
+	}else{
+	  $("div.cctx").show();
+	}
+}