From e84cd6147c6b6d94b89c4da8b1c0d52fc5b49e48 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 8 Oct 2025 10:22:27 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E3=80=90mall=20=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E3=80=91=E5=95=86=E5=93=81=E5=88=86=E7=B1=BB=E7=9A=84=E8=BF=81?= =?UTF-8?q?=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/mall/product/brand/data.ts | 31 ++++++++++++--- .../src/views/mall/product/brand/index.vue | 13 +++---- .../views/mall/product/brand/modules/form.vue | 4 +- .../src/views/mall/product/brand/data.ts | 39 +++++++++++++------ .../src/views/mall/product/brand/index.vue | 11 +++--- .../views/mall/product/brand/modules/form.vue | 4 +- 6 files changed, 69 insertions(+), 33 deletions(-) diff --git a/apps/web-antd/src/views/mall/product/brand/data.ts b/apps/web-antd/src/views/mall/product/brand/data.ts index 2a40f8d7f..f9cfa10c0 100644 --- a/apps/web-antd/src/views/mall/product/brand/data.ts +++ b/apps/web-antd/src/views/mall/product/brand/data.ts @@ -1,5 +1,5 @@ import type { VbenFormSchema } from '#/adapter/form'; -import type { VxeGridPropTypes } from '#/adapter/vxe-table'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import { CommonStatusEnum, DICT_TYPE } from '@vben/constants'; import { getDictOptions } from '@vben/hooks'; @@ -22,12 +22,18 @@ export function useFormSchema(): VbenFormSchema[] { fieldName: 'name', label: '品牌名称', component: 'Input', + componentProps: { + placeholder: '请输入品牌名称', + }, rules: 'required', }, { fieldName: 'picUrl', label: '品牌图片', component: 'ImageUpload', + componentProps: { + placeholder: '请上传品牌图片', + }, rules: 'required', }, { @@ -38,7 +44,7 @@ export function useFormSchema(): VbenFormSchema[] { min: 0, placeholder: '请输入品牌排序', }, - rules: z.number().min(0).default(1), + rules: 'required', }, { fieldName: 'status', @@ -55,6 +61,9 @@ export function useFormSchema(): VbenFormSchema[] { fieldName: 'description', label: '品牌描述', component: 'Textarea', + componentProps: { + placeholder: '请输入品牌描述', + }, }, ]; } @@ -66,6 +75,10 @@ export function useGridFormSchema(): VbenFormSchema[] { fieldName: 'name', label: '品牌名称', component: 'Input', + componentProps: { + placeholder: '请输入品牌名称', + allowClear: true, + }, }, { fieldName: 'status', @@ -73,6 +86,8 @@ export function useGridFormSchema(): VbenFormSchema[] { component: 'Select', componentProps: { options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + placeholder: '请选择品牌状态', + allowClear: true, }, }, { @@ -88,16 +103,17 @@ export function useGridFormSchema(): VbenFormSchema[] { } /** 表格列配置 */ -export function useGridColumns(): VxeGridPropTypes.Columns { +export function useGridColumns(): VxeTableGridOptions['columns'] { return [ { field: 'name', - title: '分类名称', - fixed: 'left', + title: '品牌名称', + minWidth: 180, }, { field: 'picUrl', title: '品牌图片', + minWidth: 120, cellRender: { name: 'CellImage', }, @@ -105,10 +121,12 @@ export function useGridColumns(): VxeGridPropTypes.Columns { { field: 'sort', title: '品牌排序', + minWidth: 100, }, { field: 'status', - title: '开启状态', + title: '品牌状态', + minWidth: 100, cellRender: { name: 'CellDict', props: { type: DICT_TYPE.COMMON_STATUS }, @@ -117,6 +135,7 @@ export function useGridColumns(): VxeGridPropTypes.Columns { { field: 'createTime', title: '创建时间', + minWidth: 180, formatter: 'formatDateTime', }, { diff --git a/apps/web-antd/src/views/mall/product/brand/index.vue b/apps/web-antd/src/views/mall/product/brand/index.vue index ba9c72ac4..453bc44b1 100644 --- a/apps/web-antd/src/views/mall/product/brand/index.vue +++ b/apps/web-antd/src/views/mall/product/brand/index.vue @@ -19,7 +19,7 @@ const [FormModal, formModalApi] = useVbenModal({ }); /** 刷新表格 */ -function onRefresh() { +function handleRefresh() { gridApi.query(); } @@ -40,11 +40,9 @@ async function handleDelete(row: MallBrandApi.Brand) { duration: 0, }); try { - await deleteBrand(row.id as number); - message.success({ - content: $t('ui.actionMessage.deleteSuccess', [row.name]), - }); - onRefresh(); + await deleteBrand(row.id!); + message.success($t('ui.actionMessage.deleteSuccess', [row.name])); + handleRefresh(); } finally { hideLoading(); } @@ -71,6 +69,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ }, rowConfig: { keyField: 'id', + isHover: true, }, toolbarConfig: { refresh: true, @@ -82,7 +81,7 @@ const [Grid, gridApi] = useVbenVxeGrid({