diff --git a/src/components/uploadImage/components/upload-list.vue b/src/components/uploadImage/components/upload-list.vue index e17b45b0..2aece1d2 100644 --- a/src/components/uploadImage/components/upload-list.vue +++ b/src/components/uploadImage/components/upload-list.vue @@ -239,6 +239,12 @@ export default { return []; }, }, + UploadStudyList: { + type: Array, + default: () => { + return []; + }, + }, }, data() { return { @@ -246,8 +252,18 @@ export default { uploadList: [], // 待上传文件列表 dicomList: [], // 上传的文件列表 requestNum: 6, + hasOtherStudy: false, // 是否上传文件检查与列表不一致 }; }, + watch: { + isLoad() { + if (!this.isLoad) { + this.$refs.file.value = null; + if (this.dicomList.some((item) => item.isUpload === 3)) { + } + } + }, + }, methods: { // 预上传 async preArchiveDicomStudy(post, index) { @@ -280,31 +296,23 @@ export default { let files = e.target.files; try { this.dicomList = []; + this.hasOtherStudy = false; for (var i = 0; i < files.length; ++i) { let dicom = await parseDicom(files[i]); - let has = this.StudyInstanceUidList.some( + if (!dicom) continue; + let has = this.dicomList.some( + (item) => item.SopInstanceUid === dicom.SopInstanceUid + ); + if (has) continue; + has = this.StudyInstanceUidList.some( (item) => item.StudyInstanceUid === dicom.StudyInstanceUid ); - if ( - !dicom || - !has || - this.SopInstanceUidList.includes(dicom.SopInstanceUid) - ) { - if (i === files.length - 1 && this.dicomList.length <= 0) { - let confirm = await this.$confirm( - this.$t("trials:uploadImage:confirmMessage:failSubject"), - { - type: "warning", - distinguishCancelAndClose: true, - confirmButtonText: this.$t("common:button:confirm"), - cancelButtonText: this.$t("common:button:cancel"), - } - ); - if (confirm !== "confirm") continue; - this.$refs.file.click(); - } + if (!has) { + this.hasOtherStudy = true; continue; } + if (this.SopInstanceUidList.includes(dicom.SopInstanceUid)) continue; + this.isLoad = true; dicom.file = files[i]; dicom.isUpload = 0; @@ -354,12 +362,6 @@ export default { dicom.SeriesInstanceUid ); } - if ( - item.SopInstanceUidList && - item.SopInstanceUidList.length > 0 - ) { - uploadData.IsDicomReUpload = true; - } } return uploadData.StudyInstanceUid === dicom.StudyInstanceUid; @@ -393,8 +395,9 @@ export default { }, }; if ( - item.SopInstanceUidList && - item.SopInstanceUidList.length > 0 + this.UploadStudyList.some( + (d) => d.StudyInstanceUid === uploadData.StudyInstanceUid + ) ) { uploadData.IsDicomReUpload = true; } @@ -405,6 +408,20 @@ export default { }); this.dicomList.push(dicom); } + if (this.dicomList.length <= 0 && this.hasOtherStudy) { + let confirm = await this.$confirm( + this.$t("trials:uploadImage:confirmMessage:failSubject"), + { + type: "warning", + distinguishCancelAndClose: true, + confirmButtonText: this.$t("common:button:confirm"), + cancelButtonText: this.$t("common:button:cancel"), + } + ); + if (confirm !== "confirm") return false; + this.$refs.file.click(); + return false; + } let funArr = []; for (let i = 0; i < this.uploadList.length; i++) { let item = this.uploadList[i]; @@ -423,6 +440,7 @@ export default { } } catch (err) { console.log(err); + this.$refs.file.value = null; } }, // 并发上传 @@ -471,6 +489,10 @@ export default { if (res.IsSuccess) { uploadDicom.status = 4; this.$emit("getList"); + let ind = this.uploadList.findIndex( + (item) => item.StudyInstanceUid === uploadDicom.StudyInstanceUid + ); + this.uploadList.splice(ind, 1); } else { uploadDicom.status = 5; } diff --git a/src/components/uploadImage/index.vue b/src/components/uploadImage/index.vue index 1897cd08..c1901df3 100644 --- a/src/components/uploadImage/index.vue +++ b/src/components/uploadImage/index.vue @@ -87,6 +87,7 @@ v-if="Criterion.ImageUploadEnum > 0 && isUpload" :StudyInstanceUidList="StudyInstanceUidList" :SopInstanceUidList="SopInstanceUidList" + :UploadStudyList="UploadStudyList" @getList="getList" /> { if (item.OrginalStudyList && Array.isArray(item.OrginalStudyList)) { @@ -197,6 +200,7 @@ export default { item.UploadStudyList.forEach((data) => { data.SopInstanceUidList && this.SopInstanceUidList.push(...data.SopInstanceUidList); + this.UploadStudyList.push(data); }); } });