From 85b6d0c4d6b20c3be9767bc7c4737fa174bca3d5 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 3 Oct 2025 10:12:00 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E3=80=90antd=E3=80=91=E3=80=90erp?= =?UTF-8?q?=20=E7=B3=BB=E7=BB=9F=E3=80=91supplier=20=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/erp/purchase/supplier/data.ts | 21 +++++----- .../src/views/erp/purchase/supplier/index.vue | 21 +++++----- .../erp/purchase/supplier/modules/form.vue | 41 ++++++++----------- 3 files changed, 36 insertions(+), 47 deletions(-) diff --git a/apps/web-antd/src/views/erp/purchase/supplier/data.ts b/apps/web-antd/src/views/erp/purchase/supplier/data.ts index 0c66fa8e0..73422c46d 100644 --- a/apps/web-antd/src/views/erp/purchase/supplier/data.ts +++ b/apps/web-antd/src/views/erp/purchase/supplier/data.ts @@ -1,9 +1,11 @@ import type { VbenFormSchema } from '#/adapter/form'; import type { VxeTableGridOptions } from '#/adapter/vxe-table'; -import { DICT_TYPE } from '@vben/constants'; +import { CommonStatusEnum, DICT_TYPE } from '@vben/constants'; import { getDictOptions } from '@vben/hooks'; +import { z } from '#/adapter/form'; + /** 新增/修改的表单 */ export function useFormSchema(): VbenFormSchema[] { return [ @@ -19,10 +21,10 @@ export function useFormSchema(): VbenFormSchema[] { fieldName: 'name', label: '供应商名称', component: 'Input', + rules: 'required', componentProps: { placeholder: '请输入供应商名称', }, - rules: 'required', }, { fieldName: 'contact', @@ -70,9 +72,11 @@ export function useFormSchema(): VbenFormSchema[] { component: 'RadioGroup', componentProps: { options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + buttonStyle: 'solid', + optionType: 'button', }, rules: 'required', - defaultValue: 0, + defaultValue: CommonStatusEnum.ENABLE, }, { fieldName: 'sort', @@ -80,11 +84,8 @@ export function useFormSchema(): VbenFormSchema[] { component: 'InputNumber', componentProps: { placeholder: '请输入排序', - precision: 0, - class: 'w-full', }, rules: 'required', - defaultValue: 0, }, { fieldName: 'taxNo', @@ -102,7 +103,6 @@ export function useFormSchema(): VbenFormSchema[] { placeholder: '请输入税率', min: 0, precision: 2, - class: 'w-full', }, }, { @@ -206,7 +206,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { { field: 'status', title: '状态', - width: 100, + minWidth: 100, cellRender: { name: 'CellDict', props: { type: DICT_TYPE.COMMON_STATUS }, @@ -215,7 +215,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { { field: 'sort', title: '排序', - width: 80, + minWidth: 80, }, { field: 'remark', @@ -224,10 +224,9 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { showOverflow: 'tooltip', }, { - field: 'actions', title: '操作', + width: 130, fixed: 'right', - width: 160, slots: { default: 'actions' }, }, ]; diff --git a/apps/web-antd/src/views/erp/purchase/supplier/index.vue b/apps/web-antd/src/views/erp/purchase/supplier/index.vue index 90c07ba76..9ca188749 100644 --- a/apps/web-antd/src/views/erp/purchase/supplier/index.vue +++ b/apps/web-antd/src/views/erp/purchase/supplier/index.vue @@ -22,18 +22,18 @@ import SupplierForm from './modules/form.vue'; defineOptions({ name: 'ErpSupplier' }); /** 刷新表格 */ -function onRefresh() { +function handleRefresh() { gridApi.query(); } -/** 添加供应商 */ +/** 创建供应商 */ function handleCreate() { - formModalApi.setData({ type: 'create' }).open(); + formModalApi.setData(null).open(); } /** 编辑供应商 */ function handleEdit(row: ErpSupplierApi.Supplier) { - formModalApi.setData({ type: 'update', id: row.id }).open(); + formModalApi.setData(row).open(); } /** 删除供应商 */ @@ -44,10 +44,8 @@ async function handleDelete(row: ErpSupplierApi.Supplier) { }); try { await deleteSupplier(row.id!); - message.success({ - content: $t('ui.actionMessage.deleteSuccess', [row.name]), - }); - onRefresh(); + message.success($t('ui.actionMessage.deleteSuccess', [row.name])); + handleRefresh(); } catch { hideLoading(); } @@ -85,6 +83,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ }, rowConfig: { keyField: 'id', + isHover: true, }, toolbarConfig: { refresh: true, @@ -103,7 +102,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ /> - +