feat:所有模块,接入 access 权限控制
This commit is contained in:
@@ -4,6 +4,9 @@ import type { SystemMailAccountApi } from '#/api/system/mail/account';
|
||||
|
||||
import { z } from '#/adapter/form';
|
||||
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
|
||||
import { useAccess } from '@vben/access';
|
||||
|
||||
const { hasAccessByCodes } = useAccess();
|
||||
|
||||
/** 新增/修改的表单 */
|
||||
export function useFormSchema(): VbenFormSchema[] {
|
||||
@@ -187,7 +190,17 @@ export function useGridColumns<T = SystemMailAccountApi.SystemMailAccount>(
|
||||
nameTitle: '邮箱账号',
|
||||
onClick: onActionClick,
|
||||
},
|
||||
name: 'CellOperation'
|
||||
name: 'CellOperation',
|
||||
options: [
|
||||
{
|
||||
code: 'edit',
|
||||
show: hasAccessByCodes(['system:mail-account:update']),
|
||||
},
|
||||
{
|
||||
code: 'delete',
|
||||
show: hasAccessByCodes(['system:mail-account:delete']),
|
||||
}
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
@@ -103,7 +103,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
<FormModal @success="onRefresh" />
|
||||
<Grid table-title="邮箱账号列表">
|
||||
<template #toolbar-tools>
|
||||
<Button type="primary" @click="onCreate">
|
||||
<Button type="primary" @click="onCreate" v-access:code="['system:mail-account:create']">
|
||||
<Plus class="size-5" />
|
||||
{{ $t('ui.actionTitle.create', ['邮箱账号']) }}
|
||||
</Button>
|
||||
|
||||
@@ -5,6 +5,9 @@ import type { SystemMailLogApi } from '#/api/system/mail/log';
|
||||
import { getSimpleMailAccountList } from '#/api/system/mail/account';
|
||||
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
|
||||
import { getRangePickerDefaultProps } from '#/utils/date';
|
||||
import { useAccess } from '@vben/access';
|
||||
|
||||
const { hasAccessByCodes } = useAccess();
|
||||
|
||||
/** 列表的搜索表单 */
|
||||
export function useGridFormSchema(): VbenFormSchema[] {
|
||||
@@ -138,6 +141,7 @@ export function useGridColumns<T = SystemMailLogApi.SystemMailLog>(
|
||||
{
|
||||
code: 'view',
|
||||
text: '查看',
|
||||
show: hasAccessByCodes(['system:mail-log:query']),
|
||||
}
|
||||
],
|
||||
},
|
||||
|
||||
@@ -7,6 +7,9 @@ import { getSimpleMailAccountList } from '#/api/system/mail/account';
|
||||
import { CommonStatusEnum } from '#/utils/constants';
|
||||
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
|
||||
import { getRangePickerDefaultProps } from '#/utils/date';
|
||||
import { useAccess } from '@vben/access';
|
||||
|
||||
const { hasAccessByCodes } = useAccess();
|
||||
|
||||
/** 新增/修改的表单 */
|
||||
export function useFormSchema(): VbenFormSchema[] {
|
||||
@@ -252,11 +255,18 @@ export function useGridColumns<T = SystemMailTemplateApi.SystemMailTemplate>(
|
||||
},
|
||||
name: 'CellOperation',
|
||||
options: [
|
||||
'edit', // 默认的编辑按钮
|
||||
'delete', // 默认的删除按钮
|
||||
{
|
||||
code: 'edit',
|
||||
show: hasAccessByCodes(['system:mail-template:update']),
|
||||
},
|
||||
{
|
||||
code: 'delete',
|
||||
show: hasAccessByCodes(['system:mail-template:delete']),
|
||||
},
|
||||
{
|
||||
code: 'send',
|
||||
text: '测试',
|
||||
show: hasAccessByCodes(['system:mail-template:send-mail']),
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -119,7 +119,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
<SendModal />
|
||||
<Grid table-title="邮件模板列表">
|
||||
<template #toolbar-tools>
|
||||
<Button type="primary" @click="onCreate">
|
||||
<Button type="primary" @click="onCreate" v-access:code="['system:mail-template:create']">
|
||||
<Plus class="size-5" />
|
||||
{{ $t('ui.actionTitle.create', ['邮件模板']) }}
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user