From 8d660404dcb6fe552c9f13c16d7d0b76e0606508 Mon Sep 17 00:00:00 2001
From: nehc <934298133@qq.com>
Date: Thu, 31 Jul 2025 13:43:47 +0800
Subject: [PATCH] =?UTF-8?q?feat(@vben/web-antd):=20erp-stock-stock=20?=
=?UTF-8?q?=E5=AE=9E=E7=8E=B0=E4=BA=A7=E5=93=81=E5=BA=93=E5=AD=98=E7=AE=A1?=
=?UTF-8?q?=E7=90=86=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 新增产品库存管理页面,包括库存列表和搜索功能
- 添加导出库存数据功能
- 集成 API 接口和数据处理逻辑
- 优化页面布局和组件使用
---
.../web-antd/src/api/erp/stock/stock/index.ts | 2 +-
.../src/views/erp/stock/stock/data.ts | 76 +++++++++++++++
.../src/views/erp/stock/stock/index.vue | 96 ++++++++++++++-----
3 files changed, 148 insertions(+), 26 deletions(-)
create mode 100644 apps/web-antd/src/views/erp/stock/stock/data.ts
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 57d4ec229..fa4cfaddb 100644
--- a/apps/web-antd/src/api/erp/stock/stock/index.ts
+++ b/apps/web-antd/src/api/erp/stock/stock/index.ts
@@ -2,7 +2,7 @@ import type { PageParam, PageResult } from '@vben/request';
import { requestClient } from '#/api/request';
-namespace ErpStockApi {
+export namespace ErpStockApi {
/** 产品库存信息 */
export interface Stock {
id?: number; // 编号
diff --git a/apps/web-antd/src/views/erp/stock/stock/data.ts b/apps/web-antd/src/views/erp/stock/stock/data.ts
new file mode 100644
index 000000000..4d0e52b7e
--- /dev/null
+++ b/apps/web-antd/src/views/erp/stock/stock/data.ts
@@ -0,0 +1,76 @@
+import type { VbenFormSchema } from '#/adapter/form';
+import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+
+import { getProductSimpleList } from '#/api/erp/product/product';
+import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse';
+
+/** 搜索表单 */
+export function useGridFormSchema(): VbenFormSchema[] {
+ return [
+ {
+ fieldName: 'productId',
+ label: '产品',
+ component: 'ApiSelect',
+ componentProps: {
+ placeholder: '请选择产品',
+ allowClear: true,
+ showSearch: true,
+ api: getProductSimpleList,
+ labelField: 'name',
+ valueField: 'id',
+ filterOption: false,
+ },
+ },
+ {
+ fieldName: 'warehouseId',
+ label: '仓库',
+ component: 'ApiSelect',
+ componentProps: {
+ placeholder: '请选择仓库',
+ allowClear: true,
+ showSearch: true,
+ api: getWarehouseSimpleList,
+ labelField: 'name',
+ valueField: 'id',
+ filterOption: false,
+ },
+ },
+ ];
+}
+
+/** 列表的字段 */
+export function useGridColumns(): VxeTableGridOptions['columns'] {
+ return [
+ {
+ field: 'productName',
+ title: '产品名称',
+ minWidth: 150,
+ },
+ {
+ field: 'unitName',
+ title: '产品单位',
+ minWidth: 100,
+ },
+ {
+ field: 'categoryName',
+ title: '产品分类',
+ minWidth: 120,
+ },
+ {
+ field: 'count',
+ title: '库存量',
+ minWidth: 100,
+ cellRender: {
+ name: 'CellAmount',
+ props: {
+ digits: 2,
+ },
+ },
+ },
+ {
+ field: 'warehouseName',
+ title: '仓库',
+ minWidth: 120,
+ },
+ ];
+}
diff --git a/apps/web-antd/src/views/erp/stock/stock/index.vue b/apps/web-antd/src/views/erp/stock/stock/index.vue
index 04305f885..8cd51e59c 100644
--- a/apps/web-antd/src/views/erp/stock/stock/index.vue
+++ b/apps/web-antd/src/views/erp/stock/stock/index.vue
@@ -1,32 +1,78 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+