OCT标准FCT平均值计算逻辑更改

uat_us
caiyiling 2026-03-25 09:09:35 +08:00
parent 73f8f816b7
commit d9edaf4c27
1 changed files with 20 additions and 4 deletions

View File

@ -687,11 +687,27 @@ export default {
const m1 = this.qsForm[this.m1Id] const m1 = this.qsForm[this.m1Id]
const m2 = this.qsForm[this.m2Id] const m2 = this.qsForm[this.m2Id]
const m3 = this.qsForm[this.m3Id] const m3 = this.qsForm[this.m3Id]
if (isNaN(parseFloat(m1)) || isNaN(parseFloat(m2)) || isNaN(parseFloat(m3))) { // if (isNaN(parseFloat(m1)) || isNaN(parseFloat(m2)) || isNaN(parseFloat(m3))) {
this.$set(this.qsForm, this.avgId, null) // this.$set(this.qsForm, this.avgId, null)
} else { // } else {
const avg = (parseFloat(m1) + parseFloat(m2) + parseFloat(m3)) / 3 // const avg = (parseFloat(m1) + parseFloat(m2) + parseFloat(m3)) / 3
// this.$set(this.qsForm, this.avgId, this.numberToFixed(avg))
// }
//
const validNumbers = []
if (!isNaN(parseFloat(m1))) validNumbers.push(parseFloat(m1))
if (!isNaN(parseFloat(m2))) validNumbers.push(parseFloat(m2))
if (!isNaN(parseFloat(m3))) validNumbers.push(parseFloat(m3))
//
if (validNumbers.length > 0) {
// /
const sum = validNumbers.reduce((a, b) => a + b, 0)
const avg = sum / validNumbers.length
this.$set(this.qsForm, this.avgId, this.numberToFixed(avg)) this.$set(this.qsForm, this.avgId, this.numberToFixed(avg))
} else {
//
this.$set(this.qsForm, this.avgId, null)
} }
} }
}, },