2024-08-22 11:27:06 +08:00
|
|
|
|
<!-- 横向布局 -->
|
|
|
|
|
|
<template>
|
|
|
|
|
|
<el-container class="layout">
|
|
|
|
|
|
<el-header>
|
|
|
|
|
|
<div class="logo flx-center">
|
2024-08-22 16:36:00 +08:00
|
|
|
|
<!-- <img class="logo-img" src="@/assets/images/logo.svg" alt="logo" /> -->
|
|
|
|
|
|
<img
|
|
|
|
|
|
class="logo-img"
|
|
|
|
|
|
src="@/assets/images/cn_pms9100_logo.png"
|
|
|
|
|
|
alt="logo"
|
|
|
|
|
|
/>
|
2024-08-22 11:27:06 +08:00
|
|
|
|
<span class="logo-text">{{ title }}</span>
|
|
|
|
|
|
</div>
|
2024-08-23 13:19:20 +08:00
|
|
|
|
<el-menu v-if="showMenuFlag" trigger="click" mode="horizontal" :router="false" :default-active="activeMenu">
|
2024-08-22 11:27:06 +08:00
|
|
|
|
<!-- 不能直接使用 SubMenu 组件,无法触发 el-menu 隐藏省略功能 -->
|
|
|
|
|
|
<template v-for="subItem in menuList" :key="subItem.path">
|
2024-08-22 16:36:00 +08:00
|
|
|
|
<el-sub-menu
|
|
|
|
|
|
v-if="subItem.children?.length"
|
|
|
|
|
|
:key="subItem.path"
|
|
|
|
|
|
:index="subItem.path + 'el-sub-menu'"
|
|
|
|
|
|
>
|
2024-08-22 11:27:06 +08:00
|
|
|
|
<template #title>
|
|
|
|
|
|
<el-icon>
|
|
|
|
|
|
<component :is="subItem.meta.icon"></component>
|
|
|
|
|
|
</el-icon>
|
|
|
|
|
|
<span>{{ subItem.meta.title }}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<SubMenu :menu-list="subItem.children" />
|
|
|
|
|
|
</el-sub-menu>
|
2024-08-22 16:36:00 +08:00
|
|
|
|
<el-menu-item
|
|
|
|
|
|
v-else
|
|
|
|
|
|
:key="subItem.path + 'el-menu-item'"
|
|
|
|
|
|
:index="subItem.path"
|
|
|
|
|
|
@click="handleClickMenu(subItem)"
|
|
|
|
|
|
>
|
2024-08-22 11:27:06 +08:00
|
|
|
|
<el-icon>
|
|
|
|
|
|
<component :is="subItem.meta.icon"></component>
|
|
|
|
|
|
</el-icon>
|
|
|
|
|
|
<template #title>
|
|
|
|
|
|
<span>{{ subItem.meta.title }}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-menu-item>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</el-menu>
|
|
|
|
|
|
<ToolBarRight />
|
|
|
|
|
|
</el-header>
|
2024-08-27 16:17:42 +08:00
|
|
|
|
<Main />
|
|
|
|
|
|
|
2024-08-22 11:27:06 +08:00
|
|
|
|
</el-container>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts" name="layoutTransverse">
|
|
|
|
|
|
import { computed } from "vue";
|
|
|
|
|
|
import { useAuthStore } from "@/stores/modules/auth";
|
|
|
|
|
|
import { useRoute, useRouter } from "vue-router";
|
|
|
|
|
|
import Main from "@/layouts/components/Main/index.vue";
|
|
|
|
|
|
import ToolBarRight from "@/layouts/components/Header/ToolBarRight.vue";
|
|
|
|
|
|
import SubMenu from "@/layouts/components/Menu/SubMenu.vue";
|
|
|
|
|
|
|
|
|
|
|
|
const title = import.meta.env.VITE_GLOB_APP_TITLE;
|
|
|
|
|
|
|
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
|
const authStore = useAuthStore();
|
|
|
|
|
|
const menuList = computed(() => authStore.showMenuListGet);
|
2024-08-23 13:19:20 +08:00
|
|
|
|
const showMenuFlag=computed(()=>authStore.showMenuFlagGet)
|
2024-08-22 16:36:00 +08:00
|
|
|
|
const activeMenu = computed(
|
|
|
|
|
|
() => (route.meta.activeMenu ? route.meta.activeMenu : route.path) as string
|
|
|
|
|
|
);
|
2024-08-22 11:27:06 +08:00
|
|
|
|
|
|
|
|
|
|
const handleClickMenu = (subItem: Menu.MenuOptions) => {
|
|
|
|
|
|
if (subItem.meta.isLink) return window.open(subItem.meta.isLink, "_blank");
|
|
|
|
|
|
router.push(subItem.path);
|
|
|
|
|
|
};
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
|
@import "./index.scss";
|
2024-08-22 16:36:00 +08:00
|
|
|
|
.logo{
|
|
|
|
|
|
margin-right: 0 !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
.logo-text {
|
|
|
|
|
|
letter-spacing: 2px;
|
|
|
|
|
|
}
|
2024-08-22 11:27:06 +08:00
|
|
|
|
</style>
|