* 更新文件状态 * 当状态变为 parsed 时检查是否所有文件都已处理完成
(fileId: string, updates: Partial<ExcelFile>)
| 368 | * 当状态变为 parsed 时检查是否所有文件都已处理完成 |
| 369 | */ |
| 370 | updateFileState(fileId: string, updates: Partial<ExcelFile>) { |
| 371 | this.setState( |
| 372 | state => ({ |
| 373 | files: state.files.map(f => (f.id === fileId ? {...f, ...updates} : f)) |
| 374 | }), |
| 375 | () => { |
| 376 | if (updates.state === 'parsed') { |
| 377 | // 检查是否所有待处理的文件都已经处理完成 |
| 378 | const pendingFiles = this.state.files.filter( |
| 379 | f => f.state === 'pending' |
| 380 | ); |
| 381 | if (pendingFiles.length === 0) { |
| 382 | // 所有文件都已处理完成,一次性更新表单值 |
| 383 | this.updateFormValue(); |
| 384 | // autoFill 会在 updateFormValue 中触发 |
| 385 | } |
| 386 | } |
| 387 | } |
| 388 | ); |
| 389 | } |
| 390 | |
| 391 | /** |
| 392 | * 更新表单值 |
no test coverage detected