From 2c0823f027684b7c2821a50e04ca95316ccde246 Mon Sep 17 00:00:00 2001
From: wangxiaoshuang <825034831@qq.com>
Date: Wed, 25 Jun 2025 09:15:09 +0800
Subject: [PATCH] =?UTF-8?q?=E9=98=85=E7=89=87=E8=A1=A8=E5=8D=95=E6=95=B0?=
=?UTF-8?q?=E5=80=BC=E9=97=AE=E9=A2=98=E5=8F=AF=E8=BE=93=E5=85=A5NE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../customize/CustomizeQuestionFormItem.vue | 36 ++++++++++++---
.../CustomizeQuestionTableFormItem.vue | 45 ++++++++++++++++---
.../customize/CustomizeQuestionsPreview.vue | 8 ++--
.../reading/dicoms3D/components/Viewport.vue | 3 +-
.../components/customize/QuestionList.vue | 11 +++--
.../components/customize/ReportPage.vue | 6 +--
6 files changed, 83 insertions(+), 26 deletions(-)
diff --git a/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionFormItem.vue b/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionFormItem.vue
index 8889bae9..9cedaded 100644
--- a/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionFormItem.vue
+++ b/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionFormItem.vue
@@ -69,6 +69,10 @@
:rules="[
{ required: (question.IsRequired === 0 || (question.IsRequired ===1 && question.RelevanceId && (question.RelevanceValueList.includes(isNaN(parseFloat(questionForm[question.RelevanceId])) ? questionForm[question.RelevanceId] : questionForm[question.RelevanceId].toString())))) && question.Type!=='group' && question.Type!=='summary',
message: $t('common:ruleMessage:specify'), trigger: ['blur', 'change']},
+ {
+ validator: question.Type === 'number' && !question.TypeValue ? validatorNumberInput :(rule,value,callback )=>{callback()},
+ trigger: ['blur', 'change']
+ }
]"
:class="[question.Type==='group'?'mb':question.Type==='upload'?'uploadWrapper':'']"
>
@@ -228,11 +232,12 @@
/>
{ formItemNumberChange(val, question) }"
+ @input="numberInput(question.Id)"
@blur="handleBlur(questionForm[question.Id], questionForm, question.Id)"
- v-model="questionForm[question.Id]"
+ v-model.trim="questionForm[question.Id]"
:disabled="readingTaskState === 2"
>
@@ -240,11 +245,12 @@
%
{{question.Unit !== 4 ? $fd('ValueUnit', question.Unit) : question.CustomUnit}}
@@ -502,6 +508,21 @@ export default {
}
},
methods: {
+ numberInput(id) {
+ this.questionForm[id] = this.questionForm[id].toUpperCase();
+ },
+ validatorNumberInput(rule, value, callback) {
+ let reg = new RegExp(/^(?:-?(?:(?:0|[1-9]\d*)(?:\.\d+)?|\.\d+)|NE)$/, 'g')
+ if (value === '') {
+ callback(new Error(this.$t('common:ruleMessage:specify')));
+ } else {
+ if (!reg.test(value)) {
+ callback(new Error(this.$t('trials:reading:ruleMessage:validatorNumberInput')));
+ }else{
+ callback();
+ }
+ }
+ },
limitInput(value, a, b) {
if (value.indexOf('.') > -1) {
if (value.split('.')[1].length >= this.digitPlaces) {
@@ -510,7 +531,10 @@ export default {
}
},
handleBlur(value, a, b) {
- this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces))
+ if (!value) return false
+ if(!isNaN(parseFloat(value))) {
+ this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces))
+ }
},
deleteTableCol(row, index) {
this.$confirm(this.$t('trials:uploadNonDicoms:message:msg1')).then(() => {
@@ -1085,8 +1109,6 @@ export default {
flex-direction: row;
align-items: flex-start;
}
- ::v-deep .el-form-item__content{
- }
.el-input{
width:100%;
}
diff --git a/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionTableFormItem.vue b/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionTableFormItem.vue
index 3163f2c9..2cfe9365 100644
--- a/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionTableFormItem.vue
+++ b/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionTableFormItem.vue
@@ -7,6 +7,10 @@
:rules="[
{ required: (question.IsRequired === 0 || (question.IsRequired ===1 && question.RelevanceId && !!~question.RelevanceValueList.indexOf(questionForm[question.RelevanceId]))) && question.Type!=='group' && question.Type!=='summary',
message: $t('common:ruleMessage:select'), trigger: ['blur', 'change']},
+ {
+ validator: question.Type === 'number' && !question.TypeValue ? validatorNumberInput :(rule,value,callback )=>{callback()},
+ trigger: ['blur', 'change']
+ }
]"
:class="[question.Type==='group'?'mb':question.Type==='upload'?'uploadWrapper':'']"
>
@@ -144,21 +148,23 @@
{formItemNumberChange(val, question)})"
+ @input="numberInput(question.Id)"
@blur="handleBlur(questionForm[question.Id], questionForm, question.Id)"
- v-model="questionForm[question.Id]"
+ v-model.trim="questionForm[question.Id]"
>
{{question.Unit !== 4 ? $fd('ValueUnit', question.Unit) : question.CustomUnit}}
{{question.Unit !== 4 ? $fd('ValueUnit', question.Unit) : question.CustomUnit}}
@@ -331,7 +337,6 @@ export default {
this.fileList.push({ name: '', url: `${url}` })
})
}
- console.log('11')
}
if (this.type === 'edit') return
// if (this.question.Type === 'number') {
@@ -342,6 +347,25 @@ export default {
// }
},
methods: {
+ numberInput(id,notId = false) {
+ if(notId ) {
+ this.calculationValue = this.calculationValue.toUpperCase();
+ }else {
+ this.questionForm[id] = this.questionForm[id].toUpperCase();
+ }
+ },
+ validatorNumberInput(rule, value, callback) {
+ let reg = new RegExp(/^(?:-?(?:(?:0|[1-9]\d*)(?:\.\d+)?|\.\d+)|NE)$/, 'g')
+ if (value === '') {
+ callback(new Error(this.$t('common:ruleMessage:specify')));
+ } else {
+ if (!reg.test(value)) {
+ callback(new Error(this.$t('trials:reading:ruleMessage:validatorNumberInput')));
+ }else{
+ callback();
+ }
+ }
+ },
save() {
},
openAddTableCol(row) {
@@ -382,10 +406,17 @@ export default {
}
},
handleBlur(value, a, b) {
- this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces))
+ if (!value) return false
+ if(!isNaN(parseFloat(value))) {
+ this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces))
+ }
+ // this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces))
},
handleCalculationBlur(v) {
- this.calculationValue = parseFloat(v).toFixed(this.digitPlaces)
+ if (!v) return false
+ if(!isNaN(parseFloat(v))) {
+ this.calculationValue = parseFloat(v).toFixed(this.digitPlaces)
+ }
},
limitInput(value, q) {
console.log(value)
diff --git a/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionsPreview.vue b/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionsPreview.vue
index de1cffe6..46bf4690 100644
--- a/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionsPreview.vue
+++ b/src/views/trials/trials-panel/reading/dicoms/customize/CustomizeQuestionsPreview.vue
@@ -137,7 +137,7 @@ export default {
this.classArr.push({triggerId: v.ClassifyQuestionId, classId: v.Id, classifyAlgorithms: v.ClassifyAlgorithms, classifyType: v.ClassifyType})
}
if (v.Type === 'number') {
- this.$set(this.questionForm, v.Id, v.Answer === '' ? '' : parseFloat(v.Answer).toFixed(this.digitPlaces))
+ this.$set(this.questionForm, v.Id, isNaN(parseFloat(v.Answer)) ? v.Answer : parseFloat(v.Answer).toFixed(this.digitPlaces))
}
if (v.Childrens.length > 0) {
this.setChild(v.Childrens)
@@ -191,7 +191,7 @@ export default {
this.$set(this.questionForm, v.Id, v.TableQuestions.Answers)
}
if (v.Type === 'number') {
- this.$set(this.questionForm, v.Id, v.Answer === '' ? '' : parseFloat(v.Answer).toFixed(this.digitPlaces))
+ this.$set(this.questionForm, v.Id, isNaN(parseFloat(v.Answer)) ? v.Answer : parseFloat(v.Answer).toFixed(this.digitPlaces))
}
if (v.Childrens.length > 0) {
this.setChild(v.Childrens)
@@ -212,7 +212,7 @@ export default {
i.TableQuestions.Questions.forEach(o => {
if (o.Type === 'number') {
i.TableQuestions.Answers.forEach((ite, index) => {
- this.$set(i.TableQuestions.Answers[index], o.Id, i.TableQuestions.Answers[index][o.Id] ? parseFloat(i.TableQuestions.Answers[index][o.Id]).toFixed(this.digitPlaces) : null)
+ 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))
})
}
})
@@ -222,7 +222,7 @@ export default {
this.classArr.push({triggerId: i.ClassifyQuestionId, classId: i.Id, classifyAlgorithms: i.ClassifyAlgorithms, classifyType: i.ClassifyType})
}
if (i.Type === 'number') {
- this.$set(this.questionForm, i.Id, i.Answer === '' ? '' : parseFloat(i.Answer).toFixed(this.digitPlaces))
+ this.$set(this.questionForm, i.Id, isNaN(parseFloat(i.Answer)) ? i.Answer : parseFloat(i.Answer).toFixed(this.digitPlaces))
}
if (i.Childrens && i.Childrens.length > 0) {
this.setChild(i.Childrens)
diff --git a/src/views/trials/trials-panel/reading/dicoms3D/components/Viewport.vue b/src/views/trials/trials-panel/reading/dicoms3D/components/Viewport.vue
index f236ed60..025945ef 100644
--- a/src/views/trials/trials-panel/reading/dicoms3D/components/Viewport.vue
+++ b/src/views/trials/trials-panel/reading/dicoms3D/components/Viewport.vue
@@ -402,7 +402,8 @@ export default {
this.series = { ...obj }
const renderingEngine = getRenderingEngine(this.renderingEngineId)
const viewport = renderingEngine.getViewport(this.viewportId)
- const image = await cornerstoneDICOMImageLoader.wadouri.loadImage(obj.ImageIds[obj.SliceIndex]).promise
+ let imageId = obj.ImageIds[obj.SliceIndex] ? obj.ImageIds[obj.SliceIndex] : obj.ImageIds[0]
+ const image = await cornerstoneDICOMImageLoader.wadouri.loadImage(imageId).promise
if (obj.Modality === 'PT') {
this.cachePTMetadata([image])
}
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 e4b1d01c..453bbe38 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
@@ -112,7 +112,8 @@ export default {
calculationList: [],
taskInfo: null,
isBaseLineTask: false,
- rerender: true
+ rerender: true,
+ digitPlaces: 2
}
},
mounted() {
@@ -121,6 +122,8 @@ export default {
this.taskInfo = JSON.parse(localStorage.getItem('taskInfo'))
this.isBaseLineTask = this.taskInfo.IsBaseLine
this.criterionType = this.taskInfo.CriterionType
+ var digitPlaces = Number(localStorage.getItem('digitPlaces'))
+ this.digitPlaces = digitPlaces === -1 ? this.digitPlaces : digitPlaces
this.getQuestionCalculateRelation()
this.getQuestions()
},
@@ -146,7 +149,7 @@ export default {
this.classArr.push({ triggerId: v.ClassifyQuestionId, classId: v.Id, classifyAlgorithms: v.ClassifyAlgorithms, classifyType: v.ClassifyType })
}
if (v.Type === 'number') {
- this.$set(this.questionForm, v.Id, v.Answer === '' ? '' : parseFloat(v.Answer).toFixed(this.digitPlaces))
+ this.$set(this.questionForm, v.Id, isNaN(parseFloat(v.Answer)) ? v.Answer : parseFloat(v.Answer).toFixed(this.digitPlaces))
}
if (v.Childrens.length > 0) {
this.setChild(v.Childrens)
@@ -169,7 +172,7 @@ export default {
i.TableQuestions.Questions.forEach(o => {
if (o.Type === 'number') {
i.TableQuestions.Answers.forEach((ite, index) => {
- this.$set(i.TableQuestions.Answers[index], o.Id, i.TableQuestions.Answers[index][o.Id] ? parseFloat(i.TableQuestions.Answers[index][o.Id]).toFixed(this.digitPlaces) : null)
+ 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))
})
}
})
@@ -179,7 +182,7 @@ export default {
this.classArr.push({ triggerId: i.ClassifyQuestionId, classId: i.Id, classifyAlgorithms: i.ClassifyAlgorithms, classifyType: i.ClassifyType })
}
if (i.Type === 'number') {
- this.$set(this.questionForm, i.Id, i.Answer === '' ? '' : parseFloat(i.Answer).toFixed(this.digitPlaces))
+ this.$set(this.questionForm, i.Id, isNaN(parseFloat(i.Answer)) ? i.Answer : parseFloat(i.Answer).toFixed(this.digitPlaces))
}
if (i.Childrens && i.Childrens.length > 0) {
this.setChild(i.Childrens)
diff --git a/src/views/trials/trials-panel/reading/dicoms3D/components/customize/ReportPage.vue b/src/views/trials/trials-panel/reading/dicoms3D/components/customize/ReportPage.vue
index 03329d16..1c53660e 100644
--- a/src/views/trials/trials-panel/reading/dicoms3D/components/customize/ReportPage.vue
+++ b/src/views/trials/trials-panel/reading/dicoms3D/components/customize/ReportPage.vue
@@ -396,7 +396,7 @@ export default {
if (v.Type === 'number') {
let val = null
if (v.ValueType === 0) {
- val = parseInt(v.Answers[this.visitTaskId])
+ val = isNaN(parseFloat(v.Answers[this.visitTaskId])) ? v.Answers[this.visitTaskId] : parseInt(v.Answers[this.visitTaskId])
} else if (v.ValueType === 3) {
val = v.Answers[this.visitTaskId]
} else {
@@ -422,7 +422,7 @@ export default {
if (i.Type === 'number') {
let val = null
if (i.ValueType === 0) {
- val = parseInt(i.Answers[this.visitTaskId])
+ val = isNaN(parseFloat(i.Answers[this.visitTaskId])) ? i.Answers[this.visitTaskId] : parseInt(i.Answers[this.visitTaskId])
} else if (i.ValueType === 3) {
val = i.Answers[this.visitTaskId]
} else {
@@ -561,7 +561,7 @@ export default {
if (item.Type === 'number') {
let val = null
if (item.ValueType === 0) {
- val = parseInt(i.Answer)
+ val = isNaN(parseFloat(i.Answer)) ? i.Answer : parseInt(i.Answer)
} else if (item.ValueType === 3) {
val = i.Answer
} else {