feat(bx-mobile): guard routes by portal menuCodes and drop bx admin IAM pages
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
a4f04ff297
commit
a0eebfdbd3
2 files changed
+158
-50
No files matched your search
@@ -28,20 +28,37 @@
|
||||
<van-cell title="修改密码" icon="lock" is-link @click="showPasswordDialog = true" />
|
||||
</van-cell-group>
|
||||
|
||||
<!-- Finance / approver actions -->
|
||||
<template v-if="isApprover">
|
||||
<van-cell-group inset class="group-block" title="审批管理">
|
||||
<van-cell title="备用金审批" icon="cash-back-record" is-link to="/advance/approve" />
|
||||
<van-cell title="报销审批" icon="description" is-link to="/reimburse/approve" />
|
||||
<van-cell title="发放管理" icon="balance-list-o" is-link to="/advance/issue" />
|
||||
<van-cell title="全部记录" icon="records" is-link to="/all" />
|
||||
</van-cell-group>
|
||||
</template>
|
||||
|
||||
<!-- Admin section -->
|
||||
<template v-if="auth.isAdmin">
|
||||
<van-cell-group inset class="group-block" title="系统">
|
||||
<van-cell title="系统管理" icon="setting-o" is-link to="/admin" />
|
||||
<!-- 按门户 menuCode 显隐快捷入口 -->
|
||||
<template v-if="showQuickNav">
|
||||
<van-cell-group inset class="group-block" title="快捷入口">
|
||||
<van-cell
|
||||
v-if="auth.can('bx:advanceApprove:list')"
|
||||
title="备用金审批"
|
||||
icon="cash-back-record"
|
||||
is-link
|
||||
to="/advance/approve"
|
||||
/>
|
||||
<van-cell
|
||||
v-if="auth.can('bx:reimburseApprove:list')"
|
||||
title="报销审批"
|
||||
icon="description"
|
||||
is-link
|
||||
to="/reimburse/approve"
|
||||
/>
|
||||
<van-cell
|
||||
v-if="auth.can('bx:advanceIssue:list')"
|
||||
title="发放管理"
|
||||
icon="balance-list-o"
|
||||
is-link
|
||||
to="/advance/issue"
|
||||
/>
|
||||
<van-cell
|
||||
v-if="auth.can('bx:viewAll:list')"
|
||||
title="全部记录"
|
||||
icon="records"
|
||||
is-link
|
||||
to="/all"
|
||||
/>
|
||||
</van-cell-group>
|
||||
</template>
|
||||
|
||||
@@ -128,10 +145,12 @@ const passwordForm = reactive({
|
||||
confirmPassword: '',
|
||||
})
|
||||
|
||||
const APPROVER_ROLES = ['ADMIN', 'FINANCE', 'GENERAL_MANAGER']
|
||||
|
||||
const isApprover = computed(() =>
|
||||
APPROVER_ROLES.some((r) => auth.roleCodes.includes(r)),
|
||||
const showQuickNav = computed(
|
||||
() =>
|
||||
auth.can('bx:advanceApprove:list') ||
|
||||
auth.can('bx:reimburseApprove:list') ||
|
||||
auth.can('bx:advanceIssue:list') ||
|
||||
auth.can('bx:viewAll:list'),
|
||||
)
|
||||
|
||||
const avatarChar = computed(() => {
|
||||
@@ -140,13 +159,11 @@ const avatarChar = computed(() => {
|
||||
})
|
||||
|
||||
const roleText = computed(() => {
|
||||
const codes = auth.roleCodes
|
||||
const parts: string[] = []
|
||||
if (codes.includes('ADMIN')) parts.push('管理员')
|
||||
if (codes.includes('GENERAL_MANAGER')) parts.push('总经理')
|
||||
if (codes.includes('FINANCE')) parts.push('财务人员')
|
||||
if (codes.includes('EMPLOYEE')) parts.push('员工')
|
||||
return parts.join('、') || '未分配角色'
|
||||
if (auth.isSuperAdmin || auth.allMenus) return '超级管理员'
|
||||
const role = auth.user?.role
|
||||
if (role) return role
|
||||
const roles = auth.user?.roles || []
|
||||
return roles.length ? roles.join('、') : '已登录'
|
||||
})
|
||||
|
||||
async function handleLogout() {
|
||||
|
||||
Reference in new issue
Block a user