feat:【antd】【erp 系统】finance/account 重构代码风格

This commit is contained in:
YunaiV
2025-10-04 15:31:26 +08:00
parent f63cb9ed2f
commit b0c32a2a18
3 changed files with 32 additions and 10 deletions

View File

@@ -49,7 +49,6 @@ export function useFormSchema(): VbenFormSchema[] {
componentProps: { componentProps: {
placeholder: '请输入排序', placeholder: '请输入排序',
precision: 0, precision: 0,
class: 'w-full',
}, },
rules: 'required', rules: 'required',
defaultValue: 0, defaultValue: 0,
@@ -86,11 +85,14 @@ export function useFormSchema(): VbenFormSchema[] {
fieldName: 'remark', fieldName: 'remark',
label: '备注', label: '备注',
component: 'Textarea', component: 'Textarea',
componentProps: {
placeholder: '请输入备注',
rows: 3,
},
}, },
]; ];
} }
// TODO @xuzhiqiang搜索的是不是缺了placeholder
/** 列表的搜索表单 */ /** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] { export function useGridFormSchema(): VbenFormSchema[] {
return [ return [
@@ -98,16 +100,28 @@ export function useGridFormSchema(): VbenFormSchema[] {
fieldName: 'name', fieldName: 'name',
label: '名称', label: '名称',
component: 'Input', component: 'Input',
componentProps: {
placeholder: '请输入名称',
allowClear: true,
},
}, },
{ {
fieldName: 'no', fieldName: 'no',
label: '编码', label: '编码',
component: 'Input', component: 'Input',
componentProps: {
placeholder: '请输入编码',
allowClear: true,
},
}, },
{ {
fieldName: 'remark', fieldName: 'remark',
label: '备注', label: '备注',
component: 'Input', component: 'Input',
componentProps: {
placeholder: '请输入备注',
allowClear: true,
},
}, },
]; ];
} }
@@ -118,22 +132,28 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{ {
field: 'name', field: 'name',
title: '名称', title: '名称',
minWidth: 150,
}, },
{ {
field: 'no', field: 'no',
title: '编码', title: '编码',
minWidth: 120,
}, },
{ {
field: 'remark', field: 'remark',
title: '备注', title: '备注',
minWidth: 150,
showOverflow: 'tooltip',
}, },
{ {
field: 'sort', field: 'sort',
title: '排序', title: '排序',
minWidth: 80,
}, },
{ {
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 },
@@ -142,6 +162,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{ {
field: 'defaultStatus', field: 'defaultStatus',
title: '是否默认', title: '是否默认',
minWidth: 100,
slots: { slots: {
default: ({ row }) => { default: ({ row }) => {
return h( return h(
@@ -158,6 +179,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{ {
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: ErpAccountApi.Account) {
}); });
try { try {
await deleteAccount(row.id as number); await deleteAccount(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,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
url="https://doc.iocoder.cn/sale/finance-payment-receipt/" url="https://doc.iocoder.cn/sale/finance-payment-receipt/"
/> />
</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,8 +30,9 @@ const [Form, formApi] = useVbenForm({
componentProps: { componentProps: {
class: 'w-full', class: 'w-full',
}, },
formItemClass: 'col-span-2',
labelWidth: 80,
}, },
wrapperClass: 'grid-cols-1',
layout: 'horizontal', layout: 'horizontal',
schema: useFormSchema(), schema: useFormSchema(),
showDefaultActions: false, showDefaultActions: false,
@@ -79,7 +80,7 @@ const [Modal, modalApi] = useVbenModal({
</script> </script>
<template> <template>
<Modal class="w-2/5" :title="getTitle"> <Modal class="w-1/3" :title="getTitle">
<Form class="mx-4" /> <Form class="mx-4" />
</Modal> </Modal>
</template> </template>