feat: #7648 handle LeftMenu
This commit is contained in:
parent
e418a647be
commit
361024abe2
|
@ -9,6 +9,7 @@ import { toLowerCamel } from 'src/filters';
|
||||||
import routes from 'src/router/modules';
|
import routes from 'src/router/modules';
|
||||||
import LeftMenuItem from './LeftMenuItem.vue';
|
import LeftMenuItem from './LeftMenuItem.vue';
|
||||||
import LeftMenuItemGroup from './LeftMenuItemGroup.vue';
|
import LeftMenuItemGroup from './LeftMenuItemGroup.vue';
|
||||||
|
import { useRole } from 'src/composables/useRole';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -58,6 +59,8 @@ function addChildren(module, route, parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const items = ref([]);
|
const items = ref([]);
|
||||||
|
const role = useRole();
|
||||||
|
|
||||||
function getRoutes() {
|
function getRoutes() {
|
||||||
if (props.source === 'main') {
|
if (props.source === 'main') {
|
||||||
const modules = Object.assign([], navigation.getModules().value);
|
const modules = Object.assign([], navigation.getModules().value);
|
||||||
|
@ -66,9 +69,9 @@ function getRoutes() {
|
||||||
const moduleDef = routes.find(
|
const moduleDef = routes.find(
|
||||||
(route) => toLowerCamel(route.name) === item.module
|
(route) => toLowerCamel(route.name) === item.module
|
||||||
);
|
);
|
||||||
item.children = [];
|
|
||||||
|
|
||||||
if (!moduleDef) continue;
|
if (!moduleDef) continue;
|
||||||
|
if (!role.isEmployee()) continue;
|
||||||
|
item.children = [];
|
||||||
|
|
||||||
addChildren(item.module, moduleDef, item.children);
|
addChildren(item.module, moduleDef, item.children);
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ export const useNavigationStore = defineStore('navigationStore', () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function fetchPinned() {
|
async function fetchPinned() {
|
||||||
if (pinnedModules.value.length) return;
|
if (pinnedModules.value.length || !role.isEmployee()) return;
|
||||||
|
|
||||||
const response = await axios.get('StarredModules/getStarredModules');
|
const response = await axios.get('StarredModules/getStarredModules');
|
||||||
pinnedModules.value = response.data.map((row) => row.moduleFk);
|
pinnedModules.value = response.data.map((row) => row.moduleFk);
|
||||||
|
|
Loading…
Reference in New Issue