refactor(rule-groups): 替换列表页面为 FastAPI v3 接口

变更内容:
- 更新导入语句,使用新的 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 <noreply@anthropic.com>
This commit is contained in:
2025-11-25 20:17:39 +08:00
parent ccb33e9b11
commit ef8b843dc5
+10 -10
View File
@@ -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} 个分组删除失败`);