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();
}
};