重复下载提示
continuous-integration/drone/push Build is passing Details

uat_us
wangxiaoshuang 2024-07-17 17:36:52 +08:00
parent 81506cc337
commit bebd4c4aa0
1 changed files with 7 additions and 5 deletions

View File

@ -7,7 +7,7 @@ import {
} from "@/api/load.js"; } from "@/api/load.js";
let flag = {}; let flag = {};
export const downloadImage = async (id, id2, IsDicom = true) => { export const downloadImage = async (id, id2, IsDicom = true) => {
if (flag[`${id2}_${IsDicom}`]) return if (flag[`${id2}_${IsDicom}`]) return Vue.prototype.$message.warning(Vue.prototype.$t('trials:upload:tip:uploading'));
flag[`${id2}_${IsDicom}`] = true flag[`${id2}_${IsDicom}`] = true
try { try {
let params = { let params = {
@ -16,16 +16,16 @@ export const downloadImage = async (id, id2, IsDicom = true) => {
IsDicom: IsDicom IsDicom: IsDicom
} }
let res = await requestPackageAndAnonymizImage(params); let res = await requestPackageAndAnonymizImage(params);
flag[`${id2}_${IsDicom}`] = false;
if (res.IsSuccess) { if (res.IsSuccess) {
if (!res.Result) { if (!res.Result) {
Vue.prototype.$message.warning(Vue.prototype.$t("trials:upload:message:not")) Vue.prototype.$message.warning(Vue.prototype.$t("trials:upload:message:not"))
return 1; return 1;
} }
let a = document.createElement("a"); Vue.prototype.$message.success(Vue.prototype.$t("trials:upload:message:startUpload"));
let href = Vue.prototype.OSSclientConfig.basePath + res.Result; let href = Vue.prototype.OSSclientConfig.basePath + res.Result;
download(href, res.OtherInfo.FileName) download(href, res.OtherInfo.FileName, { id2, IsDicom })
return 2; return 2;
// let a = document.createElement("a");
// // let fileName = // // let fileName =
// // res.Result.split("/")[res.Result.split("/").length - 1]; // // res.Result.split("/")[res.Result.split("/").length - 1];
// a.download = res.OtherInfo.FileName; // a.download = res.OtherInfo.FileName;
@ -39,6 +39,7 @@ export const downloadImage = async (id, id2, IsDicom = true) => {
// }, 500) // }, 500)
// return 2; // return 2;
} else { } else {
flag[`${id2}_${IsDicom}`] = false;
return false; return false;
} }
} catch (err) { } catch (err) {
@ -145,8 +146,9 @@ export const fileDownload = (content, filename) => {
eleLink.click(); eleLink.click();
document.body.removeChild(eleLink); document.body.removeChild(eleLink);
}; };
let download = async (downloadUrl, downloadFileName) => { let download = async (downloadUrl, downloadFileName, res) => {
const blob = await getBlob(downloadUrl); const blob = await getBlob(downloadUrl);
flag[`${res.id2}_${res.IsDicom}`] = false;
saveAsB(blob, downloadFileName); saveAsB(blob, downloadFileName);
} }