diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go index 34cd6f841..43b5db07f 100755 --- a/routers/repo/attachment.go +++ b/routers/repo/attachment.go @@ -368,12 +368,21 @@ func GetSuccessChunks(ctx *context.Context) { attachID = attach.ID } + dataset, err := models.GetDatasetByID(attach.DatasetID) + if err != nil { + ctx.ServerError("GetDatasetByID", err) + return + } + ctx.JSON(200, map[string]string{ "uuid": fileChunk.UUID, "uploaded": strconv.Itoa(fileChunk.IsUploaded), "uploadID": fileChunk.UploadID, "chunks": string(chunks), "attachID": strconv.Itoa(int(attachID)), + "datasetID": strconv.Itoa(int(attach.DatasetID)), + "fileName": attach.Name, + "datasetName": dataset.Title, }) } diff --git a/web_src/js/components/MinioUploader.vue b/web_src/js/components/MinioUploader.vue index fd77cfaf1..c35f1c87c 100755 --- a/web_src/js/components/MinioUploader.vue +++ b/web_src/js/components/MinioUploader.vue @@ -216,6 +216,14 @@ export default { // 删除数据集记录,未删除文件 await addAttachment(file); } + //不同数据集上传同一个文件 + if (file.datasetID != '') { + if (Number(file.datasetID) != file.datasetId) { + var info = "该文件已上传,对应数据集(" + file.datasetName + ")-文件(" + file.realName + ")"; + window.alert(info); + window.location.reload(); + } + } console.log('文件已上传完成'); this.progress = 100; this.status = this.dropzoneParams.data('upload-complete'); @@ -257,6 +265,9 @@ export default { file.uploaded = response.data.uploaded; file.chunks = response.data.chunks; file.attachID = response.data.attachID; + file.datasetID = response.data.datasetID; + file.datasetName = response.data.datasetName; + file.realName = response.data.fileName; return file; } catch (error) { this.emitDropzoneFailed(file);