From a617d4b71e0ab5d2a61496b0f0835ab23b108f6e Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 5 Apr 2025 09:43:01 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E6=89=80=E6=9C=89=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=EF=BC=8C=E6=8E=A5=E5=85=A5=20access=20=E6=9D=83?= =?UTF-8?q?=E9=99=90=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/views/system/dept/data.ts | 12 ++++++++++-- apps/web-antd/src/views/system/dept/index.vue | 4 ++-- .../src/views/system/mail/account/data.ts | 15 ++++++++++++++- .../src/views/system/mail/account/index.vue | 2 +- .../src/views/system/mail/log/data.ts | 4 ++++ .../src/views/system/mail/template/data.ts | 14 ++++++++++++-- .../src/views/system/mail/template/index.vue | 2 +- apps/web-antd/src/views/system/menu/data.ts | 16 +++++++++++++--- apps/web-antd/src/views/system/menu/index.vue | 4 ++-- .../src/views/system/notify/message/data.ts | 4 ++++ .../src/views/system/notify/my/data.ts | 6 ++++++ .../src/views/system/notify/my/index.vue | 4 ++-- .../src/views/system/notify/template/data.ts | 19 ++++++++++++++++--- .../views/system/notify/template/index.vue | 4 ++-- apps/web-antd/src/views/system/post/data.ts | 13 +++++++++++++ apps/web-antd/src/views/system/post/index.vue | 4 ++-- apps/web-antd/src/views/system/role/data.ts | 15 +++++++++++++-- apps/web-antd/src/views/system/role/index.vue | 4 ++-- .../src/views/system/sms/channel/data.ts | 13 +++++++++++++ .../src/views/system/sms/channel/index.vue | 4 ++-- .../web-antd/src/views/system/sms/log/data.ts | 4 ++++ .../src/views/system/sms/log/index.vue | 2 +- .../src/views/system/sms/template/data.ts | 14 ++++++++++++-- .../src/views/system/sms/template/index.vue | 4 ++-- apps/web-antd/src/views/system/tenant/data.ts | 13 +++++++++++++ .../src/views/system/tenant/index.vue | 4 ++-- .../src/views/system/tenantPackage/data.ts | 13 +++++++++++++ .../src/views/system/tenantPackage/index.vue | 2 +- apps/web-antd/src/views/system/user/data.ts | 16 ++++++++++++++-- apps/web-antd/src/views/system/user/index.vue | 6 +++--- 30 files changed, 199 insertions(+), 42 deletions(-) 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({ 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({