From 8064a77af2faf5bf080be0c4347a3a975225453b Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 14 七月 2026 15:38:12 +0800
Subject: [PATCH] 银川 1.物料管理页面批次属性功能联调 2.库存现有量添加自定义出库入库功能
---
src/views/basicData/mdm/data.ts | 177 +++++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 125 insertions(+), 52 deletions(-)
diff --git a/src/views/basicData/mdm/data.ts b/src/views/basicData/mdm/data.ts
index a809585..910564a 100644
--- a/src/views/basicData/mdm/data.ts
+++ b/src/views/basicData/mdm/data.ts
@@ -5,6 +5,7 @@
import { getDictOptions } from '#/packages/effects/hooks/src';
import { z } from '#/adapter/form';
+import { getUnitPage } from '#/api/mdm/unit';
/** 鐗╂枡绫诲瀷閫夐」 */
export const ITEM_TYPE_OPTIONS = [
@@ -13,6 +14,22 @@
{ label: '鎴愬搧', value: 3 },
{ label: '杈呮枡', value: 4 },
];
+
+/** 鐗╂枡绫诲瀷鏄犲皠 */
+export const ITEM_TYPE_MAP: Record<number, string> = {
+ 1: '鍘熸枡',
+ 2: '鍗婃垚鍝�',
+ 3: '鎴愬搧',
+ 4: '杈呮枡',
+};
+
+/** 鐗╂枡绫诲瀷棰滆壊鏄犲皠 */
+export const ITEM_TYPE_COLOR_MAP: Record<number, string> = {
+ 1: 'green',
+ 2: 'orange',
+ 3: 'blue',
+ 4: 'purple',
+};
/** 鏂板/淇敼鐨勮〃鍗� */
export function useFormSchema(): VbenFormSchema[] {
@@ -44,12 +61,15 @@
rules: 'required',
},
{
- component: 'Input',
- fieldName: 'barCode',
- label: '鏉$爜',
+ component: 'RadioGroup',
+ fieldName: 'itemType',
+ label: '鐗╂枡绫诲瀷',
componentProps: {
- placeholder: '璇疯緭鍏ユ潯鐮�',
+ options: ITEM_TYPE_OPTIONS,
+ buttonStyle: 'solid',
+ optionType: 'button',
},
+ rules: 'required',
},
{
component: 'Input',
@@ -60,47 +80,93 @@
},
},
{
- component: 'TreeSelect',
- fieldName: 'categoryId',
- label: '鐗╂枡鍒嗙被',
- componentProps: {
- placeholder: '璇烽�夋嫨鐗╂枡鍒嗙被',
- allowClear: true,
- treeData: [],
- fieldNames: { label: 'name', value: 'id', children: 'children' },
- },
- },
- {
- component: 'Select',
+ component: 'ApiSelect',
fieldName: 'unitMeasureId',
label: '璁¢噺鍗曚綅',
+ rules: 'required',
+ formItemClass: 'col-span-1',
componentProps: {
placeholder: '璇烽�夋嫨璁¢噺鍗曚綅',
allowClear: true,
- options: [],
- fieldNames: { label: 'name', value: 'id' },
+ api: async () => {
+ const res = await getUnitPage({ pageNo: 1, pageSize: 100, status: 0 });
+ return res.list || [];
+ },
+ labelField: 'name',
+ valueField: 'id',
},
},
{
- component: 'Select',
- fieldName: 'brandId',
- label: '鍝佺墝',
+ component: 'ApiSelect',
+ fieldName: 'unitMeasureId2',
+ label: '杈呭崟浣�1',
+ formItemClass: 'col-span-1',
componentProps: {
- placeholder: '璇烽�夋嫨鍝佺墝',
+ placeholder: '璇烽�夋嫨杈呭崟浣�1',
allowClear: true,
- options: [],
- fieldNames: { label: 'name', value: 'id' },
+ api: async () => {
+ const res = await getUnitPage({ pageNo: 1, pageSize: 100, status: 0 });
+ return res.list || [];
+ },
+ labelField: 'name',
+ valueField: 'id',
},
},
{
- component: 'Select',
- fieldName: 'itemType',
- label: '鐗╂枡绫诲瀷',
+ component: 'InputNumber',
+ fieldName: 'unitMeasureRate1',
+ label: '杈呭崟浣�1鎹㈢畻姣旂巼',
+ formItemClass: 'col-span-1',
componentProps: {
- placeholder: '璇烽�夋嫨鐗╂枡绫诲瀷',
- options: ITEM_TYPE_OPTIONS,
+ class: '!w-full',
+ min: 0,
+ precision: 6,
+ placeholder: '璇疯緭鍏ユ崲绠楁瘮鐜�',
},
- rules: 'required',
+ },
+ {
+ component: 'ApiSelect',
+ fieldName: 'unitMeasureId3',
+ label: '杈呭崟浣�2',
+ formItemClass: 'col-span-1',
+ componentProps: {
+ placeholder: '璇烽�夋嫨杈呭崟浣�2',
+ allowClear: true,
+ api: async () => {
+ const res = await getUnitPage({ pageNo: 1, pageSize: 100, status: 0 });
+ return res.list || [];
+ },
+ labelField: 'name',
+ valueField: 'id',
+ },
+ },
+ {
+ component: 'InputNumber',
+ fieldName: 'unitMeasureRate2',
+ label: '杈呭崟浣�2鎹㈢畻姣旂巼',
+ formItemClass: 'col-span-1',
+ componentProps: {
+ class: '!w-full',
+ min: 0,
+ precision: 6,
+ placeholder: '璇疯緭鍏ユ崲绠楁瘮鐜�',
+ },
+ },
+ {
+ component: 'Input',
+ fieldName: 'warehouseId',
+ label: '榛樿浠撳簱',
+ componentProps: {
+ placeholder: '璇疯緭鍏ラ粯璁や粨搴揑D',
+ },
+ },
+ {
+ component: 'Input',
+ fieldName: 'barCode',
+ label: '鏉$爜',
+ componentProps: {
+ placeholder: '璇疯緭鍏ユ潯鐮�',
+ },
},
{
component: 'InputNumber',
@@ -172,12 +238,13 @@
component: 'Switch',
fieldName: 'isBatchManaged',
label: '鎵规绠$悊',
+ defaultValue: true,
componentProps: {
class: 'w-auto',
checkedChildren: '鏄�',
unCheckedChildren: '鍚�',
},
- rules: z.boolean().default(false),
+ rules: z.boolean().default(true),
},
{
component: 'InputNumber',
@@ -235,17 +302,6 @@
},
},
{
- fieldName: 'categoryId',
- label: '鐗╂枡鍒嗙被',
- component: 'TreeSelect',
- componentProps: {
- placeholder: '璇烽�夋嫨鐗╂枡鍒嗙被',
- allowClear: true,
- treeData: [],
- fieldNames: { label: 'name', value: 'id', children: 'children' },
- },
- },
- {
fieldName: 'itemType',
label: '鐗╂枡绫诲瀷',
component: 'Select',
@@ -288,23 +344,40 @@
minWidth: 150,
},
{
- field: 'categoryName',
- title: '鍒嗙被',
- minWidth: 100,
- },
- {
field: 'unitMeasureName',
title: '鍗曚綅',
minWidth: 80,
},
{
+ field: 'unitMeasureName2',
+ title: '杈呭崟浣�1',
+ minWidth: 80,
+ },
+ {
+ field: 'unitMeasureRate1',
+ title: '杈呭崟浣�1鎹㈢畻姣旂巼',
+ minWidth: 130,
+ },
+ {
+ field: 'unitMeasureName3',
+ title: '杈呭崟浣�2',
+ minWidth: 80,
+ },
+ {
+ field: 'unitMeasureRate2',
+ title: '杈呭崟浣�2鎹㈢畻姣旂巼',
+ minWidth: 130,
+ },
+ {
+ field: 'warehouseName',
+ title: '榛樿浠撳簱',
+ minWidth: 100,
+ },
+ {
field: 'itemType',
title: '鐗╂枡绫诲瀷',
minWidth: 100,
- cellRender: {
- name: 'CellDict',
- props: { type: DICT_TYPE.MDM_ITEM_TYPE },
- },
+ slots: { default: 'itemType' },
},
{
field: 'purchasePrice',
@@ -350,4 +423,4 @@
slots: { default: 'actions' },
},
];
-}
+}
\ No newline at end of file
--
Gitblit v1.9.3