获取用户动态路由
- this.authRoutes = this.$store.state.permission.routes.filter(item => item.path);
- const secondroute = this.authRoutes.find(item => item.path === '/todoItem');
- if (secondroute && secondroute.children.find(item => item.path === 'materialWarnDetails')) {
- this.getTreeselect()
- }
定义公共方法
- funXinxiku(routePath, componentName) {
- const secondRoute = this.authRoutes.find(item => item.path === '/base');
-
- if (secondRoute && secondRoute.children.find(item => item.path === routePath)) {
- this.$router.push({ name: componentName });
- } else {
- this.$message.error('暂无权限,需要请联系管理员');
- }
- },
- funMaterial(routePath, componentName) {
- const secondRoute = this.authRoutes.find(item => item.path === '/material');
-
- if (secondRoute && secondRoute.children.find(item => item.path === routePath)) {
- this.$router.push({ name: componentName });
- } else {
- this.$message.error('暂无权限,需要请联系管理员');
- }
- },
点击传入参数调用方法
-
- xinxiku() {
- this.funXinxiku('information', 'Information');
- },
- bianmaku() {
- this.funXinxiku('material', 'Material');
- },
- gongyingfang() {
- this.funXinxiku('supplier', 'Supplier');
- },
- fenbaofang() {
- this.funXinxiku('supplier2', 'Supplier2');
-
- },
- fahuodan() {
- this.funMaterial('dispatch', 'Dispatch');
-
- },
- daohuodan() {
- this.funMaterial('arrival', 'Arrival');
- },
- yanshoudan() {
- this.funMaterial('check', 'Check');
- },
- lingliaodan() {
- this.funMaterial('receiveOrder', 'ReceiveOrder');
-
- },
- tuiliaodan() {
- this.funMaterial('returnOrder', 'ReturnOrder');
-
- },
- zulinshebei() {
- this.funMaterial('rentaldevice', 'Rentaldevice');
-
- },