From 510ec125824c3949821648718deced0ba4f6c0fd Mon Sep 17 00:00:00 2001 From: nehc <934298133@qq.com> Date: Thu, 31 Jul 2025 17:20:09 +0800 Subject: [PATCH] =?UTF-8?q?feat(@vben/web-antd):=20erp-stock-in=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=85=B6=E5=AE=83=E5=85=A5=E5=BA=93=E5=8D=95?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增其它入库单列表页面 - 实现其它入库单的创建、编辑和删除功能 - 添加产品清单管理功能 - 集成供应商、产品和仓库的选择接口 - 优化表格展示和搜索功能 --- apps/web-antd/src/api/erp/stock/in/index.ts | 23 +- .../web-antd/src/api/erp/stock/stock/index.ts | 8 +- apps/web-antd/src/views/erp/stock/in/data.ts | 338 ++++++++++++++++ .../web-antd/src/views/erp/stock/in/index.vue | 203 +++++++++- .../erp/stock/in/modules/StockInItemForm.vue | 368 ++++++++++++++++++ .../src/views/erp/stock/in/modules/form.vue | 252 ++++++++++++ 6 files changed, 1168 insertions(+), 24 deletions(-) create mode 100644 apps/web-antd/src/views/erp/stock/in/data.ts create mode 100644 apps/web-antd/src/views/erp/stock/in/modules/StockInItemForm.vue create mode 100644 apps/web-antd/src/views/erp/stock/in/modules/form.vue diff --git a/apps/web-antd/src/api/erp/stock/in/index.ts b/apps/web-antd/src/api/erp/stock/in/index.ts index 119398bc3..8fe9bafd4 100644 --- a/apps/web-antd/src/api/erp/stock/in/index.ts +++ b/apps/web-antd/src/api/erp/stock/in/index.ts @@ -2,17 +2,38 @@ import type { PageParam, PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; -namespace ErpStockInApi { +export namespace ErpStockInApi { /** 其它入库单信息 */ export interface StockIn { id?: number; // 入库编号 no: string; // 入库单号 supplierId: number; // 供应商编号 + supplierName?: string; // 供应商名称 inTime: Date; // 入库时间 totalCount: number; // 合计数量 totalPrice: number; // 合计金额,单位:元 status: number; // 状态 remark: string; // 备注 + fileUrl?: string; // 附件 + productNames?: string; // 产品信息 + creatorName?: string; // 创建人 + items?: StockInItem[]; // 入库产品清单 + } + + /** 其它入库单产品信息 */ + export interface StockInItem { + 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/api/erp/stock/stock/index.ts b/apps/web-antd/src/api/erp/stock/stock/index.ts index fa4cfaddb..3ef12dff6 100644 --- a/apps/web-antd/src/api/erp/stock/stock/index.ts +++ b/apps/web-antd/src/api/erp/stock/stock/index.ts @@ -54,9 +54,13 @@ export function getStockByProductAndWarehouse( /** * 获得产品库存数量 */ -export function getStockCount(productId: number) { +export function getStockCount(productId: number, warehouseId?: number) { + const params: any = { productId }; + if (warehouseId !== undefined) { + params.warehouseId = warehouseId; + } return requestClient.get('/erp/stock/get-count', { - params: { productId }, + params, }); } diff --git a/apps/web-antd/src/views/erp/stock/in/data.ts b/apps/web-antd/src/views/erp/stock/in/data.ts new file mode 100644 index 000000000..2086066ff --- /dev/null +++ b/apps/web-antd/src/views/erp/stock/in/data.ts @@ -0,0 +1,338 @@ +import type { VbenFormSchema } from '#/adapter/form'; +import type { VxeTableGridOptions } from '#/adapter/vxe-table'; + +import { erpPriceInputFormatter } from '@vben/utils'; + +import { getSupplierSimpleList } from '#/api/erp/purchase/supplier'; +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: 'ApiSelect', + componentProps: { + placeholder: '请选择供应商', + allowClear: true, + showSearch: true, + api: getSupplierSimpleList, + fieldNames: { + label: 'name', + value: 'id', + }, + }, + fieldName: 'supplierId', + label: '供应商', + }, + { + component: 'DatePicker', + componentProps: { + placeholder: '选择入库时间', + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'x', + style: { width: '100%' }, + }, + fieldName: 'inTime', + label: '入库时间', + rules: 'required', + }, + { + component: 'Textarea', + componentProps: { + placeholder: '请输入备注', + autoSize: { minRows: 2, maxRows: 4 }, + class: 'w-full', + }, + fieldName: 'remark', + label: '备注', + formItemClass: 'col-span-3', + }, + { + 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: '合计数量', + precision: 2, + disabled: true, + style: { width: '100%' }, + }, + fieldName: 'totalCount', + label: '合计数量', + }, + { + component: 'InputNumber', + componentProps: { + placeholder: '合计金额', + precision: 2, + formatter: erpPriceInputFormatter, + disabled: true, + style: { width: '100%' }, + }, + fieldName: 'totalPrice', + label: '合计金额', + }, + ]; +} + +/** 入库产品清单表格列定义 */ +export function useStockInItemTableColumns(): VxeTableGridOptions['columns'] { + return [ + { type: 'seq', title: '序号', minWidth: 50, fixed: 'left' }, + { + field: 'warehouseId', + title: '仓库名称', + minWidth: 150, + slots: { default: 'warehouseId' }, + }, + { + field: 'productId', + title: '产品名称', + minWidth: 200, + slots: { default: 'productId' }, + }, + { + field: 'stockCount', + title: '库存', + minWidth: 100, + }, + { + 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: '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: 'supplierId', + label: '供应商', + component: 'ApiSelect', + componentProps: { + placeholder: '请选择供应商', + allowClear: true, + showSearch: true, + api: getSupplierSimpleList, + labelField: 'name', + valueField: 'id', + filterOption: false, + }, + }, + { + fieldName: 'inTime', + label: '入库时间', + component: 'RangePicker', + componentProps: { + placeholder: ['开始日期', '结束日期'], + showTime: true, + format: 'YYYY-MM-DD HH:mm:ss', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + }, + }, + { + 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: 'supplierName', + title: '供应商', + width: 120, + }, + { + field: 'inTime', + title: '入库时间', + width: 180, + cellRender: { + name: 'CellDateTime', + }, + }, + { + field: 'creatorName', + title: '创建人', + width: 100, + }, + { + field: 'totalCount', + title: '数量', + width: 100, + cellRender: { + name: 'CellAmount', + props: { + digits: 2, + }, + }, + }, + { + field: 'totalPrice', + title: '金额', + width: 120, + cellRender: { + name: 'CellAmount', + props: { + digits: 2, + }, + }, + }, + { + field: 'status', + title: '状态', + width: 90, + fixed: 'right', + 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/stock/in/index.vue b/apps/web-antd/src/views/erp/stock/in/index.vue index ae06852cb..641c4347d 100644 --- a/apps/web-antd/src/views/erp/stock/in/index.vue +++ b/apps/web-antd/src/views/erp/stock/in/index.vue @@ -1,34 +1,195 @@ diff --git a/apps/web-antd/src/views/erp/stock/in/modules/StockInItemForm.vue b/apps/web-antd/src/views/erp/stock/in/modules/StockInItemForm.vue new file mode 100644 index 000000000..d2ba3f195 --- /dev/null +++ b/apps/web-antd/src/views/erp/stock/in/modules/StockInItemForm.vue @@ -0,0 +1,368 @@ + + + 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 new file mode 100644 index 000000000..108ef2600 --- /dev/null +++ b/apps/web-antd/src/views/erp/stock/in/modules/form.vue @@ -0,0 +1,252 @@ + + +