feat:【antd】【erp 系统】customer 迁移

This commit is contained in:
YunaiV
2025-10-03 11:50:26 +08:00
parent c208c56f72
commit 1a33f2562e
3 changed files with 45 additions and 24 deletions

View File

@@ -20,10 +20,10 @@ export function useFormSchema(): VbenFormSchema[] {
{ {
component: 'Input', component: 'Input',
fieldName: 'name', fieldName: 'name',
label: '名称', label: '客户名称',
rules: 'required', rules: 'required',
componentProps: { componentProps: {
placeholder: '请输入名称', placeholder: '请输入客户名称',
}, },
}, },
{ {
@@ -84,10 +84,8 @@ export function useFormSchema(): VbenFormSchema[] {
componentProps: { componentProps: {
placeholder: '请输入排序', placeholder: '请输入排序',
precision: 0, precision: 0,
class: 'w-full',
}, },
rules: 'required', rules: 'required',
defaultValue: 0,
}, },
{ {
fieldName: 'taxNo', fieldName: 'taxNo',
@@ -103,11 +101,9 @@ export function useFormSchema(): VbenFormSchema[] {
component: 'InputNumber', component: 'InputNumber',
componentProps: { componentProps: {
placeholder: '请输入税率', placeholder: '请输入税率',
precision: 0, precision: 2,
class: 'w-full',
}, },
rules: z.number().min(0).max(100).default(0).optional(), rules: z.number().min(0).max(100).optional(),
defaultValue: 0,
}, },
{ {
fieldName: 'bankName', fieldName: 'bankName',
@@ -139,30 +135,42 @@ export function useFormSchema(): VbenFormSchema[] {
component: 'Textarea', component: 'Textarea',
componentProps: { componentProps: {
placeholder: '请输入备注', placeholder: '请输入备注',
rows: 1, rows: 3,
}, },
formItemClass: 'col-span-2',
}, },
]; ];
} }
/** 列表的搜索表单 */ /** 列表的搜索表单 */
// TODO @XuZhiqiangplaceholder
export function useGridFormSchema(): VbenFormSchema[] { export function useGridFormSchema(): VbenFormSchema[] {
return [ return [
{ {
fieldName: 'name', fieldName: 'name',
label: '名称', label: '客户名称',
component: 'Input', component: 'Input',
componentProps: {
placeholder: '请输入客户名称',
allowClear: true,
},
}, },
{ {
fieldName: 'mobile', fieldName: 'mobile',
label: '手机号码', label: '手机号码',
component: 'Input', component: 'Input',
componentProps: {
placeholder: '请输入手机号码',
allowClear: true,
},
}, },
{ {
fieldName: 'email', fieldName: 'email',
label: '邮箱', label: '邮箱',
component: 'Input', component: 'Input',
componentProps: {
placeholder: '请输入邮箱',
allowClear: true,
},
}, },
]; ];
} }
@@ -172,39 +180,53 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
return [ return [
{ {
field: 'name', field: 'name',
title: '名称', title: '客户名称',
minWidth: 150,
}, },
{ {
field: 'contact', field: 'contact',
title: '联系人', title: '联系人',
minWidth: 120,
}, },
{ {
field: 'mobile', field: 'mobile',
title: '手机号码', title: '手机号码',
minWidth: 130,
}, },
{ {
field: 'telephone', field: 'telephone',
title: '联系电话', title: '联系电话',
minWidth: 130,
}, },
{ {
field: 'email', field: 'email',
title: '邮箱', title: '电子邮箱',
}, minWidth: 180,
{
field: 'taxNo',
title: '纳税人识别号',
}, },
{ {
field: 'status', field: 'status',
title: '状态', title: '状态',
minWidth: 100,
cellRender: { cellRender: {
name: 'CellDict', name: 'CellDict',
props: { type: DICT_TYPE.COMMON_STATUS }, props: { type: DICT_TYPE.COMMON_STATUS },
}, },
}, },
{
field: 'sort',
title: '排序',
minWidth: 80,
},
{
field: 'remark',
title: '备注',
minWidth: 150,
showOverflow: 'tooltip',
},
{ {
field: 'createTime', field: 'createTime',
title: '创建时间', title: '创建时间',
minWidth: 180,
formatter: 'formatDateTime', formatter: 'formatDateTime',
}, },
{ {

View File

@@ -24,7 +24,7 @@ const [FormModal, formModalApi] = useVbenModal({
}); });
/** 刷新表格 */ /** 刷新表格 */
function onRefresh() { function handleRefresh() {
gridApi.query(); gridApi.query();
} }
@@ -52,10 +52,8 @@ async function handleDelete(row: ErpCustomerApi.Customer) {
}); });
try { try {
await deleteCustomer(row.id as number); await deleteCustomer(row.id as number);
message.success({ message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
content: $t('ui.actionMessage.deleteSuccess', [row.name]), handleRefresh();
});
onRefresh();
} finally { } finally {
hideLoading(); hideLoading();
} }
@@ -100,7 +98,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
url="https://doc.iocoder.cn/erp/sale/" url="https://doc.iocoder.cn/erp/sale/"
/> />
</template> </template>
<FormModal @success="onRefresh" /> <FormModal @success="handleRefresh" />
<Grid table-title="客户列表"> <Grid table-title="客户列表">
<template #toolbar-tools> <template #toolbar-tools>
<TableAction <TableAction

View File

@@ -30,6 +30,7 @@ const [Form, formApi] = useVbenForm({
componentProps: { componentProps: {
class: 'w-full', class: 'w-full',
}, },
labelWidth: 90,
}, },
wrapperClass: 'grid-cols-2', wrapperClass: 'grid-cols-2',
layout: 'horizontal', layout: 'horizontal',
@@ -79,7 +80,7 @@ const [Modal, modalApi] = useVbenModal({
</script> </script>
<template> <template>
<Modal class="w-2/5" :title="getTitle"> <Modal class="w-1/2" :title="getTitle">
<Form class="mx-4" /> <Form class="mx-4" />
</Modal> </Modal>
</template> </template>