diff --git a/src/views/trials/trials-panel/reading/dicoms/components/IVUS/QuestionList.vue b/src/views/trials/trials-panel/reading/dicoms/components/IVUS/QuestionList.vue index d824df47..34c68ec0 100644 --- a/src/views/trials/trials-panel/reading/dicoms/components/IVUS/QuestionList.vue +++ b/src/views/trials/trials-panel/reading/dicoms/components/IVUS/QuestionList.vue @@ -189,11 +189,22 @@ - + - this.handleSave(index, { silentSuccess: true, skipRefresh: true })) + } + } + saveTasks.push(() => this.$refs['ecrf2'] && this.$refs['ecrf2'].handleSave({ silentSuccess: true, skipRefresh: true })) + saveTasks.push(() => this.$refs['ecrf3'] && this.$refs['ecrf3'].handleSave({ silentSuccess: true, skipRefresh: true })) + await Promise.allSettled(saveTasks.map(saveTask => saveTask())) + } catch (e) { + console.log(e) + } finally { + this.upload.visible = false + } }, renderHeader(h, { column, $index }) { const span = document.createElement('span') diff --git a/src/views/trials/trials-panel/reading/dicoms/components/OCT/QuestionList.vue b/src/views/trials/trials-panel/reading/dicoms/components/OCT/QuestionList.vue index 5067437e..c1ddf028 100644 --- a/src/views/trials/trials-panel/reading/dicoms/components/OCT/QuestionList.vue +++ b/src/views/trials/trials-panel/reading/dicoms/components/OCT/QuestionList.vue @@ -189,11 +189,22 @@ - + - @@ -617,7 +628,7 @@ export default { return v } }, - async handleSave(index) { + async handleSave(index, options = {}) { if (this.rowSaveLoadingMap[index]) return const refName = `questions${index}` this.$set(this.rowSaveLoadingMap, index, true) @@ -635,9 +646,13 @@ export default { answers: answers } await saveTaskQuestion(12, params) - this.$message.success(this.$t('common:message:savedSuccessfully')) + if (!options.silentSuccess) { + this.$message.success(this.$t('common:message:savedSuccessfully')) + } DicomEvent.$emit('getReportInfo', true) - this.refreshQuestions() + if (!options.skipRefresh) { + await this.refreshQuestions() + } this.formChanged = false } catch (e) { console.log(e) @@ -884,9 +899,23 @@ export default { } }, async uploadDlgClose() { - this.refreshQuestions() - DicomEvent.$emit('getReportInfo', true) - this.upload.visible = false + try { + await this.refreshQuestions() + const saveTasks = [] + for (let index = 0; index < this.questions.length; index++) { + const qs = this.questions[index] + if (qs.GroupClassify === 6) { + saveTasks.push(() => this.handleSave(index, { silentSuccess: true, skipRefresh: true })) + } + } + saveTasks.push(() => this.$refs['ecrf2'] && this.$refs['ecrf2'].handleSave({ silentSuccess: true, skipRefresh: true })) + saveTasks.push(() => this.$refs['ecrf3'] && this.$refs['ecrf3'].handleSave({ silentSuccess: true, skipRefresh: true })) + await Promise.allSettled(saveTasks.map(saveTask => saveTask())) + } catch (e) { + console.log(e) + } finally { + this.upload.visible = false + } }, renderHeader(h, { column, $index }) { const span = document.createElement('span') diff --git a/src/views/trials/trials-panel/reading/dicoms/components/Questions.vue b/src/views/trials/trials-panel/reading/dicoms/components/Questions.vue index d9a08683..cb261e9f 100644 --- a/src/views/trials/trials-panel/reading/dicoms/components/Questions.vue +++ b/src/views/trials/trials-panel/reading/dicoms/components/Questions.vue @@ -279,84 +279,86 @@ export default { }) }, - handleSave() { - if (this.saveLoading) return + async handleSave(options = {}) { + if (this.saveLoading) return false this.saveLoading = true - this.$refs['questions'].validate(async (valid) => { - if (!valid) { - this.saveLoading = false - return - } - // lugano标准校验脾脏状态是否符合要求 - if ((this.criterionType === 2 || this.criterionType === 18) && this.groupClassify === 3) { - // 是否有标记未保存 - var existUnSave = this.checkAnnotationStatus(this.questions) - if (existUnSave) { - this.$alert(this.$t('trials:lugano:message:saveWarning'), this.$t('trials:lugano:fusionDialog:warning')) - this.saveLoading = false - return - } - - var currentSpleenStatus = this.questionForm[this.spleenStatusId] - var currentSpleenLength = this.questionForm[this.spleenLengthId] - currentSpleenStatus = isNaN(parseInt(currentSpleenStatus)) ? null : parseInt(currentSpleenStatus) - var stIdx = this.measurements.findIndex(i => i.QuestionType === 60) - var slIdx = this.measurements.findIndex(i => i.QuestionType === 61) - - if (currentSpleenLength && currentSpleenStatus === 5) { - // '脾脏状态为不可评估,不需要添加标记!' - this.$alert(this.$t('trials:lugano:message:validSpleen1'), this.$t('trials:lugano:fusionDialog:warning'), { - callback: _ => { } - }) - this.saveLoading = false - } else if (currentSpleenStatus === 5 && ((stIdx > -1 && this.measurements[stIdx].MeasureData) || (slIdx > -1 && this.measurements[slIdx].MeasureData))) { - // 若有标记,状态不可为“无法评估” - this.$alert(this.$t('trials:lugano:message:validSpleen1'), this.$t('trials:lugano:fusionDialog:warning'), { - callback: _ => { } - }) - this.saveLoading = false - } else if (((stIdx > -1 && this.measurements[stIdx].MeasureData) || (slIdx > -1 && this.measurements[slIdx].MeasureData)) && !currentSpleenLength) { - this.$alert(this.$t('trials:lugano:message:validSpleen2'), this.$t('trials:lugano:fusionDialog:warning'), { - callback: _ => { } - }) - this.saveLoading = false - } else { - this.saveQuestionsList() - } - } else if ((this.criterionType === 2 || this.criterionType === 18) && this.groupClassify === 1 && this.questionForm[this.imageQualityIssuesId] && parseInt(this.questionForm[this.imageQualityIssuesId]) === 6) { - // 保存影响质量问题分组,如果质量问题为PET-CT影像无法融合则验证是否可以保存 - let res = null - if (this.criterionType === 18) { - res = await getCanChooseNotMergeNoPet({ visitTaskId: this.visitTaskId }) - } else { - res = await getCanChooseNotMerge({ visitTaskId: this.visitTaskId }) - } - - if (res.IsSuccess && !res.Result.IsCanChooseNotMerge) { - // this.$alert(this.$t('trials:lugano:saveQuestions:warning1'), this.$t('trials:lugano:fusionDialog:warning'), {showCancelButton: false}) - this.$alert(this.$t('trials:lugano:saveQuestions:warning1'), this.$t('trials:lugano:fusionDialog:warning'), { - showCancelButton: false, - callback: action => { } - }) - this.saveLoading = false - return - } else { - // 如果设置为PET-CT影像无法融合,则FDG-PET评估会被设置为NE。 - this.$confirm(this.$t('trials:lugano:saveQuestions:warning2'), { - type: 'warning', - distinguishCancelAndClose: true - }) - .then(() => { - this.saveQuestionsList() - }) - } - } else { - this.saveQuestionsList() - } - // this.saveQuestionsList() + const valid = await new Promise(resolve => { + this.$refs['questions'].validate(v => resolve(v)) }) + if (!valid) { + this.saveLoading = false + return false + } + // lugano标准校验脾脏状态是否符合要求 + if ((this.criterionType === 2 || this.criterionType === 18) && this.groupClassify === 3) { + // 是否有标记未保存 + var existUnSave = this.checkAnnotationStatus(this.questions) + if (existUnSave) { + await this.$alert(this.$t('trials:lugano:message:saveWarning'), this.$t('trials:lugano:fusionDialog:warning')) + this.saveLoading = false + return false + } + + var currentSpleenStatus = this.questionForm[this.spleenStatusId] + var currentSpleenLength = this.questionForm[this.spleenLengthId] + currentSpleenStatus = isNaN(parseInt(currentSpleenStatus)) ? null : parseInt(currentSpleenStatus) + var stIdx = this.measurements.findIndex(i => i.QuestionType === 60) + var slIdx = this.measurements.findIndex(i => i.QuestionType === 61) + + if (currentSpleenLength && currentSpleenStatus === 5) { + // '脾脏状态为不可评估,不需要添加标记!' + await this.$alert(this.$t('trials:lugano:message:validSpleen1'), this.$t('trials:lugano:fusionDialog:warning'), { + callback: _ => { } + }) + this.saveLoading = false + return false + } else if (currentSpleenStatus === 5 && ((stIdx > -1 && this.measurements[stIdx].MeasureData) || (slIdx > -1 && this.measurements[slIdx].MeasureData))) { + // 若有标记,状态不可为“无法评估” + await this.$alert(this.$t('trials:lugano:message:validSpleen1'), this.$t('trials:lugano:fusionDialog:warning'), { + callback: _ => { } + }) + this.saveLoading = false + return false + } else if (((stIdx > -1 && this.measurements[stIdx].MeasureData) || (slIdx > -1 && this.measurements[slIdx].MeasureData)) && !currentSpleenLength) { + await this.$alert(this.$t('trials:lugano:message:validSpleen2'), this.$t('trials:lugano:fusionDialog:warning'), { + callback: _ => { } + }) + this.saveLoading = false + return false + } + return await this.saveQuestionsList(options) + } else if ((this.criterionType === 2 || this.criterionType === 18) && this.groupClassify === 1 && this.questionForm[this.imageQualityIssuesId] && parseInt(this.questionForm[this.imageQualityIssuesId]) === 6) { + // 保存影响质量问题分组,如果质量问题为PET-CT影像无法融合则验证是否可以保存 + let res = null + if (this.criterionType === 18) { + res = await getCanChooseNotMergeNoPet({ visitTaskId: this.visitTaskId }) + } else { + res = await getCanChooseNotMerge({ visitTaskId: this.visitTaskId }) + } + + if (res.IsSuccess && !res.Result.IsCanChooseNotMerge) { + await this.$alert(this.$t('trials:lugano:saveQuestions:warning1'), this.$t('trials:lugano:fusionDialog:warning'), { + showCancelButton: false, + callback: action => { } + }) + this.saveLoading = false + return false + } + // 如果设置为PET-CT影像无法融合,则FDG-PET评估会被设置为NE。 + const confirm = await this.$confirm(this.$t('trials:lugano:saveQuestions:warning2'), { + type: 'warning', + distinguishCancelAndClose: true + }).then(() => true).catch(() => false) + if (!confirm) { + this.saveLoading = false + return false + } + return await this.saveQuestionsList(options) + } else { + return await this.saveQuestionsList(options) + } }, - async saveQuestionsList() { + async saveQuestionsList(options = {}) { this.loading = true var answers = [] var imageQuality = null @@ -382,18 +384,22 @@ export default { // }) // params.questionMarkInfoList = questionMarkInfoList // } - - saveTaskQuestion(this.questionType, params).then(async res => { + try { + const res = await saveTaskQuestion(this.questionType, params) if (this.imageQualityIssuesId) { store.dispatch('reading/setImageQualityIssues', this.questionForm[this.imageQualityIssuesId]) if (this.questionForm[this.imageQualityIssuesId] && parseInt(this.questionForm[this.imageQualityIssuesId]) === 6) { DicomEvent.$emit('closePetct') } } - this.$message.success(this.$t('common:message:savedSuccessfully')) - var trialId = this.$route.query.trialId - await store.dispatch('reading/refreshDicomReadingQuestionAnswer', { trialId: trialId, visitTaskId: this.visitTaskId }) - this.getQuestions(this.visitTaskId, true) + if (!options.silentSuccess) { + this.$message.success(this.$t('common:message:savedSuccessfully')) + } + if (!options.skipRefresh) { + var trialId = this.$route.query.trialId + await store.dispatch('reading/refreshDicomReadingQuestionAnswer', { trialId: trialId, visitTaskId: this.visitTaskId }) + this.getQuestions(this.visitTaskId, true) + } this.loading = false if (this.isQulityIssues) { DicomEvent.$emit('questionFormChange', false) @@ -417,10 +423,12 @@ export default { } this.formChanged = false this.saveLoading = false - }).catch(() => { + return res + } catch (e) { this.loading = false this.saveLoading = false - }) + throw e + } }, checkAnnotationStatus(obj) { for (let i = 0; i < obj.length; i++) { diff --git a/src/views/trials/trials-panel/reading/dicoms/index.vue b/src/views/trials/trials-panel/reading/dicoms/index.vue index 39beac30..074952d0 100644 --- a/src/views/trials/trials-panel/reading/dicoms/index.vue +++ b/src/views/trials/trials-panel/reading/dicoms/index.vue @@ -147,7 +147,7 @@ - + {{ $t('trials:reading:button:confirm') }} @@ -223,7 +223,8 @@ export default { readingVersionEnum: null, dialogBodyPartVisible: false, isReadKeyFile: true, - isHaveKeyFile: false + isHaveKeyFile: false, + IsViewStudyPart: true } }, computed: {