diff --git a/src/views/check/index.vue b/src/views/check/index.vue index 7e83201..cdf0aa5 100644 --- a/src/views/check/index.vue +++ b/src/views/check/index.vue @@ -50,6 +50,7 @@ @@ -123,6 +124,7 @@ approveApi, rejectApi, } from './check.api'; + import { publishApi } from '/@/views/resource/resource.api'; import dayjs from 'dayjs'; import { CONTENT_TYPE } from '/@/views/resource/resource.data'; import PreviewModal from '/@/views/resource/components/PreviewModal.vue'; @@ -174,11 +176,11 @@ ]; const recordColumns = [ - { title: '资源名称', dataIndex: 'title' }, + { title: '资源名称', dataIndex: 'resourceTitle' }, { title: '操作', dataIndex: 'action', align: 'center', width: 100 }, { title: '审核人', dataIndex: 'auditBy', align: 'center', width: 120 }, { title: '时间', dataIndex: 'auditTime', align: 'center', width: 170 }, - { title: '意见', dataIndex: 'auditOpinion' }, + { title: '意见', dataIndex: 'auditRejectReason' }, ]; function getTypeLabel(type: string) { @@ -210,6 +212,13 @@ createMessage.info(`重新编辑:${record.title}(跳转到资源管理编辑)`); } + // V3:已通过的资源需手动上架 + async function handlePublish(record: any) { + await publishApi({ id: record.id }); + createMessage.success('已上架'); + loadPassed(); + } + async function loadPending() { pendingLoading.value = true; try { diff --git a/src/views/label/components/CategoryFormModal.vue b/src/views/label/components/CategoryFormModal.vue index 63540a1..12e7ead 100644 --- a/src/views/label/components/CategoryFormModal.vue +++ b/src/views/label/components/CategoryFormModal.vue @@ -4,17 +4,6 @@ - - - @@ -26,20 +15,19 @@ diff --git a/src/views/label/components/TagFormModal.vue b/src/views/label/components/TagFormModal.vue index 5c378a9..8eaddfc 100644 --- a/src/views/label/components/TagFormModal.vue +++ b/src/views/label/components/TagFormModal.vue @@ -1,6 +1,16 @@ diff --git a/src/views/label/index.vue b/src/views/label/index.vue index c39ec0b..3cac86d 100644 --- a/src/views/label/index.vue +++ b/src/views/label/index.vue @@ -29,7 +29,7 @@ 冻结 - + + +标签 @@ -93,7 +93,7 @@ - + @@ -105,7 +105,6 @@ import { categoryListAllApi, categoryDeleteApi, - tagListAllApi, tagDeleteApi, buildTree, } from './label.api'; @@ -144,9 +143,13 @@ const categoryTreeSelectData = computed(() => categoryTree.value); - function onSelectCategory(keys: string[], info: any) { + function onSelectCategory(keys: string[]) { + // V3:标签数据从分类的 tags 字段取,不再单独调接口 if (keys.length > 0) { - createMessage.info(`已选中分类:${info.node.name}`); + const category = categoryList.value.find((c) => c.id === keys[0]); + tagList.value = category?.tags || []; + } else { + tagList.value = []; } } @@ -155,9 +158,15 @@ } function handleAddSubCategory(parentId: string) { + // V3:分类扁平化,此函数已废弃,保留以防其他地方调用 openCategoryModal(true, { isUpdate: false, parentId }); } + // V3:分类项后面的「+标签」按钮,新增该分类下的标签 + function handleAddTagUnderCategory(parentId: string) { + openTagModal(true, { isUpdate: false, parentId }); + } + function handleEditCategory(record: any) { openCategoryModal(true, { isUpdate: true, record }); } @@ -195,7 +204,7 @@ function handleDeleteTag(tag: any) { tagDeleteApi({ id: tag.id }, () => { createMessage.success('已删除标签'); - loadTags(); + loadCategoryTree(); }); } @@ -255,24 +264,23 @@ if (expandedKeys.value.length === 0 && categoryTree.value.length > 0) { expandedKeys.value = [categoryTree.value[0].id]; } + // V3:默认选中第一个分类,标签从分类的 tags 字段取 + if (selectedKeys.value.length === 0 && categoryList.value.length > 0) { + const first = categoryList.value[0]; + selectedKeys.value = [first.id]; + tagList.value = first?.tags || []; + } else if (selectedKeys.value.length > 0) { + // 已选中分类,重新拉数据后刷新该分类的标签(新增/编辑/删除标签后回显最新数据) + const selected = categoryList.value.find((c) => c.id === selectedKeys.value[0]); + tagList.value = selected?.tags || []; + } } finally { categoryLoading.value = false; } } - async function loadTags() { - tagLoading.value = true; - try { - const res = await tagListAllApi(); - tagList.value = res || []; - } finally { - tagLoading.value = false; - } - } - onMounted(() => { loadCategoryTree(); - loadTags(); }); diff --git a/src/views/label/label.api.ts b/src/views/label/label.api.ts index 8474b51..1a506f9 100644 --- a/src/views/label/label.api.ts +++ b/src/views/label/label.api.ts @@ -30,8 +30,8 @@ export const categoryListAllApi = (params?: any) => defHttp.get({ url: Api.categ export const categoryListRootApi = (params?: any) => defHttp.get({ url: Api.categoryListRoot, params }); export const categoryListChildrenApi = (params: any) => defHttp.get({ url: Api.categoryListChildren, params }); export const categoryQueryByIdApi = (params: any) => defHttp.get({ url: Api.categoryQueryById, params }); -export const categoryAddApi = (params: any) => defHttp.post({ url: Api.categoryAdd, params }); -export const categoryEditApi = (params: any) => defHttp.post({ url: Api.categoryEdit, params }); +export const categoryAddApi = (params: any) => defHttp.post({ url: Api.categoryAdd, params }, { successNeedMessage: false }); +export const categoryEditApi = (params: any) => defHttp.post({ url: Api.categoryEdit, params }, { successNeedMessage: false }); export const categoryDeleteApi = (params: any, handleSuccess: any) => { createConfirm({ @@ -39,7 +39,7 @@ export const categoryDeleteApi = (params: any, handleSuccess: any) => { title: '确认删除', content: '是否删除该分类?', onOk: async () => { - await defHttp.post({ url: Api.categoryDelete, params }); + await defHttp.post({ url: Api.categoryDelete, params }, { successNeedMessage: false }); handleSuccess(); }, }); @@ -51,7 +51,7 @@ export const categoryDeleteBatchApi = (params: any, handleSuccess: any) => { title: '批量删除', content: `是否删除选中的 ${params?.length || 0} 个分类?`, onOk: async () => { - await defHttp.post({ url: Api.categoryDeleteBatch, params }); + await defHttp.post({ url: Api.categoryDeleteBatch, params }, { successNeedMessage: false }); handleSuccess(); }, }); @@ -61,8 +61,8 @@ export const categoryDeleteBatchApi = (params: any, handleSuccess: any) => { export const tagListApi = (params: any) => defHttp.get({ url: Api.tagList, params }); export const tagListAllApi = (params?: any) => defHttp.get({ url: Api.tagListAll, params }); export const tagQueryByIdApi = (params: any) => defHttp.get({ url: Api.tagQueryById, params }); -export const tagAddApi = (params: any) => defHttp.post({ url: Api.tagAdd, params }); -export const tagEditApi = (params: any) => defHttp.post({ url: Api.tagEdit, params }); +export const tagAddApi = (params: any) => defHttp.post({ url: Api.tagAdd, params }, { successNeedMessage: false }); +export const tagEditApi = (params: any) => defHttp.post({ url: Api.tagEdit, params }, { successNeedMessage: false }); export const tagDeleteApi = (params: any, handleSuccess: any) => { createConfirm({ @@ -70,7 +70,7 @@ export const tagDeleteApi = (params: any, handleSuccess: any) => { title: '确认删除', content: '是否删除该标签?', onOk: async () => { - await defHttp.post({ url: Api.tagDelete, params }); + await defHttp.post({ url: Api.tagDelete, params }, { successNeedMessage: false }); handleSuccess(); }, }); @@ -82,7 +82,7 @@ export const tagDeleteBatchApi = (params: any, handleSuccess: any) => { title: '批量删除', content: `是否删除选中的 ${params?.length || 0} 个标签?`, onOk: async () => { - await defHttp.post({ url: Api.tagDeleteBatch, params }); + await defHttp.post({ url: Api.tagDeleteBatch, params }, { successNeedMessage: false }); handleSuccess(); }, }); diff --git a/src/views/resource/components/ResourceFormModal.vue b/src/views/resource/components/ResourceFormModal.vue index a783965..89f84fd 100644 --- a/src/views/resource/components/ResourceFormModal.vue +++ b/src/views/resource/components/ResourceFormModal.vue @@ -1,5 +1,5 @@ diff --git a/src/views/resource/index.vue b/src/views/resource/index.vue index a0cc8da..c9b3fc3 100644 --- a/src/views/resource/index.vue +++ b/src/views/resource/index.vue @@ -200,10 +200,10 @@ }, }); } else if (record.status === STATUS.DRAFT && record.auditStatus === AUDIT_STATUS.PASSED) { - // 已通过的草稿状态(编辑后自动退回草稿),可重新提交 + // V3:已通过待上架状态,操作为「上架」 actions.push({ - label: '提交审核', - onClick: () => handleSubmitReview(record), + label: '上架', + onClick: () => handlePublish(record), }); } return actions; diff --git a/src/views/resource/resource.data.ts b/src/views/resource/resource.data.ts index 0ef4955..4aed996 100644 --- a/src/views/resource/resource.data.ts +++ b/src/views/resource/resource.data.ts @@ -33,10 +33,12 @@ export const CONTENT_TYPE = { }; // 根据发布状态+审核状态返回展示信息 +// V3:审核通过但未上架 (auditStatus=11 && status=0) 显示为「已通过」 export function getResourceDisplayStatus(status: number, auditStatus: number | null) { if (status === STATUS.PUBLISHED) return { text: '已发布', color: 'success' }; if (status === STATUS.OFFLINE) return { text: '已下架', color: 'error' }; if (auditStatus === AUDIT_STATUS.PENDING) return { text: '待审核', color: 'warning' }; + if (auditStatus === AUDIT_STATUS.PASSED) return { text: '已通过', color: 'processing' }; if (auditStatus === AUDIT_STATUS.REJECTED) return { text: '已驳回', color: 'error' }; return { text: '草稿', color: 'default' }; }