下载优化
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
ca12b70f41
commit
c9d930ce74
|
|
@ -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
|
||||
})
|
||||
}
|
||||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue