From 085fa2fb257e9f11f8f6d34bf12e2dc281c36b4d Mon Sep 17 00:00:00 2001
From: odc.xiaohui <xiaohui@Q1>
Date: 星期四, 09 二月 2023 11:28:21 +0800
Subject: [PATCH] 2023/2/9 肖辉 修改部门管理
---
src/views/layout/components/Menu/index.vue | 64 +++++++++++++++-----------------
1 files changed, 30 insertions(+), 34 deletions(-)
diff --git a/src/views/layout/components/Menu/index.vue b/src/views/layout/components/Menu/index.vue
index 3599b9d..5c71c7f 100644
--- a/src/views/layout/components/Menu/index.vue
+++ b/src/views/layout/components/Menu/index.vue
@@ -2,7 +2,7 @@
<div>
<!-- 渚ц竟瀵艰埅鏍� -->
<el-aside width="200px">
- <h2 class="siderbar-title">閬傛槍鎵ф硶骞冲彴</h2>
+ <h2 class="siderbar-title" @click="toHome()">閬傛槍鎵ф硶骞冲彴</h2>
<el-scrollbar>
<!-- 璺敱 -->
<el-menu router class="el-menu-vertical" :default-active="$route.path">
@@ -14,15 +14,15 @@
>
<template slot="title">
<span slot="prefix" class="icon-padding fisrtSpan">
- <svg-icon :icon-class="menu.icon"></svg-icon>
+ <svg-icon class="icon-title" :icon-class="menu.icon"></svg-icon>
</span>
<span class="fisrtSpan">{{ menu.title }}</span>
</template>
- <template v-if="menu.children.length > 0">
- <template v-for="secondMenu in menu.children">
+ <template v-if="menu.menuVoArrayList.length > 0">
+ <template v-for="secondMenu in menu.menuVoArrayList">
<el-submenu
:key="secondMenu.id"
- v-if="secondMenu.children.length > 0"
+ v-if="secondMenu.menuVoArrayList.length > 0"
:index="
secondMenu.url ? secondMenu.url : secondMenu.id.toString()
"
@@ -32,7 +32,7 @@
<span class="secondSpan">{{ secondMenu.title }}</span>
</template>
<el-menu-item
- v-for="thirdMenu in secondMenu.children"
+ v-for="thirdMenu in secondMenu.menuVoArrayList"
:key="thirdMenu.id"
:index="`${thirdMenu.id}`"
:route="{ name: thirdMenu.url }"
@@ -42,7 +42,6 @@
<el-menu-item
v-else
- :key="secondMenu.id"
:index="`${secondMenu.id}`"
:route="{ name: secondMenu.url }"
>{{ secondMenu.title }}</el-menu-item
@@ -65,6 +64,9 @@
</template>
<script>
+import users from "@/api/users";
+import router from "@/router";
+
export default {
data() {
return {
@@ -72,32 +74,21 @@
};
},
created() {
- // this.getMenuList();
this.loadMenu();
},
methods: {
loadMenu() {
- const info = JSON.parse(sessionStorage.getItem("user"));
- var timer;
- if (info && info.menus) {
- clearTimeout(timer);
- this.menuList = info.menus;
- } else {
- timer = setInterval(() => {
- this.loadMenu();
- }, 1000);
- }
+ const userName = sessionStorage.getItem('name');
+ users.getMenu({ name: userName })
+ .then(res => {
+ this.menuList = res.menus;
+ sessionStorage.setItem('user', JSON.stringify(res));
+ })
+ .catch(err => this.$message.error(err))
},
- // 鑾峰彇鑿滃崟鍒楄〃
- getMenuList() {
- let arr;
- this.$axios({
- method: "get",
- url: "sccg/system/portal/menu/search_myself",
- }).then((res) => {
- console.log(res);
- });
- },
+ toHome(){
+ router.push("/home")
+ }
},
};
</script>
@@ -105,10 +96,14 @@
<style lang="scss" scpoed>
.icon-padding {
padding-right: 10px;
+ .icon-title{
+ width: 36px;
+ height: 36px;
+ }
}
.el-aside {
- background: #07162e;
+ background: #313350;
color: #e9eef3;
text-align: center;
box-sizing: border-box;
@@ -125,6 +120,7 @@
top: 0;
left: 0;
z-index: 999;
+ cursor: pointer;
}
.el-scrollbar {
@@ -133,11 +129,11 @@
box-sizing: border-box;
.el-menu {
- background: linear-gradient(#07162e, #0f2b56);
+ background: linear-gradient(#313350, #0f2b56);
border: 0;
.firstMenu {
- background: #07162e;
+ background: #313350;
text-align: left;
&:hover > .el-submenu__title {
@@ -155,7 +151,7 @@
.el-menu-item {
color: #e9eef3;
- background-color: #07162e;
+ background-color: #313350;
}
.el-menu-item:hover {
@@ -164,7 +160,7 @@
}
.is-active {
- background-color: #07162e;
+ background-color: #313350;
color: #22d3eb;
}
}
@@ -199,4 +195,4 @@
}
}
}
-</style>
\ No newline at end of file
+</style>
--
Gitblit v1.8.0