From 7fb9f6e0649017639ce0a6da2526741dec1c4a0c Mon Sep 17 00:00:00 2001 From: xuzhiqiang Date: Thu, 14 Aug 2025 16:16:34 +0800 Subject: [PATCH] =?UTF-8?q?feat(@vben/web-antd):=20erp-product-unit=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BA=A7=E5=93=81=E5=8D=95=E4=BD=8D=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=8C=85=E6=8B=AC=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E3=80=81=E5=88=97=E8=A1=A8=E5=8F=8A=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/erp/product/unit/data.ts | 89 ++++++++++ .../src/views/erp/product/unit/index.vue | 160 +++++++++++++++--- .../views/erp/product/unit/modules/form.vue | 88 ++++++++++ 3 files changed, 316 insertions(+), 21 deletions(-) create mode 100644 apps/web-antd/src/views/erp/product/unit/data.ts create mode 100644 apps/web-antd/src/views/erp/product/unit/modules/form.vue diff --git a/apps/web-antd/src/views/erp/product/unit/data.ts b/apps/web-antd/src/views/erp/product/unit/data.ts new file mode 100644 index 000000000..7de094158 --- /dev/null +++ b/apps/web-antd/src/views/erp/product/unit/data.ts @@ -0,0 +1,89 @@ +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: '单位名称', + rules: 'required', + }, + { + 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/erp/product/unit/index.vue b/apps/web-antd/src/views/erp/product/unit/index.vue index 70e5ebd61..1386c131f 100644 --- a/apps/web-antd/src/views/erp/product/unit/index.vue +++ b/apps/web-antd/src/views/erp/product/unit/index.vue @@ -1,34 +1,152 @@ diff --git a/apps/web-antd/src/views/erp/product/unit/modules/form.vue b/apps/web-antd/src/views/erp/product/unit/modules/form.vue new file mode 100644 index 000000000..4871e227c --- /dev/null +++ b/apps/web-antd/src/views/erp/product/unit/modules/form.vue @@ -0,0 +1,88 @@ + + +