调整设备管理界面

This commit is contained in:
2025-09-30 23:52:59 +08:00
parent 7710abcf9e
commit 9a701b339b
3 changed files with 41 additions and 36 deletions

View File

@@ -15,6 +15,7 @@
:collapse="isCollapse"
:collapse-transition="false"
router
:default-openeds="['/device-management']"
>
<el-menu-item index="/">
<el-icon><House /></el-icon>
@@ -87,7 +88,7 @@
<script>
import { ref, computed, onMounted, onUnmounted } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { House, Monitor, Calendar, ArrowDown, Menu, Fold, Expand, Setting, Tickets } from '@element-plus/icons-vue'; // 导入Setting和Tickets图标
import { House, Monitor, Calendar, ArrowDown, Menu, Fold, Expand, Setting, Tickets } from '@element-plus/icons-vue';
export default {
name: 'MainLayout',
@@ -99,8 +100,8 @@ export default {
Menu,
Fold,
Expand,
Setting, // 注册Setting图标
Tickets // 注册Tickets图标
Setting,
Tickets
},
setup() {
const route = useRoute();
@@ -126,9 +127,8 @@ export default {
};
const activeMenu = computed(() => {
// 对于二级菜单,需要判断当前路由是否在其子菜单中
if (route.path === '/devices' || route.path === '/device-templates') {
return route.path; // 激活子菜单项
return route.path;
}
return route.path;
});
@@ -145,8 +145,8 @@ export default {
const logout = () => {
localStorage.removeItem('jwt_token');
localStorage.removeItem('username');
username.value = '管理员';
localStorage.removeItem('username'); // 清除用户名
username.value = '管理员'; // 重置显示
router.push('/login');
};