From 1de27fdce0f354a70cb2302462b30284bf900661 Mon Sep 17 00:00:00 2001 From: yuyuanshifu <747342561@qq.com> Date: Tue, 15 Sep 2020 15:52:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E4=B8=80=E7=94=A8=E6=88=B7=E5=9C=A8?= =?UTF-8?q?=E4=B8=8D=E5=90=8C=E6=95=B0=E6=8D=AE=E9=9B=86=E4=B8=8B=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E5=90=8C=E4=B8=80=E4=B8=AA=E6=96=87=E4=BB=B6=E6=97=B6?= =?UTF-8?q?=E5=81=9A=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/repo/attachment.go | 9 +++++++++ web_src/js/components/MinioUploader.vue | 11 +++++++++++ 2 files changed, 20 insertions(+) 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);