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 7da89dc0..78ac9fa9 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 @@ -366,6 +366,10 @@ export default { const i = this.questionMarkInfoList.findIndex(i => i.MeasureData && i.MeasureData.annotationUID === annotation.annotationUID) return i > -1 }, + verifyFileIsBound(annotation) { + const i = this.questionMarkInfoList.findIndex(i => i.MeasureData && i.MeasureData.noneDicomFileId === annotation.noneDicomFileId) + return i > -1 + }, async operateImageMarker(obj) { const STATE = { BIND: 0, // 绑定标记 @@ -1159,6 +1163,8 @@ export default { if (ps) { if (prop === 'area') value = this.reRound(csUtils.roundNumber(value * ps * ps), this.digitPlaces) if (prop === 'length' || prop === 'perimeter') value = this.reRound(csUtils.roundNumber(value * ps), this.digitPlaces) + } else { + value = this.reRound(csUtils.roundNumber(value), this.digitPlaces) } let obj = { QuestionId: item.QuestionId, diff --git a/src/views/trials/trials-panel/reading/visit-review/components/FileViewer.vue b/src/views/trials/trials-panel/reading/visit-review/components/FileViewer.vue index b489a584..f9f7a265 100644 --- a/src/views/trials/trials-panel/reading/visit-review/components/FileViewer.vue +++ b/src/views/trials/trials-panel/reading/visit-review/components/FileViewer.vue @@ -126,7 +126,8 @@ @dblclick="toggleFullScreen($event, index)" @click="activeCanvas(index)" @mouseup="sliderMouseup($event, index)" @mousemove="sliderMousemove($event, index)" @mouseleave="sliderMouseleave($event, index)"> -
+
@@ -350,7 +351,11 @@ export default { taskId: '', isReadingTaskViewInOrder: null, trialCriterion: {}, - saveCustomAnnotationTimer: null + saveCustomAnnotationTimer: null, + curOperation: { + type: '', + annotation: null + } } }, computed: { @@ -544,11 +549,17 @@ export default { toolGroup.addTool(PlanarRotateTool.toolName) toolGroup.addTool(ArrowAnnotateTool.toolName, { arrowHeadStyle: 'standard', + // changeTextCallback: async (data, eventData, doneChangingTextCallback) => { + // return doneChangingTextCallback(await this.customPrompt()) + // }, + // getTextCallback: async (doneChangingTextCallback) => { + // return doneChangingTextCallback(await this.customPrompt()) + // } changeTextCallback: async (data, eventData, doneChangingTextCallback) => { - return doneChangingTextCallback(await this.customPrompt()) + return doneChangingTextCallback(data.text) }, getTextCallback: async (doneChangingTextCallback) => { - return doneChangingTextCallback(await this.customPrompt()) + return doneChangingTextCallback('Annotation') } }) toolGroup.addTool(RectangleROITool.toolName, { @@ -947,13 +958,13 @@ export default { try { // if ( this.resetAnnotation && this.isFusion ) return false if (!annotation) return false - if (annotation.metadata.toolName === 'Lengthscale') { - await this.$confirm( - this.$t('trials:trials-list:table:LengthscaleIsDeleted') - ) - const errorMsg = { message: 'Lengthscale Not delete' } - throw errorMsg - } + // if (annotation.metadata.toolName === 'Lengthscale') { + // await this.$confirm( + // this.$t('trials:trials-list:table:LengthscaleIsDeleted') + // ) + // const errorMsg = { message: 'Lengthscale Not delete' } + // throw errorMsg + // } if (this.readingTaskState === 2 && !annotation.data.label && annotation.metadata.toolName !== 'Lengthscale') return false if (this.readingTaskState === 2) { const errorMsg = { message: 'annotation Not allowed to operate' } @@ -975,16 +986,32 @@ export default { const errorMsg = { message: 'annotation Not allowed to operate' } throw errorMsg } else if (this.activeTool === 'Eraser') { - await this.$confirm( - this.$t('trials:trials-list:table:isDeleted') + - annotation.data.label + - '?' - ) + if (annotation.metadata.toolName === 'Lengthscale') { + await this.$confirm( + this.$t('trials:trials-list:table:isDeleted') + + this.$t('trials:nondicom-show:scale') + + '?' + ) + } else { + await this.$confirm( + this.$t('trials:trials-list:table:isDeleted') + + annotation.data.label + + '?' + ) + } + if (annotation.id) { let res = await deleteTrialFileType(annotation.id) if (!res.IsSuccess) throw '' } - + let psIndex = this.psArr.findIndex(item => item.Path === annotation.path) + if (psIndex > -1) { + this.psArr.splice(psIndex, 1) + } + console.log(this.psArr, psIndex) + if (annotation.metadata.toolName === 'Lengthscale') { + this.$emit('getEcrf', { type: "changePlottingScaleChangeAnswer", VisitTaskId: this.taskInfo.VisitTaskId, noneDicomFileId: annotation.noneDicomFileId, path: annotation.path || '', picturePath: null, psArr: this.psArr, isRemovePlottingScale: false }) + } const renderingEngine = getRenderingEngine(renderingEngineId) for (let i = 0; i < this.cells.length; i++) { const viewportId = `canvas-${i}` @@ -1040,47 +1067,26 @@ export default { annotation.path = path let ps = null let psIndex = this.psArr.findIndex(i => i.Path === path) - if (psIndex > -1 && this.psArr[i].PS) { - ps = parseFloat(this.psArr[i].PS).toFixed(3) + if (psIndex > -1 && this.psArr[psIndex].PS) { + ps = parseFloat(this.psArr[psIndex].PS).toFixed(3) } annotation.ps = ps if (!annotation.data.label && annotation.metadata.toolName !== 'Lengthscale') return if (annotation.metadata.toolName === 'PlanarFreehandROI' && !annotation.data.contour.closed) return if (annotation.metadata.toolName === 'Lengthscale') { const value = annotation.data.l + if (isNaN(parseFloat(value))) return false let ps = 1 if (value) { const cachedStats = Object.keys(annotation.data.cachedStats) ps = value / annotation.data.cachedStats[cachedStats[0]].length annotation.data.ps = ps - this.$emit('setPS', { NoneDicomFileId: fileList[fileIndex].Id, Path: fileList[fileIndex].Path, PS: ps, OldPS: 1 }) + this.$emit('setPS', { NoneDicomFileId: fileList[fileIndex].Id, Path: fileList[fileIndex].Path, PS: ps }) } this.setToolsPassive() if (this.customizeStandardsNoneDicom.find(item => item.toolName === annotation.metadata?.toolName)) return false - if (this.saveCustomAnnotationTimer) { - clearTimeout(this.saveCustomAnnotationTimer) - this.saveCustomAnnotationTimer = null - } - let psIndex = this.psArr.findIndex(p => p.NoneDicomFileId === fileList[fileIndex].Id) - let OldPS = 1 - if (psIndex > -1) { - OldPS = this.psArr[i].OldPS - } - let Proportion = ps / OldPS - return this.saveCustomAnnotationTimer = setTimeout(async () => { - if (OldPS === ps || !this.ecrf.IsHaveBindingQuestion) { - this.saveCustomAnnotation(annotation) - } else { - await this.$confirm( - this.$t('trials:trials-list:table:allQuestionChange') - ).then(() => { - this.saveCustomAnnotation(annotation, Proportion) - }) - .catch(action => { - this.saveCustomAnnotation(annotation, -1) - }); - } - }, 500) + this.curOperation.type = 'Modified' + return this.curOperation.annotation = annotation } this.$emit("getEcrf", { type: "getOperateStateEnum", VisitTaskId: this.taskInfo.VisitTaskId }) this.$emit('getEcrf', { type: "verifyAnnotationIsBound", VisitTaskId: this.taskInfo.VisitTaskId, annotation }) @@ -1090,11 +1096,8 @@ export default { if (isBound || this.isNumber(operateStateEnum)) { this.$emit('getEcrf', { type: "updateAnnotationToQuestion", VisitTaskId: this.taskInfo.VisitTaskId, annotation }) } else { - if (this.saveCustomAnnotationTimer) { - clearTimeout(this.saveCustomAnnotationTimer) - this.saveCustomAnnotationTimer = null - } - this.saveCustomAnnotationTimer = setTimeout(() => { this.saveCustomAnnotation(annotation) }, 1000) + this.curOperation.type = 'Modified' + this.curOperation.annotation = annotation } this.setToolsPassive() }) @@ -1121,8 +1124,8 @@ export default { annotation.path = path let ps = null let psIndex = this.psArr.findIndex(i => i.Path === path) - if (psIndex > -1 && this.psArr[i].PS) { - ps = parseFloat(this.psArr[i].PS).toFixed(3) + if (psIndex > -1 && this.psArr[psIndex].PS) { + ps = parseFloat(this.psArr[psIndex].PS).toFixed(3) } annotation.ps = ps annotation.markTool = annotation.metadata.toolName @@ -1183,7 +1186,16 @@ export default { if (annotations[i].visitTaskId !== this.taskInfo.VisitTaskId) { return } else { - this.$emit('getEcrf', { type: "bindAnnotationToQuestion", VisitTaskId: this.taskInfo.VisitTaskId, annotation: annotations[i] }) + let annotation = annotations[i] + const imageId = annotation.metadata.referencedImageId + const path = imageId.split(`web:${this.OSSclientConfig.basePath}`)[1] + let psIndex = this.psArr.findIndex(i => i.Path === path) + let ps = null + if (psIndex > -1 && this.psArr[psIndex].PS) { + ps = parseFloat(this.psArr[psIndex].PS).toFixed(3) + } + annotation.ps = ps + this.$emit('getEcrf', { type: "bindAnnotationToQuestion", VisitTaskId: this.taskInfo.VisitTaskId, annotation }) } } }, @@ -1291,38 +1303,36 @@ export default { const cachedStats = Object.keys(annotation.data.cachedStats) ps = parseFloat(value) / annotation.data.cachedStats[cachedStats[0]].length annotation.data.ps = ps - this.$emit('setPS', { NoneDicomFileId: fileList[fileIndex].Id, Path: fileList[fileIndex].Path, PS: ps, OldPS: 1 }) + this.$emit('setPS', { NoneDicomFileId: fileList[fileIndex].Id, Path: fileList[fileIndex].Path, PS: ps }) } else { cornerstoneTools.annotation.state.removeAnnotation(annotation.annotationUID) return } if (this.customizeStandardsNoneDicom.find(item => item.toolName === annotation.metadata?.toolName)) return false this.dialogVisible = false - if (this.saveCustomAnnotationTimer) { - clearTimeout(this.saveCustomAnnotationTimer) - this.saveCustomAnnotationTimer = null - } - let psIndex = this.psArr.findIndex(p => p.NoneDicomFileId === fileList[fileIndex].Id) - let OldPS = 1 - if (psIndex > -1) { - OldPS = this.psArr[psIndex].OldPS - } - let Proportion = ps / OldPS - return this.saveCustomAnnotationTimer = setTimeout(async () => { - if (!this.ecrf.IsHaveBindingQuestion) { - this.saveCustomAnnotation(annotation) - } else { - await this.$confirm( - this.$t('trials:trials-list:table:allQuestionChange') - ).then(() => { - this.saveCustomAnnotation(annotation, Proportion) - }) - .catch(action => { - this.saveCustomAnnotation(annotation, -1) - }); + this.$emit('getEcrf', { type: "verifyFileIsBound", VisitTaskId: this.taskInfo.VisitTaskId, annotation }) + this.$nextTick(() => { + if (this.saveCustomAnnotationTimer) { + clearTimeout(this.saveCustomAnnotationTimer) + this.saveCustomAnnotationTimer = null } - }, 500) - this.saveCustomAnnotationTimer = setTimeout(() => { this.saveCustomAnnotation(annotation) }, 500) + return this.saveCustomAnnotationTimer = setTimeout(async () => { + if (!this.ecrf.IsHaveBindingQuestion || !this.ecrf.isFileBound) { + this.saveCustomAnnotation(annotation) + } else { + await this.$confirm( + this.$t('trials:trials-list:table:allQuestionChange') + ).then(() => { + this.saveCustomAnnotation(annotation, 1) + }) + .catch(action => { + this.saveCustomAnnotation(annotation, -1) + }); + } + }, 500) + this.saveCustomAnnotationTimer = setTimeout(() => { this.saveCustomAnnotation(annotation) }, 500) + }) + }, getLengthscaleToolTextLines(data, targetId) { const cachedVolumeStats = data.cachedStats[targetId] @@ -1696,6 +1706,40 @@ export default { e.stopPropagation() e.preventDefault() }, + contentMouseup(e, index) { + console.log('contentMouseup') + const i = this.viewportInfos.findIndex(i => i.index === index) + if (i === -1) return + if (this.curOperation.type === 'Modified') { + let annotation = this.curOperation.annotation + if (annotation.metadata.toolName === 'Lengthscale') { + this.$emit('getEcrf', { type: "verifyFileIsBound", VisitTaskId: this.taskInfo.VisitTaskId, annotation }) + this.$nextTick(() => { + if (!this.ecrf.IsHaveBindingQuestion || !this.ecrf.isFileBound) { + this.saveCustomAnnotation(annotation) + } else { + this.$confirm( + this.$t('trials:trials-list:table:allQuestionChange') + ).then(() => { + this.saveCustomAnnotation(annotation, 1) + }) + .catch(action => { + this.saveCustomAnnotation(annotation, -1) + }); + } + }) + } else { + this.saveCustomAnnotation(annotation) + } + } + this.curOperation = { + type: '', + annotation: null + } + // e.stopImmediatePropagation() + // e.stopPropagation() + // e.preventDefault() + }, handleIframeMessage(event) { if (event.data.type === 'pdf-clicked') { const baseUrl = event.data.data.baseUrl diff --git a/src/views/trials/trials-panel/reading/visit-review/components/ReadPage.vue b/src/views/trials/trials-panel/reading/visit-review/components/ReadPage.vue index 61bd51b8..eaa9ee44 100644 --- a/src/views/trials/trials-panel/reading/visit-review/components/ReadPage.vue +++ b/src/views/trials/trials-panel/reading/visit-review/components/ReadPage.vue @@ -180,6 +180,9 @@ export default { if (type === 'changePlottingScaleChangeAnswer') { this.ecrf.isBound = this.$refs[`ecrf_${data.VisitTaskId}`][0].changePlottingScaleChangeAnswer(data) } + if (type === 'verifyFileIsBound') { + this.ecrf.isFileBound = this.$refs[`ecrf_${data.VisitTaskId}`][0].verifyFileIsBound(data.annotation) + } }, setSaved(saved) { this.$refs.fileViewer.lengthscaleToolDisabled(saved) @@ -203,7 +206,7 @@ export default { } this.psArr = [] if (i.MeasureData.metadata.toolName === 'Lengthscale' && this.psArr.findIndex(p => p.NoneDicomFileId === i.NoneDicomFileId) === -1) { - this.psArr.push({ NoneDicomFileId: i.NoneDicomFileId, Path: i.Path, PS: i.MeasureData.data.ps, OldPS: i.MeasureData.data.ps }) + this.psArr.push({ NoneDicomFileId: i.NoneDicomFileId, Path: i.Path, PS: i.MeasureData.data.ps }) } return i }) @@ -314,7 +317,7 @@ export default { i.MeasureData.id = i.Id } if (i.MeasureData.metadata.toolName === 'Lengthscale' && this.psArr.findIndex(p => p.NoneDicomFileId === i.NoneDicomFileId) === -1) { - this.psArr.push({ NoneDicomFileId: i.NoneDicomFileId, Path: i.Path, PS: i.MeasureData.data.ps, OldPS: i.MeasureData.data.ps }) + this.psArr.push({ NoneDicomFileId: i.NoneDicomFileId, Path: i.Path, PS: i.MeasureData.data.ps }) } return i })