From db9d085f948a6688944333213a18677d6065b155 Mon Sep 17 00:00:00 2001 From: xuzhiqiang Date: Fri, 15 Aug 2025 11:26:26 +0800 Subject: [PATCH 01/12] =?UTF-8?q?fix(@vben/web-antd):=20erp-stock-in=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8F=90=E4=BA=A4=E8=A1=A8=E5=8D=95=E6=97=B6?= =?UTF-8?q?=E6=B8=85=E7=A9=BA=E4=BA=A7=E5=93=81=E9=A1=B9=20ID=EF=BC=8C?= =?UTF-8?q?=E7=A1=AE=E4=BF=9D=E8=AF=B7=E6=B1=82=E6=88=90=E5=8A=9F=E4=B8=8D?= =?UTF-8?q?=E6=8A=A5row=5Fxxx=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/views/erp/stock/in/modules/form.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/web-antd/src/views/erp/stock/in/modules/form.vue b/apps/web-antd/src/views/erp/stock/in/modules/form.vue index fffca0978..a18f6c1ce 100644 --- a/apps/web-antd/src/views/erp/stock/in/modules/form.vue +++ b/apps/web-antd/src/views/erp/stock/in/modules/form.vue @@ -88,7 +88,10 @@ const [Modal, modalApi] = useVbenModal({ modalApi.lock(); // 提交表单 const data = (await formApi.getValues()) as ErpStockInApi.StockIn; - data.items = formData.value?.items; + data.items = formData.value?.items?.map((item) => ({ + ...item, + id: undefined, + })); // 将文件数组转换为字符串 if (data.fileUrl && Array.isArray(data.fileUrl)) { data.fileUrl = data.fileUrl.length > 0 ? data.fileUrl[0] : ''; -- Gitee From db2ee3c1210e72f78c25bea9f770ab398caa1a49 Mon Sep 17 00:00:00 2001 From: xuzhiqiang Date: Fri, 15 Aug 2025 16:08:49 +0800 Subject: [PATCH 02/12] =?UTF-8?q?feat(@vben/web-antd):=20erp-stock-out=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=85=B6=E5=AE=83=E5=87=BA=E5=BA=93=E5=8D=95?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=8C=85=E6=8B=AC?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E3=80=81=E5=88=97=E8=A1=A8=E5=8F=8A=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/api/erp/stock/out/index.ts | 20 +- apps/web-antd/src/views/erp/stock/out/data.ts | 329 ++++++++++++++++ .../src/views/erp/stock/out/index.vue | 227 ++++++++++- .../src/views/erp/stock/out/modules/form.vue | 196 ++++++++++ .../stock/out/modules/stock-out-item-form.vue | 367 ++++++++++++++++++ 5 files changed, 1117 insertions(+), 22 deletions(-) create mode 100644 apps/web-antd/src/views/erp/stock/out/data.ts create mode 100644 apps/web-antd/src/views/erp/stock/out/modules/form.vue create mode 100644 apps/web-antd/src/views/erp/stock/out/modules/stock-out-item-form.vue diff --git a/apps/web-antd/src/api/erp/stock/out/index.ts b/apps/web-antd/src/api/erp/stock/out/index.ts index 2224e2ddb..a3873f948 100644 --- a/apps/web-antd/src/api/erp/stock/out/index.ts +++ b/apps/web-antd/src/api/erp/stock/out/index.ts @@ -2,7 +2,7 @@ import type { PageParam, PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; -namespace ErpStockOutApi { +export namespace ErpStockOutApi { /** 其它出库单信息 */ export interface StockOut { id?: number; // 出库编号 @@ -13,6 +13,24 @@ namespace ErpStockOutApi { totalPrice: number; // 合计金额,单位:元 status: number; // 状态 remark: string; // 备注 + fileUrl?: string; // 附件 + items?: StockOutItem[]; // 出库产品清单 + } + + /** 其它出库单产品信息 */ + export interface StockOutItem { + id?: number; // 编号 + warehouseId?: number; // 仓库编号 + productId?: number; // 产品编号 + productName?: string; // 产品名称 + productUnitId?: number; // 产品单位编号 + productUnitName?: string; // 产品单位名称 + productBarCode?: string; // 产品条码 + count: number; // 数量 + productPrice: number; // 产品单价 + totalPrice: number; // 总价 + stockCount?: number; // 库存数量 + remark?: string; // 备注 } /** 其它出库单分页查询参数 */ diff --git a/apps/web-antd/src/views/erp/stock/out/data.ts b/apps/web-antd/src/views/erp/stock/out/data.ts new file mode 100644 index 000000000..ca2095c34 --- /dev/null +++ b/apps/web-antd/src/views/erp/stock/out/data.ts @@ -0,0 +1,329 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; + +import { createRequiredValidation } from '#/adapter/vxe-table'; +import { getProductSimpleList } from '#/api/erp/product/product'; +import { getCustomerSimpleList } from '#/api/erp/sale/customer'; +import { getSimpleUserList } from '#/api/system/user'; +import { DICT_TYPE, getDictOptions } from '#/utils'; + +/** 表单的配置项 */ +export function useFormSchema(formType: string): VbenFormSchema[] { + return [ + { + component: 'Input', + componentProps: { + style: { display: 'none' }, + }, + fieldName: 'id', + label: 'ID', + hideLabel: true, + formItemClass: 'hidden', + }, + { + component: 'Input', + componentProps: { + placeholder: '系统自动生成', + disabled: true, + }, + fieldName: 'no', + label: '出库单号', + disabled: formType === 'detail', + }, + { + component: 'DatePicker', + componentProps: { + placeholder: '选择出库时间', + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + style: { width: '100%' }, + }, + disabled: formType === 'detail', + fieldName: 'outTime', + label: '出库时间', + rules: 'required', + }, + { + component: 'ApiSelect', + componentProps: { + placeholder: '请选择客户', + allowClear: true, + showSearch: true, + api: getCustomerSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + disabled: formType === 'detail', + fieldName: 'customerId', + label: '客户', + }, + + { + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + autoSize: { minRows: 2, maxRows: 4 }, + class: 'w-full', + }, + disabled: formType === 'detail', + fieldName: 'remark', + label: '备注', + formItemClass: 'col-span-3', + }, + { + component: 'FileUpload', + disabled: formType === 'detail', + componentProps: { + maxNumber: 1, + maxSize: 10, + accept: [ + 'pdf', + 'doc', + 'docx', + 'xls', + 'xlsx', + 'txt', + 'jpg', + 'jpeg', + 'png', + ], + showDescription: true, + }, + fieldName: 'fileUrl', + label: '附件', + formItemClass: 'col-span-3', + }, + { + fieldName: 'product', + disabled: formType === 'detail', + label: '产品清单', + component: 'Input', + formItemClass: 'col-span-3', + }, + ]; +} + +/** 出库产品清单表格列定义 */ +export function useStockInItemTableColumns( + isValidating?: any, +): VxeTableGridOptions['columns'] { + return [ + { type: 'seq', title: '序号', minWidth: 50, fixed: 'left' }, + { + field: 'warehouseId', + title: '仓库名称', + minWidth: 150, + slots: { default: 'warehouseId' }, + className: createRequiredValidation(isValidating, 'warehouseId'), + }, + { + field: 'productId', + title: '产品名称', + minWidth: 200, + slots: { default: 'productId' }, + className: createRequiredValidation(isValidating, 'productId'), + }, + { + field: 'stockCount', + title: '库存', + minWidth: 100, + }, + { + field: 'productBarCode', + title: '条码', + minWidth: 120, + }, + { + field: 'productUnitName', + title: '单位', + minWidth: 80, + }, + { + field: 'count', + title: '数量', + minWidth: 120, + slots: { default: 'count' }, + className: createRequiredValidation(isValidating, 'count'), + }, + { + field: 'productPrice', + title: '产品单价', + minWidth: 120, + slots: { default: 'productPrice' }, + }, + { + field: 'totalPrice', + title: '金额', + minWidth: 120, + formatter: 'formatAmount2', + }, + { + field: 'remark', + title: '备注', + minWidth: 150, + slots: { default: 'remark' }, + }, + { + title: '操作', + width: 50, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'no', + label: '出库单号', + component: 'Input', + componentProps: { + placeholder: '请输入出库单号', + allowClear: true, + }, + }, + { + fieldName: 'productId', + label: '产品', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择产品', + allowClear: true, + showSearch: true, + api: getProductSimpleList, + labelField: 'name', + valueField: 'id', + filterOption: false, + }, + }, + { + fieldName: 'outTime', + label: '出库时间', + component: 'RangePicker', + componentProps: { + placeholder: ['开始日期', '结束日期'], + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + }, + }, + { + fieldName: 'customerId', + label: '客户', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择客户', + allowClear: true, + showSearch: true, + api: getCustomerSimpleList, + labelField: 'name', + valueField: 'id', + filterOption: false, + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + placeholder: '请选择状态', + allowClear: true, + options: getDictOptions(DICT_TYPE.ERP_AUDIT_STATUS, 'number'), + }, + }, + { + fieldName: 'remark', + label: '备注', + component: 'Input', + componentProps: { + placeholder: '请输入备注', + allowClear: true, + }, + }, + { + fieldName: 'creator', + label: '创建人', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择创建人', + allowClear: true, + showSearch: true, + api: getSimpleUserList, + labelField: 'nickname', + valueField: 'id', + filterOption: false, + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + type: 'checkbox', + width: 50, + fixed: 'left', + }, + { + field: 'no', + title: '出库单号', + minWidth: 180, + }, + { + field: 'productNames', + title: '产品信息', + minWidth: 200, + showOverflow: 'tooltip', + }, + { + field: 'customerName', + title: '客户', + minWidth: 120, + }, + { + field: 'outTime', + title: '出库时间', + minWidth: 180, + cellRender: { + name: 'CellDateTime', + }, + }, + { + field: 'creatorName', + title: '创建人', + minWidth: 100, + }, + { + field: 'totalCount', + title: '数量', + minWidth: 100, + }, + { + field: 'totalPrice', + title: '价格', + minWidth: 100, + }, + { + field: 'status', + title: '状态', + minWidth: 90, + fixed: 'right', + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.ERP_AUDIT_STATUS }, + }, + }, + { + title: '操作', + width: 300, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} diff --git a/apps/web-antd/src/views/erp/stock/out/index.vue b/apps/web-antd/src/views/erp/stock/out/index.vue index afbf0c8a5..b42896b37 100644 --- a/apps/web-antd/src/views/erp/stock/out/index.vue +++ b/apps/web-antd/src/views/erp/stock/out/index.vue @@ -1,34 +1,219 @@ diff --git a/apps/web-antd/src/views/erp/stock/out/modules/form.vue b/apps/web-antd/src/views/erp/stock/out/modules/form.vue new file mode 100644 index 000000000..7e8a84031 --- /dev/null +++ b/apps/web-antd/src/views/erp/stock/out/modules/form.vue @@ -0,0 +1,196 @@ + + + diff --git a/apps/web-antd/src/views/erp/stock/out/modules/stock-out-item-form.vue b/apps/web-antd/src/views/erp/stock/out/modules/stock-out-item-form.vue new file mode 100644 index 000000000..14ff4fe13 --- /dev/null +++ b/apps/web-antd/src/views/erp/stock/out/modules/stock-out-item-form.vue @@ -0,0 +1,367 @@ + + + + + -- Gitee From 048176485b4ae510c08350f4ff4764531452d77d Mon Sep 17 00:00:00 2001 From: xuzhiqiang Date: Mon, 18 Aug 2025 09:49:17 +0800 Subject: [PATCH 03/12] =?UTF-8?q?feat(@vben/web-antd):=20erp-stock-move=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=BA=93=E5=AD=98=E8=B0=83=E6=8B=A8=E5=8D=95?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=8C=85=E6=8B=AC?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E3=80=81=E5=88=97=E8=A1=A8=E5=8F=8A=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/api/erp/stock/move/index.ts | 25 +- .../web-antd/src/views/erp/stock/move/data.ts | 312 ++++++++++++++ .../src/views/erp/stock/move/index.vue | 227 ++++++++++- .../src/views/erp/stock/move/modules/form.vue | 196 +++++++++ .../move/modules/stock-move-item-form.vue | 382 ++++++++++++++++++ 5 files changed, 1120 insertions(+), 22 deletions(-) create mode 100644 apps/web-antd/src/views/erp/stock/move/data.ts create mode 100644 apps/web-antd/src/views/erp/stock/move/modules/form.vue create mode 100644 apps/web-antd/src/views/erp/stock/move/modules/stock-move-item-form.vue diff --git a/apps/web-antd/src/api/erp/stock/move/index.ts b/apps/web-antd/src/api/erp/stock/move/index.ts index 765d27eba..33e49f299 100644 --- a/apps/web-antd/src/api/erp/stock/move/index.ts +++ b/apps/web-antd/src/api/erp/stock/move/index.ts @@ -2,7 +2,7 @@ import type { PageParam, PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; -namespace ErpStockMoveApi { +export namespace ErpStockMoveApi { /** 库存调拨单信息 */ export interface StockMove { id?: number; // 调拨编号 @@ -12,6 +12,29 @@ namespace ErpStockMoveApi { totalPrice: number; // 合计金额,单位:元 status: number; // 状态 remark: string; // 备注 + fileUrl?: string; // 附件 + fromWarehouseId?: number; // 来源仓库编号 + createTime: Date; // 创建时间 + creator: string; // 创建人 + creatorName: string; // 创建人名称 + productNames: string; // 产品名称 + items?: StockMoveItem[]; // 子表信息 + } + + /** 库存调拨单子表信息 */ + export interface StockMoveItem { + count: number; // 数量 + fromWarehouseId?: number; // 来源仓库ID + id?: number; // ID + productBarCode: string; // 产品条形码 + productId?: number; // 产品ID + productName?: string; // 产品名称 + productPrice: number; // 产品单价 + productUnitName?: string; // 产品单位 + remark?: string; // 备注 + stockCount: number; // 库存数量 + toWarehouseId?: number; // 目标仓库ID + totalPrice?: number; // 总价 } /** 库存调拨单分页查询参数 */ diff --git a/apps/web-antd/src/views/erp/stock/move/data.ts b/apps/web-antd/src/views/erp/stock/move/data.ts new file mode 100644 index 000000000..94ab7fa0e --- /dev/null +++ b/apps/web-antd/src/views/erp/stock/move/data.ts @@ -0,0 +1,312 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; + +import { createRequiredValidation } from '#/adapter/vxe-table'; +import { getProductSimpleList } from '#/api/erp/product/product'; +import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; +import { getSimpleUserList } from '#/api/system/user'; +import { DICT_TYPE, getDictOptions } from '#/utils'; + +/** 表单的配置项 */ +export function useFormSchema(formType: string): VbenFormSchema[] { + return [ + { + component: 'Input', + componentProps: { + style: { display: 'none' }, + }, + fieldName: 'id', + label: 'ID', + hideLabel: true, + formItemClass: 'hidden', + }, + { + component: 'Input', + componentProps: { + placeholder: '系统自动生成', + disabled: true, + }, + fieldName: 'no', + label: '调度单号', + disabled: formType === 'detail', + }, + { + component: 'DatePicker', + componentProps: { + placeholder: '选择调度时间', + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + style: { width: '100%' }, + }, + disabled: formType === 'detail', + fieldName: 'moveTime', + label: '调度时间', + rules: 'required', + }, + { + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + autoSize: { minRows: 2, maxRows: 4 }, + class: 'w-full', + }, + disabled: formType === 'detail', + fieldName: 'remark', + label: '备注', + formItemClass: 'col-span-3', + }, + { + component: 'FileUpload', + disabled: formType === 'detail', + componentProps: { + maxNumber: 1, + maxSize: 10, + accept: [ + 'pdf', + 'doc', + 'docx', + 'xls', + 'xlsx', + 'txt', + 'jpg', + 'jpeg', + 'png', + ], + showDescription: true, + }, + fieldName: 'fileUrl', + label: '附件', + formItemClass: 'col-span-3', + }, + { + fieldName: 'product', + disabled: formType === 'detail', + label: '产品清单', + component: 'Input', + formItemClass: 'col-span-3', + }, + ]; +} + +/** 调度产品清单表格列定义 */ +export function useStockMoveItemTableColumns( + isValidating?: any, +): VxeTableGridOptions['columns'] { + return [ + { type: 'seq', title: '序号', minWidth: 50, fixed: 'left' }, + { + field: 'fromWarehouseId', + title: '调出仓库', + minWidth: 150, + slots: { default: 'fromWarehouseId' }, + className: createRequiredValidation(isValidating, 'fromWarehouseId'), + }, + { + field: 'toWarehouseId', + title: '调入仓库', + minWidth: 150, + slots: { default: 'toWarehouseId' }, + className: createRequiredValidation(isValidating, 'toWarehouseId'), + }, + { + field: 'productId', + title: '产品名称', + minWidth: 200, + slots: { default: 'productId' }, + className: createRequiredValidation(isValidating, 'productId'), + }, + { + field: 'stockCount', + title: '库存', + minWidth: 100, + }, + { + field: 'productBarCode', + title: '条码', + minWidth: 120, + }, + { + field: 'productUnitName', + title: '单位', + minWidth: 80, + }, + { + field: 'count', + title: '数量', + minWidth: 120, + slots: { default: 'count' }, + className: createRequiredValidation(isValidating, 'count'), + }, + { + field: 'productPrice', + title: '产品单价', + minWidth: 120, + slots: { default: 'productPrice' }, + }, + { + field: 'totalPrice', + title: '金额', + minWidth: 120, + formatter: 'formatAmount2', + }, + { + field: 'remark', + title: '备注', + minWidth: 150, + slots: { default: 'remark' }, + }, + { + title: '操作', + width: 50, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'no', + label: '调度单号', + component: 'Input', + componentProps: { + placeholder: '请输入调度单号', + allowClear: true, + }, + }, + { + fieldName: 'productId', + label: '产品', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择产品', + allowClear: true, + showSearch: true, + api: getProductSimpleList, + labelField: 'name', + valueField: 'id', + filterOption: false, + }, + }, + { + fieldName: 'moveTime', + label: '调度时间', + component: 'RangePicker', + componentProps: { + placeholder: ['开始日期', '结束日期'], + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + }, + }, + { + fieldName: 'fromWarehouseId', + label: '调出仓库', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择调出仓库', + allowClear: true, + showSearch: true, + api: getWarehouseSimpleList, + labelField: 'name', + valueField: 'id', + filterOption: false, + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + placeholder: '请选择状态', + allowClear: true, + options: getDictOptions(DICT_TYPE.ERP_AUDIT_STATUS, 'number'), + }, + }, + { + fieldName: 'remark', + label: '备注', + component: 'Input', + componentProps: { + placeholder: '请输入备注', + allowClear: true, + }, + }, + { + fieldName: 'creator', + label: '创建人', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择创建人', + allowClear: true, + showSearch: true, + api: getSimpleUserList, + labelField: 'nickname', + valueField: 'id', + filterOption: false, + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + type: 'checkbox', + width: 50, + fixed: 'left', + }, + { + field: 'no', + title: '调度单号', + minWidth: 180, + }, + { + field: 'productNames', + title: '产品信息', + minWidth: 200, + showOverflow: 'tooltip', + }, + { + field: 'moveTime', + title: '调度时间', + minWidth: 180, + formatter: 'formatDate', + }, + { + field: 'creatorName', + title: '创建人', + minWidth: 100, + }, + { + field: 'totalCount', + title: '数量', + minWidth: 100, + }, + { + field: 'totalPrice', + title: '金额', + minWidth: 100, + }, + { + field: 'status', + title: '状态', + minWidth: 90, + fixed: 'right', + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.ERP_AUDIT_STATUS }, + }, + }, + { + title: '操作', + width: 300, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} diff --git a/apps/web-antd/src/views/erp/stock/move/index.vue b/apps/web-antd/src/views/erp/stock/move/index.vue index d073d6f7a..8a61ecfaf 100644 --- a/apps/web-antd/src/views/erp/stock/move/index.vue +++ b/apps/web-antd/src/views/erp/stock/move/index.vue @@ -1,34 +1,219 @@ diff --git a/apps/web-antd/src/views/erp/stock/move/modules/form.vue b/apps/web-antd/src/views/erp/stock/move/modules/form.vue new file mode 100644 index 000000000..35b51a969 --- /dev/null +++ b/apps/web-antd/src/views/erp/stock/move/modules/form.vue @@ -0,0 +1,196 @@ + + + diff --git a/apps/web-antd/src/views/erp/stock/move/modules/stock-move-item-form.vue b/apps/web-antd/src/views/erp/stock/move/modules/stock-move-item-form.vue new file mode 100644 index 000000000..32835bf72 --- /dev/null +++ b/apps/web-antd/src/views/erp/stock/move/modules/stock-move-item-form.vue @@ -0,0 +1,382 @@ + + + + + -- Gitee From 2e40c2c580c99349858299559b4538350a1ff8c2 Mon Sep 17 00:00:00 2001 From: xuzhiqiang Date: Mon, 18 Aug 2025 14:00:55 +0800 Subject: [PATCH 04/12] =?UTF-8?q?feat(@vben/web-antd):=20erp-stock-check?= =?UTF-8?q?=20=E6=96=B0=E5=A2=9E=E5=BA=93=E5=AD=98=E7=9B=98=E7=82=B9?= =?UTF-8?q?=E5=8D=95=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=8C=85?= =?UTF-8?q?=E6=8B=AC=E8=A1=A8=E5=8D=95=E3=80=81=E5=88=97=E8=A1=A8=E5=8F=8A?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web-antd/src/api/erp/stock/check/index.ts | 23 +- .../src/views/erp/stock/check/data.ts | 313 +++++++++++++++ .../src/views/erp/stock/check/index.vue | 227 ++++++++++- .../views/erp/stock/check/modules/form.vue | 196 +++++++++ .../check/modules/stock-check-item-form.vue | 373 ++++++++++++++++++ 5 files changed, 1109 insertions(+), 23 deletions(-) create mode 100644 apps/web-antd/src/views/erp/stock/check/data.ts create mode 100644 apps/web-antd/src/views/erp/stock/check/modules/form.vue create mode 100644 apps/web-antd/src/views/erp/stock/check/modules/stock-check-item-form.vue diff --git a/apps/web-antd/src/api/erp/stock/check/index.ts b/apps/web-antd/src/api/erp/stock/check/index.ts index 090d87867..3c31a5e8f 100644 --- a/apps/web-antd/src/api/erp/stock/check/index.ts +++ b/apps/web-antd/src/api/erp/stock/check/index.ts @@ -2,7 +2,7 @@ import type { PageParam, PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; -namespace ErpStockCheckApi { +export namespace ErpStockCheckApi { /** 库存盘点单信息 */ export interface StockCheck { id?: number; // 盘点编号 @@ -12,8 +12,27 @@ namespace ErpStockCheckApi { totalPrice: number; // 合计金额,单位:元 status: number; // 状态 remark: string; // 备注 + fileUrl?: string; // 附件 + productNames?: string; // 产品信息 + creatorName?: string; // 创建人 + items?: StockCheckItem[]; // 盘点产品清单 + } + // 库存盘点单产品信息 + export interface StockCheckItem { + id?: number; // 编号 + warehouseId?: number; // 仓库编号 + productId?: number; // 产品编号 + productName?: string; // 产品名称 + productUnitId?: number; // 产品单位编号 + productUnitName?: string; // 产品单位名称 + productBarCode?: string; // 产品条码 + count?: number; // 盈亏数量 + actualCount?: number; // 实际库存 + productPrice?: number; // 产品单价 + totalPrice?: number; // 总价 + stockCount?: number; // 账面库存 + remark?: string; // 备注 } - /** 库存盘点单分页查询参数 */ export interface StockCheckPageParams extends PageParam { no?: string; diff --git a/apps/web-antd/src/views/erp/stock/check/data.ts b/apps/web-antd/src/views/erp/stock/check/data.ts new file mode 100644 index 000000000..a0d75ea7d --- /dev/null +++ b/apps/web-antd/src/views/erp/stock/check/data.ts @@ -0,0 +1,313 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; + +import { createRequiredValidation } from '#/adapter/vxe-table'; +import { getProductSimpleList } from '#/api/erp/product/product'; +import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; +import { getSimpleUserList } from '#/api/system/user'; +import { DICT_TYPE, getDictOptions } from '#/utils'; + +/** 表单的配置项 */ +export function useFormSchema(formType: string): VbenFormSchema[] { + return [ + { + component: 'Input', + componentProps: { + style: { display: 'none' }, + }, + fieldName: 'id', + label: 'ID', + hideLabel: true, + formItemClass: 'hidden', + }, + { + component: 'Input', + componentProps: { + placeholder: '系统自动生成', + disabled: true, + }, + fieldName: 'no', + label: '盘点单号', + }, + { + component: 'DatePicker', + componentProps: { + placeholder: '选择盘点时间', + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + style: { width: '100%' }, + }, + disabled: formType === 'detail', + fieldName: 'checkTime', + label: '盘点时间', + rules: 'required', + }, + { + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + autoSize: { minRows: 2, maxRows: 4 }, + class: 'w-full', + }, + disabled: formType === 'detail', + fieldName: 'remark', + label: '备注', + formItemClass: 'col-span-3', + }, + { + component: 'FileUpload', + disabled: formType === 'detail', + componentProps: { + maxNumber: 1, + maxSize: 10, + accept: [ + 'pdf', + 'doc', + 'docx', + 'xls', + 'xlsx', + 'txt', + 'jpg', + 'jpeg', + 'png', + ], + showDescription: true, + }, + fieldName: 'fileUrl', + label: '附件', + formItemClass: 'col-span-3', + }, + { + fieldName: 'product', + disabled: formType === 'detail', + label: '产品清单', + component: 'Input', + formItemClass: 'col-span-3', + }, + ]; +} + +/** 库存盘点清单表格列定义 */ +export function useStockCheckItemTableColumns( + isValidating?: any, +): VxeTableGridOptions['columns'] { + return [ + { type: 'seq', title: '序号', minWidth: 50, fixed: 'left' }, + { + field: 'warehouseId', + title: '仓库名称', + minWidth: 150, + slots: { default: 'warehouseId' }, + className: createRequiredValidation(isValidating, 'warehouseId'), + }, + { + field: 'productId', + title: '产品名称', + minWidth: 200, + slots: { default: 'productId' }, + className: createRequiredValidation(isValidating, 'productId'), + }, + { + field: 'stockCount', + title: '账面库存', + minWidth: 100, + }, + { + field: 'productBarCode', + title: '条码', + minWidth: 120, + }, + { + field: 'productUnitName', + title: '单位', + minWidth: 80, + }, + { + field: 'actualCount', + title: '实际库存', + minWidth: 120, + slots: { default: 'actualCount' }, + className: createRequiredValidation(isValidating, 'actualCount'), + }, + { + field: 'count', + title: '盈亏数量', + minWidth: 120, + slots: { default: 'count' }, + className: createRequiredValidation(isValidating, 'count'), + }, + { + field: 'productPrice', + title: '产品单价', + minWidth: 120, + slots: { default: 'productPrice' }, + }, + { + field: 'totalPrice', + title: '合计金额', + minWidth: 120, + formatter: 'formatAmount2', + }, + { + field: 'remark', + title: '备注', + minWidth: 150, + slots: { default: 'remark' }, + }, + { + title: '操作', + width: 50, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'no', + label: '盘点单号', + component: 'Input', + componentProps: { + placeholder: '请输入盘点单号', + allowClear: true, + }, + }, + { + fieldName: 'productId', + label: '产品', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择产品', + allowClear: true, + showSearch: true, + api: getProductSimpleList, + labelField: 'name', + valueField: 'id', + filterOption: false, + }, + }, + { + fieldName: 'checkTime', + label: '盘点时间', + component: 'RangePicker', + componentProps: { + placeholder: ['开始日期', '结束日期'], + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + }, + }, + { + fieldName: 'warehouseId', + label: '仓库', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择仓库', + allowClear: true, + showSearch: true, + api: getWarehouseSimpleList, + labelField: 'name', + valueField: 'id', + filterOption: false, + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + placeholder: '请选择状态', + allowClear: true, + options: getDictOptions(DICT_TYPE.ERP_AUDIT_STATUS, 'number'), + }, + }, + { + fieldName: 'remark', + label: '备注', + component: 'Input', + componentProps: { + placeholder: '请输入备注', + allowClear: true, + }, + }, + { + fieldName: 'creator', + label: '创建人', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择创建人', + allowClear: true, + showSearch: true, + api: getSimpleUserList, + labelField: 'nickname', + valueField: 'id', + filterOption: false, + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + type: 'checkbox', + width: 50, + fixed: 'left', + }, + { + field: 'no', + title: '盘点单号', + minWidth: 180, + }, + { + field: 'productNames', + title: '产品信息', + minWidth: 200, + showOverflow: 'tooltip', + }, + { + field: 'checkTime', + title: '出库时间', + minWidth: 180, + cellRender: { + name: 'CellDateTime', + }, + }, + { + field: 'creatorName', + title: '创建人', + minWidth: 100, + }, + { + field: 'totalCount', + title: '数量', + minWidth: 100, + }, + { + field: 'totalPrice', + title: '金额', + minWidth: 100, + }, + { + field: 'status', + title: '状态', + minWidth: 90, + fixed: 'right', + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.ERP_AUDIT_STATUS }, + }, + }, + { + title: '操作', + width: 300, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} diff --git a/apps/web-antd/src/views/erp/stock/check/index.vue b/apps/web-antd/src/views/erp/stock/check/index.vue index 3b9a7ec5c..941f8eba8 100644 --- a/apps/web-antd/src/views/erp/stock/check/index.vue +++ b/apps/web-antd/src/views/erp/stock/check/index.vue @@ -1,34 +1,219 @@ diff --git a/apps/web-antd/src/views/erp/stock/check/modules/form.vue b/apps/web-antd/src/views/erp/stock/check/modules/form.vue new file mode 100644 index 000000000..7c7eaa07b --- /dev/null +++ b/apps/web-antd/src/views/erp/stock/check/modules/form.vue @@ -0,0 +1,196 @@ + + + diff --git a/apps/web-antd/src/views/erp/stock/check/modules/stock-check-item-form.vue b/apps/web-antd/src/views/erp/stock/check/modules/stock-check-item-form.vue new file mode 100644 index 000000000..739d4f4fe --- /dev/null +++ b/apps/web-antd/src/views/erp/stock/check/modules/stock-check-item-form.vue @@ -0,0 +1,373 @@ + + + + + -- Gitee From 47e37e0ec983221482afb223a7f55d91265c6a57 Mon Sep 17 00:00:00 2001 From: xuzhiqiang Date: Thu, 21 Aug 2025 15:26:21 +0800 Subject: [PATCH 05/12] =?UTF-8?q?feat(@vben/web-antd):=20erp-purchase-in?= =?UTF-8?q?=20=E6=96=B0=E5=A2=9E=E9=87=87=E8=B4=AD=E5=85=A5=E5=BA=93?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=8C=85=E6=8B=AC?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E3=80=81=E5=88=97=E8=A1=A8=E5=8F=8A=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web-antd/src/api/erp/purchase/in/index.ts | 55 +- .../src/api/erp/purchase/order/index.ts | 1 + .../web-antd/src/api/erp/stock/stock/index.ts | 9 + .../src/views/erp/purchase/in/data.ts | 583 ++++++++++++++++++ .../src/views/erp/purchase/in/index.vue | 240 ++++++- .../purchase/in/modules/purchase-in-form.vue | 314 ++++++++++ .../in/modules/purchase-in-item-form.vue | 255 ++++++++ .../in/modules/select-purchase-order-form.vue | 63 ++ .../in/modules/select-purchase-order-grid.vue | 54 ++ 9 files changed, 1539 insertions(+), 35 deletions(-) create mode 100644 apps/web-antd/src/views/erp/purchase/in/data.ts create mode 100644 apps/web-antd/src/views/erp/purchase/in/modules/purchase-in-form.vue create mode 100644 apps/web-antd/src/views/erp/purchase/in/modules/purchase-in-item-form.vue create mode 100644 apps/web-antd/src/views/erp/purchase/in/modules/select-purchase-order-form.vue create mode 100644 apps/web-antd/src/views/erp/purchase/in/modules/select-purchase-order-grid.vue diff --git a/apps/web-antd/src/api/erp/purchase/in/index.ts b/apps/web-antd/src/api/erp/purchase/in/index.ts index fde2c0fbd..796645979 100644 --- a/apps/web-antd/src/api/erp/purchase/in/index.ts +++ b/apps/web-antd/src/api/erp/purchase/in/index.ts @@ -2,19 +2,45 @@ import type { PageParam, PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; -namespace ErpPurchaseInApi { +export namespace ErpPurchaseInApi { /** 采购入库信息 */ export interface PurchaseIn { id?: number; // 入库工单编号 - no: string; // 采购入库号 - supplierId: number; // 供应商编号 - inTime: Date; // 入库时间 - totalCount: number; // 合计数量 - totalPrice: number; // 合计金额,单位:元 - status: number; // 状态 - remark: string; // 备注 - outCount: number; // 采购出库数量 - returnCount: number; // 采购退货数量 + no?: string; // 采购入库号 + supplierId?: number; // 供应商编号 + inTime?: Date; // 入库时间 + totalCount?: number; // 合计数量 + totalPrice?: number; // 合计金额,单位:元 + status?: number; // 状态 + remark?: string; // 备注 + outCount?: number; // 采购出库数量 + returnCount?: number; // 采购退货数量 + discountPercent?: number; // 折扣百分比 + discountPrice?: number; // 折扣金额 + paymentPrice?: number; // 实际支付金额 + otherPrice?: number; // 其他费用 + totalProductPrice?: number; // 合计商品金额 + taxPrice?: number; // 合计税额 + items?: PurchaseInItem[]; // 采购入库明细 + } + export interface PurchaseInItem { + count?: number; + id?: number; + orderItemId?: number; + productBarCode?: string; + productId?: number; + productName: string; + productPrice: number; + productUnitId?: number; + productUnitName?: string; + totalProductPrice?: number; + remark: string; + stockCount?: number; + taxPercent?: number; + taxPrice?: number; + totalPrice?: number; + warehouseId?: number; + inCount?: number; } /** 采购入库分页查询参数 */ @@ -71,11 +97,12 @@ export function updatePurchaseIn(data: ErpPurchaseInApi.PurchaseIn) { /** * 更新采购入库的状态 */ -export function updatePurchaseInStatus( - params: ErpPurchaseInApi.PurchaseInStatusParams, -) { +export function updatePurchaseInStatus(id: number, status: number) { return requestClient.put('/erp/purchase-in/update-status', null, { - params, + params: { + id, + status, + }, }); } diff --git a/apps/web-antd/src/api/erp/purchase/order/index.ts b/apps/web-antd/src/api/erp/purchase/order/index.ts index ae84c2434..ec08dc179 100644 --- a/apps/web-antd/src/api/erp/purchase/order/index.ts +++ b/apps/web-antd/src/api/erp/purchase/order/index.ts @@ -41,6 +41,7 @@ export namespace ErpPurchaseOrderApi { remark?: string; // 备注 fileUrl?: string; // 附件地址 inCount?: number; // 采购入库数量 + count?: number; // 数量 returnCount?: number; // 采购退货数量 inStatus?: number; // 入库状态 returnStatus?: number; // 退货状态 diff --git a/apps/web-antd/src/api/erp/stock/stock/index.ts b/apps/web-antd/src/api/erp/stock/stock/index.ts index 3ef12dff6..df8aaaa9b 100644 --- a/apps/web-antd/src/api/erp/stock/stock/index.ts +++ b/apps/web-antd/src/api/erp/stock/stock/index.ts @@ -72,3 +72,12 @@ export function exportStock(params: ErpStockApi.StockPageParams) { params, }); } + +/** + * 获取库存数量 + */ +export function getWarehouseStockCount(params: ErpStockApi.StockQueryParams) { + return requestClient.get('/erp/stock/get-count', { + params, + }); +} diff --git a/apps/web-antd/src/views/erp/purchase/in/data.ts b/apps/web-antd/src/views/erp/purchase/in/data.ts new file mode 100644 index 000000000..4c78a0d0a --- /dev/null +++ b/apps/web-antd/src/views/erp/purchase/in/data.ts @@ -0,0 +1,583 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; + +import { erpPriceInputFormatter } from '@vben/utils'; + +import { z } from '#/adapter/form'; +import { getAccountSimpleList } from '#/api/erp/finance/account'; +import { getProductSimpleList } from '#/api/erp/product/product'; +import { getSupplierSimpleList } from '#/api/erp/purchase/supplier'; +import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; +import { getSimpleUserList } from '#/api/system/user'; +import { DICT_TYPE, getDictOptions } from '#/utils'; + +/** 表单的配置项 */ +export function useFormSchema(formType: string): VbenFormSchema[] { + return [ + { + component: 'Input', + componentProps: { + style: { display: 'none' }, + }, + fieldName: 'id', + label: 'ID', + hideLabel: true, + formItemClass: 'hidden', + }, + { + component: 'Input', + componentProps: { + placeholder: '系统自动生成', + disabled: true, + }, + fieldName: 'no', + label: '入库单号', + }, + + { + component: 'ApiSelect', + componentProps: { + disabled: true, + placeholder: '请选择供应商', + allowClear: true, + showSearch: true, + api: getSupplierSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + fieldName: 'supplierId', + label: '供应商', + rules: 'required', + }, + { + fieldName: 'orderNo', + label: '关联订单', + component: 'Input', + formItemClass: 'col-span-1', + disabled: true, + rules: 'required', + }, + { + component: 'DatePicker', + componentProps: { + disabled: formType === 'detail', + placeholder: '选择订单时间', + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + style: { width: '100%' }, + }, + fieldName: 'inTime', + label: '入库时间', + rules: 'required', + }, + + { + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + disabled: formType === 'detail', + autoSize: { minRows: 1, maxRows: 1 }, + class: 'w-full', + }, + fieldName: 'remark', + label: '备注', + formItemClass: 'col-span-2', + }, + + { + component: 'FileUpload', + componentProps: { + disabled: formType === 'detail', + maxNumber: 1, + maxSize: 10, + accept: [ + 'pdf', + 'doc', + 'docx', + 'xls', + 'xlsx', + 'txt', + 'jpg', + 'jpeg', + 'png', + ], + showDescription: true, + }, + fieldName: 'fileUrl', + label: '附件', + formItemClass: 'col-span-3', + }, + { + fieldName: 'product', + label: '产品清单', + component: 'Input', + formItemClass: 'col-span-3', + }, + { + component: 'InputNumber', + fieldName: 'discountPercent', + componentProps: { + placeholder: '优惠率', + min: 0, + max: 100, + disabled: true, + precision: 2, + style: { width: '100%' }, + }, + + label: '优惠率(%)', + }, + { + component: 'InputNumber', + componentProps: { + placeholder: '付款优惠', + precision: 2, + formatter: erpPriceInputFormatter, + disabled: true, + style: { width: '100%' }, + }, + fieldName: 'discountPrice', + label: '付款优惠', + }, + { + component: 'InputNumber', + componentProps: { + placeholder: '优惠后金额', + precision: 2, + formatter: erpPriceInputFormatter, + disabled: true, + style: { width: '100%' }, + }, + fieldName: 'discountedPrice', + label: '优惠后金额', + }, + { + component: 'InputNumber', + componentProps: { + disabled: formType === 'detail', + placeholder: '请输入其他费用', + precision: 2, + formatter: erpPriceInputFormatter, + style: { width: '100%' }, + }, + fieldName: 'otherPrice', + label: '其他费用', + }, + { + component: 'ApiSelect', + componentProps: { + placeholder: '请选择结算账户', + disabled: true, + allowClear: true, + showSearch: true, + api: getAccountSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + fieldName: 'accountId', + label: '结算账户', + }, + { + component: 'InputNumber', + componentProps: { + precision: 2, + style: { width: '100%' }, + disabled: true, + min: 0, + }, + fieldName: 'totalPrice', + label: '应付金额', + rules: z.number().min(0).optional(), + }, + ]; +} + +/** 采购订单项表格列定义 */ +export function usePurchaseOrderItemTableColumns(): VxeTableGridOptions['columns'] { + return [ + { type: 'seq', title: '序号', minWidth: 50, fixed: 'left' }, + { + field: 'warehouseId', + title: '仓库名称', + minWidth: 200, + slots: { default: 'warehouseId' }, + }, + { + field: 'productId', + title: '产品名称', + minWidth: 200, + slots: { default: 'productId' }, + }, + { + field: 'stockCount', + title: '仓库库存', + minWidth: 80, + }, + { + field: 'productBarCode', + title: '条码', + minWidth: 120, + }, + { + field: 'productUnitName', + title: '单位', + minWidth: 80, + }, + { + field: 'totalCount', + title: '原数量', + minWidth: 120, + }, + { + field: 'inCount', + title: '已入库数量', + minWidth: 120, + }, + { + field: 'count', + title: '数量', + minWidth: 120, + fixed: 'right', + slots: { default: 'count' }, + }, + { + field: 'productPrice', + title: '产品单价', + fixed: 'right', + minWidth: 120, + slots: { default: 'productPrice' }, + }, + { + field: 'totalProductPrice', + fixed: 'right', + title: '产品金额', + minWidth: 120, + formatter: 'formatAmount2', + }, + { + fixed: 'right', + field: 'taxPercent', + title: '税率(%)', + minWidth: 100, + }, + { + fixed: 'right', + field: 'taxPrice', + title: '税额', + minWidth: 120, + formatter: 'formatAmount2', + }, + { + field: 'totalPrice', + fixed: 'right', + title: '合计金额', + minWidth: 120, + formatter: 'formatAmount2', + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'no', + label: '入库单号', + component: 'Input', + componentProps: { + placeholder: '请输入入库单号', + allowClear: true, + }, + }, + { + fieldName: 'productId', + label: '产品', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择产品', + allowClear: true, + showSearch: true, + api: getProductSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + }, + { + fieldName: 'inTime', + label: '入库时间', + component: 'RangePicker', + componentProps: { + placeholder: ['开始时间', '结束时间'], + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + }, + }, + { + fieldName: 'supplierId', + label: '供应商', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择供应商', + allowClear: true, + showSearch: true, + api: getSupplierSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + }, + { + fieldName: 'warehouseId', + label: '仓库', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择仓库', + allowClear: true, + showSearch: true, + api: getWarehouseSimpleList, + labelField: 'name', + valueField: 'id', + filterOption: false, + }, + }, + { + fieldName: 'creator', + label: '创建人', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择创建人', + allowClear: true, + showSearch: true, + api: getSimpleUserList, + fieldNames: { + label: 'nickname', + value: 'id', + }, + }, + }, + { + fieldName: 'orderNo', + label: '关联订单', + component: 'Input', + componentProps: { + placeholder: '请输入关联订单号', + allowClear: true, + }, + }, + { + fieldName: 'paymentStatus', + label: '付款状态', + component: 'Select', + componentProps: { + options: [ + { label: '未付款', value: 0 }, + { label: '部分付款', value: 1 }, + { label: '全部付款', value: 2 }, + ], + placeholder: '请选择退货状态', + allowClear: true, + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + placeholder: '请选择状态', + allowClear: true, + options: getDictOptions(DICT_TYPE.ERP_AUDIT_STATUS, 'number'), + }, + }, + { + fieldName: 'remark', + label: '备注', + component: 'Input', + componentProps: { + placeholder: '请输入备注', + allowClear: true, + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + type: 'checkbox', + width: 50, + fixed: 'left', + }, + { + field: 'no', + title: '入库单号', + width: 200, + fixed: 'left', + }, + { + field: 'productNames', + title: '产品信息', + showOverflow: 'tooltip', + minWidth: 120, + }, + { + field: 'supplierName', + title: '供应商', + minWidth: 120, + }, + { + field: 'inTime', + title: '入库时间', + width: 160, + formatter: 'formatDateTime', + }, + { + field: 'creatorName', + title: '创建人', + minWidth: 120, + }, + { + field: 'totalCount', + title: '总数量', + minWidth: 120, + }, + { + field: 'totalPrice', + title: '应付金额', + formatter: 'formatNumber', + minWidth: 120, + }, + { + field: 'paymentPrice', + title: '已付金额', + formatter: 'formatNumber', + minWidth: 120, + }, + { + field: 'status', + title: '状态', + minWidth: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.ERP_AUDIT_STATUS }, + }, + }, + { + title: '操作', + minWidth: 250, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} +/** 列表的搜索表单 */ +export function useOrderGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'no', + label: '订单单号', + component: 'Input', + componentProps: { + placeholder: '请输入订单单号', + allowClear: true, + disabled: true, + }, + }, + { + fieldName: 'productId', + label: '产品', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择产品', + allowClear: true, + showSearch: true, + api: getProductSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + }, + { + fieldName: 'orderTime', + label: '订单时间', + component: 'RangePicker', + componentProps: { + placeholder: ['开始时间', '结束时间'], + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + }, + }, + ]; +} + +/** 列表的字段 */ +export function useOrderGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + type: 'radio', + width: 50, + fixed: 'left', + }, + { + field: 'no', + title: '订单单号', + width: 200, + fixed: 'left', + }, + { + field: 'productNames', + title: '产品信息', + showOverflow: 'tooltip', + minWidth: 120, + }, + { + field: 'supplierName', + title: '供应商', + minWidth: 120, + }, + { + field: 'orderTime', + title: '订单时间', + width: 160, + formatter: 'formatDate', + }, + { + field: 'creatorName', + title: '创建人', + minWidth: 120, + }, + { + field: 'totalCount', + title: '总数量', + minWidth: 120, + }, + { + field: 'inCount', + title: '入库数量', + minWidth: 120, + }, + { + field: 'totalProductPrice', + title: '金额合计', + formatter: 'formatNumber', + minWidth: 120, + }, + { + field: 'totalPrice', + title: '含税金额', + formatter: 'formatNumber', + minWidth: 120, + }, + ]; +} diff --git a/apps/web-antd/src/views/erp/purchase/in/index.vue b/apps/web-antd/src/views/erp/purchase/in/index.vue index 197c75949..70ea45004 100644 --- a/apps/web-antd/src/views/erp/purchase/in/index.vue +++ b/apps/web-antd/src/views/erp/purchase/in/index.vue @@ -1,34 +1,232 @@ diff --git a/apps/web-antd/src/views/erp/purchase/in/modules/purchase-in-form.vue b/apps/web-antd/src/views/erp/purchase/in/modules/purchase-in-form.vue new file mode 100644 index 000000000..b79514154 --- /dev/null +++ b/apps/web-antd/src/views/erp/purchase/in/modules/purchase-in-form.vue @@ -0,0 +1,314 @@ + + + diff --git a/apps/web-antd/src/views/erp/purchase/in/modules/purchase-in-item-form.vue b/apps/web-antd/src/views/erp/purchase/in/modules/purchase-in-item-form.vue new file mode 100644 index 000000000..78a978eae --- /dev/null +++ b/apps/web-antd/src/views/erp/purchase/in/modules/purchase-in-item-form.vue @@ -0,0 +1,255 @@ + + + diff --git a/apps/web-antd/src/views/erp/purchase/in/modules/select-purchase-order-form.vue b/apps/web-antd/src/views/erp/purchase/in/modules/select-purchase-order-form.vue new file mode 100644 index 000000000..9d8c911f1 --- /dev/null +++ b/apps/web-antd/src/views/erp/purchase/in/modules/select-purchase-order-form.vue @@ -0,0 +1,63 @@ + + + diff --git a/apps/web-antd/src/views/erp/purchase/in/modules/select-purchase-order-grid.vue b/apps/web-antd/src/views/erp/purchase/in/modules/select-purchase-order-grid.vue new file mode 100644 index 000000000..4809eac80 --- /dev/null +++ b/apps/web-antd/src/views/erp/purchase/in/modules/select-purchase-order-grid.vue @@ -0,0 +1,54 @@ + + + -- Gitee From 9c9345f4f6e07699513731c03202ebbccaf39ec1 Mon Sep 17 00:00:00 2001 From: xuzhiqiang Date: Thu, 21 Aug 2025 15:26:55 +0800 Subject: [PATCH 06/12] =?UTF-8?q?feat(@vben/web-antd):=20erp-purchase-retu?= =?UTF-8?q?rn=20=E6=96=B0=E5=A2=9E=E9=87=87=E8=B4=AD=E9=80=80=E8=B4=A7?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=8C=85=E6=8B=AC?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E3=80=81=E5=88=97=E8=A1=A8=E5=8F=8A=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/erp/purchase/return/index.ts | 37 +- .../src/views/erp/purchase/return/data.ts | 595 ++++++++++++++++++ .../src/views/erp/purchase/return/index.vue | 241 ++++++- .../return/modules/purchase-return-form.vue | 316 ++++++++++ .../modules/purchase-return-item-form.vue | 260 ++++++++ .../modules/select-purchase-order-form.vue | 63 ++ .../modules/select-purchase-order-grid.vue | 54 ++ 7 files changed, 1538 insertions(+), 28 deletions(-) create mode 100644 apps/web-antd/src/views/erp/purchase/return/data.ts create mode 100644 apps/web-antd/src/views/erp/purchase/return/modules/purchase-return-form.vue create mode 100644 apps/web-antd/src/views/erp/purchase/return/modules/purchase-return-item-form.vue create mode 100644 apps/web-antd/src/views/erp/purchase/return/modules/select-purchase-order-form.vue create mode 100644 apps/web-antd/src/views/erp/purchase/return/modules/select-purchase-order-grid.vue diff --git a/apps/web-antd/src/api/erp/purchase/return/index.ts b/apps/web-antd/src/api/erp/purchase/return/index.ts index 461a76f77..86423c46f 100644 --- a/apps/web-antd/src/api/erp/purchase/return/index.ts +++ b/apps/web-antd/src/api/erp/purchase/return/index.ts @@ -2,17 +2,40 @@ import type { PageParam, PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; -namespace ErpPurchaseReturnApi { +export namespace ErpPurchaseReturnApi { /** 采购退货信息 */ export interface PurchaseReturn { id?: number; // 采购退货编号 - no: string; // 采购退货号 - supplierId: number; // 供应商编号 - returnTime: Date; // 退货时间 - totalCount: number; // 合计数量 + no?: string; // 采购退货号 + supplierId?: number; // 供应商编号 + returnTime?: Date; // 退货时间 + totalCount?: number; // 合计数量 totalPrice: number; // 合计金额,单位:元 - status: number; // 状态 - remark: string; // 备注 + discountPercent?: number; // 折扣百分比 + discountPrice?: number; // 折扣金额 + status?: number; // 状态 + remark?: string; // 备注 + totalTaxPrice?: number; // 合计税额 + otherPrice?: number; // 其他费用 + items?: PurchaseReturnItem[]; + } + export interface PurchaseReturnItem { + count?: number; + id?: number; + orderItemId?: number; + productBarCode?: string; + productId?: number; + productName: string; + productPrice: number; + productUnitId?: number; + productUnitName?: string; + totalProductPrice?: number; + remark: string; + stockCount?: number; + taxPercent?: number; + taxPrice?: number; + totalPrice?: number; + warehouseId?: number; } /** 采购退货分页查询参数 */ diff --git a/apps/web-antd/src/views/erp/purchase/return/data.ts b/apps/web-antd/src/views/erp/purchase/return/data.ts new file mode 100644 index 000000000..362d41caf --- /dev/null +++ b/apps/web-antd/src/views/erp/purchase/return/data.ts @@ -0,0 +1,595 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; + +import { erpNumberFormatter, erpPriceInputFormatter } from '@vben/utils'; + +import { z } from '#/adapter/form'; +import { getAccountSimpleList } from '#/api/erp/finance/account'; +import { getProductSimpleList } from '#/api/erp/product/product'; +import { getSupplierSimpleList } from '#/api/erp/purchase/supplier'; +import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; +import { getSimpleUserList } from '#/api/system/user'; +import { DICT_TYPE, getDictOptions } from '#/utils'; + +/** 表单的配置项 */ +export function useFormSchema(formType: string): VbenFormSchema[] { + return [ + { + component: 'Input', + componentProps: { + style: { display: 'none' }, + }, + fieldName: 'id', + label: 'ID', + hideLabel: true, + formItemClass: 'hidden', + }, + { + component: 'Input', + componentProps: { + placeholder: '系统自动生成', + disabled: true, + }, + fieldName: 'no', + label: '退货单号', + }, + + { + component: 'ApiSelect', + componentProps: { + disabled: true, + placeholder: '请选择供应商', + allowClear: true, + showSearch: true, + api: getSupplierSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + fieldName: 'supplierId', + label: '供应商', + rules: 'required', + }, + { + fieldName: 'orderNo', + label: '关联订单', + component: 'Input', + formItemClass: 'col-span-1', + rules: 'required', + }, + { + component: 'DatePicker', + componentProps: { + disabled: formType === 'detail', + placeholder: '选择退货时间', + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + style: { width: '100%' }, + }, + fieldName: 'returnTime', + label: '退货时间', + rules: 'required', + }, + + { + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + disabled: formType === 'detail', + autoSize: { minRows: 1, maxRows: 1 }, + class: 'w-full', + }, + fieldName: 'remark', + label: '备注', + formItemClass: 'col-span-2', + }, + + { + component: 'FileUpload', + componentProps: { + disabled: formType === 'detail', + maxNumber: 1, + maxSize: 10, + accept: [ + 'pdf', + 'doc', + 'docx', + 'xls', + 'xlsx', + 'txt', + 'jpg', + 'jpeg', + 'png', + ], + showDescription: true, + }, + fieldName: 'fileUrl', + label: '附件', + formItemClass: 'col-span-3', + }, + { + fieldName: 'product', + label: '产品清单', + component: 'Input', + formItemClass: 'col-span-3', + }, + { + component: 'InputNumber', + fieldName: 'discountPercent', + componentProps: { + placeholder: '优惠率', + min: 0, + max: 100, + disabled: true, + precision: 2, + style: { width: '100%' }, + }, + + label: '优惠率(%)', + }, + { + component: 'InputNumber', + componentProps: { + placeholder: '付款优惠', + precision: 2, + formatter: erpPriceInputFormatter, + disabled: true, + style: { width: '100%' }, + }, + fieldName: 'discountPrice', + label: '付款优惠', + }, + { + component: 'InputNumber', + componentProps: { + placeholder: '优惠后金额', + precision: 2, + formatter: erpPriceInputFormatter, + disabled: true, + style: { width: '100%' }, + }, + fieldName: 'discountedPrice', + label: '优惠后金额', + }, + { + component: 'InputNumber', + componentProps: { + disabled: formType === 'detail', + placeholder: '请输入其他费用', + precision: 2, + formatter: erpPriceInputFormatter, + style: { width: '100%' }, + }, + fieldName: 'otherPrice', + label: '其他费用', + }, + { + component: 'ApiSelect', + componentProps: { + placeholder: '请选择结算账户', + disabled: true, + allowClear: true, + showSearch: true, + api: getAccountSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + fieldName: 'accountId', + label: '结算账户', + }, + { + component: 'InputNumber', + componentProps: { + precision: 2, + style: { width: '100%' }, + disabled: true, + min: 0, + }, + fieldName: 'totalPrice', + label: '应退金额', + rules: z.number().min(0).optional(), + }, + ]; +} + +/** 采购订单项表格列定义 */ +export function usePurchaseOrderItemTableColumns(): VxeTableGridOptions['columns'] { + return [ + { type: 'seq', title: '序号', minWidth: 50, fixed: 'left' }, + { + field: 'warehouseId', + title: '仓库名称', + minWidth: 200, + slots: { default: 'warehouseId' }, + }, + { + field: 'productId', + title: '产品名称', + minWidth: 200, + slots: { default: 'productId' }, + }, + { + field: 'stockCount', + title: '仓库库存', + minWidth: 80, + }, + { + field: 'productBarCode', + title: '条码', + minWidth: 120, + }, + { + field: 'productUnitName', + title: '单位', + minWidth: 80, + }, + { + field: 'inCount', + title: '已入库数量', + minWidth: 120, + }, + { + field: 'returnCount', + title: '已退货', + minWidth: 120, + }, + { + field: 'count', + title: '数量', + minWidth: 120, + fixed: 'right', + slots: { default: 'count' }, + }, + { + field: 'productPrice', + title: '产品单价', + fixed: 'right', + minWidth: 120, + slots: { default: 'productPrice' }, + }, + { + field: 'totalProductPrice', + fixed: 'right', + title: '产品金额', + minWidth: 120, + formatter: 'formatAmount2', + }, + { + fixed: 'right', + field: 'taxPercent', + title: '税率(%)', + minWidth: 100, + }, + { + fixed: 'right', + field: 'taxPrice', + title: '税额', + minWidth: 120, + formatter: 'formatAmount2', + }, + { + field: 'totalPrice', + fixed: 'right', + title: '合计金额', + minWidth: 120, + formatter: 'formatAmount2', + }, + ]; +} + +/** 采购退货列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'no', + label: '退货单号', + component: 'Input', + componentProps: { + placeholder: '请输入入库单号', + allowClear: true, + }, + }, + { + fieldName: 'productId', + label: '产品', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择产品', + allowClear: true, + showSearch: true, + api: getProductSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + }, + { + fieldName: 'returnTime', + label: '退货时间', + component: 'RangePicker', + componentProps: { + placeholder: ['开始时间', '结束时间'], + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + }, + }, + { + fieldName: 'supplierId', + label: '供应商', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择供应商', + allowClear: true, + showSearch: true, + api: getSupplierSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + }, + { + fieldName: 'warehouseId', + label: '仓库', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择仓库', + allowClear: true, + showSearch: true, + api: getWarehouseSimpleList, + labelField: 'name', + valueField: 'id', + filterOption: false, + }, + }, + { + fieldName: 'creator', + label: '创建人', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择创建人', + allowClear: true, + showSearch: true, + api: getSimpleUserList, + fieldNames: { + label: 'nickname', + value: 'id', + }, + }, + }, + { + fieldName: 'orderNo', + label: '关联订单', + component: 'Input', + componentProps: { + placeholder: '请输入关联订单号', + allowClear: true, + }, + }, + { + fieldName: 'refundStatus', + label: '退款状态', + component: 'Select', + componentProps: { + options: [ + { label: '未退款', value: 0 }, + { label: '部分退款', value: 1 }, + { label: '全部退款', value: 2 }, + ], + placeholder: '请选择退货状态', + allowClear: true, + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + placeholder: '请选择状态', + allowClear: true, + options: getDictOptions(DICT_TYPE.ERP_AUDIT_STATUS, 'number'), + }, + }, + { + fieldName: 'remark', + label: '备注', + component: 'Input', + componentProps: { + placeholder: '请输入备注', + allowClear: true, + }, + }, + ]; +} + +/** 采购退货列表的字段 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + type: 'checkbox', + width: 50, + fixed: 'left', + }, + { + field: 'no', + title: '退货单号', + width: 200, + fixed: 'left', + }, + { + field: 'productNames', + title: '产品信息', + showOverflow: 'tooltip', + minWidth: 120, + }, + { + field: 'supplierName', + title: '供应商', + minWidth: 120, + }, + { + field: 'returnTime', + title: '退货时间', + width: 160, + formatter: 'formatDateTime', + }, + { + field: 'creatorName', + title: '创建人', + minWidth: 120, + }, + { + field: 'totalCount', + title: '总数量', + minWidth: 120, + }, + { + field: 'totalPrice', + title: '应退金额', + formatter: 'formatAmount2', + minWidth: 120, + }, + { + field: 'refundPrice', + title: '已退金额', + formatter: 'formatAmount2', + minWidth: 120, + }, + { + field: 'noRefundPrice', + title: '未退金额', + minWidth: 120, + formatter: ({ row }) => { + return `${erpNumberFormatter(row.totalPrice - row.refundPrice, 2)}元`; + }, + }, + { + field: 'status', + title: '状态', + minWidth: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.ERP_AUDIT_STATUS }, + }, + }, + { + title: '操作', + minWidth: 250, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} +/** 采购订单列表的搜索表单 */ +export function useOrderGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'no', + label: '订单单号', + component: 'Input', + componentProps: { + placeholder: '请输入订单单号', + allowClear: true, + disabled: true, + }, + }, + { + fieldName: 'productId', + label: '产品', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择产品', + allowClear: true, + showSearch: true, + api: getProductSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + }, + { + fieldName: 'orderTime', + label: '订单时间', + component: 'RangePicker', + componentProps: { + placeholder: ['开始时间', '结束时间'], + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + }, + }, + ]; +} + +/** 采购订单列表的字段 */ +export function useOrderGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + type: 'radio', + width: 50, + fixed: 'left', + }, + { + field: 'no', + title: '订单单号', + width: 200, + fixed: 'left', + }, + { + field: 'productNames', + title: '产品信息', + showOverflow: 'tooltip', + minWidth: 120, + }, + { + field: 'supplierName', + title: '供应商', + minWidth: 120, + }, + { + field: 'orderTime', + title: '订单时间', + width: 160, + formatter: 'formatDate', + }, + { + field: 'creatorName', + title: '创建人', + minWidth: 120, + }, + { + field: 'totalCount', + title: '总数量', + minWidth: 120, + }, + { + field: 'inCount', + title: '入库数量', + minWidth: 120, + }, + { + field: 'returnCount', + title: '退货数量', + minWidth: 120, + }, + { + field: 'totalProductPrice', + title: '金额合计', + formatter: 'formatNumber', + minWidth: 120, + }, + { + field: 'totalPrice', + title: '含税金额', + formatter: 'formatNumber', + minWidth: 120, + }, + ]; +} diff --git a/apps/web-antd/src/views/erp/purchase/return/index.vue b/apps/web-antd/src/views/erp/purchase/return/index.vue index ea638d71c..119e8e083 100644 --- a/apps/web-antd/src/views/erp/purchase/return/index.vue +++ b/apps/web-antd/src/views/erp/purchase/return/index.vue @@ -1,34 +1,233 @@ diff --git a/apps/web-antd/src/views/erp/purchase/return/modules/purchase-return-form.vue b/apps/web-antd/src/views/erp/purchase/return/modules/purchase-return-form.vue new file mode 100644 index 000000000..64c0c4197 --- /dev/null +++ b/apps/web-antd/src/views/erp/purchase/return/modules/purchase-return-form.vue @@ -0,0 +1,316 @@ + + + diff --git a/apps/web-antd/src/views/erp/purchase/return/modules/purchase-return-item-form.vue b/apps/web-antd/src/views/erp/purchase/return/modules/purchase-return-item-form.vue new file mode 100644 index 000000000..38077b0e2 --- /dev/null +++ b/apps/web-antd/src/views/erp/purchase/return/modules/purchase-return-item-form.vue @@ -0,0 +1,260 @@ + + + diff --git a/apps/web-antd/src/views/erp/purchase/return/modules/select-purchase-order-form.vue b/apps/web-antd/src/views/erp/purchase/return/modules/select-purchase-order-form.vue new file mode 100644 index 000000000..d437446e0 --- /dev/null +++ b/apps/web-antd/src/views/erp/purchase/return/modules/select-purchase-order-form.vue @@ -0,0 +1,63 @@ + + + diff --git a/apps/web-antd/src/views/erp/purchase/return/modules/select-purchase-order-grid.vue b/apps/web-antd/src/views/erp/purchase/return/modules/select-purchase-order-grid.vue new file mode 100644 index 000000000..51aca19b8 --- /dev/null +++ b/apps/web-antd/src/views/erp/purchase/return/modules/select-purchase-order-grid.vue @@ -0,0 +1,54 @@ + + + -- Gitee From 9ac9f724e5792450868b0aba81a65ac6151548bc Mon Sep 17 00:00:00 2001 From: xuzhiqiang Date: Thu, 21 Aug 2025 16:54:20 +0800 Subject: [PATCH 07/12] =?UTF-8?q?feat(@vben/web-antd):=20erp-sale-customer?= =?UTF-8?q?=20=E6=96=B0=E5=A2=9E=E5=AE=A2=E6=88=B7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=8C=85=E6=8B=AC=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E3=80=81=E5=88=97=E8=A1=A8=E5=8F=8A=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/erp/sale/customer/data.ts | 214 ++++++++++++++++++ .../src/views/erp/sale/customer/index.vue | 160 +++++++++++-- .../views/erp/sale/customer/modules/form.vue | 86 +++++++ 3 files changed, 439 insertions(+), 21 deletions(-) create mode 100644 apps/web-antd/src/views/erp/sale/customer/data.ts create mode 100644 apps/web-antd/src/views/erp/sale/customer/modules/form.vue diff --git a/apps/web-antd/src/views/erp/sale/customer/data.ts b/apps/web-antd/src/views/erp/sale/customer/data.ts new file mode 100644 index 000000000..ad44e2215 --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/customer/data.ts @@ -0,0 +1,214 @@ +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: 'name', + label: '名称', + rules: 'required', + componentProps: { + placeholder: '请输入名称', + }, + }, + { + fieldName: 'contact', + label: '联系人', + component: 'Input', + componentProps: { + placeholder: '请输入联系人', + }, + }, + { + fieldName: 'mobile', + label: '手机号码', + component: 'Input', + componentProps: { + placeholder: '请输入手机号码', + }, + }, + { + fieldName: 'telephone', + label: '联系电话', + component: 'Input', + componentProps: { + placeholder: '请输入联系电话', + }, + }, + { + fieldName: 'email', + label: '电子邮箱', + component: 'Input', + componentProps: { + placeholder: '请输入电子邮箱', + }, + }, + { + fieldName: 'fax', + label: '传真', + component: 'Input', + componentProps: { + placeholder: '请输入传真', + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'RadioGroup', + componentProps: { + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + buttonStyle: 'solid', + optionType: 'button', + }, + rules: z.number().default(CommonStatusEnum.ENABLE), + }, + { + fieldName: 'sort', + label: '排序', + component: 'InputNumber', + componentProps: { + placeholder: '请输入排序', + precision: 0, + class: 'w-full', + }, + rules: 'required', + defaultValue: 0, + }, + { + fieldName: 'taxNo', + label: '纳税人识别号', + component: 'Input', + componentProps: { + placeholder: '请输入纳税人识别号', + }, + }, + { + fieldName: 'taxPercent', + label: '税率(%)', + component: 'InputNumber', + componentProps: { + placeholder: '请输入税率', + precision: 0, + class: 'w-full', + }, + rules: z.number().min(0).max(100).default(0).optional(), + defaultValue: 0, + }, + { + fieldName: 'bankName', + label: '开户行名称', + component: 'Input', + componentProps: { + placeholder: '请输入开户行名称', + }, + }, + { + fieldName: 'bankAccount', + label: '开户行账号', + component: 'Input', + componentProps: { + placeholder: '请输入开户行账号', + }, + }, + { + fieldName: 'bankAddress', + label: '开户行地址', + component: 'Input', + componentProps: { + placeholder: '请输入开户行地址', + }, + }, + { + fieldName: 'remark', + label: '备注', + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + rows: 1, + }, + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'name', + label: '名称', + component: 'Input', + }, + { + fieldName: 'mobile', + label: '手机号码', + component: 'Input', + }, + { + fieldName: 'email', + label: '邮箱', + component: 'Input', + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + field: 'name', + title: '名称', + }, + { + field: 'contact', + title: '联系人', + }, + { + field: 'mobile', + title: '手机号码', + }, + { + field: 'telephone', + title: '联系电话', + }, + { + field: 'email', + title: '邮箱', + }, + { + field: 'taxNo', + 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/erp/sale/customer/index.vue b/apps/web-antd/src/views/erp/sale/customer/index.vue index 05c511ef1..3716a9f93 100644 --- a/apps/web-antd/src/views/erp/sale/customer/index.vue +++ b/apps/web-antd/src/views/erp/sale/customer/index.vue @@ -1,34 +1,152 @@ diff --git a/apps/web-antd/src/views/erp/sale/customer/modules/form.vue b/apps/web-antd/src/views/erp/sale/customer/modules/form.vue new file mode 100644 index 000000000..f1348df17 --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/customer/modules/form.vue @@ -0,0 +1,86 @@ + + + -- Gitee From e84df50f7b2193c240e513849eee4dad758d0458 Mon Sep 17 00:00:00 2001 From: xuzhiqiang Date: Fri, 22 Aug 2025 09:20:17 +0800 Subject: [PATCH 08/12] =?UTF-8?q?feat(@vben/web-antd):=20erp-sale-order=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=8C=85=E6=8B=AC=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=88=97=E8=A1=A8=E3=80=81=E8=A1=A8=E5=8D=95=E5=8F=8A?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/api/erp/sale/order/index.ts | 26 + .../web-antd/src/views/erp/sale/order/data.ts | 454 ++++++++++++++++++ .../src/views/erp/sale/order/index.vue | 244 +++++++++- .../src/views/erp/sale/order/modules/form.vue | 206 ++++++++ .../order/modules/sale-order-item-form.vue | 356 ++++++++++++++ 5 files changed, 1265 insertions(+), 21 deletions(-) create mode 100644 apps/web-antd/src/views/erp/sale/order/data.ts create mode 100644 apps/web-antd/src/views/erp/sale/order/modules/form.vue create mode 100644 apps/web-antd/src/views/erp/sale/order/modules/sale-order-item-form.vue diff --git a/apps/web-antd/src/api/erp/sale/order/index.ts b/apps/web-antd/src/api/erp/sale/order/index.ts index 211a28e26..329ac9244 100644 --- a/apps/web-antd/src/api/erp/sale/order/index.ts +++ b/apps/web-antd/src/api/erp/sale/order/index.ts @@ -14,7 +14,33 @@ export namespace ErpSaleOrderApi { status: number; // 状态 remark: string; // 备注 outCount: number; // 销售出库数量 + fileUrl?: string; // 附件地址 + inCount?: number; // 采购入库数量 returnCount: number; // 销售退货数量 + totalProductPrice?: number; // 产品金额,单位:元 + discountPercent?: number; // 优惠率,百分比 + discountPrice?: number; // 优惠金额,单位:元 + depositPrice?: number; // 定金金额,单位:元 + items?: SaleOrderItem[]; // 销售订单产品明细列表 + } + /** ERP 销售订单产品明细 */ + export interface SaleOrderItem { + id?: number; // 订单项编号 + orderId?: number; // 采购订单编号 + productId?: number; // 产品编号 + productName?: string; // 产品名称 + productBarCode?: string; // 产品条码 + productUnitId?: number; // 产品单位编号 + productUnitName?: string; // 产品单位名称 + productPrice?: number; // 产品单价,单位:元 + totalProductPrice?: number; // 产品总价,单位:元 + count?: number; // 数量 + totalPrice?: number; // 总价,单位:元 + taxPercent?: number; // 税率,百分比 + taxPrice?: number; // 税额,单位:元 + totalTaxPrice?: number; // 含税总价,单位:元 + remark?: string; // 备注 + stockCount?: number; // 库存数量(显示字段) } /** 销售订单分页查询参数 */ diff --git a/apps/web-antd/src/views/erp/sale/order/data.ts b/apps/web-antd/src/views/erp/sale/order/data.ts new file mode 100644 index 000000000..64d41c627 --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/order/data.ts @@ -0,0 +1,454 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; + +import { erpPriceInputFormatter } from '@vben/utils'; + +import { z } from '#/adapter/form'; +import { getAccountSimpleList } from '#/api/erp/finance/account'; +import { getProductSimpleList } from '#/api/erp/product/product'; +import { getCustomerSimpleList } from '#/api/erp/sale/customer'; +import { getSimpleUserList } from '#/api/system/user'; +import { DICT_TYPE, getDictOptions } from '#/utils'; + +/** 表单的配置项 */ +export function useFormSchema(): VbenFormSchema[] { + return [ + { + component: 'Input', + componentProps: { + style: { display: 'none' }, + }, + fieldName: 'id', + label: 'ID', + hideLabel: true, + formItemClass: 'hidden', + }, + + { + component: 'Input', + componentProps: { + placeholder: '系统自动生成', + disabled: true, + }, + fieldName: 'no', + label: '订单单号', + }, + { + component: 'DatePicker', + componentProps: { + placeholder: '选择订单时间', + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + style: { width: '100%' }, + }, + fieldName: 'orderTime', + label: '订单时间', + rules: 'required', + }, + { + component: 'ApiSelect', + componentProps: { + placeholder: '请选择客户', + allowClear: true, + showSearch: true, + api: getCustomerSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + fieldName: 'customerId', + label: '客户', + rules: 'required', + }, + { + fieldName: 'saleUserId', + label: '创建人', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择创建人', + allowClear: true, + showSearch: true, + api: getSimpleUserList, + fieldNames: { + label: 'nickname', + value: 'id', + }, + }, + }, + { + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + autoSize: { minRows: 1, maxRows: 1 }, + }, + fieldName: 'remark', + label: '备注', + }, + { + component: 'FileUpload', + componentProps: { + maxNumber: 1, + maxSize: 10, + accept: [ + 'pdf', + 'doc', + 'docx', + 'xls', + 'xlsx', + 'txt', + 'jpg', + 'jpeg', + 'png', + ], + showDescription: true, + }, + fieldName: 'fileUrl', + label: '附件', + formItemClass: 'col-span-3', + }, + { + fieldName: 'product', + label: '产品清单', + component: 'Input', + formItemClass: 'col-span-3', + }, + { + component: 'InputNumber', + componentProps: { + placeholder: '请输入优惠率', + min: 0, + max: 100, + precision: 2, + style: { width: '100%' }, + }, + fieldName: 'discountPercent', + label: '优惠率(%)', + rules: z.number().min(0).optional(), + }, + { + component: 'InputNumber', + componentProps: { + placeholder: '收款优惠', + precision: 2, + formatter: erpPriceInputFormatter, + disabled: true, + style: { width: '100%' }, + }, + fieldName: 'discountPrice', + label: '付款优惠', + }, + { + component: 'InputNumber', + componentProps: { + placeholder: '优惠后金额', + precision: 2, + formatter: erpPriceInputFormatter, + disabled: true, + style: { width: '100%' }, + }, + fieldName: 'totalPrice', + label: '优惠后金额', + }, + { + component: 'ApiSelect', + componentProps: { + placeholder: '请选择结算账户', + allowClear: true, + showSearch: true, + api: getAccountSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + fieldName: 'accountId', + label: '结算账户', + }, + { + component: 'InputNumber', + componentProps: { + placeholder: '请输入收取订金', + precision: 2, + style: { width: '100%' }, + min: 0, + }, + fieldName: 'depositPrice', + label: '收取订金', + rules: z.number().min(0).optional(), + }, + ]; +} + +/** 采购订单项表格列定义 */ +export function useSaleOrderItemTableColumns(): VxeTableGridOptions['columns'] { + return [ + { type: 'seq', title: '序号', minWidth: 50, fixed: 'left' }, + { + field: 'productId', + title: '产品名称', + minWidth: 200, + slots: { default: 'productId' }, + }, + { + field: 'stockCount', + title: '库存', + minWidth: 80, + }, + { + field: 'productBarCode', + title: '条码', + minWidth: 120, + }, + { + field: 'productUnitName', + title: '单位', + minWidth: 80, + }, + { + field: 'count', + title: '数量', + minWidth: 120, + slots: { default: 'count' }, + }, + { + field: 'productPrice', + title: '产品单价', + minWidth: 120, + slots: { default: 'productPrice' }, + }, + { + field: 'totalProductPrice', + title: '金额', + minWidth: 120, + formatter: 'formatAmount2', + }, + { + field: 'taxPercent', + title: '税率(%)', + minWidth: 100, + slots: { default: 'taxPercent' }, + }, + { + field: 'taxPrice', + title: '税额', + minWidth: 120, + formatter: 'formatAmount2', + }, + { + field: 'totalPrice', + title: '税额合计', + minWidth: 120, + formatter: 'formatAmount2', + }, + { + field: 'remark', + title: '备注', + minWidth: 150, + slots: { default: 'remark' }, + }, + { + title: '操作', + width: 50, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'no', + label: '订单单号', + component: 'Input', + componentProps: { + placeholder: '请输入订单单号', + allowClear: true, + }, + }, + { + fieldName: 'productId', + label: '产品', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择产品', + allowClear: true, + showSearch: true, + api: getProductSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + }, + { + fieldName: 'orderTime', + label: '订单时间', + component: 'RangePicker', + componentProps: { + placeholder: ['开始时间', '结束时间'], + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + }, + }, + { + fieldName: 'supplierId', + label: '客户', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择客户', + allowClear: true, + showSearch: true, + api: getCustomerSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + }, + { + fieldName: 'creator', + label: '创建人', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择创建人', + allowClear: true, + showSearch: true, + api: getSimpleUserList, + fieldNames: { + label: 'nickname', + value: 'id', + }, + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + options: getDictOptions(DICT_TYPE.ERP_AUDIT_STATUS, 'number'), + placeholder: '请选择状态', + allowClear: true, + }, + }, + { + fieldName: 'outStatus', + label: '出库状态', + component: 'Select', + componentProps: { + options: [ + { label: '未出库', value: 0 }, + { label: '部分出库', value: 1 }, + { label: '全部出库', value: 2 }, + ], + placeholder: '请选择出库状态', + allowClear: true, + }, + }, + { + fieldName: 'returnStatus', + label: '退货状态', + component: 'Select', + componentProps: { + options: [ + { label: '未退货', value: 0 }, + { label: '部分退货', value: 1 }, + { label: '全部退货', value: 2 }, + ], + placeholder: '请选择退货状态', + allowClear: true, + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + type: 'checkbox', + width: 50, + fixed: 'left', + }, + { + field: 'no', + title: '订单单号', + width: 200, + fixed: 'left', + }, + { + field: 'productNames', + title: '产品信息', + showOverflow: 'tooltip', + minWidth: 120, + }, + { + field: 'customerName', + title: '客户', + minWidth: 120, + }, + { + field: 'orderTime', + title: '订单时间', + width: 160, + formatter: 'formatDate', + }, + { + field: 'creatorName', + title: '创建人', + minWidth: 120, + }, + { + field: 'totalCount', + title: '总数量', + minWidth: 120, + }, + { + field: 'outCount', + title: '出库数量', + minWidth: 120, + }, + { + field: 'returnCount', + title: '退货数量', + minWidth: 120, + }, + { + field: 'totalProductPrice', + title: '金额合计', + formatter: 'formatNumber', + minWidth: 120, + }, + { + field: 'totalPrice', + title: '含税金额', + formatter: 'formatNumber', + minWidth: 120, + }, + { + field: 'depositPrice', + title: '收取订金', + formatter: 'formatNumber', + minWidth: 120, + }, + { + field: 'status', + title: '状态', + minWidth: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.ERP_AUDIT_STATUS }, + }, + }, + { + title: '操作', + width: 220, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} diff --git a/apps/web-antd/src/views/erp/sale/order/index.vue b/apps/web-antd/src/views/erp/sale/order/index.vue index 51b03d262..cafc50121 100644 --- a/apps/web-antd/src/views/erp/sale/order/index.vue +++ b/apps/web-antd/src/views/erp/sale/order/index.vue @@ -1,34 +1,236 @@ diff --git a/apps/web-antd/src/views/erp/sale/order/modules/form.vue b/apps/web-antd/src/views/erp/sale/order/modules/form.vue new file mode 100644 index 000000000..a61c368c2 --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/order/modules/form.vue @@ -0,0 +1,206 @@ + + + diff --git a/apps/web-antd/src/views/erp/sale/order/modules/sale-order-item-form.vue b/apps/web-antd/src/views/erp/sale/order/modules/sale-order-item-form.vue new file mode 100644 index 000000000..5fa6850d0 --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/order/modules/sale-order-item-form.vue @@ -0,0 +1,356 @@ + + + -- Gitee From 765bb2ef5a4889029fbf89b9dad1765cd53c61a1 Mon Sep 17 00:00:00 2001 From: xuzhiqiang Date: Fri, 22 Aug 2025 14:45:23 +0800 Subject: [PATCH 09/12] =?UTF-8?q?feat(@vben/web-antd):=20erp-sale-out=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=94=80=E5=94=AE=E5=87=BA=E5=BA=93=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=8C=85=E6=8B=AC=E5=87=BA?= =?UTF-8?q?=E5=BA=93=E5=88=97=E8=A1=A8=E3=80=81=E8=A1=A8=E5=8D=95=E5=8F=8A?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/api/erp/sale/order/index.ts | 1 + apps/web-antd/src/api/erp/sale/out/index.ts | 44 +- apps/web-antd/src/views/erp/sale/out/data.ts | 591 ++++++++++++++++++ .../web-antd/src/views/erp/sale/out/index.vue | 247 +++++++- .../erp/sale/out/modules/sale-out-form.vue | 310 +++++++++ .../sale/out/modules/sale-out-item-form.vue | 255 ++++++++ .../out/modules/select-sale-order-form.vue | 69 ++ .../out/modules/select-sale-order-grid.vue | 54 ++ 8 files changed, 1542 insertions(+), 29 deletions(-) create mode 100644 apps/web-antd/src/views/erp/sale/out/data.ts create mode 100644 apps/web-antd/src/views/erp/sale/out/modules/sale-out-form.vue create mode 100644 apps/web-antd/src/views/erp/sale/out/modules/sale-out-item-form.vue create mode 100644 apps/web-antd/src/views/erp/sale/out/modules/select-sale-order-form.vue create mode 100644 apps/web-antd/src/views/erp/sale/out/modules/select-sale-order-grid.vue diff --git a/apps/web-antd/src/api/erp/sale/order/index.ts b/apps/web-antd/src/api/erp/sale/order/index.ts index 329ac9244..7bd9b4fad 100644 --- a/apps/web-antd/src/api/erp/sale/order/index.ts +++ b/apps/web-antd/src/api/erp/sale/order/index.ts @@ -8,6 +8,7 @@ export namespace ErpSaleOrderApi { id?: number; // 订单工单编号 no: string; // 销售订单号 customerId: number; // 客户编号 + accountId?: number; // 收款账户编号 orderTime: Date; // 订单时间 totalCount: number; // 合计数量 totalPrice: number; // 合计金额,单位:元 diff --git a/apps/web-antd/src/api/erp/sale/out/index.ts b/apps/web-antd/src/api/erp/sale/out/index.ts index 62045216a..dc4f5d05f 100644 --- a/apps/web-antd/src/api/erp/sale/out/index.ts +++ b/apps/web-antd/src/api/erp/sale/out/index.ts @@ -2,17 +2,45 @@ import type { PageParam, PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; -namespace ErpSaleOutApi { +export namespace ErpSaleOutApi { /** 销售出库信息 */ export interface SaleOut { id?: number; // 销售出库编号 - no: string; // 销售出库号 - customerId: number; // 客户编号 - outTime: Date; // 出库时间 - totalCount: number; // 合计数量 - totalPrice: number; // 合计金额,单位:元 - status: number; // 状态 - remark: string; // 备注 + no?: string; // 销售出库号 + customerId?: number; // 客户编号 + saleUserId?: number; // 客户编号 + outTime?: Date; // 出库时间 + totalCount?: number; // 合计数量 + totalPrice?: number; // 合计金额,单位:元 + status?: number; // 状态 + remark?: string; // 备注 + discountPercent?: number; // 折扣百分比 + discountPrice?: number; // 折扣金额 + otherPrice?: number; // 其他费用 + totalProductPrice?: number; // 合计商品金额 + taxPrice?: number; // 合计税额 + totalTaxPrice?: number; // 合计税额 + fileUrl?: string; // 附件地址 + items?: SaleOutItem[]; + } + export interface SaleOutItem { + count?: number; + id?: number; + orderItemId?: number; + productBarCode?: string; + productId?: number; + productName: string; + productPrice: number; + productUnitId?: number; + productUnitName?: string; + totalProductPrice?: number; + remark: string; + stockCount?: number; + taxPercent?: number; + taxPrice?: number; + totalPrice?: number; + warehouseId?: number; + outCount?: number; } /** 销售出库分页查询参数 */ diff --git a/apps/web-antd/src/views/erp/sale/out/data.ts b/apps/web-antd/src/views/erp/sale/out/data.ts new file mode 100644 index 000000000..9212d47f9 --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/out/data.ts @@ -0,0 +1,591 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; + +import { erpNumberFormatter, erpPriceInputFormatter } from '@vben/utils'; + +import { z } from '#/adapter/form'; +import { getAccountSimpleList } from '#/api/erp/finance/account'; +import { getProductSimpleList } from '#/api/erp/product/product'; +import { getCustomerSimpleList } from '#/api/erp/sale/customer'; +import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; +import { getSimpleUserList } from '#/api/system/user'; +import { DICT_TYPE, getDictOptions } from '#/utils'; + +/** 表单的配置项 */ +export function useFormSchema(formType: string): VbenFormSchema[] { + return [ + { + component: 'Input', + componentProps: { + style: { display: 'none' }, + }, + fieldName: 'id', + label: 'ID', + hideLabel: true, + formItemClass: 'hidden', + }, + { + component: 'Input', + componentProps: { + placeholder: '系统自动生成', + disabled: true, + }, + fieldName: 'no', + label: '出库单号', + }, + { + component: 'ApiSelect', + componentProps: { + disabled: true, + placeholder: '请选择客户', + allowClear: true, + showSearch: true, + api: getCustomerSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + fieldName: 'customerId', + label: '客户', + rules: 'required', + }, + { + fieldName: 'orderNo', + label: '关联订单', + component: 'Input', + formItemClass: 'col-span-1', + rules: 'required', + componentProps: { + placeholder: '请选择关联订单', + disabled: formType === 'detail', + }, + }, + { + component: 'DatePicker', + componentProps: { + disabled: formType === 'detail', + placeholder: '选择出库时间', + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + style: { width: '100%' }, + }, + fieldName: 'outTime', + label: '出库时间', + rules: 'required', + }, + { + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + disabled: formType === 'detail', + autoSize: { minRows: 1, maxRows: 1 }, + class: 'w-full', + }, + fieldName: 'remark', + formItemClass: 'col-span-2', + label: '备注', + }, + { + component: 'FileUpload', + componentProps: { + disabled: formType === 'detail', + maxNumber: 1, + maxSize: 10, + accept: [ + 'pdf', + 'doc', + 'docx', + 'xls', + 'xlsx', + 'txt', + 'jpg', + 'jpeg', + 'png', + ], + showDescription: true, + }, + fieldName: 'fileUrl', + label: '附件', + formItemClass: 'col-span-3', + }, + { + fieldName: 'product', + label: '产品清单', + component: 'Input', + formItemClass: 'col-span-3', + }, + { + component: 'InputNumber', + fieldName: 'discountPercent', + componentProps: { + placeholder: '优惠率', + min: 0, + max: 100, + disabled: true, + precision: 2, + style: { width: '100%' }, + }, + + label: '优惠率(%)', + }, + { + component: 'InputNumber', + componentProps: { + placeholder: '付款优惠', + precision: 2, + formatter: erpPriceInputFormatter, + disabled: true, + style: { width: '100%' }, + }, + fieldName: 'discountPrice', + label: '付款优惠', + }, + { + component: 'InputNumber', + componentProps: { + placeholder: '优惠后金额', + precision: 2, + formatter: erpPriceInputFormatter, + disabled: true, + style: { width: '100%' }, + }, + fieldName: 'discountedPrice', + label: '优惠后金额', + }, + { + component: 'InputNumber', + componentProps: { + disabled: formType === 'detail', + placeholder: '请输入其他费用', + precision: 2, + formatter: erpPriceInputFormatter, + style: { width: '100%' }, + }, + fieldName: 'otherPrice', + label: '其他费用', + }, + { + component: 'ApiSelect', + componentProps: { + placeholder: '请选择结算账户', + disabled: true, + allowClear: true, + showSearch: true, + api: getAccountSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + fieldName: 'accountId', + label: '结算账户', + }, + { + component: 'InputNumber', + componentProps: { + precision: 2, + style: { width: '100%' }, + disabled: true, + min: 0, + }, + fieldName: 'totalPrice', + label: '应收金额', + rules: z.number().min(0).optional(), + }, + ]; +} + +/** 采购订单项表格列定义 */ +export function useSaleOutItemTableColumns(): VxeTableGridOptions['columns'] { + return [ + { type: 'seq', title: '序号', minWidth: 50, fixed: 'left' }, + { + field: 'warehouseId', + title: '仓库名称', + minWidth: 200, + slots: { default: 'warehouseId' }, + }, + { + field: 'productId', + title: '产品名称', + minWidth: 200, + slots: { default: 'productId' }, + }, + { + field: 'stockCount', + title: '仓库库存', + minWidth: 80, + }, + { + field: 'productBarCode', + title: '条码', + minWidth: 120, + }, + { + field: 'productUnitName', + title: '单位', + minWidth: 80, + }, + { + field: 'totalCount', + title: '原数量', + minWidth: 120, + }, + { + field: 'outCount', + title: '已出库数量', + minWidth: 120, + }, + { + field: 'count', + title: '数量', + minWidth: 120, + fixed: 'right', + slots: { default: 'count' }, + }, + { + field: 'productPrice', + title: '产品单价', + fixed: 'right', + minWidth: 120, + slots: { default: 'productPrice' }, + }, + { + field: 'totalProductPrice', + fixed: 'right', + title: '产品金额', + minWidth: 120, + formatter: 'formatAmount2', + }, + { + fixed: 'right', + field: 'taxPercent', + title: '税率(%)', + minWidth: 100, + }, + { + fixed: 'right', + field: 'taxPrice', + title: '税额', + minWidth: 120, + formatter: 'formatAmount2', + }, + { + field: 'totalPrice', + fixed: 'right', + title: '合计金额', + minWidth: 120, + formatter: 'formatAmount2', + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'no', + label: '出库单号', + component: 'Input', + componentProps: { + placeholder: '请输入出库单号', + allowClear: true, + }, + }, + { + fieldName: 'productId', + label: '产品', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择产品', + allowClear: true, + showSearch: true, + api: getProductSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + }, + { + fieldName: 'outTime', + label: '出库时间', + component: 'RangePicker', + componentProps: { + placeholder: ['开始时间', '结束时间'], + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + }, + }, + { + fieldName: 'customerId', + label: '客户', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择客户', + allowClear: true, + showSearch: true, + api: getCustomerSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + }, + { + fieldName: 'warehouseId', + label: '仓库', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择仓库', + allowClear: true, + showSearch: true, + api: getWarehouseSimpleList, + labelField: 'name', + valueField: 'id', + filterOption: false, + }, + }, + { + fieldName: 'creator', + label: '创建人', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择创建人', + allowClear: true, + showSearch: true, + api: getSimpleUserList, + fieldNames: { + label: 'nickname', + value: 'id', + }, + }, + }, + { + fieldName: 'orderNo', + label: '关联订单', + component: 'Input', + componentProps: { + placeholder: '请输入关联订单号', + allowClear: true, + }, + }, + { + fieldName: 'receiptStatus', + label: '收款状态', + component: 'Select', + componentProps: { + options: [ + { label: '未收款', value: 0 }, + { label: '部分收款', value: 1 }, + { label: '全部收款', value: 2 }, + ], + placeholder: '请选择收款状态', + allowClear: true, + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + placeholder: '请选择状态', + allowClear: true, + options: getDictOptions(DICT_TYPE.ERP_AUDIT_STATUS, 'number'), + }, + }, + { + fieldName: 'remark', + label: '备注', + component: 'Input', + componentProps: { + placeholder: '请输入备注', + allowClear: true, + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + type: 'checkbox', + width: 50, + fixed: 'left', + }, + { + field: 'no', + title: '出库单号', + width: 200, + fixed: 'left', + }, + { + field: 'productNames', + title: '产品信息', + showOverflow: 'tooltip', + minWidth: 120, + }, + { + field: 'customerName', + title: '客户', + minWidth: 120, + }, + { + field: 'outTime', + title: '出库时间', + width: 160, + formatter: 'formatDate', + }, + { + field: 'creatorName', + title: '创建人', + minWidth: 120, + }, + { + field: 'totalCount', + title: '总数量', + minWidth: 120, + }, + { + field: 'totalPrice', + title: '应收金额', + formatter: 'formatNumber', + minWidth: 120, + }, + { + field: 'receiptPrice', + title: '已收金额', + formatter: 'formatNumber', + minWidth: 120, + }, + { + field: 'unReceiptPrice', + title: '未收金额', + formatter: ({ row }) => { + return `${erpNumberFormatter(row.totalPrice - row.receiptPrice, 2)}元`; + }, + minWidth: 120, + }, + { + field: 'status', + title: '状态', + minWidth: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.ERP_AUDIT_STATUS }, + }, + }, + { + title: '操作', + minWidth: 250, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} +/** 列表的搜索表单 */ +export function useOrderGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'no', + label: '订单单号', + component: 'Input', + componentProps: { + placeholder: '请输入订单单号', + allowClear: true, + disabled: true, + }, + }, + { + fieldName: 'productId', + label: '产品', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择产品', + allowClear: true, + showSearch: true, + api: getProductSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + }, + { + fieldName: 'orderTime', + label: '订单时间', + component: 'RangePicker', + componentProps: { + placeholder: ['开始时间', '结束时间'], + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + }, + }, + ]; +} + +/** 列表的字段 */ +export function useOrderGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + type: 'radio', + width: 50, + fixed: 'left', + }, + { + field: 'no', + title: '订单单号', + width: 200, + fixed: 'left', + }, + { + field: 'productNames', + title: '产品信息', + showOverflow: 'tooltip', + minWidth: 120, + }, + { + field: 'customerName', + title: '客户', + minWidth: 120, + }, + { + field: 'orderTime', + title: '订单时间', + width: 160, + formatter: 'formatDate', + }, + { + field: 'creatorName', + title: '创建人', + minWidth: 120, + }, + { + field: 'totalCount', + title: '总数量', + minWidth: 120, + }, + { + field: 'outCount', + title: '出库数量', + minWidth: 120, + }, + { + field: 'totalProductPrice', + title: '金额合计', + formatter: 'formatNumber', + minWidth: 120, + }, + { + field: 'totalPrice', + title: '含税金额', + formatter: 'formatNumber', + minWidth: 120, + }, + ]; +} diff --git a/apps/web-antd/src/views/erp/sale/out/index.vue b/apps/web-antd/src/views/erp/sale/out/index.vue index a94068e22..3909cd1ba 100644 --- a/apps/web-antd/src/views/erp/sale/out/index.vue +++ b/apps/web-antd/src/views/erp/sale/out/index.vue @@ -1,34 +1,239 @@ diff --git a/apps/web-antd/src/views/erp/sale/out/modules/sale-out-form.vue b/apps/web-antd/src/views/erp/sale/out/modules/sale-out-form.vue new file mode 100644 index 000000000..6a93c78ef --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/out/modules/sale-out-form.vue @@ -0,0 +1,310 @@ + + + diff --git a/apps/web-antd/src/views/erp/sale/out/modules/sale-out-item-form.vue b/apps/web-antd/src/views/erp/sale/out/modules/sale-out-item-form.vue new file mode 100644 index 000000000..d16f7d122 --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/out/modules/sale-out-item-form.vue @@ -0,0 +1,255 @@ + + + diff --git a/apps/web-antd/src/views/erp/sale/out/modules/select-sale-order-form.vue b/apps/web-antd/src/views/erp/sale/out/modules/select-sale-order-form.vue new file mode 100644 index 000000000..2f435178f --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/out/modules/select-sale-order-form.vue @@ -0,0 +1,69 @@ + + + diff --git a/apps/web-antd/src/views/erp/sale/out/modules/select-sale-order-grid.vue b/apps/web-antd/src/views/erp/sale/out/modules/select-sale-order-grid.vue new file mode 100644 index 000000000..79114dab6 --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/out/modules/select-sale-order-grid.vue @@ -0,0 +1,54 @@ + + + -- Gitee From 93427f13bb713e4e31dcf6b17aec8eef4da7ba9b Mon Sep 17 00:00:00 2001 From: xuzhiqiang Date: Fri, 22 Aug 2025 14:55:33 +0800 Subject: [PATCH 10/12] =?UTF-8?q?feat(@vben/web-antd):=20erp-sale-return?= =?UTF-8?q?=20=E6=96=B0=E5=A2=9E=E9=94=80=E5=94=AE=E9=80=80=E8=B4=A7?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=8C=85=E6=8B=AC?= =?UTF-8?q?=E9=80=80=E8=B4=A7=E5=88=97=E8=A1=A8=E3=80=81=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E5=8F=8A=E7=9B=B8=E5=85=B3=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web-antd/src/api/erp/sale/return/index.ts | 43 +- .../src/views/erp/sale/return/data.ts | 591 ++++++++++++++++++ .../src/views/erp/sale/return/index.vue | 247 +++++++- .../sale/return/modules/sale-return-form.vue | 314 ++++++++++ .../return/modules/sale-return-item-form.vue | 255 ++++++++ .../return/modules/select-sale-order-form.vue | 69 ++ .../return/modules/select-sale-order-grid.vue | 54 ++ 7 files changed, 1544 insertions(+), 29 deletions(-) create mode 100644 apps/web-antd/src/views/erp/sale/return/data.ts create mode 100644 apps/web-antd/src/views/erp/sale/return/modules/sale-return-form.vue create mode 100644 apps/web-antd/src/views/erp/sale/return/modules/sale-return-item-form.vue create mode 100644 apps/web-antd/src/views/erp/sale/return/modules/select-sale-order-form.vue create mode 100644 apps/web-antd/src/views/erp/sale/return/modules/select-sale-order-grid.vue diff --git a/apps/web-antd/src/api/erp/sale/return/index.ts b/apps/web-antd/src/api/erp/sale/return/index.ts index 0ebcfc752..91057f4df 100644 --- a/apps/web-antd/src/api/erp/sale/return/index.ts +++ b/apps/web-antd/src/api/erp/sale/return/index.ts @@ -2,17 +2,44 @@ import type { PageParam, PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; -namespace ErpSaleReturnApi { +export namespace ErpSaleReturnApi { /** 销售退货信息 */ export interface SaleReturn { id?: number; // 销售退货编号 - no: string; // 销售退货号 - customerId: number; // 客户编号 - returnTime: Date; // 退货时间 - totalCount: number; // 合计数量 - totalPrice: number; // 合计金额,单位:元 - status: number; // 状态 - remark: string; // 备注 + no?: string; // 销售退货号 + customerId?: number; // 客户编号 + returnTime?: Date; // 退货时间 + totalCount?: number; // 合计数量 + totalPrice?: number; // 合计金额,单位:元 + status?: number; // 状态 + remark?: string; // 备注 + discountPercent?: number; // 折扣百分比 + discountPrice?: number; // 折扣金额 + otherPrice?: number; // 其他费用 + totalProductPrice?: number; // 合计商品金额 + taxPrice?: number; // 合计税额 + totalTaxPrice?: number; // 合计税额 + fileUrl?: string; // 附件地址 + items?: SaleReturnItem[]; + } + export interface SaleReturnItem { + count?: number; + id?: number; + orderItemId?: number; + productBarCode?: string; + productId?: number; + productName: string; + productPrice: number; + productUnitId?: number; + productUnitName?: string; + totalProductPrice?: number; + remark: string; + stockCount?: number; + taxPercent?: number; + taxPrice?: number; + totalPrice?: number; + warehouseId?: number; + returnCount?: number; } /** 销售退货分页查询参数 */ diff --git a/apps/web-antd/src/views/erp/sale/return/data.ts b/apps/web-antd/src/views/erp/sale/return/data.ts new file mode 100644 index 000000000..01c046728 --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/return/data.ts @@ -0,0 +1,591 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; + +import { erpNumberFormatter, erpPriceInputFormatter } from '@vben/utils'; + +import { z } from '#/adapter/form'; +import { getAccountSimpleList } from '#/api/erp/finance/account'; +import { getProductSimpleList } from '#/api/erp/product/product'; +import { getCustomerSimpleList } from '#/api/erp/sale/customer'; +import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse'; +import { getSimpleUserList } from '#/api/system/user'; +import { DICT_TYPE, getDictOptions } from '#/utils'; + +/** 表单的配置项 */ +export function useFormSchema(formType: string): VbenFormSchema[] { + return [ + { + component: 'Input', + componentProps: { + style: { display: 'none' }, + }, + fieldName: 'id', + label: 'ID', + hideLabel: true, + formItemClass: 'hidden', + }, + { + component: 'Input', + componentProps: { + placeholder: '系统自动生成', + disabled: true, + }, + fieldName: 'no', + label: '退货单号', + }, + { + component: 'ApiSelect', + componentProps: { + disabled: true, + placeholder: '请选择客户', + allowClear: true, + showSearch: true, + api: getCustomerSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + fieldName: 'customerId', + label: '客户', + rules: 'required', + }, + { + fieldName: 'orderNo', + label: '关联订单', + component: 'Input', + formItemClass: 'col-span-1', + rules: 'required', + componentProps: { + placeholder: '请选择关联订单', + disabled: formType === 'detail', + }, + }, + { + component: 'DatePicker', + componentProps: { + disabled: formType === 'detail', + placeholder: '选择退货时间', + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + style: { width: '100%' }, + }, + fieldName: 'returnTime', + label: '退货时间', + rules: 'required', + }, + { + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + disabled: formType === 'detail', + autoSize: { minRows: 1, maxRows: 1 }, + class: 'w-full', + }, + fieldName: 'remark', + formItemClass: 'col-span-2', + label: '备注', + }, + { + component: 'FileUpload', + componentProps: { + disabled: formType === 'detail', + maxNumber: 1, + maxSize: 10, + accept: [ + 'pdf', + 'doc', + 'docx', + 'xls', + 'xlsx', + 'txt', + 'jpg', + 'jpeg', + 'png', + ], + showDescription: true, + }, + fieldName: 'fileUrl', + label: '附件', + formItemClass: 'col-span-3', + }, + { + fieldName: 'product', + label: '产品清单', + component: 'Input', + formItemClass: 'col-span-3', + }, + { + component: 'InputNumber', + fieldName: 'discountPercent', + componentProps: { + placeholder: '优惠率', + min: 0, + max: 100, + disabled: true, + precision: 2, + style: { width: '100%' }, + }, + + label: '优惠率(%)', + }, + { + component: 'InputNumber', + componentProps: { + placeholder: '付款优惠', + precision: 2, + formatter: erpPriceInputFormatter, + disabled: true, + style: { width: '100%' }, + }, + fieldName: 'discountPrice', + label: '付款优惠', + }, + { + component: 'InputNumber', + componentProps: { + placeholder: '优惠后金额', + precision: 2, + formatter: erpPriceInputFormatter, + disabled: true, + style: { width: '100%' }, + }, + fieldName: 'discountedPrice', + label: '优惠后金额', + }, + { + component: 'InputNumber', + componentProps: { + disabled: formType === 'detail', + placeholder: '请输入其他费用', + precision: 2, + formatter: erpPriceInputFormatter, + style: { width: '100%' }, + }, + fieldName: 'otherPrice', + label: '其他费用', + }, + { + component: 'ApiSelect', + componentProps: { + placeholder: '请选择结算账户', + disabled: true, + allowClear: true, + showSearch: true, + api: getAccountSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + fieldName: 'accountId', + label: '结算账户', + }, + { + component: 'InputNumber', + componentProps: { + precision: 2, + style: { width: '100%' }, + disabled: true, + min: 0, + }, + fieldName: 'totalPrice', + label: '应退金额', + rules: z.number().min(0).optional(), + }, + ]; +} + +/** 采购订单项表格列定义 */ +export function useSaleReturnItemTableColumns(): VxeTableGridOptions['columns'] { + return [ + { type: 'seq', title: '序号', minWidth: 50, fixed: 'left' }, + { + field: 'warehouseId', + title: '仓库名称', + minWidth: 200, + slots: { default: 'warehouseId' }, + }, + { + field: 'productId', + title: '产品名称', + minWidth: 200, + slots: { default: 'productId' }, + }, + { + field: 'stockCount', + title: '仓库库存', + minWidth: 80, + }, + { + field: 'productBarCode', + title: '条码', + minWidth: 120, + }, + { + field: 'productUnitName', + title: '单位', + minWidth: 80, + }, + { + field: 'totalCount', + title: '原数量', + minWidth: 120, + }, + { + field: 'returnCount', + title: '已退货数量', + minWidth: 120, + }, + { + field: 'count', + title: '数量', + minWidth: 120, + fixed: 'right', + slots: { default: 'count' }, + }, + { + field: 'productPrice', + title: '产品单价', + fixed: 'right', + minWidth: 120, + slots: { default: 'productPrice' }, + }, + { + field: 'totalProductPrice', + fixed: 'right', + title: '产品金额', + minWidth: 120, + formatter: 'formatAmount2', + }, + { + fixed: 'right', + field: 'taxPercent', + title: '税率(%)', + minWidth: 100, + }, + { + fixed: 'right', + field: 'taxPrice', + title: '税额', + minWidth: 120, + formatter: 'formatAmount2', + }, + { + field: 'totalPrice', + fixed: 'right', + title: '合计金额', + minWidth: 120, + formatter: 'formatAmount2', + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'no', + label: '退货单号', + component: 'Input', + componentProps: { + placeholder: '请输入退货单号', + allowClear: true, + }, + }, + { + fieldName: 'productId', + label: '产品', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择产品', + allowClear: true, + showSearch: true, + api: getProductSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + }, + { + fieldName: 'returnTime', + label: '退货时间', + component: 'RangePicker', + componentProps: { + placeholder: ['开始时间', '结束时间'], + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + }, + }, + { + fieldName: 'customerId', + label: '客户', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择客户', + allowClear: true, + showSearch: true, + api: getCustomerSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + }, + { + fieldName: 'warehouseId', + label: '仓库', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择仓库', + allowClear: true, + showSearch: true, + api: getWarehouseSimpleList, + labelField: 'name', + valueField: 'id', + filterOption: false, + }, + }, + { + fieldName: 'creator', + label: '创建人', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择创建人', + allowClear: true, + showSearch: true, + api: getSimpleUserList, + fieldNames: { + label: 'nickname', + value: 'id', + }, + }, + }, + { + fieldName: 'orderNo', + label: '关联订单', + component: 'Input', + componentProps: { + placeholder: '请输入关联订单号', + allowClear: true, + }, + }, + { + fieldName: 'refundStatus', + label: '退货状态', + component: 'Select', + componentProps: { + options: [ + { label: '未退货', value: 0 }, + { label: '部分退货', value: 1 }, + { label: '全部退货', value: 2 }, + ], + placeholder: '请选择退货状态', + allowClear: true, + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'Select', + componentProps: { + placeholder: '请选择状态', + allowClear: true, + options: getDictOptions(DICT_TYPE.ERP_AUDIT_STATUS, 'number'), + }, + }, + { + fieldName: 'remark', + label: '备注', + component: 'Input', + componentProps: { + placeholder: '请输入备注', + allowClear: true, + }, + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + type: 'checkbox', + width: 50, + fixed: 'left', + }, + { + field: 'no', + title: '退货单号', + width: 200, + fixed: 'left', + }, + { + field: 'productNames', + title: '产品信息', + showOverflow: 'tooltip', + minWidth: 120, + }, + { + field: 'customerName', + title: '客户', + minWidth: 120, + }, + { + field: 'returnTime', + title: '退货时间', + width: 160, + formatter: 'formatDate', + }, + { + field: 'creatorName', + title: '创建人', + minWidth: 120, + }, + { + field: 'totalCount', + title: '总数量', + minWidth: 120, + }, + { + field: 'totalPrice', + title: '应退金额', + formatter: 'formatNumber', + minWidth: 120, + }, + { + field: 'refundPrice', + title: '已退金额', + formatter: 'formatNumber', + minWidth: 120, + }, + { + field: 'unRefundPrice', + title: '未退金额', + formatter: ({ row }) => { + return `${erpNumberFormatter(row.totalPrice - row.refundPrice, 2)}元`; + }, + minWidth: 120, + }, + { + field: 'status', + title: '状态', + minWidth: 120, + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.ERP_AUDIT_STATUS }, + }, + }, + { + title: '操作', + minWidth: 250, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} +/** 列表的搜索表单 */ +export function useOrderGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'no', + label: '订单单号', + component: 'Input', + componentProps: { + placeholder: '请输入订单单号', + allowClear: true, + disabled: true, + }, + }, + { + fieldName: 'productId', + label: '产品', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择产品', + allowClear: true, + showSearch: true, + api: getProductSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + }, + { + fieldName: 'orderTime', + label: '订单时间', + component: 'RangePicker', + componentProps: { + placeholder: ['开始时间', '结束时间'], + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + }, + }, + ]; +} + +/** 列表的字段 */ +export function useOrderGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + type: 'radio', + width: 50, + fixed: 'left', + }, + { + field: 'no', + title: '订单单号', + width: 200, + fixed: 'left', + }, + { + field: 'productNames', + title: '产品信息', + showOverflow: 'tooltip', + minWidth: 120, + }, + { + field: 'customerName', + title: '客户', + minWidth: 120, + }, + { + field: 'orderTime', + title: '订单时间', + width: 160, + formatter: 'formatDate', + }, + { + field: 'creatorName', + title: '创建人', + minWidth: 120, + }, + { + field: 'totalCount', + title: '总数量', + minWidth: 120, + }, + { + field: 'returnCount', + title: '已退货数量', + minWidth: 120, + }, + { + field: 'totalProductPrice', + title: '金额合计', + formatter: 'formatNumber', + minWidth: 120, + }, + { + field: 'totalPrice', + title: '含税金额', + formatter: 'formatNumber', + minWidth: 120, + }, + ]; +} diff --git a/apps/web-antd/src/views/erp/sale/return/index.vue b/apps/web-antd/src/views/erp/sale/return/index.vue index a47959215..1cf8a6183 100644 --- a/apps/web-antd/src/views/erp/sale/return/index.vue +++ b/apps/web-antd/src/views/erp/sale/return/index.vue @@ -1,34 +1,239 @@ diff --git a/apps/web-antd/src/views/erp/sale/return/modules/sale-return-form.vue b/apps/web-antd/src/views/erp/sale/return/modules/sale-return-form.vue new file mode 100644 index 000000000..dae48a668 --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/return/modules/sale-return-form.vue @@ -0,0 +1,314 @@ + + + diff --git a/apps/web-antd/src/views/erp/sale/return/modules/sale-return-item-form.vue b/apps/web-antd/src/views/erp/sale/return/modules/sale-return-item-form.vue new file mode 100644 index 000000000..b2ce1adc4 --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/return/modules/sale-return-item-form.vue @@ -0,0 +1,255 @@ + + + diff --git a/apps/web-antd/src/views/erp/sale/return/modules/select-sale-order-form.vue b/apps/web-antd/src/views/erp/sale/return/modules/select-sale-order-form.vue new file mode 100644 index 000000000..2f435178f --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/return/modules/select-sale-order-form.vue @@ -0,0 +1,69 @@ + + + diff --git a/apps/web-antd/src/views/erp/sale/return/modules/select-sale-order-grid.vue b/apps/web-antd/src/views/erp/sale/return/modules/select-sale-order-grid.vue new file mode 100644 index 000000000..f690d368d --- /dev/null +++ b/apps/web-antd/src/views/erp/sale/return/modules/select-sale-order-grid.vue @@ -0,0 +1,54 @@ + + + -- Gitee From 4bd2e1d56e9283e31d248a2d603433ab73b50cce Mon Sep 17 00:00:00 2001 From: xuzhiqiang Date: Fri, 22 Aug 2025 15:52:30 +0800 Subject: [PATCH 11/12] =?UTF-8?q?feat(@vben/web-antd):=20erp-finance-accou?= =?UTF-8?q?nt=20=E6=96=B0=E5=A2=9E=E7=BB=93=E7=AE=97=E8=B4=A6=E6=88=B7?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=8C=85=E6=8B=AC?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E3=80=81=E5=88=97=E8=A1=A8=E5=8F=8A=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/erp/finance/account/data.ts | 167 ++++++++++++++++++ .../src/views/erp/finance/account/index.vue | 160 ++++++++++++++--- .../erp/finance/account/modules/form.vue | 86 +++++++++ 3 files changed, 392 insertions(+), 21 deletions(-) create mode 100644 apps/web-antd/src/views/erp/finance/account/data.ts create mode 100644 apps/web-antd/src/views/erp/finance/account/modules/form.vue diff --git a/apps/web-antd/src/views/erp/finance/account/data.ts b/apps/web-antd/src/views/erp/finance/account/data.ts new file mode 100644 index 000000000..dc11d945f --- /dev/null +++ b/apps/web-antd/src/views/erp/finance/account/data.ts @@ -0,0 +1,167 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; + +import { h } from 'vue'; + +import { Tag } from 'ant-design-vue'; + +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: 'name', + label: '名称', + rules: 'required', + componentProps: { + placeholder: '请输入名称', + }, + }, + { + fieldName: 'status', + label: '状态', + component: 'RadioGroup', + componentProps: { + options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'), + buttonStyle: 'solid', + optionType: 'button', + }, + rules: z.number().default(CommonStatusEnum.ENABLE), + }, + + { + fieldName: 'sort', + label: '排序', + component: 'InputNumber', + componentProps: { + placeholder: '请输入排序', + precision: 0, + class: 'w-full', + }, + rules: 'required', + defaultValue: 0, + }, + { + fieldName: 'defaultStatus', + label: '是否默认', + component: 'RadioGroup', + componentProps: { + options: [ + { + label: '是', + value: true, + }, + { + label: '否', + value: false, + }, + ], + buttonStyle: 'solid', + optionType: 'button', + }, + rules: z.boolean().default(false).optional(), + }, + { + fieldName: 'no', + label: '编码', + component: 'Input', + componentProps: { + placeholder: '请输入编码', + }, + }, + { + fieldName: 'remark', + label: '备注', + component: 'Textarea', + }, + ]; +} + +/** 列表的搜索表单 */ +export function useGridFormSchema(): VbenFormSchema[] { + return [ + { + fieldName: 'name', + label: '名称', + component: 'Input', + }, + { + fieldName: 'no', + label: '编码', + component: 'Input', + }, + { + fieldName: 'remark', + label: '备注', + component: 'Input', + }, + ]; +} + +/** 列表的字段 */ +export function useGridColumns(): VxeTableGridOptions['columns'] { + return [ + { + field: 'name', + title: '名称', + }, + { + field: 'no', + title: '编码', + }, + { + field: 'remark', + title: '备注', + }, + { + field: 'sort', + title: '排序', + }, + { + field: 'status', + title: '状态', + cellRender: { + name: 'CellDict', + props: { type: DICT_TYPE.COMMON_STATUS }, + }, + }, + { + field: 'defaultStatus', + title: '是否默认', + slots: { + default: ({ row }) => { + return h( + Tag, + { + class: 'mr-1', + color: row.defaultStatus ? 'blue' : 'red', + }, + () => (row.defaultStatus ? '是' : '否'), + ); + }, + }, + }, + { + field: 'createTime', + title: '创建时间', + formatter: 'formatDateTime', + }, + { + title: '操作', + width: 130, + fixed: 'right', + slots: { default: 'actions' }, + }, + ]; +} diff --git a/apps/web-antd/src/views/erp/finance/account/index.vue b/apps/web-antd/src/views/erp/finance/account/index.vue index c53233737..858ccbd4c 100644 --- a/apps/web-antd/src/views/erp/finance/account/index.vue +++ b/apps/web-antd/src/views/erp/finance/account/index.vue @@ -1,34 +1,152 @@ diff --git a/apps/web-antd/src/views/erp/finance/account/modules/form.vue b/apps/web-antd/src/views/erp/finance/account/modules/form.vue new file mode 100644 index 000000000..9adcff6d1 --- /dev/null +++ b/apps/web-antd/src/views/erp/finance/account/modules/form.vue @@ -0,0 +1,86 @@ + + + -- Gitee From efcfe2104fc33dc32dbcab9b7feb1490051a13c0 Mon Sep 17 00:00:00 2001 From: xuzhiqiang Date: Fri, 22 Aug 2025 17:17:20 +0800 Subject: [PATCH 12/12] =?UTF-8?q?fix(@vben/web-antd):=20erp=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E9=87=87=E8=B4=AD=E5=92=8C=E9=94=80=E5=94=AE=E9=80=80?= =?UTF-8?q?=E8=B4=A7=E8=A1=A8=E5=8D=95=EF=BC=8C=E4=BF=AE=E5=A4=8D=E5=85=B3?= =?UTF-8?q?=E8=81=94=E8=AE=A2=E5=8D=95=E9=80=89=E6=8B=A9=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E4=B8=8D=E7=BB=9F=E4=B8=80=E8=AF=A6=E7=BB=86=E5=8F=AF=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=90=8D=E7=A7=B0=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web-antd/src/views/erp/purchase/in/data.ts | 5 ++++- .../erp/purchase/in/modules/purchase-in-form.vue | 1 - .../in/modules/select-purchase-order-form.vue | 8 +++++++- .../src/views/erp/purchase/order/modules/form.vue | 13 ++----------- ...derItemForm.vue => purchase-order-item-form.vue} | 6 +++--- apps/web-antd/src/views/erp/purchase/return/data.ts | 4 ++++ .../return/modules/purchase-return-form.vue | 1 - .../return/modules/select-purchase-order-form.vue | 8 +++++++- .../views/erp/sale/out/modules/sale-out-form.vue | 1 - .../erp/sale/return/modules/sale-return-form.vue | 1 - 10 files changed, 27 insertions(+), 21 deletions(-) rename apps/web-antd/src/views/erp/purchase/order/modules/{PurchaseOrderItemForm.vue => purchase-order-item-form.vue} (98%) diff --git a/apps/web-antd/src/views/erp/purchase/in/data.ts b/apps/web-antd/src/views/erp/purchase/in/data.ts index 4c78a0d0a..28b74fa7e 100644 --- a/apps/web-antd/src/views/erp/purchase/in/data.ts +++ b/apps/web-antd/src/views/erp/purchase/in/data.ts @@ -56,7 +56,10 @@ export function useFormSchema(formType: string): VbenFormSchema[] { label: '关联订单', component: 'Input', formItemClass: 'col-span-1', - disabled: true, + componentProps: { + disabled: formType === 'detail', + placeholder: '请选择关联订单', + }, rules: 'required', }, { diff --git a/apps/web-antd/src/views/erp/purchase/in/modules/purchase-in-form.vue b/apps/web-antd/src/views/erp/purchase/in/modules/purchase-in-form.vue index b79514154..f86740fd9 100644 --- a/apps/web-antd/src/views/erp/purchase/in/modules/purchase-in-form.vue +++ b/apps/web-antd/src/views/erp/purchase/in/modules/purchase-in-form.vue @@ -303,7 +303,6 @@ defineExpose({ modalApi });