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, icon: MaterPerson,
title: '个人', title: '个人',
order: 5, order: 5,
authority: ['dashboard'], authority: ['user'],
}, },
}, },
]; ];

View File

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

View File

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

View File

@ -80,7 +80,14 @@ async function onDelete() {
<FormDrawer /> <FormDrawer />
<Grid table-title="用户列表"> <Grid table-title="用户列表">
<template #toolbar-tools> <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>
<template #makeTime="{ row }"> <template #makeTime="{ row }">
{{ dayjs(row.makeTime).format('YYYY-MM-DD HH:mm') }} {{ dayjs(row.makeTime).format('YYYY-MM-DD HH:mm') }}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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