上传添加时间戳
continuous-integration/drone/push Build is passing Details

uat_us
熊飞 2024-01-18 11:17:54 +08:00
parent 033a34cf1e
commit 8081b33a97
2 changed files with 211 additions and 178 deletions

View File

@ -24,7 +24,28 @@ async function ossGenerateSTS() {
switch (res.Result.ObjectStoreUse) { switch (res.Result.ObjectStoreUse) {
case 'AliyunOSS': case 'AliyunOSS':
Vue.prototype.OSSclientConfig.bucket = Vue.prototype.OSSclientConfig.bucketName Vue.prototype.OSSclientConfig.bucket = Vue.prototype.OSSclientConfig.bucketName
Vue.prototype.OSSclient = new OSS(Vue.prototype.OSSclientConfig) let OSSclient = new OSS(Vue.prototype.OSSclientConfig)
Vue.prototype.OSSclient = {
put: function (objectName, object) {
return new Promise(async (resolve, reject) => {
try {
objectName = objectName + '_' + new Date().getTime()
let res = await OSSclient.put(objectName, object)
if (res && res.url) {
resolve({
name: objectName,
url: Vue.prototype.OSSclientConfig.viewEndpoint + objectName
})
} else {
reject()
}
} catch (e) {
console.log(e)
reject()
}
})
}
}
break break
case 'MinIO': case 'MinIO':
let minioClient = new Minio.Client(Vue.prototype.OSSclientConfig); let minioClient = new Minio.Client(Vue.prototype.OSSclientConfig);

View File

@ -1021,6 +1021,7 @@ export default {
archiveStudy(index, config) { archiveStudy(index, config) {
var scope = this var scope = this
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
try {
preArchiveDicomStudy({ preArchiveDicomStudy({
trialId: scope.trialId, trialId: scope.trialId,
siteId: scope.data.SiteId, siteId: scope.data.SiteId,
@ -1092,6 +1093,7 @@ export default {
for (let ii = 0; ii < v.instanceList.length; ii++) { for (let ii = 0; ii < v.instanceList.length; ii++) {
arr.push((function (){ arr.push((function (){
return new Promise(async resolve1 => { return new Promise(async resolve1 => {
try {
let o = v.instanceList[ii] let o = v.instanceList[ii]
let name = `${v.instanceList[ii].instanceUid}_${v.instanceList[ii].file.webkitRelativePath}` let name = `${v.instanceList[ii].instanceUid}_${v.instanceList[ii].file.webkitRelativePath}`
if (o.isReUpload) { if (o.isReUpload) {
@ -1101,7 +1103,8 @@ export default {
} else { } else {
let path = `/${params.trialId}/Image/${params.siteId}/${params.subjectId}/${params.subjectVisitId}/${dicomInfo.studyUid}/${v.seriesUid}/${o.instanceUid}/${scope.getGuid(dicomInfo.studyUid + v.seriesUid + o.instanceUid + params.trialId)}` let path = `/${params.trialId}/Image/${params.siteId}/${params.subjectId}/${params.subjectVisitId}/${dicomInfo.studyUid}/${v.seriesUid}/${o.instanceUid}/${scope.getGuid(dicomInfo.studyUid + v.seriesUid + o.instanceUid + params.trialId)}`
let res = await dcmUpload(path, o.file, config) let res = await dcmUpload(path, o.file, config)
if (!res) { console.log('imageRes', res)
if (!res || !res.url) {
params.failedFileCount++ params.failedFileCount++
} else { } else {
dicomInfo.failedFileCount++ dicomInfo.failedFileCount++
@ -1113,6 +1116,7 @@ export default {
let thumbnailPath = `/${params.trialId}/Image/${params.siteId}/${params.subjectId}/${params.subjectVisitId}/${dicomInfo.studyUid}/${v.seriesUid}/${v.seriesUid}.png` let thumbnailPath = `/${params.trialId}/Image/${params.siteId}/${params.subjectId}/${params.subjectVisitId}/${dicomInfo.studyUid}/${v.seriesUid}/${v.seriesUid}.png`
let OSSclient = scope.OSSclient let OSSclient = scope.OSSclient
let seriesRes = await OSSclient.put(thumbnailPath, blob) let seriesRes = await OSSclient.put(thumbnailPath, blob)
console.log('seriesRes', seriesRes)
if (seriesRes && seriesRes.url) { if (seriesRes && seriesRes.url) {
ImageResizePath = scope.$getObjectName(seriesRes.url) ImageResizePath = scope.$getObjectName(seriesRes.url)
} }
@ -1145,6 +1149,10 @@ export default {
} }
} }
resolve1() resolve1()
} catch (e) {
console.log(e)
resolve1()
}
}) })
})()) })())
if (arr.length >= 66 || ii === v.instanceList.length - 1) { if (arr.length >= 66 || ii === v.instanceList.length - 1) {
@ -1210,6 +1218,10 @@ export default {
clearInterval(t) clearInterval(t)
} }
}) })
} catch (e) {
console.log(e)
reject()
}
}) })
}, },
generateTxtFile(text) { generateTxtFile(text) {