| | |
| | | </div> |
| | | <div class="adminui-header-right"> |
| | | <div v-if="!ismobile" class="adminui-header-menu"> |
| | | <el-menu mode="horizontal" :default-active="active" router background-color="#222b45" text-color="#fff" active-text-color="var(--el-color-primary)"> |
| | | <el-menu mode="horizontal" @select="handleSelect" :default-active="active" background-color="#222b45" text-color="#fff" active-text-color="var(--el-color-primary)"> |
| | | <NavMenu :navMenus="menu"></NavMenu> |
| | | </el-menu> |
| | | </div> |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | findRouteByPath(routes, targetPath) { |
| | | for (let i = 0; i < routes.length; i++) { |
| | | if (routes[i].path === targetPath) { |
| | | // 如果找到匹配的path,直接返回当前对象 |
| | | return routes[i]; |
| | | } |
| | | if (routes[i].children) { |
| | | // 如果当前对象有children,递归查找 |
| | | const found = this.findRouteByPath(routes[i].children, targetPath); |
| | | if (found) { |
| | | return found; |
| | | } |
| | | } |
| | | } |
| | | // 如果没有找到匹配的path,返回null |
| | | return null; |
| | | }, |
| | | handleSelect(key, keyPath,index,routeResult) { |
| | | var MENU = this.$TOOL.data.get("MENU"); |
| | | var foundRoute = this.findRouteByPath(MENU, key); |
| | | //http://116.63.148.72:8080/xxl-job-admin |
| | | var TOKEN = this.$TOOL.cookie.get("TOKEN"); |
| | | if(key == "/myiframe/urlPath") { //任务调度 |
| | | this.$router.push({path: '/myiframe/urlPath',query:{name: foundRoute.name,src:foundRoute.origin}}); |
| | | return; |
| | | } |
| | | if(foundRoute.name != "数字看板") { |
| | | this.$router.push({path: key}); |
| | | }else { |
| | | window.open(key + `?token=${TOKEN}`,'_blank'); |
| | | } |
| | | }, |
| | | openSetting(){ |
| | | this.settingDialog = true; |
| | | }, |