zyh
This commit is contained in:
@@ -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,
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
@@ -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('表格填写完成');
|
||||
|
||||
Reference in New Issue
Block a user