diff --git a/inventory-web/src/views/material/list.vue b/inventory-web/src/views/material/list.vue
index c53afc3..03464a0 100644
--- a/inventory-web/src/views/material/list.vue
+++ b/inventory-web/src/views/material/list.vue
@@ -14,7 +14,7 @@
-
+
@@ -182,7 +182,7 @@
-
+
@@ -222,7 +222,7 @@
-
+
{{ scope.row.commonName }}
-
@@ -390,7 +390,7 @@
-
+
@@ -743,7 +743,7 @@ const fieldOptions = computed(() => {
const allFields = [
{ value: 'companyName', label: '所属公司', perm: 'material_list:companyName' },
{ value: 'name', label: '名称', perm: 'material_list:name' },
- { value: 'commonName', label: '俗名', perm: 'material_list:commonName' },
+ { value: 'commonName', label: '出厂名称', perm: 'material_list:commonName' },
{ value: 'category', label: '类别', perm: 'material_list:category' },
{ value: 'type', label: '类型', perm: 'material_list:type' },
{ value: 'spec', label: '规格型号', perm: 'material_list:spec' },
diff --git a/inventory-web/src/views/stock/inbound/buy.vue b/inventory-web/src/views/stock/inbound/buy.vue
index b260efd..ff06b50 100644
--- a/inventory-web/src/views/stock/inbound/buy.vue
+++ b/inventory-web/src/views/stock/inbound/buy.vue
@@ -48,17 +48,17 @@
-
-
-
+ />
([])
const typeOptions = ref([])
const companyOptions = ref([])
+const categoryTreeOptions = ref<{ value: string; label: string; children?: any[] }[]>([])
+
+// 用于搜索栏级联选择器的数据绑定中转:数组 <-> 以 "/" 拼接的字符串
+const searchCategoryPath = computed({
+ get() {
+ return queryParams.category ? queryParams.category.split('/') : [];
+ },
+ set(val: string[] | null) {
+ queryParams.category = val && val.length > 0 ? val.join('/') : '';
+ }
+});
const queryParams = reactive({
page: 1,
@@ -1383,6 +1394,7 @@ const fetchOptions = async () => {
const res: any = await getFilterOptions()
if (res.code === 200) {
categoryOptions.value = res.data.categories
+ categoryTreeOptions.value = buildCategoryTree(res.data.categories || [])
typeOptions.value = res.data.types
companyOptions.value = res.data.companies
}
@@ -1391,6 +1403,30 @@ const fetchOptions = async () => {
}
}
+// 将 "IRIS/半成品/无人机" 之类的字符串数组构建为级联树
+const buildCategoryTree = (categories: string[]) => {
+ const root: { value: string; label: string; children?: any[] }[] = [];
+ categories.forEach((cat: string) => {
+ if (!cat) return;
+ const parts = cat.split('/');
+ let currentLevel = root;
+ parts.forEach((part, index) => {
+ let existingNode = currentLevel.find(n => n.value === part);
+ if (!existingNode) {
+ existingNode = { value: part, label: part };
+ currentLevel.push(existingNode);
+ }
+ if (index < parts.length - 1) {
+ if (!existingNode.children) {
+ existingNode.children = [];
+ }
+ currentLevel = existingNode.children as any[];
+ }
+ });
+ });
+ return root;
+};
+
// 加载库位树数据
const loadWarehouseTree = async () => {
try {
diff --git a/inventory-web/src/views/stock/inbound/product.vue b/inventory-web/src/views/stock/inbound/product.vue
index 48b2d9d..166d7b4 100644
--- a/inventory-web/src/views/stock/inbound/product.vue
+++ b/inventory-web/src/views/stock/inbound/product.vue
@@ -47,17 +47,17 @@
-
-
-
+ />
([])
+const categoryTreeOptions = ref<{ value: string; label: string; children?: any[] }[]>([])
+
+// 用于搜索栏级联选择器的数据绑定中转:数组 <-> 以 "/" 拼接的字符串
+const searchCategoryPath = computed({
+ get() {
+ return queryParams.category ? queryParams.category.split('/') : [];
+ },
+ set(val: string[] | null) {
+ queryParams.category = val && val.length > 0 ? val.join('/') : '';
+ }
+});
+
const typeOptions = ref([])
const companyOptions = ref([]) // [新增]
const advancedFilterVisible = ref(false)
@@ -1157,6 +1169,7 @@ const fetchOptions = async () => {
const res: any = await getFilterOptions()
if (res.code === 200) {
categoryOptions.value = res.data.categories
+ categoryTreeOptions.value = buildCategoryTree(res.data.categories || [])
typeOptions.value = res.data.types
companyOptions.value = res.data.companies // [新增]
}
@@ -1165,6 +1178,30 @@ const fetchOptions = async () => {
}
}
+// 将 "IRIS/半成品/无人机" 之类的字符串数组构建为级联树
+const buildCategoryTree = (categories: string[]) => {
+ const root: { value: string; label: string; children?: any[] }[] = [];
+ categories.forEach((cat: string) => {
+ if (!cat) return;
+ const parts = cat.split('/');
+ let currentLevel = root;
+ parts.forEach((part, index) => {
+ let existingNode = currentLevel.find(n => n.value === part);
+ if (!existingNode) {
+ existingNode = { value: part, label: part };
+ currentLevel.push(existingNode);
+ }
+ if (index < parts.length - 1) {
+ if (!existingNode.children) {
+ existingNode.children = [];
+ }
+ currentLevel = existingNode.children as any[];
+ }
+ });
+ });
+ return root;
+};
+
// 加载库位树数据
const loadWarehouseTree = async () => {
try {
diff --git a/inventory-web/src/views/stock/inbound/semi.vue b/inventory-web/src/views/stock/inbound/semi.vue
index 459bb21..12f3008 100644
--- a/inventory-web/src/views/stock/inbound/semi.vue
+++ b/inventory-web/src/views/stock/inbound/semi.vue
@@ -48,17 +48,17 @@
-
-
-
+ />
([])
+const categoryTreeOptions = ref<{ value: string; label: string; children?: any[] }[]>([])
+
+// 用于搜索栏级联选择器的数据绑定中转:数组 <-> 以 "/" 拼接的字符串
+const searchCategoryPath = computed({
+ get() {
+ return queryParams.category ? queryParams.category.split('/') : [];
+ },
+ set(val: string[] | null) {
+ queryParams.category = val && val.length > 0 ? val.join('/') : '';
+ }
+});
+
const typeOptions = ref([])
const companyOptions = ref([]) // [新增]
const advancedFilterVisible = ref(false)
@@ -1248,6 +1260,7 @@ const fetchOptions = async () => {
const res: any = await getFilterOptions()
if (res.code === 200) {
categoryOptions.value = res.data.categories
+ categoryTreeOptions.value = buildCategoryTree(res.data.categories || [])
typeOptions.value = res.data.types
companyOptions.value = res.data.companies // [新增]
}
@@ -1256,6 +1269,30 @@ const fetchOptions = async () => {
}
}
+// 将 "IRIS/半成品/无人机" 之类的字符串数组构建为级联树
+const buildCategoryTree = (categories: string[]) => {
+ const root: { value: string; label: string; children?: any[] }[] = [];
+ categories.forEach((cat: string) => {
+ if (!cat) return;
+ const parts = cat.split('/');
+ let currentLevel = root;
+ parts.forEach((part, index) => {
+ let existingNode = currentLevel.find(n => n.value === part);
+ if (!existingNode) {
+ existingNode = { value: part, label: part };
+ currentLevel.push(existingNode);
+ }
+ if (index < parts.length - 1) {
+ if (!existingNode.children) {
+ existingNode.children = [];
+ }
+ currentLevel = existingNode.children as any[];
+ }
+ });
+ });
+ return root;
+};
+
// 加载库位树数据
const loadWarehouseTree = async () => {
try {