合并冲突

This commit is contained in:
zhoumengru
2025-09-09 09:52:52 +08:00
70 changed files with 3979 additions and 846 deletions

View File

@@ -15,9 +15,8 @@
</div>
</div>
<div :class="[subMenu.length > 0 ? 'subcontent' : 'content']">
<router-view />
<router-view />
</div>
</div>
<div class="menu">
<div
@@ -47,14 +46,13 @@ export default {
menuList: [
{
name: '系统总览',
path:'/home'
path: '/home'
},
{
name: '运行监控',
path: '/monitor'
},
{
name: '预测管理',
path: '/predict'
},
@@ -109,13 +107,58 @@ export default {
subMenu: []
}
},
watch: {
$route: {
handler(n) {
console.log(n,"nnnnnnnnnnnnnn")
this.subMenu =n.matched[1].children || []
},
immediate: true
}
},
mounted() {
this.initRoute()
},
methods: {
// 过滤函数:根据权限数据过滤路由并附加权限信息
filterRoutes(routes, permissions) {
return routes.filter((route) => {
let hasViewPermission = false
// 查找当前路由对应的权限项
const routePermissions = permissions.filter((perm) => perm.route === route.path)
// 如果有权限项,附加到路由对象
if (routePermissions.length > 0) {
route.permissions = routePermissions;
hasViewPermission = true
}
// 检查是否有查看权限
// const hasViewPermission = routePermissions.some((perm) =>
// perm.is_view === '1'
// );
// 递归处理子路由
if (route.children && route.children.length) {
route.children = this.filterRoutes(route.children, permissions)
}
// 保留有权限的路由或包含有效子路由的父路由
return hasViewPermission || (route.children && route.children.length)
})
},
initRoute() {
console.log(this.$route,this.$router)
console.log(localStorage.getItem('user'), "localStorage.getItem('user')")
// 执行过滤
// const filteredRoutes = this.filterRoutes(
// this.menuList,
// JSON.parse(localStorage.getItem('user'))
// )
console.log( this.$route.matched, 'filteredRoutes')
this.subMenu = this.$route.matched[1].children || []
// this.menuList= JSON.parse(localStorage.getItem('user'))
// this.subMenu =filteredRoutes[0].children||[]
this.currentKey = '/' + this.$route.fullPath.split('/')[1]
this.subCurrentKey = this.$route.fullPath.split('/')[2]
@@ -127,7 +170,7 @@ export default {
this.$router.push(menu.path)
},
subMenuClick(subMenu) {
debugger
console.log(subMenu, subMenu.path)
this.subCurrentKey = subMenu.path
this.$router.push('/system'+subMenu.path)
}
@@ -175,10 +218,10 @@ export default {
margin: 20px 10px;
border-radius: 20px;
}
.content{
.content {
height: 100%;
}
.subcontent{
.subcontent {
height: calc(100% - 46px);
}
.menu {
@@ -199,7 +242,7 @@ export default {
font-size: 20px;
font-weight: 700;
cursor: pointer;
margin: 0 20px;
margin: 0 35px;
}
.active {
border: 1px solid $border-color;