Forráskód Böngészése

修改刷新功能

huk 3 éve
szülő
commit
53e7a6caa8
3 módosított fájl, 61 hozzáadás és 14 törlés
  1. 2 2
      build/utils.js
  2. 10 10
      config/index.js
  3. 49 2
      src/components/main.vue

+ 2 - 2
build/utils.js

@@ -18,8 +18,8 @@ const devPathSrc = path.resolve(__dirname, '../../../src'); // node_modules应
 //  'logistics', 'process', '   ', 'reportform', 'basicconfig', 'system']
 // let devModules = ['index', 'qualityControl', 'standard', 'basicconfig'];
 // let devModules = ['index','devops','workFlow','systemConfig', 'microService'];
-let devModules = ['all'];
-// let devModules = ['index','TMS','statisticalReport','homepage','RMS'];
+//let devModules = ['all'];
+ let devModules = ['index','TMS','statisticalReport','homepage','RMS'];
 // let devModules = ['index','systemConfig', 'formGenerator', 'preview', 'metaData', 'serviceManager', 'configManager', 'custom'];
 // let devModules = ['index', 'systemConfig','formGenerator', 'preview', 'metaData', 'serviceManager', 'configManager', 'btnControll'];
 if (pathSrc.indexOf('node_modules') > -1) {

+ 10 - 10
config/index.js

@@ -62,20 +62,20 @@ let proxyTable = {
       "^/api/v1": "/api/v1"
     }
   },
-  // "/api/v1": {
-  //   target: "http://192.168.1.106:8080",
-  //   ws: true,
-  //   pathRewrite: {
-  //     "^/api/v1": "/api/v1"
-  //   }
-  // },
-  "/views/api/v1": {
-    target: "http://172.16.33.166:8080",
+  "/api/v1": {
+    target: "http://192.168.1.106:8019",
     ws: true,
     pathRewrite: {
-      "^/views/api/v1": "/api/v1"
+      "^/api/v1": "/api/v1"
     }
   },
+  // "/views/api/v1": {
+  //   target: "http://172.16.33.166:8080",
+  //   ws: true,
+  //   pathRewrite: {
+  //     "^/views/api/v1": "/api/v1"
+  //   }
+  // },
   '/icore.icp.web/pass/logout': {
     target: 'http://172.16.33.161:9001/logout',
     changeOrigin: true,

+ 49 - 2
src/components/main.vue

@@ -74,7 +74,7 @@
     >
       <div id="menuDrag" v-if="menuType === '2'" class="menuDrag"></div>
       <el-menu
-        :default-active="menuData.length > 1 ? '1' : '0-0'"
+        :default-active="defaultActiveIndex"
         :collapse="menuType === '1'"
         class="el-menu-vertical-demo icore-menu icore-menu-level1"
         v-for="(item, index) in menuData"
@@ -865,6 +865,7 @@ export default {
       styleControll: false,
       dutyId: "",
       appId: '',
+      defaultActiveIndex: '' 
     };
   },
   created() {
@@ -985,6 +986,10 @@ export default {
         });
       }
     },
+    selectedMenu: function(menuId){
+      var currentMenu = this.getMenuIndexByMenuId(this.menuData,  null, menuId);
+      currentMenu && window.top.localStorage.setItem("currentMenuIndex", currentMenu.menuIndex);
+    }
   },
   mounted() {
     let that = this;
@@ -1539,7 +1544,10 @@ export default {
           this.init(token);
         }
         // 打开设为主页的菜单
-        that.openMainPage();
+        // that.openMainPage();
+
+        // 自动打开上一次访问页面
+        that.autoOpenLatestPage();
       }
 
       if (routerFlag > 0 || routerFlagP > 0) {
@@ -1745,6 +1753,7 @@ export default {
               menuLabel: "首页",
             },
           ];
+          window.top.localStorage.setItem("currentMenuIndex","");
         }
       }
       that.tabsData = temp;
@@ -1791,6 +1800,9 @@ export default {
         });
       }
       //   console.log('目录', that.selectedMenu, that.tabsData)
+      // 左侧菜单点击切换的时候需要重新加载页面
+      that.menuTabIndex = that.getTabIndex(menuData.menuId);
+      $("#menuTabId iframe").eq(that.menuTabIndex).length && $("#menuTabId iframe").eq(that.menuTabIndex)[0].contentWindow.location.reload(true);
     },
     //  是否合部都不是菜单就不用显示
     allNoMenu(items) {
@@ -2402,6 +2414,41 @@ export default {
       }
       return list;
     },
+    getMenuIndexByMenuId(tree, index, menuId) {
+      if (!!tree && tree.length !== 0) {
+        for (let i = 0; i < tree.length; i++) {
+          let menuIndex = index ? (index + "-" + i.toString()) : i.toString();
+          if (tree[i].menuId == menuId){
+            tree[i]["menuIndex"] = menuIndex;
+            return tree[i];
+          } 
+
+            if (
+              tree[i].hasOwnProperty("children") &&
+              tree[i].children !== null &&
+              tree[i].children.length > 0
+            ) {
+              var result = this.getMenuIndexByMenuId(tree[i].children, menuIndex, menuId);
+              if(result){
+                return result;
+              }
+            }
+        }
+      }
+    },
+    autoOpenLatestPage() {
+      var that = this;
+      var currentMenuIndex = window.top.localStorage.getItem("currentMenuIndex");
+      let menuList = window.top.document.getElementsByClassName("el-menu-item");
+      for (let i = 0; i < menuList.length; i++) {
+        if(menuList[i].__vue__.index === currentMenuIndex){
+            setTimeout(function(){
+                that.defaultActiveIndex = currentMenuIndex;
+                menuList[i].click();
+            }, 20);
+        }
+      }
+    },
     // 打开设为主页菜单页面
     openMainPage() {
       this.mainPageList = this.getMainPage(this.menuData);