refactor(label): 清理标签分类页面未使用代码与废弃函数

删除弹窗状态变量、reactive 导入、废弃函数,提升可读性。
This commit is contained in:
wanghao
2026-06-26 14:43:54 +08:00
parent 9c6680146f
commit 375011991e
+4 -38
View File
@@ -70,14 +70,8 @@
</a-card>
<a-card title="分类权限配置" :bordered="false" class="card-section">
<!-- <a-alert message="权限矩阵接口后端尚未提供,当前为占位展示" type="info" show-icon style="margin-bottom: 12px" />-->
<a-table
:columns="permissionColumns"
:data-source="permissionList"
:pagination="false"
size="middle"
bordered
>
<!-- <a-alert message="权限矩阵接口后端尚未提供,当前为占位展示" type="info" show-icon style="margin-bottom: 12px" />-->
<a-table :columns="permissionColumns" :data-source="permissionList" :pagination="false" size="middle" bordered>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex !== 'role'">
<a-tag :color="getPermissionColor(record.permissions[column.idx])">
@@ -98,16 +92,11 @@
</template>
<script setup lang="ts">
import { ref, reactive, computed, onMounted } from 'vue';
import { ref, computed, onMounted } from 'vue';
import { PlusOutlined } from '@ant-design/icons-vue';
import { useMessage } from '/@/hooks/web/useMessage';
import { useModal } from '/@/components/Modal';
import {
categoryListAllApi,
categoryDeleteApi,
tagDeleteApi,
buildTree,
} from './label.api';
import { categoryListAllApi, categoryDeleteApi, tagDeleteApi, buildTree } from './label.api';
import CategoryFormModal from './components/CategoryFormModal.vue';
import TagFormModal from './components/TagFormModal.vue';
@@ -141,8 +130,6 @@
return filter(categoryTree.value);
});
const categoryTreeSelectData = computed(() => categoryTree.value);
function onSelectCategory(keys: string[]) {
// V3:标签数据从分类的 tags 字段取,不再单独调接口
if (keys.length > 0) {
@@ -157,11 +144,6 @@
openCategoryModal(true, { isUpdate: false, parentId });
}
function handleAddSubCategory(parentId: string) {
// V3:分类扁平化,此函数已废弃,保留以防其他地方调用
openCategoryModal(true, { isUpdate: false, parentId });
}
// V3:分类项后面的「+标签」按钮,新增该分类下的标签
function handleAddTagUnderCategory(parentId: string) {
openTagModal(true, { isUpdate: false, parentId });
@@ -238,22 +220,6 @@
return code;
}
// ============ 弹窗状态 ============
const categoryModalVisible = ref(false);
const categoryModalTitle = ref('新增分类');
const categorySubmitting = ref(false);
const categoryForm = reactive({
id: '',
name: '',
parentId: undefined as string | undefined,
sortNo: 1,
description: '',
});
const tagModalVisible = ref(false);
const tagSubmitting = ref(false);
const tagForm = reactive({ name: '', sortNo: 1, description: '' });
// ============ 加载 ============
async function loadCategoryTree() {
categoryLoading.value = true;