feat:【antd】【erp 系统】product unit 迁移

This commit is contained in:
YunaiV
2025-10-03 08:58:11 +08:00
parent f3390427ac
commit 7934cbdd7b
3 changed files with 20 additions and 8 deletions

View File

@@ -22,6 +22,9 @@ export function useFormSchema(): VbenFormSchema[] {
fieldName: 'name',
label: '单位名称',
rules: 'required',
componentProps: {
placeholder: '请输入单位名称',
},
},
{
fieldName: 'status',
@@ -44,12 +47,17 @@ export function useGridFormSchema(): VbenFormSchema[] {
fieldName: 'name',
label: '单位名称',
component: 'Input',
componentProps: {
placeholder: '请输入单位名称',
allowClear: true,
},
},
{
fieldName: 'status',
label: '单位状态',
component: 'Select',
componentProps: {
placeholder: '请选择单位状态',
allowClear: true,
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
},
@@ -63,14 +71,17 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{
field: 'id',
title: '单位编号',
minWidth: 100,
},
{
field: 'name',
title: '单位名称',
minWidth: 200,
},
{
field: 'status',
title: '单位状态',
minWidth: 100,
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.COMMON_STATUS },
@@ -79,6 +90,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{
field: 'createTime',
title: '创建时间',
minWidth: 180,
formatter: 'formatDateTime',
},
{

View File

@@ -24,7 +24,7 @@ const [FormModal, formModalApi] = useVbenModal({
});
/** 刷新表格 */
function onRefresh() {
function handleRefresh() {
gridApi.query();
}
@@ -52,10 +52,8 @@ async function handleDelete(row: ErpProductUnitApi.ProductUnit) {
});
try {
await deleteProductUnit(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,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
url="https://doc.iocoder.cn/erp/product/"
/>
</template>
<FormModal @success="onRefresh" />
<FormModal @success="handleRefresh" />
<Grid table-title="产品单位列表">
<template #toolbar-tools>
<TableAction

View File

@@ -73,7 +73,9 @@ const [Modal, modalApi] = useVbenModal({
try {
formData.value = await getProductUnit(data.id);
// 设置到 values
await formApi.setValues(formData.value);
if (formData.value) {
await formApi.setValues(formData.value);
}
} finally {
modalApi.unlock();
}
@@ -82,7 +84,7 @@ const [Modal, modalApi] = useVbenModal({
</script>
<template>
<Modal class="w-2/5" :title="getTitle">
<Modal :title="getTitle" class="w-1/2">
<Form class="mx-4" />
</Modal>
</template>