From 5334be0cfa7f0376e985918edbc823be5113918c Mon Sep 17 00:00:00 2001 From: dxc Date: Tue, 21 Apr 2026 16:33:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E7=A1=80=E4=BF=A1=E6=81=AF=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E9=92=88=E5=AF=B9=E4=BA=8E=E7=B1=BB=E5=88=AB=E5=88=A0?= =?UTF-8?q?=E9=99=A44=E5=B1=82=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inventory-web/src/views/material/list.vue | 29 +++++++++++------------ 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/inventory-web/src/views/material/list.vue b/inventory-web/src/views/material/list.vue index 30b8f2f..eee1deb 100644 --- a/inventory-web/src/views/material/list.vue +++ b/inventory-web/src/views/material/list.vue @@ -361,6 +361,7 @@
/
-
- * 必须构成4层结构 -
+
@@ -842,6 +842,16 @@ const categoryOptions = ref([]); const typeOptions = ref([]); const categoryTreeOptions = ref([]); +// 类别级联选择器的 ref +const categoryCascaderRef = ref(null); + +// 选中类别后自动收起下拉面板 +const onCategoryChange = () => { + if (categoryCascaderRef.value) { + categoryCascaderRef.value.togglePopperVisible(false); + } +}; + const tempCategoryPrefix = ref([]); const tempCategorySuffix = ref(''); @@ -891,19 +901,8 @@ const validateCategoryLevel = (rule: any, value: any, callback: any) => { if (!prefixStr && !suffixStr) { callback(new Error('请填写或选择类别')); - return; - } - - let fullPath = ''; - if (prefixStr && suffixStr) fullPath = prefixStr + '/' + suffixStr; - else if (prefixStr) fullPath = prefixStr; - else fullPath = suffixStr; - - const levels = fullPath.split('/').filter(p => p.trim() !== '').length; - - if (levels !== 4) { - callback(new Error(`必须严格满足4层结构,当前为 ${levels} 层`)); } else { + // 只要有前缀或后缀,就直接放行,不再限制必须是4层 callback(); } };