From 5d99264665ae4af0acaa07a8dc885cac90d9948b Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Sun, 8 Jun 2025 17:14:21 +0800 Subject: [PATCH] feat: mall express --- .../views/mall/trade/delivery/express/data.ts | 133 ++++++++++++++ .../mall/trade/delivery/express/index.vue | 163 +++++++++++++++--- .../trade/delivery/express/modules/form.vue | 89 ++++++++++ 3 files changed, 359 insertions(+), 26 deletions(-) create mode 100644 apps/web-antd/src/views/mall/trade/delivery/express/data.ts create mode 100644 apps/web-antd/src/views/mall/trade/delivery/express/modules/form.vue diff --git a/apps/web-antd/src/views/mall/trade/delivery/express/data.ts b/apps/web-antd/src/views/mall/trade/delivery/express/data.ts new file mode 100644 index 000000000..514b776e6 --- /dev/null +++ b/apps/web-antd/src/views/mall/trade/delivery/express/data.ts @@ -0,0 +1,133 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; + +import { z } from '#/adapter/form'; +import { CommonStatusEnum, DICT_TYPE, getDictOptions } from '#/utils'; + +/** 新增/修改的表单 */ +export function useFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + fieldName: 'id', + dependencies: { + triggerFields: [''], + show: () => false, + }, + }, + { + component: 'Input', + fieldName: 'code', + label: '公司编码', + rules: 'required', + }, + { + component: 'Input', + fieldName: 'name', + label: '公司名称', + rules: 'required', + }, + { + component: 'ImageUpload', + fieldName: 'logo', + label: '公司 logo', + componentProps: { + maxSize: 1, + }, + rules: 'required', + }, + { + fieldName: 'sort', + label: '显示顺序', + component: 'InputNumber', + componentProps: { + min: 0, + }, + rules: 'required', + }, + { + fieldName: 'status', + label: '开启状态', + component: 'RadioGroup', + componentProps: { + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + buttonStyle: 'solid', + optionType: 'button', + }, + rules: z.number().default(CommonStatusEnum.ENABLE), + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'name', + label: '快递公司名称', + component: 'Input', + }, + { + fieldName: 'code', + label: '快递公司编号', + component: 'Input', + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + allowClear: true, + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + field: 'id', + title: '编号', + }, + { + field: 'code', + title: '公司编码', + }, + { + field: 'name', + title: '公司名称', + }, + { + field: 'logo', + title: '公司 logo', + cellRender: { + name: 'CellImage', + }, + }, + { + field: 'sort', + title: '显示顺序', + }, + { + field: 'status', + title: '状态', + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.COMMON_STATUS }, + }, + }, + { + field: 'createTime', + title: '创建时间', + formatter: 'formatDateTime', + }, + { + title: '操作', + width: 130, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} diff --git a/apps/web-antd/src/views/mall/trade/delivery/express/index.vue b/apps/web-antd/src/views/mall/trade/delivery/express/index.vue index 9f64b29fa..5a52b2826 100644 --- a/apps/web-antd/src/views/mall/trade/delivery/express/index.vue +++ b/apps/web-antd/src/views/mall/trade/delivery/express/index.vue @@ -1,34 +1,145 @@ diff --git a/apps/web-antd/src/views/mall/trade/delivery/express/modules/form.vue b/apps/web-antd/src/views/mall/trade/delivery/express/modules/form.vue new file mode 100644 index 000000000..d2fd82670 --- /dev/null +++ b/apps/web-antd/src/views/mall/trade/delivery/express/modules/form.vue @@ -0,0 +1,89 @@ + + +