feat(resource): 新增急救宣教资源管理、分类标签、审核管理模块

- 资源管理:列表筛选 + 新增/编辑弹窗 + 移动端预览 + 版本历史,已接入后端 RESTful 接口
- 分类与标签:左侧分类树(支持新增子分类/编辑/删除)+ 右侧标签云管理
- 审核管理:待审核/已通过/已驳回/审核记录四个 tab,驳回原因弹窗已接入审核接口
- 开发环境 API 地址切换为同事本地后台
This commit is contained in:
wanghao
2026-06-23 17:54:28 +08:00
parent a47c2c7400
commit a2a0e274f4
12 changed files with 2016 additions and 2 deletions
+118
View File
@@ -0,0 +1,118 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
const { createConfirm } = useMessage();
enum Api {
// 分类
categoryList = '/health-emergency/emergency/firstAid/category/list',
categoryListAll = '/health-emergency/emergency/firstAid/category/listAll',
categoryListRoot = '/health-emergency/emergency/firstAid/category/listRoot',
categoryListChildren = '/health-emergency/emergency/firstAid/category/listChildren',
categoryQueryById = '/health-emergency/emergency/firstAid/category/queryById',
categoryAdd = '/health-emergency/emergency/firstAid/category/add',
categoryEdit = '/health-emergency/emergency/firstAid/category/edit',
categoryDelete = '/health-emergency/emergency/firstAid/category/delete',
categoryDeleteBatch = '/health-emergency/emergency/firstAid/category/deleteBatch',
// 标签
tagList = '/health-emergency/emergency/firstAid/tag/list',
tagListAll = '/health-emergency/emergency/firstAid/tag/listAll',
tagQueryById = '/health-emergency/emergency/firstAid/tag/queryById',
tagAdd = '/health-emergency/emergency/firstAid/tag/add',
tagEdit = '/health-emergency/emergency/firstAid/tag/edit',
tagDelete = '/health-emergency/emergency/firstAid/tag/delete',
tagDeleteBatch = '/health-emergency/emergency/firstAid/tag/deleteBatch',
}
// ============ 分类 ============
export const categoryListApi = (params: any) => defHttp.get({ url: Api.categoryList, params });
export const categoryListAllApi = (params?: any) => defHttp.get({ url: Api.categoryListAll, params });
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 categoryDeleteApi = (params: any, handleSuccess: any) => {
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '是否删除该分类?',
onOk: async () => {
await defHttp.post({ url: Api.categoryDelete, params });
handleSuccess();
},
});
};
export const categoryDeleteBatchApi = (params: any, handleSuccess: any) => {
createConfirm({
iconType: 'warning',
title: '批量删除',
content: `是否删除选中的 ${params?.length || 0} 个分类?`,
onOk: async () => {
await defHttp.post({ url: Api.categoryDeleteBatch, params });
handleSuccess();
},
});
};
// ============ 标签 ============
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 tagDeleteApi = (params: any, handleSuccess: any) => {
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '是否删除该标签?',
onOk: async () => {
await defHttp.post({ url: Api.tagDelete, params });
handleSuccess();
},
});
};
export const tagDeleteBatchApi = (params: any, handleSuccess: any) => {
createConfirm({
iconType: 'warning',
title: '批量删除',
content: `是否删除选中的 ${params?.length || 0} 个标签?`,
onOk: async () => {
await defHttp.post({ url: Api.tagDeleteBatch, params });
handleSuccess();
},
});
};
// ============ 工具:扁平列表转树 ============
export function buildTree(list: any[]): any[] {
const map = new Map<string, any>();
const roots: any[] = [];
list.forEach((item) => {
map.set(item.id, { ...item, children: [] });
});
list.forEach((item) => {
const node = map.get(item.id);
if (item.parentId && map.has(item.parentId)) {
map.get(item.parentId).children.push(node);
} else {
roots.push(node);
}
});
// 移除空 children
const clean = (nodes: any[]) => {
nodes.forEach((n) => {
if (n.children.length === 0) {
delete n.children;
} else {
clean(n.children);
}
});
return nodes;
};
return clean(roots);
}