|
|
@@ -339,9 +339,9 @@
|
|
|
</el-form-item>
|
|
|
|
|
|
<!-- 分类编码 -->
|
|
|
- <el-form-item label="分类编码" prop="code" required>
|
|
|
+ <!-- <el-form-item label="分类编码" prop="code" required>
|
|
|
<el-input v-model="categoryForm.code" placeholder="请输入分类编码(英文大写)" />
|
|
|
- </el-form-item>
|
|
|
+ </el-form-item> -->
|
|
|
|
|
|
<!-- 父级分类 -->
|
|
|
<el-form-item label="父级分类" prop="parentId">
|
|
|
@@ -362,7 +362,7 @@
|
|
|
</el-form-item>
|
|
|
|
|
|
<!-- 分类类型 -->
|
|
|
- <el-form-item label="分类类型" prop="type" required>
|
|
|
+ <!-- <el-form-item label="分类类型" prop="type" required>
|
|
|
<el-select v-model="categoryForm.type" placeholder="请选择分类类型" style="width: 100%">
|
|
|
<el-option label="图片文件" :value="1" />
|
|
|
<el-option label="视频文件" :value="2" />
|
|
|
@@ -370,7 +370,7 @@
|
|
|
<el-option label="文档文件" :value="4" />
|
|
|
<el-option label="其他文件" :value="5" />
|
|
|
</el-select>
|
|
|
- </el-form-item>
|
|
|
+ </el-form-item> -->
|
|
|
|
|
|
<!-- 排序 -->
|
|
|
<el-form-item label="排序" prop="sort">
|
|
|
@@ -378,9 +378,9 @@
|
|
|
</el-form-item>
|
|
|
|
|
|
<!-- 描述 -->
|
|
|
- <el-form-item label="描述" prop="description">
|
|
|
+ <!-- <el-form-item label="描述" prop="description">
|
|
|
<el-input v-model="categoryForm.description" type="textarea" :rows="3" placeholder="请输入分类描述(可选)" />
|
|
|
- </el-form-item>
|
|
|
+ </el-form-item> -->
|
|
|
</el-form>
|
|
|
|
|
|
<template #footer>
|
|
|
@@ -2158,14 +2158,15 @@ const filteredTopCategories = computed(() => {
|
|
|
|
|
|
// 根据当前顶级分类过滤子分类
|
|
|
const filteredCategoryTree = computed(() => {
|
|
|
- console.log('filteredCategoryTree computed - currentTopCategory:', currentTopCategory.value);
|
|
|
- console.log('filteredCategoryTree computed - categoryTree:', categoryTree.value);
|
|
|
-
|
|
|
if (!currentTopCategory.value || !categoryTree.value || categoryTree.value.length === 0) {
|
|
|
- console.log('filteredCategoryTree computed - returning empty array');
|
|
|
return [];
|
|
|
}
|
|
|
|
|
|
+ // 如果没有选择顶级分类(全部文件),显示所有分类
|
|
|
+ // if (!currentTopCategory.value) {
|
|
|
+ // return categoryTree.value;
|
|
|
+ // }
|
|
|
+
|
|
|
// 从树形结构中获取当前顶级分类的子分类
|
|
|
const getSubCategories = (parentId) => {
|
|
|
// 在顶级分类中查找对应的分类
|
|
|
@@ -2200,9 +2201,10 @@ const uploadCategoryOptions = computed(() => {
|
|
|
|
|
|
// 上传对话框中的树形分类数据(仅允许选择叶子节点:非叶子设置为 disabled)
|
|
|
const uploadCategoryTree = computed(() => {
|
|
|
- if (!currentTopCategory.value || !categoryTree.value || categoryTree.value.length === 0) {
|
|
|
+ if (!categoryTree.value || categoryTree.value.length === 0) {
|
|
|
return [];
|
|
|
}
|
|
|
+
|
|
|
const mapWithDisabled = (nodes) => {
|
|
|
if (!Array.isArray(nodes)) return [];
|
|
|
return nodes.map((node) => {
|
|
|
@@ -2215,6 +2217,13 @@ const uploadCategoryTree = computed(() => {
|
|
|
};
|
|
|
});
|
|
|
};
|
|
|
+
|
|
|
+ // 如果没有选择顶级分类(全部文件),显示所有分类
|
|
|
+ if (!currentTopCategory.value) {
|
|
|
+ return mapWithDisabled(categoryTree.value);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果选择了顶级分类,只显示该分类下的子分类
|
|
|
const parentCategory = categoryTree.value.find((category) => category.id === currentTopCategory.value.id);
|
|
|
const children = parentCategory && Array.isArray(parentCategory.children) ? parentCategory.children : [];
|
|
|
return mapWithDisabled(children);
|