feat:【mall 商城】快递公司的迁移(antd 100%)

This commit is contained in:
YunaiV
2025-10-11 20:26:57 +08:00
parent 59bbe4cc93
commit a46fa6442c
3 changed files with 31 additions and 8 deletions

View File

@@ -21,12 +21,18 @@ export function useFormSchema(): VbenFormSchema[] {
component: 'Input', component: 'Input',
fieldName: 'code', fieldName: 'code',
label: '公司编码', label: '公司编码',
componentProps: {
placeholder: '请输入快递编码',
},
rules: 'required', rules: 'required',
}, },
{ {
component: 'Input', component: 'Input',
fieldName: 'name', fieldName: 'name',
label: '公司名称', label: '公司名称',
componentProps: {
placeholder: '请输入快递名称',
},
rules: 'required', rules: 'required',
}, },
{ {
@@ -34,6 +40,7 @@ export function useFormSchema(): VbenFormSchema[] {
fieldName: 'logo', fieldName: 'logo',
label: '公司 logo', label: '公司 logo',
rules: 'required', rules: 'required',
help: '推荐 180x180 图片分辨率',
}, },
{ {
fieldName: 'sort', fieldName: 'sort',
@@ -41,6 +48,7 @@ export function useFormSchema(): VbenFormSchema[] {
component: 'InputNumber', component: 'InputNumber',
componentProps: { componentProps: {
min: 0, min: 0,
placeholder: '请输入显示顺序',
}, },
rules: 'required', rules: 'required',
}, },
@@ -65,17 +73,26 @@ export function useGridFormSchema(): VbenFormSchema[] {
fieldName: 'name', fieldName: 'name',
label: '快递公司名称', label: '快递公司名称',
component: 'Input', component: 'Input',
componentProps: {
placeholder: '请输入快递公司名称',
allowClear: true,
},
}, },
{ {
fieldName: 'code', fieldName: 'code',
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'),
}, },
@@ -89,18 +106,22 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{ {
field: 'id', field: 'id',
title: '编号', title: '编号',
minWidth: 100,
}, },
{ {
field: 'code', field: 'code',
title: '公司编码', title: '公司编码',
minWidth: 120,
}, },
{ {
field: 'name', field: 'name',
title: '公司名称', title: '公司名称',
minWidth: 150,
}, },
{ {
field: 'logo', field: 'logo',
title: '公司 logo', title: '公司 logo',
minWidth: 120,
cellRender: { cellRender: {
name: 'CellImage', name: 'CellImage',
}, },
@@ -108,10 +129,12 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{ {
field: 'sort', field: 'sort',
title: '显示顺序', title: '显示顺序',
minWidth: 100,
}, },
{ {
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 },
@@ -120,6 +143,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();
} }
@@ -51,11 +51,9 @@ async function handleDelete(row: MallDeliveryExpressApi.DeliveryExpress) {
duration: 0, duration: 0,
}); });
try { try {
await deleteDeliveryExpress(row.id as number); await deleteDeliveryExpress(row.id!);
message.success({ message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
content: $t('ui.actionMessage.deleteSuccess', [row.name]), handleRefresh();
});
onRefresh();
} finally { } finally {
hideLoading(); hideLoading();
} }
@@ -82,6 +80,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
}, },
rowConfig: { rowConfig: {
keyField: 'id', keyField: 'id',
isHover: true,
}, },
toolbarConfig: { toolbarConfig: {
refresh: true, refresh: true,
@@ -93,7 +92,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
<template> <template>
<Page auto-content-height> <Page auto-content-height>
<FormModal @success="onRefresh" /> <FormModal @success="handleRefresh" />
<Grid table-title="快递公司列表"> <Grid table-title="快递公司列表">
<template #toolbar-tools> <template #toolbar-tools>
<TableAction <TableAction

View File

@@ -83,7 +83,7 @@ const [Modal, modalApi] = useVbenModal({
</script> </script>
<template> <template>
<Modal class="w-2/5" :title="getTitle"> <Modal :title="getTitle" class="w-2/5">
<Form class="mx-4" /> <Form class="mx-4" />
</Modal> </Modal>
</template> </template>