feat:所有模块,接入 access 权限控制
This commit is contained in:
@@ -14,6 +14,9 @@ import { DICT_TYPE, getDictOptions } from '#/utils/dict';
|
||||
import { handleTree } from '#/utils/tree';
|
||||
import { CommonStatusEnum, SystemMenuTypeEnum } from '#/utils/constants';
|
||||
import { isHttpUrl } from '@vben/utils';
|
||||
import { useAccess } from '@vben/access';
|
||||
|
||||
const { hasAccessByCodes } = useAccess();
|
||||
|
||||
/** 新增/修改的表单 */
|
||||
export function useFormSchema(): VbenFormSchema[] {
|
||||
@@ -323,11 +326,18 @@ export function useGridColumns(
|
||||
{
|
||||
code: 'append',
|
||||
text: '新增下级',
|
||||
show: hasAccessByCodes(['system:menu:create']),
|
||||
},
|
||||
{
|
||||
code: 'edit',
|
||||
show: hasAccessByCodes(['system:menu:update']),
|
||||
},
|
||||
{
|
||||
code: 'delete',
|
||||
show: hasAccessByCodes(['system:menu:delete']),
|
||||
},
|
||||
'edit', // 默认的编辑按钮
|
||||
'delete', // 默认的删除按钮
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
<FormModal @success="onRefresh" />
|
||||
<Grid>
|
||||
<template #toolbar-tools>
|
||||
<Button type="primary" @click="onCreate">
|
||||
<Button type="primary" @click="onCreate" v-access:code="['system:menu:create']">
|
||||
<Plus class="size-5" />
|
||||
{{ $t('ui.actionTitle.create', ['菜单']) }}
|
||||
</Button>
|
||||
@@ -151,4 +151,4 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
</template>
|
||||
</Grid>
|
||||
</Page>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user