数值问题答案为NE保存bug修复

uat
caiyiling 2026-03-04 11:26:48 +08:00
parent 1f51bbd178
commit da252ae4df
2 changed files with 16 additions and 5 deletions

View File

@ -114,7 +114,7 @@
v-else
type="number"
@change="(val) => { formItemChange(val, item) }"
@input="(val) => questionForm[item.Id] = val.replace(/[^\d.]/g, '')"
@input="numberInput(item.Id)"
@blur="handleBlur(questionForm[item.Id], questionForm, item)"
v-model.trim="questionForm[item.Id]" :disabled="readingTaskState === 2">
<template slot="append" v-if="item.Unit !== 0">{{ item.Unit !== 4 ? $fd('ValueUnit', item.Unit) : item.CustomUnit }}</template>
@ -369,7 +369,7 @@ export default {
const type = ['number', 'radio', 'select', 'input', 'textarea', 'calculation']
questions.forEach(item => {
if (type.includes(item.Type)) {
const answer = item.Type === 'select' && item.OptionTypeEnum === 1 && item.Answer ? JSON.parse(item.Answer) : item.Type === 'number' || item.Type === 'calculation' ? isNaN(parseFloat(item.Answer)) ? null : item.Answer : item.Answer
const answer = item.Type === 'select' && item.OptionTypeEnum === 1 && item.Answer ? JSON.parse(item.Answer) : item.Answer
this.$set(this.questionForm, item.Id, answer)
}
if (item.QuestionType === 1013) {
@ -498,7 +498,6 @@ export default {
},
formItemChange(val, item) {
console.log('formItemChange: ', item.QuestionName, val)
this.formChanged = true
// if (item.Type === 'number') {
// this.limitBlur(item.Id, item.ValueType)
@ -546,6 +545,7 @@ export default {
}
},
numberOrNEInput(id) {
this.formChanged = true
// this.questionForm[id] = this.questionForm[id].toUpperCase();
if (!this.questionForm[id]) {
return
@ -564,6 +564,11 @@ export default {
this.questionForm[id] = value
this.$set(this.questionForm, id, value)
},
numberInput(id) {
this.formChanged = true
let value = this.questionForm[id].replace(/[^\d.]/g, '')
this.$set(this.questionForm, id, value)
},
handleNumberOrNEBlur(item) {
if (this.questionForm[item.Id] && !isNaN(parseFloat(this.questionForm[item.Id]))) {
if (item.ValueType === 3) {

View File

@ -122,7 +122,7 @@
v-else
type="number"
@change="(val) => { formItemChange(val, item) }"
@input="(val) => questionForm[item.Id] = val.replace(/[^\d.]/g, '')"
@input="numberInput(item.Id)"
@blur="handleBlur(questionForm[item.Id], questionForm, item)"
v-model.trim="questionForm[item.Id]" :disabled="readingTaskState === 2">
<template slot="append" v-if="item.Unit !== 0">{{ item.Unit !== 4 ? $fd('ValueUnit', item.Unit) : item.CustomUnit }}</template>
@ -369,7 +369,7 @@ export default {
const type = ['number', 'radio', 'select', 'input', 'textarea', 'calculation']
questions.forEach(item => {
if (type.includes(item.Type)) {
const answer = item.Type === 'select' && item.OptionTypeEnum === 1 && item.Answer ? JSON.parse(item.Answer) : item.Type === 'number' || item.Type === 'calculation' ? isNaN(parseFloat(item.Answer)) ? null : item.Answer : item.Answer
const answer = item.Type === 'select' && item.OptionTypeEnum === 1 && item.Answer ? JSON.parse(item.Answer) : item.Answer
this.$set(this.questionForm, item.Id, answer)
}
if (item.QuestionType === 1013) {
@ -541,6 +541,7 @@ export default {
}
},
numberOrNEInput(id) {
this.formChanged = true
// this.questionForm[id] = this.questionForm[id].toUpperCase();
if (!this.questionForm[id]) {
return
@ -559,6 +560,11 @@ export default {
this.questionForm[id] = value
this.$set(this.questionForm, id, value)
},
numberInput(id) {
this.formChanged = true
let value = this.questionForm[id].replace(/[^\d.]/g, '')
this.$set(this.questionForm, id, value)
},
handleNumberOrNEBlur(item) {
if (this.questionForm[item.Id] && !this.questionForm[item.Id].startsWith('N')) {
if (item.ValueType === 3) {