fix(document-types): 修复构建错误 - 替换为 FastAPI v3 接口
问题: - document-types.new.tsx 仍在使用已重命名的 getAllRuleGroups 函数 - 导致构建失败:"getAllRuleGroups" is not exported 修复: - getAllRuleGroups → getAllEvaluationPointGroups - 传递正确的参数:includeDisabled=false, withRuleCount=true 影响范围: - app/routes/document-types.new.tsx (文档类型创建/编辑页面) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,7 @@ import { redirect, type MetaFunction, type ActionFunctionArgs, type LoaderFuncti
|
|||||||
import { Card } from "~/components/ui/Card";
|
import { Card } from "~/components/ui/Card";
|
||||||
import { Button } from "~/components/ui/Button";
|
import { Button } from "~/components/ui/Button";
|
||||||
import documentTypesNewStyles from "~/styles/pages/document-types_new.css?url";
|
import documentTypesNewStyles from "~/styles/pages/document-types_new.css?url";
|
||||||
import { getAllRuleGroups, type RuleGroup } from "~/api/evaluation_points/rule-groups";
|
import { getAllEvaluationPointGroups, type RuleGroup } from "~/api/evaluation_points/rule-groups";
|
||||||
import { getDocumentType, createDocumentType, updateDocumentType, getEntryModules } from "~/api/document-types/document-types";
|
import { getDocumentType, createDocumentType, updateDocumentType, getEntryModules } from "~/api/document-types/document-types";
|
||||||
import { getPromptTemplates, type PromptTemplateUI } from "~/api/prompts/prompts";
|
import { getPromptTemplates, type PromptTemplateUI } from "~/api/prompts/prompts";
|
||||||
import { toastService } from "~/components/ui/Toast";
|
import { toastService } from "~/components/ui/Toast";
|
||||||
@@ -70,14 +70,14 @@ export async function loader({ request }: LoaderFunctionArgs) {
|
|||||||
const id = url.searchParams.get("id");
|
const id = url.searchParams.get("id");
|
||||||
const isEdit = id ? true : false;
|
const isEdit = id ? true : false;
|
||||||
|
|
||||||
// 1. 获取评查点分组 - 使用getAllRuleGroups获取所有分组
|
// 1. 获取评查点分组 - 使用 FastAPI v3 的 getAllEvaluationPointGroups 获取所有分组
|
||||||
const ruleGroupsResponse = await getAllRuleGroups(frontendJWT);
|
const ruleGroupsResponse = await getAllEvaluationPointGroups(false, true, frontendJWT);
|
||||||
if (ruleGroupsResponse.error) {
|
if (ruleGroupsResponse.error) {
|
||||||
console.error("获取评查点分组失败:", ruleGroupsResponse.error);
|
console.error("获取评查点分组失败:", ruleGroupsResponse.error);
|
||||||
// throw new Error(ruleGroupsResponse.error);
|
// throw new Error(ruleGroupsResponse.error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ruleGroupsResponse.data已经是树形结构数据,getAllRuleGroups内部已处理好parent-children关系
|
// ruleGroupsResponse.data已经是树形结构数据,getAllEvaluationPointGroups内部已处理好parent-children关系
|
||||||
const groupsTree = ruleGroupsResponse.error ? [] : ruleGroupsResponse.data || [];
|
const groupsTree = ruleGroupsResponse.error ? [] : ruleGroupsResponse.data || [];
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user