diff --git a/apps/web-antd/src/views/system/dept/data.ts b/apps/web-antd/src/views/system/dept/data.ts
index 1bba82c44..2fd458407 100644
--- a/apps/web-antd/src/views/system/dept/data.ts
+++ b/apps/web-antd/src/views/system/dept/data.ts
@@ -9,6 +9,9 @@ import { getSimpleUserList } from '#/api/system/user';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { CommonStatusEnum } from '#/utils/constants';
import { handleTree } from '#/utils/tree';
+import { useAccess } from '@vben/access';
+
+const { hasAccessByCodes } = useAccess();
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
@@ -180,10 +183,15 @@ export function useGridColumns(
{
code: 'append',
text: '新增下级',
+ show: hasAccessByCodes(['system:dept:create']),
},
- 'edit', // 默认的编辑按钮
{
- code: 'delete', // 默认的删除按钮
+ code: 'edit',
+ show: hasAccessByCodes(['system:dept:update']),
+ },
+ {
+ code: 'delete',
+ show: hasAccessByCodes(['system:dept:delete']),
disabled: (row: SystemDeptApi.SystemDept) => {
return !!(row.children && row.children.length > 0);
},
diff --git a/apps/web-antd/src/views/system/dept/index.vue b/apps/web-antd/src/views/system/dept/index.vue
index 1ac2afeda..ba5d22eda 100644
--- a/apps/web-antd/src/views/system/dept/index.vue
+++ b/apps/web-antd/src/views/system/dept/index.vue
@@ -123,7 +123,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
-
-
\ No newline at end of file
+
diff --git a/apps/web-antd/src/views/system/mail/account/data.ts b/apps/web-antd/src/views/system/mail/account/data.ts
index 750143ce5..ba90f4ac0 100644
--- a/apps/web-antd/src/views/system/mail/account/data.ts
+++ b/apps/web-antd/src/views/system/mail/account/data.ts
@@ -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(
nameTitle: '邮箱账号',
onClick: onActionClick,
},
- name: 'CellOperation'
+ name: 'CellOperation',
+ options: [
+ {
+ code: 'edit',
+ show: hasAccessByCodes(['system:mail-account:update']),
+ },
+ {
+ code: 'delete',
+ show: hasAccessByCodes(['system:mail-account:delete']),
+ }
+ ],
},
},
];
diff --git a/apps/web-antd/src/views/system/mail/account/index.vue b/apps/web-antd/src/views/system/mail/account/index.vue
index f687fefdc..bf42f0108 100644
--- a/apps/web-antd/src/views/system/mail/account/index.vue
+++ b/apps/web-antd/src/views/system/mail/account/index.vue
@@ -103,7 +103,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
-
+
{{ $t('ui.actionTitle.create', ['邮箱账号']) }}
diff --git a/apps/web-antd/src/views/system/mail/log/data.ts b/apps/web-antd/src/views/system/mail/log/data.ts
index 100fd894d..9e0520647 100644
--- a/apps/web-antd/src/views/system/mail/log/data.ts
+++ b/apps/web-antd/src/views/system/mail/log/data.ts
@@ -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(
{
code: 'view',
text: '查看',
+ show: hasAccessByCodes(['system:mail-log:query']),
}
],
},
diff --git a/apps/web-antd/src/views/system/mail/template/data.ts b/apps/web-antd/src/views/system/mail/template/data.ts
index c16224b91..aff719a5c 100644
--- a/apps/web-antd/src/views/system/mail/template/data.ts
+++ b/apps/web-antd/src/views/system/mail/template/data.ts
@@ -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(
},
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']),
},
],
},
diff --git a/apps/web-antd/src/views/system/mail/template/index.vue b/apps/web-antd/src/views/system/mail/template/index.vue
index 1b970f555..45f681fca 100644
--- a/apps/web-antd/src/views/system/mail/template/index.vue
+++ b/apps/web-antd/src/views/system/mail/template/index.vue
@@ -119,7 +119,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
-
+
{{ $t('ui.actionTitle.create', ['邮件模板']) }}
diff --git a/apps/web-antd/src/views/system/menu/data.ts b/apps/web-antd/src/views/system/menu/data.ts
index ad2fccc94..3c07c5394 100644
--- a/apps/web-antd/src/views/system/menu/data.ts
+++ b/apps/web-antd/src/views/system/menu/data.ts
@@ -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', // 默认的删除按钮
],
},
},
];
-}
\ No newline at end of file
+}
diff --git a/apps/web-antd/src/views/system/menu/index.vue b/apps/web-antd/src/views/system/menu/index.vue
index e06681bf0..b71cadc59 100644
--- a/apps/web-antd/src/views/system/menu/index.vue
+++ b/apps/web-antd/src/views/system/menu/index.vue
@@ -123,7 +123,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
-
+
{{ $t('ui.actionTitle.create', ['菜单']) }}
@@ -151,4 +151,4 @@ const [Grid, gridApi] = useVbenVxeGrid({
-
\ No newline at end of file
+
diff --git a/apps/web-antd/src/views/system/notify/message/data.ts b/apps/web-antd/src/views/system/notify/message/data.ts
index 3249e23e7..187bfc869 100644
--- a/apps/web-antd/src/views/system/notify/message/data.ts
+++ b/apps/web-antd/src/views/system/notify/message/data.ts
@@ -4,6 +4,9 @@ import type { SystemNotifyMessageApi } from '#/api/system/notify/message';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { getRangePickerDefaultProps } from '#/utils/date';
+import { useAccess } from '@vben/access';
+
+const { hasAccessByCodes } = useAccess();
/** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] {
@@ -153,6 +156,7 @@ export function useGridColumns(
{
code: 'view',
text: '查看',
+ show: hasAccessByCodes(['system:notify-message:query']),
},
],
},
diff --git a/apps/web-antd/src/views/system/notify/my/data.ts b/apps/web-antd/src/views/system/notify/my/data.ts
index 67040034c..aeb10d0f1 100644
--- a/apps/web-antd/src/views/system/notify/my/data.ts
+++ b/apps/web-antd/src/views/system/notify/my/data.ts
@@ -2,7 +2,11 @@ import type { VbenFormSchema } from '#/adapter/form';
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
import type { SystemNotifyMessageApi } from '#/api/system/notify/message';
+import { getRangePickerDefaultProps } from '#/utils/date';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
+import { useAccess } from '@vben/access';
+
+const { hasAccessByCodes } = useAccess();
/** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] {
@@ -23,6 +27,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
component: 'RangePicker',
componentProps: {
allowClear: true,
+ ...getRangePickerDefaultProps(),
},
},
];
@@ -90,6 +95,7 @@ export function useGridColumns(
{
code: 'view',
text: '查看',
+ show: hasAccessByCodes(['system:notify-message:query']),
},
],
},
diff --git a/apps/web-antd/src/views/system/notify/my/index.vue b/apps/web-antd/src/views/system/notify/my/index.vue
index ea0000de8..5b9524a79 100644
--- a/apps/web-antd/src/views/system/notify/my/index.vue
+++ b/apps/web-antd/src/views/system/notify/my/index.vue
@@ -150,11 +150,11 @@ const [Grid, gridApi] = useVbenVxeGrid({
-
+
标记已读
-
+
全部已读
diff --git a/apps/web-antd/src/views/system/notify/template/data.ts b/apps/web-antd/src/views/system/notify/template/data.ts
index a64123cc6..6ef3337ef 100644
--- a/apps/web-antd/src/views/system/notify/template/data.ts
+++ b/apps/web-antd/src/views/system/notify/template/data.ts
@@ -6,6 +6,9 @@ import { z } from '#/adapter/form';
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[] {
@@ -260,9 +263,19 @@ export function useGridColumns
},
name: 'CellOperation',
options: [
- 'edit', // 默认的编辑按钮
- { code: 'send', text: '测试' },
- 'delete', // 默认的删除按钮
+ {
+ code: 'edit',
+ show: hasAccessByCodes(['system:notify-template:update']),
+ },
+ {
+ code: 'send',
+ text: '测试',
+ show: hasAccessByCodes(['system:notify-template:send-notify']),
+ },
+ {
+ code: 'delete',
+ show: hasAccessByCodes(['system:notify-template:delete']),
+ },
],
},
},
diff --git a/apps/web-antd/src/views/system/notify/template/index.vue b/apps/web-antd/src/views/system/notify/template/index.vue
index c030e57d6..15f06e805 100644
--- a/apps/web-antd/src/views/system/notify/template/index.vue
+++ b/apps/web-antd/src/views/system/notify/template/index.vue
@@ -127,11 +127,11 @@ const [Grid, gridApi] = useVbenVxeGrid({
-
+
{{ $t('ui.actionTitle.create', ['站内信模板']) }}
-
+
{{ $t('ui.actionTitle.export') }}
diff --git a/apps/web-antd/src/views/system/post/data.ts b/apps/web-antd/src/views/system/post/data.ts
index cb4988e0a..167bd2e69 100644
--- a/apps/web-antd/src/views/system/post/data.ts
+++ b/apps/web-antd/src/views/system/post/data.ts
@@ -4,6 +4,9 @@ import type { SystemPostApi } from '#/api/system/post';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { CommonStatusEnum } from '#/utils/constants';
+import { useAccess } from '@vben/access';
+
+const { hasAccessByCodes } = useAccess();
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
@@ -143,6 +146,16 @@ export function useGridColumns(
onClick: onActionClick,
},
name: 'CellOperation',
+ options: [
+ {
+ code: 'edit',
+ show: hasAccessByCodes(['system:post:update']),
+ },
+ {
+ code: 'delete',
+ show: hasAccessByCodes(['system:post:delete']),
+ },
+ ],
},
},
];
diff --git a/apps/web-antd/src/views/system/post/index.vue b/apps/web-antd/src/views/system/post/index.vue
index 0e8773a74..b265d62ff 100644
--- a/apps/web-antd/src/views/system/post/index.vue
+++ b/apps/web-antd/src/views/system/post/index.vue
@@ -110,11 +110,11 @@ const [Grid, gridApi] = useVbenVxeGrid({
-
+
{{ $t('ui.actionTitle.create', ['岗位']) }}
-
+
{{ $t('ui.actionTitle.export') }}
diff --git a/apps/web-antd/src/views/system/role/data.ts b/apps/web-antd/src/views/system/role/data.ts
index 9ab94d72b..2633b8249 100644
--- a/apps/web-antd/src/views/system/role/data.ts
+++ b/apps/web-antd/src/views/system/role/data.ts
@@ -6,6 +6,9 @@ import { z } from '#/adapter/form';
import { CommonStatusEnum, SystemDataScopeEnum } 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[] {
@@ -250,15 +253,23 @@ export function useGridColumns(
},
name: 'CellOperation',
options: [
- 'edit', // 默认的编辑按钮
- 'delete', // 默认的删除按钮
+ {
+ code: 'edit',
+ show: hasAccessByCodes(['system:role:update']),
+ },
+ {
+ code: 'delete',
+ show: hasAccessByCodes(['system:role:delete']),
+ },
{
code: 'assign-data-permission',
text: '数据权限',
+ show: hasAccessByCodes(['system:permission:assign-role-data-scope']),
},
{
code: 'assign-menu',
text: '菜单权限',
+ show: hasAccessByCodes(['system:permission:assign-role-menu']),
},
],
},
diff --git a/apps/web-antd/src/views/system/role/index.vue b/apps/web-antd/src/views/system/role/index.vue
index 1e2b8959e..61a045d0a 100644
--- a/apps/web-antd/src/views/system/role/index.vue
+++ b/apps/web-antd/src/views/system/role/index.vue
@@ -145,11 +145,11 @@ const [Grid, gridApi] = useVbenVxeGrid({
-
+
{{ $t('ui.actionTitle.create', ['角色']) }}
-
+
{{ $t('ui.actionTitle.export') }}
diff --git a/apps/web-antd/src/views/system/sms/channel/data.ts b/apps/web-antd/src/views/system/sms/channel/data.ts
index 206659903..e62f44f5d 100644
--- a/apps/web-antd/src/views/system/sms/channel/data.ts
+++ b/apps/web-antd/src/views/system/sms/channel/data.ts
@@ -6,6 +6,9 @@ import { z } from '#/adapter/form';
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[] {
@@ -200,6 +203,16 @@ export function useGridColumns(
onClick: onActionClick,
},
name: 'CellOperation',
+ options: [
+ {
+ code: 'edit',
+ show: hasAccessByCodes(['system:sms-channel:update']),
+ },
+ {
+ code: 'delete',
+ show: hasAccessByCodes(['system:sms-channel:delete']),
+ }
+ ],
},
},
];
diff --git a/apps/web-antd/src/views/system/sms/channel/index.vue b/apps/web-antd/src/views/system/sms/channel/index.vue
index cb8d49b1e..d07c0a117 100644
--- a/apps/web-antd/src/views/system/sms/channel/index.vue
+++ b/apps/web-antd/src/views/system/sms/channel/index.vue
@@ -111,11 +111,11 @@ const [Grid, gridApi] = useVbenVxeGrid({
-
+
{{ $t('ui.actionTitle.create', ['短信渠道']) }}
-
+
{{ $t('ui.actionTitle.export') }}
diff --git a/apps/web-antd/src/views/system/sms/log/data.ts b/apps/web-antd/src/views/system/sms/log/data.ts
index a71fba710..6bbab713c 100644
--- a/apps/web-antd/src/views/system/sms/log/data.ts
+++ b/apps/web-antd/src/views/system/sms/log/data.ts
@@ -5,6 +5,9 @@ import type { SystemSmsLogApi } from '#/api/system/sms/log';
import { getSimpleSmsChannelList } from '#/api/system/sms/channel';
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
import { getRangePickerDefaultProps } from '#/utils/date';
+import { useAccess } from '@vben/access';
+
+const { hasAccessByCodes } = useAccess();
/** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] {
@@ -176,6 +179,7 @@ export function useGridColumns(
{
code: 'view',
text: '查看',
+ show: hasAccessByCodes(['system:sms-log:query']),
},
],
},
diff --git a/apps/web-antd/src/views/system/sms/log/index.vue b/apps/web-antd/src/views/system/sms/log/index.vue
index d28b256f8..d9d508d45 100644
--- a/apps/web-antd/src/views/system/sms/log/index.vue
+++ b/apps/web-antd/src/views/system/sms/log/index.vue
@@ -83,7 +83,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
-
+
{{ $t('ui.actionTitle.export') }}
diff --git a/apps/web-antd/src/views/system/sms/template/data.ts b/apps/web-antd/src/views/system/sms/template/data.ts
index f8c41c9f2..1a8fa6e03 100644
--- a/apps/web-antd/src/views/system/sms/template/data.ts
+++ b/apps/web-antd/src/views/system/sms/template/data.ts
@@ -7,6 +7,9 @@ import { getSimpleSmsChannelList } from '#/api/system/sms/channel';
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[] {
@@ -280,11 +283,18 @@ export function useGridColumns(
},
name: 'CellOperation',
options: [
- 'edit', // 默认的编辑按钮
- 'delete', // 默认的删除按钮
+ {
+ code: 'edit',
+ show: hasAccessByCodes(['system:sms-template:update']),
+ },
+ {
+ code: 'delete',
+ show: hasAccessByCodes(['system:sms-template:delete']),
+ },
{
code: 'sms-send',
text: '发送短信',
+ show: hasAccessByCodes(['system:sms-template:send-sms']),
},
],
},
diff --git a/apps/web-antd/src/views/system/sms/template/index.vue b/apps/web-antd/src/views/system/sms/template/index.vue
index 8be2fb9db..daf57e11d 100644
--- a/apps/web-antd/src/views/system/sms/template/index.vue
+++ b/apps/web-antd/src/views/system/sms/template/index.vue
@@ -127,11 +127,11 @@ const [Grid, gridApi] = useVbenVxeGrid({
-
+
{{ $t('ui.actionTitle.create', ['短信模板']) }}
-
+
{{ $t('ui.actionTitle.export') }}
diff --git a/apps/web-antd/src/views/system/tenant/data.ts b/apps/web-antd/src/views/system/tenant/data.ts
index 1b1f98707..de8fd256e 100644
--- a/apps/web-antd/src/views/system/tenant/data.ts
+++ b/apps/web-antd/src/views/system/tenant/data.ts
@@ -7,6 +7,9 @@ import { getTenantPackageList } from '#/api/system/tenant-package';
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[] {
@@ -254,6 +257,16 @@ export function useGridColumns(onActionClick:
onClick: onActionClick,
},
name: 'CellOperation',
+ options: [
+ {
+ code: 'edit',
+ show: hasAccessByCodes(['system:tenant:update']),
+ },
+ {
+ code: 'delete',
+ show: hasAccessByCodes(['system:tenant:delete']),
+ },
+ ],
},
},
];
diff --git a/apps/web-antd/src/views/system/tenant/index.vue b/apps/web-antd/src/views/system/tenant/index.vue
index fe35c4f47..7fcbbe8d4 100644
--- a/apps/web-antd/src/views/system/tenant/index.vue
+++ b/apps/web-antd/src/views/system/tenant/index.vue
@@ -111,11 +111,11 @@ const [Grid, gridApi] = useVbenVxeGrid({
-
+
{{ $t('ui.actionTitle.create', ['租户']) }}
-
+
{{ $t('ui.actionTitle.export') }}
diff --git a/apps/web-antd/src/views/system/tenantPackage/data.ts b/apps/web-antd/src/views/system/tenantPackage/data.ts
index b79891102..c67974585 100644
--- a/apps/web-antd/src/views/system/tenantPackage/data.ts
+++ b/apps/web-antd/src/views/system/tenantPackage/data.ts
@@ -6,6 +6,9 @@ import { z } from '#/adapter/form';
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[] {
@@ -135,6 +138,16 @@ export function useGridColumns(o
onClick: onActionClick,
},
name: 'CellOperation',
+ options: [
+ {
+ code: 'edit',
+ show: hasAccessByCodes(['system:tenant-package:update']),
+ },
+ {
+ code: 'delete',
+ show: hasAccessByCodes(['system:tenant-package:delete']),
+ },
+ ],
},
},
];
diff --git a/apps/web-antd/src/views/system/tenantPackage/index.vue b/apps/web-antd/src/views/system/tenantPackage/index.vue
index b9ac0dc5d..5c1261fca 100644
--- a/apps/web-antd/src/views/system/tenantPackage/index.vue
+++ b/apps/web-antd/src/views/system/tenantPackage/index.vue
@@ -101,7 +101,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
-
+
{{ $t('ui.actionTitle.create', ['套餐']) }}
diff --git a/apps/web-antd/src/views/system/user/data.ts b/apps/web-antd/src/views/system/user/data.ts
index 3e888c561..30c84b9e6 100644
--- a/apps/web-antd/src/views/system/user/data.ts
+++ b/apps/web-antd/src/views/system/user/data.ts
@@ -10,6 +10,9 @@ import { getSimplePostList } from '#/api/system/post';
import { getSimpleRoleList } from '#/api/system/role';
import { handleTree } from '#/utils/tree';
import { getRangePickerDefaultProps } from '#/utils/date';
+import { useAccess } from '@vben/access';
+
+const { hasAccessByCodes } = useAccess();
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
@@ -344,15 +347,24 @@ export function useGridColumns(
name: 'CellOperation',
// TODO @芋艿:后续把 delete、assign-role、reset-password 搞成"更多"
options: [
- 'edit', // 默认的编辑按钮
- 'delete', // 默认的删除按钮
+ {
+ code: 'edit',
+ show: hasAccessByCodes(['system:user:update']),
+ },
+ {
+ code: 'delete',
+ show: hasAccessByCodes(['system:user:delete']),
+ },
{
code: 'assign-role',
text: '分配角色',
+ show: hasAccessByCodes(['system:permission:assign-user-role']),
+ 'v-access:code': 'system:user:assign-role1',
},
{
code: 'reset-password',
text: '重置密码',
+ show: hasAccessByCodes(['system:user:update-password']),
},
],
},
diff --git a/apps/web-antd/src/views/system/user/index.vue b/apps/web-antd/src/views/system/user/index.vue
index a4d444a73..f4818e4b1 100644
--- a/apps/web-antd/src/views/system/user/index.vue
+++ b/apps/web-antd/src/views/system/user/index.vue
@@ -202,15 +202,15 @@ const [Grid, gridApi] = useVbenVxeGrid({
-
+
{{ $t('ui.actionTitle.create', ['用户']) }}
-
+
{{ $t('ui.actionTitle.export') }}
-
+
{{ $t('ui.actionTitle.import', ['用户']) }}