完成文档列表页面ui,封装部分上传文件的公共组件,封装请求接口
This commit is contained in:
@@ -213,7 +213,6 @@ export default function FilesUpload() {
|
||||
}
|
||||
|
||||
setCurrentFile(selectedFiles[0]);
|
||||
console.log("currentFile", currentFile);
|
||||
startUpload(selectedFiles[0]);
|
||||
}, [fileType, currentFile]);
|
||||
|
||||
@@ -246,7 +245,7 @@ export default function FilesUpload() {
|
||||
setUploadSpeed("完成");
|
||||
|
||||
// 完成上传后开始处理流程
|
||||
startProcessing();
|
||||
startProcessing(file);
|
||||
}
|
||||
return 100;
|
||||
}
|
||||
@@ -257,7 +256,7 @@ export default function FilesUpload() {
|
||||
};
|
||||
|
||||
// 开始处理文件
|
||||
const startProcessing = () => {
|
||||
const startProcessing = (file: File) => {
|
||||
setUploadStage("processing");
|
||||
|
||||
// 更新步骤状态 - 将第一步标记为完成
|
||||
@@ -276,7 +275,7 @@ export default function FilesUpload() {
|
||||
if (currentStepIndex >= processingSteps.length) {
|
||||
if (processingIntervalRef.current) {
|
||||
clearInterval(processingIntervalRef.current);
|
||||
completeProcessing();
|
||||
completeProcessing(file);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -322,18 +321,18 @@ export default function FilesUpload() {
|
||||
};
|
||||
|
||||
// 完成处理流程
|
||||
const completeProcessing = () => {
|
||||
const completeProcessing = (file: File) => {
|
||||
// 设置当前状态为已完成
|
||||
setUploadStage("completed");
|
||||
|
||||
// 创建完成的文件对象
|
||||
if (currentFile) {
|
||||
if (file) {
|
||||
console.log("创建完成的文件对象...");
|
||||
const newFile: UploadedFile = {
|
||||
id: `file_${Date.now()}`,
|
||||
name: currentFile.name,
|
||||
size: currentFile.size,
|
||||
type: currentFile.type,
|
||||
name: file.name,
|
||||
size: file.size,
|
||||
type: file.type,
|
||||
fileType: fileType as FileType,
|
||||
priority,
|
||||
status: ProcessingStatus.SUCCESS,
|
||||
@@ -495,6 +494,7 @@ export default function FilesUpload() {
|
||||
width: "15%",
|
||||
render: (_: unknown, record: UploadedFile) => (
|
||||
<Button
|
||||
className={record.status !== ProcessingStatus.SUCCESS ? "" : "hover:border-green-700 hover:text-green-700"}
|
||||
type="default"
|
||||
size="small"
|
||||
disabled={record.status !== ProcessingStatus.SUCCESS}
|
||||
|
||||
Reference in New Issue
Block a user