From 08b86cccfc8227ab065ee913f809609ef708486d Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期五, 21 八月 2026 09:59:21 +0800
Subject: [PATCH] 物料管理/物料分类/计量单位增加 Excel 导入功能
---
src/views/basicData/mdm/unit/data.ts | 91 ++++++++++++---------------------------------
1 files changed, 24 insertions(+), 67 deletions(-)
diff --git a/src/views/basicData/mdm/unit/data.ts b/src/views/basicData/mdm/unit/data.ts
index e6081e4..6e15fe9 100644
--- a/src/views/basicData/mdm/unit/data.ts
+++ b/src/views/basicData/mdm/unit/data.ts
@@ -5,7 +5,6 @@
import { getDictOptions } from '#/packages/effects/hooks/src';
import { z } from '#/adapter/form';
-import { getUnitPage } from '#/api/mdm/unit';
/** 鏂板/淇敼鐨勮〃鍗� */
export function useFormSchema(): VbenFormSchema[] {
@@ -34,61 +33,6 @@
rules: 'required',
componentProps: {
placeholder: '璇疯緭鍏ュ崟浣嶅悕绉�',
- },
- },
- {
- component: 'Switch',
- fieldName: 'primaryFlag',
- label: '鏄惁涓诲崟浣�',
- componentProps: {
- class: 'w-auto',
- checkedChildren: '鏄�',
- unCheckedChildren: '鍚�',
- },
- rules: z.boolean().default(false),
- },
- {
- component: 'ApiSelect',
- fieldName: 'primaryId',
- label: '涓诲崟浣�',
- dependencies: {
- triggerFields: ['primaryFlag'],
- show: (values) => {
- return values.primaryFlag === false;
- },
- required: (values) => {
- return values.primaryFlag === false;
- },
- },
- componentProps: {
- placeholder: '璇烽�夋嫨涓诲崟浣�',
- allowClear: true,
- api: async () => {
- const res = await getUnitPage({ pageNo: 1, pageSize: 100, primaryFlag: true, status: 0 });
- return res.list || [];
- },
- labelField: 'name',
- valueField: 'id',
- },
- },
- {
- component: 'InputNumber',
- fieldName: 'changeRate',
- label: '鎹㈢畻姣斾緥',
- dependencies: {
- triggerFields: ['primaryFlag'],
- show: (values) => {
- return values.primaryFlag === false;
- },
- required: (values) => {
- return values.primaryFlag === false;
- },
- },
- componentProps: {
- class: '!w-full',
- min: 0,
- precision: 4,
- placeholder: '璇疯緭鍏ユ崲绠楁瘮渚�',
},
},
{
@@ -163,17 +107,6 @@
minWidth: 150,
},
{
- field: 'primaryFlag',
- title: '涓诲崟浣�',
- minWidth: 80,
- slots: { default: 'primaryFlag' },
- },
- {
- field: 'changeRate',
- title: '鎹㈢畻姣斾緥',
- minWidth: 100,
- },
- {
field: 'status',
title: '鐘舵��',
minWidth: 80,
@@ -195,4 +128,28 @@
slots: { default: 'actions' },
},
];
+}
+
+/** 璁¢噺鍗曚綅瀵煎叆鐨勮〃鍗� */
+export function useImportFormSchema(): VbenFormSchema[] {
+ return [
+ {
+ fieldName: 'file',
+ label: '鍗曚綅鏁版嵁',
+ component: 'Upload',
+ rules: 'required',
+ help: '浠呭厑璁稿鍏� xls銆亁lsx 鏍煎紡鏂囦欢',
+ },
+ {
+ fieldName: 'updateSupport',
+ label: '鏄惁瑕嗙洊',
+ component: 'Switch',
+ componentProps: {
+ checkedChildren: '鏄�',
+ unCheckedChildren: '鍚�',
+ },
+ rules: z.boolean().default(false),
+ help: '鏄惁鏇存柊宸茬粡瀛樺湪鐨勫崟浣嶆暟鎹�',
+ },
+ ];
}
\ No newline at end of file
--
Gitblit v1.9.3