From 615cf94189bbe09be8a0eda36f056f6fbdb23ec4 Mon Sep 17 00:00:00 2001 From: wangxiaoshuang <825034831@qq.com> Date: Tue, 24 Jun 2025 10:41:10 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E6=95=B0=E5=80=BC=E7=B1=BB=E5=9E=8B=E8=BE=93=E5=85=A5=E6=A1=86?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A0=A1=E9=AA=8C=E5=85=81=E8=AE=B8=E8=BE=93?= =?UTF-8?q?=E5=85=A5NE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../customize/CustomizeQuestionFormItem.vue | 30 ++++++++++++++-- .../CustomizeQuestionTableFormItem.vue | 35 +++++++++++++++++-- .../components/customize/QuestionFormItem.vue | 31 ++++++++++++++-- .../customize/QuestionTableFormItem.vue | 35 +++++++++++++++++-- 4 files changed, 119 insertions(+), 12 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..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 @@