fix event record
This commit is contained in:
@@ -48,7 +48,7 @@
|
||||
:title="item.title"
|
||||
arrow
|
||||
hover
|
||||
@click="go(item.path)"
|
||||
@click="go(item)"
|
||||
>
|
||||
<template #leftIcon>
|
||||
<t-icon :name="item.icon" size="1.75rem" />
|
||||
@@ -87,6 +87,7 @@ type MenuItem = {
|
||||
path: string;
|
||||
title: string;
|
||||
visible: boolean;
|
||||
action?: "store";
|
||||
};
|
||||
|
||||
type MenuGroup = {
|
||||
@@ -108,6 +109,7 @@ const currentUserAvatar = computed(() => buildUserAvatar(currentUser.value));
|
||||
const canSelectStore = computed(() => userStore.hasRoles(gaoRoleCodes.globalManager));
|
||||
const canLoadLoginStore = computed(() => userStore.hasRoles([gaoRoleCodes.storeManager, gaoRoleCodes.employee], "or"));
|
||||
const canViewStore = computed(() => canSelectStore.value || canLoadLoginStore.value);
|
||||
const canManageStore = computed(() => userStore.hasRoles([gaoRoleCodes.globalManager, gaoRoleCodes.storeManager], "or"));
|
||||
const canManagePermission = computed(() => (
|
||||
userStore.hasRoles(coreRoleCodes.admin) || userStore.hasRoles(coreRoleCodes.userRoleAdmin)
|
||||
) && userStore.hasPermissions([
|
||||
@@ -166,7 +168,8 @@ const menuGroupList = computed<MenuGroup[]>(() => [
|
||||
icon: "shop",
|
||||
path: "/management/stores",
|
||||
title: "门店管理",
|
||||
visible: canSelectStore.value && userStore.hasPermissions(permissionCodes.store.read)
|
||||
action: "store",
|
||||
visible: canManageStore.value && userStore.hasPermissions(permissionCodes.store.read)
|
||||
},
|
||||
{
|
||||
icon: "usergroup",
|
||||
@@ -235,8 +238,24 @@ function buildUserAvatar(user?: UserAvatarSource): string {
|
||||
return UserAPI.getAvatarURL(user) || buildFallbackAvatar(currentUser.value?.name, "#0f766e");
|
||||
}
|
||||
|
||||
async function go(path: string): Promise<void> {
|
||||
await router.push(path);
|
||||
async function go(item: MenuItem | string): Promise<void> {
|
||||
if (typeof item === "string") {
|
||||
await router.push(item);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.action === "store" && !canSelectStore.value) {
|
||||
const store = await currentStoreStore.loadLoginStore();
|
||||
if (!store?.id) {
|
||||
Toast.warning("未绑定所属门店");
|
||||
return;
|
||||
}
|
||||
|
||||
await router.push(`/management/stores/${store.id}`);
|
||||
return;
|
||||
}
|
||||
|
||||
await router.push(item.path);
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
|
||||
Reference in New Issue
Block a user