From b9b44b51b201e2f5a9a1f3665c7fb76b5690f9af Mon Sep 17 00:00:00 2001 From: wu <731351411@qq.com> Date: 星期一, 23 十二月 2024 16:13:08 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- UI-Project/src/layout/MainErpView.vue | 230 +++++++++++++++++++++------------------------------------ 1 files changed, 85 insertions(+), 145 deletions(-) diff --git a/UI-Project/src/layout/MainErpView.vue b/UI-Project/src/layout/MainErpView.vue index 8680e02..7c66472 100644 --- a/UI-Project/src/layout/MainErpView.vue +++ b/UI-Project/src/layout/MainErpView.vue @@ -7,15 +7,14 @@ import deepClone from '@/utils/deepClone' import { useRouter } from 'vue-router'; import { useI18n } from 'vue-i18n' - const { t } = useI18n() - let language = ref(localStorage.getItem('lang') || 'zh') +const { t } = useI18n() +let language = ref(localStorage.getItem('lang') || 'zh') const store = userInfo() - +const isCollapse = ref(false); // const { $i18n } = useI18n(); // 鑾峰彇 i18n 瀹炰緥 const router = useRouter() const userStore = useUserInfoStore() -const user = userStore.user.userName - +// const user = userStore.user.userName let userInfoStr = window.localStorage.getItem('userInfo') console.log(userInfoStr); // const userInfoStr = localStorage.getItem('userInfo'); @@ -29,60 +28,66 @@ }) router.push('/login') } -// const quit = async () => { -// try { -// store.$patch({user: null}) -// const response = await request.post('/loadGlass/sys/user/logout') -// if (response.code === 200) { -// console.log('鐧诲嚭鎴愬姛'); -// } else { -// // 澶勭悊閿欒鎯呭喌 -// console.error('鐧诲嚭澶辫触', response); -// } -// } -// catch (error) { -// // 澶勭悊閿欒 -// console.error(error); -// } -// } -// store.createWebSocket(); -// function quit() { -// userStore.$patch({ -// user: null, -// }) -// // router.push('/login') -// request.get("/loadGlass/sys/user/login").then((res) => { -// if (res.code === 200) { -// ElMessage.success(res.msg); -// console.log(res.data); -// } else { -// ElMessage.warning(res.msg); -// // router.push("/login"); -// } -// }); -// } - - function replaceChineseWithEnglish(menuData) { - // 瀹氫箟涓嫳鏂囧鐓у叧绯诲璞� + // 瀹氫箟涓縿鏂囧鐓у叧绯诲璞� const translation = { - '涓婄墖鏈�': '小褌芯谢 蟹邪谐褉褍蟹泻懈', - '鎺扮墖/璇嗗埆': '袪邪蟹谢芯屑/懈写械薪褌懈褎懈泻邪褑懈褟', - '鍗у紡缂撳瓨': ' 袚芯褉懈蟹芯薪褌邪谢褜薪褘泄 斜褍褎械褉', - '纾ㄨ竟鍓嶅崸寮忕紦瀛�': '袚芯褉懈蟹芯薪褌邪谢褜薪褘泄 斜褍褎械褉 锌械褉械写 褕谢懈褎芯胁泻芯泄', - '涓嬬墖鍗у紡缂撳瓨': '袚芯褉懈蟹芯薪褌邪谢褜薪褘泄 斜褍褎械褉 褋褌械泻谢邪 褉邪蟹谐褉褍蟹泻懈', - '纾ㄨ竟锛堝喎鍔犲伐锛�': '楔谢懈褎芯胁邪褌褜 泻褉邪褟 (褏芯谢芯写薪邪褟 芯斜褉邪斜芯褌泻邪)', - '1绾跨(杈�(鍐峰姞宸�)': '楔谢懈褎芯胁邪褌褜 泻褉邪褟 1 谢懈薪懈懈 (褏芯谢芯写薪邪褟 芯斜褉邪斜芯褌泻邪)', - '2绾跨(杈�(鍐峰姞宸�)': '楔谢懈褎芯胁邪褌褜 泻褉邪褟 2 谢懈薪懈懈 (褏芯谢芯写薪邪褟 芯斜褉邪斜芯褌泻邪)', - '澶х悊鐗囩': '袘褍褎械褉薪邪褟 褋懈褋褌械屑邪', - '閽㈠寲': '袟邪泻邪谢泻邪', - '閽㈠寲鍓�': '袩械褉械写 蟹邪泻邪谢泻懈', - '閽㈠寲鍚�': '袩芯褋谢械 蟹邪泻邪谢泻懈', - '涓嬬墖鍙�': '小褌芯谢 褉邪蟹谐褉褍蟹泻懈', - '绯荤粺绠$悊': '校锌褉邪胁谢械薪懈械 褋懈褋褌械屑芯泄', - '鐢ㄦ埛绠$悊': '校锌褉邪胁谢械薪懈械 锌芯谢褜蟹芯胁邪褌械谢械屑', - '鏉冮檺绠$悊': '校锌褉邪胁谢械薪懈械 锌芯谢薪芯屑芯褔懈褟屑懈', - '瑙掕壊绠$悊': '校锌褉邪胁谢械薪懈械 褉芯谢褜褞', + '涓婄墖鏈�': '小褌芯谢 蟹邪谐褉褍蟹泻懈', + '涓婄墖': '袙械褉褏薪褟褟 褔邪褋褌褜', + '鎺扮墖/璇嗗埆': '袪邪蟹谢芯屑/懈写械薪褌懈褎懈泻邪褑懈褟', + '鍗у紡缂撳瓨': ' 袚芯褉懈蟹芯薪褌邪谢褜薪褘泄 斜褍褎械褉', + '纾ㄨ竟鍓嶅崸寮忕紦瀛�': '袚芯褉懈蟹芯薪褌邪谢褜薪褘泄 斜褍褎械褉 锌械褉械写 褕谢懈褎芯胁泻芯泄', + '涓嬬墖鍗у紡缂撳瓨': '袚芯褉懈蟹芯薪褌邪谢褜薪褘泄 斜褍褎械褉 褋褌械泻谢邪 褉邪蟹谐褉褍蟹泻懈', + '纾ㄨ竟锛堝喎鍔犲伐锛�': '楔谢懈褎芯胁邪褌褜 泻褉邪褟 (褏芯谢芯写薪邪褟 芯斜褉邪斜芯褌泻邪)', + '1绾跨(杈�(鍐峰姞宸�)': '楔谢懈褎芯胁邪褌褜 泻褉邪褟 1 谢懈薪懈懈 (褏芯谢芯写薪邪褟 芯斜褉邪斜芯褌泻邪)', + '2绾跨(杈�(鍐峰姞宸�)': '楔谢懈褎芯胁邪褌褜 泻褉邪褟 2 谢懈薪懈懈 (褏芯谢芯写薪邪褟 芯斜褉邪斜芯褌泻邪)', + '澶х悊鐗囩': '袘褍褎械褉薪邪褟 褋懈褋褌械屑邪', + '閽㈠寲': '袟邪泻邪谢泻邪', + '閽㈠寲鍓�': '袩械褉械写 蟹邪泻邪谢泻懈', + '閽㈠寲鍚�': '袩芯褋谢械 蟹邪泻邪谢泻懈', + '涓嬬墖鍙�': '小褌芯谢 褉邪蟹谐褉褍蟹泻懈', + '绯荤粺绠$悊': '校锌褉邪胁谢械薪懈械 褋懈褋褌械屑芯泄', + '鐢ㄦ埛绠$悊': '校锌褉邪胁谢械薪懈械 锌芯谢褜蟹芯胁邪褌械谢械屑', + '鏉冮檺绠$悊': '校锌褉邪胁谢械薪懈械 锌芯谢薪芯屑芯褔懈褟屑懈', + '瑙掕壊绠$悊': '校锌褉邪胁谢械薪懈械 褉芯谢褜褞', + '鍙鍖栫郴缁�': '袙懈蟹褍邪谢褜薪邪褟 褋懈褋褌械屑邪', + '鎶ュ伐绠$悊': '校锌褉邪胁谢械薪懈械 芯褌褔械褌薪芯褋褌褜褞', + '浠撳偍涓績': '小泻谢邪写褋泻芯泄 褑械薪褌褉', + '鍘熺墖浠撳偍': '小泻谢邪写 褋褘褉褜褟', + }; + menuData.forEach(menu => { + menu.menuName = translation[menu.menuName] || menu.menuName; + // if (menu.children) { + menu.children && menu.children.forEach(submenu => { + submenu.menuName = translation[submenu.menuName] || submenu.menuName; + }); + // } + }); +} +function replaceChineseWithRussian(menuData) { + // 瀹氫箟涓嫳鏂囧鐓у叧绯诲璞� + const translation = { + '涓婄墖鏈�': 'Loading Machine', + '涓婄墖': 'Start showing a movie', + '鎺扮墖/璇嗗埆': 'Breaking /Identification', + '鍗у紡缂撳瓨': 'Horizontal cache', + '纾ㄨ竟鍓嶅崸寮忕紦瀛�': 'Horizontal buffer before edge grinding', + '涓嬬墖鍗у紡缂撳瓨': 'Offline horizontal cache', + '纾ㄨ竟锛堝喎鍔犲伐锛�': 'Grinding edge (cold processing)', + '1绾跨(杈�(鍐峰姞宸�)': '1-line edge grinding (cold processing)', + '2绾跨(杈�(鍐峰姞宸�)': '2-line edge grinding (cold processing)', + '澶х悊鐗囩': 'Dali slice cage', + '閽㈠寲': 'Toughened', + '閽㈠寲鍓�': 'Before Tempering', + '閽㈠寲鍚�': 'After Tempering', + '涓嬬墖鍙�': 'Next Stage', + '绯荤粺绠$悊': 'System Management', + '鐢ㄦ埛绠$悊': 'User Management', + '鏉冮檺绠$悊': 'Rights Management', + '瑙掕壊绠$悊': 'Roles', + '鍙鍖栫郴缁�': 'visualization system', + '鎶ュ伐绠$悊': 'Job reporting management', + '浠撳偍涓績': 'Storage Center', + '鍘熺墖浠撳偍': 'Original film storage', }; menuData.forEach(menu => { menu.menuName = translation[menu.menuName] || menu.menuName; @@ -95,33 +100,15 @@ } //鎻愬彇鑿滃崟妯″潡鍒楄〃 let menuList = $ref([]) - -// onMounted(async () => { -// try { -// const res = await request.get('/loadGlass/sys/menu/getMenuTree'); // 鍋囪 request.get 杩斿洖 Promise -// if (res.code == 200) { -// // 浣跨敤 value 灞炴�ф潵淇敼 ref 寮曠敤鐨勫�� -// menuList.value = deepClone(res.data); -// const language = $i18n.locale; -// if (language === 'en') { -// replaceChineseWithEnglish(menuList.value); // 浼犲叆 ref 鐨� value -// } -// console.log(res.data.token); // 濡傛灉 res.data 涓湁 token 鐨勮瘽 -// } else { -// ElMessage.warning(res.msg); -// router.push('/login'); -// } -// } catch (error) { -// // 澶勭悊璇锋眰閿欒 -// console.error('鑾峰彇鑿滃崟鍒楄〃鏃跺嚭閿�:', error); -// } -// }); request.get('/loadGlass/sys/menu/getMenuTree').then((res) => { if (res.code == 200) { menuList = res.data console.log(language.value) + // translateMenu(menuList.value, language.value); if (language.value === 'en') { - + replaceChineseWithRussian(menuList); + } + if (language.value === 'py') { replaceChineseWithEnglish(menuList); } } else { @@ -131,7 +118,6 @@ }) const menu = ref(null) let indexKey = ref(null) - function handleOpen(key) { indexKey.value = key } @@ -144,11 +130,9 @@ }, {deep: true} ) - router.beforeEach((to, from) => { //return false }) - let openFlag = $ref(null) //鍘熷鑿滃崟鎵撳紑 const openMenu = (menuID) => { @@ -158,21 +142,19 @@ openFlag = menuID } } +function toggleCollapse() { + isCollapse.value = !isCollapse.value; +} </script> - <template> <div id="all"> <el-container> <el-header> <div style="height: 100%;width: 100%;display: flex;background-color: #fff;"> <img src="../assets/northGlass.ico" - alt="" + alt="" @click="toggleCollapse" style="max-width: 100%;max-height: 100%"> - <h3 style="margin: 1rem ;font-weight: bold;width: 33vw;"> {{ $t('main.titleFirst') }}{{ user }}{{ $t('main.titleLast') }}</h3> - <!-- <div class="header-left"> - <el-button :icon="isCollapse ? 'el-icon-s-unfold' : 'el-icon-s-fold'" @click="toggleCollapse" - style="height:30px;"></el-button> - </div> --> + <h3 style="margin: 1rem ;font-weight: bold;width: 33vw;"> {{ $t('main.titleFirst') }}{{ userName }}{{ $t('main.titleLast') }}</h3> <span style="height: 70%;width: 78vw;margin-top: 1rem;"> <!-- <el-button class="sys-quit" @click="quit" @@ -188,33 +170,22 @@ <SwitchButton size=""/>{{ $t('main.quit') }} </el-icon> </el-button> + <!-- <div class="header-left"> + <el-button @click="toggleCollapse" style="height: 30px;"> + <el-icon><Expand /></el-icon> + </el-button> + </div> --> </span> </div> </el-header> <div id="line"></div> <el-container> - <!-- <el-aside width="160px" - style="height: 99%; background-color: #fff;"> - <div class="menu"> - <div v-for="items in menuList"> - <div class='menu_title' - @click="openMenu(items.id)"> - <span>鈽�</span> - {{ items.menuName }} - </div> - <ul class='enter-x-left' - v-show="openFlag==items.id"> - <li v-for="menuItem in items.children" - style="margin-bottom:2px"> - <router-link :to="{path:menuItem.url}"> - {{ menuItem.menuName }} - </router-link> - </el-aside> --> + <el-aside :width="isCollapse ? '0px' : '200px'" style="background-color: #fff;"> <el-row :span="20"> - <el-menu :default-active="activePath" class="el-menu-vertical-demo" background-color="#fff"> + <el-menu :default-active="activePath" class="el-menu-vertical-demo" > <div class="menu"> <div v-for="items in menuList"> - <div class='menu_title' + <div class='menu_title' v-show="!isCollapse" @click="openMenu(items.id)"> <span>鈽�</span> {{ items.menuName }} @@ -232,50 +203,39 @@ </div> </el-menu> </el-row> - <el-main> +</el-aside> +<el-main> <div id="main"> <router-view></router-view> </div> </el-main> - </el-container> </el-container> </div> </template> - <style scoped> - .el-menu-vertical-demo:not(.el-menu--collapse) { width: 200px; min-height: 400px; text-align: left; - } - - - - #all { background-color: #eee; height: 100%; } - .el-container { height: 100vh; width: 99vw; } - * { padding: 0; margin: 0; } - :deep(.sys-quit) { float: right; margin-right: 1rem; width: 5rem; } - /* 妯嚎 */ #line { float: right; @@ -287,16 +247,13 @@ position: relative; text-align: center; } - :deep(span) { margin-right: 0; } - .el-collapse { font-size: 16px; font-weight: bold; } - #main { width: 99%; float: right; @@ -304,9 +261,7 @@ background-color: #fff; } /*------------*/ - /* .menu div div{ - width: 138px; height: 35px; line-height: 35px; @@ -328,27 +283,23 @@ /* 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; - width: 200px; + width: 180px; line-height: 30px; /* background: rgb(128, 128, 128); */ color: #000000; @@ -358,16 +309,13 @@ 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; @@ -376,7 +324,6 @@ ul li a:hover { color: #1087ff; } - .item_divider { width: 118px; height: 0px; @@ -384,7 +331,6 @@ opacity: 0.8; */ margin-bottom: 2px; } - .item a { width: 138px; height: 35px; @@ -395,13 +341,11 @@ font-size: 14px; text-decoration: none; } - .menu_title { width: 180px; /* white-space: nowrap; overflow: hidden; text-overflow: ellipsis; */ - height: 45px; line-height: 55px; /* background: #fafafa; */ @@ -414,12 +358,10 @@ font-weight: bold; overflow: hidden; } - .menu_title:hover { /* background: #dedede; */ color: #3b9af9; } - .indicator { display: block; width: 40px; @@ -431,7 +373,6 @@ transition: all 0.3s ease; text-align: center; } - /* 鍔ㄧ敾鏁堟灉 */ .enter-x-left { z-index: 9; @@ -441,19 +382,15 @@ 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; } @@ -463,4 +400,7 @@ transform: translateX(0); } } +.header-left{ + margin-left: -350px; +} </style> \ No newline at end of file -- Gitblit v1.8.0