From 63fe4c5b2e1cad84f5cf6f7a818049e63b55b5a0 Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Sat, 5 Oct 2024 12:51:28 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=94=A8=E6=88=B7=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/components/table/index.ts | 1 + .../src/components/table/src/table-switch.vue | 82 +++++++ apps/web-antd/src/views/system/user/data.tsx | 49 +++- apps/web-antd/src/views/system/user/index.vue | 210 ++++++++++++++---- 4 files changed, 298 insertions(+), 44 deletions(-) create mode 100644 apps/web-antd/src/components/table/index.ts create mode 100644 apps/web-antd/src/components/table/src/table-switch.vue diff --git a/apps/web-antd/src/components/table/index.ts b/apps/web-antd/src/components/table/index.ts new file mode 100644 index 00000000..28bd800a --- /dev/null +++ b/apps/web-antd/src/components/table/index.ts @@ -0,0 +1 @@ +export { default as TableSwitch } from './src/table-switch.vue'; diff --git a/apps/web-antd/src/components/table/src/table-switch.vue b/apps/web-antd/src/components/table/src/table-switch.vue new file mode 100644 index 00000000..4d945195 --- /dev/null +++ b/apps/web-antd/src/components/table/src/table-switch.vue @@ -0,0 +1,82 @@ + + + diff --git a/apps/web-antd/src/views/system/user/data.tsx b/apps/web-antd/src/views/system/user/data.tsx index c8c6f011..a34bd88e 100644 --- a/apps/web-antd/src/views/system/user/data.tsx +++ b/apps/web-antd/src/views/system/user/data.tsx @@ -1,7 +1,7 @@ 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'; export const querySchema: FormSchemaGetter = () => [ @@ -39,6 +39,52 @@ export const querySchema: FormSchemaGetter = () => [ label: '创建时间', }, ]; + +export const columns: VxeGridProps['columns'] = [ + { type: 'checkbox', width: 60 }, + { + field: 'userName', + title: '名称', + }, + { + field: 'nickName', + title: '昵称', + }, + { + field: 'avatar', + title: '头像', + slots: { default: 'avatar' }, + width: 80, + }, + { + field: 'deptName', + title: '部门', + }, + { + field: 'phonenumber', + title: '手机号', + formatter({ cellValue }) { + return cellValue || '暂无'; + }, + }, + { + field: 'status', + title: '状态', + slots: { default: 'status' }, + }, + { + field: 'createTime', + title: '创建时间', + }, + { + field: 'action', + fixed: 'right', + slots: { default: 'action' }, + title: '操作', + width: 180, + }, +]; + export const drawerSchema: FormSchemaGetter = () => [ { component: 'Input', @@ -87,6 +133,7 @@ export const drawerSchema: FormSchemaGetter = () => [ component: 'Input', fieldName: 'email', label: '邮箱', + // TODO: 这里非必填未生效 rules: z.string().email('请输入正确的邮箱').optional(), }, { diff --git a/apps/web-antd/src/views/system/user/index.vue b/apps/web-antd/src/views/system/user/index.vue index 88092143..49818bcd 100644 --- a/apps/web-antd/src/views/system/user/index.vue +++ b/apps/web-antd/src/views/system/user/index.vue @@ -1,28 +1,37 @@