|
|
@@ -9,10 +9,10 @@
|
|
|
<div
|
|
|
v-for="(item, index) in menuList"
|
|
|
:key="index"
|
|
|
- :class="{'menuItem-deactive':menuLeftValue!=item.name,'menuItem-active':menuLeftValue==item.name}"
|
|
|
+ :class="{'menuItem-deactive':menuLeftValue!=item.meta.title,'menuItem-active':menuLeftValue==item.meta.title}"
|
|
|
@click="menuValueFn(item)"
|
|
|
>
|
|
|
- {{ item.name }}
|
|
|
+ {{ item.meta.title }}
|
|
|
</div>
|
|
|
<el-dropdown @command="handleCommand" class="avatar-dropdown" trigger="hover">
|
|
|
<div class="avatar-wrapper">
|
|
|
@@ -37,7 +37,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="yjContent">
|
|
|
- <div class="contentLeft" :class="{ collapsed: !leftItem}" v-show="$route.path != '/YuJing/shouye/index'">
|
|
|
+ <div class="contentLeft" :class="{ 'collapsed': !leftItem}" v-if="menuLeftValue != '首页'">
|
|
|
<div class="leftMenu">
|
|
|
<el-menu
|
|
|
:default-active="$route.path"
|
|
|
@@ -49,7 +49,7 @@
|
|
|
:router="true"
|
|
|
>
|
|
|
<div class="leftTitle">
|
|
|
- <template v-if="leftItem">{{ $route.meta.title }}
|
|
|
+ <template v-if="leftItem">{{ menuLeftValue }}
|
|
|
<img
|
|
|
src="/src/assets/images/left.png"
|
|
|
alt=""
|
|
|
@@ -63,158 +63,55 @@
|
|
|
@click="imgLeftFn"/>
|
|
|
</template>
|
|
|
</div>
|
|
|
- <template v-for="item in menuData[menuLeftValue]" :key="item.path">
|
|
|
- <el-sub-menu v-if="item.children" :index="item.path">
|
|
|
- <template #title>
|
|
|
- <el-icon><component :is="item.icon" /></el-icon>
|
|
|
- <span>{{ item.title }}</span>
|
|
|
- </template>
|
|
|
- <el-menu-item
|
|
|
- v-for="child in item.children"
|
|
|
- :key="child.path"
|
|
|
- :index="child.path"
|
|
|
- >
|
|
|
- <el-icon><component :is="child.icon" /></el-icon>
|
|
|
- <span>{{ child.title }}</span>
|
|
|
- </el-menu-item>
|
|
|
- </el-sub-menu>
|
|
|
- <el-menu-item v-else :index="item.path">
|
|
|
- <el-icon><component :is="item.icon" /></el-icon>
|
|
|
- <template #title>{{ item.title }}</template>
|
|
|
- </el-menu-item>
|
|
|
- </template>
|
|
|
+ <sidebar :menuItem="menuItem"/>
|
|
|
</el-menu>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="contentRight" :class="{ collapsed: !leftItem }">
|
|
|
- <router-view v-slot="{ Component, route }">
|
|
|
- <transition name="fade-transform" mode="out-in">
|
|
|
- <keep-alive >
|
|
|
- <component v-if="!route.meta.link" :is="Component" :key="route.path"/>
|
|
|
- </keep-alive>
|
|
|
- </transition>
|
|
|
- </router-view>
|
|
|
+ <div class="contentRight" :class="{ 'collapsed': !leftItem }">
|
|
|
+ <app-main />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
-<script lang="js" setup>
|
|
|
-import { ref, reactive, markRaw } from "vue";
|
|
|
-import useUserStore from '@/store/modules/user'
|
|
|
-import {Setting} from "@element-plus/icons-vue";
|
|
|
-import { ElMessageBox } from 'element-plus'
|
|
|
|
|
|
-const routerInstance = useRouter();
|
|
|
+<script setup>
|
|
|
+import Sidebar from './components/Sidebar/index.vue';
|
|
|
+import { AppMain} from './components';
|
|
|
+import useAppStore from '@/store/modules/app';
|
|
|
+import useUserStore from '@/store/modules/user';
|
|
|
+import {staticMenuData} from "@/router/staticMenuData"
|
|
|
+import { ref } from 'vue';
|
|
|
+
|
|
|
+const sidebar = computed(() => useAppStore().sidebar)
|
|
|
const userStore = useUserStore();
|
|
|
-const route = useRoute()
|
|
|
-const menuLeftValue = ref("");
|
|
|
const leftItem = ref(true);
|
|
|
-const menuList = ref([
|
|
|
- { name: "首页", path: "/YuJing/shouye/index" },
|
|
|
- { name: "值班管理",path: "/YuJing/transaction/dutyRecord" },
|
|
|
- { name: "水功能区",path: "/YuJing/water/monitorAlert" }
|
|
|
-]);
|
|
|
-const menuData = reactive({
|
|
|
- "值班管理": [
|
|
|
- {
|
|
|
- index: "3",
|
|
|
- title: "事务管理",
|
|
|
- icon: markRaw(Setting),
|
|
|
- children: [
|
|
|
- { index: "3-1", title: "值班记录",icon: markRaw(Setting), path: "/YuJing/transaction/dutyRecord" },
|
|
|
- { index: "3-2", title: "会商记录",icon: markRaw(Setting), path: "/YuJing/transaction/consultationRecord" }]
|
|
|
- },
|
|
|
- {
|
|
|
- index: "4",
|
|
|
- title: "邮件管理",
|
|
|
- icon: markRaw(Setting),
|
|
|
- }
|
|
|
- ],
|
|
|
- "水功能区": [
|
|
|
- {
|
|
|
- index: "5",
|
|
|
- title: "监视告警",
|
|
|
- icon: markRaw(Setting),
|
|
|
- path: "/YuJing/water/monitorAlert"
|
|
|
- },
|
|
|
- ]
|
|
|
-});
|
|
|
const isCollapse = ref(false);
|
|
|
+const menuLeftValue = ref(useRoute().meta.title);
|
|
|
+const menuList = staticMenuData[0].children;
|
|
|
+const menuItem = ref(null);
|
|
|
+console.log('menuList',menuList);
|
|
|
+
|
|
|
+const menuValueFn = (row) => {
|
|
|
+ menuLeftValue.value = row.meta.title;
|
|
|
+ menuItem.value = row.children;
|
|
|
+};
|
|
|
|
|
|
-onMounted(() => {
|
|
|
- menuLeftValue.value = route.meta.title;
|
|
|
-});
|
|
|
function imgLeftFn() {
|
|
|
isCollapse.value = !isCollapse.value;
|
|
|
leftItem.value = !leftItem.value;
|
|
|
-}
|
|
|
-const menuValueFn = (val) => {
|
|
|
- menuLeftValue.value = val.name;
|
|
|
- if (val.path) {
|
|
|
- routerInstance.push(val.path);
|
|
|
- };
|
|
|
-};
|
|
|
-function handleMenuSelect(index) {
|
|
|
- // 查找对应的路径
|
|
|
- let path = '/';
|
|
|
- for (const category of Object.values(menuData)) {
|
|
|
- for (const item of category) {
|
|
|
- if (item.index === index) {
|
|
|
- path = item.path || '/';
|
|
|
- break;
|
|
|
- };
|
|
|
- if (item.children) {
|
|
|
- const child = item.children.find(child => child.index === index);
|
|
|
- if (child) {
|
|
|
- path = child.path || '/';
|
|
|
- break;
|
|
|
- };
|
|
|
- };
|
|
|
- };
|
|
|
- };
|
|
|
- routerInstance.push(path);
|
|
|
};
|
|
|
-function handleCommand(command) {
|
|
|
- switch (command) {
|
|
|
- case "setLayout":
|
|
|
- setLayout()
|
|
|
- break
|
|
|
- case "logout":
|
|
|
- logout()
|
|
|
- break
|
|
|
- default:
|
|
|
- break
|
|
|
- }
|
|
|
-};
|
|
|
-function logout() {
|
|
|
- ElMessageBox.confirm('确定注销并退出系统吗?', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- userStore.logOut().then(() => {
|
|
|
- location.href = '/index'
|
|
|
- })
|
|
|
- }).catch(() => { })
|
|
|
-}
|
|
|
-const emits = defineEmits(['setLayout'])
|
|
|
-function setLayout() {
|
|
|
- emits('setLayout')
|
|
|
-}
|
|
|
</script>
|
|
|
+
|
|
|
<style scoped lang="scss">
|
|
|
.yujing-index {
|
|
|
- position: fixed;
|
|
|
- top: 0;
|
|
|
- left: 0;
|
|
|
width: 100%;
|
|
|
height: 100vh;
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
.yjIndexTop {
|
|
|
- height: 7.74vh;
|
|
|
+ height: 70px;
|
|
|
width: 100%;
|
|
|
- background: url("../../assets/images/top-bg.png") no-repeat;
|
|
|
+ background: url("@/assets/images/top-bg.png") no-repeat;
|
|
|
background-size: 100% 100%;
|
|
|
display: flex;
|
|
|
.title {
|
|
|
@@ -222,43 +119,37 @@ function setLayout() {
|
|
|
width: 26.5%;
|
|
|
margin-left: 20px;
|
|
|
.yujing-logo{
|
|
|
- width: 3.125vw;
|
|
|
- height: 5.66vh;
|
|
|
+ width: 3.75rem;
|
|
|
+ height: 3.75rem;
|
|
|
position: absolute;
|
|
|
- top: 7px;
|
|
|
+ top: 3px;
|
|
|
}
|
|
|
span{
|
|
|
- font-size: 28px;
|
|
|
- line-height: 7.17vh;
|
|
|
+ font-size: 1.875rem;
|
|
|
+ line-height:70px;
|
|
|
color: #fff;
|
|
|
position: absolute;
|
|
|
- right: 20%;
|
|
|
+ right: 16%;
|
|
|
}
|
|
|
}
|
|
|
.menu {
|
|
|
margin-top: 0.9vh;
|
|
|
// line-height: 4.25vh;
|
|
|
- width: 62%;
|
|
|
+ width: 65%;
|
|
|
display: flex;
|
|
|
align-items: center; /* 水平居中 */
|
|
|
- font-size: 20px;
|
|
|
+ font-size: 1.125rem;
|
|
|
color: #1890ff;
|
|
|
.menuItem-deactive {
|
|
|
- margin-right: 5px;
|
|
|
- // width: 8%;
|
|
|
- // height: 60%;
|
|
|
- padding: 5px 8px;
|
|
|
+ padding: 0.5rem 0.625rem;
|
|
|
text-align: center;
|
|
|
- border-radius: 15px 15px 15px 15px;
|
|
|
+ border-radius: 1rem;
|
|
|
cursor: pointer;
|
|
|
}
|
|
|
.menuItem-active {
|
|
|
- margin-right: 5px;
|
|
|
- // width: 8%;
|
|
|
- // height: 60%;
|
|
|
- padding: 5px 8px;
|
|
|
+ padding: 0.5rem 0.625rem;
|
|
|
text-align: center;
|
|
|
- border-radius: 15px 15px 15px 15px;
|
|
|
+ border-radius: 1rem;
|
|
|
background: rgba(93, 171, 255,0.3);
|
|
|
cursor: pointer;
|
|
|
}
|
|
|
@@ -268,7 +159,7 @@ function setLayout() {
|
|
|
.avatar-dropdown{
|
|
|
position: absolute;
|
|
|
right: 10px;
|
|
|
- top: 2.5%;
|
|
|
+ top: 2%;
|
|
|
.avatar-wrapper{
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
@@ -292,13 +183,6 @@ function setLayout() {
|
|
|
.yjContent {
|
|
|
flex: 1;
|
|
|
display: flex;
|
|
|
- .leftItemClass {
|
|
|
- width: 3.281vw !important;
|
|
|
- img {
|
|
|
- margin: auto;
|
|
|
- cursor: pointer;
|
|
|
- }
|
|
|
- }
|
|
|
.contentLeft {
|
|
|
width: 10%;
|
|
|
height: 100%;
|
|
|
@@ -311,7 +195,7 @@ function setLayout() {
|
|
|
text-align: center;
|
|
|
line-height: 2.83vh;
|
|
|
font-size: 18px;
|
|
|
- background: url("../../assets/images/lefttitle-bg.png") no-repeat;
|
|
|
+ background: url("@/assets/images/lefttitle-bg.png") no-repeat;
|
|
|
background-size: 100% 100%;
|
|
|
.imgLeft {
|
|
|
position: absolute;
|
|
|
@@ -321,11 +205,9 @@ function setLayout() {
|
|
|
}
|
|
|
}
|
|
|
&.collapsed {
|
|
|
- width: 3.281 !important;
|
|
|
-
|
|
|
+ width: 3.281vw !important;
|
|
|
.leftTitle {
|
|
|
padding: 0 5px;
|
|
|
-
|
|
|
.imgLeft {
|
|
|
position: static;
|
|
|
margin: 5px auto;
|
|
|
@@ -345,8 +227,8 @@ function setLayout() {
|
|
|
flex: 1;
|
|
|
transition: margin-left 0.3s;
|
|
|
height: 100%;
|
|
|
- &.expanded {
|
|
|
- margin-left: 73px; /* 63px + 10px */
|
|
|
+ &.collapsed {
|
|
|
+ // margin-left: 73px;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -365,4 +247,4 @@ function setLayout() {
|
|
|
.contentLeft .el-menu .el-sub-menu__title:hover {
|
|
|
background-color: rgb(93, 171, 255) !important;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|