From caf8681e24beb726076e9dea927972df46872769 Mon Sep 17 00:00:00 2001
From: dap <15891557205@163.com>
Date: Sat, 5 Oct 2024 15:35:58 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E8=8F=9C=E5=8D=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
apps/web-antd/src/views/system/menu/data.tsx | 87 +++++++++-
apps/web-antd/src/views/system/menu/index.vue | 163 ++++++++++++++----
2 files changed, 213 insertions(+), 37 deletions(-)
diff --git a/apps/web-antd/src/views/system/menu/data.tsx b/apps/web-antd/src/views/system/menu/data.tsx
index d4ff2c5c..d81c7a0e 100644
--- a/apps/web-antd/src/views/system/menu/data.tsx
+++ b/apps/web-antd/src/views/system/menu/data.tsx
@@ -1,8 +1,9 @@
import { DictEnum } from '@vben/constants';
import { getPopupContainer } from '@vben/utils';
-import { type FormSchemaGetter, z } from '#/adapter';
+import { type FormSchemaGetter, type VxeGridProps, z } from '#/adapter';
import { getDictOptions } from '#/utils/dict';
+import { renderDict, renderIcon } from '#/utils/render';
export const querySchema: FormSchemaGetter = () => [
{
@@ -42,6 +43,90 @@ export const yesNoOptions = [
{ label: '否', value: '1' },
];
+// (M目录 C菜单 F按钮)
+const menuTypes = {
+ M: { value: '目录', icon: 'fxemoji:folder' },
+ C: { value: '菜单', icon: 'fluent-emoji-flat:open-book' },
+ F: { value: '按钮', icon: 'fluent-emoji:ok-button' },
+};
+
+export const columns: VxeGridProps['columns'] = [
+ {
+ title: '菜单名称',
+ field: 'menuName',
+ treeNode: true,
+ width: 200,
+ },
+ {
+ title: '图标',
+ field: 'icon',
+ width: 80,
+ slots: {
+ default: ({ row }) => {
+ if (row?.icon === '#') {
+ return '';
+ }
+ return renderIcon(row.icon);
+ },
+ },
+ },
+ {
+ title: '排序',
+ field: 'orderNum',
+ width: 120,
+ },
+ {
+ title: '组件类型',
+ field: 'menuType',
+ width: 150,
+ slots: {
+ default: ({ row }) => {
+ const current = menuTypes[row.menuType as 'C' | 'F' | 'M'];
+ return current as any;
+ },
+ },
+ },
+ {
+ title: '权限标识',
+ field: 'perms',
+ },
+ {
+ title: '组件路径',
+ field: 'component',
+ },
+ {
+ title: '状态',
+ field: 'status',
+ width: 100,
+ slots: {
+ default: ({ row }) => {
+ return renderDict(row.status, DictEnum.SYS_NORMAL_DISABLE);
+ },
+ },
+ },
+ {
+ title: '显示',
+ field: 'visible',
+ width: 100,
+ slots: {
+ default: ({ row }) => {
+ return renderDict(row.visible, DictEnum.SYS_SHOW_HIDE);
+ },
+ },
+ },
+ {
+ title: '创建时间',
+ field: 'createTime',
+ },
+ {
+ field: 'action',
+ fixed: 'right',
+ slots: { default: 'action' },
+ title: '操作',
+ width: 180,
+ },
+];
+
export const drawerSchema: FormSchemaGetter = () => [
{
component: 'Input',
diff --git a/apps/web-antd/src/views/system/menu/index.vue b/apps/web-antd/src/views/system/menu/index.vue
index 0960fdc9..d683446f 100644
--- a/apps/web-antd/src/views/system/menu/index.vue
+++ b/apps/web-antd/src/views/system/menu/index.vue
@@ -1,55 +1,146 @@
-
-
-
-
-
-
-
- {{ $t('pages.common.add') }}
-
-
-
-
+
+
+
+ 菜单权限列表
+
+
+
+
+ {{ $t('pages.common.collapse') }}
+
+
+ {{ $t('pages.common.expand') }}
+
+
+ {{ $t('pages.common.add') }}
+
+
+
+
+
+
+ {{ $t('pages.common.edit') }}
+
+
+
+ {{ $t('pages.common.delete') }}
+
+
+
+
+
+