diff --git a/src/views/trials/trials-panel/reading/dicoms3D/components/customize/QuestionFormItem.vue b/src/views/trials/trials-panel/reading/dicoms3D/components/customize/QuestionFormItem.vue index 27154bff..e8115b57 100644 --- a/src/views/trials/trials-panel/reading/dicoms3D/components/customize/QuestionFormItem.vue +++ b/src/views/trials/trials-panel/reading/dicoms3D/components/customize/QuestionFormItem.vue @@ -288,6 +288,7 @@ import QuestionTableFormItem from './QuestionTableFormItem' import BaseModel from '@/components/BaseModel' import PreviewFile from '@/components/PreviewFile/index' import { mapGetters } from 'vuex' +import DicomEvent from '@/views/trials/trials-panel/reading/dicoms/components/DicomEvent' export default { name: 'QuestionFormItem', components: { QuestionTableFormItem, BaseModel, PreviewFile }, @@ -461,6 +462,16 @@ export default { }) } } + + DicomEvent.$on('openAddTableCol', (data) => { + let { RowId } = data + if (this.questionForm[this.question.Id] && Array.isArray(this.questionForm[this.question.Id]) && this.questionForm[this.question.Id].length > 0) { + let index = this.questionForm[this.question.Id].findIndex(item => item.RowId === RowId) + if (!!~index) { + this.openAddTableCol(this.question, index) + } + } + }) }, methods: { numberInput(id) { @@ -694,7 +705,7 @@ export default { } } if (isExistUnSaved) { - if (this.addOrEdit.type = 'add') { + if (this.addOrEdit.type === 'add') { // 标记未保存是否确认关闭? const confirm = await this.$confirm(this.$t("dicom3D:CustomizeQuestionFormItem:confirm:markNoSaveAndclose"), { type: 'warning', @@ -1193,7 +1204,7 @@ export default { } } if (isExistUnSaved) { - if (this.addOrEdit.type = 'add') { + if (this.addOrEdit.type === 'add') { //标记未保存是否确认关闭? const confirm = await this.$confirm(this.$t("dicom3D:CustomizeQuestionFormItem:confirm:markNoSaveAndclose"), { type: 'warning', diff --git a/src/views/trials/trials-panel/reading/dicoms3D/components/customize/QuestionList.vue b/src/views/trials/trials-panel/reading/dicoms3D/components/customize/QuestionList.vue index 051eb25c..2527679b 100644 --- a/src/views/trials/trials-panel/reading/dicoms3D/components/customize/QuestionList.vue +++ b/src/views/trials/trials-panel/reading/dicoms3D/components/customize/QuestionList.vue @@ -577,7 +577,7 @@ export default { try { const answers = [{ id: obj.question.Id, answer: this.questionForm[obj.question.Id] }] const markInfo = [] - + console.log(this.questionMarkInfoList, 'this.questionMarkInfoList') const index = this.questionMarkInfoList.findIndex( item => item.QuestionId === this.operateQuestionId ) @@ -604,6 +604,7 @@ export default { picturePath = pictureObj.isSuccess ? this.$getObjectName(pictureObj.result.url) : '' markInfo[0].PicturePath = picturePath } + markInfo[0].MarkId = annotation ? annotation.annotationUID : null await saveTaskQuestion(-10, { visitTaskId: this.visitTaskId, answers, @@ -665,11 +666,12 @@ export default { QuestionType: 0, RowId: this.operateRowId, TableQuestionId: this.operateQuestionId, - RowIndex: obj.rowIndex + RowIndex: obj.rowIndex, + MarkId: annotation ? annotation.annotationUID : null }, -10) this.$set(this.questionsMarkStatus, `${this.operateRowId}_${this.operateQuestionId}`, - { isMarked: !!annotation, isSaved: true, OrderMarkName: annotation.data.label } + { isMarked: !!annotation, isSaved: true, OrderMarkName: annotation ? annotation.data.label : '' } ) this.resetOperateState() } catch (e) { @@ -719,6 +721,7 @@ export default { return index > -1 ? this.questionMarkInfoList[index].MeasureData : null }, async bindAnnotationToQuestion(annotation) { + console.log(this.operateStateEnum, 'bindAnnotationToQuestion') try { const VALID_STATES = [null, 0, 1, 3] const currentState = this.operateStateEnum @@ -729,32 +732,45 @@ export default { return this.handleNullState(annotation) } if (!this.operateQuestionId) return - if ([0, 3].includes(currentState)) { + if ([0, 1, 3].includes(currentState)) { // 该标记不能与问题绑定! if (!annotation.data.label || annotation.markTool !== this.imageTool) { let message = this.$t("dicom3D:CustomizeQuestionList:alert:markNoSaveToQuestion").replace("xxx", this.$t(`dicom3D:mark:${this.imageTool}`)) this.$alert(message) return } - if (currentState === 3) { - const conflictIndex = this.questionMarkInfoList.findIndex( - item => item.MeasureData.annotationUID === annotation.annotationUID - && item.RowId !== this.operateRowId && this.operateRowId - ) - if (conflictIndex > -1) { - //该标记已绑定到其他行,不能更改绑定! - this.$alert(this.$t("dicom3D:CustomizeQuestionList:alert:markIsbind")) - return - } + // if (currentState === 3) { + let conflictIndex = this.questionMarkInfoList.findIndex( + item => item.MeasureData.annotationUID === annotation.annotationUID + && item.RowId !== this.operateRowId && item.RowId + ) + // && this.operateRowId + console.log(conflictIndex) + if (conflictIndex > -1) { + //该标记已绑定到其他行,不能更改绑定! + this.$alert(this.$t("dicom3D:CustomizeQuestionList:alert:markIsbind")) + return } + conflictIndex = this.questionMarkInfoList.findIndex( + item => item.MeasureData.annotationUID === annotation.annotationUID + && !item.TableQuestionId && this.isTableQuestion + ) + if (conflictIndex > -1) { + //该标记已绑定到外层问题,不能更改绑定! + this.$alert(this.$t("dicom3D:CustomizeQuestionList:alert:markIsbind2")) + return + } + // } // 是否确认绑定? 是否确认更改? - const message = currentState === 0 ? this.$t("dicom3D:CustomizeQuestionList:confirm:bindYesOrNo") : this.$t("dicom3D:CustomizeQuestionList:confirm:updateYesOrNo") - const result = await this.$confirm(message, { - type: 'warning', - distinguishCancelAndClose: true - }) - const isConfirmed = result === 'confirm' - if (!isConfirmed) return + const message = currentState === 0 ? this.$t("dicom3D:CustomizeQuestionList:confirm:bindYesOrNo") : currentState === 3 ? this.$t("dicom3D:CustomizeQuestionList:confirm:updateYesOrNo") : null + if (message) { + const result = await this.$confirm(message, { + type: 'warning', + distinguishCancelAndClose: true + }) + const isConfirmed = result === 'confirm' + if (!isConfirmed) return + } } const targetIndex = this.findTargetIndex() if (targetIndex === -1) { @@ -885,6 +901,9 @@ export default { qsArr.push({ ...item }) const keyId = item.RowId ? `${item.RowId}_${item.TableQuestionId}` : item.TableQuestionId; this.$set(this.questionsMarkStatus, keyId, questionMarkInfo); + if (item.RowId) { + DicomEvent.$emit('openAddTableCol', { RowId: item.RowId }) + } } if (qsArr.length > 0) { store.dispatch('dicom3d/setOperateInfo', qsArr); @@ -926,7 +945,7 @@ export default { if ((TableQuestionId && QuestionId === questionId && markTableQuestions.includes(TableQuestionId)) && !RowId) { if (questionsMarkStatus && questionsMarkStatus[TableQuestionId]) { delete questionsMarkStatus[TableQuestionId] - }else { + } else { return item } } else {