【自定义非dicom】增加比例尺后,表格中的数据没有刷新
continuous-integration/drone/push Build is passing Details

main
wangxiaoshuang 2025-10-31 17:12:13 +08:00
parent 746278681d
commit 134f2471a6
2 changed files with 53 additions and 69 deletions

View File

@ -258,11 +258,12 @@
<template
v-if="question.Childrens && question.Childrens.length > 0 && question.Type !== 'table' && question.Type !== 'basicTable'">
<QuestionFormItem v-for="(item) in question.Childrens" :key="item.Id" :question="item" :isBaseline="isBaseline"
:reading-task-state="readingTaskState" :question-form="questionForm" :visit-task-id="visitTaskId"
:criterion-id="criterionId" :calculationList="calculationList" :questionMarkInfoList="questionMarkInfoList"
:questionsMarkStatus="questionsMarkStatus" @formItemNumberChange="formItemNumberChange"
@setFormItemData="setFormItemData" @resetFormItemData="resetFormItemData" @getQuestions="getQuestions"
@operateImageMarker="operateImageMarker" @unBindAnnotationToQuestion="unBindAnnotationToQuestion" />
:isNoneDicom="isNoneDicom" :reading-task-state="readingTaskState" :question-form="questionForm"
:visit-task-id="visitTaskId" :criterion-id="criterionId" :calculationList="calculationList"
:questionMarkInfoList="questionMarkInfoList" :questionsMarkStatus="questionsMarkStatus"
@formItemNumberChange="formItemNumberChange" @setFormItemData="setFormItemData"
@resetFormItemData="resetFormItemData" @getQuestions="getQuestions" @operateImageMarker="operateImageMarker"
@unBindAnnotationToQuestion="unBindAnnotationToQuestion" />
</template>
<!-- <base-model :config="addOrEdit"
@ -291,6 +292,11 @@ 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'
import {
utilities as csUtils
// getEnabledElementByIds
} from '@cornerstonejs/core'
import store from '@/store'
export default {
name: 'QuestionFormItem',
components: {
@ -340,6 +346,10 @@ export default {
default() {
return {}
}
},
isNoneDicom: {
type: Boolean,
default: false
}
},
data() {
@ -480,6 +490,9 @@ export default {
}
}
})
DicomEvent.$on('closeAddTableCol', (data) => {
this.handleCancel()
})
DicomEvent.$on('operateImageMarker', (data) => {
let { operateStateEnum, QuestionId, picturePath } = data
if (this.question.Id === QuestionId) {
@ -1202,11 +1215,40 @@ export default {
const hasProp = cachedStats
&& Object.prototype.hasOwnProperty.call(cachedStats, prop)
if (!hasProp) return null
const value = cachedStats[prop]
let value = cachedStats[prop]
if (this.isNoneDicom && annotation.ps && value !== null) {
let ps = annotation.ps
if (prop === 'area') {
value = this.reRound(csUtils.roundNumber(value * ps * ps), this.digitPlaces)
} else if (prop === 'length' || prop === 'perimeter') {
value = this.reRound(csUtils.roundNumber(value * ps), this.digitPlaces)
} else {
value = this.reRound(csUtils.roundNumber(value), this.digitPlaces)
}
} else if (this.isNoneDicom && value !== null) {
value = this.reRound(csUtils.roundNumber(value), this.digitPlaces)
}
return value !== null
? parseFloat(value).toFixed(this.digitPlaces)
: value
},
reRound(result, finalPrecision) {
if (typeof result === 'string' && result.includes(', ')) {
const numStrs = result.split(', ')
const processed = numStrs.map(str => this.processSingle(str, finalPrecision))
return processed.join(', ')
}
return this.processSingle(result, finalPrecision)
},
processSingle(str, precision) {
const num = parseFloat(str)
if (isNaN(num)) return 'NaN'
//
if (Math.abs(num) < 0.0001) return str
const factor = 10 ** precision
return (Math.round(num * factor + 0.0000001) / factor).toFixed(precision)
},
async beforeClose(done) {
try {
//

View File

@ -16,8 +16,8 @@
<el-form v-if="taskInfo && rerender" ref="questions" size="small" :model="questionForm" class="ecrf-form">
<template v-if="rerender">
<QuestionFormItem v-for="question of questions" :key="question.Id" :visit-task-id="visitTaskId"
:question="question" :question-form="questionForm" :reading-task-state="readingTaskState"
:criterion-id="criterionId" :calculation-list="calculationList"
:isNoneDicom="isNoneDicom" :question="question" :question-form="questionForm"
:reading-task-state="readingTaskState" :criterion-id="criterionId" :calculation-list="calculationList"
:question-mark-info-list="questionMarkInfoList" :questions-mark-status="questionsMarkStatus"
:is-baseline="isBaseLineTask" @resetFormItemData="resetFormItemData" @setFormItemData="setFormItemData"
@getQuestions="getQuestions" @operateImageMarker="operateImageMarker"
@ -200,6 +200,7 @@ export default {
i.TableQuestions.Answers.forEach((ite, index) => {
this.$set(i.TableQuestions.Answers[index], o.Id, isNaN(parseFloat(i.TableQuestions.Answers[index][o.Id])) ? i.TableQuestions.Answers[index][o.Id] : parseFloat(i.TableQuestions.Answers[index][o.Id]).toFixed(this.digitPlaces))
})
this.$set(this.questionImageToolAttributeInfo, o.Id, o.ImageToolAttribute)
}
})
this.$set(this.questionForm, i.Id, i.TableQuestions.Answers)
@ -1077,66 +1078,6 @@ export default {
receiveMsg(event) {
if (event.data.type === 'isCanActiveNoneDicomTool') {
let obj = { isCanActiveTool: true, lesionName: '', reason: '', toolName: event.data.toolName }
// this.getUnSaveTarget()
// var obj = {}
// if (this.unSaveTargets.length > 0) {
// var rowIndex = String(this.unSaveTargets[0].rowIndex)
// var questionId = this.unSaveTargets[0].questionId
// const refName = `${this.activeItem.activeCollapseId}_${this.activeItem.activeRowIndex}`
// if (rowIndex === this.activeItem.activeRowIndex && questionId === this.activeItem.activeCollapseId && !this.$refs[refName][0].questionForm.MeasureData) {
// //
// // questions.findIndex(i => i.QuestionMark === questionMark)
// var lesionType = this.$refs[refName][0].questionForm.LesionType
// if (lesionType === 0) {
// // ''
// obj = { isCanActiveTool: false, lesionName: '', reason: this.$t('trials:reading:warnning:msg18') }
// } else {
// obj = { isCanActiveTool: true, lesionName: this.$refs[refName][0].lesionMark, reason: '', toolName: event.data.toolName }
// }
// } else {
// let msg = this.$t('trials:reading:warnning:msg5')
// msg = msg.replace('xxx', this.unSaveTargets[0].lessionName)
// obj = { isCanActiveTool: false, lesionName: '', reason: msg }
// }
// } else {
// if (this.activeItem.activeCollapseId) {
// //
// const refName = `${this.activeItem.activeCollapseId}_${this.activeItem.activeRowIndex}`
// // obj = { isCanActiveTool: true, lesionName: this.$refs[refName][0].lesionMark, reason: '' }
// const lesionType = this.$refs[refName][0].questionForm.LesionType
// if (lesionType === 0) {
// //
// obj = { isCanActiveTool: false, lesionName: '', reason: this.$t('trials:reading:warnning:msg18') }
// } else {
// obj = { isCanActiveTool: true, lesionName: this.$refs[refName][0].lesionMark, reason: '', toolName: event.data.toolName }
// }
// } else {
// // /
// var qsObj = null
// var lesionName = ''
// if (this.isBaseLineTask) {
// const idx = this.tableQuestions.findIndex(item => item.LesionType === 1)
// if (idx > -1) {
// qsObj = this.tableQuestions[idx]
// }
// } else {
// const idx = this.tableQuestions.findIndex(item => item.LesionType === 2)
// if (idx > -1) {
// qsObj = this.tableQuestions[idx]
// }
// }
// // var questions = qsObj.TableQuestions.Questions.find(item => item.QuestionMark === 3)
// // if (questions) {
// // var maxIndex = this.getMaxRowIndex(qsObj.TableQuestions.Answers)
// // lesionName = `${qsObj.OrderMark}${String(maxIndex + 1).padStart(2, '0')}`
// // }
// var maxIndex = this.getMaxRowIndex(qsObj.TableQuestions.Answers)
// lesionName = `${qsObj.OrderMark}${String(maxIndex + 1).padStart(2, '0')}`
// obj = { isCanActiveTool: true, lesionName: lesionName, reason: '', toolName: event.data.toolName }
// }
// }
DicomEvent.$emit('isCanActiveNoneDicomTool', obj)
} else if (event.data.type === 'setMeasurement') {
// this.setMeasuredData(event.data.data)
@ -1155,7 +1096,8 @@ export default {
}
if (!isRemovePlottingScale) {
this.questionMarkInfoList.forEach(item => {
let prop = this.questionImageToolAttributeInfo[item.QuestionId]
DicomEvent.$emit('closeAddTableCol', { RowId: item.RowId })
let prop = this.questionImageToolAttributeInfo[item.QuestionId] || this.questionImageToolAttributeInfo[item.TableQuestionId]
if (item.Path === path && ['length', 'perimeter', 'area'].includes(prop)) {
const referencedImageId = item?.MeasureData?.metadata?.referencedImageId
if (!referencedImageId) return null