停用显示修复
This commit is contained in:
parent
048b62766b
commit
c9f0a69f8e
|
|
@ -93,7 +93,7 @@
|
|||
</el-form-item>
|
||||
<el-form-item label="小类类型" required>
|
||||
<el-select v-model="form.category_id" :disabled="!form.major_category_id" style="width: 100%" @change="syncCategory">
|
||||
<el-option v-for="category in minorCategories" :key="category.id" :label="categoryLabel(category)" :value="category.id" :disabled="category.status !== 'active'" />
|
||||
<el-option v-for="category in minorCategories" :key="category.id" :label="minorCategoryLabel(category, form.major_category_id)" :value="category.id" :disabled="category.status !== 'active'" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="单位">
|
||||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user