diff --git a/apps/web-antd/src/adapter/vxe-table.ts b/apps/web-antd/src/adapter/vxe-table.ts
index 96c85d129..4fef67d52 100644
--- a/apps/web-antd/src/adapter/vxe-table.ts
+++ b/apps/web-antd/src/adapter/vxe-table.ts
@@ -341,13 +341,13 @@ setupVbenVxeTable({
vxeUI.formats.add('formatAmount2', {
tableCellFormatMethod({ cellValue }, digits = 2) {
- return `${erpNumberFormatter(cellValue, digits)}元`;
+ return `${erpNumberFormatter(cellValue, digits)}`;
},
});
vxeUI.formats.add('formatFenToYuanAmount', {
tableCellFormatMethod({ cellValue }, digits = 2) {
- return `${erpNumberFormatter(fenToYuan(cellValue), digits)}元`;
+ return `${erpNumberFormatter(fenToYuan(cellValue), digits)}`;
},
});
},
diff --git a/apps/web-antd/src/views/erp/product/product/data.ts b/apps/web-antd/src/views/erp/product/product/data.ts
index 942e2288e..cfde896db 100644
--- a/apps/web-antd/src/views/erp/product/product/data.ts
+++ b/apps/web-antd/src/views/erp/product/product/data.ts
@@ -3,7 +3,6 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { CommonStatusEnum, DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
-import { handleTree } from '@vben/utils';
import { z } from '#/adapter/form';
import { getProductCategorySimpleList } from '#/api/erp/product/category';
@@ -109,6 +108,9 @@ export function useFormSchema(): VbenFormSchema[] {
component: 'InputNumber',
componentProps: {
placeholder: '请输入采购价格,单位:元',
+ precision: 2,
+ min: 0,
+ step: 0.01,
},
},
{
@@ -117,6 +119,9 @@ export function useFormSchema(): VbenFormSchema[] {
component: 'InputNumber',
componentProps: {
placeholder: '请输入销售价格,单位:元',
+ precision: 2,
+ min: 0,
+ step: 0.01,
},
},
{
@@ -125,12 +130,18 @@ export function useFormSchema(): VbenFormSchema[] {
component: 'InputNumber',
componentProps: {
placeholder: '请输入最低价格,单位:元',
+ precision: 2,
+ min: 0,
+ step: 0.01,
},
},
{
fieldName: 'remark',
label: '备注',
component: 'Textarea',
+ componentProps: {
+ placeholder: '请输入备注',
+ },
},
];
}
@@ -142,6 +153,10 @@ export function useGridFormSchema(): VbenFormSchema[] {
fieldName: 'name',
label: '名称',
component: 'Input',
+ componentProps: {
+ placeholder: '请输入名称',
+ allowClear: true,
+ },
},
{
fieldName: 'categoryId',
@@ -169,38 +184,50 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{
field: 'barCode',
title: '条码',
+ minWidth: 120,
},
{
field: 'name',
title: '名称',
+ minWidth: 200,
},
{
field: 'standard',
title: '规格',
+ minWidth: 100,
},
{
field: 'categoryName',
title: '分类',
+ minWidth: 120,
},
{
field: 'unitName',
title: '单位',
+ minWidth: 100,
},
{
field: 'purchasePrice',
title: '采购价格',
+ minWidth: 100,
+ formatter: 'formatAmount2',
},
{
field: 'salePrice',
title: '销售价格',
+ minWidth: 100,
+ formatter: 'formatAmount2',
},
{
field: 'minPrice',
title: '最低价格',
+ minWidth: 100,
+ formatter: 'formatAmount2',
},
{
field: 'status',
title: '状态',
+ minWidth: 100,
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.COMMON_STATUS },
@@ -209,6 +236,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{
field: 'createTime',
title: '创建时间',
+ minWidth: 180,
formatter: 'formatDateTime',
},
{
diff --git a/apps/web-antd/src/views/erp/product/product/index.vue b/apps/web-antd/src/views/erp/product/product/index.vue
index fe7a4e7ca..4b96bc300 100644
--- a/apps/web-antd/src/views/erp/product/product/index.vue
+++ b/apps/web-antd/src/views/erp/product/product/index.vue
@@ -24,7 +24,7 @@ const [FormModal, formModalApi] = useVbenModal({
});
/** 刷新表格 */
-function onRefresh() {
+function handleRefresh() {
gridApi.query();
}
@@ -52,10 +52,8 @@ async function handleDelete(row: ErpProductApi.Product) {
});
try {
await deleteProduct(row.id as number);
- message.success({
- content: $t('ui.actionMessage.deleteSuccess', [row.name]),
- });
- onRefresh();
+ message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
+ handleRefresh();
} finally {
hideLoading();
}
@@ -100,7 +98,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
url="https://doc.iocoder.cn/erp/product/"
/>
-
+
+
-
+
diff --git a/apps/web-ele/src/adapter/vxe-table.ts b/apps/web-ele/src/adapter/vxe-table.ts
index c99686be5..354e53907 100644
--- a/apps/web-ele/src/adapter/vxe-table.ts
+++ b/apps/web-ele/src/adapter/vxe-table.ts
@@ -321,19 +321,22 @@ setupVbenVxeTable({
// add by 星语:数量格式化,例如说:金额
vxeUI.formats.add('formatNumber', {
tableCellFormatMethod({ cellValue }) {
+ if (cellValue === null || cellValue === undefined) {
+ return '';
+ }
return erpCountInputFormatter(cellValue);
},
});
vxeUI.formats.add('formatAmount2', {
tableCellFormatMethod({ cellValue }, digits = 2) {
- return `${erpNumberFormatter(cellValue, digits)}元`;
+ return `${erpNumberFormatter(cellValue, digits)}`;
},
});
vxeUI.formats.add('formatFenToYuanAmount', {
tableCellFormatMethod({ cellValue }, digits = 2) {
- return `${erpNumberFormatter(fenToYuan(cellValue), digits)}元`;
+ return `${erpNumberFormatter(fenToYuan(cellValue), digits)}`;
},
});
},