安琪酵母(西藏)益生菌信息采集中心智能实验室
longyvfengyun
2023-08-25 b311eb1e1e0e725613f752e82124b3297198c233
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<script setup>
import {ref, watchEffect} from "vue";
import FlexLayout from "@/components/FlexLayout.vue";
import slideMenu from "@/views/mainLayout/js/slideMenu";
import {useRoute} from "vue-router";
 
const {isCollapse, menuActive, menuData} = slideMenu();
const route = useRoute();
const isOpen = ref(!isCollapse.value);
menuActive.value = route.path;
menuData.value = [
    {
        title: "首页",
        path: "/home",
        icon: "HomeFilled"
    },
    {
        title: "门禁",
        path: "/accessControl",
        icon: "Checked",
    },
    {
        title: "空调",
        path: "/airConditioning",
        icon: "Postcard",
    },
    {
        title: "视频监控",
        path: "/video",
        icon: "VideoCameraFilled",
    },
    // {
    //     title: "用户管理",
    //     path: "/userManagement",
    //     icon: "UserFilled"
    // },
    // {
    //     title: "资产管理",
    //     path: "/asset",
    //     icon: "School",
    //     children: [
    //         {
    //             title: "门禁资产管理",
    //             path: "/asset/accessControl",
    //         },
    //         {
    //             title: "空调资产管理",
    //             path: "/asset/air",
    //         },
    //         {
    //             title: "视频监控资产管理",
    //             path: "/asset/video",
    //         },
    //         {
    //             title: "机房采集模块管理",
    //             path: "/asset/homeModule",
    //         }
    //     ]
    // },
];
 
watchEffect(()=>{
    if(isCollapse.value) {
        isOpen.value = false;
    }else {
        setTimeout(()=>{
            isOpen.value = true;
        }, 300);
    }
});
</script>
 
<template>
    <flex-layout no-bg>
        <template #header>
            <div class="sys-logo">
                <div class="logo-img">
                    <img src="../components/images/logo.png" alt="" />
                </div>
                <div class="sys-name" v-if="isOpen">
                    环境监控系统
                </div>
            </div>
        </template>
        <div class="menu-wrapper">
            <el-menu
                :router="true"
                text-color="#4ba1fa"
                active-text-color="#00fefe"
                background-color="#021a64"
                :default-active="menuActive"
                :unique-opened="true"
                class="el-menu-vertical"
                :collapse="isCollapse">
                <template v-for="menu in menuData" :key="menu.path">
                    <el-sub-menu :index="menu.path" v-if="menu.children">
                        <template #title>
                            <el-icon>
                                <component :is="menu.icon"></component>
                            </el-icon>
                            <span>{{menu.title}}</span>
                        </template>
                        <el-menu-item
                            v-for="children in menu.children"
                            :key="children.path"
                            :index="children.path">{{children.title}}</el-menu-item>
                    </el-sub-menu>
                    <el-menu-item :index="menu.path" v-else>
                        <el-icon>
                            <component :is="menu.icon"></component>
                        </el-icon>
                        <template #title>{{menu.title}}</template>
                    </el-menu-item>
                </template>
            </el-menu>
        </div>
    </flex-layout>
</template>
 
<style lang="less" scoped>
.menu-wrapper {
    height: 100%;
    overflow-y: auto;
    background-color: #021a64;
    &.min-width {
        min-width: 240px;
    }
}
.el-menu-vertical {
    font-size: 16px;
    border-right: 0;
    .el-menu-item.is-active{
        background-color: rgb(4, 32, 119);
    }
}
 
.el-menu-vertical:not(.el-menu--collapse) {
    width: 200px;
    min-height: 400px;
}
.sys-logo {
    user-select: none;
    padding: 16px 0 16px 16px;
    .logo-img {
        display: inline-block;
        height: 28px;
        vertical-align: bottom;
        img {
            width: auto;
            height: 100%;
        }
    }
    .sys-name {
        display: inline-block;
        margin-left: 6px;
        font-weight: bold;
        color: @font-color-primary;
    }
}
</style>