zhanghua
2025-07-16 7c20fd15b7fbc2bd5756b39d5ab655cc849ffcc3
src/views/layout/components/Menu/index.vue
@@ -1,229 +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-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-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-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-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/portalSetting">门户设置</el-menu-item>
              <el-menu-item index="/home/system/otherInterface">第三方接口管理</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>
</style>