This commit is contained in:
zzz
2026-04-08 20:23:51 +08:00
parent 6f8976cf71
commit 38e41c6eff
6 changed files with 663 additions and 149 deletions

View File

@@ -92,6 +92,7 @@ export interface TemplateField {
name: string;
field_type: string;
required: boolean;
hint?: string;
}
// 表格填写结果
@@ -625,7 +626,10 @@ export const backendApi = {
*/
async fillTemplate(
templateId: string,
templateFields: TemplateField[]
templateFields: TemplateField[],
sourceDocIds?: string[],
sourceFilePaths?: string[],
userHint?: string
): Promise<FillResult> {
const url = `${BACKEND_BASE_URL}/templates/fill`;
@@ -636,6 +640,9 @@ export const backendApi = {
body: JSON.stringify({
template_id: templateId,
template_fields: templateFields,
source_doc_ids: sourceDocIds || [],
source_file_paths: sourceFilePaths || [],
user_hint: userHint || null,
}),
});

View File

@@ -128,8 +128,12 @@ const TemplateFill: React.FC = () => {
setStep('filling');
try {
// 调用后端填表接口
const result = await backendApi.fillTemplate('temp-template-id', templateFields);
// 调用后端填表接口传递选中的文档ID
const result = await backendApi.fillTemplate(
'temp-template-id',
templateFields,
selectedDocs // 传递源文档ID列表
);
setFilledResult(result);
setStep('preview');
toast.success('表格填写完成');