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

This commit is contained in:
YunaiV
2025-10-11 21:00:23 +08:00
parent a46fa6442c
commit 53195748b8
3 changed files with 35 additions and 7 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,9 @@ export function useFormSchema(): VbenFormSchema[] {
component: 'InputNumber', component: 'InputNumber',
componentProps: { componentProps: {
min: 0, min: 0,
placeholder: '请输入显示顺序',
controlsPosition: 'right',
class: '!w-full',
}, },
rules: 'required', rules: 'required',
}, },
@@ -65,18 +75,27 @@ 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: {
clearable: true, placeholder: '请选择状态',
allowClear: true,
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
}, },
}, },
@@ -89,18 +108,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 +131,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 +145,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();
} }
@@ -50,9 +50,9 @@ async function handleDelete(row: MallDeliveryExpressApi.DeliveryExpress) {
text: $t('ui.actionMessage.deleting', [row.name]), text: $t('ui.actionMessage.deleting', [row.name]),
}); });
try { try {
await deleteDeliveryExpress(row.id as number); await deleteDeliveryExpress(row.id!);
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name])); ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh(); handleRefresh();
} finally { } finally {
loadingInstance.close(); loadingInstance.close();
} }
@@ -79,6 +79,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
}, },
rowConfig: { rowConfig: {
keyField: 'id', keyField: 'id',
isHover: true,
}, },
toolbarConfig: { toolbarConfig: {
refresh: true, refresh: true,
@@ -90,7 +91,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
@@ -117,6 +118,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
:actions="[ :actions="[
{ {
label: $t('common.edit'), label: $t('common.edit'),
type: 'primary',
link: true, link: true,
icon: ACTION_ICON.EDIT, icon: ACTION_ICON.EDIT,
auth: ['trade:delivery:express:update'], auth: ['trade:delivery:express:update'],
@@ -124,8 +126,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
}, },
{ {
label: $t('common.delete'), label: $t('common.delete'),
link: true,
type: 'danger', type: 'danger',
link: true,
icon: ACTION_ICON.DELETE, icon: ACTION_ICON.DELETE,
auth: ['trade:delivery:express:delete'], auth: ['trade:delivery:express:delete'],
popConfirm: { popConfirm: {

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>