From 5783abee4e8c6ba1fc525545cf2a41ffe3e01926 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期五, 10 七月 2026 16:59:40 +0800
Subject: [PATCH] 物料产品选择勾选问题
---
src/views/basicData/mdm/data.ts | 181 ++++++++++++++++++++++++++++++++-------------
1 files changed, 129 insertions(+), 52 deletions(-)
diff --git a/src/views/basicData/mdm/data.ts b/src/views/basicData/mdm/data.ts
index a809585..479f150 100644
--- a/src/views/basicData/mdm/data.ts
+++ b/src/views/basicData/mdm/data.ts
@@ -5,6 +5,8 @@
import { getDictOptions } from '#/packages/effects/hooks/src';
import { z } from '#/adapter/form';
+import { getUnitPage } from '#/api/mdm/unit';
+import { getWarehouseSimpleList } from '#/api/erp/stock/warehouse';
/** 鐗╂枡绫诲瀷閫夐」 */
export const ITEM_TYPE_OPTIONS = [
@@ -13,6 +15,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 +62,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 +81,97 @@
},
},
{
- 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: 'ApiSelect',
+ fieldName: 'warehouseId',
+ label: '榛樿浠撳簱',
+ componentProps: {
+ placeholder: '璇烽�夋嫨榛樿浠撳簱',
+ allowClear: true,
+ api: getWarehouseSimpleList,
+ labelField: 'name',
+ valueField: 'id',
+ },
+ },
+ {
+ component: 'Input',
+ fieldName: 'barCode',
+ label: '鏉$爜',
+ componentProps: {
+ placeholder: '璇疯緭鍏ユ潯鐮�',
+ },
},
{
component: 'InputNumber',
@@ -177,7 +248,7 @@
checkedChildren: '鏄�',
unCheckedChildren: '鍚�',
},
- rules: z.boolean().default(false),
+ rules: z.boolean().default(true),
},
{
component: 'InputNumber',
@@ -235,17 +306,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 +348,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 +427,4 @@
slots: { default: 'actions' },
},
];
-}
+}
\ No newline at end of file
--
Gitblit v1.9.3