From 52ae513e1c52bf0c02bcc86834bd1a0ae13b3a0d Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Mon, 19 May 2025 17:58:06 +0800 Subject: [PATCH] perf: use table action --- apps/web-antd/src/views/system/dept/data.ts | 39 +----- apps/web-antd/src/views/system/dept/index.vue | 106 +++++++++------- .../src/views/system/loginlog/data.ts | 31 +---- .../src/views/system/loginlog/index.vue | 57 ++++----- .../src/views/system/mail/account/data.ts | 34 +---- .../src/views/system/mail/account/index.vue | 89 +++++++------- .../src/views/system/mail/log/data.ts | 31 +---- .../src/views/system/mail/log/index.vue | 35 +++--- .../src/views/system/mail/template/data.ts | 38 +----- .../src/views/system/mail/template/index.vue | 103 +++++++++------- apps/web-antd/src/views/system/menu/data.ts | 37 +----- apps/web-antd/src/views/system/menu/index.vue | 106 +++++++++------- apps/web-antd/src/views/system/notice/data.ts | 39 +----- .../src/views/system/notice/index.vue | 100 ++++++++------- .../src/views/system/notify/message/data.ts | 31 +---- .../src/views/system/notify/message/index.vue | 37 +++--- .../src/views/system/notify/my/data.ts | 32 +---- .../src/views/system/notify/my/index.vue | 87 +++++++------ .../src/views/system/notify/template/data.ts | 39 +----- .../views/system/notify/template/index.vue | 116 +++++++++--------- .../src/views/system/oauth2/client/data.ts | 34 +---- .../src/views/system/oauth2/client/index.vue | 89 +++++++------- .../src/views/system/oauth2/token/data.ts | 31 +---- .../src/views/system/oauth2/token/index.vue | 59 ++++----- .../src/views/system/operatelog/data.ts | 31 +---- .../src/views/system/operatelog/index.vue | 57 ++++----- apps/web-antd/src/views/system/post/data.ts | 34 +---- apps/web-antd/src/views/system/post/index.vue | 99 ++++++++------- .../src/views/system/sms/channel/data.ts | 34 +---- .../src/views/system/sms/channel/index.vue | 102 +++++++-------- .../web-antd/src/views/system/sms/log/data.ts | 31 +---- .../src/views/system/sms/log/index.vue | 57 ++++----- .../src/views/system/sms/template/data.ts | 39 +----- .../src/views/system/sms/template/index.vue | 113 +++++++++-------- .../src/views/system/social/client/data.ts | 34 +---- .../src/views/system/social/client/index.vue | 89 +++++++------- .../src/views/system/social/user/index.vue | 5 - 37 files changed, 866 insertions(+), 1259 deletions(-) diff --git a/apps/web-antd/src/views/system/dept/data.ts b/apps/web-antd/src/views/system/dept/data.ts index 1b112a599..f57287407 100644 --- a/apps/web-antd/src/views/system/dept/data.ts +++ b/apps/web-antd/src/views/system/dept/data.ts @@ -1,8 +1,7 @@ import type { VbenFormSchema } from '#/adapter/form'; -import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { SystemDeptApi } from '#/api/system/dept'; -import { useAccess } from '@vben/access'; import { handleTree } from '@vben/utils'; import { z } from '#/adapter/form'; @@ -10,8 +9,6 @@ import { getDeptList } from '#/api/system/dept'; import { getSimpleUserList } from '#/api/system/user'; import { CommonStatusEnum, DICT_TYPE, getDictOptions } from '#/utils'; -const { hasAccessByCodes } = useAccess(); - /** 新增/修改的表单 */ export function useFormSchema(): VbenFormSchema[] { return [ @@ -113,7 +110,6 @@ export function useFormSchema(): VbenFormSchema[] { /** 列表的字段 */ export function useGridColumns( - onActionClick?: OnActionClickFn, getLeaderName?: (userId: number) => string | undefined, ): VxeTableGridOptions['columns'] { return [ @@ -154,39 +150,10 @@ export function useGridColumns( formatter: 'formatDateTime', }, { - field: 'operation', title: '操作', - minWidth: 200, - align: 'right', + width: 220, fixed: 'right', - headerAlign: 'center', - showOverflow: false, - cellRender: { - attrs: { - nameField: 'name', - nameTitle: '部门', - onClick: onActionClick, - }, - name: 'CellOperation', - options: [ - { - code: 'append', - text: '新增下级', - show: hasAccessByCodes(['system:dept:create']), - }, - { - code: 'edit', - show: hasAccessByCodes(['system:dept:update']), - }, - { - code: 'delete', - show: hasAccessByCodes(['system:dept:delete']), - disabled: (row: SystemDeptApi.Dept) => { - return !!(row.children && row.children.length > 0); - }, - }, - ], - }, + slots: { default: 'actions' }, }, ]; } diff --git a/apps/web-antd/src/views/system/dept/index.vue b/apps/web-antd/src/views/system/dept/index.vue index 10c1d41e0..eb9771303 100644 --- a/apps/web-antd/src/views/system/dept/index.vue +++ b/apps/web-antd/src/views/system/dept/index.vue @@ -1,21 +1,18 @@