feat(@vben/web-antd): 更新路由权限控制并调整首页路径

This commit is contained in:
Kven 2025-06-04 20:17:14 +08:00
parent d6bee4b911
commit ce60c7194d
10 changed files with 49 additions and 9 deletions

View File

@ -11,7 +11,7 @@ const routes: RouteRecordRaw[] = [
icon: MaterPerson,
title: '个人',
order: 5,
authority: ['dashboard'],
authority: ['user'],
},
},
];

View File

@ -57,7 +57,7 @@ const routes: RouteRecordRaw[] = [
meta: {
icon: IconLog,
title: '系统日志',
authority: ['system'],
authority: ['system:operationLog'],
},
},
{
@ -67,7 +67,7 @@ const routes: RouteRecordRaw[] = [
meta: {
icon: FluentWorkflow,
title: '工作流管理',
authority: ['system'],
authority: ['system:workflow'],
},
},
],

View File

@ -151,14 +151,20 @@ export function useColumns(
{
code: 'append',
text: '新增下级',
permission: 'system:dept:create',
},
// {
// code: 'auth',
// text: '工作流',
// },
'edit', // 默认的编辑按钮
{
code: 'edit',
text: '修改',
permission: 'system:dept:update',
},
{
code: 'delete', // 默认的删除按钮
permission: 'system:dept:delete',
disabled: (row: DeptApi.Dept) => {
return !!(row.children && row.children.length > 0);
},

View File

@ -80,7 +80,14 @@ async function onDelete() {
<FormDrawer />
<Grid table-title="用户列表">
<template #toolbar-tools>
<Button type="primary" @click="onDelete" danger> 批量删除 </Button>
<Button
type="primary"
@click="onDelete"
danger
v-access:code="'system:log:delete'"
>
批量删除
</Button>
</template>
<template #makeTime="{ row }">
{{ dayjs(row.makeTime).format('YYYY-MM-DD HH:mm') }}

View File

@ -120,6 +120,18 @@ export function useColumns<T = RoleApi.Role>(
nameField: 'name',
nameTitle: '角色',
onClick: onActionClick,
options: [
{
code: 'edit',
text: '编辑',
permission: 'system:role:update',
},
{
code: 'delete',
text: '删除',
permission: 'system:role:delete',
},
],
},
name: 'CellOperation',
},

View File

@ -155,7 +155,11 @@ function onCreate() {
<FormDrawer />
<Grid table-title="角色列表">
<template #toolbar-tools>
<Button type="primary" @click="onCreate">
<Button
type="primary"
@click="onCreate"
v-access:code="'system:role:create'"
>
<Plus class="size-5" />
{{ $t('ui.actionTitle.create', ['角色']) }}
</Button>

View File

@ -191,14 +191,17 @@ export function useColumns<T = UserApi.User>(
{
code: 'resetPassword',
text: '重置密码',
permission: 'system:user:update',
},
{
code: 'edit',
text: '修改',
permission: 'system:user:update',
},
{
code: 'delete',
text: '删除',
permission: 'system:user:delete',
},
],
name: 'CellOperation',

View File

@ -170,7 +170,11 @@ function onCreate() {
<FormDrawer @success="onRefresh" />
<Grid table-title="用户列表">
<template #toolbar-tools>
<Button type="primary" @click="onCreate">
<Button
type="primary"
@click="onCreate"
v-access:code="'system:user:create'"
>
<Plus class="size-5" />
{{ $t('ui.actionTitle.create', ['用户']) }}
</Button>

View File

@ -67,7 +67,11 @@ export function useColumns(
onClick: onActionClick,
},
options: [
'edit', // 默认的编辑按钮
{
code: 'update',
text: '关联部门',
permission: 'workflow:update',
},
],
},
field: 'operation',

View File

@ -6,7 +6,7 @@ export const LOGIN_PATH = '/auth/login';
/**
* @zh_CN
*/
export const DEFAULT_HOME_PATH = '/analytics';
export const DEFAULT_HOME_PATH = '/home';
export interface LanguageOption {
label: string;