diff --git a/src/views/trials/trials-panel/visit/crc-upload/components/uploadPetClinicalData.vue b/src/views/trials/trials-panel/visit/crc-upload/components/uploadPetClinicalData.vue index 7969e031..1b22bd21 100644 --- a/src/views/trials/trials-panel/visit/crc-upload/components/uploadPetClinicalData.vue +++ b/src/views/trials/trials-panel/visit/crc-upload/components/uploadPetClinicalData.vue @@ -265,14 +265,44 @@ {{ $t("trials:uploadClinicalData:button:downloadTemplate") }} - {{ $t("common:button:new") }} + --> + + + {{ $t("common:button:new") }} + @@ -444,8 +474,9 @@ import { deletePreviousHistory, deletePreviousOther, deletePreviousSurgery, + getCRCClinicalData, + addOrUpdateReadingClinicalData, } from "@/api/trials"; -import { getCRCClinicalData } from "@/api/trials"; import PreviousRadiotherapy from "./previousRadiotherapy"; import PreviousSurgery from "./previousSurgery"; import PreviousOther from "./previousOther"; @@ -492,9 +523,11 @@ export default { }, data() { return { + faccept: [".pdf"], isShow: false, userTypeEnumInt: zzSessionStorage.getItem("userTypeEnumInt") * 1, loading: false, + btnLoading: false, PreviousHistoryList: [], PreviousSurgeryList: [], PreviousOtherList: [], @@ -516,6 +549,93 @@ export default { this.getClinicalData(); }, methods: { + beginScanFiles(e, id, clinicalDataTrialSetId) { + this.currentRow = { + Id: id, + ClinicalDataTrialSetId: clinicalDataTrialSetId, + SubjectId: this.data.SubjectId, + }; + this.currentRow.TrialId = this.$route.query.trialId; + var files = e.target.files; + this.fileList = []; + for (var i = 0; i < files.length; ++i) { + const fileName = files[i].name; + var extendName = fileName + .substring(fileName.lastIndexOf(".")) + .toLocaleLowerCase(); + if (this.faccept.indexOf(extendName) !== -1) { + let obj = { + size: files[i].size, + type: extendName.split(".")[1], + file: files[i], + }; + this.fileList.push(obj); + } + } + this.handleUploadFile(); + this.$refs.addFile.forEach((item) => { + item.value = null; + }); + }, + async handleUploadFile() { + this.btnLoading = true; + this.loading = true; + this.addFileList = []; + try { + for (var i = 0; i < this.fileList.length; ++i) { + const file = await this.fileToBlob(this.fileList[i].file); + var timestamp = Date.now(); + const res = await this.OSSclient.put( + `/${this.trialId}/ClinicalData/${timestamp}_${this.fileList[i].file.name}`, + file + ); + this.addFileList.push({ + fileName: this.fileList[i].file.name, + path: this.$getObjectName(res.url), + url: this.$getObjectName(res.url), + type: this.fileList[i].type, + size: this.fileList[i].size, + }); + } + this.saveClinicalData(); + } catch (err) { + console.log(err); + this.btnLoading = false; + this.loading = false; + } + }, + saveClinicalData() { + this.btnLoading = true; + this.loading = true; + var param = { + id: this.currentRow.Id, + trialId: this.currentRow.TrialId, + subjectId: this.currentRow.SubjectId, + readingId: this.subjectVisitId, + clinicalDataTrialSetId: this.currentRow.ClinicalDataTrialSetId, + isVisit: true, + deleteFileIds: [], + addFileList: this.addFileList, + }; + if (this.studyData.StudyId) { + param.StudyId = this.studyData.StudyId; + } + addOrUpdateReadingClinicalData(param) + .then((response) => { + this.btnLoading = false; + this.loading = false; + // 刷新文件列表并关闭弹窗 + this.getClinicalData(); + this.$message.success( + this.$t("trials:uploadClinicalData:message:uploadSuccessfully") + ); + this.$emit("getStudyInfo"); + }) + .catch(() => { + this.btnLoading = false; + this.loading = false; + }); + }, getClinicalData() { this.loading = true; this.data.TrialId = this.$route.query.trialId;