diff --git a/src/store/getters.js b/src/store/getters.js index 2d0a5744..70d1a6bd 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -50,6 +50,8 @@ const getters = { IsFirstSysDocNeedSign: state => state.user.IsFirstSysDocNeedSign, TrialStatusStr: state => state.user.TrialStatusStr, lastViewportTaskId: state => state.noneDicomReview.lastViewportTaskId, - currentTaskState: state => state.noneDicomReview.currentTaskState + currentTaskState: state => state.noneDicomReview.currentTaskState, + operateInfo: state => state.dicom3d.operateInfo, + deleteAnnotationIds: state => state.dicom3d.deleteAnnotationIds } export default getters diff --git a/src/store/index.js b/src/store/index.js index 9a91ddcd..d4c9477c 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -13,6 +13,7 @@ import financials from './modules/financials' import reading from './modules/reading' import lang from './modules/lang' import noneDicomReview from './modules/noneDicomReview' +import dicom3d from './modules/dicom3d' Vue.use(Vuex) const store = new Vuex.Store({ @@ -28,7 +29,8 @@ const store = new Vuex.Store({ financials, reading, lang, - noneDicomReview + noneDicomReview, + dicom3d }, getters }) diff --git a/src/store/modules/dicom3d.js b/src/store/modules/dicom3d.js new file mode 100644 index 00000000..486a5c08 --- /dev/null +++ b/src/store/modules/dicom3d.js @@ -0,0 +1,28 @@ +const getDefaultState = () => { + return { + operateInfo: {}, + deleteAnnotationIds: [] + } +} +const state = getDefaultState + +const mutations = { + +} + +const actions = { + setOperateInfo({ state }, obj) { + state.operateInfo = Object.assign({}, obj) + }, + setDeleteAnnotationIds({ state }, arr) { + state.deleteAnnotationIds = Object.assign({}, obj) + }, +} + +export default { + namespaced: true, + state, + mutations, + actions +} + diff --git a/src/views/trials/trials-panel/reading/dicoms3D/components/ReadPage.vue b/src/views/trials/trials-panel/reading/dicoms3D/components/ReadPage.vue index 9eba66c0..466ff424 100644 --- a/src/views/trials/trials-panel/reading/dicoms3D/components/ReadPage.vue +++ b/src/views/trials/trials-panel/reading/dicoms3D/components/ReadPage.vue @@ -438,6 +438,7 @@ @resetAnnotations="resetAnnotations" @setReadingTaskState="setReadingTaskState" @viewCustomAnnotationSeries="viewCustomAnnotationSeries" + @getCustomScreenshots="getCustomScreenshots" @setReadingToolActive="setReadingToolActive" @setReadingToolPassive="setReadingToolPassive" /> @@ -562,6 +563,8 @@ import * as cornerstoneTools from '@cornerstonejs/tools' import initLibraries from '@/views/trials/trials-panel/reading/dicoms/components/Fusion/js/initLibraries' import html2canvas from 'html2canvas' import { getTools, getCustomizeStandardsTools, config } from './toolConfig' +import { mapGetters } from 'vuex' +import store from '@/store' import StudyList from './StudyList' import Viewport from './Viewport' import PetCtViewport from './PetCtViewport' @@ -751,7 +754,7 @@ export default { }, viewportKey() { return this.isFusion ? 'viewport-fusion' : 'viewport' - } + }, }, watch: { activeTaskId: { @@ -1450,15 +1453,19 @@ export default { annotation.numberOfFrames = isNaN(parseInt(params.frame)) ? null : parseInt(params.frame) annotation.markTool = annotation.metadata.toolName this.markedSeriesIds.push(series.Id) - const markName = await this.customPrompt() + const operateStateEnum = this.$refs[`ecrf_${this.taskInfo.VisitTaskId}`][0].operateStateEnum + const markName = await this.customPrompt(!this.isNumber(operateStateEnum)) if (markName) { annotation.data.label = markName if (annotation.metadata.toolName === 'ArrowAnnotate') { annotation.data.text = markName } - this.saveCustomAnnotation(annotation) - this.$refs[`ecrf_${series.TaskInfo.VisitTaskId}`][0].bindAnnotationToQuestion(annotation) + if (this.isNumber(operateStateEnum)) { + this.$refs[`ecrf_${series.TaskInfo.VisitTaskId}`][0].bindAnnotationToQuestion(annotation) + } else { + this.saveCustomAnnotation(annotation) + } } } @@ -1500,8 +1507,13 @@ export default { if (annotation.metadata.toolName === 'PlanarFreehandROI' && !annotation.data.contour.closed) return const series = this.$refs[`${this.viewportKey}-${this.activeViewportIndex}`][0].series if (series && series.TaskInfo.VisitTaskId && series.TaskInfo.VisitTaskId === this.taskInfo.VisitTaskId) { - this.saveCustomAnnotation(annotation) - this.$refs[`ecrf_${series.TaskInfo.VisitTaskId}`][0].updateAnnotationToQuestion(annotation) + const operateStateEnum = this.$refs[`ecrf_${this.taskInfo.VisitTaskId}`][0].operateStateEnum + const isBound = this.$refs[`ecrf_${annotation.visitTaskId}`][0].verifyAnnotationIsBound(annotation) + if (isBound || this.isNumber(operateStateEnum)) { + this.$refs[`ecrf_${series.TaskInfo.VisitTaskId}`][0].updateAnnotationToQuestion(annotation) + } else { + this.saveCustomAnnotation(annotation) + } } this.setToolsPassive() }, @@ -1521,7 +1533,7 @@ export default { } if (annotation.visitTaskId === this.taskInfo.VisitTaskId) { const isBound = this.$refs[`ecrf_${annotation.visitTaskId}`][0].verifyAnnotationIsBound(annotation) - if (isBound) { + if (isBound && this.activeTool === 'Eraser') { this.$alert('该标记已与问题进行绑定,不允许删除!') const errorMsg = { message: 'annotation Not allowed to operate' } throw errorMsg @@ -2589,6 +2601,23 @@ export default { this.$refs[series.TaskInfo.VisitTaskId][0].setSeriesActive(series.StudyIndex, series.SeriesIndex) } }, + async getCustomScreenshots(obj, callback) { + const i = this.visitTaskList.findIndex(i => i.VisitTaskId === obj.visitTaskId) + if (i === -1) return + const studyList = this.visitTaskList[i].StudyList + const series = this.getMarkedSeries(studyList, obj.annotation) + if (series) { + this.$refs[`${this.viewportKey}-${this.cells.length - 1}`][0].setSeriesInfo(series, true) + this.activeViewportIndex = i + this.$refs[series.TaskInfo.VisitTaskId][0].setSeriesActive(series.StudyIndex, series.SeriesIndex) + const divForDownloadViewport = document.querySelector( + `div[data-viewport-uid="${this.viewportKey}-${this.activeViewportIndex}"]` + ) + const canvas = await html2canvas(divForDownloadViewport) + const base64Str = canvas.toDataURL('image/png', 1) + callback(base64Str) + } + }, async getScreenshots(measureData, callback) { if (measureData) { await this.imageLocation(measureData) @@ -2787,12 +2816,13 @@ export default { return params }, // 输入标记名称自定义弹窗 - async customPrompt() { + async customPrompt(isShowCancelButton = true) { try { const that = this // 请输入标记名称 const { value } = await this.$prompt(this.$t('trials:noneDicom:message:msg1'), '', { showClose: false, + showCancelButton: isShowCancelButton, beforeClose: (action, instance, done) => { if (action === 'confirm') { const value = instance.inputValue @@ -2813,6 +2843,9 @@ export default { return null } }, + isNumber(value) { + return typeof value === 'number' && value !== null && !isNaN(value) + }, showPanel(e, toolName) { if (toolName === 'layout' && this.isFusion) return false e.currentTarget.firstChild.lastChild.style.display = 'block' 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 fb4cf890..5edd289e 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 @@ -54,12 +54,64 @@ {{$t('common:button:edit')}} - + {{$t('common:button:delete')}} + + + + + + + + + {{ $t('common:button:cancel') }} + + + + {{ $t('common:button:save') }} + + + { formItemNumberChange(val, question) }" @blur="questionsMarkStatus[question.Id] && questionsMarkStatus[question.Id].isMarked ? ()=>{} : handleMarkedQsBlur(questionForm[question.Id], questionForm, question.Id, question) " v-model="questionForm[question.Id]" - :disabled="(questionsMarkStatus[question.Id].isMarked && question.ImageMarkEnum === 2) || question.ImageMarkEnum === 1" + :disabled="(questionsMarkStatus[question.Id] && questionsMarkStatus[question.Id].isMarked && question.ImageMarkEnum === 2) || question.ImageMarkEnum === 1" style="width: 150px;" > @@ -243,7 +295,7 @@ - + 保存 @@ -378,51 +430,20 @@ @resetFormItemData="resetFormItemData" @getQuestions="getQuestions" @operateImageMarker="operateImageMarker" + @unBindAnnotationToQuestion="unBindAnnotationToQuestion" /> - - - - - - - - - {{ $t('common:button:cancel') }} - - - - {{ $t('common:button:save') }} - - - + + --> 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 88466a65..50c191d6 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 @@ -39,6 +39,7 @@ @setFormItemData="setFormItemData" @getQuestions="getQuestions" @operateImageMarker="operateImageMarker" + @unBindAnnotationToQuestion="unBindAnnotationToQuestion" /> @@ -79,10 +80,11 @@