浏览代码

前端功能优化

rsbi 3 年之前
父节点
当前提交
f725756c6a
共有 4 个文件被更改,包括 147 次插入72 次删除
  1. 58 4
      src/components/NavMenu.vue
  2. 6 2
      src/components/OperationDailog.vue
  3. 1 1
      src/view/Login.vue
  4. 82 65
      src/view/model/CubeAdd.vue

+ 58 - 4
src/components/NavMenu.vue

@@ -1,3 +1,8 @@
+<!--
+ * Copyright 2021 本系统版权归成都睿思商智科技有限公司所有
+ * 用户不能删除系统源码上的版权信息, 使用许可证地址:
+ * https://www.ruisitech.com/licenses/index.html
+ -->
 <template>
       <div class="tabpanel_tab_content">
             <div class="tabpanel_header">
@@ -20,8 +25,9 @@
                         <i class="fa fa-exchange"></i>
                         </span>
                         <el-dropdown-menu slot="dropdown">
-                            <!--
+                           
                         <el-dropdown-item command="flash">刷新当前页面</el-dropdown-item>
+                         <!--
                         <el-dropdown-item command="fullScreem">全屏当前页面</el-dropdown-item>
                         -->
                         <el-dropdown-item command="closeother">关闭其他页面</el-dropdown-item>
@@ -54,10 +60,14 @@ export default {
     };
   },
   mounted:function(){
-    
+    var ms = localStorage.getItem("menus");
+    if(ms){
+        this.menus = JSON.parse(ms);
+    }
   },
   methods: {
       gotab(pos){
+          /**
         var o = $(".tabpanel_mover");
         var left = Number(o.css("marginLeft").replace("px", ""));
         if(pos =='left'){
@@ -70,8 +80,20 @@ export default {
         }
         var size = $(".tabpanel_mover li").length;
         if(Math.abs(left/110) < size){
-            o.css("marginLeft", left+"px");
+            //o.css("marginLeft", left+"px");
+            //o.scrollLeft(size);
         }
+
+        //o.scrollLeft(300+"px");
+        console.log(o.scrollLeft());
+        **/
+        var left = $(".tabpanel_header").scrollLeft();
+        if(pos =='left'){
+            left = left + 110;
+        }else{
+            left = left - 110;
+        }
+        $(".tabpanel_header").scrollLeft(left);
       },
       menuAdd(menu){
           for(let m of this.menus){
@@ -92,7 +114,10 @@ export default {
                 active:"active",
                 closeBtn:true
             });
+            //滚动条移如最右边
+            this.$nextTick(()=>$(".tabpanel_header").scrollLeft(9999));
           }
+          this.cacheMenus();
       },
       closemenu(url){
           let ts = this;
@@ -101,12 +126,21 @@ export default {
                   if(b.active === 'active'){  //删除的刚好是active
                     let provNode = ts.menus[a - 1]; //前一个节点
                     provNode.active = 'active';
+                    
+                    //点击X按钮后,需要移除缓存的 路由对象
+                    if(b.url === '/etl/imp/DbImp' || b.url === '/etl/imp/CsvImp' || b.url === '/etl/imp/XlsImp'){
+                        var p = ts.$parent.clearPage;
+                        if(p.indexOf(b.url) < 0){
+                            p.push(b.url);
+                        }
+                    }                   
                     ts.$router.push(provNode.url);
                   }
                   ts.menus.splice(a, 1);
                   return false;
               }
           });
+          this.cacheMenus();
       },
       selectmenu(url){
           let ts = this;
@@ -116,10 +150,23 @@ export default {
           $(this.menus).each((a, b)=>{
               if(b.url === url){
                   b.active = "active";
+                  if(ts.$route.path === url){
+                      return false;
+                  }
                   ts.$router.push(url);
                   return false;
               }
           });
+          this.cacheMenus();
+      },
+      /**
+       * 更新菜单的url
+       */
+      chgMenuUrl(oldUrl, newUrl){
+          let u = this.menus.filter(m=>m.url.indexOf(oldUrl)>=0)[0];
+          if(u){
+            u.url = newUrl;
+          }
       },
        handleCommand(cmd){
            if(cmd === "closeother"){
@@ -135,6 +182,8 @@ export default {
                this.menus[0].active = "active";
                this.$router.push(this.menus[0].url);
            }else if(cmd === 'flash'){
+               location.reload();
+               /** 
                $(this.menus).each((a, b)=>{
                    if(b.active === 'active'){
                        //this.$router.go(0);
@@ -143,7 +192,12 @@ export default {
                        return false;
                    }
                });
+               */
            }
+           this.cacheMenus();
+       },
+       cacheMenus(){
+           localStorage.setItem("menus", JSON.stringify(this.menus));
        }
   },
 };
@@ -152,7 +206,7 @@ export default {
 <style lang="css">
 .tabpanel_header {
     width: calc(100% - 80px);
-    overflow: hidden;
+    overflow: auto;
     display: inline-block;
 }
 .btn-link {

+ 6 - 2
src/components/OperationDailog.vue

@@ -4,8 +4,9 @@
 <template>
   <div v-show="dailogShow">
     <div class="ibox" style="margin-bottom:0px;">
-        <div class="ibox-title">
-            {{title}}
+        <div class="ibox-title" style="height:33px;">
+            {{title}} &nbsp;
+            <button class="btn btn-outline btn-info btn-xs" @click="goback()"><i class="fa fa-chevron-left"></i>返回</button>
         </div>
         <div class="ibox-content" :style="autoHeight()" style="padding-bottom: 0px;overflow:auto;">
             <slot></slot>
@@ -68,6 +69,9 @@ export default {
         if(this.callback()){
             this.closeDailog();
         }
+    },
+     goback(){
+      this.closeDailog();
     }
   }
 }

文件差异内容过多而无法显示
+ 1 - 1
src/view/Login.vue


+ 82 - 65
src/view/model/CubeAdd.vue

@@ -287,7 +287,7 @@ export default {
           var dt = [];
           for(let i=0; i<tbs.length; i++){
             var ccld = [];
-            var nd = {id:tbs[i],text:tbs[i],icon:'fa fa-table', state:{opened:true}, children:ccld};
+            var nd = {id:tbs[i], li_attr:{istable:true},text:tbs[i],icon:'fa fa-table', state:{opened:true}, children:ccld};
             dt.push(nd);
             var cols = findcols(tbs[i]);
             for(let l=0; l<cols.length; l++){
@@ -322,7 +322,10 @@ export default {
             check_callback: true,
             data: dts,
           },
-          plugins: ["wholerow"],
+          checkbox:{
+            three_state:false,
+          },
+          plugins: ["wholerow", "checkbox"],
         }).bind("ready.jstree", function () {
           
         });
@@ -494,83 +497,97 @@ export default {
     ds2cube(){
         let ts = this;
         var leftRef = $("#cubelefttree").jstree(true);
-        var left = leftRef.get_selected(true);
-        if(left.length == 0){
+        var lefts = leftRef.get_selected(true);
+        if(lefts.length == 0){
           ts.$notify.error("您还未从左边选择字段。");
           return;
         }
-        left = left[0];
-        if(!left.li_attr){
-          ts.$notify.error("请选择字段。");
-          return;
-        }
-        if(leftRef.is_hidden(left)){
-          return;
-        }
-        var rightRef = $("#cuberighttree").jstree(true);
-        var right = rightRef.get_selected(true);
-        if(right.length == 0){
-          ts.$notify.error("您还未选择右边度量或维度。");
-          return;
-        }
-        right = right[0];
-        var parent = right.parent;
-        if(!parent){
-          ts.$notify.error("您还未选择右边度量或维度。");
-          return;
-        }
-        parent = rightRef.get_node(parent);
-        var isCalc = true; //是否是公式?
-        if(!left.li_attr.expression||left.li_attr.expression==null||left.li_attr.expression==""){
-          isCalc = false;
-        }	
-        if(right.id == 'cubedl' || parent.id == 'cubedl' || (parent.li_attr && parent.li_attr.tp == "kpigroup")){
-          //生成ID
-          var cid = ts.findCubeMaxId();
-          //calc 表示是否是动态字段,
-          //calcKpi 表示是否是计算指标
-          var o = {id:cid.id, text:'sum('+left.text+")",li_attr:{tp:"kpi",drag:true,aggre:"sum",col:(!isCalc?left.li_attr.col:left.li_attr.expression), tname:left.li_attr.tname,dispName:left.text,alias:left.id,calc:isCalc,calcKpi:0},icon:"glyphicon glyphicon-stop icon_kpi"};
-          if(right.id == 'cubedl' || (parent.id=="cubedl" && right.li_attr.tp == "kpigroup")){
-            rightRef.create_node(right.id, o);
-            rightRef.open_node(right.id);
-          }else{
-            //获取位置
-            var cnodes = rightRef.get_node(right.parent);
-            var idx = -1;
-            for(j=0; j<cnodes.children.length; j++){
-              if(cnodes.children[j] == right.id){
-                idx = j;
-                break;
+        const exef = (left)=>{
+          if(!left.li_attr){
+            ts.$notify.error("请选择字段。");
+            return false;
+          }
+          if(leftRef.is_hidden(left)){
+            return false;
+          }
+          var rightRef = $("#cuberighttree").jstree(true);
+          var right = rightRef.get_selected(true);
+          if(right.length == 0){
+            ts.$notify.error("您还未选择右边度量或维度。");
+            return false;
+          }
+          right = right[0];
+          var parent = right.parent;
+          if(!parent){
+            ts.$notify.error("您还未选择右边度量或维度。");
+            return false;
+          }
+          parent = rightRef.get_node(parent);
+          var isCalc = true; //是否是公式?
+          if(!left.li_attr.expression||left.li_attr.expression==null||left.li_attr.expression==""){
+            isCalc = false;
+          }	
+          if(right.id == 'cubedl' || parent.id == 'cubedl' || (parent.li_attr && parent.li_attr.tp == "kpigroup")){
+            //生成ID
+            var cid = ts.findCubeMaxId();
+            //calc 表示是否是动态字段,
+            //calcKpi 表示是否是计算指标
+            var o = {id:cid.id, text:'sum('+left.text+")",li_attr:{tp:"kpi",drag:true,aggre:"sum",col:(!isCalc?left.li_attr.col:left.li_attr.expression), tname:left.li_attr.tname,dispName:left.text,alias:left.id,calc:isCalc,calcKpi:0},icon:"glyphicon glyphicon-stop icon_kpi"};
+            if(right.id == 'cubedl' || (parent.id=="cubedl" && right.li_attr.tp == "kpigroup")){
+              rightRef.create_node(right.id, o);
+              rightRef.open_node(right.id);
+            }else{
+              //获取位置
+              var cnodes = rightRef.get_node(right.parent);
+              var idx = -1;
+              for(j=0; j<cnodes.children.length; j++){
+                if(cnodes.children[j] == right.id){
+                  idx = j;
+                  break;
+                }
               }
+              rightRef.create_node(right.parent, o, idx + 1);
             }
-            rightRef.create_node(right.parent, o, idx + 1);
-          }
-          leftRef.hide_node(left.id);
-        }else if(right.id == 'cubewd' || parent.id == 'cubewd' || (parent.li_attr && parent.li_attr.tp == 'group')){
-          var cid = ts.findCubeMaxId();
-          var o = {id:cid.id, text:left.text, li_attr:{tp:"dim",drag:true,col:!isCalc?left.li_attr.col:left.li_attr.expression,tname:left.li_attr.tname,dispName:left.text,tname:left.li_attr.tname,vtype:left.li_attr.vtype,alias:left.li_attr.col,calc:isCalc},icon:"glyphicon glyphicon-stop icon_dim", targetId:""};  //通过targetId 来指引对应数据库的的字段 ID, 用在修改上
-          if(right.id == 'cubewd' || (parent.id == 'cubewd' && right.li_attr.tp == 'group')){
-            rightRef.create_node(right.id, o);
-            rightRef.open_node(right.id);
-          }else{
-            //获取位置
-            var cnodes = rightRef.get_node(right.parent);
-            var idx = -1;
-            for(var j=0; j<cnodes.children.length; j++){
-              if(cnodes.children[j] == right.id){
-                idx = j;
-                break;
+            leftRef.hide_node(left.id);
+          }else if(right.id == 'cubewd' || parent.id == 'cubewd' || (parent.li_attr && parent.li_attr.tp == 'group')){
+            var cid = ts.findCubeMaxId();
+            var o = {id:cid.id, text:left.text, li_attr:{tp:"dim",drag:true,col:!isCalc?left.li_attr.col:left.li_attr.expression,tname:left.li_attr.tname,dispName:left.text,tname:left.li_attr.tname,vtype:left.li_attr.vtype,alias:left.li_attr.col,calc:isCalc},icon:"glyphicon glyphicon-stop icon_dim", targetId:""};  //通过targetId 来指引对应数据库的的字段 ID, 用在修改上
+            if(right.id == 'cubewd' || (parent.id == 'cubewd' && right.li_attr.tp == 'group')){
+              rightRef.create_node(right.id, o);
+              rightRef.open_node(right.id);
+            }else{
+              //获取位置
+              var cnodes = rightRef.get_node(right.parent);
+              var idx = -1;
+              for(var j=0; j<cnodes.children.length; j++){
+                if(cnodes.children[j] == right.id){
+                  idx = j;
+                  break;
+                }
               }
+              rightRef.create_node(right.parent, o, idx + 1);
             }
-            rightRef.create_node(right.parent, o, idx + 1);
+            leftRef.hide_node(left.id);
           }
-          leftRef.hide_node(left.id);
+          return true;
+        }
+        let isexe = false;
+        $(lefts).each((a, b)=>{
+          if(b.li_attr && b.li_attr.istable == true){
+            return;
+          }
+          isexe = true;
+          return exef(b);
+        });
+        if(isexe == false){
+          this.$notify.error("您还未选择右边度量或维度。");
         }
     },
     cube2ds(){
       var rightRef = $("#cuberighttree").jstree(true);
       var leftRef = $("#cubelefttree").jstree(true);
       var right = rightRef.get_selected(true);
+      let ts = this;
       if(right.length == 0 || !(right[0].li_attr) || !right[0].li_attr.tp){
         ts.$notify.error("您还未选择需要删除的度量或维度。");
         return;