菜单
This commit is contained in:
@@ -93,7 +93,7 @@
|
||||
<script>
|
||||
import jxTime from '@components/time.vue'
|
||||
import jxDialog from '@components/dialog.vue'
|
||||
import { updatePass } from '@config/getData2.js'
|
||||
import { updatePass, sysMenuBuild, authLogout } from '@config/getData2.js'
|
||||
import {encrypt} from '../../../main.js'
|
||||
export default {
|
||||
components: {
|
||||
@@ -103,84 +103,85 @@ export default {
|
||||
data () {
|
||||
return {
|
||||
username: this.$store.getters.userInfo !== '' ? JSON.parse(this.$store.getters.userInfo).user.username : '',
|
||||
menus: [{
|
||||
label: '首页',
|
||||
index: '1',
|
||||
router: '',
|
||||
children: [{
|
||||
label: '首页',
|
||||
index: '1',
|
||||
router: '/index/home'
|
||||
}]
|
||||
}, {
|
||||
label: '任务管理',
|
||||
index: '2',
|
||||
router: '',
|
||||
children: [{
|
||||
label: '搬运站点',
|
||||
index: '1',
|
||||
router: '/index/carrypoint'
|
||||
}, {
|
||||
label: '任务列表',
|
||||
index: '2',
|
||||
router: '/index/tasklists'
|
||||
}, {
|
||||
label: '任务操作',
|
||||
index: '3',
|
||||
router: '/index/taskoperates'
|
||||
}]
|
||||
}, {
|
||||
label: '故障管理',
|
||||
index: '3',
|
||||
router: '',
|
||||
children: [{
|
||||
label: '故障信息',
|
||||
index: '1',
|
||||
router: '/index/errorinfo'
|
||||
}, {
|
||||
label: '故障处理',
|
||||
index: '2',
|
||||
router: '/index/errordeal'
|
||||
}]
|
||||
}, {
|
||||
label: '车辆信息',
|
||||
index: '4',
|
||||
router: '',
|
||||
children: [{
|
||||
label: '车辆状态',
|
||||
index: '1',
|
||||
router: '/index/vehiclestatus'
|
||||
}, {
|
||||
label: '车辆控制',
|
||||
index: '2',
|
||||
router: '/index/vehiclecontrol'
|
||||
}]
|
||||
}, {
|
||||
label: '示教',
|
||||
index: '5',
|
||||
router: '/index/teach'
|
||||
}, {
|
||||
label: '系统管理',
|
||||
index: '6',
|
||||
router: '',
|
||||
children: [{
|
||||
label: '用户管理',
|
||||
index: '1',
|
||||
router: '/index/user'
|
||||
}, {
|
||||
label: '角色管理',
|
||||
index: '2',
|
||||
router: '/index/role'
|
||||
}, {
|
||||
label: '系统参数',
|
||||
index: '3',
|
||||
router: '/index/system'
|
||||
}, {
|
||||
label: '开发者选项',
|
||||
index: '4',
|
||||
router: '/index/developer'
|
||||
}]
|
||||
}],
|
||||
menus: [] || JSON.parse(this.$store.getters.menus),
|
||||
// menus: [{
|
||||
// label: '首页',
|
||||
// index: '1',
|
||||
// router: '',
|
||||
// children: [{
|
||||
// label: '首页',
|
||||
// index: '1',
|
||||
// router: '/index/home'
|
||||
// }]
|
||||
// }, {
|
||||
// label: '任务管理',
|
||||
// index: '2',
|
||||
// router: '',
|
||||
// children: [{
|
||||
// label: '搬运站点',
|
||||
// index: '1',
|
||||
// router: '/index/carrypoint'
|
||||
// }, {
|
||||
// label: '任务列表',
|
||||
// index: '2',
|
||||
// router: '/index/tasklists'
|
||||
// }, {
|
||||
// label: '任务操作',
|
||||
// index: '3',
|
||||
// router: '/index/taskoperates'
|
||||
// }]
|
||||
// }, {
|
||||
// label: '故障管理',
|
||||
// index: '3',
|
||||
// router: '',
|
||||
// children: [{
|
||||
// label: '故障信息',
|
||||
// index: '1',
|
||||
// router: '/index/errorinfo'
|
||||
// }, {
|
||||
// label: '故障处理',
|
||||
// index: '2',
|
||||
// router: '/index/errordeal'
|
||||
// }]
|
||||
// }, {
|
||||
// label: '车辆信息',
|
||||
// index: '4',
|
||||
// router: '',
|
||||
// children: [{
|
||||
// label: '车辆状态',
|
||||
// index: '1',
|
||||
// router: '/index/vehiclestatus'
|
||||
// }, {
|
||||
// label: '车辆控制',
|
||||
// index: '2',
|
||||
// router: '/index/vehiclecontrol'
|
||||
// }]
|
||||
// }, {
|
||||
// label: '示教',
|
||||
// index: '5',
|
||||
// router: '/index/teach'
|
||||
// }, {
|
||||
// label: '系统管理',
|
||||
// index: '6',
|
||||
// router: '',
|
||||
// children: [{
|
||||
// label: '用户管理',
|
||||
// index: '1',
|
||||
// router: '/index/user'
|
||||
// }, {
|
||||
// label: '角色管理',
|
||||
// index: '2',
|
||||
// router: '/index/role'
|
||||
// }, {
|
||||
// label: '系统参数',
|
||||
// index: '3',
|
||||
// router: '/index/system'
|
||||
// }, {
|
||||
// label: '开发者选项',
|
||||
// index: '4',
|
||||
// router: '/index/developer'
|
||||
// }]
|
||||
// }],
|
||||
dropdown: false,
|
||||
oldpassword: '',
|
||||
newpassword1: '',
|
||||
@@ -193,7 +194,11 @@ export default {
|
||||
return this.$route.meta.jumpPath
|
||||
},
|
||||
childmenus () {
|
||||
return this.menus[Number(this.$route.meta.jumpPath) - 1].children
|
||||
let res = []
|
||||
if (this.menus.length) {
|
||||
res = this.menus[Number(this.$route.meta.jumpPath) - 1].children
|
||||
}
|
||||
return res
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -220,11 +225,14 @@ export default {
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.menus.map(el => {
|
||||
if (el.router === this.$route.path) {
|
||||
this.childmenus = el.children
|
||||
}
|
||||
})
|
||||
this._sysMenuBuild()
|
||||
if (this.menus.length) {
|
||||
this.menus.map(el => {
|
||||
if (el.router === this.$route.path) {
|
||||
this.childmenus = el.children
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleSelect (key) {
|
||||
@@ -292,8 +300,22 @@ export default {
|
||||
this.$refs.child.disabled = false
|
||||
}
|
||||
},
|
||||
async _sysMenuBuild () {
|
||||
let res = await sysMenuBuild()
|
||||
this.menus = [...res]
|
||||
res.map(el => {
|
||||
if (el.router === this.$route.path) {
|
||||
this.childmenus = el.children
|
||||
}
|
||||
})
|
||||
this.$store.dispatch('getMenus', [...res])
|
||||
},
|
||||
async _authLogout () {
|
||||
await authLogout()
|
||||
},
|
||||
toEixt () {
|
||||
this.$store.dispatch('setSignOut')
|
||||
this._authLogout()
|
||||
this.$router.push('/login')
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user