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',
fieldName: 'code',
label: '公司编码',
componentProps: {
placeholder: '请输入快递编码',
},
rules: 'required',
},
{
component: 'Input',
fieldName: 'name',
label: '公司名称',
componentProps: {
placeholder: '请输入快递名称',
},
rules: 'required',
},
{
@@ -34,6 +40,7 @@ export function useFormSchema(): VbenFormSchema[] {
fieldName: 'logo',
label: '公司 logo',
rules: 'required',
help: '推荐 180x180 图片分辨率',
},
{
fieldName: 'sort',
@@ -41,6 +48,9 @@ export function useFormSchema(): VbenFormSchema[] {
component: 'InputNumber',
componentProps: {
min: 0,
placeholder: '请输入显示顺序',
controlsPosition: 'right',
class: '!w-full',
},
rules: 'required',
},
@@ -65,18 +75,27 @@ export function useGridFormSchema(): VbenFormSchema[] {
fieldName: 'name',
label: '快递公司名称',
component: 'Input',
componentProps: {
placeholder: '请输入快递公司名称',
allowClear: true,
},
},
{
fieldName: 'code',
label: '快递公司编号',
component: 'Input',
componentProps: {
placeholder: '请输入快递公司编号',
allowClear: true,
},
},
{
fieldName: 'status',
label: '状态',
component: 'Select',
componentProps: {
clearable: true,
placeholder: '请选择状态',
allowClear: true,
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
},
},
@@ -89,18 +108,22 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{
field: 'id',
title: '编号',
minWidth: 100,
},
{
field: 'code',
title: '公司编码',
minWidth: 120,
},
{
field: 'name',
title: '公司名称',
minWidth: 150,
},
{
field: 'logo',
title: '公司 logo',
minWidth: 120,
cellRender: {
name: 'CellImage',
},
@@ -108,10 +131,12 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{
field: 'sort',
title: '显示顺序',
minWidth: 100,
},
{
field: 'status',
title: '状态',
minWidth: 100,
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.COMMON_STATUS },
@@ -120,6 +145,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();
}
@@ -50,9 +50,9 @@ async function handleDelete(row: MallDeliveryExpressApi.DeliveryExpress) {
text: $t('ui.actionMessage.deleting', [row.name]),
});
try {
await deleteDeliveryExpress(row.id as number);
await deleteDeliveryExpress(row.id!);
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
onRefresh();
handleRefresh();
} finally {
loadingInstance.close();
}
@@ -79,6 +79,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
},
rowConfig: {
keyField: 'id',
isHover: true,
},
toolbarConfig: {
refresh: true,
@@ -90,7 +91,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
<template>
<Page auto-content-height>
<FormModal @success="onRefresh" />
<FormModal @success="handleRefresh" />
<Grid table-title="快递公司列表">
<template #toolbar-tools>
<TableAction
@@ -117,6 +118,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
:actions="[
{
label: $t('common.edit'),
type: 'primary',
link: true,
icon: ACTION_ICON.EDIT,
auth: ['trade:delivery:express:update'],
@@ -124,8 +126,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
},
{
label: $t('common.delete'),
link: true,
type: 'danger',
link: true,
icon: ACTION_ICON.DELETE,
auth: ['trade:delivery:express:delete'],
popConfirm: {

View File

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