Compare commits

..

No commits in common. "3a02e9a5963bb52254242b8b54eb1414b19c0fd2" and "af586a11879e203e1edc9471eddfb10436aaea10" have entirely different histories.

5 changed files with 70 additions and 149 deletions

View File

@ -44,6 +44,7 @@ Viewer.setDefaults({
'rotatable': true,
'scalable': true,
'transition': true,
'fullscreen': true,
'keyboard': true,
'url': 'data-source'
}

View File

@ -7,11 +7,8 @@ import {
import streamSaver from "streamsaver";
import "streamsaver/examples/zip-stream.js"
let flag = {};
export const resetFlag = () => {
flag = {}
}
export const downloadImage = async (id, id2, IsDicom = true) => {
if (flag[`${id2}_${IsDicom}`]) return Vue.prototype.$message.warning(Vue.prototype.$t('trials:upload:tip:uploading'));
if (flag[`${id2}_${IsDicom}`]) return
flag[`${id2}_${IsDicom}`] = true
try {
let params = {
@ -20,31 +17,27 @@ export const downloadImage = async (id, id2, IsDicom = true) => {
IsDicom: IsDicom
}
let res = await requestPackageAndAnonymizImage(params);
flag[`${id2}_${IsDicom}`] = false;
if (res.IsSuccess) {
if (!res.Result) {
flag[`${id2}_${IsDicom}`] = false;
Vue.prototype.$message.warning(Vue.prototype.$t("trials:upload:message:not"))
return 1;
}
Vue.prototype.$message.success(Vue.prototype.$t("trials:upload:message:startUpload"));
let a = document.createElement("a");
let href = Vue.prototype.OSSclientConfig.basePath + res.Result;
download(href, res.OtherInfo.FileName, { id2, IsDicom })
// let fileName =
// res.Result.split("/")[res.Result.split("/").length - 1];
a.download = res.OtherInfo.fileName;
a.href = href;
a.click();
URL.revokeObjectURL(href);
let timer = setTimeout(() => {
a = null;
href = null;
timer = null;
}, 500)
return 2;
// let a = document.createElement("a");
// // let fileName =
// // res.Result.split("/")[res.Result.split("/").length - 1];
// a.download = res.OtherInfo.FileName;
// a.href = href;
// a.click();
// URL.revokeObjectURL(href);
// let timer = setTimeout(() => {
// a = null;
// href = null;
// timer = null;
// }, 500)
// return 2;
} else {
flag[`${id2}_${IsDicom}`] = false;
return false;
}
} catch (err) {
@ -150,70 +143,3 @@ const handleBatchDown = async (item, zip) => {
})
};
const getFileData = (fileUrl) => {
return new Promise((resolve, reject) => {
axios(fileUrl, {
method: "GET",
responseType: "blob", // 返回的数据会被强制转为blob类型 转换成arraybuffer 也行
})
.then((res) => {
resolve(res);
})
.catch((error) => {
reject(error);
});
});
};
export const fileDownload = (content, filename) => {
const eleLink = document.createElement("a");
eleLink.download = filename;
eleLink.style.display = "none";
const blob = new Blob([content]);
eleLink.href = URL.createObjectURL(blob);
document.body.appendChild(eleLink);
eleLink.click();
document.body.removeChild(eleLink);
};
let download = async (downloadUrl, downloadFileName, res) => {
const blob = await getBlob(downloadUrl);
flag[`${res.id2}_${res.IsDicom}`] = false;
saveAsB(blob, downloadFileName);
}
let getBlob = (url) => {
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = 'blob';
xhr.onload = () => {
if (xhr.status === 200) {
resolve(xhr.response);
} else {
reject(new Error(`Request failed with status ${xhr.status}`));
}
};
xhr.onerror = () => {
reject(new Error('Request failed'));
};
xhr.send();
});
}
let saveAsB = (blob, filename) => {
const link = document.createElement('a');
const body = document.body;
link.href = window.URL.createObjectURL(blob);
link.download = filename;
// hide the link
link.style.display = 'none';
body.appendChild(link);
link.click();
body.removeChild(link);
window.URL.revokeObjectURL(link.href);
}

View File

@ -203,30 +203,28 @@
>
<i slot="default" class="el-icon-plus" />
<div slot="file" slot-scope="{file}">
<viewer :images="images" :ref="file.url">
<img
class="el-upload-list__item-thumbnail"
:src="OSSclientConfig.basePath + file.url"
alt=""
crossorigin="anonymous"
<img
class="el-upload-list__item-thumbnail"
:src="OSSclientConfig.basePath + file.url"
alt=""
crossorigin="anonymous"
>
<span class="el-upload-list__item-actions">
<span
class="el-upload-list__item-preview"
@click="handlePictureCardPreview(file)"
>
<span class="el-upload-list__item-actions">
<span
class="el-upload-list__item-preview"
@click="handlePictureCardPreview(file)"
>
<i class="el-icon-zoom-in" />
</span>
<span
v-if="adInfo.ReadingTaskState < 2"
class="el-upload-list__item-delete"
@click="handleRemove(file)"
>
<i class="el-icon-delete" />
</span>
<i class="el-icon-zoom-in" />
</span>
</viewer>
<span
v-if="adInfo.ReadingTaskState < 2"
class="el-upload-list__item-delete"
@click="handleRemove(file)"
>
<i class="el-icon-delete" />
</span>
</span>
</div>
</el-upload>
@ -305,6 +303,9 @@
</div>
<SignForm ref="signForm" :sign-code-enum="signCode" @closeDialog="closeSignDialog" />
</el-dialog>
<viewer v-if="imgVisible" :images="[imageUrl]" ref="viewer">
<img :src="imageUrl" crossorigin="anonymous" alt="">
</viewer>
</div>
</template>
<script>
@ -387,8 +388,7 @@ export default {
judgeResultArmEnum: '',
criterionType: null,
openWindow: null,
isFixed: false,
images: []
isFixed: false
}
},
// watch: {
@ -707,9 +707,9 @@ export default {
},
//
handlePictureCardPreview(file) {
this.images = this.fileList.map(f => this.OSSclientConfig.basePath + f.url)
// this.imageUrl = this.OSSclientConfig.basePath + file.url
this.$refs[file.url].$viewer.show()
this.imageUrl = this.OSSclientConfig.basePath + file.url
this.imgVisible = true
this.$refs.viewer.$viewer.show()
},
//
handleRemove(file, fileList) {

View File

@ -92,30 +92,28 @@
>
<i slot="default" class="el-icon-plus" />
<div slot="file" slot-scope="{file}">
<viewer :images="images" :ref="file.url">
<img
class="el-upload-list__item-thumbnail"
:src="OSSclientConfig.basePath + file.url"
crossOrigin="anonymous"
alt=""
<img
class="el-upload-list__item-thumbnail"
:src="OSSclientConfig.basePath + file.url"
crossOrigin="anonymous"
alt=""
>
<span class="el-upload-list__item-actions">
<span
class="el-upload-list__item-preview"
@click="handlePictureCardPreview(file)"
>
<span class="el-upload-list__item-actions">
<span
class="el-upload-list__item-preview"
@click="handlePictureCardPreview(file)"
>
<i class="el-icon-zoom-in" />
</span>
<span
v-if="!isSendMessage && auditState!==2"
class="el-upload-list__item-delete"
@click="handleRemove(file)"
>
<i class="el-icon-delete" />
</span>
<i class="el-icon-zoom-in" />
</span>
</viewer>
<span
v-if="!isSendMessage && auditState!==2"
class="el-upload-list__item-delete"
@click="handleRemove(file)"
>
<i class="el-icon-delete" />
</span>
</span>
</div>
</el-upload>
<!-- <el-dialog
@ -132,9 +130,9 @@
</el-form-item>
</el-form>
<!-- <viewer v-if="imgVisible" :images="[imageUrl]" ref="viewer">
<viewer v-if="imgVisible" :images="[imageUrl]" ref="viewer">
<img :src="imageUrl" crossorigin="anonymous" alt="">
</viewer> -->
</viewer>
<el-dialog
v-if="chatVisible"
:visible.sync="chatVisible"
@ -224,8 +222,7 @@ export default {
userTypeEnumInt: zzSessionStorage.getItem('userTypeEnumInt') * 1,
isClosedDialog: false,
isSendMessage: false,
closeQuestionVisible: false,
images:[]
closeQuestionVisible: false
}
},
mounted() {
@ -385,9 +382,9 @@ export default {
},
//
handlePictureCardPreview(file) {
this.images = this.fileList.map(f => this.OSSclientConfig.basePath + f.url)
// this.imageUrl = this.OSSclientConfig.basePath + file.url
this.$refs[file.url].$viewer.show()
this.imageUrl = this.OSSclientConfig.basePath + file.url
this.imgVisible = true
this.$refs.viewer.$viewer.show()
},
//
handleRemove(file, fileList) {
@ -397,7 +394,7 @@ export default {
},
initializeViewer() {
Viewer.setDefaults({
toolbar: { zoomIn: true, zoomOut: true, rotateLeft: true, rotateRight: true, flipHorizontal: true, flipVertical: true}
toolbar: { zoomIn: true, zoomOut: true, rotateLeft: true, rotateRight: true, flipHorizontal: true, flipVertical: true }
})
}
}

View File

@ -1218,7 +1218,7 @@ import SignForm from "@/views/trials/components/newSignForm";
import { getToken } from "@/utils/auth";
import const_ from "@/const/sign-code";
import uploadPetClinicalData from "@/views/trials/trials-panel/visit/crc-upload/components/uploadPetClinicalData.vue";
import { downloadImage , resetFlag } from "@/utils/uploadZip.js";
import { downloadImage } from "@/utils/uploadZip.js";
export default {
name: "QualityAssurance",
components: {
@ -1331,9 +1331,6 @@ export default {
BodyPart: {},
};
},
beforeDestroy(){
resetFlag();
},
async mounted() {
this.BodyPart.Bodypart = await this.$getBodyPart(this.$route.query.trialId);
if (this.disabled) {