sunlupeng 1 năm trước cách đây
mục cha
commit
dcc10a4d8d
3 tập tin đã thay đổi với 11 bổ sung195 xóa
  1. 5 97
      src/layout/components/Homebar.vue
  2. 5 97
      src/layout/components/Navbar.vue
  3. 1 1
      src/views/login.vue

+ 5 - 97
src/layout/components/Homebar.vue

@@ -47,7 +47,7 @@
           <router-link to="/user/profile">
             <el-dropdown-item>个人中心</el-dropdown-item>
           </router-link>
-          <el-dropdown-item @click.native="companySetting()" v-loading.fullscreen.lock="fullscreenLoading">
+          <el-dropdown-item v-if="userInfo.manageMenuId" @click.native="companySetting()" v-loading.fullscreen.lock="fullscreenLoading">
             <span>企业管理</span>
           </el-dropdown-item>
           <el-dropdown-item divided @click.native="logout">
@@ -117,6 +117,9 @@ export default {
       get() {
         return this.$store.state.settings.topNav
       }
+    },
+    userInfo() {
+      return JSON.parse(this.$store.getters.userInfo);
     }
   },
   methods: {
@@ -131,108 +134,13 @@ export default {
     },
     async companySetting() {
       let item = {
-        id: 6,
+        id: this.userInfo.manageMenuId,
         parentId: 5,
         path: "/system/companyInfo",
       }
       this.fullscreenLoading = true;
       getListByMenuId(item.id).then(response => {
         let menuList = response.data;
-        const menus = [
-          {
-            "id": 6,
-            "parentId": 5,
-            "name": "企业管理",
-            "path": "/system",
-            "component": null,
-            "componentName": null,
-            "icon": "system",
-            "visible": true,
-            "keepAlive": true,
-            "alwaysShow": true,
-            "children": [
-              {
-                "id": 109,
-                "parentId": 6,
-                "name": "企业信息",
-                "path": "companyInfo",
-                "component": "system/companyInfo/index",
-                "componentName": "SystemCompanyInfo",
-                "icon": "tree-table",
-                "visible": true,
-                "keepAlive": true,
-                "alwaysShow": true,
-                "children": null
-              },
-              {
-                "id": 102,
-                "parentId": 6,
-                "name": "菜单管理",
-                "path": "menu",
-                "component": "system/menu/index",
-                "componentName": "SystemMenu",
-                "icon": "tree-table",
-                "visible": true,
-                "keepAlive": true,
-                "alwaysShow": true,
-                "children": null
-              },
-              {
-                "id": 103,
-                "parentId": 6,
-                "name": "部门管理",
-                "path": "dept",
-                "component": "system/dept/index",
-                "componentName": "SystemDept",
-                "icon": "tree",
-                "visible": true,
-                "keepAlive": true,
-                "alwaysShow": true,
-                "children": null
-              },
-              {
-                "id": 100,
-                "parentId": 6,
-                "name": "用户管理",
-                "path": "user",
-                "component": "system/user/index",
-                "componentName": "SystemUser",
-                "icon": "user",
-                "visible": true,
-                "keepAlive": true,
-                "alwaysShow": true,
-                "children": null
-              },
-              {
-                "id": 101,
-                "parentId": 6,
-                "name": "角色管理",
-                "path": "role",
-                "component": "system/role/index",
-                "componentName": "SystemRole",
-                "icon": "peoples",
-                "visible": true,
-                "keepAlive": true,
-                "alwaysShow": true,
-                "children": null
-              },
-
-              {
-                "id": 105,
-                "parentId": 6,
-                "name": "字典管理",
-                "path": "dict",
-                "component": "system/dict/index",
-                "componentName": "SystemDictType",
-                "icon": "dict",
-                "visible": true,
-                "keepAlive": true,
-                "alwaysShow": true,
-                "children": null
-              }
-            ]
-          }
-        ]
         localStorage.setItem("parentId", item.parentId)
         localStorage.setItem("menus", JSON.stringify(menuList))
         this.$store.dispatch('GenerateRoutes', menuList).then(accessRoutes => {

+ 5 - 97
src/layout/components/Navbar.vue

@@ -49,7 +49,7 @@
           <router-link to="/user/profile">
             <el-dropdown-item>个人中心</el-dropdown-item>
           </router-link>
-          <el-dropdown-item @click.native="companySetting()" v-loading.fullscreen.lock="fullscreenLoading">
+          <el-dropdown-item v-if="userInfo.manageMenuId" @click.native="companySetting()" v-loading.fullscreen.lock="fullscreenLoading">
             <span>企业管理</span>
           </el-dropdown-item>
           <el-dropdown-item divided @click.native="logout">
@@ -117,6 +117,9 @@ export default {
     },
     title() {
       return this.$store.state.settings.title
+    },
+    userInfo() {
+      return JSON.parse(this.$store.getters.userInfo);
     }
   },
   methods: {
@@ -128,108 +131,13 @@ export default {
     },
     async companySetting() {
       let item = {
-        id: 6,
+        id: this.userInfo.manageMenuId,
         parentId: 5,
         path: "/system/companyInfo",
       }
       this.fullscreenLoading = true;
       getListByMenuId(item.id).then(response => {
         let menuList = response.data;
-        const menus = [
-          {
-            "id": 6,
-            "parentId": 5,
-            "name": "企业管理",
-            "path": "/system",
-            "component": null,
-            "componentName": null,
-            "icon": "system",
-            "visible": true,
-            "keepAlive": true,
-            "alwaysShow": true,
-            "children": [
-              {
-                "id": 109,
-                "parentId": 6,
-                "name": "企业信息",
-                "path": "companyInfo",
-                "component": "system/companyInfo/index",
-                "componentName": "SystemCompanyInfo",
-                "icon": "tree-table",
-                "visible": true,
-                "keepAlive": true,
-                "alwaysShow": true,
-                "children": null
-              },
-              {
-                "id": 102,
-                "parentId": 6,
-                "name": "菜单管理",
-                "path": "menu",
-                "component": "system/menu/index",
-                "componentName": "SystemMenu",
-                "icon": "tree-table",
-                "visible": true,
-                "keepAlive": true,
-                "alwaysShow": true,
-                "children": null
-              },
-              {
-                "id": 103,
-                "parentId": 6,
-                "name": "部门管理",
-                "path": "dept",
-                "component": "system/dept/index",
-                "componentName": "SystemDept",
-                "icon": "tree",
-                "visible": true,
-                "keepAlive": true,
-                "alwaysShow": true,
-                "children": null
-              },
-              {
-                "id": 100,
-                "parentId": 6,
-                "name": "用户管理",
-                "path": "user",
-                "component": "system/user/index",
-                "componentName": "SystemUser",
-                "icon": "user",
-                "visible": true,
-                "keepAlive": true,
-                "alwaysShow": true,
-                "children": null
-              },
-              {
-                "id": 101,
-                "parentId": 6,
-                "name": "角色管理",
-                "path": "role",
-                "component": "system/role/index",
-                "componentName": "SystemRole",
-                "icon": "peoples",
-                "visible": true,
-                "keepAlive": true,
-                "alwaysShow": true,
-                "children": null
-              },
-
-              {
-                "id": 105,
-                "parentId": 6,
-                "name": "字典管理",
-                "path": "dict",
-                "component": "system/dict/index",
-                "componentName": "SystemDictType",
-                "icon": "dict",
-                "visible": true,
-                "keepAlive": true,
-                "alwaysShow": true,
-                "children": null
-              }
-            ]
-          }
-        ]
         localStorage.setItem("parentId", item.parentId)
         localStorage.setItem("menus", JSON.stringify(menuList))
         this.$store.dispatch('GenerateRoutes', menuList).then(accessRoutes => {

+ 1 - 1
src/views/login.vue

@@ -210,7 +210,7 @@ export default {
             removePassword()
             removeRememberMe()
           }
-          setTenantId(1)
+          // setTenantId(1)
           this.$store.dispatch(this.loginForm.loginType === "sms" ? "SmsLogin" : "Login", this.loginForm).then(() => {
             this.$router.push({path: "/"}).catch(() => {
             });