From c9d930ce74c63be8a9945682e7ed5c9f8af2d67f Mon Sep 17 00:00:00 2001 From: wangxiaoshuang <825034831@qq.com> Date: Wed, 17 Dec 2025 15:25:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/inspection.js | 10 +++ src/utils/request-download.js | 8 ++- src/views/trials/trials-inspection/index.vue | 66 +++++++++++++++++--- 3 files changed, 73 insertions(+), 11 deletions(-) diff --git a/src/api/inspection.js b/src/api/inspection.js index 23ecc1f..37d82b9 100644 --- a/src/api/inspection.js +++ b/src/api/inspection.js @@ -1,5 +1,6 @@ // 检查管理 import request from '@/utils/request' +import requestDownload from '@/utils/request-download' // 检查->患者列表 export function getPatientList(data) { @@ -203,4 +204,13 @@ export function getDownloadPatientStudyInfo(data) { method: 'post', data }) +} +// 获取影像下载数据(接口二) +export function PatientStudyBatchDownload(data) { + return requestDownload({ + url: '/download/PatientStudyBatchDownload', + method: 'post', + responseType: 'blob', + data + }) } \ No newline at end of file diff --git a/src/utils/request-download.js b/src/utils/request-download.js index 8d6b71d..1d2f349 100644 --- a/src/utils/request-download.js +++ b/src/utils/request-download.js @@ -45,13 +45,17 @@ service.interceptors.response.use( let contentDisposition = response.headers['content-disposition'] let fileName = '' if (contentDisposition) { - fileName = contentDisposition.split('; ')[2].split('=')[1].split("\'")[2] + if (contentDisposition.includes('zip')) { + fileName = contentDisposition.split('; ')[1].split('=')[1] + } else { + fileName = contentDisposition.split('; ')[2].split('=')[1].split("\'")[2] + } fileName = decodeURI(fileName) } const a = document.createElement('a') // xls类型: application/vnd.ms-excel // xlsx类型:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8 - const href = URL.createObjectURL(new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8' })) + const href = URL.createObjectURL(new Blob([res], { type: response.headers['content-type'] })) a.download = fileName a.href = href a.click() diff --git a/src/views/trials/trials-inspection/index.vue b/src/views/trials/trials-inspection/index.vue index 3d52474..0805b0d 100644 --- a/src/views/trials/trials-inspection/index.vue +++ b/src/views/trials/trials-inspection/index.vue @@ -234,9 +234,11 @@ import addTrialsList from './components/add-trials-list' import viewStudyList from './components/view-study-list' import pushRecordList from './components/push-record-list' import pullImage from './components/pullImage/index.vue' -import { getPatientList, deletePatientStudyAllData, getDownloadPatientStudyInfo } from '@/api/inspection.js' +import { getPatientList, deletePatientStudyAllData, getDownloadPatientStudyInfo, PatientStudyBatchDownload } from '@/api/inspection.js' import { getDicomCalledAEList, getDicomCallingAEList } from '@/api/dicomAE.js' import downloadRecord from "@/views/trials/trials-panel/trial-summary/download-record" +import { getToken } from '@/utils/auth' +import * as signalR from '@microsoft/signalr' import { downloadImageSuccess, } from '@/api/trials.js' @@ -319,12 +321,21 @@ export default { this.downloadVisible = false done() }, + generate() { + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { + const r = Math.random() * 16 | 0; + const v = c === 'x' ? r : (r & 0x3 | 0x8); + return v.toString(16); + }); + }, async getDownloadPatientStudyInfo(arr) { try { let data = { PatientIdList: [], ScpStudyIdList: [] } + this.downloadId = this.generate() + data.CurrentNoticeId = this.downloadId arr.forEach(item => { data.PatientIdList.push(item.PatientId) if (item.SCPStudyId) { @@ -332,14 +343,16 @@ export default { } }) - let res = await getDownloadPatientStudyInfo(data) - if (res.IsSuccess) { - let confirm = await this.$confirm(this.$t('trials:imageSummary:confirm:space').replace('xxx', this.formatSize(res.OtherInfo.ImageSize))) - if (!confirm) return false - this.downloadId = res.OtherInfo.downloadId - this.downloadImage(res.Result, res.OtherInfo) - this.downloadVisible = true - } + // return this.downloadZipDirect(data) + this.onUploadProgress(this.downloadId) + await PatientStudyBatchDownload(data) + // if (res.IsSuccess) { + // // let confirm = await this.$confirm(this.$t('trials:imageSummary:confirm:space').replace('xxx', this.formatSize(res.OtherInfo.ImageSize))) + // // if (!confirm) return false + // // this.downloadId = res.OtherInfo.downloadId + // // this.downloadImage(res.Result, res.OtherInfo) + // // this.downloadVisible = true + // } } catch (err) { console.log(err) } @@ -570,11 +583,46 @@ export default { this[`${key}TrialsVisible`] = true this.selectPatient = item }, + async onUploadProgress(id, num, type = 'start') { + if (id !== this.downloadId) return false + this.downloadType = type + if (type === 'start') { + this.downloadVisible = true + } + if (type === 'downLoad') { + this.percentage = num + // if (this.downLoadImageCount >= OtherInfo.ImageCount) { + // this.downLoadImageCount = OtherInfo.ImageCount + // this.percentage = 100 + // } else { + // this.percentage = (((this.downLoadImageCount / OtherInfo.ImageCount).toFixed(2)) * 100).toFixed(0) + // } + + } + // if (type === 'downLoaded') { + // } + // if (type === 'error') { + // let confirm = await this.$confirm(this.$t('trials:imageSummary:confirm:downloadError')) + // this.downLoadType = 'start' + // this.percentage = 0 + // this.downLoadImageCount = 0 + // this.downloadVisible = false + // } + } }, mounted() { this.$EventBus.$on("reload", (data) => { window.location.reload() }); + let connection = new signalR.HubConnectionBuilder() + .withUrl("/DownloadHub", { accessTokenFactory: () => getToken() }) + .configureLogging(signalR.LogLevel.Information) + .withAutomaticReconnect() + .build() + connection.start() + connection.on("ReceivProgressAsync", (id, num) => { + this.onUploadProgress2(id, num, 'downLoad') + }); } }