From 91f291a2c3b4e41fc0b44f2395ad5c956803ee8c Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期六, 11 五月 2024 08:34:24 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override
---
north-glass-erp/northglass-erp/src/layout/MainErpView.vue | 289 +++++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 267 insertions(+), 22 deletions(-)
diff --git a/north-glass-erp/northglass-erp/src/layout/MainErpView.vue b/north-glass-erp/northglass-erp/src/layout/MainErpView.vue
index b9bc12d..86a58c2 100644
--- a/north-glass-erp/northglass-erp/src/layout/MainErpView.vue
+++ b/north-glass-erp/northglass-erp/src/layout/MainErpView.vue
@@ -1,40 +1,78 @@
<script setup>
import { RouterLink,useRouter} from 'vue-router'
import useUserInfoStore from '@/stores/userInfo'
-import request from "@/utils/request";
-import {ElMessage} from "element-plus";
+import request from "@/utils/request"
+import {ElMessage} from "element-plus"
import {onMounted, reactive, ref, watch} from "vue"
import deepClone from "@/utils/deepClone"
import userInfo from '@/stores/userInfo'
+import {Close, Grid, Histogram, MessageBox, SwitchButton} from "@element-plus/icons-vue"
+import { useI18n } from 'vue-i18n'
+import i18n from "@/lang/index"
+const lang = i18n.global.locale.value
+//璇█鑾峰彇
+const { t } = useI18n()
const store=userInfo()
const router = useRouter()
const userStore = useUserInfoStore()
const user = userStore.user.userName
+//鐩戝惉寮傛杩斿洖浠g爜
+watch(()=>userStore.responseCode,(newVal) => {
+ switch (newVal){
+ case 401:{
+ if(userStore.msg.split('.')[1] === 'search'){
+ router.push({path:'/main/user/notPermission'});
+ }else{
+ ElMessage.warning(t('error.Code_401'))
+ }
+ userStore.responseCode=null
+ break
+ }
+ case 402:{
+ ElMessage.warning(t('error.Code_402'))
+ router.push("/login")
+ break
+ }
+ default:{
+ break
+ }
+ }
+ }
+)
store.createWebSocket();
+
+// 閫�鍑虹櫥褰�
function quit(){
userStore.$patch({
user:null
})
- router.push("/login")
+ request.post('/userInfo/logout').finally(()=>{
+ router.push("/login")
+ })
+
+ //
}
+
+
//鎻愬彇妯″潡鍒楄〃
let menuList=$ref([])
-request.get("/menu").then((res) => {
- if(res.code==200){
- menuList= deepClone(res.data)
- }else{
- ElMessage.warning(res.msg)
- router.push("/login")
- }
+onMounted(()=>{
+ request.get(`/menu/getMenu/${lang}`).then((res) => {
+ if(res.code==200){
+ menuList= deepClone(res.data)
+ }
+ })
+
})
+
//鑾峰彇鑿滃崟鍒楄〃
let menuItemList=$ref([])
-request.get("/menuItem").then((res) => {
+request.get(`/menuItem/getMenuItem/${lang}`).then((res) => {
if(res.code==200){
menuItemList= deepClone(res.data)
}else{
@@ -61,37 +99,54 @@
})
+let openFlag = $ref(null)
+//鍘熷鑿滃崟鎵撳紑
+const openMenu = (menuID) => {
+ if(menuID===openFlag){
+ openFlag = null
+ }else {
+ openFlag = menuID
+ }
+}
+
+
</script>
<template>
<div>
<el-container>
- <el-header>
+ <el-header >
<div style="height: 100%;width: 100%;display: flex">
<img src="../assets/northGlass.ico" alt="" style="max-width: 100%;max-height: 100%">
- <h3 style="margin: 1rem ;font-weight: bold;width: 20vw;"> 娆㈣繋{{ user }}浣跨敤鍖楃幓ERP绯荤粺锛�</h3>
- <span style="height: 70%;width: 78vw;margin-top: 1rem;" >
- <el-button class="sys-quit" @click="quit" type="info" round>閫�鍑�</el-button>
- </span>
+ <h3 style="margin: 1rem ;font-weight: bold;width: 40vw;"> {{$t('main.titleFirst') + user + $t('main.titleLast')}}</h3>
+ <span style="height: 70%;width: 78vw;margin-top: 1.5rem;" >
+<!-- <el-button class="sys-quit" @click="quit" type="info" round>-->
+ <el-icon @click="quit" style="float: right;margin-right: 1rem" size="large" ><SwitchButton size=""/></el-icon>
+<!-- </el-button>-->
+ </span>
</div>
</el-header>
<el-container >
- <el-aside width="160px" style="margin-top: 1.5rem;height: 90% " >
- <el-menu
+ <el-aside width="160px" style="height: 97%; " >
+<!-- <el-menu
+ style=" border-radius:0.5rem;border: 0.01rem solid #409EFF;margin-bottom: 0.5rem"
@open="handleOpen"
ref="menu"
active-color="#ffd04b"
- background-color="#545c64"
- class="el-menu-vertical-demo"
+ background-color="#409EFF"
default-active="2"
text-color="#fff">
<el-sub-menu
+
v-for="items in menuList"
:index="items.id"
:key="items.id">
<template #title>
- <span>{{items.menuName}}</span>
+ <el-icon v-if="items.id==1"><Grid/></el-icon>
+ <el-icon v-if="items.id==2"><Histogram/></el-icon>
+ <el-icon v-if="items.id==3"><MessageBox/></el-icon>
+ <span style="font-weight: bold;">{{items.menuName}}</span>
</template>
<router-link
v-show="items.id==menuItem.menuID"
@@ -103,7 +158,25 @@
</router-link>
</el-sub-menu>
- </el-menu>
+ </el-menu>-->
+ <div class="menu" >
+ <div v-for="items in menuList">
+ <div class='menu_title' @click="openMenu(items.id)" >{{items.menuName}}<span class='indicator' >鈻�</span></div>
+ <ul class='enter-x-left' v-show="openFlag==items.id">
+
+ <li v-for="menuItem in menuItemList"
+ v-show="items.id==menuItem.menuID"
+ style="margin-bottom: 2px"
+ >
+ <router-link
+ :to="{path:menuItem.url}">
+ {{ menuItem.itemName}}
+ </router-link>
+
+ </li>
+ </ul>
+ </div>
+ </div>
</el-aside>
<el-main>
@@ -146,4 +219,176 @@
float: right;
height: 99%;
}
+
+
+
+
+/*------------*/
+
+
+
+
+.menu div div{
+
+ width: 138px;
+ height: 35px;
+ line-height: 35px;
+ background: #C6E2FF;
+ color: #000000;
+ font-size: 16px;
+ padding-left: 15px;
+ transition: all 0.3s ease;
+ cursor: pointer;
+ position: relative;
+ font-weight: bold;
+ overflow: hidden;
+ border-bottom: 12px ;
+ margin-bottom:4px;
+ text-align: left;
+ cursor: pointer;
+ border-radius:8px;
+ /* outline: none; */
+
+ background-color:#5CADFE;
+ box-shadow: 0 8px 16px 0 rgba(0,0,0,0), 0 6px 5px 0 rgba(0,0,0,0.19);
+
+
+
+}
+
+.menu {
+ width: 138px;
+ height: 33px;
+ line-height: 25px;
+
+ color: #000000;
+ font-size: 16px;
+ padding-left: 15px;
+ padding-right: 2px;
+
+
+
+}
+
+ul {
+ height: auto;
+ margin: 1px auto;
+ text-align: center;
+}
+
+ul li {
+
+ height: 28px;
+ line-height: 30px;
+ background: rgb(128, 128, 128);
+ color: #000000;
+ padding-left: 36px;
+ cursor: pointer;
+ overflow: hidden;
+ text-align: left;
+ border-radius:8px;
+ /* outline: none; */
+
+ background: #5CADFE;
+ box-shadow: 0 8px 16px 0 rgba(0,0,0,0), 0 6px 5px 0 rgba(0,0,0,0.19);
+}
+
+ul li:hover {
+ background:#5CADFE ;
+ color: #ffffff;
+}
+
+ul li a {
+ text-decoration: none;
+ color: #000000;
+ font-size: 14px;
+}
+ul li a:hover {
+
+ color: #ffffff;
+}
+
+.item_divider {
+ width: 118px;
+ height: 0px;
+ /* background-color: white;
+ opacity: 0.8; */
+ margin-bottom:2px;
+}
+.item a{
+ width: 138px;
+ height: 35px;
+ display: block;
+ text-decoration: none;
+ color: white;
+ font-size: 14px;
+ text-decoration: none;
+}
+
+.menu_title {
+ width: 138px;
+ height: 35px;
+ line-height: 35px;
+ background: #fafafa;
+ color: rgb(128, 128, 128);
+ font-size: 16px;
+ padding-left: 15px;
+ transition: all 0.3s ease;
+ cursor: pointer;
+ position: relative;
+ font-weight: bold;
+ overflow: hidden;
+
+}
+
+.menu_title:hover {
+ /* background: #dedede; */
+ color: #ffffff;
+}
+
+.indicator {
+ display: block;
+ width: 50px;
+ height: 35px;
+ font-weight: bold;
+ position: absolute;
+ right: 0px;
+ top: 0px;
+ transition: all 0.3s ease;
+ text-align: center;
+}
+
+
+
+/* 鍔ㄧ敾鏁堟灉 */
+.enter-x-left {
+ z-index: 9;
+ opacity: 0;
+ animation: enter-x-left 0.4s ease-in-out 0.3s;
+ animation-fill-mode: forwards;
+ transform: translateX(-50px);
+ transition: all 0.3s ease;
+}
+.enter-x-left:nth-child(1){
+ animation-delay: 0.1s;
+}
+.enter-x-left:nth-child(2){
+ animation-delay: 0.2s;
+}
+.enter-x-left:nth-child(3) {
+ animation-delay: 0.3s;
+}
+.enter-x-left:nth-child(4){
+ animation-delay: 0.4s;
+}
+
+
+@keyframes enter-x-left {
+ to {
+ opacity: 1;
+ transform: translateX(0);
+ }
+}
+
+
</style>
\ No newline at end of file
--
Gitblit v1.8.0