MCPcopy
hub / github.com/baidu/amis / updateFileState

Method updateFileState

packages/amis/src/renderers/Form/InputExcel.tsx:370–389  ·  view source on GitHub ↗

* 更新文件状态 * 当状态变为 parsed 时检查是否所有文件都已处理完成

(fileId: string, updates: Partial<ExcelFile>)

Source from the content-addressed store, hash-verified

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 * 更新表单值

Callers 2

processExcelFileMethod · 0.95
parseExcelDataMethod · 0.95

Calls 2

updateFormValueMethod · 0.95
filterMethod · 0.45

Tested by

no test coverage detected