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..8a05e509 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,9 +232,10 @@ /> % -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)) + let reg = new RegExp(/[a-zA-Z]/, 'ig') + if(!reg.test(value)) { + this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces)) + } }, deleteTableCol(row, index) { this.$confirm(this.$t('trials:uploadNonDicoms:message:msg1')).then(() => { 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 251666fd..42acda72 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,19 +148,21 @@ @@ -342,6 +348,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,7 +407,11 @@ export default { } }, handleBlur(value, a, b) { - this.$set(a, b, parseFloat(value).toFixed(this.digitPlaces)) + let reg = new RegExp(/[a-zA-Z]/, 'ig') + if(!reg.test(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) 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 df3e2b38..7441a60c 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 @@ -121,6 +121,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':'']" > @@ -354,9 +358,10 @@