From c35ef82788f727f23601636689b57a05f0977a0d Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Fri, 6 Jun 2025 23:26:09 +0800 Subject: [PATCH] feat: mall product property --- .../src/views/mall/product/property/data.ts | 176 ++++++++++++++++++ .../src/views/mall/product/property/index.vue | 53 +++--- .../property/modules/property-form.vue | 88 +++++++++ .../property/modules/property-grid.vue | 142 ++++++++++++++ .../product/property/modules/value-form.vue | 100 ++++++++++ .../product/property/modules/value-grid.vue | 151 +++++++++++++++ 6 files changed, 685 insertions(+), 25 deletions(-) create mode 100644 apps/web-antd/src/views/mall/product/property/data.ts create mode 100644 apps/web-antd/src/views/mall/product/property/modules/property-form.vue create mode 100644 apps/web-antd/src/views/mall/product/property/modules/property-grid.vue create mode 100644 apps/web-antd/src/views/mall/product/property/modules/value-form.vue create mode 100644 apps/web-antd/src/views/mall/product/property/modules/value-grid.vue diff --git a/apps/web-antd/src/views/mall/product/property/data.ts b/apps/web-antd/src/views/mall/product/property/data.ts new file mode 100644 index 000000000..733c8fdcb --- /dev/null +++ b/apps/web-antd/src/views/mall/product/property/data.ts @@ -0,0 +1,176 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; + +import { getPropertySimpleList } from '#/api/mall/product/property'; + +// ============================== 属性 ============================== + +/** 类型新增/修改的表单 */ +export function usePropertyFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'id', + component: 'Input', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + fieldName: 'name', + label: '名称', + component: 'Input', + componentProps: { + placeholder: '请输入名称', + }, + rules: 'required', + }, + { + fieldName: 'remark', + label: '备注', + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + }, + }, + ]; +} + +/** 类型列表的搜索表单 */ +export function usePropertyGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'name', + label: '名称', + component: 'Input', + componentProps: { + placeholder: '请输入名称', + clearable: true, + }, + }, + ]; +} + +/** 类型列表的字段 */ +export function usePropertyGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + field: 'id', + title: '编号', + }, + { + field: 'name', + title: '名称', + }, + { + field: 'remark', + title: '备注', + }, + { + field: 'createTime', + title: '创建时间', + formatter: 'formatDateTime', + }, + { + title: '操作', + width: 160, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} + +// ============================== 值数据 ============================== + +/** 数据新增/修改的表单 */ +export function useValueFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'id', + component: 'Input', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + fieldName: 'propertyId', + label: '属性编号', + component: 'ApiSelect', + componentProps: (values) => { + return { + api: getPropertySimpleList, + labelField: 'name', + valueField: 'id', + disabled: !!values.id, + }; + }, + rules: 'required', + dependencies: { + triggerFields: [''], + }, + }, + { + fieldName: 'name', + label: '名称', + component: 'Input', + componentProps: { + placeholder: '请输入名称', + }, + rules: 'required', + }, + { + fieldName: 'remark', + label: '备注', + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + }, + }, + ]; +} + +/** 字典数据列表搜索表单 */ +export function useValueGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'name', + label: '名称', + component: 'Input', + componentProps: { + clearable: true, + }, + }, + ]; +} + +/** + * 字典数据表格列 + */ +export function useValueGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + field: 'id', + title: '编号', + }, + { + field: 'name', + title: '属性值名称', + }, + { + field: 'remark', + title: '备注', + }, + { + title: '创建时间', + field: 'createTime', + formatter: 'formatDateTime', + }, + { + title: '操作', + width: 160, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} diff --git a/apps/web-antd/src/views/mall/product/property/index.vue b/apps/web-antd/src/views/mall/product/property/index.vue index e8aff091a..452e04417 100644 --- a/apps/web-antd/src/views/mall/product/property/index.vue +++ b/apps/web-antd/src/views/mall/product/property/index.vue @@ -1,34 +1,37 @@ diff --git a/apps/web-antd/src/views/mall/product/property/modules/property-form.vue b/apps/web-antd/src/views/mall/product/property/modules/property-form.vue new file mode 100644 index 000000000..cce88878b --- /dev/null +++ b/apps/web-antd/src/views/mall/product/property/modules/property-form.vue @@ -0,0 +1,88 @@ + + + diff --git a/apps/web-antd/src/views/mall/product/property/modules/property-grid.vue b/apps/web-antd/src/views/mall/product/property/modules/property-grid.vue new file mode 100644 index 000000000..5be3a96b3 --- /dev/null +++ b/apps/web-antd/src/views/mall/product/property/modules/property-grid.vue @@ -0,0 +1,142 @@ + + + diff --git a/apps/web-antd/src/views/mall/product/property/modules/value-form.vue b/apps/web-antd/src/views/mall/product/property/modules/value-form.vue new file mode 100644 index 000000000..394bfe14b --- /dev/null +++ b/apps/web-antd/src/views/mall/product/property/modules/value-form.vue @@ -0,0 +1,100 @@ + + + diff --git a/apps/web-antd/src/views/mall/product/property/modules/value-grid.vue b/apps/web-antd/src/views/mall/product/property/modules/value-grid.vue new file mode 100644 index 000000000..e34dcca53 --- /dev/null +++ b/apps/web-antd/src/views/mall/product/property/modules/value-grid.vue @@ -0,0 +1,151 @@ + + +