From 433064c3530cc88089c0d56995527bc476504f9e Mon Sep 17 00:00:00 2001 From: "DESKTOP-6C3NK6N\\WXS" <815034831@qq.com> Date: Wed, 4 Sep 2024 16:32:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../downloadDicomAndNonedicom/index.vue | 21 ++++++++++------ src/utils/stream.js | 25 ++++++++++++++++--- .../qc-check/components/qualityAssurance.vue | 2 +- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/src/components/downloadDicomAndNonedicom/index.vue b/src/components/downloadDicomAndNonedicom/index.vue index 500dbc9a..659c5c40 100644 --- a/src/components/downloadDicomAndNonedicom/index.vue +++ b/src/components/downloadDicomAndNonedicom/index.vue @@ -243,7 +243,11 @@ export default { } if (type === 'dicom' || type === 'all') { this.list.forEach((item) => { - if (item.DicomStudyList && item.DicomStudyList.length > 0) { + if ( + item.IsDicom && + item.DicomStudyList && + item.DicomStudyList.length > 0 + ) { data.SubjectVisitIdList.push(item.SourceSubjectVisitId) let arr = item.DicomStudyList.map((d) => d.Id) data.DicomStudyIdList = [...data.DicomStudyIdList, ...arr] @@ -253,11 +257,12 @@ export default { if (type === 'noneDicom' || type === 'all') { this.list.forEach((item) => { if ( - item.NoneDicomStudyIdList && - item.NoneDicomStudyIdList.length > 0 + !item.IsDicom && + item.NoneDicomStudyList && + item.NoneDicomStudyList.length > 0 ) { data.SubjectVisitIdList.push(item.SourceSubjectVisitId) - let arr = item.NoneDicomStudyIdList.map((d) => d.Id) + let arr = item.NoneDicomStudyList.map((d) => d.Id) data.NoneDicomStudyIdList = [...data.NoneDicomStudyIdList, ...arr] } }) @@ -274,11 +279,11 @@ export default { } if ( !row.IsDicom && - row.NoneDicomStudyIdList && - row.NoneDicomStudyIdList.length > 0 + row.NoneDicomStudyList && + row.NoneDicomStudyList.length > 0 ) { data.SubjectVisitIdList.push(row.SourceSubjectVisitId) - let arr = row.NoneDicomStudyIdList.map((d) => d.Id) + let arr = row.NoneDicomStudyList.map((d) => d.Id) data.NoneDicomStudyIdList = [...data.NoneDicomStudyIdList, ...arr] } } @@ -319,7 +324,7 @@ export default { 'IsDicom', true )}/${study.StudyCode}/${fileName}`, - path: this.OSSclientConfig.basePath + instance.Path, + url: this.OSSclientConfig.basePath + instance.Path, } files.push(obj) }) diff --git a/src/utils/stream.js b/src/utils/stream.js index 1c74b6d3..de27a281 100644 --- a/src/utils/stream.js +++ b/src/utils/stream.js @@ -15,8 +15,13 @@ function zipFiles(zipName, files) { if (fileInfo.done) {//迭代终止 ctrl.close(); } else { - const { name, url } = fileInfo.value; - return fetch(url).then(res => { + let { name, url } = fileInfo.value; + url = decodeUtf8(url); + return fetch(url, { + headers: { + 'Cross-Origin-Embedder-Policy': 'unsafe-none' + } + }).then(res => { ctrl.enqueue({ name, stream: () => res.body @@ -40,7 +45,12 @@ async function updateFile(file, name) { try { store.dispatch('trials/setUnLock', true) const fileOutputStream = streamSaver.createWriteStream(name); - let res = await fetch(file); + file = decodeUtf8(file); + let res = await fetch(file, { + headers: { + 'Cross-Origin-Embedder-Policy': 'unsafe-none' + } + }); res.body.pipeTo(fileOutputStream).then(() => { store.dispatch('trials/setUnLock', true) }); @@ -48,6 +58,15 @@ async function updateFile(file, name) { console.log(err) } } +function decodeUtf8(bytes) { + let str = bytes.split('?'); + let str2 = str[0].split('/'); + let name = str2[str2.length - 1]; + name = encodeURIComponent(name); + str.shift(); + str2.pop(); + return str2.join("/") + '/' + name; +} export function downLoadFile(file, name, type = 'file') { if (type === 'zip') return zipFiles(name, file); return updateFile(file, name) diff --git a/src/views/trials/trials-panel/visit/qc-check/components/qualityAssurance.vue b/src/views/trials/trials-panel/visit/qc-check/components/qualityAssurance.vue index c582c49d..408326c0 100644 --- a/src/views/trials/trials-panel/visit/qc-check/components/qualityAssurance.vue +++ b/src/views/trials/trials-panel/visit/qc-check/components/qualityAssurance.vue @@ -1470,7 +1470,7 @@ export default { )}/${study.StudyCode}_${study.StudyTime}_${ series.Modality }/${fileName}`, - path: this.OSSclientConfig.basePath + instance.Path, + url: this.OSSclientConfig.basePath + instance.Path, } files.push(obj) })