From 0b3b5799eac2684b10bc08f08fd579f440df607e Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Wed, 28 May 2025 20:50:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=9A=E5=91=98=E5=88=86=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/views/member/group/data.ts | 88 +++++++++++ .../web-antd/src/views/member/group/index.vue | 145 ++++++++++++++---- .../src/views/member/group/modules/form.vue | 82 ++++++++++ 3 files changed, 289 insertions(+), 26 deletions(-) create mode 100644 apps/web-antd/src/views/member/group/data.ts create mode 100644 apps/web-antd/src/views/member/group/modules/form.vue diff --git a/apps/web-antd/src/views/member/group/data.ts b/apps/web-antd/src/views/member/group/data.ts new file mode 100644 index 000000000..e7466bd3e --- /dev/null +++ b/apps/web-antd/src/views/member/group/data.ts @@ -0,0 +1,88 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; + +import { z } from '#/adapter/form'; +import { CommonStatusEnum, DICT_TYPE, getDictOptions } from '#/utils'; + +/** 新增/修改的表单 */ +export function useFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'id', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + component: 'Input', + fieldName: 'name', + label: '分组名称', + }, + { + fieldName: 'status', + label: '状态', + component: 'RadioGroup', + componentProps: { + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + buttonStyle: 'solid', + optionType: 'button', + }, + rules: z.number().default(CommonStatusEnum.ENABLE), + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'name', + label: '分组名称', + component: 'Input', + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + field: 'id', + title: '编号', + }, + { + field: 'name', + title: '分组名称', + }, + { + field: 'status', + title: '状态', + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.COMMON_STATUS }, + }, + }, + { + field: 'createTime', + title: '创建时间', + formatter: 'formatDateTime', + }, + { + title: '操作', + width: 130, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} diff --git a/apps/web-antd/src/views/member/group/index.vue b/apps/web-antd/src/views/member/group/index.vue index 692c3f277..b4de637e7 100644 --- a/apps/web-antd/src/views/member/group/index.vue +++ b/apps/web-antd/src/views/member/group/index.vue @@ -1,34 +1,127 @@ diff --git a/apps/web-antd/src/views/member/group/modules/form.vue b/apps/web-antd/src/views/member/group/modules/form.vue new file mode 100644 index 000000000..19f88b3e7 --- /dev/null +++ b/apps/web-antd/src/views/member/group/modules/form.vue @@ -0,0 +1,82 @@ + + +