| | |
| | | import { logout } from '@/api/api'; |
| | | import { removeToken, getToken } from '@/utils/auth'; |
| | | import customElMenu from '../components/customElMenu.vue'; |
| | | import { queryMenuTree, getPerms } from '../api/api'; |
| | | import { queryMenuTree } from '../api/api'; |
| | | import colorChange from '../views/maintenance/colorChange.vue'; |
| | | export default { |
| | | name: 'navMenu', |
| | |
| | | label: '数据质检', |
| | | class: 'm1', |
| | | checkClass: 'm11', |
| | | url: '', |
| | | }, |
| | | { |
| | | label: '数据交换', |
| | | class: 'm2', |
| | | checkClass: 'm21', |
| | | url: '', |
| | | }, |
| | | { |
| | | label: '数据管理', |
| | | class: 'm3', |
| | | checkClass: 'm31', |
| | | url: '', |
| | | }, |
| | | { |
| | | label: '服务管理', |
| | | class: 'm4', |
| | | checkClass: 'm41', |
| | | url: '', |
| | | }, |
| | | { |
| | | label: '综合展示', |
| | | class: 'm5', |
| | | checkClass: 'm51', |
| | | url: '', |
| | | }, |
| | | { |
| | | label: '运维管理', |
| | | class: 'm6', |
| | | checkClass: 'm61', |
| | | url: '', |
| | | }, |
| | | ], |
| | | }; |
| | | }, |
| | | created() {}, |
| | | mounted() { |
| | | this.getUserPerms(); |
| | | this.getMenuTree(); |
| | | }, |
| | | computed: { |
| | |
| | | }, |
| | | //鼠标移入菜单事件 |
| | | setMenuMove(index, item) { |
| | | this.$router.push(item.url); |
| | | this.changeSelectStyle = index; |
| | | }, |
| | | getMenuTree() { |
| | | async getMenuTree() { |
| | | //获取目录树最大ID,新建节点使用 |
| | | // queryMaxId().then((res) => { |
| | | // this.id = res.data; |
| | | // }); |
| | | // 获取目录树数据 |
| | | queryMenuTree().then((res) => { |
| | | if (res.code == 200) { |
| | | if (res.result.length != 0) { |
| | | let menuLists = res.result.filter((value) => { |
| | | return value.pid == 1; |
| | | }); |
| | | // console.log(menuLists); |
| | | this.menuList = menuLists; |
| | | } else { |
| | | alert('暂无菜单栏数据'); |
| | | } |
| | | // |
| | | |
| | | const data = await queryMenuTree(); |
| | | var that = this; |
| | | if (data.code == 200) { |
| | | if (data.result.length != 0) { |
| | | let menuLists = data.result.filter((value) => { |
| | | return value.pid == 1; |
| | | }); |
| | | |
| | | that.menuList = menuLists; |
| | | that.setMenuTree(menuLists); |
| | | } else { |
| | | console.log('接口报错'); |
| | | alert('暂无菜单栏数据'); |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | setMenuTree(res) { |
| | | console.log(res); |
| | | for (var i = 0; i < res.length; i++) { |
| | | for (var j = 0; j < this.listMenu.length; j++) { |
| | | if (this.listMenu[j].label == res[i].cnName) { |
| | | this.listMenu[j].url = res[i].perms; |
| | | } |
| | | } |
| | | } |
| | | console.log(this.listMenu); |
| | | }, |
| | | treeData(source) { |
| | | let cloneData = JSON.parse(JSON.stringify(source)); // 对源数据深度克隆 |
| | |
| | | this.$router.push(index); |
| | | } |
| | | }, |
| | | getUserPerms() { |
| | | getPerms().then((res) => { |
| | | if (res.code == 200) this.$store.commit('getPermsEntity', res.result); |
| | | }); |
| | | }, |
| | | }, |
| | | watch: { |
| | | $route() { |
| | |
| | | .logo { |
| | | width: 80px; |
| | | height: 80px; |
| | | margin-left: 30px; |
| | | margin-top: 33px; |
| | | background: url('../assets/img/图层 34.png') no-repeat 100% 100%; |
| | | // margin-left: 30px; |
| | | // margin-top: 33px; |
| | | // background: url('../assets/img/图层 34.png') no-repeat 100% 100%; |
| | | } |
| | | // .rightWrapper { |
| | | // width: 70%; |