yirongjin
2025-07-23 c2da0b81321e66e3c3706d6833ad4c92c62d0935
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<template>
    <div class="layout-left-aside-compontent">
        <div class="header">
            <img src="@/assets/img/logo_white.png" alt="Logo" class="logo-img" v-if="!collapse" />
            <template v-else>
                <span class="logo-font">潍</span>
                <span class="logo-font">柴</span>
            </template>
        </div>
        <div class="menus-box">
            <el-scrollbar>
                <el-menu :collapse="collapse" :unique-opened="true" :default-active="defaultActiveMenuIndex" active-text-color="#ffd04b" 
                    background-color="#3a405a" text-color="#bfcbd9" @select="onSelectMenu">
                    <sub-menus :menus="menus" props-text="name" props-icon="iconCls" />
                </el-menu>
            </el-scrollbar>
        </div>
    </div>
</template>
 
<script>
import SubMenus from './SubMenus.vue'
export default {
    name:'layoutLeftAsideCompontent',
    components:{SubMenus},
    data(){
        return {
            
        }
    },
    computed:{
        collapse(){
            return this.$store.getters['system/getCollapse'];
        },
        menus(){
            return this.$store.getters['user/getMenusTree'];
        },
        defaultActiveMenuIndex(){
            let temp = this.$store.getters['system/getCurrentFullMenuPath']
            let res = '';
            if (temp.length>0) {
                res = temp[temp.length-1].id
            }
            return res
        }
    },
    methods:{
        onSelectMenu(itemIndex,pathIndexArr){
            let obj = this.$utils.getTreeItemByKeyValues(this.menus,pathIndexArr,'id','children')
            if (obj && obj.path) {
                this.$router.push(obj.path)
            }
        }
    }
}
</script>
 
<style scoped lang="scss">
$asideHeight:110px;
.layout-left-aside-compontent{
    height: 100%;
    box-sizing: border-box;
    background-color: #3a405a;
    color: #bfcbd9;
    border-right: 1px solid #485e7a;
    padding-top: $asideHeight;
    position: relative;
    &>.header{
        position: absolute;
        top:0;
        left:0;
        width: 100%;
        height: $asideHeight;
        box-sizing: border-box;
        flex-shrink: 0;
        border-bottom: 1px solid #485e7a;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        .logo-img{
            width: 90%;
            height: auto;
        }
        .logo-font{
            color: white;
            font-size: 30px;
            font-weight: bold;
        }
    }
    .menus-box{
        height: 100%;
    }
    .el-menu{
        border-right: 0;
    }
}
</style>
<style lang="scss">
.layout-left-aside-compontent{
    .el-scrollbar__view{
        overflow: hidden;
    }
}    
</style>