在路由权限校验中获取设备列表
This commit is contained in:
@ -11,10 +11,6 @@ import ThemePicker from "@/components/ThemePicker"
|
|||||||
export default {
|
export default {
|
||||||
name: "App",
|
name: "App",
|
||||||
components: { ThemePicker },
|
components: { ThemePicker },
|
||||||
mounted() {
|
|
||||||
//获取站点列表
|
|
||||||
this.$store.dispatch('getZdList')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@ -31,6 +31,7 @@ router.beforeEach((to, from, next) => {
|
|||||||
// 判断当前用户是否已拉取完user_info信息
|
// 判断当前用户是否已拉取完user_info信息
|
||||||
store.dispatch('GetInfo').then(() => {
|
store.dispatch('GetInfo').then(() => {
|
||||||
isRelogin.show = false
|
isRelogin.show = false
|
||||||
|
store.dispatch('getZdList')
|
||||||
store.dispatch('GenerateRoutes').then(accessRoutes => {
|
store.dispatch('GenerateRoutes').then(accessRoutes => {
|
||||||
// 根据roles权限生成可访问的路由表
|
// 根据roles权限生成可访问的路由表
|
||||||
router.addRoutes(accessRoutes) // 动态添加可访问路由表
|
router.addRoutes(accessRoutes) // 动态添加可访问路由表
|
||||||
|
|||||||
@ -23,11 +23,14 @@ const ems = {
|
|||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
getZdList({commit,state}){
|
getZdList({commit,state}){
|
||||||
return getAllSites().then(response => {
|
if(state.zdList.length === 0){
|
||||||
|
getAllSites().then(response => {
|
||||||
commit('SET_ZD_LIST', response?.data || [])
|
commit('SET_ZD_LIST', response?.data || [])
|
||||||
console.log('store action getZdList 获取站点数据',state.zdList)
|
console.log('store action getZdList 获取站点数据',state.zdList)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user