fixed
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { useState, useEffect, useRef } from "react";
|
||||
import { MetaFunction, ActionFunctionArgs } from "@remix-run/node";
|
||||
import { MetaFunction, ActionFunctionArgs, LoaderFunctionArgs } from "@remix-run/node";
|
||||
import { Form, useActionData, useLoaderData } from "@remix-run/react";
|
||||
import { Card } from "~/components/ui/Card";
|
||||
import { Button } from "~/components/ui/Button";
|
||||
@@ -26,6 +26,13 @@ export function links() {
|
||||
];
|
||||
}
|
||||
|
||||
// 面包屑导航
|
||||
export const handle = {
|
||||
breadcrumb: () => {
|
||||
return '上传文件'
|
||||
}
|
||||
}
|
||||
|
||||
export const meta: MetaFunction = () => {
|
||||
return [
|
||||
{ title: "待审核文件上传 - 中国烟草AI合同及卷宗审核系统" },
|
||||
@@ -221,13 +228,15 @@ export async function action({ request }: ActionFunctionArgs) {
|
||||
type LoaderData = {
|
||||
documents: Document[];
|
||||
documentTypes: DocumentType[];
|
||||
mode: string;
|
||||
};
|
||||
|
||||
// 添加 loader 函数
|
||||
export async function loader() {
|
||||
export async function loader({ request }: LoaderFunctionArgs) {
|
||||
try {
|
||||
console.log('loader: 开始加载数据...');
|
||||
|
||||
// console.log('loader: 开始加载数据...');
|
||||
const url = new URL(request.url);
|
||||
const mode = url.searchParams.get("mode") || "create";
|
||||
// 并行加载文档和文档类型
|
||||
const [documentsResponse, typesResponse] = await Promise.all([
|
||||
getTodayDocuments(),
|
||||
@@ -242,6 +251,7 @@ export async function loader() {
|
||||
}
|
||||
|
||||
return Response.json({
|
||||
mode,
|
||||
documents: documentsResponse.data || [],
|
||||
documentTypes: typesResponse.data || []
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user