数值问题更改
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
4ec0a178b4
commit
c0ae4732fc
|
|
@ -112,7 +112,7 @@
|
||||||
</el-input>
|
</el-input>
|
||||||
<el-input
|
<el-input
|
||||||
v-else
|
v-else
|
||||||
type="text"
|
type="number"
|
||||||
@change="(val) => { formItemChange(val, item) }"
|
@change="(val) => { formItemChange(val, item) }"
|
||||||
@input="(val) => questionForm[item.Id] = val.replace(/[^\d.]/g, '')"
|
@input="(val) => questionForm[item.Id] = val.replace(/[^\d.]/g, '')"
|
||||||
@blur="handleBlur(questionForm[item.Id], questionForm, item)"
|
@blur="handleBlur(questionForm[item.Id], questionForm, item)"
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@
|
||||||
</el-input>
|
</el-input>
|
||||||
<el-input
|
<el-input
|
||||||
v-else
|
v-else
|
||||||
type="text"
|
type="number"
|
||||||
@change="(val) => { formItemChange(val, item) }"
|
@change="(val) => { formItemChange(val, item) }"
|
||||||
@input="(val) => questionForm[item.Id] = val.replace(/[^\d.]/g, '')"
|
@input="(val) => questionForm[item.Id] = val.replace(/[^\d.]/g, '')"
|
||||||
@blur="handleBlur(questionForm[item.Id], questionForm, item)"
|
@blur="handleBlur(questionForm[item.Id], questionForm, item)"
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,16 @@
|
||||||
<div style="display: flex;justify-content: space-between;"
|
<div style="display: flex;justify-content: space-between;"
|
||||||
v-else-if="question.Type === 'number' || question.Type === 'calculation'">
|
v-else-if="question.Type === 'number' || question.Type === 'calculation'">
|
||||||
<template v-if="question.Type === 'number'">
|
<template v-if="question.Type === 'number'">
|
||||||
<el-input-number v-if="question.ValueType === 0" v-model="questionForm[question.Id]" :precision="0"
|
<el-input
|
||||||
|
v-if="question.Unit"
|
||||||
|
type="number"
|
||||||
|
@input="(val) => questionForm[question.Id] = val.replace(/[^\d.]/g, '')"
|
||||||
|
@blur="handleBlur(questionForm[question.Id], questionForm, question)"
|
||||||
|
v-model.trim="questionForm[question.Id]" :disabled="readingTaskState === 2">
|
||||||
|
<template slot="append" v-if="question.Unit !== 0">{{ question.Unit !== 4 ? $fd('ValueUnit', question.Unit) : question.CustomUnit }}</template>
|
||||||
|
<template slot="append" v-else-if="question.ValueType === 2">%</template>
|
||||||
|
</el-input>
|
||||||
|
<el-input-number v-else-if="question.ValueType === 0" v-model="questionForm[question.Id]" :precision="0"
|
||||||
:disabled="readingTaskState >= 2 || isFirstChangeTask" />
|
:disabled="readingTaskState >= 2 || isFirstChangeTask" />
|
||||||
<el-input-number v-else-if="question.ValueType === 3" v-model="questionForm[question.Id]"
|
<el-input-number v-else-if="question.ValueType === 3" v-model="questionForm[question.Id]"
|
||||||
:disabled="readingTaskState >= 2 || isFirstChangeTask" />
|
:disabled="readingTaskState >= 2 || isFirstChangeTask" />
|
||||||
|
|
@ -387,8 +396,22 @@ export default {
|
||||||
this.fileList.splice(this.fileList.findIndex(f => f.url === file.url), 1)
|
this.fileList.splice(this.fileList.findIndex(f => f.url === file.url), 1)
|
||||||
this.urls.splice(this.fileList.findIndex(f => f === file.url), 1)
|
this.urls.splice(this.fileList.findIndex(f => f === file.url), 1)
|
||||||
this.$emit('setFormItemData', { key: this.question.Id, val: this.urls.length > 0 ? this.urls.join('|') : '' })
|
this.$emit('setFormItemData', { key: this.question.Id, val: this.urls.length > 0 ? this.urls.join('|') : '' })
|
||||||
|
},
|
||||||
|
handleBlur(value, a, item) {
|
||||||
|
if (!value || item.ValueType === 3) return false
|
||||||
|
const num = parseFloat(this.questionForm[item.Id])
|
||||||
|
if (!isNaN(num)) {
|
||||||
|
this.$set(this.questionForm, item.Id, parseFloat(num).toFixed(this.digitPlaces))
|
||||||
|
if (item.ValueType === 0) {
|
||||||
|
// 整型
|
||||||
|
this.$set(this.questionForm, item.Id, parseInt(num))
|
||||||
|
} else if (item.ValueType === 1 || item.ValueType === 2){
|
||||||
|
// 小数、百分比
|
||||||
|
this.$set(this.questionForm, item.Id, parseFloat(num).toFixed(this.digitPlaces))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue