add point chart

This commit is contained in:
Timi
2026-09-23 21:54:19 +08:00
parent f8574c387d
commit 3a9dbbb60b
14 changed files with 462 additions and 93 deletions
+8 -29
View File
@@ -53,7 +53,6 @@ const permissionStore = usePermissionSettingsStore();
const userStore = useUserStore();
const isRefreshing = ref(false);
const deletableRoleIdSet = ref(new Set<string>());
const directRoleIdSet = ref(new Set<string>());
// ---------- 顶部导航 ----------
@@ -80,9 +79,11 @@ const sortedRoles = computed<Array<Role & { level: number }>>(() => {
async function removeRole(id: string): Promise<void> {
try {
await permissionStore.removeRole(id);
} catch (error) {
await refreshAuthorizationScope();
await permissionStore.loadAll(true);
await refreshAuthorizationScope();
} catch (error) {
await permissionStore.loadAll(true);
await refreshAuthorizationScope();
Message.error(getErrorMessage(error, "角色删除失败"));
}
}
@@ -95,12 +96,7 @@ function canDeleteRole(role: Role): boolean {
}
function getRoleScopeLabel(role: Role): string {
const direct = directRoleIdSet.value.has(role.id);
const manageable = deletableRoleIdSet.value.has(role.id);
if (direct && manageable) {
return "直属且可管理";
}
return direct ? "直属角色" : "可管理角色";
return userStore.hasRoles(coreRoleCodes.admin) ? "系统角色" : role.ownerType === "STORE" ? "本店角色" : "可管理角色";
}
// ---------- 页面数据 ----------
@@ -121,9 +117,7 @@ onMounted(async () => {
if (canCreateRole.value) {
navBarStore.setRightText("添加", "var(--td-brand-color)", toCreate);
}
if (userStore.hasRoles(coreRoleCodes.admin)) {
await permissionStore.loadAll();
}
await permissionStore.loadAll();
await refreshAuthorizationScope();
if (!displayRoleList.value.length) {
displayRoleList.value = getDisplayRoleList();
@@ -163,23 +157,8 @@ async function refreshAuthorizationScope(): Promise<void> {
deletableRoleIdSet.value = new Set(permissionStore.roleList.map(item => item.id));
return;
}
try {
const [manageableRoleList, currentRoleList] = await Promise.all([
permissionStore.loadManageableRoles(),
permissionStore.loadCurrentRoleDetails()
]);
const roleMap = new Map<string, Role>();
for (const role of [...currentRoleList, ...manageableRoleList]) {
roleMap.set(role.id, role);
}
displayRoleList.value = Array.from(roleMap.values());
directRoleIdSet.value = new Set(currentRoleList.map(item => item.id).filter((id): id is string => Boolean(id)));
deletableRoleIdSet.value = new Set(manageableRoleList.map(item => item.id).filter((id): id is string => Boolean(id)));
} catch {
directRoleIdSet.value = new Set<string>();
deletableRoleIdSet.value = new Set<string>();
}
displayRoleList.value = permissionStore.roleList;
deletableRoleIdSet.value = new Set(permissionStore.roleList.map(item => item.id));
}
</script>