|
|
|
@@ -14,7 +14,11 @@
|
|
|
|
|
/>
|
|
|
|
|
</t-dropdown-menu>
|
|
|
|
|
</div>
|
|
|
|
|
<t-cell-group v-if="activeRole && grantablePermissionList.length" title="可配置的转授权限 D" theme="card">
|
|
|
|
|
<t-cell-group
|
|
|
|
|
v-if="activeRole && grantablePermissionList.length"
|
|
|
|
|
title="允许该角色可继续往下级角色转授权限"
|
|
|
|
|
theme="card"
|
|
|
|
|
>
|
|
|
|
|
<t-cell
|
|
|
|
|
v-for="item in grantablePermissionList"
|
|
|
|
|
:key="item.id"
|
|
|
|
@@ -33,15 +37,6 @@
|
|
|
|
|
</t-cell>
|
|
|
|
|
</t-cell-group>
|
|
|
|
|
<t-empty v-else-if="!permissionStore.loading" description="暂无可配置的转授权限 D" />
|
|
|
|
|
<t-button
|
|
|
|
|
v-if="canEditActiveRole"
|
|
|
|
|
v-can="rolePermissionWriteAccess"
|
|
|
|
|
class="save"
|
|
|
|
|
theme="primary"
|
|
|
|
|
@click="savePermissionList"
|
|
|
|
|
>
|
|
|
|
|
保存 D
|
|
|
|
|
</t-button>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
@@ -49,6 +44,7 @@
|
|
|
|
|
import type { DropdownOption, DropdownValue } from "tdesign-mobile-vue";
|
|
|
|
|
import { Toast } from "tdesign-mobile-vue";
|
|
|
|
|
import { type Permission, useUserStore } from "timi-web";
|
|
|
|
|
import { useNavBarStore } from "@/store/navBarStore";
|
|
|
|
|
import { type Role, usePermissionSettingsStore } from "@/store/permissionSettingsStore";
|
|
|
|
|
import { getErrorMessage } from "@/utils/error";
|
|
|
|
|
import { corePermissionCodes, coreRoleCodes } from "@/utils/permission";
|
|
|
|
@@ -58,6 +54,7 @@ defineOptions({
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const permissionStore = usePermissionSettingsStore();
|
|
|
|
|
const navBarStore = useNavBarStore();
|
|
|
|
|
const userStore = useUserStore();
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
|
|
|
|
@@ -88,14 +85,6 @@ const roleOptions = computed<DropdownOption[]>(() => candidateRoleList.value
|
|
|
|
|
disabled: false
|
|
|
|
|
})));
|
|
|
|
|
|
|
|
|
|
const rolePermissionWriteAccess = {
|
|
|
|
|
value: [
|
|
|
|
|
corePermissionCodes.rolePermission.create,
|
|
|
|
|
corePermissionCodes.rolePermission.delete
|
|
|
|
|
],
|
|
|
|
|
mode: "and"
|
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
|
|
// ---------- 权限状态 ----------
|
|
|
|
|
|
|
|
|
|
const checkedPermissionIdSet = computed(() => new Set(checkedPermissionIds.value));
|
|
|
|
@@ -155,6 +144,17 @@ async function savePermissionList(): Promise<void> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function updateNavBar(): void {
|
|
|
|
|
navBarStore.clearRight();
|
|
|
|
|
if (canEditActiveRole.value && canUpdateRolePermission.value) {
|
|
|
|
|
navBarStore.setRightText("保存", "var(--td-brand-color)", savePermissionList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
watch([canEditActiveRole, canUpdateRolePermission], updateNavBar, { immediate: true });
|
|
|
|
|
onMounted(updateNavBar);
|
|
|
|
|
onUnmounted(navBarStore.clearRight);
|
|
|
|
|
|
|
|
|
|
// ---------- 权限勾选 ----------
|
|
|
|
|
|
|
|
|
|
function isPermissionChecked(permissionId: string): boolean {
|
|
|
|
@@ -185,8 +185,7 @@ function clearPermissionState(): void {
|
|
|
|
|
// ---------- 授权范围 ----------
|
|
|
|
|
|
|
|
|
|
async function loadAuthorizationScope(): Promise<void> {
|
|
|
|
|
const roleList = isSystemAdmin.value ? permissionStore.roleList : await permissionStore.loadManageableRoles();
|
|
|
|
|
candidateRoleList.value = roleList;
|
|
|
|
|
candidateRoleList.value = isSystemAdmin.value ? permissionStore.roleList : await permissionStore.loadManageableRoles();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
@@ -203,7 +202,7 @@ onMounted(async () => {
|
|
|
|
|
.role-delegation-permission-assign {
|
|
|
|
|
gap: 1rem;
|
|
|
|
|
display: flex;
|
|
|
|
|
padding: calc(var(--app-nav-height) + 4.5rem) 0 6rem 0;
|
|
|
|
|
padding: calc(var(--app-nav-height) + 3.5rem) 0 6rem 0;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
|
|
|
|
.header {
|
|
|
|
@@ -249,13 +248,6 @@ onMounted(async () => {
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.save {
|
|
|
|
|
left: 1rem;
|
|
|
|
|
right: 1rem;
|
|
|
|
|
bottom: calc(.75rem + env(safe-area-inset-bottom, 0));
|
|
|
|
|
position: fixed;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:global(html.theme-dark) {
|
|
|
|
|