feat: 管理端 RBAC 权限体系与员工管理
新增多角色权限控制(赛事/财务/客服管理员),支持员工 CRUD、路由菜单按权限显隐、审计日志范围过滤;登录返回角色与权限列表。玩家端赛事列表增加静默刷新避免图片闪烁。Seed 补充演示员工账号与充值相关权限。附带 RBAC/审计范围单元测试及 UAT 文档更新。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -13,10 +13,20 @@ withDefaults(
|
||||
row: PlayerActionRow;
|
||||
showDetail?: boolean;
|
||||
showLedger?: boolean;
|
||||
showEdit?: boolean;
|
||||
showDeposit?: boolean;
|
||||
showWithdraw?: boolean;
|
||||
showFreeze?: boolean;
|
||||
showDelete?: boolean;
|
||||
}>(),
|
||||
{
|
||||
showDetail: true,
|
||||
showLedger: true,
|
||||
showEdit: true,
|
||||
showDeposit: true,
|
||||
showWithdraw: true,
|
||||
showFreeze: true,
|
||||
showDelete: true,
|
||||
},
|
||||
);
|
||||
|
||||
@@ -42,13 +52,13 @@ const { t } = useAdminLocale();
|
||||
<el-button v-if="showLedger" link type="primary" size="small" @click="emit('ledger')">
|
||||
{{ t('user.action.ledger_short') }}
|
||||
</el-button>
|
||||
<el-button link type="primary" size="small" @click="emit('edit')">{{ t('common.edit') }}</el-button>
|
||||
<el-button link type="success" size="small" @click="emit('deposit')">{{ t('common.topup') }}</el-button>
|
||||
<el-button link type="warning" size="small" @click="emit('withdraw')">
|
||||
<el-button v-if="showEdit" link type="primary" size="small" @click="emit('edit')">{{ t('common.edit') }}</el-button>
|
||||
<el-button v-if="showDeposit" link type="success" size="small" @click="emit('deposit')">{{ t('common.topup') }}</el-button>
|
||||
<el-button v-if="showWithdraw" link type="warning" size="small" @click="emit('withdraw')">
|
||||
{{ t('agent_portal.withdraw_btn_label') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.status === 'ACTIVE'"
|
||||
v-if="showFreeze && row.status === 'ACTIVE'"
|
||||
link
|
||||
type="warning"
|
||||
size="small"
|
||||
@@ -56,26 +66,26 @@ const { t } = useAdminLocale();
|
||||
>
|
||||
{{ t('common.freeze') }}
|
||||
</el-button>
|
||||
<el-button v-else link type="primary" size="small" @click="emit('freeze')">
|
||||
<el-button v-else-if="showFreeze" link type="primary" size="small" @click="emit('freeze')">
|
||||
{{ t('common.unfreeze') }}
|
||||
</el-button>
|
||||
<el-button link type="danger" size="small" @click="emit('delete')">
|
||||
<el-button v-if="showDelete" link type="danger" size="small" @click="emit('delete')">
|
||||
{{ t('common.delete') }}
|
||||
</el-button>
|
||||
</template>
|
||||
<template #menu>
|
||||
<el-dropdown-item v-if="showDetail" @click="emit('detail')">{{ t('common.detail') }}</el-dropdown-item>
|
||||
<el-dropdown-item v-if="showLedger" @click="emit('ledger')">{{ t('user.action.view_wallet_ledger') }}</el-dropdown-item>
|
||||
<el-dropdown-item @click="emit('edit')">{{ t('common.edit') }}</el-dropdown-item>
|
||||
<el-dropdown-item divided @click="emit('deposit')">{{ t('common.topup') }}</el-dropdown-item>
|
||||
<el-dropdown-item @click="emit('withdraw')">
|
||||
<el-dropdown-item v-if="showEdit" @click="emit('edit')">{{ t('common.edit') }}</el-dropdown-item>
|
||||
<el-dropdown-item v-if="showDeposit" divided @click="emit('deposit')">{{ t('common.topup') }}</el-dropdown-item>
|
||||
<el-dropdown-item v-if="showWithdraw" @click="emit('withdraw')">
|
||||
<span class="action-warning">{{ t('agent_portal.withdraw_btn_label') }}</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item v-if="row.status === 'ACTIVE'" @click="emit('freeze')">
|
||||
<el-dropdown-item v-if="showFreeze && row.status === 'ACTIVE'" @click="emit('freeze')">
|
||||
<span class="action-warning">{{ t('common.freeze') }}</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item v-else @click="emit('freeze')">{{ t('common.unfreeze') }}</el-dropdown-item>
|
||||
<el-dropdown-item divided @click="emit('delete')">
|
||||
<el-dropdown-item v-else-if="showFreeze" @click="emit('freeze')">{{ t('common.unfreeze') }}</el-dropdown-item>
|
||||
<el-dropdown-item v-if="showDelete" divided @click="emit('delete')">
|
||||
<span class="action-danger">{{ t('common.delete') }}</span>
|
||||
</el-dropdown-item>
|
||||
</template>
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { RouterLink, useRoute } from 'vue-router';
|
||||
import { useAdminLocale } from '../composables/useAdminLocale';
|
||||
import { usePermissions } from '../composables/usePermissions';
|
||||
import { AdminPerm } from '../constants/permissions';
|
||||
|
||||
const { t } = useAdminLocale();
|
||||
const route = useRoute();
|
||||
const { hasPermission, role } = usePermissions();
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
@@ -12,10 +16,21 @@ withDefaults(
|
||||
{ embedded: false },
|
||||
);
|
||||
|
||||
const tabs = [
|
||||
{ path: '/', labelKey: 'nav.dashboard.matches' },
|
||||
{ path: '/dashboard/players', labelKey: 'nav.dashboard.players' },
|
||||
];
|
||||
const tabs = computed(() => {
|
||||
const list: { path: string; labelKey: string }[] = [];
|
||||
const code = role.value;
|
||||
if (code === 'SUPPORT') return list;
|
||||
if (hasPermission(AdminPerm.matches)) {
|
||||
list.push({ path: '/', labelKey: 'nav.dashboard.matches' });
|
||||
}
|
||||
if (
|
||||
hasPermission(AdminPerm.reports) &&
|
||||
(code === 'FINANCE_ADMIN' || code === 'SUPER_ADMIN' || list.length === 0)
|
||||
) {
|
||||
list.push({ path: '/dashboard/players', labelKey: 'nav.dashboard.players' });
|
||||
}
|
||||
return list;
|
||||
});
|
||||
|
||||
function isActive(path: string) {
|
||||
if (path === '/dashboard/players') {
|
||||
@@ -27,6 +42,7 @@ function isActive(path: string) {
|
||||
|
||||
<template>
|
||||
<nav
|
||||
v-if="tabs.length > 1"
|
||||
class="dashboard-subnav"
|
||||
:class="{ 'dashboard-subnav--embedded': embedded }"
|
||||
aria-label="Dashboard sections"
|
||||
|
||||
Reference in New Issue
Block a user