使用el-menu做侧边栏导航遇到需要点击两次菜单才展开

news2024/9/24 3:19:18

在根据路由遍历生成侧边导航栏时,遇到一个问题,就是当我点击选中某个垂直菜单时,只有点击第二次它才会展开,第一次在选中垂直菜单之后垂直菜单它就收缩起来了,如下图:
在这里插入图片描述
如上图,在我第一次点击选中“告警管理”这个菜单的时候,外联监测它会立马收缩起来,当我第二次点击时就不会收缩,而是展开状态,这是因为我的el-menu里default-active和el-submenu的index及el-menu-item的index属性不一致导致的,default-openeds和default-active尽量不要同时存在,删掉default-openeds即可,路由里name都一定要写上,不然会在控制台报警告,如下截图:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

由于我们这个侧边菜单栏是拿到该角色所拥有的菜单数组集合,那这里面可能有一些公共的路由,比如404,登录login等这些路由(特点是hidden为true,即默认隐藏的路由),所以我们需要在sideMenus.vue里接收到menuList之后进行递归处理掉hidden为true那些路由。下面附上asileLeft.vue、sideMenus.vue、和路由配置index.js的全部代码:

// asileLeft.vue

<template>
  <div class="asileLeft">
    <el-aside class="slider_container">
      <!--      :default-active="$route.path"             -->
      <el-menu
        mode="vertical"
        unique-opened
        background-color="#fff"
        text-color="#fff"
        active-text-color="#409EFF"
        :collapse-transition="false"
        :collapse="collapse"
        :default-active="$route.name"
        ref="elMenuRef"
        class="el-menu"
      >
        <!-- 菜单组件 -->
        <side-Meuns :menuList="menuList" :collapse="collapse"></side-Meuns>
      </el-menu>
    </el-aside>
  </div>
</template>

<script>
import sideMeuns from "./sideMeuns";
export default {
  name: "asileLeft",
  props: {
    menuList: {
      type: Array,
    },

    collapse: {
      type: Boolean,
    },
  },

  computed: {
    activeMenu() {
      const route = this.$route;
      const { meta, path } = route;
      // console.log("监听菜单切换2", meta, route);
      // if set path, the sidebar will highlight the path you set
      if (meta.activeMenu) {
        return meta.activeMenu;
      }

      return path;
    },
  },
  data() {
    return {};
  },
  components: { sideMeuns },
  methods: {},
};
</script>

<style lang="scss" scoped>
.asileLeft {
  background-color: #d3dce6;
  color: #333;
  text-align: left;

  width: 230px !important;
}

::v-deep .el-submenu .el-menu-item {
  box-shadow: none !important;
}
</style>

// sideMenus.vue

<template>
  <div class="">
    <!-- 遍历路由表,生成左侧菜单 -->

    <div
      v-for="(item, memuIndex) in meuns"
      :key="item.path + memuIndex + suijiNum()"
    >
      <!--  :index="item.menuIdEx"-->
      <el-submenu
        v-if="item.children && item.children.length"
        :index="item.name"
        :key="item.path + memuIndex + suijiNum()"
      >
        <template slot="title">
          <item
            :icon="item.meta && item.meta.icon"
            :title="item.meta && item.meta.title"
          />
        </template>

        <!-- 二级菜单 -->
        <div
          v-for="(myItem, myIndex) in item.children"
          :key="myItem.path + myIndex + suijiNum()"
        >
          <!-- :index="myItem.menuIdEx" -->
          <el-submenu
            v-if="myItem.children && myItem.children.length"
            :index="myItem.name"
            :key="myItem.path + myIndex + suijiNum()"
          >
            <template slot="title">
              <item
                :icon="myItem.meta && myItem.meta.icon"
                :title="myItem.meta && myItem.meta.title"
              />
            </template>

            <!-- 三级菜单   :index="myItem2.menuIdEx"-->
            <el-menu-item
              v-for="(myItem2, index2) in myItem.children"
              :index="myItem2.name"
              :key="myItem2.path + index2 + suijiNum()"
              :class="currentRouteName == myItem2.name ? 'select' : ''"
              @click.native="
                setPath(myItem2, myItem2.path, $event, '3', index2)
              "
              style="position: relative"
            >
              <item
                :icon="myItem2.meta && myItem2.meta.icon"
                :title="myItem2.meta && myItem2.meta.title"
              />
              <span
                v-if="currentRouteName == myItem2.name"
                style="position: absolute; top: 0px; right: 0.65rem"
              >
                <img src="@/assets/toRight.png" alt="" />
              </span>
            </el-menu-item>
          </el-submenu>

          <!--  :index="myItem.menuIdEx"-->
          <el-menu-item
            v-else
            :index="myItem.name"
            :key="myIndex + suijiNum()"
            :class="currentRouteName == myItem.name ? 'select' : ''"
            @click.native="setPath(myItem, myItem.path, $event, '2', myIndex)"
            style="position: relative"
          >
            <item
              :icon="myItem.meta && myItem.meta.icon"
              :title="myItem.meta && myItem.meta.title"
            />
            <span
              v-if="currentRouteName == myItem.name"
              style="position: absolute; top: 0px; right: 0.65rem"
            >
              <img src="@/assets/toRight.png" alt="" />
            </span>
          </el-menu-item>
        </div>
      </el-submenu>

      <!-- :index="item.menuIdEx" -->
      <el-menu-item
        :class="currentRouteName == item.name ? 'select' : 'noSelect'"
        @click.native="setPath(item, item.path, $event, '1', memuIndex)"
        v-else
        :index="item.name"
        :key="suijiNum()"
        class="firstMenu"
        style="position: relative"
        :style="{ 'margin-left': collapse ? '-0.01rem' : '' }"
      >
        <item
          :icon="item.meta && item.meta.icon"
          :title="item.meta && item.meta.title"
        />
        <span
          v-if="!collapse && currentRouteName == item.name"
          style="position: absolute; top: 0px; right: 0.65rem"
        >
          <img src="@/assets/toRight.png" alt="" />
        </span>
      </el-menu-item>
    </div>
  </div>
</template>
<script>
import Item from "./Item";
import AppLink from "./Link";
export default {
  title: "sideMeuns",
  components: { Item, AppLink },
  props: {
    menuList: {
      type: Array,
      default: () => [],
    },
    collapse: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      meuns: "",

      selectPath: "",
      currentRouteName: "",
    };
  },

  watch: {
    menuList: {
      handler(newVal, oldVal) {
        // console.log("接收", newVal);

        let arr = this.Waydigui(newVal);
        this.meuns = arr;

        this.$forceUpdate();
      },
      immediate: true,
    },
    $route: {
      handler(newVal, oldVal) {
        // console.log("路由", newVal, oldVal);
        this.currentRouteName = newVal.name;
      },
      immediate: true,
    },
  },
  methods: {
    Waydigui(allArr) {
      //递归过滤掉所有hidden为true的项

      return allArr.filter((item) => {
        if (item.children) {
          item.children = this.Waydigui(item.children);
        }
        if (!item.hidden) {
          return true;
        }
      });
    },
    setPath(item, path, even, type, index) {
      //点击菜单
      // console.log("setPath", item, path, even, type, this.$route, index);
      if (type == 1) {
        //选中的是一级
      } else if (type == 2) {
        //选中的是二级
      } else if (type == 3) {
        //选中的是三级
      }

      this.selectPath = path;

      this.$router.push({
        path,
      });
    },

    //生成随机数
    suijiNum() {
      var timestamp = Date.parse(new Date());
      return Math.round(Math.random() * 100000000000000) + timestamp + "";
    },
  },
};
</script>

<style lang="scss" scoped>
::v-deep .el-menu {
  background: #ffffff !important;
  color: #838a9d !important;

  div {
    li {
      margin: 0 10px;

      &:hover {
        // max-width: 14.6rem !important;
        border-radius: 4px !important;
      }
    }
  }
}

::v-deep .el-submenu {
  .el-submenu__title {
    position: relative;
    color: #838a9d !important;
    height: 2.5rem !important;
    line-height: 2.5rem !important;
    .el-submenu__icon-arrow {
      // border: 1px solid red;

      position: absolute;
      top: 50%;
      right: 3.2rem;
    }

    &:hover {
      // background-color: #00b259 !important;
      // color: #fff !important;

      border-radius: 4px !important;
      i {
        // color: #fff !important;
      }
    }
  }
}

::v-deep .el-menu-item {
  background: #ffffff !important;
  color: #838a9d !important;
  border: none !important;
  padding-left: 2.5rem !important;
  box-shadow: none !important;
  margin: 0 10px;
  &:hover {
    // background-color: #00b259 !important;
    // color: #fff !important;
    // max-width: 14.6rem !important;
    border-radius: 4px;
  }
}

::v-deep .firstMenu {
  padding-left: 0.68rem !important;

  .navSpan {
    margin-left: -0.23rem;
  }
}

::v-deep .select {
  background: #00b259 !important;
  max-width: 14.6rem !important;
  border-radius: 4px;
  color: #fff !important;
  // margin-left: 10px;
}
::v-deep .noSelect {
  background: #fff !important;
  color: #838a9d !important;
}
</style>

// 路由配置index.js

import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/layout'
import LayoutNoLeftMenu from '@/layout/LayoutNoLeftMenu.vue'
import LayoutEx from '@/layoutEx'

import Layout1 from '@/layout/components/layout1'

/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    perms: ['admin','editor']    control the page perms (you can set multiple perms)
    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar
    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
  }
 */

/**
 * constantRoutes
 * a base page that does not have permission requirements
 * all perms can be accessed
 */

// 所有情况都展示menuIdEx为0
//
export const constantRoutes = [
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login/index'),
    hidden: true,
    menuIdEx: '0',
  },
  {
    path: '/register',
    name: 'register',
    component: () => import('@/views/register/index'),
    hidden: true,
    menuIdEx: '0',
  },
  {
    path: '/404',
    name: '404',
    component: () => import('@/views/404'),
    hidden: true,
    menuIdEx: '0',
  },
]

/**
 * asyncRoutes
 * the routes that need to be dynamically loaded based on user perms
 */
export const asyncRoutes = [
  //首页

  {
    path: '/',
    menuIdEx: '1',
    component: LayoutNoLeftMenu,
    redirect: '/homePage',
    // component: () => import('@/views/homePage/homePage.vue'),
    name: 'homePage',
    meta: {
      title: '首页',
      icon: '首页',
      perms: ['homePage'],
      menuName: '首页',
      keepAlive: false,
      breadcrumb: false,
    },

    children: [
      {
        menuIdEx: '1-1',
        path: '/homePage',
        name: 'homePage',
        component: () => import('@/views/homePage/homePage.vue'),
        meta: {
          title: '首页',
          icon: '首页',
          perms: ['homePage'],
          menuName: '首页',
          keepAlive: false,
          breadcrumb: true,
        },
        hidden: true,
      },
    ],
  },

  // 外联监测-----------------------------------------------------------------

  //外联监测-告警管理
  {
    path: '/outDevice',
    menuIdEx: '2',
    component: Layout,
    redirect: '/warn-manage',
    name: 'warn-manage',
    meta: {
      title: '外联监测',
      icon: '外联监测',
      perms: ['externalMonitoring'],
      menuName: '外联监测',
    },
    children: [
      {
        menuIdEx: '2-1',
        path: '/warn-manage',
        name: 'warn-manage',
        component: () => import('@/views/outDevice/warn-manage.vue'),
        meta: {
          title: '告警管理',
          icon: '监测对象列表',
          perms: ['alarmManage'],
          menuName: '外联监测',
        },
      },

      //外联监测-告警日志

      {
        menuIdEx: '2 - 2',
        path: '/warn-log',
        name: 'warn-log',
        component: () => import('@/views/outDevice/warn-log.vue'),
        meta: {
          title: '告警日志',
          icon: '监测对象列表',
          perms: ['alarmLog'],
          menuName: '外联监测',
        },
      },

      //外联监测-策略设置

      {
        menuIdEx: '2 - 3',
        path: '/stragey-setting',
        name: 'stragey-setting',
        component: () => import('@/views/outDevice/stragey-setting.vue'),
        meta: {
          title: '策略设置',
          icon: '监测对象列表',
          perms: ['policySettings'],
          menuName: '外联监测',
        },
      },
    ],
  },

  //监测对象管理--监测对象管理

  {
    path: '/assets',
    menuIdEx: '3',
    component: Layout,
    redirect: '/assetsList',
    name: 'assetsList',
    meta: {
      title: '监测对象管理',
      icon: '监测对象管理',
      perms: ['assets'],
      menuName: '监测对象管理',
      exname: '',
    },
    children: [
      {
        menuIdEx: '3 - 1',
        path: '/assetsList',
        name: 'assetsList',
        component: () => import('@/views/assets/assetsList.vue'),
        meta: {
          title: '监测对象列表',
          icon: '监测对象列表',
          perms: ['assetsList'],
          menuName: '监测对象管理',
        },
      },
      {
        menuIdEx: '3-1-1',
        path: '/assetAddEdit',
        name: 'assetAddEdit',
        component: () => import('@/views/assets/assetAddEdit.vue'),
        meta: {
          title: '监测对象管理',
          icon: '监测对象列表',
          perms: ['assetsList'],
          menuName: '监测对象管理',
          backBtn: true,
        },
        hidden: true,
      },
      // 除黄石外 其他地区没有这个页面
      // {
      //   menuIdEx: 1,
      //   path: '/ipManage',
      //   name: 'ipManage',
      //   component: () => import('@/views/assets/ipManage.vue'),

      //   meta: {
      //     title: '监测对象地址管理',
      //     icon: '监测对象列表',
      //     perms: ['ipManage'],
      //     menuName: '监测对象管理',
      //     backBtn: false,
      //   },
      //   hidden: window.g.ifHiddenAssetChangeAndWaitingFlag,
      // },
      // 复制的一份 这个页面有黄石没有的功能
      // {
      //   menuIdEx: 1,
      //   path: '/ipManage',
      //   name: 'ipManage',
      //   component: () => import('@/views/ipManage-copy/ipManage.vue'),
      //   meta: {
      //     title: '监测对象地址管理',
      //     icon: '监测对象列表',
      //     perms: ['ipManage'],
      //     menuName: '监测对象管理',
      //     backBtn: false,
      //   },
      // },
      // {
      //   menuIdEx: 1,
      //   path: '/changeList',
      //   name: 'changeList',
      //   component: () => import('@/views/assetPool/changeList.vue'),
      //   meta: {
      //     title: '监测对象变更列表',
      //     icon: '监测对象列表',
      //     perms: ['changeList'],
      //     menuName: '监测对象管理',
      //     backBtn: false,
      //   },
      //   hidden: window.g.ifHiddenAssetChangeAndWaitingFlag,
      // },
      // {
      //   menuIdEx: 1,
      //   path: '/waitingList',
      //   name: 'waitingList',
      //   component: () => import('@/views/assetPool/waitingList.vue'),
      //   meta: {
      //     title: '监测对象待处理列表',
      //     icon: '监测对象列表',
      //     perms: ['waitingList'],
      //     menuName: '监测对象管理',
      //     backBtn: false,
      //   },
      //   hidden: window.g.ifHiddenAssetChangeAndWaitingFlag,
      // },
      {
        menuIdEx: '3 - 2',
        path: '/assetPool',
        name: 'assetPool',
        component: () => import('@/views/assetPool/assetPool.vue'),
        meta: {
          title: '监测对象档案',
          icon: '监测对象列表',
          perms: ['assetPool'],
          menuName: '监测对象管理',
        },
      },
      {
        menuIdEx: '3 - 3',
        path: '/assetPoolDetail',
        name: 'assetPoolDetail',
        component: () => import('@/views/assetPool/assetPoolDetail.vue'),
        meta: {
          title: '监测对象档案详情',
          icon: '监测对象列表',
          perms: ['assetPoolDetail'],
          menuName: '监测对象管理',
          backBtn: true,
        },
        hidden: true,
      },
      {
        menuIdEx: '3 - 4',
        path: '/assetPoolAddEdit',
        name: 'assetPoolAddEdit',
        component: () => import('@/views/assetPool/assetPoolAddEdit.vue'),
        meta: {
          title: '监测对象档案管理',
          icon: '监测对象列表',
          perms: ['assetPoolAddEdit'],
          menuName: '监测对象管理',
          backBtn: true,
        },
        hidden: true,
      },
      // {
      //   menuIdEx: 1,
      //   path: '/failList',
      //   name: 'failList',
      //   component: () => import('@/views/assetPool/failList.vue'),
      //   meta: {
      //     title: '失败明细列表',
      //     icon: '监测对象列表',
      //     perms: ['failList'],
      //     menuName: '监测对象管理',
      //     backBtn: false,
      //   },
      // },
      {
        menuIdEx: '3 - 5',
        path: '/waitingDetail',
        name: 'waitingDetail',
        component: () => import('@/views/assetPool/waitingDetail.vue'),
        meta: {
          title: '待处理监测对象详情',
          icon: '监测对象列表',
          perms: ['waitingDetail'],
          menuName: '监测对象管理',
          backBtn: true,
        },
        hidden: true,
      },
      // {
      //   menuIdEx: 1,
      //   path: '/reportSetting',
      //   name: 'reportSetting',
      //   component: () => import('@/views/assetPool/reportSetting.vue'),
      //   meta: {
      //     title: '上报接口配置',
      //     icon: '监测对象列表',
      //     perms: ['reportSetting'],
      //     menuName: '监测对象管理',
      //     backBtn: false,
      //   },
      // },
      // {
      //   menuIdEx: '3 - 6',
      //   path: '/ipCascade',
      //   name: 'ipCascade',
      //   component: () => import('@/views/assets/ipCascade.vue'),
      //   meta: {
      //     title: '级联IP管理',
      //     icon: '监测对象列表',
      //     perms: ['ipCascade'],
      //     menuName: '监测对象管理',
      //   },
      // },

      {
        menuIdEx: '3 - 7',
        path: '/ip-cascade-edit',
        name: 'ip-cascade-edit',
        component: () => import('@/views/assets/ip-cascade-edit.vue'),
        meta: {
          title: '级联IP管理详情',
          icon: '监测对象列表',
          perms: ['ipCascade'],
          menuName: '监测对象管理',
          backBtn: true,
        },
        hidden: true,
      },

      //监测对象管理--审批列表
      {
        path: '/regUserList',
        menuIdEx: '3 - 8',

        name: 'regUserList',
        component: () => import('@/views/assets/regUserList.vue'),
        meta: {
          title: '审批列表',
          icon: '监测对象列表',
          perms: ['regUserList'],
          menuName: '监测对象管理',
        },
      },

      //监测对象管理--用户列表
      {
        path: '/userList',
        menuIdEx: '3 - 9',

        name: 'userList',
        component: () => import('@/views/assets/userList.vue'),
        meta: {
          title: '用户列表',
          icon: '监测对象列表',
          perms: ['userList'],
          menuName: '监测对象管理',
        },
      },

      {
        path: '/userListAdd',
        menuIdEx: '3 - 10',

        name: 'userListAdd',
        component: () => import('@/views/assets/userListAdd.vue'),
        meta: {
          title: '新增用户',
          icon: 'user',
          perms: ['userListAdd'],
          menuName: '监测对象管理',
          backBtn: true,
        },
        hidden: true,
      },

      //监测对象管理--组织架构
      {
        path: '/groupList',
        menuIdEx: '3 - 11',

        name: 'groupList',
        component: () => import('@/views/assets/groupList.vue'),
        meta: {
          title: '组织架构',
          icon: '监测对象列表',
          perms: ['groupList'],
          menuName: '监测对象管理',
        },
      },

      //监测对象管理-

      {
        path: '/userDetail',
        menuIdEx: '3 - 12',

        name: 'userDetail',
        component: () => import('@/views/assets/userDetail.vue'),
        meta: {
          title: '用户详情',
          icon: 'user',
          perms: ['userDetail'],
          menuName: '监测对象管理',
          backBtn: true,
        },
        hidden: true,
      },
      {
        path: '/assetsDetail',
        menuIdEx: '3 - 13',

        name: 'assetsDetail',
        component: () => import('@/views/assets/assetsDetail.vue'),
        meta: {
          title: '监测对象详情',
          icon: 'user',
          perms: ['assetsList'],
          menuName: '监测对象管理',
          backBtn: true,
        },
        hidden: true,
      },
      {
        path: '/userCenter',
        menuIdEx: '3 - 14',

        name: 'userCenter',
        component: () => import('@/views/userCenter/userCenter.vue'),
        meta: {
          title: '个人中心',
          icon: 'user',
          perms: ['assetsDetail'],
          menuName: '监测对象管理',
          backBtn: true,
        },
        hidden: true,
      },
    ],
  },

  // 监测终端管理----------------------------------------------------------------

  //监测终端管理-终端管理
  {
    path: '/desktopAssistant',
    menuIdEx: '4',
    component: Layout,
    redirect: '/terminal',
    name: 'terminal',
    meta: {
      title: '监测终端管理',
      icon: '监测终端管理',
      perms: ['desktopAssistant'],
      menuName: '监测终端管理',
    },
    children: [
      //监测终端管理-应用管理

      {
        menuIdEx: '4 - 1',
        path: '/appControl',
        name: 'appControl',
        component: () => import('@/views/appControl/appControl.vue'),
        meta: {
          title: '应用管理',
          icon: '监测对象列表',
          perms: ['appControl'],
          menuName: '监测终端管理',
        },
      },
      {
        menuIdEx: '4 - 2',
        path: '/appControlDetail',
        name: 'appControlDetail',
        component: () => import('@/views/appControl/appControlDetail.vue'),
        meta: {
          title: '应用管理详情',
          icon: '监测对象列表',
          perms: ['appControlDetail'],
          menuName: '监测终端管理',
          backBtn: true,
        },
        hidden: true,
      },

      {
        menuIdEx: '4 - 3',
        path: '/terminal',
        name: 'terminal',
        component: () => import('@/views/terminal/terminal.vue'),
        meta: {
          title: '终端管理',
          icon: '监测对象列表',
          perms: ['terminal'],
          menuName: '监测终端管理',
        },
      },
      {
        menuIdEx: '4 - 4',
        path: '/terminalDetail',
        name: 'terminalDetail',
        component: () => import('@/views/terminal/terminalDetail.vue'),
        meta: {
          title: '终端详情',
          icon: '监测对象列表',
          perms: ['terminalDetail'],
          menuName: '监测终端管理',
          backBtn: true,
        },
        hidden: true,
      },

      //监测终端管理-消息通知

      {
        menuIdEx: '4 - 5',
        path: '/Notify',
        name: 'Notify',
        component: () => import('@/views/Notify/Notify.vue'),
        meta: {
          title: '消息通知',
          icon: '监测对象列表',
          perms: ['Notify'],
          menuName: '监测终端管理',
        },
      },
      {
        menuIdEx: '4 - 6',
        path: '/NotifyDetail',
        name: 'NotifyDetail',
        component: () => import('@/views/Notify/NotifyDetail.vue'),
        meta: {
          title: '消息通知详情',
          icon: '监测对象列表',
          perms: ['NotifyDetail'],
          menuName: '监测终端管理',
          backBtn: true,
        },
        hidden: true,
      },
    ],
  },

  // 监测对象访控 =====================================================================================================================================================

  // 监测对象访控 - 访控策略
  {
    path: '/accessControl',
    name: 'accessControl',
    menuIdEx: '5',
    component: Layout,

    meta: {
      title: '监测对象访控',
      icon: '准入设置',
      perms: ['accessControl'],
      menuName: '监测对象访控',
    },
    children: [
      {
        menuIdEx: '5 - 1',
        path: '/nacStrategy',
        name: 'nacStrategy',
        component: () => import('@/views/nacControl/nacStrategy.vue'),
        meta: {
          title: '访控策略',
          icon: '监测对象列表',
          perms: ['nacStrategy'],
          menuName: '监测对象访控',
        },
      },
      {
        path: '/nacStrategyDetail',
        menuIdEx: '5 - 2',
        name: 'nacStrategyDetail',
        component: () => import('@/views/nacControl/nacStrategyDetail.vue'),
        meta: {
          title: '访控策略详情',
          icon: '准入设置',
          perms: ['nacStrategyDetail'],
          menuName: '监测对象访控',
          backBtn: true,
        },
        hidden: true,
      },
      {
        path: '/nacStrategyAddEdit',
        menuIdEx: '5 - 3',
        name: 'nacStrategyAddEdit',
        component: () => import('@/views/nacControl/nacStrategyAddEdit.vue'),
        meta: {
          title: '访控策略配置',
          icon: '准入设置',
          perms: ['nacStrategyAddEdit'],
          menuName: '监测对象访控',
          backBtn: true,
        },
        hidden: true,
      },

      // 监测对象访控 - 访问控制

      {
        path: '/nacJurisdiction',
        name: 'nacJurisdiction',
        menuIdEx: '5 - 4',
        component: () => import('@/views/nacControl/nacJurisdiction.vue'),
        meta: {
          title: '访问控制',
          icon: '监测对象列表',
          perms: ['nacJurisdiction'],
          menuName: '监测对象访控',
        },
      },
      {
        path: '/nacJurisdictionDetail',
        menuIdEx: '5 - 5',
        name: 'nacJurisdictionDetail',
        component: () => import('@/views/nacControl/nacJurisdictionDetail.vue'),
        meta: {
          title: '访问控制详情',
          icon: '访问控制',
          perms: ['nacJurisdictionDetail'],
          menuName: '监测对象访控',
          backBtn: true,
        },
        hidden: true,
      },
      {
        path: '/nacJurisdictionAddEdit',
        menuIdEx: '5 - 6',
        name: 'nacJurisdictionAddEdit',
        component: () =>
          import('@/views/nacControl/nacJurisdictionAddEdit.vue'),
        meta: {
          title: '访问控制配置',
          icon: '访问控制',
          perms: ['nacJurisdictionAddEdit'],
          menuName: '监测对象访控',
          backBtn: true,
        },
        hidden: true,
      },

      // 监测对象访控 - 特权名单

      {
        path: '/blackWhiteList',
        menuIdEx: '5 - 7',

        name: 'blackWhiteList',
        component: () => import('@/views/nacControl/blackWhiteList.vue'),
        meta: {
          title: '特权名单',
          icon: '监测对象列表',
          perms: ['blackWhiteList'],
          menuName: '监测对象访控',
        },
      },
    ],
  },

  // 日志管理--------------------------------------------------
  // 日志管理-账户操作日志
  {
    path: '/logManage',
    menuIdEx: '6',
    component: Layout,
    redirect: '/accountlog',
    name: 'accountlog',
    meta: {
      title: '日志管理',
      icon: '日志管理',
      perms: ['logManage'],
      menuName: '日志管理',
    },

    children: [
      {
        path: '/BlockLog',
        name: 'BlockLog',
        menuIdEx: '6 - 1',
        component: () => import('@/views/nacControl/prevent-log.vue'),
        meta: {
          title: '监控访控日志',
          icon: '监测对象列表',
          perms: ['BlockLog'],
          menuName: '日志管理',
        },
      },
      {
        menuIdEx: '6 - 2',
        path: '/accountlog',
        name: 'accountlog',
        component: () => import('@/views/accountlog/accountlog.vue'),
        meta: {
          title: '账户操作日志',
          icon: '监测对象列表',
          perms: ['accountlog'],
          menuName: '日志管理',
          keepAlive: true,
        },
      },
    ],
  },

  // 系统管理 =====================================================================================================================================================

  {
    menuIdEx: '7',
    path: '/systemSet',
    component: Layout,
    redirect: '/assetsSet/topoFind',
    name: 'systemSet',
    meta: {
      title: '系统管理',
      icon: '系统管理',
      perms: ['assetsSet'],
      menuName: '系统管理',
      exname: '',
    },

    children: [
      //系统管理 -
      // {
      //   menuIdEx: 4,
      //   path: '/assetsSet',
      //   component: Layout1,
      //   redirect: '/assetsSet/topoFind',
      //   name: 'assetsSet',
      //   meta: {
      //     title: '监测对象管理设置',
      //     icon: '监测对象列表',
      //     perms: ['assetsSet'],
      //     menuName: '系统管理',
      //     exname: '',
      //   },
      //   children: [
      //     {
      //       menuIdEx: 1,
      //       path: '/topoFind',
      //       name: 'topoFind',
      //       component: () => import('@/views/assets/findSet.vue'),

      //       meta: {
      //         title: '主动探测设置',
      //         icon: '主动探测设置',
      //         perms: ['topoFind'],
      //         menuName: '系统管理',
      //       },
      //     },
      //     {
      //       menuIdEx: 1,
      //       path: '/topoFindList',
      //       name: 'topoFindList',
      //       component: () => import('@/views/assets/topoFindList.vue'),

      //       meta: {
      //         title: '交换机联动设置',
      //         icon: '交换机联动设置',
      //         perms: ['topoFindList'],
      //         menuName: '系统管理',
      //       },
      //     },
      //     {
      //       menuIdEx: 1,
      //       path: '/analysis',
      //       name: 'analysis',
      //       component: () => import('@/views/assets/analysis.vue'),

      //       meta: {
      //         title: '监测对象探针列表',
      //         icon: '监测对象探针列表',
      //         perms: ['analysis'],
      //         menuName: '系统管理',
      //       },
      //     },
      //     {
      //       menuIdEx: 1,
      //       path: '/oidList',
      //       name: 'oidList',
      //       component: () => import('@/views/assets/oidList.vue'),

      //       meta: {
      //         title: '设备厂商OID表',
      //         icon: '设备厂商OID表',
      //         perms: ['oidList'],
      //         menuName: '系统管理',
      //       },
      //     },
      //     {
      //       menuIdEx: 1,
      //       path: '/featuresList',
      //       name: 'featuresList',
      //       component: () => import('@/views/assets/featuresList.vue'),

      //       meta: {
      //         title: '监测对象特征库',
      //         icon: '监测对象特征库',
      //         perms: ['featuresList'],
      //         menuName: '系统管理',
      //       },
      //     },
      //     {
      //       menuIdEx: 1,
      //       path: '/sipList',
      //       name: 'sipList',
      //       component: () => import('@/views/systemControl/sipList.vue'),

      //       meta: {
      //         title: 'SIP列表',
      //         icon: 'SIP列表',
      //         perms: ['sipList'],
      //         menuName: '系统管理',
      //       },
      //     },
      //     {
      //       menuIdEx: 1,
      //       path: '/icon',
      //       name: 'iconList',
      //       component: () => import('@/views/systemControl/iconList.vue'),

      //       meta: {
      //         title: '图标管理',
      //         icon: '图标管理',
      //         perms: ['iconList'],
      //         menuName: '系统管理',
      //       },
      //     },
      //   ],
      // },

      //系统管理 - 准入控制设置
      {
        path: '/nacParameter',
        menuIdEx: '7 - 1',
        // component: Layout,
        // redirect: '/nacParameter',

        meta: {
          title: '监测访控设置',
          icon: '监测对象列表',
          perms: ['nacParameter'],
          menuName: '系统管理',
        },
        name: 'nacParameter',
        component: () => import('@/views/nacControl/nacParameter.vue'),

        // children: [
        //   {
        //     path: '/nacParameter',
        //     name: 'nacParameter',
        //     component: () => import('@/views/nacControl/nacParameter.vue'),
        //     meta: {
        //       title: '准入控制设置',
        //       icon: '',
        //       perms: ['nacParameter'],
        //       menuName: '系统管理',
        //     },
        //   },
        // ],
      },

      {
        menuIdEx: '7 - 2',
        path: '/topoFind',
        name: 'topoFind',
        component: () => import('@/views/assets/findSet.vue'),

        meta: {
          title: '主动探测设置',
          icon: '主动探测设置',
          perms: ['topoFind'],
          menuName: '系统管理',
        },
      },
      {
        menuIdEx: '7 - 3',
        path: '/topoFindList',
        name: 'topoFindList',
        component: () => import('@/views/assets/topoFindList.vue'),

        meta: {
          title: '交换机联动设置',
          icon: '交换机联动设置',
          perms: ['topoFindList'],
          menuName: '系统管理',
        },
      },

      {
        menuIdEx: '7 - 4',
        path: '/analysis',
        name: 'analysis',
        component: () => import('@/views/assets/analysis.vue'),

        meta: {
          title: '监测探针设置',
          icon: '监测对象探针列表',
          perms: ['analysis'],
          menuName: '系统管理',
        },
      },

      //系统管理 - 账户管理
      {
        path: '/jurisdiction',
        menuIdEx: '7 - 5',
        component: Layout1,
        name: 'jurisdiction',

        meta: {
          title: '账号权限设置',
          icon: '监测对象列表',
          perms: ['jurisdiction'],
          menuName: '系统管理',
          exname: '',
        },

        children: [
          {
            menuIdEx: '7 - 5 - 1',
            path: '/user',
            name: 'User',

            component: () => import('@/views/system/user.vue'),

            meta: {
              title: '用户权限',
              icon: '用户管理',
              perms: ['userManage'],
              menuName: '系统管理',
            },
          },

          {
            menuIdEx: '7 - 5 - 2',
            path: '/role',
            name: 'Role',

            component: () => import('@/views/system/role'),
            meta: {
              title: '角色权限',
              icon: '角色管理',
              perms: ['roleManage'],
              menuName: '系统管理',
            },
          },

          {
            menuIdEx: '7 - 5 - 3',
            path: '/perm',
            name: 'Perm',
            component: () => import('@/views/system/perm'),

            meta: {
              title: '权限菜单',
              icon: '权限菜单',
              perms: ['jurisdictionManage'],
              menuName: '系统管理',
            },
          },
        ],
      },

      //系统管理 - 级联管理
      // {
      //   path: '/levelControl',
      //   menuIdEx: 4,
      //   // component: Layout,
      //   meta: {
      //     title: '级联管理',
      //     icon: '监测对象列表',
      //     perms: ['levelControl'],
      //     menuName: '系统管理',
      //   },
      //   name: 'levelControl',
      //   component: () => import('@/views/systemControl/levelControl.vue'),

      //   // children: [
      //   //   {
      //   //     menuIdEx: 1,
      //   //     path: 'levelControl',
      //   //     name: 'levelControl',
      //   //     component: () => import('@/views/systemControl/levelControl.vue'),
      //   //     meta: {
      //   //       title: '级联管理',
      //   //       icon: '',
      //   //       perms: ['levelControl'],
      //   //       menuName: '系统管理',
      //   //     },
      //   //   },
      //   // ],
      // },

      //系统管理 - 系统维护
      {
        path: '/systemControl',
        menuIdEx: '7 - 6',
        // component: Layout,
        meta: {
          title: '系统维护',
          icon: '监测对象列表',
          perms: ['systemFix'],
          menuName: '系统管理',
        },

        name: 'setting',
        component: () => import('@/views/systemControl/setting.vue'),

        // children: [
        //   {
        //     menuIdEx: 1,
        //     path: 'setting',
        //     name: 'setting',
        //     component: () => import('@/views/systemControl/setting.vue'),
        //     meta: {
        //       title: '系统维护',
        //       icon: '',
        //       perms: ['systemFix'],
        //       menuName: '系统管理',
        //     },
        //   },
        // ],
      },

      //系统管理 - 系统授权

      {
        path: '/systemEmpower',
        menuIdEx: '7 - 7',
        // component: Layout,
        // redirect: '/systemControl',
        meta: {
          title: '系统授权',
          icon: '监测对象列表',
          perms: ['systemEmpower'],
          menuName: '系统管理',
        },
        name: 'systemEmpower',
        component: () => import('@/views/systemControl/systemEmpower.vue'),

        // children: [
        //   {
        //     path: '/systemEmpower',
        //     name: 'systemEmpower',
        //     component: () => import('@/views/systemControl/systemEmpower.vue'),
        //     meta: {
        //       title: '系统授权',
        //       icon: '',
        //       perms: ['systemEmpower'],
        //       menuName: '系统管理',
        //     },
        //   },
        // ],
      },

      //系统管理 - 提示页面设置
      {
        path: '/webCustomized',
        menuIdEx: '7 - 8',
        // component: Layout,
        // redirect: '/webCustomized',
        meta: {
          title: '提示页面设置',
          icon: '监测对象列表',
          perms: ['webCustomized'],
          menuName: '系统管理',
        },
        name: 'webCustomized',
        component: () => import('@/views/nacControl/webCustomized.vue'),
        // children: [
        //   {
        //     path: '/webCustomized',
        //     name: 'webCustomized',
        //     component: () => import('@/views/nacControl/webCustomized.vue'),
        //     meta: {
        //       title: '提示页面设置',
        //       icon: '',
        //       perms: ['webCustomized'],
        //       menuName: '系统管理',
        //     },
        //   },
        // ],
      },
    ],
  },

  // 全局总览
  // {
  //   path: '/viewAll',
  //   menuIdEx: 1,
  //   component: LayoutNoLeftMenu,

  //   // redirect: '/homePage',
  //   children: [
  //     {
  //       path: '/viewAll',
  //       name: 'viewAll',
  //       component: () => import('@/views/viewAll/viewAll.vue'),
  //       meta: {
  //         title: '全局总览',
  //         icon: 'user',
  //         perms: ['viewAll'],
  //         menuName: '全局总览',
  //         keepAlive: true,
  //       },
  //     },
  //   ],
  // },

  {
    path: '/resetPassword',
    menuIdEx: '8',
    component: Layout,
    // redirect: '/systemControl',
    name: 'resetPassword',
    children: [
      {
        path: '/resetPassword',
        name: 'resetPassword',
        component: () => import('@/views/systemControl/resetPassword.vue'),
        meta: {
          title: '重置密码',
          icon: 'zhunrucanshu',
          perms: ['resetPassword'],
          menuName: '系统管理',
          backBtn: true,
        },
        hidden: true,
      },
    ],
    hidden: true,
  },

  { path: '*', name: '404', menuIdEx: '9', redirect: '/404', hidden: true },
]

const createRouter = () =>
  new Router({
    // mode: 'history', // require service support
    scrollBehavior: () => ({ y: 0 }),
    routes: constantRoutes,
  })

const router = createRouter()

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/696911.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Gitlab升级报错二:rails_migration[gitlab-rails] (gitlab::database_migrations line 51)

gitlab-ctl 修改文件目录后出现以下错误&#xff1a;从root --> home 先停掉gitlab: gitlab-ctl stop 单独启动数据库&#xff0c;如果不单独启动数据库&#xff0c;就会报以上错误 sudo gitlab-ctl start postgresql 解决办法&#xff1a; sudo gitlab-rake db:migrat…

Interactive Linear Algebra:免费的交互式线性代数学习教程

本文介绍一个学习线性代数的网站&#xff0c;该网站通过将线性代数中的数学规则可视化&#xff0c;更直观的展示线性代数的运算过程。该网站可以帮助我们更快更高效的学习线性代数。如果有考研的同学或者觉得学习线性代数很枯燥或者很困难的同学&#xff0c;可以了解该网站&…

XILINX 7系列FPGA封装兼容原则及同封装替换注意问题

&#x1f3e1;《电子元器件高级指南》 目录 1&#xff0c;概述2&#xff0c;封装兼容原则3&#xff0c;注意问题4&#xff0c;总结 1&#xff0c;概述 XILINX 7系列的FPGA同封装的元器件一般都是可以兼容的&#xff0c;在一定程度上可以做到PIN TO PIN的替换&#xff0c;本文介…

Windows服务器部署项目自启动

1.下载jar包 https://github.com/kohsuke/winsw 2.重命名 3. 编辑xml文件 <configuration> <id>MyApp</id> <name>MyApp</name> <description>This is MyApp.</description><executable>java</executable> <argum…

NTP服务设置开机自启启动失败

文章目录 前言一、NTP服务设置开机自启启动失败原因二、解决办法 前言 Linux服务器设置了ntpd开机自启动&#xff0c;重启服务器ntpd却没有自启动 一、NTP服务设置开机自启启动失败原因 原因&#xff1a;chrony服务与NTP服务冲突导致开机启动未生效 二、解决办法 关闭chrony服务…

Flutter 设置自定义字体

一般我们会在 assets 文件夹下新建一个 font 的文件夹&#xff0c;然后把字体拖动到 font 文件夹中&#xff0c;如下图所示 然后在 pubspec.yaml 配置文件中新添加如下内容 fonts:- family: Impactfonts:- asset: assets/font/IMPACT.TTF 最后字体使用 Text( "自定义字体…

初级应急响应-Windows-常用工具

应急工具-PChunter PCHunter是一款强大的内核级监控软件&#xff0c;软件可以查看内核文件、驱动模块、隐藏进程、注册表内核&#xff0c;网络等等信息&#xff0c;和PCHunter功能相似的还有火绒剑&#xff0c;PowerTool等。 应急工具-Autoruns 登录时的加载程序、驱动程序加…

poi生成excel饼图设置颜色

效果 实现 import com.gideon.entity.ChartPosition; import com.gideon.entity.LineChart; import com.gideon.entity.PieChart; import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.xddf.usermodel.PresetColo…

react封装jsoneditor

1、安装&#xff1a; api文档&#xff1a;jsoneditor npm install jsoneditor2、代码&#xff1a; JsonEditor/index.tsx: import { useMemoizedFn } from ahooks; import JSONEditor from jsoneditor; import { useEffect, useState } from react; import ./index.less;in…

SpringBoot - 如何使用SpringBootServletInitializer将SpringBoot项目打成WAR包并部署TOMCAT中

写在前面 请先阅读&#xff1a; MAVEN的SCOPE属性详细说明&#xff1a;https://blog.csdn.net/goodjava2007/article/details/122860143 SpringBootServletInitializer的作用 SpringBootServletInitializer 是一个 SpringBoot 提供的、用于配置SERVLET初始化的类&#xff0c…

美颜SDK的未来发展:从单纯的美颜到更多的人脸应用

近年来&#xff0c;随着智能手机的普及和社交媒体的兴起&#xff0c;美颜应用成为了人们生活中越来越重要的一部分。为了满足用户对美颜的需求&#xff0c;美颜SDK&#xff08;软件开发工具包&#xff09;应运而生&#xff0c;它为开发者提供了一种方便的方式来集成美颜功能到他…

样本标准差与总体标准差中自由度理解

在计算总体标准差时&#xff0c;其计算公式如下&#xff1a; 计算样本标准差是&#xff1a; 这里样本标准差用的是n-1&#xff0c;不是n。根据chatgpt的回答&#xff0c;理解如下&#xff1a; 当样本均值使用作为均值估计量会引入一定的不确定性&#xff08;偏差&#xff09;&…

华为OD机试真题 Python 实现【天然蓄水池】【2023Q1 200分】,附详细解题思路

一、题目描述 公元2919年&#xff0c;人类终于发现了一颗宜居星球——X星。现想在X星一片连绵起伏的山脉间建一个天然蓄水库&#xff0c;如何选取水库边界&#xff0c;使蓄水量最大&#xff1f; 要求&#xff1a; 山脉用正整数数组s表示&#xff0c;每个元素代表山脉的高度。…

基于GPT3.5模型搭建的聊天系统BAIChat

1. 使用chatgpt前提条件 需要特殊的网络环境。如果是小白&#xff0c;不会搭建网络环境&#xff0c;可以关注我私信我&#xff0c;在线帮你搭建网络环境。 2.BAIChat链接 https://chatbot.theb.ai/#/chat/1686535596065 GPT3 研究背景 最近的研究表明&#xff0c;在 pretrai…

docker命令创建 Portainer容器

Portainer控制台可查看docker中各个容器的相关信息&#xff0c;实时查看容器启动日志以及对各个容器进行重启、删除&#xff0c;重建等代替命令的一列操作&#xff0c;使用起来非常方便。 创建目录data并赋权限 # 数据目录 mkdir -p /software/docker/portainer/data # 赋权限…

线性代数高级--二次型--特征值与特征向量--特征值分解--多元函数的泰勒展开

目录 二次型 概念 示例 性质和特点 特征值与特征向量 概念 示例 注意 性质和特点 特征值分解 注意 多元函数的泰勒展开 回顾一元函数泰勒展开 多元函数的泰勒展开 二次型 概念 二次型是一个关于向量的二次多项式&#xff0c;通常用矩阵表示。 考虑一个n维向量…

Oracle 实现A表B表字段/表名不同,定时任务+存储过程,定期执行增删改查

说明 假设Oracle A表B表 &#xff0c;表字段不同&#xff0c;表名也不同&#xff0c; 通过存储过程 定时任务(Jobs)&#xff0c; 定期去执行业务逻辑的增删改查 。 1、定时同步 创建一个存储过程&#xff0c;用于比较两张表中的数据&#xff0c;并根据状态决定需要同步的数据。…

java开发必备技能之Spring常用注解(重点)

参考了尚硅谷注解版&#xff0c;注解版后面的源码没看&#xff0c;雷神讲的太散了 Spring注解 AnnotationConfigApplicationContext 组件添加相关注解 1、ConfigurationBean (基础) 1-1 XML文件方式实现组件添加 public class Person { private String name;private Integ…

五个漂亮的 Arch Linux 发行版

导读本文将介绍几个漂亮的 Arch Linux 发行版&#xff0c;这些发行版将设计的优雅之美与 Arch Linux 强大的底层框架相结合。 Arch Linux 提供滚动更新模型、强大的 pacman 软件包管理器&#xff0c;以及通过其软件仓库提供的成千上万的应用程序。它非常受欢迎&#xff0c;因为…

多线程之wait()和notify()详解

1.每个Java对象都有一个监视器&#xff08;monitor&#xff09;&#xff0c;它是用来控制对该对象的访问的。一个线程要想进入某个对象的监视器区域&#xff0c;必须先获得该对象的锁。然后可以通过wait方法来释放该对象的锁并进入等待状态&#xff0c;直到其他线程调用notify或…