| | |
| | | <script setup> |
| | | import { RouterLink,useRouter} from 'vue-router' |
| | | import useUserInfoStore from '@/stores/userInfo' |
| | | import {useRouter} from 'vue-router' |
| | | import useUserInfoStore from '@/stores/userInfo' |
| | | import userInfo from '@/stores/userInfo' |
| | | import request from "@/utils/request"; |
| | | import {ElMessage} from "element-plus"; |
| | | import {onMounted, reactive, ref, watch} from "vue" |
| | | import {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"; |
| | | const store=userInfo() |
| | | |
| | | const store = userInfo() |
| | | |
| | | const router = useRouter() |
| | | const userStore = useUserInfoStore() |
| | | const user = userStore.user.userName |
| | | |
| | | // store.createWebSocket(); |
| | | function quit(){ |
| | | function quit() { |
| | | userStore.$patch({ |
| | | user:null |
| | | user: null |
| | | }) |
| | | router.push("/login") |
| | | } |
| | | |
| | | |
| | | //提取模块列表 |
| | | let menuList=$ref([]) |
| | | request.get("/menu").then((res) => { |
| | | if(res.code==200){ |
| | | menuList= deepClone(res.data) |
| | | }else{ |
| | | let menuList = $ref([]) |
| | | request.get('/menu/sysMenu/list').then((res) => { |
| | | if (res.code == 200) { |
| | | menuList = deepClone(res.data) |
| | | } else { |
| | | ElMessage.warning(res.msg) |
| | | router.push("/login") |
| | | router.push('/login') |
| | | } |
| | | }) |
| | | |
| | | //获取菜单列表 |
| | | let menuItemList=$ref([]) |
| | | request.get("/menuItem").then((res) => { |
| | | if(res.code==200){ |
| | | menuItemList= deepClone(res.data) |
| | | }else{ |
| | | ElMessage.warning(res.msg) |
| | | router.push("/login") |
| | | } |
| | | }) |
| | | // let menuItemList = $ref([]) |
| | | // request.get('/menuItem').then((res) => { |
| | | // if (res.code == 200) { |
| | | // menuItemList = deepClone(res.data) |
| | | // } else { |
| | | // ElMessage.warning(res.msg) |
| | | // router.push('/login') |
| | | // } |
| | | // }) |
| | | |
| | | const menu = ref(null) |
| | | let indexKey = ref(null) |
| | | |
| | | function handleOpen(key) { |
| | | indexKey.value=key |
| | | indexKey.value = key |
| | | } |
| | | watch(indexKey,(newVal,oldVal) => { |
| | | if(oldVal !== newVal && oldVal !== null){ |
| | | menu.value.close(oldVal) |
| | | } |
| | | |
| | | watch(indexKey, (newVal, oldVal) => { |
| | | if (oldVal !== newVal && oldVal !== null) { |
| | | menu.value.close(oldVal) |
| | | } |
| | | }, |
| | | {deep:true} |
| | | ) |
| | |
| | | <div style="height: 100%;width: 100%;display: flex;background-color: #fff;"> |
| | | <img src="../assets/northGlass.ico" alt="" style="max-width: 100%;max-height: 100%"> |
| | | <h3 style="margin: 1rem ;font-weight: bold;width: 20vw;"> 欢迎{{ user }}使用北玻MES系统!</h3> |
| | | <span style="height: 70%;width: 78vw;margin-top: 1rem;" > |
| | | <el-button class="sys-quit" @click="quit" round> |
| | | <el-icon size="large"><SwitchButton size=""/></el-icon> |
| | | <span style="height: 70%;width: 78vw;margin-top: 1rem;"> |
| | | <el-button class="sys-quit" @click="quit" round> |
| | | <el-icon size="large"><SwitchButton size=""/></el-icon> |
| | | </el-button> |
| | | </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 class='indicator' >⌵</span> --> |
| | | <!-- <span class='indicator' >≡</span> --> |
| | | <!-- <img src="../assets/9.png" alt="" style="max-width: 50%;max-height: 50%;"> --> |
| | | <span>☰</span> |
| | | {{items.menuName}} |
| | | </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> |
| | | <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 class='indicator' >⌵</span> --> |
| | | <!-- <span class='indicator' >≡</span> --> |
| | | <!-- <img src="../assets/9.png" alt="" style="max-width: 50%;max-height: 50%;"> --> |
| | | <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> |
| | | |
| | | </li> |
| | | </ul> |
| | | </div> |
| | | </div> |
| | | </el-aside> |
| | | |