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', fieldName: 'name',
label: '单位名称', label: '单位名称',
rules: 'required', rules: 'required',
componentProps: {
placeholder: '请输入单位名称',
},
}, },
{ {
fieldName: 'status', fieldName: 'status',
@@ -44,12 +47,17 @@ export function useGridFormSchema(): VbenFormSchema[] {
fieldName: 'name', fieldName: 'name',
label: '单位名称', label: '单位名称',
component: 'Input', component: 'Input',
componentProps: {
placeholder: '请输入单位名称',
allowClear: true,
},
}, },
{ {
fieldName: 'status', fieldName: 'status',
label: '单位状态', label: '单位状态',
component: 'Select', component: 'Select',
componentProps: { componentProps: {
placeholder: '请选择单位状态',
allowClear: true, allowClear: true,
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
}, },
@@ -63,14 +71,17 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{ {
field: 'id', field: 'id',
title: '单位编号', title: '单位编号',
minWidth: 100,
}, },
{ {
field: 'name', field: 'name',
title: '单位名称', title: '单位名称',
minWidth: 200,
}, },
{ {
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 },
@@ -79,6 +90,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: ErpProductUnitApi.ProductUnit) {
}); });
try { try {
await deleteProductUnit(row.id as number); await deleteProductUnit(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/product/" url="https://doc.iocoder.cn/erp/product/"
/> />
</template> </template>
<FormModal @success="onRefresh" /> <FormModal @success="handleRefresh" />
<Grid table-title="产品单位列表"> <Grid table-title="产品单位列表">
<template #toolbar-tools> <template #toolbar-tools>
<TableAction <TableAction

View File

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