| | |
| | | import { useRouter } from 'vue-router'; |
| | | import { useI18n } from 'vue-i18n' |
| | | import { provide } from 'vue'; |
| | | import {host, WebSocketHost} from '@/utils/constants' |
| | | import {closeWebSocket, initializeWebSocket} from '@/utils/WebSocketService'; |
| | | // import {host, WebSocketHost} from '@/utils/constants' |
| | | // import {closeWebSocket, initializeWebSocket} from '@/utils/WebSocketService'; |
| | | const globalDate = ref(''); |
| | | const { t } = useI18n() |
| | | let language = ref(localStorage.getItem('lang') || 'zh') |
| | |
| | | }) |
| | | router.push('/login') |
| | | } |
| | | let socket = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/loadGlass/api/talk/mainMes`; |
| | | const handleMessage = (data) => { |
| | | if(data.globalDate!=null){ |
| | | window.localStorage.setItem('getglobalDate', data.globalDate[0]) |
| | | }else{ |
| | | globalDate.value = '' |
| | | } |
| | | } |
| | | let getglobalDate = window.localStorage.getItem('getglobalDate') |
| | | provide('globalDate', getglobalDate); |
| | | // let socket = null; |
| | | // const socketUrl = `ws://${WebSocketHost}:${host}/api/loadGlass/api/talk/mainMes`; |
| | | // const handleMessage = (data) => { |
| | | // if(data.globalDate!=null){ |
| | | // window.localStorage.setItem('getglobalDate', data.globalDate[0]) |
| | | // }else{ |
| | | // globalDate.value = '' |
| | | // } |
| | | // } |
| | | function replaceChineseWithEnglish(menuData) { |
| | | // 定义中俄文对照关系对象 |
| | | const translation = { |
| | |
| | | // 定义中英文对照关系对象 |
| | | const translation = { |
| | | '上片机': 'Loading Machine', |
| | | '上片': 'Start showing a movie', |
| | | '上片一线': 'First line on film', |
| | | '上片二线': 'Second line on film', |
| | | '掰片/识别': 'Breaking /Identification', |
| | | '掰片一线': 'Broken piece line', |
| | | '掰片二线': 'Broken pieces with two lines', |
| | | '卧式缓存': 'Horizontal cache', |
| | | '卧式缓存一号线': 'Horizontal Cache 1', |
| | | '卧式缓存二号线': 'Horizontal Cache 2', |
| | | '磨边前卧式缓存': 'Horizontal buffer before edge grinding', |
| | | '下片卧式缓存': 'Offline horizontal cache', |
| | | '磨边(冷加工)': 'Grinding edge (cold processing)', |
| | | '磨边(冷加工)': 'Grinding edge (cold processing)', |
| | | '1线磨边(冷加工)': '1-line edge grinding (cold processing)', |
| | | '2线磨边(冷加工)': '2-line edge grinding (cold processing)', |
| | | '大理片笼': 'Dali slice cage', |
| | | '钢化': 'Toughened', |
| | | '钢化查询': 'Tempered steel inquiry', |
| | | '钢化前': 'Before Tempering', |
| | | '钢化后': 'After Tempering', |
| | | '下片台': 'Next Stage', |
| | |
| | | '用户管理': 'User Management', |
| | | '权限管理': 'Rights Management', |
| | | '角色管理': 'Roles', |
| | | '系统配置': 'system configuration', |
| | | '可视化系统': 'visualization system', |
| | | '报工管理': 'Job reporting management', |
| | | '仓储中心': 'Storage Center', |
| | | '原片仓储': 'Original film storage', |
| | | '中空': 'Hollow', |
| | | '中空一线': 'Hollow Line', |
| | | '中空二线': 'Hollow Second Line', |
| | | '中空三线': 'Hollow three line', |
| | | '中空理片笼': 'Hollow Film processing cage', |
| | | '折铝框一线': '1 Fold aluminum frame', |
| | | '折铝框二线': '2 Fold aluminum frame', |
| | | '折铝框三线': '3 Fold aluminum frame', |
| | | '大屏显示': 'Large Screen Display', |
| | | }; |
| | | 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 replaceChineseWithKorean(menuData) { |
| | | // 定义中韩文对照关系对象 |
| | | const translation = { |
| | | '上片机': '로딩 머신', |
| | | '上片一线': '전편 일선', |
| | | '上片二线': '전편 2선.', |
| | | '掰片/识别': '커팅/식별', |
| | | '掰片一线': '한 줄로 쪼개다', |
| | | '掰片二线': '쪼개기 2 선', |
| | | '卧式缓存': '수평 버퍼', |
| | | '卧式缓存一号线': '수평 캐시 1호선', |
| | | '卧式缓存二号线': '수평 캐시 2호선', |
| | | '磨边前卧式缓存': '에징 전 수평 버퍼', |
| | | '下片卧式缓存': '언로딩 수평 버퍼', |
| | | '磨边(冷加工)': '라인1 에징 (콜드 워킹) ', |
| | | '磨边(冷加工)': '라인1 에징 (콜드 워킹) ', |
| | | '1线磨边(冷加工)': '라인1 에징 (콜드 워킹) ', |
| | | '2线磨边(冷加工)': '라인2 에징 (콜드 워킹) ', |
| | | '大理片笼': '유리 분류 케이지', |
| | | '钢化': '강화', |
| | | '钢化查询': '강화 조회', |
| | | '钢化前': '강화 전', |
| | | '钢化后': '강화 후', |
| | | '下片台': '언로딩 스테이션', |
| | | '系统管理': '시스템 관리', |
| | | '用户管理': '사용자 관리', |
| | | '权限管理': '권한 관리', |
| | | '角色管理': '역할 관리', |
| | | '系统配置': '시스템 구성', |
| | | '可视化系统': '시각화 시스템', |
| | | '报工管理': '신문 관리', |
| | | '仓储中心': '창고 저장 센터', |
| | | '原片仓储': '원본 창고', |
| | | '中空': '중공', |
| | | '中空一线': '중공 일선', |
| | | '中空二线': '중공 2선', |
| | | '中空三线': '중공 3선', |
| | | '中空理片笼': '중공리 편롱', |
| | | '折铝框一线': '알루미늄 테두리 일선을 접다', |
| | | '折铝框二线': '알루미늄 프레임 2선 접기', |
| | | '折铝框三线': '알루미늄 테두리 세 줄을 접다.', |
| | | '大屏显示': '대형 화면 표시', |
| | | }; |
| | | menuData.forEach(menu => { |
| | | menu.menuName = translation[menu.menuName] || menu.menuName; |
| | |
| | | if (language.value === 'py') { |
| | | replaceChineseWithEnglish(menuList); |
| | | } |
| | | if (language.value === 'kr') { |
| | | replaceChineseWithKorean(menuList); |
| | | } |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | router.push('/login') |
| | | } |
| | | }) |
| | | request.post('/loadGlass/sys/menu/getNowDate').then((res) => { |
| | | if (res.code == 200) { |
| | | window.localStorage.setItem('getglobalDate', res.data) |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | const menu = ref(null) |
| | |
| | | isCollapse.value = !isCollapse.value; |
| | | } |
| | | onMounted(() => { |
| | | socket = initializeWebSocket(socketUrl, handleMessage); |
| | | // fetchlack() |
| | | // socket = initializeWebSocket(socketUrl, handleMessage); |
| | | }); |
| | | onUnmounted(() => { |
| | | if (socket) { |
| | | closeWebSocket(socket); |
| | | } |
| | | }); |
| | | // const fetchlack = async () => { |
| | | // try { |
| | | // console.log(33333); |
| | | // const response = await request.post('/loadGlass/sys/menu/getNowDate') |
| | | // console.log(response.code); |
| | | // if (response.code == 200) { |
| | | // console.log(11111); |
| | | // console.log(response.data); |
| | | // console.log(2222); |
| | | // // window.localStorage.setItem('getglobalDate', response.data) |
| | | // } else { |
| | | // ElMessage.error(response.message); |
| | | // } |
| | | // } |
| | | // catch (error) { |
| | | // // 处理错误 |
| | | // } |
| | | // } |
| | | let getglobalDate = window.localStorage.getItem('getglobalDate') |
| | | provide('globalDate', getglobalDate); |
| | | // onUnmounted(() => { |
| | | // if (socket) { |
| | | // closeWebSocket(socket); |
| | | // } |
| | | // }); |
| | | </script> |
| | | <template> |
| | | <div id="all"> |