uat_us
caiyiling 2024-07-18 11:14:36 +08:00
commit 5e14615176
6 changed files with 148 additions and 69 deletions

View File

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

View File

@ -7,8 +7,11 @@ import {
import streamSaver from "streamsaver"; import streamSaver from "streamsaver";
import "streamsaver/examples/zip-stream.js" import "streamsaver/examples/zip-stream.js"
let flag = {}; let flag = {};
export const resetFlag = () => {
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 = {
@ -17,27 +20,31 @@ 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) {
flag[`${id2}_${IsDicom}`] = false;
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;
// let fileName = download(href, res.OtherInfo.FileName, { id2, IsDicom })
// 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; 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 { } else {
flag[`${id2}_${IsDicom}`] = false;
return false; return false;
} }
} catch (err) { } catch (err) {
@ -143,3 +150,70 @@ 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,28 +203,30 @@
> >
<i slot="default" class="el-icon-plus" /> <i slot="default" class="el-icon-plus" />
<div slot="file" slot-scope="{file}"> <div slot="file" slot-scope="{file}">
<img <viewer :images="images" :ref="file.url">
class="el-upload-list__item-thumbnail" <img
:src="OSSclientConfig.basePath + file.url" class="el-upload-list__item-thumbnail"
alt="" :src="OSSclientConfig.basePath + file.url"
crossorigin="anonymous" alt=""
> crossorigin="anonymous"
<span class="el-upload-list__item-actions">
<span
class="el-upload-list__item-preview"
@click="handlePictureCardPreview(file)"
> >
<i class="el-icon-zoom-in" /> <span class="el-upload-list__item-actions">
</span> <span
class="el-upload-list__item-preview"
@click="handlePictureCardPreview(file)"
>
<i class="el-icon-zoom-in" />
</span>
<span <span
v-if="adInfo.ReadingTaskState < 2" v-if="adInfo.ReadingTaskState < 2"
class="el-upload-list__item-delete" class="el-upload-list__item-delete"
@click="handleRemove(file)" @click="handleRemove(file)"
> >
<i class="el-icon-delete" /> <i class="el-icon-delete" />
</span>
</span> </span>
</span> </viewer>
</div> </div>
</el-upload> </el-upload>
@ -303,9 +305,6 @@
</div> </div>
<SignForm ref="signForm" :sign-code-enum="signCode" @closeDialog="closeSignDialog" /> <SignForm ref="signForm" :sign-code-enum="signCode" @closeDialog="closeSignDialog" />
</el-dialog> </el-dialog>
<viewer v-if="imgVisible" :images="[imageUrl]" ref="viewer">
<img :src="imageUrl" crossorigin="anonymous" alt="">
</viewer>
</div> </div>
</template> </template>
<script> <script>
@ -388,7 +387,8 @@ export default {
judgeResultArmEnum: '', judgeResultArmEnum: '',
criterionType: null, criterionType: null,
openWindow: null, openWindow: null,
isFixed: false isFixed: false,
images: []
} }
}, },
// watch: { // watch: {
@ -707,9 +707,9 @@ export default {
}, },
// //
handlePictureCardPreview(file) { handlePictureCardPreview(file) {
this.imageUrl = this.OSSclientConfig.basePath + file.url this.images = this.fileList.map(f => this.OSSclientConfig.basePath + f.url)
this.imgVisible = true // this.imageUrl = this.OSSclientConfig.basePath + file.url
this.$refs.viewer.$viewer.show() this.$refs[file.url].$viewer.show()
}, },
// //
handleRemove(file, fileList) { handleRemove(file, fileList) {

View File

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

@ -1045,7 +1045,7 @@ export default {
formRow: {}, formRow: {},
searchData: searchDataDefault(), searchData: searchDataDefault(),
loading: false, loading: false,
uploadVisible: true, uploadVisible: false,
qcVisible: false, qcVisible: false,
list: [], list: [],
total: 0, total: 0,

View File

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