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 @@ /> @@ -240,11 +245,12 @@ @@ -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 @@ @@ -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 {