优化文档列表

This commit is contained in:
2025-04-14 16:47:26 +08:00
parent cb52bf8179
commit 5573724390
5 changed files with 182 additions and 115 deletions
+5 -2
View File
@@ -71,7 +71,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
// 并行获取文档详情和文档类型列表
const [documentResponse, documentTypesResponse] = await Promise.all([
getDocument(id),
getDocumentTypes()
getDocumentTypes({ pageSize: 500 })
]);
if (documentResponse.error) {
@@ -198,6 +198,8 @@ export default function DocumentEdit() {
// 在新窗口打开文档预览
const openPreview = () => {
// 假设有一个预览URL的格式,比如 /preview?path=xxx
console.log('documentstest', document);
const previewUrl = `/preview?path=${encodeURIComponent(document.path)}&name=${encodeURIComponent(document.name)}`;
window.open(previewUrl, '_blank');
};
@@ -268,11 +270,12 @@ export default function DocumentEdit() {
<div className="grid grid-cols-2 gap-6">
<div className="form-group">
<label htmlFor="type-id" className="form-label"> <span className="text-red-500">*</span></label>
<select
<select
id="type-id"
name="type_id"
className="form-select"
defaultValue={document.type}
disabled={document.fileStatus !== 'Processed'}
required
>
{documentTypes.map((type: DocType) => (