From fd32a85424624bd0c8d1a9c47d4612e89610077e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=96=87=E5=B3=B0?= Date: Tue, 14 Apr 2026 14:31:17 +0800 Subject: [PATCH] up --- .../ops_vue_js/src/components/useDropzone.vue | 87 +++++++++++-------- 1 file changed, 52 insertions(+), 35 deletions(-) diff --git a/frontend/ops_vue_js/src/components/useDropzone.vue b/frontend/ops_vue_js/src/components/useDropzone.vue index aee2aca..d65e2f2 100644 --- a/frontend/ops_vue_js/src/components/useDropzone.vue +++ b/frontend/ops_vue_js/src/components/useDropzone.vue @@ -201,7 +201,6 @@ const initDropzone = () => { }); }; - function return_files() { return files; } @@ -209,36 +208,36 @@ function return_files() { // 加载初始已有文件(编辑场景) function loadInitialFiles() { if (!dropzoneInstance || !prop.initialFiles?.length) return; - prop.initialFiles.forEach((f) => { // 构造 Dropzone 期望的 mock file 对象 - console.log(f) - // const mockFile = { - // name: f.Name, - // size: f.Size, - // type: f.Mime, - // status: Dropzone.SUCCESS, - // accepted: true, - // upload: { uuid: f.Sha256 }, - // previewElement: null, - // _removeLink: null, - // }; - // // 通知 Dropzone "这是一个已存在的文件,不要上传" - // dropzoneInstance.emit("addedfile", mockFile); - // dropzoneInstance.emit("complete", mockFile); - // dropzoneInstance.files.push(mockFile); - // // 填充上传结果字段 - // const url = `/api/files/get/${f.Sha256}`; - // files.push({ - // uuid: f.Sha256, - // hash: f.Sha256, - // get_url: url, - // download_url: `/api/files/download/${f.Sha256}`, - // file_name: f.Name, - // file_size: f.Size, - // is_upload: true, - // }); + console.log(f); + // 填充上传结果字段 + const url = `/api/files/get/${f.Sha256}`; + const mockFile = { + name: f.Name, + size: f.Size, + type: f.Mime, + status: Dropzone.SUCCESS, + accepted: true, + upload: { uuid: f.Sha256 }, + previewElement: null, + _removeLink: null, + }; + // 通知 Dropzone "这是一个已存在的文件,不要上传" + dropzoneInstance.emit("addedfile", mockFile); + dropzoneInstance.emit("complete", mockFile); + dropzoneInstance.files.push(mockFile); + + files.push({ + uuid: f.Sha256, + hash: f.Sha256, + get_url: url, + download_url: `/api/files/download/${f.Sha256}`, + file_name: f.Name, + file_size: f.Size, + is_upload: true, + }); }); } @@ -270,22 +269,40 @@ defineExpose({
-
+
+ +
- - + +
- - + +
- -
{{ files.length }}/{{ maxFiles }}
+ +
+ {{ files.length }}/{{ maxFiles }} +