From a6c3ae8e0588a50820269c1eeef820d979edbd16 Mon Sep 17 00:00:00 2001 From: wangxiaoshuang <825034831@qq.com> Date: Tue, 18 Aug 2026 09:32:10 +0800 Subject: [PATCH] =?UTF-8?q?IVUS&OCT=E9=98=85=E7=89=87=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E7=82=B9=EF=BC=9A=E9=9D=B6=E6=AE=B5=E6=A0=87=E8=AE=B0=E5=92=8C?= =?UTF-8?q?=E9=98=85=E7=89=87=E9=A1=B5=E9=9D=A2=E6=95=B0=E6=8D=AE=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E5=92=8C=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 10 + package.json | 1 + .../uploadDicomAndNonedicom/index.vue | 8 +- .../uploadDicomAndNonedicom/nonedicomFile.vue | 45 +++- .../site-research/components/Questions.vue | 4 +- .../reading-task/components/TargetSection.vue | 196 +++++++++++------- vue.config.js | 3 +- 7 files changed, 184 insertions(+), 83 deletions(-) diff --git a/package-lock.json b/package-lock.json index 39fcd597..205955d4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -57,6 +57,7 @@ "sortablejs": "^1.15.5", "streamsaver": "^2.0.6", "svgo": "^1.2.2", + "unzipit": "^2.0.3", "v-viewer": "^1.7.4", "vcrontab": "^0.3.5", "vue": "2.7.16", @@ -21835,6 +21836,15 @@ "node": ">=0.10.0" } }, + "node_modules/unzipit": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/unzipit/-/unzipit-2.0.3.tgz", + "integrity": "sha512-e6+ftgSQRj9Hwf2mIWFwYIGqBoKV7AziG/d7pep2Uv3NCzHbhLO5d9dGRwpahVlnpQ7aQC+5kWk72dnWocdYyA==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/unzipper": { "version": "0.10.14", "resolved": "https://registry.npmmirror.com/unzipper/-/unzipper-0.10.14.tgz", diff --git a/package.json b/package.json index e10c42e7..3be3af68 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "sortablejs": "^1.15.5", "streamsaver": "^2.0.6", "svgo": "^1.2.2", + "unzipit": "^2.0.3", "v-viewer": "^1.7.4", "vcrontab": "^0.3.5", "vue": "2.7.16", diff --git a/src/components/uploadDicomAndNonedicom/index.vue b/src/components/uploadDicomAndNonedicom/index.vue index c5f19dbd..98510f22 100644 --- a/src/components/uploadDicomAndNonedicom/index.vue +++ b/src/components/uploadDicomAndNonedicom/index.vue @@ -3,7 +3,7 @@ :append-to-body="true" class="uploadDicomAndNonedicom"> {{ title }} - + { return { SubjectId: null, @@ -332,6 +333,34 @@ export default { store.dispatch('trials/setUnLock', false) }, methods: { + async readZipFileListRaw(zipFile) { + try { + // 1. 使用 unzipRaw 读取原始条目列表 + const { entries } = await unzipRaw(zipFile); + + // 2. entries 是一个数组,需要手动处理 + const fileList = entries.map(entry => { + // 3. 使用 TextDecoder 指定编码来解码文件名 + // 例如,对于简体中文 ZIP 包,可以使用 'gbk' + const decoder = new TextDecoder('gbk'); // 或者 'big5' + const name = decoder.decode(entry.nameBytes); + + return { + path: name, + name: name.split('/').pop(), + isDirectory: entry.isDirectory, + size: entry.size, + lastModified: entry.lastModDate + }; + }); + + console.log('解码后的文件列表:', fileList); + return fileList; + } catch (error) { + console.error('读取 ZIP 失败:', error); + throw error; + } + }, async getList() { try { this.searchData.SubjectId = this.SubjectId @@ -370,11 +399,15 @@ export default { // 扫描待上传文件 beginScanFiles(e) { var files = [...e.target.files] - var sameFiles = [] + var sameFiles = [], zipFiles = [], f = false files.forEach((file) => { var extendName = file.name .substring(file.name.lastIndexOf('.')) .toLocaleLowerCase() + if (extendName === '.zip' && this.IsImageSegment) { + if (file.name.indexOf('筛选期') > -1 || file.name.indexOf('研究结束') > -1) f = true + zipFiles.push(file) + } if ( this.faccept.indexOf(extendName) !== -1 && this.fileList.findIndex((v) => v.name === file.name) > -1 @@ -382,6 +415,16 @@ export default { sameFiles.push(file.name) } }) + if (zipFiles.length > 0) { + zipFiles.forEach(async file => { + let list = await this.readZipFileListRaw(file) + if (!f) f = list.some(i => i.path.indexOf('筛选期') > -1 || i.path.indexOf('研究结束') > -1) + list = null + }) + } + if (f) return this.$confirm(this.$t("trials:uploadNonDicoms:confirm:zipNameNonCompliant"), '', { + type: "warning" + }) var scope = this if (sameFiles.length > 0) { const h = this.$createElement diff --git a/src/views/trials/trials-panel/attachments/site-research/components/Questions.vue b/src/views/trials/trials-panel/attachments/site-research/components/Questions.vue index 35db4ecd..60d4ffc7 100644 --- a/src/views/trials/trials-panel/attachments/site-research/components/Questions.vue +++ b/src/views/trials/trials-panel/attachments/site-research/components/Questions.vue @@ -166,7 +166,7 @@