|
@@ -1,4 +1,5 @@
|
|
|
import { asyncRoutes, constantRoutes } from '@/router'
|
|
|
+import { getModule } from '@/api/goods'
|
|
|
|
|
|
/**
|
|
|
* Use meta.role to determine if the current user has permission
|
|
@@ -55,8 +56,43 @@ const actions = {
|
|
|
} else {
|
|
|
accessedRoutes = filterAsyncRoutes(asyncRoutes, roles)
|
|
|
}
|
|
|
- commit('SET_ROUTES', accessedRoutes)
|
|
|
- resolve(accessedRoutes)
|
|
|
+ getModule({ organizeID: 1 }).then(response => {
|
|
|
+ const modules = response.data[0]
|
|
|
+ if (accessedRoutes[0].name === 'Goods') {
|
|
|
+ if (modules && modules.firstModulesName) {
|
|
|
+ accessedRoutes[0].children.unshift({
|
|
|
+ path: '/goods/list/preferred',
|
|
|
+ name: 'PreferredProduct',
|
|
|
+ component: () => import('@/views/goods/list-preferred'),
|
|
|
+ meta: { title: modules.firstModulesName, noCache: true, activeMenu: '/goods/list' },
|
|
|
+ hidden: true
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (modules && modules.secondModulesName) {
|
|
|
+ accessedRoutes[0].children.unshift({
|
|
|
+ path: '/goods/list/preferential',
|
|
|
+ name: 'PreferentialProduct',
|
|
|
+ component: () => import('@/views/goods/list-preferential'),
|
|
|
+ meta: { title: modules.secondModulesName, noCache: true, activeMenu: '/goods/list' },
|
|
|
+ hidden: true
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (modules && modules.thirdModulesName) {
|
|
|
+ accessedRoutes[0].children.unshift({
|
|
|
+ path: '/goods/list/commonly',
|
|
|
+ name: 'CommonlyProduct',
|
|
|
+ component: () => import('@/views/goods/list-commonly'),
|
|
|
+ meta: { title: modules.thirdModulesName, noCache: true, activeMenu: '/goods/list' },
|
|
|
+ hidden: true
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ commit('SET_ROUTES', accessedRoutes)
|
|
|
+ resolve(accessedRoutes)
|
|
|
+ }).catch(() => {
|
|
|
+ commit('SET_ROUTES', accessedRoutes)
|
|
|
+ resolve(accessedRoutes)
|
|
|
+ })
|
|
|
})
|
|
|
}
|
|
|
}
|