From ef8b843dc5a4b64d6706244f8d192d693d2582c4 Mon Sep 17 00:00:00 2001 From: Wenyan Date: Tue, 25 Nov 2025 20:17:39 +0800 Subject: [PATCH] =?UTF-8?q?refactor(rule-groups):=20=E6=9B=BF=E6=8D=A2?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E9=A1=B5=E9=9D=A2=E4=B8=BA=20FastAPI=20v3=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 变更内容: - 更新导入语句,使用新的 FastAPI v3 函数 - getRuleGroups → getEvaluationPointGroups - deleteRuleGroup → deleteEvaluationPointGroup - batchUpdateRuleGroupStatus → batchUpdateEvaluationPointGroupStatus - batchDeleteRuleGroups → batchDeleteEvaluationPointGroups 影响范围: - app/routes/rule-groups._index.tsx(评查点分组列表页面) 功能: - 列表查询、删除、批量启用/禁用、批量删除 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/routes/rule-groups._index.tsx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/routes/rule-groups._index.tsx b/app/routes/rule-groups._index.tsx index 4326c9b..90cb9f2 100644 --- a/app/routes/rule-groups._index.tsx +++ b/app/routes/rule-groups._index.tsx @@ -9,12 +9,12 @@ import { Table } from "~/components/ui/Table"; import { FilterPanel, FilterSelect, SearchFilter } from "~/components/ui/FilterPanel"; // import { Pagination } from "~/components/ui/Pagination"; import { - getRuleGroups, + getEvaluationPointGroups, getChildGroups, type RuleGroup, - deleteRuleGroup, - batchUpdateRuleGroupStatus, - batchDeleteRuleGroups + deleteEvaluationPointGroup, + batchUpdateEvaluationPointGroupStatus, + batchDeleteEvaluationPointGroups } from "~/api/evaluation_points/rule-groups"; import { toastService, messageService } from "~/components/ui"; @@ -43,8 +43,8 @@ export async function loader({ request }: { request: Request }) { const page = parseInt(url.searchParams.get('page') || '1'); const pageSize = parseInt(url.searchParams.get('pageSize') || '50'); - // 🆕 调用增强的 getRuleGroups API - const response = await getRuleGroups({ + // 🆕 调用 FastAPI v3 的 getEvaluationPointGroups API + const response = await getEvaluationPointGroups({ name, code, is_enabled: is_enabled ? is_enabled === 'true' : undefined, @@ -52,7 +52,7 @@ export async function loader({ request }: { request: Request }) { page, pageSize, token: frontendJWT - }); + }, frontendJWT); if (response.error) { throw new Error(response.error); @@ -239,7 +239,7 @@ export default function RuleGroupsIndex() { confirmDelay: 4, onConfirm: async () => { try { - const result = await deleteRuleGroup(groupId, frontendJWT); + const result = await deleteEvaluationPointGroup(groupId, frontendJWT); if (result.success) { // 从本地状态中移除被删除的分组 setGroups(prev => { @@ -283,7 +283,7 @@ export default function RuleGroupsIndex() { } try { - const result = await batchUpdateRuleGroupStatus(selectedIds, enable, frontendJWT); + const result = await batchUpdateEvaluationPointGroupStatus(selectedIds, enable, frontendJWT); if (result.success) { toastService.success(`成功${enable ? '启用' : '禁用'} ${result.updated_count} 个分组`); // 刷新页面以重新加载数据 @@ -313,7 +313,7 @@ export default function RuleGroupsIndex() { confirmDelay: 4, onConfirm: async () => { try { - const result = await batchDeleteRuleGroups(selectedIds, frontendJWT); + const result = await batchDeleteEvaluationPointGroups(selectedIds, frontendJWT); toastService.success(`成功删除 ${result.deleted_count} 个分组`); if (result.failed_ids.length > 0) { toastService.warning(`有 ${result.failed_ids.length} 个分组删除失败`);