| | |
| | | import { logout, selectMenuRecursive } from '@/api/api'; |
| | | import { removeToken, getToken } from '@/utils/auth'; |
| | | import customElMenu from '../components/customElMenu.vue'; |
| | | import { queryMenuTree } from '../api/api'; |
| | | import { queryMenuTree, getPerms } from '../api/api'; |
| | | import colorChange from '../views/maintenance/colorChange.vue'; |
| | | import { containsCoordinate } from 'ol/extent'; |
| | | import Vue from 'vue'; |
| | |
| | | itemdetail: {}, |
| | | formLabelWidth: '70px', |
| | | count: 5, |
| | | changeSelectStyle: 5, |
| | | changeSelectStyle: null, |
| | | changeliSelect: null, |
| | | changeSelectdiv: false, |
| | | listMenu: [ |
| | |
| | | mounted() { |
| | | this.getMenuTree(); |
| | | }, |
| | | computed: { |
| | | // 我们使用计算属性来获取到当前点击的菜单的路由路径,然后设置default-active中的值 |
| | | // 使得菜单在载入时就能对应高亮 |
| | | // activeIndex() { |
| | | // const route = this.$route; |
| | | // const { meta, path } = route; |
| | | // // if set path, the sidebar will highlight the path you set |
| | | // // 可以在路由配置文件中设置自定义的路由路径到meta.activeMenu属性中,来控制菜单自定义高亮显示 |
| | | // if (meta.activeMenu) { |
| | | // return meta.activeMenu; |
| | | // } |
| | | // return path; |
| | | // }, |
| | | }, |
| | | computed: {}, |
| | | methods: { |
| | | //主题切换 |
| | | setThemeColors() { |
| | | // var value; |
| | | // if (this.themeColor) { |
| | | // value = '#303030'; |
| | | // } else { |
| | | // value = '#409EFF'; |
| | | // } |
| | | // localStorage.setItem('theme', value); |
| | | // this.$store.commit('setSkin', value); |
| | | async getCookies() { |
| | | var boolean = this.getTimeCookies(); |
| | | if (boolean != true) { |
| | | this.$router.push('/login'); |
| | | return; |
| | | } |
| | | if (this.$store.state.permsEntity.length == 0) { |
| | | const data = await getPerms(); |
| | | this.$store.state.permsEntity = data.result; |
| | | } |
| | | this.$store.state.uname = JSON.parse( |
| | | localStorage.getItem('LFToken') |
| | | ).uname; |
| | | this.$router.push('/'); |
| | | }, |
| | | getTimeCookies() { |
| | | var time1 = new Date(JSON.parse(localStorage.getItem('LFToken')).time); |
| | | var time2 = new Date(); |
| | | if (time2 > time1) { |
| | | return false; |
| | | } else { |
| | | return true; |
| | | } |
| | | }, |
| | | //主题切换 |
| | | setThemeColors() {}, |
| | | //鼠标移入菜单事件 |
| | | setMenuMove(index, item) { |
| | | var that = this; |
| | | |
| | | if (item.perms != null) { |
| | | this.$router.push(item.url); |
| | | this.setShowFalseDiv(false); |
| | | this.changeliSelect = '呵呵'; |
| | | this.showFlag = null; |
| | | if (this.showFlag != null) { |
| | | this.setShowFalseDiv(false); |
| | | this.changeliSelect = '%%'; |
| | | this.showFlag = null; |
| | | } |
| | | } else { |
| | | if (this.showFlag != index) { |
| | | this.showFlag = index; |
| | |
| | | |
| | | this.changeSelectStyle = index; |
| | | }, |
| | | |
| | | setShowFalseDiv(bolean) { |
| | | var index = this.showFlag; |
| | | let newItem = this.listMenu[index]; |
| | |
| | | this.setShowFalseDiv(false); |
| | | this.changeliSelect = res.cnName; |
| | | this.$router.push(res.url); |
| | | this.$store.commit('currentPerms', res.perms); |
| | | }, |
| | | async getMenuTree() { |
| | | //获取目录树最大ID,新建节点使用 |
| | | // queryMaxId().then((res) => { |
| | | // this.id = res.data; |
| | | // }); |
| | | // |
| | | |
| | | this.getCookies(); |
| | | const data = await queryMenuTree(); |
| | | var that = this; |
| | | if (data.code == 200) { |
| | |
| | | res[i].children = result.result.filter((value) => { |
| | | return value.pid == res[i].id; |
| | | }); |
| | | this.listMenu.push(res[i]); |
| | | this.changeSelectStyle = this.listMenu.length - 1; |
| | | var strartMneu = res[i].children[0]; |
| | | this.$store.commit('currentPerms', strartMneu.perms); |
| | | this.changeliSelect = strartMneu.cnName; |
| | | this.$bus.$emit('currentPerms', strartMneu.perms); |
| | | } else { |
| | | this.listMenu.push(res[i]); |
| | | } |
| | | this.listMenu.push(res[i]); |
| | | } |
| | | }, |
| | | treeData(source) { |
| | |
| | | } |
| | | .secondMenuDiv { |
| | | position: absolute; |
| | | z-index: 30; |
| | | z-index: 1024; |
| | | margin-top: 10px; |
| | | border: 1px solid white; |
| | | border-radius: 5px; |