From c9f0a69f8e7007fd94371a0cc8c1363f8cae1734 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=87=E7=9D=BF=20=E5=BC=A0?= Date: Wed, 23 Sep 2026 14:53:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=81=9C=E7=94=A8=E6=98=BE=E7=A4=BA=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/Materials.vue | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/Materials.vue b/frontend/src/views/Materials.vue index 40052798..eb5b8327 100644 --- a/frontend/src/views/Materials.vue +++ b/frontend/src/views/Materials.vue @@ -93,7 +93,7 @@ - + @@ -219,6 +219,11 @@ function categoryLabel(category, withCode = false) { return category.status === 'active' ? name : `${name}(已停用)` } +function minorCategoryLabel(category, majorId) { + const major = categories.value.find(item => item.id === majorId) + return major && major.status !== 'active' ? category.name : categoryLabel(category) +} + function handleImageUpload(e) { const file = e.target.files[0] if (file) { @@ -293,12 +298,13 @@ function markCodeEdited() { function getMajorCategoryDisplay(row) { const { major } = resolveCategoryPath(categories.value, row.category_id) - if (major) return `${major.code} ${major.name}` + if (major) return categoryLabel(major, true) return materialsStore.getCategoryDisplay(row.category) } function getMinorCategoryDisplay(row) { - return resolveCategoryPath(categories.value, row.category_id).minor?.name || '-' + const { major, minor } = resolveCategoryPath(categories.value, row.category_id) + return minor ? minorCategoryLabel(minor, major?.id) : '-' } function syncUnit(id) {