From 7c20fd15b7fbc2bd5756b39d5ab655cc849ffcc3 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期三, 16 七月 2025 22:39:23 +0800
Subject: [PATCH] 添加时间筛选

---
 src/views/layout/components/Menu/index.vue |  461 ++++++++++++++++++++++++++++++---------------------------
 1 files changed, 244 insertions(+), 217 deletions(-)

diff --git a/src/views/layout/components/Menu/index.vue b/src/views/layout/components/Menu/index.vue
index 4f35d59..5302c98 100644
--- a/src/views/layout/components/Menu/index.vue
+++ b/src/views/layout/components/Menu/index.vue
@@ -1,234 +1,261 @@
 <template>
-  <div>
-    <!-- 渚ц竟瀵艰埅鏍� -->
-    <el-aside width="200px">
-      <h2 class="siderbar-title">閬傛槍鎵ф硶骞冲彴</h2>
-      <el-scrollbar>
-        <!-- 璺敱 -->
-        <el-menu router class="el-menu-vertical" :default-active="$route.path" >
-          <!-- 绯荤粺璁剧疆妯″潡 -->
-          <el-submenu index="/home/system" class="firstMenu">
-            <template slot="title" class="firstSpan">
-              <!-- <i class="el-icon-reading"></i> -->
-              <span  slot="prefix" class="icon-padding fisrtSpan">
-                <svg-icon icon-class="system"></svg-icon>
-              </span>
-              <span class="fisrtSpan">绯荤粺璁剧疆</span>
-            </template>
-            <!-- 鍩烘湰璁剧疆 -->
-            <el-submenu index="/home/system/base" class="secondMenu">
-              <template slot="title">
-                <span class="secondSpan">鍩烘湰璁剧疆</span>
-              </template>
-              <!-- 鐢ㄦ埛绠$悊 -->
-              <el-menu-item index="/home/system/user">鐢ㄦ埛绠$悊</el-menu-item>
-              <!-- <el-submenu index="/home/system/base/user" class="thirdMenu">
-                <template slot="title">
-                  <span class="thirdSpan">鐢ㄦ埛绠$悊</span>
-                </template>
-                <el-menu-item index="/home/system/user">鐢ㄦ埛鍒楄〃</el-menu-item>
-              </el-submenu> -->
-              <!-- 瑙掕壊绠$悊 -->
-              <el-menu-item index="/home/system/role">瑙掕壊绠$悊</el-menu-item>
-              <!-- <el-submenu index="/home/system/base/role" class="thirdMenu">
-                <template slot="title">
-                  <span class="thirdSpan">瑙掕壊绠$悊</span>
-                </template>
-                <el-menu-item index="/home/system/role">瑙掕壊绠$悊鍒楄〃</el-menu-item>
-              </el-submenu> -->
-              <!-- 鏉冮檺绠$悊 -->
-              <el-menu-item index="/home/system/authority">鏉冮檺绠$悊</el-menu-item>
-              <!-- <el-submenu index="/home/system/base/authority" class="thirdMenu">
-                <template slot="title">
-                  <span class="thirdSpan">鏉冮檺绠$悊</span>
-                </template>
-                <el-menu-item index="/home/system/authority">璁剧疆鏉冮檺</el-menu-item>
-              </el-submenu> -->
-              <!-- 閮ㄩ棬绠$悊 -->
-              <el-menu-item index="/home/system/department">閮ㄩ棬绠$悊</el-menu-item>
-              <!-- <el-submenu index="/home/system/base/department" class="thirdMenu">
-                <template slot="title">
-                  <span class="thirdSpan">閮ㄩ棬绠$悊</span>
-                </template>
-                <el-menu-item index="/home/system/department">閮ㄩ棬绠$悊</el-menu-item>
-              </el-submenu> -->
-            </el-submenu>
-            <!-- 骞冲彴璁剧疆 -->
-            <el-submenu index="/home/article/add" class="secondMenu">
-              <template slot="title">
-                <span class="secondSpan">闂ㄦ埛绠$悊</span>
-              </template>
-              <el-menu-item index="/home/system/mySetting">鑷畾涔夎彍鍗�</el-menu-item>
-              <el-menu-item index="/home/system/portalSetting">logo绠$悊</el-menu-item>
-              <el-menu-item index="/home/system/otherInterface">绗笁鏂规帴鍙g鐞�</el-menu-item>
-            </el-submenu>
-          </el-submenu>
-          <!-- 杩愯惀绠$悊妯″潡 -->
-          <el-submenu index="/home/operate" class="firstMenu">
-            <template slot="title">
-              <span slot="prefix" class="icon-padding fisrtSpan">
-                <svg-icon icon-class="operate"></svg-icon>
-              </span>
-              <span class="fisrtSpan">杩愯惀绠$悊</span>
-            </template>
-            <el-menu-item index="/home/article/add">鎵ф硶绠$悊</el-menu-item>
-            <el-menu-item index="/home/article/add">璋冨害绠$悊</el-menu-item>
-            <el-menu-item index="/home/article/add">搴楅摵绠$悊</el-menu-item>
-            <el-menu-item index="/home/article/add">杞﹁締绠$悊</el-menu-item>
-            <el-menu-item index="/home/article/add">鍥剧墖绠$悊</el-menu-item>
-            <el-menu-item index="/home/article/add">瑙嗛绠$悊</el-menu-item>
-            <el-menu-item index="/home/article/add">娑堟伅绠$悊</el-menu-item>
-            <el-menu-item index="/home/article/add">瀹℃牳绠$悊</el-menu-item>
-            <el-menu-item index="/home/article/add">鐭俊绠$悊</el-menu-item>
-            <el-menu-item index="/home/article">绠楁硶妯″瀷绠$悊</el-menu-item>
-            <el-menu-item index="/home/article">鏃ュ織绠$悊</el-menu-item>
-          </el-submenu>
-          <!-- 瑙嗛宸℃煡妯″潡 -->
-          <el-submenu index="/home/video" class="firstMenu">
-            <template slot="title">
-              <span slot="prefix" class="icon-padding fisrtSpan">
-                <svg-icon icon-class="video"></svg-icon>
-              </span>
-              <span slot="title" class="fisrtSpan">瑙嗛宸℃煡</span>
-            </template>
-            <el-menu-item index="/home/video">瑙嗛宸℃煡</el-menu-item>
-          </el-submenu>
-          <!-- 娌圭儫淇℃伅鏌ヨ妯″潡 -->
-          <el-submenu index="/home/lampblack" class="firstMenu">
-            <template slot="title">
-              <span slot="prefix" class="icon-padding fisrtSpan">
-                <svg-icon icon-class="intelligence"></svg-icon>
-              </span>
-              <span class="fisrtSpan">娌圭儫淇℃伅鏌ヨ</span>
-            </template>
-            <el-menu-item index="/home/article/add">棰勮鐮斿垽</el-menu-item>
-            <el-menu-item index="/home/article">杩濊妫�绱�</el-menu-item>
-            <el-menu-item index="/home/article">瓒嬪娍鍒嗘瀽</el-menu-item>
-            <el-menu-item index="/home/article">鏁版嵁缁熻</el-menu-item>
-            <el-menu-item index="/home/article">杩愯鎶ュ憡</el-menu-item>
-          </el-submenu>
-          <!-- 鎵ф硶绠$悊妯″潡 -->
-          <el-submenu index="/home/law" class="firstMenu">
-            <template slot="title">
-              <span slot="prefix" class="icon-padding fisrtSpan">
-                <svg-icon icon-class="intelligence"></svg-icon>
-              </span>
-              <span class="fisrtSpan">鎵ф硶绠$悊</span>
-            </template>
-            <el-menu-item index="/home/article/add">棰勮鐮斿垽</el-menu-item>
-            <el-menu-item index="/home/article">杩濊妫�绱�</el-menu-item>
-            <el-menu-item index="/home/article">瓒嬪娍鍒嗘瀽</el-menu-item>
-            <el-menu-item index="/home/article">鏁版嵁缁熻</el-menu-item>
-            <el-menu-item index="/home/article">杩愯鎶ュ憡</el-menu-item>
-          </el-submenu>
-          <!-- 鏅鸿兘宸℃煡妯″潡 -->
-          <el-submenu index="/home/intellect" class="firstMenu">
-            <template slot="title">
-              <span slot="prefix" class="icon-padding fisrtSpan">
-                <svg-icon icon-class="intelligence"></svg-icon>
-              </span>
-              <span class="fisrtSpan">鏅鸿兘宸℃煡</span>
-            </template>
-            <el-menu-item index="/home/article/add">棰勮鐮斿垽</el-menu-item>
-            <el-menu-item index="/home/article">杩濊妫�绱�</el-menu-item>
-            <el-menu-item index="/home/article">瓒嬪娍鍒嗘瀽</el-menu-item>
-            <el-menu-item index="/home/article">鏁版嵁缁熻</el-menu-item>
-            <el-menu-item index="/home/article">杩愯鎶ュ憡</el-menu-item>
-          </el-submenu>
-          <!-- 骞冲彴鍩烘湰淇℃伅 -->
-          <el-submenu index="/home/info" class="firstMenu">
-            <template slot="title">
-              <span slot="prefix" class="icon-padding fisrtSpan">
-                <svg-icon icon-class="intelligence"></svg-icon>
-              </span>
-              <span class="fisrtSpan">骞冲彴鍩烘湰淇℃伅</span>
-            </template>
-            <el-menu-item index="/home/article/add">棰勮鐮斿垽</el-menu-item>
-            <el-menu-item index="/home/article">杩濊妫�绱�</el-menu-item>
-            <el-menu-item index="/home/article">瓒嬪娍鍒嗘瀽</el-menu-item>
-            <el-menu-item index="/home/article">鏁版嵁缁熻</el-menu-item>
-            <el-menu-item index="/home/article">杩愯鎶ュ憡</el-menu-item>
-          </el-submenu>
-        </el-menu>
-      </el-scrollbar>
-    </el-aside>
-  </div>
+    <div>
+        <!-- 渚ц竟瀵艰埅鏍� -->
+        <el-aside width="200px">
+            <h2 class="siderbar-title" @click="toHome()">閬傛槍鎵ф硶骞冲彴</h2>
+            <el-scrollbar>
+                <!-- 璺敱 -->
+                <el-menu
+                    router
+                    class="el-menu-vertical"
+                    :default-active="$route.path.name"
+                    @select="handleSelect"
+                >
+                    <el-submenu
+                        :index="String(menu.id)"
+                        v-for="menu in menuList"
+                        :key="menu.id"
+                        class="firstMenu"
+                    >
+                        <template slot="title">
+                            <span slot="prefix" class="icon-padding fisrtSpan">
+                                <svg-icon
+                                    class="icon-title"
+                                    v-bind:class="menu.icon"
+                                    :icon-class="menu.icon"
+                                ></svg-icon>
+                            </span>
+                            <span class="fisrtSpan">{{ menu.title }}</span>
+                        </template>
+                        <template v-if="menu.menuVoArrayList.length > 0">
+                            <template
+                                v-for="secondMenu in menu.menuVoArrayList"
+                            >
+                                <el-submenu
+                                    :key="secondMenu.id"
+                                    v-if="secondMenu.menuVoArrayList.length > 0"
+                                    :index="
+                                        secondMenu.url
+                                            ? secondMenu.url
+                                            : secondMenu.id.toString()
+                                    "
+                                    class="secondMenu"
+                                    :class="
+                                        secondMenu.menuVoArrayList.length > 0
+                                            ? 'is-Active'
+                                            : 'none-Active'
+                                    "
+                                >
+                                    <template slot="title">
+                                        <span class="secondSpan">{{
+                                            secondMenu.title
+                                        }}</span>
+                                    </template>
+                                    <el-menu-item
+                                        v-for="thirdMenu in secondMenu.menuVoArrayList"
+                                        :key="thirdMenu.id"
+                                        :index="`${thirdMenu.id}`"
+                                        :route="{ name: thirdMenu.url }"
+                                        v-if="thirdMenu.id != '65'"
+                                    >
+                                        <template>
+                                            {{ thirdMenu.title }}
+                                        </template></el-menu-item
+                                    >
+                                </el-submenu>
+                                <el-menu-item
+                                    v-else
+                                    :index="`${secondMenu.id}`"
+                                    :route="{ name: secondMenu.url }"
+                                    >{{ secondMenu.title }}</el-menu-item
+                                >
+                            </template>
+                        </template>
+                        <el-menu-item
+                            v-else
+                            :key="menu.id"
+                            :index="`${menu.id}`"
+                            :route="{ name: menu.url }"
+                            >{{ menu.title }}</el-menu-item
+                        >
+                    </el-submenu>
+                </el-menu>
+            </el-scrollbar>
+        </el-aside>
+    </div>
 </template>
 
 <script>
-export default {
+import users from "@/api/users";
+import router from "@/router";
 
+export default {
+    data() {
+        return {
+            menuList: [],
+            isActive: ''
+        };
+    },
+    created() {
+        this.loadMenu();
+    },
+    watch: {
+        $route() {
+            this.handleSelect(this.$route.fullPath)
+        },
+        '$route.path'(toPath, fromPath) {
+            this.handleSelect(toPath)
+            this.$router.push({ path: toPath })
+        },
+    },
+
+    methods: {
+        handleSelect(path) {
+            this.isActive = path
+        },
+        loadMenu() {
+            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))
+        },
+        toHome() {
+            router.push("/home")
+        }
+    },
 };
 </script>
 
 <style lang="scss" scpoed>
 .icon-padding {
-  padding-right: 10px;
+    padding-right: 10px;
+    .icon-title {
+        width: 36px;
+        height: 36px;
+    }
+}
+.smoke {
+    padding: 5px;
 }
 .el-aside {
-  background: #07162e;
-  color: #e9eef3;
-  text-align: center;
-  box-sizing: border-box;
-  position: relative;
-  //    鍥哄畾鏍囬
-  .siderbar-title {
-    position: fixed;
+    background: #313350;
+    color: #e9eef3;
     text-align: center;
-    margin: 0;
-    font-size: 26px;
-    width: 200px;
-    line-height: 66px;
-    top: 0;
-    left: 0;
-    z-index: 999;
-    // box-shadow: 0 -5px 5px #0ff inset;
-  }
-  .el-scrollbar {
-    height: calc(100vh - 66px);
-    margin-top: 66px;
     box-sizing: border-box;
-    .el-menu {
-      background: linear-gradient(#07162e, #0f2b56);
-      border: 0;
-      .firstMenu {
-        background: #07162e;
-        text-align: left;
-        &:hover .fisrtSpan{
-          color: #22d3eb;
-        }
-        span,span {
-          color: #e9eef3;
-        }
-        .el-menu-item {
-          color: #e9eef3;
-          background-color: #07162e;
-          &:hover {
-            color: #22d3eb;
-          }
-        }
-        .is-active {
-          background-color: #07162e;
-          color: #22d3eb;
-        }
-      }
-      .secondMenu{
-        &:hover .secondSpan{
-          color: #22d3eb;
-        }
-      }
-      .thirdMenu{
-        &:hover .thirdSpan{
-          color: #22d3eb;
-        }
-      }
-      .is-active {
-        background-color: #092c4a;
-      }
+    position: relative;
+    //    鍥哄畾鏍囬
+    .siderbar-title {
+        position: fixed;
+        text-align: center;
+        margin: 0;
+        font-size: 26px;
+        width: 200px;
+        line-height: 66px;
+        top: 0;
+        left: 0;
+        z-index: 999;
+        cursor: pointer;
     }
-    .el-scrollbar__wrap {
-      overflow-x: hidden;
+    .el-scrollbar {
+        height: calc(100vh - 66px);
+        margin-top: 66px;
+        box-sizing: border-box;
+        .el-menu {
+            background: linear-gradient(#313350, #0f2b56);
+            border: 0;
+            font-size: 16px;
+            .is-opened {
+                .fisrtSpan {
+                    color: #22d3eb;
+                }
+            }
+            .firstMenu {
+                background: #313350;
+                text-align: left;
+                //border-bottom:1px solid #ccc ;
+                &:hover > .el-submenu__title {
+                    background-color: #092c4a;
+                }
+                &:hover .fisrtSpan {
+                    color: #22d3eb;
+                }
+                span,
+                span {
+                    color: #e9eef3;
+                    font-size: 16px;
+                }
+                .el-menu {
+                    .is-active {
+                        background-color: #409eff;
+                        color: #fff;
+                    }
+                    .is-Active {
+                        background-color: #092c4a;
+                        color: #fff;
+                    }
+                }
+                .el-menu-item {
+                    color: #e9eef3;
+                    background-color: #313350;
+                    font-size: 16px;
+                    // border-bottom: 0.5px solid #7c7979;
+                }
+                .el-menu-item:hover {
+                    background-color: #409eff;
+                    color: #22d3eb;
+                }
+                .is-opened {
+                    .secondSpan {
+                        color: #22d3eb;
+                    }
+                }
+                .secondMenu {
+                    //border-bottom:1px solid #ccc ;
+                    .is-active {
+                        background-color: #409eff;
+                        color: #22d3eb;
+                    }
+                }
+            }
+            .secondMenu {
+                &:hover > .el-submenu__title {
+                    background-color: #092c4a;
+                }
+                .secondSpan {
+                }
+                &:hover .secondSpan {
+                    color: #22d3eb;
+                }
+                .is-opened {
+                    .el-submenu__title {
+                        background-color: #fff;
+                    }
+                }
+                .is-active {
+                    background-color: #409eff;
+                    color: #fff;
+                }
+            }
+            .thirdMenu {
+                &:hover > .el-submenu__title {
+                    background-color: #092c4a;
+                }
+
+                &:hover .thirdSpan {
+                    color: #22d3eb;
+                }
+            }
+
+            .is-active {
+                background-color: #092c4a;
+            }
+        }
+        .el-scrollbar__wrap {
+            overflow-x: hidden;
+        }
     }
-  }
 }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.8.0